Nasty Problem

S

S Wheeler

I have a REALLY nasty problem and could use some expert help.

I have two mixed mode apps. Each uses a mixed mode DLL that exports a couple
of classes. There is no dll main as it is not needed. This was working fine
until a couple of days ago when I added some (a lot of) new code to the dll.
The apps generally do not run at the same time. Every thing compiles and
links OK. But at run time I now immediately get :

The application failed to initialize properly (0xc0000005). Click on OK to
terminate the application.

I have to click OK twice and then get:

Unhandled exceptionat 0x7c964ed1 (ntdll.dll) in myApp.exe: 0xC0000005:
Access violation.

This occurs very earily in the app loading and I can not even hit a break
point.

I have read all the google stuff about permissions and viruses but I am sure
that is not the problem here. After exhaustive debugging, I noted that in
one of my GUI apps (the simpler one) I had some MessageBox calls that would
be called if certain error conditions occured. I was able to determine that
the presence of these calls was enough to cause the problem - so I removed
them and that application started working fine. I had already been
suspecting some sort of run time library mismatch and this seems to confirm
that. I have removed all MessageBox calls in my other app but it still crash
immediately after starting.

My first question: what libraries would MessageBox require (implicitly
linked) and what might be some other library calls that may be causing
similar problems in my other application. I am using /clr and Multi-threaded
Debug (/MTd) for the application and /clr and Multi-threaded Debug DLL
(/MDd) for the DLL. This is such a subttle problem, it must be some sort of
run time mismatch deep under the covers and the error messaages and posted
articles are missleading at best. Could this be related to the app Message
Loop?

Kindly Experts, I could use your help!
 
M

Maksim Libenson

Hi,

Do you have any global variables defined in your code? That would be
first thing that I will check. Otherwise just comment all new code and
start uncommenting gradually untill you will hit the problem.

Max
http://ceeplusplus.com
 
S

Steve Wheeler

No globals are defined; there are 2 static mdthods, but other than that no
static variables either. Commenting new code is not simple beause the change
represents the merging of 2 libraries and there are dependancies through out
the main application which is some 50K+ lines of code. Any other thoughts?
 
V

Vladimir Nesterovsky

I have a REALLY nasty problem and could use some expert help.
I have two mixed mode apps. Each uses a mixed mode DLL that exports a
couple of classes. There is no dll main as it is not needed. This was
working fine until a couple of days ago when I added some (a lot of) new
code to the dll. The apps generally do not run at the same time. Every
thing compiles and links OK. But at run time I now immediately get :

The application failed to initialize properly (0xc0000005). Click on OK to
terminate the application.

What do you see in the debugger output window?
Did you try to set "Break On Exception" (every type)?
 
S

S Wheeler

Vladimir -
Here is my debug widow output:

'PTS6000.exe': Loaded
'E:\Development\Peforce\thunderbolt\software\main\utilities\PTS6000\GUI\Debug\PTS6000.exe',
Symbols loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Exports loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\mscoree.dll', Exports loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Exports loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', Exports loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', Exports loaded.
'PTS6000.exe': Loaded
'E:\Development\Peforce\thunderbolt\software\main\utilities\PTS6000\GUI\Debug\Updates.dll',
Symbols loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\msvcp71d.dll', Symbols loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\msvcr71d.dll', Symbols loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\W32N50.dll', Exports loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\user32.dll', Exports loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', Exports loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\winspool.drv', Exports loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Exports loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', Exports loaded.
'PTS6000.exe': Loaded
'C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll', Exports loaded.
'PTS6000.exe': Loaded
'C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\msvcr71.dll', Symbols loaded.
'PTS6000.exe': Loaded
'C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll', Exports loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', Exports loaded.
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', Exports loaded.
'PTS6000.exe': Loaded
'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll',
Exports loaded.
First-chance exception at 0x77d48fc0 (user32.dll) in PTS6000.exe:
0xC0000005: Access violation reading location 0x00000002.
'PTS6000.exe': Unloaded
'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll'
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll', Exports loaded.
First-chance exception at 0x7c90eae0 (ntdll.dll) in PTS6000.exe: 0xC0000005:
Access violation reading location 0x00000130.
'PTS6000.exe': Unloaded 'C:\WINDOWS\system32\comctl32.dll'
'PTS6000.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll', Symbols loaded.
First-chance exception at 0x77d49f29 (user32.dll) in PTS6000.exe:
0xC0000005: Access violation reading location 0x00000002.
'PTS6000.exe': Unloaded 'C:\WINDOWS\system32\comctl32.dll'
'PTS6000.exe': Loaded
'C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll', No symbols
loaded.
First-chance exception at 0x00000000 in PTS6000.exe: 0xC0000005: Access
violation reading location 0x00000000.
First-chance exception at 0x791b7e5f (mscorwks.dll) in PTS6000.exe:
0xC0000005: Access violation reading location 0x000001b2.
The thread 'Win32 Thread' (0x8dc) has exited with code -2146233082
(0x80131506).
First-chance exception at 0x77d48ade (user32.dll) in PTS6000.exe:
0xC0000005: Access violation reading location 0x00000008.
First-chance exception at 0x7c964ed1 (ntdll.dll) in PTS6000.exe: 0xC0000005:
Access violation.
Unhandled exception at 0x7c964ed1 (ntdll.dll) in PTS6000.exe: 0xC0000005:
Access violation.
The program '[2868] PTS6000.exe: Native' has exited with code 0 (0x0).
 
O

Oleg Starodumov

I have two mixed mode apps. Each uses a mixed mode DLL that exports a couple
of classes. There is no dll main as it is not needed. This was working fine
until a couple of days ago when I added some (a lot of) new code to the dll.
The apps generally do not run at the same time. Every thing compiles and
links OK. But at run time I now immediately get :

The application failed to initialize properly (0xc0000005). Click on OK to
terminate the application.

I have to click OK twice and then get:

Unhandled exceptionat 0x7c964ed1 (ntdll.dll) in myApp.exe: 0xC0000005:
Access violation.

Do you initialize CRT in the mixed DLLs? (as described in KB below)
http://support.microsoft.com/?id=814472

Also, try to compile the application with /MDd and see if the problem
still occurs after that.

If none of this helps, enable breaking into debugger on first chance exceptions
as Vladimir said (Debug | Exceptions | Win32 Exceptions | at least C0000005,
check "When exception is thrown - break into debugger"), run the application under
debugger, and check call stacks for all exceptions. You can post the call stacks here.

You might need to configure symbol server to see good call stacks:
http://msdn.microsoft.com/library/en-us/vsdebug/html/vxtskUsingASymbolServer.asp
 
R

raphaeljenks

Hi I got the The application failed to initialize properly - 0xc0000005
message several times whenn using applications that used to work fine
on my computer. It especially messed with spybot and Ad-aware. AVG
didn't see the problem (which worked in regular mode), niether did
Ad-aware (which worked in safe mode). nor Spybot (in safe mode).
Finally I was tipped off
(http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=807630&SiteID=1)
to use Panda Activescan. It found the trojan, or virus or whatever it
was and now all my applications are working. I just though I should
write this in case it helps somebody out there.

Raphael

Oleg Starodumov ha escrito:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top