Hello Vortex
I have a problem calling GdiplusStartup, it crashes.
I copied from your source code which works well and mine crashes!
Could you help me please
Philippe RIO
includelib "\Program Files\PellesC\Lib\Win64\GdiPlus.lib"
BITMAP STRUCT
bmType DWORD ?
bmWidth DWORD ?
bmHeight DWORD ?
bmWidthBytes DWORD ?
bmPlanes WORD ?
bmBitsPixel WORD ?
padding DWORD ?
bmBits QWORD ?
BITMAP ENDS
GdiplusStartupInput STRUCT
GdiplusVersion DWORD ?
DebugEventCallback DWORD ? ;; Should be QWORD I think
SuppressBackgroundThread DWORD ?
SuppressExternalCodecs DWORD ?
GdiplusStartupInput ENDS
GdipCreateBitmapFromFile PROTO :QWORD,:QWORD
GdipCreateHBITMAPFromBitmap PROTO :QWORD,:QWORD,:QWORD
GdipDisposeImage PROTO :QWORD
GdiplusStartup PROTO :QWORD,:QWORD,:QWORD
GdiplusShutdown PROTO :QWORD
.Data?
StartupInfo GdiplusStartupInput <?>
GDIPlusToken QWORD ?
.Code
ALIGN 16
UnicodeStr PROC Source:QWORD,Dest:QWORD PARMAREA=4*QWORD
xor r8d,r8d
mov r9d,1
xor eax,eax
sub rax,r9
@@:
add rax,r9
mov r8b,BYTE PTR [rcx + rax]
mov WORD PTR [rdx + rax * 2],r8w
test r8,r8
jnz @b
ret
UnicodeStr ENDP
GDIPlus_Init PROC
mov rax,OFFSET StartupInfo
mov GdiplusStartupInput.GdiplusVersion[rax],1
mov rcx,OFFSET GDIPlusToken
mov rdx,OFFSET StartupInfo
xor r8d,r8d
call GdiplusStartup
; INVOKE GdiplusStartup,ADDR GDIPlusToken,ADDR StartupInfo,0
ret
GDIPlus_Init ENDP
GDIPlus_Exit PROC
INVOKE GdiplusShutdown,GDIPlusToken + rip
ret
GDIPlus_Exit ENDP
GDIPlus_LoadFile PROC __hWnd:QWORD,__lpszFileName:QWORD PARMAREA=4*QWORD
LOCAL _hBitmap:QWORD
LOCAL _UniCodeFileName[64]:BYTE
LOCAL _BmpImage:QWORD
INVOKE UnicodeStr,__lpszFileName,ADDR _UniCodeFileName
INVOKE GdipCreateBitmapFromFile,ADDR _UniCodeFileName,ADDR _BmpImage
INVOKE GdipCreateHBITMAPFromBitmap,_BmpImage,ADDR _hBitmap,0
mov rax,_hBitmap
ret
GDIPlus_LoadFile ENDP
; **********************************************************************************
; *********************** F I N I S H E D **********************************************
; **********************************************************************************
END