So yesterday I was troubleshooting some window creation issues, and had to fool around in the kernel side of window creation, down in win32k.sys. Specifically I was looking at window class registration, which happens when you call RegisterClassEx from your Windows app. Down in the kernel, some magic happens with creating Atoms as part of the window class registration. I traced through a bunch of win32k.sys routines to figure out where in memory they were storing this, and then I wanted to dump the table. After dumping about 4 of the entries manually, I got bored and wrote this little gem:
r $t0=poi(poi(win32k!UserAtomTableHandle)+c) .for ( r $t1=0; @$t1 < @$t0; r $t1 = @$t1 + 1 ) { du poi(poi(win32k!UserAtomTableHandle)+10+( @$t1 * 4))+c }
Basically, this uses the symbol win32k!UserAtomTableHandle to find the length of the table, and then uses a for loop to go through, calculating the offset of each item, and them dumping its string value. On my Windows 7 system it produced something like this:
8c2a3d1c "Native" 878b0c9c "ObjectLink" 87e1e18c "AeroWizardInternalFrameButtonCli" 87e1e1cc "cked" 878cb314 "Static" 878cb104 "DDEMLUnicodeClient" 9620faec "DataObject" 8c2affa4 "ACTIVATESHELLWINDOW" 8c2afe34 "FlashWState" 9620fa84 "SysCH" 8c2b2ce4 "PBrush" 8c3b8f24 "MSUIM.Msg.RpcSendReceive" 878bb7b4 "SysIC" 878cb1ec "DDEMLEvent" 878bb784 "SHELLHOOK" 8c2b2e0c "Custom Link Source" 9159dc84 "AltTab_KeyHookWnd" 91529084 "Search Box" 878bb6f4 "SysDT" 8c2b2dd4 "Link Source" 9620fb8c "FileName" 87e35b0c "GDI+ Accessibility" 878bb664 "SysWNDO" 878bb854 "DDEMLAnsiServer" 87e0c0bc "SysLink" 9620fb24 "NetworkName" 8c2cde3c "USER32" 8c2b2d14 "OleDraw" 9620fb5c "FileNameW" 8c2b2bec "MoreOlePrivateData" 8c282434 "Edit" 9620fbbc "Binary" 878cb374 "OleClipboardPersistOnFlush" 8c2a3d4c "OwnerLink" 878cb2e4 "ListBox" 8c2b2e54 "Embed Source" 878bb634 "SysIMEL" 878cb224 "ComboLBox"
If I knew anything about computer programming etc… I’ll bet I would find this super cool! But since I don’t, I’ll just have to say I think YOU’RE super cool. ๐
Unfortunately, probably even most computer programmers out there don’t find it interesting. But hopefully somebody will find it useful at some point. But thanks for thinking I’M cool. ๐