Debug Labs


Unhandled Exception in Component Code (Software  CONTINUABLE)

This lab will demonstrate an Unhandled Exception in a component. In this scenarion, an Unhandled Exception in the ISAPI extension "badExt.dll".

This scenarion is presented in 2 variations, the 1st variation shows the unhandled exception in the main thread running the HTTPExtensionProc, while the second variation shows the unhandled exception in a spawned thread other than the main thread.

In both variations, the Unhandled Exception is caused by a CONTINUABLE exception implemented by a call to RaiseException(...).

1- Lab Setup
	

Note: This lab assumes that you have already installed the necessary lab files to run it.

1- Verify the site is running in medium protection

2- Verify that the process "dllhost.exe" mapped to the out of process pooled application is running and note down its PID

To find the PID of the desired dllhost, do the follwing:

- Open Component Services

- Expand "Component Services" Node

- Expand "Computers" Node

- Expand "My Computer" Node

- Select "COM+ Applications"

- Click "Status View" icon and notice the PID column on the right hand pane

 

3- Attach windbg to the dllhost process with the PID found in step 2

a) Using the GUI:

- Click "File"

- Click "Attach to Process"

- Select "dllhost.exe" with the PID found in step 2 and click "OK"

b) Using the command prompt:

- Switch to thr folder where the debugging tools for windows is installed

- Type in "windbg -p <PID>" and hit Enter

 

 

Note:- If the failfast feature is not disabled, you need to instruct the debugger to catch "Other Exceptions" by running the following command:

In Windbg command line, type in "sxe *" with no quotation marks and press Enter.

5- In windbg command line, type in "g" with no quotation marks and press Enter

 

 

2- Run Scenario

1- Click the "Invoke Extension" button to load the ISAPI Extension in the dllhost process memory space. You should see the ISAPI extension "badExt.dll"among the list of modules loaded in dllhost.exe
2- Click the "Cause Unknown Exception V:1" button the first time to cause a 1st chance Unknown Exception in dllhost.exe.
 Note that the debugger breaks and diplays 
	a- Comments about the exception
b- The value of the registers
c- The module where the Eception happened
d- The assembly line that caused the Exception
3- To study the second variation of this lab, click the "Cause Unknown Exception V:2" button.

                                                                           

                                                                                         

1) Unhandled Exception in the main thread running HttpExtensionProc:  (Variation 1)

1- Debug Annotation

 

1) Without symbols

 

 

a) The faulting Stack

 

The stack backtrace of the thread that caused the Unhandled Exception would look like:

 

0:001> kvn50

# ChildEBP RetAddr Args to Child

WARNING: Stack unwind information not available. Following frames may be wrong.

00 0088f6e8 01151938 00000057 00000000 00000000 KERNEL32!RaiseException+0x37

01 0088f708 01151546 00de1e90 00000001 00de1f5c badext!HttpExtensionProc+0x60d

*** ERROR: Symbol file could not be found. Defaulted to export symbols for wam.dll -

02 0088f728 65d82b06 00de1e90 00de1f5c 00de1e90 badext!HttpExtensionProc+0x21b

03 0088f770 65d823a2 004077b0 00de2006 00de1e90 wam!SE_TABLE::ReleaseExtension+0xbe8

*** ERROR: Symbol file could not be found. Defaulted to export symbols for RPCRT4.DLL -

04 0088f7b4 77d339c0 00406d40 00000000 000000e1 wam!SE_TABLE::ReleaseExtension+0x484

05 0088f7dc 77d93570 65d8223f 0088f7f8 00000005 RPCRT4!NdrServerInitialize+0x288

06 0088fa54 77d949ac 0009d860 0009e0b8 0009ec08 RPCRT4!NdrStubCall2+0x570

*** ERROR: Symbol file could not be found. Defaulted to export symbols for ole32.dll -

07 0088fab8 77b29e7f 0009d860 0009ec08 0009e0b8 RPCRT4!CStdStubBuffer_Invoke+0x9e

08 0088fafc 77b29d6e 0009ec08 000ad03c 000a0860 ole32!HDC_UserMarshal+0x78a

09 0088fb44 77aa7ae7 0009ec08 000acf50 0009d860 ole32!HDC_UserMarshal+0x679

0a 0088fba8 77aa7a33 0009e0b8 00000000 0009d860 ole32!CoGetCallContext+0x401

0b 0088fbc4 77b29c89 0009ec08 00000001 0009d860 ole32!CoGetCallContext+0x34d

0c 0088fbf4 77b29a89 0009ebc0 0009e0b8 0009d860 ole32!HDC_UserMarshal+0x594

0d 0088fcb4 77b2a12c 000b19f8 00000000 000ad020 ole32!HDC_UserMarshal+0x394

0e 0088fcf4 77d33721 0009ebc0 000ad020 00079af0 ole32!HDC_UserMarshal+0xa37

