|
|
1.1 ! root 1: /******************************Module*Header*******************************\ ! 2: * Module Name: debug.c ! 3: * ! 4: * Debugger extension for dumping the INFO structure in NTSD ! 5: * ! 6: * Created: 24-Feb-1992 20:47:03 ! 7: * Author: Petrus Wong ! 8: * ! 9: * Copyright (c) 1990 Microsoft Corporation ! 10: * ! 11: * 1. Place the DLL in the correct path ! 12: * 2. Run NTSD -d mdi ! 13: * 3. Upon NTSD prompt, do ! 14: * !debug.dinfo address ! 15: * where address is the address of Info ! 16: * ! 17: * Dependencies: ! 18: * ! 19: * (#defines) ! 20: * (#includes) ! 21: * ! 22: \**************************************************************************/ ! 23: #include <stddef.h> ! 24: #include <windows.h> ! 25: #include <winerror.h> ! 26: #include <excpt.h> ! 27: #include <stdarg.h> ! 28: #include <stdio.h> ! 29: #include <ntsdexts.h> ! 30: #include "mditypes.h" ! 31: ! 32: #define move(dst, src)\ ! 33: try {\ ! 34: ReadProcessMemory(hCurrentProcess, (LPVOID)(src), &(dst), sizeof(dst), NULL);\ ! 35: } except (EXCEPTION_EXECUTE_HANDLER) {\ ! 36: return;\ ! 37: } ! 38: ! 39: /******************************Public*Routine******************************\ ! 40: * ! 41: * LibMain ! 42: * ! 43: * Effects: LibMain is called by Windows when ! 44: * the DLL is initialized, Thread Attached, and other times. ! 45: * ! 46: * Warnings: The LibMain function should perform additional initialization ! 47: * tasks required by the DLL. In this example, no initialization ! 48: * tasks are required. LibMain should return a value of 1 if ! 49: * the initialization is successful. ! 50: * ! 51: * History: ! 52: * 24-Feb-1992 -by- Petrus Wong ! 53: * Wrote it. ! 54: \**************************************************************************/ ! 55: ! 56: INT APIENTRY LibMain(HANDLE hInst, DWORD ul_reason_being_called, LPVOID lpReserved) ! 57: { ! 58: return 1; ! 59: UNREFERENCED_PARAMETER(hInst); ! 60: UNREFERENCED_PARAMETER(ul_reason_being_called); ! 61: UNREFERENCED_PARAMETER(lpReserved); ! 62: } ! 63: ! 64: ! 65: /******************************Public*Routine******************************\ ! 66: * dinfo ! 67: * ! 68: * ! 69: * Effects: Debugger extension to dump the INFO structure ! 70: * ! 71: * To invoke the routine in NTSD, do the following: ! 72: * ! 73: * 1. place the debug.dll in the path ! 74: * 2. on NTSD prompt, type ! 75: * ! 76: * !debug.dinfo <address of the INFO structure> ! 77: * ! 78: * Warnings: ! 79: * ! 80: * History: ! 81: * 24-Feb-1992 -by- Petrus Wong ! 82: * Wrote it. ! 83: \**************************************************************************/ ! 84: ! 85: void dinfo ( ! 86: HANDLE hCurrentProcess, ! 87: HANDLE hCurrentThread, ! 88: HANDLE dwCurrentPc, ! 89: PNTSD_EXTENSION_APIS lpExtensionApis, ! 90: LPSTR lpArgumentString) ! 91: { ! 92: PNTSD_OUTPUT_ROUTINE Print; ! 93: PNTSD_GET_EXPRESSION EvalExpression; ! 94: PNTSD_GET_SYMBOL GetSymbol; ! 95: ! 96: PINFO pInfo; ! 97: INFO info; ! 98: ! 99: Print = lpExtensionApis->lpOutputRoutine; ! 100: EvalExpression = lpExtensionApis->lpGetExpressionRoutine; ! 101: GetSymbol = lpExtensionApis->lpGetSymbolRoutine; ! 102: ! 103: while (*lpArgumentString == ' ') ! 104: lpArgumentString++; ! 105: ! 106: pInfo = (PINFO)EvalExpression(lpArgumentString); ! 107: move(info, pInfo); ! 108: Print(info.CaptionBarText); ! 109: Print("\n"); ! 110: Print("hParent = %x\n", info.hParent ); ! 111: Print("hTextWnd = %x\n", info.hTextWnd ); ! 112: Print("rcClient(l,t,r,b) = (%d,%d,%d,%d)\n", ! 113: info.rcClient.left, info.rcClient.top, ! 114: info.rcClient.right, info.rcClient.bottom ); ! 115: return; ! 116: } ! 117:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.