Access Violation when DLL's Load??

'Program.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll', Symbols loaded.
'Program.exe': Loaded 'C:\WINDOWS\system32\MFC71.dll', Symbols loaded.
'Program.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', No symbols loaded.
'Program.exe': Loaded 'C:\WINDOWS\system32\MFC71ENU.DLL', No symbols loaded.
First-chance exception at 0x7c910370 (ntdll.dll) in Program.exe: 0xC0000005: Access violation reading location 0x02086000.

Does this mean that the access violation happened when MFC71ENU.DLL loaded??  I don't think it does because I took that dll away and it had the same error on shlwapi.dll??  The problem is this access violation occurs before any code of mine appears to be hit.  My program.exe loads many DLL's tho, so my question is what happens when a DLL loads?  What code gets executed if any?

I also don't want to hear anything about this being a first-chance execption so it's not important.  This needs to be fixed and I'm trying to get the general idea of whats wrong.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

itsmeandnobodyelseConnect With a Mentor Commented:
If you could run the prog in the VC debugger you should go the Debug Exceptions ... menu while running. Select "access violation" from listbox and check "Stop immediately" checkbox. Restart program. When it crashes it will show you the source where the access violation happened provided it's your code ...

Regards, Alex
AlexFMConnect With a Mentor Commented:
When Dll is loaded, it's DllMain function is called. If Dll is yours, see what code runs in this function. I guess that MFC71ENU.DLL is not yours, so that there is nothing to do.
First-chance exception message means: there was exception, but it successfully handled. I don't think that you can do something in this situation to fix this - except of using Run command instead of Go :)
>>Does this mean that the access violation happened when MFC71ENU.DLL loaded??

Yes, as AlexFM described, the entry point is called. But, *stop* focusing on First Chance exceptions. They're normal, you will encounter a *lot* of them when debugging. That's part of the control flow of Windows.
Oh, as a side note to First Chance access violations - you might just see a call of 'IsBadReadPtr()' ( whic e.g. can be written like

BOOL IsBadReadPtr(CONST VOID *lp, UINT ucb)
    BYTE b;

    _try {

        for (UINT un = 0; un < uncb; un++) b = *(BYTE*)(lp + un);

    __except(1) {

        return TRUE;

    return FALSE;

which would cause such a First Chance exception, but not do any damage. As I already mentioned in an earlier Q of yours, ("First and second chance exception handling") describes that really good.
jkrConnect With a Mentor Commented:
Oh, if you absolutely want to find out what function that is, you might want to install the symbol files for your OS/SP, so you can see the exact function in ntdll.dll which is causing that problem.
All Courses

From novice to tech pro — start learning today.