|
|
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: \**************************************************************************/
1.1.1.2 ! root 23: #include <stdarg.h>
! 24: #include <stdio.h>
! 25:
1.1 root 26: #include <stddef.h>
27: #include <windows.h>
28: #include <winerror.h>
1.1.1.2 ! root 29:
1.1 root 30: #include <excpt.h>
1.1.1.2 ! root 31:
! 32: typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
! 33:
1.1 root 34: #include <ntsdexts.h>
35: #include "mditypes.h"
36:
1.1.1.2 ! root 37: //
! 38: // don't use try/except here. Otherwise, mip2coff -c chokes with the
! 39: // following fatal error on MIPS:
! 40: // tried to get local variable absolute addr with no procedure
! 41: //
! 42: // NTSD will catch the fault anyway
! 43: //
! 44: // Alternatively, we can get rid of the -c switch on mip2coff in the
! 45: // module that use try/except, but we won't have any locals for the module
! 46: //
! 47: // Petrus Wong 05-Oct-1992
! 48: //
1.1 root 49: #define move(dst, src)\
1.1.1.2 ! root 50: {\
1.1 root 51: ReadProcessMemory(hCurrentProcess, (LPVOID)(src), &(dst), sizeof(dst), NULL);\
52: return;\
53: }
54:
55: /******************************Public*Routine******************************\
56: *
57: * LibMain
58: *
59: * Effects: LibMain is called by Windows when
60: * the DLL is initialized, Thread Attached, and other times.
61: *
62: * Warnings: The LibMain function should perform additional initialization
63: * tasks required by the DLL. In this example, no initialization
64: * tasks are required. LibMain should return a value of 1 if
65: * the initialization is successful.
66: *
67: * History:
68: * 24-Feb-1992 -by- Petrus Wong
69: * Wrote it.
70: \**************************************************************************/
71:
1.1.1.2 ! root 72: INT WINAPI LibMain(HANDLE hInst, DWORD ul_reason_being_called, LPVOID lpReserved)
1.1 root 73: {
74: return 1;
75: UNREFERENCED_PARAMETER(hInst);
76: UNREFERENCED_PARAMETER(ul_reason_being_called);
77: UNREFERENCED_PARAMETER(lpReserved);
78: }
79:
80:
81: /******************************Public*Routine******************************\
82: * dinfo
83: *
84: *
85: * Effects: Debugger extension to dump the INFO structure
86: *
87: * To invoke the routine in NTSD, do the following:
88: *
89: * 1. place the debug.dll in the path
90: * 2. on NTSD prompt, type
91: *
92: * !debug.dinfo <address of the INFO structure>
93: *
94: * Warnings:
95: *
96: * History:
97: * 24-Feb-1992 -by- Petrus Wong
98: * Wrote it.
99: \**************************************************************************/
100:
101: void dinfo (
102: HANDLE hCurrentProcess,
103: HANDLE hCurrentThread,
104: HANDLE dwCurrentPc,
105: PNTSD_EXTENSION_APIS lpExtensionApis,
106: LPSTR lpArgumentString)
107: {
108: PNTSD_OUTPUT_ROUTINE Print;
109: PNTSD_GET_EXPRESSION EvalExpression;
110: PNTSD_GET_SYMBOL GetSymbol;
111:
112: PINFO pInfo;
113: INFO info;
114:
115: Print = lpExtensionApis->lpOutputRoutine;
116: EvalExpression = lpExtensionApis->lpGetExpressionRoutine;
117: GetSymbol = lpExtensionApis->lpGetSymbolRoutine;
118:
119: while (*lpArgumentString == ' ')
120: lpArgumentString++;
121:
122: pInfo = (PINFO)EvalExpression(lpArgumentString);
123: move(info, pInfo);
124: Print(info.CaptionBarText);
125: Print("\n");
126: Print("hParent = %x\n", info.hParent );
127: Print("hTextWnd = %x\n", info.hTextWnd );
128: Print("rcClient(l,t,r,b) = (%d,%d,%d,%d)\n",
129: info.rcClient.left, info.rcClient.top,
130: info.rcClient.right, info.rcClient.bottom );
131: return;
132: }
133:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.