๐Ÿ” dk

June 19, 2026 ยท View on GitHub

๐Ÿ” dk โ€” Advanced WinDbg Extension

A powerful WinDbg extension for deep Windows kernel and user-mode debugging, with rich visualizations and Time Travel Debugging support.

License: MIT Release Platform: Windows x64 | x86 WinDbg Extension C++17


โœจ What is dk?

dk is an enhanced, extensible WinDbg extension originally derived from tokenext. It goes far beyond a token inspector โ€” dk is a comprehensive toolkit for Windows kernel and user-mode debugging, offering:

  • ๐Ÿง  Deep kernel introspection โ€” processes, threads, tokens, objects, modules, handles, sessions, pools
  • ๐Ÿ“„ Memory analysis โ€” pages, VADs, heap, virtual address regions, pool tracking
  • ๐ŸŽจ SVG visualizations โ€” export memory pages, call-stack forests, and address reference trees as interactive SVGs
  • โฑ๏ธ Time Travel Debugging (TTD) โ€” replay and analyze recorded execution, memory access history, and call events
  • ๐ŸŒ Embedded HTTP server โ€” serve debug data over a local REST API for external tooling
  • ๐Ÿค– Debugger Data Model โ€” leverage WinDbg's modern structured object model
  • ๐Ÿ–ฅ๏ธ x64 and x86 (Win32) โ€” supports both 64-bit and 32-bit WinDbg sessions

๐Ÿ–ผ๏ธ Demos

Memory Page Visualization (page_2_svg)

DemoDescription
Initial versionBasic page content layout
Buffer & symbol pointersLocal buffer pointers (green), symbol pointers (red)
Heap pointersHeap allocation pointers (blue)
Heap history (clickable)Heap allocation change history with clickable links

TTD Call-Stack Forest Visualization (dump_ttd_events)

Generate an interactive SVG call-stack forest from a Time Travel Debugging session (best for small projects):

0:001> !dk ldttd
0:001> !dk dump_ttd_events d:\helloworld_viz

๐Ÿ“Š View helloworld demo (open locally for click interaction โ€” browsers block SVG scripts)


๐Ÿ“ฆ Download

Pre-built binaries for v1.0.5 are available on the Releases page. Pick the build that matches your WinDbg architecture:

BuildArchitectureDownload
Release x64 (recommended)64-bit WinDbgdk-v1.0.5-Release-x64.zip
Release x86 (Win32)32-bit WinDbgdk-v1.0.5-Release-Win32.zip
Debug x6464-bit WinDbgdk-v1.0.5-Debug-x64.zip
Debug x86 (Win32)32-bit WinDbgdk-v1.0.5-Debug-Win32.zip

Tip: Use the Release build for everyday debugging. Use Debug builds only when diagnosing issues with the extension itself.


๐Ÿš€ Quick Start

  1. Download the ZIP for your architecture from the ๐Ÿ“ฆ Download section above.
  2. Extract it to a folder, e.g. C:\tools\dk\.
  3. Load the extension in WinDbg:
    .load C:\tools\dk\dk.dll
    
  4. Verify:
    !dk help
    

Option B โ€” Build from source

Prerequisites

Steps

  1. Clone the repository:
    git clone https://github.com/long123king/dk.git
    
  2. Open dk.sln in Visual Studio.
  3. Build in Release | x64 (or Release | Win32 for 32-bit) configuration.
  4. Load the resulting dk.dll in WinDbg as shown above.

๐Ÿ“– Command Reference

Run !dk help for the full list, or !dk help <command> for detailed usage of a specific command.

Process & Thread

CommandDescription
!dk psesList all processes
!dk process [EPROCESS_Addr]Dump detailed process information
!dk ps_flags <EPROCESS_Addr>Analyze process flags
!dk kill <EPROCESS_Addr>Terminate a process
!dk threadsList threads for the current process
!dk kallDump all stack backtraces (single process)
!dk pkallDump all stack backtraces (all processes)

Security (Token / SID / Privileges)

CommandDescription
!dk token [Token_Addr]Dump a security token object
!dk sid <SID_Addr>Dump a Security Identifier (SID)
!dk add_privilege <Priv_Value>Add a privilege to the current token

Memory & Pages

CommandDescription
!dk va_regionsAnalyze virtual address regions
!dk page <Virtual_Addr>Dump page table translation
!dk pages <Virtual_Addr>Dump page table entries for a region
!dk vad <MMVAD_Addr>Display VAD information
!dk as_qword <Address> [Count]Display memory as QWORDs with type enrichment
!dk as_mem <Address>Display memory content with type enrichment
!dk page_2_svg <Addr> <Svg_File>Export a page to SVG
!dk pages_2_svg <Addr> <Count> <Svg_File>Export continuous pages to SVG

Kernel Pool

