start:
invoke GetModuleHandle,0
mov hInstance,eax
invoke InitCommonControls
here=> invoke DialogBoxParam,hInstance,IDD_DIALOG1,0,addr MainDlgProc,0
invoke ExitProcess,eax


If I step trough this code I get this information:

"First-chance exception in myprog.exe (NTDLL.DLL]:0xC0000008: Invalid Handle"

when the marked line is executed. After that message I can't resume debugging.

Running the exe the usual way don't affect the execution.

I can't figure out what's the problem. Any ideas?

Best regards
Posted on 2006-04-11 13:54:05 by minor28
Might be an issue with MASM32 and/or Windows XP. Check THIS THREAD out for more info.
Posted on 2006-04-11 14:04:05 by SpooK
0xC0000008 is an access violation exception. Without more information (source) I can't really help you. Only thing I can think of that "possibly" could cause this would be that the resource for IDD_DIALOG1 isn't linked in, MainDlgProc hasn't been defined, or you forgot to define hInstance. Your code looks fine but the issue is that you are trying to access memory that you either don't have permission to access or doesn't exist.

Regards,
Bryant Keller
Posted on 2006-04-11 14:07:38 by Synfire
I checked your thread. Did try InitCommonControlsEx and I do want DialogBoxParam.

The funny thing is that this is version 2 of a prog where version 1 works without this message. If I put an int 3 in code it works. Must be something with a handle.

I found this on support.microsoft.com


If you do not want to see the first chance exception in the debugger, you should disable first chance exception handling for the specific exception code. Otherwise, when the first chance exception occurs, you may need to instruct the debugger to pass on the exception to the program to be handled as usual.


Debugging with OllyDbg or VS6 gives the same error. I have not found a way to intruct neither Olly nor VS to pass the exception.
Posted on 2006-04-11 16:48:48 by minor28
Hello minor28,

Check your MainDlgProc.  Maybe you trying to close a handle twice or non-existent handle.

best regards,

czDrillard
Posted on 2006-04-12 08:18:48 by czDrillard
My guess is that it's the the MainDlgProc, since windows calls the dialogproc *before* returning from the DialogBoxParam call (WM_INITDIALOG and other messages as well. And the same goes for CreateWindow).
Posted on 2006-04-12 10:02:52 by f0dder
Found the error. I did trace it with int 3. Started with WM_INITDIALOG in MainDlgProc to WM_INITDIALOG in a tab dialog process and further to listing a listview where I neglected to check if open a regkey ( the fifth key in order of the twelfth loop) was a success. It wasn't so the RegCloseKey got the invalid handle.

Thanks for your help.
Posted on 2006-04-12 13:28:56 by minor28