A plain C application compiles fine on MSVC6, but when running, it raises an Access violation.
When running the app in WinDbg, I get the AV error raised when loading rasadhlp.dll (a windows file).
Question: What could possibly cause an access violation when loading a windows dll?
I'm used to working on the various nixes rather than windows, so there might be something really obvious that I'm missing.
[...]
ModLoad: 77920000 77a13000 C:\WINDOWS\system32\SETUPAPI.dll
ModLoad: 76fc0000 76fc6000 C:\WINDOWS\system32\rasadhlp.dll
(f38.a08): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000000 ebx=00000000 ecx=00000000 edx=0049f8f0 esi=0049f8f0 edi=00000000
eip=7c918fea esp=0012fbdc ebp=0012fc50 iopl=0 nv up ei ng nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010286
ntdll!RtlpWaitForCriticalSection+0x5b:
7c918fea ff4010 inc dword ptr [eax+10h] ds:0023:00000010=????????
0:000> g
(f38.a08): Access violation - code c0000005 (!!! second chance !!!)
eax=00000000 ebx=00000000 ecx=00000000 edx=0049f8f0 esi=0049f8f0 edi=00000000
eip=7c918fea esp=0012fbdc ebp=0012fc50 iopl=0 nv up ei ng nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000286
ntdll!RtlpWaitForCriticalSection+0x5b:
7c918fea ff4010 inc dword ptr [eax+10h] ds:0023:00000010=????????
Note: The app is compiled on win2k, tested on XP. (which, for various weird reasons, can't be changed right now...)
[edit]: program trace:
ntdll!RtlpWaitForCriticalSection+0x5b
ntdll!RtlEnterCriticalSection+0x46
msvcrt!vprintf+0x18
intl!libintl_vfprintf+0xa8
intl!libintl_fprintf+0x1f
image00400000+0x6239
MSCTF!DllGetClassObject+0x1de9
ntdll!RtlpNtMakeTemporaryKey+0x7ec8
ntdll!RtlInitializeSListHead+0x115c0
ntdll!iswdigit+0x339
ntdll!LdrGetProcedureAddress+0x4b
image00400000+0x626f4
[edit 2]: I know that the exception is first caught by the debugger, and that this is completely normal. You'll notice in the log that I manually skip over the first-chance exception, and force it to rise into my program. I'm wondering about the origin of such an error, rather than the handling.