00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
#include "userkdx.h"
00019
#include "vkoem.h"
00020
00021
#ifdef KERNEL
00022
PSTR
pszExtName =
"USERKDX";
00023
#else
00024 PSTR
pszExtName =
"USEREXTS";
00025
#endif
00026
00027
#include <stdexts.h>
00028
#include <stdexts.c>
00029
00030
00031
00032
00033 #define CDWORDS 16
00034 #define BF_MAX_WIDTH 80
00035 #define BF_COLUMN_WIDTH 19
00036
00037
00038
00039
00040
00041 BOOL bServerDebug =
TRUE;
00042 BOOL bShowFlagNames =
TRUE;
00043 char gach1[80];
00044 char gach2[80];
00045 CLS gcls;
00046 PGETEPROCESSDATAFUNC GetEProcessData;
00047 SHAREDINFO gShi;
00048 SERVERINFO gSi;
00049 int giBFColumn;
00050 char gaBFBuff[
BF_MAX_WIDTH + 1];
00051
00052
00053 typedef struct {
00054 int iMetric;
00055 LPSTR pstrMetric;
00056 }
SYSMET_ENTRY;
00057 #define SMENTRY(sm) {SM_##sm, #sm}
00058
00059 extern ULONG_PTR
UserProbeAddress;
00060 extern int gnIndent;
00061
00062
00063
00064
00065 #define NELEM(array) (sizeof(array)/sizeof(array[0]))
00066
00067
#ifdef KERNEL // ########### KERNEL MODE ONLY MACROS ###############
00068
00069
#define VAR(v) "win32k!" #v
00070
#define FIXKP(p) p
00071
#define RebaseSharedPtr(p) (p)
00072
00073
#define FOREACHWINDOWSTATION(pwinsta) \
00074
moveExpValuePtr(&pwinsta, VAR(grpWinStaList)); \
00075
SAFEWHILE (pwinsta != NULL) {
00076
00077
#define NEXTEACHWINDOWSTATION(pwinsta) \
00078
move(pwinsta, &pwinsta->rpwinstaNext); \
00079
}
00080
00081
00082
00083
#define FOREACHDESKTOP(pdesk) \
00084
{ \
00085
WINDOWSTATION *pwinsta; \
00086
\
00087
FOREACHWINDOWSTATION(pwinsta) \
00088
move(pdesk, &pwinsta->rpdeskList); \
00089
SAFEWHILE (pdesk != NULL) {
00090
00091
#define NEXTEACHDESKTOP(pdesk) \
00092
move(pdesk, &pdesk->rpdeskNext); \
00093
} \
00094
NEXTEACHWINDOWSTATION(pwinsta) \
00095
}
00096
00097
00098
00099
#define FOREACHPPI(ppi) \
00100
{ \
00101
PLIST_ENTRY ProcessHead; \
00102
LIST_ENTRY List; \
00103
PLIST_ENTRY NextProcess; \
00104
PEPROCESS pEProcess; \
00105
PW32PROCESS pW32Process; \
00106
\
00107
ProcessHead = EvalExp( "PsActiveProcessHead" ); \
00108
if (!ProcessHead) { \
00109
Print("Unable to get value of PsActiveProcessHead\n"); \
00110
return FALSE; \
00111
} \
00112
\
00113
if (!tryMove(List, ProcessHead)) { \
00114
Print("Unable to get value of PsActiveProcessHead\n"); \
00115
return FALSE; \
00116
} \
00117
NextProcess = List.Flink; \
00118
if (NextProcess == NULL) { \
00119
Print("PsActiveProcessHead->Flink is NULL!\n"); \
00120
return FALSE; \
00121
} \
00122
\
00123
SAFEWHILE(NextProcess != ProcessHead) { \
00124
pEProcess = GetEProcessData((PEPROCESS)NextProcess, \
00125
PROCESS_PROCESSHEAD, \
00126
NULL); \
00127
\
00128
if (GetEProcessData(pEProcess, PROCESS_PROCESSLINK, \
00129
&List) == NULL) { \
00130
Print("Unable to read _EPROCESS at %lx\n",pEProcess); \
00131
break; \
00132
} \
00133
NextProcess = List.Flink; \
00134
\
00135
if (GetEProcessData(pEProcess, PROCESS_WIN32PROCESS, \
00136
&pW32Process) == NULL || pW32Process == NULL) { \
00137
continue; \
00138
} \
00139
\
00140
ppi = (PPROCESSINFO)pW32Process;
00141
00142
00143
#define NEXTEACHPPI() } }
00144
00145
00146
00147
#define FOREACHPTI(pti) { \
00148
PPROCESSINFO ppi; \
00149
\
00150
FOREACHPPI(ppi) \
00151
if (!tryMove(pti, &ppi->ptiList)) { \
00152
DEBUGPRINT("FOREACHPTI:Cant get ptiList from %x.\n", &ppi->ptiList); \
00153
} \
00154
SAFEWHILE (pti != NULL) {
00155
00156
00157
#define NEXTEACHPTI(pti) \
00158
if (!tryMove(pti, &pti->ptiSibling)) { \
00159
DEBUGPRINT("NEXTEACHPTI:Can't get ptiSibling from %x.\n", \
00160
&pti->ptiSibling); \
00161
pti = NULL; \
00162
} \
00163
} \
00164
NEXTEACHPPI() }
00165
00166
00167
#else
00168
00169
void PrivateSetRipFlags(DWORD dwRipFlags, DWORD pid);
00170
00171 #define VAR(v) "user32!" #v
00172 #define FIXKP(p) FixKernelPointer(p)
00173
00174
#endif
00175
00176 #define GETSHAREDINFO(psi) moveExp(&psi, VAR(gSharedInfo))
00177
00178 #define FOREACHHANDLEENTRY(phe, he, i) \
00179
{ \
00180
PSHAREDINFO pshi; \
00181
SHAREDINFO shi; \
00182
SERVERINFO si; \
00183
\
00184
GETSHAREDINFO(pshi); \
00185
if (!tryMove(shi, pshi)) { \
00186
Print("FOREACHHANDLEENTRY:Could not get SHAREDINFO.\n"); \
00187
return FALSE; \
00188
} \
00189
if (!tryMove(si, shi.psi)) { \
00190
Print("FOREACHHANDLEENTRY:Could not get SERVERINFO.\n"); \
00191
} \
00192
phe = shi.aheList; \
00193
for (i = 0; si.cHandleEntries; si.cHandleEntries--, i++, phe++) { \
00194
if (IsCtrlCHit()) { \
00195
break; \
00196
} \
00197
if (!tryMove(he, phe)) { \
00198
Print("FOREACHHANDLEENTRY:Cant get handle entry from %x.\n", phe); \
00199
continue; \
00200
}
00201
00202 #define NEXTEACHHANDLEENTRY() \
00203
} \
00204
}
00205
00206
00207 #define DUMPHOOKS(s, hk) \
00208
if (di.aphkStart[hk + 1]) { \
00209
Print("\t" s " @0x%p\n", di.aphkStart[hk + 1]); \
00210
SAFEWHILE (di.aphkStart[hk + 1]) { \
00211
move(hook, di.aphkStart[hk + 1]); \
00212
if (di.aphkStart[hk + 1] == hook.phkNext) \
00213
break; \
00214
di.aphkStart[hk + 1] = hook.phkNext; \
00215
Print("\t iHook %d, offPfn=0x%08lx, flags=0x%04lx, ihmod=%d\n", \
00216
hook.iHook, hook.offPfn, hook.flags, hook.ihmod); \
00217
} \
00218
}
00219
00220 #define DUMPLHOOKS(s, hk) \
00221
if (ti.aphkStart[hk + 1]) { \
00222
Print("\t" s " @0x%p\n", ti.aphkStart[hk + 1]); \
00223
SAFEWHILE (ti.aphkStart[hk + 1]) { \
00224
move(hook, ti.aphkStart[hk + 1]); \
00225
if (ti.aphkStart[hk + 1] == hook.phkNext) \
00226
break; \
00227
ti.aphkStart[hk + 1] = hook.phkNext; \
00228
Print("\t iHook %d, offPfn=0x%08lx, flags=0x%04lx, ihmod=%d\n", \
00229
hook.iHook, hook.offPfn, hook.flags, hook.ihmod); \
00230
} \
00231
}
00232
00233
00234
00235
00236
00237
00238 #define STRWD1 "67"
00239 #define STRWD2 "28"
00240 #define DWSTR1 "%08lx %." STRWD1 "s"
00241 #define DWSTR2 "%08lx %-" STRWD2 "." STRWD2 "s"
00242 #define DWPSTR1 "%p %." STRWD1 "s"
00243 #define DWPSTR2 "%p %-" STRWD2 "." STRWD2 "s"
00244 #define PRTFDW1(p, f1) Print(DWSTR1 "\n", (DWORD)##p##f1, #f1)
00245 #define PRTVDW1(s1, v1) Print(DWSTR1 "\n", v1, #s1)
00246 #define PRTFDW2(p, f1, f2) Print(DWSTR2 "\t" DWSTR2 "\n", (DWORD)##p##f1, #f1, (DWORD)##p##f2, #f2)
00247 #define PRTVDW2(s1, v1, s2, v2) Print(DWSTR2 "\t" DWSTR2 "\n", v1, #s1, v2, #s2)
00248 #define PRTFRC(p, rc) Print("%-" STRWD2 "s{%#lx, %#lx, %#lx, %#lx}\n", #rc, ##p##rc.left, ##p##rc.top, ##p##rc.right, ##p##rc.bottom)
00249 #define PRTFPT(p, pt) Print("%-" STRWD2 "s{%#lx, %#lx}\n", #pt, ##p##pt.x, ##p##pt.y)
00250 #define PRTVPT(s, pt) Print("%-" STRWD2 "s{%#lx, %#lx}\n", #s, pt.x, pt.y)
00251 #define PRTFDWP1(p, f1) Print(DWPSTR1 "\n", (DWORD_PTR)##p##f1, #f1)
00252 #define PRTFDWP2(p, f1, f2) Print(DWPSTR2 "\t" DWPSTR2 "\n", (DWORD_PTR)##p##f1, #f1, (DWORD_PTR)##p##f2, #f2)
00253 #define PRTFDWPDW(p, f1, f2) Print(DWPSTR2 "\t" DWSTR2 "\n", (DWORD_PTR)##p##f1, #f1, (DWORD)##p##f2, #f2)
00254 #define PRTFDWDWP(p, f1, f2) Print(DWSTR2 "\t" DWPSTR2 "\n", (DWORD)##p##f1, #f1, (DWORD_PTR)##p##f2, #f2)
00255
00256
00257
00258
00259 #define BEGIN_PRTFFLG()
00260 #define PRTFFLG(p, f) PrintBitField(#f, (BOOLEAN)!!(p.f))
00261 #define END_PRTFFLG() PrintEndBitField()
00262
00263 #define PRTGDW1(g1) \
00264
{ DWORD _dw1; \
00265
moveExpValue(&_dw1, VAR(g1)); \
00266
Print(DWSTR1 "\n", _dw1, #g1); }
00267
00268 #define PRTGDW2(g1, g2) \
00269
{ DWORD _dw1, _dw2; \
00270
moveExpValue(&_dw1, VAR(g1)); \
00271
moveExpValue(&_dw2, VAR(g2)); \
00272
Print(DWSTR2 "\t" DWSTR2 "\n", _dw1, #g1, _dw2, #g2); }
00273
00274
00275 #define PRTWND(s, pwnd) \
00276
{ DebugGetWindowTextA(pwnd, ach); \
00277
Print("%-" STRWD2 "s" DWSTR2 "\n", #s, pwnd, ach); }
00278
00279 #define PRTGWND(gpwnd) \
00280
{ PWND _pwnd; \
00281
moveExpValuePtr(&_pwnd, VAR(gpwnd)); \
00282
DebugGetWindowTextA(_pwnd, ach); \
00283
Print("%-" STRWD2 "s" DWSTR2 "\n", #gpwnd, _pwnd, ach); }
00284
00285
00286
00287
00288
00289
#ifdef KERNEL
00290
00291
PETHREAD DummyGetCurrentThreadAddress(USHORT Processor, HANDLE hCurrentThread);
00292
PEPROCESS GetCurrentProcessAddress(DWORD Processor, HANDLE hCurrentThread,
PETHREAD CurrentThread);
00293
BOOL PrintMessages(
PQMSG pqmsgRead);
00294
BOOL GetAndDumpHE(ULONG_PTR dwT,
PHE phe, BOOL fPointerTest);
00295 LPSTR
ProcessName(
PPROCESSINFO ppi);
00296
00297
#else // !KERNEL
00298
00299 PVOID
FixKernelPointer(PVOID pKernel);
00300
BOOL DumpConvInfo(
PCONV_INFO pcoi);
00301
BOOL GetTargetTEB(PTEB pteb, PTEB *ppteb);
00302
00303
#endif // !KERNEL
00304
00305 LPSTR
GetFlags(WORD wType, DWORD dwFlags, LPSTR pszBuf, BOOL fPrintZero);
00306
BOOL HtoHE(ULONG_PTR h,
HANDLEENTRY *phe,
HANDLEENTRY **pphe);
00307
BOOL dbgPtoH(PVOID p, ULONG_PTR *ph);
00308
BOOL dbgHtoP(DWORD h, PVOID *pp);
00309 PVOID
GetPfromH(ULONG_PTR h,
HANDLEENTRY **pphe,
HANDLEENTRY *phe);
00310
BOOL getHEfromP(
HANDLEENTRY **pphe,
HANDLEENTRY *phe, PVOID p);
00311 PVOID
HorPtoP(PVOID p,
int type);
00312
BOOL DebugGetWindowTextA(
PWND pwnd,
char *achDest);
00313
BOOL DebugGetClassNameA(LPSTR lpszClassName,
char *achDest);
00314
BOOL dwrWorker(
PWND pwnd,
int tab);
00315
00316 BOOL IsRemoteSession(VOID)
00317 {
00318 PPEB ppeb;
00319
00320 ppeb = NtCurrentPeb();
00321
00322
return (ppeb->SessionId != 0);
00323 }
00324
00325
00326
00327
00328
00329 typedef struct _WFLAGS {
00330 PSZ
pszText;
00331 WORD
wFlag;
00332 }
WFLAGS;
00333
00334 #define WF_ENTRY(flag) #flag, flag
00335
00336 WFLAGS aWindowFlags[] = {
00337
WF_ENTRY(
BFBITMAP),
00338
WF_ENTRY(
BFBOTTOM),
00339
WF_ENTRY(
BFCENTER),
00340
WF_ENTRY(
BFFLAT),
00341
WF_ENTRY(
BFICON),
00342
WF_ENTRY(
BFLEFT),
00343
WF_ENTRY(
BFMULTILINE),
00344
WF_ENTRY(
BFNOTIFY),
00345
WF_ENTRY(
BFPUSHLIKE),
00346
WF_ENTRY(
BFRIGHT),
00347
WF_ENTRY(
BFRIGHTBUTTON),
00348
WF_ENTRY(
BFTOP),
00349
WF_ENTRY(
BFVCENTER),
00350
WF_ENTRY(
CBFAUTOHSCROLL),
00351
WF_ENTRY(
CBFBUTTONUPTRACK),
00352
WF_ENTRY(
CBFDISABLENOSCROLL),
00353
WF_ENTRY(
CBFDROPDOWN),
00354
WF_ENTRY(
CBFDROPDOWNLIST),
00355
WF_ENTRY(
CBFDROPPABLE),
00356
WF_ENTRY(
CBFDROPTYPE),
00357
WF_ENTRY(
CBFEDITABLE),
00358
WF_ENTRY(
CBFHASSTRINGS),
00359
WF_ENTRY(
CBFLOWERCASE),
00360
WF_ENTRY(
CBFNOINTEGRALHEIGHT),
00361
WF_ENTRY(
CBFOEMCONVERT),
00362
WF_ENTRY(
CBFOWNERDRAW),
00363
WF_ENTRY(
CBFOWNERDRAWFIXED),
00364
WF_ENTRY(
CBFOWNERDRAWVAR),
00365
WF_ENTRY(
CBFSIMPLE),
00366
WF_ENTRY(
CBFSORT),
00367
WF_ENTRY(
CBFUPPERCASE),
00368
WF_ENTRY(
DF3DLOOK),
00369
WF_ENTRY(
DFCONTROL),
00370
WF_ENTRY(
DFLOCALEDIT),
00371
WF_ENTRY(
DFNOFAILCREATE),
00372
WF_ENTRY(
DFSYSMODAL),
00373
WF_ENTRY(
EFAUTOHSCROLL),
00374
WF_ENTRY(
EFAUTOVSCROLL),
00375
WF_ENTRY(
EFCOMBOBOX),
00376
WF_ENTRY(
EFLOWERCASE),
00377
WF_ENTRY(
EFMULTILINE),
00378
WF_ENTRY(
EFNOHIDESEL),
00379
WF_ENTRY(
EFNUMBER),
00380
WF_ENTRY(
EFOEMCONVERT),
00381
WF_ENTRY(
EFPASSWORD),
00382
WF_ENTRY(
EFREADONLY),
00383
WF_ENTRY(
EFUPPERCASE),
00384
WF_ENTRY(
EFWANTRETURN),
00385
WF_ENTRY(
SBFSIZEBOX),
00386
WF_ENTRY(
SBFSIZEBOXBOTTOMRIGHT),
00387
WF_ENTRY(
SBFSIZEBOXTOPLEFT),
00388
WF_ENTRY(
SBFSIZEGRIP),
00389
WF_ENTRY(
SFCENTERIMAGE),
00390
WF_ENTRY(
SFEDITCONTROL),
00391
WF_ENTRY(
SFELLIPSISMASK),
00392
WF_ENTRY(
SFNOPREFIX),
00393
WF_ENTRY(
SFNOTIFY),
00394
WF_ENTRY(
SFREALSIZEIMAGE),
00395
WF_ENTRY(
SFRIGHTJUST),
00396
WF_ENTRY(
SFSUNKEN),
00397
WF_ENTRY(
WEFACCEPTFILES),
00398
WF_ENTRY(
WEFAPPWINDOW),
00399
WF_ENTRY(
WEFCLIENTEDGE),
00400
WF_ENTRY(
WEFCONTEXTHELP),
00401
WF_ENTRY(
WEFCONTROLPARENT),
00402
WF_ENTRY(
WEFDLGMODALFRAME),
00403
WF_ENTRY(
WEFDRAGOBJECT),
00404
WF_ENTRY(
WEFLEFTSCROLL),
00405
WF_ENTRY(
WEFMDICHILD),
00406
WF_ENTRY(
WEFNOACTIVATE),
00407
WF_ENTRY(
WEFNOPARENTNOTIFY),
00408
WF_ENTRY(
WEFRIGHT),
00409
WF_ENTRY(
WEFRTLREADING),
00410
WF_ENTRY(
WEFSTATICEDGE),
00411
WF_ENTRY(
WEFLAYERED),
00412
WF_ENTRY(
WEFTOOLWINDOW),
00413
WF_ENTRY(
WEFTOPMOST),
00414
WF_ENTRY(
WEFTRANSPARENT),
00415
WF_ENTRY(
WEFTRUNCATEDCAPTION),
00416
WF_ENTRY(
WEFWINDOWEDGE),
00417
WF_ENTRY(
WFALWAYSSENDNCPAINT),
00418
WF_ENTRY(
WFANSICREATOR),
00419
WF_ENTRY(
WFANSIPROC),
00420
WF_ENTRY(
WFANYHUNGREDRAW),
00421
WF_ENTRY(
WFBEINGACTIVATED),
00422
WF_ENTRY(
WFBORDER),
00423
WF_ENTRY(
WFBOTTOMMOST),
00424
WF_ENTRY(
WFCAPTION),
00425
WF_ENTRY(
WFCEPRESENT),
00426
WF_ENTRY(
WFCHILD),
00427
WF_ENTRY(
WFCLIPCHILDREN),
00428
WF_ENTRY(
WFCLIPSIBLINGS),
00429
WF_ENTRY(
WFCLOSEBUTTONDOWN),
00430
WF_ENTRY(
WFCPRESENT),
00431
WF_ENTRY(
WFDESTROYED),
00432
WF_ENTRY(
WFDIALOGWINDOW),
00433
WF_ENTRY(
WFDISABLED),
00434
WF_ENTRY(
WFDLGFRAME),
00435
WF_ENTRY(
WFDONTVALIDATE),
00436
WF_ENTRY(
WFERASEBKGND),
00437
WF_ENTRY(
WFFRAMEON),
00438
WF_ENTRY(
WFFULLSCREEN),
00439
WF_ENTRY(
WFGOTQUERYSUSPENDMSG),
00440
WF_ENTRY(
WFGOTSUSPENDMSG),
00441
WF_ENTRY(
WFGROUP),
00442
WF_ENTRY(
WFHASPALETTE),
00443
WF_ENTRY(
WFHASSPB),
00444
WF_ENTRY(
WFHELPBUTTONDOWN),
00445
WF_ENTRY(
WFHIDDENPOPUP),
00446
WF_ENTRY(
WFHPRESENT),
00447
WF_ENTRY(
WFHSCROLL),
00448
WF_ENTRY(
WFICONICPOPUP),
00449
WF_ENTRY(
WFINDESTROY),
00450
WF_ENTRY(
WFINTERNALPAINT),
00451
WF_ENTRY(
WFLINEDNBUTTONDOWN),
00452
WF_ENTRY(
WFLINEUPBUTTONDOWN),
00453
WF_ENTRY(
WFMAXBOX),
00454
WF_ENTRY(
WFMAXFAKEREGIONAL),
00455
WF_ENTRY(
WFMAXIMIZED),
00456
WF_ENTRY(
WFMENUDRAW),
00457
WF_ENTRY(
WFMINBOX),
00458
WF_ENTRY(
WFMINIMIZED),
00459
WF_ENTRY(
WFMPRESENT),
00460
WF_ENTRY(
WFMSGBOX),
00461
WF_ENTRY(
WFNOANIMATE),
00462
WF_ENTRY(
WFNOIDLEMSG),
00463
WF_ENTRY(
WFNONCPAINT),
00464
WF_ENTRY(
WFOLDUI),
00465
WF_ENTRY(
WFPAGEUPBUTTONDOWN),
00466
WF_ENTRY(
WFPAGEDNBUTTONDOWN),
00467
WF_ENTRY(
WFPAINTNOTPROCESSED),
00468
WF_ENTRY(
WFPIXIEHACK),
00469
WF_ENTRY(
WFPOPUP),
00470
WF_ENTRY(
WFREALLYMAXIMIZABLE),
00471
WF_ENTRY(
WFREDRAWFRAMEIFHUNG),
00472
WF_ENTRY(
WFREDRAWIFHUNG),
00473
WF_ENTRY(
WFREDUCEBUTTONDOWN),
00474
WF_ENTRY(
WFSCROLLBUTTONDOWN),
00475
WF_ENTRY(
WFSENDERASEBKGND),
00476
WF_ENTRY(
WFSENDNCPAINT),
00477
WF_ENTRY(
WFSENDSIZEMOVE),
00478
WF_ENTRY(
WFSERVERSIDEPROC),
00479
WF_ENTRY(
WFSHELLHOOKWND),
00480
WF_ENTRY(
WFSIZEBOX),
00481
WF_ENTRY(
WFSMQUERYDRAGICON),
00482
WF_ENTRY(
WFSTARTPAINT),
00483
WF_ENTRY(
WFSYNCPAINTPENDING),
00484
WF_ENTRY(
WFSYSMENU),
00485
WF_ENTRY(
WFTABSTOP),
00486
WF_ENTRY(
WFTILED),
00487
WF_ENTRY(
WFTITLESET),
00488
WF_ENTRY(
WFTOGGLETOPMOST),
00489
WF_ENTRY(
WFTOPLEVEL),
00490
WF_ENTRY(
WFUPDATEDIRTY),
00491
WF_ENTRY(
WFVERTSCROLLTRACK),
00492
WF_ENTRY(
WFVISIBLE),
00493
WF_ENTRY(
WFVPRESENT),
00494
WF_ENTRY(
WFVSCROLL),
00495
WF_ENTRY(
WFWIN31COMPAT),
00496
WF_ENTRY(
WFWIN40COMPAT),
00497
WF_ENTRY(
WFWIN50COMPAT),
00498
WF_ENTRY(
WFWMPAINTSENT),
00499
WF_ENTRY(
WFZOOMBUTTONDOWN),
00500 };
00501
00502 LPCSTR
aszTypeNames[
TYPE_CTYPES] = {
00503
"Free",
00504
"Window",
00505
"Menu",
00506
"Icon/Cursor",
00507
"WPI(SWP) struct",
00508
"Hook",
00509
"Clipboard Data",
00510
"CallProcData",
00511
"Accelerator",
00512
"DDE access",
00513
"DDE conv",
00514
"DDE Transaction",
00515
"Monitor",
00516
"Keyboard Layout",
00517
"Keyboard File",
00518
"WinEvent hook",
00519
"Timer",
00520
"Input Context",
00521 };
00522
00523
#include "ptagdbg.h"
00524
00525 #define NO_FLAG (LPCSTR)(LONG_PTR)0xFFFFFFFF // use this for non-meaningful entries.
00526 #define _MASKENUM_START (NO_FLAG-1)
00527 #define _MASKENUM_END (NO_FLAG-2)
00528 #define _SHIFT_BITS (NO_FLAG-3)
00529 #define _CONTINUE_ON (NO_FLAG-4)
00530
00531 #define MASKENUM_START(mask) _MASKENUM_START, (LPCSTR)(mask)
00532 #define MASKENUM_END(shift) _MASKENUM_END, (LPCSTR)(shift)
00533 #define SHIFT_BITS(n) _SHIFT_BITS, (LPCSTR)(n)
00534 #define CONTINUE_ON(arr) _CONTINUE_ON, (LPCSTR)(arr)
00535
00536 LPCSTR
apszSmsFlags[] = {
00537
"SMF_REPLY" ,
00538
"SMF_RECEIVERDIED" ,
00539
"SMF_SENDERDIED" ,
00540
"SMF_RECEIVERFREE" ,
00541
"SMF_RECEIVEDMESSAGE" ,
00542
NO_FLAG ,
00543
NO_FLAG ,
00544
NO_FLAG ,
00545
"SMF_CB_REQUEST" ,
00546
"SMF_CB_REPLY" ,
00547
"SMF_CB_CLIENT" ,
00548
"SMF_CB_SERVER" ,
00549
"SMF_WOWRECEIVE" ,
00550
"SMF_WOWSEND" ,
00551
"SMF_RECEIVERBUSY" ,
00552
NULL
00553 };
00554
00555 LPCSTR
apszTifFlags[] = {
00556
"TIF_INCLEANUP" ,
00557
"TIF_16BIT" ,
00558
"TIF_SYSTEMTHREAD" ,
00559
"TIF_CSRSSTHREAD" ,
00560
"TIF_TRACKRECTVISIBLE" ,
00561
"TIF_ALLOWFOREGROUNDACTIVATE" ,
00562
"TIF_DONTATTACHQUEUE" ,
00563
"TIF_DONTJOURNALATTACH" ,
00564
"TIF_WOW64" ,
00565
"TIF_INACTIVATEAPPMSG" ,
00566
"TIF_SPINNING" ,
00567
"TIF_PALETTEAWARE" ,
00568
"TIF_SHAREDWOW" ,
00569
"TIF_FIRSTIDLE" ,
00570
"TIF_WAITFORINPUTIDLE" ,
00571
"TIF_MOVESIZETRACKING" ,
00572
"TIF_VDMAPP" ,
00573
"TIF_DOSEMULATOR" ,
00574
"TIF_GLOBALHOOKER" ,
00575
"TIF_DELAYEDEVENT" ,
00576
"TIF_MSGPOSCHANGED" ,
00577
"TIF_SHUTDOWNCOMPLETE" ,
00578
"TIF_IGNOREPLAYBACKDELAY" ,
00579
"TIF_ALLOWOTHERACCOUNTHOOK" ,
00580
NO_FLAG ,
00581
"TIF_GUITHREADINITIALIZED" ,
00582
"TIF_DISABLEIME" ,
00583
"TIF_INGETTEXTLENGTH" ,
00584
"TIF_ANSILENGTH" ,
00585
"TIF_DISABLEHOOKS" ,
00586
NULL
00587 };
00588
00589 LPCSTR
apszQsFlags[] = {
00590
"QS_KEY" ,
00591
"QS_MOUSEMOVE" ,
00592
"QS_MOUSEBUTTON" ,
00593
"QS_POSTMESSAGE" ,
00594
"QS_TIMER" ,
00595
"QS_PAINT" ,
00596
"QS_SENDMESSAGE" ,
00597
"QS_HOTKEY" ,
00598
"QS_ALLPOSTMESSAGE" ,
00599
"QS_SMSREPLY" ,
00600
"QS_SYSEXPUNGE" ,
00601
"QS_THREADATTACHED" ,
00602
"QS_EXCLUSIVE" ,
00603
"QS_EVENT" ,
00604
"QS_TRANSFER" ,
00605
NULL
00606 };
00607
00608 LPCSTR
apszMfFlags[] = {
00609
"MF_GRAYED" ,
00610
"MF_DISABLED" ,
00611
"MF_BITMAP" ,
00612
"MF_CHECKED" ,
00613
"MF_POPUP" ,
00614
"MF_MENUBARBREAK" ,
00615
"MF_MENUBREAK" ,
00616
"MF_HILITE" ,
00617
"MF_OWNERDRAW" ,
00618
"MF_USECHECKBITMAPS" ,
00619
NO_FLAG ,
00620
"MF_SEPARATOR" ,
00621
"MF_DEFAULT" ,
00622
"MF_SYSMENU" ,
00623
"MF_RIGHTJUSTIFY" ,
00624
"MF_MOUSESELECT" ,
00625
NULL
00626 };
00627
00628 LPCSTR
apszCsfFlags[] = {
00629
"CSF_SERVERSIDEPROC" ,
00630
"CSF_ANSIPROC" ,
00631
"CSF_WOWDEFERDESTROY" ,
00632
"CSF_SYSTEMCLASS" ,
00633
"CSF_WOWCLASS" ,
00634
"CSF_WOWEXTRA" ,
00635
"CSF_CACHEDSMICON" ,
00636
"CSF_WIN40COMPAT" ,
00637
NULL
00638 };
00639
00640 LPCSTR
apszCsFlags[] = {
00641
"CS_VREDRAW" ,
00642
"CS_HREDRAW" ,
00643
"CS_KEYCVTWINDOW" ,
00644
"CS_DBLCLKS" ,
00645
NO_FLAG ,
00646
"CS_OWNDC" ,
00647
"CS_CLASSDC" ,
00648
"CS_PARENTDC" ,
00649
"CS_NOKEYCVT" ,
00650
"CS_NOCLOSE" ,
00651
NO_FLAG ,
00652
"CS_SAVEBITS" ,
00653
"CS_BYTEALIGNCLIENT" ,
00654
"CS_BYTEALIGNWINDOW" ,
00655
"CS_GLOBALCLASS" ,
00656
NO_FLAG ,
00657
"CS_IME" ,
00658
NULL
00659 };
00660
00661 LPCSTR
apszQfFlags[] = {
00662
"QF_UPDATEKEYSTATE" ,
00663
"used to be ALTTAB" ,
00664
"QF_FMENUSTATUSBREAK" ,
00665
"QF_FMENUSTATUS" ,
00666
"QF_FF10STATUS" ,
00667
"QF_MOUSEMOVED" ,
00668
"QF_ACTIVATIONCHANGE" ,
00669
"QF_TABSWITCHING" ,
00670
"QF_KEYSTATERESET" ,
00671
"QF_INDESTROY" ,
00672
"QF_LOCKNOREMOVE" ,
00673
"QF_FOCUSNULLSINCEACTIVE" ,
00674
NO_FLAG ,
00675
NO_FLAG ,
00676
"QF_DIALOGACTIVE" ,
00677
"QF_EVENTDEACTIVATEREMOVED" ,
00678
NO_FLAG ,
00679
"QF_TRACKMOUSELEAVE" ,
00680
"QF_TRACKMOUSEHOVER" ,
00681
"QF_TRACKMOUSEFIRING" ,
00682
"QF_CAPTURELOCKED" ,
00683
"QF_ACTIVEWNDTRACKING" ,
00684
NULL
00685 };
00686
00687 LPCSTR
apszW32pfFlags[] = {
00688
"W32PF_CONSOLEAPPLICATION" ,
00689
"W32PF_FORCEOFFFEEDBACK" ,
00690
"W32PF_STARTGLASS" ,
00691
"W32PF_WOW" ,
00692
"W32PF_READSCREENACCESSGRANTED" ,
00693
"W32PF_INITIALIZED" ,
00694
"W32PF_APPSTARTING" ,
00695
"W32PF_WOW64" ,
00696
"W32PF_ALLOWFOREGROUNDACTIVATE" ,
00697
"W32PF_OWNDCCLEANUP" ,
00698
"W32PF_SHOWSTARTGLASSCALLED" ,
00699
"W32PF_FORCEBACKGROUNDPRIORITY" ,
00700
"W32PF_TERMINATED" ,
00701
"W32PF_CLASSESREGISTERED" ,
00702
"W32PF_THREADCONNECTED" ,
00703
"W32PF_PROCESSCONNECTED" ,
00704
"W32PF_WAKEWOWEXEC" ,
00705
"W32PF_WAITFORINPUTIDLE" ,
00706
"W32PF_IOWINSTA" ,
00707
"W32PF_CONSOLEFOREGROUND" ,
00708
"W32PF_OLELOADED" ,
00709
"W32PF_SCREENSAVER" ,
00710
"W32PF_IDLESCREENSAVER" ,
00711
NULL
00712 };
00713
00714
00715 LPCSTR
apszHeFlags[] = {
00716
"HANDLEF_DESTROY" ,
00717
"HANDLEF_INDESTROY" ,
00718
"HANDLEF_INWAITFORDEATH" ,
00719
"HANDLEF_FINALDESTROY" ,
00720
"HANDLEF_MARKED_OK" ,
00721
"HANDLEF_GRANTED" ,
00722
NULL
00723 };
00724
00725
00726 LPCSTR
apszHdataFlags[] = {
00727
"HDATA_APPOWNED" ,
00728
NO_FLAG ,
00729
NO_FLAG ,
00730
NO_FLAG ,
00731
NO_FLAG ,
00732
NO_FLAG ,
00733
NO_FLAG ,
00734
NO_FLAG ,
00735
"HDATA_EXECUTE" ,
00736
"HDATA_INITIALIZED" ,
00737
NO_FLAG ,
00738
NO_FLAG ,
00739
NO_FLAG ,
00740
NO_FLAG ,
00741
"HDATA_NOAPPFREE" ,
00742
"HDATA_READONLY" ,
00743
NULL
00744 };
00745
00746 LPCSTR
apszXiFlags[] = {
00747
"XIF_SYNCHRONOUS" ,
00748
"XIF_COMPLETE" ,
00749
"XIF_ABANDONED" ,
00750
NULL
00751 };
00752
00753 LPCSTR
apszIifFlags[] = {
00754
"IIF_IN_SYNC_XACT" ,
00755
NO_FLAG ,
00756
NO_FLAG ,
00757
NO_FLAG ,
00758
NO_FLAG ,
00759
NO_FLAG ,
00760
NO_FLAG ,
00761
NO_FLAG ,
00762
NO_FLAG ,
00763
NO_FLAG ,
00764
NO_FLAG ,
00765
NO_FLAG ,
00766
NO_FLAG ,
00767
NO_FLAG ,
00768
NO_FLAG ,
00769
"IIF_UNICODE" ,
00770
NULL
00771 };
00772
00773 LPCSTR
apszTmrfFlags[] = {
00774
"TMRF_READY" ,
00775
"TMRF_SYSTEM" ,
00776
"TMRF_RIT" ,
00777
"TMRF_INIT" ,
00778
"TMRF_ONESHOT" ,
00779
"TMRF_WAITING" ,
00780
NULL ,
00781 };
00782
00783
00784 LPCSTR
apszSbFlags[] = {
00785
"SB_VERT" ,
00786
"SB_CTL" ,
00787
NULL ,
00788 };
00789
00790
00791 LPCSTR
apszCSFlags[] = {
00792
"FS_LATIN1" ,
00793
"FS_LATIN2" ,
00794
"FS_CYRILLIC" ,
00795
"FS_GREEK" ,
00796
"FS_TURKISH" ,
00797
"FS_HEBREW" ,
00798
"FS_ARABIC" ,
00799
"FS_BALTIC" ,
00800
"FS_VIETNAMESE" ,
00801
NO_FLAG ,
00802
NO_FLAG ,
00803
NO_FLAG ,
00804
NO_FLAG ,
00805
NO_FLAG ,
00806
NO_FLAG ,
00807
NO_FLAG ,
00808
"FS_THAI" ,
00809
"FS_JISJAPAN" ,
00810
"FS_CHINESESIMP" ,
00811
"FS_WANSUNG" ,
00812
"FS_CHINESETRAD" ,
00813
"FS_JOHAB" ,
00814
NO_FLAG ,
00815
NO_FLAG ,
00816
NO_FLAG ,
00817
NO_FLAG ,
00818
NO_FLAG ,
00819
NO_FLAG ,
00820
NO_FLAG ,
00821
NO_FLAG ,
00822
NO_FLAG ,
00823
"FS_SYMBOL" ,
00824
NULL
00825 };
00826
00827
00828 LPCSTR
apszMenuTypeFlags[] = {
00829
NO_FLAG ,
00830
NO_FLAG ,
00831
"MFT_BITMAP" ,
00832
NO_FLAG ,
00833
"MF_POPUP" ,
00834
"MFT_MENUBARBREAK" ,
00835
"MFT_MENUBREAK" ,
00836
NO_FLAG ,
00837
"MFT_OWNERDRAW" ,
00838
NO_FLAG ,
00839
NO_FLAG ,
00840
"MFT_SEPARATOR" ,
00841
NO_FLAG ,
00842
"MF_SYSMENU" ,
00843
"MFT_RIGHTJUSTIFY" ,
00844
NULL
00845 };
00846
00847 LPCSTR
apszMenuStateFlags[] = {
00848
"MF_GRAYED" ,
00849
"MF_DISABLED" ,
00850
NO_FLAG ,
00851
"MFS_CHECKED" ,
00852
NO_FLAG ,
00853
NO_FLAG ,
00854
NO_FLAG ,
00855
"MFS_HILITE" ,
00856
NO_FLAG ,
00857
NO_FLAG ,
00858
NO_FLAG ,
00859
NO_FLAG ,
00860
"MFS_DEFAULT" ,
00861
NO_FLAG ,
00862
NO_FLAG ,
00863
"MF_MOUSESELECT" ,
00864
NULL
00865 };
00866
00867
00868 LPCSTR
apszCursorfFlags[] = {
00869
"CURSORF_FROMRESOURCE",
00870
"CURSORF_GLOBAL",
00871
"CURSORF_LRSHARED",
00872
"CURSORF_ACON",
00873
"CURSORF_WOWCLEANUP" ,
00874
NO_FLAG ,
00875
"CURSORF_ACONFRAME",
00876
"CURSORF_SECRET",
00877
"CURSORF_LINKED",
00878
NULL
00879 };
00880
00881 LPCSTR
apszMonfFlags[] = {
00882
"MONF_VISIBLE",
00883
"MONF_PALETTEDISPLAY",
00884
NULL,
00885 };
00886
00887 LPCSTR
apszSifFlags[] = {
00888
"PUSIF_PALETTEDISPLAY",
00889
"PUSIF_SNAPTO",
00890
"PUSIF_COMBOBOXANIMATION",
00891
"PUSIF_LISTBOXSMOOTHSCROLLING",
00892
"PUSIF_KEYBOARDCUES",
00893
NULL,
00894 };
00895
00896 LPCSTR
apszRipFlags[] = {
00897
"RIPF_PROMPTONERROR",
00898
"RIPF_PROMPTONWARNING",
00899
"RIPF_PROMPTONVERBOSE",
00900
NO_FLAG,
00901
"RIPF_PRINTONERROR",
00902
"RIPF_PRINTONWARNING",
00903
"RIPF_PRINTONVERBOSE",
00904
NO_FLAG,
00905
"RIPF_PRINTFILELINE",
00906
NULL
00907 };
00908
00909 LPCSTR
apszSRVIFlags[] = {
00910
"SRVIF_CHECKED",
00911
"SRVIF_WINEVENTHOOKS",
00912
"SRVIF_DBCS",
00913
"SRVIF_IME",
00914
"SRVIF_MIDEAST",
00915
NULL
00916 };
00917
00918 LPCSTR
apszPROPFlags[] = {
00919
"PROPF_INTERNAL",
00920
"PROPF_STRING",
00921
"PROPF_NOPOOL",
00922 };
00923
00924 LPCSTR
apszLpkEntryPoints[] = {
00925
"LpkTabbedTextOut" ,
00926
"LpkPSMTextOut" ,
00927
"LpkDrawTextEx" ,
00928
"LpkEditControl" ,
00929
NULL
00930 };
00931
00932
00933
00934
00935 LPCSTR
aszUserPreferencesMask0[
sizeof(
DWORD) * 8] = {
00936
"ACTIVEWINDOWTRACKING",
00937
"MENUANIMATION",
00938
"COMBOBOXANIMATION",
00939
"LISTBOXSMOOTHSCROLLING",
00940
"GRADIENTCAPTIONS",
00941
"KEYBOARDCUES",
00942
"ACTIVEWNDTRKZORDER",
00943
"HOTTRACKING",
00944
NO_FLAG,
00945
"MENUFADE",
00946
"SELECTIONFADE",
00947
"TOOLTIPANIMATION",
00948
"TOOLTIPFADE",
00949
"CURSORSHADOW",
00950
NO_FLAG,
00951
NO_FLAG,
00952
NO_FLAG,
00953
NO_FLAG,
00954
NO_FLAG,
00955
NO_FLAG,
00956
NO_FLAG,
00957
NO_FLAG,
00958
NO_FLAG,
00959
NO_FLAG,
00960
NO_FLAG,
00961
NO_FLAG,
00962
NO_FLAG,
00963
NO_FLAG,
00964
NO_FLAG,
00965
NO_FLAG,
00966
NO_FLAG,
00967
"UIEFFECTS",
00968 };
00969
00970 LPCSTR
aszUserPreferences[SPI_DWORDRANGECOUNT] = {
00971
"FOREGROUNDLOCKTIMEOUT",
00972
"ACTIVEWNDTRKTIMEOUT",
00973
"FOREGROUNDFLASHCOUNT",
00974
"CARETWIDTH",
00975 };
00976
00977 LPCSTR
aszKeyEventFlags[] = {
00978
"KEYEVENTF_EXTENDEDKEY",
00979
"KEYEVENTF_KEYUP",
00980
"KEYEVENTF_UNICODE",
00981
"KEYEVENTF_SCANCODE",
00982
NULL,
00983 };
00984
00985 LPCSTR
aszMouseEventFlags[] = {
00986
"MOUSEEVENTF_MOVE",
00987
"MOUSEEVENTF_LEFTDOWN",
00988
"MOUSEEVENTF_LEFTUP",
00989
"MOUSEEVENTF_RIGHTDOWN",
00990
"MOUSEEVENTF_RIGHTUP",
00991
"MOUSEEVENTF_MIDDLEDOWN",
00992
"MOUSEEVENTF_MIDDLEUP",
00993
NO_FLAG,
00994
NO_FLAG,
00995
NO_FLAG,
00996
NO_FLAG,
00997
"MOUSEEVENTF_WHEEL",
00998
NO_FLAG,
00999
NO_FLAG,
01000
"MOUSEEVENTF_VIRTUALDESK",
01001
"MOUSEEVENTF_ABSOLUTE",
01002
NULL,
01003 };
01004
01005 const char*
aszWindowStyle[] = {
01006
NO_FLAG,
01007
NO_FLAG,
01008
NO_FLAG,
01009
NO_FLAG,
01010
NO_FLAG,
01011
NO_FLAG,
01012
NO_FLAG,
01013
NO_FLAG,
01014
NO_FLAG,
01015
NO_FLAG,
01016
NO_FLAG,
01017
NO_FLAG,
01018
NO_FLAG,
01019
NO_FLAG,
01020
NO_FLAG,
01021
NO_FLAG,
01022
"WS_TABSTOP",
01023
"WS_GROUP",
01024
"WS_THICKFRAME",
01025
"WS_SYSMENU",
01026
"WS_HSCROLL",
01027
"WS_VSCROLL",
01028
"WS_DLGFRAME",
01029
"WS_BORDER",
01030
"WS_MAXIMIZE",
01031
"WS_CLIPCHILDREN",
01032
"WS_CLIPSIBLINGS",
01033
"WS_DISABLED",
01034
"WS_VISIBLE",
01035
"WS_MINIMIZE",
01036
"WS_CHILD",
01037
"WS_POPUP",
01038
NULL,
01039 };
01040
01041 const char*
aszDialogStyle[] = {
01042
"DS_ABSALIGN",
01043
"DS_SYSMODAL",
01044
"DS_3DLOOK",
01045
"DS_FIXEDSYS",
01046
"DS_NOFAILCREATE",
01047
"DS_LOCALEDIT",
01048
"DS_SETFONT",
01049
"DS_MODALFRAME",
01050
"DS_NOIDLEMSG",
01051
"DS_SETFOREGROUND",
01052
"DS_CONTROL",
01053
"DS_CENTER",
01054
"DS_CENTERMOUSE",
01055
"DS_CONTEXTHELP",
01056
NO_FLAG,
01057
NO_FLAG,
01058
01059
CONTINUE_ON(
aszWindowStyle + 16),
01060 };
01061
01062
01063 const char*
aszButtonStyle[] = {
01064
MASKENUM_START(BS_TYPEMASK),
01065
"BS_PUSHBUTTON",
01066
"BS_DEFPUSHBUTTON",
01067
"BS_CHECKBOX",
01068
"BS_AUTOCHECKBOX",
01069
"BS_RADIOBUTTON",
01070
"BS_3STATE",
01071
"BS_AUTO3STATE",
01072
"BS_GROUPBOX",
01073
"BS_USERBUTTON",
01074
"BS_AUTORADIOBUTTON",
01075
"BS_PUSHBOX",
01076
"BS_OWNERDRAW",
01077
MASKENUM_END(4),
01078
01079
NO_FLAG,
01080
"BS_LEFTTEXT",
01081
01082
MASKENUM_START(BS_IMAGEMASK),
01083
"BS_TEXT",
01084
"BS_ICON",
01085
"BS_BITMAP",
01086
MASKENUM_END(2),
01087
01088
MASKENUM_START(BS_HORZMASK),
01089
NO_FLAG,
01090
"BS_LEFT",
01091
"BS_RIGHT",
01092
"BS_CENTER",
01093
MASKENUM_END(2),
01094
01095
MASKENUM_START(BS_VERTMASK),
01096
NO_FLAG,
01097
"BS_TOP",
"BS_BOTTOM",
"BS_VCENTER",
01098
MASKENUM_END(2),
01099
01100
"BS_PUSHLIKE",
01101
"BS_MULTILINE",
01102
"BS_NOTIFY",
01103
"BS_FLAT",
01104
01105
CONTINUE_ON(
aszWindowStyle + 16),
01106 };
01107
01108 const char*
aszComboBoxStyle[] = {
01109
MASKENUM_START(0x0f),
01110
NO_FLAG,
01111
"CBS_SIMPLE",
01112
"CBS_DROPDOWN",
01113
"CBS_DROPDOWNLIST",
01114
MASKENUM_END(4),
01115
01116
"CBS_OWNERDRAWFIXED",
01117
"CBS_OWNERDRAWVARIABLE",
01118
"CBS_AUTOHSCROLL",
01119
"CBS_OEMCONVERT",
01120
"CBS_SORT",
01121
"CBS_HASSTRINGS",
01122
"CBS_NOINTEGRALHEIGHT",
01123
"CBS_DISABLENOSCROLL",
01124
NO_FLAG,
01125
"CBS_UPPERCASE",
01126
"CBS_LOWERCASE",
01127
NO_FLAG,
01128
01129
CONTINUE_ON(
aszWindowStyle + 16),
01130 };
01131
01132 const char*
aszStaticStyle[] = {
01133
MASKENUM_START(SS_TYPEMASK),
01134
"SS_LEFT",
01135
"SS_CENTER",
01136
"SS_RIGHT",
01137
"SS_ICON",
01138
"SS_BLACKRECT",
01139
"SS_GRAYRECT",
01140
"SS_WHITERECT",
01141
"SS_BLACKFRAME",
01142
"SS_GRAYFRAME",
01143
"SS_WHITEFRAME",
01144
"SS_USERITEM",
01145
"SS_SIMPLE",
01146
"SS_LEFTNOWORDWRAP",
01147
"SS_OWNERDRAW",
01148
"SS_BITMAP",
01149
"SS_ENHMETAFILE",
01150
"SS_ETCHEDHORZ",
01151
"SS_ETCHEDVERT",
01152
"SS_ETCHEDFRAME",
01153
MASKENUM_END(5),
01154
01155
NO_FLAG,
01156
NO_FLAG,
01157
"SS_NOPREFIX",
01158
"SS_NOTIFY",
01159
"SS_CENTERIMAGE",
01160
"SS_RIGHTJUST",
01161
"SS_REALSIZEIMAGE",
01162
"SS_SUNKEN",
01163
"SS_EDITCONTROL",
01164
01165
MASKENUM_START(SS_ELLIPSISMASK),
01166
NO_FLAG,
01167
"SS_ENDELLIPSIS",
01168
"SS_PATHELLIPSIS",
01169
"SS_WORDELLIPSIS",
01170
MASKENUM_END(2),
01171
01172
CONTINUE_ON(
aszWindowStyle + 16),
01173 };
01174
01175 const char*
aszListBoxStyle[] = {
01176
"LBS_NOTIFY",
01177
"LBS_SORT",
01178
"LBS_NOREDRAW",
01179
"LBS_MULTIPLESEL",
01180
"LBS_OWNERDRAWFIXED",
01181
"LBS_OWNERDRAWVARIABLE",
01182
"LBS_HASSTRINGS",
01183
"LBS_USETABSTOPS",
01184
"LBS_NOINTEGRALHEIGHT",
01185
"LBS_MULTICOLUMN",
01186
"LBS_WANTKEYBOARDINPUT",
01187
"LBS_EXTENDEDSEL",
01188
"LBS_DISABLENOSCROLL",
01189
"LBS_NODATA",
01190
"LBS_NOSEL",
01191
NO_FLAG,
01192
01193
CONTINUE_ON(
aszWindowStyle + 16),
01194 };
01195
01196 const char*
aszEditStyle[] = {
01197
MASKENUM_START(ES_FMTMASK),
01198
"ES_LEFT",
01199
"ES_CENTER",
01200
"ES_RIGHT",
01201
MASKENUM_END(2),
01202
01203
"ES_MULTILINE",
01204
"ES_UPPERCASE",
01205
"ES_LOWERCASE",
01206
"ES_PASSWORD",
01207
"ES_AUTOVSCROLL",
01208
"ES_AUTOHSCROLL",
01209
"ES_NOHIDESEL",
01210
"ES_COMBOBOX",
01211
"ES_OEMCONVERT",
01212
"ES_READONLY",
01213
"ES_WANTRETURN",
01214
"ES_NUMBER",
01215
NO_FLAG,
01216
NO_FLAG,
01217
01218
CONTINUE_ON(
aszWindowStyle + 16),
01219 };
01220
01221 const char*
aszScrollBarStyle[] = {
01222
"SBS_HORZ",
01223
"SBS_VERT",
01224
"SBS_TOPALIGN",
01225
"SBS_LEFTALIGN",
01226
"SBS_BOTTOMALIGN",
01227
"SBS_RIGHTALIGN",
01228
"SBS_SIZEBOXTOPLEFTALIGN",
01229
"SBS_SIZEBOXBOTTOMRIGHTALIGN",
01230
"SBS_SIZEBOX",
01231
"SBS_SIZEGRIP",
01232
SHIFT_BITS(8),
01233
01234
CONTINUE_ON(
aszWindowStyle + 16),
01235 };
01236
01237 const char*
aszWindowExStyle[] = {
01238
"WS_EX_DLGMODALFRAME",
01239
"WS_EX_DRAGOBJECT",
01240
"WS_EX_NOPARENTNOTIFY",
01241
"WS_EX_TOPMOST",
01242
"WS_EX_ACCEPTFILES",
01243
"WS_EX_TRANSPARENT",
01244
"WS_EX_MDICHILD",
01245
"WS_EX_TOOLWINDOW",
01246
"WS_EX_WINDOWEDGE",
01247
"WS_EX_CLIENTEDGE",
01248
"WS_EX_CONTEXTHELP",
01249
NO_FLAG,
01250
01251
"WS_EX_RIGHT",
01252
01253
"WS_EX_RTLREADING",
01254
01255
"WS_EX_LEFTSCROLLBAR",
01256
01257
NO_FLAG,
01258
01259
"WS_EX_CONTROLPARENT",
01260
"WS_EX_STATICEDGE",
01261
"WS_EX_APPWINDOW",
01262
"WS_EX_LAYERED",
01263
NULL
01264 };
01265
01266 const char*
aszClientImcFlags[] = {
01267
"IMCF_UNICODE",
01268
"IMCF_ACTIVE",
01269
"IMCF_CHGMSG",
01270
"IMCF_SAVECTRL",
01271
"IMCF_PROCESSEVENT",
01272
"IMCF_FIRSTSELECT",
01273
"IMCF_INDESTROY",
01274
"IMCF_WINNLSDISABLE",
01275
"IMCF_DEFAULTIMC",
01276
NULL,
01277 };
01278
01279 const char*
aszConversionModes[] = {
01280
"IME_CMODE_NATIVE",
01281
"IME_CMODE_KATAKANA",
01282
NO_FLAG,
01283
"IME_CMODE_FULLSHAPE",
01284
"IME_CMODE_ROMAN",
01285
"IME_CMODE_CHARCODE",
01286
"IME_CMODE_HANJACONVERT",
01287
"IME_CMODE_SOFTKBD",
01288
"IME_CMODE_NOCONVERSION",
01289
"IME_CMODE_EUDC",
01290
"IME_CMODE_SYMBOL",
01291
"IME_CMODE_FIXED",
01292
NULL
01293 };
01294
01295 const char*
aszSentenceModes[] = {
01296
"IME_SMODE_PLAURALCLAUSE",
01297
"IME_SMODE_SINGLECONVERT",
01298
"IME_SMODE_AUTOMATIC",
01299
"IME_SMODE_PHRASEPREDICT",
01300
"IME_SMODE_CONVERSATION",
01301
NULL
01302 };
01303
01304 const char*
aszImeInit[] = {
01305
"INIT_STATUSWNDPOS",
01306
"INIT_CONVERSION",
01307
"INIT_SENTENCE",
01308
"INIT_LOGFONT",
01309
"INIT_COMPFORM",
01310
"INIT_SOFTKBDPOS",
01311
NULL
01312 };
01313
01314 const char*
aszImeSentenceMode[] = {
01315
"IME_SMODE_PLAURALCLAUSE",
01316
"IME_SMODE_SINGLECONVERT",
01317
"IME_SMODE_AUTOMATIC",
01318
"IME_SMODE_PHRASEPREDICT",
01319
"IME_SMODE_CONVERSATION",
01320
NULL
01321 };
01322
01323 const char*
aszImeConversionMode[] = {
01324
"IME_CMODE_NATIVE",
01325
"IME_CMODE_KATAKANA",
01326
NO_FLAG,
01327
"IME_CMODE_FULLSHAPE",
01328
"IME_CMODE_ROMAN",
01329
"IME_CMODE_CHARCODE",
01330
"IME_CMODE_HANJACONVERT",
01331
"IME_CMODE_SOFTKBD",
01332
"IME_CMODE_NOCONVERSION",
01333
"IME_CMODE_EUDC",
01334
"IME_CMODE_SYMBOL",
01335
"IME_CMODE_FIXED",
01336
NULL
01337 };
01338
01339 const char*
aszImeDirtyFlags[] = {
01340
"IMSS_UPDATE_OPEN",
01341
"IMSS_UPDATE_CONVERSION",
01342
"IMSS_UPDATE_SENTENCE",
01343
NO_FLAG,
01344
NO_FLAG,
01345
NO_FLAG,
01346
NO_FLAG,
01347
NO_FLAG,
01348
"IMSS_INIT_OPEN",
01349
NULL
01350 };
01351
01352 const char*
aszImeCompFormFlags[] = {
01353
01354
"CFS_RECT",
01355
"CFS_POINT",
01356
"CFS_SCREEN",
01357
"CFS_VERTICAL",
01358
"CFS_HIDDEN",
01359
"CFS_FORCE_POSITION",
01360
"CFS_CANDIDATEPOS",
01361
"CFS_EXCLUDE",
01362 };
01363
01364
01365 const char*
aszEdUndoType[] = {
01366
"UNDO_INSERT",
01367
"UNDO_DELETE",
01368
NULL,
01369 };
01370
01371 const char*
aszDeviceInfoActionFlags[] = {
01372
"GDIAF_ARRIVED",
01373
"GDIAF_QUERYREMOVE",
01374
"GDIAF_REMOVECANCELLED",
01375
"GDIAF_DEPARTED",
01376
"GDIAF_IME_STATUS",
01377
"GDIAF_REFRESH_MOUSE",
01378
NO_FLAG,
01379
"GDIAF_FREEME",
01380
"GDIAF_PNPWAITING",
01381
"GDIAF_RETRYREAD",
01382
NULL,
01383 };
01384
01385 enum GF_FLAGS {
01386
GF_SMS = 0,
01387
GF_TIF,
01388
GF_QS,
01389
GF_MF,
01390
GF_CSF,
01391
GF_CS,
01392
GF_QF,
01393
GF_W32PF,
01394
GF_HE,
01395
GF_HDATA,
01396
GF_XI,
01397
GF_IIF,
01398
GF_TMRF,
01399
GF_SB,
01400
GF_CHARSETS,
01401
GF_MENUTYPE,
01402
GF_MENUSTATE,
01403
GF_CURSORF,
01404
GF_MON,
01405
GF_SI,
01406
GF_RIP,
01407
GF_SRVI,
01408
GF_PROP,
01409
GF_UPM0,
01410
GF_KI,
01411
GF_MI,
01412
GF_DS,
01413
GF_WS,
01414
GF_ES,
01415
GF_BS,
01416
GF_CBS,
01417
GF_SS,
01418
GF_LBS,
01419
GF_SBS,
01420
GF_WSEX,
01421
GF_CLIENTIMC,
01422
GF_CONVERSION,
01423
GF_SENTENCE,
01424
GF_IMEINIT,
01425
GF_IMEDIRTY,
01426
GF_IMECOMPFORM,
01427
GF_EDUNDO,
01428
GF_DIAF,
01429
01430
GF_LPK,
01431
GF_MAX
01432 };
01433
01434 LPCSTR*
aapszFlag[
GF_MAX] = {
01435
apszSmsFlags,
01436
apszTifFlags,
01437
apszQsFlags,
01438
apszMfFlags,
01439
apszCsfFlags,
01440
apszCsFlags,
01441
apszQfFlags,
01442
apszW32pfFlags,
01443
apszHeFlags,
01444
apszHdataFlags,
01445
apszXiFlags,
01446
apszIifFlags,
01447
apszTmrfFlags,
01448
apszSbFlags,
01449
apszCSFlags,
01450
apszMenuTypeFlags,
01451
apszMenuStateFlags,
01452
apszCursorfFlags,
01453
apszMonfFlags,
01454
apszSifFlags,
01455
apszRipFlags,
01456
apszSRVIFlags,
01457
apszPROPFlags,
01458
aszUserPreferencesMask0,
01459
aszKeyEventFlags,
01460
aszMouseEventFlags,
01461
aszDialogStyle,
01462
aszWindowStyle,
01463
aszEditStyle,
01464
aszButtonStyle,
01465
aszComboBoxStyle,
01466
aszStaticStyle,
01467
aszListBoxStyle,
01468
aszScrollBarStyle,
01469
aszWindowExStyle,
01470
aszClientImcFlags,
01471
aszConversionModes,
01472
aszSentenceModes,
01473
aszImeInit,
01474
aszImeDirtyFlags,
01475
aszImeCompFormFlags,
01476
aszEdUndoType,
01477
aszDeviceInfoActionFlags,
01478
01479
apszLpkEntryPoints,
01480 };
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499 LPSTR
GetFlags(
01500 WORD wType,
01501 DWORD dwFlags,
01502 LPSTR pszBuf,
01503 BOOL fPrintZero)
01504 {
01505
static char szT[512];
01506 WORD i;
01507
BOOL fFirst =
TRUE;
01508
BOOL fNoMoreNames =
FALSE;
01509 LPCSTR *apszFlags;
01510 LPSTR apszFlagNames[
sizeof(
DWORD) * 8], pszT;
01511
const char** ppszNextFlag;
01512
UINT uFlagsCount, uNextFlag;
01513
DWORD dwUnnamedFlags, dwLoopFlag;
01514
DWORD dwShiftBits;
01515
DWORD dwOrigFlags;
01516
01517
if (pszBuf ==
NULL) {
01518 pszBuf = szT;
01519 }
01520
if (!
bShowFlagNames) {
01521
sprintf(pszBuf,
"%x",
dwFlags);
01522
return pszBuf;
01523 }
01524
01525
if (wType >=
GF_MAX) {
01526 strcpy(pszBuf,
"Invalid flag type.");
01527
return pszBuf;
01528 }
01529
01530
01531
01532
01533 *pszBuf =
'\0';
01534 RtlZeroMemory(apszFlagNames,
sizeof(apszFlagNames));
01535
01536 apszFlags =
aapszFlag[wType];
01537
01538
01539
01540
01541 uFlagsCount = 0;
01542 dwUnnamedFlags = dwOrigFlags =
dwFlags;
01543 dwLoopFlag = 1;
01544 dwShiftBits = 0;
01545
01546 reentry:
01547
for (i = 0;
dwFlags;
dwFlags >>= 1, i++, dwLoopFlag <<= 1, ++dwShiftBits) {
01548
const char* lpszFlagName =
NULL;
01549
01550
01551
01552
01553
if (apszFlags[i] ==
NULL) {
01554
break;
01555 }
01556
01557
if (apszFlags[i] ==
_MASKENUM_START) {
01558
01559
01560
01561
DWORD en = 0;
01562
DWORD dwMask = (
DWORD)(ULONG_PTR)apszFlags[++i];
01563
01564
01565 dwUnnamedFlags &= ~dwMask;
01566 lpszFlagName =
NULL;
01567
for (++i; apszFlags[i] !=
NULL && apszFlags[i] !=
_MASKENUM_END; ++i, ++en) {
01568
if ((dwOrigFlags & dwMask) == (en << dwShiftBits )) {
01569
if (apszFlags[i] !=
NO_FLAG) {
01570 lpszFlagName = apszFlags[i];
01571 }
01572 }
01573 }
01574
01575
01576
01577
01578
dwFlags >>= (
int)(ULONG_PTR)apszFlags[++i] - 1;
01579 dwLoopFlag <<= (
int)(ULONG_PTR)apszFlags[i] - 1;
01580 dwShiftBits += (
int)(ULONG_PTR)apszFlags[i] - 1;
01581
if (lpszFlagName ==
NULL) {
01582
01583
01584
01585
continue;
01586 }
01587 }
01588
else if (apszFlags[i] ==
_CONTINUE_ON) {
01589
01590
01591
01592 apszFlags = (LPSTR*)apszFlags[i + 1];
01593
goto reentry;
01594 }
01595
else if (apszFlags[i] ==
_SHIFT_BITS) {
01596
01597
01598
01599
dwFlags >>= (
int)(ULONG_PTR)apszFlags[++i] - 1;
01600 dwLoopFlag <<= (
int)(ULONG_PTR)apszFlags[i] - 1;
01601 dwShiftBits += (
int)(ULONG_PTR)apszFlags[i] - 1;
01602
continue;
01603 }
01604
else {
01605
01606
01607
01608
if (!(
dwFlags & 1) || (apszFlags[i] ==
NO_FLAG)) {
01609
continue;
01610 }
01611 lpszFlagName = apszFlags[i];
01612 }
01613
01614
01615
01616
01617 ppszNextFlag = apszFlagNames;
01618 uNextFlag = 0;
01619
while (uNextFlag < uFlagsCount) {
01620
if (strcmp(*ppszNextFlag, lpszFlagName) > 0) {
01621
break;
01622 }
01623 ppszNextFlag++;
01624 uNextFlag++;
01625 }
01626
01627
01628
01629 RtlMoveMemory((
char*)(ppszNextFlag + 1), ppszNextFlag, (uFlagsCount - uNextFlag) *
sizeof(
DWORD));
01630 *ppszNextFlag = lpszFlagName;
01631 uFlagsCount++;
01632
01633
01634
01635 dwUnnamedFlags &= ~dwLoopFlag;
01636 }
01637
01638
01639
01640
01641 ppszNextFlag = apszFlagNames;
01642 pszT = pszBuf;
01643
01644
01645
01646
if (uFlagsCount > 0) {
01647 pszT +=
sprintf(pszT,
"%s", *ppszNextFlag++);
01648 uFlagsCount--;
01649 }
01650
01651
01652
01653
while (uFlagsCount > 0) {
01654 pszT +=
sprintf(pszT,
" | %s", *ppszNextFlag++);
01655 uFlagsCount--;
01656 }
01657
01658
01659
01660
if (dwUnnamedFlags != 0) {
01661 pszT +=
sprintf(pszT,
" | %#lx", dwUnnamedFlags);
01662 }
01663
01664
01665
01666
if (fPrintZero && (pszT == pszBuf)) {
01667
sprintf(pszBuf,
"0");
01668 }
01669
01670
return pszBuf;
01671 }
01672
01674
01675
01676
01678
01679 typedef struct {
01680 LPCSTR name;
01681 DWORD value;
01682 }
EnumItem;
01683
01684 #define EITEM(a) { #a, a }
01685
01686 const EnumItem aClsTypes[] = {
01687
EITEM(
ICLS_BUTTON),
01688
EITEM(
ICLS_EDIT),
01689
EITEM(
ICLS_STATIC),
01690
EITEM(
ICLS_LISTBOX),
01691
EITEM(
ICLS_SCROLLBAR),
01692
EITEM(
ICLS_COMBOBOX),
01693
EITEM(
ICLS_CTL_MAX),
01694
EITEM(
ICLS_DESKTOP),
01695
EITEM(
ICLS_DIALOG),
01696
EITEM(
ICLS_MENU),
01697
EITEM(
ICLS_SWITCH),
01698
EITEM(
ICLS_ICONTITLE),
01699
EITEM(
ICLS_MDICLIENT),
01700
EITEM(
ICLS_COMBOLISTBOX),
01701
EITEM(
ICLS_DDEMLEVENT),
01702
EITEM(
ICLS_DDEMLMOTHER),
01703
EITEM(
ICLS_DDEML16BIT),
01704
EITEM(
ICLS_DDEMLCLIENTA),
01705
EITEM(
ICLS_DDEMLCLIENTW),
01706
EITEM(
ICLS_DDEMLSERVERA),
01707
EITEM(
ICLS_DDEMLSERVERW),
01708
EITEM(
ICLS_IME),
01709
EITEM(
ICLS_TOOLTIP),
01710
NULL,
01711 };
01712
01713 const EnumItem aCharSets[] = {
01714
EITEM(ANSI_CHARSET),
01715
EITEM(DEFAULT_CHARSET),
01716
EITEM(SYMBOL_CHARSET),
01717
EITEM(SHIFTJIS_CHARSET),
01718
EITEM(HANGEUL_CHARSET),
01719
EITEM(HANGUL_CHARSET),
01720
EITEM(GB2312_CHARSET),
01721
EITEM(CHINESEBIG5_CHARSET),
01722
EITEM(OEM_CHARSET),
01723
EITEM(JOHAB_CHARSET),
01724
EITEM(HEBREW_CHARSET),
01725
EITEM(ARABIC_CHARSET),
01726
EITEM(GREEK_CHARSET),
01727
EITEM(TURKISH_CHARSET),
01728
EITEM(VIETNAMESE_CHARSET),
01729
EITEM(THAI_CHARSET),
01730
EITEM(EASTEUROPE_CHARSET),
01731
EITEM(RUSSIAN_CHARSET),
01732
NULL,
01733 };
01734
01735 const EnumItem aImeHotKeys[] = {
01736
01737
EITEM(IME_CHOTKEY_IME_NONIME_TOGGLE),
01738
EITEM(IME_CHOTKEY_SHAPE_TOGGLE),
01739
EITEM(IME_CHOTKEY_SYMBOL_TOGGLE),
01740
01741
EITEM(IME_JHOTKEY_CLOSE_OPEN),
01742
01743
EITEM(IME_KHOTKEY_SHAPE_TOGGLE),
01744
EITEM(IME_KHOTKEY_HANJACONVERT),
01745
EITEM(IME_KHOTKEY_ENGLISH),
01746
01747
EITEM(IME_THOTKEY_IME_NONIME_TOGGLE),
01748
EITEM(IME_THOTKEY_SHAPE_TOGGLE),
01749
EITEM(IME_THOTKEY_SYMBOL_TOGGLE),
01750
01751
EITEM(IME_HOTKEY_DSWITCH_FIRST),
01752
EITEM(IME_HOTKEY_DSWITCH_LAST),
01753
01754
EITEM(IME_ITHOTKEY_RESEND_RESULTSTR),
01755
EITEM(IME_ITHOTKEY_PREVIOUS_COMPOSITION),
01756
EITEM(IME_ITHOTKEY_UISTYLE_TOGGLE),
01757
EITEM(IME_ITHOTKEY_RECONVERTSTRING),
01758
EITEM(IME_HOTKEY_PRIVATE_LAST),
01759
NULL,
01760 };
01761
01762 const EnumItem aCandidateListStyle[] = {
01763
EITEM(IME_CAND_UNKNOWN),
01764
EITEM(IME_CAND_READ),
01765
EITEM(IME_CAND_CODE),
01766
EITEM(IME_CAND_MEANING),
01767
EITEM(IME_CAND_RADICAL),
01768
EITEM(IME_CAND_STROKE),
01769
NULL
01770 };
01771
01772
01773
01774
enum {
01775
EI_CLSTYPE = 0,
01776
EI_CHARSETTYPE,
01777
EI_IMEHOTKEYTYPE,
01778
EI_IMECANDIDATESTYLE,
01779
EI_MAX
01780 };
01781
01782 typedef struct {
01783 DWORD dwMask;
01784 const EnumItem* items;
01785 }
MaskedEnum;
01786
01787 const MaskedEnum aEnumItems[] = {
01788 ~0,
aClsTypes,
01789 ~0,
aCharSets,
01790 ~0,
aImeHotKeys,
01791 ~0,
aCandidateListStyle,
01792 };
01793
01794 LPCSTR
GetMaskedEnum(WORD wType, DWORD dwValue, LPSTR buf)
01795 {
01796
const EnumItem* item;
01797
static char ach[32];
01798
01799
if (wType >=
EI_MAX) {
01800 strcpy(buf,
"Invalid type.");
01801
return buf;
01802 }
01803
01804 dwValue &=
aEnumItems[wType].
dwMask;
01805
01806 item =
aEnumItems[wType].
items;
01807
01808
for (; item->
name; ++item) {
01809
if (item->
value == dwValue) {
01810
if (buf) {
01811 strcpy(buf, item->
name);
01812
return buf;
01813 }
01814
return item->
name;
01815 }
01816 }
01817
01818
if (buf) {
01819 *buf = 0;
01820
return buf;
01821 }
01822
01823
sprintf(ach,
"%x", wType);
01824
return ach;
01825 }
01826
01827 #define WM_ITEM(x) { x, #x }
01828
01829
struct {
01830 DWORD msg;
01831 LPSTR
pszMsg;
01832 }
gaMsgs[] = {
01833
#include "wm.txt"
01834 };
01835
01836
#undef WM_ITEM
01837
01838
01839
#ifdef KERNEL
01840
01841
PETHREAD (*GetCurrentThreadAddress)(
USHORT, HANDLE) = DummyGetCurrentThreadAddress;
01842
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
PETHREAD
01858 DummyGetCurrentThreadAddress(
01859 USHORT Processor,
01860 HANDLE hCurrentThread
01861 )
01862 {
01863 WCHAR awchKDName[
MAX_PATH];
01864 LPWSTR lpszKDExts;
01865 HANDLE hmodKDExts;
01866
01867
01868
01869
01870
01871 GetModuleFileNameW(NULL, awchKDName, MAX_PATH);
01872 _wcslwr(awchKDName);
01873
if (wcsstr(awchKDName, L
"alphakd.exe"))
01874 lpszKDExts =
L"kdextalp.dll";
01875
else if (wcsstr(awchKDName, L
"i386kd.exe"))
01876 lpszKDExts =
L"kdextx86.dll";
01877
else if (wcsstr(awchKDName, L
"mipskd.exe"))
01878 lpszKDExts =
L"kdextmip.dll";
01879
else if (wcsstr(awchKDName, L
"ppckd.exe"))
01880 lpszKDExts =
L"kdextppc.dll";
01881
else {
01882 Print(
"Unknown kernel debugger: %s\n", awchKDName);
01883
return NULL;
01884 }
01885
01886
01887
01888
01889 hmodKDExts = LoadLibraryW(lpszKDExts);
01890
if (hmodKDExts ==
NULL) {
01891 Print(
"Could not load %s\n", lpszKDExts);
01892
return NULL;
01893 }
01894 GetCurrentThreadAddress = (PVOID)GetProcAddress(hmodKDExts,
"GetCurrentThreadAddress");
01895
if (GetCurrentThreadAddress ==
NULL) {
01896 Print(
"Could not find GetCurrentThreadAddress\n");
01897 FreeLibrary(hmodKDExts);
01898 GetCurrentThreadAddress = DummyGetCurrentThreadAddress;
01899
return NULL;
01900 }
01901
01902
01903
01904
01905
return GetCurrentThreadAddress(Processor, hCurrentThread);
01906 }
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
PEPROCESS
01921 GetCurrentProcessAddress(
01922 DWORD Processor,
01923 HANDLE hCurrentThread,
01924
PETHREAD CurrentThread
01925 )
01926 {
01927
ETHREAD Thread;
01928
01929
if (CurrentThread ==
NULL) {
01930 CurrentThread = (
PETHREAD)GetCurrentThreadAddress( (USHORT)Processor, hCurrentThread );
01931
if (CurrentThread ==
NULL) {
01932 DEBUGPRINT(
"GetCurrentProcessAddress: failed to get thread addr.\n");
01933
return NULL;
01934 }
01935 }
01936
01937
if (!tryMove(Thread, CurrentThread)) {
01938 DEBUGPRINT(
"GetCurrentProcessAddress: failed to read thread memory.\n");
01939
return NULL;
01940 }
01941
01942
return CONTAINING_RECORD(Thread.
Tcb.
ApcState.
Process,
EPROCESS,Pcb);
01943 }
01944
01945
01946
01947
01948
01949
01950
01951
BOOL
01952 GetProcessName(
01953
PEPROCESS pEProcess,
01954 LPWSTR lpBuffer)
01955 {
01956 UCHAR ImageFileName[16];
01957
if (
GetEProcessData(pEProcess, PROCESS_IMAGEFILENAME, ImageFileName)) {
01958 swprintf(lpBuffer, L
"%.16hs", ImageFileName);
01959
return TRUE;
01960 }
else {
01961 Print(
"Unable to read _EPROCESS at %lx\n", pEProcess);
01962
return FALSE;
01963 }
01964 }
01965
01966
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
BOOL
01977 GetAppName(
01978
PETHREAD pEThread,
01979
PTHREADINFO pti,
01980 LPWSTR lpBuffer,
01981 DWORD cbBuffer)
01982 {
01983 PUNICODE_STRING pstrAppName;
01984 UNICODE_STRING strAppName;
01985
BOOL fRead =
FALSE;
01986
01987
if (pti->
pstrAppName !=
NULL) {
01988 pstrAppName = pti->
pstrAppName;
01989
if (pstrAppName !=
NULL && tryMove(strAppName, pstrAppName)) {
01990 cbBuffer =
min(cbBuffer -
sizeof(WCHAR), strAppName.Length);
01991
if (tryMoveBlock(lpBuffer, strAppName.Buffer, cbBuffer)) {
01992 lpBuffer[cbBuffer /
sizeof(WCHAR)] = 0;
01993 fRead =
TRUE;
01994 }
01995 }
01996 }
else {
01997 fRead = GetProcessName(pEThread->
ThreadsProcess, lpBuffer);
01998 }
01999
02000
if (!fRead) {
02001 wcsncpy(lpBuffer, L
"<unknown name>", cbBuffer /
sizeof(WCHAR));
02002 }
02003
return fRead;
02004 }
02005
02006
#endif // KERNEL
02007
02008
02009
#ifdef KERNEL
02010
02011
02012
02013
02014
02015
02016
02017
02018
02019
02020
BOOL PrintMessages(
02021
PQMSG pqmsgRead)
02022 {
02023
QMSG qmsg;
02024
ASYNCSENDMSG asm;
02025
char *aszEvents[] = {
02026
"MSG",
02027
"SHO",
02028
"CMD",
02029
"SWP",
02030
"UKS",
02031
"DEA",
02032
"ACT",
02033
"PST",
02034
"EXE",
02035
"CMN",
02036
"DSW",
02037
"ASY",
02038
"HNG",
02039
"CMT",
02040
"NWE",
02041
"RAC",
02042
"RSO",
02043
"? ",
02044
"? ",
02045
"? "
02046 };
02047
#define NQEVENT (sizeof(aszEvents)/sizeof(aszEvents[0]))
02048
02049 Print(
"typ pqmsg hwnd msg wParam lParam time ExInfo dwQEvent pti\n");
02050 Print(
"-------------------------------------------------------------------------------\n");
02051
02052 SAFEWHILE (TRUE) {
02053
move(qmsg,
FIXKP(pqmsgRead));
02054
if (qmsg.
dwQEvent < NQEVENT)
02055 Print(
"%s %08lx ", aszEvents[qmsg.
dwQEvent], pqmsgRead);
02056
else
02057 Print(
"??? %08lx ", pqmsgRead);
02058
02059
switch (qmsg.
dwQEvent) {
02060
case QEVENT_ASYNCSENDMSG:
02061
move(
asm, (PVOID)qmsg.
msg.wParam);
02062
02063 Print(
"%07lx %04lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
02064
asm.hwnd,
asm.message,
asm.wParam,
asm.lParam,
02065 qmsg.
msg.time, qmsg.
ExtraInfo, qmsg.
dwQEvent, qmsg.
pti);
02066
break;
02067
02068
case 0:
02069
default:
02070 Print(
"%07lx %04lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
02071 qmsg.
msg.hwnd, qmsg.
msg.message, qmsg.
msg.wParam, qmsg.
msg.lParam,
02072 qmsg.
msg.time, qmsg.
ExtraInfo, qmsg.
dwQEvent, qmsg.
pti);
02073
break;
02074
02075 }
02076
02077
if (qmsg.
pqmsgNext !=
NULL) {
02078
if (pqmsgRead == qmsg.
pqmsgNext) {
02079 Print(
"loop found in message list!");
02080
return FALSE;
02081 }
02082 pqmsgRead = qmsg.
pqmsgNext;
02083 }
else {
02084
return TRUE;
02085 }
02086 }
02087
return TRUE;
02088 }
02089
#endif // KERNEL
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100
02101
02102
BOOL
02103
GetAndDumpHE(
02104 ULONG_PTR dwT,
02105
PHE phe,
02106 BOOL fPointerTest)
02107 {
02108
02109
DWORD dw;
02110
HEAD head;
02111
PHE pheT;
02112
PSHAREDINFO pshi;
02113
SHAREDINFO shi;
02114
SERVERINFO si;
02115 ULONG_PTR cHandleEntries;
02116
02117
02118
02119
02120
02121
02122 dw =
HMIndexFromHandle(dwT);
02123
02124
02125
02126
02127
02128
02129
if (!fPointerTest &&
IS_PTR(dwT)) {
02130 head.
h =
NULL;
02131
move(head, (PVOID)dwT);
02132
if (head.
h !=
NULL) {
02133
if (
GetAndDumpHE((ULONG_PTR)head.
h, phe, TRUE)) {
02134
return TRUE;
02135 }
02136 }
02137 }
02138
02139
02140
02141
02142
GETSHAREDINFO(pshi);
02143
move(shi, pshi);
02144
move(si, shi.
psi);
02145 cHandleEntries = si.
cHandleEntries;
02146
if (dw >= cHandleEntries)
02147
return FALSE;
02148
02149
02150
02151
02152 pheT = shi.
aheList;
02153 pheT = &pheT[dw];
02154
move(*phe, pheT);
02155
02156
02157
02158
02159
if (phe->
bType >=
TYPE_CTYPES) {
02160 pheT =
NULL;
02161 }
else {
02162
move(head, phe->
phead);
02163
if (phe->
bType !=
TYPE_FREE) {
02164
02165
02166
02167
02168
if (
HMIndexFromHandle(head.
h) != dw)
02169 pheT =
NULL;
02170 }
02171 }
02172
02173
if (pheT ==
NULL) {
02174
if (!fPointerTest)
02175 Print(
"0x%p is not a valid object or handle.\n", dwT);
02176
return FALSE;
02177 }
02178
02179
02180
02181
02182
Idhe(0, head.
h, NULL);
02183 Print(
"\n");
02184
02185
return TRUE;
02186 }
02187
02188
02189
02190
02191
02192
02193
02194
02195
02196
02197
02198
02199
02200
02201
02202
BOOL HtoHE(
02203 ULONG_PTR h,
02204
HANDLEENTRY *phe,
02205
HANDLEENTRY **pphe)
02206 {
02207
SHAREDINFO si, *psi;
02208
SERVERINFO svi;
02209
DWORD index;
02210
02211 index =
HMIndexFromHandle(h);
02212
GETSHAREDINFO(psi);
02213
if (!tryMove(si, psi)) {
02214 DEBUGPRINT(
"HtoHE(%x): SHAREDINFO move failed. Bad symbols?\n", h);
02215
return FALSE;
02216 }
02217
if (!tryMove(svi, si.
psi)) {
02218 DEBUGPRINT(
"HtoHE(%x): SERVERINFO move failed. Bad symbols?\n", h);
02219
return FALSE;
02220 }
02221
if (index >= svi.
cHandleEntries) {
02222 DEBUGPRINT(
"HtoHE(%x): index %d is too large.\n", h, index);
02223
return FALSE;
02224 }
02225
if (pphe !=
NULL) {
02226 *pphe = &si.
aheList[index];
02227 }
02228
if (!tryMove(*phe, &si.
aheList[index])) {
02229 DEBUGPRINT(
"HtoHE(%x): aheList[%d] move failed.\n", h, index);
02230
return FALSE;
02231 }
02232
return TRUE;
02233 }
02234
02235
02236
02237
02238
02239
02240
02241
02242
02243
02244
02245
02246
BOOL dbgPtoH(
02247 PVOID p,
02248 ULONG_PTR *ph)
02249 {
02250
THROBJHEAD head;
02251
02252
if (tryMove(head, p)) {
02253 *ph = (ULONG_PTR)head.h;
02254
return TRUE;
02255 }
02256 DEBUGPRINT(
"dbgPtoH(%x): failed.\n", p);
02257
return FALSE;
02258 }
02259
02260
02261
02262
02263
02264
02265
02266
02267
02268
02269
02270
02271
BOOL dbgHtoP(
02272 DWORD h,
02273 PVOID *pp)
02274 {
02275
HANDLEENTRY he;
02276
02277
if (
HtoHE(h, &he, NULL)) {
02278 *pp =
FIXKP(he.
phead);
02279
return TRUE;
02280 }
02281 DEBUGPRINT(
"dbgHtoP(%x): failed.\n", h);
02282
return FALSE;
02283 }
02284
02285
02286
02287
02288
02289
02290
02291
02292
02293
02294
02295
02296 PVOID
GetPfromH(
02297 ULONG_PTR h,
02298
HANDLEENTRY **pphe,
02299
HANDLEENTRY *phe)
02300 {
02301
HANDLEENTRY he, *pheT;
02302
HEAD head;
02303
02304
if (!
HtoHE(h, &he, &pheT)) {
02305 DEBUGPRINT(
"GetPfromH(%x): failed to get HE.\n", h);
02306
return NULL;
02307 }
02308
if (!tryMove(head,
FIXKP(he.
phead))) {
02309 DEBUGPRINT(
"GetPfromH(%x): failed to get phead.\n", h);
02310
return NULL;
02311 }
02312
if (head.
h != (HANDLE)h) {
02313 DEBUGPRINT(
"WARNING: Full handle for 0x%x is 0x%08lx.\n", h, head.
h);
02314 }
02315
if (pphe !=
NULL) {
02316 *pphe = pheT;
02317 }
02318
if (phe !=
NULL) {
02319 *phe = he;
02320 }
02321
return FIXKP(he.
phead);
02322 }
02323
02324
02325
02326
02327
02328
02329
02330
02331
02332
02333
02334
02335
02336
BOOL getHEfromP(
02337
HANDLEENTRY **pphe,
02338
HANDLEENTRY *phe,
02339 PVOID p)
02340 {
02341 PVOID pLookup;
02342
THROBJHEAD head;
02343
02344 p =
FIXKP(p);
02345
if (!tryMove(head, p)) {
02346
return FALSE;
02347 }
02348
02349 pLookup =
GetPfromH((ULONG_PTR)head.h, pphe, phe);
02350
if (
FIXKP(pLookup) != p) {
02351 DEBUGPRINT(
"getHEfromP(%x): invalid.\n", p);
02352
return FALSE;
02353 }
02354
return TRUE;
02355 }
02356
02357
02358
02359
02360
02361
02362
02363
02364
02365
02366
02367
02368
02369
02370
02371
02372 PVOID
HorPtoP(
02373 PVOID p,
02374
int type)
02375 {
02376
HANDLEENTRY he;
02377 PVOID pT;
02378
02379
if (p ==
NULL) {
02380 DEBUGPRINT(
"HorPtoP(%x, %d): failed. got NULL.\n", p, type);
02381
return NULL;
02382 }
02383
02384 p =
FIXKP(p);
02385
if (tryMove(pT, p) &&
getHEfromP(NULL, &he, p)) {
02386
02387
02388
02389
if ((
type == -2 || he.
bType !=
TYPE_FREE) &&
02390 he.
bType <
TYPE_CTYPES &&
02391 ((
int)
type < 0 || he.
bType ==
type)) {
02392
return (PVOID)
FIXKP(he.
phead);
02393 }
02394 }
02395
02396 pT =
GetPfromH((ULONG_PTR)p, NULL, &he);
02397
if (pT ==
NULL) {
02398 Print(
"WARNING: dumping %#p even though is not a valid pointer or handle!\n", p);
02399
return p;
02400 }
02401
02402
return FIXKP(pT);
02403 }
02404
02405
02406
02407
02408
02409
02410
02411
02412
02413
02414
02415
02416
02417
BOOL DebugGetWindowTextA(
02418
PWND pwnd,
02419
char *achDest)
02420 {
02421
WND wnd;
02422 WCHAR awch[80];
02423
02424
if (pwnd ==
NULL) {
02425 achDest[0] =
'\0';
02426
return FALSE;
02427 }
02428
02429
if (!tryMove(wnd,
FIXKP(pwnd))) {
02430 strcpy(achDest,
"<< Can't get WND >>");
02431
return FALSE;
02432 }
02433
02434
if (wnd.
strName.
Buffer ==
NULL) {
02435 strcpy(achDest,
"<null>");
02436 }
else {
02437 ULONG cbText;
02438 cbText =
min(
sizeof(awch), wnd.
strName.
Length +
sizeof(WCHAR));
02439
if (!(tryMoveBlock(awch,
FIXKP(wnd.
strName.
Buffer), cbText))) {
02440 strcpy(achDest,
"<< Can't get title >>");
02441
return FALSE;
02442 }
02443 awch[
sizeof(awch) /
sizeof(WCHAR) - 1] =
L'\0';
02444
RtlUnicodeToMultiByteN(achDest, cbText /
sizeof(WCHAR), NULL,
02445 awch, cbText);
02446 }
02447
return TRUE;
02448 }
02449
02450
02451
02452
02453
02454
02455
02456
02457
02458
02459
02460
02461
02462
BOOL DebugGetClassNameA(
02463 LPSTR lpszClassName,
02464
char *achDest)
02465 {
02466
CHAR ach[80];
02467
02468
if (lpszClassName ==
NULL) {
02469 strcpy(achDest,
"<null>");
02470 }
else {
02471
if (!tryMove(ach,
FIXKP(lpszClassName))) {
02472 strcpy(achDest,
"<inaccessible>");
02473 }
else {
02474 strcpy(achDest, ach);
02475 }
02476 strcpy(achDest, ach);
02477 }
02478
return TRUE;
02479 }
02480
02481
02482
02483
02484
02485
02486
02487
02488
02489
02490
02491
02492
void PrintBitField(LPSTR pszFieldName, BOOLEAN fValue)
02493 {
02494
int iWidth;
02495
int iStart =
giBFColumn;
02496
02497
sprintf(gach1, fValue ?
"*%-s " :
" %-s ", pszFieldName);
02498
02499 iWidth = (
strlen(gach1) +
BF_COLUMN_WIDTH - 1) /
BF_COLUMN_WIDTH;
02500 iWidth *=
BF_COLUMN_WIDTH;
02501
02502
if ((
giBFColumn += iWidth) >=
BF_MAX_WIDTH) {
02503
giBFColumn = iWidth;
02504 Print(
"%s\n", gaBFBuff);
02505 iStart = 0;
02506 }
02507
02508
sprintf(gaBFBuff + iStart,
"%-*s", iWidth, gach1);
02509 }
02510
02511
void PrintEndBitField()
02512 {
02513
if (
giBFColumn != 0) {
02514
giBFColumn = 0;
02515 Print(
"%s\n", gaBFBuff);
02516 }
02517 }
02518
02519
02520
char *
pszObjStr[] = {
02521
"Free",
02522
"Window",
02523
"Menu",
02524
"Cursor",
02525
"SetWindowPos",
02526
"Hook",
02527
"Thread Info",
02528
"Clip Data",
02529
"Call Proc",
02530
"Accel Table",
02531
"WindowStation",
02532
"DeskTop",
02533
"DdeAccess",
02534
"DdeConv",
02535
"DdeExact",
02536
"Monitor",
02537
"Ctypes",
02538
"Console",
02539
"Generic"
02540 };
02541
02542
02543
#ifdef KERNEL
02544
02545
02546
02547
02548
02549
02550
02551
02552
02553 LPCSTR GetGDIHandleType(
02554 HANDLE handle)
02555 {
02556 HOBJ ho;
02557 PENTRY pent;
02558
ENTRY ent;
02559 BASEOBJECT obj;
02560 ULONG ulTemp;
02561
static CHAR szT[20];
02562 ULONG gcMaxHmgr, index;
02563
02564
02565
#define INDEX_MASK ((1 << INDEX_BITS) - 1)
02566
#define HmgIfromH(h) ((ULONG)(h) & INDEX_MASK)
02567
02568 szT[0] =
'\0';
02569 ho = (HOBJ) handle;
02570 moveExpValue(&pent,
VAR(gpentHmgr));
02571 moveExp(&gcMaxHmgr,
VAR(gcMaxHmgr));
02572 index = HmgIfromH((ULONG_PTR) ho);
02573
if (index > gcMaxHmgr) {
02574
return szT;
02575 }
02576
if (!tryMove(ent, &(pent[index]))) {
02577
return szT;
02578 }
02579
if (ent.FullUnique != ((ULONG_PTR)ho >> 16)) {
02580
return szT;
02581 }
02582
if (!tryMove(obj, ent.einfo.pobj)) {
02583
return szT;
02584 }
02585
if (obj.hHmgr != ho) {
02586
return szT;
02587 }
02588 ulTemp = (ULONG) ent.Objt;
02589
02590
switch(ulTemp) {
02591
case DEF_TYPE:
02592 strcpy(szT,
"DEF");
02593
break;
02594
02595
case DC_TYPE:
02596 strcpy(szT,
"DC");
02597
break;
02598
02599
case RGN_TYPE:
02600 strcpy(szT,
"RGN");
02601
break;
02602
02603
case SURF_TYPE:
02604 strcpy(szT,
"SURF");
02605
break;
02606
02607
case PATH_TYPE:
02608 strcpy(szT,
"PATH");
02609
break;
02610
02611
case PAL_TYPE:
02612 strcpy(szT,
"PAL");
02613
break;
02614
02615
case ICMLCS_TYPE:
02616 strcpy(szT,
"ICMLCS");
02617
break;
02618
02619
case LFONT_TYPE:
02620 strcpy(szT,
"LFONT");
02621
break;
02622
02623
case RFONT_TYPE:
02624 strcpy(szT,
"RFONT");
02625
break;
02626
02627
case PFE_TYPE:
02628 strcpy(szT,
"PFE");
02629
break;
02630
02631
case PFT_TYPE:
02632 strcpy(szT,
"PFT");
02633
break;
02634
02635
case ICMCXF_TYPE:
02636 strcpy(szT,
"ICMCXF");
02637
break;
02638
02639
case SPRITE_TYPE:
02640 strcpy(szT,
"SPRITE");
02641
break;
02642
02643
case SPACE_TYPE:
02644 strcpy(szT,
"SPACE");
02645
break;
02646
02647
case META_TYPE:
02648 strcpy(szT,
"META");
02649
break;
02650
02651
case EFSTATE_TYPE:
02652 strcpy(szT,
"EFSTATE");
02653
break;
02654
02655
case BMFD_TYPE:
02656 strcpy(szT,
"BMFD");
02657
break;
02658
02659
case VTFD_TYPE:
02660 strcpy(szT,
"VTFD");
02661
break;
02662
02663
case TTFD_TYPE:
02664 strcpy(szT,
"TTFD");
02665
break;
02666
02667
case RC_TYPE:
02668 strcpy(szT,
"RC");
02669
break;
02670
02671
case TEMP_TYPE:
02672 strcpy(szT,
"TEMP");
02673
break;
02674
02675
case DRVOBJ_TYPE:
02676 strcpy(szT,
"DRVOBJ");
02677
break;
02678
02679
case DCIOBJ_TYPE:
02680 strcpy(szT,
"DCIOBJ");
02681
break;
02682
02683
case SPOOL_TYPE:
02684 strcpy(szT,
"SPOOL");
02685
break;
02686
02687
default:
02688 ulTemp = LO_TYPE(ent.FullUnique << TYPE_SHIFT);
02689
switch (ulTemp) {
02690
case LO_BRUSH_TYPE:
02691 strcpy(szT,
"BRUSH");
02692
break;
02693
02694
case LO_PEN_TYPE:
02695 strcpy(szT,
"LO_PEN");
02696
break;
02697
02698
case LO_EXTPEN_TYPE:
02699 strcpy(szT,
"LO_EXTPEN");
02700
break;
02701
02702
case CLIENTOBJ_TYPE:
02703 strcpy(szT,
"CLIENTOBJ");
02704
break;
02705
02706
case LO_METAFILE16_TYPE:
02707 strcpy(szT,
"LO_METAFILE16");
02708
break;
02709
02710
case LO_METAFILE_TYPE:
02711 strcpy(szT,
"LO_METAFILE");
02712
break;
02713
02714
case LO_METADC16_TYPE:
02715 strcpy(szT,
"LO_METADC16");
02716
break;
02717 }
02718 }
02719
return szT;
02720 }
02721
02722
#endif // KERNEL
02723
02724
02725
02726
02727
02728
02729
02730
02731
02732
02733
02734
02735
02736
02737
VOID DirectAnalyze(
02738 ULONG_PTR dw,
02739 ULONG_PTR adw,
02740 BOOL fNoSym)
02741 {
02742
PHE phe;
02743
HANDLEENTRY he;
02744
DWORD index;
02745 DWORD_PTR dwOffset;
02746 WORD uniq, w, aw;
02747
HEAD head;
02748
CHAR ach[80];
02749
#ifdef KERNEL
02750
LPCSTR psz;
02751
#endif
02752
02753 Print(
"0x%p ", dw);
02754
if (HIWORD(dw) != 0) {
02755
02756
02757
02758 index =
HMIndexFromHandle(dw);
02759
if (index <
gSi.
cHandleEntries) {
02760 uniq =
HMUniqFromHandle(dw);
02761 phe = &
gShi.
aheList[index];
02762
move(he, phe);
02763
if (he.
wUniq == uniq) {
02764 Print(
"= a %s handle. ", pszObjStr[he.
bType]);
02765 fNoSym =
TRUE;
02766 }
02767 }
02768
#ifdef KERNEL
02769
02770
02771
02772 psz = GetGDIHandleType((HANDLE)dw);
02773
if (*psz) {
02774 Print(
"= a GDI %s type handle. ", psz);
02775 fNoSym =
TRUE;
02776 }
02777
#endif // KERNEL
02778
02779
02780
02781
if (tryMove(head, (PVOID)dw)) {
02782
if (head.
h) {
02783 index =
HMIndexFromHandle(head.
h);
02784
if (index <
gSi.
cHandleEntries) {
02785 phe = &
gShi.
aheList[index];
02786
move(he, phe);
02787
if (he.
phead == (PVOID)dw) {
02788 Print(
"= a pointer to a %s.", pszObjStr[he.
bType]);
02789 fNoSym =
TRUE;
02790 }
02791 }
02792 }
02793
02794
02795
02796 w = HIWORD(dw);
02797 aw = HIWORD(adw);
02798
if (w == aw || w == aw - 1 || w == aw + 1) {
02799 Print(
"= Stack Reference ");
02800 fNoSym =
TRUE;
02801 }
02802
if (!fNoSym) {
02803
02804
02805
02806 GetSym((PVOID)dw, ach, &dwOffset);
02807
if (*ach) {
02808 Print(
"= symbol \"%s\"", ach);
02809
if (dwOffset) {
02810 Print(
" + %x", dwOffset);
02811 }
02812 }
02813 }
02814 }
02815 }
02816 Print(
"\n");
02817 }
02818
02819
02820
02821
BOOL Isas(
02822 DWORD opts,
02823 PVOID param1,
02824 PVOID param2)
02825 {
02826
PSHAREDINFO pshi;
02827
DWORD count = PtrToUlong(param2);
02828 LPDWORD pdw;
02829 DWORD_PTR dw;
02830
02831
if (param1 == 0) {
02832
return FALSE;
02833 }
02834
02835
02836
02837
GETSHAREDINFO(pshi);
02838
move(gShi, pshi);
02839
02840
if (!tryMove(gSi,
gShi.
psi)) {
02841 Print(
"Could not access shared info\n");
02842
return TRUE;
02843 }
02844
02845
if (opts & OFLAG(d)) {
02846
DirectAnalyze((ULONG_PTR)param1, 0, OFLAG(s) & opts);
02847 }
else {
02848 pdw = param1;
02849
if (pdw ==
NULL) {
02850 Print(
"Hay bud, give me an address to look analyze.\n");
02851
return FALSE;
02852 }
02853
if (count == 0) {
02854 count = 25;
02855 }
02856 Print(
"--- Stack analysis ---\n");
02857
for ( ; count; count--, pdw++) {
02858
if (IsCtrlCHit()) {
02859
break;
02860 }
02861 Print(
"[0x%p]: ", pdw);
02862
if (tryMove(dw, pdw))
02863
DirectAnalyze(dw, (DWORD_PTR)pdw, OFLAG(s) & opts);
02864
else
02865 Print(
"No access\n");
02866 }
02867 }
02868
return TRUE;
02869 }
02870
02871
02872
02873
#ifdef KERNEL
02874
02875
02876
02877
02878
02879
02880
02881
02882
02883
02884
02885
VOID DumpAtomTable(
02886 PRTL_ATOM_TABLE *ppat,
02887 ATOM a)
02888 {
02889 RTL_ATOM_TABLE at, *pat;
02890 RTL_ATOM_TABLE_ENTRY ate, *pate;
02891
int iBucket;
02892 LPWSTR pwsz;
02893
BOOL fFirst;
02894
02895
move(pat, ppat);
02896
if (pat ==
NULL) {
02897 Print(
"is not initialized.\n");
02898
return;
02899 }
02900
move(at, pat);
02901
if (a) {
02902 Print(
"\n");
02903 }
else {
02904 Print(
"at %x\n", pat);
02905 }
02906
for (iBucket = 0; iBucket < (
int)at.NumberOfBuckets; iBucket++) {
02907
move(pate, &pat->Buckets[iBucket]);
02908
if (pate !=
NULL && !a) {
02909 Print(
"Bucket %2d:", iBucket);
02910 }
02911 fFirst =
TRUE;
02912 SAFEWHILE (pate != NULL) {
02913
if (!fFirst && !a) {
02914 Print(
" ");
02915 }
02916 fFirst =
FALSE;
02917
move(ate, pate);
02918 pwsz = (LPWSTR)LocalAlloc(LPTR, (ate.NameLength + 1) *
sizeof(WCHAR));
02919
moveBlock(pwsz,
FIXKP(&pate->Name), ate.NameLength *
sizeof(WCHAR));
02920 pwsz[ate.NameLength] =
L'\0';
02921
if (a == 0 || a == (ATOM)(ate.HandleIndex | MAXINTATOM)) {
02922 Print(
"%hx(%2d) = %ls (%d)%s\n",
02923 (ATOM)(ate.HandleIndex | MAXINTATOM),
02924 ate.ReferenceCount,
02925 pwsz, ate.NameLength,
02926 ate.Flags & RTL_ATOM_PINNED ?
" pinned" :
"");
02927
02928
if (a) {
02929 LocalFree(pwsz);
02930
return;
02931 }
02932 }
02933 LocalFree(pwsz);
02934
if (pate == ate.HashLink) {
02935 Print(
"Bogus hash link at %x\n", pate);
02936
break;
02937 }
02938 pate = ate.HashLink;
02939 }
02940 }
02941
if (a)
02942 Print(
"\n");
02943 }
02944
02945
02946
02947
02948
02949
02950
02951
02952
02953
02954
02955
02956
BOOL Iatom(
02957 DWORD opts,
02958 PVOID param1)
02959 {
02960 PRTL_ATOM_TABLE *ppat;
02961 ATOM a;
02962
PWINDOWSTATION pwinsta;
02963
02964 UNREFERENCED_PARAMETER(opts);
02965
02966
try {
02967 a = (ATOM)param1;
02968
02969 ppat = EvalExp(
VAR(UserAtomTableHandle));
02970
if (ppat !=
NULL) {
02971 Print(
"\nPrivate atom table for WIN32K ");
02972 DumpAtomTable(ppat, a);
02973 }
02974
02975 FOREACHWINDOWSTATION(pwinsta)
02976 ppat = (PRTL_ATOM_TABLE *)&pwinsta->pGlobalAtomTable;
02977 if (ppat != NULL) {
02978 Print(
"\nGlobal atom table for window station %lx ",
02979 pwinsta);
02980 DumpAtomTable(ppat, a);
02981 }
02982 NEXTEACHWINDOWSTATION(pwinsta);
02983 } except (EXCEPTION_EXECUTE_HANDLER) {
02984 ;
02985 }
02986
return TRUE;
02987 }
02988
#endif // KERNEL
02989
02990
#ifndef KERNEL
02991
02992
02993
02994
02995
02996
02997
02998
02999
03000
03001
BOOL DumpConvInfo(
03002
PCONV_INFO pcoi)
03003 {
03004
CL_CONV_INFO coi;
03005
ADVISE_LINK al;
03006
XACT_INFO xi;
03007
03008
move(coi, pcoi);
03009 Print(
" next = 0x%08lx\n", coi.
ci.
next);
03010 Print(
" pcii = 0x%08lx\n", coi.
ci.
pcii);
03011 Print(
" hUser = 0x%08lx\n", coi.
ci.
hUser);
03012 Print(
" hConv = 0x%08lx\n", coi.
ci.
hConv);
03013 Print(
" laService = 0x%04x\n", coi.
ci.
laService);
03014 Print(
" laTopic = 0x%04x\n", coi.
ci.
laTopic);
03015 Print(
" hwndPartner = 0x%08lx\n", coi.
ci.
hwndPartner);
03016 Print(
" hwndConv = 0x%08lx\n", coi.
ci.
hwndConv);
03017 Print(
" state = 0x%04x\n", coi.
ci.
state);
03018 Print(
" laServiceRequested= 0x%04x\n", coi.
ci.
laServiceRequested);
03019 Print(
" pxiIn = 0x%08lx\n", coi.
ci.
pxiIn);
03020 Print(
" pxiOut = 0x%08lx\n", coi.
ci.
pxiOut);
03021 SAFEWHILE (coi.
ci.
pxiOut) {
03022
move(xi, coi.
ci.
pxiOut);
03023 Print(
" hXact = (0x%08lx)->0x%08lx\n", xi.
hXact, coi.
ci.
pxiOut);
03024 coi.
ci.
pxiOut = xi.
next;
03025 }
03026 Print(
" dmqIn = 0x%08lx\n", coi.
ci.
dmqIn);
03027 Print(
" dmqOut = 0x%08lx\n", coi.
ci.
dmqOut);
03028 Print(
" aLinks = 0x%08lx\n", coi.
ci.
aLinks);
03029 Print(
" cLinks = 0x%08lx\n", coi.
ci.
cLinks);
03030 SAFEWHILE (coi.
ci.
cLinks--) {
03031
move(al, coi.
ci.
aLinks++);
03032 Print(
" pLinkCount = 0x%08x\n", al.
pLinkCount);
03033 Print(
" wType = 0x%08x\n", al.
wType);
03034 Print(
" state = 0x%08x\n", al.
state);
03035
if (coi.
ci.
cLinks) {
03036 Print(
" ---\n");
03037 }
03038 }
03039
if (coi.
ci.
state & ST_CLIENT) {
03040 Print(
" hwndReconnect = 0x%08lx\n", coi.
hwndReconnect);
03041 Print(
" hConvList = 0x%08lx\n", coi.
hConvList);
03042 }
03043
03044
return TRUE;
03045 }
03046
#endif // !KERNEL
03047
03048
03049
03050
03051
#ifndef KERNEL
03052
03053
03054
03055
03056
03057
03058
03059
03060
03061
03062
BOOL
03063
GetTargetTEB(
03064 PTEB pteb,
03065 PTEB *ppteb)
03066 {
03067
NTSTATUS Status;
03068 THREAD_BASIC_INFORMATION ThreadInformation;
03069
03070
Status =
NtQueryInformationThread( hCurrentThread,
03071 ThreadBasicInformation,
03072 &ThreadInformation,
03073
sizeof( ThreadInformation ),
03074 NULL);
03075
if (
NT_SUCCESS( Status )) {
03076
if (ppteb !=
NULL) {
03077 *ppteb = (PTEB)ThreadInformation.TebBaseAddress;
03078 }
03079
return tryMove(*pteb, (LPVOID)ThreadInformation.TebBaseAddress);
03080 }
03081
return FALSE;
03082 }
03083
#endif // !KERNEL
03084
03085
03086
03087
#ifndef KERNEL
03088
03089
03090
03091
03092
03093
03094
03095
03096
03097
03098
03099 PVOID
03100
FixKernelPointer(
03101 PVOID pKernel)
03102 {
03103
static TEB teb;
03104
static PTEB pteb =
NULL;
03105
static PVOID HighestUserAddress;
03106
03107
if (pKernel ==
NULL) {
03108
return NULL;
03109 }
03110
if (HighestUserAddress == 0) {
03111 SYSTEM_BASIC_INFORMATION SystemInformation;
03112
03113
if (
NT_SUCCESS(
NtQuerySystemInformation(SystemBasicInformation,
03114 &SystemInformation,
03115
sizeof(SystemInformation),
03116 NULL))) {
03117 HighestUserAddress = (PVOID)SystemInformation.MaximumUserModeAddress;
03118 }
else {
03119
03120
03121 HighestUserAddress = (PVOID)MAXINT_PTR;
03122 }
03123 }
03124
03125
if (pKernel <= HighestUserAddress) {
03126
return pKernel;
03127 }
03128
if (pteb ==
NULL) {
03129
GetTargetTEB(&teb, &pteb);
03130 }
03131
return (PVOID)(((
PBYTE)pKernel) - ((
PCLIENTINFO)(&teb.Win32ClientInfo[0]))->ulClientDelta);
03132 }
03133
03134
void *
03135
RebaseSharedPtr(
void * p)
03136 {
03137
PSHAREDINFO pshi;
03138 ULONG_PTR ulSharedDelta;
03139
03140 moveExp(&pshi,
VAR(gSharedInfo));
03141
move(ulSharedDelta, &pshi->
ulSharedDelta);
03142
03143
return (p) ? (PVOID)((
PBYTE)(p) - ulSharedDelta) :
NULL;
03144 }
03145
03146
#endif // !KERNEL
03147
03148
03149
03150
03151
03152
03153
03154
void*
userexts_bsearch (
03155
const void *key,
03156
const void *base,
03157 size_t num,
03158 size_t width,
03159
int (*compare)(
const void*,
const void*))
03160 {
03161
char* lo = (
char*)base;
03162
char* hi = (
char*)base + (num - 1) * width;
03163
char* mid;
03164
unsigned int half;
03165
int result;
03166
03167
while (lo <= hi) {
03168
if (half = num / 2) {
03169 mid = lo + ((num & 1) ? half : (half - 1)) * width;
03170
if (!(result = compare(key, mid)))
03171
return mid;
03172
else if (result < 0) {
03173 hi = mid - width;
03174 num = (num & 1) ? half : half-1;
03175 }
03176
else {
03177 lo = mid + width;
03178 num = half;
03179 }
03180 }
03181
else if (num) {
03182
return compare(key, lo) ?
NULL : lo;
03183 }
03184
else {
03185
break;
03186 }
03187 }
03188
03189
return NULL;
03190 }
03191
03192
03193
03194
03195
03196
03197
03198
03199
03200
typedef struct {
03201
DWORD dwVKey;
03202
const char* name;
03203 }
VKeyDef;
03204
03205
int compareVKey(
const VKeyDef* a,
const VKeyDef* b)
03206 {
03207
return a->
dwVKey - b->
dwVKey;
03208 }
03209
03210
#define VKEY_ITEM(x) { x, #x }
03211
03212
const VKeyDef gVKeyDef[] = {
03213
#include "../vktbl.txt"
03214 };
03215
03216
const char*
_GetVKeyName(DWORD dwVKey,
int n)
03217 {
03218
int i;
03219
03220
03221
03222
03223
if ((dwVKey >=
'A' && dwVKey <= 'Z') || (dwVKey >=
'0' && dwVKey <=
'9')) {
03224
static char buffer[] =
"VK_*";
03225
03226
if (
n != 0) {
03227
return "";
03228 }
03229 buffer[
ARRAY_SIZE(buffer) - 2] = (
BYTE)dwVKey;
03230
return buffer;
03231 }
03232
03233
03234
03235
03236
for (i = 0; i <
ARRAY_SIZE(gVKeyDef); ++i) {
03237
const VKeyDef* result =
gVKeyDef + i;
03238
03239
if (result->
dwVKey == dwVKey) {
03240
for (; i <
ARRAY_SIZE(gVKeyDef); ++i) {
03241
if (
gVKeyDef[i].
dwVKey != dwVKey) {
03242
return "";
03243 }
03244
if (&
gVKeyDef[i] - result ==
n) {
03245
return gVKeyDef[i].
name;
03246 }
03247 }
03248 }
03249 }
03250
03251
03252
03253
03254
return "";
03255 }
03256
03257
const char*
GetVKeyName(DWORD dwVKey)
03258 {
03259
static char buf[256];
03260
const char* delim =
"";
03261
int n = 0;
03262
03263 buf[0] = 0;
03264
03265
for (
n = 0;
n <
ARRAY_SIZE(
gVKeyDef); ++
n) {
03266
const char* name =
_GetVKeyName(dwVKey,
n);
03267
if (*name) {
03268 strcat(buf, delim);
03269 strcat(buf, name);
03270 delim =
" / ";
03271 }
03272
else {
03273
break;
03274 }
03275 }
03276
return buf;
03277 }
03278
03279
#undef VKEY_ITEM
03280
03281
03282
03283
03284
03285
#ifdef KERNEL
03286
03287
03288
03289
03290
03291
03292
void DumpClassList (DWORD opts,
PCLS pcls, BOOL fPrivate)
03293 {
03294
PCLS pclsClone;
03295
CLS cls, clsClone;
03296
03297 SAFEWHILE (pcls != NULL) {
03298
if (!tryMove(cls, pcls)) {
03299 Print(
" Private class\t\tPCLS @ 0x%lx - inaccessible, skipping...\n", pcls);
03300
break;
03301 }
03302 Print(
" %s class\t\t", fPrivate ?
"Private" :
"Public ");
03303 Idcls(opts, pcls);
03304
03305
if (cls.
pclsClone !=
NULL) {
03306 pclsClone = cls.
pclsClone;
03307 SAFEWHILE (pclsClone != NULL) {
03308
if (!tryMove(clsClone, pclsClone)) {
03309 Print(
"Could not access clone class at %x, skipping clones...\n", pclsClone);
03310
break;
03311 }
03312 Print(
" %s class clone\t", fPrivate ?
"Private" :
"Public ");
03313 Idcls(opts, pclsClone);
03314 pclsClone = clsClone.
pclsNext;
03315 }
03316 }
03317
03318 pcls = cls.
pclsNext;
03319 }
03320 }
03321
03322
03323
03324
03325
03326
03327
03328
03329
03330
03331
BOOL Idcls(
03332 DWORD opts,
03333 PVOID param1)
03334 {
03335
char ach[120];
03336 DWORD_PTR dwOffset;
03337
CLS localCLS;
03338
PCLS pcls = param1;
03339
PROCESSINFO pi;
03340
PPROCESSINFO ppi;
03341
03342
if (param1 == 0) {
03343
03344 FOREACHPPI(ppi)
03345 Print("\nClasses for process %x:\n", ppi);
03346 move(pi, ppi);
03347 DumpClassList(opts, pi.pclsPrivateList, TRUE);
03348 DumpClassList(opts, pi.pclsPublicList, FALSE);
03349 NEXTEACHPPI()
03350
03351 Print("\nGlobal Classes:\n");
03352 moveExpValuePtr(&pcls, VAR(gpclsList));
03353 SAFEWHILE (pcls) {
03354 Print(
" Global Class\t\t");
03355 Idcls(opts, pcls);
03356
move(pcls, &pcls->pclsNext);
03357 }
03358
return TRUE;
03359 }
03360
03361
03362
03363
03364
if (opts & OFLAG(p)) {
03365 opts &= ~OFLAG(p);
03366 Print(
"\nClasses for process %x:\n", param1);
03367
move(pi, param1);
03368 DumpClassList(opts, pi.
pclsPrivateList, TRUE);
03369 DumpClassList(opts, pi.
pclsPublicList, FALSE);
03370
return TRUE;
03371 }
03372
03373
move(localCLS, pcls);
03374
03375
DebugGetClassNameA(localCLS.lpszAnsiClassName, ach);
03376 Print(
"PCLS @ 0x%lx \t(%s)\n", pcls, ach);
03377
if (opts & OFLAG(v)) {
03378 Print(
"\t pclsNext @0x%p\n"
03379
"\t atomClassNameAtom 0x%04x\n"
03380
"\t fnid 0x%04x\n"
03381
"\t pDCE @0x%p\n"
03382
"\t cWndReferenceCount 0x%08lx\n"
03383
"\t flags %s\n",
03384
03385 localCLS.
pclsNext,
03386 localCLS.
atomClassName,
03387 localCLS.
fnid,
03388 localCLS.
pdce,
03389 localCLS.
cWndReferenceCount,
03390 GetFlags(GF_CSF, (WORD)localCLS.
CSF_flags, NULL, TRUE));
03391
03392
if (localCLS.
lpszClientAnsiMenuName) {
03393
move(ach, localCLS.
lpszClientAnsiMenuName);
03394 ach[
sizeof(ach) - 1] =
'\0';
03395 }
else {
03396 ach[0] =
'\0';
03397 }
03398 Print(
"\t lpszClientMenu @0x%p (%s)\n",
03399 localCLS.
lpszClientUnicodeMenuName,
03400 ach);
03401
03402 Print(
"\t hTaskWow 0x%08lx\n"
03403
"\t spcpdFirst @0x%p\n"
03404
"\t pclsBase @0x%p\n"
03405
"\t pclsClone @0x%p\n",
03406 localCLS.
hTaskWow,
03407 localCLS.
spcpdFirst,
03408 localCLS.
pclsBase,
03409 localCLS.
pclsClone);
03410
03411 GetSym((LPVOID)localCLS.lpfnWndProc, ach, &dwOffset);
03412 Print(
"\t style %s\n"
03413
"\t lpfnWndProc @0x%p = \"%s\" \n"
03414
"\t cbclsExtra 0x%08lx\n"
03415 "\t cbwndExtra 0x%08lx\n"
03416
"\t hModule 0x%08lx\n"
03417
"\t spicn @0x%p\n"
03418
"\t spcur @0x%p\n"
03419
"\t hbrBackground 0x%08lx\n"
03420
"\t spicnSm @0x%p\n",
03421
GetFlags(GF_CS, localCLS.style, NULL, TRUE),
03422 localCLS.lpfnWndProc, ach,
03423 localCLS.cbclsExtra,
03424 localCLS.cbwndExtra,
03425 localCLS.hModule,
03426 localCLS.spicn,
03427 localCLS.spcur,
03428 localCLS.hbrBackground,
03429 localCLS.spicnSm);
03430 }
03431
03432
return TRUE;
03433 }
03434
#endif // KERNEL
03435
03436
03437
03438
#ifdef KERNEL
03439
03440
03441
03442 LPSTR
ProcessName(
03443
PPROCESSINFO ppi)
03444 {
03445 W32PROCESS w32p;
03446
static UCHAR ImageFileName[16];
03447
03448
move(w32p, ppi);
03449
GetEProcessData(w32p.Process,
PROCESS_IMAGEFILENAME, ImageFileName);
03450
if (ImageFileName[0]) {
03451
return ImageFileName;
03452 }
else {
03453
return "System";
03454 }
03455 }
03456
03457
03458
03459
VOID PrintCurHeader()
03460 {
03461 Print(
"P = Process Owned.\n");
03462 Print(
"P .pcursor flg rt ..lpName aMod bpp ..cx ..cy xHot yHot .hbmMask hbmColor\n");
03463 }
03464
03465
03466
VOID PrintCurData(
03467
PCURSOR pcur,
03468 DWORD opts)
03469 {
03470
CURSOR cur;
03471
03472
move(cur, pcur);
03473
03474
if ((opts & OFLAG(x)) &&
03475 cur.CURSORF_flags & (
CURSORF_ACONFRAME |
CURSORF_LINKED)) {
03476
return;
03477 }
03478
if (cur.CURSORF_flags &
CURSORF_ACON) {
03479
ACON acon;
03480
03481
if (opts & OFLAG(a)) {
03482 Print(
"--------------\n");
03483 }
03484
if (opts & OFLAG(o)) {
03485 Print(
"Owner:%#p(%s)\n", cur.head.ppi,
ProcessName(cur.head.ppi));
03486 }
03487
move(acon, pcur);
03488
if (opts & OFLAG(v)) {
03489 Print(
"\nACON @%x:\n", pcur);
03490 Print(
" ppiOwner = %#p\n", (DWORD_PTR)cur.head.ppi);
03491 Print(
" CURSORF_flags = %s\n",
GetFlags(GF_CURSORF, cur.CURSORF_flags, NULL, TRUE));
03492 Print(
" strName = %#p\n", (DWORD_PTR)cur.strName.Buffer);
03493 Print(
" atomModName = %x\n", cur.atomModName);
03494 Print(
" rt = %x\n", cur.rt);
03495 }
else {
03496 Print(
"%c %8x %3x %2x %8x %4x --- ACON (%d frames)\n",
03497 cur.head.ppi ?
'P' :
' ',
03498 pcur,
03499 cur.CURSORF_flags,
03500 cur.rt,
03501 cur.strName.Buffer,
03502 cur.atomModName,
03503 acon.cpcur);
03504 }
03505
if (opts & OFLAG(a)) {
03506 Print(
"%d animation sequences, currently at step %d.\n",
03507 acon.cicur,
03508 acon.iicur);
03509
while (acon.cpcur--) {
03510
move(pcur, acon.aspcur++);
03511 PrintCurData(pcur, opts & ~(OFLAG(x) | OFLAG(o)));
03512 }
03513 Print(
"--------------\n");
03514 }
03515 }
else {
03516 if (opts & OFLAG(v)) {
03517 Print(
"\nCursor/Icon @%x:\n", pcur);
03518 Print(
" ppiOwner = %#p(%s)\n",
03519 (DWORD_PTR)cur.head.ppi,
03520
ProcessName(cur.head.ppi));
03521 Print(
" pcurNext = %x\n", cur.pcurNext);
03522 Print(
" CURSORF_flags = %s\n",
GetFlags(
GF_CURSORF, cur.CURSORF_flags,
NULL,
TRUE));
03523 Print(
" strName = %#p\n", (DWORD_PTR)cur.strName.Buffer);
03524 Print(
" atomModName = %x\n", cur.atomModName);
03525 Print(
" rt = %x\n", cur.rt);
03526 Print(
" bpp = %x\n", cur.bpp);
03527 Print(
" cx = %x\n", cur.cx);
03528 Print(
" cy = %x\n", cur.cy);
03529 Print(
" xHotspot = %x\n", cur.xHotspot);
03530 Print(
" yHotspot = %x\n", cur.yHotspot);
03531 Print(
" hbmMask = %x\n", cur.hbmMask);
03532 Print(
" hbmColor = %x\n", cur.hbmColor);
03533 }
else {
03534
if (opts & OFLAG(o)) {
03535 Print(
"Owner:%x(%s)\n", cur.head.ppi,
ProcessName(cur.head.ppi));
03536 }
03537 Print(
"%c %8x %3x %2x %8x %4x %3x %4x %4x %4x %4x %8x %8x\n",
03538 cur.head.ppi ?
'P' :
' ',
03539 pcur,
03540 cur.CURSORF_flags,
03541 cur.rt,
03542 cur.strName.Buffer,
03543 cur.atomModName,
03544 cur.bpp,
03545 cur.cx,
03546 cur.cy,
03547 cur.xHotspot,
03548 cur.yHotspot,
03549 cur.hbmMask,
03550 cur.hbmColor);
03551 }
03552 }
03553 }
03554
03555
03556
03557
03558
03559
03560
03561
03562
03563
03564
03565
03566
BOOL Idcur(
03567 DWORD opts,
03568 PVOID param1)
03569 {
03570
PROCESSINFO pi, *ppi, *ppiDesired =
NULL;
03571
CURSOR cur, *pcur;
03572
int cCursors = 0;
03573 INT_PTR idDesired = 0;
03574
HANDLEENTRY he, *phe;
03575
int i;
03576
03577
if (OFLAG(p) & opts) {
03578 ppiDesired = (
PPROCESSINFO)param1;
03579 param1 =
NULL;
03580 }
else if (OFLAG(i) & opts) {
03581 idDesired = (INT_PTR)param1;
03582 param1 =
NULL;
03583 }
03584
if (param1 ==
NULL) {
03585
if (!(OFLAG(v) & opts)) {
03586 PrintCurHeader();
03587 }
03588 moveExpValuePtr(&pcur,
VAR(
gpcurFirst));
03589
if (pcur !=
NULL && ppiDesired ==
NULL) {
03590 Print(
"Global cache:\n");
03591
while (pcur) {
03592
move(cur, pcur);
03593
if (!idDesired || ((INT_PTR)cur.strName.Buffer == idDesired)) {
03594
if (cur.head.ppi !=
NULL) {
03595 Print(
"Wrong cache! Owned by %x! --v\n", cur.head.ppi);
03596 }
03597 PrintCurData((
PCURSOR)pcur, opts);
03598 }
03599 pcur = cur.pcurNext;
03600 }
03601 }
03602 FOREACHPPI(ppi)
03603
if (ppiDesired ==
NULL || ppiDesired == ppi) {
03604
if (tryMove(pi, ppi)) {
03605
if (pi.
pCursorCache) {
03606 Print(
"Cache for process %x(%s):\n", ppi,
ProcessName(ppi));
03607 pcur = pi.
pCursorCache;
03608
while (pcur) {
03609
if (tryMove(cur, pcur)) {
03610
if (!idDesired || ((INT_PTR)cur.strName.Buffer == idDesired)) {
03611
if (cur.head.ppi != ppi) {
03612 Print(
"Wrong cache! Owned by %x! --v\n", cur.head.ppi);
03613 }
03614 PrintCurData((
PCURSOR)pcur, opts);
03615 }
03616 pcur = cur.pcurNext;
03617 }
else {
03618 Print(
"Could not access %x.\n", pcur);
03619
break;
03620 }
03621 }
03622 }
03623 }
else {
03624 Print(
"Failed to access ppi %x.\n", ppi);
03625 }
03626 }
03627 NEXTEACHPPI();
03628 Print(
"Non-cached cursor objects:\n");
03629
FOREACHHANDLEENTRY(phe, he, i)
03630 if (he.bType == TYPE_CURSOR) {
03631
CURSOR cur;
03632
03633
if (tryMove(cur, he.
phead)) {
03634
if (!(cur.CURSORF_flags & (
CURSORF_LINKED |
CURSORF_ACONFRAME)) &&
03635 (!idDesired || (INT_PTR)cur.strName.Buffer == idDesired) &&
03636 (ppiDesired ==
NULL || ppiDesired == cur.head.ppi)) {
03637 Print(
"%x:", i);
03638 PrintCurData((
PCURSOR)he.
phead, opts | OFLAG(x) | OFLAG(o));
03639 }
03640 }
else {
03641 Print(
"Could not access phead(%x) of handle %x.\n", he.
phead, i);
03642 }
03643 cCursors++;
03644 }
03645
NEXTEACHHANDLEENTRY()
03646 Print("%d Cursors/Icons Total.\n", cCursors);
03647 return TRUE;
03648 }
03649
03650 pcur = HorPtoP(param1, TYPE_CURSOR);
03651 if (pcur == NULL) {
03652 Print(
"%8x : Invalid cursor handle or pointer.\n", param1);
03653
return FALSE;
03654 }
03655
03656
if (!(OFLAG(v) & opts)) {
03657 PrintCurHeader();
03658 }
03659 PrintCurData(pcur, opts);
03660
return TRUE;
03661 }
03662
#endif // KERNEL
03663
03664
03665
03666
#ifdef KERNEL
03667
03668
03669
03670
03671
03672
03673
03674
03675
03676
03677
BOOL dddexact(
03678 DWORD_PTR pOrg,
03679
PXSTATE pxs,
03680 DWORD opts)
03681 {
03682
if (opts & OFLAG(v)) {
03683 Print(
" XACT:0x%p\n", pOrg);
03684 Print(
" snext = 0x%08lx\n", pxs->
snext);
03685 Print(
" fnResponse = 0x%08lx\n", pxs->
fnResponse);
03686 Print(
" hClient = 0x%08lx\n", pxs->
hClient);
03687 Print(
" hServer = 0x%08lx\n", pxs->
hServer);
03688 Print(
" pIntDdeInfo = 0x%08lx\n", pxs->
pIntDdeInfo);
03689 }
else {
03690 Print(
"0x%p(0x%08lx) ", pOrg, pxs->
flags);
03691 }
03692
return TRUE;
03693 }
03694
#endif // KERNEL
03695
03696
03697
03698
#ifdef KERNEL
03699
03700
03701
03702
03703
03704
03705
03706
03707
03708
03709
BOOL dddeconv(
03710 DWORD_PTR pOrg,
03711
PDDECONV pddeconv,
03712 DWORD opts)
03713 {
03714
DDEIMP ddei;
03715
XSTATE xs;
03716
PXSTATE pxs;
03717
int cX;
03718
03719
03720 Print(
" CONVERSATION-PAIR(0x%p:0x%08lx)\n", pOrg, pddeconv->
spartnerConv);
03721
if (opts & OFLAG(v)) {
03722 Print(
" snext = 0x%08lx\n", pddeconv->
snext);
03723 Print(
" spwnd = 0x%08lx\n", pddeconv->
spwnd);
03724 Print(
" spwndPartner = 0x%08lx\n", pddeconv->
spwndPartner);
03725 }
03726
if (opts & (OFLAG(v) | OFLAG(r))) {
03727
if (pddeconv->
spxsOut) {
03728 pxs = pddeconv->
spxsOut;
03729 cX = 0;
03730 SAFEWHILE (pxs) {
03731
move(xs, pxs);
03732
if ((opts & OFLAG(r)) && !cX++) {
03733 Print(
" Transaction chain:");
03734 }
else {
03735 Print(
" ");
03736 }
03737 dddexact((DWORD_PTR)pxs, &xs, opts);
03738
if (opts & OFLAG(r)) {
03739 pxs = xs.
snext;
03740 }
else {
03741 pxs =
NULL;
03742 }
03743
if (!pxs) {
03744 Print(
"\n");
03745 }
03746 }
03747 }
03748 }
03749
if (opts & OFLAG(v)) {
03750 Print(
" pfl = 0x%08lx\n", pddeconv->
pfl);
03751 Print(
" flags = 0x%08lx\n", pddeconv->
flags);
03752
if ((opts & OFLAG(v)) && (opts & OFLAG(r)) && pddeconv->
pddei) {
03753 Print(
" pddei = 0x%08lx\n", pddeconv->
pddei);
03754
move(ddei, pddeconv->
pddei);
03755 Print(
" Impersonation info:\n");
03756 Print(
" qos.Length = 0x%08lx\n", ddei.
qos.Length);
03757 Print(
" qos.ImpersonationLevel = 0x%08lx\n", ddei.
qos.ImpersonationLevel);
03758 Print(
" qos.ContextTrackingMode = 0x%08lx\n", ddei.
qos.ContextTrackingMode);
03759 Print(
" qos.EffectiveOnly = 0x%08lx\n", ddei.
qos.EffectiveOnly);
03760 Print(
" ClientContext = 0x%08lx\n", &ddei.
ClientContext);
03761 Print(
" cRefInit = 0x%08lx\n", ddei.
cRefInit);
03762 Print(
" cRefConv = 0x%08lx\n", ddei.
cRefConv);
03763 }
03764 }
03765
return TRUE;
03766 }
03767
#endif // KERNEL
03768
03769
03770
03771
#ifdef KERNEL
03772
03773
03774
03775
03776
03777
03778
03779
03780
03781
03782
BOOL Idde(
03783 DWORD opts,
03784 PVOID param1)
03785 {
03786
HEAD head;
03787
DDECONV ddeconv;
03788
PSHAREDINFO pshi;
03789
SHAREDINFO shi;
03790
SERVERINFO si;
03791
HANDLEENTRY he;
03792 DWORD_PTR cHandleEntries;
03793 HANDLE h;
03794
WND wnd;
03795
UINT i;
03796 PVOID pObj =
NULL;
03797
PHE pheList;
03798
PROP prop;
03799
PROPLIST propList;
03800
DWORD atomDdeTrack;
03801
XSTATE xs;
03802
03803 moveExpValue(&atomDdeTrack,
VAR(atomDDETrack));
03804
GETSHAREDINFO(pshi);
03805
move(shi, pshi);
03806
move(si, shi.
psi);
03807 cHandleEntries = si.
cHandleEntries;
03808 pheList = shi.
aheList;
03809
03810
if (param1) {
03811
03812
03813
03814 h = (HANDLE)param1;
03815 i =
HMIndexFromHandle(h);
03816
if (i >= cHandleEntries) {
03817
move(head, h);
03818 i =
HMIndexFromHandle(head.
h);
03819 }
03820
if (i >= cHandleEntries) {
03821 Print(
"0x%08lx is not a valid object.\n", h);
03822
return FALSE;
03823 }
03824
move(he, &pheList[i]);
03825 pObj =
FIXKP(he.
phead);
03826
03827
03828
03829
switch (he.
bType) {
03830
case TYPE_WINDOW:
03831
move(wnd, pObj);
03832
move(propList, wnd.
ppropList);
03833
for (i = 0; i < propList.
iFirstFree; i++) {
03834
if (i == 0) {
03835 Print(
"Window 0x%08lx conversations:\n", h);
03836 }
03837
move(prop, &propList.
aprop[i]);
03838
if (prop.
atomKey == (ATOM)
MAKEINTATOM(atomDdeTrack)) {
03839
move(ddeconv, (
PDDECONV)prop.
hData);
03840 Print(
" ");
03841 dddeconv((DWORD_PTR)prop.
hData,
03842 &ddeconv,
03843 opts);
03844 }
03845 }
03846
return TRUE;
03847
03848
case TYPE_DDECONV:
03849
case TYPE_DDEXACT:
03850
break;
03851
03852
default:
03853 Print(
"0x%08lx is not a valid window, conversation or transaction object.\n", h);
03854
return FALSE;
03855 }
03856 }
03857
03858
03859
03860
03861
03862 Print(
"DDE objects:\n");
03863
for (i = 0; i < cHandleEntries; i++) {
03864
move(he, &pheList[i]);
03865
if (he.
bType ==
TYPE_DDECONV && (pObj ==
FIXKP(he.
phead) || pObj ==
NULL)) {
03866
move(ddeconv,
FIXKP(he.
phead));
03867 dddeconv((DWORD_PTR)
FIXKP(he.
phead),
03868 (
PDDECONV)&ddeconv,
03869 opts);
03870 }
03871
03872
if (he.
bType ==
TYPE_DDEXACT && (pObj ==
NULL || pObj ==
FIXKP(he.
phead))) {
03873
move(xs,
FIXKP(he.
phead));
03874
if (!(opts & OFLAG(v))) {
03875 Print(
" XACT:");
03876 }
03877 dddexact((DWORD_PTR)
FIXKP(he.
phead),
03878 (
PXSTATE)&xs,
03879 opts);
03880 Print(
"\n");
03881 }
03882 }
03883
return TRUE;
03884 }
03885
#endif // KERNEL
03886
03887
03888
03889
#ifndef KERNEL
03890
03891
03892
03893
03894
03895
03896
03897
03898
03899
03900
BOOL Iddeml(
03901 DWORD opts,
03902 LPSTR lpas)
03903 {
03904
CHANDLEENTRY he, *phe;
03905
int cHandles, ch, i;
03906
DWORD Type;
03907 DWORD_PTR Instance, Object, Pointer;
03908
CL_INSTANCE_INFO cii, *pcii;
03909 ATOM ns;
03910
SERVER_LOOKUP sl;
03911
LINK_COUNT lc;
03912
CL_CONV_INFO cci;
03913
PCL_CONV_INFO pcci;
03914
CONVLIST cl;
03915 HWND hwnd, *phwnd;
03916
XACT_INFO xi;
03917
DDEMLDATA dd;
03918
CONV_INFO ci;
03919
03920 moveExpValue(&cHandles,
"user32!cHandlesAllocated");
03921
03922 Instance = 0;
03923 Type = 0;
03924 Object = 0;
03925 Pointer = 0;
03926 SAFEWHILE (*lpas) {
03927 SAFEWHILE (*lpas ==
' ')
03928 lpas++;
03929
03930
if (*lpas ==
'i') {
03931 lpas++;
03932 Instance = (DWORD_PTR)EvalExp(lpas);
03933 SAFEWHILE (*lpas !=
' ' && *lpas != 0)
03934 lpas++;
03935
continue;
03936 }
03937
if (*lpas ==
't') {
03938 lpas++;
03939 Type = (
DWORD)(DWORD_PTR)EvalExp(lpas);
03940 SAFEWHILE (*lpas !=
' ' && *lpas != 0)
03941 lpas++;
03942
continue;
03943 }
03944
if (*lpas) {
03945 Object = Pointer = (DWORD_PTR)EvalExp(lpas);
03946 SAFEWHILE (*lpas !=
' ' && *lpas != 0)
03947 lpas++;
03948 }
03949 }
03950
03951
03952
03953
03954
03955 moveExpValuePtr(&pcii,
"user32!pciiList");
03956
if (pcii ==
NULL) {
03957 Print(
"No Instances exist.\n");
03958
return TRUE;
03959 }
03960
move(cii, pcii);
03961 SAFEWHILE(pcii != NULL) {
03962 pcii = cii.
next;
03963
if (Instance == 0 || (Instance == (DWORD_PTR)cii.
hInstClient)) {
03964 Print(
"Objects for instance 0x%p:\n", cii.
hInstClient);
03965 ch = cHandles;
03966 moveExpValuePtr(&phe,
"user32!aHandleEntry");
03967 SAFEWHILE (ch--) {
03968
move(he, phe++);
03969
if (he.
handle == 0) {
03970
continue;
03971 }
03972
if (
InstFromHandle(cii.
hInstClient) !=
InstFromHandle(he.
handle)) {
03973
continue;
03974 }
03975
if (Type &&
TypeFromHandle(he.
handle) != Type) {
03976
continue;
03977 }
03978
if (Object && (he.
handle != (HANDLE)Object) &&
03979 Pointer && he.
dwData != Pointer) {
03980
continue;
03981 }
03982 Print(
" (0x%08lx)->0x%08lx ", he.
handle, he.
dwData);
03983
switch (
TypeFromHandle(he.
handle)) {
03984
case HTYPE_INSTANCE:
03985 Print(
"Instance\n");
03986
if (opts & OFLAG(v)) {
03987 Print(
" next = 0x%08lx\n", cii.
next);
03988 Print(
" hInstServer = 0x%08lx\n", cii.
hInstServer);
03989 Print(
" hInstClient = 0x%08lx\n", cii.
hInstClient);
03990 Print(
" MonitorFlags = 0x%08lx\n", cii.
MonitorFlags);
03991 Print(
" hwndMother = 0x%08lx\n", cii.
hwndMother);
03992 Print(
" hwndEvent = 0x%08lx\n", cii.
hwndEvent);
03993 Print(
" hwndTimeout = 0x%08lx\n", cii.
hwndTimeout);
03994 Print(
" afCmd = 0x%08lx\n", cii.
afCmd);
03995 Print(
" pfnCallback = 0x%08lx\n", cii.
pfnCallback);
03996 Print(
" LastError = 0x%08lx\n", cii.
LastError);
03997 Print(
" tid = 0x%08lx\n", cii.
tid);
03998 Print(
" plaNameService = 0x%08lx\n", cii.
plaNameService);
03999 Print(
" cNameServiceAlloc = 0x%08lx\n", cii.
cNameServiceAlloc);
04000 SAFEWHILE (cii.
cNameServiceAlloc--) {
04001
move(ns, cii.
plaNameService++);
04002 Print(
" 0x%04lx\n", ns);
04003 }
04004 Print(
" aServerLookup = 0x%08lx\n", cii.
aServerLookup);
04005 Print(
" cServerLookupAlloc = 0x%08lx\n", cii.
cServerLookupAlloc);
04006 SAFEWHILE (cii.
cServerLookupAlloc--) {
04007
move(sl, cii.
aServerLookup++);
04008 Print(
" laService = 0x%04x\n", sl.
laService);
04009 Print(
" laTopic = 0x%04x\n", sl.
laTopic);
04010 Print(
" hwndServer = 0x%08lx\n", sl.
hwndServer);
04011
if (cii.
cServerLookupAlloc) {
04012 Print(
" ---\n");
04013 }
04014 }
04015 Print(
" ConvStartupState = 0x%08lx\n", cii.
ConvStartupState);
04016 Print(
" flags = %s\n",
04017
GetFlags(GF_IIF, cii.
flags, NULL, TRUE));
04018 Print(
" cInDDEMLCallback = 0x%08lx\n", cii.
cInDDEMLCallback);
04019 Print(
" pLinkCount = 0x%08lx\n", cii.
pLinkCount);
04020 SAFEWHILE (cii.
pLinkCount) {
04021
move(lc, cii.
pLinkCount);
04022 cii.
pLinkCount = lc.
next;
04023 Print(
" next = 0x%08lx\n", lc.
next);
04024 Print(
" laTopic = 0x%04x\n", lc.
laTopic);
04025 Print(
" gaItem = 0x%04x\n", lc.
gaItem);
04026 Print(
" laItem = 0x%04x\n", lc.
laItem);
04027 Print(
" wFmt = 0x%04x\n", lc.
wFmt);
04028 Print(
" Total = 0x%04x\n", lc.
Total);
04029 Print(
" Count = 0x%04x\n", lc.
Count);
04030
if (cii.
pLinkCount !=
NULL) {
04031 Print(
" ---\n");
04032 }
04033 }
04034 }
04035
break;
04036
04037
case HTYPE_ZOMBIE_CONVERSATION:
04038 Print(
"Zombie Conversation\n");
04039
if (opts & OFLAG(v)) {
04040
DumpConvInfo((
PCONV_INFO)he.
dwData);
04041 }
04042
break;
04043
04044
case HTYPE_SERVER_CONVERSATION:
04045 Print(
"Server Conversation\n");
04046
if (opts & OFLAG(v)) {
04047
DumpConvInfo((
PCONV_INFO)he.
dwData);
04048 }
04049
break;
04050
04051
case HTYPE_CLIENT_CONVERSATION:
04052 Print(
"Client Conversation\n");
04053
if (opts & OFLAG(v)) {
04054
DumpConvInfo((
PCONV_INFO)he.
dwData);
04055 }
04056
break;
04057
04058
case HTYPE_CONVERSATION_LIST:
04059
04060
if (
IsRemoteSession()) {
04061 Print(
"!ddeml for Conversation List doesn't work on HYDRA systems\n");
04062 }
else {
04063 Print(
"Conversation List\n");
04064
if (opts & OFLAG(v)) {
04065
move(cl, (PVOID)he.
dwData);
04066 Print(
" pcl = 0x%08lx\n", he.
dwData);
04067 Print(
" chwnd = 0x%08lx\n", cl.
chwnd);
04068 i = 0;
04069 phwnd = (HWND *)&((
PCONVLIST)he.
dwData)->ahwnd;
04070 SAFEWHILE(cl.
chwnd--) {
04071
move(hwnd, phwnd++);
04072 Print(
" ahwnd[%d] = 0x%08lx\n", i, hwnd);
04073 pcci = (
PCL_CONV_INFO)
GetWindowLongPtr(hwnd, GWLP_PCI);
04074 SAFEWHILE (pcci) {
04075
move(cci, pcci);
04076 pcci = (
PCL_CONV_INFO)cci.
ci.
next;
04077 Print(
" hConv = 0x%08lx\n", cci.
ci.
hConv);
04078 }
04079 i++;
04080 }
04081 }
04082 }
04083
break;
04084
04085
case HTYPE_TRANSACTION:
04086 Print(
"Transaction\n");
04087
if (opts & OFLAG(v)) {
04088
move(xi, (PVOID)he.
dwData);
04089 Print(
" next = 0x%08lx\n", xi.
next);
04090 Print(
" pcoi = 0x%08lx\n", xi.
pcoi);
04091
move(ci, xi.
pcoi);
04092 Print(
" hConv = 0x%08lx\n", ci.
hConv);
04093 Print(
" hUser = 0x%08lx\n", xi.
hUser);
04094 Print(
" hXact = 0x%08lx\n", xi.
hXact);
04095 Print(
" pfnResponse = 0x%08lx\n", xi.
pfnResponse);
04096 Print(
" gaItem = 0x%04x\n", xi.
gaItem);
04097 Print(
" wFmt = 0x%04x\n", xi.
wFmt);
04098 Print(
" wType; = 0x%04x\n", xi.
wType);
04099 Print(
" wStatus; = 0x%04x\n", xi.
wStatus);
04100 Print(
" flags; = %s\n",
04101
GetFlags(GF_XI, xi.
flags, NULL, TRUE));
04102 Print(
" state; = 0x%04x\n", xi.
state);
04103 Print(
" hDDESent = 0x%08lx\n", xi.
hDDESent);
04104 Print(
" hDDEResult = 0x%08lx\n", xi.
hDDEResult);
04105 }
04106
break;
04107
04108
case HTYPE_DATA_HANDLE:
04109 Print(
"Data Handle\n");
04110
if (opts & OFLAG(v)) {
04111
move(dd, (PVOID)he.
dwData);
04112 Print(
" hDDE = 0x%08lx\n", dd.
hDDE);
04113 Print(
" flags = %s\n",
04114
GetFlags(GF_HDATA, (WORD)dd.
flags, NULL, TRUE));
04115 }
04116
break;
04117 }
04118 }
04119 }
04120
if (pcii !=
NULL) {
04121
move(cii, pcii);
04122 }
04123 }
04124
return TRUE;
04125 }
04126
#endif // !KERNEL
04127
04128
04129
#ifdef KERNEL
04130
04131
04132
04133
04134
04135
04136
04137
04138
04139
04140
04141
BOOL Iddesk(
04142 DWORD opts,
04143 PVOID param1)
04144 {
04145
04146
PWINDOWSTATION pwinsta =
NULL;
04147
WINDOWSTATION winsta;
04148
PDESKTOP pdesk;
04149
DESKTOP desk;
04150
WND wnd;
04151
MENU menu;
04152
CALLPROCDATA cpd;
04153
HOOK hook;
04154
DESKTOPINFO di;
04155
DWORD cClasses = 0;
04156
DWORD acHandles[
TYPE_CTYPES];
04157
BOOL abTrack[
TYPE_CTYPES];
04158
HANDLEENTRY he;
04159
PHE phe;
04160
DWORD i;
04161 WCHAR ach[80];
04162
OBJECT_HEADER Head;
04163
OBJECT_HEADER_NAME_INFO NameInfo;
04164
BOOL fMatch;
04165
04166
04167
04168
04169
if (!param1) {
04170
04171 FOREACHWINDOWSTATION(pwinsta)
04172
04173 DEBUGPRINT(
"WINSTA @ %x\n", pwinsta);
04174
move(winsta, pwinsta);
04175
move(Head,
OBJECT_TO_OBJECT_HEADER(pwinsta));
04176
move(NameInfo, ((PCHAR)(
OBJECT_TO_OBJECT_HEADER(pwinsta)) - Head.
NameInfoOffset));
04177
move(ach, NameInfo.
Name.Buffer);
04178 ach[NameInfo.
Name.Length /
sizeof(WCHAR)] = 0;
04179 Print(
"Windowstation: %ws\n", ach);
04180 Print(
"Other desktops:\n");
04181 pdesk = winsta.
rpdeskList;
04182
04183 SAFEWHILE (pdesk) {
04184 Print(
"Desktop at %x\n", pdesk);
04185 Iddesk(opts & OFLAG(v) | OFLAG(h), pdesk);
04186
move(desk, pdesk);
04187 pdesk = desk.
rpdeskNext;
04188 }
04189
04190 Print(
"\n");
04191
04192 NEXTEACHWINDOWSTATION(pwinsta)
04193
04194
return TRUE;
04195 }
04196
04197 pdesk = (
PDESKTOP)param1;
04198
move(desk, pdesk);
04199
04200
move(Head,
OBJECT_TO_OBJECT_HEADER(pdesk));
04201
move(NameInfo, ((PCHAR)(
OBJECT_TO_OBJECT_HEADER(pdesk)) - Head.
NameInfoOffset));
04202
move(ach, NameInfo.
Name.Buffer);
04203 ach[NameInfo.
Name.Length /
sizeof(WCHAR)] = 0;
04204 Print(
"Name: %ws\n", ach);
04205
04206
move(Head,
OBJECT_TO_OBJECT_HEADER(pdesk));
04207 Print(
"# Opens = %d\n", Head.
HandleCount);
04208 Print(
"Heap = %08x\n", desk.
pheapDesktop);
04209 Print(
"Windowstation = %08x\n", desk.
rpwinstaParent);
04210 Print(
"Message pwnd = %08x\n", desk.
spwndMessage);
04211 Print(
"Menu pwnd = %08x\n", desk.
spwndMenu);
04212 Print(
"System pmenu = %08x\n", desk.
spmenuSys);
04213 Print(
"Console thread = %x\n", desk.
dwConsoleThreadId);
04214 Print(
"PtiList.Flink = %08x\n", desk.
PtiList.Flink);
04215
if (!tryMove(di, desk.
pDeskInfo)) {
04216 Print(
"Unable to get DESKTOPINFO at %x\n", desk.
pDeskInfo);
04217 }
else {
04218 Print(
"Desktop pwnd = %08x\n",
di.spwnd);
04219 Print(
"\tfsHooks = 0x%08lx\n"
04220
"\taphkStart\n",
04221
di.fsHooks);
04222
04223
DUMPHOOKS(
"WH_MSGFILTER", WH_MSGFILTER);
04224
DUMPHOOKS(
"WH_JOURNALRECORD", WH_JOURNALRECORD);
04225
DUMPHOOKS(
"WH_JOURNALPLAYBACK", WH_JOURNALPLAYBACK);
04226
DUMPHOOKS(
"WH_KEYBOARD", WH_KEYBOARD);
04227
DUMPHOOKS(
"WH_GETMESSAGE", WH_GETMESSAGE);
04228
DUMPHOOKS(
"WH_CALLWNDPROC", WH_CALLWNDPROC);
04229
DUMPHOOKS(
"WH_CALLWNDPROCRET", WH_CALLWNDPROCRET);
04230
DUMPHOOKS(
"WH_CBT", WH_CBT);
04231
DUMPHOOKS(
"WH_SYSMSGFILTER", WH_SYSMSGFILTER);
04232
DUMPHOOKS(
"WH_MOUSE", WH_MOUSE);
04233
DUMPHOOKS(
"WH_HARDWARE", WH_HARDWARE);
04234
DUMPHOOKS(
"WH_DEBUG", WH_DEBUG);
04235
DUMPHOOKS(
"WH_SHELL", WH_SHELL);
04236
DUMPHOOKS(
"WH_FOREGROUNDIDLE", WH_FOREGROUNDIDLE);
04237
DUMPHOOKS(
"WH_KEYBOARD_LL", WH_KEYBOARD_LL);
04238
DUMPHOOKS(
"WH_MOUSE_LL", WH_MOUSE_LL);
04239 }
04240
04241
04242
04243
04244 for (i = 0; i <
TYPE_CTYPES; i++) {
04245 abTrack[i] =
FALSE;
04246 acHandles[i] = 0;
04247 }
04248 abTrack[
TYPE_WINDOW] = abTrack[
TYPE_MENU] =
04249 abTrack[
TYPE_CALLPROC] =
04250 abTrack[
TYPE_HOOK] =
TRUE;
04251
04252
if (opts & OFLAG(v)) {
04253 Print(
"Handle Type\n");
04254 Print(
"--------------------\n");
04255 }
04256
04257
FOREACHHANDLEENTRY(phe, he, i)
04258 fMatch = FALSE;
04259 try {
04260
switch (he.
bType) {
04261
case TYPE_WINDOW:
04262
move(wnd,
FIXKP(he.
phead));
04263
if (wnd.
head.rpdesk == pdesk)
04264 fMatch =
TRUE;
04265
break;
04266
case TYPE_MENU:
04267
move(menu,
FIXKP(he.
phead));
04268
if (menu.
head.rpdesk == pdesk)
04269 fMatch =
TRUE;
04270
break;
04271
case TYPE_CALLPROC:
04272
move(cpd,
FIXKP(he.
phead));
04273
if (cpd.
head.rpdesk == pdesk)
04274 fMatch =
TRUE;
04275
break;
04276
case TYPE_HOOK:
04277
move(hook,
FIXKP(he.
phead));
04278
if (hook.
head.rpdesk == pdesk)
04279 fMatch =
TRUE;
04280
break;
04281
default:
04282
break;
04283 }
04284 } except (EXCEPTION_EXECUTE_HANDLER) {
04285 ;
04286 }
04287
04288
if (!fMatch)
04289
continue;
04290
04291 acHandles[he.
bType]++;
04292
04293
if (opts & OFLAG(v)) {
04294 Print(
"0x%08lx %c %s\n",
04295 i,
04296 (he.
bFlags & HANDLEF_DESTROY) ?
'*' :
' ',
04297 aszTypeNames[he.
bType]);
04298 }
04299
NEXTEACHHANDLEENTRY()
04300
04301 if (!(opts & OFLAG(v))) {
04302 Print(
"Count Type\n");
04303 Print(
"--------------------\n");
04304 Print(
"0x%08lx Class\n", cClasses);
04305
for (i = 0; i <
TYPE_CTYPES; i++) {
04306
if (abTrack[i])
04307 Print(
"0x%08lx %s\n", acHandles[i],
aszTypeNames[i]);
04308 }
04309 }
04310
04311 Print(
"\n");
04312
return TRUE;
04313 }
04314
#endif // KERNEL
04315
04316
04317
BOOL IsNumChar(
int c,
int base)
04318 {
04319
return (
'0' <=
c &&
c <=
'9') ||
04320 (base == 16 && ((
'a' <=
c &&
c <=
'f') || (
'A' <=
c &&
c <=
'F')));
04321 }
04322
04323
04324
NTSTATUS
04325
GetInteger(LPSTR psz,
int base,
int * pi, LPSTR * ppsz)
04326 {
04327
NTSTATUS status = STATUS_INVALID_PARAMETER;
04328
04329
for (;;) {
04330
if (
IsNumChar(*psz, base)) {
04331 status =
RtlCharToInteger(psz, base, pi);
04332
if (ppsz &&
NT_SUCCESS(status)) {
04333
while (
IsNumChar(*psz++, base))
04334 ;
04335
04336 *ppsz = psz;
04337 }
04338
04339
break;
04340 }
04341
04342
if (*psz !=
' ' && *psz !=
'\t') {
04343
break;
04344 }
04345
04346 psz++;
04347 }
04348
04349 return status;
04350 }
04351
04352
BOOL Idf(DWORD opts, LPSTR pszName)
04353 {
04354 static char *szLevels[8] = {
04355
"<none>",
04356 "Errors",
04357
"Warnings",
04358
"Errors and Warnings",
04359
"Verbose",
04360 "Errors and Verbose",
04361
"Warnings and Verbose",
04362
"Errors, Warnings, and Verbose"
04363 };
04364
04365
NTSTATUS status;
04366 ULONG ulFlags;
04367
PSERVERINFO psi;
04368 WORD wRipFlags;
04369
DWORD wPID;
04370
04371
04372
if (opts & OFLAG(x)) {
04373
04374
04375
04376
04377
04378
04379
04380
04381
04382
04383
BOOL bRet;
04384
char ach[80];
04385 PROCESS_INFORMATION ProcessInfo;
04386 STARTUPINFOA StartupInfoA;
04387
04388
if (pszName[0] ==
'\0') {
04389 Print(
"must provide a name. eg; \"!df -x fred\"\n");
04390
return TRUE;
04391 }
04392
sprintf(ach,
"remote.exe /s cmd.exe %s", pszName);
04393
04394
04395
04396 RtlZeroMemory(&StartupInfoA,
sizeof(STARTUPINFOA));
04397 StartupInfoA.cb =
sizeof(STARTUPINFOA);
04398 StartupInfoA.lpTitle = pszName;
04399 StartupInfoA.dwFlags = STARTF_USESHOWWINDOW;
04400 StartupInfoA.wShowWindow = SW_SHOWMINIMIZED;
04401 #if 0
04402
Print(
"StartupInfoA:\n");
04403 Print(
" cb = %d\n", StartupInfoA.cb);
04404 Print(
" lpReserved = %s\n", StartupInfoA.lpReserved);
04405 Print(
" lpDesktop = %s\n", StartupInfoA.lpDesktop);
04406 Print(
" lpTitle = %s\n", StartupInfoA.lpTitle);
04407 Print(
" dwX, dwY = %d,%d\n", StartupInfoA.dwX, StartupInfoA.dwY);
04408 Print(
" dwXSize, dwYSize = %d,%d\n", StartupInfoA.dwXSize, StartupInfoA.dwYSize);
04409 Print(
" dwXCountChars, dwYCountChars = %d,%d\n", StartupInfoA.dwXCountChars, StartupInfoA.dwYCountChars);
04410 Print(
" dwFillAttribute = 0x%x\n", StartupInfoA.dwFillAttribute);
04411 Print(
" dwFlags = 0x%x\n", StartupInfoA.dwFlags);
04412 Print(
" wShowWindow = 0x%x\n", StartupInfoA.wShowWindow);
04413 Print(
" hStdInput = 0x%x\n", StartupInfoA.hStdInput);
04414 Print(
" hStdOutput = 0x%x\n", StartupInfoA.hStdOutput);
04415 Print(
" hStdError = 0x%x\n", StartupInfoA.hStdError);
04416
#endif
04417
bRet = CreateProcessA(
04418 NULL,
04419 ach,
04420 NULL,
04421 NULL,
04422 FALSE,
04423 CREATE_NEW_CONSOLE,
04424 NULL,
04425 NULL,
04426 &StartupInfoA,
04427 &ProcessInfo );
04428
04429
if (bRet) {
04430 Print(
"Successfully created a minimized remote cmd process\n");
04431 Print(
"use \"remote /c <machine> %s\" to connect\n", pszName);
04432 Print(
"use \"exit\" to kill the remote cmd process\n");
04433 }
04434
#if 0
04435
Print(
"CreateProcessA returns %x\n", bRet);
04436 Print(
"Process handle %x\n"
04437
" hThread %x\n"
04438
" dwProcessId %x\n"
04439
" dwThreadId %x\n",
04440 ProcessInfo.hProcess,
04441 ProcessInfo.hThread,
04442 ProcessInfo.dwProcessId,
04443 ProcessInfo.dwThreadId);
04444
#endif
04445
NtClose(ProcessInfo.hProcess);
04446
NtClose(ProcessInfo.hThread);
04447
return TRUE;
04448 }
04449
04450 moveExpValuePtr(&psi,
VAR(gpsi));
04451
04452
if (opts & OFLAG(p)) {
04453
04454 status =
GetInteger(pszName, 16, &wPID, NULL);
04455
04456
#ifdef KERNEL
04457
04458 (lpExtensionApis->lpWriteProcessMemoryRoutine)(
04459 (ULONG_PTR) (&psi->
wRIPPID),
04460 (
void *) &wPID,
04461
sizeof(wPID),
04462
NULL);
04463
#else
04464
if (!
IsRemoteSession()) {
04465
PrivateSetRipFlags(-1, (DWORD)wPID);
04466 }
else {
04467 Print(
"!df -p doesn't work on HYDRA systems\n");
04468 }
04469
#endif
04470
04471
move(wPID, &psi->
wRIPPID);
04472 Print(
"Set Rip process to %ld (0x%lX)\n", (DWORD)wPID, (DWORD)wPID);
04473
04474
return TRUE;
04475 }
04476
04477
04478
04479
move(wRipFlags, &psi->
wRIPFlags);
04480
move(wPID, &psi->
wRIPPID);
04481
04482 status =
GetInteger(pszName, 16, &ulFlags, NULL);
04483
04484
04485
if (
NT_SUCCESS(status) && !(ulFlags & ~
RIPF_VALIDUSERFLAGS)) {
04486
#ifdef KERNEL
04487
wRipFlags = (WORD)((wRipFlags & ~
RIPF_VALIDUSERFLAGS) | ulFlags);
04488
04489
04490 (lpExtensionApis->lpWriteProcessMemoryRoutine)(
04491 (ULONG_PTR) (&psi->
wRIPFlags),
04492 (
void *) &wRipFlags,
04493
sizeof(wRipFlags),
04494
NULL);
04495
#else
04496
PrivateSetRipFlags(ulFlags, -1);
04497
#endif
04498
04499
move(wRipFlags, &psi->
wRIPFlags);
04500 }
04501
04502 Print(
"Flags = %.3x\n", wRipFlags & RIPF_VALIDUSERFLAGS);
04503 Print(
" Print Process/Component %sabled\n", (wRipFlags & RIPF_HIDEPID) ?
"dis" :
"en");
04504 Print(
" Print File/Line %sabled\n", (wRipFlags & RIPF_PRINTFILELINE) ?
"en" :
"dis");
04505 Print(
" Print on %s\n", szLevels[(wRipFlags & RIPF_PRINT_MASK) >> RIPF_PRINT_SHIFT]);
04506 Print(
" Prompt on %s\n", szLevels[(wRipFlags & RIPF_PROMPT_MASK) >> RIPF_PROMPT_SHIFT]);
04507
04508
if (wPID == 0)
04509 Print(
" All process RIPs are shown\n");
04510
else
04511 Print(
" RIPs shown for process %ld (0x%lX)\n", (DWORD)wPID, (DWORD)wPID);
04512
04513
return TRUE;
04514 }
04515
04516
04517
#if DEBUGTAGS || DBG
04518
BOOL Itag(DWORD opts, LPSTR pszName)
04519 {
04520
NTSTATUS status;
04521
PSERVERINFO psi;
04522
int tag = -1;
04523
DWORD dwDBGTAGFlagsNew;
04524
DWORD dwDBGTAGFlags;
04525
int i;
04526
int iStart, iEnd;
04527
char szT[100];
04528 DBGTAG * pdbgtag;
04529 DBGTAG dbgtag;
04530
04531 UNREFERENCED_PARAMETER(opts);
04532
04533
04534
04535
04536 moveExpValuePtr(&psi,
VAR(gpsi));
04537 status =
GetInteger(pszName, 10, &tag, &pszName);
04538
04539
if (!
NT_SUCCESS(status) || tag < 0 || DBGTAG_Max <= tag) {
04540 tag = -1;
04541 }
else {
04542
04543
04544
04545 status =
GetInteger(pszName, 16, &dwDBGTAGFlagsNew, NULL);
04546
if (
NT_SUCCESS(status) && !(dwDBGTAGFlagsNew & ~DBGTAG_VALIDUSERFLAGS)) {
04547
04548
04549
04550
04551
#ifdef KERNEL
04552
move(dwDBGTAGFlags, &psi->adwDBGTAGFlags[tag]);
04553
COPY_FLAG(dwDBGTAGFlags, dwDBGTAGFlagsNew, DBGTAG_VALIDUSERFLAGS);
04554 (lpExtensionApis->lpWriteProcessMemoryRoutine)(
04555 (DWORD_PTR) (&psi->adwDBGTAGFlags[tag]),
04556 (
void *) &dwDBGTAGFlags,
04557
sizeof(dwDBGTAGFlags),
04558
NULL);
04559
#else
04560
extern void PrivateSetDbgTag(
int tag, DWORD dwDBGTAGFlags);
04561
04562
if (!
IsRemoteSession()) {
04563 PrivateSetDbgTag(tag, dwDBGTAGFlagsNew);
04564 }
else {
04565 Print(
"!tag doesn't work on HYDRA systems\n");
04566 }
04567
#endif
04568
04569 }
04570 }
04571
04572
04573
04574
04575 Print(
"%-5s%-7s%-*s%-*s\n",
04576
"Tag",
04577
"Flags",
04578 DBGTAG_NAMELENGTH,
04579
"Name",
04580 DBGTAG_DESCRIPTIONLENGTH,
04581
"Description");
04582
04583
for (i = 0; i < 12 + DBGTAG_NAMELENGTH + DBGTAG_DESCRIPTIONLENGTH; i++) {
04584 szT[i] =
'-';
04585 }
04586 szT[i++] =
'\n';
04587 szT[i] = 0;
04588 Print(szT);
04589
04590
if (tag != -1) {
04591 iStart = iEnd = tag;
04592 }
else {
04593 iStart = 0;
04594 iEnd = DBGTAG_Max - 1;
04595 }
04596
04597
for (i = iStart; i <= iEnd; i++) {
04598
move(dwDBGTAGFlags, &(psi->adwDBGTAGFlags[i]));
04599
04600 pdbgtag = EvalExp(
VAR(gadbgtag));
04601
move(dbgtag, &pdbgtag[i]);
04602
04603 Print(
"%-5d%-7d%-*s%-*s\n",
04604 i,
04605 dwDBGTAGFlags & DBGTAG_VALIDUSERFLAGS,
04606 DBGTAG_NAMELENGTH,
04607 dbgtag.achName,
04608 DBGTAG_DESCRIPTIONLENGTH,
04609 dbgtag.achDescription);
04610 }
04611
04612
return TRUE;
04613 }
04614
04615
#endif // if DEBUGTAGS
04616
04617
04618
04619
04620
04621
04622
04623
04624
04625
04626
04627
BOOL Idhe(
04628 DWORD opts,
04629 PVOID param1,
04630 PVOID param2)
04631 {
04632
04633
static char szHeader [] =
"Phe Handle phead pOwner cLockObj Type Flags\n";
04634
static char szFormat [] =
"%#010lx %#010lx %#010lx %#010lx %#010lx %-15s %#4lx\n";
04635
THROBJHEAD head;
04636 DWORD_PTR dw;
04637
PHE pheT;
04638
HANDLEENTRY he, *phe;
04639
int i;
04640
UINT uHandleCount = 0;
04641
#ifdef KERNEL
04642
PHANDLETYPEINFO pahti =
NULL;
04643
HANDLETYPEINFO ahti[
TYPE_CTYPES];
04644
PPROCESSINFO ppi;
04645
#endif // KERNEL
04646
04647
04648
04649
04650
if (!(opts & OFLAG(t)) && (opts & OFLAG(o))) {
04651 param2 = param1;
04652 }
04653
04654
04655
04656
if (!(opts & OFLAG(r)) && (opts & (OFLAG(t) | OFLAG(o) | OFLAG(p)))) {
04657 Print(
"Dumping handles ");
04658
if (opts & OFLAG(t)) {
04659
if ((UINT_PTR)param1 >=
TYPE_CTYPES) {
04660 Print(
"Invalid Type: %#lx\n", param1);
04661
return FALSE;
04662 }
04663 Print(
"of type %d (%s)", param1, aszTypeNames[(UINT_PTR)param1]);
04664 }
04665
if (opts & OFLAG(o)) {
04666 Print(
" owned by %#lx", param2);
04667 }
04668
if (opts & OFLAG(p)) {
04669 Print(
" or any thread on this process");
04670 }
04671 Print(
"\n");
04672 }
04673
04674
#ifdef KERNEL
04675
04676
04677
04678
if (opts & OFLAG(p)) {
04679 pahti = EvalExp(
VAR(gahti));
04680
move(ahti, pahti);
04681 }
04682
04683
04684
#endif // KERNEL
04685
04686
04687
04688
if (!(opts & ~OFLAG(r)) && (param1 !=
NULL)) {
04689 dw = (DWORD_PTR)
HorPtoP(param1, -2);
04690
if (dw == 0) {
04691 Print(
"0x%p is not a valid object or handle.\n", param1);
04692
return FALSE;
04693 }
04694 }
else {
04695
04696
04697
04698 Print(szHeader);
04699
FOREACHHANDLEENTRY(phe, he, i)
04700
04701 if (he.bType == TYPE_FREE) {
04702
continue;
04703 }
04704
04705
if ((opts & OFLAG(t)) && (he.
bType != (
BYTE)param1)) {
04706
continue;
04707 }
04708
04709
if ((opts & OFLAG(o)) && (
FIXKP(he.
pOwner) != param2)) {
04710
04711
if (opts & OFLAG(p)) {
04712
#ifndef KERNEL
04713
continue;
04714
#else
04715
if (ahti[he.
bType].
bObjectCreateFlags &
OCF_PROCESSOWNED) {
04716
continue;
04717 }
04718
if (!(ahti[he.
bType].
bObjectCreateFlags &
OCF_THREADOWNED)) {
04719
continue;
04720 }
04721 tryMove(ppi, &((
PTHREADINFO)he.
pOwner)->ppi);
04722
if (ppi != param2) {
04723
continue;
04724 }
04725
#endif
04726
}
else {
04727
continue;
04728 }
04729 }
04730
04731
Idhe(OFLAG(r), he.
phead, NULL);
04732 uHandleCount++;
04733
NEXTEACHHANDLEENTRY()
04734 Print("%d handle(s)\n", uHandleCount);
04735 return TRUE;
04736 }
04737
04738 if (!getHEfromP(&pheT, &he, (PVOID)dw)) {
04739 Print(
"%x is not a USER handle manager object.\n", param1);
04740
return FALSE;
04741 }
04742
04743
#ifdef KERNEL
04744
04745
04746
04747
if (!(opts & OFLAG(r))) {
04748
if (he.
pOwner !=
NULL) {
04749
if (!(opts & OFLAG(p))) {
04750 pahti = EvalExp(
VAR(gahti));
04751
move(ahti, pahti);
04752 }
04753
if ((ahti[he.
bType].
bObjectCreateFlags &
OCF_PROCESSOWNED)) {
04754 Idp(OFLAG(p), (PVOID)he.
pOwner);
04755 }
else if ((ahti[he.
bType].
bObjectCreateFlags &
OCF_THREADOWNED)) {
04756 Idt(OFLAG(p), (PVOID)he.
pOwner);
04757 }
04758 }
04759 }
04760
#endif // KERNEL
04761
04762
move(head, (PVOID)dw);
04763
04764
04765
04766
04767
if (!(opts & OFLAG(r))) {
04768
PRTVDW2(phe, pheT, cLockObj, head.cLockObj);
04769
PRTVDW2(wUniq, he.
wUniq, handle, head.h);
04770
PRTVDW2(phead,
FIXKP(he.
phead), pOwner,
FIXKP(he.
pOwner));
04771 Print(DWSTR1
" - %s\n", he.
bType,
"bType", aszTypeNames[he.
bType]);
04772 Print(DWSTR1
" - %s\n", he.
bFlags,
"bFlags",
GetFlags(GF_HE, he.
bFlags, NULL, TRUE));
04773 }
else {
04774 Print(szFormat,
04775 pheT, head.h,
FIXKP(he.
phead),
FIXKP(he.
pOwner),
04776 head.cLockObj, aszTypeNames[(DWORD)he.
bType], (DWORD)he.
bFlags);
04777 }
04778
04779
return TRUE;
04780 }
04781
04782
#ifdef KERNEL
04783
04784
04785
04786
04787
04788
04789
04790
04791
04792
04793
04794
04795
04796
BOOL Idhk(
04797 DWORD opts,
04798 PVOID param1)
04799 {
04800
04801
DWORD dwFlags;
04802
PTHREADINFO pti;
04803
THREADINFO ti;
04804
HOOK hook;
04805
04806
#define DHKF_GLOBAL_HOOKS 1
04807
#define DHKF_PTI_GIVEN 2
04808
04809
dwFlags = 0;
04810
04811 pti =
NULL;
04812
if (opts & OFLAG(g)) {
04813
dwFlags |= DHKF_GLOBAL_HOOKS;
04814 }
04815
04816
#ifdef LATER
04817
if (opts & OFLAG(a)) {
04818 moveExpValuePtr(&pti,
VAR(gptiFirst));
04819 SAFEWHILE (pti != NULL) {
04820
char ach[80];
04821
04822
sprintf(ach,
"%lx", pti);
04823 dhk(hCurrentProcess, hCurrentThread, dwCurPc,
04824 dwCurrentPc, ach);
04825
move(pti, &(pti->ptiNext));
04826 }
04827
if (
dwFlags & DHKF_GLOBAL_HOOKS) {
04828 dhk(hCurrentProcess, hCurrentThread, dwCurPc,
04829 dwCurrentPc,
"g");
04830 }
04831
return TRUE;
04832 }
04833
#endif
04834
if (param1 ==
NULL) {
04835
PQ pq;
04836
Q q;
04837 moveExpValuePtr(&pq,
VAR(gpqForeground));
04838
if (pq ==
NULL) {
04839
04840 Print(
"No foreground queue!\n");
04841
return TRUE;
04842 }
04843
move(q, pq);
04844 pti = q.
ptiKeyboard;
04845 }
else {
04846
dwFlags |= DHKF_PTI_GIVEN;
04847 pti = (
PTHREADINFO)param1;
04848 }
04849
04850
move(ti, pti);
04851
04852
if (
dwFlags & DHKF_PTI_GIVEN || !(
dwFlags & DHKF_GLOBAL_HOOKS)) {
04853 Print(
"Local hooks on PTHREADINFO @ 0x%p%s:\n", pti,
04854 (dwFlags & DHKF_PTI_GIVEN ?
"" :
" (foreground thread)"));
04855
04856
DUMPLHOOKS(
"WH_MSGFILTER", WH_MSGFILTER);
04857
DUMPLHOOKS(
"WH_JOURNALRECORD", WH_JOURNALRECORD);
04858
DUMPLHOOKS(
"WH_JOURNALPLAYBACK", WH_JOURNALPLAYBACK);
04859
DUMPLHOOKS(
"WH_KEYBOARD", WH_KEYBOARD);
04860
DUMPLHOOKS(
"WH_GETMESSAGE", WH_GETMESSAGE);
04861
DUMPLHOOKS(
"WH_CALLWNDPROC", WH_CALLWNDPROC);
04862
DUMPLHOOKS(
"WH_CALLWNDPROCRET", WH_CALLWNDPROCRET);
04863
DUMPLHOOKS(
"WH_CBT", WH_CBT);
04864
DUMPLHOOKS(
"WH_SYSMSGFILTER", WH_SYSMSGFILTER);
04865
DUMPLHOOKS(
"WH_MOUSE", WH_MOUSE);
04866
DUMPLHOOKS(
"WH_HARDWARE", WH_HARDWARE);
04867
DUMPLHOOKS(
"WH_DEBUG", WH_DEBUG);
04868
DUMPLHOOKS(
"WH_SHELL", WH_SHELL);
04869
DUMPLHOOKS(
"WH_FOREGROUNDIDLE", WH_FOREGROUNDIDLE);
04870
DUMPLHOOKS(
"WH_KEYBOARD_LL", WH_KEYBOARD_LL);
04871
DUMPLHOOKS(
"WH_MOUSE_LL", WH_MOUSE_LL);
04872 }
04873
04874
if (
dwFlags & DHKF_GLOBAL_HOOKS) {
04875
DESKTOPINFO di;
04876
04877
move(di, ti.
pDeskInfo);
04878
04879 Print(
"Global hooks for Desktop @ %lx:\n", ti.
rpdesk);
04880 Print(
"\tfsHooks 0x%08lx\n"
04881
"\taphkStart\n",
di.fsHooks);
04882
04883
DUMPHOOKS(
"WH_MSGFILTER", WH_MSGFILTER);
04884
DUMPHOOKS(
"WH_JOURNALRECORD", WH_JOURNALRECORD);
04885
DUMPHOOKS(
"WH_JOURNALPLAYBACK", WH_JOURNALPLAYBACK);
04886
DUMPHOOKS(
"WH_KEYBOARD", WH_KEYBOARD);
04887
DUMPHOOKS(
"WH_GETMESSAGE", WH_GETMESSAGE);
04888
DUMPHOOKS(
"WH_CALLWNDPROC", WH_CALLWNDPROC);
04889
DUMPHOOKS(
"WH_CALLWNDPROCRET", WH_CALLWNDPROCRET);
04890
DUMPHOOKS(
"WH_CBT", WH_CBT);
04891
DUMPHOOKS(
"WH_SYSMSGFILTER", WH_SYSMSGFILTER);
04892
DUMPHOOKS(
"WH_MOUSE", WH_MOUSE);
04893
DUMPHOOKS(
"WH_HARDWARE", WH_HARDWARE);
04894
DUMPHOOKS(
"WH_DEBUG", WH_DEBUG);
04895
DUMPHOOKS(
"WH_SHELL", WH_SHELL);
04896
DUMPHOOKS(
"WH_FOREGROUNDIDLE", WH_FOREGROUNDIDLE);
04897
DUMPHOOKS(
"WH_KEYBOARD_LL", WH_KEYBOARD_LL);
04898
DUMPHOOKS(
"WH_MOUSE_LL", WH_MOUSE_LL);
04899 }
04900
return TRUE;
04901 }
04902
#endif // KERNEL
04903
04904
04905
#ifdef KERNEL
04906
04907
04908
04909
04910
04911
04912
04913
04914
BOOL Idhot()
04915 {
04916
PHOTKEY phk;
04917
HOTKEY hk;
04918
04919 moveExpValuePtr(&phk,
VAR(gphkFirst));
04920 SAFEWHILE (phk != NULL) {
04921
move(hk, phk);
04922 Print(
"fsModifiers %lx, vk %x - ",
04923 hk.
fsModifiers, hk.
vk);
04924 Print(
"%s%s%s%sVK:%x %s",
04925 hk.
fsModifiers & MOD_SHIFT ?
"Shift + " :
"",
04926 hk.
fsModifiers & MOD_ALT ?
"Alt + " :
"",
04927 hk.
fsModifiers & MOD_CONTROL ?
"Ctrl + " :
"",
04928 hk.
fsModifiers & MOD_WIN ?
"Win + " :
"",
04929 hk.
vk,
GetVKeyName(hk.
vk));
04930
04931 Print(
"\n id %x\n", hk.
id);
04932 Print(
" pti %lx\n", hk.
pti);
04933 Print(
" pwnd %lx = ", hk.
spwnd);
04934
if (hk.
spwnd ==
PWND_FOCUS) {
04935 Print(
"PWND_FOCUS\n");
04936 }
else if (hk.
spwnd ==
PWND_INPUTOWNER) {
04937 Print(
"PWND_INPUTOWNER\n");
04938 }
else {
04939
CHAR ach[80];
04940
04941
04942
04943
DebugGetWindowTextA(hk.
spwnd,ach);
04944 Print(
"\"%s\"\n", ach);
04945 }
04946 Print(
"\n");
04947
04948 phk = hk.
phkNext;
04949 }
04950
return TRUE;
04951 }
04952
#endif // KERNEL
04953
04954
#ifdef KERNEL
04955
04956
04957
04958
04959
04960
04961
04962
04963
04964
04965
04966
04967
04968
04969
BOOL Idhs(
04970 DWORD opts,
04971 PVOID param1)
04972 {
04973
HANDLEENTRY *phe, he;
04974
DWORD dwT;
04975
DWORD acHandles[
TYPE_CTYPES];
04976
DWORD cHandlesUsed, cHandlesSkipped;
04977
DWORD idThread, idProcess;
04978
DWORD i;
04979
int Type, cHandleEntries = 0;
04980
PROCESSINFO pi;
04981
THREADINFO ti;
04982
04983
PHANDLETYPEINFO pahti =
NULL;
04984
HANDLETYPEINFO ahti[
TYPE_CTYPES];
04985
04986 pahti = EvalExp(
VAR(gahti));
04987
if (!pahti) {
04988
return TRUE;;
04989 }
04990
move(ahti, pahti);
04991
04992
04993
04994
04995
04996
if (opts & OFLAG(y)) {
04997 Type = PtrToUlong(param1);
04998 }
else if (opts & (OFLAG(t) | OFLAG(p))) {
04999 dwT = PtrToUlong(param1);
05000 }
05001
05002 cHandlesSkipped = 0;
05003 cHandlesUsed = 0;
05004
for (i = 0; i <
TYPE_CTYPES; i++)
05005 acHandles[i] = 0;
05006
05007
if (param1) {
05008
if (opts & OFLAG(p)) {
05009 Print(
"Handle dump for client process id 0x%lx only:\n\n", dwT);
05010 }
else if (opts & OFLAG(t)) {
05011 Print(
"Handle dump for client thread id 0x%lx only:\n\n", dwT);
05012 }
else if (opts & OFLAG(y)) {
05013 Print(
"Handle dump for %s objects:\n\n", aszTypeNames[Type]);
05014 }
05015 }
else {
05016 Print(
"Handle dump for all processes and threads:\n\n");
05017 }
05018
05019
if (opts & OFLAG(v)) {
05020 Print(
"Handle Type\n");
05021 Print(
"--------------------\n");
05022 }
05023
05024
FOREACHHANDLEENTRY(phe, he, i)
05025 cHandleEntries++;
05026
05027 if ((opts & OFLAG(y)) && he.bType != Type) {
05028
continue;
05029 }
05030
05031
if (opts & OFLAG(p) &&
05032 (ahti[he.
bType].
bObjectCreateFlags &
OCF_PROCESSOWNED)) {
05033
05034
if (he.
pOwner ==
NULL) {
05035
continue;
05036 }
05037
05038
move(pi, he.
pOwner);
05039
if (
GetEProcessData(pi.Process, PROCESS_PROCESSID, &idProcess) ==
NULL) {
05040 Print(
"Unable to read _EPROCESS at %lx\n",pi.Process);
05041
continue;
05042 }
05043
if (idProcess != dwT) {
05044 continue;
05045 }
05046
05047 }
else if ((opts & OFLAG(t)) &&
05048 !(ahti[he.
bType].bObjectCreateFlags &
OCF_PROCESSOWNED)) {
05049
05050
if (he.
pOwner ==
NULL) {
05051
continue;
05052 }
05053
05054
move(ti, he.
pOwner);
05055
move(idThread, &(ti.pEThread->Cid.UniqueThread));
05056
if (idThread != dwT) {
05057
continue;
05058 }
05059 }
05060
05061 acHandles[he.
bType]++;
05062
05063
if (he.
bType ==
TYPE_FREE) {
05064
continue;
05065 }
05066
05067 cHandlesUsed++;
05068
05069
if (opts & OFLAG(v)) {
05070 Print(
"0x%08lx %c %s\n",
05071 i,
05072 (he.
bFlags & HANDLEF_DESTROY) ?
'*' :
' ',
05073 aszTypeNames[he.
bType]);
05074 }
05075
05076
NEXTEACHHANDLEENTRY()
05077
05078 if (!(opts & OFLAG(v))) {
05079 Print(
"Count Type\n");
05080 Print(
"--------------------\n");
05081
for (i = 0; i <
TYPE_CTYPES; i++) {
05082
if ((opts & OFLAG(y)) && Type != (
int)i) {
05083
continue;
05084 }
05085 Print(
"0x%08lx (%d) %s\n", acHandles[i], i, aszTypeNames[i]);
05086 }
05087 }
05088
05089
if (!(opts & OFLAG(y))) {
05090 Print(
"\nTotal Accessible Handles: 0x%lx\n", cHandleEntries);
05091 Print(
"Used Accessible Handles: 0x%lx\n", cHandlesUsed);
05092 Print(
"Free Accessible Handles: 0x%lx\n", cHandleEntries - cHandlesUsed);
05093 }
05094
return TRUE;
05095 }
05096
#endif // KERNEL
05097
05098
#ifdef KERNEL
05099
05100
05101
05102
05103
05104
05105
05106
05107
BOOL Idi()
05108 {
05109
char ach[80];
05110
PQ pq;
05111
Q q;
05112
DWORD dw, dw1;
05113
PSERVERINFO psi;
05114
SERVERINFO si;
05115
PDESKTOP pdesk;
05116
DESKTOP desk;
05117
PWND pwnd;
05118
05119
05120
PRTGDW2(gptiCurrent, grpdeskRitInput);
05121
PRTGDW2(gpqForeground, gpqForegroundPrev);
05122
PRTGDW2(gptiForeground, gpqCursor);
05123
05124
sprintf(ach,
"win32k!glinp + %#lx", FIELD_OFFSET(
LASTINPUT, timeLastInputMessage));
05125 moveExpValue(&dw, ach);
05126
sprintf(ach,
"win32k!glinp + %#lx", FIELD_OFFSET(
LASTINPUT, ptiLastWoken));
05127 moveExpValue(&dw1, ach);
05128
PRTVDW2(
glinp.
timeLastInputMessage, dw,
glinp.
ptiLastWoken, dw1);
05129
PRTGDW1(gwMouseOwnerButton);
05130
05131 moveExpValuePtr(&psi,
VAR(gpsi));
05132
move(si, psi);
05133
PRTVPT(
gpsi->ptCursor, si.ptCursor);
05134
05135 moveExpValuePtr(&pdesk,
VAR(grpdeskRitInput));
05136
if (pdesk !=
NULL) {
05137
move(desk, pdesk);
05138
move(pwnd, &(desk.
pDeskInfo->
spwnd));
05139
PRTWND(Desktop window, pwnd);
05140 }
05141
05142 moveExpValuePtr(&pq,
VAR(gpqForeground));
05143
if (pq !=
NULL) {
05144
move(q, pq);
05145
PRTWND(
gpqForeground->
spwndFocus, q.
spwndFocus);
05146
PRTWND(
gpqForeground->
spwndActive, q.
spwndActive);
05147 }
05148
05149
PRTGWND(gspwndScreenCapture);
05150
PRTGWND(gspwndInternalCapture);
05151
PRTGWND(gspwndMouseOwner);
05152
05153
return TRUE;
05154 }
05155
#endif // KERNEL
05156
05157
05158
05159
05160
05161
05162
05163
05164
05165
05166
05167
05168
05169
05170
BOOL Idll(
05171 DWORD opts,
05172 LPSTR lpas)
05173 {
05174
static DWORD iOffset;
05175
static DWORD cStructs;
05176
static DWORD cDwords;
05177
static DWORD cDwordsBack;
05178
static DWORD_PTR dw, dwHalfSpeed;
05179 DWORD_PTR dwT;
05180
DWORD cBytesBack;
05181
DWORD i, j;
05182
BOOL fIndirectFirst;
05183
BOOL fTestAndCountOnly;
05184 DWORD_PTR dwFind;
05185
DWORD adw[
CDWORDS];
05186
NTSTATUS Status;
05187
DWORD dwValue;
05188
05189 UNREFERENCED_PARAMETER(opts);
05190
05191
05192
05193
05194
05195
while (*lpas ==
' ')
05196 lpas++;
05197
05198
05199
05200
05201
05202
if (*lpas != 0) {
05203
05204
05205
05206
05207
05208 fIndirectFirst =
FALSE;
05209
if (*lpas ==
'*') {
05210 lpas++;
05211 fIndirectFirst =
TRUE;
05212 }
05213
05214
05215
05216
05217
Status =
GetInteger(lpas, 16, &dwValue, &lpas);
05218 dw = dwValue;
05219
if (!
NT_SUCCESS(Status)) {
05220 dw = (DWORD_PTR)EvalExp(lpas);
05221 }
05222
if (fIndirectFirst)
05223
move(dw, (PVOID)dw);
05224 dwHalfSpeed = dw;
05225
05226 iOffset = 0;
05227 cStructs = (
DWORD)25;
05228 cDwords = 8;
05229 cDwordsBack = 0;
05230 fTestAndCountOnly =
FALSE;
05231 dwFind = 0;
05232
05233 SAFEWHILE (TRUE) {
05234
while (*lpas ==
' ')
05235 lpas++;
05236
05237
switch(*lpas) {
05238
case 'l':
05239
05240
05241
05242 lpas++;
05243 cDwords = (
DWORD)(DWORD_PTR)EvalExp(lpas);
05244
if (cDwords >
CDWORDS) {
05245 Print(
"\nl%d? - %d DWORDs maximum\n\n", cDwords, CDWORDS);
05246 cDwords =
CDWORDS;
05247 }
05248
break;
05249
05250
case 'b':
05251
05252
05253
05254
05255
05256 lpas++;
05257 cDwordsBack = (
DWORD)(DWORD_PTR)EvalExp(lpas);
05258
if (cDwordsBack >=
CDWORDS) {
05259 Print(
"\nb%d? - %d DWORDs maximum\n\n", cDwordsBack, CDWORDS - 1);
05260 cDwordsBack =
CDWORDS - 1;
05261 }
05262
break;
05263
05264
case 'o':
05265
05266
05267
05268 lpas++;
05269 iOffset = (
DWORD)(DWORD_PTR)EvalExp(lpas);
05270
break;
05271
05272
case 'c':
05273
05274
05275
05276 lpas++;
05277 cStructs = (
DWORD)(DWORD_PTR)EvalExp(lpas);
05278
break;
05279
05280
case 'f':
05281
05282
05283
05284 lpas++;
05285 dwFind = (DWORD_PTR)EvalExp(lpas);
05286
break;
05287
05288
case 't':
05289
05290
05291
05292 fTestAndCountOnly =
TRUE;
05293 cStructs = 0x100000;
05294
05295
default:
05296
break;
05297 }
05298
05299
while (*lpas && *lpas !=
' ')
05300 lpas++;
05301
05302
if (*lpas == 0)
05303
break;
05304 }
05305
05306
if (cDwordsBack > cDwords) {
05307 Print(
"backing up %d DWORDS per struct (b%d): ",
05308 cDwordsBack, cDwordsBack);
05309 Print(
"increasing l%d to l%d so next link is included\n",
05310 cDwords, cDwordsBack + 1);
05311 cDwords = cDwordsBack + 1;
05312 }
05313
05314
for (i = 0; i <
CDWORDS; i++)
05315 adw[i] = 0;
05316 }
05317
05318 cBytesBack = cDwordsBack *
sizeof(
DWORD);
05319
05320
for (i = 0; i < cStructs; i++) {
05321
moveBlock(adw, (PVOID)(dw - cBytesBack),
sizeof(DWORD) * cDwords);
05322
05323
if (!fTestAndCountOnly) {
05324 Print(
"---- 0x%lx:\n", i);
05325
for (j = 0; j < cDwords; j += 4) {
05326
switch (cDwords - j) {
05327
case 1:
05328 Print(
"%08lx: %08lx\n",
05329 dw + j *
sizeof(DWORD),
05330 adw[j + 0]);
05331
break;
05332
05333
case 2:
05334 Print(
"%08lx: %08lx %08lx\n",
05335 dw + j *
sizeof(DWORD),
05336 adw[j + 0], adw[j + 1]);
05337
break;
05338
05339
case 3:
05340 Print(
"%08lx: %08lx %08lx %08lx\n",
05341 dw + j *
sizeof(DWORD),
05342 adw[j + 0], adw[j + 1], adw[j + 2]);
05343
break;
05344
05345
default:
05346 Print(
"%08lx: %08lx %08lx %08lx %08lx\n",
05347 dw + j *
sizeof(DWORD),
05348 adw[j + 0], adw[j + 1], adw[j + 2], adw[j + 3]);
05349 }
05350 }
05351 }
else if ((i & 0xff) == 0xff) {
05352 Print(
"item 0x%lx at %lx...\n", i+1, dw);
05353 }
05354
05355
if (dwFind == dw) {
05356 Print(
"====== FOUND ITEM ======\n");
05357
break;
05358 }
05359
05360
05361
05362
05363
if ((i & 0xf) == 0xf) {
05364
if (IsCtrlCHit()) {
05365 Print(
"terminated by Ctrl-C on item 0x%lx at %lx...\n", i, dw);
05366
break;
05367 }
05368 }
05369
05370
05371
05372
05373 dwT = dw + iOffset *
sizeof(
DWORD);
05374
move(dw, (PVOID)dwT);
05375
05376
if (fTestAndCountOnly) {
05377
05378
05379
05380
05381
if (i & 1) {
05382 dwT = dwHalfSpeed + iOffset *
sizeof(
DWORD);
05383
move(dwHalfSpeed, (PVOID)dwT);
05384 }
05385
if (dw == dwHalfSpeed) {
05386 Print(
"!!! Loop Detected on item 0x%lx at %lx...\n", i, dw);
05387
break;
05388 }
05389 }
05390
05391
if (dw == 0)
05392
break;
05393 }
05394 Print(
"---- Total 0x%lx items ----\n", i+1);
05395
return TRUE;
05396 }
05397
05398
05399
05400
05401
05402
05403
05404
05405
05406
05407
BOOL Ifind(
05408 DWORD opts,
05409 LPSTR lpas)
05410 {
05411
DWORD iOffset = 0;
05412 LPDWORD adw;
05413
DWORD cbDwords;
05414 DWORD_PTR dwBase;
05415 DWORD_PTR dwLast = 0;
05416 DWORD_PTR dwAddr;
05417 DWORD_PTR dwTest;
05418 DWORD_PTR dwT;
05419
05420 UNREFERENCED_PARAMETER(opts);
05421
05422
05423
05424
05425
05426
while (*lpas ==
' ')
05427 lpas++;
05428
05429
05430
05431
05432
05433
if (*lpas != 0) {
05434
05435
05436
05437
05438 dwBase = (DWORD_PTR)EvalExp(lpas);
05439
while (*lpas && *lpas !=
' ')
05440 lpas++;
05441 dwAddr = (DWORD_PTR)EvalExp(lpas);
05442
while (*lpas && *lpas !=
' ')
05443 lpas++;
05444
05445 iOffset = 0;
05446
05447 SAFEWHILE (TRUE) {
05448
if (IsCtrlCHit())
05449
return TRUE;
05450
while (*lpas ==
' ')
05451 lpas++;
05452
05453
switch(*lpas) {
05454
case 'o':
05455
05456
05457
05458 lpas++;
05459 iOffset = (
DWORD)(DWORD_PTR)EvalExp(lpas);
05460
break;
05461
05462
default:
05463
break;
05464 }
05465
05466
while (*lpas && *lpas !=
' ')
05467 lpas++;
05468
05469 if (*lpas == 0)
05470
break;
05471 }
05472 }
05473
05474 cbDwords = (iOffset + 1) *
sizeof(
DWORD);
05475 adw = LocalAlloc(LPTR, cbDwords);
05476 dwTest = dwBase;
05477
05478
while (dwTest && dwTest != dwAddr) {
05479
moveBlock(adw, (PVOID)dwTest, cbDwords);
05480
05481 dwLast = dwTest;
05482 dwT = dwTest + iOffset *
sizeof(
DWORD);
05483
move(dwTest, (PVOID)dwT);
05484 }
05485
if (dwTest == 0)
05486 Print(
"Address %#p not found\n", dwAddr);
05487
else
05488 Print(
"Address %#p found, previous = %#p\n", dwAddr, dwLast);
05489 LocalFree(adw);
05490
return TRUE;
05491 }
05492
05493
05494
#ifdef KERNEL
05495
05496
05497
05498
05499
05500
05501
05502
05503
BOOL Idlr(
05504 DWORD opts,
05505 PVOID param1)
05506 {
05507
HANDLEENTRY he;
05508
#if DBG
05509
PLR plrT;
05510
#endif
05511
05512
#if DEBUGTAGS
05513
PSERVERINFO psi;
05514
DWORD dwDBGTAGFlags;
05515 moveExpValuePtr(&psi,
VAR(
gpsi));
05516
move(dwDBGTAGFlags, &(psi->adwDBGTAGFlags[DBGTAG_TrackLocks]));
05517 dwDBGTAGFlags &= DBGTAG_VALIDUSERFLAGS;
05518
if (dwDBGTAGFlags == DBGTAG_DISABLED) {
05519 Print(
"dlr works better if tag TrackLocks is enabled.\n");
05520
return(
TRUE);
05521 }
05522
05523
#endif
05524
05525 UNREFERENCED_PARAMETER(opts);
05526
05527
if (!
GetAndDumpHE((ULONG_PTR)param1, &he,
FALSE)) {
05528 Print(
"!dlr: GetAndDumpHE failed\n");
05529
return FALSE;
05530 }
05531
05532
05533
05534
05535
05536
#if DBG
05537
plrT = he.plr;
05538
05539
if (plrT !=
NULL) {
05540 Print(
"phe %x Dumping the lock records\n"
05541
"----------------------------------------------\n"
05542
"address cLock\n"
05543
"----------------------------------------------\n");
05544 }
05545
05546 SAFEWHILE (plrT !=
NULL) {
05547 DWORD_PTR dw;
05548
LOCKRECORD lr;
05549
int i;
05550
char ach[80];
05551
05552
move(lr, plrT);
05553
05554 Print(
"%08x %08d\n", lr.
ppobj, lr.
cLockObj);
05555
05556
for (i = 0; i <
LOCKRECORD_STACK; i++) {
05557 GetSym((
LPVOID)lr.
trace[i], ach, &dw);
05558 Print(
" %s+%x\n",
05559 ach, dw);
05560 }
05561
05562 plrT = lr.
plrNext;
05563 }
05564
#endif // DBG
05565
05566
return TRUE;
05567 }
05568
#endif // KERNEL
05569
05570
05571
05572
05573
05574
05575
05576
05577
05578
05579
05580
05581
05582
05583
void DumpMenu( UINT uIndent, DWORD opts,
PMENU pMenu )
05584 {
05585
MENU localMenu;
05586
ITEM localItem;
05587
PITEM pitem;
05588 LPDWORD lpdw;
05589 DWORD_PTR localDW;
05590
UINT i;
05591 WCHAR szBufW[128];
05592
char szIndent[256];
05593
05594
05595
05596
05597
for (i=0; i < uIndent; szIndent[i++]=
' ');
05598 szIndent[i] =
'\0';
05599
05600
05601
05602
05603
if (!(opts & OFLAG(v))) {
05604 Print(
"0x%p %s", pMenu, szIndent);
05605 }
else {
05606 Print(
"%sPMENU @0x%p:\n", szIndent, pMenu);
05607 }
05608
05609
05610
05611
05612
if (!tryMove(localMenu, pMenu)) {
05613
return;
05614 }
05615
05616
05617
05618
05619
05620
if (!(opts & OFLAG(v))) {
05621 Print(
"PMENU: fFlags=0x%lX, cItems=%lu, iItem=%lu, spwndNotify=0x%p\n",
05622 localMenu.
fFlags, localMenu.
cItems, localMenu.
iItem, localMenu.
spwndNotify);
05623 }
else {
05624 Print(
"%s fFlags............ %s\n"
05625
"%s location.......... (%lu, %lu)\n",
05626 szIndent,
GetFlags(GF_MF, (WORD)localMenu.
fFlags, NULL, TRUE),
05627 szIndent, localMenu.
cxMenu, localMenu.
cyMenu);
05628 Print(
"%s spwndNotify....... 0x%p\n"
05629
"%s dwContextHelpId... 0x%08lX\n"
05630
"%s items............. %lu items in block of %lu\n",
05631 szIndent, localMenu.
spwndNotify,
05632 szIndent, localMenu.
dwContextHelpId,
05633 szIndent, localMenu.
cItems, localMenu.
cAlloced);
05634 }
05635
05636 lpdw = (LPDWORD)(((
PBYTE)pMenu) + FIELD_OFFSET(
MENU, rgItems));
05637
if (tryMove(localDW,
FIXKP(lpdw))) {
05638 pitem = (
PITEM)localDW;
05639 i = 0;
05640 SAFEWHILE (i < localMenu.
cItems) {
05641
05642
05643
05644
if (tryMove(localItem,
FIXKP(pitem))) {
05645
if (!(opts & OFLAG(i))) {
05646
05647
05648
05649
if (!(opts & OFLAG(v))) {
05650 Print(
"0x%p %s%lu: ID=0x%08lX hbmp=0x%08lX", pitem, szIndent, i, localItem.
wID, localItem.
hbmp);
05651
if (localItem.
cch && tryMoveBlock(szBufW,
FIXKP(localItem.
lpstr), (localItem.
cch*
sizeof(WCHAR)))) {
05652 szBufW[localItem.
cch] = 0;
05653 Print(
" %ws%\n", szBufW);
05654 }
else {
05655 Print(
", fType=%s",
GetFlags(GF_MENUTYPE, (WORD)localItem.
fType, NULL, TRUE));
05656
if (! (localItem.
fType & MF_SEPARATOR)) {
05657 Print(
", lpstr=0x%p", localItem.
lpstr);
05658 }
05659 Print(
"\n");
05660 }
05661 }
else {
05662 Print(
"%s Item #%d @0x%p:\n", szIndent, i, pitem);
05663
05664
05665
05666 Print(
"%s ID........... 0x%08lX (%lu)\n"
05667
"%s lpstr.... 0x%p",
05668 szIndent, localItem.
wID, localItem.
wID,
05669 szIndent, localItem.
lpstr);
05670
if (localItem.
cch && tryMoveBlock(szBufW,
FIXKP(localItem.
lpstr), (localItem.
cch*
sizeof(WCHAR)))) {
05671 szBufW[localItem.
cch] = 0;
05672 Print(
" %ws%\n", szBufW);
05673 }
else {
05674 Print(
"\n");
05675 }
05676 Print(
"%s fType........ %s\n"
05677
"%s fState....... %s\n"
05678
"%s dwItemData... 0x%p\n",
05679 szIndent,
GetFlags(GF_MENUTYPE, (WORD)localItem.
fType, NULL, TRUE),
05680 szIndent,
GetFlags(GF_MENUSTATE, (WORD)localItem.
fState, NULL, TRUE),
05681 szIndent, localItem.
dwItemData);
05682 Print(
"%s checks....... on=0x%08lX, off=0x%08lX\n"
05683
"%s location..... @(%lu,%lu) size=(%lu,%lu)\n",
05684 szIndent, localItem.
hbmpChecked, localItem.
hbmpUnchecked,
05685 szIndent, localItem.
xItem, localItem.
yItem, localItem.
cxItem, localItem.
cyItem);
05686 Print(
"%s underline.... x=%lu, width=%lu\n"
05687
"%s dxTab........ %lu\n"
05688
"%s spSubMenu.... 0x%p\n",
05689 szIndent, localItem.
ulX, localItem.
ulWidth,
05690 szIndent, localItem.
dxTab,
05691 szIndent, localItem.
spSubMenu);
05692 }
05693 }
05694
05695
05696
05697
05698
if (opts & OFLAG(r)) {
05699 pMenu =
HorPtoP(localItem.
spSubMenu, TYPE_MENU);
05700
if (pMenu && tryMove(localMenu, pMenu)) {
05701
DumpMenu(uIndent+8, opts, pMenu);
05702 }
05703 }
05704 }
05705 pitem++;
05706 i++;
05707 }
05708 }
05709 }
05710
05711
05712
BOOL Idm(
05713 DWORD opts,
05714 PVOID param1)
05715 {
05716
HANDLEENTRY he;
05717 PVOID pvObject;
05718
05719
if (param1 ==
NULL)
05720
return FALSE;
05721
05722 pvObject =
HorPtoP(
FIXKP(param1), -1);
05723
if (pvObject ==
NULL) {
05724 Print(
"dm: Could not convert 0x%p to an object.\n", pvObject);
05725
return TRUE;
05726 }
05727
05728
if (!
getHEfromP(NULL, &he, pvObject)) {
05729 Print(
"dm: Could not get header for object 0x%p.\n", pvObject);
05730
return TRUE;
05731 }
05732
05733
switch (he.
bType) {
05734
case TYPE_WINDOW:
05735 {
05736
WND wnd;
05737
05738 Print(
"--- Dump Menu for %s object @0x%p ---\n", pszObjStr[he.
bType],
FIXKP(pvObject));
05739
if (!tryMove(wnd, pvObject)) {
05740 Print(
"dm: Could not get copy of object 0x%p.\n", pvObject);
05741
return TRUE;
05742 }
05743
05744
if (opts & OFLAG(s)) {
05745
05746
05747
05748
if ((pvObject =
FIXKP(wnd.
spmenuSys)) ==
NULL) {
05749 Print(
"dm: This window does not have a system menu.\n");
05750
return TRUE;
05751 }
05752
05753 }
else {
05754
if (wnd.style & WS_CHILD) {
05755
05756
05757
05758 Print(
"dm: Child windows do not have menus.\n");
05759
return TRUE;
05760 }
05761
05762
if ((pvObject =
FIXKP(wnd.
spmenu)) ==
NULL) {
05763 Print(
"dm: This window does not have a menu.\n");
05764
return TRUE;
05765 }
05766 }
05767 }
05768
05769
05770
05771 case TYPE_MENU:
05772
DumpMenu(0, opts, (
PMENU)pvObject);
05773
break;
05774
05775
default:
05776
return FALSE;
05777 }
05778
05779
return TRUE;
05780 }
05781
05782
05783
05784
05785
05786
#ifdef KERNEL
05787
05788
05789
05790
05791
05792
05793
05794
05795
05796
05797
05798
BOOL Idmq(
05799 DWORD opts,
05800 PVOID param1)
05801 {
05802
THREADINFO ti;
05803
PQ pq;
05804
Q q;
05805
static DWORD dwPosted;
05806
static DWORD dwInput;
05807
static DWORD dwQueues, dwThreads;
05808
static PTHREADINFO ptiStatic;
05809
BOOL bMsgsPresent =
FALSE;
05810
05811
if (opts & OFLAG(c)) {
05812
if (param1 == 0) {
05813 Print(
"Summary of all message queues (\"age\" is newest time - oldest time)\n");
05814 }
else {
05815 Print(
"Summary of message queue (\"age\" is newest time - oldest time)\n");
05816 }
05817 Print(
"Queue # Input age \t Thread # Posted age\n");
05818 Print(
"======== ======== ========\t======== ======== ========\n");
05819 dwInput = dwPosted = 0;
05820 dwThreads = dwQueues = 0;
05821 }
05822
05823
if (param1 == 0) {
05824
if ((opts & OFLAG(a)) || (opts & OFLAG(c))) {
05825
05826 FOREACHPTI(ptiStatic);
05827
move(pq, &ptiStatic->
pq);
05828
if (pq == 0) {
05829 Print(
"Thread %lx has no queue\n", ptiStatic);
05830 }
else {
05831 Idmq(opts & OFLAG(c), pq);
05832 }
05833
move(pq, &ptiStatic->
pqAttach);
05834
if (pq) {
05835 Print(
"->");
05836 Idmq(opts & OFLAG(c), pq);
05837 }
05838 dwThreads++;
05839 NEXTEACHPTI(ptiStatic);
05840
05841
if (opts & OFLAG(c)) {
05842 Print(
"Queues # Input \t Threads # Posted\n");
05843 Print(
"======== ======== ========\t======== ========\n");
05844 Print(
"%8x %8x \t%8x %8x\n",
05845 dwQueues, dwPosted, dwThreads, dwPosted);
05846 }
05847
return TRUE;
05848 }
05849 }
05850
05851 pq = (
PQ)
FIXKP(param1);
05852
if (!tryMove(q, pq)) {
05853
if ((opts & OFLAG(c)) == 0) {
05854 Print(
"* Cannot get queue 0x%p: (skipped)\n", pq);
05855
return FALSE;
05856 }
else {
05857 Print(
"%lx - cannot get queue \t%lx", pq, ptiStatic);
05858
move(ti,
FIXKP(q.
ptiKeyboard));
05859
goto ShowThreadCount;
05860 }
05861 }
05862
if ((opts & OFLAG(c)) == 0) {
05863 Print(
"Messages for queue 0x%p\n", pq);
05864 }
05865
05866
if ((q.
ptiKeyboard == ptiStatic) || (q.
ptiMouse == ptiStatic)) {
05867 dwQueues++;
05868 }
05869
05870
if (q.
ptiKeyboard !=
NULL) {
05871
move(ti,
FIXKP(q.
ptiKeyboard));
05872
05873
if (!(opts & OFLAG(c)) && ti.
mlPost.
pqmsgRead) {
05874 bMsgsPresent =
TRUE;
05875 Print(
"==== PostMessage queue ====\n");
05876
if (ti.
mlPost.
pqmsgRead !=
NULL) {
05877 PrintMessages(
FIXKP(ti.
mlPost.
pqmsgRead));
05878 }
05879 }
05880 }
05881
05882
if (!(opts & OFLAG(c)) && q.
mlInput.
pqmsgRead) {
05883 bMsgsPresent =
TRUE;
05884 Print(
"==== Input queue ==========\n");
05885
if (q.
mlInput.
pqmsgRead !=
NULL) {
05886 PrintMessages(
FIXKP(q.
mlInput.
pqmsgRead));
05887 }
05888 }
05889
05890
if (opts & OFLAG(c)) {
05891
DWORD dwTimePosted;
05892
DWORD dwTimeInput = 0;
05893
DWORD dwOldest, dwNewest;
05894
05895
if (q.
mlInput.
cMsgs) {
05896 dwInput += q.
mlInput.
cMsgs;
05897
move(dwOldest,
FIXKP(&q.
mlInput.
pqmsgRead->
msg.time));
05898
move(dwNewest,
FIXKP(&q.
mlInput.
pqmsgWriteLast->
msg.time));
05899 dwTimeInput = dwNewest - dwOldest;
05900 }
05901 Print(
"%08x%c %8x %8x\t%08x",
05902 pq,
05903 ((q.
ptiKeyboard != ptiStatic) && (q.
ptiMouse != ptiStatic)) ?
'*' :
' ',
05904 q.
mlInput.
cMsgs, dwTimeInput,
05905 q.
ptiKeyboard);
05906
05907
05908
05909
05910
05911 ShowThreadCount:
05912 dwTimePosted = 0;
05913
if (ti.
mlPost.
cMsgs) {
05914 dwPosted += ti.
mlPost.
cMsgs;
05915
move(dwOldest,
FIXKP(&ti.
mlPost.
pqmsgRead->
msg.time));
05916
move(dwNewest,
FIXKP(&ti.
mlPost.
pqmsgWriteLast->
msg.time));
05917 dwTimePosted = dwNewest - dwOldest;
05918 }
05919 Print(
" %8x %8x\n", ti.
mlPost.
cMsgs, dwTimePosted);
05920 }
else {
05921
if (bMsgsPresent) {
05922 Print(
"\n");
05923 }
05924 }
05925
05926
return TRUE;
05927 }
05928
#endif KERNEL
05929
05930
05931
05932
05933
#ifdef KERNEL
05934
05935
05936
05937
05938
05939
05940
05941
05942
05943
05944
05945
BOOL Idwe(
05946 DWORD opts,
05947 PVOID param1)
05948 {
05949
EVENTHOOK EventHook, *pEventHook;
05950
NOTIFY Notify, *pNotify;
05951 PVOID pobj;
05952
char ach[100];
05953
05954 pobj =
FIXKP(param1);
05955
05956
if (opts & OFLAG(n)) {
05957
if (pobj) {
05958
move(Notify, pobj);
05959
sprintf(ach,
"NOTIFY 0x%p\n", pobj);
05960
Idso(0, ach);
05961
return 1;
05962 }
05963 moveExpValuePtr(&pNotify,
VAR(gpPendingNotifies));
05964 Print(
"Pending Notifications:\n");
05965
gnIndent += 2;
05966 SAFEWHILE (pNotify != NULL) {
05967
sprintf(ach,
"NOTIFY 0x%p\n", pNotify);
05968
Idso(0, ach);
05969
move(pNotify, &pNotify->
pNotifyNext);
05970 }
05971
gnIndent -= 2;
05972
return TRUE;
05973 }
05974
05975
if (pobj) {
05976
move(EventHook, pobj);
05977
sprintf(ach,
"EVENTHOOK 0x%p\n", pobj);
05978
Idso(0, ach);
05979
return 1;
05980 }
05981 moveExpValuePtr(&pEventHook,
VAR(gpWinEventHooks));
05982 Print(
"WinEvent hooks:\n");
05983
gnIndent += 2;
05984 SAFEWHILE (pEventHook != NULL) {
05985
sprintf(ach,
"EVENTHOOK 0x%p\n", pEventHook);
05986
Idso(0, ach);
05987
move(pEventHook, &pEventHook->
pehNext);
05988 }
05989
gnIndent -= 2;
05990 Print(
"\n");
05991
return TRUE;
05992 }
05993
#endif KERNEL
05994
05995
05996
05997
#ifndef KERNEL
05998
05999
06000
06001
06002
06003
06004
06005
06006
06007
06008
BOOL Idped(
06009 DWORD opts,
06010 PVOID param1)
06011 {
06012
PED ped;
06013
ED ed;
06014
DWORD pText;
06015
06016 UNREFERENCED_PARAMETER(opts);
06017
06018 ped = param1;
06019
06020
move(ed, ped);
06021
move(pText, ed.
hText);
06022
06023
06024 Print(
"PED Handle: %lX\n", ped);
06025 Print(
"hText %lX (%lX)\n", ed.
hText, pText);
06026
PRTFDW2(ed., cchAlloc, cchTextMax);
06027
PRTFDW2(ed., cch, cLines);
06028
PRTFDW2(ed., ichMinSel, ichMaxSel);
06029
PRTFDW2(ed., ichCaret, iCaretLine);
06030
PRTFDW2(ed., ichScreenStart, ichLinesOnScreen);
06031
PRTFDW2(ed., xOffset, charPasswordChar);
06032
PRTFDWDWP(ed., cPasswordCharWidth, hwnd);
06033
PRTFDWP1(ed., pwnd);
06034
PRTFRC(ed., rcFmt);
06035
PRTFDWP1(ed., hwndParent);
06036
PRTFPT(ed., ptPrevMouse);
06037
PRTFDW1(ed., prevKeys);
06038
06039
BEGIN_PRTFFLG();
06040
PRTFFLG(ed, fSingle);
06041
PRTFFLG(ed, fNoRedraw);
06042
PRTFFLG(ed, fMouseDown);
06043
PRTFFLG(ed, fFocus);
06044
PRTFFLG(ed, fDirty);
06045
PRTFFLG(ed, fDisabled);
06046
PRTFFLG(ed, fNonPropFont);
06047
PRTFFLG(ed, fNonPropDBCS);
06048
PRTFFLG(ed, fBorder);
06049
PRTFFLG(ed, fAutoVScroll);
06050
PRTFFLG(ed, fAutoHScroll);
06051
PRTFFLG(ed, fNoHideSel);
06052
PRTFFLG(ed, fDBCS);
06053
PRTFFLG(ed, fFmtLines);
06054
PRTFFLG(ed, fWrap);
06055
PRTFFLG(ed, fCalcLines);
06056
PRTFFLG(ed, fEatNextChar);
06057
PRTFFLG(ed, fStripCRCRLF);
06058
PRTFFLG(ed, fInDialogBox);
06059
PRTFFLG(ed, fReadOnly);
06060
PRTFFLG(ed, fCaretHidden);
06061
PRTFFLG(ed, fTrueType);
06062
PRTFFLG(ed, fAnsi);
06063
PRTFFLG(ed, fWin31Compat);
06064
PRTFFLG(ed, f40Compat);
06065
PRTFFLG(ed, fFlatBorder);
06066
PRTFFLG(ed, fSawRButtonDown);
06067
PRTFFLG(ed, fInitialized);
06068
PRTFFLG(ed, fSwapRoOnUp);
06069
PRTFFLG(ed, fAllowRTL);
06070
PRTFFLG(ed, fDisplayCtrl);
06071
PRTFFLG(ed, fRtoLReading);
06072
PRTFFLG(ed, fInsertCompChr);
06073
PRTFFLG(ed, fReplaceCompChr);
06074
PRTFFLG(ed, fNoMoveCaret);
06075
PRTFFLG(ed, fResultProcess);
06076
PRTFFLG(ed, fKorea);
06077
PRTFFLG(ed, fInReconversion);
06078
END_PRTFFLG();
06079
06080
PRTFDWDWP(ed., cbChar, chLines);
06081
PRTFDWDWP(ed., format, lpfnNextWord);
06082
PRTFDW1(ed., maxPixelWidth);
06083
06084 {
06085
const char* p =
"**INVALID**";
06086
06087
if (ed.undoType <
UNDO_DELETE) {
06088 p =
GetFlags(GF_EDUNDO, 0, NULL, TRUE);
06089 }
06090 Print(DWSTR2
"\t" "%08x undoType (%s)\n", ed.hDeletedText,
"hDeleteText", ed.undoType, p);
06091 }
06092
06093
PRTFDW2(ed., ichDeleted, cchDeleted);
06094
PRTFDW2(ed., ichInsStart, ichInsEnd);
06095
06096
PRTFDWPDW(ed., hFont, aveCharWidth);
06097
PRTFDW2(ed., lineHeight, charOverhang);
06098
PRTFDW2(ed., cxSysCharWidth, cySysCharHeight);
06099
PRTFDWP2(ed., listboxHwnd, pTabStops);
06100
PRTFDWP1(ed., charWidthBuffer);
06101
06102
PRTFDW1(ed., wMaxNegA);
06103
PRTFDW2(ed., wMaxNegAcharPos, wMaxNegC);
06104
PRTFDW2(ed., wMaxNegCcharPos, wLeftMargin);
06105
PRTFDW2(ed., wRightMargin, ichStartMinSel);
06106
PRTFDWDWP(ed., ichStartMaxSel, pLpkEditCallout);
06107
PRTFDWP2(ed., hCaretBitmap, hInstance);
06108
PRTFDW2(ed., seed, fEncoded);
06109
PRTFDW2(ed., iLockLevel, wImeStatus);
06110
return TRUE;
06111 }
06112
#endif // !KERNEL
06113
06114
06115
#ifndef KERNEL
06116
06117
06118
06119
06120
06121
06122
06123
06124
06125
06126
BOOL Idci()
06127 {
06128 TEB teb, *pteb;
06129
PCLIENTINFO pci;
06130
06131
if (
GetTargetTEB(&teb, &pteb)) {
06132 pci = (
PCLIENTINFO)&teb.Win32ClientInfo[0];
06133
06134 Print(
"PCLIENTINFO @ %p:\n", &pteb->Win32ClientInfo[0]);
06135
06136 Print(
"\tdwExpWinVer %08lx\n", pci->
dwExpWinVer);
06137
06138 Print(
"\tdwCompatFlags %08lx\n", pci->
dwCompatFlags);
06139
06140 Print(
"\tdwTIFlags %08lx\n", pci->
dwTIFlags);
06141
06142 Print(
"\tpDeskInfo %p\n", pci->
pDeskInfo);
06143
06144 Print(
"\tulClientDelta %p\n", pci->
ulClientDelta);
06145
06146 Print(
"\tphkCurrent %p\n", pci->
phkCurrent);
06147
06148 Print(
"\tfsHooks %08lx\n", pci->
fsHooks);
06149
06150 Print(
"\tCallbackWnd %08lx\n", pci->
CallbackWnd);
06151
06152 Print(
"\tcSpins %08lx\n", pci->
cSpins);
06153 Print(
"\tCodePage %d\n", pci->
CodePage);
06154
06155 }
else {
06156 Print(
"Unable to get TEB info.\n");
06157 }
06158
return TRUE;
06159 }
06160
#endif // !KERNEL
06161
06162
06163
06164
#ifdef KERNEL
06165
06166
06167
06168
06169
06170
06171
06172
06173
06174
06175
BOOL Idpi(
06176 DWORD opts,
06177 PVOID param1)
06178 {
06179 PW32PROCESS pW32Process;
06180
PPROCESSINFO ppi;
06181
PROCESSINFO pi;
06182
SERVERINFO si;
06183
SHAREDINFO shi;
06184
PSHAREDINFO pshi;
06185
DESKTOPVIEW dv;
06186
DWORD idProcess;
06187
06188
06189
06190
06191
if (opts & OFLAG(c)) {
06192 Print(
"Current Process:\n");
06193 param1 = (PVOID)GetCurrentProcessAddress(
06194 (USHORT)dwProcessor, hCurrentThread, NULL );
06195
06196
if (param1 == 0) {
06197 Print(
"Unable to get current process pointer.\n");
06198
return FALSE;
06199 }
06200
06201
if (
GetEProcessData(param1, PROCESS_WIN32PROCESS, &pW32Process) ==
NULL) {
06202 Print(
"Unable to read _EPROCESS at %lx\n", param1);
06203
return FALSE;
06204 }
06205 param1 = pW32Process;
06206 }
else if (param1 == 0) {
06207 Print(
"**** NT ACTIVE WIN32 PROCESSINFO DUMP ****\n");
06208 FOREACHPPI(ppi)
06209 Idpi(0, ppi);
06210 Print("\n");
06211 NEXTEACHPPI()
06212 return TRUE;
06213 }
06214
06215 ppi = FIXKP(param1);
06216
06217 if (!tryMove(pi, ppi)) {
06218 Print(
"Can't get PROCESSINFO from %x.\n", ppi);
06219
return FALSE;
06220 }
06221
06222
if (
GetEProcessData(pi.Process, PROCESS_PROCESSID, &idProcess) ==
NULL) {
06223 Print(
"Unable to read _EPROCESS at %lx\n",pi.Process);
06224
return FALSE;
06225 }
06226
06227 Print(
"---PPROCESSINFO @ 0x%p for process %x(%s):\n",
06228 ppi,
06229 idProcess,
06230
ProcessName(ppi));
06231 Print(
"\tppiNext @0x%p\n", pi.
ppiNext);
06232 Print(
"\trpwinsta @0x%p\n", pi.
rpwinsta);
06233 Print(
"\thwinsta 0x%08lx\n", pi.
hwinsta);
06234 Print(
"\tamwinsta 0x%08lx\n", pi.
amwinsta);
06235 Print(
"\tptiMainThread @0x%p\n", pi.
ptiMainThread);
06236 Print(
"\tcThreads 0x%08lx\n", pi.
cThreads);
06237 Print(
"\trpdeskStartup @0x%p\n", pi.
rpdeskStartup);
06238 Print(
"\thdeskStartup 0x%08lx\n", pi.
hdeskStartup);
06239 Print(
"\tpclsPrivateList @0x%p\n", pi.
pclsPrivateList);
06240 Print(
"\tpclsPublicList @0x%p\n", pi.
pclsPublicList);
06241 Print(
"\tflags %s\n",
06242
GetFlags(GF_W32PF, pi.W32PF_Flags, NULL, TRUE));
06243 Print(
"\tdwHotkey 0x%08lx\n", pi.
dwHotkey);
06244 Print(
"\tpWowProcessInfo @0x%p\n", pi.
pwpi);
06245 Print(
"\tluidSession 0x%08lx:0x%08lx\n", pi.
luidSession.HighPart,
06246 pi.
luidSession.LowPart);
06247 Print(
"\tdwX,dwY (0x%x,0x%x)\n", pi.
usi.
dwX, pi.
usi.
dwY);
06248 Print(
"\tdwXSize,dwYSize (0x%x,0x%x)\n", pi.
usi.
dwXSize, pi.
usi.
dwYSize);
06249 Print(
"\tdwFlags 0x%08x\n", pi.
usi.
dwFlags);
06250 Print(
"\twShowWindow 0x%04x\n", pi.
usi.
wShowWindow);
06251 Print(
"\tpCursorCache 0x%08x\n", pi.
pCursorCache);
06252 Print(
"\tdwLpkEntryPoints %s\n",
06253
GetFlags(GF_LPK, pi.
dwLpkEntryPoints, NULL, TRUE));
06254
06255
06256
06257
06258 dv.
pdvNext = pi.
pdvList;
06259 Print(
"Desktop views:\n");
06260
while (dv.
pdvNext !=
NULL) {
06261
if (!tryMove(dv, dv.
pdvNext))
06262
break;
06263 Print(
"\tpdesk = %08x, ulClientDelta = %08x\n", dv.
pdesk, dv.
ulClientDelta);
06264 }
06265
06266
06267
06268
06269
GETSHAREDINFO(pshi);
06270
move(shi, pshi);
06271
move(si, shi.
psi);
06272
06273
return TRUE;
06274 }
06275
#endif // KERNEL
06276
06277
06278
06279
#ifdef KERNEL
06280
06281
06282
06283
06284
06285
06286
06287
06288
06289
BOOL Idpm(
06290 DWORD opts,
06291 PVOID param1)
06292 {
06293
06294
PPOPUPMENU ppopupmenu;
06295
POPUPMENU localPopupMenu;
06296
06297 UNREFERENCED_PARAMETER(opts);
06298
06299 ppopupmenu = (
PPOPUPMENU)
FIXKP(param1);
06300
move(localPopupMenu, ppopupmenu);
06301
06302 Print(
"PPOPUPMENU @ 0x%lX\n", ppopupmenu);
06303
06304
BEGIN_PRTFFLG();
06305
PRTFFLG(localPopupMenu, fIsMenuBar);
06306
PRTFFLG(localPopupMenu, fHasMenuBar);
06307
PRTFFLG(localPopupMenu, fIsSysMenu);
06308
PRTFFLG(localPopupMenu, fIsTrackPopup);
06309
PRTFFLG(localPopupMenu, fDroppedLeft);
06310
PRTFFLG(localPopupMenu, fHierarchyDropped);
06311
PRTFFLG(localPopupMenu, fRightButton);
06312
PRTFFLG(localPopupMenu, fToggle);
06313
PRTFFLG(localPopupMenu, fSynchronous);
06314 PRTFFLG(localPopupMenu, fFirstClick);
06315
PRTFFLG(localPopupMenu, fDropNextPopup);
06316
PRTFFLG(localPopupMenu, fNoNotify);
06317
PRTFFLG(localPopupMenu, fAboutToHide);
06318
PRTFFLG(localPopupMenu, fShowTimer);
06319
PRTFFLG(localPopupMenu, fHideTimer);
06320
PRTFFLG(localPopupMenu, fDestroyed);
06321
PRTFFLG(localPopupMenu, fDelayedFree);
06322
PRTFFLG(localPopupMenu, fFlushDelayedFree);
06323
PRTFFLG(localPopupMenu, fFreed);
06324
PRTFFLG(localPopupMenu, fInCancel);
06325
PRTFFLG(localPopupMenu, fTrackMouseEvent);
06326
PRTFFLG(localPopupMenu, fSendUninit);
06327
END_PRTFFLG();
06328
06329
PRTFDWP2(localPopupMenu., spwndNotify, spwndPopupMenu);
06330
PRTFDWP2(localPopupMenu., spwndNextPopup, spwndPrevPopup);
06331
PRTFDWP2(localPopupMenu., spmenu, spmenuAlternate);
06332
PRTFDWP2(localPopupMenu., spwndActivePopup, ppopupmenuRoot);
06333
PRTFDWPDW(localPopupMenu., ppmDelayedFree, posSelectedItem);
06334
PRTFDW1(localPopupMenu., posDropped);
06335
06336
return TRUE;
06337 }
06338
#endif // KERNEL
06339
06340
#ifdef KERNEL
06341
06342
06343
06344
06345
06346
06347
06348
BOOL Idms(
06349 DWORD opts,
06350 PVOID param1)
06351 {
06352
06353
MENUSTATE *pms;
06354
MENUSTATE localms;
06355
06356 UNREFERENCED_PARAMETER(opts);
06357
06358 pms = (
PMENUSTATE)
FIXKP(param1);
06359
move(localms, pms);
06360
06361 Print(
"PMENUSTATE @ 0x%lX\n", pms);
06362
06363
BEGIN_PRTFFLG();
06364
PRTFFLG(localms, fMenuStarted);
06365
PRTFFLG(localms, fIsSysMenu);
06366
PRTFFLG(localms, fInsideMenuLoop);
06367
PRTFFLG(localms, fButtonDown);
06368
PRTFFLG(localms, fInEndMenu);
06369
PRTFFLG(localms, fUnderline);
06370
PRTFFLG(localms, fButtonAlwaysDown);
06371
PRTFFLG(localms, fDragging);
06372
PRTFFLG(localms, fModelessMenu);
06373
PRTFFLG(localms, fInCallHandleMenuMessages);
06374
PRTFFLG(localms, fDragAndDrop);
06375
PRTFFLG(localms, fAutoDismiss);
06376
PRTFFLG(localms, fIgnoreButtonUp);
06377
PRTFFLG(localms, fMouseOffMenu);
06378
PRTFFLG(localms, fInDoDragDrop);
06379
PRTFFLG(localms, fActiveNoForeground);
06380
PRTFFLG(localms, fNotifyByPos);
06381
END_PRTFFLG();
06382
06383
PRTFDWP1(localms., pGlobalPopupMenu);
06384
PRTFPT(localms., ptMouseLast);
06385
PRTFDW2(localms., mnFocus, cmdLast);
06386
PRTFDWP1(localms., ptiMenuStateOwner);
06387
06388
return TRUE;
06389 }
06390
#endif // KERNEL
06391
06392
06393
06394
#ifdef KERNEL
06395
06396
06397
06398
06399
06400
06401
06402
06403
06404
06405
BOOL Idq(
06406 DWORD opts,
06407 PVOID param1)
06408 {
06409
06410
char ach[80];
06411
PQ pq;
06412
Q q;
06413
06414
if (opts & OFLAG(a)) {
06415
PTHREADINFO pti;
06416 Print(
"Dumping all queues:\n");
06417
06418 FOREACHPTI(pti);
06419
move(pq, &pti->
pq);
06420 Idq(opts & ~OFLAG(a), pq);
06421 NEXTEACHPTI(pti);
06422
return TRUE;
06423
#ifdef SOME_OTHER_DELUSION
06424
HANDLEENTRY he, *phe;
06425
int i;
06426
06427
06428
FOREACHHANDLEENTRY(phe, he, i)
06429 if (he.bType == TYPE_INPUTQUEUE) {
06430 Idq(opts & ~OFLAG(a),
FIXKP(he.
phead));
06431 Print(
"\n");
06432 }
06433
NEXTEACHHANDLEENTRY()
06434 return TRUE;
06435 #endif
06436 }
06437
06438 if (param1 == 0) {
06439 Print(
"Dumping foreground queue:\n");
06440 moveExpValuePtr(&pq,
VAR(gpqForeground));
06441
if (pq ==
NULL) {
06442 Print(
"no foreground queue (gpqForeground == NULL)!\n");
06443
return TRUE;
06444 }
06445 }
else {
06446 pq = (
PQ)
FIXKP(param1);
06447 }
06448
06449
06450
06451
06452
move(q, pq);
06453
if (q.
ptiKeyboard) {
06454 Idt(OFLAG(p), q.
ptiKeyboard);
06455 }
06456
06457
06458
06459
06460
06461 Print(
"PQ @ 0x%p\n", pq);
06462 Print(
06463
"\tmlInput.pqmsgRead 0x%08lx\n"
06464
"\tmlInput.pqmsgWriteLast 0x%08lx\n"
06465
"\tmlInput.cMsgs 0x%08lx\n",
06466 q.
mlInput.
pqmsgRead,
06467 q.
mlInput.
pqmsgWriteLast,
06468 q.
mlInput.
cMsgs);
06469
06470 Print(
"\tptiSysLock 0x%08lx\n"
06471
"\tidSysLock 0x%08lx\n"
06472
"\tidSysPeek 0x%08lx\n",
06473 q.
ptiSysLock,
06474 q.
idSysLock,
06475 q.
idSysPeek);
06476
06477 Print(
"\tptiMouse 0x%08lx\n"
06478
"\tptiKeyboard 0x%08lx\n",
06479 q.
ptiMouse,
06480 q.
ptiKeyboard);
06481
06482 Print(
"\tspcurCurrent 0x%08lx\n"
06483
"\tiCursorLevel 0x%08lx\n",
06484 q.
spcurCurrent,
06485 q.
iCursorLevel);
06486
06487
DebugGetWindowTextA(q.
spwndCapture, ach);
06488 Print(
"\tspwndCapture 0x%08lx \"%s\"\n",
06489 q.
spwndCapture, ach);
06490
DebugGetWindowTextA(q.
spwndFocus, ach);
06491 Print(
"\tspwndFocus 0x%08lx \"%s\"\n",
06492 q.
spwndFocus, ach);
06493
DebugGetWindowTextA(q.
spwndActive, ach);
06494 Print(
"\tspwndActive 0x%08lx \"%s\"\n",
06495 q.
spwndActive, ach);
06496
DebugGetWindowTextA(q.
spwndActivePrev, ach);
06497 Print(
"\tspwndActivePrev 0x%08lx \"%s\"\n",
06498 q.
spwndActivePrev, ach);
06499
06500 Print(
"\tcodeCapture 0x%04lx\n"
06501
"\tmsgDblClk 0x%04lx\n"
06502
"\ttimeDblClk 0x%08lx\n",
06503 q.
codeCapture,
06504 q.
msgDblClk,
06505 q.
timeDblClk);
06506
06507 Print(
"\thwndDblClk 0x%08lx\n",
06508 q.
hwndDblClk);
06509
06510 Print(
"\tptDblClk { %d, %d }\n",
06511 q.
ptDblClk.x,
06512 q.
ptDblClk.y);
06513
06514 Print(
"\tQF_flags 0x%08lx %s\n"
06515
"\tcThreads 0x%08lx\n"
06516
"\tcLockCount 0x%08lx\n",
06517 q.
QF_flags,
GetFlags(GF_QF, q.
QF_flags, NULL, FALSE),
06518 (DWORD) q.
cThreads,
06519 (DWORD) q.
cLockCount);
06520
06521 Print(
"\tmsgJournal 0x%08lx\n"
06522
"\tExtraInfo 0x%08lx\n",
06523 q.
msgJournal,
06524 q.
ExtraInfo);
06525
06526
06527
06528
06529
if (opts & OFLAG(t)) {
06530 Idti(0, q.
ptiKeyboard);
06531 }
06532
return TRUE;
06533 }
06534
#endif // KERNEL
06535
06536
06537
06538
06539
06540
06541
06542
06543
06544
06545
06546
BOOL Idsbt(
06547 DWORD opts,
06548 PVOID param1)
06549 {
06550
SBTRACK sbt, *psbt;
06551 SBCALC sbc;
06552
06553 UNREFERENCED_PARAMETER(opts);
06554
06555
if (param1 == 0) {
06556 Print(
"Expected pSBTrack address\n");
06557
return FALSE;
06558 }
06559 psbt = (
PSBTRACK)param1;
06560
move(sbt, psbt);
06561
06562 Print(
"SBTrack:\n");
06563 Print(
" fHitOld %d\n", sbt.
fHitOld);
06564 Print(
" fTrackVert %d\n", sbt.
fTrackVert);
06565 Print(
" fCtlSB %d\n", sbt.
fCtlSB);
06566 Print(
" fTrackRecalc %d\n", sbt.
fTrackRecalc);
06567 Print(
" spwndSB 0x%08lx\n", sbt.
spwndSB);
06568 Print(
" spwndSBNotify 0x%08lx\n", sbt.
spwndSBNotify);
06569 Print(
" spwndTrack 0x%08lx\n", sbt.
spwndTrack);
06570 Print(
" cmdSB 0x%08lx\n", sbt.
cmdSB);
06571 Print(
" dpxThumb 0x%08lx\n", sbt.
dpxThumb);
06572 Print(
" posOld 0x%08lx\n", sbt.
posOld);
06573 Print(
" posNew 0x%08lx\n", sbt.
posNew);
06574 Print(
" pxOld 0x%08lx\n", sbt.
pxOld );
06575 Print(
" rcTrack (0x%08lx,0x%08lx,0x%08lx,0x%08lx)\n",
06576 sbt.
rcTrack.left,
06577 sbt.
rcTrack.top,
06578 sbt.
rcTrack.right,
06579 sbt.
rcTrack.bottom);
06580 Print(
" hTimerSB 0x%08lx\n", sbt.
hTimerSB );
06581 Print(
" xxxpfnSB 0x%08lx\n", sbt.
xxxpfnSB );
06582 Print(
" nBar %d\n", sbt.
nBar );
06583 Print(
" pSBCalc 0x%08lx\n", sbt.
pSBCalc );
06584
move(sbc, sbt.
pSBCalc);
06585 Print(
" pxTop 0x%08lx\n", sbc.
pxTop );
06586 Print(
" pxBottom 0x%08lx\n", sbc.
pxBottom);
06587 Print(
" pxLeft 0x%08lx\n", sbc.
pxLeft);
06588 Print(
" pxRight 0x%08lx\n", sbc.
pxRight);
06589 Print(
" cpxThumb 0x%08lx\n", sbc.
cpxThumb );
06590 Print(
" pxUpArrow 0x%08lx\n", sbc.
pxUpArrow );
06591 Print(
" pxDownArrow 0x%08lx\n", sbc.
pxDownArrow);
06592 Print(
" pxStart 0x%08lx\n", sbc.
pxStart);
06593 Print(
" pxThumbBottom 0x%08lx\n", sbc.
pxThumbBottom);
06594 Print(
" pxThumbTop 0x%08lx\n", sbc.
pxThumbTop );
06595 Print(
" cpx 0x%08lx\n", sbc.
cpx );
06596 Print(
" pxMin 0x%08lx\n", sbc.
pxMin );
06597 Print(
" pos 0x%08lx\n", sbc.pos );
06598 Print(
" posMin 0x%08lx\n", sbc.posMin );
06599 Print(
" posMax 0x%08lx\n", sbc.posMax );
06600 Print(
" page 0x%08lx\n", sbc.page );
06601
06602
06603
return TRUE;
06604 }
06605
06606
06607
06608
06609
06610
06611
06612
06613
06614
06615
06616
06617
06618
06619
BOOL Idsbwnd(
06620 DWORD opts,
06621 PVOID param1)
06622 {
06623
SBWND sbw, *psbw;
06624
06625 UNREFERENCED_PARAMETER(opts);
06626
06627
if (param1 == 0) {
06628 Print(
"Expected SB pwnd address\n");
06629
return FALSE;
06630 }
06631 psbw = (
PSBWND)param1;
06632
move(sbw, psbw);
06633
06634 Print(
"SBWnd:\n");
06635 Print(
" min %d\n", sbw.
SBCalc.posMin);
06636 Print(
" max %d\n", sbw.
SBCalc.posMax);
06637 Print(
" page %d\n", sbw.
SBCalc.page);
06638 Print(
" pos %d\n", sbw.
SBCalc.pos);
06639 Print(
" fVert %d\n", sbw.
fVert);
06640 Print(
" wDisableFlags %d\n", sbw.
wDisableFlags);
06641 Print(
" pxTop 0x%08lx\n", sbw.
SBCalc.
pxTop );
06642 Print(
" pxBottom 0x%08lx\n", sbw.
SBCalc.
pxBottom);
06643 Print(
" pxLeft 0x%08lx\n", sbw.
SBCalc.
pxLeft);
06644 Print(
" pxRight 0x%08lx\n", sbw.
SBCalc.
pxRight);
06645 Print(
" cpxThumb 0x%08lx\n", sbw.
SBCalc.
cpxThumb );
06646 Print(
" pxUpArrow 0x%08lx\n", sbw.
SBCalc.
pxUpArrow );
06647 Print(
" pxDownArrow 0x%08lx\n", sbw.
SBCalc.
pxDownArrow);
06648 Print(
" pxStart 0x%08lx\n", sbw.
SBCalc.
pxStart);
06649 Print(
" pxThumbBottom 0x%08lx\n", sbw.
SBCalc.
pxThumbBottom);
06650 Print(
" pxThumbTop 0x%08lx\n", sbw.
SBCalc.
pxThumbTop );
06651 Print(
" cpx 0x%08lx\n", sbw.
SBCalc.
cpx );
06652 Print(
" pxMin 0x%08lx\n", sbw.
SBCalc.
pxMin );
06653 Print(
" pos 0x%08lx\n", sbw.
SBCalc.pos );
06654 Print(
" posMin 0x%08lx\n", sbw.
SBCalc.posMin );
06655 Print(
" posMax 0x%08lx\n", sbw.
SBCalc.posMax );
06656 Print(
" page 0x%08lx\n", sbw.
SBCalc.page );
06657
return TRUE;
06658 }
06659
06660
06661
06662
06663
06664
06665
06666
BOOL Idsi(DWORD opts)
06667 {
06668
06669
SERVERINFO si;
06670
PSERVERINFO psi;
06671
int i;
06672
06673 moveExpValuePtr(&psi,
VAR(gpsi));
06674
06675 Print(
"PSERVERINFO @ 0x%p\n", psi);
06676
06677
move(si, psi);
06678
06679 Print(
"\tRIPFlags 0x%04lx %s\n", si.
wRIPFlags,
GetFlags(GF_RIP, si.
wRIPFlags, NULL, FALSE));
06680 Print(
"\tSRVIFlags 0x%04lx %s\n", si.
wSRVIFlags,
GetFlags(GF_SRVI, si.
wSRVIFlags, NULL, FALSE));
06681 Print(
"\tPUSIFlags 0x%08lx %s\n", si.PUSIFlags,
GetFlags(GF_SI, si.PUSIFlags, NULL, FALSE));
06682
06683 Print(
"\tcHandleEntries 0x%08lx\n"
06684
"\tcbHandleTable 0x%08lx\n"
06685
"\tnEvents 0x%08lx\n",
06686 si.
cHandleEntries,
06687 si.
cbHandleTable,
06688 si.nEvents);
06689
06690
if (opts & OFLAG(p)) {
06691 Print(
"\tmpFnidPfn:\n");
06692
for (i = 0; i <
FNID_ARRAY_SIZE; i++) {
06693 Print(
"\t\t[%d] = %08lx\n", i, si.
mpFnidPfn[i]);
06694 }
06695 }
06696
06697
if (opts & OFLAG(w)) {
06698 Print(
"\taStoCidPfn:\n");
06699
for (i = 0; i <
FNID_WNDPROCEND -
FNID_START + 1; i++) {
06700 Print(
"\t\t[%d] = %08lx\n", i, si.
aStoCidPfn[i]);
06701 }
06702 }
06703
06704
if (opts & OFLAG(b)) {
06705 Print(
"\tmpFnid_serverCBWndProc:\n");
06706
for (i = 0; i <
FNID_END -
FNID_START + 1; i++) {
06707 Print(
"\t\t[%d] = %08lx\n", i, si.
mpFnid_serverCBWndProc[i]);
06708 }
06709 }
06710
06711
if (opts & OFLAG(m)) {
06712
06713
06714
06715
06716
06717
static SYSMET_ENTRY aSysMet[SM_CMETRICS] = {
06718
SMENTRY(ARRANGE),
06719
SMENTRY(CXBORDER),
06720
SMENTRY(CYBORDER),
06721
SMENTRY(CYCAPTION),
06722
SMENTRY(CLEANBOOT),
06723
SMENTRY(CXCURSOR),
06724
SMENTRY(CYCURSOR),
06725
SMENTRY(DBCSENABLED),
06726
SMENTRY(DEBUG),
06727 SMENTRY(CXDLGFRAME),
06728
SMENTRY(CYDLGFRAME),
06729
SMENTRY(CXDOUBLECLK),
06730
SMENTRY(CYDOUBLECLK),
06731
SMENTRY(CXDRAG),
06732
SMENTRY(CYDRAG),
06733
SMENTRY(CXEDGE),
06734
SMENTRY(CYEDGE),
06735
SMENTRY(CXFRAME),
06736
SMENTRY(CYFRAME),
06737
SMENTRY(CXFULLSCREEN),
06738
SMENTRY(CYFULLSCREEN),
06739
SMENTRY(CXICON),
06740
SMENTRY(CYICON),
06741
SMENTRY(CXICONSPACING),
06742
SMENTRY(CYICONSPACING),
06743
SMENTRY(IMMENABLED),
06744
SMENTRY(CYKANJIWINDOW),
06745
SMENTRY(CXMAXIMIZED),
06746
SMENTRY(CYMAXIMIZED),
06747
SMENTRY(CXMAXTRACK),
06748
SMENTRY(CYMAXTRACK),
06749
SMENTRY(CYMENU),
06750
SMENTRY(CXMENUCHECK),
06751
SMENTRY(CYMENUCHECK),
06752
SMENTRY(MENUDROPALIGNMENT),
06753
SMENTRY(CXMENUSIZE),
06754
SMENTRY(CYMENUSIZE),
06755
SMENTRY(MIDEASTENABLED),
06756
SMENTRY(CXMIN),
06757
SMENTRY(CYMIN),
06758
SMENTRY(CXMINIMIZED),
06759
SMENTRY(CYMINIMIZED),
06760
SMENTRY(CXMINSPACING),
06761
SMENTRY(CYMINSPACING),
06762
SMENTRY(CXMINTRACK),
06763
SMENTRY(CYMINTRACK),
06764
SMENTRY(CMONITORS),
06765
SMENTRY(CMOUSEBUTTONS),
06766
SMENTRY(MOUSEPRESENT),
06767
SMENTRY(MOUSEWHEELPRESENT),
06768
SMENTRY(NETWORK),
06769
SMENTRY(PENWINDOWS),
06770
SMENTRY(RESERVED1),
06771
SMENTRY(RESERVED2),
06772
SMENTRY(RESERVED3),
06773
SMENTRY(RESERVED4),
06774
SMENTRY(SAMEDISPLAYFORMAT),
06775
SMENTRY(CXSCREEN),
06776
SMENTRY(CYSCREEN),
06777
SMENTRY(CXVSCROLL),
06778
SMENTRY(CYHSCROLL),
06779
SMENTRY(CYVSCROLL),
06780
SMENTRY(CXHSCROLL),
06781
SMENTRY(SECURE),
06782
SMENTRY(SHOWSOUNDS),
06783
SMENTRY(CXSIZE),
06784
SMENTRY(CYSIZE),
06785
SMENTRY(SLOWMACHINE),
06786
SMENTRY(CYSMCAPTION),
06787
SMENTRY(CXSMICON),
06788
SMENTRY(CYSMICON),
06789
SMENTRY(CXSMSIZE),
06790
SMENTRY(CYSMSIZE),
06791
SMENTRY(SWAPBUTTON),
06792
SMENTRY(CYVTHUMB),
06793
SMENTRY(CXHTHUMB),
06794
SMENTRY(UNUSED_64),
06795
SMENTRY(UNUSED_65),
06796
SMENTRY(UNUSED_66),
06797
SMENTRY(XVIRTUALSCREEN),
06798
SMENTRY(YVIRTUALSCREEN),
06799
SMENTRY(CXVIRTUALSCREEN),
06800
SMENTRY(CYVIRTUALSCREEN),
06801 };
06802
06803 Print(
"\taiSysMet:\n");
06804
for (i = 0; i < SM_CMETRICS; i++) {
06805 Print(
"\t\tSM_%-18s = 0x%08lx = %d\n",
06806 aSysMet[i].pstrMetric,
06807 si.aiSysMet[aSysMet[i].iMetric],
06808 si.aiSysMet[aSysMet[i].iMetric]);
06809 }
06810 }
06811
06812
if (opts & OFLAG(c)) {
06813
static LPSTR aszSysColor[COLOR_MAX] = {
06814
06815
"SCROLLBAR",
06816
"BACKGROUND",
06817
"ACTIVECAPTION",
06818
"INACTIVECAPTION",
06819
"MENU",
06820
"WINDOW",
06821
"WINDOWFRAME",
06822
"MENUTEXT",
06823
"WINDOWTEXT",
06824
"CAPTIONTEXT",
06825
"ACTIVEBORDER",
06826
"INACTIVEBORDER",
06827
"APPWORKSPACE",
06828
"HIGHLIGHT",
06829
"HIGHLIGHTTEXT",
06830
"BTNFACE",
06831
"BTNSHADOW",
06832
"GRAYTEXT",
06833
"BTNTEXT",
06834
"INACTIVECAPTIONTEXT",
06835
"BTNHIGHLIGHT",
06836
"3DDKSHADOW",
06837
"3DLIGHT",
06838
"INFOTEXT",
06839
"INFOBK",
06840
"3DALTFACE",
06841
"HOTLIGHT",
06842 };
06843 Print(
"\targbSystem:\n\t\tCOLOR%24sSYSRGB\tSYSHBR\n",
"");
06844
for (i = 0; i < COLOR_MAX; i++) {
06845 Print(
"\t\tCOLOR_%-21s: 0x%08lx\t0x%08lx\n",
06846 aszSysColor[i], si.argbSystem[i], si.ahbrSystem[i]);
06847 }
06848 }
06849
06850
if (opts & OFLAG(o)) {
06851 Print(
"\toembmi @ 0x%p:\n\t\tx \ty \tcx \tcy\n", &psi->oembmi);
06852
for (i = 0; i <
OBI_COUNT; i++) {
06853 Print(
"\tbm[%d]:\t%08x\t%08x\t%08x\t%08x\n",
06854 i,
06855 si.oembmi[i].x ,
06856 si.oembmi[i].y ,
06857 si.oembmi[i].cx,
06858 si.oembmi[i].cy);
06859 }
06860 Print(
06861
"\t\tPlanes = %d\n"
06862
"\t\tBitsPixel = %d\n"
06863
"\t\tBitCount = %d\n"
06864
"\t\tdmLogPixels = %d\n"
06865
"\t\trcScreen = (%d,%d)-(%d,%d) %dx%d\n"
06866 ,
06867 si.Planes ,
06868 si.BitsPixel ,
06869 si.BitCount ,
06870 (UINT) si.dmLogPixels,
06871 si.rcScreen.left,si.rcScreen.top,si.rcScreen.right,si.rcScreen.bottom,
06872 si.rcScreen.right-si.rcScreen.left, si.rcScreen.bottom-si.rcScreen.top);
06873
06874 }
06875
06876
if (opts & OFLAG(v)) {
06877 Print(
06878
"\tptCursor {%d, %d}\n"
06879
"\tgclBorder 0x%08lx\n"
06880
"\tdtScroll 0x%08lx\n"
06881
"\tdtLBSearch 0x%08lx\n"
06882
"\tdtCaretBlink 0x%08lx\n"
06883
"\tdwDefaultHeapBase 0x%08lx\n"
06884
"\tdwDefaultHeapSize 0x%08lx\n"
06885
"\twMaxLeftOverlapChars 0x%08lx\n"
06886
"\twMaxRightOverlapchars 0x%08lx\n"
06887
"\tuiShellMsg 0x%08lx\n"
06888
"\tcxSysFontChar 0x%08lx\n"
06889
"\tcySysFontChar 0x%08lx\n"
06890
"\tcxMsgFontChar 0x%08lx\n"
06891
"\tcyMsgFontChar 0x%08lx\n"
06892
"\ttmSysFont @ 0x%p\n"
06893
"\tatomIconSmProp 0x%04lx\n"
06894
"\tatomIconProp 0x%04lx\n"
06895
"\thIconSmWindows 0x%08lx\n"
06896
"\thIcoWindows 0x%08lx\n"
06897
"\thCaptionFont 0x%08lx\n"
06898
"\thMsgFont 0x%08lx\n"
06899
"\tatomContextHelpIdProp 0x%08lx\n",
06900 si.ptCursor.x,
06901 si.ptCursor.y,
06902 si.gclBorder,
06903 si.dtScroll,
06904 si.dtLBSearch,
06905 si.dtCaretBlink,
06906 si.
dwDefaultHeapBase,
06907 si.
dwDefaultHeapSize,
06908 si.wMaxLeftOverlapChars,
06909 si.wMaxRightOverlapChars,
06910 si.
uiShellMsg,
06911 si.cxSysFontChar,
06912 si.cySysFontChar,
06913 si.cxMsgFontChar,
06914 si.cyMsgFontChar,
06915 &psi->tmSysFont,
06916 si.
atomIconSmProp,
06917 si.
atomIconProp,
06918 si.hIconSmWindows,
06919 si.hIcoWindows,
06920 si.hCaptionFont,
06921 si.hMsgFont,
06922 si.
atomContextHelpIdProp);
06923 }
06924
06925
if (opts & OFLAG(h)) {
06926
SHAREDINFO shi;
06927
PSHAREDINFO pshi;
06928
06929
GETSHAREDINFO(pshi);
06930
move(shi, pshi);
06931 Print(
"\nSHAREDINFO @ 0x%p:\n", pshi);
06932 Print(
06933
"\taheList 0x%08lx\n",
06934 shi.
aheList);
06935 }
06936
06937
return TRUE;
06938 }
06939
06940
06941
#ifdef KERNEL
06942
06943
06944
06945
06946
06947
06948
06949
06950
06951
06952
06953
06954
06955
BOOL Idsms(
06956 DWORD opts,
06957 PVOID param1)
06958 {
06959
06960
SMS sms;
06961
PSMS psms;
06962
int c = 0;
06963
int cm = 0;
06964
06965
if ((opts & OFLAG(m)) || (param1 == 0)) {
06966 moveExpValuePtr(&psms,
VAR(gpsmsList));
06967
06968
if (psms ==
NULL) {
06969 Print(
"No send messages currently in the list.\n");
06970
return TRUE;
06971 }
06972
06973
if (opts & OFLAG(c)) {
06974
06975 SAFEWHILE (psms != NULL) {
06976
if ((
c % 400) == 0) {
06977 Print(
"%d (0x%lx)...\n", c, c);
06978 }
06979
c++;
06980
move(psms, &psms->psmsNext);
06981 }
06982 }
else if (opts & OFLAG(m)) {
06983
06984 SAFEWHILE (psms != NULL) {
06985
c++;
06986
move(sms, psms);
06987
if (sms.
message == PtrToUlong(param1)) {
06988 cm++;
06989 Idsms(opts & ~OFLAG(m), psms);
06990 }
06991 psms = sms.
psmsNext;
06992 }
06993 Print(
"%d messages == 0x%lx (out of a total of %d).\n", cm, param1, c);
06994
return TRUE;
06995 }
else {
06996 SAFEWHILE (psms != NULL) {
06997
c++;
06998
if (!Idsms(opts, psms)) {
06999 Print(
"%d (0x%lx) messages.\n", c, c);
07000
return FALSE;
07001 }
07002
move(psms, &psms->psmsNext);
07003 }
07004 }
07005 Print(
"%d (0x%lx) messages.\n", c, c);
07006
return TRUE;
07007 }
07008
07009 psms = (
PSMS)param1;
07010
07011 Print(
"PSMS @ 0x%p\n", psms);
07012
move(sms, psms);
07013
07014 Print(
"SEND: ");
07015
if (sms.
ptiSender !=
NULL) {
07016 Idt(OFLAG(p), sms.
ptiSender);
07017 }
else {
07018 Print(
"NULL\n");
07019 }
07020
07021
if (sms.
ptiReceiver !=
NULL) {
07022 Print(
"RECV: ");
07023 Idt(OFLAG(p), sms.
ptiReceiver);
07024 }
else {
07025 Print(
"NULL\n");
07026 }
07027
07028
if (opts & OFLAG(v)) {
07029
char ach[80];
07030
07031 Print(
"\tpsmsNext 0x%08lx\n"
07032 #
if DBG
07033
"\tpsmsSendList 0x%08lx\n"
07034
"\tpsmsSendNext 0x%08lx\n"
07035 #endif
07036
"\tpsmsReceiveNext 0x%08lx\n"
07037
"\ttSent 0x%08lx\n"
07038
"\tptiSender 0x%08lx\n"
07039
"\tptiReceiver 0x%08lx\n"
07040
"\tlRet 0x%08lx\n"
07041
"\tflags %s\n"
07042
"\twParam 0x%08lx\n"
07043
"\tlParam 0x%08lx\n"
07044
"\tmessage 0x%08lx\n",
07045 sms.
psmsNext,
07046 #
if DBG
07047 sms.psmsSendList,
07048 sms.psmsSendNext,
07049 #endif
07050 sms.
psmsReceiveNext,
07051 sms.
tSent,
07052 sms.
ptiSender,
07053 sms.
ptiReceiver,
07054 sms.
lRet,
07055
GetFlags(GF_SMS, (WORD)sms.
flags, NULL, TRUE),
07056 sms.
wParam,
07057 sms.
lParam,
07058 sms.
message);
07059
DebugGetWindowTextA(sms.
spwnd, ach);
07060 Print(
"\tspwnd 0x%08lx \"%s\"\n", sms.
spwnd, ach);
07061 }
07062
07063
#if DBG
07064
if (opts & OFLAG(l)) {
07065
DWORD idThread;
07066
PSMS psmsList;
07067
DWORD idThreadSender, idThreadReceiver;
07068
THREADINFO ti;
07069
07070 psmsList = sms.psmsSendList;
07071
if (psmsList ==
NULL) {
07072 Print(
"%x : Empty List\n", psms);
07073 }
else {
07074 Print(
"%x : [tidSender](msg)[tidReceiver]\n", psms);
07075 }
07076 SAFEWHILE (psmsList != NULL) {
07077
move(sms, psmsList);
07078
if (sms.
ptiSender ==
NULL) {
07079 idThread = 0;
07080 }
else {
07081
move(ti, sms.
ptiSender);
07082
move(idThreadSender, &(ti.pEThread->Cid.UniqueThread));
07083 }
07084
if (sms.
ptiReceiver ==
NULL) {
07085 idThread = 0;
07086 }
else {
07087
move(ti, sms.
ptiReceiver);
07088
move(idThreadReceiver, &(ti.pEThread->Cid.UniqueThread));
07089 }
07090 Print(
"%x : [%x](%x)[%x]\n", psmsList, idThreadSender, sms.
message,
07091 idThreadReceiver);
07092
07093
if (psmsList == sms.psmsSendNext) {
07094 Print(
"Loop in list?\n");
07095
return FALSE;
07096 }
07097
07098 psmsList = sms.psmsSendNext;
07099 }
07100 Print(
"\n");
07101 }
07102
#endif
07103
return TRUE;
07104 }
07105
#endif // KERNEL
07106
07107
07108
07109
#ifdef KERNEL
07110
07111
07112
07113
07114
07115
07116
07117
07118
07119
07120
07121
07122
07123
BOOL DumpThread(
07124 DWORD opts,
07125
PETHREAD pEThread)
07126 {
07127
ETHREAD EThread;
07128 WCHAR ach[256];
07129
THREADINFO ti;
07130
PTHREADINFO pti;
07131
CLIENTTHREADINFO cti;
07132
SMS sms;
07133
07134
if (!tryMove(EThread, pEThread)) {
07135 Print(
"Unable to read _ETHREAD at %lx\n",pEThread);
07136
return FALSE;
07137 }
07138
07139 pti = EThread.
Tcb.
Win32Thread;
07140
if (!tryMove(ti, pti)) {
07141
if (!(opts & OFLAG(g))) {
07142 Print(
" et 0x%08lx t 0x???????? q 0x???????? i %2x.%-3lx <unknown name>\n",
07143 pEThread,
07144 EThread.
Cid.UniqueProcess,
07145 EThread.
Cid.UniqueThread);
07146 }
07147
return TRUE;
07148 }
07149
07150
if (ti.pEThread != pEThread || pti ==
NULL) {
07151
return FALSE;
07152 }
else {
07153
07154
07155
07156
07157
07158
07159
if (!(opts & OFLAG(v))) {
07160 PWCHAR pwch;
07161
07162 GetAppName(&EThread, &ti, ach,
sizeof(ach));
07163 pwch = wcsrchr(ach,
L'\\');
07164
if (pwch ==
NULL) {
07165 pwch = ach;
07166 }
else {
07167 pwch++;
07168 }
07169
07170 Print(
" et 0x%08lx t 0x%08lx q 0x%08lx i %2x.%-3lx %ws\n",
07171 pEThread,
07172 pti,
07173 ti.
pq,
07174 EThread.
Cid.UniqueProcess,
07175 EThread.
Cid.UniqueThread,
07176 pwch);
07177
07178
07179
07180
07181
if (opts & OFLAG(s)) {
07182
#define DT_INDENT "\t"
07183
move(cti, ti.
pcti);
07184
07185
if (cti.
fsWakeMask == 0) {
07186 Print(DT_INDENT
"Not waiting for USER input events.\n");
07187 }
else if ((cti.
fsWakeMask & (QS_ALLINPUT | QS_EVENT)) == (QS_ALLINPUT | QS_EVENT)) {
07188 Print(DT_INDENT
"Waiting for any USER input event (== in GetMessage).\n");
07189 }
else if ((cti.
fsWakeMask == (QS_SMSREPLY | QS_SENDMESSAGE))
07190 || (cti.
fsWakeMask == QS_SMSREPLY)) {
07191
move(sms, ti.
psmsSent);
07192 Print(DT_INDENT
"Waiting on thread %#lx to reply to this SendMessage:\n", sms.
ptiReceiver);
07193 Print(DT_INDENT
"pwnd:%#lx message:%#lx wParam:%#lx lParam:%#lx\n",
07194 sms.
spwnd, sms.
message, sms.
wParam, sms.
lParam);
07195
if (cti.
fsChangeBits & QS_SMSREPLY) {
07196 Print(DT_INDENT
"The receiver thread has replied to the message.\n");
07197 }
07198 }
else {
07199 Print(DT_INDENT
"Waiting for: %s\n",
07200
GetFlags(
GF_QS, (WORD)cti.
fsWakeMask,
NULL,
TRUE));
07201 }
07202 }
07203
07204 }
else {
07205 Idti(0, pti);
07206 Print(
"--------\n");
07207 }
07208 }
07209
return TRUE;
07210 }
07211
07212
void DumpProcessThreads(
07213 DWORD opts,
07214
PEPROCESS pEProcess,
07215 ULONG_PTR ThreadToDump)
07216 {
07217 PW32PROCESS pW32Process;
07218
PETHREAD pEThread;
07219
ETHREAD EThread;
07220 LIST_ENTRY ThreadList;
07221 PLIST_ENTRY ThreadListHead;
07222 PLIST_ENTRY NextThread;
07223
07224
07225
07226
07227
if ((
GetEProcessData(pEProcess, PROCESS_WIN32PROCESS,&pW32Process) ==
NULL)
07228 || (pW32Process ==
NULL)) {
07229
return;
07230 }
07231
07232 ThreadListHead =
GetEProcessData(pEProcess, PROCESS_THREADLIST, &ThreadList);
07233
if (ThreadListHead ==
NULL) {
07234
return;
07235 }
07236
07237 NextThread = ThreadList.Flink;
07238
07239 SAFEWHILE ( NextThread != ThreadListHead) {
07240 pEThread = (
PETHREAD)(CONTAINING_RECORD(NextThread,
KTHREAD, ThreadListEntry));
07241
07242
if (!tryMove(EThread, pEThread)) {
07243 Print(
"Unable to read _ETHREAD at %#p\n",pEThread);
07244
break;
07245 }
07246 NextThread = ((
PKTHREAD)&EThread)->ThreadListEntry.Flink;
07247
07248
07249
07250
07251
07252
if (ThreadToDump == 0 ||
07253
07254 (ThreadToDump <
UserProbeAddress &&
07255 ThreadToDump == (ULONG_PTR)EThread.
Cid.UniqueThread) ||
07256
07257 (ThreadToDump >=
UserProbeAddress &&
07258 ThreadToDump == (ULONG_PTR)pEThread)) {
07259
07260
if (!DumpThread(opts, pEThread) && ThreadToDump != 0) {
07261 Print(
"Sorry, EThread %#p is not a Win32 thread.\n",
07262 pEThread);
07263 }
07264
07265
if (ThreadToDump != 0) {
07266
return;
07267 }
07268
07269 }
07270 }
07271 }
07272
07273
BOOL Idt(
07274 DWORD opts,
07275 PVOID param1)
07276 {
07277 ULONG_PTR ThreadToDump;
07278 LIST_ENTRY
List;
07279 PLIST_ENTRY NextProcess;
07280 PLIST_ENTRY ProcessHead;
07281
PEPROCESS pEProcess;
07282
PETHREAD pEThread;
07283
THREADINFO ti;
07284
PTHREADINFO pti;
07285
07286 ThreadToDump = (ULONG_PTR)param1;
07287
07288
07289
07290
07291
if (opts & OFLAG(p)) {
07292
if (!param1) {
07293 Print(
"Expected a pti parameter.\n");
07294
return FALSE;
07295 }
07296
07297 pti =
FIXKP(param1);
07298
07299
if (pti ==
NULL) {
07300 Print(
"WARNING: bad pti given!\n");
07301 pti = param1;
07302 }
else {
07303
move(ti, pti);
07304
if (!DumpThread(opts, ti.pEThread)) {
07305
07306
07307
07308
07309
07310 Print(
"Sorry, EThread %x is not a Win32 thread.\n",
07311 ti.pEThread);
07312
return FALSE;
07313 }
07314
return TRUE;
07315 }
07316 }
07317
07318
07319
07320
07321
if (opts & OFLAG(c)) {
07322 Print(
"Current Thread:");
07323 ThreadToDump = (ULONG_PTR)GetCurrentThreadAddress(
07324 (USHORT)dwProcessor, hCurrentThread );
07325
07326
if (ThreadToDump == 0) {
07327 Print(
"Unable to get current thread pointer.\n");
07328
return FALSE;
07329 }
07330 pEThread = (
PETHREAD)ThreadToDump;
07331
if (!DumpThread(opts, pEThread)) {
07332
07333
07334
07335
07336
07337 Print(
"Sorry, EThread %x is not a Win32 thread.\n",
07338 pEThread);
07339
return FALSE;
07340 }
07341
return TRUE;
07342
07343
07344
07345 }
else if (ThreadToDump == 0) {
07346 Print(
"**** NT ACTIVE WIN32 THREADINFO DUMP ****\n");
07347 }
07348
07349 ProcessHead = EvalExp(
"PsActiveProcessHead" );
07350
if (!ProcessHead) {
07351 Print(
"Unable to get value of PsActiveProcessHead\n");
07352
return FALSE;
07353 }
07354
07355
if (!tryMove(List, ProcessHead)) {
07356 Print(
"Unable to get value of PsActiveProcessHead\n");
07357
return FALSE;
07358 }
07359 NextProcess =
List.Flink;
07360
if (NextProcess ==
NULL) {
07361 Print(
"PsActiveProcessHead->Flink is NULL!\n");
07362
return FALSE;
07363 }
07364
07365 SAFEWHILE(NextProcess != ProcessHead) {
07366 pEProcess =
GetEProcessData((
PEPROCESS)NextProcess,
07367 PROCESS_PROCESSHEAD,
07368 NULL);
07369
07370
if (
GetEProcessData(pEProcess, PROCESS_PROCESSLINK,
07371 &List) ==
NULL) {
07372 Print(
"Unable to read _EPROCESS at %lx\n",pEProcess);
07373
break;
07374 }
07375 NextProcess =
List.Flink;
07376
07377 DumpProcessThreads(opts, pEProcess, ThreadToDump);
07378
07379 }
07380
07381
if (opts & OFLAG(c)) {
07382 Print(
"%x is not a windows thread.\n", ThreadToDump);
07383 }
07384
07385
return TRUE;
07386 }
07387
#endif // KERNEL
07388
07389
#ifdef KERNEL
07390
07391
07392
07393
07394
07395
07396
BOOL DumpProcess(
07397 DWORD opts,
07398
PEPROCESS pEProcess)
07399 {
07400
EPROCESS EProcess;
07401 WCHAR ach[256];
07402
PROCESSINFO pi;
07403
PPROCESSINFO ppi;
07404
07405
if (!tryMove(EProcess, pEProcess)) {
07406 Print(
"Unable to read _EPROCESS at %lx\n",pEProcess);
07407
return FALSE;
07408 }
07409
07410 ppi =
PpiFromProcess(&EProcess);
07411
07412
if (!tryMove(pi, ppi)) {
07413 Print(
"sid %2d ep 0x%08lx p 0x???????? f 0x???????? i %2x <unknown name>\n",
07414 EProcess.
SessionId,
07415 pEProcess,
07416 EProcess.
UniqueProcessId);
07417
return TRUE;
07418 }
07419
07420
if (pi.Process != pEProcess || ppi ==
NULL) {
07421
return FALSE;
07422 }
else {
07423
07424
07425
07426
07427
if (!(opts & OFLAG(v))) {
07428 PWCHAR pwch;
07429
07430 GetProcessName(pEProcess, ach);
07431 pwch = wcsrchr(ach, L
'\\');
07432
if (pwch ==
NULL) {
07433 pwch = ach;
07434 }
else {
07435 pwch++;
07436 }
07437
07438 Print(
"sid %2d ep 0x%08lx p 0x%08lx f 0x%08lx i %2x %ws\n",
07439 EProcess.
SessionId,
07440 pEProcess,
07441 ppi,
07442 pi.W32PF_Flags,
07443 EProcess.
UniqueProcessId,
07444 pwch);
07445 }
else {
07446 Idpi(0, ppi);
07447 Print(
"--------\n");
07448 }
07449
07450
07451
07452
07453
if (opts & OFLAG(t)) {
07454 DumpProcessThreads(opts, pEProcess, 0);
07455 }
07456 }
07457
return TRUE;
07458 }
07459
07460
BOOL Idp(
07461 DWORD opts,
07462 PVOID param1)
07463 {
07464 ULONG_PTR ProcessToDump;
07465
PROCESSINFO pi;
07466
PPROCESSINFO ppi;
07467
PEPROCESS pEProcess;
07468
EPROCESS EProcess;
07469 LIST_ENTRY
List;
07470 PLIST_ENTRY NextProcess;
07471 PLIST_ENTRY ProcessHead;
07472 PW32PROCESS pW32Process;
07473
07474 ProcessToDump = (ULONG_PTR)param1;
07475
07476
07477
07478
07479
if (opts & OFLAG(p)) {
07480
if (!param1) {
07481 Print(
"Expected a ppi parameter.\n");
07482
return FALSE;
07483 }
07484
07485 ppi =
FIXKP(param1);
07486
07487
if (ppi ==
NULL) {
07488 Print(
"WARNING: bad ppi given!\n");
07489 ppi = param1;
07490 }
else {
07491
move(pi, ppi);
07492
if (!DumpProcess(opts, pi.Process)) {
07493 Print(
"Sorry, EProcess %x is not a Win32 process.\n",
07494 pi.Process);
07495
return FALSE;
07496 }
07497
return TRUE;
07498 }
07499 }
07500
07501
07502
07503
07504
if (opts & OFLAG(c)) {
07505 Print(
"Current Process:");
07506 ProcessToDump = (ULONG_PTR)GetCurrentProcessAddress(
07507 (USHORT)dwProcessor, hCurrentThread, NULL);
07508
07509
if (ProcessToDump == 0) {
07510 Print(
"Unable to get current process pointer.\n");
07511
return FALSE;
07512 }
07513 pEProcess = (
PEPROCESS)ProcessToDump;
07514
if (!DumpProcess(opts, pEProcess)) {
07515 Print(
"Sorry, EProcess %x is not a Win32 process.\n", pEProcess);
07516
return FALSE;
07517 }
07518
return TRUE;
07519
07520
07521
07522 }
else if (ProcessToDump == 0) {
07523 Print(
"**** NT ACTIVE WIN32 PROCESSINFO DUMP ****\n");
07524 }
07525
07526 ProcessHead = EvalExp(
"PsActiveProcessHead" );
07527
if (!ProcessHead) {
07528 Print(
"Unable to get value of PsActiveProcessHead\n");
07529
return FALSE;
07530 }
07531
07532
if (!tryMove(List, ProcessHead)) {
07533 Print(
"Unable to get value of PsActiveProcessHead\n");
07534
return FALSE;
07535 }
07536 NextProcess =
List.Flink;
07537
if (NextProcess ==
NULL) {
07538 Print(
"PsActiveProcessHead->Flink is NULL!\n");
07539
return FALSE;
07540 }
07541
07542 SAFEWHILE(NextProcess != ProcessHead) {
07543 pEProcess =
GetEProcessData((
PEPROCESS)NextProcess,
07544 PROCESS_PROCESSHEAD,
07545 NULL);
07546
07547
if (
GetEProcessData(pEProcess, PROCESS_PROCESSLINK,
07548 &List) ==
NULL) {
07549 Print(
"Unable to read _EPROCESS at %#p\n",pEProcess);
07550
break;
07551 }
07552 NextProcess =
List.Flink;
07553
07554
07555
07556
07557
if (
GetEProcessData(pEProcess, PROCESS_WIN32PROCESS,
07558 &pW32Process) ==
NULL || pW32Process ==
NULL) {
07559
continue;
07560 }
07561
07562
if (!tryMove(EProcess, pEProcess)) {
07563 Print(
"Unable to read _EPROCESS at %lx\n",pEProcess);
07564
break;
07565 }
07566
07567
07568
07569
07570
if (ProcessToDump == 0 ||
07571
07572 (ProcessToDump <
UserProbeAddress &&
07573 ProcessToDump == (ULONG_PTR)EProcess.
UniqueProcessId) ||
07574
07575 (ProcessToDump >=
UserProbeAddress &&
07576 ProcessToDump == (ULONG_PTR)pEProcess)) {
07577
07578
if (!DumpProcess(opts, pEProcess)
07579 && (ProcessToDump != 0)) {
07580 Print(
"Sorry, EProcess %#p is not a Win32 process.\n",
07581 pEProcess);
07582 }
07583
07584
if (ProcessToDump != 0) {
07585
return TRUE;
07586 }
07587 }
07588
07589 }
07590
07591
if (opts & OFLAG(c)) {
07592 Print(
"%#p is not a windows process.\n", ProcessToDump);
07593 }
07594
07595
return TRUE;
07596 }
07597
#endif // KERNEL
07598
07599
07600
07601
#ifdef KERNEL
07602
07603
07604
07605
07606
07607
07608
07609
07610
BOOL Idtdb(
07611 DWORD opts,
07612 PVOID param1)
07613 {
07614
07615
PTDB ptdb;
07616
TDB tdb;
07617
PTHREADINFO pti;
07618
07619 UNREFERENCED_PARAMETER(opts);
07620
07621
if (param1 == 0) {
07622 Print(
"Dumping all ptdbs:\n");
07623 FOREACHPTI(pti)
07624 move(ptdb, &pti->ptdb);
07625 SAFEWHILE (ptdb) {
07626 Idtdb(0, ptdb);
07627
move(ptdb, &ptdb->ptdbNext);
07628 }
07629 NEXTEACHPTI(pti)
07630 return TRUE;
07631 }
07632
07633 ptdb = (
PTDB)param1;
07634
07635 if (ptdb == NULL) {
07636 Print(
"Must supply a TDB address.\n");
07637
return FALSE;
07638 }
07639
07640
move(tdb, ptdb);
07641
07642 Print(
"TDB (non preemptive scheduler task database) @ 0x%p\n", ptdb);
07643 Print(
"\tptdbNext @0x%p\n", tdb.
ptdbNext);
07644 Print(
"\tnEvents 0x%08lx\n", tdb.
nEvents);
07645 Print(
"\tnPriority 0x%08lx\n", tdb.
nPriority);
07646 Print(
"\tpti @0x%p\n", tdb.
pti);
07647
return TRUE;
07648 }
07649
#endif // KERNEL
07650
07651
#ifndef KERNEL
07652
07653
07654
07655
07656
07657
07658
07659
07660
07661
07662
BOOL Ikbp()
07663 {
07664
static HANDLE ghToken =
NULL;
07665
BOOL fFirstTry =
FALSE;
07666
NTSTATUS Status;
07667
07668
#if 0
07669
07670
07671
07672
if (ghToken ==
NULL) {
07673 LUID luid;
07674 TOKEN_PRIVILEGES tp, tpPrevious;
07675
DWORD cbSizePrevious, dwGLE;
07676
07677 fFirstTry =
TRUE;
07678
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &ghToken)) {
07679 Print(
"!kbp failed to open process token. GLE:%d\n", GetLastError());
07680
goto TryItAnyway;
07681 }
07682
if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid)) {
07683 Print(
"!kbp failed to lookup debug privilege. GLE:%d\n", GetLastError());
07684
goto TryItAnyway;
07685 }
07686
07687
07688
07689 tp.PrivilegeCount = 1;
07690 tp.Privileges[0].Luid = luid;
07691 tp.Privileges[0].Attributes = 0;
07692 AdjustTokenPrivileges(ghToken, FALSE, &tp,
sizeof(TOKEN_PRIVILEGES), &tpPrevious,&cbSizePrevious);
07693 dwGLE = GetLastError();
07694
if (dwGLE != ERROR_SUCCESS) {
07695 Print(
"!kbp failed to get current privilege setting. GLE:%d\n", dwGLE);
07696
goto TryItAnyway;
07697 }
07698
07699
07700
07701 tpPrevious.PrivilegeCount = 1;
07702 tpPrevious.Privileges[0].Luid = luid;
07703 tpPrevious.Privileges[0].Attributes |= SE_PRIVILEGE_ENABLED;
07704 AdjustTokenPrivileges(ghToken, FALSE, &tpPrevious,cbSizePrevious, NULL, NULL);
07705 dwGLE = GetLastError();
07706
if (dwGLE != ERROR_SUCCESS) {
07707 Print(
"!kbp failed to get adjust privilege setting. GLE:%d\n", dwGLE);
07708
goto TryItAnyway;
07709 }
07710
07711 CloseHandle(ghToken);
07712 fFirstTry =
FALSE;
07713 }
07714
07715
07716 TryItAnyway:
07717
if (fFirstTry && (ghToken !=
NULL)) {
07718 CloseHandle(ghToken);
07719 }
07720
#endif
07721
07722
Status =
NtSystemDebugControl(SysDbgBreakPoint, NULL, 0, NULL, 0, NULL);
07723
if (!
NT_SUCCESS(Status)) {
07724 Print(
"!kbp NtSystemDebugControl failed. Status:%#lx\n", Status);
07725
if (fFirstTry) {
07726 ghToken =
NULL;
07727 }
07728
return FALSE;
07729 }
else {
07730
return TRUE;
07731 }
07732 }
07733
07734
#endif // !KERNEL
07735
07736
#ifndef KERNEL
07737
07738
07739
07740
07741
07742
07743
07744
07745
07746
07747
BOOL Icbp(VOID)
07748 {
07749
DWORD dwProcessId;
07750
DWORD dwThreadId;
07751
BOOL fServerProcess;
07752
USER_API_MSG m;
07753
PACTIVATEDEBUGGERMSG a = &m.
u.ActivateDebugger;
07754
07755 moveExpValue(&fServerProcess,
VAR(gfServerProcess));
07756
07757
if (fServerProcess) {
07758 Print(
"Already debugging server process!\n");
07759 }
else {
07760
07761
07762
07763 dwThreadId =
GetWindowThreadProcessId(
GetDesktopWindow(), &dwProcessId);
07764 a->
ClientId.UniqueProcess = (HANDLE)LongToHandle(dwProcessId);
07765 a->
ClientId.UniqueThread = (HANDLE)LongToHandle(dwThreadId);
07766
07767
07768
07769
07770
CsrClientCallServer( (PCSR_API_MSG)&m,
07771 NULL,
07772 CSR_MAKE_API_NUMBER( USERSRV_SERVERDLL_INDEX,
07773 UserpActivateDebugger
07774 ),
07775
sizeof(*a)
07776 );
07777 }
07778
07779
return TRUE;
07780 }
07781
07782
#endif // !KERNEL
07783
07784
#ifndef KERNEL
07785
07786
07787
07788
07789
07790
07791
07792
07793
07794
07795
BOOL Idteb()
07796 {
07797 TEB teb, *pteb;
07798
07799
if (
GetTargetTEB(&teb, &pteb)) {
07800 Print(
"TEB @ 0x%p:\n", pteb);
07801
07802
07803
07804
07805
07806
07807
07808
07809
07810
07811 Print(
"\tClientId %08lx\n", teb.ClientId);
07812
07813
07814
07815
07816 Print(
"\tLastErrorValue %08lx\n", teb.LastErrorValue);
07817
07818 Print(
"\tCountOfOwnedCriticalSections %08lx\n", teb.CountOfOwnedCriticalSections);
07819
07820 Print(
"\tWin32ThreadInfo(pti) %p\n", teb.Win32ThreadInfo);
07821
07822
07823
07824
07825
07826 Print(
"\tWin32ClientInfo[0](pci) %08lx\n", teb.Win32ClientInfo[0]);
07827
07828
07829
07830
07831 Print(
"\tWin32ClientInfo(pcti) @%p\n", &pteb->Win32ClientInfo[0]);
07832
07833
07834 Print(
"\tGdiClientPID %08lx\n", teb.GdiClientPID);
07835
07836 Print(
"\tGdiClientTID %08lx\n", teb.GdiClientTID);
07837
07838 Print(
"\tGdiThreadLocalInfo %08lx\n", teb.GdiThreadLocalInfo);
07839
07840
07841
07842
07843
07844
07845
07846
07847
07848
07849
07850
07851
07852
07853
07854
07855
07856 }
else {
07857 Print(
"Unable to get TEB info.\n");
07858 }
07859
return TRUE;
07860 }
07861
#endif // !KERNEL
07862
07863
07864
#ifdef KERNEL
07865
typedef struct _tagBASECHARSET {
07866 LPSTR pstrCS;
07867
DWORD dwValue;
07868 } BASECHARSET;
07869
07870 BASECHARSET CrackCS[] = {
07871 {
"ANSI_CHARSET" ,0 },
07872 {
"DEFAULT_CHARSET" ,1 },
07873 {
"SYMBOL_CHARSET" ,2 },
07874 {
"SHIFTJIS_CHARSET" ,128 },
07875 {
"HANGEUL_CHARSET" ,129 },
07876 {
"GB2312_CHARSET" ,134 },
07877 {
"CHINESEBIG5_CHARSET" ,136 },
07878 {
"OEM_CHARSET" ,255 },
07879 {
"JOHAB_CHARSET" ,130 },
07880 {
"HEBREW_CHARSET" ,177 },
07881 {
"ARABIC_CHARSET" ,178 },
07882 {
"GREEK_CHARSET" ,161 },
07883 {
"TURKISH_CHARSET" ,162 },
07884 {
"THAI_CHARSET" ,222 },
07885 {
"EASTEUROPE_CHARSET" ,238 },
07886 {
"RUSSIAN_CHARSET" ,204 },
07887 {
"MAC_CHARSET" ,77 }};
07888
07889
07890
07891
07892
07893
07894
07895
07896
07897
BOOL Idkl(
07898 DWORD opts,
07899 PVOID param1)
07900 {
07901 LIST_ENTRY
List;
07902 LIST_ENTRY ThreadList;
07903 PLIST_ENTRY NextProcess;
07904 PLIST_ENTRY NextThread;
07905 PLIST_ENTRY ProcessHead;
07906 PLIST_ENTRY ThreadListHead;
07907
PEPROCESS pEProcess;
07908 PW32PROCESS pW32Process;
07909
PETHREAD pEThread;
07910
ETHREAD EThread;
07911 WCHAR ach[256];
07912
THREADINFO ti;
07913
PTHREADINFO pti;
07914
KL kl, *pkl, *pklAnchor;
07915
KBDFILE kf;
07916 KBDTABLES KbdTbl;
07917
int i;
07918
int nThread;
07919
07920
07921
if (opts & OFLAG(k)) {
07922
goto display_layouts;
07923 }
07924
07925
if (param1 == 0) {
07926 Print(
"Using gspklBaseLayout\n");
07927 moveExpValuePtr(&pkl,
VAR(gspklBaseLayout));
07928
if (!pkl) {
07929
return FALSE;
07930 }
07931 }
else {
07932 pkl = (
PKL)
FIXKP(param1);
07933 }
07934
07935
if (pkl ==
NULL) {
07936
return FALSE;
07937 }
07938
07939
move(kl, pkl);
07940
07941 Print(
"KL @ 0x%p (cLockObj = %d)\n", pkl, kl.
head.
cLockObj);
07942 Print(
" pklNext @0x%p\n", kl.
pklNext);
07943 Print(
" pklPrev @0x%p\n", kl.
pklPrev);
07944 Print(
" dwKL_Flags 0x%08lx\n", kl.
dwKL_Flags);
07945 Print(
" hkl 0x%08lx\n", kl.
hkl);
07946 Print(
" piiex @0x%p\n", kl.
piiex);
07947
07948
if (kl.
spkf ==
NULL) {
07949 Print(
" spkf @0x%p (NONE!)\n", kl.
spkf);
07950 }
else {
07951
move(kf, kl.
spkf);
07952
07953
move(KbdTbl, kf.
pKbdTbl);
07954
07955 Print(
" spkf @0x%p (cLockObj = %d)\n", kl.
spkf, kf.
head.
cLockObj);
07956 Print(
" pkfNext @0x%p\n", kf.
pkfNext);
07957 Print(
" awchKF[] L\"%ws\"\n", &kf.
awchKF[0]);
07958 Print(
" hBase 0x%08lx\n", kf.
hBase);
07959 Print(
" pKbdTbl @0x%p\n", kf.
pKbdTbl);
07960 Print(
" fLocaleFlags 0x%08lx\n", KbdTbl.fLocaleFlags);
07961 Print(
" dwFontSigs %s\n",
GetFlags(GF_CHARSETS, kl.
dwFontSigs, NULL, TRUE));
07962 }
07963
07964
for (i = 0; i < (
sizeof(CrackCS) /
sizeof(BASECHARSET)); i++) {
07965
if (CrackCS[i].dwValue == kl.
iBaseCharset) {
07966
break;
07967 }
07968 }
07969 Print(
" iBaseCharset %s\n",
07970 (i < (
sizeof(CrackCS) /
sizeof(BASECHARSET))) ? CrackCS[i].pstrCS :
"ILLEGAL VALUE");
07971 Print(
" Codepage %d\n", kl.
CodePage);
07972
07973
if (opts & OFLAG(a)) {
07974 pklAnchor = pkl;
07975 SAFEWHILE (kl.
pklNext != pklAnchor) {
07976 pkl = kl.
pklNext;
07977
if (!Idkl(0, pkl)) {
07978
return FALSE;
07979 }
07980
move(kl, pkl);
07981 }
07982 }
07983
return TRUE;
07984
07985 display_layouts:
07986
07987 ProcessHead = EvalExp(
"PsActiveProcessHead" );
07988
if (!ProcessHead) {
07989 Print(
"Unable to get value of PsActiveProcessHead\n");
07990
return FALSE;
07991 }
07992 Print(
"ProcessHead = %lx\n", ProcessHead);
07993
07994
if (!tryMove(List, ProcessHead)) {
07995 Print(
"Unable to get value of PsActiveProcessHead\n");
07996
return FALSE;
07997 }
07998 NextProcess =
List.Flink;
07999
if (NextProcess ==
NULL) {
08000 Print(
"PsActiveProcessHead->Flink is NULL!\n");
08001
return FALSE;
08002 }
08003 Print(
"NextProcess = %lx\n", NextProcess);
08004
08005 nThread = 0;
08006 SAFEWHILE(NextProcess != ProcessHead) {
08007 pEProcess =
GetEProcessData((
PEPROCESS)NextProcess,
08008 PROCESS_PROCESSHEAD,
08009 NULL);
08010 Print(
"pEProcess = %lx\n", pEProcess);
08011
08012
if (
GetEProcessData(pEProcess, PROCESS_PROCESSLINK,
08013 &List) ==
NULL) {
08014 Print(
"Unable to read _EPROCESS at %lx\n",pEProcess);
08015
break;
08016 }
08017 NextProcess =
List.Flink;
08018
08019
08020
08021
08022
if (
GetEProcessData(pEProcess, PROCESS_WIN32PROCESS,
08023 &pW32Process) ==
NULL || pW32Process ==
NULL) {
08024
continue;
08025 }
08026
08027 ThreadListHead =
GetEProcessData(pEProcess, PROCESS_THREADLIST, &ThreadList);
08028
if (ThreadListHead ==
NULL)
08029
continue;
08030 NextThread = ThreadList.Flink;
08031
08032 SAFEWHILE ( NextThread != ThreadListHead) {
08033 pEThread = (
PETHREAD)(CONTAINING_RECORD(NextThread,
KTHREAD, ThreadListEntry));
08034
08035
if (!tryMove(EThread, pEThread)) {
08036 Print(
"Unable to read _ETHREAD at %lx\n",pEThread);
08037
break;
08038 }
08039 NextThread = ((
PKTHREAD)&EThread)->ThreadListEntry.Flink;
08040
08041 pti = EThread.
Tcb.
Win32Thread;
08042
if (pti ==
NULL) {
08043 Print(
"Cid %lx:%lx has NULL pti\n",
08044 EThread.
Cid.UniqueProcess,
08045 EThread.
Cid.UniqueThread);
08046 }
else if (!tryMove(ti, pti)) {
08047 Print(
"Idt: Unable to move pti from %x.\n",
08048 pti);
08049
return FALSE;
08050 }
08051
08052
if (ti.pEThread != pEThread || pti ==
NULL) {
08053
08054
08055
08056
08057
08058 }
else {
08059
08060 PWCHAR pwch;
08061
08062
if (!GetAppName(&EThread, &ti, ach,
sizeof(ach))) {
08063 Print(
"Idt: Unable to get app name for ETHREAD %x.\n",
08064 pEThread);
08065
return FALSE;
08066 }
08067 pwch = wcsrchr(ach, L
'\\');
08068
if (pwch ==
NULL) {
08069 pwch = ach;
08070 }
else {
08071 pwch++;
08072 }
08073
08074 nThread++;
08075 Print(
"t 0x%08lx i %2x.%-3lx k 0x%08lx %ws\n",
08076 pti,
08077 EThread.
Cid.UniqueProcess,
08078 EThread.
Cid.UniqueThread,
08079 ti.
spklActive,
08080 pwch);
08081
if (opts & OFLAG(v)) {
08082 Idkl(0, ti.
spklActive);
08083 }
08084
08085 }
08086 }
08087 }
08088 Print(
" %d threads total.\n", nThread);
08089 moveExpValuePtr(&pkl,
VAR(gspklBaseLayout));
08090 Print(
" gspklBaseLayout = %#p\n", pkl);
08091
if (opts & OFLAG(v)) {
08092 Idkl(0, pkl);
08093 }
08094
08095
return TRUE;
08096 }
08097
08098
08099
08100
08101
08102
08103
08104
08105
08106
BOOL Iddk(
08107 DWORD opts,
08108 PVOID param1)
08109 {
08110 KBDTABLES KbdTbl;
08111 PKBDTABLES pKbdTbl;
08112 DEADKEY DeadKey;
08113 PDEADKEY pDeadKey;
08114
08115 UNREFERENCED_PARAMETER(opts);
08116
08117
if (param1 == 0) {
08118 Print(
"Expected address\n");
08119
return FALSE;
08120 }
else {
08121 pKbdTbl = (PKBDTABLES)
FIXKP(param1);
08122 }
08123
08124
move(KbdTbl, pKbdTbl);
08125
08126 pDeadKey = KbdTbl.pDeadKey;
08127
08128
if (!pDeadKey) {
08129 Print(
"No deadkey table for this layout\n");
08130
return TRUE;
08131 }
08132
08133
do {
08134
move(DeadKey, pDeadKey);
08135
if (DeadKey.dwBoth == 0) {
08136
break;
08137 }
08138 Print(
"d 0x%04x ch 0x%04x => 0x%04x\n", HIWORD(DeadKey.dwBoth), LOWORD(DeadKey.dwBoth), DeadKey.wchComposed);
08139 pDeadKey++;
08140 }
while (
TRUE);
08141
08142
return TRUE;
08143 }
08144
08145
08146
08147
08148
08149
08150
08151
08152
BOOL Idii(
08153 DWORD opts,
08154 PVOID param1)
08155 {
08156
IMEINFOEX iiex, *piiex;
08157
08158 UNREFERENCED_PARAMETER(opts);
08159
08160
if (param1 ==
NULL) {
08161 Print(
"Expected address\n");
08162
return FALSE;
08163 }
08164
08165 piiex = (
PIMEINFOEX)
FIXKP(param1);
08166
move(iiex, piiex);
08167
08168 Print(
"IIEX @ 0x%p\n", piiex);
08169 Print(
" hKL 0x%08lx\n", iiex.
hkl);
08170 Print(
" ImeInfo\n");
08171 Print(
" dwPrivateDataSize 0x%08lx\n", iiex.
ImeInfo.dwPrivateDataSize);
08172 Print(
" fdwProperty 0x%08lx\n", iiex.
ImeInfo.fdwProperty);
08173 Print(
" fdwConversionCaps 0x%08lx\n", iiex.
ImeInfo.fdwConversionCaps);
08174 Print(
" fdwSentenceCaps 0x%08lx\n", iiex.
ImeInfo.fdwSentenceCaps);
08175 Print(
" fdwUICaps 0x%08lx\n", iiex.
ImeInfo.fdwUICaps);
08176 Print(
" fdwSCSCaps 0x%08lx\n", iiex.
ImeInfo.fdwSCSCaps);
08177 Print(
" fdwSelectCaps 0x%08lx\n", iiex.
ImeInfo.fdwSelectCaps);
08178 Print(
" wszImeDescription[] L\"%ws\"\n", &iiex.
wszImeDescription[0]);
08179 Print(
" wszImeFile[] L\"%ws\"\n", &iiex.
wszImeFile[0]);
08180
08181
return TRUE;
08182 }
08183
08184
08185
08186
08187
08188
08189
08190
08191
08192
BOOL Idti(
08193 DWORD opts,
08194 PVOID param1)
08195 {
08196
PTHREADINFO pti;
08197
THREADINFO ti;
08198
CLIENTTHREADINFO cti;
08199
PETHREAD pThread;
08200
ETHREAD Thread;
08201 UCHAR PriorityClass;
08202
08203 UNREFERENCED_PARAMETER(opts);
08204
08205
08206
if (param1 ==
NULL) {
08207
PQ pq;
08208
Q q;
08209 Print(
"No pti specified: using foreground thread\n");
08210 moveExpValuePtr(&pq,
VAR(gpqForeground));
08211
if (pq ==
NULL) {
08212 Print(
"No foreground queue!\n");
08213
return FALSE;
08214 }
08215
move(q,
FIXKP(pq));
08216 pti =
FIXKP(q.
ptiKeyboard);
08217 }
else {
08218 pti = (
PTHREADINFO)
FIXKP(param1);
08219 }
08220
08221
if (pti ==
NULL) {
08222
return FALSE;
08223 }
08224
08225 Idt(OFLAG(p), pti);
08226
08227
move(ti, pti);
08228
move(cti, ti.
pcti);
08229
08230 Print(
"PTHREADINFO @ 0x%p\n", pti);
08231
08232 Print(
"\tPtiLink.Flink @0x%p\n"
08233
"\tptl @0x%p\n"
08234
"\tptlW32 @0x%p\n"
08235
"\tppi @0x%p\n"
08236
"\tpq @0x%p\n"
08237
"\tspklActive @0x%p\n"
08238
"\tmlPost.pqmsgRead @0x%p\n"
08239
"\tmlPost.pqmsgWriteLast @0x%p\n"
08240
"\tmlPost.cMsgs 0x%08lx\n",
08241 ti.
PtiLink.Flink,
08242 ti.
ptl,
08243 ti.ptlW32,
08244 ti.
ppi,
08245 ti.
pq,
08246 ti.
spklActive,
08247 ti.
mlPost.
pqmsgRead,
08248 ti.
mlPost.
pqmsgWriteLast,
08249 ti.
mlPost.
cMsgs);
08250
08251 Print(
"\tspwndDefaultIme @0x%p\n"
08252
"\tspDefaultImc @0x%p\n"
08253
"\thklPrev 0x%08lx\n",
08254 ti.
spwndDefaultIme,
08255 ti.
spDefaultImc,
08256 ti.
hklPrev);
08257
08258 Print(
"\trpdesk @0x%p\n",
08259 ti.
rpdesk);
08260 Print(
"\thdesk 0x%08lx\n",
08261 ti.
hdesk);
08262 Print(
"\tamdesk 0x%08lx\n",
08263 ti.
amdesk);
08264
08265 Print(
"\tpDeskInfo @0x%p\n"
08266
"\tpClientInfo @0x%p\n",
08267 ti.
pDeskInfo,
08268 ti.
pClientInfo);
08269
08270 Print(
"\tTIF_flags %s\n",
08271
GetFlags(GF_TIF, ti.
TIF_flags, NULL, TRUE));
08272 Print(
"\tsphkCurrent @0x%p\n"
08273
"\tpEventQueueServer @0x%p\n"
08274
"\thEventQueueClient 0x%08lx\n",
08275 ti.
sphkCurrent,
08276 ti.
pEventQueueServer,
08277 ti.
hEventQueueClient);
08278
08279 Print(
"\tfsChangeBits %s\n",
08280
GetFlags(GF_QS, (WORD)cti.
fsChangeBits, NULL, TRUE));
08281 Print(
"\tfsChangeBitsRemovd %s\n",
08282
GetFlags(GF_QS, (WORD)ti.
fsChangeBitsRemoved, NULL, TRUE));
08283 Print(
"\tfsWakeBits %s\n",
08284
GetFlags(GF_QS, (WORD)cti.
fsWakeBits, NULL, TRUE));
08285 Print(
"\tfsWakeMask %s\n",
08286
GetFlags(GF_QS, (WORD)cti.
fsWakeMask, NULL, TRUE));
08287
08288 Print(
"\tcPaintsReady 0x%04x\n"
08289
"\tcTimersReady 0x%04x\n"
08290
"\ttimeLast 0x%08lx\n"
08291
"\tptLast.x 0x%08lx\n"
08292
"\tptLast.y 0x%08lx\n"
08293
"\tidLast 0x%08lx\n"
08294
"\tcQuit 0x%08lx\n"
08295
"\texitCode 0x%08lx\n"
08296
"\tpSBTrack 0x%08lx\n"
08297
"\tpsmsSent @0x%p\n"
08298
"\tpsmsCurrent @0x%p\n",
08299 ti.
cPaintsReady,
08300 ti.
cTimersReady,
08301 ti.
timeLast,
08302 ti.
ptLast.x,
08303 ti.
ptLast.y,
08304 ti.
idLast,
08305 ti.
cQuit,
08306 ti.
exitCode,
08307 ti.
pSBTrack,
08308 ti.
psmsSent,
08309 ti.
psmsCurrent);
08310
08311 Print(
"\tfsHooks 0x%08lx\n"
08312
"\taphkStart @0x%p l%ld\n"
08313
"\tsphkCurrent @0x%p\n",
08314 ti.
fsHooks,
08315 &(pti->
aphkStart), CWINHOOKS,
08316 ti.
sphkCurrent);
08317 Print(
"\tpsmsReceiveList @0x%p\n",
08318 ti.
psmsReceiveList);
08319 Print(
"\tptdb @0x%p\n"
08320
"\tThread @0x%p\n",
08321 ti.
ptdb, ti.pEThread);
08322
08323 pThread = (
PETHREAD)ti.pEThread;
08324
move(Thread, pThread);
08325
GetEProcessData(Thread.
ThreadsProcess, PROCESS_PRIORITYCLASS, &PriorityClass);
08326 Print(
"\t PriorityClass %d\n",
08327 PriorityClass);
08328
08329 Print(
"\tcWindows 0x%08lx\n"
08330
"\tcVisWindows 0x%08lx\n"
08331
"\tpqAttach @0x%p\n"
08332
"\tiCursorLevel 0x%08lx\n",
08333 ti.
cWindows,
08334 ti.
cVisWindows,
08335 ti.
pqAttach,
08336 ti.
iCursorLevel);
08337
08338 Print(
"\tpMenuState @0x%p\n",
08339 ti.
pMenuState);
08340
08341
return TRUE;
08342 }
08343
#endif // KERNEL
08344
08345
08346
#ifdef KERNEL
08347
08348
BOOL ScanThreadlocks(
PTHREADINFO pti,
char chType, PVOID pvSearch);
08349
08350
08351
08352
08353
08354
08355
08356
08357
08358
08359
08360
BOOL Idtl(
08361 DWORD opts,
08362 PVOID param1)
08363 {
08364
PTHREADINFO pti;
08365
08366
if (param1 == 0) {
08367 Print(
"Dumping all thread locks:\n");
08368 Print(
"pti pObj Caller\n");
08369 FOREACHPTI(pti)
08370 Idtl(OFLAG(t) | OFLAG(x), pti);
08371 NEXTEACHPTI(pti);
08372 return TRUE;
08373 }
08374
08375 if (opts & OFLAG(t)) {
08376 pti = (
PTHREADINFO)
FIXKP(param1);
08377
if (pti ==
NULL) {
08378
return FALSE;
08379 }
08380
08381
08382
08383
08384
if (!(opts & OFLAG(x))) {
08385 Print(
"pti pObj Caller\n");
08386 }
08387 ScanThreadlocks(pti,
'o', NULL);
08388 ScanThreadlocks(pti,
'k', NULL);
08389
return TRUE;
08390 }
08391
08392
08393
if (!param1) {
08394
return FALSE;
08395 }
08396
08397 Print(
"Thread Locks for object %x:\n", param1);
08398 Print(
"pti pObj Caller\n");
08399
08400 FOREACHPTI(pti)
08401 ScanThreadlocks(pti, 'o', param1);
08402 ScanThreadlocks(pti, 'k', param1);
08403 NEXTEACHPTI(pti);
08404
08405 Print("--- End Thread Lock List ---\n");
08406
08407 return TRUE;
08408 }
08409
08410
08411
08412
08413
08414
08415
08416 BOOL
08417 ScanThreadlocks(
08418
PTHREADINFO pti,
08419
char chType,
08420 PVOID pvSearch)
08421 {
08422
TL tl;
08423
THREADINFO ti;
08424
PTL ptl;
08425
08426
if (!tryMove(ti, pti)) {
08427 Print(
"Idtl: Can't get pti data from %x.\n", pti);
08428
return FALSE;
08429 }
08430
switch (chType) {
08431
case 'o':
08432 ptl = ti.
ptl;
08433
break;
08434
case 'k':
08435 ptl = ti.ptlW32;
08436
break;
08437
default:
08438 Print(
"Internal error, bad chType in ScanThreadlocks\n");
08439
return FALSE;
08440 }
08441 SAFEWHILE(ptl) {
08442
char ach[80];
08443 DWORD_PTR dwOffset;
08444
08445
if (!tryMove(tl, ptl)) {
08446 Print(
"Idtl: Can't get ptl data from %x.\n", ptl);
08447
return FALSE;
08448 }
08449
08450
if (!pvSearch || (tl.pobj == pvSearch)) {
08451 Print(
"%p %c %p", pti, chType, tl.pobj);
08452
#if DBG
08453
GetSym(tl.pfnCaller, ach, &dwOffset);
08454 Print(
" %s", ach);
08455
if (dwOffset) {
08456 Print(
"+%lx", dwOffset);
08457 }
08458
#endif // !DBG
08459
if (chType ==
'k') {
08460 GetSym(tl.pfnFree, ach, &dwOffset);
08461 Print(
" (%s)", ach);
08462
if (dwOffset) {
08463 Print(
"+%x", dwOffset);
08464 }
08465 }
08466 Print(
"\n");
08467 }
08468 ptl = tl.next;
08469 }
08470
return TRUE;
08471 }
08472
08473
#endif // KERNEL
08474
08475
08476
08477
#ifdef KERNEL
08478
08479
08480
08481
08482
08483
08484
08485
08486
08487
08488
BOOL Idtmr(
08489 DWORD opts,
08490 PVOID param1)
08491 {
08492
PTIMER ptmr;
08493
TIMER tmr;
08494
THREADINFO ti;
08495
08496 UNREFERENCED_PARAMETER(opts);
08497
08498
if (param1 == 0) {
08499 moveExpValuePtr(&ptmr,
VAR(gptmrFirst));
08500 SAFEWHILE (ptmr) {
08501 Idtmr(0, ptmr);
08502 Print(
"\n");
08503
move(ptmr, &ptmr->
ptmrNext);
08504 }
08505
return TRUE;
08506 }
08507
08508 ptmr = (
PTIMER)param1;
08509
08510
if (ptmr ==
NULL) {
08511 Print(
"Expected ptmr address.\n");
08512
return FALSE;
08513 }
08514
08515
move(tmr, ptmr);
08516
08517
08518 Print(
"Timer %08x:\n"
08519
" ptmrNext = %x\n"
08520
" pti = %x",
08521 ptmr,
08522 tmr.
ptmrNext,
08523 tmr.
pti);
08524
if (tryMove(ti, tmr.
pti)) {
08525 WCHAR awch[80];
08526
ETHREAD EThread;
08527
08528
if (tryMove(EThread, ti.pEThread)) {
08529
if (GetAppName(&EThread, &ti, awch,
sizeof(awch))) {
08530 PWCHAR pwch = wcsrchr(awch, L
'\\');
08531
if (pwch ==
NULL) {
08532 pwch = awch;
08533 }
else {
08534 pwch++;
08535 }
08536 Print(
" q 0x%08lx i %2x.%-3lx %ws",
08537 ti.
pq,
08538 EThread.
Cid.UniqueProcess,
08539 EThread.
Cid.UniqueThread,
08540 pwch);
08541 }
08542 }
08543 }
08544 Print(
"\n"
08545
" spwnd = %x",
08546 tmr.
spwnd);
08547
if (tmr.
spwnd) {
08548
char ach[80];
08549
DebugGetWindowTextA(tmr.
spwnd, ach);
08550 Print(
" \"%s\"", ach);
08551 }
08552 Print(
"\n"
08553
" nID = %x\n"
08554
" cmsCountdown = %x\n"
08555
" cmsRate = %x\n"
08556
" flags = %s\n"
08557
" pfn = %x\n"
08558
" ptiOptCreator = %x\n",
08559 tmr.
nID,
08560 tmr.
cmsCountdown,
08561 tmr.
cmsRate,
08562
GetFlags(GF_TMRF, (WORD)tmr.
flags, NULL, TRUE),
08563 tmr.
pfn,
08564 tmr.
ptiOptCreator);
08565
08566
return TRUE;
08567 }
08568
#endif // KERNEL
08569
08570
08571
08572
08573
08574
08575
08576
08577
08578
08579
08580
08581
08582
08583
BOOL Idu(
08584 DWORD opts,
08585 PVOID param1)
08586 {
08587
HANDLEENTRY he, *phe;
08588
int i;
08589
DWORD dw;
08590
08591 UNREFERENCED_PARAMETER(opts);
08592
08593
if (param1 ==
NULL) {
08594
FOREACHHANDLEENTRY(phe, he, i)
08595 if (he.bType != TYPE_FREE && tryDword(&dw, FIXKP(he.phead))) {
08596
Idu(OFLAG(x), he.
phead);
08597 }
08598
NEXTEACHHANDLEENTRY()
08599 return TRUE;
08600 }
08601
08602 param1 = HorPtoP(FIXKP(param1), -1);
08603 if (param1 == NULL) {
08604
return FALSE;
08605 }
08606
08607
if (!
getHEfromP(NULL, &he, param1)) {
08608
return FALSE;
08609 }
08610
08611 Print(
"--- %s object @%x ---\n", pszObjStr[he.
bType],
FIXKP(param1));
08612
switch (he.
bType) {
08613
case TYPE_WINDOW:
08614
return Idw(0, param1);
08615
08616
case TYPE_MENU:
08617
return Idm(0, param1);
08618
08619
#ifdef KERNEL
08620
case TYPE_CURSOR:
08621
return Idcur(0, param1);
08622
08623
#ifdef LATER
08624
case TYPE_INPUTQUEUE:
08625
return Idq(0, param1);
08626
#endif
08627
08628
case TYPE_HOOK:
08629
return Idhk(OFLAG(a) | OFLAG(g), NULL);
08630
08631
case TYPE_DDECONV:
08632
case TYPE_DDEXACT:
08633
return Idde(0, param1);
08634
#endif // KERNEL
08635
08636
case TYPE_MONITOR:
08637
08638
case TYPE_CALLPROC:
08639
case TYPE_ACCELTABLE:
08640
case TYPE_SETWINDOWPOS:
08641
case TYPE_DDEACCESS:
08642
default:
08643 Print(
"not supported.\n", pszObjStr[he.
bType]);
08644 }
08645
return TRUE;
08646 }
08647
08648
08649
08650
#ifdef KERNEL
08651
08652
08653
08654
08655
08656
08657
08658
08659
BOOL Idumphmgr(
08660 DWORD opts)
08661 {
08662
PERFHANDLEINFO aLocalHti[
TYPE_CTYPES], aLocalPrevHti[
TYPE_CTYPES];
08663
PPERFHANDLEINFO pgahti;
08664
08665 LONG lTotalAlloc, lTotalMax, lTotalCurrent;
08666 LONG lPrevTotalAlloc, lPrevTotalMax, lPrevTotalCurrent;
08667 SIZE_T lTotalSize, lPrevTotalSize;
08668
08669
int idx;
08670
08671 pgahti = EvalExp(
VAR(gaPerfhti));
08672
if (!pgahti) {
08673 Print(
"\n!dumphmgr works only with debug versions of win32k.sys\n\n");
08674
return TRUE;
08675 }
08676
move(aLocalHti, pgahti);
08677
08678 pgahti = EvalExp(
VAR(gaPrevhti));
08679
if (!pgahti) {
08680
return TRUE;
08681 }
08682
08683
move(aLocalPrevHti, pgahti);
08684
08685 lTotalSize = lTotalAlloc = lTotalMax = lTotalCurrent = 0;
08686 lPrevTotalSize = lPrevTotalAlloc = lPrevTotalMax = lPrevTotalCurrent = 0;
08687
08688
if (aLocalPrevHti[
TYPE_WINDOW].
lTotalCount) {
08689 Print(
"\nThe snapshot values come under the current ones\n");
08690
08691 Print(
"Type Allocated Maximum Count Size\n");
08692 Print(
"______________________________________________________________________________");
08693
for(idx=1; idx <
TYPE_CTYPES; idx++) {
08694 Print(
"\n%-15s %8d %-+6d %7d %-+5d %6d %-+5d %9d %-+d",
08695 aszTypeNames[idx],
08696 aLocalHti[idx].lTotalCount, aLocalHti[idx].lTotalCount - aLocalPrevHti[idx].lTotalCount,
08697 aLocalHti[idx].lMaxCount, aLocalHti[idx].lMaxCount - aLocalPrevHti[idx].lMaxCount,
08698 aLocalHti[idx].lCount, aLocalHti[idx].lCount - aLocalPrevHti[idx].lCount,
08699 aLocalHti[idx].lSize, aLocalHti[idx].lSize - aLocalPrevHti[idx].lSize);
08700
if (aLocalPrevHti[
TYPE_WINDOW].
lTotalCount) {
08701 Print(
"\n %8d %7d %6d %9d",
08702 aLocalPrevHti[idx].lTotalCount,
08703 aLocalPrevHti[idx].lMaxCount,
08704 aLocalPrevHti[idx].lCount,
08705 aLocalPrevHti[idx].lSize);
08706 lPrevTotalAlloc += aLocalPrevHti[idx].
lTotalCount;
08707 lPrevTotalMax += aLocalPrevHti[idx].lMaxCount;
08708 lPrevTotalCurrent += aLocalPrevHti[idx].lCount;
08709 lPrevTotalSize += aLocalPrevHti[idx].lSize;
08710
08711 }
08712 lTotalAlloc += aLocalHti[idx].
lTotalCount;
08713 lTotalMax += aLocalHti[idx].lMaxCount;
08714 lTotalCurrent += aLocalHti[idx].lCount;
08715 lTotalSize += aLocalHti[idx].lSize;
08716 }
08717 Print(
"\n______________________________________________________________________________\n");
08718 Print(
"Totals %8d %-+6d %7d %-+5d %6d %+-5d %9d %-+d\n",
08719 lTotalAlloc, lTotalAlloc - lPrevTotalAlloc,
08720 lTotalMax, lTotalMax - lPrevTotalMax,
08721 lTotalCurrent, lTotalCurrent - lPrevTotalCurrent,
08722 lTotalSize, lTotalSize - lPrevTotalSize);
08723 Print(
" %8d %7d %6d %9d\n",
08724 lPrevTotalAlloc, lPrevTotalMax, lPrevTotalCurrent, lPrevTotalSize);
08725
08726 }
08727
else {
08728 Print(
"Type Allocated Maximum Count Size\n");
08729 Print(
"______________________________________________________");
08730
for(idx=1; idx <
TYPE_CTYPES; idx++) {
08731 Print(
"\n%-17s %9d %7d %6d %d",
08732 aszTypeNames[idx],
08733 aLocalHti[idx].lTotalCount,
08734 aLocalHti[idx].lMaxCount,
08735 aLocalHti[idx].lCount,
08736 aLocalHti[idx].lSize);
08737 lTotalAlloc += aLocalHti[idx].
lTotalCount;
08738 lTotalMax += aLocalHti[idx].lMaxCount;
08739 lTotalCurrent += aLocalHti[idx].lCount;
08740 lTotalSize += aLocalHti[idx].lSize;
08741 }
08742 Print(
"\n______________________________________________________\n");
08743 Print(
"Current totals %9d %7d %6d %d\n",
08744 lTotalAlloc, lTotalMax, lTotalCurrent, lTotalSize);
08745 }
08746
08747
08748
08749
08750
08751
if (opts & OFLAG(s)) {
08752 (lpExtensionApis->lpWriteProcessMemoryRoutine)(
08753 (ULONG_PTR)(&(pgahti[0])),
08754 (
void*)(aLocalHti),
08755
sizeof(aLocalHti),
08756
NULL);
08757 }
08758
08759
return TRUE;
08760 }
08761
#endif // KERNEL
08762
08763
08764
08765
08766
08767
08768
08769
08770
08771
08772
08773
08774
08775
BOOL dwrWorker(
08776
PWND pwnd,
08777
int tab)
08778 {
08779
WND wnd;
08780
08781
if (pwnd == 0) {
08782
return FALSE;
08783 }
08784
08785
do {
08786 pwnd =
FIXKP(pwnd);
08787
move(wnd, pwnd);
08788
DebugGetWindowTextA(pwnd, gach1);
08789
move(gcls,
FIXKP(wnd.
pcls));
08790
if (
gcls.
atomClassName < 0xC000) {
08791
switch (
gcls.
atomClassName) {
08792
case WC_DIALOG:
08793 strcpy(gach1,
"WC_DIALOG");
08794
break;
08795
08796
case DESKTOPCLASS:
08797 strcpy(gach1,
"DESKTOP");
08798
break;
08799
08800
case SWITCHWNDCLASS:
08801 strcpy(gach1,
"SWITCHWND");
08802
break;
08803
08804
case ICONTITLECLASS:
08805 strcpy(gach1,
"ICONTITLE");
08806 break;
08807
08808
default:
08809
if (
gcls.
atomClassName == 0) {
08810
move(
gach1,
FIXKP(
gcls.lpszAnsiClassName));
08811 }
else {
08812
sprintf(gach2,
"0x%04x",
gcls.
atomClassName);
08813 }
08814 }
08815 }
else {
08816
DebugGetClassNameA(
gcls.lpszAnsiClassName, gach2);
08817 }
08818 Print(
"%08x%*s [%s|%s]", pwnd, tab,
"", gach1, gach2);
08819
if (wnd.
spwndOwner !=
NULL) {
08820 Print(
" <- Owned by:%08x",
FIXKP(wnd.
spwndOwner));
08821 }
08822 Print(
"\n");
08823
if (wnd.
spwndChild !=
NULL) {
08824
dwrWorker(wnd.
spwndChild, tab + 2);
08825 }
08826 } SAFEWHILE ((pwnd = wnd.
spwndNext) && tab > 0);
08827
return TRUE;
08828 }
08829
08830
08831
08832
08833
08834
08835
08836
08837
08838
08839
08840
08841
BOOL Idw(
08842 DWORD opts,
08843 PVOID param1)
08844 {
08845
WND wnd;
08846
CLS cls;
08847
PWND pwnd = param1;
08848
char ach[80];
08849 DWORD_PTR dwOffset;
08850
int ix;
08851
DWORD tempDWord;
08852
DWORD dwWOW;
08853
08854
if (opts & OFLAG(a)) {
08855
#ifdef KERNEL
08856
DESKTOP desk, *pdesk;
08857
PWND pwnd;
08858 WCHAR wach[80];
08859
08860
if (param1 != 0) {
08861 Print(
"window parameter ignored with -a option.\n");
08862 }
08863 FOREACHDESKTOP(pdesk)
08864 if (tryMove(desk, pdesk)) {
08865
OBJECT_HEADER_NAME_INFO NameInfo;
08866
OBJECT_HEADER Head;
08867
08868
move(Head,
OBJECT_TO_OBJECT_HEADER(pdesk));
08869
move(NameInfo, ((PCHAR)(
OBJECT_TO_OBJECT_HEADER(pdesk)) - Head.
NameInfoOffset));
08870
moveBlock(wach,
FIXKP(NameInfo.
Name.Buffer), NameInfo.
Name.Length);
08871 wach[NameInfo.
Name.Length /
sizeof(WCHAR)] =
L'\0';
08872 Print(
"\n----Windows for %ws desktop @%08lx:\n\n", wach, pdesk);
08873
move(pwnd, &(desk.pDeskInfo->spwnd));
08874
if (!
Idw((opts & ~OFLAG(a)) | OFLAG(p), pwnd)) {
08875
return FALSE;
08876 }
08877 }
08878 NEXTEACHDESKTOP(pdesk)
08879 #
else
08880 TEB teb;
08881
08882
if (
GetTargetTEB(&teb, NULL)) {
08883
PDESKTOPINFO pdi;
08884
DESKTOPINFO di;
08885
08886 pdi = ((
PCLIENTINFO)&teb.Win32ClientInfo[0])->pDeskInfo;
08887
move(di, pdi);
08888
return Idw(opts & ~OFLAG(a) | OFLAG(p),
FIXKP(
di.spwnd));
08889 }
08890
#endif // !KERNEL
08891 return TRUE;
08892 }
08893
08894
08895
08896
08897
if (opts & OFLAG(t)) {
08898
#ifdef KERNEL
08899
PTHREADINFO pti, ptiWnd;
08900
PDESKTOP pdesk;
08901
PDESKTOPINFO pdi;
08902
08903
08904
08905 pti = (
PTHREADINFO)param1;
08906
if (!tryMove(pdesk, &pti->
rpdesk)
08907 || !tryMove(pdi, &pdesk->
pDeskInfo)
08908 || !tryMove(pwnd, &pdi->
spwnd)
08909 || !tryMove(pwnd, &pwnd->
spwndChild)) {
08910
return FALSE;
08911 }
08912
08913
08914
08915 SAFEWHILE (pwnd) {
08916
if (tryMove(ptiWnd, &(pwnd->
head.pti)) && (ptiWnd == pti)) {
08917
if (!
Idw(opts & ~OFLAG(t), pwnd)) {
08918
return FALSE;
08919 }
08920 }
08921
if (!tryMove(pwnd, &pwnd->
spwndNext)) {
08922
return FALSE;
08923 }
08924 }
08925
return TRUE;
08926
08927
#else // !KERNEL
08928
Print(
"t parameter not supported for NTSD at this point\n");
08929
#endif // !KERNEL
08930
}
08931
08932
08933
08934
08935
if (param1 ==
NULL || opts & (OFLAG(p) | OFLAG(s))) {
08936
08937
08938
08939
08940
if (param1 ==
NULL && (opts & (OFLAG(p) | OFLAG(s)))) {
08941 Print(
"Must specify window with '-p' or '-s' options.\n");
08942
return FALSE;
08943 }
08944
08945
if (param1 && (pwnd =
HorPtoP(pwnd, TYPE_WINDOW)) ==
NULL) {
08946
return FALSE;
08947 }
08948
08949
if (opts & OFLAG(p)) {
08950 Print(
"pwndParent = 0x%p\n", pwnd);
08951
if (!tryMove(pwnd,
FIXKP(&pwnd->spwndChild))) {
08952 Print(
"<< Can't get WND >>\n");
08953
return TRUE;
08954 }
08955 SAFEWHILE (pwnd) {
08956
if (!
Idw(opts & ~OFLAG(p), pwnd)) {
08957
return FALSE;
08958 }
08959
move(pwnd,
FIXKP(&pwnd->spwndNext));
08960 }
08961
return TRUE;
08962
08963 }
else if (opts & OFLAG(s)) {
08964
move(pwnd,
FIXKP(&pwnd->spwndParent));
08965
return Idw((opts | OFLAG(p)) & ~OFLAG(s), pwnd);
08966
08967 }
else {
08968
#ifdef KERNEL
08969
Q q;
08970
PQ pq;
08971
THREADINFO ti;
08972
PWND pwnd;
08973
08974 moveExpValuePtr(&pq,
VAR(gpqForeground));
08975
move(q, pq);
08976
move(ti, q.
ptiKeyboard);
08977
if (ti.
rpdesk ==
NULL) {
08978 Print(
"Foreground thread doesn't have a desktop.\n");
08979
return FALSE;
08980 }
08981
move(pwnd, &(ti.
pDeskInfo->
spwnd));
08982 Print(
"pwndDesktop = 0x%p\n", pwnd);
08983
return Idw(opts | OFLAG(p), pwnd);
08984
#else // !KERNEL
08985
return Idw(opts | OFLAG(a), 0);
08986
#endif // !KERNEL
08987
}
08988 }
08989
08990
if (param1 && (pwnd =
HorPtoP(param1, TYPE_WINDOW)) ==
NULL) {
08991 Print(
"Idw: 0x%p is not a pwnd.\n", param1);
08992
return FALSE;
08993 }
08994
08995
if (opts & OFLAG(r)) {
08996
dwrWorker(
FIXKP(pwnd), 0);
08997
return TRUE;
08998 }
08999
09000
move(wnd,
FIXKP(pwnd));
09001
09002
#ifdef KERNEL
09003
09004
09005
09006
if (wnd.
head.pti) {
09007 Idt(OFLAG(p), (PVOID)wnd.
head.pti);
09008 }
09009
#endif // KERNEL
09010
09011
09012
09013 Print(
"pwnd = 0x%p", pwnd);
09014
09015
09016
09017
if (opts & OFLAG(z)) {
09018
if (wnd.ExStyle & WS_EX_TOPMOST) {
09019 Print(
" TOPMOST");
09020 }
09021
if (!(wnd.style & WS_VISIBLE)) {
09022 Print(
" HIDDEN");
09023 }
09024
if (wnd.style & WS_DISABLED) {
09025 Print(
" DISABLED");
09026 }
09027
if (wnd.
spwndOwner !=
NULL) {
09028
DebugGetWindowTextA(wnd.
spwndOwner, ach);
09029 Print(
" OWNER:0x%p \"%s\"", wnd.
spwndOwner, ach);
09030 }
09031 }
09032 Print(
"\n");
09033
09034
if (!(opts & OFLAG(v))) {
09035
09036
09037
09038
09039
DebugGetWindowTextA(pwnd, ach);
09040 Print(
"title = \"%s\"\n", ach);
09041
09042
09043
09044
09045
if (opts & OFLAG(h)) {
09046
if (IsWOWProc (wnd.
lpfnWndProc)) {
09047 UnMarkWOWProc(wnd.
lpfnWndProc,dwWOW);
09048 Print(
"wndproc = %04lx:%04lx (WOW) (%s)",
09049 HIWORD(dwWOW),LOWORD(dwWOW),
09050
TestWF(&wnd, WFANSIPROC) ?
"ANSI" :
"Unicode" );
09051 }
09052
else {
09053 GetSym((LPVOID)wnd.
lpfnWndProc, ach, &dwOffset);
09054 Print(
"wndproc = 0x%p = \"%s\" (%s)", wnd.
lpfnWndProc, ach,
09055
TestWF(&wnd, WFANSIPROC) ?
"ANSI" :
"Unicode" );
09056 }
09057 }
else {
09058
if (IsWOWProc (wnd.
lpfnWndProc)) {
09059 UnMarkWOWProc(wnd.
lpfnWndProc,dwWOW);
09060 Print(
"wndproc = %04lx:%04lx (WOW) (%s)",
09061 HIWORD(dwWOW),LOWORD(dwWOW),
09062
TestWF(&wnd, WFANSIPROC) ?
"ANSI" :
"Unicode" );
09063 }
09064
else {
09065 Print(
"wndproc = 0x%p (%s)", wnd.
lpfnWndProc,
09066
TestWF(&wnd, WFANSIPROC) ?
"ANSI" :
"Unicode" );
09067 }
09068 }
09069
09070
09071
09072
09073
move(cls,
FIXKP(wnd.
pcls));
09074
if (cls.
atomClassName < 0xC000) {
09075
sprintf(ach,
"0x%04x", cls.
atomClassName);
09076 }
else {
09077
DebugGetClassNameA(cls.lpszAnsiClassName, ach);
09078 }
09079 Print(
" Class:\"%s\"\n", ach);
09080 }
else {
09081
09082
09083
09084 Print(
"\tpti @0x%p\n",
FIXKP(wnd.
head.pti));
09085 Print(
"\thandle 0x%p\n", wnd.
head.h);
09086
09087
DebugGetWindowTextA(wnd.
spwndNext, ach);
09088 Print(
"\tspwndNext @0x%p \"%s\"\n", wnd.
spwndNext, ach);
09089
DebugGetWindowTextA(wnd.
spwndParent, ach);
09090 Print(
"\tspwndParent @0x%p \"%s\"\n", wnd.
spwndParent, ach);
09091
DebugGetWindowTextA(wnd.
spwndChild, ach);
09092 Print(
"\tspwndChild @0x%p \"%s\"\n", wnd.
spwndChild, ach);
09093
DebugGetWindowTextA(wnd.
spwndOwner, ach);
09094 Print(
"\tspwndOwner @0x%p \"%s\"\n", wnd.
spwndOwner, ach);
09095
09096 Print(
"\trcWindow (%d,%d)-(%d,%d) %dx%d\n",
09097 wnd.
rcWindow.left, wnd.
rcWindow.top,
09098 wnd.
rcWindow.right, wnd.
rcWindow.bottom,
09099 wnd.
rcWindow.right - wnd.
rcWindow.left,
09100 wnd.
rcWindow.bottom - wnd.
rcWindow.top);
09101
09102 Print(
"\trcClient (%d,%d)-(%d,%d) %dx%d\n",
09103 wnd.
rcClient.left, wnd.
rcClient.top,
09104 wnd.
rcClient.right, wnd.
rcClient.bottom,
09105 wnd.
rcClient.right - wnd.
rcClient.left,
09106 wnd.
rcClient.bottom - wnd.
rcClient.top);
09107
09108
if (IsWOWProc (wnd.
lpfnWndProc)) {
09109 UnMarkWOWProc(wnd.
lpfnWndProc,dwWOW);
09110 Print(
"\tlpfnWndProc @%04lx:%04lx (WOW) (%s)\n",
09111 HIWORD(dwWOW),LOWORD(dwWOW),
09112
TestWF(&wnd, WFANSIPROC) ?
"ANSI" :
"Unicode" );
09113 }
09114
else {
09115 GetSym((LPVOID)wnd.
lpfnWndProc, ach, &dwOffset);
09116 Print(
"\tlpfnWndProc @0x%p (%s) %s\n", wnd.
lpfnWndProc, ach,
09117
TestWF(&wnd, WFANSIPROC) ?
"ANSI" :
"Unicode" );
09118 }
09119
move(cls,
FIXKP(wnd.
pcls));
09120
if (cls.
atomClassName < 0xC000) {
09121
sprintf(ach,
"0x%04x", cls.
atomClassName);
09122 }
else {
09123
DebugGetClassNameA(cls.lpszAnsiClassName, ach);
09124 }
09125 Print(
"\tpcls @0x%p (%s)\n",
09126 wnd.
pcls, ach);
09127
09128 Print(
"\thrgnUpdate 0x%p\n",
09129 wnd.
hrgnUpdate);
09130
DebugGetWindowTextA(wnd.
spwndLastActive, ach);
09131 Print(
"\tspwndLastActive @0x%p \"%s\"\n",
09132 wnd.
spwndLastActive, ach);
09133 Print(
"\tppropList @0x%p\n"
09134
"\tpSBInfo @0x%p\n",
09135 wnd.
ppropList,
09136 wnd.
pSBInfo);
09137
if (wnd.
pSBInfo) {
09138
SBINFO asb;
09139
09140
moveBlock(&asb,
FIXKP(wnd.
pSBInfo),
sizeof(asb));
09141 Print(
"\t SBO_FLAGS = %s\n"
09142
"\t SBO_HMIN = %d\n"
09143
"\t SBO_HMAX = %d\n"
09144
"\t SBO_HPAGE = %d\n"
09145
"\t SBO_HPOS = %d\n"
09146
"\t SBO_VMIN = %d\n"
09147
"\t SBO_VMAX = %d\n"
09148
"\t SBO_VPAGE = %d\n"
09149
"\t SBO_VPOS = %d\n",
09150
GetFlags(GF_SB, (WORD)asb.
WSBflags, NULL, TRUE),
09151 asb.
Horz.
posMin,
09152 asb.
Horz.
posMax,
09153 asb.
Horz.
page,
09154 asb.
Horz.
pos,
09155 asb.
Vert.
posMin,
09156 asb.
Vert.
posMax,
09157 asb.
Vert.
page,
09158 asb.
Vert.
pos);
09159 }
09160 Print(
"\tspmenuSys @0x%p\n"
09161
"\tspmenu/id @0x%p\n",
09162 wnd.
spmenuSys,
09163 wnd.
spmenu);
09164 Print(
"\thrgnClip 0x%p\n",
09165 wnd.
hrgnClip);
09166
09167
09168
09169
09170
09171
DebugGetWindowTextA(pwnd, ach);
09172 Print(
"\tpName \"%s\"\n",
09173 ach);
09174 Print(
"\tdwUserData 0x%p\n",
09175 wnd.
dwUserData);
09176 Print(
"\tstate 0x%08lx\n"
09177
"\tstate2 0x%08lx\n"
09178
"\tExStyle 0x%08lx\n"
09179
"\tstyle 0x%08lx\n"
09180
"\tfnid 0x%08lx\n"
09181
"\thImc 0x%08lx\n"
09182
"\tbFullScreen %d\n"
09183
"\thModule 0x%08lx\n",
09184 wnd.state,
09185 wnd.state2,
09186 wnd.ExStyle,
09187 wnd.style,
09188 (DWORD)wnd.fnid,
09189 wnd.
hImc,
09190
GetFullScreen(&wnd),
09191 wnd.hModule);
09192 }
09193
09194
09195
09196
if (opts & OFLAG(f)) {
09197
int i;
09198 WORD wFlag;
09199
PBYTE pbyte = (
PBYTE)(&(wnd.state));
09200
09201
for (i = 0; i <
ARRAY_SIZE(aWindowFlags); i++) {
09202 wFlag =
aWindowFlags[i].
wFlag;
09203
if (pbyte[
HIBYTE(wFlag)] &
LOBYTE(wFlag)) {
09204 Print(
"\t%-18s\t%lx:%02lx\n",
09205 aWindowFlags[i].pszText,
09206 (PBYTE)&(pwnd->state) +
HIBYTE(wFlag),
09207
LOBYTE(wFlag));
09208 }
09209 }
09210 }
09211
09212
if (opts & OFLAG(w)) {
09213 Print(
"\t%d window bytes: ", wnd.
cbwndExtra);
09214
if (wnd.
cbwndExtra) {
09215
for (ix=0; ix < wnd.
cbwndExtra; ix += 4) {
09216
DWORD UNALIGNED *pdw;
09217
09218 pdw = (
DWORD UNALIGNED *) ((
BYTE *) (pwnd+1) + ix);
09219
move(tempDWord, pdw);
09220 Print(
"%08x ", tempDWord);
09221 }
09222 }
09223 Print(
"\n");
09224 }
09225
09226
09227
09228
09229
if (opts & OFLAG(o)) {
09230
PSERVERINFO psi;
09231
PPROPLIST ppropList;
09232
PROPLIST propList;
09233
PROP prop;
09234
UINT i, j;
09235
09236
struct {
09237 LPSTR pstrName;
09238 ATOM atom;
09239 LPSTR pstrSymbol;
09240 } apropatom[] =
09241 {
09242
"Icon", 0, MAKEINTRESOURCEA(FIELD_OFFSET(
SERVERINFO, atomIconProp)),
09243
"IconSM", 0, MAKEINTRESOURCEA(FIELD_OFFSET(
SERVERINFO, atomIconSmProp)),
09244
"ContextHelpID",0, MAKEINTRESOURCEA(FIELD_OFFSET(
SERVERINFO, atomContextHelpIdProp)),
09245
"Checkpoint", 0,
VAR(atomCheckpointProp),
09246
"Flash State", 0,
VAR(gaFlashWState),
09247
"DDETrack", 0,
VAR(atomDDETrack),
09248
"QOS", 0,
VAR(atomQOS),
09249
"DDEImp", 0,
VAR(atomDDEImp),
09250
"WNDOBJ", 0,
VAR(atomWndObj),
09251
"IMELevel", 0,
VAR(atomImeLevel),
09252 };
09253
09254
09255
09256
09257
09258 moveExpValuePtr(&psi,
VAR(gpsi));
09259
for (i = 0; i <
ARRAY_SIZE(apropatom); i++) {
09260
if (!
IS_PTR(apropatom[i].pstrSymbol)) {
09261
09262
09263
09264
09265
move(apropatom[0].atom, (ATOM *) ((BYTE *)psi + LOWORD(apropatom[i].pstrSymbol)));
09266 }
else {
09267
09268
09269
09270
09271 moveExpValue(&apropatom[i].atom, apropatom[i].pstrSymbol);
09272 }
09273 }
09274
09275
09276
09277
09278 ppropList = wnd.
ppropList;
09279
if (!ppropList) {
09280 Print(
"\tNULL Property List\n");
09281 }
else {
09282
move(propList, ppropList);
09283 Print(
"\tProperty List @0x%08x : %d Properties, %d total entries, %d free entries\n",
09284 ppropList,
09285 propList.
iFirstFree,
09286 propList.
cEntries,
09287 propList.
cEntries - propList.
iFirstFree);
09288
09289
09290
09291
09292
for (i = 0; !IsCtrlCHit() && i < propList.
iFirstFree; i++) {
09293 LPSTR pstrInternal;
09294
09295
move(prop, &ppropList->
aprop[i]);
09296
09297
09298
09299
09300 pstrInternal =
"";
09301
if (prop.
fs &
PROPF_INTERNAL) {
09302
for (j = 0; j <
ARRAY_SIZE(apropatom); j++) {
09303
if (prop.
atomKey == apropatom[j].atom) {
09304 pstrInternal = apropatom[j].pstrName;
09305
break;
09306 }
09307 }
09308 }
09309
09310 Print(
"\tProperty %d\n", i);
09311 Print(
"\t\tatomKey 0x%04x %s\n", prop.
atomKey, pstrInternal);
09312 Print(
"\t\tfs 0x%04x %s\n", prop.
fs,
GetFlags(GF_PROP, prop.
fs, NULL, FALSE));
09313 Print(
"\t\thData 0x%08x (%d)\n", prop.
hData, prop.
hData);
09314
09315
#ifdef KERNEL
09316
if (prop.
fs &
PROPF_INTERNAL) {
09317
if (j == 3) {
09318
CHECKPOINT cp;
09319
PCHECKPOINT pcp = (
PCHECKPOINT)prop.
hData;
09320
move(cp, pcp);
09321 Print(
"\t\tCheckPoint:\n");
09322 Print(
"\t\trcNormal (%d,%d),(%d,%d) %dx%d\n",
09323 cp.
rcNormal.left,
09324 cp.
rcNormal.top,
09325 cp.
rcNormal.right,
09326 cp.
rcNormal.bottom,
09327 cp.
rcNormal.right - cp.
rcNormal.left,
09328 cp.
rcNormal.bottom - cp.
rcNormal.top);
09329
09330 Print(
"\t\tptMin (%d,%d)\n", cp.
ptMin.x, cp.
ptMin.y);
09331 Print(
"\t\tptMax (%d,%d)\n", cp.
ptMax.x, cp.
ptMax.y);
09332 Print(
"\t\tfDragged:%d\n", cp.
fDragged);
09333 Print(
"\t\tfWasMaximizedBeforeMinimized:%d\n", cp.
fWasMaximizedBeforeMinimized);
09334 Print(
"\t\tfWasMinimizedBeforeMaximized:%d\n", cp.
fWasMinimizedBeforeMaximized);
09335 Print(
"\t\tfMinInitialized:%d\n", cp.
fMinInitialized);
09336 Print(
"\t\tfMaxInitiailized:%d\n", cp.
fMaxInitialized);
09337 }
09338 }
09339
#endif // ifdef KERNEL
09340
09341 Print(
"\n");
09342 }
09343 }
09344 }
09345
09346 Print(
"---\n");
09347
09348
return TRUE;
09349 }
09350
09351
09352
#ifdef KERNEL
09353
09354
09355
09356
09357
09358
09359
09360
09361
09362
09363
BOOL Idwpi(
09364 DWORD opts,
09365 PVOID param1)
09366 {
09367
09368
PWOWPROCESSINFO pwpi;
09369
WOWPROCESSINFO wpi;
09370
PPROCESSINFO ppi;
09371
09372
if (param1 == 0) {
09373 FOREACHPPI(ppi)
09374 Print("Process %x.\n", FIXKP(ppi));
09375 move(pwpi, FIXKP(&ppi->pwpi));
09376 SAFEWHILE (pwpi) {
09377 Idwpi(0, pwpi);
09378 Print(
"\n");
09379
move(pwpi,
FIXKP(&pwpi->pwpiNext));
09380 }
09381 NEXTEACHPPI()
09382 return TRUE;
09383 }
09384
09385 if (opts & OFLAG(p)) {
09386 ppi = (
PPROCESSINFO)
FIXKP(param1);
09387
move(pwpi, &ppi->pwpi);
09388
if (pwpi ==
NULL) {
09389 Print(
"No pwpis for this process.\n");
09390
return TRUE;
09391 }
09392 SAFEWHILE (pwpi) {
09393 Idwpi(0, pwpi);
09394 Print(
"\n");
09395
move(pwpi, &pwpi->pwpiNext);
09396 }
09397
return TRUE;
09398 }
09399
09400 pwpi = (
PWOWPROCESSINFO)
FIXKP(param1);
09401
move(wpi, pwpi);
09402
09403 Print(
"PWOWPROCESSINFO @ 0x%p\n", pwpi);
09404 Print(
"\tpwpiNext 0x%08lx\n", wpi.
pwpiNext);
09405 Print(
"\tptiScheduled 0x%08lx\n", wpi.
ptiScheduled);
09406 Print(
"\tnTaskLock 0x%08lx\n", wpi.
nTaskLock);
09407 Print(
"\tptdbHead 0x%08lx\n", wpi.
ptdbHead);
09408 Print(
"\tlpfnWowExitTask 0x%08lx\n", wpi.
lpfnWowExitTask);
09409 Print(
"\tpEventWowExec 0x%08lx\n", wpi.
pEventWowExec);
09410 Print(
"\thEventWowExecClient 0x%08lx\n", wpi.
hEventWowExecClient);
09411 Print(
"\tnSendLock 0x%08lx\n", wpi.
nSendLock);
09412 Print(
"\tnRecvLock 0x%08lx\n", wpi.
nRecvLock);
09413 Print(
"\tCSOwningThread 0x%08lx\n", wpi.
CSOwningThread);
09414 Print(
"\tCSLockCount 0x%08lx\n", wpi.
CSLockCount);
09415
return TRUE;
09416 }
09417
#endif // KERNEL
09418
09419
09420
09421
09422
09423
09424
09425
09426
09427
09428
09429
09430
09431
09432
09433
09434
#ifdef KERNEL
09435
09436
BOOL DHAVerifyHeap(
09437 PWIN32HEAP pHeap,
09438 BOOL bVerbose)
09439 {
09440 DbgHeapHead Alloc, *pAlloc = pHeap->pFirstAlloc;
09441
int sizeHead, counter = 0;
09442
char szHeadOrTail[HEAP_CHECK_SIZE];
09443
09444
if (pAlloc ==
NULL)
09445
return FALSE;
09446
09447 sizeHead = pHeap->dwFlags & WIN32_HEAP_USE_GUARDS ?
09448
sizeof(pHeap->szHead) : 0;
09449
09450
do {
09451
if (!tryMove(Alloc, pAlloc)) {
09452 Print(
"Failed to read pAlloc from %p\n", pAlloc);
09453
return FALSE;
09454 }
09455
09456
09457
09458
if (Alloc.mark != HEAP_ALLOC_MARK) {
09459 Print(
"!!! Bad mark found in allocation use !dso DbgHeapHead %p\n", pAlloc);
09460 }
09461
if (sizeHead) {
09462
if (!tryMove(szHeadOrTail, (PBYTE)pAlloc-
sizeof(szHeadOrTail))) {
09463 Print(
"Failed to read szHead from %p\n", (PBYTE)pAlloc-
sizeof(szHeadOrTail));
09464
return FALSE;
09465 }
09466
if (!RtlEqualMemory(szHeadOrTail, pHeap->szHead, sizeHead)) {
09467 Print(
"Head pattern corrupted for allocation %#p\n", pAlloc);
09468 }
09469
if (!tryMove(szHeadOrTail, (PBYTE)pAlloc +
sizeof(DbgHeapHead) + Alloc.size)) {
09470 Print(
"Failed to read szHead from %p\n", (PBYTE)pAlloc +
sizeof(DbgHeapHead) + Alloc.size);
09471
return FALSE;
09472 }
09473
if (!RtlEqualMemory(szHeadOrTail, pHeap->szTail, sizeHead)) {
09474 Print(
"Tail pattern corrupted for allocation %#p\n", pAlloc);
09475 }
09476 }
09477
if (bVerbose) {
09478 Print(
"Allocation %#p, tag %04d size %08d\n", pAlloc, Alloc.tag, Alloc.size);
09479 }
09480
if (counter++ > 100) {
09481 Print(
".");
09482 counter = 0;
09483 }
09484 pAlloc = Alloc.pNext;
09485 }
while (pAlloc !=
NULL);
09486
if (bVerbose) {
09487 Print(
"To dump an allocation use !dso DBGHEAPHEAD address\n");
09488 }
09489
09490
return TRUE;
09491 }
09492
09493
BOOL Idha(
09494 DWORD opts,
09495 PVOID pointer)
09496 {
09497
int ind, counter;
09498 SIZE_T sizeHead;
09499 WIN32HEAP localgWin32Heaps[MAX_HEAPS];
09500
09501
if (pointer == 0 && (opts & OFLAG(a) ==0)) {
09502 Print(
"Wrong usage: dha takes a pointer as a parameter\n");
09503
return FALSE;
09504 }
09505
09506
if (!tryMoveBlock(localgWin32Heaps, EvalExp(
VAR(gWin32Heaps)),
sizeof(localgWin32Heaps)))
09507 {
09508 Print(
"Can't read the heap globals fix symbols and !reload win32k.sys\n");
09509
return TRUE;
09510 }
09511
09512
09513
09514
09515
for (ind = counter = 0; ind < MAX_HEAPS; ind++) {
09516
09517
09518
09519
09520
if ((opts & OFLAG(a)) == 0) {
09521
if ((PVOID)localgWin32Heaps[ind].heap > pointer ||
09522 (
PBYTE)localgWin32Heaps[ind].heap + localgWin32Heaps[ind].heapReserveSize < (
PBYTE)pointer) {
09523
09524
continue;
09525 }
09526 }
09527
09528 Print(
"\nHeap number %d ", ind);
09529 Print(
"at address %p, flags %d is ", localgWin32Heaps[ind].heap, localgWin32Heaps[ind].dwFlags);
09530
09531
09532
if (localgWin32Heaps[ind].dwFlags & WIN32_HEAP_INUSE) {
09533
09534 DbgHeapHead Alloc, *pAlloc;
09535
09536 Print(
"in use\n");
09537
if (localgWin32Heaps[ind].pFirstAlloc ==
NULL)
09538
continue;
09539
09540 pAlloc = localgWin32Heaps[ind].pFirstAlloc;
09541
if (localgWin32Heaps[ind].dwFlags & WIN32_HEAP_USE_GUARDS) {
09542 sizeHead =
sizeof(localgWin32Heaps[0].szHead);
09543 Print(
" has string quards szHead %s, szTail %s\n",
09544 localgWin32Heaps[0].szHead,
09545 localgWin32Heaps[0].szTail);
09546 }
else {
09547 sizeHead = 0;
09548 Print(
"no string quards\n");
09549 }
09550
09551
if (opts & OFLAG(a)) {
09552
if (DHAVerifyHeap(&localgWin32Heaps[ind], opts & OFLAG(v))) {
09553 Print(
"WIN32HEAP at %p is healthy\n", localgWin32Heaps[ind].heap);
09554 }
09555
continue;
09556 }
09557
do {
09558
if (!tryMove(Alloc, pAlloc)) {
09559 Print(
"Failed to read pAlloc %p\n", pAlloc);
09560
return TRUE;
09561 }
09562
if ((
PBYTE)pAlloc - sizeHead < (
PBYTE)pointer &&
09563 (
PBYTE)pAlloc +
sizeof(DbgHeapHead) + Alloc.size + sizeHead > (
PBYTE)pointer) {
09564
09565
09566
09567
09568 Print(
"Found allocation %p ", pAlloc);
09569
if (pointer == (
PBYTE)pAlloc +
sizeof(DbgHeapHead)) {
09570 Print(
"as the begining of a heap allocated block\n");
09571 }
else {
09572 Print(
"inside a heap allocated block\n");
09573 }
09574 Print(
"tag %04d size %08d now verify the heap\n", Alloc.tag, Alloc.size);
09575
09576
09577
09578
if (DHAVerifyHeap(&localgWin32Heaps[ind], opts & OFLAG(v))) {
09579 Print(
"WIN32HEAP at %p is healthy\n", localgWin32Heaps[ind].heap);
09580 }
09581
return TRUE;
09582 }
else {
09583 pAlloc = Alloc.pNext;
09584
if (counter++ > 100) {
09585 counter = 0;
09586 Print(
".");
09587 }
09588 }
09589
09590 }
while (pAlloc !=
NULL);
09591 }
else {
09592 Print(
"NOT in use\n");
09593 }
09594 }
09595 Print(
"No heap contains this pointer %p\n", pointer);
09596
return TRUE;
09597 }
09598
09599
09600
09601
09602
09603
09604
09605
09606
09607
09608
BOOL Idws(
09609 DWORD opts,
09610 PVOID param1)
09611 {
09612
WINDOWSTATION winsta, *pwinsta;
09613 WCHAR ach[80];
09614
OBJECT_HEADER Head;
09615
OBJECT_HEADER_NAME_INFO NameInfo;
09616
09617 UNREFERENCED_PARAMETER(opts);
09618
09619
if (param1 == 0) {
09620
09621 FOREACHWINDOWSTATION(pwinsta)
09622
09623 Idws(0, pwinsta);
09624 Print("\n");
09625
09626 NEXTEACHWINDOWSTATION(pwinsta)
09627
09628 return TRUE;
09629 }
09630
09631 pwinsta = param1;
09632 move(winsta, pwinsta);
09633 move(Head, OBJECT_TO_OBJECT_HEADER(pwinsta));
09634 move(NameInfo, ((PCHAR)(OBJECT_TO_OBJECT_HEADER(pwinsta)) - Head.NameInfoOffset));
09635 move(ach, NameInfo.Name.Buffer);
09636 ach[NameInfo.Name.Length / sizeof(WCHAR)] = 0;
09637 Print("Windowstation: %ws @%0lx\n", ach, pwinsta);
09638 Print(" # Opens = %d\n", Head.HandleCount);
09639 Print(" pTerm = %0lx\n", winsta.pTerm);
09640 Print(" rpdeskList = %0lx\n", winsta.rpdeskList);
09641 Print(" dwFlags = %0lx\n", winsta.dwWSF_Flags);
09642 Print(" spklList = %0lx\n", winsta.spklList);
09643 Print(" ptiClipLock = %0lx\n", winsta.ptiClipLock);
09644 Print(" spwndClipOpen = %0lx\n", winsta.spwndClipOpen);
09645 Print(" spwndClipViewer = %0lx\n", winsta.spwndClipViewer);
09646 Print(" spwndClipOwner = %0lx\n", winsta.spwndClipOwner);
09647 Print(" pClipBase = %0lx\n", winsta.pClipBase);
09648 Print(" cNumClipFormats = %0lx\n", winsta.cNumClipFormats);
09649 Print(" ptiDrawingClipboard= %0lx\n", winsta.ptiDrawingClipboard);
09650 Print(" fClipboardChanged = %d\n", winsta.fClipboardChanged);
09651 Print(" pGlobalAtomTable = %0lx\n", winsta.pGlobalAtomTable);
09652 Print(" luidUser = %0lx.%lx\n", winsta.luidUser.HighPart,
09653 winsta.luidUser.LowPart);
09654
09655 return TRUE;
09656 }
09657
09658
09659
09660
09661
09662
09663
09664 BOOL Iddl(
09665 DWORD opts,
09666 PVOID param1)
09667 {
09668
#ifdef LOGDESKTOPLOCKS
09669
PDESKTOP pdesk;
09670
DESKTOP desk;
09671
OBJECT_HEADER Head;
09672 LogD log;
09673 PLogD pLog;
09674
BOOL bExtra =
FALSE;
09675
int i, ind;
09676 DWORD_PTR dwOffset;
09677
CHAR symbol[160];
09678
09679
if (param1 == 0) {
09680 Print(
"Use !ddl pdesk\n");
09681
return TRUE;
09682 }
09683
09684 pdesk = (
PDESKTOP)param1;
09685
move(desk, pdesk);
09686
move(Head,
OBJECT_TO_OBJECT_HEADER(pdesk));
09687
09688 Print(
"Desktop locks:\n\n");
09689 Print(
"# HandleCount = %d\n", Head.
HandleCount);
09690 Print(
"# PointerCount = %d\n", Head.
PointerCount);
09691 Print(
"# Log PointerCount = %d\n\n", desk.nLockCount);
09692
09693 pLog = desk.pLog;
09694
09695
if (opts & OFLAG(v)) {
09696 bExtra =
TRUE;
09697 }
09698
09699
for (i = 0; i < desk.nLogCrt; i++) {
09700
move(log, pLog);
09701
09702 Print(
"%s Tag %6d Extra %8lx\n",
09703 (log.type ?
"LOCK " :
"UNLOCK"),
09704 log.tag, log.extra);
09705
09706
if (bExtra) {
09707 Print(
"----------------------------------------------\n");
09708
09709
for (ind = 0; ind < 6; ind++) {
09710
if (log.trace[ind] == 0) {
09711
break;
09712 }
09713
09714 GetSym((PVOID)log.trace[ind], symbol, &dwOffset);
09715
if (*symbol) {
09716 Print(
"\t%s", symbol);
09717
if (dwOffset) {
09718 Print(
" + %x\n", dwOffset);
09719 }
09720 }
09721 }
09722 Print(
"\n");
09723 }
09724
09725 pLog++;
09726 }
09727 return TRUE;
09728
#else
09729
Print(
"!ddl is available only on LOGDESKTOPLOCKS enabled builds of win32k.sys\n");
09730
return FALSE;
09731 UNREFERENCED_PARAMETER(opts);
09732 UNREFERENCED_PARAMETER(param1);
09733
#endif // LOGDESKTOPLOCKS
09734
}
09735
09736
09737
09738
09739
09740
09741
09742
09743
BOOL Idcss(
09744 DWORD opts,
09745 PVOID param1)
09746 {
09747
int trace;
09748 DWORD_PTR off;
09749
PCRITSTACK pstack;
09750
CRITSTACK stack;
09751
CHAR symbol[160];
09752
09753
09754
09755
09756 moveExp(&pstack,
VAR(gCritStack));
09757
if (!tryMove(stack, pstack)) {
09758 Print(
"dcss: Could not get CRITSTACK.\n");
09759
return FALSE;
09760 }
09761
09762
if (stack.
nFrames > 0) {
09763 Print(
"--- Critical section stack trace ---\n");
09764
09765 Print(
"\nthread : %8lx\n", stack.
thread);
09766
09767 Print(
"\n\tRetAddr Call\n");
09768
09769
for (trace = 0; trace < stack.
nFrames; trace++) {
09770 GetSym((PVOID)stack.
trace[trace], symbol, &off);
09771 Print(
"\t%#p %s+%x\n", stack.
trace[trace], symbol, off);
09772 }
09773 }
09774
09775
return TRUE;
09776
09777 UNREFERENCED_PARAMETER(opts);
09778 UNREFERENCED_PARAMETER(param1);
09779 }
09780
09781
void PrintStackTrace(
09782 PVOID* parrTrace,
09783
int tracesCount)
09784 {
09785
int traceInd;
09786 DWORD_PTR dwOffset;
09787
CHAR symbol[160];
09788
09789
for (traceInd = 0; traceInd < tracesCount; traceInd++) {
09790
09791
if (parrTrace[traceInd] == 0) {
09792
break;
09793 }
09794
09795 GetSym(parrTrace[traceInd], symbol, &dwOffset);
09796
if (*symbol) {
09797 Print(
"\t%s", symbol);
09798
if (dwOffset) {
09799 Print(
"+%x\n", dwOffset);
09800 }
09801 }
09802 }
09803 Print(
"\n");
09804 }
09805
09806
BOOL Idvs(
09807 DWORD opts,
09808 PVOID param1)
09809 {
09810 PWin32Section pSection;
09811 Win32Section Section;
09812 PWin32MapView pView;
09813 Win32MapView View;
09814
BOOL bIncludeStackTrace =
FALSE;
09815
09816
if (EvalExp(
VAR(gpSections)) ==
NULL) {
09817 Print(
"!dvs is available if TRACE_MAP_VIEWS is defined\n");
09818
return FALSE;
09819 }
09820
09821 moveExpValuePtr(&pSection,
VAR(gpSections));
09822
09823
if (opts & OFLAG(s)) {
09824 bIncludeStackTrace =
TRUE;
09825 }
09826
09827
while (pSection !=
NULL) {
09828
if (!tryMove(Section, pSection)) {
09829 Print(
"!dvs: Could not get pSection structure for %#p\n", pSection);
09830
return FALSE;
09831 }
09832
09833 Print(
">>--------------------------------------\n");
09834
09835 Print(
"Section %#p\n"
09836
" pFirstView %#p\n"
09837
" SectionObject %#p\n"
09838
" SectionSize 0x%x\n"
09839
" SectionTag 0x%x\n",
09840 pSection,
09841 Section.pFirstView,
09842 Section.SectionObject,
09843 Section.SectionSize,
09844 Section.SectionTag);
09845
09846
if (bIncludeStackTrace) {
09847
#ifdef MAP_VIEW_STACK_TRACE
09848
DWORD_PTR dwOffset;
09849
CHAR symbol[160];
09850
int ind;
09851
09852
for (ind = 0; ind < MAP_VIEW_STACK_TRACE_SIZE; ind++) {
09853
if (Section.trace[ind] == 0) {
09854
break;
09855 }
09856
09857 GetSym((PVOID)Section.trace[ind], symbol, &dwOffset);
09858
if (*symbol) {
09859 Print(
" %s", symbol);
09860
if (dwOffset) {
09861 Print(
"+%x\n", dwOffset);
09862 }
09863 }
09864 }
09865 Print(
"\n");
09866
#endif // MAP_VIEW_STACK_TRACE
09867
}
09868
09869 pView = Section.pFirstView;
09870
09871
while (pView !=
NULL) {
09872
if (!tryMove(View, pView)) {
09873 Print(
"!dvs: Could not get pView structure for %#p\n", pView);
09874
return FALSE;
09875 }
09876
09877 Print(
"Views: ---------------------------------\n"
09878
" View %#p\n"
09879
" pViewBase %#p\n"
09880
" ViewSize %#p\n",
09881 pView,
09882 View.pViewBase,
09883 View.ViewSize);
09884
09885
if (bIncludeStackTrace) {
09886
#ifdef MAP_VIEW_STACK_TRACE
09887
DWORD_PTR dwOffset;
09888
CHAR symbol[160];
09889
int ind;
09890
09891
for (ind = 0; ind < MAP_VIEW_STACK_TRACE_SIZE; ind++) {
09892
if (View.trace[ind] == 0) {
09893
break;
09894 }
09895
09896 GetSym((PVOID)View.trace[ind], symbol, &dwOffset);
09897
if (*symbol) {
09898 Print(
" %s", symbol);
09899
if (dwOffset) {
09900 Print(
"+%x\n", dwOffset);
09901 }
09902 }
09903 }
09904 Print(
"\n");
09905
#endif // MAP_VIEW_STACK_TRACE
09906
}
09907
09908 pView = View.pNext;
09909 }
09910
09911 pSection = Section.pNext;
09912 }
09913
return TRUE;
09914 UNREFERENCED_PARAMETER(opts);
09915 UNREFERENCED_PARAMETER(param1);
09916 }
09917
09918
BOOL Idfa(
09919 DWORD opts,
09920 PVOID param1)
09921 {
09922
#if DBG
09923
DWORD_PTR dwOffset;
09924
CHAR symbol[160];
09925
int ind;
09926 PVOID* pTrace;
09927 PVOID trace;
09928
DWORD dwAllocFailIndex;
09929
DWORD* pdwAllocFailIndex;
09930
PEPROCESS pep;
09931
PEPROCESS* ppep;
09932
PETHREAD pet;
09933
PETHREAD* ppet;
09934
09935
if (EvalExp(
VAR(gdwAllocFailIndex)) ==
NULL) {
09936 Print(
"!dfa is available only in debug versions of win32k.sys\n");
09937
return FALSE;
09938 }
09939
09940 moveExp(&pdwAllocFailIndex,
VAR(gdwAllocFailIndex));
09941
if (!tryMove(dwAllocFailIndex, pdwAllocFailIndex)) {
09942 Print(
"dfa failure");
09943
return FALSE;
09944 }
09945
09946 moveExp(&ppep,
VAR(gpepRecorded));
09947
if (!tryMove(
pep, ppep)) {
09948 Print(
"dfa failure");
09949
return FALSE;
09950 }
09951 moveExp(&ppet,
VAR(gpetRecorded));
09952
if (!tryMove(pet, ppet)) {
09953 Print(
"dfa failure");
09954
return FALSE;
09955 }
09956
09957 Print(
"Fail allocation index %d 0x%04x\n", dwAllocFailIndex, dwAllocFailIndex);
09958 Print(
"pEProcess %#p pEThread %#p\n\n",
pep, pet);
09959
09960 moveExp(&pTrace,
VAR(gRecordedStackTrace));
09961
09962
for (ind = 0; ind < 12; ind++) {
09963
09964
if (!tryMove(trace, pTrace)) {
09965 Print(
"dfa failure");
09966
return FALSE;
09967 }
09968
09969
if (trace == 0) {
09970
break;
09971 }
09972
09973 GetSym((PVOID)trace, symbol, &dwOffset);
09974
if (*symbol) {
09975 Print(
"\t%s", symbol);
09976
if (dwOffset) {
09977 Print(
"+%x\n", dwOffset);
09978 }
09979 }
09980
09981 pTrace++;
09982 }
09983 Print(
"\n");
09984
#endif // DBG
09985 return TRUE;
09986 UNREFERENCED_PARAMETER(opts);
09987 UNREFERENCED_PARAMETER(param1);
09988 }
09989
09990
09991
09992
09993
09994
09995
09996
09997
09998
09999
BOOL Idpa(
10000 DWORD opts,
10001 PVOID param1)
10002 {
10003
PWin32AllocStats pAllocList;
10004
Win32AllocStats AllocList;
10005
DWORD* pdwPoolFlags;
10006
DWORD dwPoolFlags;
10007
BOOL bIncludeStackTrace =
FALSE;
10008
10009 moveExp(&pdwPoolFlags,
VAR(gdwPoolFlags));
10010
if (!tryMove(dwPoolFlags, pdwPoolFlags)) {
10011 Print(
"Couldn't evaluate win32k!gdwPoolFlags. The symbols may be wrong !\n");
10012
return FALSE;
10013 }
10014
10015
if (!(dwPoolFlags &
POOL_HEAVY_ALLOCS)) {
10016 Print(
"win32k.sys doesn't have pool instrumentation !\n");
10017
return FALSE;
10018 }
10019
10020
if (opts & OFLAG(s)) {
10021
if (dwPoolFlags &
POOL_CAPTURE_STACK) {
10022 bIncludeStackTrace =
TRUE;
10023 }
else {
10024 Print(
"win32k.sys doesn't have stack traces enabled for pool allocations\n");
10025 }
10026 }
10027
10028 moveExp(&pAllocList,
VAR(gAllocList));
10029
if (!tryMove(AllocList, pAllocList)) {
10030 Print(
"Could not get Win32AllocStats structure win32k!gAllocList !\n");
10031
return FALSE;
10032 }
10033
10034
10035
10036
10037
if (opts & OFLAG(c)) {
10038
10039 Print(
"- pool instrumentation enabled for win32k.sys\n");
10040
if (dwPoolFlags &
POOL_CAPTURE_STACK) {
10041 Print(
"- stack traces enabled for pool allocations\n");
10042 }
else {
10043 Print(
"- stack traces disabled for pool allocations\n");
10044 }
10045
10046
if (dwPoolFlags &
POOL_KEEP_FAIL_RECORD) {
10047 Print(
"- records of failed allocations enabled\n");
10048 }
else {
10049 Print(
"- records of failed allocations disabled\n");
10050 }
10051
10052
if (dwPoolFlags &
POOL_KEEP_FREE_RECORD) {
10053 Print(
"- records of free pool enabled\n");
10054 }
else {
10055 Print(
"- records of free pool disabled\n");
10056 }
10057
10058 Print(
"\n");
10059
10060 Print(
" CrtM CrtA MaxM MaxA Head\n");
10061 Print(
"------------|------------|------------|------------|------------|\n");
10062 Print(
" 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n",
10063 AllocList.
dwCrtMem,
10064 AllocList.
dwCrtAlloc,
10065 AllocList.
dwMaxMem,
10066 AllocList.
dwMaxAlloc,
10067 AllocList.
pHead);
10068
10069
return TRUE;
10070 }
10071
10072
if (opts & OFLAG(f)) {
10073
10074
DWORD dwFailRecordCrtIndex;
10075
DWORD* pdwFailRecordCrtIndex;
10076
DWORD dwFailRecordTotalFailures;
10077
DWORD* pdwFailRecordTotalFailures;
10078
DWORD dwFailRecords;
10079
DWORD* pdwFailRecords;
10080
DWORD Ind, dwFailuresToDump;
10081
PPOOLRECORD* ppFailRecord;
10082
PPOOLRECORD pFailRecord;
10083
PPOOLRECORD pFailRecordOrg;
10084
10085
if (!(dwPoolFlags &
POOL_KEEP_FAIL_RECORD)) {
10086 Print(
"win32k.sys doesn't have records of failed allocations !\n");
10087
return TRUE;
10088 }
10089
10090 moveExp(&pdwFailRecordTotalFailures,
VAR(gdwFailRecordTotalFailures));
10091
if (!tryMove(dwFailRecordTotalFailures, pdwFailRecordTotalFailures)) {
10092 Print(
"Could not get win32k!gdwFailRecordTotalFailures !\n");
10093
return FALSE;
10094 }
10095
10096
if (dwFailRecordTotalFailures == 0) {
10097 Print(
"No allocation failure in win32k.sys !\n");
10098
return TRUE;
10099 }
10100
10101 moveExp(&pdwFailRecordCrtIndex,
VAR(gdwFailRecordCrtIndex));
10102
if (!tryMove(dwFailRecordCrtIndex, pdwFailRecordCrtIndex)) {
10103 Print(
"Could not get win32k!gdwFailRecordCrtIndex !\n");
10104
return FALSE;
10105 }
10106
10107 moveExp(&pdwFailRecords,
VAR(gdwFailRecords));
10108
if (!tryMove(dwFailRecords, pdwFailRecords)) {
10109 Print(
"Could not get win32k!gdwFailRecords !\n");
10110
return FALSE;
10111 }
10112
10113
if (dwFailRecordTotalFailures < dwFailRecords) {
10114 dwFailuresToDump = dwFailRecordTotalFailures;
10115 }
else {
10116 dwFailuresToDump = dwFailRecords;
10117 }
10118
10119 moveExp(&ppFailRecord,
VAR(gparrFailRecord));
10120
10121
if (!tryMove(pFailRecord, ppFailRecord)) {
10122 Print(
"\nCould not move from %#p !\n\n", ppFailRecord);
10123
return FALSE;
10124 }
10125
10126 pFailRecordOrg = pFailRecord;
10127
10128 Print(
"\nFailures to dump : %d\n\n", dwFailuresToDump);
10129
10130
for (Ind = 0; Ind < dwFailuresToDump; Ind++) {
10131
10132
POOLRECORD FailRecord;
10133
DWORD tag[2] = {0, 0};
10134
10135
if (dwFailRecordCrtIndex == 0) {
10136 dwFailRecordCrtIndex = dwFailRecords - 1;
10137 }
else {
10138 dwFailRecordCrtIndex--;
10139 }
10140
10141 pFailRecord = pFailRecordOrg + dwFailRecordCrtIndex;
10142
10143
10144
10145
10146
if (!tryMove(FailRecord, pFailRecord)) {
10147 Print(
"\nCould not move from %#p !\n\n", pFailRecord);
10148
break;
10149 }
10150
10151 tag[0] = PtrToUlong(FailRecord.
ExtraData);
10152
10153 Print(
"Allocation for tag '%s' size 0x%x failed\n",
10154 &tag,
10155 FailRecord.
size);
10156
10157 PrintStackTrace(FailRecord.
trace, RECORD_STACK_TRACE_SIZE);
10158 }
10159 }
10160
if (opts & OFLAG(r)) {
10161
10162
DWORD dwFreeRecordCrtIndex;
10163
DWORD* pdwFreeRecordCrtIndex;
10164
DWORD dwFreeRecordTotalFrees;
10165
DWORD* pdwFreeRecordTotalFrees;
10166
DWORD dwFreeRecords;
10167
DWORD* pdwFreeRecords;
10168
DWORD Ind, dwFreesToDump;
10169
PPOOLRECORD* ppFreeRecord;
10170
PPOOLRECORD pFreeRecord;
10171
PPOOLRECORD pFreeRecordOrg;
10172
10173
if (!(dwPoolFlags &
POOL_KEEP_FREE_RECORD)) {
10174 Print(
"win32k.sys doesn't have records of free pool !\n");
10175
return FALSE;
10176 }
10177
10178 moveExp(&pdwFreeRecordTotalFrees,
VAR(gdwFreeRecordTotalFrees));
10179
if (!tryMove(dwFreeRecordTotalFrees, pdwFreeRecordTotalFrees)) {
10180 Print(
"Could not get win32k!gdwFreeRecordTotalFrees !\n");
10181
return FALSE;
10182 }
10183
10184
if (dwFreeRecordTotalFrees == 0) {
10185 Print(
"No free pool in win32k.sys !\n");
10186
return FALSE;
10187 }
10188
10189 moveExp(&pdwFreeRecordCrtIndex,
VAR(gdwFreeRecordCrtIndex));
10190
if (!tryMove(dwFreeRecordCrtIndex, pdwFreeRecordCrtIndex)) {
10191 Print(
"Could not get win32k!gdwFreeRecordCrtIndex !\n");
10192
return FALSE;
10193 }
10194
10195 moveExp(&pdwFreeRecords,
VAR(gdwFreeRecords));
10196
if (!tryMove(dwFreeRecords, pdwFreeRecords)) {
10197 Print(
"Could not get win32k!gdwFreeRecords !\n");
10198
return FALSE;
10199 }
10200
10201
if (dwFreeRecordTotalFrees < dwFreeRecords) {
10202 dwFreesToDump = dwFreeRecordTotalFrees;
10203 }
else {
10204 dwFreesToDump = dwFreeRecords;
10205 }
10206
10207 moveExp(&ppFreeRecord,
VAR(gparrFreeRecord));
10208
10209
if (!tryMove(pFreeRecord, ppFreeRecord)) {
10210 Print(
"\nCould not move from %#p !\n\n", ppFreeRecord);
10211
return FALSE;
10212 }
10213
10214 pFreeRecordOrg = pFreeRecord;
10215
10216 Print(
"\nFrees to dump : %d\n\n", dwFreesToDump);
10217
10218
for (Ind = 0; Ind < dwFreesToDump; Ind++) {
10219
10220
POOLRECORD FreeRecord;
10221
10222
if (dwFreeRecordCrtIndex == 0) {
10223 dwFreeRecordCrtIndex = dwFreeRecords - 1;
10224 }
else {
10225 dwFreeRecordCrtIndex--;
10226 }
10227
10228 pFreeRecord = pFreeRecordOrg + dwFreeRecordCrtIndex;
10229
10230
10231
10232
10233
if (!tryMove(FreeRecord, pFreeRecord)) {
10234 Print(
"\nCould not move from %#p !\n\n", pFreeRecord);
10235
break;
10236 }
10237
10238 Print(
"Free pool for p %#p size 0x%x\n",
10239 FreeRecord.
ExtraData,
10240 FreeRecord.
size);
10241
10242 PrintStackTrace(FreeRecord.
trace, RECORD_STACK_TRACE_SIZE);
10243 }
10244 }
10245
10246
if (opts & OFLAG(v)) {
10247
10248 PWin32PoolHead ph;
10249 Win32PoolHead h;
10250
10251
10252 ph = AllocList.
pHead;
10253
10254
while (ph !=
NULL) {
10255
10256
if (!tryMove(h, ph)) {
10257 Print(
"\nCould not move from %#p !\n\n", ph);
10258
break;
10259 }
10260
10261 Print(
"p %#p pHead %#p size %x\n",
10262 ph + 1, ph, h.size);
10263
10264
if (bIncludeStackTrace) {
10265
10266 DWORD_PTR dwOffset;
10267
CHAR symbol[160];
10268
int ind;
10269 PVOID trace;
10270 PVOID* pTrace;
10271
10272 pTrace = h.pTrace;
10273
10274
for (ind = 0; ind < POOL_ALLOC_TRACE_SIZE; ind++) {
10275
10276
if (!tryMove(trace, pTrace)) {
10277 Print(
"dpa failure\n");
10278
return FALSE;
10279 }
10280
10281
if (trace == 0) {
10282
break;
10283 }
10284
10285 GetSym((PVOID)trace, symbol, &dwOffset);
10286
if (*symbol) {
10287 Print(
"\t%s", symbol);
10288
if (dwOffset) {
10289 Print(
"+%x\n", dwOffset);
10290 }
10291 }
10292
10293 pTrace++;
10294 }
10295 Print(
"\n");
10296 }
10297
10298 ph = h.pNext;
10299 }
10300
return TRUE;
10301 }
10302
10303
if (opts & OFLAG(p)) {
10304
10305 PWin32PoolHead ph;
10306 Win32PoolHead h;
10307
BYTE* p;
10308
10309
if (param1 == 0) {
10310
return TRUE;
10311 }
10312
10313 p = (
BYTE*)param1;
10314
10315 ph = AllocList.
pHead;
10316
10317
while (ph !=
NULL) {
10318
10319
if (!tryMove(h, ph)) {
10320 Print(
"\nCould not move from %#p !\n\n", ph);
10321
break;
10322 }
10323
10324
if (p >= (
BYTE*)ph && p <= (
BYTE*)ph + h.size +
sizeof(Win32PoolHead)) {
10325
10326 PVOID Trace[
RECORD_STACK_TRACE_SIZE];
10327
10328 Print(
"p %#p pHead %#p size %x\n",
10329 ph + 1, ph, h.size);
10330
10331
moveBlock(Trace, h.pTrace,
sizeof(PVOID) * RECORD_STACK_TRACE_SIZE);
10332
10333
10334 PrintStackTrace(Trace, RECORD_STACK_TRACE_SIZE);
10335
return TRUE;
10336 }
10337
10338 ph = h.pNext;
10339 }
10340
return TRUE;
10341 }
10342
10343
return TRUE;
10344 }
10345
#endif // KERNEL
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
BOOL Ifno(
10361 DWORD opts,
10362 PVOID param1)
10363 {
10364
HANDLEENTRY he, heBest, heAfter, *phe;
10365
DWORD i;
10366
DWORD hBest, hAfter;
10367 DWORD_PTR dw;
10368
10369 UNREFERENCED_PARAMETER(opts);
10370
10371
if (param1 ==
NULL) {
10372 Print(
"Expected an address.\n");
10373
return FALSE;
10374 }
10375
10376 dw = (DWORD_PTR)
FIXKP(param1);
10377 heBest.
phead =
NULL;
10378 heAfter.
phead = (PVOID)-1;
10379
10380
if (dw != (DWORD_PTR)param1) {
10381
10382
10383
10384
FOREACHHANDLEENTRY(phe, he, i)
10385 if ((DWORD_PTR)he.phead <= dw &&
10386 heBest.phead < he.phead &&
10387 he.bType != TYPE_FREE) {
10388 heBest = he;
10389 hBest = i;
10390 }
10391
if ((DWORD_PTR)he.
phead > dw &&
10392 heAfter.
phead > he.
phead &&
10393 he.
bType !=
TYPE_FREE) {
10394 heAfter = he;
10395 hAfter = i;
10396 }
10397
NEXTEACHHANDLEENTRY()
10398
10399 if (heBest.phead != NULL) {
10400 Print(
"Nearest guy before %#p is a %s object located at %#p (i=%x).\n",
10401 dw, aszTypeNames[heBest.
bType], heBest.
phead, hBest);
10402 }
10403
if (heAfter.
phead != (PVOID)-1) {
10404 Print(
"Nearest guy after %#p is a %s object located at %#p. (i=%x)\n",
10405 dw, aszTypeNames[heAfter.
bType], heAfter.
phead, hAfter);
10406 }
10407 }
else {
10408
10409
10410
10411
FOREACHHANDLEENTRY(phe, he, i)
10412 if ((DWORD_PTR)FIXKP(he.phead) <= dw &&
10413 heBest.phead < he.phead &&
10414 he.bType != TYPE_FREE) {
10415 heBest = he;
10416 hBest = i;
10417 }
10418
if ((DWORD_PTR)
FIXKP(he.
phead) > dw &&
10419 heAfter.
phead > he.
phead &&
10420 he.
bType !=
TYPE_FREE) {
10421 heAfter = he;
10422 hAfter = i;
10423 }
10424
NEXTEACHHANDLEENTRY()
10425
10426 if (heBest.phead != NULL) {
10427 Print(
"Nearest guy before %#p is a %s object located at %#p (i=%x).\n",
10428 dw, aszTypeNames[heBest.
bType],
FIXKP(heBest.
phead), hBest);
10429 }
10430
if (heAfter.
phead != (PVOID)-1) {
10431 Print(
"Nearest guy after %#p is a %s object located at %#p. (i=%x)\n",
10432 dw, aszTypeNames[heAfter.
bType],
FIXKP(heAfter.
phead), hAfter);
10433 }
10434 }
10435
return TRUE;
10436 }
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
BOOL Ifrr(
10453 DWORD opts,
10454 PVOID param1,
10455 PVOID param2,
10456 PVOID param3,
10457 PVOID param4)
10458 {
10459 DWORD_PTR pSrc1 = (DWORD_PTR)param1;
10460 DWORD_PTR pSrc2 = (DWORD_PTR)param2;
10461 DWORD_PTR pRef1 = (DWORD_PTR)param3;
10462 DWORD_PTR pRef2 = (DWORD_PTR)param4;
10463 DWORD_PTR dw;
10464 DWORD_PTR buffer[
PAGE_SIZE /
sizeof(DWORD_PTR)];
10465
10466 UNREFERENCED_PARAMETER(opts);
10467
10468
if (pSrc2 < pSrc1) {
10469 Print(
"Source range improper. Values reversed.\n");
10470 dw = pSrc1;
10471 pSrc1 = pSrc2;
10472 pSrc2 = dw;
10473 }
10474
if (pRef2 == 0) {
10475 pRef2 = pRef1;
10476 }
10477
if (pRef2 < pRef1) {
10478 Print(
"Reference range improper. Values reversed.\n");
10479 dw = pRef1;
10480 pRef1 = pRef2;
10481 pRef2 = dw;
10482 }
10483
10484 pSrc1 &= MAXULONG_PTR -
PAGE_SIZE + 1;
10485 pSrc2 = (pSrc2 + (
sizeof(DWORD_PTR)-1)) & (MAXULONG_PTR - (
sizeof(DWORD_PTR)-1));
10486
10487 Print(
"Searching range (%#p-%#p) for references to (%#p-%#p)...",
10488 pSrc1, pSrc2, pRef1, pRef2);
10489
10490
for (; pSrc1 < pSrc2; pSrc1 +=
PAGE_SIZE) {
10491
BOOL fSuccess;
10492
10493
if (!(pSrc1 & 0xFFFFFF)) {
10494 Print(
"\nSearching %#p...", pSrc1);
10495 }
10496 fSuccess = tryMoveBlock(buffer, (PVOID)pSrc1,
sizeof(buffer));
10497
if (!fSuccess) {
10498
10499
10500
10501 }
else {
10502
for (dw = 0; dw <
ARRAY_SIZE(buffer); dw++) {
10503
if (buffer[dw] >= pRef1 && buffer[dw] <= pRef2) {
10504 Print(
"\n[%#p] = %#p ",
10505 pSrc1 + dw *
sizeof(DWORD_PTR),
10506 buffer[dw]);
10507 }
10508 }
10509 }
10510
if (IsCtrlCHit()) {
10511 Print(
"\nSearch aborted.\n");
10512
return TRUE;
10513 }
10514 }
10515 Print(
"\nSearch complete.\n");
10516
return TRUE;
10517 }
10518
10519
10520
#ifdef KERNEL
10521
10522
#if 0
10523
VOID ddGdiDevice(
10524 PGDI_DEVICE pGdiDevice)
10525 {
10526 Print(
"\t\tGDI_DEVICE\n");
10527 Print(
"\t\tcRefCount = %d\n", pGdiDevice->cRefCount);
10528 Print(
"\t\thDevInfo = 0x%.8x\n", pGdiDevice->hDevInfo);
10529 Print(
"\t\thDev = 0x%.8x\n", pGdiDevice->hDev);
10530 Print(
"\t\trcScreen = (%d,%d)-(%d,%d) %dx%d\n",
10531 pGdiDevice->rcScreen.left, pGdiDevice->rcScreen.top,
10532 pGdiDevice->rcScreen.right, pGdiDevice->rcScreen.bottom,
10533 pGdiDevice->rcScreen.right - pGdiDevice->rcScreen.left,
10534 pGdiDevice->rcScreen.bottom - pGdiDevice->rcScreen.top);
10535 Print(
"\t\tDEVMODEW\n");
10536 }
10537
#endif
10538
#endif
10539
10540
10541
void
10542
DumpMonitor(
PMONITOR pMonitor, LPSTR pstrPrefix)
10543 {
10544 Print(
"%shead.h = 0x%.8x\n", pstrPrefix, pMonitor->
head.
h);
10545 Print(
"%shead.cLockObj = 0x%.8x\n", pstrPrefix, pMonitor->
head.
cLockObj);
10546 Print(
"%spMonitorNext = 0x%.8x\n", pstrPrefix, pMonitor->
pMonitorNext);
10547 Print(
"%sdwMONFlags = 0x%.8x %s\n", pstrPrefix, pMonitor->
dwMONFlags,
GetFlags(GF_MON, pMonitor->
dwMONFlags, NULL, FALSE));
10548
10549 Print(
"%srcMonitor = (%d,%d)-(%d,%d) %dx%d\n",
10550 pstrPrefix,
10551 pMonitor->
rcMonitor.left, pMonitor->
rcMonitor.top,
10552 pMonitor->
rcMonitor.right, pMonitor->
rcMonitor.bottom,
10553 pMonitor->
rcMonitor.right - pMonitor->
rcMonitor.left,
10554 pMonitor->
rcMonitor.bottom - pMonitor->
rcMonitor.top);
10555
10556 Print(
"%srcWork = (%d,%d)-(%d,%d) %dx%d\n",
10557 pstrPrefix,
10558 pMonitor->
rcWork.left, pMonitor->
rcWork.top,
10559 pMonitor->
rcWork.right, pMonitor->
rcWork.bottom,
10560 pMonitor->
rcWork.right - pMonitor->
rcWork.left,
10561 pMonitor->
rcWork.bottom - pMonitor->
rcWork.top);
10562
10563 Print(
"%shrgnMonitor = 0x%.8x\n", pstrPrefix, pMonitor->
hrgnMonitor);
10564 Print(
"%scFullScreen = %d\n", pstrPrefix, pMonitor->
cFullScreen);
10565 Print(
"%scwndStack = %d\n", pstrPrefix, pMonitor->
cWndStack);
10566
10567
#if 0
10568
Print(
"%spMonGdiDevice = 0x%.8x\n", pstrPrefix, pMonitor->pMonGdiDevice);
10569
10570
if (pMonitor->pMonGdiDevice) {
10571
move(gdiDevice, pMonitor->pMonGdiDevice);
10572 ddGdiDevice(&gdiDevice);
10573 }
else {
10574 Print(
"\n\n");
10575 Print(
"ERROR - pMonGdiDevice missing\n");
10576 Print(
"\n\n");
10577 }
10578
#endif
10579
}
10580
10581
10582
10583
BOOL
10584
Idmon(DWORD opts, PVOID param1)
10585 {
10586
MONITOR monitor;
10587
10588 UNREFERENCED_PARAMETER(opts);
10589
10590
if (!param1) {
10591
return FALSE;
10592 }
10593
10594 Print(
"Dumping MONITOR at 0x%.8x\n", param1);
10595
move(monitor, (
PMONITOR)param1);
10596
DumpMonitor(&monitor,
"\t");
10597
10598
return TRUE;
10599 }
10600
10601
BOOL Idy(
10602 DWORD opts,
10603 PVOID param1)
10604 {
10605
PDISPLAYINFO pdi, gpdi;
10606
DISPLAYINFO di;
10607
PMONITOR pMonitor;
10608
MONITOR monitor;
10609
PSERVERINFO psi;
10610
SERVERINFO si;
10611
int i;
10612
PSHAREDINFO pshi;
10613
10614
#if 0
10615
GDI_DEVICE gdiDevice;
10616
#endif
10617
10618 UNREFERENCED_PARAMETER(opts);
10619
10620 moveExp(&pshi,
VAR(gSharedInfo));
10621
move(gpdi, &pshi->
pDispInfo);
10622
10623
if (param1) {
10624 pdi = (
DISPLAYINFO *)param1;
10625 }
else {
10626 pdi = gpdi;
10627 }
10628
10629
move(di, pdi);
10630
10631 moveExpValuePtr(&psi,
VAR(gpsi));
10632
move(si, psi);
10633
10634 Print(
"Dumping DISPLAYINFO at 0x%.8x\n", pdi);
10635 Print(
"\thDev = 0x%.8x\n",
di.hDev);
10636 Print(
"\thdcScreen = 0x%.8x\n",
di.hdcScreen);
10637
10638 Print(
"\thdcBits = 0x%.8x\n",
di.hdcBits);
10639
10640 Print(
"\thdcGray = 0x%.8x\n",
di.hdcGray);
10641 Print(
"\thbmGray = 0x%.8x\n",
di.hbmGray);
10642 Print(
"\tcxGray = %d\n",
di.cxGray);
10643 Print(
"\tcyGray = %d\n",
di.cyGray);
10644 Print(
"\tpdceFirst = 0x%.8x\n",
di.pdceFirst);
10645 Print(
"\tpspbFirst = 0x%.8x\n",
di.pspbFirst);
10646 Print(
"\tcMonitors (visible) = %d\n",
di.cMonitors);
10647 Print(
"\tpMonitorPrimary = 0x%.8x\n",
RebaseSharedPtr(
di.pMonitorPrimary));
10648 Print(
"\tpMonitorFirst = 0x%.8x\n",
RebaseSharedPtr(
di.pMonitorFirst));
10649
10650 Print(
"\trcScreen = (%d,%d)-(%d,%d) %dx%d\n",
10651
10652 si.rcScreen.left, si.rcScreen.top,
10653 si.rcScreen.right, si.rcScreen.bottom,
10654 si.rcScreen.right - si.rcScreen.left,
10655 si.rcScreen.bottom - si.rcScreen.top);
10656
10657 Print(
"\thrgnScreen = 0x%.8x\n",
di.hrgnScreen);
10658 Print(
"\tdmLogPixels = %d\n",
di.dmLogPixels);
10659 Print(
"\tBitCountMax = %d\n",
di.BitCountMax);
10660 Print(
"\tfDesktopIsRect = %d\n",
di.fDesktopIsRect);
10661
10662
#if 0
10663
if (
di.pDispGdiDevice) {
10664
move(gdiDevice,
di.pDispGdiDevice);
10665 ddGdiDevice(&gdiDevice);
10666 }
else {
10667 Print(
"\n\n");
10668 Print(
"ERROR - pDispGdiDevice missing\n");
10669 Print(
"\n\n");
10670 }
10671
#endif
10672
10673 Print(
"\n");
10674
10675
if (pdi == gpdi) {
10676
if (si.dmLogPixels !=
di.dmLogPixels) {
10677 Print(
"\n\n");
10678 Print(
"ERROR - dmLogPixels doesn't match in gpsi (%d) and gpDispInfo (%d)\n",
10679 si.dmLogPixels,
di.dmLogPixels);
10680 Print(
"\n\n");
10681 }
10682
10683
#if 0
10684
if (
di.pDispGdiDevice) {
10685
if (!
EqualRect(&si.rcScreen, &gdiDevice.rcScreen)) {
10686 Print(
"\n\n");
10687 Print(
"ERROR - rcScreen doesn't match in gpsi (%d,%d)-(%d,%d) and gpDispInfo (%d,%d)-(%d,%d)\n",
10688 si.rcScreen.left, si.rcScreen.top,
10689 si.rcScreen.right, si.rcScreen.bottom,
10690 gdiDevice.rcScreen.left, gdiDevice.rcScreen.top,
10691 gdiDevice.rcScreen.right, gdiDevice.rcScreen.bottom);
10692 Print(
"\n\n");
10693 }
10694 }
10695
#endif
10696
}
10697
10698
10699
for ( pMonitor =
RebaseSharedPtr(
di.pMonitorFirst), i = 1;
10700 pMonitor;
10701 pMonitor =
RebaseSharedPtr(monitor.
pMonitorNext), i++) {
10702
10703 Print(
"\tMonitor %d, pMonitor = 0x%.8x\n", i, pMonitor);
10704
move(monitor, pMonitor);
10705
DumpMonitor(&monitor,
"\t\t");
10706 Print(
"\n");
10707 }
10708
10709
return TRUE;
10710 }
10711
10712
10713
#ifdef KERNEL
10714
10715
10716
10717
10718
10719
10720
10721
10722
typedef struct {
10723
int iVK;
10724 LPSTR pszVK;
10725 } VK, *PVK;
10726
10727 VK aVK[] = {
10728 { VK_SHIFT,
"SHIFT" },
10729 { VK_LSHIFT,
"LSHIFT" },
10730 { VK_RSHIFT,
"RSHIFT" },
10731 { VK_CONTROL,
"CONTROL" },
10732 { VK_LCONTROL,
"LCONTROL" },
10733 { VK_RCONTROL,
"RCONTROL" },
10734 { VK_MENU,
"MENU" },
10735 { VK_LMENU,
"LMENU" },
10736 { VK_RMENU,
"RMENU" },
10737 { VK_NUMLOCK,
"NUMLOCK" },
10738 { VK_CAPITAL,
"CAPITAL" },
10739 { VK_LBUTTON,
"LBUTTON" },
10740 { VK_MBUTTON,
"MBUTTON" },
10741 { VK_RBUTTON,
"RBUTTON" },
10742 { VK_XBUTTON1,
"XBUTTON1" },
10743 { VK_XBUTTON2,
"XBUTTON2" },
10744 { VK_RETURN ,
"ENTER" },
10745 { VK_KANA,
"KANA/HANJA" },
10746 { VK_OEM_8,
"OEM_8" },
10747
10748 { 0,
NULL }
10749 };
10750
10751
BOOL Ikbd(
10752 DWORD opts,
10753 PVOID param1)
10754 {
10755
PQ pq;
10756
Q q;
10757
PBYTE pb, pbr;
10758
int i;
10759
BYTE afUpdateKeyState[
CBKEYSTATE +
CBKEYSTATERECENTDOWN];
10760
PBYTE pgafAsyncKeyState;
10761
BYTE afAsyncKeyState[
CBKEYSTATE];
10762
PBYTE pgafRawKeyState;
10763
BYTE afRawKeyState[
CBKEYSTATE];
10764
UINT PhysModifiers;
10765
10766
if (opts & OFLAG(a)) {
10767
PTHREADINFO pti;
10768
10769 opts &= ~OFLAG(a);
10770 FOREACHPTI(pti);
10771
move(pq, &pti->
pq);
10772 Ikbd(opts, pq);
10773 NEXTEACHPTI(pti);
10774
return TRUE;
10775 }
10776
10777
10778
10779
10780
10781
if (opts & OFLAG(u)) {
10782
if (param1 ==
NULL) {
10783 Print(
"provide arg 2 of ProcessUpdateKeyEvent(), or WM_UPDATEKEYSTATE wParam\n");
10784
return FALSE;
10785 }
10786 pb = (
PBYTE)param1;
10787
move(afUpdateKeyState, pb);
10788 pb = afUpdateKeyState;
10789 pbr = afUpdateKeyState +
CBKEYSTATE;
10790 Print(
"Key State: === NEW STATE ==== Asynchronous Physical\n");
10791
10792 }
else {
10793
if (param1) {
10794 pq = (
PQ)param1;
10795 }
else {
10796 moveExpValuePtr(&pq,
VAR(gpqForeground));
10797 }
10798
10799
10800
10801
10802
move(q, pq);
10803
if (q.
ptiKeyboard) {
10804 Idt(OFLAG(p), q.
ptiKeyboard);
10805 }
10806
10807 pb = (
PBYTE)&(q.
afKeyState);
10808 pbr = (
PBYTE)&(q.
afKeyRecentDown);
10809 Print(
"Key State: QUEUE %lx Asynchronous Raw\n", pq);
10810 }
10811
10812 moveExp(&pgafAsyncKeyState,
VAR(gafAsyncKeyState));
10813 tryMove(afAsyncKeyState, pgafAsyncKeyState);
10814
10815 moveExp(&pgafRawKeyState,
VAR(gafRawKeyState));
10816 tryMove(afRawKeyState, pgafRawKeyState);
10817
10818 Print(
" Down Toggle Recent Down Toggle Down Toggle\n");
10819
for (i = 0; aVK[i].pszVK !=
NULL; i++) {
10820 Print(
"VK_%s:\t%d %d %d %d %d %d %d\n",
10821 aVK[i].pszVK,
10822
TestKeyDownBit(pb, aVK[i].iVK) != 0,
10823
TestKeyToggleBit(pb, aVK[i].iVK) != 0,
10824
TestKeyRecentDownBit(pbr, aVK[i].iVK) != 0,
10825
TestKeyDownBit(afAsyncKeyState, aVK[i].iVK) != 0,
10826
TestKeyToggleBit(afAsyncKeyState, aVK[i].iVK) != 0,
10827
TestKeyDownBit(afRawKeyState, aVK[i].iVK) != 0,
10828
TestKeyToggleBit(afRawKeyState, aVK[i].iVK) != 0);
10829 }
10830
10831 moveExpValuePtr(&PhysModifiers,
VAR(gfsSASModifiersDown));
10832 Print(
"PhysModifiers = %x\n");
10833
return TRUE;
10834 }
10835
#endif // KERNEL
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
BOOL Itest()
10854 {
10855 PVOID p;
10856 DWORD_PTR cch;
10857
CHAR ach[80];
10858
10859 Print(
"Print test!\n");
10860 SAFEWHILE(TRUE) {
10861 Print(
"SAFEWHILE test... Hit Ctrl-C NOW!\n");
10862 }
10863 p = EvalExp(
VAR(gpsi));
10864 Print(
"EvalExp(%s) = %#p\n",
VAR(gpsi), p);
10865 GetSym(p, ach, &cch);
10866 Print(
"GetSym(%#p) = %s\n", p, ach);
10867
if (IsWinDbg()) {
10868 Print(
"I think windbg is calling me.\n");
10869 }
else {
10870 Print(
"I don't think windbg is calling me.\n");
10871 }
10872 Print(
"MoveBlock test...\n");
10873
moveBlock(&p, EvalExp(
VAR(gpsi)),
sizeof(PVOID));
10874 Print(
"MoveBlock(%#p) = %#p.\n", EvalExp(
VAR(gpsi)), p);
10875
10876 Print(
"moveExp test...\n");
10877 moveExp(&p,
VAR(gpsi));
10878 Print(
"moveExp(%s) = %x.\n",
VAR(gpsi), p);
10879
10880 Print(
"moveExpValue test...\n");
10881 moveExpValuePtr(&p,
VAR(gpsi));
10882 Print(
"moveExpValue(%s) = %#p.\n",
VAR(gpsi), p);
10883
10884 Print(
"Basic tests complete.\n");
10885
return TRUE;
10886 }
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
BOOL Iuver()
10901 {
10902
PSERVERINFO psi;
10903 WORD wSRVIFlags;
10904
10905
#if DBG
10906
Print(
"USEREXTS version: Checked.\n"
10907
"WIN32K.SYS version: ");
10908
#else
10909
Print(
"USEREXTS version: Free.\n"
10910
"WIN32K.SYS version: ");
10911
#endif
10912
10913 moveExpValuePtr(&psi,
VAR(gpsi));
10914
move(wSRVIFlags, &psi->
wSRVIFlags);
10915
10916 Print((wSRVIFlags & SRVIF_CHECKED) ?
"Checked" :
"Free");
10917 Print(
".\n");
10918
return TRUE;
10919 }
10920
10921
#define DUMPSTATUS(status) if (tryMoveExpValue(&Status, VAR(g ## status))) { \
10922
Print("g%s = %lx\n", #status, Status); \
10923
}
10924
#define DUMPTIME(time) if (tryMoveExpValue(&Time, VAR(g ## time))) { \
10925
Print("g%s = %lx\n", #time, Time); \
10926
}
10927
10928
10929
#ifdef KERNEL
10930
10931
10932
10933
10934
10935
10936
10937
BOOL Idinp(
10938 DWORD opts,
10939 PVOID param1)
10940 {
10941
DWORD Time;
10942
NTSTATUS Status;
10943
PDEVICEINFO pDeviceInfo, *ppDeviceInfo;
10944
int i = 0;
10945
char ach[100];
10946
DWORD nKbd;
10947
BOOL bVerbose =
FALSE;
10948
10949
DUMPSTATUS(KbdIoctlLEDSStatus);
10950
10951
DUMPTIME(MouseProcessMiceInputTime);
10952
DUMPTIME(MouseQueueMouseEventTime);
10953
DUMPTIME(MouseUnqueueMouseEventTime);
10954
10955
if (opts & OFLAG(v)) {
10956 bVerbose =
TRUE;
10957 }
10958
10959
10960 ppDeviceInfo = EvalExp(
VAR(gpDeviceInfoList));
10961
while (tryMove(pDeviceInfo, ppDeviceInfo) && pDeviceInfo) {
10962
10963
if (param1 && (param1 != pDeviceInfo)) {
10964 ;
10965 }
else if (pDeviceInfo != 0) {
10966
DEVICEINFO DeviceInfo;
10967 WCHAR awchBuffer[100];
10968
DWORD cbBuffer;
10969
10970 Print(
"#%d: %x ", i, pDeviceInfo);
10971
if (tryMove(DeviceInfo, pDeviceInfo)) {
10972
if (DeviceInfo.type ==
DEVICE_TYPE_MOUSE) {
10973 Print(
"MOU", i);
10974 }
else if (DeviceInfo.type ==
DEVICE_TYPE_KEYBOARD) {
10975 Print(
"KBD");
10976 }
else {
10977 Print(
"%2d?", DeviceInfo.type);
10978 }
10979
if (DeviceInfo.usActions) {
10980 Print(
" Pending action %x %s", DeviceInfo.usActions,
10981
GetFlags(GF_DIAF, DeviceInfo.usActions, NULL, TRUE));
10982 }
10983 cbBuffer =
min(DeviceInfo.ustrName.Length,
sizeof(awchBuffer)-
sizeof(WCHAR));
10984
if (tryMoveBlock(awchBuffer, DeviceInfo.ustrName.Buffer, cbBuffer)) {
10985 awchBuffer[cbBuffer /
sizeof(WCHAR)] = 0;
10986 Print(
"\n %ws\n", awchBuffer);
10987 }
else {
10988 Print(
"\n");
10989 }
10990 }
else {
10991 DeviceInfo.type = 0xFF;
10992 }
10993
if (bVerbose || (param1 == pDeviceInfo)) {
10994
sprintf(ach,
"GENERIC_DEVICE_INFO 0x%p", pDeviceInfo);
10995
gnIndent += 2;
10996
Idso(0, ach);
10997
gnIndent += 2;
10998
sprintf(ach,
"IO_STATUS_BLOCK 0x%p",
10999 (PBYTE)pDeviceInfo + FIELD_OFFSET(
DEVICEINFO, iosb));
11000
Idso(0, ach);
11001
gnIndent -= 2;
11002
if (DeviceInfo.type ==
DEVICE_TYPE_MOUSE) {
11003
sprintf(ach,
"MOUSE_DEVICE_INFO 0x%p",
11004 (PBYTE)pDeviceInfo + FIELD_OFFSET(
DEVICEINFO, mouse));
11005
Idso(0, ach);
11006
11007
gnIndent += 2;
11008
sprintf(ach,
"MOUSE_ATTRIBUTES 0x%p",
11009 (PBYTE)pDeviceInfo + FIELD_OFFSET(
DEVICEINFO, mouse)
11010 + FIELD_OFFSET(
MOUSE_DEVICE_INFO, Attr));
11011
Idso(0, ach);
11012
gnIndent -= 2;
11013 }
else if (DeviceInfo.type ==
DEVICE_TYPE_KEYBOARD) {
11014
sprintf(ach,
"KEYBOARD_DEVICE_INFO 0x%p",
11015 (PBYTE)pDeviceInfo + FIELD_OFFSET(
DEVICEINFO, keyboard));
11016
Idso(0, ach);
11017
gnIndent += 2;
11018
sprintf(ach,
"KEYBOARD_ATTRIBUTES 0x%p",
11019 (PBYTE)pDeviceInfo + FIELD_OFFSET(
DEVICEINFO, keyboard)
11020 + FIELD_OFFSET(
KEYBOARD_DEVICE_INFO, Attr));
11021
Idso(0, ach);
11022
gnIndent -= 2;
11023 }
else {
11024 Print(
"Unknown device type %d\n", DeviceInfo.type);
11025 }
11026
if (opts & OFLAG(i)) {
11027 Print(
" Input Records:");
11028
if (DeviceInfo.iosb.Information == 0) {
11029 Print(
" NONE\n");
11030 }
else {
11031 Print(
"\n");
11032
gnIndent += 2;
11033
sprintf(ach,
"KEYBOARD_INPUT_DATA %p *%x",
11034 &(pDeviceInfo->
keyboard.
Data[0]),
11035 DeviceInfo.iosb.Information /
sizeof(DeviceInfo.
keyboard.
Data[0]));
11036
Idso(0, ach);
11037
gnIndent -= 2;
11038 }
11039 }
11040
gnIndent -= 2;
11041 }
11042 }
11043 ppDeviceInfo =
FIXKP(&pDeviceInfo->pNext);
11044 i++;
11045 }
11046
11047
11048 {
11049
SERVERINFO si;
11050
PSERVERINFO psi;
11051
11052
11053
11054
11055
11056
11057
11058
static SYSMET_ENTRY aSysMet[] = {
11059
SMENTRY(MOUSEPRESENT),
11060
SMENTRY(MOUSEWHEELPRESENT),
11061
SMENTRY(CMOUSEBUTTONS),
11062 };
11063
11064 moveExpValuePtr(&psi,
VAR(gpsi));
11065
move(si, psi);
11066
11067
for (i = 0; i <
NELEM(aSysMet); i++) {
11068 Print(
"SM_%-18s = 0x%08lx = %d\n",
11069 aSysMet[i].pstrMetric,
11070 si.aiSysMet[aSysMet[i].iMetric],
11071 si.aiSysMet[aSysMet[i].iMetric]);
11072 }
11073
11074 moveExpValuePtr(&nKbd,
VAR(gnKeyboards));
11075 Print(
"gnKeyboards = %d\n", nKbd);
11076 moveExpValuePtr(&nKbd,
VAR(gnMice));
11077 Print(
"gnMice = %d\n", nKbd);
11078 }
11079
return TRUE;
11080 }
11081
11082
11083
11084
11085
11086
11087
BOOL Ihh(
11088 DWORD opts,
11089 PVOID param1)
11090 {
11091
DWORD dwHHint, *pdwHH;
11092 ULONG ulSessionId, *pulASessionId;
11093
int i, maxFlags;
11094
11095
char * aHHstrings[] = {
11096
"HH_DRIVERENTRY 0x00000001",
11097
"HH_USERINITIALIZE 0x00000002",
11098
"HH_INITVIDEO 0x00000004",
11099
"HH_REMOTECONNECT 0x00000008",
11100
"HH_REMOTEDISCONNECT 0x00000010",
11101
"HH_REMOTERECONNECT 0x00000020",
11102
"HH_REMOTELOGOFF 0x00000040",
11103
"HH_DRIVERUNLOAD 0x00000080",
11104
"HH_GRECLEANUP 0x00000100",
11105
"HH_USERKCLEANUP 0x00000200",
11106
"HH_INITIATEWIN32KCLEANUP 0x00000400",
11107
"HH_ALLDTGONE 0x00000800",
11108
"HH_RITGONE 0x00001000",
11109
"HH_RITCREATED 0x00002000",
11110
"HH_LOADCURSORS 0x00004000",
11111
"HH_KBDLYOUTGLOBALCLEANUP 0x00008000",
11112
"HH_KBDLYOUTFREEWINSTA 0x00010000",
11113
"HH_CLEANUPRESOURCES 0x00020000",
11114
"HH_DISCONNECTDESKTOP 0x00040000"
11115 };
11116
11117
if (param1) {
11118 dwHHint = (
DWORD)((DWORD_PTR)param1);
11119 Print(
"gdwHydraHint is 0x%x:\n", dwHHint);
11120 }
else {
11121 pdwHH = EvalExp(
VAR(gdwHydraHint));
11122
if(!tryMove(dwHHint, pdwHH)) {
11123 Print(
"Can't get value of gdwHydraHint");
11124
return FALSE;
11125 }
11126
11127 pulASessionId = EvalExp(
VAR(gSessionId));
11128
if (!tryMove(ulSessionId, pulASessionId)) {
11129 Print(
"Can't get value of gSessionId");
11130
return FALSE;
11131 }
11132
11133 Print(
"Session 0x%x \n gdwHydraHint is 0x%x:\n", ulSessionId, dwHHint);
11134 }
11135
11136 i = 0;
11137 maxFlags =
sizeof(aHHstrings)/
sizeof(aHHstrings[0]);
11138
11139
while (dwHHint) {
11140
11141
if (dwHHint & 0x01) {
11142
11143
if (i >= maxFlags) {
11144 Print(
"\n Error: Unknown flags: userkdx.dll might be outdated\n");
11145
return TRUE;
11146 }
11147 Print(
" %s\n", aHHstrings[i]);
11148 }
11149 i++;
11150 dwHHint >>= 1;
11151 }
11152
11153
return TRUE;
11154 UNREFERENCED_PARAMETER(opts);
11155 }
11156
11157
#endif // KERNEL
11158
11159
11160
11161
11162
11163
11164
11165
#ifdef KERNEL
11166
BOOL Idupm (
void)
11167 {
11168
char ach[80];
11169
DWORD dwMask;
11170
int i;
11171 WORD w =
GF_UPM0;
11172
11173 Print(
"UserPreferencesMask:\n");
11174
for (i = 0; i < SPI_BOOLMASKDWORDSIZE; i++) {
11175
sprintf(ach,
"win32k!gpdwCPUserPreferencesMask + %#lx", i *
sizeof(DWORD));
11176 moveExpValue(&dwMask, ach);
11177 w =
GF_UPM0 + i;
11178 Print(
"Offset: %d - %#lx: %s\n",
11179 i, dwMask,
GetFlags(w, dwMask, NULL, TRUE));
11180 }
11181
return TRUE;
11182 }
11183
#endif // KERNEL
11184
11185
11186
11187
11188
11189
11190
#ifdef KERNEL
11191
BOOL Idup (
void)
11192 {
11193 Print(
"Bummer, not implemented yet!");
11194
return TRUE;
11195 }
11196
#endif // KERNEL
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
static struct {
11207
const char*
terse;
11208
const char*
verbose;
11209 }
gaIMCAttr[] = {
11210
"IN",
"INPUT",
11211
"TC",
"TARGET_CONVERTED",
11212
"CV",
"CONVERTED",
11213
"TN",
"TARGET_NOTCONVERTED",
11214
"IE",
"INPUT_ERROR",
11215
"FC",
"FIXEDCONVERTED",
11216 };
11217
11218
const char*
GetInxAttr(BYTE bAttr)
11219 {
11220
if (bAttr <
ARRAY_SIZE(gaIMCAttr)) {
11221
return gaIMCAttr[bAttr].terse;
11222 }
11223
return "**";
11224 }
11225
11226
void _PrintInxAttr(
const char* title, PVOID pCompStr, DWORD offset, DWORD len)
11227 {
11228
DWORD i;
11229
PBYTE pAttr = (
PBYTE)pCompStr + offset;
11230
11231
if (title ==
NULL) {
11232
11233 Print(
" ");
11234
for (i = 0; i <
ARRAY_SIZE(gaIMCAttr); ++i) {
11235
if (i && i % 4 == 0) {
11236 Print(
"\n");
11237 Print(
" ");
11238 }
11239 Print(
"%s:%s ", gaIMCAttr[i].terse, gaIMCAttr[i].verbose);
11240 }
11241 Print(
"\n");
11242
return;
11243 }
11244
11245
if (offset == 0 || len == 0) {
11246
return;
11247 }
11248
11249 Print(
" %-12s (@%p) off:0x%x len:0x%x (in byte)\n",
11250 title, pAttr, offset, len);
11251 Print(
" ");
11252
for (i = 0; i < len; ++i) {
11253
BYTE bAttr;
11254
11255
move(bAttr, pAttr + i);
11256 Print(
"|%s",
GetInxAttr(bAttr));
11257 }
11258 Print(
"|\n");
11259 }
11260
11261
#define PrintInxAttr(name) \
11262
_PrintInxAttr(#name, pCompStr, CompStr.dw ## name ## Offset, CompStr.dw ## name ## Len)
11263
11264
void _PrintInxClause(
const char* title, PVOID pCompStr, DWORD offset, DWORD len)
11265 {
11266 PDWORD pClause = (PDWORD)((
PBYTE)pCompStr + offset);
11267
DWORD i;
11268
11269
if (offset == 0 || len == 0) {
11270
return;
11271 }
11272
11273 Print(
" %-12s (@%p) off:0x%x len:0x%x (0x%x dwords)\n",
11274 title, pClause, offset, len, len /
sizeof(DWORD));
11275
11276 Print(
" ");
11277 len /=
sizeof(
DWORD);
11278
for (i = 0; i < len; ++i) {
11279
DWORD dwData;
11280
11281
move(dwData, pClause + i);
11282 Print(
"|0x%x", dwData);
11283 }
11284 Print(
"|\n");
11285 }
11286
11287
#define PrintInxClause(name) \
11288
_PrintInxClause(#name, pCompStr, CompStr.dw ## name ## Offset, CompStr.dw ## name ## Len)
11289
11290
const char*
GetInxStr(WCHAR wchar, BOOLEAN fUnicode)
11291 {
11292
static char ach[32];
11293
11294
if (wchar >= 0x20 && wchar <= 0x7e) {
11295
sprintf(ach,
"'%c'", wchar);
11296 }
11297
else if (fUnicode) {
11298
sprintf(ach,
"U+%04x", wchar);
11299 }
11300
else {
11301
sprintf(ach,
"%02x", (BYTE)wchar);
11302 }
11303
11304
return ach;
11305 }
11306
11307
void _PrintInxStr(
const char* title, PVOID pCompStr, DWORD offset, DWORD len, BOOLEAN fUnicode)
11308 {
11309
DWORD i;
11310
11311
if (offset == 0 || len == 0) {
11312
return;
11313 }
11314
11315 Print(
" %-12s (@%p) off:0x%x len:0x%x (0x%x cch)\n",
11316 title, (PBYTE)pCompStr + offset, offset, len, len / (fUnicode + 1));
11317
11318 Print(
" ");
11319
for (i = 0; i < len; ++i) {
11320 WCHAR wchar;
11321
if (fUnicode) {
11322
move(wchar, (PWCHAR)((PBYTE)pCompStr + offset) + i);
11323 }
11324
else {
11325
BYTE bchar;
11326
11327
move(bchar, (PBYTE)pCompStr + offset + i);
11328 wchar = bchar;
11329 }
11330 Print(
"|%s",
GetInxStr(wchar, fUnicode));
11331 }
11332 Print(
"|\n");
11333 }
11334
11335
#define PrintInxStr(name) \
11336
_PrintInxStr(#name, pCompStr, CompStr.dw ## name ## Offset, CompStr.dw ## name ## Len, fUnicode)
11337
11338
11339
#define PrintInxElementA(name) \
11340
do { \
11341
PrintInxAttr(name ## Attr); \
11342
PrintInxClause(name ## Clause); \
11343
PrintInxStr(name ## Str); \
11344
} while (0)
11345
11346
#define PrintInxElementB(name) \
11347
do { \
11348
PrintInxClause(name ## Clause); \
11349
PrintInxStr(name ## Str); \
11350
} while (0)
11351
11352
11353
void _PrintInxFriendlyStr(
11354
const char* title,
11355 PBYTE pCompStr,
11356 DWORD dwAttrOffset,
11357 DWORD dwAttrLen,
11358 DWORD dwClauseOffset,
11359 DWORD dwClauseLen,
11360 DWORD dwStrOffset,
11361 DWORD dwStrLen,
11362 BOOLEAN fUnicode)
11363 {
11364
DWORD i;
11365
DWORD n;
11366
DWORD dwClause;
11367
11368 Print(
" %-11s", title);
11369
if (dwStrOffset == 0 || dwStrLen == 0) {
11370 Print(
"\n");
11371
return;
11372 }
11373
11374
for (i = 0,
n = 0; i < dwStrLen; ++i) {
11375
BYTE bAttr;
11376 WCHAR wchar;
11377
11378
move(dwClause, (PDWORD)(pCompStr + dwClauseOffset) + n);
11379
if (dwClause == i) {
11380 ++
n;
11381
if (i) {
11382 Print(
"| ");
11383 }
11384 }
11385
11386
if (fUnicode) {
11387
move(wchar, (PWCHAR)((PBYTE)pCompStr + dwStrOffset) + i);
11388 }
11389
else {
11390
BYTE bchar;
11391
move(bchar, (PBYTE)pCompStr + dwStrOffset + i);
11392 wchar = bchar;
11393 }
11394
11395
if (dwAttrOffset != ~0) {
11396
move(bAttr, pCompStr + dwAttrOffset + i);
11397 Print(
"|%s:%s",
GetInxAttr(bAttr),
GetInxStr(wchar, fUnicode));
11398 }
11399
else {
11400 Print(
"|%s",
GetInxStr(wchar, fUnicode));
11401 }
11402 }
11403 Print(
"|\n");
11404
if (dwClauseLen /
sizeof(
DWORD) != (
n + 1)) {
11405 Print(
" ** dwClauseLen (0x%x) doesn't match to n (0x%x) **\n", dwClauseLen, (n + 1) *
sizeof(DWORD));
11406 }
11407
if (dwAttrOffset != ~0 && dwAttrLen != dwStrLen) {
11408 Print(
" ** dwAttrLen (0x%x) doesn't match to dwStrLen (0x%x) **\n", dwAttrLen, dwStrLen);
11409 }
11410 }
11411
11412
#define PrintInxFriendlyStrA(name) \
11413
_PrintInxFriendlyStr(#name, \
11414
(PBYTE)pCompStr, \
11415
CompStr.dw ## name ## AttrOffset, \
11416
CompStr.dw ## name ## AttrLen, \
11417
CompStr.dw ## name ## ClauseOffset, \
11418
CompStr.dw ## name ## ClauseLen, \
11419
CompStr.dw ## name ## StrOffset, \
11420
CompStr.dw ## name ## StrLen, \
11421
fUnicode)
11422
11423
#define PrintInxFriendlyStrB(name) \
11424
_PrintInxFriendlyStr(#name, \
11425
(PBYTE)pCompStr, \
11426
~0, \
11427
0, \
11428
CompStr.dw ## name ## ClauseOffset, \
11429
CompStr.dw ## name ## ClauseLen, \
11430
CompStr.dw ## name ## StrOffset, \
11431
CompStr.dw ## name ## StrLen, \
11432
fUnicode)
11433
11434
11435
11436
BOOL Idimc(DWORD opts, PVOID param1)
11437 {
11438
IMC imc;
11439
PIMC pImc;
11440
PCLIENTIMC pClientImc;
11441
CLIENTIMC ClientImc;
11442 PINPUTCONTEXT pInputContext;
11443 INPUTCONTEXT InputContext;
11444 HANDLE hInputContext;
11445 BOOLEAN fUnicode =
FALSE;
11446 BOOLEAN fVerbose, fDumpInputContext, fShowIMCMinInfo, fShowModeSaver, fShowCompStrRaw;
11447
char ach[32];
11448
11449
if (param1 ==
NULL) {
11450 Print(
"!dimc -? for help\n");
11451
return FALSE;
11452 }
11453
11454
11455
11456
11457
11458
if (opts & OFLAG(a)) {
11459 opts |= ~(OFLAG(w) | OFLAG(c) | OFLAG(i) | OFLAG(u));
11460 }
11461
11462 fVerbose = !!(opts & OFLAG(v));
11463 fShowCompStrRaw = (opts & OFLAG(s)) || fVerbose;
11464 fDumpInputContext = (opts & OFLAG(d)) || fShowCompStrRaw || fVerbose;
11465 fShowIMCMinInfo = (opts & OFLAG(h)) || fDumpInputContext || fVerbose;
11466 fShowModeSaver = (opts & OFLAG(r)) || fVerbose;
11467
11468
if (opts & OFLAG(w)) {
11469
11470
11471
11472
PWND pwnd;
11473
11474
if ((pwnd =
HorPtoP(param1, TYPE_WINDOW)) ==
NULL) {
11475
return FALSE;
11476 }
11477 Print(
"pwnd=%p\n", pwnd);
11478
if (!tryMove(param1, &pwnd->
hImc)) {
11479 Print(
"Could not read pwnd->hImc.\n");
11480
return FALSE;
11481 }
11482 }
11483
11484
if (opts & OFLAG(c)) {
11485
11486
11487
11488 pClientImc = param1;
11489
goto LClientImc;
11490 }
11491
11492
if (opts & OFLAG(i)) {
11493
11494
11495
11496 pInputContext = param1;
11497 opts |= OFLAG(h);
11498 hInputContext = 0;
11499
if (opts & OFLAG(u)) {
11500 Print(
"Assuming Input Context is UNICODE.\n");
11501 }
11502
else {
11503 Print(
"Assuming Input Context is ANSI.\n");
11504 }
11505
goto LInputContext;
11506 }
11507
11508
11509
11510
11511
if ((pImc =
HorPtoP(param1, TYPE_INPUTCONTEXT)) ==
NULL) {
11512 Print(
"Idimc: %x is not an input context.\n", param1);
11513
return FALSE;
11514 }
11515
11516
move(imc, pImc);
11517
11518
#ifdef KERNEL
11519
11520
if (imc.
head.pti) {
11521 Idt(OFLAG(p), (PVOID)imc.
head.pti);
11522 }
11523
#endif
11524
11525
11526
11527
11528 Print(
"pImc = %08lx pti:%08lx\n", pImc,
FIXKP(imc.
head.pti));
11529 Print(
" handle %08lx\n", imc.
head.h);
11530 Print(
" dwClientImc %08lx\n", imc.
dwClientImcData);
11531 Print(
" hImeWnd %08lx\n", imc.
hImeWnd);
11532
11533
11534
11535
11536 pClientImc = (PVOID)imc.
dwClientImcData;
11537 LClientImc:
11538
if (pClientImc ==
NULL) {
11539 Print(
"pClientImc is NULL.\n");
11540
return TRUE;
11541 }
11542
move(ClientImc, pClientImc);
11543
11544
if (fVerbose) {
11545
sprintf(ach,
"CLIENTIMC %p", pClientImc);
11546
Idso(0, ach);
11547 }
11548
else {
11549 Print(
"pClientImc @%p cLockObj:%x\n", imc.
dwClientImcData, ClientImc.
cLockObj);
11550 }
11551 Print(
" dwFlags %s\n",
GetFlags(GF_CLIENTIMC, ClientImc.
dwFlags, NULL, TRUE));
11552 fUnicode = !!(ClientImc.
dwFlags &
IMCF_UNICODE);
11553
11554
11555
11556
11557 hInputContext = ClientImc.
hInputContext;
11558
if (hInputContext) {
11559
move(pInputContext, hInputContext);
11560 }
11561
else {
11562 pInputContext =
NULL;
11563 }
11564 LInputContext:
11565 Print(
"InputContext %08lx (@%p)", hInputContext, pInputContext);
11566
11567
if (pInputContext ==
NULL) {
11568 Print(
"\n");
11569
return TRUE;
11570 }
11571
11572
11573
11574
11575
11576
if (opts & OFLAG(u)) {
11577 fUnicode =
TRUE;
11578 }
11579
11580
move(InputContext, pInputContext);
11581 Print(
" hwnd=%p\n", InputContext.hWnd);
11582
11583
if (fVerbose) {
11584
sprintf(ach,
"INPUTCONTEXT %p", pInputContext);
11585
Idso(0, ach);
11586 }
11587
11588
11589
11590
11591
11592
if (fShowIMCMinInfo) {
11593 PCOMPOSITIONSTRING pCompStr =
NULL;
11594 PCANDIDATEINFO pCandInfo =
NULL;
11595 PGUIDELINE pGuideLine =
NULL;
11596 PTRANSMSGLIST pMsgBuf =
NULL;
11597
DWORD i;
11598
11599 Print(
" dwRefCount: 0x%x fdwDirty: %s\n",
11600 InputContext.dwRefCount,
GetFlags(GF_IMEDIRTY, InputContext.fdwDirty, NULL, TRUE));
11601 Print(
" Conversion: %s\n",
GetFlags(GF_CONVERSION, InputContext.fdwConversion, NULL, TRUE));
11602 Print(
" Sentence: %s\n",
GetFlags(GF_SENTENCE, InputContext.fdwSentence, NULL, TRUE));
11603 Print(
" fChgMsg: %d uSaveVKey: %02x %s\n",
11604 InputContext.fChgMsg,
11605 InputContext.uSavedVKey,
GetVKeyName(InputContext.uSavedVKey));
11606 Print(
" StatusWnd: (0x%x,0x%x) SoftKbd: (0x%x,0x%x)\n",
11607 InputContext.ptStatusWndPos.x, InputContext.ptStatusWndPos.y,
11608 InputContext.ptSoftKbdPos.x, InputContext.ptSoftKbdPos.y);
11609 Print(
" fdwInit: %s\n",
GetFlags(GF_IMEINIT, InputContext.fdwInit, NULL, TRUE));
11610
11611 {
11612 LPCSTR fmt =
" Font: '%s' %dpt wt:%d charset: %s\n";
11613
if (fUnicode) {
11614 fmt =
" Font: '%S' %dpt wt:%d charset: %s\n";
11615 }
11616 Print(fmt,
11617 InputContext.lfFont.A.lfFaceName,
11618 InputContext.lfFont.A.lfHeight,
11619 InputContext.lfFont.A.lfWeight,
11620
GetMaskedEnum(EI_CHARSETTYPE, InputContext.lfFont.A.lfCharSet, NULL));
11621 }
11622
11623
11624 Print(
" cfCompForm: %s pos:(0x%x,0x%x) rc:(0x%x,0x%x)-(0x%x,0x%x)\n",
11625
GetFlags(GF_IMECOMPFORM, InputContext.cfCompForm.dwStyle, NULL, TRUE),
11626 InputContext.cfCompForm.ptCurrentPos.x, InputContext.cfCompForm.ptCurrentPos.y,
11627 InputContext.cfCompForm.rcArea.left, InputContext.cfCompForm.rcArea.top,
11628 InputContext.cfCompForm.rcArea.right, InputContext.cfCompForm.rcArea.bottom);
11629
11630
if (InputContext.hCompStr) {
11631
if (!tryMove(pCompStr, InputContext.hCompStr)) {
11632 Print(
"Could not get hCompStr=%08x\n", InputContext.hCompStr);
11633
11634 }
11635 }
11636
if (pCompStr && fVerbose) {
11637
sprintf(ach,
"COMPOSITIONSTRING %p", pCompStr);
11638
Idso(0, ach);
11639 }
11640
11641
if (InputContext.hCandInfo) {
11642
if (!tryMove(pCandInfo, InputContext.hCandInfo)) {
11643 Print(
"Could not get hCandInfo=%08x\n", InputContext.hCandInfo);
11644
11645 }
11646 }
11647
if (pCandInfo && fVerbose) {
11648
sprintf(ach,
"CANDIDATEINFO %p", pCandInfo);
11649
Idso(0, ach);
11650 }
11651
11652
if (InputContext.hGuideLine) {
11653
if (!tryMove(pGuideLine, InputContext.hGuideLine)) {
11654 Print(
"Could not get hGuideLine=%08x\n", InputContext.hGuideLine);
11655
11656 }
11657 }
11658
if (pGuideLine && fVerbose) {
11659
sprintf(ach,
"GUIDELINE %p", pGuideLine);
11660
Idso(0, ach);
11661 }
11662
11663
if (InputContext.hMsgBuf) {
11664
if (!tryMove(pMsgBuf, InputContext.hMsgBuf)) {
11665 Print(
"Could not get hMsgBuf=%08x\n", InputContext.hMsgBuf);
11666
11667 }
11668 }
11669
if (pMsgBuf && fVerbose) {
11670
sprintf(ach,
"TRANSMSGLIST %p", pMsgBuf);
11671
Idso(0, ach);
11672 }
11673
11674
if (!fDumpInputContext && !fVerbose) {
11675 Print(
" CompStr @%p CandInfo @%p GuideL @%p \n",
11676 pCompStr, pCandInfo, pGuideLine);
11677 Print(
" MsgBuf @%p (0x%x)\n", pMsgBuf, InputContext.dwNumMsgBuf);
11678 }
11679
11680
if (fDumpInputContext) {
11681
11682
11683
11684
if (pCompStr) {
11685 COMPOSITIONSTRING CompStr;
11686
11687
move(CompStr, pCompStr);
11688 Print(
" hCompositionString: %p (@%p) dwSize=0x%x\n",
11689 InputContext.hCompStr, pCompStr, CompStr.dwSize);
11690
11691
if (fShowCompStrRaw) {
11692
_PrintInxAttr(NULL, NULL, 0, 0);
11693
PrintInxElementA(CompRead);
11694
PrintInxElementA(Comp);
11695
PrintInxElementB(ResultRead);
11696
PrintInxElementB(Result);
11697 }
11698
11699 Print(
" CursorPos=0x%x DeltaStart=0x%x\n",
11700 CompStr.dwCursorPos, CompStr.dwDeltaStart);
11701 Print(
" Private: (@%p) off:0x%x len:0x%x\n",
11702 (PBYTE)pCompStr + CompStr.dwPrivateOffset,
11703 CompStr.dwPrivateOffset, CompStr.dwPrivateSize);
11704
11705 Print(
"\n");
11706
11707
PrintInxFriendlyStrA(CompRead);
11708
PrintInxFriendlyStrA(Comp);
11709
PrintInxFriendlyStrB(ResultRead);
11710
PrintInxFriendlyStrB(Result);
11711
11712 Print(
"\n");
11713 }
11714
else {
11715 Print(
" pCompStr is NULL\n");
11716 }
11717
11718
11719
11720
11721
if (pCandInfo) {
11722 CANDIDATEINFO CandInfo;
11723
11724
move(CandInfo, pCandInfo);
11725 Print(
" hCandidateInfo: %p (@%p) dwSize=0x%x dwCount=0x%x PrivOffset=0x%x PrivSize=0x%x\n",
11726 InputContext.hCandInfo, pCandInfo, CandInfo.dwSize, CandInfo.dwCount,
11727 CandInfo.dwPrivateOffset, CandInfo.dwPrivateSize);
11728
11729
for (i = 0; i < CandInfo.dwCount; ++i) {
11730 PCANDIDATELIST pCandList;
11731 CANDIDATELIST CandList;
11732
DWORD j;
11733
11734 pCandList = (PCANDIDATELIST)((
PBYTE)pCandInfo + CandInfo.dwOffset[i]);
11735
move(CandList, pCandList);
11736
11737 Print(
" CandList[%02x] (@%p) %s count=%x sel=%x pgStart=%x pgSize=%x\n",
11738 i, pCandList,
GetMaskedEnum(
EI_IMECANDIDATESTYLE, CandList.dwStyle,
NULL),
11739 CandList.dwCount,
11740 CandList.dwSelection, CandList.dwPageStart, CandList.dwPageSize);
11741
11742
if (CandList.dwStyle == IME_CAND_CODE && CandList.dwCount == 1) {
11743
11744 Print(
" Special case: DBCS char = %04x", CandList.dwOffset[0]);
11745 }
11746
else if (CandList.dwCount > 1) {
11747
for (j = 0; j < CandList.dwCount; ++j) {
11748
DWORD k;
11749
DWORD dwOffset;
11750
11751
move(dwOffset, pCandList->dwOffset + j);
11752
11753 Print(
" %c%c[%02x]@%p ",
11754 j == CandList.dwSelection ?
'*' :
' ',
11755 (j >= CandList.dwPageStart && j < CandList.dwPageStart + CandList.dwPageSize) ?
'+' :
' ',
11756 j, (
PBYTE)pCandList + dwOffset);
11757
for (k = 0; k < 0x100; ++k) {
11758 WCHAR wchar;
11759
11760
if (fUnicode) {
11761
move(wchar, (PWCHAR)((
PBYTE)pCandList + dwOffset) + k);
11762 }
11763
else {
11764
BYTE bchar;
11765
move(bchar, (
PBYTE)pCandList + dwOffset + k);
11766 wchar = bchar;
11767 }
11768
if (wchar == 0) {
11769
break;
11770 }
11771 Print(
"|%s",
GetInxStr(wchar, fUnicode));
11772 }
11773 Print(
"|\n");
11774 }
11775 }
11776 }
11777 }
11778
11779
if (pGuideLine) {
11780 GUIDELINE GuideLine;
11781
11782
move(GuideLine, pGuideLine);
11783 Print(
" hGuideLine: %p (@%p) dwSize=0x%x\n",
11784 InputContext.hGuideLine, pGuideLine, GuideLine.dwSize);
11785
11786 Print(
" level:%x index;%x privOffset:%x privSize:%x\n",
11787 GuideLine.dwLevel, GuideLine.dwIndex,
11788 GuideLine.dwPrivateSize, GuideLine.dwPrivateOffset);
11789
11790
if (GuideLine.dwStrOffset && GuideLine.dwStrLen) {
11791
11792 Print(
" str @%p ", (PBYTE)pGuideLine + GuideLine.dwStrOffset);
11793
for (i = 0; i < GuideLine.dwStrLen; ++i) {
11794 WCHAR wchar;
11795
11796
if (fUnicode) {
11797
move(wchar, (PWCHAR)((PBYTE)pGuideLine + GuideLine.dwStrOffset) + i);
11798 }
11799
else {
11800
BYTE bchar;
11801
move(bchar, (PBYTE)pGuideLine + GuideLine.dwStrOffset + i);
11802 wchar = bchar;
11803 }
11804 Print(
"|%s",
GetInxStr(wchar, fUnicode));
11805 }
11806 Print(
"|\n");
11807 }
11808 }
11809
11810
if (pMsgBuf) {
11811 TRANSMSGLIST TransMsgList;
11812
11813
move(TransMsgList, pMsgBuf);
11814 Print(
" hMsgBuf: %p (@%p) dwNumMsgBuf=0x%x uMsgCount=0x%x\n",
11815 InputContext.hMsgBuf, pMsgBuf, InputContext.dwNumMsgBuf,
11816 TransMsgList.uMsgCount);
11817
11818
if (InputContext.dwNumMsgBuf) {
11819 PTRANSMSG pTransMsg = pMsgBuf->TransMsg;
11820
11821 Print(
" | ## |msg | wParam | lParam |\n");
11822 Print(
" +----+----+--------+--------+\n");
11823
11824
for (i = 0; i < InputContext.dwNumMsgBuf; ++i, ++pTransMsg) {
11825
const char*
pszMsg =
"";
11826 TRANSMSG TransMsg;
11827
DWORD j;
11828
11829
move(TransMsg, pTransMsg);
11830
11831
11832
for (j = 0; j <
ARRAY_SIZE(gaMsgs); ++j) {
11833
if (
gaMsgs[i].msg == TransMsg.message) {
11834
pszMsg =
gaMsgs[j].pszMsg;
11835
break;
11836 }
11837 }
11838
11839 Print(
" | %02x |%04x|%08x|%08x| %s\n",
11840 i,
11841 TransMsg.message, TransMsg.wParam, TransMsg.lParam, pszMsg);
11842 }
11843 Print(
" +----+----+--------+--------+\n");
11844 }
11845 }
11846
11847 }
11848 }
11849
11850
11851
11852
11853
if (fShowModeSaver) {
11854
PIMEMODESAVER pModeSaver = InputContext.pImeModeSaver;
11855
11856
11857
11858
11859
while (pModeSaver) {
11860
IMEMODESAVER ImeModeSaver;
11861
11862
move(ImeModeSaver, pModeSaver);
11863 Print(
"ImeModeSaver @ %p -- LangId=%04x fOpen=%d\n",
11864 pModeSaver, ImeModeSaver.
langId, ImeModeSaver.
fOpen);
11865 Print(
" fdwInit %s\n",
GetFlags(GF_IMEINIT, ImeModeSaver.
fdwInit, NULL, TRUE));
11866 Print(
" Conversion %s\n",
GetFlags(GF_CONVERSION, ImeModeSaver.
fdwConversion, NULL, TRUE));
11867 Print(
" Sentence %s\n",
GetFlags(GF_SENTENCE, ImeModeSaver.
fdwSentence, NULL, TRUE));
11868
move(pModeSaver, &pModeSaver->
next);
11869 }
11870 }
11871
11872
return TRUE;
11873 }
11874
11875
#ifndef KERNEL
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
BOOL Ikc(
11886 DWORD opts,
11887 PVOID param1)
11888 {
11889
WND wnd;
11890
PWND pwnd, pwndParent;
11891
char ach[80];
11892
BOOL bHideFocus, bHideAccel;
11893
SERVERINFO si;
11894
PSERVERINFO psi;
11895
11896
if (param1 && (pwnd =
HorPtoP(param1, TYPE_WINDOW)) ==
NULL) {
11897 Print(
"Idw: %x is not a pwnd.\n", param1);
11898
return FALSE;
11899 }
11900 moveExpValuePtr(&psi,
VAR(gpsi));
11901
move(si, psi);
11902
11903
if (si.bKeyboardPref) {
11904 Print(
"gpsi->bKeyboardPref ON, KC mechanism is turned off\n");
11905 }
11906
if (!(si.PUSIFlags & (
PUSIF_KEYBOARDCUES |
PUSIF_UIEFFECTS) ==
PUSIF_KEYBOARDCUES |
PUSIF_UIEFFECTS)) {
11907 Print(
"Either the UI effects or PUSIF_KEYBOARDCUES are off\n");
11908 }
11909
11910
if (!param1) {
11911
return FALSE;
11912 }
11913
move(wnd,
FIXKP(pwnd));
11914
11915
11916
11917
DebugGetWindowTextA(pwnd, ach);
11918 Print(
"pwnd = %08lx \"%s\"\n", pwnd, ach);
11919 bHideAccel =
TestWF(pwnd, WEFPUIACCELHIDDEN);
11920 bHideFocus =
TestWF(pwnd, WEFPUIFOCUSHIDDEN);
11921
11922
switch(wnd.fnid) {
11923
case FNID_BUTTON :
11924 {
11925 Print(
"FNID_BUTTON");
11926 }
11927
goto printCues;
11928
case FNID_LISTBOX :
11929 {
11930 Print(
"FNID_LISTBOX");
11931 }
11932
goto printCues;
11933
case FNID_DIALOG :
11934 {
11935 Print(
"FNID_DIALOG");
11936 }
11937
goto printCues;
11938
case FNID_STATIC :
11939 {
11940 Print(
"FNID_STATIC");
11941 }
11942 printCues:
11943 Print(bHideAccel ?
" Hide Accel" :
" Show Accel");
11944 Print(bHideFocus ?
" Hide Focus" :
" Show Focus");
11945
break;
11946
11947
default:
11948 Print(
"Not KC interesting FNID 0x%x", wnd.fnid);
11949
break;
11950 }
11951 Print(
"\n");
11952
11953 pwndParent = wnd.
spwndParent;
11954
move(wnd,
FIXKP(wnd.
spwndParent));
11955
if (wnd.fnid ==
FNID_DIALOG) {
11956 Print(
"The parent is a dialog:\n");
11957
Ikc(opts, pwndParent);
11958 }
else {
11959 Print(
"The parent is not a dialog\n");
11960 }
11961
return TRUE;
11962 }
11963
#endif
11964
11965
#ifdef KERNEL
11966
11967
11968
11969
11970
11971
11972
11973
11974
#define IHK_ITEM(x) { x, #x }
11975
11976
BOOL Idimk(DWORD opts, PVOID param1)
11977 {
11978
PIMEHOTKEYOBJ pObj;
11979
IMEHOTKEYOBJ hotkeyObj;
11980
static const struct {
11981
DWORD mask;
11982
const char* name;
11983 } masks[] = {
11984 IHK_ITEM(MOD_IGNORE_ALL_MODIFIER),
11985 IHK_ITEM(MOD_ON_KEYUP),
11986 IHK_ITEM(MOD_RIGHT),
11987 IHK_ITEM(MOD_LEFT),
11988 IHK_ITEM(MOD_SHIFT),
11989 IHK_ITEM(MOD_CONTROL),
11990 IHK_ITEM(MOD_ALT),
11991 };
11992
int nHotKeys = 0;
11993
11994 UNREFERENCED_PARAMETER(opts);
11995
11996
if (param1 ==
NULL) {
11997 moveExpValuePtr(&pObj,
VAR(gpImeHotKeyListHeader));
11998
if (!pObj) {
11999 Print(
"No IME HotKeys. win32k!gpImeHotKeyListHeader is NULL.\n\n");
12000
return FALSE;
12001 }
12002 Print(
"using win32k!gpImeHotKeyListHeader (@0x%p)\n", pObj);
12003 }
12004
else {
12005 pObj = (
PIMEHOTKEYOBJ)
FIXKP(param1);
12006 }
12007
12008
while (pObj) {
12009
int i,
n;
12010
12011
move(hotkeyObj, pObj);
12012
12013 Print(
"ImeHotKeyObj @ 0x%p\n", pObj);
12014 Print(
" pNext 0x%p\n", hotkeyObj.
pNext);
12015
#if 0
12016
Print(
"IMEHOTKEY @ 0x%p\n", &pObj->
hk);
12017
#endif
12018
Print(
" dwHotKeyID 0x%04x ", hotkeyObj.
hk.
dwHotKeyID);
12019
12020
12021
12022
12023
if (hotkeyObj.
hk.
dwHotKeyID >= IME_HOTKEY_DSWITCH_FIRST && hotkeyObj.
hk.
dwHotKeyID <= IME_HOTKEY_DSWITCH_LAST) {
12024 Print(
" Direct Switch to HKL 0x%p", hotkeyObj.
hk.
hKL);
12025 }
12026
else {
12027 Print(
" %s",
GetMaskedEnum(EI_IMEHOTKEYTYPE, hotkeyObj.
hk.
dwHotKeyID, NULL));
12028 }
12029
12030
12031
12032
12033 Print(
"\n uVKey 0x%02x %s\n", hotkeyObj.
hk.
uVKey,
GetVKeyName(hotkeyObj.
hk.
uVKey));
12034
12035
12036
12037
12038 Print(
" Modifiers 0x%04x ", hotkeyObj.
hk.
uModifiers);
12039
n = 0;
12040
for (i = 0; i <
ARRAY_SIZE(masks); ++i) {
12041
if (masks[i].mask & hotkeyObj.
hk.
uModifiers) {
12042 Print(
"%s%s", n ?
" | " :
"", masks[i].name);
12043 ++
n;
12044 }
12045 }
12046
12047
12048
12049
12050 Print(
"\n hKL 0x%p\n\n", hotkeyObj.
hk.
hKL);
12051
12052 pObj = hotkeyObj.
pNext;
12053
12054
12055
12056
12057
if (param1 !=
NULL) {
12058
break;
12059 }
12060
12061 ++nHotKeys;
12062 }
12063
if (nHotKeys) {
12064 Print(
"Number of IME HotKeys: 0x%04x\n", nHotKeys);
12065 }
12066
12067
return TRUE;
12068 }
12069
12070
#undef IHK_ITEM
12071
12072
#endif // KERNEL
12073
12074
#ifdef KERNEL
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
#define DGF_ITEM(x) { x, #x }
12085
12086
BOOL Igflags(DWORD opts)
12087 {
12088
static const struct {
12089
DWORD dwFlag;
12090
const char* name;
12091 } names[] = {
12092 DGF_ITEM(FLG_STOP_ON_EXCEPTION),
12093 DGF_ITEM(FLG_SHOW_LDR_SNAPS),
12094 DGF_ITEM(FLG_DEBUG_INITIAL_COMMAND),
12095 DGF_ITEM(FLG_STOP_ON_HUNG_GUI),
12096 DGF_ITEM(FLG_HEAP_ENABLE_TAIL_CHECK),
12097 DGF_ITEM(FLG_HEAP_ENABLE_FREE_CHECK),
12098 DGF_ITEM(FLG_HEAP_VALIDATE_PARAMETERS),
12099 DGF_ITEM(FLG_HEAP_VALIDATE_ALL),
12100 DGF_ITEM(FLG_POOL_ENABLE_TAGGING),
12101 DGF_ITEM(FLG_HEAP_ENABLE_TAGGING),
12102 DGF_ITEM(FLG_USER_STACK_TRACE_DB),
12103 DGF_ITEM(FLG_KERNEL_STACK_TRACE_DB),
12104 DGF_ITEM(FLG_MAINTAIN_OBJECT_TYPELIST),
12105 DGF_ITEM(FLG_HEAP_ENABLE_TAG_BY_DLL),
12106 DGF_ITEM(FLG_ENABLE_CSRDEBUG),
12107 DGF_ITEM(FLG_ENABLE_KDEBUG_SYMBOL_LOAD),
12108 DGF_ITEM(FLG_DISABLE_PAGE_KERNEL_STACKS),
12109 DGF_ITEM(FLG_HEAP_DISABLE_COALESCING),
12110 DGF_ITEM(FLG_ENABLE_CLOSE_EXCEPTIONS),
12111 DGF_ITEM(FLG_ENABLE_EXCEPTION_LOGGING),
12112 DGF_ITEM(FLG_ENABLE_HANDLE_TYPE_TAGGING),
12113 DGF_ITEM(FLG_HEAP_PAGE_ALLOCS),
12114 DGF_ITEM(FLG_DEBUG_INITIAL_COMMAND_EX),
12115 DGF_ITEM(FLG_DISABLE_DBGPRINT),
12116 };
12117
DWORD dwFlags;
12118
int i,
n = 0;
12119
12120 moveExpValue(&dwFlags,
"NT!NtGlobalFlag");
12121
if (opts & OFLAG(v)) {
12122 Print(
"NT!NtGlobalFlag %08lx\n\n", dwFlags);
12123 }
12124
else {
12125 Print(
"NT!NtGlobalFlag 0x%lx\n", dwFlags);
12126 }
12127
12128
dwFlags &= FLG_VALID_BITS;
12129
12130
for (i = 0; i <
ARRAY_SIZE(names); ++i) {
12131 BOOLEAN on = (
dwFlags & names[i].dwFlag) != 0;
12132
12133
if (opts & OFLAG(v)) {
12134 Print(
" %c%-34s %c(%08x)\n", on ?
'*' :
' ', names[i].name, on ?
'*' :
' ', names[i].dwFlag);
12135 }
12136
else {
12137
if (
n++ % 2 == 0) {
12138 Print(
"\n");
12139 }
12140 Print(
" %c%-29s ", on ?
'*' :
' ', names[i].name +
sizeof "FLG_" - 1);
12141 }
12142 }
12143
if (!(opts & OFLAG(v))) {
12144 Print(
"\n");
12145 }
12146
12147
return TRUE;
12148 }
12149
12150
#undef DGF_ITEM
12151
12152
#endif // KERNEL
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
void PrintVKey(
int i)
12164 {
12165 Print(
" %02x %s\n", gVKeyDef[i].dwVKey, gVKeyDef[i].name);
12166 }
12167
12168
BOOL Ivkey(DWORD opts, LPSTR pszName)
12169 {
12170
int i;
12171
12172
if ((opts & OFLAG(a)) || (opts & OFLAG(o))) {
12173
12174
12175
12176
int n = 0;
12177
12178
for (i = 0; i < 0x100; ++i) {
12179
const char* name =
GetVKeyName(i);
12180
if (*name) {
12181
char buf[128];
12182
int len;
12183
12184
sprintf(buf,
" %02x %-35s", i, name);
12185
12186
if (opts & OFLAG(a)) {
12187
12188
12189
12190
if ((len =
strlen(buf)) >= 40 &&
n % 2 == 1) {
12191 Print(
"\n");
12192
n = 0;
12193 }
12194 Print(buf);
12195
12196
12197
12198
if (++
n % 2 == 0 || len >= 40) {
12199 Print(
"\n");
12200
n = 0;
12201 }
12202 }
12203
else {
12204 Print(
"%s\n", buf);
12205 }
12206 }
12207 }
12208 Print(
"\n");
12209 }
12210
else if (*pszName ==
'V' || *pszName ==
'v') {
12211
12212
12213
12214
int nFound = 0;
12215
int len =
strlen(pszName);
12216
12217
if (len == 4) {
12218
int ch = pszName[3];
12219
12220
if ((ch >=
'A' && ch <= 'Z') || (ch >=
'0' && ch <=
'9')) {
12221 Print(
" %02x %s\n", ch, pszName);
12222 ++nFound;
12223 }
12224 }
12225
12226
for (i = 0; i <
ARRAY_SIZE(gVKeyDef); ++i) {
12227
if (_strnicmp(gVKeyDef[i].name, pszName, len) == 0) {
12228 Print(
" %02x %s\n", gVKeyDef[i].dwVKey, gVKeyDef[i].name);
12229 ++nFound;
12230 }
12231 }
12232
if (nFound == 0) {
12233 Print(
"Could not find it.\n");
12234 }
12235 }
12236
else {
12237
12238
12239
12240
NTSTATUS status;
12241
DWORD dwVKey;
12242
const char* name;
12243
12244 status =
GetInteger(pszName, 16, &dwVKey, NULL);
12245
if (!
NT_SUCCESS(status)) {
12246
return FALSE;
12247 }
12248 name =
GetVKeyName(dwVKey);
12249
if (*name) {
12250 Print(
" %02x %s\n", dwVKey, name);
12251 }
12252
else {
12253 Print(
"Could not find it.\n");
12254 }
12255 }
12256
12257
return TRUE;
12258 }
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
BOOL Idisi(DWORD opts, PVOID param1)
12270 {
12271 PINPUT pObj;
12272 INPUT input;
12273
12274 UNREFERENCED_PARAMETER(opts);
12275
12276
if (param1 ==
NULL) {
12277
return FALSE;
12278 }
12279
12280 pObj = (PINPUT)
FIXKP(param1);
12281
move(input, pObj);
12282
12283 Print(
"INPUT @%p - size: 0x%x\n", pObj,
sizeof input);
12284
12285
switch (input.type) {
12286
case INPUT_MOUSE:
12287 {
12288 MOUSEINPUT* pmi = &input.mi;
12289
12290 Print(
"type: Mouse Input(%x)\n", input.type);
12291 Print(
" dx %lx (%ld in dec.)\n", pmi->dx, pmi->dx);
12292 Print(
" dy %lx (%ld in dec.)\n", pmi->dx, pmi->dx);
12293 Print(
" mouseData %lx (%ld in dec.)\n", pmi->mouseData, pmi->mouseData);
12294 Print(
" dwFlags %lx (%s)\n", pmi->dwFlags,
GetFlags(GF_MI, pmi->dwFlags, NULL, TRUE));
12295 Print(
" time %lx\n", pmi->time);
12296 Print(
" dwExtraInfo %lx\n", pmi->dwExtraInfo);
12297 }
12298
break;
12299
12300
case INPUT_KEYBOARD:
12301 {
12302 KEYBDINPUT* pki = &input.ki;
12303
const char* name;
12304
12305 Print(
"type: Keyboard Input(%x)\n", input.type);
12306
12307
12308
12309 Print(
" wVk %lx", pki->wVk);
12310 name =
GetVKeyName(pki->wVk);
12311
if (*name) {
12312 Print(
" (%s)\n", name);
12313 }
else {
12314 Print(
"\n");
12315 }
12316
12317
12318
12319
if (pki->dwFlags & KEYEVENTF_UNICODE) {
12320 Print(
" UNICODE %lx\n", pki->wScan);
12321 }
else {
12322 Print(
" wScan %lx\n", pki->wScan);
12323 }
12324
12325
12326
12327 Print(
" dwFlags %lx (%s)\n", pki->dwFlags,
GetFlags(GF_KI, pki->dwFlags, NULL, TRUE));
12328 Print(
" time %lx\n", pki->time);
12329 Print(
" dwExtraInfo %lx\n", pki->dwExtraInfo);
12330 }
12331
break;
12332
12333
case INPUT_HARDWARE:
12334 Print(
"type: HardwareEvent(%x)\n", input.type);
12335 Print(
" uMsg %lx\n", input.hi.uMsg);
12336 Print(
" wParamH:wParamL %x:%x\n", input.hi.wParamH, input.hi.wParamL);
12337
break;
12338
12339
default:
12340 Print(
"Invalid type information(0x%lx)\n", input.type);
12341
break;
12342 }
12343
12344
return TRUE;
12345 }
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
BOOL Iwm(DWORD opts, LPSTR pszName)
12358 {
12359
int i;
12360
DWORD value;
12361
12362 UNREFERENCED_PARAMETER(opts);
12363
12364
if (!(opts & OFLAG(a)) && *pszName == 0) {
12365
return FALSE;
12366 }
12367
12368
if (!
NT_SUCCESS(
GetInteger(pszName, 16, &value, NULL)) || strchr(pszName,
'_')) {
12369
12370
12371
12372
int nFound = 0;
12373
int len =
strlen(pszName);
12374
12375
for (i = 0; i <
ARRAY_SIZE(gaMsgs); ++i) {
12376
if (_strnicmp(gaMsgs[i].pszMsg, pszName, len) == 0) {
12377 Print(
" %04x %s\n", gaMsgs[i].msg, gaMsgs[i].pszMsg);
12378 ++nFound;
12379 }
12380 }
12381
if (nFound == 0) {
12382 Print(
"Could not find it.\n");
12383 }
12384 }
12385
else {
12386
12387
12388
12389
int i;
12390
12391
for (i = 0; i <
ARRAY_SIZE(gaMsgs); ++i) {
12392
if (
gaMsgs[i].msg == value) {
12393 Print(
" %04x %s\n", gaMsgs[i].msg, gaMsgs[i].pszMsg);
12394
break;
12395 }
12396 }
12397 }
12398
12399
return TRUE;
12400 }
12401
12402
12403
12404
12405
12406
12407
PBYTE SkipSz(UTCHAR *lpsz, UTCHAR* lpszCopy, UINT len)
12408 {
12409
UTCHAR c;
12410
UINT n = 0;
12411
12412 lpszCopy[len - 1] = 0;
12413
12414
move(
c, lpsz);
12415
if (
c == 0xFF) {
12416
if (lpszCopy) {
12417 *lpszCopy = 0;
12418 }
12419
return (
PBYTE)lpsz + 4;
12420 }
12421
12422
do {
12423
move(
c, lpsz);
12424 ++lpsz;
12425
if (++
n < len) {
12426
if (lpszCopy) {
12427 *lpszCopy ++ =
c;
12428 }
12429 }
12430 }
while (
c != 0);
12431
12432
return (
PBYTE)lpsz;
12433 }
12434
12435
12436
#ifndef NextWordBoundary
12437
#define NextWordBoundary(p) ((PBYTE)(p) + ((ULONG_PTR)(p) & 1))
12438
#endif
12439
#ifndef NextDWordBoundary
12440
#define NextDWordBoundary(p) ((PBYTE)(p) + ((ULONG_PTR)(-(LONG_PTR)(p)) & 3))
12441
#endif
12442
12443
PBYTE WordSkipSz(UTCHAR *lpsz, UTCHAR* lpszCopy, UINT len)
12444 {
12445
PBYTE pb =
SkipSz(lpsz, lpszCopy, len);
12446
return NextWordBoundary(pb);
12447 }
12448
12449
PBYTE DWordSkipSz(UTCHAR *lpsz, UTCHAR* lpszCopy, UINT len)
12450 {
12451 PBYTE pb =
SkipSz(lpsz, lpszCopy, len);
12452
return NextDWordBoundary(pb);
12453 }
12454
12455 LPCSTR
GetCharSetName(BYTE charset)
12456 {
12457
return GetMaskedEnum(EI_CHARSETTYPE, charset, NULL);
12458 }
12459
12460
VOID ParseDialogFont(LPWORD* lplpstr, LPDLGTEMPLATE2 lpdt)
12461 {
12462 LOGFONT LogFont;
12463
short tmp;
12464
int fontheight, fheight;
12465
PSERVERINFO gpsi;
12466
BOOL fDesktopCharset =
FALSE;
12467 WORD dmLogPixels;
12468
12469
12470
12471
12472
move(tmp, *lplpstr);
12473 ++*lplpstr;
12474 fontheight = fheight = tmp;
12475
12476
if (fontheight == 0x7FFF) {
12477
12478 Print(
"\
12479 Font System Font (Messagebox font)\n");
12480
return;
12481 }
12482
12483
12484
12485
12486
12487
12488 RtlZeroMemory(&LogFont,
sizeof(LOGFONT));
12489
12490 moveExpValue(&gpsi,
VAR(gpsi));
12491
move(dmLogPixels, &
gpsi->dmLogPixels);
12492 LogFont.lfHeight = -
MultDiv(fontheight, dmLogPixels, 72);
12493
12494
if (lpdt->wDlgVer) {
12495 WORD w;
12496
BYTE b;
12497
12498
12499
12500
move(w, *lplpstr);
12501 ++*lplpstr;
12502 LogFont.lfWeight = w;
12503
12504
12505
12506
move(b, *lplpstr);
12507 ++((
BYTE*)*lplpstr);
12508 LogFont.lfItalic = b;
12509
12510
12511
12512
12513
move(b, *lplpstr);
12514 ++((
BYTE*)*lplpstr);
12515 LogFont.lfCharSet = b;
12516 }
12517
else {
12518
12519
12520
12521 LogFont.lfWeight = FW_BOLD;
12522 LogFont.lfCharSet = 0;
12523 fDesktopCharset =
TRUE;
12524 }
12525
12526 *lplpstr = (WORD*)
DWordSkipSz(*lplpstr, LogFont.lfFaceName,
ARRAY_SIZE(LogFont.lfFaceName));
12527
12528 Print(
"\
12529
Font %dpt (%d), Weight: %d, %s Italic, %s,\n\
12530
\"%ls\"\n",
12531 fontheight, LogFont.lfHeight,
12532 LogFont.lfWeight,
12533 LogFont.lfItalic ?
"" :
"Not",
12534 fDesktopCharset ?
"DESKTOP_CHARSET" :
GetCharSetName(LogFont.lfCharSet),
12535 LogFont.lfFaceName);
12536 }
12537
12538 LPCSTR
GetCtrlStyle(WORD iClass, DWORD style)
12539 {
12540 WORD
type =
GF_WS;
12541
12542
switch (iClass) {
12543
case ICLS_DIALOG:
12544
type =
GF_DS;
12545
break;
12546
case ICLS_STATIC:
12547
type =
GF_SS;
12548
break;
12549
case ICLS_EDIT:
12550
type =
GF_ES;
12551
break;
12552
case ICLS_BUTTON:
12553
type =
GF_BS;
12554
break;
12555
case ICLS_COMBOBOX:
12556 type =
GF_CBS;
12557
break;
12558
case ICLS_LISTBOX:
12559
type =
GF_LBS;
12560
break;
12561
case ICLS_SCROLLBAR:
12562
type =
GF_SBS;
12563
break;
12564
default:
12565
break;
12566 }
12567 return GetFlags(type, style, NULL, FALSE);
12568 }
12569
12570
BOOL Iddlgt(DWORD opts, LPVOID param1)
12571 {
12572 LPDLGTEMPLATE lpdt = (LPDLGTEMPLATE)
FIXKP(param1);
12573 DLGTEMPLATE2
dt;
12574 LPDLGTEMPLATE2 lpdt2 = &
dt;
12575 BOOLEAN fNewDialogTemplate =
FALSE;
12576
UTCHAR* lpszMenu;
12577
UTCHAR* lpszClass;
12578
UTCHAR* lpszText;
12579
UTCHAR* lpStr;
12580 UTCHAR* lpCreateParams;
12581 LPCSTR lpszIClassName;
12582 WORD w;
12583 DLGITEMTEMPLATE2 dit;
12584 LPDLGITEMTEMPLATE lpdit;
12585
UTCHAR menuName[64];
12586
UTCHAR className[64];
12587
UTCHAR text[64];
12588
PSERVERINFO gpsi;
12589
12590 UNREFERENCED_PARAMETER(opts);
12591
12592
if (opts == 0 && param1 ==
NULL) {
12593
return FALSE;
12594 }
12595
12596
move(w, &((LPDLGTEMPLATE2)lpdt)->wSignature);
12597
12598
if (w == 0xffff) {
12599
move(dt, lpdt);
12600 fNewDialogTemplate =
TRUE;
12601 }
12602
else {
12603
dt.wDlgVer = 0;
12604
dt.wSignature = 0;
12605
dt.dwHelpID = 0;
12606
move(
dt.dwExStyle, &lpdt->dwExtendedStyle);
12607
move(
dt.style, &lpdt->style);
12608
move(
dt.cDlgItems, &lpdt->cdit);
12609
move(
dt.x, &lpdt->x);
12610
move(
dt.y, &lpdt->y);
12611
move(
dt.cx, &lpdt->cx);
12612
move(
dt.cy, &lpdt->cy);
12613 }
12614
12615
12616 Print(
"DlgTemplate%s @%p version %d\n",
dt.wDlgVer ?
"2" :
"", lpdt,
dt.wDlgVer);
12617
12618
if (!(opts & OFLAG(v))) {
12619 Print(
"\
12620
(%d, %d)-(%d,%d) [%d, %d](dec)\n\
12621
Style %08lx ExStyle %08lx items 0x%x\n",
12622
dt.x,
dt.y,
dt.x +
dt.cx,
dt.y +
dt.cy,
dt.cx,
dt.cy,
12623
dt.style,
dt.dwExStyle,
dt.cDlgItems);
12624 }
12625
else {
12626 Print(
"\
12627
(%d,%d)-(%d,%d) [%d,%d] (dec) item: 0x%lx\n",
12628
dt.x,
dt.y,
dt.x +
dt.cx,
dt.y +
dt.cy,
12629
dt.cx,
dt.cy,
12630
dt.cDlgItems);
12631 Print(
"\
12632
Style %08lx %s",
dt.style, OFLAG(v) ?
GetFlags(GF_DS,
dt.style, NULL, FALSE) :
"");
12633
if ((
dt.style & DS_SHELLFONT) == DS_SHELLFONT) {
12634 Print(
" [DS_SHELLFONT]");
12635 }
12636 Print(
"\n");
12637 Print(
"\
12638
ExStyle %08lx %s\n",
dt.dwExStyle,
GetFlags(GF_WSEX,
dt.dwExStyle, NULL, FALSE));
12639 }
12640
12641
12642 lpszMenu = (LPWSTR)(((
PBYTE)(lpdt)) + (
dt.wDlgVer ?
sizeof(DLGTEMPLATE2):
sizeof(DLGTEMPLATE)));
12643
12644
12645
12646
12647
12648
move(w, (WORD*)lpszMenu);
12649
12650
12651
12652
12653
if (w != 0) {
12654
if (w == 0xffff) {
12655 LPWORD lpwMenu = (LPWORD)((LPBYTE)lpszMenu + 2);
12656
move(w, lpwMenu);
12657 Print(
"\
12658
menu id %lx\n", w);
12659 }
12660 }
12661
12662
if (w == 0xFFFF) {
12663 lpszClass = (LPWSTR)((LPBYTE)lpszMenu + 4);
12664 }
else {
12665 lpszClass = (
UTCHAR *)
WordSkipSz(lpszMenu, menuName,
ARRAY_SIZE(menuName));
12666 Print(
"\
12667
menu @%p \"%ls\"\n", lpszMenu, menuName);
12668 }
12669
12670
12671
12672
12673 lpszText = (
UTCHAR *)
WordSkipSz(lpszClass, className,
ARRAY_SIZE(className));
12674 Print(
"\
12675
class @%p \"%ls\"\n", lpszClass, className);
12676
12677
12678
12679
12680 lpStr = (
UTCHAR *)
WordSkipSz(lpszText, text,
ARRAY_SIZE(text));
12681 Print(
"\
12682
text @%p \"%ls\"\n", lpszText, text);
12683
12684
12685
12686
12687
if (
dt.style & DS_SETFONT) {
12688
ParseDialogFont(&lpStr, &dt);
12689 }
12690
12691 lpdit = (LPDLGITEMTEMPLATE)
NextDWordBoundary(lpStr);
12692
12693
12695
12697
if (!(opts & OFLAG(r))) {
12698
return TRUE;
12699 }
12700
12701 Print(
"\n");
12702
12703
12704
12705
12706
12707
while (
dt.cDlgItems-- != 0) {
12708 WORD iClass = 0;
12709
12710
12711
12712
12713
if (
dt.wDlgVer) {
12714
move(dit, lpdit);
12715 }
else {
12716 dit.dwHelpID = 0;
12717
move(dit.dwExStyle, &lpdit->dwExtendedStyle);
12718
move(dit.style, &lpdit->style);
12719
move(dit.x, &lpdit->x);
12720
move(dit.y, &lpdit->y);
12721
move(dit.cx, &lpdit->cx);
12722
move(dit.cy, &lpdit->cy);
12723
move(w, &lpdit->id);
12724 dit.dwID = w;
12725 }
12726
12727 Print(
"\
12728
#ID:0x%04x @%p HelpID:0x%04x (%d,%d)-(%d,%d) [%d,%d] (dec)\n",
12729 dit.dwID,
12730 lpdit,
12731 dit.dwHelpID,
12732 dit.x, dit.y, dit.x + dit.cx, dit.y + dit.cy,
12733 dit.cx, dit.cy);
12734
12735
12736
12737
12738 lpszClass = (LPWSTR)(((
PBYTE)(lpdit)) + (
dt.wDlgVer ?
sizeof(DLGITEMTEMPLATE2) :
sizeof(DLGITEMTEMPLATE)));
12739
12740
12741
12742
12743
12744
move(w, lpszClass);
12745
if (w == 0xFFFF) {
12746 WORD wAtom;
12747
12748 lpszText = lpszClass + 2;
12749
#ifdef ORG
12750
lpszClass = (LPWSTR)(
gpsi->
atomSysClass[*(((LPWORD)lpszClass)+1) & ~
CODEBIT]);
12751
#endif
12752
moveExpValue(&gpsi,
VAR(gpsi));
12753
move(iClass, lpszClass + 1);
12754 iClass &= ~
CODEBIT;
12755
if (*(lpszIClassName =
GetMaskedEnum(EI_CLSTYPE, iClass, NULL)) ==
'\0') {
12756 lpszIClassName =
NULL;
12757 }
12758
move(wAtom, &
gpsi->
atomSysClass[iClass]);
12759 swprintf(className, L
"#%lx", wAtom);
12760 }
else {
12761 lpszText = (
UTCHAR*)
SkipSz(lpszClass, className,
ARRAY_SIZE(className));
12762 lpszIClassName =
NULL;
12763 }
12764
12765 Print(
"\
12766
class @%p \"%ls\" ", lpszClass, className);
12767
if (lpszIClassName) {
12768 Print(
"= %s", lpszIClassName);
12769 }
12770 Print(
"\n");
12771
12772 lpszText = (
UTCHAR*)
NextWordBoundary(lpszText);
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
move(w, lpszText);
12784
if (w == 0xFFFF) {
12785 swprintf(text, L
"#%lx", w);
12786 lpCreateParams = (LPWSTR)((
PBYTE)lpszText + 4);
12787 }
else {
12788 lpCreateParams = (LPWSTR)(
PBYTE)
WordSkipSz(lpszText, text,
ARRAY_SIZE(text));
12789 }
12790
12791 Print(
"\
12792
text @%p \"%ls\"\n", lpszText, text);
12793
12794 Print(
"\
12795
style %08lx %s%s", dit.style,
12796 (opts & OFLAG(v)) ?
GetCtrlStyle(iClass, dit.style) :
"",
12797 (opts & OFLAG(v)) ?
"\n" :
"");
12798 Print(
"\
12799
ExStyle %08lx %s\n", dit.dwExStyle, (opts & OFLAG(v)) ?
GetFlags(GF_WSEX, dit.dwExStyle, NULL, FALSE) :
"");
12800
12801
12802
12803
12804
move(w, lpCreateParams);
12805 lpdit = (LPDLGITEMTEMPLATE)
NextDWordBoundary(
12806 (LPBYTE)(lpCreateParams + 1) + w);
12807 Print(
"\n");
12808 }
12809
12810
12811
return TRUE;
12812 }
12813
12814
#if !defined(KERNEL)
12815
BOOL Idimedpi(DWORD opts, PVOID param1)
12816 {
12817
IMEDPI ImeDpi;
12818
PIMEDPI pImeDpi;
12819
char ach[32];
12820
12821 UNREFERENCED_PARAMETER(opts);
12822
12823
if (param1 ==
NULL) {
12824 moveExpValue(&pImeDpi,
"imm32!gpImeDpi");
12825 }
12826
else {
12827 pImeDpi = (
PIMEDPI)
FIXKP(param1);
12828 }
12829
12830
while (pImeDpi) {
12831
move(ImeDpi, pImeDpi);
12832
12833 Print(
"IMEDPI @ %08p hInst: %08p cLock:%3d", pImeDpi, ImeDpi.
hInst, ImeDpi.
cLock);
12834 Print(
" CodePage:%4d UI Class: \"%S\"\n", ImeDpi.
dwCodePage, ImeDpi.
wszUIClass);
12835
if (opts & OFLAG(i)) {
12836 Print(
" ImeInfo: @ %08p dwPrivateDataSize: %08x\n", &pImeDpi->
ImeInfo,
12837 ImeDpi.
ImeInfo.dwPrivateDataSize);
12838 }
12839
12840
if (opts & OFLAG(v)) {
12841
sprintf(ach,
"IMEDPI %p", pImeDpi);
12842
Idso(0, ach);
12843 }
12844
12845 Print(
"\n");
12846
12847 pImeDpi = ImeDpi.
pNext;
12848 }
12849
12850
return TRUE;
12851 }
12852
12853
#endif