00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
#include "precomp.h"
00012
#pragma hdrstop
00013 #define NOEXTAPI
00014
#include <wdbgexts.h>
00015
00016
00017
00018
00019 PSTR
pszAccessViolation =
"CONEXTS: Access violation on \"%s\", switch to server context\n";
00020 PSTR
pszMoveException =
"CONEXTS: exception in move()\n";
00021 PSTR
pszReadFailure =
"CONEXTS: moveBlock(%x, %x, %x) failed!\n";
00022
00023
00024
00025
00026 #define move(dst, src) moveBlock(dst, src, sizeof(dst))
00027
00028 #define moveBlock(dst, src, size) \
00029
try { \
00030
if (lpExtensionApis->nSize >= sizeof(WINDBG_EXTENSION_APIS)) { \
00031
if (!(*lpExtensionApis->lpReadProcessMemoryRoutine)((DWORD_PTR)(src), &(dst), (size), NULL)) { \
00032
(*lpExtensionApis->lpOutputRoutine)(pszReadFailure, &dst, src, size); \
00033
return FALSE; \
00034
} \
00035
} else { \
00036
if (!NT_SUCCESS(NtReadVirtualMemory(hCurrentProcess, (LPVOID)(src), &(dst), (size), NULL))) { \
00037
(*lpExtensionApis->lpOutputRoutine)(pszReadFailure, &dst, src, size); \
00038
return FALSE; \
00039
} \
00040
} \
00041
} except (EXCEPTION_EXECUTE_HANDLER) { \
00042
(*lpExtensionApis->lpOutputRoutine)(pszMoveException); \
00043
return FALSE; \
00044
}
00045
00046 #define moveExpressionValue(dst, src) \
00047
try { \
00048
DWORD dwGlobal = (DWORD)lpExtensionApis->lpGetExpressionRoutine(src); \
00049
if (lpExtensionApis->nSize < sizeof(WINDBG_EXTENSION_APIS)) { \
00050
move(dwGlobal, dwGlobal); \
00051
} \
00052
(DWORD)dst = dwGlobal; \
00053
} except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? \
00054
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { \
00055
(*lpExtensionApis->lpOutputRoutine)(pszAccessViolation, src); \
00056
return FALSE; \
00057
}
00058
00059 #define moveExpressionValuePtr(dst, src) \
00060
try { \
00061
DWORD_PTR dwGlobal = lpExtensionApis->lpGetExpressionRoutine(src);\
00062
if (lpExtensionApis->nSize < sizeof(WINDBG_EXTENSION_APIS)) { \
00063
move(dwGlobal, dwGlobal); \
00064
} \
00065
(DWORD_PTR)dst = dwGlobal; \
00066
} except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? \
00067
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { \
00068
(*lpExtensionApis->lpOutputRoutine)(pszAccessViolation, src); \
00069
return FALSE; \
00070
}
00071
00072 #define moveExpressionAddress(dst, src) \
00073
try { \
00074
if (lpExtensionApis->nSize >= sizeof(WINDBG_EXTENSION_APIS)) { \
00075
(DWORD_PTR)dst = lpExtensionApis->lpGetExpressionRoutine("&"src); \
00076
} else { \
00077
(DWORD_PTR)dst = lpExtensionApis->lpGetExpressionRoutine(src); \
00078
} \
00079
} except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? \
00080
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { \
00081
(*lpExtensionApis->lpOutputRoutine)(pszAccessViolation, src); \
00082
return FALSE; \
00083
}
00084
00085 BOOL DebugConvertToAnsi(
00086 HANDLE hCurrentProcess,
00087 PWINDBG_EXTENSION_APIS lpExtensionApis,
00088 LPWSTR psrc,
00089 ULONG cbSrc,
00090 LPSTR pdst,
00091 ULONG cbDst)
00092 {
00093 WCHAR awch[80];
00094 ULONG cchText;
00095
00096 cbSrc =
min(cbSrc,
sizeof(awch) -
sizeof(WCHAR));
00097
moveBlock(awch, psrc, cbSrc);
00098 awch[cbSrc/
sizeof(WCHAR)] = 0;
00099
00100 cchText = wcslen(awch);
00101
if (cchText == 0) {
00102 strcpy(pdst,
"<null>");
00103 }
else {
00104 cbSrc =
min(cbSrc +
sizeof(WCHAR), (cchText + 1) *
sizeof(WCHAR));
00105
RtlUnicodeToMultiByteN(pdst, cbDst,
NULL,
00106 awch, cbSrc);
00107 pdst[cbDst-1] = 0;
00108 }
00109
return TRUE;
00110 }
00111
00112 BOOL gbShowFlagNames =
FALSE;
00113
00114 #define NO_FLAG (LPSTR)0xFFFFFFFF // use this for non-meaningful entries.
00115
00116 #define GF_CONSOLE 1
00117 LPSTR
apszConsoleFlags[] = {
00118
"CONSOLE_IS_ICONIC" ,
00119
"CONSOLE_OUTPUT_SUSPENDED" ,
00120
"CONSOLE_HAS_FOCUS" ,
00121
"CONSOLE_IGNORE_NEXT_MOUSE_INPUT",
00122
"CONSOLE_SELECTING" ,
00123
"CONSOLE_SCROLLING" ,
00124
"CONSOLE_DISABLE_CLOSE" ,
00125
"CONSOLE_NOTIFY_LAST_CLOSE" ,
00126
"CONSOLE_NO_WINDOW" ,
00127
"CONSOLE_VDM_REGISTERED" ,
00128
"CONSOLE_UPDATING_SCROLL_BARS" ,
00129
"CONSOLE_QUICK_EDIT_MODE" ,
00130
"CONSOLE_TERMINATING" ,
00131
"CONSOLE_CONNECTED_TO_EMULATOR" ,
00132
"CONSOLE_FULLSCREEN_NOPAINT" ,
00133
"CONSOLE_SHUTTING_DOWN" ,
00134
"CONSOLE_AUTO_POSITION" ,
00135
"CONSOLE_IGNORE_NEXT_KEYUP" ,
00136
"CONSOLE_WOW_REGISTERED" ,
00137
"CONSOLE_USE_PRIVATE_FLAGS" ,
00138
"CONSOLE_HISTORY_NODUP" ,
00139
"CONSOLE_SCROLLBAR_TRACKING" ,
00140
"CONSOLE_IN_DESTRUCTION" ,
00141
"CONSOLE_SETTING_WINDOW_SIZE" ,
00142
"CONSOLE_DEFAULT_BUFFER_SIZE" ,
00143
NULL
00144 };
00145
00146 #define GF_CONSOLESEL 2
00147 LPSTR
apszConsoleSelectionFlags[] = {
00148
"CONSOLE_SELECTION_NOT_EMPTY" ,
00149
"CONSOLE_MOUSE_SELECTION" ,
00150
"CONSOLE_MOUSE_DOWN" ,
00151
"CONSOLE_SELECTION_INVERTED" ,
00152
NULL
00153 };
00154
00155 #define GF_FULLSCREEN 3
00156 LPSTR
apszFullScreenFlags[] = {
00157
"CONSOLE_FULLSCREEN",
00158
"CONSOLE_FULLSCREEN_HARDWARE",
00159
NULL
00160 };
00161
00162 #define GF_CMDHIST 4
00163 LPSTR
apszCommandHistoryFlags[] = {
00164
"CLE_ALLOCATED",
00165
"CLE_RESET",
00166
NULL
00167 };
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177 LPSTR
GetFlags(
00178 WORD wType,
00179 DWORD dwFlags,
00180 LPSTR pszBuf)
00181 {
00182
static char szT[400];
00183
DWORD i;
00184
BOOL fFirst =
TRUE;
00185
BOOL fNoMoreNames =
FALSE;
00186 LPSTR *apszFlags;
00187
00188
if (pszBuf ==
NULL) {
00189 pszBuf = szT;
00190 }
00191 *pszBuf =
'\0';
00192
00193
if (!
gbShowFlagNames) {
00194
return(pszBuf);
00195 }
00196
00197
switch (wType) {
00198
case GF_CONSOLE:
00199 apszFlags =
apszConsoleFlags;
00200
break;
00201
00202
case GF_CONSOLESEL:
00203 apszFlags =
apszConsoleSelectionFlags;
00204
break;
00205
00206
case GF_FULLSCREEN:
00207 apszFlags =
apszFullScreenFlags;
00208
break;
00209
00210
case GF_CMDHIST:
00211 apszFlags =
apszCommandHistoryFlags;
00212
break;
00213
00214
default:
00215 strcpy(pszBuf,
" = Invalid flag type.");
00216
return(pszBuf);
00217 }
00218
00219
for (i = 0;
dwFlags;
dwFlags >>= 1, i++) {
00220
00221
if (!fNoMoreNames && (apszFlags[i] ==
NULL)) {
00222 fNoMoreNames =
TRUE;
00223 }
00224
if (
dwFlags & 1) {
00225
if (!fFirst) {
00226 strcat(pszBuf,
" | ");
00227 }
else {
00228 strcat(pszBuf,
" = ");
00229 fFirst =
FALSE;
00230 }
00231
if (fNoMoreNames || (apszFlags[i] ==
NO_FLAG)) {
00232
char ach[16];
00233
sprintf(ach,
"0x%lx", 1 << i);
00234 strcat(pszBuf, ach);
00235 }
else {
00236 strcat(pszBuf, apszFlags[i]);
00237 }
00238 }
00239 }
00240
return pszBuf;
00241 }
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251 BOOL help(
00252 HANDLE hCurrentProcess,
00253 HANDLE hCurrentThread,
00254 DWORD dwCurrentPc,
00255 PWINDBG_EXTENSION_APIS lpExtensionApis,
00256 LPSTR lpArgumentString)
00257 {
00258 PWINDBG_OUTPUT_ROUTINE Print;
00259 PWINDBG_GET_EXPRESSION EvalExpression;
00260 PWINDBG_GET_SYMBOL GetSymbol;
00261
00262 UNREFERENCED_PARAMETER(hCurrentProcess);
00263 UNREFERENCED_PARAMETER(hCurrentThread);
00264 UNREFERENCED_PARAMETER(dwCurrentPc);
00265
00266 Print = lpExtensionApis->lpOutputRoutine;
00267 EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
00268 GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
00269
00270
while (*lpArgumentString ==
' ')
00271 lpArgumentString++;
00272
00273
if (*lpArgumentString ==
'\0') {
00274 Print(
"conexts help:\n\n");
00275 Print(
"!help [cmd] - this list, or details about cmd\n");
00276 Print(
"!dc [fvh] [pconsole] - Dump CONSOLE_INFORMATION struct\n");
00277 Print(
"!dch <p> - Dump Command History\n");
00278 Print(
"!dcpt [address] - Dump CPTABLEINFO (default: GlyphCP)\n");
00279 Print(
"!dmem [v] [pconsole] - Dump memory usage\n");
00280 Print(
"!df - Dump font cache\n");
00281 Print(
"!di <p> - Dump input buffer info\n");
00282 Print(
"!dir <p> - Dump input record ???\n");
00283 Print(
"!ds <pscreen> - Dump SCREEN_INFORMATION struct\n");
00284 Print(
"!dt [f] [v[n]] <pcon> - Dump screen buffer info\n");
00285 }
else {
00286
if (*lpArgumentString ==
'!')
00287 lpArgumentString++;
00288
if (strcmp(lpArgumentString,
"df") == 0) {
00289 Print(
"!df - dumps Faces and then the cache\n");
00290
00291 }
else if (strcmp(lpArgumentString,
"dc") == 0) {
00292 Print(
"!dc [fhv] - dumps CONSOLE_INFORMATION struct for all consoles\n");
00293 Print(
"!dc [fhv] address - dumps CONSOLE_INFORMATION struct for console at address\n");
00294 Print(
" optional flags (must be sparated by spaces) :\n");
00295 Print(
" f - show names of flags\n");
00296 Print(
" h - show command histories\n");
00297 Print(
" v - show verbose information\n");
00298 Print(
"eg: \"dc f h v\"\n");
00299
00300 }
else if (strcmp(lpArgumentString,
"dt") == 0) {
00301 Print(
"!dt [fc] [v[n]] addr - dumps text buffer info for Console at addr\n");
00302 Print(
"!dt - dumps text buffer info for all Consoles\n");
00303 Print(
" f - show flags\n");
00304 Print(
" c - checks text buffer integrity\n");
00305 Print(
" v[n] - show first n lines (default 10)\n");
00306
00307 }
else if (strcmp(lpArgumentString,
"di") == 0) {
00308 Print(
"!di address - dumps text buffer info (INPUT_INFORMATION)\n");
00309 Print(
"!di - dumps text buffer info for all Consoles\n");
00310
00311 }
else if (strcmp(lpArgumentString,
"ds") == 0) {
00312 Print(
"!ds address - dumps SCREEN_INFORMATION struct at address\n");
00313
00314 }
else if (strcmp(lpArgumentString,
"dmem") == 0) {
00315 Print(
"!dmem [v] - dumps memory usage for all consoles\n");
00316 Print(
"!dmem [v] addr - dumps memory usage for all console at addr\n");
00317 Print(
" v - show verbose information\n");
00318
00319 }
00320 }
00321
00322
return 0;
00323 }
00324
00325
BOOL dch(HANDLE, HANDLE, DWORD, PWINDBG_EXTENSION_APIS, LPSTR);
00326
00327
00328
00329
00330
00331
00332
00333
00334 BOOL dc(
00335 HANDLE hCurrentProcess,
00336 HANDLE hCurrentThread,
00337 DWORD dwCurrentPc,
00338 PWINDBG_EXTENSION_APIS lpExtensionApis,
00339 LPSTR lpArgString)
00340 {
00341 PWINDBG_OUTPUT_ROUTINE Print;
00342 PWINDBG_GET_EXPRESSION EvalExpression;
00343 PWINDBG_GET_SYMBOL GetSymbol;
00344
00345
char ach[120];
00346
char chVerbose, chShowFlags, chHistory;
00347
BOOL fPrintLine;
00348 ULONG i;
00349 ULONG
NumberOfConsoleHandles;
00350
PCONSOLE_INFORMATION *
ConsoleHandles;
00351
CONSOLE_INFORMATION Console;
00352
PCONSOLE_INFORMATION pConsole =
NULL;
00353
00354 Print = lpExtensionApis->lpOutputRoutine;
00355 EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
00356 GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
00357
00358
gbShowFlagNames =
FALSE;
00359 chVerbose =
' ';
00360 chShowFlags =
' ';
00361 chHistory =
' ';
00362
00363
do {
00364
00365
00366
00367
while (*lpArgString && *lpArgString ==
' ')
00368 lpArgString++;
00369
00370
00371
00372
00373
switch (*lpArgString) {
00374
case 'f':
00375
gbShowFlagNames =
TRUE;
00376 chShowFlags =
'f';
00377
break;
00378
00379
case 'v':
00380 chVerbose =
'v';
00381
break;
00382
00383
case 'h':
00384 chHistory =
'h';
00385
break;
00386
00387
case '\0':
00388
00389
00390
00391
moveExpressionValue(
NumberOfConsoleHandles,
00392
"winsrv!NumberOfConsoleHandles");
00393
moveExpressionValuePtr(
ConsoleHandles,
00394
"winsrv!ConsoleHandles");
00395 fPrintLine =
FALSE;
00396
for (i = 0; i <
NumberOfConsoleHandles; i++) {
00397
move(pConsole,
ConsoleHandles);
00398
if (pConsole !=
NULL) {
00399
if (fPrintLine)
00400 Print(
"==========================================\n");
00401
sprintf(ach,
"%c %c %c %p", chVerbose, chShowFlags, chHistory, pConsole);
00402
dc(hCurrentProcess, hCurrentThread, dwCurrentPc, lpExtensionApis, ach);
00403 fPrintLine =
TRUE;
00404 }
00405
ConsoleHandles++;
00406 }
00407
return TRUE;
00408
00409
default:
00410 pConsole = (
PCONSOLE_INFORMATION)EvalExpression(lpArgString);
00411
break;
00412 }
00413 lpArgString++;
00414
00415 }
while (pConsole ==
NULL);
00416
00417
move(Console, pConsole);
00418
00419
DebugConvertToAnsi(hCurrentProcess,
00420 lpExtensionApis,
00421 Console.
Title,
00422 Console.
TitleLength,
00423 ach,
00424
sizeof(ach));
00425 Print(
"PCONSOLE @ 0x%lX \"%s\"\n", pConsole, ach);
00426
00427
if (chHistory ==
'h') {
00428 PLIST_ENTRY ListHead, ListNext;
00429 LIST_ENTRY ListEntry;
00430
PCOMMAND_HISTORY History;
00431
00432 ListHead = &(pConsole->
CommandHistoryList);
00433 ListNext = Console.
CommandHistoryList.Flink;
00434
while (ListNext != ListHead) {
00435
History = CONTAINING_RECORD( ListNext,
COMMAND_HISTORY, ListLink );
00436
sprintf(ach,
"%p",
History);
00437
dch(hCurrentProcess, hCurrentThread, dwCurrentPc,
00438 lpExtensionApis, ach);
00439
move(ListEntry, ListNext);
00440 ListNext = ListEntry.Flink;
00441 Print(
"----\n");
00442 }
00443
return TRUE;
00444 }
00445
00446 Print(
"\t pConsoleLock 0x%08lX\n"
00447
"\t RefCount 0x%04lX\n"
00448
"\t WaitCount 0x%04lX\n"
00449
"\t pInputBuffer 0x%08lX\n"
00450
"\t pCurrentScreenBuffer 0x%08lX\n"
00451
"\t pScreenBuffers 0x%08lX\n"
00452
"\t hWnd 0x%08lX\n"
00453
"\t hDC 0x%08lX\n"
00454
"\t LastAttributes 0x%04lX\n",
00455 &pConsole->
ConsoleLock,
00456 Console.
RefCount,
00457 Console.
WaitCount,
00458 &pConsole->
InputBuffer,
00459 Console.
CurrentScreenBuffer,
00460 Console.
ScreenBuffers,
00461 Console.
hWnd,
00462 Console.
hDC,
00463 Console.
LastAttributes);
00464
00465 Print(
"\t Flags 0x%08lX%s\n",
00466 Console.
Flags,
GetFlags(
GF_CONSOLE, Console.
Flags,
NULL));
00467 Print(
"\t FullScreenFlags 0x%04lX%s\n",
00468 Console.
FullScreenFlags,
00469
GetFlags(
GF_FULLSCREEN, Console.
FullScreenFlags,
NULL));
00470 Print(
"\t ConsoleHandle 0x%08lX\n"
00471
"\t CtrlFlags 0x%08lX\n",
00472 Console.
ConsoleHandle,
00473 Console.
CtrlFlags
00474 );
00475
00476
if (chVerbose ==
'v') {
00477 Print(
"\t hMenu 0x%08lX\n"
00478
"\t hHeirMenu 0x%08lX\n"
00479
"\t hSysPalette 0x%08lX\n"
00480
"\t WindowRect.L T R B 0x%08lX 0x%08lX 0x%08lX 0x%08lX\n"
00481
"\t ResizeFlags 0x%08lX\n"
00482
"\t OutputQueue.F B 0x%08lX 0x%08lX\n"
00483
"\t InitEvents[] 0x%08lX 0x%08lX\n"
00484
"\t ClientThreadHandle 0x%08lX\n"
00485
"\t ProcessHandleList.F B 0x%08lX 0x%08lX\n"
00486
"\t CommandHistoryList.F B 0x%08lX 0x%08lX\n"
00487
"\t ExeAliasList.F B 0x%08lX 0x%08lX\n",
00488 Console.
hMenu,
00489 Console.
hHeirMenu,
00490 Console.
hSysPalette,
00491 Console.
WindowRect.left,
00492 Console.
WindowRect.top,
00493 Console.
WindowRect.right,
00494 Console.
WindowRect.bottom,
00495 Console.
ResizeFlags,
00496 Console.
OutputQueue.Flink,
00497 Console.
OutputQueue.Blink,
00498 Console.
InitEvents[0],
00499 Console.
InitEvents[1],
00500 Console.
ClientThreadHandle,
00501 Console.
ProcessHandleList.Flink,
00502 Console.
ProcessHandleList.Blink,
00503 Console.
CommandHistoryList.Flink,
00504 Console.
CommandHistoryList.Blink,
00505 Console.
ExeAliasList.Flink,
00506 Console.
ExeAliasList.Blink
00507 );
00508
DebugConvertToAnsi(hCurrentProcess,
00509 lpExtensionApis,
00510 Console.
OriginalTitle,
00511 Console.
OriginalTitleLength,
00512 ach,
00513
sizeof(ach)
00514 );
00515 Print(
"\t NumCommandHistories 0x%04lX\n"
00516
"\t MaxCommandHistories 0x%04lX\n"
00517
"\t CommandHistorySize 0x%04lX\n"
00518
"\t OriginalTitleLength 0x%04lX\n"
00519
"\t TitleLength 0x%04lX\n"
00520
"\t OriginalTitle %s\n"
00521
"\t dwHotKey 0x%08lX\n"
00522
"\t hIcon 0x%08lX\n"
00523
"\t iIcondId 0x%08lX\n"
00524
"\t ReserveKeys 0x%02lX\n"
00525
"\t WaitQueue 0x%08lX\n",
00526 Console.
NumCommandHistories,
00527 Console.
MaxCommandHistories,
00528 Console.
CommandHistorySize,
00529 Console.
OriginalTitleLength,
00530 Console.
TitleLength,
00531 ach,
00532 Console.
dwHotKey,
00533 Console.
hIcon,
00534 Console.
iIconId,
00535 Console.
ReserveKeys,
00536 Console.
WaitQueue
00537 );
00538 Print(
"\t SelectionFlags 0x%08lX%s\n"
00539
"\t SelectionRect.L T R B 0x%04lX 0x%04lX 0x%04lX 0x%04lX\n"
00540
"\t SelectionAnchor.X Y 0x%04lX 0x%04lX\n"
00541
"\t TextCursorPosition.X Y 0x%04lX 0x%04lX\n"
00542
"\t TextCursorSize 0x%08lX\n"
00543
"\t TextCursorVisible 0x%02lX\n"
00544
"\t InsertMode 0x%02lX\n"
00545
"\t wShowWindow 0x%04lX\n"
00546
"\t dwWindowOriginX 0x%08lX\n"
00547
"\t dwWindowOriginY 0x%08lX\n"
00548
"\t PopupCount 0x%04lX\n",
00549 Console.
SelectionFlags,
00550
GetFlags(
GF_CONSOLESEL, Console.
SelectionFlags,
NULL),
00551 Console.
SelectionRect.Left,
00552 Console.
SelectionRect.Top,
00553 Console.
SelectionRect.Right,
00554 Console.
SelectionRect.Bottom,
00555 Console.
SelectionAnchor.X,
00556 Console.
SelectionAnchor.Y,
00557 Console.
TextCursorPosition.X,
00558 Console.
TextCursorPosition.Y,
00559 Console.
TextCursorSize,
00560 Console.
TextCursorVisible,
00561 Console.
InsertMode,
00562 Console.
wShowWindow,
00563 Console.
dwWindowOriginX,
00564 Console.
dwWindowOriginY,
00565 Console.
PopupCount
00566 );
00567 Print(
"\t VDMStartHardwareEvent 0x%08lX\n"
00568
"\t VDMEndHardwareEvent 0x%08lX\n"
00569
"\t VDMProcessHandle 0x%08lX\n"
00570
"\t VDMProcessId 0x%08lX\n"
00571
"\t VDMBufferSectionHandle 0x%08lX\n"
00572
"\t VDMBuffer 0x%08lX\n"
00573
"\t VDMBufferClient 0x%08lX\n"
00574
"\t VDMBufferSize.X Y 0x%04lX 0x%04lX\n"
00575
"\t StateSectionHandle 0x%08lX\n"
00576
"\t StateBuffer 0x%08lX\n"
00577
"\t StateBufferClient 0x%08lX\n"
00578
"\t StateLength 0x%08lX\n",
00579 Console.
VDMStartHardwareEvent,
00580 Console.
VDMEndHardwareEvent,
00581 Console.
VDMProcessHandle,
00582 Console.
VDMProcessId,
00583 Console.
VDMBufferSectionHandle,
00584 Console.
VDMBuffer,
00585 Console.
VDMBufferClient,
00586 Console.
VDMBufferSize.X,
00587 Console.
VDMBufferSize.Y,
00588 Console.
StateSectionHandle,
00589 Console.
StateBuffer,
00590 Console.
StateBufferClient,
00591 Console.
StateLength
00592 );
00593 Print(
"\t CP 0x%08lX\n"
00594
"\t OutputCP 0x%08lX\n"
00595
"\t hWndProgMan 0x%08lX\n"
00596
"\t bIconInit 0x%08lX\n"
00597
"\t LimitingProcessId 0x%08lX\n"
00598
"\t TerminationEvent 0x%08lX\n"
00599
"\t VerticalClientToWin 0x%04lX\n"
00600
"\t HorizontalClientToWin 0x%04lX\n",
00601 Console.
CP,
00602 Console.
OutputCP,
00603 Console.
hWndProgMan,
00604 Console.
bIconInit,
00605 Console.
LimitingProcessId,
00606 Console.
TerminationEvent,
00607 Console.
VerticalClientToWindow,
00608 Console.
HorizontalClientToWindow
00609 );
00610
#if defined(FE_SB)
00611
Print(
"\t EudcInformation 0x%08lX\n"
00612
"\t FontCacheInformation 0x%08lX\n",
00613 Console.EudcInformation,
00614 Console.FontCacheInformation
00615 );
00616
#if defined(FE_IME)
00617
Print(
"\tConsoleIme:\n"
00618
"\t ScrollFlag 0x%08lX\n"
00619
"\t ScrollWaitTimeout 0x%08lX\n"
00620
"\t ScrollWaitCountDown 0x%08lX\n"
00621
"\t CompStrData 0x%08lX\n"
00622
"\t ConvAreaMode 0x%08lX\n"
00623
"\t ConvAreaSystem 0x%08lX\n"
00624
"\t NumberOfConvAreaCompStr 0x%08lX\n"
00625
"\t ConvAreaCompStr 0x%08lX\n"
00626
"\t ConvAreaRoot 0x%08lX\n",
00627 Console.ConsoleIme.ScrollFlag,
00628 Console.ConsoleIme.ScrollWaitTimeout,
00629 Console.ConsoleIme.ScrollWaitCountDown,
00630 Console.ConsoleIme.CompStrData,
00631 Console.ConsoleIme.ConvAreaMode,
00632 Console.ConsoleIme.ConvAreaSystem,
00633 Console.ConsoleIme.NumberOfConvAreaCompStr,
00634 Console.ConsoleIme.ConvAreaCompStr,
00635 Console.ConsoleIme.ConvAreaRoot
00636 );
00637
#endif
00638
#endif
00639
}
00640
return TRUE;
00641 }
00642
00643
00644
00645
00646
00647
00648
00649
00650 BOOL dt(
00651 HANDLE hCurrentProcess,
00652 HANDLE hCurrentThread,
00653 DWORD dwCurrentPc,
00654 PWINDBG_EXTENSION_APIS lpExtensionApis,
00655 LPSTR lpArgString)
00656 {
00657 PWINDBG_OUTPUT_ROUTINE Print;
00658 PWINDBG_GET_EXPRESSION EvalExpression;
00659 PWINDBG_GET_SYMBOL GetSymbol;
00660
00661
char ach[120];
00662
BOOL fPrintLine;
00663 ULONG i, nLines;
00664
SHORT sh;
00665 ULONG
NumberOfConsoleHandles;
00666
PCONSOLE_INFORMATION *
ConsoleHandles;
00667
CONSOLE_INFORMATION Console;
00668
SCREEN_INFORMATION Screen;
00669
PCONSOLE_INFORMATION pConsole;
00670
DWORD FrameBufPtr;
00671
char chVerbose =
' ';
00672
char chShowFlags =
' ';
00673
char chCheck =
' ';
00674
PROW pRow;
00675
00676 Print = lpExtensionApis->lpOutputRoutine;
00677 EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
00678 GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
00679
00680
00681
00682
00683
00684 pConsole =
NULL;
00685
do {
00686
00687
00688
00689
while (*lpArgString && *lpArgString ==
' ')
00690 lpArgString++;
00691
00692
switch (*lpArgString) {
00693
case 'f':
00694
gbShowFlagNames =
TRUE;
00695 chShowFlags =
'f';
00696
break;
00697
00698
case 'c':
00699 chCheck =
'c';
00700
break;
00701
00702
case 'v':
00703 chVerbose =
'v';
00704 nLines = 0;
00705 lpArgString++;
00706
while ((*lpArgString >=
'0') && (*lpArgString <=
'9')) {
00707 nLines *= 10;
00708 nLines += *lpArgString -
'0';
00709 lpArgString++;
00710 }
00711 lpArgString--;
00712
if (nLines == 0) {
00713 nLines = 10;
00714 }
00715
break;
00716
00717
case '\0':
00718
00719
00720
00721
moveExpressionValue(
NumberOfConsoleHandles,
00722
"winsrv!NumberOfConsoleHandles");
00723
moveExpressionValuePtr(
ConsoleHandles,
00724
"winsrv!ConsoleHandles");
00725 fPrintLine =
FALSE;
00726
for (i = 0; i <
NumberOfConsoleHandles; i++) {
00727
move(pConsole,
ConsoleHandles);
00728
if (pConsole !=
NULL) {
00729
if (fPrintLine)
00730 Print(
"==========================================\n");
00731
sprintf(ach,
"%c %c %p", chVerbose, chShowFlags, pConsole);
00732
if (!
dt(hCurrentProcess, hCurrentThread,
00733 dwCurrentPc, lpExtensionApis, ach)) {
00734
return FALSE;
00735 }
00736 fPrintLine =
TRUE;
00737 }
00738
ConsoleHandles++;
00739 }
00740
return TRUE;
00741
00742
default:
00743 pConsole = (
PCONSOLE_INFORMATION)EvalExpression(lpArgString);
00744
break;
00745 }
00746 lpArgString++;
00747 }
while (pConsole ==
NULL);
00748
00749
move(Console, pConsole);
00750
00751 Print(
"PCONSOLE @ 0x%lX\n", pConsole);
00752
DebugConvertToAnsi(hCurrentProcess,
00753 lpExtensionApis,
00754 Console.
Title,
00755 Console.
TitleLength,
00756 ach,
00757
sizeof(ach));
00758 Print(
"\t Title %s\n"
00759
"\t pCurrentScreenBuffer 0x%08lX\n"
00760
"\t pScreenBuffers 0x%08lX\n"
00761
"\t VDMBuffer 0x%08lx\n"
00762
"\t CP %d, OutputCP %d\n",
00763 ach,
00764 Console.
CurrentScreenBuffer,
00765 Console.
ScreenBuffers,
00766 Console.
VDMBuffer,
00767 Console.
CP,
00768 Console.
OutputCP
00769 );
00770
00771
moveExpressionValue(FrameBufPtr,
"winsrv!FrameBufPtr");
00772
move(Screen, Console.
CurrentScreenBuffer);
00773
if (Screen.
Flags &
CONSOLE_TEXTMODE_BUFFER) {
00774 Print(
"\t TextInfo.Rows 0x%08X\n"
00775
"\t TextInfo.TextRows 0x%08X\n"
00776
"\t TextInfo.FirstRow 0x%08X\n"
00777
"\t FrameBufPtr 0x%08X\n",
00778 Screen.
BufferInfo.TextInfo.Rows,
00779 Screen.
BufferInfo.TextInfo.TextRows,
00780 Screen.
BufferInfo.TextInfo.FirstRow,
00781 FrameBufPtr);
00782 }
00783
00784 pRow = Screen.
BufferInfo.TextInfo.Rows;
00785
if (chCheck) {
00786 Print(
"Checking BufferInfo...\n");
00787
for (sh = 0; sh < Screen.
ScreenBufferSize.Y; sh++) {
00788
ROW Row;
00789
move(Row, pRow);
00790
00791
00792
00793
00794
00795
if (Row.
AttrRow.
Length == 1) {
00796
if (Row.
AttrRow.
Attrs != &(pRow->
AttrRow.
AttrPair)) {
00797 Print(
"Bad Row[%lx]: Attrs %lx should be %lx\n",
00798 sh, Row.
AttrRow.
Attrs, pRow->
AttrRow.
AttrPair);
00799 }
00800 }
00801
00802
00803
00804
00805
00806 pRow++;
00807 }
00808 Print(
"...check completed\n");
00809 }
00810
00811
if (chVerbose ==
' ') {
00812
return TRUE;
00813 }
00814
00815 pRow = Screen.
BufferInfo.TextInfo.Rows;
00816
for (i = 0; i < nLines; i++) {
00817
ROW Row;
00818
move(Row, pRow);
00819
00820
DebugConvertToAnsi(hCurrentProcess,
00821 lpExtensionApis,
00822 Row.
CharRow.
Chars,
00823 -1,
00824 ach,
00825
sizeof(ach));
00826 Print(
"Row %2d: %4x %4x, %4x %4x, %lx:\"%.40s\"\n",
00827 i,
00828 (
USHORT)Row.
CharRow.
Right, (
USHORT)Row.
CharRow.
OldRight,
00829 (
USHORT)Row.
CharRow.
Left, (
USHORT)Row.
CharRow.
OldLeft,
00830 Row.
CharRow.
Chars, ach);
00831 Print(
" %4x %4x,%04x or %lx\n",
00832 (
USHORT)Row.
AttrRow.
Length,
00833 (
USHORT)Row.
AttrRow.
AttrPair.
Length,
00834 (WORD)Row.
AttrRow.
AttrPair.
Attr,
00835 Row.
AttrRow.
Attrs);
00836 pRow++;
00837 }
00838
return TRUE;
00839 }
00840
00841
00842
00843
00844
00845
00846
00847
00848 BOOL df(
00849 HANDLE hCurrentProcess,
00850 HANDLE hCurrentThread,
00851 DWORD dwCurrentPc,
00852 PWINDBG_EXTENSION_APIS lpExtensionApis,
00853 LPSTR lpArgumentString)
00854 {
00855 PWINDBG_OUTPUT_ROUTINE Print;
00856 PWINDBG_GET_EXPRESSION EvalExpression;
00857 PWINDBG_GET_SYMBOL GetSymbol;
00858
BYTE Buff[
sizeof(
FACENODE) + (LF_FACESIZE *
sizeof(WCHAR))];
00859
PFACENODE pFN;
00860
00861
DWORD NumberOfFonts;
00862
DWORD FontInfoLength;
00863
FONT_INFO FontInfo;
00864
PFONT_INFO pFontInfo;
00865
DWORD dw;
00866
00867 UNREFERENCED_PARAMETER(hCurrentProcess);
00868 UNREFERENCED_PARAMETER(hCurrentThread);
00869 UNREFERENCED_PARAMETER(dwCurrentPc);
00870
00871 Print = lpExtensionApis->lpOutputRoutine;
00872 EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
00873 GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
00874
00875
00876
00877
00878
00879
00880
while (*lpArgumentString ==
' ')
00881 lpArgumentString++;
00882
00883
00884 Print(
"Faces:\n");
00885
moveExpressionValuePtr(pFN,
"winsrv!gpFaceNames");
00886
while (pFN != 0) {
00887
move(Buff, pFN);
00888 pFN = (
PFACENODE)Buff;
00889 Print(
" \"%ls\"\t%s %s %s %s %s %s\n",
00890 &pFN->
awch[0],
00891 pFN->
dwFlag &
EF_NEW ?
"NEW" :
" ",
00892 pFN->
dwFlag &
EF_OLD ?
"OLD" :
" ",
00893 pFN->
dwFlag &
EF_ENUMERATED ?
"ENUMERATED" :
" ",
00894 pFN->
dwFlag &
EF_OEMFONT ?
"OEMFONT" :
" ",
00895 pFN->
dwFlag &
EF_TTFONT ?
"TTFONT" :
" ",
00896 pFN->
dwFlag &
EF_DEFFACE ?
"DEFFACE" :
" ");
00897 pFN = pFN->
pNext;
00898 }
00899
00900
moveExpressionValue(
FontInfoLength,
"winsrv!FontInfoLength");
00901
moveExpressionValue(
NumberOfFonts,
"winsrv!NumberOfFonts");
00902
moveExpressionValuePtr(pFontInfo,
"winsrv!FontInfo");
00903
00904 Print(
"0x%lx fonts cached, 0x%lx allocated:\n",
NumberOfFonts,
FontInfoLength);
00905
00906
for (dw = 0; dw <
NumberOfFonts; dw++, pFontInfo++) {
00907 WCHAR FaceName[LF_FACESIZE];
00908
move(
FontInfo, pFontInfo);
00909
move(FaceName,
FontInfo.
FaceName);
00910 Print(
"%04x hFont 0x%08lX \"%ls\"\n"
00911
" SizeWant (%d;%d)\n"
00912
" Size (%d;%d)\n"
00913
" Family %02X\n"
00914
" Weight 0x%08lX\n",
00915 dw,
00916
FontInfo.
hFont,
00917 FaceName,
00918
FontInfo.
SizeWant.X,
FontInfo.
SizeWant.Y,
00919
FontInfo.
Size.X,
FontInfo.
Size.Y,
00920
FontInfo.
Family,
00921
FontInfo.
Weight);
00922
#if defined(FE_SB)
00923
Print(
" CharSet 0x%02X\n",
00924
FontInfo.tmCharSet);
00925
#endif
00926
}
00927
00928
return TRUE;
00929 }
00930
00931
00932
00933
00934
00935
00936
00937
00938 BOOL di(
00939 HANDLE hCurrentProcess,
00940 HANDLE hCurrentThread,
00941 DWORD dwCurrentPc,
00942 PWINDBG_EXTENSION_APIS lpExtensionApis,
00943 LPSTR lpArgumentString)
00944 {
00945 PWINDBG_OUTPUT_ROUTINE Print;
00946 PWINDBG_GET_EXPRESSION EvalExpression;
00947 PWINDBG_GET_SYMBOL GetSymbol;
00948
00949
INPUT_INFORMATION Input;
00950
PINPUT_INFORMATION pInput;
00951
00952
PCONSOLE_INFORMATION pConsole;
00953 ULONG
NumberOfConsoleHandles;
00954
PCONSOLE_INFORMATION *
ConsoleHandles;
00955
BOOL fPrintLine;
00956 ULONG i;
00957
char ach[120];
00958
00959 Print = lpExtensionApis->lpOutputRoutine;
00960 EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
00961 GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
00962
00963
00964
00965
00966
00967
00968
while (*lpArgumentString ==
' ')
00969 lpArgumentString++;
00970
00971
00972
00973
00974
if (*lpArgumentString == 0) {
00975
moveExpressionValue(
NumberOfConsoleHandles,
00976
"winsrv!NumberOfConsoleHandles");
00977
moveExpressionValuePtr(
ConsoleHandles,
00978
"winsrv!ConsoleHandles");
00979 fPrintLine =
FALSE;
00980
for (i = 0; i <
NumberOfConsoleHandles; i++) {
00981
move(pConsole,
ConsoleHandles);
00982
if (pConsole !=
NULL) {
00983
if (fPrintLine)
00984 Print(
"---\n");
00985 pInput = &pConsole->
InputBuffer;
00986
#ifdef _WIN64
00987
_i64toa((ULONG64)pInput, ach, 16);
00988
#else
00989
_itoa((ULONG)pInput, ach, 16);
00990
#endif
00991
if (!
di(hCurrentProcess, hCurrentThread, dwCurrentPc, lpExtensionApis, ach)) {
00992
return FALSE;
00993 }
00994 fPrintLine =
TRUE;
00995 }
00996
ConsoleHandles++;
00997 }
00998
return TRUE;
00999 }
else {
01000 pInput = (
PINPUT_INFORMATION)EvalExpression(lpArgumentString);
01001 }
01002
01003
move(Input, pInput);
01004
01005 Print(
"PINPUT @ 0x%lX\n", pInput);
01006 Print(
"\t pInputBuffer 0x%08lX\n"
01007
"\t InputBufferSize 0x%08lX\n"
01008
"\t AllocatedBufferSize 0x%08lX\n"
01009
"\t InputMode 0x%08lX\n"
01010
"\t RefCount 0x%08lX\n"
01011
"\t First 0x%08lX\n"
01012
"\t In 0x%08lX\n"
01013
"\t Out 0x%08lX\n"
01014
"\t Last 0x%08lX\n"
01015
"\t ReadWaitQueue.Flink 0x%08lX\n"
01016
"\t ReadWaitQueue.Blink 0x%08lX\n"
01017
"\t InputWaitEvent 0x%08lX\n",
01018 Input.
InputBuffer,
01019 Input.
InputBufferSize,
01020 Input.
AllocatedBufferSize,
01021 Input.
InputMode,
01022 Input.
RefCount,
01023 Input.
First,
01024 Input.
In,
01025 Input.
Out,
01026 Input.
Last,
01027 Input.
ReadWaitQueue.Flink,
01028 Input.
ReadWaitQueue.Blink,
01029 Input.
InputWaitEvent
01030 );
01031
01032
return TRUE;
01033 }
01034
01035
01036
01037
01038
01039
01040
01041 BOOL dir(
01042 HANDLE hCurrentProcess,
01043 HANDLE hCurrentThread,
01044 DWORD dwCurrentPc,
01045 PWINDBG_EXTENSION_APIS lpExtensionApis,
01046 LPSTR lpArgumentString)
01047 {
01048 PWINDBG_OUTPUT_ROUTINE Print;
01049 PWINDBG_GET_EXPRESSION EvalExpression;
01050 PWINDBG_GET_SYMBOL GetSymbol;
01051
01052 INPUT_RECORD InputRecord;
01053 PINPUT_RECORD pInputRecord;
01054
01055
char ach[80];
01056
int cch;
01057 LPSTR lpAddress;
01058
DWORD NumRecords,i;
01059
01060 UNREFERENCED_PARAMETER(hCurrentProcess);
01061 UNREFERENCED_PARAMETER(hCurrentThread);
01062 UNREFERENCED_PARAMETER(dwCurrentPc);
01063
01064 Print = lpExtensionApis->lpOutputRoutine;
01065 EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
01066 GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
01067
01068
01069
01070
01071
01072
01073
while (*lpArgumentString ==
' ')
01074 lpArgumentString++;
01075
01076 lpAddress = lpArgumentString;
01077
while (*lpArgumentString !=
' ' && *lpArgumentString != 0)
01078 lpArgumentString++;
01079
01080 cch = (
int)(lpArgumentString - lpAddress);
01081
if (cch > 79)
01082 cch = 79;
01083
01084 strncpy(ach, lpAddress, cch);
01085
01086 pInputRecord = (PINPUT_RECORD)EvalExpression(lpAddress);
01087 NumRecords = (
DWORD)EvalExpression(lpArgumentString);
01088
01089 Print(
"%x PINPUTRECORDs @ 0x%lX\n", NumRecords, pInputRecord);
01090
for (i=0;i<NumRecords;i++) {
01091
move(InputRecord, pInputRecord);
01092
01093
switch (InputRecord.EventType) {
01094
case KEY_EVENT:
01095 Print(
"\t KEY_EVENT\n");
01096
if (InputRecord.Event.KeyEvent.bKeyDown)
01097 Print(
"\t KeyDown\n");
01098
else
01099 Print(
"\t KeyUp\n");
01100 Print(
"\t wRepeatCount %d\n",
01101 InputRecord.Event.KeyEvent.wRepeatCount);
01102 Print(
"\t wVirtualKeyCode %x\n",
01103 InputRecord.Event.KeyEvent.wVirtualKeyCode);
01104 Print(
"\t wVirtualScanCode %x\n",
01105 InputRecord.Event.KeyEvent.wVirtualScanCode);
01106 Print(
"\t aChar is %c",
01107 InputRecord.Event.KeyEvent.uChar.AsciiChar);
01108 Print(
"\n");
01109 Print(
"\t uChar is %x\n",
01110 InputRecord.Event.KeyEvent.uChar.UnicodeChar);
01111 Print(
"\t dwControlKeyState %x\n",
01112 InputRecord.Event.KeyEvent.dwControlKeyState);
01113
break;
01114
case MOUSE_EVENT:
01115 Print(
"\t MOUSE_EVENT\n"
01116
"\t dwMousePosition %x %x\n"
01117
"\t dwButtonState %x\n"
01118
"\t dwControlKeyState %x\n"
01119
"\t dwEventFlags %x\n",
01120 InputRecord.Event.MouseEvent.dwMousePosition.X,
01121 InputRecord.Event.MouseEvent.dwMousePosition.Y,
01122 InputRecord.Event.MouseEvent.dwButtonState,
01123 InputRecord.Event.MouseEvent.dwControlKeyState,
01124 InputRecord.Event.MouseEvent.dwEventFlags
01125 );
01126
01127
break;
01128
case WINDOW_BUFFER_SIZE_EVENT:
01129 Print(
"\t WINDOW_BUFFER_SIZE_EVENT\n"
01130
"\t dwSize %x %x\n",
01131 InputRecord.Event.WindowBufferSizeEvent.dwSize.X,
01132 InputRecord.Event.WindowBufferSizeEvent.dwSize.Y
01133 );
01134
break;
01135
case MENU_EVENT:
01136 Print(
"\t MENU_EVENT\n"
01137
"\t dwCommandId %x\n",
01138 InputRecord.Event.MenuEvent.dwCommandId
01139 );
01140
break;
01141
case FOCUS_EVENT:
01142 Print(
"\t FOCUS_EVENT\n");
01143
if (InputRecord.Event.FocusEvent.bSetFocus)
01144 Print(
"\t bSetFocus is TRUE\n");
01145
else
01146 Print(
"\t bSetFocus is FALSE\n");
01147
break;
01148
default:
01149 Print(
"\t Unknown event type %x\n",InputRecord.EventType);
01150
break;
01151 }
01152 pInputRecord++;
01153 }
01154
return TRUE;
01155 }
01156
01157
01158
01159
01160
01161
01162
01163
01164 BOOL ds(
01165 HANDLE hCurrentProcess,
01166 HANDLE hCurrentThread,
01167 DWORD dwCurrentPc,
01168 PWINDBG_EXTENSION_APIS lpExtensionApis,
01169 LPSTR lpArgumentString)
01170 {
01171 PWINDBG_OUTPUT_ROUTINE Print;
01172 PWINDBG_GET_EXPRESSION EvalExpression;
01173 PWINDBG_GET_SYMBOL GetSymbol;
01174
01175
SCREEN_INFORMATION Screen;
01176
PSCREEN_INFORMATION pScreen;
01177
01178 UNREFERENCED_PARAMETER(hCurrentProcess);
01179 UNREFERENCED_PARAMETER(hCurrentThread);
01180 UNREFERENCED_PARAMETER(dwCurrentPc);
01181
01182 Print = lpExtensionApis->lpOutputRoutine;
01183 EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
01184 GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
01185
01186
01187
01188
01189
01190
01191
while (*lpArgumentString ==
' ')
01192 lpArgumentString++;
01193
01194
01195 pScreen = (
PSCREEN_INFORMATION)EvalExpression(lpArgumentString);
01196
move(Screen, pScreen);
01197
01198 Print(
"PSCREEN @ 0x%lX\n", pScreen);
01199 Print(
"\t pConsole 0x%08lX\n"
01200
"\t Flags 0x%08lX %s | %s\n"
01201
"\t OutputMode 0x%08lX\n"
01202
"\t RefCount 0x%08lX\n"
01203
"\t ScreenBufferSize.X Y 0x%08X 0x%08X\n"
01204
"\t Window.L T R B 0x%08X 0x%08X 0x%08X 0x%08X\n"
01205
"\t ResizingWindow 0x%08X\n",
01206 Screen.
Console,
01207 Screen.
Flags,
01208 Screen.
Flags &
CONSOLE_TEXTMODE_BUFFER ?
"TEXTMODE" :
"GRAPHICS",
01209 Screen.
Flags &
CONSOLE_OEMFONT_DISPLAY ?
"OEMFONT" :
"TT FONT",
01210 Screen.
OutputMode,
01211 Screen.
RefCount,
01212 (
DWORD)Screen.
ScreenBufferSize.X,
01213 (
DWORD)Screen.
ScreenBufferSize.Y,
01214 (
DWORD)Screen.
Window.Left,
01215 (
DWORD)Screen.
Window.Top,
01216 (
DWORD)Screen.
Window.Right,
01217 (
DWORD)Screen.
Window.Bottom,
01218 Screen.
ResizingWindow
01219 );
01220 Print(
"\t Attributes 0x%08X\n"
01221
"\t PopupAttributes 0x%08X\n"
01222
"\t WindowMaximizedX 0x%08X\n"
01223
"\t WindowMaximizedY 0x%08X\n"
01224
"\t WindowMaximized 0x%08X\n"
01225
"\t CommandIdLow High 0x%08X 0x%08X\n"
01226
"\t CursorHandle 0x%08X\n"
01227
"\t hPalette 0x%08X\n"
01228
"\t dwUsage 0x%08X\n"
01229
"\t CursorDisplayCount 0x%08X\n"
01230
"\t WheelDelta 0x%08X\n",
01231 Screen.
Attributes,
01232 Screen.
PopupAttributes,
01233 Screen.
WindowMaximizedX,
01234 Screen.
WindowMaximizedY,
01235 Screen.
WindowMaximized,
01236 Screen.
CommandIdLow,
01237 Screen.
CommandIdHigh,
01238 Screen.
CursorHandle,
01239 Screen.
hPalette,
01240 Screen.
dwUsage,
01241 Screen.
CursorDisplayCount,
01242 Screen.
WheelDelta
01243 );
01244
if (Screen.
Flags &
CONSOLE_TEXTMODE_BUFFER) {
01245 Print(
"\t TextInfo.Rows 0x%08X\n"
01246
"\t TextInfo.TextRows 0x%08X\n"
01247
"\t TextInfo.FirstRow 0x%08X\n",
01248 Screen.
BufferInfo.TextInfo.Rows,
01249 Screen.
BufferInfo.TextInfo.TextRows,
01250 Screen.
BufferInfo.TextInfo.FirstRow);
01251
01252 Print(
"\t TextInfo.CurrentTextBufferFont.FontSize 0x%04X,0x%04X\n"
01253
"\t TextInfo.CurrentTextBufferFont.FontNumber 0x%08X\n",
01254 Screen.
BufferInfo.TextInfo.CurrentTextBufferFont.FontSize.X,
01255 Screen.
BufferInfo.TextInfo.CurrentTextBufferFont.FontSize.Y,
01256 Screen.
BufferInfo.TextInfo.CurrentTextBufferFont.FontNumber);
01257
01258 Print(
"\t TextInfo.CurrentTextBufferFont.Family, Weight 0x%08X, 0x%08X\n"
01259
"\t TextInfo.CurrentTextBufferFont.FaceName %ls\n"
01260
"\t TextInfo.CurrentTextBufferFont.FontCodePage %d\n",
01261 Screen.
BufferInfo.TextInfo.CurrentTextBufferFont.Family,
01262 Screen.
BufferInfo.TextInfo.CurrentTextBufferFont.Weight,
01263 Screen.
BufferInfo.TextInfo.CurrentTextBufferFont.FaceName,
01264 Screen.
BufferInfo.TextInfo.CurrentTextBufferFont.FontCodePage);
01265
01266
if (Screen.
BufferInfo.TextInfo.ListOfTextBufferFont !=
NULL) {
01267
PTEXT_BUFFER_FONT_INFO pLinkFont;
01268
TEXT_BUFFER_FONT_INFO LinkFont;
01269 ULONG
Count = 0;
01270
01271 pLinkFont = Screen.
BufferInfo.TextInfo.ListOfTextBufferFont;
01272
01273
while (pLinkFont != 0) {
01274
move(LinkFont, pLinkFont);
01275
01276 Print(
"\t Link Font #%d\n",
Count++);
01277 Print(
"\t TextInfo.LinkOfTextBufferFont.FontSize 0x%04X,0x%04X\n"
01278
"\t TextInfo.LinkOfTextBufferFont.FontNumber 0x%08X\n",
01279 LinkFont.
FontSize.X,
01280 LinkFont.
FontSize.Y,
01281 LinkFont.
FontNumber);
01282
01283 Print(
"\t TextInfo.LinkOfTextBufferFont.Family, Weight 0x%08X, 0x%08X\n"
01284
"\t TextInfo.LinkOfTextBufferFont.FaceName %ls\n"
01285
"\t TextInfo.LinkOfTextBufferFont.FontCodePage %d\n",
01286 LinkFont.
Family,
01287 LinkFont.
Weight,
01288 LinkFont.
FaceName,
01289 LinkFont.
FontCodePage);
01290
01291 pLinkFont = LinkFont.
NextTextBufferFont;
01292 }
01293 Print(
"\n");
01294 }
01295
01296 Print(
"\t TextInfo.ModeIndex 0x%08X\n"
01297 #ifdef i386
01298
"\t TextInfo.WindowedWindowSize.X Y 0x%08X 0x%08X\n"
01299
"\t TextInfo.WindowedScreenSize.X Y 0x%08X 0x%08X\n"
01300
"\t TextInfo.MousePosition.X Y 0x%08X 0x%08X\n"
01301 #endif
01302
"\t TextInfo.Flags 0x%08X\n",
01303
01304 Screen.
BufferInfo.TextInfo.ModeIndex,
01305 #ifdef i386
01306 Screen.
BufferInfo.TextInfo.WindowedWindowSize.X,
01307 Screen.
BufferInfo.TextInfo.WindowedWindowSize.Y,
01308 Screen.
BufferInfo.TextInfo.WindowedScreenSize.X,
01309 Screen.
BufferInfo.TextInfo.WindowedScreenSize.Y,
01310 Screen.
BufferInfo.TextInfo.MousePosition.X,
01311 Screen.
BufferInfo.TextInfo.MousePosition.Y,
01312 #endif
01313 Screen.
BufferInfo.TextInfo.Flags);
01314
01315 Print(
"\t TextInfo.CursorVisible 0x%08X\n"
01316
"\t TextInfo.CursorOn 0x%08X\n"
01317
"\t TextInfo.DelayCursor 0x%08X\n"
01318
"\t TextInfo.CursorPosition.X Y 0x%08X 0x%08X\n"
01319
"\t TextInfo.CursorSize 0x%08X\n"
01320
"\t TextInfo.CursorYSize 0x%08X\n"
01321
"\t TextInfo.UpdatingScreen 0x%08X\n",
01322 Screen.
BufferInfo.TextInfo.CursorVisible,
01323 Screen.
BufferInfo.TextInfo.CursorOn,
01324 Screen.
BufferInfo.TextInfo.DelayCursor,
01325 Screen.
BufferInfo.TextInfo.CursorPosition.X,
01326 Screen.
BufferInfo.TextInfo.CursorPosition.Y,
01327 Screen.
BufferInfo.TextInfo.CursorSize,
01328 Screen.
BufferInfo.TextInfo.CursorYSize,
01329 Screen.
BufferInfo.TextInfo.UpdatingScreen);
01330
01331 }
else {
01332 Print(
"\t GraphicsInfo.BitMapInfoLength 0x%08X\n"
01333
"\t GraphicsInfo.lpBitMapInfo 0x%08X\n"
01334
"\t GraphicsInfo.BitMap 0x%08X\n"
01335
"\t GraphicsInfo.ClientBitMap 0x%08X\n"
01336
"\t GraphicsInfo.ClientProcess 0x%08X\n"
01337
"\t GraphicsInfo.hMutex 0x%08X\n"
01338
"\t GraphicsInfo.hSection 0x%08X\n"
01339
"\t GraphicsInfo.dwUsage 0x%08X\n",
01340 Screen.
BufferInfo.GraphicsInfo.BitMapInfoLength,
01341 Screen.
BufferInfo.GraphicsInfo.lpBitMapInfo,
01342 Screen.
BufferInfo.GraphicsInfo.BitMap,
01343 Screen.
BufferInfo.GraphicsInfo.ClientBitMap,
01344 Screen.
BufferInfo.GraphicsInfo.ClientProcess,
01345 Screen.
BufferInfo.GraphicsInfo.hMutex,
01346 Screen.
BufferInfo.GraphicsInfo.hSection,
01347 Screen.
BufferInfo.GraphicsInfo.dwUsage
01348 );
01349 }
01350
01351
return TRUE;
01352 }
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362 BOOL dcpt(
01363 HANDLE hCurrentProcess,
01364 HANDLE hCurrentThread,
01365 DWORD dwCurrentPc,
01366 PWINDBG_EXTENSION_APIS lpExtensionApis,
01367 LPSTR lpArgumentString)
01368 {
01369 PWINDBG_OUTPUT_ROUTINE Print;
01370 PWINDBG_GET_EXPRESSION EvalExpression;
01371 PWINDBG_GET_SYMBOL GetSymbol;
01372
01373 PCPTABLEINFO pcpt;
01374 CPTABLEINFO cpt;
01375
01376 UNREFERENCED_PARAMETER(hCurrentProcess);
01377 UNREFERENCED_PARAMETER(hCurrentThread);
01378 UNREFERENCED_PARAMETER(dwCurrentPc);
01379
01380 Print = lpExtensionApis->lpOutputRoutine;
01381 EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
01382 GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
01383
01384
01385
01386
01387
01388
01389
while (*lpArgumentString ==
' ')
01390 lpArgumentString++;
01391
01392
01393
01394
01395
if (*lpArgumentString == 0) {
01396 lpArgumentString =
"winsrv!GlyphCP";
01397 }
01398 pcpt = (PCPTABLEINFO)EvalExpression(lpArgumentString);
01399
move(cpt, pcpt);
01400
01401 Print(
"CPTABLEINFO @ 0x%lX\n", pcpt);
01402
01403 Print(
" CodePage = 0x%x (%d)\n"
01404
" MaximumCharacterSize = %x\n"
01405
" DefaultChar = %x\n",
01406 cpt.CodePage, cpt.CodePage,
01407 cpt.MaximumCharacterSize,
01408 cpt.DefaultChar);
01409
01410 Print(
" UniDefaultChar = 0x%04x\n"
01411
" TransDefaultChar = %x\n"
01412
" TransUniDefaultChar = 0x%04x\n"
01413
" DBCSCodePage = 0x%x (%d)\n",
01414 cpt.UniDefaultChar,
01415 cpt.TransDefaultChar,
01416 cpt.TransUniDefaultChar,
01417 cpt.DBCSCodePage, cpt.DBCSCodePage);
01418
01419 Print(
" LeadByte[MAXIMUM_LEADBYTES] = %04x,%04x,%04x,...\n"
01420
" MultiByteTable = %x\n"
01421
" WideCharTable = %lx\n"
01422
" DBCSRanges = %lx\n"
01423
" DBCSOffsets = %lx\n",
01424 cpt.LeadByte[0], cpt.LeadByte[1], cpt.LeadByte[2],
01425 cpt.MultiByteTable,
01426 cpt.WideCharTable,
01427 cpt.DBCSRanges,
01428 cpt.DBCSOffsets);
01429
01430
return TRUE;
01431 }
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441 BOOL dch(
01442 HANDLE hCurrentProcess,
01443 HANDLE hCurrentThread,
01444 DWORD dwCurrentPc,
01445 PWINDBG_EXTENSION_APIS lpExtensionApis,
01446 LPSTR lpArgumentString)
01447 {
01448 PWINDBG_OUTPUT_ROUTINE Print;
01449 PWINDBG_GET_EXPRESSION EvalExpression;
01450 PWINDBG_GET_SYMBOL GetSymbol;
01451
01452
PCOMMAND_HISTORY pCmdHist;
01453
COMMAND_HISTORY CmdHist;
01454
PCOMMAND pCmd;
01455
union {
01456
COMMAND Cmd;
01457 WCHAR awch[80];
01458 } DbgCmd;
01459
01460
int i;
01461
char ach[120];
01462
01463 UNREFERENCED_PARAMETER(hCurrentThread);
01464 UNREFERENCED_PARAMETER(dwCurrentPc);
01465
01466 Print = lpExtensionApis->lpOutputRoutine;
01467 EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
01468 GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
01469
01470
01471
01472
01473
while (*lpArgumentString ==
' ')
01474 lpArgumentString++;
01475
01476
01477
01478
01479
if (*lpArgumentString == 0) {
01480 Print(
"must specify address of COMMAND_HISTORY struct\n");
01481 Print(
"(a breakpoint on winsrv!AddCommand() may help)\n");
01482
return FALSE;
01483 }
01484
01485 pCmdHist = (
PCOMMAND_HISTORY)EvalExpression(lpArgumentString);
01486
move(CmdHist, pCmdHist);
01487
01488 Print(
"COMMAND_HISTORY @ 0x%lX\n", pCmdHist);
01489
01490 Print(
" Flags = 0x%08lX%s\n",
01491 CmdHist.
Flags,
GetFlags(
GF_CMDHIST, CmdHist.
Flags,
NULL));
01492 Print(
" ListLink.F B = 0x%08lX 0x%08lX\n",
01493 CmdHist.
ListLink.Flink, CmdHist.
ListLink.Blink);
01494
01495
DebugConvertToAnsi(hCurrentProcess,
01496 lpExtensionApis,
01497 CmdHist.
AppName,
01498 -1,
01499 ach,
01500
sizeof(ach));
01501 Print(
" AppName = %s\n", ach);
01502
01503 Print(
" NumberOfCommands = 0x%lx\n"
01504
" LastAdded = 0x%lx\n"
01505
" LastDisplayed = 0x%lx\n"
01506
" FirstCommand = 0x%lx\n"
01507
" MaximumNumberOfCommands = 0x%lx\n",
01508 CmdHist.
NumberOfCommands,
01509 CmdHist.
LastAdded,
01510 CmdHist.
LastDisplayed,
01511 CmdHist.
FirstCommand,
01512 CmdHist.
MaximumNumberOfCommands);
01513
01514 Print(
" ProcessHandle = 0x%08lX\n",
01515 CmdHist.
ProcessHandle);
01516
01517 Print(
" PopupList.F B = 0x%08lX 0x%08lX\n",
01518 CmdHist.
PopupList.Flink, CmdHist.
PopupList.Blink);
01519
01520
for (i = 0; i < CmdHist.
NumberOfCommands; i++) {
01521
move(pCmd, &(pCmdHist->
Commands[i]));
01522
01523
01524
moveBlock(DbgCmd, pCmd,
sizeof(DbgCmd.Cmd.CommandLength));
01525
01526
01527
moveBlock(DbgCmd, pCmd,
01528 DbgCmd.Cmd.
CommandLength +
sizeof(DbgCmd.Cmd.CommandLength));
01529
01530
01531
01532 DbgCmd.Cmd.CommandLength /=
sizeof(WCHAR);
01533 DbgCmd.Cmd.Command[DbgCmd.Cmd.CommandLength] =
L'\0';
01534 Print(
" %03d: %d chars = \"%S\"\n", i,
01535 DbgCmd.Cmd.CommandLength,
01536 DbgCmd.Cmd.Command);
01537
if (i == CmdHist.
LastAdded) {
01538 Print(
" (Last Added)\n");
01539 }
else if (i == CmdHist.
LastDisplayed) {
01540 Print(
" (Last Displayed)\n");
01541 }
else if (i == CmdHist.
FirstCommand) {
01542 Print(
" (First Command)\n");
01543 }
01544 }
01545
01546
return TRUE;
01547 }
01548
01549
01550
01551
01552
01553 #define HEAP_GRANULARITY 8
01554 #define HEAP_SIZE(Size) (((Size) + (HEAP_GRANULARITY - 1) + HEAP_GRANULARITY) & ~(HEAP_GRANULARITY - 1))
01555
01556 ULONG
dmem(
01557 HANDLE hCurrentProcess,
01558 HANDLE hCurrentThread,
01559 DWORD dwCurrentPc,
01560 PWINDBG_EXTENSION_APIS lpExtensionApis,
01561 LPSTR lpArgString)
01562 {
01563 PWINDBG_OUTPUT_ROUTINE Print;
01564 PWINDBG_GET_EXPRESSION EvalExpression;
01565 PWINDBG_GET_SYMBOL GetSymbol;
01566
01567
char ach[120];
01568
char chVerbose;
01569 ULONG i;
01570 ULONG
NumberOfConsoleHandles;
01571
PCONSOLE_INFORMATION *
ConsoleHandles;
01572
CONSOLE_INFORMATION Console;
01573
PCONSOLE_INFORMATION pConsole =
NULL;
01574
SCREEN_INFORMATION Screen;
01575
PSCREEN_INFORMATION pScreen =
NULL;
01576 ULONG cbTotal = 0;
01577 ULONG cbConsole = 0;
01578 ULONG cbInput = 0;
01579 ULONG cbOutput = 0;
01580 ULONG cbFE = 0;
01581
01582 Print = lpExtensionApis->lpOutputRoutine;
01583 EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
01584 GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
01585
01586 chVerbose =
' ';
01587
01588
do {
01589
01590
01591
01592
while (*lpArgString && *lpArgString ==
' ')
01593 lpArgString++;
01594
01595
switch (*lpArgString) {
01596
case 'v':
01597 chVerbose =
'v';
01598
break;
01599
01600
case '\0':
01601
01602
01603
01604
moveExpressionValue(
NumberOfConsoleHandles,
01605
"winsrv!NumberOfConsoleHandles");
01606
moveExpressionValuePtr(
ConsoleHandles,
01607
"winsrv!ConsoleHandles");
01608
for (i = 0; i <
NumberOfConsoleHandles; i++) {
01609
move(pConsole,
ConsoleHandles);
01610
if (pConsole !=
NULL) {
01611
sprintf(ach,
"%c %p", chVerbose, pConsole);
01612 cbTotal +=
dmem(hCurrentProcess, hCurrentThread, dwCurrentPc, lpExtensionApis, ach);
01613 Print(
"==========================================\n");
01614 }
01615
ConsoleHandles++;
01616 }
01617 Print(
"Total Size for all consoles = %d bytes\n", cbTotal);
01618
return cbTotal;
01619
01620
default:
01621 pConsole = (
PCONSOLE_INFORMATION)EvalExpression(lpArgString);
01622
break;
01623 }
01624 lpArgString++;
01625
01626 }
while (pConsole ==
NULL);
01627
01628
move(Console, pConsole);
01629
01630
DebugConvertToAnsi(hCurrentProcess,
01631 lpExtensionApis,
01632 Console.
Title,
01633 Console.
TitleLength,
01634 ach,
01635
sizeof(ach));
01636 Print(
"PCONSOLE @ 0x%lX \"%s\"\n", pConsole, ach);
01637
01638 cbConsole =
HEAP_SIZE(
sizeof(Console)) +
01639
HEAP_SIZE(Console.TitleLength) +
01640
HEAP_SIZE(Console.OriginalTitleLength);
01641
01642 cbInput =
HEAP_SIZE(Console.InputBuffer.AllocatedBufferSize);
01643
01644 pScreen = Console.ScreenBuffers;
01645
while (pScreen !=
NULL) {
01646
01647
move(Screen, pScreen);
01648 cbOutput +=
HEAP_SIZE(
sizeof(Screen));
01649
01650
if (Screen.Flags &
CONSOLE_TEXTMODE_BUFFER) {
01651 cbOutput +=
HEAP_SIZE(Screen.ScreenBufferSize.Y *
sizeof(
ROW)) +
01652
HEAP_SIZE(Screen.ScreenBufferSize.X * Screen.ScreenBufferSize.Y *
sizeof(WCHAR));
01653
if (Screen.BufferInfo.TextInfo.DbcsScreenBuffer.TransBufferCharacter) {
01654 cbFE +=
HEAP_SIZE(Screen.ScreenBufferSize.X * Screen.ScreenBufferSize.Y *
sizeof(WCHAR));
01655 }
01656
if (Screen.BufferInfo.TextInfo.DbcsScreenBuffer.TransBufferAttribute) {
01657 cbFE +=
HEAP_SIZE(Screen.ScreenBufferSize.X * Screen.ScreenBufferSize.Y *
sizeof(
BYTE));
01658 }
01659
if (Screen.BufferInfo.TextInfo.DbcsScreenBuffer.TransWriteConsole) {
01660 cbFE +=
HEAP_SIZE(Screen.ScreenBufferSize.X * Screen.ScreenBufferSize.Y *
sizeof(WCHAR));
01661 }
01662
if (Screen.BufferInfo.TextInfo.DbcsScreenBuffer.KAttrRows) {
01663 cbFE +=
HEAP_SIZE(Screen.ScreenBufferSize.X * Screen.ScreenBufferSize.Y *
sizeof(
BYTE));
01664 }
01665 }
01666
01667 pScreen = Screen.
Next;
01668 }
01669
01670 cbTotal = cbConsole + cbInput + cbOutput + cbFE;
01671
01672
if (chVerbose ==
'v') {
01673 Print(
" Console Size = %7d\n", cbConsole);
01674 Print(
" Input Size = %7d\n", cbInput);
01675 Print(
" Output Size = %7d\n", cbOutput);
01676 Print(
" FE Size = %7d\n", cbFE);
01677 }
01678
01679 Print(
"Total Size = %7d\n", cbTotal);
01680
01681
return cbTotal;
01682 }
01683