This is counterintuitive but if you want to see how to write a Win32 debugger, Wine is by far your best bet: https://github.com/wine-mirror/wine/tree/master/programs/winedbg">https://github.com/wine-mirr...
I mentioned this years ago but my main source of information for non-obvious Win32 arcana is the ReactOS and Wine source code, not MSDN docs or even the Windows Internals books.
Also, ReactOS is the nicest kernel code for something of this scale I& #39;ve seen anywhere.