Hi everybody,
I'm doing my first experience in 64 bit platform and I have some doubt about the struct handling.
Fistly I tried to do something like this:
; wc is a variable type WNDCLASSEX
lea rsi, wc
assume rsi: ptr WNDCLASSEX
mov [rsi].cbSize,sizeof WNDCLASSEX
assume rsi:NOTHING
But this code does not compile.
Secondly I tried this
lea rsi, wc
mov dword ptr ds:[rsi],sizeof WNDCLASSEX
but doesn't work
What is the way to handle structs in 64 bits?
Best Regards,
GUAN
This worked fine for me some months ago, when I was playing with Iczelion's tute 03:
WinMain PROC FRAME ;hInst:HINSTANCE, hPrevInst:HINSTANCE, CmdLine:LPSTR, CmdShow:DWORD
;LOCAL wc:WNDCLASSEX
;LOCAL msg:MSG
;LOCAL hwnd:HWND
push rbp
.PUSHREG rbp
sub rsp, 80t+32t+8+8
.ALLOCSTACK 80t+32t+8+8
mov rbp, rsp
.SETFRAME rbp, 0
.ENDPROLOG
wc EQU <(rbp+0).WNDCLASSEX>
msg EQU <(rbp+80t).MSG>
hwnd EQU <qword ptr (rbp+80t+32t)>
CmdShow EQU <dword ptr (rbp+80t+32t+8+8 +8+8+24t)>
CmdLine EQU <dword ptr (rbp+80t+32t+8+8 +8+8+16t)>
hPrevInst EQU <qword ptr (rbp+80t+32t+8+8 +8+8+8)>
hInst EQU <qword ptr (rbp+80t+32t+8+8 +8+8+0)>
mov [hInst], rcx
mov [hPrevInst], rdx
mov [CmdLine], r8d
mov [CmdShow], r9d
mov [wc].cbSize, SIZEOF WNDCLASSEX
mov [wc].style, CS_HREDRAW OR CS_VREDRAW
lea rax, [WndProc]
mov [wc].lpfnWndProc, rax
mov [wc].cbClsExtra, NULL
mov [wc].cbWndExtra, NULL
mov rax, [hInst]
mov [wc].hInstance, rax
mov [wc].hbrBackground, COLOR_WINDOW+1
mov [wc].lpszMenuName, NULL
lea rax, [ClassName]
mov [wc].lpszClassName, rax
...
Hi MazeGen,
Thanks for your request, but I have one doubt about it.
In 32 bit a lot of time we have a pointer to one struct in some register, i.e in esi, for handling his struct we could make.
assume esi: ptr THE NAME OF THE STRUCT
....
assume esi:NOTHING
How can we do something like this in 64 bits?
The example that you give me declares the variables for handling, but if I gave the pointer in a register ?
Best Regards,
GUAN
Yep, ASSUME doesn't seem to be supported in ML64.
You can use the longer notation though:
lea ebx, [wc]
mov [ebx].WNDCLASSEX.cbSize, SIZEOF WNDCLASSEX
OK thanks again
GUAN