I tried this code as 64 bit using JWasm/Polink:
option casemap:none, frame:auto
WINVER equ 500h
WIN32_LEAN_AND_MEAN equ 1
include windows.inc
includelib kernel32.lib
includelib user32.lib
.data
p1 db "Proc 1",0
p2 db "Proc 2",0
.code
;=============================================================================================================
Pr1 proc
invoke MessageBox,0, addr p1, 0, MB_OK
ret
Pr1 endp
Pr2 proc
invoke Pr1
invoke MessageBox,0, addr p2, 0, MB_OK
ret
Pr2 endp
;=============================================================================================================
WinMainCRTStartup proc
invoke Pr2
invoke ExitProcess, 0
WinMainCRTStartup endp
end WinMainCRTStartup
The exe were build, but no Messagebox appears and the program crashes.
What's my error?
If I use:
WinMainCRTStartup proc
invoke Pr1
invoke ExitProcess, 0
WinMainCRTStartup endp
One Messagebox appears and program end without error.
Need help.
Best regards,
Nordwind
the PROC directive does not generate a stack frame until the FRAME keyword is used or local variables are declared -> the stack is not correctly aligned when a call (invoke) occurs.
...
Pr1 proc frame
...-
Pr1 proc frame
...
WinMainCRTStartup proc frame
...
qWord
Quote from: Nordwind64 on February 24, 2011, 10:17:16 PM
You are right! I tested the FRAME keyword in my procs, but forgot it for the proc WinMainCRTStartup.
And I tought, if I set the option frame:auto, jwasm will build all proc automatically with the FRAME keyword... my error.
You helped me alot, thank you qWord! :U
Best regards,
Nordwind