Debug Labs


Other Second Chance Exceptions  

This lab will demonstrate a Second Chance Invalid Handle Exception . In this scenarion, an Invalid File Handle was passed to a function.

 

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

4- Add the symbol path in windbg using the GUI or the ".sympath+" command. (Use the company wide symbol server \\symbols\symbols)

a) Using the GUI:

- Click "File"

- Click "Symbol File Path"

- Type in \\symbols\symbols and hit Enter

b) Using the ".sympath+" command:

Go to windbg command line and type in this command ".sympath+ \\symbols\symbols" and press Enter.

 

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.

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 "AV Extension" button the first time to cause a 1st chance AV 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 AV happened
d- The assembly line that caused the AV

					

                                                                           

 

1- Debug Annotation

 

1) Without symbols

 

a) The faulting Stack

 

The stack backtrace of the thread that AV'd would look like:

  

b) The regiters values

 

 

c) The disassmbly code

   

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 AV'd would look like:

 

 

Advanced Technique

 

 

To verify that the symbols are lined up properly for our extension, issue this command.

 

0:019>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 AV'd would look like:

 

 


- Microsoft Confidential -