Page 1 of 1
issues with svg & pdf vector drawing using x86-backend C
Posted: Mon Jan 15, 2024 9:46 am
by morosh
under x86-backend C, the following snippet didn't compiles:
Code: Select all
LoadFont(0, "Times New Roman", 20)
If StartVectorDrawing(SvgVectorOutput(GetUserDirectory(#PB_Directory_Desktop)+"test.svg", 595, 842))
VectorFont(FontID(0), 25)
MovePathCursor(20, 20)
DrawVectorText("Hello")
StopVectorDrawing() ; svg
EndIf
RunProgram(GetUserDirectory(#PB_Directory_Desktop)+"test.svg")
If StartVectorDrawing(PdfVectorOutput(GetUserDirectory(#PB_Directory_Desktop)+"test.pdf", 595, 842))
VectorFont(FontID(0), 25)
MovePathCursor(20, 20)
DrawVectorText("Hello")
StopVectorDrawing() ; pdf
EndIf
RunProgram(GetUserDirectory(#PB_Directory_Desktop)+"test.pdf")
First, there is error at:
If StartVectorDrawing(SvgVectorOutput(GetUserDirectory(#PB_Directory_Desktop)+"test.svg", 595, 842))
Then (after commenting the first svg part) there's another error at:
StopVectorDrawing() ; pdf
Re: issues with svg & pdf vector drawing using x86-backend C
Posted: Sat Jan 27, 2024 10:37 am
by Fred
I can't reproduce it here, can anybody else confirm ?
Re: issues with svg & pdf vector drawing using x86-backend C
Posted: Sun Jan 28, 2024 2:56 pm
by mk-soft
Works here
OS: VM Window 10 Pro (22H2)
Re: issues with svg & pdf vector drawing using x86-backend C
Posted: Sun Jan 28, 2024 3:19 pm
by Marc56us
Works here too.
(PB 6.10 B4 x64 and x86 - Win 10 x64)
there is error at:
Please copy/paste log

Re: issues with svg & pdf vector drawing using x86-backend C
Posted: Sun Jan 28, 2024 3:24 pm
by mk-soft
You should check whether the file already exists or whether it is open.
Code: Select all
LoadFont(0, "Times New Roman", 20)
; dummy locked file
r1 = OpenFile(0, GetUserDirectory(#PB_Directory_Desktop)+"test.svg")
output = SvgVectorOutput(GetUserDirectory(#PB_Directory_Desktop)+"test.svg", 595, 842)
If output
If StartVectorDrawing(output)
VectorFont(FontID(0), 25)
MovePathCursor(20, 20)
DrawVectorText("Hello")
StopVectorDrawing() ; svg
EndIf
RunProgram(GetUserDirectory(#PB_Directory_Desktop)+"test.svg")
Else
Debug "File locked"
EndIf
Re: issues with svg & pdf vector drawing using x86-backend C
Posted: Sun Jan 28, 2024 10:01 pm
by morosh
May be, it was an error from me
In fact, the executable format was "console", I got :
Line6:- Invalid memory access, read error at address 0
only with backend c-x86, all others modes work.
Now I changed it to "windows", and now it compiles well
Sorry for disturbing.
Re: issues with svg & pdf vector drawing using x86-backend C
Posted: Mon Jan 29, 2024 7:56 am
by juergenkulow
Do you use an Arabic version of
Windows?
Re: issues with svg & pdf vector drawing using x86-backend C
Posted: Mon Jan 29, 2024 9:41 am
by morosh
I'm using W10 which support arabic by default
I'm still wondering if using "console" as executable format is really an error, is it?, I'm not opening any window.
Re: issues with svg & pdf vector drawing using x86-backend C
Posted: Mon Jan 29, 2024 12:42 pm
by juergenkulow
Have you tried using programs like
x32dbg to find the faulty assembler command that triggers the invalid memory access in your exe file?
Re: issues with svg & pdf vector drawing using x86-backend C
Posted: Tue Jan 30, 2024 6:35 am
by juergenkulow
What information about the error is displayed?
Code: Select all
; Find Error Instruction in arabic SvgVectorOutput on Windows Console x86 C Backend
OnErrorGoto(?ErrorHandler)
LoadFont(0, "Times New Roman", 20)
If StartVectorDrawing(SvgVectorOutput(GetUserDirectory(#PB_Directory_Desktop)+"test.svg", 595, 842))
VectorFont(FontID(0), 25)
MovePathCursor(20, 20)
DrawVectorText("Hello")
StopVectorDrawing() ; svg
EndIf
;! asm("int3");
RunProgram(GetUserDirectory(#PB_Directory_Desktop)+"test.svg")
If StartVectorDrawing(PdfVectorOutput(GetUserDirectory(#PB_Directory_Desktop)+"test.pdf", 595, 842))
VectorFont(FontID(0), 25)
MovePathCursor(20, 20)
DrawVectorText("Hello")
StopVectorDrawing() ; pdf
EndIf
RunProgram(GetUserDirectory(#PB_Directory_Desktop)+"test.pdf")
End
ErrorHandler:
*eip.Quad=ErrorAddress()
*esp.Long=ErrorRegister(#PB_OnError_ESP)
s.s="eip:"+Hex(*eip)+" "+Hex(*eip\q,#PB_Quad)+#CRLF$
If ExamineAssembly(*eip, *eip+8)
If NextInstruction()
s+InstructionString() + #CRLF$
EndIf
EndIf
s+"eax:"+Hex(ErrorRegister(#PB_OnError_EAX),#PB_Long)+
" ebx:"+Hex(ErrorRegister(#PB_OnError_EBX),#PB_Long)+
" ecx:"+Hex(ErrorRegister(#PB_OnError_ECX),#PB_Long)+
" edx:"+Hex(ErrorRegister(#PB_OnError_EDX),#PB_Long)+
" ebp:"+Hex(ErrorRegister(#PB_OnError_EBP),#PB_Long)+
" esi:"+Hex(ErrorRegister(#PB_OnError_ESI),#PB_Long)+
" edi:"+Hex(ErrorRegister(#PB_OnError_EDI),#PB_Long)+#CRLF$
i=0
s+"Stack: "
Repeat
s+Hex(*esp\l,#PB_Long)+" "
If *esp\l=0
i+1
Else
i=0
EndIf
*esp+4
Until i>=5
OpenConsole()
Print(s)
Input()
End
CompilerIf #PB_Compiler_ExecutableFormat<> #PB_Compiler_Console Or #PB_Compiler_Processor<>#PB_Processor_x86 Or
#PB_Compiler_OS<>#PB_OS_Windows Or #PB_Compiler_Backend<>#PB_Backend_C
CompilerError "Please use Console on Windows x86 C Backend"
CompilerEndIf
CompilerIf #PB_Compiler_LineNumbering=0
CompilerError "Please switch Compiler Option OnError on."
CompilerEndIf
CompilerIf #PB_Compiler_Debugger=1
CompilerError "Please switch Compiler Option Start Debugger off."
CompilerEndIf
Re: issues with svg & pdf vector drawing using x86-backend C
Posted: Wed Jan 31, 2024 7:53 am
by morosh
Thanks for follow-up, that's what I got:
eip:4253DA 2BE850044203008B
mov eax, [eax]
eax:0 ebx:3FA000 ecx:24F05D0 edx:0 ebp:19FE08 esi:0 edi:6D7420
Stack: 24F47F0 40 5 24F070E 23107F9 232C856 19FE28 426850 24F05D0 0 40829800 0 408A5000 2 19FF18 401179 24F05D0 0 40829800 0 408A5000 800 808 6C7980 19FEA0 410071 6C0000 0 19FE00 6C98B8 19FF60 77A4AE30 28353D8E FFFFFFFE 19FED4 77A57B1D 0 808 6D61A8 6C0000 3FA000 0 0 6C0000 77A2FDA9 40ED51 101 77A15E6E 6D6C39 8 800 0 12 6C0000 0 6C0000 19FEF4 5F810042 19FEEC 769412A4 4D9840 FA0 0 19FF04 40896C 4D9840 FA0 0 24F05D0 D10A2785 402488 40142B 19FF30 3FA000 19FF70 401F2D 405A80 401FD9 401FD9 401F2D 1 6CEA78 6D7420 9983D7B4 401FD9 401FD9 3FA000 90081900 C0000005 518641 19FF3C 19F820 19FFCC 417E40 99D76734 0 19FF80 76AC0099 3FA000 76AC0080 19FFDC 77A37B6E 3FA000 5F81013A 0 0 3FA000 C0000005 0 769DC1A0 5475566B CD6A8EAA 0 FFFFFFFF 19F804 22E897CB 0 19FF8C 19F804 19FFE4 77A4AE30 283534F6 0 19FFEC 77A37B3E FFFFFFFF 77A58CB0 0 0 401FD9 3FA000 0 78746341 20 1 3308 DC 0 20 0 14 1 7 34 17C 1 0 0 0 0 0