0f 0088fd2c 77d33667 77b29f7b 00079af0 0088fe0c RPCRT4!I_RpcFree+0x1ff

10 0088fd84 77d33579 00000000 00000000 0088fe0c RPCRT4!I_RpcFree+0x145

11 0088fda4 77d48e81 00079af0 00000000 0088fe0c RPCRT4!I_RpcFree+0x57

12 0088fdd4 77d34bc6 00079af0 00079ab4 00000000 RPCRT4!RpcSsDestroyClientContext+0xa6

13 0088fe10 77d346c5 000a33b8 00081df8 80030001 RPCRT4!NdrCorrelationFree+0x1120

14 0088fe28 77d422ff 000799f8 0088fe50 000a33b8 RPCRT4!NdrCorrelationFree+0xc1f

15 0088ff74 77d420d9 77d42528 00081df8 00070000 RPCRT4!NdrConformantArrayMemorySize+0x4c5

16 0088ffa8 77d424da 00080f10 0088ffec 77e887dd RPCRT4!NdrConformantArrayMemorySize+0x29f

17 0088ffb4 77e887dd 0007e7b8 00070000 0006f740 RPCRT4!NdrConformantArrayMemorySize+0x6a0

18 0088ffec 00000000 77d424c2 0007e7b8 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 CONTINUABLE (Second parameter of RaiseException is 0) which means that even if it not handled, execution could continue.

 

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 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 and 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 encountered the unhandled exception would look like:

 

0:001> kvn50

# ChildEBP RetAddr Args to Child

00 0088f6e8 021e1938 00000057 00000000 00000000 KERNEL32!RaiseException+0x56 (FPO: [Non-Fpo])

01 0088f708 021e1546 00e023c0 00000001 00e0248c badext!doRE1+0x18 (FPO: [Non-Fpo])

03 0088f73c 65d82a97 00de1e90 00de1f5c 00de1e90 wam!HSE_APPDLL::ExecuteRequest+0x93 (FPO: [1,0,3]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\isplocal.cxx @ 450]

04 0088f770 65d823a2 004077b0 00de2006 00de1e90 wam!WAM::InvokeExtension+0x35 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 913]

05 0088f7b4 77d339c0 00406d40 00000000 000000e1 wam!WAM::ProcessRequest+0x240 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 643]

06 0088f7dc 77d93570 65d8223f 0088f7f8 00000005 RPCRT4!Invoke+0x30 [..\i386\stubless.asm @ 88]

07 0088fa54 77d949ac 0009d860 0009e0b8 0009ec08 RPCRT4!NdrStubCall2+0x63d (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\srvcall.c @ 1724]

08 0088fab8 77b29e7f 0009d860 0009ec08 0009e0b8 RPCRT4!CStdStubBuffer_Invoke+0xec (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\stub.c @ 1571]

09 0088fafc 77b29d6e 0009ec08 000ad03c 000a0860 ole32!SyncStubInvoke+0x61 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1136]

0a 0088fb44 77aa7ae7 0009ec08 000acf50 0009d860 ole32!StubInvoke+0xa8 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1334]

0b 0088fba8 77aa7a33 0009e0b8 00000000 0009d860 ole32!CCtxComChnl::ContextInvoke+0xbb (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\ctxchnl.cxx @ 1204]

0c 0088fbc4 77b29c89 0009ec08 00000001 0009d860 ole32!MTAInvoke+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\callctrl.cxx @ 1952]

0d 0088fbf4 77b29a89 0009ebc0 0009e0b8 0009d860 ole32!AppInvoke+0xb5 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1013]

0e 0088fcb4 77b2a12c 000b19f8 00000000 000ad020 ole32!ComInvokeWithLockAndIPID+0x29e (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1578]

0f 0088fcf4 77d33721 0009ebc0 000ad020 00079af0 ole32!ThreadInvoke+0x1b7 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 3835]

10 0088fd2c 77d33667 77b29f7b 00079af0 0088fe0c RPCRT4!DispatchToStubInC+0x84 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\dispatch.c @ 82]

11 0088fd84 77d33579 00000000 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x100 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 543]

12 0088fda4 77d48e81 00079af0 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStub+0x5e (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 407]

13 0088fdd4 77d34bc6 00079af0 00079ab4 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWithObject+0xa9 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 795]

14 0088fe10 77d346c5 000a33b8 00081df8 80030001 RPCRT4!LRPC_SCALL::DealWithRequestMessage+0x1c6 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 2665]

15 0088fe28 77d422ff 000799f8 0088fe50 000a33b8 RPCRT4!LRPC_ADDRESS::DealWithLRPCRequest+0x10c (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 867]

16 0088ff74 77d420d9 77d42528 00081df8 00070000 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x1eb (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 1175]

17 0088ff78 77d42528 00081df8 00070000 0006f740 RPCRT4!RecvLotsaCallsWrapper+0x9 (FPO: [1,0,0]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 37]

