Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: util/win/process_structs.h

Issue 981393003: win: Support reading process info cross-bitness (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@64-port-test-2
Patch Set: . Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« util/win/process_info.cc ('K') | « util/win/process_info_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef CRASHPAD_UTIL_WIN_PROCESS_STRUCTS_H_
16 #define CRASHPAD_UTIL_WIN_PROCESS_STRUCTS_H_
17
18 #include <windows.h>
19
20 namespace crashpad {
Mark Mentovai 2015/03/09 16:11:46 Although we rarely have subnamespaces inside “cras
scottmg 2015/03/09 21:16:37 Done.
21
22 //! \brief Selected structures from winternl.h, ntddk.h, and `dt ntdll!xxx`,
Mark Mentovai 2015/03/09 16:11:46 You should have a //! \{ before this, and a //! \}
scottmg 2015/03/09 21:16:36 Done.
23 //! customized to have both x86 and x64 sizes available.
24 //!
25 //! The structure and field names follow the Windows names for clarity. We do,
26 //! however, use plain integral types rather than pointer types (DWORD/DWORD64,
27 //! rather than e.g. PVOID). This is both easier to define, and avoids
28 //! accidentally treating them as pointers into the current address space.
29 //!
30 //! In all cases, the `T` in the templates below must be either DWORD for
Mark Mentovai 2015/03/09 16:11:46 I think I’d like traits a little better, so that t
scottmg 2015/03/09 21:16:37 The user code does get better, but this gets prett
31 //! targeting x86 or DWORD64 for targeting x64.
32
33 #pragma pack(push, 1)
Mark Mentovai 2015/03/09 16:11:46 Is this true for the native structs too? Or are yo
scottmg 2015/03/09 21:16:37 Right, I set it to 1 so that it would explicitly m
34
35 template <class T> struct PROCESS_BASIC_INFORMATION_T {
36 union {
37 DWORD ExitStatus;
38 T padding_for_x64_0;
39 };
40 T PebBaseAddress;
41 T AffinityMask;
42 union {
43 DWORD BasePriority;
44 T padding_for_x64_1;
45 };
46 T UniqueProcessId;
47 T InheritedFromUniqueProcessId;
48 };
49
50 template <class T> struct LIST_ENTRY_T {
51 T Flink;
52 T Blink;
53 };
54
55 template <class T> struct UNICODE_STRING_T {
56 union {
57 struct {
58 USHORT Length;
59 USHORT MaximumLength;
60 };
61 T padding_for_x64;
62 };
63 T Buffer;
64 };
65
66 template <class T> struct PEB_LDR_DATA_T {
67 ULONG Length;
68 DWORD Initialized;
69 T SsHandle;
70 LIST_ENTRY_T<T> InLoadOrderModuleList;
71 LIST_ENTRY_T<T> InMemoryOrderModuleList;
72 LIST_ENTRY_T<T> InInitializationOrderModuleList;
73 };
74
75 template <class T> struct LDR_DATA_TABLE_ENTRY_T {
76 LIST_ENTRY_T<T> InLoadOrderLinks;
77 LIST_ENTRY_T<T> InMemoryOrderLinks;
78 LIST_ENTRY_T<T> InInitializationOrderLinks;
79 T DllBase;
80 T EntryPoint;
81 union {
82 ULONG SizeOfImage;
83 T padding_for_x86;
84 };
85 UNICODE_STRING_T<T> FullDllName;
86 UNICODE_STRING_T<T> BaseDllName;
87 ULONG Flags;
88 USHORT ObsoleteLoadCount;
89 USHORT TlsIndex;
90 LIST_ENTRY_T<T> HashLinks;
91 ULONG TimeDateStamp;
92 };
93
94 template <class T> struct CURDIR_T {
95 UNICODE_STRING_T<T> DosPath;
96 T Handle;
97 };
98
99 template <class T> struct STRING_T {
100 union {
101 struct {
102 DWORD Length;
103 DWORD MaximumLength;
104 };
105 T padding_for_x64;
106 };
107 T Buffer;
108 };
109
110 template <class T> struct RTL_DRIVE_LETTER_CURDIR_T {
111 WORD Flags;
112 WORD Length;
113 DWORD TimeStamp;
114 STRING_T<T> DosPath;
115 };
116
117 template <class T> struct RTL_USER_PROCESS_PARAMETERS_T {
118 DWORD MaximumLength;
119 DWORD Length;
120 DWORD Flags;
121 DWORD DebugFlags;
122 T ConsoleHandle;
123 union {
124 DWORD ConsoleFlags;
125 T padding_for_x86;
126 };
127 T StandardInput;
128 T StandardOutput;
129 T StandardError;
130 CURDIR_T<T> CurrentDirectory;
131 UNICODE_STRING_T<T> DllPath;
132 UNICODE_STRING_T<T> ImagePathName;
133 UNICODE_STRING_T<T> CommandLine;
134 T Environment;
135 DWORD StartingX;
136 DWORD StartingY;
137 DWORD CountX;
138 DWORD CountY;
139 DWORD CountCharsX;
140 DWORD CountCharsY;
141 DWORD FillAttribute;
142 DWORD WindowFlags;
143 DWORD ShowWindowFlags;
144 UNICODE_STRING_T<T> WindowTitle;
145 UNICODE_STRING_T<T> DesktopInfo;
146 UNICODE_STRING_T<T> ShellInfo;
147 UNICODE_STRING_T<T> RuntimeData;
148 RTL_DRIVE_LETTER_CURDIR_T<T> CurrentDirectores[32]; // sic.
Mark Mentovai 2015/03/09 16:11:46 Ha!
149 };
150
151 template <class T> struct GdiHandleBufferCountForBitness;
152 template <> struct GdiHandleBufferCountForBitness<DWORD> {
153 enum { value = 34 };
154 };
155 template <> struct GdiHandleBufferCountForBitness<DWORD64> {
156 enum { value = 60 };
157 };
158
159 template <class T> struct PEB_T {
160 union {
161 struct {
162 BYTE InheritedAddressSpace;
163 BYTE ReadImageFileExecOptions;
164 BYTE BeingDebugged;
165 BYTE BitField;
166 };
167 T padding_for_x64_0;
168 };
169 T Mutant;
170 T ImageBaseAddress;
171 T Ldr;
172 T ProcessParameters;
173 T SubSystemData;
174 T ProcessHeap;
175 T FastPebLock;
176 T AtlThunkSListPtr;
177 T IFEOKey;
178 T CrossProcessFlags;
179 T KernelCallbackTable;
180 DWORD SystemReserved;
181 DWORD AtlThunkSListPtr32;
182 T ApiSetMap;
183 union {
184 DWORD TlsExpansionCounter;
185 T padding_for_x64_1;
186 };
187 T TlsBitmap;
188 DWORD TlsBitmapBits[2];
189 T ReadOnlySharedMemoryBase;
190 T SparePvoid0;
191 T ReadOnlyStaticServerData;
192 T AnsiCodePageData;
193 T OemCodePageData;
194 T UnicodeCaseTableData;
195 DWORD NumberOfProcessors;
196 DWORD NtGlobalFlag;
197 LARGE_INTEGER CriticalSectionTimeout;
198 T HeapSegmentReserve;
199 T HeapSegmentCommit;
200 T HeapDeCommitTotalFreeThreshold;
201 T HeapDeCommitFreeBlockThreadhold;
202 DWORD NumberOfHeaps;
203 DWORD MaximumNumberOfHeaps;
204 T ProcessHeaps;
205 T GdiSharedHandleTable;
206 T ProcessStarterHelper;
207 DWORD GdiDCAttributeList;
208 T LoaderLock;
209 DWORD OSMajorVersion;
210 DWORD OSMinorVersion;
211 WORD OSBuildNumber;
212 WORD OSCSDVersion;
213 DWORD OSPlatformId;
214 DWORD ImageSubsystem;
215 DWORD ImageSubsystemMajorVersion;
216 union {
217 DWORD ImageSubsystemMinorVersion;
218 T padding_for_x64_2;
219 };
220 T ActiveProcessAffinityMask;
221 DWORD GdiHandleBuffer[GdiHandleBufferCountForBitness<T>::value];
222 T PostProcessInitRoutine;
223 T TlsExpansionBitmap;
224 DWORD TlsExpansionBitmapBits[32];
225 union {
226 DWORD SessionId;
227 T padding_for_x64_3;
228 };
229 ULARGE_INTEGER AppCompatFlags;
230 ULARGE_INTEGER AppCompatFlagsUser;
231 T pShimData;
232 T AppCompatInfo;
233 UNICODE_STRING_T<T> CSDVersion;
234 T ActivationContextData;
235 T ProcessAssemblyStorageMap;
236 T SystemDefaultActivationContextData;
237 T SystemAssemblyStorageMap;
238 T MinimumStackCommit;
239 T FlsCallback;
240 LIST_ENTRY_T<T> FlsListHead;
241 T FlsBitmap;
242 DWORD FlsBitmapBits[4];
243 DWORD FlsHighIndex;
244 };
245
246 #pragma pack(pop)
247
248 } // namespace crashpad
249
250 #endif // CRASHPAD_UTIL_WIN_PROCESS_STRUCTS_H_
OLDNEW
« util/win/process_info.cc ('K') | « util/win/process_info_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698