Listing 3: wdjext.c Support code for building debugger extensions
// This is boilerplate code that can be included in any WinDbg // kernel debugger extension project. // // includes <wdbgexts.h> and other required headers and definitions #include "wdjexts.h" // note that the name of the following variable is important, // because the macros in <wdbgexts.h> assume it is ExtensionApis. WINDBG_EXTENSION_APIS ExtensionApis; USHORT MjVersion; USHORT MnVersion; // WinDbgExtensionDllInit() is called when the debugger loads // your extension DLL. VOID WDBGAPI WinDbgExtensionDllInit( PWINDBG_EXTENSION_APIS lpExtensionApis, USHORT MajorVersion, USHORT MinorVersion ) { ExtensionApis = *lpExtensionApis; // structure copy MjVersion = MajorVersion; MnVersion = MinorVersion; } // ExtensionApiVersion() is called by the debugger to insure that // your routines were written to a compatibile interface version. EXT_API_VERSION Version = { 3, 5, EXT_API_VERSION_NUMBER, 0 }; LPEXT_API_VERSION WDBGAPI ExtensionApiVersion() { return &Version; } // Feel free to uncomment the next function if need be. See the // article text for discussion of this function. //ULONG //WDBGAPI //CheckVersion() //{ // return (ULONG)1; // who knows? //} //End of File