18 0088ffa8 77d424da 00080f10 0088ffec 77e887dd RPCRT4!BaseCachedThreadRoutine+0x4f (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 3586]

19 0088ffb4 77e887dd 0007e7b8 00070000 0006f740 RPCRT4!ThreadStartRoutine+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\threads.cxx @ 230]

1a 0088ffec 00000000 77d424c2 0007e7b8 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 (doRE1) 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:001> .frame4

04 0088f770 65d823a2 wam!WAM::InvokeExtension+0x35 [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 913]

 

0:001> dv

this = 0

psExt = 0040d028

szISADllPath = 00e02535 "C:\Inetpub\wwwroot\Dev\badext.dll"

pWamExecInfo = 00e023c0

ret = 0x406c08

 

0:001> dt pWamExecInfo -r

Local var @ 0x88f780 Type WAM_EXEC_INFO*

0x00e023c0

+0x000 ecb :

+0x000 cbSize : 0x90

+0x004 dwVersion : 0x40000

+0x008 ConnID : 0x00e023c0

+0x00c dwHttpStatusCode : 0xc8

+0x010 lpszLogData : [80] ""

+0x060 lpszMethod : 0x00e02520 "GET"

+0x064 lpszQueryString : 0x00e02557 "s=re1_v1"

+0x068 lpszPathInfo : 0x00e0250c ""

+0x06c lpszPathTranslated : 0x00e0250d "c:\inetpub\wwwroot"

+0x070 cbTotalBytes : 0

+0x074 cbAvailable : 0

.....

.....

.....

 

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 and 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:001> kvn50

# ChildEBP RetAddr Args to Child

00 0088f6e8 01151938 00000057 00000000 00000000 KERNEL32!RaiseException+0x56 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\windows\base\client\thread.c @ 1382]

01 0088f708 01151546 00de1e90 00000001 00de1f5c badext!doRE1+0x18 (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\extDBG\badext.cpp @ 461]

02 0088f728 65d82b06 00de1e90 00de1f5c 00de1e90 badext!HttpExtensionProc+0x21b (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\extDBG\badext.cpp @ 150]

03 0088f73c 65d82a97 00de1e90 00de1f5c 00de1e90 wam!HSE_APPDLL::ExecuteRequest+0x93 (FPO: [1,0,3]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\isplocal.cxx @ 450]

04 0088f770 65d823a2 004077b0 00de2006 00de1e90 wam!WAM::InvokeExtension+0x35 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 913]

05 0088f7b4 77d339c0 00406d40 00000000 000000e1 wam!WAM::ProcessRequest+0x240 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 643]

06 0088f7dc 77d93570 65d8223f 0088f7f8 00000005 RPCRT4!Invoke+0x30 [..\i386\stubless.asm @ 88]

07 0088fa54 77d949ac 0009d860 0009e0b8 0009ec08 RPCRT4!NdrStubCall2+0x63d (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\srvcall.c @ 1724]

08 0088fab8 77b29e7f 0009d860 0009ec08 0009e0b8 RPCRT4!CStdStubBuffer_Invoke+0xec (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\stub.c @ 1571]

09 0088fafc 77b29d6e 0009ec08 000ad03c 000a0860 ole32!SyncStubInvoke+0x61 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1136]

0a 0088fb44 77aa7ae7 0009ec08 000acf50 0009d860 ole32!StubInvoke+0xa8 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1334]

0b 0088fba8 77aa7a33 0009e0b8 00000000 0009d860 ole32!CCtxComChnl::ContextInvoke+0xbb (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\ctxchnl.cxx @ 1204]

0c 0088fbc4 77b29c89 0009ec08 00000001 0009d860 ole32!MTAInvoke+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\callctrl.cxx @ 1952]

0d 0088fbf4 77b29a89 0009ebc0 0009e0b8 0009d860 ole32!AppInvoke+0xb5 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1013]

0e 0088fcb4 77b2a12c 000b19f8 00000000 000ad020 ole32!ComInvokeWithLockAndIPID+0x29e (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1578]

0f 0088fcf4 77d33721 0009ebc0 000ad020 00079af0 ole32!ThreadInvoke+0x1b7 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 3835]

10 0088fd2c 77d33667 77b29f7b 00079af0 0088fe0c RPCRT4!DispatchToStubInC+0x84 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\dispatch.c @ 82]

11 0088fd84 77d33579 00000000 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x100 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 543]

12 0088fda4 77d48e81 00079af0 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStub+0x5e (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 407]

13 0088fdd4 77d34bc6 00079af0 00079ab4 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWithObject+0xa9 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 795]

14 0088fe10 77d346c5 000a33b8 00081df8 80030001 RPCRT4!LRPC_SCALL::DealWithRequestMessage+0x1c6 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 2665]

15 0088fe28 77d422ff 000799f8 0088fe50 000a33b8 RPCRT4!LRPC_ADDRESS::DealWithLRPCRequest+0x10c (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 867]

