Lab 17 Using Kernel Debugging Commands With WinDbg
Lab 17 Using Kernel Debugging Commands With WinDbg
)
What You Need
A Windows 10 machine with Livekd working, as prepared in the previous project. This project should work on Win 7 or any later version, but I only tested it on
Windows 10.
Purpose
Practice using simple WinDbg commands.
Starting Configuration
You should have Livekd running, which launched WinDbg, as you did at the end of the previous project.
lm
Scroll back to see the lm command you entered, and the first few loaded kernel modules, as shown below.
Scroll down to find the module named nt, as shown below. It's easy to spot because it'e one of the few modules that shows a Symbols path.
dd nt
da nt
You see the characters "MZ" --they are at the start of every EXE file.
da nt+4c
You see the message "This program cannot be run in DOS mode", as shown below:
Save the image with a filename of "Proj 13a from YOUR NAME".
Searching for Functions
In WinDbg, execute this command:
x nt!*
x nt!*Create*
This finds all the functions in Ntoskrnl that contain the word "Create".
x nt!*CreateFile*
This finds all the functions in Ntoskrnl that contain the word "CreateFile".
There are only about ten of those, including "nt!NtCreateFile", as shown below:
Unassembling a Function
In WinDbg, execute this command:
u nt!NtCreateFile
This shows the first few bytes of the function, disassembled, as shown below:
To see more of this function, it helps to use the WinDbg Disassembly window.
nt!NtCreateFile
This shows the assembly code before and after the start of the NtCreateFile function, as shown below:
nt!NtCreateFile+16
Resize this window to make the entire function visible. Drag the mouse through it to highlight the entire function, as shown below.
Saving a Screen Image
Make sure you have highlighted the entire function, as shown above.
Save the image with a filename of "Proj 13b from YOUR NAME".
Online Help
Close the Disassembly window.
You see the first page of the online help, as shown below:
Press Enter to see the other page.
dt nt!_DRIVER_OBJECT
This shows the first few lines of a driver object structure, which stores information about a kernel driver, as shown below. Notice the DriverStart pointer--this contains
the location of the driver in memory.
Save the image with a filename of "Proj 13c from YOUR NAME".