annotate agent/src/os/win32/nt4internals.hpp @ 2977:f01de7799e05

Updated hgignore.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 15 Jun 2011 17:54:31 +0200
parents c18cbe5936b8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
2 * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 #ifndef _NT4INTERNALS_H_
a61af66fc99e Initial load
duke
parents:
diff changeset
26 #define _NT4INTERNALS_H_
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 #include <windows.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 namespace NT4 {
a61af66fc99e Initial load
duke
parents:
diff changeset
31 extern "C" {
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // Data structures and constants required to be able to get necessary
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // debugging-related information on Windows NT 4.0 through internal
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // (i.e., non-public) APIs. These are adapted from those in the
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // _Windows NT/2000 Native API Reference_ by Gary Nebbett, Macmillan
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // Technical Publishing, 201 West 103rd Street, Indianapolis, IN
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // 46290, 2000.
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 typedef LONG NTSTATUS;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 typedef LONG KPRIORITY;
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
a61af66fc99e Initial load
duke
parents:
diff changeset
44 #define NTAPI __stdcall
a61af66fc99e Initial load
duke
parents:
diff changeset
45 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
46 #define _cdecl
a61af66fc99e Initial load
duke
parents:
diff changeset
47 #define NTAPI
a61af66fc99e Initial load
duke
parents:
diff changeset
48 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 #define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 typedef enum _SYSTEM_INFORMATION_CLASS {
a61af66fc99e Initial load
duke
parents:
diff changeset
53 SystemProcessesAndThreadsInformation = 5
a61af66fc99e Initial load
duke
parents:
diff changeset
54 } SYSTEM_INFORMATION_CLASS;
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 typedef struct _UNICODE_STRING {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 USHORT Length;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 USHORT MaximumLength;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 PWSTR Buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 } UNICODE_STRING;
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 typedef struct _VM_COUNTERS {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 ULONG PeakVirtualSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 ULONG VirtualSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 ULONG PageFaultCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
66 ULONG PeakWorkingSetSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 ULONG WorkingSetSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
68 ULONG QuotaPeakPagedPoolUsage;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 ULONG QuotaPagedPoolUsage;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 ULONG QuotaPeakNonPagedPoolUsage;
a61af66fc99e Initial load
duke
parents:
diff changeset
71 ULONG QuotaNonPagedPoolUsage;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 ULONG PagefileUsage;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 ULONG PeakPagefileUsage;
a61af66fc99e Initial load
duke
parents:
diff changeset
74 } VM_COUNTERS, *PVM_COUNTERS;
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 typedef struct _IO_COUNTERS {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 LARGE_INTEGER ReadOperationCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 LARGE_INTEGER WriteOperationCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
79 LARGE_INTEGER OtherOperationCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 LARGE_INTEGER ReadTransferCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
81 LARGE_INTEGER WriteTransferCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
82 LARGE_INTEGER OtherTransferCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
83 } IO_COUNTERS, *PIO_COUNTERS;
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 typedef struct _CLIENT_ID {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 HANDLE UniqueProcess;
a61af66fc99e Initial load
duke
parents:
diff changeset
87 HANDLE UniqueThread;
a61af66fc99e Initial load
duke
parents:
diff changeset
88 } CLIENT_ID, *PCLIENT_ID;
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 typedef enum {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 StateInitialized,
a61af66fc99e Initial load
duke
parents:
diff changeset
92 StateReady,
a61af66fc99e Initial load
duke
parents:
diff changeset
93 StateRunning,
a61af66fc99e Initial load
duke
parents:
diff changeset
94 StateStandby,
a61af66fc99e Initial load
duke
parents:
diff changeset
95 StateTerminated,
a61af66fc99e Initial load
duke
parents:
diff changeset
96 StateWait,
a61af66fc99e Initial load
duke
parents:
diff changeset
97 StateTransition,
a61af66fc99e Initial load
duke
parents:
diff changeset
98 StateUnknown
a61af66fc99e Initial load
duke
parents:
diff changeset
99 } THREAD_STATE;
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 typedef enum {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 Executive,
a61af66fc99e Initial load
duke
parents:
diff changeset
103 FreePage,
a61af66fc99e Initial load
duke
parents:
diff changeset
104 PageIn,
a61af66fc99e Initial load
duke
parents:
diff changeset
105 PoolAllocation,
a61af66fc99e Initial load
duke
parents:
diff changeset
106 DelayExecution,
a61af66fc99e Initial load
duke
parents:
diff changeset
107 Suspended,
a61af66fc99e Initial load
duke
parents:
diff changeset
108 UserRequest,
a61af66fc99e Initial load
duke
parents:
diff changeset
109 WrExecutive,
a61af66fc99e Initial load
duke
parents:
diff changeset
110 WrFreePage,
a61af66fc99e Initial load
duke
parents:
diff changeset
111 WrPageIn,
a61af66fc99e Initial load
duke
parents:
diff changeset
112 WrPoolAllocation,
a61af66fc99e Initial load
duke
parents:
diff changeset
113 WrDelayExecution,
a61af66fc99e Initial load
duke
parents:
diff changeset
114 WrSuspended,
a61af66fc99e Initial load
duke
parents:
diff changeset
115 WrUserRequest,
a61af66fc99e Initial load
duke
parents:
diff changeset
116 WrEventPair,
a61af66fc99e Initial load
duke
parents:
diff changeset
117 WrQueue,
a61af66fc99e Initial load
duke
parents:
diff changeset
118 WrLpcReceive,
a61af66fc99e Initial load
duke
parents:
diff changeset
119 WrLpcReply,
a61af66fc99e Initial load
duke
parents:
diff changeset
120 WrVirtualMemory,
a61af66fc99e Initial load
duke
parents:
diff changeset
121 WrPageOut,
a61af66fc99e Initial load
duke
parents:
diff changeset
122 WrRendezvous,
a61af66fc99e Initial load
duke
parents:
diff changeset
123 Spare2,
a61af66fc99e Initial load
duke
parents:
diff changeset
124 Spare3,
a61af66fc99e Initial load
duke
parents:
diff changeset
125 Spare4,
a61af66fc99e Initial load
duke
parents:
diff changeset
126 Spare5,
a61af66fc99e Initial load
duke
parents:
diff changeset
127 Spare6,
a61af66fc99e Initial load
duke
parents:
diff changeset
128 WrKernel
a61af66fc99e Initial load
duke
parents:
diff changeset
129 } KWAIT_REASON;
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 typedef struct _SYSTEM_THREADS {
a61af66fc99e Initial load
duke
parents:
diff changeset
132 LARGE_INTEGER KernelTime;
a61af66fc99e Initial load
duke
parents:
diff changeset
133 LARGE_INTEGER UserTime;
a61af66fc99e Initial load
duke
parents:
diff changeset
134 LARGE_INTEGER CreateTime;
a61af66fc99e Initial load
duke
parents:
diff changeset
135 ULONG WaitTime;
a61af66fc99e Initial load
duke
parents:
diff changeset
136 PVOID StartAddress;
a61af66fc99e Initial load
duke
parents:
diff changeset
137 CLIENT_ID ClientId;
a61af66fc99e Initial load
duke
parents:
diff changeset
138 KPRIORITY Priority;
a61af66fc99e Initial load
duke
parents:
diff changeset
139 KPRIORITY BasePriority;
a61af66fc99e Initial load
duke
parents:
diff changeset
140 ULONG ContextSwitchCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
141 THREAD_STATE State;
a61af66fc99e Initial load
duke
parents:
diff changeset
142 KWAIT_REASON WaitReason;
a61af66fc99e Initial load
duke
parents:
diff changeset
143 } SYSTEM_THREADS, *PSYSTEM_THREADS;
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145 typedef struct _SYSTEM_PROCESSES { // Information class 5
a61af66fc99e Initial load
duke
parents:
diff changeset
146 ULONG NextEntryDelta;
a61af66fc99e Initial load
duke
parents:
diff changeset
147 ULONG ThreadCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
148 ULONG Reserved1[6];
a61af66fc99e Initial load
duke
parents:
diff changeset
149 LARGE_INTEGER CreateTime;
a61af66fc99e Initial load
duke
parents:
diff changeset
150 LARGE_INTEGER UserTime;
a61af66fc99e Initial load
duke
parents:
diff changeset
151 LARGE_INTEGER KernelTime;
a61af66fc99e Initial load
duke
parents:
diff changeset
152 UNICODE_STRING ProcessName;
a61af66fc99e Initial load
duke
parents:
diff changeset
153 KPRIORITY BasePriority;
a61af66fc99e Initial load
duke
parents:
diff changeset
154 ULONG ProcessId;
a61af66fc99e Initial load
duke
parents:
diff changeset
155 ULONG InheritedFromProcessId;
a61af66fc99e Initial load
duke
parents:
diff changeset
156 ULONG HandleCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
157 ULONG Reserved2[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
158 ULONG PrivatePageCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
159 VM_COUNTERS VmCounters;
a61af66fc99e Initial load
duke
parents:
diff changeset
160 IO_COUNTERS IoCounters; // Windows 2000 only
a61af66fc99e Initial load
duke
parents:
diff changeset
161 SYSTEM_THREADS Threads[1];
a61af66fc99e Initial load
duke
parents:
diff changeset
162 } SYSTEM_PROCESSES, *PSYSTEM_PROCESSES;
a61af66fc99e Initial load
duke
parents:
diff changeset
163
a61af66fc99e Initial load
duke
parents:
diff changeset
164 typedef NTSTATUS NTAPI
a61af66fc99e Initial load
duke
parents:
diff changeset
165 ZwQuerySystemInformationFunc(IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
a61af66fc99e Initial load
duke
parents:
diff changeset
166 IN OUT PVOID SystemInformation,
a61af66fc99e Initial load
duke
parents:
diff changeset
167 IN ULONG SystemInformationLength,
a61af66fc99e Initial load
duke
parents:
diff changeset
168 OUT PULONG ReturnLength OPTIONAL
a61af66fc99e Initial load
duke
parents:
diff changeset
169 );
a61af66fc99e Initial load
duke
parents:
diff changeset
170
a61af66fc99e Initial load
duke
parents:
diff changeset
171 typedef struct _DEBUG_BUFFER {
a61af66fc99e Initial load
duke
parents:
diff changeset
172 HANDLE SectionHandle;
a61af66fc99e Initial load
duke
parents:
diff changeset
173 PVOID SectionBase;
a61af66fc99e Initial load
duke
parents:
diff changeset
174 PVOID RemoteSectionBase;
a61af66fc99e Initial load
duke
parents:
diff changeset
175 ULONG SectionBaseDelta;
a61af66fc99e Initial load
duke
parents:
diff changeset
176 HANDLE EventPairHandle;
a61af66fc99e Initial load
duke
parents:
diff changeset
177 ULONG Unknown[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
178 HANDLE RemoteThreadHandle;
a61af66fc99e Initial load
duke
parents:
diff changeset
179 ULONG InfoClassMask;
a61af66fc99e Initial load
duke
parents:
diff changeset
180 ULONG SizeOfInfo;
a61af66fc99e Initial load
duke
parents:
diff changeset
181 ULONG AllocatedSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
182 ULONG SectionSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
183 PVOID ModuleInformation;
a61af66fc99e Initial load
duke
parents:
diff changeset
184 PVOID BackTraceInformation;
a61af66fc99e Initial load
duke
parents:
diff changeset
185 PVOID HeapInformation;
a61af66fc99e Initial load
duke
parents:
diff changeset
186 PVOID LockInformation;
a61af66fc99e Initial load
duke
parents:
diff changeset
187 PVOID Reserved[8];
a61af66fc99e Initial load
duke
parents:
diff changeset
188 } DEBUG_BUFFER, *PDEBUG_BUFFER;
a61af66fc99e Initial load
duke
parents:
diff changeset
189
a61af66fc99e Initial load
duke
parents:
diff changeset
190 typedef PDEBUG_BUFFER NTAPI
a61af66fc99e Initial load
duke
parents:
diff changeset
191 RtlCreateQueryDebugBufferFunc(IN ULONG Size,
a61af66fc99e Initial load
duke
parents:
diff changeset
192 IN BOOLEAN EventPair);
a61af66fc99e Initial load
duke
parents:
diff changeset
193
a61af66fc99e Initial load
duke
parents:
diff changeset
194 #define PDI_MODULES 0x01 // The loaded modules of the process
a61af66fc99e Initial load
duke
parents:
diff changeset
195 #define PDI_BACKTRACE 0x02 // The heap stack back traces
a61af66fc99e Initial load
duke
parents:
diff changeset
196 #define PDI_HEAPS 0x04 // The heaps of the process
a61af66fc99e Initial load
duke
parents:
diff changeset
197 #define PDI_HEAP_TAGS 0x08 // The heap tags
a61af66fc99e Initial load
duke
parents:
diff changeset
198 #define PDI_HEAP_BLOCKS 0x10 // The heap blocks
a61af66fc99e Initial load
duke
parents:
diff changeset
199 #define PDI_LOCKS 0x20 // The locks created by the process
a61af66fc99e Initial load
duke
parents:
diff changeset
200
a61af66fc99e Initial load
duke
parents:
diff changeset
201 typedef struct _DEBUG_MODULE_INFORMATION { // c.f. SYSTEM_MODULE_INFORMATION
a61af66fc99e Initial load
duke
parents:
diff changeset
202 ULONG Reserved[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
203 ULONG Base;
a61af66fc99e Initial load
duke
parents:
diff changeset
204 ULONG Size;
a61af66fc99e Initial load
duke
parents:
diff changeset
205 ULONG Flags;
a61af66fc99e Initial load
duke
parents:
diff changeset
206 USHORT Index;
a61af66fc99e Initial load
duke
parents:
diff changeset
207 USHORT Unknown;
a61af66fc99e Initial load
duke
parents:
diff changeset
208 USHORT LoadCount;
a61af66fc99e Initial load
duke
parents:
diff changeset
209 USHORT ModuleNameOffset;
a61af66fc99e Initial load
duke
parents:
diff changeset
210 CHAR ImageName[256];
a61af66fc99e Initial load
duke
parents:
diff changeset
211 } DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 // Flags
a61af66fc99e Initial load
duke
parents:
diff changeset
214 #define LDRP_STATIC_LINK 0x00000002
a61af66fc99e Initial load
duke
parents:
diff changeset
215 #define LDRP_IMAGE_DLL 0x00000004
a61af66fc99e Initial load
duke
parents:
diff changeset
216 #define LDRP_LOAD_IN_PROGRESS 0x00001000
a61af66fc99e Initial load
duke
parents:
diff changeset
217 #define LDRP_UNLOAD_IN_PROGRESS 0x00002000
a61af66fc99e Initial load
duke
parents:
diff changeset
218 #define LDRP_ENTRY_PROCESSED 0x00004000
a61af66fc99e Initial load
duke
parents:
diff changeset
219 #define LDRP_ENTRY_INSERTED 0x00008000
a61af66fc99e Initial load
duke
parents:
diff changeset
220 #define LDRP_CURRENT_LOAD 0x00010000
a61af66fc99e Initial load
duke
parents:
diff changeset
221 #define LDRP_FAILED_BUILTIN_LOAD 0x00020000
a61af66fc99e Initial load
duke
parents:
diff changeset
222 #define LDRP_DONT_CALL_FOR_THREADS 0x00040000
a61af66fc99e Initial load
duke
parents:
diff changeset
223 #define LDRP_PROCESS_ATTACH_CALLED 0x00080000
a61af66fc99e Initial load
duke
parents:
diff changeset
224 #define LDRP_DEBUG_SYMBOLS_LOADED 0x00100000
a61af66fc99e Initial load
duke
parents:
diff changeset
225 #define LDRP_IMAGE_NOT_AT_BASE 0x00200000
a61af66fc99e Initial load
duke
parents:
diff changeset
226 #define LDRP_WX86_IGNORE_MACHINETYPE 0x00400000
a61af66fc99e Initial load
duke
parents:
diff changeset
227
a61af66fc99e Initial load
duke
parents:
diff changeset
228 // NOTE that this will require creating a thread in the target
a61af66fc99e Initial load
duke
parents:
diff changeset
229 // process, implying that we can not call this while the process is
a61af66fc99e Initial load
duke
parents:
diff changeset
230 // suspended. May have to run this command in the child processes
a61af66fc99e Initial load
duke
parents:
diff changeset
231 // rather than the server.
a61af66fc99e Initial load
duke
parents:
diff changeset
232
a61af66fc99e Initial load
duke
parents:
diff changeset
233 typedef NTSTATUS NTAPI
a61af66fc99e Initial load
duke
parents:
diff changeset
234 RtlQueryProcessDebugInformationFunc(IN ULONG ProcessId,
a61af66fc99e Initial load
duke
parents:
diff changeset
235 IN ULONG DebugInfoClassMask,
a61af66fc99e Initial load
duke
parents:
diff changeset
236 IN OUT PDEBUG_BUFFER DebugBuffer);
a61af66fc99e Initial load
duke
parents:
diff changeset
237
a61af66fc99e Initial load
duke
parents:
diff changeset
238 typedef NTSTATUS NTAPI
a61af66fc99e Initial load
duke
parents:
diff changeset
239 RtlDestroyQueryDebugBufferFunc(IN PDEBUG_BUFFER DebugBuffer);
a61af66fc99e Initial load
duke
parents:
diff changeset
240
a61af66fc99e Initial load
duke
parents:
diff changeset
241 // Routines to load and unload NTDLL.DLL.
a61af66fc99e Initial load
duke
parents:
diff changeset
242 HMODULE loadNTDLL();
a61af66fc99e Initial load
duke
parents:
diff changeset
243 // Safe to call even if has not been loaded
a61af66fc99e Initial load
duke
parents:
diff changeset
244 void unloadNTDLL();
a61af66fc99e Initial load
duke
parents:
diff changeset
245
a61af66fc99e Initial load
duke
parents:
diff changeset
246 } // extern "C"
a61af66fc99e Initial load
duke
parents:
diff changeset
247 } // namespace NT4
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 //----------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
250
a61af66fc99e Initial load
duke
parents:
diff changeset
251 // On NT 4 only, we now use PSAPI to enumerate the loaded modules in
a61af66fc99e Initial load
duke
parents:
diff changeset
252 // the target processes. RtlQueryProcessDebugInformation creates a
a61af66fc99e Initial load
duke
parents:
diff changeset
253 // thread in the target process, which causes problems when we are
a61af66fc99e Initial load
duke
parents:
diff changeset
254 // handling events like breakpoints in the debugger. The dependence on
a61af66fc99e Initial load
duke
parents:
diff changeset
255 // an external DLL which might not be present is unfortunate, but we
a61af66fc99e Initial load
duke
parents:
diff changeset
256 // can either redistribute this DLL (if allowed) or refuse to start on
a61af66fc99e Initial load
duke
parents:
diff changeset
257 // NT 4 if it is not present.
a61af66fc99e Initial load
duke
parents:
diff changeset
258
a61af66fc99e Initial load
duke
parents:
diff changeset
259 typedef struct _MODULEINFO {
a61af66fc99e Initial load
duke
parents:
diff changeset
260 LPVOID lpBaseOfDll;
a61af66fc99e Initial load
duke
parents:
diff changeset
261 DWORD SizeOfImage;
a61af66fc99e Initial load
duke
parents:
diff changeset
262 LPVOID EntryPoint;
a61af66fc99e Initial load
duke
parents:
diff changeset
263 } MODULEINFO, *LPMODULEINFO;
a61af66fc99e Initial load
duke
parents:
diff changeset
264
a61af66fc99e Initial load
duke
parents:
diff changeset
265 typedef BOOL (WINAPI EnumProcessModulesFunc)(HANDLE, HMODULE *, DWORD, LPDWORD);
a61af66fc99e Initial load
duke
parents:
diff changeset
266 typedef DWORD (WINAPI GetModuleFileNameExFunc)(HANDLE, HMODULE, LPTSTR, DWORD);
a61af66fc99e Initial load
duke
parents:
diff changeset
267 typedef BOOL (WINAPI GetModuleInformationFunc)(HANDLE, HMODULE, LPMODULEINFO, DWORD);
a61af66fc99e Initial load
duke
parents:
diff changeset
268 // Routines to load and unload PSAPI.DLL.
a61af66fc99e Initial load
duke
parents:
diff changeset
269 HMODULE loadPSAPIDLL();
a61af66fc99e Initial load
duke
parents:
diff changeset
270 // Safe to call even if has not been loaded
a61af66fc99e Initial load
duke
parents:
diff changeset
271 void unloadPSAPIDLL();
a61af66fc99e Initial load
duke
parents:
diff changeset
272
a61af66fc99e Initial load
duke
parents:
diff changeset
273 #endif // #defined _NT4INTERNALS_H_