16 0088ff74 77d420d9 77d42528 00081df8 00070000 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x1eb (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 1175]

17 0088ff78 77d42528 00081df8 00070000 0006f740 RPCRT4!RecvLotsaCallsWrapper+0x9 (FPO: [1,0,0]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 37]

18 0088ffa8 77d424da 00080f10 0088ffec 77e887dd RPCRT4!BaseCachedThreadRoutine+0x4f (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 3586]

19 0088ffb4 77e887dd 0007e7b8 00070000 0006f740 RPCRT4!ThreadStartRoutine+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\threads.cxx @ 230]

1a 0088ffec 00000000 77d424c2 0007e7b8 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 150 looks like

 

DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *lpEcb)

{

.....

.....

if (!strncmp(szS, "av1", 3))

{

return doRE1(lpEcb, Variation); //Line 150

}

.....

.....

}

 

Line 461 looks like

 

 

DWORD doRE1(EXTENSION_CONTROL_BLOCK *lpEcb, int Variation)

{

DWORD dwThreadID;

HANDLE hThread;

if (1 == Variation)

{

RaiseException(ERROR_INVALID_PARAMETER, 0, 0, NULL); //line 461

}

if (2 == Variation)

{

hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)REContinuable, NULL, 0, &dwThreadID);

}

return HSE_STATUS_SUCCESS;

}

 

 

 

 

 

 

Note:

If on the other hand, the "debug break on failfast" is turned on (failfast enabled) or if the debugger is not set to break on "Other Exceptions",

the faulting stack would look like:

1) Without symbols

a) The faulting Stack

The stack backtrace of the thread that caused the Unhandled Exception would look like:

0:001> kvn50

# ChildEBP RetAddr Args to Child

WARNING: Stack unwind information not available. Following frames may be wrong.

00 0088f1a0 77ad99f7 0088f2e4 77aa7c18 00000000 ntdll!DbgBreakPoint

01 0088f2b4 77b2d60d 0088f2e4 000c7ae4 00000006 ole32!UpdateDCOMSettings+0x5091

02 0088fafc 77b29d6e 000a01f0 000c7ae4 000a0c88 ole32!WdtpInterfacePointer_UserUnmarshal+0x1c4

03 0088fb44 77aa7ae7 000a01f0 000c79f8 000b6110 ole32!HDC_UserMarshal+0x679

04 0088fba8 77aa7a33 0009fa1c 00000000 000b6110 ole32!CoGetCallContext+0x401

05 0088fbc4 77b29c89 000a01f0 00000001 000b6110 ole32!CoGetCallContext+0x34d

06 0088fbf4 77b29a89 000a01a8 0009fa1c 000b6110 ole32!HDC_UserMarshal+0x594

07 0088fcb4 77b2a12c 000c88f8 00000000 000c7ac8 ole32!HDC_UserMarshal+0x394

*** ERROR: Symbol file could not be found. Defaulted to export symbols for RPCRT4.DLL -

08 0088fcf4 77d33721 000a01a8 000c7ac8 0007a410 ole32!HDC_UserMarshal+0xa37

09 0088fd2c 77d33667 77b29f7b 0007a410 0088fe0c RPCRT4!I_RpcFree+0x1ff

0a 0088fd84 77d33579 00000000 00000000 0088fe0c RPCRT4!I_RpcFree+0x145

0b 0088fda4 77d48e81 0007a410 00000000 0088fe0c RPCRT4!I_RpcFree+0x57

0c 0088fdd4 77d34bc6 0007a410 0007a3d4 00000000 RPCRT4!RpcSsDestroyClientContext+0xa6

0d 0088fe10 77d346c5 000a51f8 00082690 80030001 RPCRT4!NdrCorrelationFree+0x1120

0e 0088fe28 77d422ff 0007a318 0088fe50 000a51f8 RPCRT4!NdrCorrelationFree+0xc1f

0f 0088ff74 77d420d9 77d42528 00082690 00070000 RPCRT4!NdrConformantArrayMemorySize+0x4c5

10 0088ffa8 77d424da 00081898 0088ffec 77e887dd RPCRT4!NdrConformantArrayMemorySize+0x29f

*** ERROR: Symbol file could not be found. Defaulted to export symbols for KERNEL32.DLL -

11 0088ffb4 77e887dd 0007ef58 00070000 0006f740 RPCRT4!NdrConformantArrayMemorySize+0x6a0

12 0088ffec 00000000 77d424c2 0007ef58 00000000 KERNEL32!GetModuleFileNameA+0x1d1

As you may have noticed in this faulting stack, the last call -assuming the export symbols for ntdll did line up- is to DbgBreakPoint. This means that an exception of some sort happened and since

the debugger is attached to the process raising the exception (dllhost.exe), DbgBreakPoint is called so that the debugger handles this exception.

Where this exception happened and what is the exact exception? To answer these questions, we need at least to line up the public symbols.

