# MS C++ debug problem / NTdll.dll invalid handle



## wzvh3c (Jan 8, 2008)

I am currently getting the following error and can not understand what is causing it. 
First-chance exception in TestShell.exe (NTDLL.dll): 0xc0000008: Invalid handle.
A little background. I have a Visual Basic program "TestShell.exe" that calls a dll "TestExec.dll", and TestExec.dll calls another dll named 
"Pul_Inp_MC.dll". Both TestExec and Pul_Inp_MC are written in MS Visual C++ Version 6.0. The problem I have is when I try to run 
TestExec or Pul_Inp_MC in debug mode in the Visual C++ IDE, I get the above error. Now what is also very puzzling is that at one time it was working fine
but something has changed in the IDE environment, TestShell.exe, or TestExec.dll and I can't figure it out. 
In the Projects->Settings->Debug tab I have the "Executable for debug session:" set to the TestShell.exe program.
When I go into the debug mode I get a warning message the tells me "TestShell.exe 
does not contain debugging information. Press OK to continue." After I press OK I get the error message above 
concerning the First-chance exception. I was able to trace the code in TestShell.exe and the code errors out on the following line: 
mTestForm.ws_Test.Connect "127.0.0.1", 2882
In the above statement TestShell.exe is trying to make a TCP/IP connection to another
program.

Every thing runs together when I am not in debug mode.

Does anybody have any ideas?


----------



## calvin-c (May 17, 2006)

Did you check out 'first chance exception'? It's basically a warning type of message. Yes, there's an error but the 'first chance exception' is shown *before* the program handles the error (and only in debug mode). Since the program runs fine when not in debug mode I'd say you already have code that handles the error-the 'first chance exception' simply warns you that the error did occur.


----------

