Unfortunately those Eng* functions can only be used from display drivers and not kernel mode drivers, so it's a little tricky to suss 'em out.
if some fortunate or unfortunate soul tries to suss em out here is a little hack
to get all those sussed out information back to original win32k.sys 's PDB
so that windbg or livekd recognises them without any problems 
1) you would need ddk or wdk or whatever rtm it is called nowadays
for the cl.exe and build environment
2) you would need a c file that contains the definitions like blah.c
you would need the following command to put your blah.c information into
microsofts pdb file
here is the command line
Code:
C:\win32kpdb>cl.exe /Zi /Gz /c /Fdwin32k.pdb /ID:\WINDDK\3790~1.183\inc\wxp /ID:
\WINDDK\3790~1.183\inc /ID:\WINDDK\3790~1.183\inc\crt /ID:\WINDDK\3790~1.183\inc
\ddk\wxp /ID:\WINDDK\3790~1.183\inc\hal\wxp /ID:\WINDDK\3790~1.183\inc\ifs\wxp /
ID:\WINDDK\3790~1.183\inc\mfc42 /ID:\WINDDK\3790~1.183\inc\wxp /ID:\WINDDK\3790~
1.183\inc\processor /ID:\WINDDK\3790~1.183\inc\ddk\wdm\wxp /D_X86_=1 tagthread.c
i used specific include paths specific to my setup of ddk your mileage may vary you would need to define _x86_ macro
tag thread.c is the file that contains the information that i added to win32k.sys file
whose contents at that time of experiment was
Code:
#include <ntddk.h>
typedef void *POINTER;
typedef POINTER PDESKTOPINFO;
typedef POINTER PPROCESSINFO;
typedef POINTER PTL;
typedef POINTER PQ;
typedef POINTER PKL;
typedef POINTER PCLIENTTHREADINFO;
typedef POINTER PDESKTOP;
typedef POINTER PCLIENTINFO;
typedef POINTER PSMS;
typedef POINTER PMENUSTATE;
typedef POINTER PTDB;
typedef POINTER PWINDOWSTATION;
typedef POINTER PSVR_INSTANCE_INFO;
typedef POINTER PMOVESIZEDATA;
typedef POINTER PSBTRACK;
typedef POINTER PWND;
typedef POINTER PIMC;
typedef POINTER PQMSG;
typedef POINTER PCLS;
typedef POINTER PWOWPROCESSINFO;
typedef POINTER PDESKTOPVIEW;
typedef POINTER PCURSOR;
typedef POINTER PW32JOB;
typedef POINTER KERNEL_ULONG_PTR;
typedef PTHREADINFO;
typedef PHOOK;
typedef struct tagCLIENTTHREADINFO {
UINT CTIF_flags;
WORD fsChangeBits; // Bits changes since last compared
WORD fsWakeBits; // Bits currently available
WORD fsWakeBitsJournal; // Bits saved while journalling
WORD fsWakeMask; // Bits looking for when asleep
LONG timeLastRead; // Time of last input read
} CLIENTTHREADINFO;
typedef struct tagPROCESSINFO { //W32PROCESS;
//***************************************** begin: USER specific fields
PTHREADINFO ptiList; // threads in this process
PTHREADINFO ptiMainThread; // pti of "main thread"
PDESKTOP rpdeskStartup; // initial desktop
PCLS pclsPrivateList; // this processes' private classes
PCLS pclsPublicList; // this processes' public classes
PWOWPROCESSINFO pwpi; // Wow PerProcess Info
PPROCESSINFO ppiNext; // next ppi structure in start list
PPROCESSINFO ppiNextRunning;
int cThreads; // count of threads using this process info
HDESK hdeskStartup; // initial desktop handle
UINT cSysExpunge; // sys expunge counter
DWORD dwhmodLibLoadedMask; // bits describing loaded hook dlls
HANDLE ahmodLibLoaded[CLIBS]; // process unique hmod array for hook dlls
PWINDOWSTATION prpwinsta; // process windowstation
HWINSTA hwinsta; // windowstation handle
ACCESS_MASK amwinsta; // windowstation accesses
DWORD dwHotkey; // hot key from progman
HMONITOR hMonitor; // monitor handle from CreateProcess
PDESKTOPVIEW pdvList; // list of desktop views
UINT iClipSerialNumber; // clipboard serial number
RTL_BITMAP bmHandleFlags; // per handle flags
PCURSOR pCursorCache; // process cursor/icon cache
PVOID pClientBase; // LEAVE THIS FOR HYDRA; offset to the shared section
DWORD dwLpkEntryPoints; // user mode language pack installed
PW32JOB pW32Job; // pointer to the W32JOB structure
DWORD dwImeCompatFlags; // per-process Ime Compatibility flags
LUID luidSession; // logon session id
USERSTARTUPINFO usi; // process startup info
#ifdef VALIDATEHANDLEQUOTA
LONG lHandles;
#endif
#ifdef USE_MIRRORING
DWORD dwLayout; // the default Window orientation for this process
#endif
} PROCESSINFO;
typedef struct _HEAD {
DWORD h; //HHOOK
DWORD cLockObj;
} HEAD, *PHEAD;
typedef struct _THROBJHEAD {
HEAD hdr;
DWORD pti;
} THROBJHEAD, *PTHROBJHEAD;
typedef struct _DESKHEAD {
DWORD rpdesk;
DWORD pSelf;
} DESKHEAD, *PDESKHEAD;
typedef struct _THRDESKHEAD {
THROBJHEAD tohdr;
DESKHEAD dhdr;
} THRDESKHEAD, *PTHRDESKHEAD;
typedef struct tagHOOK { /* hk */
THRDESKHEAD head;
PHOOK phkNext;
int iHook; // WH_xxx hook type
KERNEL_ULONG_PTR offPfn;
UINT flags; // HF_xxx flags
int ihmod;
PTHREADINFO ptiHooked; // Thread hooked.
PDESKTOP rpdesk; // Global hook pdesk. Only used when
// hook is locked and owner is destroyed
#ifdef HOOKBATCH
DWORD cEventMessages; // Number of events in the cache
DWORD iCurrentEvent; // Current cache event
DWORD CacheTimeOut; // Timeout between keys
PEVENTMSG aEventCache; // The array of Events
#endif // HOOKBATCH
} HOOK;
typedef struct _THREADINFO {
ULONG a[10]; // W32THREAD
PTL ptl; // Listhead for thread lock list +28
PPROCESSINFO ppi; // process info struct for this thread +2C
PQ pq; // keyboard and mouse input queue +30
PKL spklActive; // active keyboard layout for this thread +34
PCLIENTTHREADINFO pcti; // Info that must be visible from client +38
PDESKTOP rpdesk;
PDESKTOPINFO pDeskInfo; // Desktop info visible to client +40
PCLIENTINFO pClientInfo; // Client info stored in TEB +44
ULONG TIF_flags; // TIF_ flags go here. +48
PUNICODE_STRING pstrAppName; // Application module name. +4C
PSMS psmsSent; // Most recent SMS this thread has sent
PSMS psmsCurrent; // Received SMS this thread is currently processing
PSMS psmsReceiveList;// SMSs to be processed
LONG timeLast; // Time, position, and ID of last message
ULONG_PTR idLast;
int cQuit;
int exitCode;
HANDLE hdesk; // Desktop handle. Changed from "HDESK hdesk"
int cPaintsReady;
unsigned int cTimersReady;
PMENUSTATE pMenuState;
union {
PTDB ptdb; // Win16Task Schedule data for WOW thread
PWINDOWSTATION pwinsta; // Window station for SYSTEM thread
};
PSVR_INSTANCE_INFO psiiList; // thread DDEML instance list
ULONG dwExpWinVer;
ULONG dwCompatFlags; // The Win 3.1 Compat flags
ULONG dwCompatFlags2; // new DWORD to extend compat flags for NT5+ features
PQ pqAttach; // calculation variabled used in zzzAttachThreadInput()
void* ptiSibling; // Pointer to sibling thread info. Chnaged from "PTHREADINFO ptiSibling"
PMOVESIZEDATA pmsd;
ULONG fsHooks; // WHF_ Flags for which hooks are installed
PHOOK sphkCurrent; // Hook this thread is currently processing
PSBTRACK pSBTrack;
HANDLE hEventQueueClient;
PKEVENT pEventQueueServer;
LIST_ENTRY PtiLink; // Link to other threads on desktop
int iCursorLevel; // keep track of each thread's level
ULONG b[2]; //POINT ptLast;
PWND spwndDefaultIme;// Default IME Window for this thread
PIMC spDefaultImc; // Default input context for this thread
HANDLE hklPrev; // Previous active. Changed from "HKL hklPrev"
int cEnterCount;
MLIST mlPost; // posted message list.
USHORT fsChangeBitsRemoved;// Bits removed during PeekMessage
WCHAR wchInjected; // character from last VK_PACKET
ULONG fsReserveKeys; // Keys that must be sent to the active +E0
PKEVENT *apEvent; // Wait array for xxxPollAndWaitForSingleObject +E4
ACCESS_MASK amdesk; // Granted access +E8
unsigned int cWindows; // Number of windows owned by this thread +EC
unsigned int cVisWindows; // Number of visible windows on this thread +F0
PHOOK aphkStart[CWINHOOKS]; // Hooks registered for this thread, local hook +F4
CLIENTTHREADINFO cti; // Use this when no desktop is available +F8
} THREADINFO, *PTHREADINFO;
THREADINFO thinf;
this is how you do it
Code:
copy the win32k.pdb from symbol cache into a folder
copy this tagthread.c (this is crap i have changed many HWINSTA etc
symbols to ULONG to fool errors and test
and go to the build environment and pass the commandline
copy back the new win32k.pbd to symbol cache (remember save original
before replacing)
go to kd and do dt _win32k!_Threadinfo <some address> here
it should show some real information in formatted style
like below if you are successfull
result as follows
Code:
lkd> !ready
Processor 0: Ready Threads at priority 8
THREAD ff5e3020 Cid 0350.0b64 Teb: 7ffad000 Win32Thread: e123adc0 READY
THREAD 810c0020 Cid 0314.07b0 Teb: 7ff8d000 Win32Thread: 00000000 WAIT
THREAD ffbad020 Cid 0314.0330 Teb: 7ffdb000 Win32Thread: e2107a50 WAIT
THREAD ff98bcb0 Cid 0350.0c24 Teb: 7ffde000 Win32Thread: e245c400 WAIT
THREAD ff5e3020 Cid 0350.0b64 Teb: 7ffad000 Win32Thread: e123adc0 READY
lkd> dt win32k!_Threadinfo e123adc0
win32k!_THREADINFO
+0x000 a : [10] 0xff5e3020 <--- this is w32thread
but i just took zairon post definition as it is to test
+0x028 ptl : (null)
+0x02c ppi : 0xe24db0c0
+0x030 pq : 0xe1080c18
+0x034 spklActive : 0xe20bcf08
+0x038 pcti : 0xbc662b18
+0x03c rpdesk : 0x810f0e10
+0x040 pDeskInfo : 0xbc630650
+0x044 pClientInfo : 0x7ffad6cc
+0x048 TIF_flags : 0x1000000
+0x04c pstrAppName : (null)
+0x050 psmsSent : (null)
+0x054 psmsCurrent : (null)
+0x058 psmsReceiveList : (null)
+0x05c timeLast : 0
+0x060 idLast : 0
+0x064 cQuit : 0
+0x068 exitCode : 40
+0x06c hdesk : (null)
+0x070 cPaintsReady : 0
+0x074 cTimersReady : 0
+0x078 pMenuState : (null)
+0x07c ptdb : (null)
+0x07c pwinsta : (null)
+0x080 psiiList : 0x00000400
+0x084 dwExpWinVer : 0
+0x088 dwCompatFlags : 0x10000
+0x08c dwCompatFlags2 : 0
+0x090 pqAttach : 0xe153e8f8
+0x094 ptiSibling : (null)
+0x098 pmsd : (null)
+0x09c fsHooks : 0
+0x0a0 sphkCurrent : 0
+0x0a4 pSBTrack : 0x00000704
+0x0a8 hEventQueueClient : 0xff9c3f40
+0x0ac pEventQueueServer : 0xe153e9a4 _KEVENT
+0x0b0 PtiLink : _LIST_ENTRY [ 0xe1036e5c - 0x0 ]
+0x0b8 iCursorLevel : 0
+0x0bc b : [2] 0
+0x0c4 spwndDefaultIme : (null)
+0x0c8 spDefaultImc : (null)
+0x0cc hklPrev : (null)
+0x0d0 cEnterCount : 0
+0x0d4 mlPost : 0
+0x0d8 fsChangeBitsRemoved : 0
+0x0da wchInjected : 0
+0x0dc fsReserveKeys : 0
+0x0e0 apEvent : (null)
+0x0e4 amdesk : 0
+0x0e8 cWindows : 0xf01ff
+0x0ec cVisWindows : 0
+0x0f0 aphkStart : [20] 0
+0x140 cti : 0
lkd>
have fun :)
Bookmarks