2) With symbols including public symbols of "badExt.dll"

First, we need to add the symbol path(company wide symbols) as well as symbols of our dll

0:001> .sympath+ \\symbols\symbols

Symbol search path is: \\symbols\symbols

0:001> .sympath+ c:\symbols\public (where public symbols of badExt.dll are located)

Symbol search path is: \\symbols\symbols;c:\symbols\public

The stack backtrace of the thread that caused the Unhandled Exception would look like:

0:001> kvn50

# ChildEBP RetAddr Args to Child

00 0088f15c 7875ffec 00075cc0 77ab1818 00000000 ntdll!DbgBreakPoint (FPO: [0,0,0])

01 0088f16c 7878c3ce 0088f2e4 00000000 00000000 COMSVCS!ComSvcsExceptionFilter+0x9c (FPO: [3,0,3])

02 0088f17c 77ad147a 0009dc10 0088f2e4 00000001 COMSVCS!CContext::ServerException+0xe (FPO: [2,0,0])

03 0088f1a0 77ad99f7 0088f2e4 77aa7c18 00000000 ole32!CObjectContext::NotifyServerException+0x77 (FPO: [Non-Fpo])

04 0088f2b4 77b2d60d 0088f2e4 000c7ae4 00000006 ole32!AppInvokeExceptionFilter+0x6c (FPO: [Non-Fpo])

05 0088fafc 77b29d6e 000a01f0 000c7ae4 000a0c88 ole32!SyncStubInvoke+0x85 (FPO: [Non-Fpo])

06 0088fb44 77aa7ae7 000a01f0 000c79f8 000b6110 ole32!StubInvoke+0xa8 (FPO: [Non-Fpo]) (CONV: stdcall)

07 0088fba8 77aa7a33 0009fa1c 00000000 000b6110 ole32!CCtxComChnl::ContextInvoke+0xbb (FPO: [Non-Fpo])

08 0088fbc4 77b29c89 000a01f0 00000001 000b6110 ole32!MTAInvoke+0x18 (FPO: [Non-Fpo]) (CONV: stdcall)

09 0088fbf4 77b29a89 000a01a8 0009fa1c 000b6110 ole32!AppInvoke+0xb5 (FPO: [Non-Fpo]) (CONV: stdcall)

0a 0088fcb4 77b2a12c 000c88f8 00000000 000c7ac8 ole32!ComInvokeWithLockAndIPID+0x29e (FPO: [Non-Fpo])

0b 0088fcf4 77d33721 000a01a8 000c7ac8 0007a410 ole32!ThreadInvoke+0x1b7 (FPO: [Non-Fpo])

0c 0088fd2c 77d33667 77b29f7b 0007a410 0088fe0c RPCRT4!DispatchToStubInC+0x84 (FPO: [Non-Fpo])

0d 0088fd84 77d33579 00000000 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x100 (FPO: [Non-Fpo])

0e 0088fda4 77d48e81 0007a410 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStub+0x5e (FPO: [Non-Fpo])

0f 0088fdd4 77d34bc6 0007a410 0007a3d4 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWithObject+0xa9 (FPO: [Non-Fpo]) 10 0088fe

10 77d346c5 000a51f8 00082690 80030001 RPCRT4!LRPC_SCALL::DealWithRequestMessage+0x1c6 (FPO: [Non-Fpo])

11 0088fe28 77d422ff 0007a318 0088fe50 000a51f8 RPCRT4!LRPC_ADDRESS::DealWithLRPCRequest+0x10c (FPO: [Non-Fpo])

12 0088ff74 77d420d9 77d42528 00082690 00070000 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x1eb (FPO: [Non-Fpo])

13 0088ff78 77d42528 00082690 00070000 0006f740 RPCRT4!RecvLotsaCallsWrapper+0x9 (FPO: [1,0,0]) (CONV: stdcall)

14 0088ffa8 77d424da 00081898 0088ffec 77e887dd RPCRT4!BaseCachedThreadRoutine+0x4f (FPO: [Non-Fpo])

15 0088ffb4 77e887dd 0007ef58 00070000 0006f740 RPCRT4!ThreadStartRoutine+0x18 (FPO: [Non-Fpo])

16 0088ffec 00000000 77d424c2 0007ef58 00000000 KERNEL32!BaseThreadStart+0x52 (FPO: [Non-Fpo])

Now, with the public symbols lined up, notice the call to "COMSVCS!ComSvcsExceptionFilter " that called the DbgBreakPoint.

So basically what happened is that a component running in dllhost raised an exception that it did not handle. Since the component is actually running in a COM+ package (dllhost), COMSVCS is

the first to be notified about this exception to try to handle it.

To get the component that raised this unhandled exception, we need to reconstruct the call stack as follows:

0:001> dd 0088f2e4 L2

0088f2e4 0088f3b0 0088f3c4

 

0:001> .exr 0088f3b0

ExceptionAddress: 77e9e8bb (KERNEL32!RaiseException+0x00000056)

