Hi, this is my problem, when my program (dialog) processes a button (the correct one), it closes, I try to remedy this with the following code but it just crashes after the message box. I appreciate any help, I'm guessing I'm just forgetting some asm fundamentals.

start:


invoke GetModuleHandle,NULL
mov hInstance,eax

invoke InitCommonControls
invoke DialogBoxParam,hInstance,IDD_DIALOG1,NULL,addr DlgProc,NULL
invoke ExitProcess,0

;########################################################################

DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
mov eax,uMsg
.if eax==WM_INITDIALOG

.elseif eax==WM_COMMAND
mov eax,wParam
.if eax==1001 ; My button
jmp RegistryProc
.endif
.elseif eax==WM_CLOSE
invoke EndDialog,hWin,0
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
DlgProc endp

RegistryProc:


invoke RegOpenKeyEx, HKEY_CURRENT_USER, ADDR szRegKey, 0, KEY_WRITE, ADDR hRegKey
.IF (eax!=ERROR_SUCCESS)
invoke MessageBox,NULL,ADDR MsgBoxTextReg, ADDR MsgBoxCaption,MB_OK
.endif
jmp DlgProc
end start
Posted on 2004-11-07 05:41:02 by Nilrem2
at a guess it looks like stack corruption

the jmp RegistryProc should be a call RegistryProc

and RegistryProc should end with a ret , not a jmp Dlgproc as thats gonna totally screw up the stack
Posted on 2004-11-07 10:40:26 by evlncrn8
Thanks, I'll give it a try later. Like I said, assembly fundamentals. 8-)
Posted on 2004-11-07 12:29:00 by Nilrem2