CommandDescription
!dk poolhdr <Address>Decode pool header
!dk bigpoolDump kernel Big Pool allocations
!dk poolrangeDump pool allocation range
!dk pooltrackAnalyze pool tracking info
!dk poolmetricsDisplay pool metrics
!dk free_pool <Size_Hex>Search for free pool chunks of a given size

Heap (User Mode)

CommandDescription
!dk heap_ssumDisplay heap size summary
!dk heap_bysize <Size_Hex>List heap allocations of a specific size
!dk heap_oversize <Size_Hex>List heap allocations larger than a given size

Objects & Handles

CommandDescription
!dk obj <Object_Addr>Display Object Header and type info
!dk gobjDump global Root Object Directory
!dk obj_dir <Directory_Addr>List Object Directory contents
!dk handle_table <TableAddr>Display a handle table
!dk khandlesDump kernel handles

Modules & PE

CommandDescription
!dk lmList all modules
!dk lmuList user-mode modules
!dk lmkList kernel modules
!dk pe_hdr <Addr>Dump PE header
!dk peguid <Address>Extract PE GUID
!dk unloaded_peSearch for potential unloaded PE modules

User-Mode Search & Analysis

CommandDescription
!dk usearch_astr <String>Search user memory for an ASCII string
!dk usearch_ustr <String>Search user memory for a Unicode string
!dk usearch_bytes <Bytes>Search user memory for bytes
!dk usearch_addr <Address>Search user memory for an address
!dk uaddr_analyze <Address>Analyze a user-mode address
!dk uaddr_ref_tree <Address>Display address reference tree
!dk uaddr_analyze_svg <Address>Analyze user-mode address, output as SVG
!dk ustacksSummarize user-mode stacks

Time Travel Debugging (TTD)

CommandDescription
!dk ldttdLoad/initialize TTD support
!dk ttd_callsList TTD calls
!dk ttd_mem_accessTTD memory access analysis
!dk ttd_mem_useTTD memory usage info
!dk ttd_vis_infoGenerate TTD visualization information
!dk dump_ttd_events <Output_Dir>Dump TTD events as SVG visualizations
!dk dump_ttd_events_to_csv <Filename>Dump TTD events to a CSV file

Debugger Data Model

CommandDescription
!dk ls_model <root>List model objects (Sessions, Settings, State, Utility, LastEvent)
!dk ls_sessionsList model sessions
!dk ls_processes <session_id>List model processes
!dk ls_threads <session_id> <pid>List model threads
!dk ls_modules <session_id> <pid>List model modules
!dk ls_handles <session_id> <pid>List model handles
!dk mobj <path>Dump a model object at a path
!dk call <path>Call a model function

Embedded HTTP Server

Start a local REST API server to expose debug data to external tools:

0:001> !dk serve_start [host] [port]

Default listens on http://127.0.0.1:8080. Stop with GET /api/server/stop.


๐Ÿ—๏ธ Building a New WinDbg C++ Extension

1. Add Windows Kits paths to Visual Studio project settings

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- ... -->
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <IncludePath>C:\Program Files (x86)\Windows Kits\10\Debuggers\inc;$(IncludePath)</IncludePath>
    <LibraryPath>C:\Program Files (x86)\Windows Kits\10\Debuggers\lib\x64;$(LibraryPath)</LibraryPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <IncludePath>C:\Program Files (x86)\Windows Kits\10\Debuggers\inc;$(IncludePath)</IncludePath>
    <LibraryPath>C:\Program Files (x86)\Windows Kits\10\Debuggers\lib\x64;$(LibraryPath)</LibraryPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <IncludePath>C:\Program Files (x86)\Windows Kits\10\Debuggers\inc;$(IncludePath)</IncludePath>
    <LibraryPath>C:\Program Files (x86)\Windows Kits\10\Debuggers\lib\x86;$(LibraryPath)</LibraryPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <IncludePath>C:\Program Files (x86)\Windows Kits\10\Debuggers\inc;$(IncludePath)</IncludePath>
    <LibraryPath>C:\Program Files (x86)\Windows Kits\10\Debuggers\lib\x86;$(LibraryPath)</LibraryPath>
  </PropertyGroup>
  <!-- ... -->
</Project>

2. Patch engextcpp.cpp

Copy engextcpp.cpp from C:\Program Files (x86)\Windows Kits\10\Debuggers\inc into your project and apply the following fixes:

248c248
<     m_OptionChars = "/-";
---
>     m_OptionChars = const_cast<PSTR>("/-");
286c286
<     PSTR Value = "";
---
>     PSTR Value = const_cast<PSTR>("");
2673c2673
<              BufferChars > 0)
---
>              *BufferChars > 0)

3. Define exported symbols in dk.def

Every WinDbg extension DLL must export at minimum these four symbols:

DebugExtensionInitialize
DebugExtensionUninitialize
DebugExtensionNotify
help

๐Ÿ“š References


๐Ÿ“„ License

This project is licensed under the MIT License.