ExceptionCode: 00000057

ExceptionFlags: 00000000

NumberParameters: 0

 

0:001> .cxr 0088f3c4

eax=0088f698 ebx=00000003 ecx=00000000 edx=7803b012 esi=00000000 edi=0040d3b0

eip=77e9e8bb esp=0088f690 ebp=0088f6e8 iopl=0 nv up ei pl zr na po nc

cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246 KERNEL32!RaiseException+56: 77e9e8bb e988c60100 jmp

KERNEL32!RaiseException+0x56 (77ebaf48)

 

0:001> kvn50

# ChildEBP RetAddr Args to Child

00 0088f6e8 021e1938 00000057 00000000 00000000 KERNEL32!RaiseException+0x56 (FPO: [Non-Fpo]) 1382]

01 0088f708 021e1546 00e023c0 00000001 00e0248c badext!doRE1+0x18

02 0088f728 65d82b06 00e023c0 00e0248c 00e023c0 badext!HttpExtensionProc+0x21b

03 0088f73c 65d82a97 00e023c0 00e0248c 00e023c0 wam!HSE_APPDLL::ExecuteRequest+0x93 (FPO: [1,0,3])

04 0088f770 65d823a2 0040d028 00e02535 00e023c0 wam!WAM::InvokeExtension+0x35 (FPO: [Non-Fpo])

05 0088f7b4 77d339c0 00406c08 00000000 000000cb wam!WAM::ProcessRequest+0x240 (FPO: [Non-Fpo])

06 0088f7dc 77d93570 65d8223f 0088f7f8 00000005 RPCRT4!Invoke+0x30 [..\i386\stubless.asm @ 88]

07 0088fa54 77d949ac 000b6110 0009fa1c 000a01f0 RPCRT4!NdrStubCall2+0x63d (FPO: [Non-Fpo])

08 0088fab8 77b29e7f 000b6110 000a01f0 0009fa1c RPCRT4!CStdStubBuffer_Invoke+0xec

09 0088fafc 77b29d6e 000a01f0 000c7ae4 000a0c88 ole32!SyncStubInvoke+0x61 (FPO: [Non-Fpo])

0a 0088fb44 77aa7ae7 000a01f0 000c79f8 000b6110 ole32!StubInvoke+0xa8 (FPO: [Non-Fpo])

0b 0088fba8 77aa7a33 0009fa1c 00000000 000b6110 ole32!CCtxComChnl::ContextInvoke+0xbb (FPO: [Non-Fpo])

0c 0088fbc4 77b29c89 000a01f0 00000001 000b6110 ole32!MTAInvoke+0x18 (FPO: [Non-Fpo])

0d 0088fbf4 77b29a89 000a01a8 0009fa1c 000b6110 ole32!AppInvoke+0xb5 (FPO: [Non-Fpo])

0e 0088fcb4 77b2a12c 000c88f8 00000000 000c7ac8 ole32!ComInvokeWithLockAndIPID+0x29e (FPO: [Non-Fpo])

0f 0088fcf4 77d33721 000a01a8 000c7ac8 0007a410 ole32!ThreadInvoke+0x1b7 (FPO: [Non-Fpo])

10 0088fd2c 77d33667 77b29f7b 0007a410 0088fe0c RPCRT4!DispatchToStubInC+0x84 (FPO: [Non-Fpo])

11 0088fd84 77d33579 00000000 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x100 (FPO: [Non-Fpo])

12 0088fda4 77d48e81 0007a410 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStub+0x5e (FPO: [Non-Fpo])

13 0088fdd4 77d34bc6 0007a410 0007a3d4 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWithObject+0xa9 (FPO: [Non-Fpo])

14 0088fe10 77d346c5 000a51f8 00082690 80030001 RPCRT4!LRPC_SCALL::DealWithRequestMessage+0x1c6 (FPO: [Non-Fpo])

15 0088fe28 77d422ff 0007a318 0088fe50 000a51f8 RPCRT4!LRPC_ADDRESS::DealWithLRPCRequest+0x10c (FPO: [Non-Fpo])

16 0088ff74 77d420d9 77d42528 00082690 00070000 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x1eb (FPO: [Non-Fpo])

17 0088ff78 77d42528 00082690 00070000 0006f740 RPCRT4!RecvLotsaCallsWrapper+0x9 (FPO: [1,0,0])

18 0088ffa8 77d424da 00081898 0088ffec 77e887dd RPCRT4!BaseCachedThreadRoutine+0x4f (FPO: [Non-Fpo])

19 0088ffb4 77e887dd 0007ef58 00070000 0006f740 RPCRT4!ThreadStartRoutine+0x18 (FPO: [Non-Fpo])

1a 0088ffec 00000000 77d424c2 0007ef58 00000000 KERNEL32!BaseThreadStart+0x52 (FPO: [Non-Fpo])

