1) Without symbols
a) The faulting Stack
The stack backtrace of the thread that caused the Unhandled Exception would look like:
0:006> kvn50
# ChildEBP RetAddr Args to Child
WARNING: Stack unwind information not available. Following frames may be wrong.
00 00b3f6e8 01291972 00000057 00000001 00000000 KERNEL32!RaiseException+0x37
01 00b3f708 01291563 00e01e90 00000001 00e01f5c badext!HttpExtensionProc+0x647
*** ERROR: Symbol file could not be found. Defaulted to export symbols for wam.dll -
02 00b3f728 65d82b06 00e01e90 00e01f5c 00e01e90 badext!HttpExtensionProc+0x238
03 00b3f770 65d823a2 0040c1a0 00e02005 00e01e90 wam!SE_TABLE::ReleaseExtension+0xbe8
*** ERROR: Symbol file could not be found. Defaulted to export symbols for RPCRT4.DLL -
04 00b3f7b4 77d339c0 00406c08 00000000 000000cb wam!SE_TABLE::ReleaseExtension+0x484
05 00b3f7dc 77d93570 65d8223f 00b3f7f8 00000005 RPCRT4!NdrServerInitialize+0x288
06 00b3fa54 77d949ac 000c8ee8 0009f794 000caaf8 RPCRT4!NdrStubCall2+0x570
*** ERROR: Symbol file could not be found. Defaulted to export symbols for ole32.dll -
07 00b3fab8 77b29e7f 000c8ee8 000caaf8 0009f794 RPCRT4!CStdStubBuffer_Invoke+0x9e
08 00b3fafc 77b29d6e 000caaf8 000c655c 000a2410 ole32!HDC_UserMarshal+0x78a
09 00b3fb44 77aa7ae7 000caaf8 000c6470 000c8ee8 ole32!HDC_UserMarshal+0x679
0a 00b3fba8 77aa7a33 0009f794 00000000 000c8ee8 ole32!CoGetCallContext+0x401
0b 00b3fbc4 77b29c89 000caaf8 00000001 000c8ee8 ole32!CoGetCallContext+0x34d
0c 00b3fbf4 77b29a89 000caab0 0009f794 000c8ee8 ole32!HDC_UserMarshal+0x594
0d 00b3fcb4 77b2a12c 000ca640 00000000 000c6540 ole32!HDC_UserMarshal+0x394
0e 00b3fcf4 77d33721 000caab0 000c6540 0007a410 ole32!HDC_UserMarshal+0xa37
0f 00b3fd2c 77d33667 77b29f7b 0007a410 00b3fe0c RPCRT4!I_RpcFree+0x1ff
10 00b3fd84 77d33579 00000000 00000000 00b3fe0c RPCRT4!I_RpcFree+0x145
11 00b3fda4 77d48e81 0007a410 00000000 00b3fe0c RPCRT4!I_RpcFree+0x57
12 00b3fdd4 77d34bc6 0007a410 0007a3d4 00000000 RPCRT4!RpcSsDestroyClientContext+0xa6
13 00b3fe10 77d346c5 000a5a98 00082690 80030001 RPCRT4!NdrCorrelationFree+0x1120
14 00b3fe28 77d422ff 0007a318 00b3fe50 000a5a98 RPCRT4!NdrCorrelationFree+0xc1f
15 00b3ff74 77d420d9 77d42528 00082690 00000000 RPCRT4!NdrConformantArrayMemorySize+0x4c5
16 00b3ffa8 77d424da 0009e120 00b3ffec 77e887dd RPCRT4!NdrConformantArrayMemorySize+0x29f
17 00b3ffb4 77e887dd 0009bb28 00000000 00000000 RPCRT4!NdrConformantArrayMemorySize+0x6a0
18 00b3ffec 00000000 77d424c2 0009bb28 00000000 KERNEL32!GetModuleFileNameA+0x1d1
This call stack shows that an exception of code (00000057) was raised in "badext.dll". This exception is a software exception that translates to "ERROR_INVALID_PARAMETER". In this case,
the exception is NONCONTINUABLE (Second parameter of RaiseException is not 0) which means that any attempt to continue execution causes the EXCEPTION_NONCONTINUABLE_EXCEPTION
exception causing the process to terminate.
Again, In this call stack, it is clear that the culprit is "badext.dll". So it is enough to tell the customer to contact the dll vendor to fix it. If it is an in-house component and the customer would like help
from Microsoft, they should open an advisory case to troubleshoot the issue further.
2) With symbols including public symbols of "badExt.dll"
First, we need to add the symbol path(company wide symbols) as well as public symbols of our dll a) Using the GUI:
- Click "File"
- Click "Symbol File Path"
- Type in SRV*C:\LabSymbols*\\symbols\symbols;C:\IISDebugLabs\symbols\Pub a
nd hit Enter
b) Using the ".sympath+" command:
.sympath+ SRV*C:\LabSymbols*\\symbols\symbols;C :\IISDebugLabs\symbols\Pub
Note: For more information on setting the symbol path for windbg, please refer to the debugger documentation for the .sympath command. This will describe
the "downstream store" feature that lets you download symbols to a symbol server of your own.
The stack backtrace of the thread that caused the Unhandled Exception would look like:
0:006> kvn50
# ChildEBP RetAddr Args to Child
00 00b3f6e8 01291972 00000057 00000001 00000000 KERNEL32!RaiseException+0x56 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\windows\base\client\thread.c @ 1382]
01 00b3f708 01291563 00e01e90 00000001 00e01f5c badext!doRE2+0x19
02 00b3f728 65d82b06 00e01e90 00e01f5c 00e01e90 badext!HttpExtensionProc+0x238
03 00b3f73c 65d82a97 00e01e90 00e01f5c 00e01e90 wam!HSE_APPDLL::ExecuteRequest+0x93 (FPO: [1,0,3]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\isplocal.cxx @ 450]
04 00b3f770 65d823a2 0040c1a0 00e02005 00e01e90 wam!WAM::InvokeExtension+0x35 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 913]
05 00b3f7b4 77d339c0 00406c08 00000000 000000cb wam!WAM::ProcessRequest+0x240 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 643]
06 00b3f7dc 77d93570 65d8223f 00b3f7f8 00000005 RPCRT4!Invoke+0x30 [..\i386\stubless.asm @ 88]
07 00b3fa54 77d949ac 000c8ee8 0009f794 000caaf8 RPCRT4!NdrStubCall2+0x63d (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\srvcall.c @ 1724]
08 00b3fab8 77b29e7f 000c8ee8 000caaf8 0009f794 RPCRT4!CStdStubBuffer_Invoke+0xec (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\stub.c @ 1571]
09 00b3fafc 77b29d6e 000caaf8 000c655c 000a2410 ole32!SyncStubInvoke+0x61 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1136]
0a 00b3fb44 77aa7ae7 000caaf8 000c6470 000c8ee8 ole32!StubInvoke+0xa8 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1334]
0b 00b3fba8 77aa7a33 0009f794 00000000 000c8ee8 ole32!CCtxComChnl::ContextInvoke+0xbb (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\ctxchnl.cxx @ 1204]
0c 00b3fbc4 77b29c89 000caaf8 00000001 000c8ee8 ole32!MTAInvoke+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\callctrl.cxx @ 1952]
0d 00b3fbf4 77b29a89 000caab0 0009f794 000c8ee8 ole32!AppInvoke+0xb5 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1013]
0e 00b3fcb4 77b2a12c 000ca640 00000000 000c6540 ole32!ComInvokeWithLockAndIPID+0x29e (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1578]
0f 00b3fcf4 77d33721 000caab0 000c6540 0007a410 ole32!ThreadInvoke+0x1b7 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 3835]
10 00b3fd2c 77d33667 77b29f7b 0007a410 00b3fe0c RPCRT4!DispatchToStubInC+0x84 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\dispatch.c @ 82]
11 00b3fd84 77d33579 00000000 00000000 00b3fe0c RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x100 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 543]
12 00b3fda4 77d48e81 0007a410 00000000 00b3fe0c RPCRT4!RPC_INTERFACE::DispatchToStub+0x5e (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 407]
13 00b3fdd4 77d34bc6 0007a410 0007a3d4 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWithObject+0xa9 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 795]
14 00b3fe10 77d346c5 000a5a98 00082690 80030001 RPCRT4!LRPC_SCALL::DealWithRequestMessage+0x1c6 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 2665]
15 00b3fe28 77d422ff 0007a318 00b3fe50 000a5a98 RPCRT4!LRPC_ADDRESS::DealWithLRPCRequest+0x10c (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 867]
16 00b3ff74 77d420d9 77d42528 00082690 00000000 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x1eb (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 1175]
17 00b3ff78 77d42528 00082690 00000000 00000000 RPCRT4!RecvLotsaCallsWrapper+0x9 (FPO: [1,0,0]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 37]
18 00b3ffa8 77d424da 0009e120 00b3ffec 77e887dd RPCRT4!BaseCachedThreadRoutine+0x4f (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 3586]
19 00b3ffb4 77e887dd 0009bb28 00000000 00000000 RPCRT4!ThreadStartRoutine+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\threads.cxx @ 230]
1a 00b3ffec 00000000 77d424c2 0009bb28 00000000 KERNEL32!BaseThreadStart+0x52 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\windows\base\client\support.c @ 460]
So, this shows that the RaiseException call in kernel32 came from the function (doRE2) in "badext.dll".
Advanced Technique
Notice also that the call to our extension was invoked by "wam.dll" (Web Application Manager). It is the component responsible for handing
over any request that needs to be processed by an ISAPI extension.
One way to see the http request passed to our extension is to dump the structure of "pWamExecInfo".
0:006> .frame4
04 00b3f770 65d823a2 wam!WAM::InvokeExtension+0x35 [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 913]
0:006> dv
this = 0
psExt = 0040c1a0
szISADllPath = 00e02005 "C:\Inetpub\wwwroot\Dev\badext.dll"
pWamExecInfo = 00e01e90
ret = 0x406c08
0:006> dt pWamExecInfo -r Local var @ 0xb3f780 Type WAM_EXEC_INFO*
0x00e01e90
+0x000 ecb :
+0x000 cbSize : 0x90
+0x004 dwVersion : 0x40000
+0x008 ConnID : 0x00e01e90
+0x00c dwHttpStatusCode : 0xc8
+0x010 lpszLogData : [80] ""
+0x060 lpszMethod : 0x00e01ff0 "GET"
+0x064 lpszQueryString : 0x00e02027 "s=re2_v1"
+0x068 lpszPathInfo : 0x00e01fdc ""
+0x06c lpszPathTranslated : 0x00e01fdd "c:\inetpub\wwwroot"
+0x070 cbTotalBytes : 0
+0x074 cbAvailable : 0
+0x078 lpbData : (null)
.....
.....
.....
To verify that the symbols are lined up properly for our extension, issue this command.
0:006> lmv mbadext
start end module name 06470000 06475000
badext (pdb symbols) C :\IISDebugLabs\symbols\Pub
Loaded symbol image file: C:\IISDebuglabs\www\App\badext.dll Image path: C:\IISDebuglabs\www\App\badext.dll
Timestamp: Wed Jan 29 18:07:14 2003 (3E385EA2)
Checksum: 0000EBCD
File version: 5.0.0.0
Product version: 5.0.0.0
File flags: 0 (Mask 3F)
File OS: 40004 NT Win32
File type: 2.0 Dll
File date: 00000000.00000000
CompanyName: Microsoft Corporation
ProductName: Internet Information Services
InternalName: badEXT.dll
OriginalFilename: badEXT.dll
ProductVersion: 5.00.0984
FileVersion: 5.00.0984
FileDescription: badEXT Test
LegalCopyright: Copyright (C) Microsoft Corp. 1981-1999
3) with Private Symbols "badExt.dll"
First, we need to add the symbol path(company wide symbols) as well as private symbols of our dll a) Using the GUI:
- Click "File"
- Click "Symbol File Path"
- Type in SRV*C:\LabSymbols*\\symbols\symbols;C:\IISDebugLabs\symbols\Pri a
nd hit Enter
b) Using the ".sympath+" command:
.sympath+ SRV*C:\LabSymbols*\\symbols\symbols;C :\IISDebugLabs\symbols\Pri
The stack backtrace of the thread that caused the Unhandled Exception would look like:
0:006> kvn50
# ChildEBP RetAddr Args to Child
00 00b3f6e8 01291972 00000057 00000001 00000000 KERNEL32!RaiseException+0x56 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\windows\base\client\thread.c @ 1382]
01 00b3f708 01291563 00e01e90 00000001 00e01f5c badext!doRE2+0x19 (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\extDBG\badext.cpp @ 485]
02 00b3f728 65d82b06 00e01e90 00e01f5c 00e01e90 badext!HttpExtensionProc+0x238 (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\extDBG\badext.cpp @ 154]
03 00b3f73c 65d82a97 00e01e90 00e01f5c 00e01e90 wam!HSE_APPDLL::ExecuteRequest+0x93 (FPO: [1,0,3]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\isplocal.cxx @ 450]
04 00b3f770 65d823a2 0040c1a0 00e02005 00e01e90 wam!WAM::InvokeExtension+0x35 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 913]
05 00b3f7b4 77d339c0 00406c08 00000000 000000cb wam!WAM::ProcessRequest+0x240 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 643]
06 00b3f7dc 77d93570 65d8223f 00b3f7f8 00000005 RPCRT4!Invoke+0x30 [..\i386\stubless.asm @ 88]
07 00b3fa54 77d949ac 000c8ee8 0009f794 000caaf8 RPCRT4!NdrStubCall2+0x63d (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\srvcall.c @ 1724]
08 00b3fab8 77b29e7f 000c8ee8 000caaf8 0009f794 RPCRT4!CStdStubBuffer_Invoke+0xec (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\stub.c @ 1571]
09 00b3fafc 77b29d6e 000caaf8 000c655c 000a2410 ole32!SyncStubInvoke+0x61 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1136]
0a 00b3fb44 77aa7ae7 000caaf8 000c6470 000c8ee8 ole32!StubInvoke+0xa8 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1334]
0b 00b3fba8 77aa7a33 0009f794 00000000 000c8ee8 ole32!CCtxComChnl::ContextInvoke+0xbb (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\ctxchnl.cxx @ 1204]
0c 00b3fbc4 77b29c89 000caaf8 00000001 000c8ee8 ole32!MTAInvoke+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\callctrl.cxx @ 1952]
0d 00b3fbf4 77b29a89 000caab0 0009f794 000c8ee8 ole32!AppInvoke+0xb5 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1013]
0e 00b3fcb4 77b2a12c 000ca640 00000000 000c6540 ole32!ComInvokeWithLockAndIPID+0x29e (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1578]
0f 00b3fcf4 77d33721 000caab0 000c6540 0007a410 ole32!ThreadInvoke+0x1b7 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 3835]
10 00b3fd2c 77d33667 77b29f7b 0007a410 00b3fe0c RPCRT4!DispatchToStubInC+0x84 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\dispatch.c @ 82]
11 00b3fd84 77d33579 00000000 00000000 00b3fe0c RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x100 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 543]
12 00b3fda4 77d48e81 0007a410 00000000 00b3fe0c RPCRT4!RPC_INTERFACE::DispatchToStub+0x5e (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 407]
13 00b3fdd4 77d34bc6 0007a410 0007a3d4 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWithObject+0xa9 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 795]
14 00b3fe10 77d346c5 000a5a98 00082690 80030001 RPCRT4!LRPC_SCALL::DealWithRequestMessage+0x1c6 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 2665]
15 00b3fe28 77d422ff 0007a318 00b3fe50 000a5a98 RPCRT4!LRPC_ADDRESS::DealWithLRPCRequest+0x10c (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 867]
16 00b3ff74 77d420d9 77d42528 00082690 00000000 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x1eb (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 1175]
17 00b3ff78 77d42528 00082690 00000000 00000000 RPCRT4!RecvLotsaCallsWrapper+0x9 (FPO: [1,0,0]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 37]
18 00b3ffa8 77d424da 0009e120 00b3ffec 77e887dd RPCRT4!BaseCachedThreadRoutine+0x4f (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 3586]
19 00b3ffb4 77e887dd 0009bb28 00000000 00000000 RPCRT4!ThreadStartRoutine+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\threads.cxx @ 230]
1a 00b3ffec 00000000 77d424c2 0009bb28 00000000 KERNEL32!BaseThreadStart+0x52 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\windows\base\client\support.c @ 460]
Notice in frame O1 and 02 the line of the code as well as the name and location of the source code. Going back to the source code in badext.cpp:
Line 154 looks like
DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *lpEcb)
{
.....
.....
if (!strncmp(szS, "av1", 3))
{
return doRE2(lpEcb, Variation); //Line 150
}
.....
.....
}
Line 485 looks like
DWORD doRE2(EXTENSION_CONTROL_BLOCK *lpEcb, int Variation)
{
DWORD dwThreadID;
HANDLE hThread;
if (1 == Variation)
{
RaiseException(ERROR_INVALID_PARAMETER, EXCEPTION_NONCONTINUABLE, 0, NULL); //line 485
}
if (2 == Variation)
{
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)RENonContinuable, NULL, 0, &dwThreadID);
}
return HSE_STATUS_SUCCESS;
}