Code Example: A WinDbg Extension

This example shows how to write a simple WinDbg extension DLL. The code is contained on the accompanying CD and on the book's web site: http://www.W2KDriverBook.com. The purpose of the extension is to provide one command: !devext that formats and displays the driver's Device Extension data structure.

DBG.C

All the code for this extension resides in a single source file. Of course, the file #includes other files, but they are sourced from elsewhere, such as the driver.

HEADER

This part of the code contains the definitions for the extension DLL.

 // The ordering of #include files is important #include <ntddk.h> #include <windef.h> // The following items are from WINBASE.H // in the Win32 SDK. (WINBASE.H itself ...

Get Windows® 2000 Device Driver Book: A Guide for Programmers, Second Edition, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.