So, this shows that the RaiseException call in kernel32 came from the function (doRE1) in "badext.dll".

The first parameter of RaiseException is the exception code. In this case "00000057" which translates to "ERROR_INVALID_PARAMETER"

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.

 

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:001> .frame4

04 0088f770 65d823a2 wam!WAM::InvokeExtension+0x35 [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 913]

0:001> dv

this = 0

psExt = 0040d028

szISADllPath = 00e02535 "C:\Inetpub\wwwroot\Dev\badext.dll"

pWamExecInfo = 00e023c0

ret = 0x406c08

0:001> dt pWamExecInfo -r

Local var @ 0x88f780 Type WAM_EXEC_INFO*

0x00e023c0

+0x000 ecb :

+0x000 cbSize : 0x90

+0x004 dwVersion : 0x40000

+0x008 ConnID : 0x00e023c0

+0x00c dwHttpStatusCode : 0xc8

+0x010 lpszLogData : [80] ""

+0x060 lpszMethod : 0x00e02520 "GET"

+0x064 lpszQueryString : 0x00e02557 "s=re1_v1"

+0x068 lpszPathInfo : 0x00e0250c ""

+0x06c lpszPathTranslated : 0x00e0250d "c:\inetpub\wwwroot"

+0x070 cbTotalBytes : 0

+0x074 cbAvailable : 0

.....

.....

.....

 

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 M (pdb symbols) c:\symbols\public\badext.pdb

Loaded symbol image file: C:\Inetpub\wwwroot\Dev\badext.dll Image path: C:\Inetpub\wwwroot\Dev\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"

 

The stack backtrace of the thread that caused the Unhandled Exception would look like:

0:001> kvn50

# ChildEBP RetAddr Args to Child

00 0088f6e8 021e1938 00000057 00000000 00000000 KERNEL32!RaiseException+0x56 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\windows\base\client\thread.c @ 1382]

01 0088f708 021e1546 00e023c0 00000001 00e0248c badext!doRE1+0x18 (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\extDBG\badext.cpp @ 461]

02 0088f728 65d82b06 00e023c0 00e0248c 00e023c0 badext!HttpExtensionProc+0x21b (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\extDBG\badext.cpp @ 150]

03 0088f73c 65d82a97 00e023c0 00e0248c 00e023c0 wam!HSE_APPDLL::ExecuteRequest+0x93 (FPO: [1,0,3]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\isplocal.cxx @ 450]

04 0088f770 65d823a2 0040d028 00e02535 00e023c0 wam!WAM::InvokeExtension+0x35 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 913]

05 0088f7b4 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 0088f7dc 77d93570 65d8223f 0088f7f8 00000005 RPCRT4!Invoke+0x30 [..\i386\stubless.asm @ 88]

07 0088fa54 77d949ac 000b6110 0009fa1c 000a01f0 RPCRT4!NdrStubCall2+0x63d (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\srvcall.c @ 1724]

08 0088fab8 77b29e7f 000b6110 000a01f0 0009fa1c RPCRT4!CStdStubBuffer_Invoke+0xec (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\stub.c @ 1571]

09 0088fafc 77b29d6e 000a01f0 000c7ae4 000a0c88 ole32!SyncStubInvoke+0x61 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1136]

0a 0088fb44 77aa7ae7 000a01f0 000c79f8 000b6110 ole32!StubInvoke+0xa8 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1334]

0b 0088fba8 77aa7a33 0009fa1c 00000000 000b6110 ole32!CCtxComChnl::ContextInvoke+0xbb (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\ctxchnl.cxx @ 1204]

0c 0088fbc4 77b29c89 000a01f0 00000001 000b6110 ole32!MTAInvoke+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\callctrl.cxx @ 1952]

0d 0088fbf4 77b29a89 000a01a8 0009fa1c 000b6110 ole32!AppInvoke+0xb5 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1013]

0e 0088fcb4 77b2a12c 000c88f8 00000000 000c7ac8 ole32!ComInvokeWithLockAndIPID+0x29e (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1578]

0f 0088fcf4 77d33721 000a01a8 000c7ac8 0007a410 ole32!ThreadInvoke+0x1b7 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 3835]

10 0088fd2c 77d33667 77b29f7b 0007a410 0088fe0c RPCRT4!DispatchToStubInC+0x84 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\dispatch.c @ 82]

11 0088fd84 77d33579 00000000 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x100 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 543]

12 0088fda4 77d48e81 0007a410 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStub+0x5e (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 407]

13 0088fdd4 77d34bc6 0007a410 0007a3d4 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWithObject+0xa9 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 795]

14 0088fe10 77d346c5 000a51f8 00082690 80030001 RPCRT4!LRPC_SCALL::DealWithRequestMessage+0x1c6 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 2665]

15 0088fe28 77d422ff 0007a318 0088fe50 000a51f8 RPCRT4!LRPC_ADDRESS::DealWithLRPCRequest+0x10c (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 867]

