« Previous Next »

Thread: IIS7 NTDLL.DLL Errors

Last post 12-09-2008 5:28 PM by anilr. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 12-02-2008, 5:21 PM

    • DadKind
    • Not Ranked
    • Joined on 07-30-2002, 10:16 AM
    • Fresno
    • Posts 6

    IIS7 NTDLL.DLL Errors

     Hello All,

    I'm porting an old web app to Server2008/IIS7 (it was originally written in VS2005 and runs on XP Pro and Windows Server 2003).

     This app imports from functions from an unmanaged DLL.

    When I was first running my app I was getting a bunch of "Unable to load DLL" errors. I then figured out that I needed to copy the unmanaged DLL to the Temporary ASP.NET folder and the DLL is now found (but this is another thread!) but the application runs.

    Outside the IDE, whenever my app calls the unmanaged code (using DllImport) my app crashes painfully and I see the following in the Application Log:

    Faulting application w3wp.exe, version 7.0.6001.18000, time stamp 0x47919413, faulting module ntdll.dll, version 6.0.6001.18000, time stamp 0x4791a7a6, exception code 0xc0000374, fault offset 0x000b015d, process id 0x142c, application start time 0x01c954c955ce8d65.

     I've seen other posts here and elsewhere regarding this, but I've not seen any real solutuions or explanations as to the actual cause of the problem.

     Can anyone shed some light on this? 

    What is the actual problem?

    What is the solution?

     TIA
    -tomas

    //----------
    // Tomas Vera
    //-----------
  • 12-03-2008, 4:44 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: IIS7 NTDLL.DLL Errors

    The exception code 0xc0000374 indicates a heap corruption - to determine the solution, you would need to debug the crash in a debugger to figure out who is corrupting the heap.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 12-09-2008, 1:10 PM In reply to

    • DadKind
    • Not Ranked
    • Joined on 07-30-2002, 10:16 AM
    • Fresno
    • Posts 6

    Re: IIS7 NTDLL.DLL Errors

     Anil,

    I got this from a Windb session, but I need some help interpreting the results. Is "COMCTL32.DLL" the offending DLL? What should be the next step?

    Why does this run inside the debugger but not in "normal" fashion?

    Your help is much appreciated.

     

    -tomas

    -----WINDBG Session ---------------------


    0:023> g
    ModLoad: 0f680000 0f6d3000   C:\development\RsyncWebTest\bin\rsynclib.dll
    ModLoad: 01720000 01747000   C:\development\RsyncWebTest\bin\librsync.dll
    ModLoad: 74230000 74269000   C:\Windows\system32\OLEACC.dll
    ModLoad: 72470000 724b2000   C:\Windows\system32\WINSPOOL.DRV
    ModLoad: 76ff0000 77063000   C:\Windows\system32\COMDLG32.dll
    ModLoad: 73940000 739c5000   C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.6001.18000_none_886786f450a74a05\COMCTL32.dll
    Critical error detected c0000374
    (ba8.1c10): Break instruction exception - code 80000003 (first chance)
    eax=00000000 ebx=00000000 ecx=772e385a edx=0f52e8c5 esi=001d0000 edi=0f6b4140
    eip=77307dfe esp=0f52eb14 ebp=0f52eb90 iopl=0         nv up ei pl nz na pe nc
    cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000206
    ntdll!DbgBreakPoint:
    77307dfe cc              int     3
     

    //----------
    // Tomas Vera
    //-----------
  • 12-09-2008, 4:11 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: IIS7 NTDLL.DLL Errors

    I would suggest turning on pageheap (using either app-verifier or gflags) on the process and re-reproing - you should then catch the problem at the point of corruption.

    You have not pasted the stack trace below, but it does seem to indicate bad definition of the interop stub method.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 12-09-2008, 5:12 PM In reply to

    • DadKind
    • Not Ranked
    • Joined on 07-30-2002, 10:16 AM
    • Fresno
    • Posts 6

    Re: IIS7 NTDLL.DLL Errors

     OK. I've turned on PageHeap using GlobalFlags. But still it doesn't seem to show much. Here is a more detailed dump of data. I'm a little concerned that WinDbg does not seem to find the Symbol file for some of the DLLs.

     

    Here's my stub definition:
    [DllImport("rsynclib.dll", CharSet = CharSet.Auto)]
    public static extern string DecryptBuffer([In] byte[] pEncrypted, [In] int dwBufLen, [In, Out] byte[]  pClear);

    And here's the signature in the DLL source:
    PWCHAR CCryptString::DecryptBuffer( IN CONST PBYTE pEncrypted, IN CONST DWORD dwBufLen, OUT PBYTE pClear )

     Again, this all works as expected in the IDE, but not when run outside the IDE in the "production" mode.

     Thanks for your help thus far!

    -tomas

     

     ---- WINDBG OUTPUT ----

    ModLoad: 66f00000 66f40000   C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Web.RegularE#\854f0d4c93caa7b6b958ba325aa59f07\System.Web.RegularExpressions.ni.dll
    ModLoad: 7ade0000 7af7c000   C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Drawing\b07363ad6e831292e585523a54df6879\System.Drawing.ni.dll
    ModLoad: 752b0000 752f5000   C:\Windows\system32\bcrypt.dll
    (1458.15a4): Break instruction exception - code 80000003 (first chance)
    eax=7ffda000 ebx=00000000 ecx=00000000 edx=7734d094 esi=00000000 edi=00000000
    eip=77307dfe esp=0f6ffee0 ebp=0f6fff0c iopl=0         nv up ei pl zr na pe nc
    cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\system32\ntdll.dll - 
    ntdll!DbgBreakPoint:
    77307dfe cc              int     3
    0:023> g
    ModLoad: 0f560000 0f5b3000   C:\development\RsyncWebTest\bin\rsynclib.dll
    ModLoad: 00560000 00587000   C:\development\RsyncWebTest\bin\librsync.dll
    ModLoad: 74230000 74269000   C:\Windows\system32\OLEACC.dll
    ModLoad: 72470000 724b2000   C:\Windows\system32\WINSPOOL.DRV
    ModLoad: 76ff0000 77063000   C:\Windows\system32\COMDLG32.dll
    ModLoad: 73940000 739c5000   C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.6001.18000_none_886786f450a74a05\COMCTL32.dll
    Critical error detected c0000374
    (1458.1134): Break instruction exception - code 80000003 (first chance)
    eax=00000000 ebx=00000000 ecx=772e385a edx=0f4de855 esi=00310000 edi=0f594140
    eip=77307dfe esp=0f4deaa4 ebp=0f4deb20 iopl=0         nv up ei pl nz na po nc
    cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
    ntdll!DbgBreakPoint:
    77307dfe cc              int     3
    0:021> K
    ChildEBP RetAddr  
    WARNING: Stack unwind information not available. Following frames may be wrong.
    0f4deb20 77370d68 ntdll!DbgBreakPoint
    0f4deb30 77370e56 ntdll!RtlpNtMakeTemporaryKey+0x2fc3
    0f4deb64 77330531 ntdll!RtlpNtMakeTemporaryKey+0x30b1
    0f4deb90 7710c56f ntdll!RtlTimeToElapsedTimeFields+0x19b6
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\system32\ole32.dll - 
    0f4deba4 768fdc2c kernel32!HeapFree+0x14
    0f4debb8 768fdc53 ole32!CoTaskMemAlloc+0x17c
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll - 
    0f4debc8 7a138820 ole32!CoTaskMemFree+0x13
    0f4debd8 79ead0ce mscorwks!CorLaunchApplication+0x19c06
    0f4dee14 79eb068c mscorwks!GetMetaDataInternalInterface+0x1701e
    0f4dee94 79eb03ed mscorwks!GetMetaDataInternalInterface+0x1a5dc
    *** WARNING: Unable to verify checksum for C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Web\8c1af99f3ddcfeb589e13bed6b9acf36\System.Web.ni.dll
    *** ERROR: Module load completed but symbols could not be loaded for C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Web\8c1af99f3ddcfeb589e13bed6b9acf36\System.Web.ni.dll
    0f4def7c 6619006e mscorwks!GetMetaDataInternalInterface+0x1a33d
    0f4def94 6619025c System_Web_ni+0x27006e
    00000000 00000000 System_Web_ni+0x27025c
    
    //----------
    // Tomas Vera
    //-----------
  • 12-09-2008, 5:28 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: IIS7 NTDLL.DLL Errors

    Use .symfix to point the debugger to microsoft's public symbol server.

    You probably need to change CharSet to CharSet.Unicode and add a [MarshalAs(UnmanagedType.LPWStr)] to the returned string - CLR is treating it like BSTR and using CoTaksMemFree to free it, I don't think your dll allocated it with CoTaskMemAlloc.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
Page 1 of 1 (6 items)
Microsoft Communities