this is weird, up untill CreateSurface, everything works fine,
when i do:



invoke RtlZeroMemory,addr ddsd,SIZEOF DDSURFACEDESC
mov ddsd.dwSize,SIZEOF DDSURFACEDESC

;Windowed Mode
mov ddsd.dwFlags, DDSD_CAPS
mov ddsd.ddsCaps.dwCaps, DDSCAPS_PRIMARYSURFACE
;Create the PrimarySurface
DDINVOKE CreateSurface,g_pDD,addr ddsd,addr g_pDDS,NULL
...
...


creates:


004011A8 > C745 94 6C0000>MOV DWORD PTR SS:[EBP-6C],6C ; SIZEOF ddsd
004011AF . C745 98 010000>MOV DWORD PTR SS:[EBP-68],1 ; ddsd.dwFlags, DDSD_CAPS
004011B6 . C745 FC 000200>MOV DWORD PTR SS:[EBP-4],200 ; ddsd.ddsCaps.dwCaps, DDSCAPS_PRIMARYSURFACE
004011BD . A1 8E414000 MOV EAX,DWORD PTR DS:[40418E] ; mov eax , [this]
004011C2 . 8B00 MOV EAX,DWORD PTR DS:[EAX] ; mov eax , [eax]
004011C4 . 6A 00 PUSH 0 ; NULL
004011C6 . 68 96414000 PUSH CrazyChi.00404196 ; ADDR g_pDDS
004011CB . 8D45 94 LEA EAX,DWORD PTR SS:[EBP-6C]
004011CE . 50 PUSH EAX ; ADDR ddsd
004011CF . FF35 8E414000 PUSH DWORD PTR DS:[40418E] ; g_pDD
004011D5 . FF50 18 CALL NEAR DWORD PTR DS:[EAX+18] ; Exeption Here -> CreateSurface






DDINVOKE MACRO func, this, arglist :VARARG
mov eax , [this]
mov eax , [eax]

IFB <arglist>
INVOKE [IDirectDrawVtbl. func][eax], this
ELSE
INVOKE [IDirectDrawVtbl. func][eax], this, arglist
ENDIF
ENDM



i get an exception with EIP=0 ..
EAX's table pointer gets overRide by 'LEA EAX,DWORD PTR SS:'
very weird ..
mabye i have bad ddraw.inc ? (by Diamond Crew)
Thnx
Posted on 2004-01-01 13:25:25 by wizzra
...
/me slaps MS for declaring that DDSURFACEDESC must be Global ...
...
Posted on 2004-01-01 14:13:00 by wizzra
If you are using the BizzareCreations includes, it will error when using Blt.

The invoke will have eax changed by one of the passed parameters.

I changed the macro to use edx as the index reg.
Posted on 2004-01-02 02:31:05 by ThoughtCriminal
yes u are right, i do have same crash using Blt.
thnx i will change it to Edx!
Posted on 2004-01-02 05:06:14 by wizzra