16 0088ff74 77d420d9 77d42528 00082690 00070000 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x1eb (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 1175]

17 0088ff78 77d42528 00082690 00070000 0006f740 RPCRT4!RecvLotsaCallsWrapper+0x9 (FPO: [1,0,0]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 37]

18 0088ffa8 77d424da 00081898 0088ffec 77e887dd RPCRT4!BaseCachedThreadRoutine+0x4f (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 3586]

19 0088ffb4 77e887dd 0007ef58 00070000 0006f740 RPCRT4!ThreadStartRoutine+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\threads.cxx @ 230]

1a 0088ffec 00000000 77d424c2 0007ef58 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 150 looks like

DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *lpEcb)

{

.....

.....

if (!strncmp(szS, "av1", 3))

{

return doDZ1(lpEcb, Variation); //Line 150

}

.....

.....

}

Line 461 looks like

DWORD doRE1(EXTENSION_CONTROL_BLOCK *lpEcb, int Variation)

{

DWORD dwThreadID;

HANDLE hThread;

if (1 == Variation)

{

RaiseException(ERROR_INVALID_PARAMETER, 0, 0, NULL); //line 461

}

if (2 == Variation)

{

hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)REContinuable, NULL, 0, &dwThreadID);

}

return HSE_STATUS_SUCCESS;

}

 

 

 

 

 


		

 

1) Unknown Exception in a spawned thread: (Variation 2)

1- Debug Annotation

 

1) Without symbols

 

a) The faulting Stack

 

The stack backtrace of the thread that caused the Unhandled Exception would look like:

 

 

 

0:027> kvn50

# ChildEBP RetAddr Args to Child

WARNING: Stack unwind information not available. Following frames may be wrong.

00 023affa0 022e19a0 00000057 00000000 00000000 KERNEL32!RaiseException+0x37

01 023affec 00000000 022e1993 00000000 00000000 badext!HttpExtensionProc+0x675

 

 

In this stack backtrace, 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.

 

b) The regiters values

 

 

 

0:027> r

eax=023aff50 ebx=00000000 ecx=00000101 edx=ffffffff esi=00000000 edi=00000000

eip=77e9e8bb esp=023aff48 ebp=023affa0 iopl=0 nv up ei pl zr na po nc

cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246

KERNEL32!RaiseException+37:

77e9e8bb e988c60100 jmp KERNEL32!GetThreadPriorityBoost+0x105 (77ebaf48)

 

 

c) The disassmbly code

 

0:027> u eip

KERNEL32!RaiseException+37:

77e9e8bb e988c60100 jmp KERNEL32!GetThreadPriorityBoost+0x105 (77ebaf48)

77e9e8c0 8b4510 mov eax,[ebp+0x10]

77e9e8c3 83f80f cmp eax,0xf

77e9e8c6 0f8774c60100 jnbe KERNEL32!GetThreadPriorityBoost+0xfd (77ebaf40)

77e9e8cc 8945c0 mov [ebp-0x40],eax 77e9e8cf 8bc8 mov ecx,eax

77e9e8d1 48 dec eax

77e9e8d2 85c9 test ecx,ecx

 

2) With symbols including public symbols of "badExt.dll"

 

First, we need to add the symbol path(company wide symbols) as well as symbols of our dll

 

0:001> .sympath+ \\symbols\symbols

Symbol search path is: \\symbols\symbols

0:001> .sympath+ c:\symbols\public (where public symbols of badExt.dll are located)

Symbol search path is: \\symbols\symbols;c:\symbols\public

The stack backtrace of the thread that caused the Unhandled Exception would look like:

 

0:027> kvn50

# ChildEBP RetAddr Args to Child

00 023affa0 022e19a0 00000057 00000000 00000000 KERNEL32!RaiseException+0x56 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\windows\base\client\thread.c @ 1382]

01 023affec 00000000 022e1993 00000000 00000000 badext!REContinuable+0xd

 

 

Now, with the public symbols lined up, we see that the function call that raised the exception is to "ReContinuable"

 

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.

 

 

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 M (pdb symbols) c:\symbols\public\badext.pdb

Loaded symbol image file: C:\Inetpub\wwwroot\Dev\badext.dll Image path: C:\Inetpub\wwwroot\Dev\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"

The stack backtrace of the thread that caused the Unhandled Exception would look like:

 

0:027> kvn50

# ChildEBP RetAddr Args to Child

00 023affa0 022e19a0 00000057 00000000 00000000 KERNEL32!RaiseException+0x56 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\windows\base\client\thread.c @ 1382]

01 023affec 00000000 022e1993 00000000 00000000 badext!REContinuable+0xd (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\extDBG\badext.cpp @ 501]

 

   

Notice in frame OO and 01 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 515 looks like

 

DWORD REContinuable()

{

RaiseException(ERROR_INVALID_PARAMETER, 0, 0, NULL); //line 501

return 1;

}

 


- Microsoft Confidential -