1
|
1 /*
|
|
2 * Win32 definitions for Windows NT
|
|
3 *
|
|
4 * Copyright 1996 Alexandre Julliard
|
|
5 */
|
|
6
|
|
7 #ifndef __WINE_WINNT_H
|
|
8 #define __WINE_WINNT_H
|
|
9
|
|
10 #include "windef.h"
|
|
11
|
|
12 #ifndef RC_INVOKED
|
|
13 #include <string.h>
|
|
14 #endif
|
|
15
|
|
16 #include "pshpack1.h"
|
|
17 /* Defines */
|
|
18
|
|
19 /* Argument 1 passed to the DllEntryProc. */
|
|
20 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
|
|
21 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
|
|
22 #define DLL_THREAD_ATTACH 2 /* attach new thread */
|
|
23 #define DLL_THREAD_DETACH 3 /* detach thread */
|
|
24
|
|
25
|
|
26 /* u.x.wProcessorArchitecture (NT) */
|
|
27 #define PROCESSOR_ARCHITECTURE_INTEL 0
|
|
28 #define PROCESSOR_ARCHITECTURE_MIPS 1
|
|
29 #define PROCESSOR_ARCHITECTURE_ALPHA 2
|
|
30 #define PROCESSOR_ARCHITECTURE_PPC 3
|
|
31 #define PROCESSOR_ARCHITECTURE_SHX 4
|
|
32 #define PROCESSOR_ARCHITECTURE_ARM 5
|
|
33 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
|
|
34
|
|
35 /* dwProcessorType */
|
|
36 #define PROCESSOR_INTEL_386 386
|
|
37 #define PROCESSOR_INTEL_486 486
|
|
38 #define PROCESSOR_INTEL_PENTIUM 586
|
|
39 #define PROCESSOR_INTEL_860 860
|
|
40 #define PROCESSOR_MIPS_R2000 2000
|
|
41 #define PROCESSOR_MIPS_R3000 3000
|
|
42 #define PROCESSOR_MIPS_R4000 4000
|
|
43 #define PROCESSOR_ALPHA_21064 21064
|
|
44 #define PROCESSOR_PPC_601 601
|
|
45 #define PROCESSOR_PPC_603 603
|
|
46 #define PROCESSOR_PPC_604 604
|
|
47 #define PROCESSOR_PPC_620 620
|
|
48 #define PROCESSOR_HITACHI_SH3 10003
|
|
49 #define PROCESSOR_HITACHI_SH3E 10004
|
|
50 #define PROCESSOR_HITACHI_SH4 10005
|
|
51 #define PROCESSOR_MOTOROLA_821 821
|
|
52 #define PROCESSOR_SHx_SH3 103
|
|
53 #define PROCESSOR_SHx_SH4 104
|
|
54 #define PROCESSOR_STRONGARM 2577
|
|
55 #define PROCESSOR_ARM720 1824 /* 0x720 */
|
|
56 #define PROCESSOR_ARM820 2080 /* 0x820 */
|
|
57 #define PROCESSOR_ARM920 2336 /* 0x920 */
|
|
58 #define PROCESSOR_ARM_7TDMI 70001
|
|
59
|
|
60 #define ANYSIZE_ARRAY 1
|
|
61
|
|
62 #define MINCHAR 0x80
|
|
63 #define MAXCHAR 0x7f
|
|
64 #define MINSHORT 0x8000
|
|
65 #define MAXSHORT 0x7fff
|
|
66 #define MINLONG 0x80000000
|
|
67 #define MAXLONG 0x7fffffff
|
|
68 #define MAXBYTE 0xff
|
|
69 #define MAXWORD 0xffff
|
|
70 #define MAXDWORD 0xffffffff
|
|
71
|
|
72 #define FIELD_OFFSET(type, field) \
|
|
73 ((LONG)(INT)&(((type *)0)->field))
|
|
74
|
|
75 #define CONTAINING_RECORD(address, type, field) \
|
|
76 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
|
|
77
|
|
78 /* Types */
|
|
79
|
|
80 /* TCHAR data types definitions for Winelib. */
|
|
81 /* These types are _not_ defined for the emulator, because they */
|
|
82 /* depend on the UNICODE macro that only exists in user's code. */
|
|
83
|
|
84 #ifndef __WINE__
|
|
85 # ifdef UNICODE
|
|
86 typedef WCHAR TCHAR, *PTCHAR;
|
|
87 typedef LPWSTR PTSTR, LPTSTR;
|
|
88 typedef LPCWSTR PCTSTR, LPCTSTR;
|
|
89 #define __TEXT(string) L##string /*probably wrong */
|
|
90 # else /* UNICODE */
|
|
91 typedef char TCHAR, *PTCHAR;
|
|
92 typedef LPSTR PTSTR, LPTSTR;
|
|
93 typedef LPCSTR PCTSTR, LPCTSTR;
|
|
94 #define __TEXT(string) string
|
|
95 # endif /* UNICODE */
|
|
96 #endif /* __WINE__ */
|
|
97 #define TEXT(quote) __TEXT(quote)
|
|
98
|
|
99 typedef BYTE BOOLEAN;
|
|
100 typedef BOOLEAN *PBOOLEAN;
|
|
101
|
|
102 typedef struct _LIST_ENTRY {
|
|
103 struct _LIST_ENTRY *Flink;
|
|
104 struct _LIST_ENTRY *Blink;
|
|
105 } LIST_ENTRY, *PLIST_ENTRY;
|
|
106
|
|
107 typedef struct _SINGLE_LIST_ENTRY {
|
|
108 struct _SINGLE_LIST_ENTRY *Next;
|
|
109 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
|
|
110
|
|
111 /* Heap flags */
|
|
112
|
|
113 #define HEAP_NO_SERIALIZE 0x00000001
|
|
114 #define HEAP_GROWABLE 0x00000002
|
|
115 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
|
|
116 #define HEAP_ZERO_MEMORY 0x00000008
|
|
117 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
|
|
118 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
|
|
119 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
|
|
120 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
|
|
121 #define HEAP_CREATE_ALIGN_16 0x00010000
|
|
122 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
|
|
123 #define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */
|
|
124 #define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */
|
|
125 #define HEAP_WINE_CODE16SEG 0x04000000 /* Not a Win32 flag */
|
|
126 #define HEAP_WINE_SHARED 0x08000000 /* Not a Win32 flag */
|
|
127
|
|
128 /* Processor feature flags. */
|
|
129 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
|
|
130 #define PF_FLOATING_POINT_EMULATED 1
|
|
131 #define PF_COMPARE_EXCHANGE_DOUBLE 2
|
|
132 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
|
|
133 #define PF_PPC_MOVEMEM_64BIT_OK 4
|
|
134 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
|
2568
|
135 /* based on wine-20010510 -- alex */
|
|
136 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
|
|
137 #define PF_AMD3D_INSTRUCTIONS_AVAILABLE 7
|
|
138 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
|
1
|
139
|
|
140 /* The Win32 register context */
|
|
141
|
|
142 /* CONTEXT is the CPU-dependent context; it should be used */
|
|
143 /* wherever a platform-specific context is needed (e.g. exception */
|
|
144 /* handling, Win32 register functions). */
|
|
145
|
|
146 /* CONTEXT86 is the i386-specific context; it should be used */
|
|
147 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
|
|
148 /* Win16 register functions), so that this code can be compiled */
|
|
149 /* on all platforms. */
|
|
150
|
|
151 #define SIZE_OF_80387_REGISTERS 80
|
|
152
|
|
153 typedef struct _FLOATING_SAVE_AREA
|
|
154 {
|
|
155 DWORD ControlWord;
|
|
156 DWORD StatusWord;
|
|
157 DWORD TagWord;
|
|
158 DWORD ErrorOffset;
|
|
159 DWORD ErrorSelector;
|
|
160 DWORD DataOffset;
|
|
161 DWORD DataSelector;
|
|
162 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
|
|
163 DWORD Cr0NpxState;
|
|
164 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
|
|
165
|
|
166 typedef struct _CONTEXT86
|
|
167 {
|
|
168 DWORD ContextFlags;
|
|
169
|
|
170 /* These are selected by CONTEXT_DEBUG_REGISTERS */
|
|
171 DWORD Dr0;
|
|
172 DWORD Dr1;
|
|
173 DWORD Dr2;
|
|
174 DWORD Dr3;
|
|
175 DWORD Dr6;
|
|
176 DWORD Dr7;
|
|
177
|
|
178 /* These are selected by CONTEXT_FLOATING_POINT */
|
|
179 FLOATING_SAVE_AREA FloatSave;
|
|
180
|
|
181 /* These are selected by CONTEXT_SEGMENTS */
|
|
182 DWORD SegGs;
|
|
183 DWORD SegFs;
|
|
184 DWORD SegEs;
|
|
185 DWORD SegDs;
|
|
186
|
|
187 /* These are selected by CONTEXT_INTEGER */
|
|
188 DWORD Edi;
|
|
189 DWORD Esi;
|
|
190 DWORD Ebx;
|
|
191 DWORD Edx;
|
|
192 DWORD Ecx;
|
|
193 DWORD Eax;
|
|
194
|
|
195 /* These are selected by CONTEXT_CONTROL */
|
|
196 DWORD Ebp;
|
|
197 DWORD Eip;
|
|
198 DWORD SegCs;
|
|
199 DWORD EFlags;
|
|
200 DWORD Esp;
|
|
201 DWORD SegSs;
|
|
202 } CONTEXT86;
|
|
203
|
|
204 #define CONTEXT_X86 0x00010000
|
|
205 #define CONTEXT_i386 CONTEXT_X86
|
|
206 #define CONTEXT_i486 CONTEXT_X86
|
|
207
|
|
208 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
|
|
209 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
|
|
210 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
|
|
211 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
|
|
212 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
|
|
213 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
|
|
214
|
|
215 /* i386 context definitions */
|
|
216 #ifdef __i386__
|
|
217
|
|
218 #define CONTEXT_CONTROL CONTEXT86_CONTROL
|
|
219 #define CONTEXT_INTEGER CONTEXT86_INTEGER
|
|
220 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
|
|
221 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
|
|
222 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
|
|
223 #define CONTEXT_FULL CONTEXT86_FULL
|
|
224
|
|
225 typedef CONTEXT86 CONTEXT;
|
|
226
|
|
227 #endif /* __i386__ */
|
|
228
|
|
229 /* Alpha context definitions */
|
1337
|
230 #if defined(_ALPHA_) || defined(__alpha__)
|
1
|
231
|
|
232 #define CONTEXT_ALPHA 0x00020000
|
|
233
|
|
234 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
|
|
235 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
|
|
236 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
|
|
237 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
|
|
238
|
|
239 typedef struct _CONTEXT
|
|
240 {
|
|
241 /* selected by CONTEXT_FLOATING_POINT */
|
|
242 ULONGLONG FltF0;
|
|
243 ULONGLONG FltF1;
|
|
244 ULONGLONG FltF2;
|
|
245 ULONGLONG FltF3;
|
|
246 ULONGLONG FltF4;
|
|
247 ULONGLONG FltF5;
|
|
248 ULONGLONG FltF6;
|
|
249 ULONGLONG FltF7;
|
|
250 ULONGLONG FltF8;
|
|
251 ULONGLONG FltF9;
|
|
252 ULONGLONG FltF10;
|
|
253 ULONGLONG FltF11;
|
|
254 ULONGLONG FltF12;
|
|
255 ULONGLONG FltF13;
|
|
256 ULONGLONG FltF14;
|
|
257 ULONGLONG FltF15;
|
|
258 ULONGLONG FltF16;
|
|
259 ULONGLONG FltF17;
|
|
260 ULONGLONG FltF18;
|
|
261 ULONGLONG FltF19;
|
|
262 ULONGLONG FltF20;
|
|
263 ULONGLONG FltF21;
|
|
264 ULONGLONG FltF22;
|
|
265 ULONGLONG FltF23;
|
|
266 ULONGLONG FltF24;
|
|
267 ULONGLONG FltF25;
|
|
268 ULONGLONG FltF26;
|
|
269 ULONGLONG FltF27;
|
|
270 ULONGLONG FltF28;
|
|
271 ULONGLONG FltF29;
|
|
272 ULONGLONG FltF30;
|
|
273 ULONGLONG FltF31;
|
|
274
|
|
275 /* selected by CONTEXT_INTEGER */
|
|
276 ULONGLONG IntV0;
|
|
277 ULONGLONG IntT0;
|
|
278 ULONGLONG IntT1;
|
|
279 ULONGLONG IntT2;
|
|
280 ULONGLONG IntT3;
|
|
281 ULONGLONG IntT4;
|
|
282 ULONGLONG IntT5;
|
|
283 ULONGLONG IntT6;
|
|
284 ULONGLONG IntT7;
|
|
285 ULONGLONG IntS0;
|
|
286 ULONGLONG IntS1;
|
|
287 ULONGLONG IntS2;
|
|
288 ULONGLONG IntS3;
|
|
289 ULONGLONG IntS4;
|
|
290 ULONGLONG IntS5;
|
|
291 ULONGLONG IntFp;
|
|
292 ULONGLONG IntA0;
|
|
293 ULONGLONG IntA1;
|
|
294 ULONGLONG IntA2;
|
|
295 ULONGLONG IntA3;
|
|
296 ULONGLONG IntA4;
|
|
297 ULONGLONG IntA5;
|
|
298 ULONGLONG IntT8;
|
|
299 ULONGLONG IntT9;
|
|
300 ULONGLONG IntT10;
|
|
301 ULONGLONG IntT11;
|
|
302 ULONGLONG IntRa;
|
|
303 ULONGLONG IntT12;
|
|
304 ULONGLONG IntAt;
|
|
305 ULONGLONG IntGp;
|
|
306 ULONGLONG IntSp;
|
|
307 ULONGLONG IntZero;
|
|
308
|
|
309 /* selected by CONTEXT_FLOATING_POINT */
|
|
310 ULONGLONG Fpcr;
|
|
311 ULONGLONG SoftFpcr;
|
|
312
|
|
313 /* selected by CONTEXT_CONTROL */
|
|
314 ULONGLONG Fir;
|
|
315 DWORD Psr;
|
|
316 DWORD ContextFlags;
|
|
317 DWORD Fill[4];
|
|
318 } CONTEXT;
|
|
319
|
|
320 #define _QUAD_PSR_OFFSET HighSoftFpcr
|
|
321 #define _QUAD_FLAGS_OFFSET HighFir
|
|
322
|
|
323 #endif /* _ALPHA_ */
|
|
324
|
|
325 /* Mips context definitions */
|
|
326 #ifdef _MIPS_
|
|
327
|
|
328 #define CONTEXT_R4000 0x00010000
|
|
329
|
|
330 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
|
|
331 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
|
|
332 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
|
|
333
|
|
334 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
|
|
335
|
|
336 typedef struct _CONTEXT
|
|
337 {
|
|
338 DWORD Argument[4];
|
|
339 /* These are selected by CONTEXT_FLOATING_POINT */
|
|
340 DWORD FltF0;
|
|
341 DWORD FltF1;
|
|
342 DWORD FltF2;
|
|
343 DWORD FltF3;
|
|
344 DWORD FltF4;
|
|
345 DWORD FltF5;
|
|
346 DWORD FltF6;
|
|
347 DWORD FltF7;
|
|
348 DWORD FltF8;
|
|
349 DWORD FltF9;
|
|
350 DWORD FltF10;
|
|
351 DWORD FltF11;
|
|
352 DWORD FltF12;
|
|
353 DWORD FltF13;
|
|
354 DWORD FltF14;
|
|
355 DWORD FltF15;
|
|
356 DWORD FltF16;
|
|
357 DWORD FltF17;
|
|
358 DWORD FltF18;
|
|
359 DWORD FltF19;
|
|
360 DWORD FltF20;
|
|
361 DWORD FltF21;
|
|
362 DWORD FltF22;
|
|
363 DWORD FltF23;
|
|
364 DWORD FltF24;
|
|
365 DWORD FltF25;
|
|
366 DWORD FltF26;
|
|
367 DWORD FltF27;
|
|
368 DWORD FltF28;
|
|
369 DWORD FltF29;
|
|
370 DWORD FltF30;
|
|
371 DWORD FltF31;
|
|
372
|
|
373 /* These are selected by CONTEXT_INTEGER */
|
|
374 DWORD IntZero;
|
|
375 DWORD IntAt;
|
|
376 DWORD IntV0;
|
|
377 DWORD IntV1;
|
|
378 DWORD IntA0;
|
|
379 DWORD IntA1;
|
|
380 DWORD IntA2;
|
|
381 DWORD IntA3;
|
|
382 DWORD IntT0;
|
|
383 DWORD IntT1;
|
|
384 DWORD IntT2;
|
|
385 DWORD IntT3;
|
|
386 DWORD IntT4;
|
|
387 DWORD IntT5;
|
|
388 DWORD IntT6;
|
|
389 DWORD IntT7;
|
|
390 DWORD IntS0;
|
|
391 DWORD IntS1;
|
|
392 DWORD IntS2;
|
|
393 DWORD IntS3;
|
|
394 DWORD IntS4;
|
|
395 DWORD IntS5;
|
|
396 DWORD IntS6;
|
|
397 DWORD IntS7;
|
|
398 DWORD IntT8;
|
|
399 DWORD IntT9;
|
|
400 DWORD IntK0;
|
|
401 DWORD IntK1;
|
|
402 DWORD IntGp;
|
|
403 DWORD IntSp;
|
|
404 DWORD IntS8;
|
|
405 DWORD IntRa;
|
|
406 DWORD IntLo;
|
|
407 DWORD IntHi;
|
|
408
|
|
409 /* These are selected by CONTEXT_FLOATING_POINT */
|
|
410 DWORD Fsr;
|
|
411
|
|
412 /* These are selected by CONTEXT_CONTROL */
|
|
413 DWORD Fir;
|
|
414 DWORD Psr;
|
|
415
|
|
416 DWORD ContextFlags;
|
|
417 DWORD Fill[2];
|
|
418 } CONTEXT;
|
|
419
|
|
420 #endif /* _MIPS_ */
|
|
421
|
|
422 /* PowerPC context definitions */
|
|
423 #ifdef __PPC__
|
|
424
|
|
425 #define CONTEXT_CONTROL 0x0001
|
|
426 #define CONTEXT_FLOATING_POINT 0x0002
|
|
427 #define CONTEXT_INTEGER 0x0004
|
|
428 #define CONTEXT_DEBUG_REGISTERS 0x0008
|
|
429 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
|
|
430
|
|
431 typedef struct
|
|
432 {
|
|
433 /* These are selected by CONTEXT_FLOATING_POINT */
|
|
434 double Fpr0;
|
|
435 double Fpr1;
|
|
436 double Fpr2;
|
|
437 double Fpr3;
|
|
438 double Fpr4;
|
|
439 double Fpr5;
|
|
440 double Fpr6;
|
|
441 double Fpr7;
|
|
442 double Fpr8;
|
|
443 double Fpr9;
|
|
444 double Fpr10;
|
|
445 double Fpr11;
|
|
446 double Fpr12;
|
|
447 double Fpr13;
|
|
448 double Fpr14;
|
|
449 double Fpr15;
|
|
450 double Fpr16;
|
|
451 double Fpr17;
|
|
452 double Fpr18;
|
|
453 double Fpr19;
|
|
454 double Fpr20;
|
|
455 double Fpr21;
|
|
456 double Fpr22;
|
|
457 double Fpr23;
|
|
458 double Fpr24;
|
|
459 double Fpr25;
|
|
460 double Fpr26;
|
|
461 double Fpr27;
|
|
462 double Fpr28;
|
|
463 double Fpr29;
|
|
464 double Fpr30;
|
|
465 double Fpr31;
|
|
466 double Fpscr;
|
|
467
|
|
468 /* These are selected by CONTEXT_INTEGER */
|
|
469 DWORD Gpr0;
|
|
470 DWORD Gpr1;
|
|
471 DWORD Gpr2;
|
|
472 DWORD Gpr3;
|
|
473 DWORD Gpr4;
|
|
474 DWORD Gpr5;
|
|
475 DWORD Gpr6;
|
|
476 DWORD Gpr7;
|
|
477 DWORD Gpr8;
|
|
478 DWORD Gpr9;
|
|
479 DWORD Gpr10;
|
|
480 DWORD Gpr11;
|
|
481 DWORD Gpr12;
|
|
482 DWORD Gpr13;
|
|
483 DWORD Gpr14;
|
|
484 DWORD Gpr15;
|
|
485 DWORD Gpr16;
|
|
486 DWORD Gpr17;
|
|
487 DWORD Gpr18;
|
|
488 DWORD Gpr19;
|
|
489 DWORD Gpr20;
|
|
490 DWORD Gpr21;
|
|
491 DWORD Gpr22;
|
|
492 DWORD Gpr23;
|
|
493 DWORD Gpr24;
|
|
494 DWORD Gpr25;
|
|
495 DWORD Gpr26;
|
|
496 DWORD Gpr27;
|
|
497 DWORD Gpr28;
|
|
498 DWORD Gpr29;
|
|
499 DWORD Gpr30;
|
|
500 DWORD Gpr31;
|
|
501
|
|
502 DWORD Cr;
|
|
503 DWORD Xer;
|
|
504
|
|
505 /* These are selected by CONTEXT_CONTROL */
|
|
506 DWORD Msr;
|
|
507 DWORD Iar;
|
|
508 DWORD Lr;
|
|
509 DWORD Ctr;
|
|
510
|
|
511 DWORD ContextFlags;
|
|
512 DWORD Fill[3];
|
|
513
|
|
514 /* These are selected by CONTEXT_DEBUG_REGISTERS */
|
|
515 DWORD Dr0;
|
|
516 DWORD Dr1;
|
|
517 DWORD Dr2;
|
|
518 DWORD Dr3;
|
|
519 DWORD Dr4;
|
|
520 DWORD Dr5;
|
|
521 DWORD Dr6;
|
|
522 DWORD Dr7;
|
|
523 } CONTEXT;
|
|
524
|
|
525 typedef struct _STACK_FRAME_HEADER
|
|
526 {
|
|
527 DWORD BackChain;
|
|
528 DWORD GlueSaved1;
|
|
529 DWORD GlueSaved2;
|
|
530 DWORD Reserved1;
|
|
531 DWORD Spare1;
|
|
532 DWORD Spare2;
|
|
533
|
|
534 DWORD Parameter0;
|
|
535 DWORD Parameter1;
|
|
536 DWORD Parameter2;
|
|
537 DWORD Parameter3;
|
|
538 DWORD Parameter4;
|
|
539 DWORD Parameter5;
|
|
540 DWORD Parameter6;
|
|
541 DWORD Parameter7;
|
|
542 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
|
|
543
|
|
544 #endif /* __PPC__ */
|
|
545
|
|
546 #ifdef __sparc__
|
|
547
|
|
548 /*
|
|
549 * FIXME:
|
|
550 *
|
|
551 * There is no official CONTEXT structure defined for the SPARC
|
|
552 * architecture, so I just made one up.
|
|
553 *
|
|
554 * This structure is valid only for 32-bit SPARC architectures,
|
|
555 * not for 64-bit SPARC.
|
|
556 *
|
|
557 * Note that this structure contains only the 'top-level' registers;
|
|
558 * the rest of the register window chain is not visible.
|
|
559 *
|
|
560 * The layout follows the Solaris 'prgregset_t' structure.
|
|
561 *
|
|
562 */
|
|
563
|
|
564 #define CONTEXT_SPARC 0x10000000
|
|
565
|
|
566 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
|
|
567 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
|
|
568 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
|
|
569
|
|
570 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
|
|
571
|
|
572 typedef struct _CONTEXT
|
|
573 {
|
|
574 DWORD ContextFlags;
|
|
575
|
|
576 /* These are selected by CONTEXT_INTEGER */
|
|
577 DWORD g0;
|
|
578 DWORD g1;
|
|
579 DWORD g2;
|
|
580 DWORD g3;
|
|
581 DWORD g4;
|
|
582 DWORD g5;
|
|
583 DWORD g6;
|
|
584 DWORD g7;
|
|
585 DWORD o0;
|
|
586 DWORD o1;
|
|
587 DWORD o2;
|
|
588 DWORD o3;
|
|
589 DWORD o4;
|
|
590 DWORD o5;
|
|
591 DWORD o6;
|
|
592 DWORD o7;
|
|
593 DWORD l0;
|
|
594 DWORD l1;
|
|
595 DWORD l2;
|
|
596 DWORD l3;
|
|
597 DWORD l4;
|
|
598 DWORD l5;
|
|
599 DWORD l6;
|
|
600 DWORD l7;
|
|
601 DWORD i0;
|
|
602 DWORD i1;
|
|
603 DWORD i2;
|
|
604 DWORD i3;
|
|
605 DWORD i4;
|
|
606 DWORD i5;
|
|
607 DWORD i6;
|
|
608 DWORD i7;
|
|
609
|
|
610 /* These are selected by CONTEXT_CONTROL */
|
|
611 DWORD psr;
|
|
612 DWORD pc;
|
|
613 DWORD npc;
|
|
614 DWORD y;
|
|
615 DWORD wim;
|
|
616 DWORD tbr;
|
|
617
|
|
618 /* FIXME: floating point registers missing */
|
|
619
|
|
620 } CONTEXT;
|
|
621
|
|
622 #endif /* __sparc__ */
|
|
623
|
|
624 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
|
|
625 #error You need to define a CONTEXT for your CPU
|
|
626 #endif
|
|
627
|
|
628 typedef CONTEXT *PCONTEXT;
|
|
629 typedef HANDLE *PHANDLE;
|
|
630
|
|
631 #ifdef __WINE__
|
|
632
|
|
633 /* Macros for easier access to i386 context registers */
|
|
634
|
|
635 #define EAX_reg(context) ((context)->Eax)
|
|
636 #define EBX_reg(context) ((context)->Ebx)
|
|
637 #define ECX_reg(context) ((context)->Ecx)
|
|
638 #define EDX_reg(context) ((context)->Edx)
|
|
639 #define ESI_reg(context) ((context)->Esi)
|
|
640 #define EDI_reg(context) ((context)->Edi)
|
|
641 #define EBP_reg(context) ((context)->Ebp)
|
|
642
|
|
643 #define CS_reg(context) ((context)->SegCs)
|
|
644 #define DS_reg(context) ((context)->SegDs)
|
|
645 #define ES_reg(context) ((context)->SegEs)
|
|
646 #define FS_reg(context) ((context)->SegFs)
|
|
647 #define GS_reg(context) ((context)->SegGs)
|
|
648 #define SS_reg(context) ((context)->SegSs)
|
|
649
|
|
650 #define EFL_reg(context) ((context)->EFlags)
|
|
651 #define EIP_reg(context) ((context)->Eip)
|
|
652 #define ESP_reg(context) ((context)->Esp)
|
|
653
|
|
654 #define AX_reg(context) (*(WORD*)&EAX_reg(context))
|
|
655 #define BX_reg(context) (*(WORD*)&EBX_reg(context))
|
|
656 #define CX_reg(context) (*(WORD*)&ECX_reg(context))
|
|
657 #define DX_reg(context) (*(WORD*)&EDX_reg(context))
|
|
658 #define SI_reg(context) (*(WORD*)&ESI_reg(context))
|
|
659 #define DI_reg(context) (*(WORD*)&EDI_reg(context))
|
|
660 #define BP_reg(context) (*(WORD*)&EBP_reg(context))
|
|
661
|
|
662 #define AL_reg(context) (*(BYTE*)&EAX_reg(context))
|
|
663 #define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
|
|
664 #define BL_reg(context) (*(BYTE*)&EBX_reg(context))
|
|
665 #define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
|
|
666 #define CL_reg(context) (*(BYTE*)&ECX_reg(context))
|
|
667 #define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
|
|
668 #define DL_reg(context) (*(BYTE*)&EDX_reg(context))
|
|
669 #define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
|
|
670
|
|
671 #define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
|
|
672 #define RESET_CFLAG(context) (EFL_reg(context) &= ~0x0001)
|
|
673 #define SET_ZFLAG(context) (EFL_reg(context) |= 0x0040)
|
|
674 #define RESET_ZFLAG(context) (EFL_reg(context) &= ~0x0040)
|
|
675
|
|
676 #define ISV86(context) (EFL_reg(context) & 0x00020000)
|
|
677 #define V86BASE(context) ((context)->Dr7) /* ugly */
|
|
678
|
|
679
|
|
680 /* Macros to retrieve the current context */
|
|
681
|
|
682 #ifdef __i386__
|
|
683
|
|
684 #ifdef NEED_UNDERSCORE_PREFIX
|
|
685 # define __ASM_NAME(name) "_" name
|
|
686 #else
|
|
687 # define __ASM_NAME(name) name
|
|
688 #endif
|
|
689
|
|
690 #ifdef __GNUC__
|
|
691 # define __ASM_GLOBAL_FUNC(name,code) \
|
|
692 __asm__( ".align 4\n\t" \
|
|
693 ".globl " __ASM_NAME(#name) "\n\t" \
|
|
694 ".type " __ASM_NAME(#name) ",@function\n" \
|
|
695 __ASM_NAME(#name) ":\n\t" \
|
|
696 code );
|
|
697 #else /* __GNUC__ */
|
|
698 # define __ASM_GLOBAL_FUNC(name,code) \
|
|
699 void __asm_dummy_##name(void) { \
|
|
700 asm( ".align 4\n\t" \
|
|
701 ".globl " __ASM_NAME(#name) "\n\t" \
|
|
702 ".type " __ASM_NAME(#name) ",@function\n" \
|
|
703 __ASM_NAME(#name) ":\n\t" \
|
|
704 code ); \
|
|
705 }
|
|
706 #endif /* __GNUC__ */
|
|
707
|
|
708 #define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \
|
|
709 __ASM_GLOBAL_FUNC( name, \
|
|
710 "call " __ASM_NAME("CALL32_Regs") "\n\t" \
|
|
711 ".long " __ASM_NAME(#fn) "\n\t" \
|
|
712 ".byte " #args ", " #args )
|
|
713 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
|
|
714 _DEFINE_REGS_ENTRYPOINT( name, fn, 0 )
|
|
715 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
|
|
716 _DEFINE_REGS_ENTRYPOINT( name, fn, 4 )
|
|
717 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
|
|
718 _DEFINE_REGS_ENTRYPOINT( name, fn, 8 )
|
|
719 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
|
|
720 _DEFINE_REGS_ENTRYPOINT( name, fn, 12 )
|
|
721 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
|
|
722 _DEFINE_REGS_ENTRYPOINT( name, fn, 16 )
|
|
723
|
|
724 #endif /* __i386__ */
|
|
725
|
|
726 #ifdef __sparc__
|
|
727 /* FIXME: use getcontext() to retrieve full context */
|
|
728 #define _GET_CONTEXT \
|
|
729 CONTEXT context; \
|
|
730 do { memset(&context, 0, sizeof(CONTEXT)); \
|
|
731 context.ContextFlags = CONTEXT_CONTROL; \
|
|
732 context.pc = (DWORD)__builtin_return_address(0); \
|
|
733 } while (0)
|
|
734
|
|
735 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
|
|
736 void WINAPI name ( void ) \
|
|
737 { _GET_CONTEXT; fn( &context ); }
|
|
738 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
|
|
739 void WINAPI name ( t1 a1 ) \
|
|
740 { _GET_CONTEXT; fn( a1, &context ); }
|
|
741 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
|
|
742 void WINAPI name ( t1 a1, t2 a2 ) \
|
|
743 { _GET_CONTEXT; fn( a1, a2, &context ); }
|
|
744 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
|
|
745 void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
|
|
746 { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
|
|
747 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
|
|
748 void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
|
|
749 { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
|
|
750
|
|
751 #endif /* __sparc__ */
|
|
752
|
|
753 #ifndef DEFINE_REGS_ENTRYPOINT_0
|
|
754 #error You need to define DEFINE_REGS_ENTRYPOINT macros for your CPU
|
|
755 #endif
|
|
756
|
|
757 #ifdef __i386__
|
|
758 # define GET_IP(context) ((LPVOID)(context)->Eip)
|
|
759 #endif
|
|
760 #ifdef __sparc__
|
|
761 # define GET_IP(context) ((LPVOID)(context)->pc)
|
|
762 #endif
|
|
763
|
|
764 #if !defined(GET_IP) && !defined(RC_INVOKED)
|
|
765 # error You must define GET_IP for this CPU
|
|
766 #endif
|
|
767
|
|
768 #endif /* __WINE__ */
|
|
769
|
|
770 /*
|
|
771 * Exception codes
|
|
772 */
|
|
773
|
|
774 #define STATUS_SUCCESS 0x00000000
|
|
775 #define STATUS_WAIT_0 0x00000000
|
|
776 #define STATUS_ABANDONED_WAIT_0 0x00000080
|
|
777 #define STATUS_USER_APC 0x000000C0
|
|
778 #define STATUS_TIMEOUT 0x00000102
|
|
779 #define STATUS_PENDING 0x00000103
|
|
780
|
|
781 #define STATUS_GUARD_PAGE_VIOLATION 0x80000001
|
|
782 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002
|
|
783 #define STATUS_BREAKPOINT 0x80000003
|
|
784 #define STATUS_SINGLE_STEP 0x80000004
|
|
785 #define STATUS_BUFFER_OVERFLOW 0x80000005
|
|
786 #define STATUS_NO_MORE_FILES 0x80000006
|
|
787 #define STATUS_WAKE_SYSTEM_DEBUGGER 0x80000007
|
|
788
|
|
789 #define STATUS_HANDLES_CLOSED 0x8000000A
|
|
790 #define STATUS_NO_INHERITANCE 0x8000000B
|
|
791 #define STATUS_GUID_SUBSTITUTION_MADE 0x8000000C
|
|
792 #define STATUS_PARTIAL_COPY 0x8000000D
|
|
793 #define STATUS_DEVICE_PAPER_EMPTY 0x8000000E
|
|
794 #define STATUS_DEVICE_POWERED_OFF 0x8000000F
|
|
795 #define STATUS_DEVICE_OFF_LINE 0x80000010
|
|
796 #define STATUS_DEVICE_BUSY 0x80000011
|
|
797 #define STATUS_NO_MORE_EAS 0x80000012
|
|
798 #define STATUS_INVALID_EA_NAME 0x80000013
|
|
799 #define STATUS_EA_LIST_INCONSISTENT 0x80000014
|
|
800 #define STATUS_INVALID_EA_FLAG 0x80000015
|
|
801 #define STATUS_VERIFY_REQUIRED 0x80000016
|
|
802 #define STATUS_EXTRANEOUS_INFORMATION 0x80000017
|
|
803 #define STATUS_RXACT_COMMIT_NECESSARY 0x80000018
|
|
804 #define STATUS_NO_MORE_ENTRIES 0x8000001A
|
|
805 #define STATUS_FILEMARK_DETECTED 0x8000001B
|
|
806 #define STATUS_MEDIA_CHANGED 0x8000001C
|
|
807 #define STATUS_BUS_RESET 0x8000001D
|
|
808 #define STATUS_END_OF_MEDIA 0x8000001E
|
|
809 #define STATUS_BEGINNING_OF_MEDIA 0x8000001F
|
|
810 #define STATUS_MEDIA_CHECK 0x80000020
|
|
811 #define STATUS_SETMARK_DETECTED 0x80000021
|
|
812 #define STATUS_NO_DATA_DETECTED 0x80000022
|
|
813 #define STATUS_REDIRECTOR_HAS_OPEN_HANDLES 0x80000023
|
|
814 #define STATUS_SERVER_HAS_OPEN_HANDLES 0x80000024
|
|
815 #define STATUS_ALREADY_DISCONNECTED 0x80000025
|
|
816 #define STATUS_LONGJUMP 0x80000026
|
|
817
|
|
818 #define STATUS_UNSUCCESSFUL 0xC0000001
|
|
819 #define STATUS_NOT_IMPLEMENTED 0xC0000002
|
|
820 #define STATUS_INVALID_INFO_CLASS 0xC0000003
|
|
821 #define STATUS_INFO_LENGTH_MISMATCH 0xC0000004
|
|
822 #define STATUS_ACCESS_VIOLATION 0xC0000005
|
|
823 #define STATUS_IN_PAGE_ERROR 0xC0000006
|
|
824 #define STATUS_PAGEFILE_QUOTA 0xC0000007
|
|
825 #define STATUS_INVALID_HANDLE 0xC0000008
|
|
826 #define STATUS_BAD_INITIAL_STACK 0xC0000009
|
|
827 #define STATUS_BAD_INITIAL_PC 0xC000000A
|
|
828 #define STATUS_INVALID_CID 0xC000000B
|
|
829 #define STATUS_TIMER_NOT_CANCELED 0xC000000C
|
|
830 #define STATUS_INVALID_PARAMETER 0xC000000D
|
|
831 #define STATUS_NO_SUCH_DEVICE 0xC000000E
|
|
832 #define STATUS_NO_SUCH_FILE 0xC000000F
|
|
833 #define STATUS_INVALID_DEVICE_REQUEST 0xC0000010
|
|
834 #define STATUS_END_OF_FILE 0xC0000011
|
|
835 #define STATUS_WRONG_VOLUME 0xC0000012
|
|
836 #define STATUS_NO_MEDIA_IN_DEVICE 0xC0000013
|
|
837 #define STATUS_UNRECOGNIZED_MEDIA 0xC0000014
|
|
838 #define STATUS_NONEXISTENT_SECTOR 0xC0000015
|
|
839 #define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016
|
|
840 #define STATUS_NO_MEMORY 0xC0000017
|
|
841 #define STATUS_CONFLICTING_ADDRESSES 0xC0000018
|
|
842 #define STATUS_NOT_MAPPED_VIEW 0xC0000019
|
|
843 #define STATUS_UNABLE_TO_FREE_VM 0xC000001A
|
|
844 #define STATUS_UNABLE_TO_DELETE_SECTION 0xC000001B
|
|
845 #define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C
|
|
846 #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
|
|
847 #define STATUS_INVALID_LOCK_SEQUENCE 0xC000001E
|
|
848 #define STATUS_INVALID_VIEW_SIZE 0xC000001F
|
|
849 #define STATUS_INVALID_FILE_FOR_SECTION 0xC0000020
|
|
850 #define STATUS_ALREADY_COMMITTED 0xC0000021
|
|
851 #define STATUS_ACCESS_DENIED 0xC0000022
|
|
852 #define STATUS_BUFFER_TOO_SMALL 0xC0000023
|
|
853 #define STATUS_OBJECT_TYPE_MISMATCH 0xC0000024
|
|
854 #define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
|
|
855 #define STATUS_INVALID_DISPOSITION 0xC0000026
|
|
856 #define STATUS_UNWIND 0xC0000027
|
|
857 #define STATUS_BAD_STACK 0xC0000028
|
|
858 #define STATUS_INVALID_UNWIND_TARGET 0xC0000029
|
|
859 #define STATUS_NOT_LOCKED 0xC000002A
|
|
860 #define STATUS_PARITY_ERROR 0xC000002B
|
|
861 #define STATUS_UNABLE_TO_DECOMMIT_VM 0xC000002C
|
|
862 #define STATUS_NOT_COMMITTED 0xC000002D
|
|
863 #define STATUS_INVALID_PORT_ATTRIBUTES 0xC000002E
|
|
864 #define STATUS_PORT_MESSAGE_TOO_LONG 0xC000002F
|
|
865 #define STATUS_INVALID_PARAMETER_MIX 0xC0000030
|
|
866 #define STATUS_INVALID_QUOTA_LOWER 0xC0000031
|
|
867 #define STATUS_DISK_CORRUPT_ERROR 0xC0000032
|
|
868 #define STATUS_OBJECT_NAME_INVALID 0xC0000033
|
|
869 #define STATUS_OBJECT_NAME_NOT_FOUND 0xC0000034
|
|
870 #define STATUS_OBJECT_NAME_COLLISION 0xC0000035
|
|
871 #define STATUS_PORT_DISCONNECTED 0xC0000037
|
|
872 #define STATUS_DEVICE_ALREADY_ATTACHED 0xC0000038
|
|
873 #define STATUS_OBJECT_PATH_INVALID 0xC0000039
|
|
874 #define STATUS_OBJECT_PATH_NOT_FOUND 0xC000003A
|
|
875 #define STATUS_PATH_SYNTAX_BAD 0xC000003B
|
|
876 #define STATUS_DATA_OVERRUN 0xC000003C
|
|
877 #define STATUS_DATA_LATE_ERROR 0xC000003D
|
|
878 #define STATUS_DATA_ERROR 0xC000003E
|
|
879 #define STATUS_CRC_ERROR 0xC000003F
|
|
880 #define STATUS_SECTION_TOO_BIG 0xC0000040
|
|
881 #define STATUS_PORT_CONNECTION_REFUSED 0xC0000041
|
|
882 #define STATUS_INVALID_PORT_HANDLE 0xC0000042
|
|
883 #define STATUS_SHARING_VIOLATION 0xC0000043
|
|
884 #define STATUS_QUOTA_EXCEEDED 0xC0000044
|
|
885 #define STATUS_INVALID_PAGE_PROTECTION 0xC0000045
|
|
886 #define STATUS_MUTANT_NOT_OWNED 0xC0000046
|
|
887 #define STATUS_SEMAPHORE_LIMIT_EXCEEDED 0xC0000047
|
|
888 #define STATUS_PORT_ALREADY_SET 0xC0000048
|
|
889 #define STATUS_SUSPEND_COUNT_EXCEEDED 0xC000004A
|
|
890 #define STATUS_LOCK_NOT_GRANTED 0xC0000054 /* FIXME: not sure */
|
|
891 #define STATUS_FILE_LOCK_CONFLICT 0xC0000055 /* FIXME: not sure */
|
|
892 #define STATUS_UNKNOWN_REVISION 0xC0000058
|
|
893 #define STATUS_INVALID_SECURITY_DESCR 0xC0000079
|
|
894 #define STATUS_DISK_FULL 0xC000007F
|
|
895 #define STATUS_SECTION_NOT_EXTENDED 0xC0000087
|
|
896 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
|
|
897 #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
|
|
898 #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
|
|
899 #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
|
|
900 #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
|
|
901 #define STATUS_FLOAT_OVERFLOW 0xC0000091
|
|
902 #define STATUS_FLOAT_STACK_CHECK 0xC0000092
|
|
903 #define STATUS_FLOAT_UNDERFLOW 0xC0000093
|
|
904 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
|
|
905 #define STATUS_INTEGER_OVERFLOW 0xC0000095
|
|
906 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
|
|
907 #define STATUS_MEDIA_WRITE_PROTECTED 0XC00000A2
|
|
908 #define STATUS_INVALID_PARAMETER_2 0xC00000F0
|
|
909 #define STATUS_STACK_OVERFLOW 0xC00000FD
|
|
910 #define STATUS_DIRECTORY_NOT_EMPTY 0xC0000101
|
|
911 #define STATUS_TOO_MANY_OPENED_FILES 0xC000011F
|
|
912 #define STATUS_CONTROL_C_EXIT 0xC000013A
|
|
913 #define STATUS_PIPE_BROKEN 0xC000014B
|
|
914 #define STATUS_NOT_REGISTRY_FILE 0xC000015C
|
|
915 #define STATUS_PARTITION_FAILURE 0xC0000172
|
|
916 #define STATUS_INVALID_BLOCK_LENGTH 0xC0000173
|
|
917 #define STATUS_DEVICE_NOT_PARTITIONED 0xC0000174
|
|
918 #define STATUS_UNABLE_TO_LOCK_MEDIA 0xC0000175
|
|
919 #define STATUS_UNABLE_TO_UNLOAD_MEDIA 0xC0000176
|
|
920 #define STATUS_EOM_OVERFLOW 0xC0000177
|
|
921 #define STATUS_NO_MEDIA 0xC0000178
|
|
922 #define STATUS_NO_SUCH_MEMBER 0xC000017A
|
|
923 #define STATUS_INVALID_MEMBER 0xC000017B
|
|
924 #define STATUS_KEY_DELETED 0xC000017C
|
|
925 #define STATUS_NO_LOG_SPACE 0xC000017D
|
|
926 #define STATUS_TOO_MANY_SIDS 0xC000017E
|
|
927 #define STATUS_LM_CROSS_ENCRYPTION_REQUIRED 0xC000017F
|
|
928 #define STATUS_KEY_HAS_CHILDREN 0xC0000180
|
|
929 #define STATUS_CHILD_MUST_BE_VOLATILE 0xC0000181
|
|
930 #define STATUS_DEVICE_CONFIGURATION_ERROR0xC0000182
|
|
931 #define STATUS_DRIVER_INTERNAL_ERROR 0xC0000183
|
|
932 #define STATUS_INVALID_DEVICE_STATE 0xC0000184
|
|
933 #define STATUS_IO_DEVICE_ERROR 0xC0000185
|
|
934 #define STATUS_DEVICE_PROTOCOL_ERROR 0xC0000186
|
|
935 #define STATUS_BACKUP_CONTROLLER 0xC0000187
|
|
936 #define STATUS_LOG_FILE_FULL 0xC0000188
|
|
937 #define STATUS_TOO_LATE 0xC0000189
|
|
938 #define STATUS_NO_TRUST_LSA_SECRET 0xC000018A
|
|
939 #define STATUS_NO_TRUST_SAM_ACCOUNT 0xC000018B
|
|
940 #define STATUS_TRUSTED_DOMAIN_FAILURE 0xC000018C
|
|
941 #define STATUS_TRUSTED_RELATIONSHIP_FAILURE 0xC000018D
|
|
942 #define STATUS_EVENTLOG_FILE_CORRUPT 0xC000018E
|
|
943 #define STATUS_EVENTLOG_CANT_START 0xC000018F
|
|
944 #define STATUS_TRUST_FAILURE 0xC0000190
|
|
945 #define STATUS_MUTANT_LIMIT_EXCEEDED 0xC0000191
|
|
946 #define STATUS_NETLOGON_NOT_STARTED 0xC0000192
|
|
947 #define STATUS_ACCOUNT_EXPIRED 0xC0000193
|
|
948 #define STATUS_POSSIBLE_DEADLOCK 0xC0000194
|
|
949 #define STATUS_NETWORK_CREDENTIAL_CONFLICT 0xC0000195
|
|
950 #define STATUS_REMOTE_SESSION_LIMIT 0xC0000196
|
|
951 #define STATUS_EVENTLOG_FILE_CHANGED 0xC0000197
|
|
952 #define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 0xC0000198
|
|
953 #define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT 0xC0000199
|
|
954 #define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT 0xC000019A
|
|
955 #define STATUS_DOMAIN_TRUST_INCONSISTENT 0xC000019B
|
|
956 #define STATUS_FS_DRIVER_REQUIRED 0xC000019C
|
|
957
|
|
958 #define STATUS_RESOURCE_LANG_NOT_FOUND 0xC0000204
|
|
959
|
|
960 #define MAXIMUM_WAIT_OBJECTS 64
|
|
961 #define MAXIMUM_SUSPEND_COUNT 127
|
|
962
|
|
963
|
|
964 /*
|
|
965 * Return values from the actual exception handlers
|
|
966 */
|
|
967
|
|
968 #define ExceptionContinueExecution 0
|
|
969 #define ExceptionContinueSearch 1
|
|
970 #define ExceptionNestedException 2
|
|
971 #define ExceptionCollidedUnwind 3
|
|
972
|
|
973 /*
|
|
974 * Return values from filters in except() and from UnhandledExceptionFilter
|
|
975 */
|
|
976
|
|
977 #define EXCEPTION_EXECUTE_HANDLER 1
|
|
978 #define EXCEPTION_CONTINUE_SEARCH 0
|
|
979 #define EXCEPTION_CONTINUE_EXECUTION -1
|
|
980
|
|
981 /*
|
|
982 * From OS/2 2.0 exception handling
|
|
983 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
|
|
984 */
|
|
985
|
|
986 #define EH_NONCONTINUABLE 0x01
|
|
987 #define EH_UNWINDING 0x02
|
|
988 #define EH_EXIT_UNWIND 0x04
|
|
989 #define EH_STACK_INVALID 0x08
|
|
990 #define EH_NESTED_CALL 0x10
|
|
991
|
|
992 #define EXCEPTION_CONTINUABLE 0
|
|
993 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
|
|
994
|
|
995 /*
|
|
996 * The exception record used by Win32 to give additional information
|
|
997 * about exception to exception handlers.
|
|
998 */
|
|
999
|
|
1000 #define EXCEPTION_MAXIMUM_PARAMETERS 15
|
|
1001
|
|
1002 typedef struct __EXCEPTION_RECORD
|
|
1003 {
|
|
1004 DWORD ExceptionCode;
|
|
1005 DWORD ExceptionFlags;
|
|
1006 struct __EXCEPTION_RECORD *ExceptionRecord;
|
|
1007
|
|
1008 LPVOID ExceptionAddress;
|
|
1009 DWORD NumberParameters;
|
|
1010 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
|
|
1011 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
|
|
1012
|
|
1013 /*
|
|
1014 * The exception pointers structure passed to exception filters
|
|
1015 * in except() and the UnhandledExceptionFilter().
|
|
1016 */
|
|
1017
|
|
1018 typedef struct _EXCEPTION_POINTERS
|
|
1019 {
|
|
1020 PEXCEPTION_RECORD ExceptionRecord;
|
|
1021 PCONTEXT ContextRecord;
|
|
1022 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
|
|
1023
|
|
1024
|
|
1025 /*
|
|
1026 * The exception frame, used for registering exception handlers
|
|
1027 * Win32 cares only about this, but compilers generally emit
|
|
1028 * larger exception frames for their own use.
|
|
1029 */
|
|
1030
|
|
1031 struct __EXCEPTION_FRAME;
|
|
1032
|
|
1033 typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct __EXCEPTION_FRAME*,
|
|
1034 PCONTEXT,struct __EXCEPTION_FRAME **);
|
|
1035
|
|
1036 typedef struct __EXCEPTION_FRAME
|
|
1037 {
|
|
1038 struct __EXCEPTION_FRAME *Prev;
|
|
1039 PEXCEPTION_HANDLER Handler;
|
|
1040 } EXCEPTION_FRAME, *PEXCEPTION_FRAME;
|
|
1041
|
|
1042 #include "poppack.h"
|
|
1043
|
|
1044 /*
|
|
1045 * function pointer to a exception filter
|
|
1046 */
|
|
1047
|
|
1048 typedef LONG CALLBACK (*PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
|
|
1049 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
|
|
1050
|
|
1051 DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
|
|
1052 LPTOP_LEVEL_EXCEPTION_FILTER
|
|
1053 WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
|
|
1054
|
|
1055 /* status values for ContinueDebugEvent */
|
|
1056 #define DBG_CONTINUE 0x00010002
|
|
1057 #define DBG_TERMINATE_THREAD 0x40010003
|
|
1058 #define DBG_TERMINATE_PROCESS 0x40010004
|
|
1059 #define DBG_CONTROL_C 0x40010005
|
|
1060 #define DBG_CONTROL_BREAK 0x40010008
|
|
1061 #define DBG_EXCEPTION_NOT_HANDLED 0x80010001
|
|
1062
|
|
1063 typedef struct _NT_TIB
|
|
1064 {
|
|
1065 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
|
|
1066 PVOID StackBase;
|
|
1067 PVOID StackLimit;
|
|
1068 PVOID SubSystemTib;
|
|
1069 union {
|
|
1070 PVOID FiberData;
|
|
1071 DWORD Version;
|
|
1072 } DUMMYUNIONNAME;
|
|
1073 PVOID ArbitraryUserPointer;
|
|
1074 struct _NT_TIB *Self;
|
|
1075 } NT_TIB, *PNT_TIB;
|
|
1076
|
|
1077 struct _TEB;
|
|
1078 /*
|
|
1079 #if defined(__i386__) && defined(__GNUC__)
|
|
1080 extern inline struct _TEB * WINAPI NtCurrentTeb(void);
|
|
1081 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
|
|
1082 {
|
|
1083 struct _TEB *teb;
|
|
1084 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
|
|
1085 return teb;
|
|
1086 }
|
|
1087 #else
|
|
1088 extern struct _TEB * WINAPI NtCurrentTeb(void);
|
|
1089 #endif
|
|
1090 */
|
|
1091
|
|
1092 /*
|
|
1093 * File formats definitions
|
|
1094 */
|
|
1095
|
|
1096 typedef struct _IMAGE_DOS_HEADER {
|
|
1097 WORD e_magic; /* 00: MZ Header signature */
|
|
1098 WORD e_cblp; /* 02: Bytes on last page of file */
|
|
1099 WORD e_cp; /* 04: Pages in file */
|
|
1100 WORD e_crlc; /* 06: Relocations */
|
|
1101 WORD e_cparhdr; /* 08: Size of header in paragraphs */
|
|
1102 WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
|
|
1103 WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
|
|
1104 WORD e_ss; /* 0e: Initial (relative) SS value */
|
|
1105 WORD e_sp; /* 10: Initial SP value */
|
|
1106 WORD e_csum; /* 12: Checksum */
|
|
1107 WORD e_ip; /* 14: Initial IP value */
|
|
1108 WORD e_cs; /* 16: Initial (relative) CS value */
|
|
1109 WORD e_lfarlc; /* 18: File address of relocation table */
|
|
1110 WORD e_ovno; /* 1a: Overlay number */
|
|
1111 WORD e_res[4]; /* 1c: Reserved words */
|
|
1112 WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
|
|
1113 WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
|
|
1114 WORD e_res2[10]; /* 28: Reserved words */
|
|
1115 DWORD e_lfanew; /* 3c: Offset to extended header */
|
|
1116 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
|
|
1117
|
|
1118 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
|
|
1119 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
|
|
1120 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
|
|
1121 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
|
|
1122 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
|
|
1123 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
|
|
1124
|
|
1125 /*
|
|
1126 * This is the Windows executable (NE) header.
|
|
1127 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
|
|
1128 */
|
|
1129 typedef struct
|
|
1130 {
|
|
1131 WORD ne_magic; /* 00 NE signature 'NE' */
|
|
1132 BYTE ne_ver; /* 02 Linker version number */
|
|
1133 BYTE ne_rev; /* 03 Linker revision number */
|
|
1134 WORD ne_enttab; /* 04 Offset to entry table relative to NE */
|
|
1135 WORD ne_cbenttab; /* 06 Length of entry table in bytes */
|
|
1136 LONG ne_crc; /* 08 Checksum */
|
|
1137 WORD ne_flags; /* 0c Flags about segments in this file */
|
|
1138 WORD ne_autodata; /* 0e Automatic data segment number */
|
|
1139 WORD ne_heap; /* 10 Initial size of local heap */
|
|
1140 WORD ne_stack; /* 12 Initial size of stack */
|
|
1141 DWORD ne_csip; /* 14 Initial CS:IP */
|
|
1142 DWORD ne_sssp; /* 18 Initial SS:SP */
|
|
1143 WORD ne_cseg; /* 1c # of entries in segment table */
|
|
1144 WORD ne_cmod; /* 1e # of entries in module reference tab. */
|
|
1145 WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
|
|
1146 WORD ne_segtab; /* 22 Offset to segment table */
|
|
1147 WORD ne_rsrctab; /* 24 Offset to resource table */
|
|
1148 WORD ne_restab; /* 26 Offset to resident-name table */
|
|
1149 WORD ne_modtab; /* 28 Offset to module reference table */
|
|
1150 WORD ne_imptab; /* 2a Offset to imported name table */
|
|
1151 DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
|
|
1152 WORD ne_cmovent; /* 30 # of movable entry points */
|
|
1153 WORD ne_align; /* 32 Logical sector alignment shift count */
|
|
1154 WORD ne_cres; /* 34 # of resource segments */
|
|
1155 BYTE ne_exetyp; /* 36 Flags indicating target OS */
|
|
1156 BYTE ne_flagsothers; /* 37 Additional information flags */
|
|
1157 WORD fastload_offset; /* 38 Offset to fast load area (should be ne_pretthunks)*/
|
|
1158 WORD fastload_length; /* 3a Length of fast load area (should be ne_psegrefbytes) */
|
|
1159 WORD ne_swaparea; /* 3c Reserved by Microsoft */
|
|
1160 WORD ne_expver; /* 3e Expected Windows version number */
|
|
1161 } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER;
|
|
1162
|
|
1163 typedef struct _IMAGE_VXD_HEADER {
|
|
1164 WORD e32_magic;
|
|
1165 BYTE e32_border;
|
|
1166 BYTE e32_worder;
|
|
1167 DWORD e32_level;
|
|
1168 WORD e32_cpu;
|
|
1169 WORD e32_os;
|
|
1170 DWORD e32_ver;
|
|
1171 DWORD e32_mflags;
|
|
1172 DWORD e32_mpages;
|
|
1173 DWORD e32_startobj;
|
|
1174 DWORD e32_eip;
|
|
1175 DWORD e32_stackobj;
|
|
1176 DWORD e32_esp;
|
|
1177 DWORD e32_pagesize;
|
|
1178 DWORD e32_lastpagesize;
|
|
1179 DWORD e32_fixupsize;
|
|
1180 DWORD e32_fixupsum;
|
|
1181 DWORD e32_ldrsize;
|
|
1182 DWORD e32_ldrsum;
|
|
1183 DWORD e32_objtab;
|
|
1184 DWORD e32_objcnt;
|
|
1185 DWORD e32_objmap;
|
|
1186 DWORD e32_itermap;
|
|
1187 DWORD e32_rsrctab;
|
|
1188 DWORD e32_rsrccnt;
|
|
1189 DWORD e32_restab;
|
|
1190 DWORD e32_enttab;
|
|
1191 DWORD e32_dirtab;
|
|
1192 DWORD e32_dircnt;
|
|
1193 DWORD e32_fpagetab;
|
|
1194 DWORD e32_frectab;
|
|
1195 DWORD e32_impmod;
|
|
1196 DWORD e32_impmodcnt;
|
|
1197 DWORD e32_impproc;
|
|
1198 DWORD e32_pagesum;
|
|
1199 DWORD e32_datapage;
|
|
1200 DWORD e32_preload;
|
|
1201 DWORD e32_nrestab;
|
|
1202 DWORD e32_cbnrestab;
|
|
1203 DWORD e32_nressum;
|
|
1204 DWORD e32_autodata;
|
|
1205 DWORD e32_debuginfo;
|
|
1206 DWORD e32_debuglen;
|
|
1207 DWORD e32_instpreload;
|
|
1208 DWORD e32_instdemand;
|
|
1209 DWORD e32_heapsize;
|
|
1210 BYTE e32_res3[12];
|
|
1211 DWORD e32_winresoff;
|
|
1212 DWORD e32_winreslen;
|
|
1213 WORD e32_devid;
|
|
1214 WORD e32_ddkver;
|
|
1215 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
|
|
1216
|
|
1217
|
|
1218 /* These defines describe the meanings of the bits in the Characteristics
|
|
1219 field */
|
|
1220
|
|
1221 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
|
|
1222 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
|
|
1223 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
|
|
1224 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
|
|
1225 #define IMAGE_FILE_16BIT_MACHINE 0x0040
|
|
1226 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
|
|
1227 #define IMAGE_FILE_32BIT_MACHINE 0x0100
|
|
1228 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
|
|
1229 #define IMAGE_FILE_SYSTEM 0x1000
|
|
1230 #define IMAGE_FILE_DLL 0x2000
|
|
1231 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
|
|
1232
|
|
1233 /* These are the settings of the Machine field. */
|
|
1234 #define IMAGE_FILE_MACHINE_UNKNOWN 0
|
|
1235 #define IMAGE_FILE_MACHINE_I860 0x14d
|
|
1236 #define IMAGE_FILE_MACHINE_I386 0x14c
|
|
1237 #define IMAGE_FILE_MACHINE_R3000 0x162
|
|
1238 #define IMAGE_FILE_MACHINE_R4000 0x166
|
|
1239 #define IMAGE_FILE_MACHINE_R10000 0x168
|
|
1240 #define IMAGE_FILE_MACHINE_ALPHA 0x184
|
|
1241 #define IMAGE_FILE_MACHINE_POWERPC 0x1F0
|
|
1242
|
|
1243 #define IMAGE_SIZEOF_FILE_HEADER 20
|
|
1244
|
|
1245 /* Possible Magic values */
|
|
1246 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
|
|
1247 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
|
|
1248
|
|
1249 /* These are indexes into the DataDirectory array */
|
|
1250 #define IMAGE_FILE_EXPORT_DIRECTORY 0
|
|
1251 #define IMAGE_FILE_IMPORT_DIRECTORY 1
|
|
1252 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
|
|
1253 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
|
|
1254 #define IMAGE_FILE_SECURITY_DIRECTORY 4
|
|
1255 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
|
|
1256 #define IMAGE_FILE_DEBUG_DIRECTORY 6
|
|
1257 #define IMAGE_FILE_DESCRIPTION_STRING 7
|
|
1258 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
|
|
1259 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
|
|
1260 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
|
|
1261
|
|
1262 /* Directory Entries, indices into the DataDirectory array */
|
|
1263
|
|
1264 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
|
|
1265 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
|
|
1266 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
|
|
1267 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
|
|
1268 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
|
|
1269 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
|
|
1270 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
|
|
1271 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
|
|
1272 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
|
|
1273 #define IMAGE_DIRECTORY_ENTRY_TLS 9
|
|
1274 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
|
|
1275 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
|
|
1276 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
|
|
1277 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
|
|
1278 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
|
|
1279
|
|
1280 /* Subsystem Values */
|
|
1281
|
|
1282 #define IMAGE_SUBSYSTEM_UNKNOWN 0
|
|
1283 #define IMAGE_SUBSYSTEM_NATIVE 1
|
|
1284 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
|
|
1285 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem*/
|
|
1286 #define IMAGE_SUBSYSTEM_OS2_CUI 5
|
|
1287 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
|
|
1288
|
|
1289 typedef struct _IMAGE_FILE_HEADER {
|
|
1290 WORD Machine;
|
|
1291 WORD NumberOfSections;
|
|
1292 DWORD TimeDateStamp;
|
|
1293 DWORD PointerToSymbolTable;
|
|
1294 DWORD NumberOfSymbols;
|
|
1295 WORD SizeOfOptionalHeader;
|
|
1296 WORD Characteristics;
|
|
1297 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
|
|
1298
|
|
1299 typedef struct _IMAGE_DATA_DIRECTORY {
|
|
1300 DWORD VirtualAddress;
|
|
1301 DWORD Size;
|
|
1302 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
|
|
1303
|
|
1304 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
|
|
1305
|
|
1306 typedef struct _IMAGE_OPTIONAL_HEADER {
|
|
1307
|
|
1308 /* Standard fields */
|
|
1309
|
|
1310 WORD Magic;
|
|
1311 BYTE MajorLinkerVersion;
|
|
1312 BYTE MinorLinkerVersion;
|
|
1313 DWORD SizeOfCode;
|
|
1314 DWORD SizeOfInitializedData;
|
|
1315 DWORD SizeOfUninitializedData;
|
|
1316 DWORD AddressOfEntryPoint;
|
|
1317 DWORD BaseOfCode;
|
|
1318 DWORD BaseOfData;
|
|
1319
|
|
1320 /* NT additional fields */
|
|
1321
|
|
1322 DWORD ImageBase;
|
|
1323 DWORD SectionAlignment;
|
|
1324 DWORD FileAlignment;
|
|
1325 WORD MajorOperatingSystemVersion;
|
|
1326 WORD MinorOperatingSystemVersion;
|
|
1327 WORD MajorImageVersion;
|
|
1328 WORD MinorImageVersion;
|
|
1329 WORD MajorSubsystemVersion;
|
|
1330 WORD MinorSubsystemVersion;
|
|
1331 DWORD Win32VersionValue;
|
|
1332 DWORD SizeOfImage;
|
|
1333 DWORD SizeOfHeaders;
|
|
1334 DWORD CheckSum;
|
|
1335 WORD Subsystem;
|
|
1336 WORD DllCharacteristics;
|
|
1337 DWORD SizeOfStackReserve;
|
|
1338 DWORD SizeOfStackCommit;
|
|
1339 DWORD SizeOfHeapReserve;
|
|
1340 DWORD SizeOfHeapCommit;
|
|
1341 DWORD LoaderFlags;
|
|
1342 DWORD NumberOfRvaAndSizes;
|
|
1343 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
|
|
1344 } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
|
|
1345
|
|
1346 typedef struct _IMAGE_NT_HEADERS {
|
|
1347 DWORD Signature;
|
|
1348 IMAGE_FILE_HEADER FileHeader;
|
|
1349 IMAGE_OPTIONAL_HEADER OptionalHeader;
|
|
1350 } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
|
|
1351
|
|
1352 #define IMAGE_SIZEOF_SHORT_NAME 8
|
|
1353
|
|
1354 typedef struct _IMAGE_SECTION_HEADER {
|
|
1355 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
|
|
1356 union {
|
|
1357 DWORD PhysicalAddress;
|
|
1358 DWORD VirtualSize;
|
|
1359 } Misc;
|
|
1360 DWORD VirtualAddress;
|
|
1361 DWORD SizeOfRawData;
|
|
1362 DWORD PointerToRawData;
|
|
1363 DWORD PointerToRelocations;
|
|
1364 DWORD PointerToLinenumbers;
|
|
1365 WORD NumberOfRelocations;
|
|
1366 WORD NumberOfLinenumbers;
|
|
1367 DWORD Characteristics;
|
|
1368 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
|
|
1369
|
|
1370 #define IMAGE_SIZEOF_SECTION_HEADER 40
|
|
1371
|
|
1372 #define IMAGE_FIRST_SECTION(ntheader) \
|
|
1373 ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
|
|
1374 ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
|
|
1375
|
|
1376 /* These defines are for the Characteristics bitfield. */
|
|
1377 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
|
|
1378 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
|
|
1379 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
|
|
1380 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
|
|
1381 /* #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - Reserved */
|
|
1382 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
|
|
1383
|
|
1384 #define IMAGE_SCN_CNT_CODE 0x00000020
|
|
1385 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
|
|
1386 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
|
|
1387
|
|
1388 #define IMAGE_SCN_LNK_OTHER 0x00000100
|
|
1389 #define IMAGE_SCN_LNK_INFO 0x00000200
|
|
1390 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
|
|
1391 #define IMAGE_SCN_LNK_REMOVE 0x00000800
|
|
1392 #define IMAGE_SCN_LNK_COMDAT 0x00001000
|
|
1393
|
|
1394 /* 0x00002000 - Reserved */
|
|
1395 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
|
|
1396 #define IMAGE_SCN_MEM_FARDATA 0x00008000
|
|
1397
|
|
1398 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
|
|
1399 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
|
|
1400 #define IMAGE_SCN_MEM_16BIT 0x00020000
|
|
1401 #define IMAGE_SCN_MEM_LOCKED 0x00040000
|
|
1402 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
|
|
1403
|
|
1404 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
|
|
1405 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
|
|
1406 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
|
|
1407 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
|
|
1408 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
|
|
1409 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
|
|
1410 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
|
|
1411 /* 0x00800000 - Unused */
|
|
1412
|
|
1413 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
|
|
1414
|
|
1415
|
|
1416 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
|
|
1417 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
|
|
1418 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
|
|
1419 #define IMAGE_SCN_MEM_SHARED 0x10000000
|
|
1420 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
|
|
1421 #define IMAGE_SCN_MEM_READ 0x40000000
|
|
1422 #define IMAGE_SCN_MEM_WRITE 0x80000000
|
|
1423
|
|
1424 #include "pshpack2.h"
|
|
1425
|
|
1426 typedef struct _IMAGE_SYMBOL {
|
|
1427 union {
|
|
1428 BYTE ShortName[8];
|
|
1429 struct {
|
|
1430 DWORD Short;
|
|
1431 DWORD Long;
|
|
1432 } Name;
|
|
1433 DWORD LongName[2];
|
|
1434 } N;
|
|
1435 DWORD Value;
|
|
1436 SHORT SectionNumber;
|
|
1437 WORD Type;
|
|
1438 BYTE StorageClass;
|
|
1439 BYTE NumberOfAuxSymbols;
|
|
1440 } IMAGE_SYMBOL;
|
|
1441 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
|
|
1442
|
|
1443 #define IMAGE_SIZEOF_SYMBOL 18
|
|
1444
|
|
1445 typedef struct _IMAGE_LINENUMBER {
|
|
1446 union {
|
|
1447 DWORD SymbolTableIndex;
|
|
1448 DWORD VirtualAddress;
|
|
1449 } Type;
|
|
1450 WORD Linenumber;
|
|
1451 } IMAGE_LINENUMBER;
|
|
1452 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
|
|
1453
|
|
1454 #define IMAGE_SIZEOF_LINENUMBER 6
|
|
1455
|
|
1456 typedef union _IMAGE_AUX_SYMBOL {
|
|
1457 struct {
|
|
1458 DWORD TagIndex;
|
|
1459 union {
|
|
1460 struct {
|
|
1461 WORD Linenumber;
|
|
1462 WORD Size;
|
|
1463 } LnSz;
|
|
1464 DWORD TotalSize;
|
|
1465 } Misc;
|
|
1466 union {
|
|
1467 struct {
|
|
1468 DWORD PointerToLinenumber;
|
|
1469 DWORD PointerToNextFunction;
|
|
1470 } Function;
|
|
1471 struct {
|
|
1472 WORD Dimension[4];
|
|
1473 } Array;
|
|
1474 } FcnAry;
|
|
1475 WORD TvIndex;
|
|
1476 } Sym;
|
|
1477 struct {
|
|
1478 BYTE Name[IMAGE_SIZEOF_SYMBOL];
|
|
1479 } File;
|
|
1480 struct {
|
|
1481 DWORD Length;
|
|
1482 WORD NumberOfRelocations;
|
|
1483 WORD NumberOfLinenumbers;
|
|
1484 DWORD CheckSum;
|
|
1485 SHORT Number;
|
|
1486 BYTE Selection;
|
|
1487 } Section;
|
|
1488 } IMAGE_AUX_SYMBOL;
|
|
1489 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
|
|
1490
|
|
1491 #define IMAGE_SIZEOF_AUX_SYMBOL 18
|
|
1492
|
|
1493 #include "poppack.h"
|
|
1494
|
|
1495 #define IMAGE_SYM_UNDEFINED (SHORT)0
|
|
1496 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
|
|
1497 #define IMAGE_SYM_DEBUG (SHORT)-2
|
|
1498
|
|
1499 #define IMAGE_SYM_TYPE_NULL 0x0000
|
|
1500 #define IMAGE_SYM_TYPE_VOID 0x0001
|
|
1501 #define IMAGE_SYM_TYPE_CHAR 0x0002
|
|
1502 #define IMAGE_SYM_TYPE_SHORT 0x0003
|
|
1503 #define IMAGE_SYM_TYPE_INT 0x0004
|
|
1504 #define IMAGE_SYM_TYPE_LONG 0x0005
|
|
1505 #define IMAGE_SYM_TYPE_FLOAT 0x0006
|
|
1506 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
|
|
1507 #define IMAGE_SYM_TYPE_STRUCT 0x0008
|
|
1508 #define IMAGE_SYM_TYPE_UNION 0x0009
|
|
1509 #define IMAGE_SYM_TYPE_ENUM 0x000A
|
|
1510 #define IMAGE_SYM_TYPE_MOE 0x000B
|
|
1511 #define IMAGE_SYM_TYPE_BYTE 0x000C
|
|
1512 #define IMAGE_SYM_TYPE_WORD 0x000D
|
|
1513 #define IMAGE_SYM_TYPE_UINT 0x000E
|
|
1514 #define IMAGE_SYM_TYPE_DWORD 0x000F
|
|
1515 #define IMAGE_SYM_TYPE_PCODE 0x8000
|
|
1516
|
|
1517 #define IMAGE_SYM_DTYPE_NULL 0
|
|
1518 #define IMAGE_SYM_DTYPE_POINTER 1
|
|
1519 #define IMAGE_SYM_DTYPE_FUNCTION 2
|
|
1520 #define IMAGE_SYM_DTYPE_ARRAY 3
|
|
1521
|
|
1522 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
|
|
1523 #define IMAGE_SYM_CLASS_NULL 0x0000
|
|
1524 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
|
|
1525 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
|
|
1526 #define IMAGE_SYM_CLASS_STATIC 0x0003
|
|
1527 #define IMAGE_SYM_CLASS_REGISTER 0x0004
|
|
1528 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
|
|
1529 #define IMAGE_SYM_CLASS_LABEL 0x0006
|
|
1530 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
|
|
1531 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
|
|
1532 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
|
|
1533 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
|
|
1534 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
|
|
1535 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
|
|
1536 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
|
|
1537 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
|
|
1538 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
|
|
1539 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
|
|
1540 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
|
|
1541 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
|
|
1542
|
|
1543 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
|
|
1544 #define IMAGE_SYM_CLASS_BLOCK 0x0064
|
|
1545 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
|
|
1546 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
|
|
1547 #define IMAGE_SYM_CLASS_FILE 0x0067
|
|
1548 #define IMAGE_SYM_CLASS_SECTION 0x0068
|
|
1549 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
|
|
1550
|
|
1551 #define N_BTMASK 0x000F
|
|
1552 #define N_TMASK 0x0030
|
|
1553 #define N_TMASK1 0x00C0
|
|
1554 #define N_TMASK2 0x00F0
|
|
1555 #define N_BTSHFT 4
|
|
1556 #define N_TSHIFT 2
|
|
1557
|
|
1558 #define BTYPE(x) ((x) & N_BTMASK)
|
|
1559
|
|
1560 #ifndef ISPTR
|
|
1561 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
|
|
1562 #endif
|
|
1563
|
|
1564 #ifndef ISFCN
|
|
1565 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
|
|
1566 #endif
|
|
1567
|
|
1568 #ifndef ISARY
|
|
1569 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
|
|
1570 #endif
|
|
1571
|
|
1572 #ifndef ISTAG
|
|
1573 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
|
|
1574 #endif
|
|
1575
|
|
1576 #ifndef INCREF
|
|
1577 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
|
|
1578 #endif
|
|
1579 #ifndef DECREF
|
|
1580 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
|
|
1581 #endif
|
|
1582
|
|
1583 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
|
|
1584 #define IMAGE_COMDAT_SELECT_ANY 2
|
|
1585 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
|
|
1586 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
|
|
1587 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
|
|
1588 #define IMAGE_COMDAT_SELECT_LARGEST 6
|
|
1589 #define IMAGE_COMDAT_SELECT_NEWEST 7
|
|
1590
|
|
1591 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
|
|
1592 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
|
|
1593 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
|
|
1594
|
|
1595 /* Export module directory */
|
|
1596
|
|
1597 typedef struct _IMAGE_EXPORT_DIRECTORY {
|
|
1598 DWORD Characteristics;
|
|
1599 DWORD TimeDateStamp;
|
|
1600 WORD MajorVersion;
|
|
1601 WORD MinorVersion;
|
|
1602 DWORD Name;
|
|
1603 DWORD Base;
|
|
1604 DWORD NumberOfFunctions;
|
|
1605 DWORD NumberOfNames;
|
|
1606 LPDWORD *AddressOfFunctions;
|
|
1607 LPDWORD *AddressOfNames;
|
|
1608 LPWORD *AddressOfNameOrdinals;
|
|
1609 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
|
|
1610
|
|
1611 /* Import name entry */
|
|
1612 typedef struct _IMAGE_IMPORT_BY_NAME {
|
|
1613 WORD Hint;
|
|
1614 BYTE Name[1];
|
|
1615 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
|
|
1616
|
|
1617 /* Import thunk */
|
|
1618 typedef struct _IMAGE_THUNK_DATA {
|
|
1619 union {
|
|
1620 LPBYTE ForwarderString;
|
|
1621 FARPROC Function;
|
|
1622 DWORD Ordinal;
|
|
1623 PIMAGE_IMPORT_BY_NAME AddressOfData;
|
|
1624 } u1;
|
|
1625 } IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;
|
|
1626
|
|
1627 /* Import module directory */
|
|
1628
|
|
1629 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
|
|
1630 union {
|
|
1631 DWORD Characteristics; /* 0 for terminating null import descriptor */
|
|
1632 PIMAGE_THUNK_DATA OriginalFirstThunk; /* RVA to original unbound IAT */
|
|
1633 } u;
|
|
1634 DWORD TimeDateStamp; /* 0 if not bound,
|
|
1635 * -1 if bound, and real date\time stamp
|
|
1636 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
|
|
1637 * (new BIND)
|
|
1638 * otherwise date/time stamp of DLL bound to
|
|
1639 * (Old BIND)
|
|
1640 */
|
|
1641 DWORD ForwarderChain; /* -1 if no forwarders */
|
|
1642 DWORD Name;
|
|
1643 /* RVA to IAT (if bound this IAT has actual addresses) */
|
|
1644 PIMAGE_THUNK_DATA FirstThunk;
|
|
1645 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
|
|
1646
|
|
1647 #define IMAGE_ORDINAL_FLAG 0x80000000
|
|
1648 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
|
|
1649 #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
|
|
1650
|
|
1651 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
|
|
1652 {
|
|
1653 DWORD TimeDateStamp;
|
|
1654 WORD OffsetModuleName;
|
|
1655 WORD NumberOfModuleForwarderRefs;
|
|
1656 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
|
|
1657 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
|
|
1658
|
|
1659 typedef struct _IMAGE_BOUND_FORWARDER_REF
|
|
1660 {
|
|
1661 DWORD TimeDateStamp;
|
|
1662 WORD OffsetModuleName;
|
|
1663 WORD Reserved;
|
|
1664 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
|
|
1665
|
|
1666 typedef struct _IMAGE_BASE_RELOCATION
|
|
1667 {
|
|
1668 DWORD VirtualAddress;
|
|
1669 DWORD SizeOfBlock;
|
|
1670 WORD TypeOffset[1];
|
|
1671 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
|
|
1672
|
|
1673 typedef struct _IMAGE_RELOCATION
|
|
1674 {
|
|
1675 union {
|
|
1676 DWORD VirtualAddress;
|
|
1677 DWORD RelocCount;
|
|
1678 } u;
|
|
1679 DWORD SymbolTableIndex;
|
|
1680 WORD Type;
|
|
1681 } IMAGE_RELOCATION;
|
|
1682 typedef IMAGE_RELOCATION *PIMAGE_RELOCATION;
|
|
1683
|
|
1684 #define IMAGE_SIZEOF_RELOCATION 10
|
|
1685
|
|
1686 /* generic relocation types */
|
|
1687 #define IMAGE_REL_BASED_ABSOLUTE 0
|
|
1688 #define IMAGE_REL_BASED_HIGH 1
|
|
1689 #define IMAGE_REL_BASED_LOW 2
|
|
1690 #define IMAGE_REL_BASED_HIGHLOW 3
|
|
1691 #define IMAGE_REL_BASED_HIGHADJ 4
|
|
1692 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
|
|
1693 #define IMAGE_REL_BASED_SECTION 6
|
|
1694 #define IMAGE_REL_BASED_REL 7
|
|
1695 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
|
|
1696 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
|
|
1697 #define IMAGE_REL_BASED_DIR64 10
|
|
1698 #define IMAGE_REL_BASED_HIGH3ADJ 11
|
|
1699
|
|
1700 /* I386 relocation types */
|
|
1701 #define IMAGE_REL_I386_ABSOLUTE 0
|
|
1702 #define IMAGE_REL_I386_DIR16 1
|
|
1703 #define IMAGE_REL_I386_REL16 2
|
|
1704 #define IMAGE_REL_I386_DIR32 6
|
|
1705 #define IMAGE_REL_I386_DIR32NB 7
|
|
1706 #define IMAGE_REL_I386_SEG12 9
|
|
1707 #define IMAGE_REL_I386_SECTION 10
|
|
1708 #define IMAGE_REL_I386_SECREL 11
|
|
1709 #define IMAGE_REL_I386_REL32 20
|
|
1710
|
|
1711 /* MIPS relocation types */
|
|
1712 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
|
|
1713 #define IMAGE_REL_MIPS_REFHALF 0x0001
|
|
1714 #define IMAGE_REL_MIPS_REFWORD 0x0002
|
|
1715 #define IMAGE_REL_MIPS_JMPADDR 0x0003
|
|
1716 #define IMAGE_REL_MIPS_REFHI 0x0004
|
|
1717 #define IMAGE_REL_MIPS_REFLO 0x0005
|
|
1718 #define IMAGE_REL_MIPS_GPREL 0x0006
|
|
1719 #define IMAGE_REL_MIPS_LITERAL 0x0007
|
|
1720 #define IMAGE_REL_MIPS_SECTION 0x000A
|
|
1721 #define IMAGE_REL_MIPS_SECREL 0x000B
|
|
1722 #define IMAGE_REL_MIPS_SECRELLO 0x000C
|
|
1723 #define IMAGE_REL_MIPS_SECRELHI 0x000D
|
|
1724 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
|
|
1725 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
|
|
1726 #define IMAGE_REL_MIPS_PAIR 0x0025
|
|
1727
|
|
1728 /* ALPHA relocation types */
|
|
1729 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
|
|
1730 #define IMAGE_REL_ALPHA_REFLONG 0x0001
|
|
1731 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
|
|
1732 #define IMAGE_REL_ALPHA_GPREL 0x0003
|
|
1733 #define IMAGE_REL_ALPHA_LITERAL 0x0004
|
|
1734 #define IMAGE_REL_ALPHA_LITUSE 0x0005
|
|
1735 #define IMAGE_REL_ALPHA_GPDISP 0x0006
|
|
1736 #define IMAGE_REL_ALPHA_BRADDR 0x0007
|
|
1737 #define IMAGE_REL_ALPHA_HINT 0x0008
|
|
1738 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
|
|
1739 #define IMAGE_REL_ALPHA_REFHI 0x000A
|
|
1740 #define IMAGE_REL_ALPHA_REFLO 0x000B
|
|
1741 #define IMAGE_REL_ALPHA_PAIR 0x000C
|
|
1742 #define IMAGE_REL_ALPHA_MATCH 0x000D
|
|
1743 #define IMAGE_REL_ALPHA_SECTION 0x000E
|
|
1744 #define IMAGE_REL_ALPHA_SECREL 0x000F
|
|
1745 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
|
|
1746 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
|
|
1747 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
|
|
1748 #define IMAGE_REL_ALPHA_REFQ3 0x0013
|
|
1749 #define IMAGE_REL_ALPHA_REFQ2 0x0014
|
|
1750 #define IMAGE_REL_ALPHA_REFQ1 0x0015
|
|
1751 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
|
|
1752 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
|
|
1753
|
|
1754 /* PowerPC relocation types */
|
|
1755 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
|
|
1756 #define IMAGE_REL_PPC_ADDR64 0x0001
|
|
1757 #define IMAGE_REL_PPC_ADDR 0x0002
|
|
1758 #define IMAGE_REL_PPC_ADDR24 0x0003
|
|
1759 #define IMAGE_REL_PPC_ADDR16 0x0004
|
|
1760 #define IMAGE_REL_PPC_ADDR14 0x0005
|
|
1761 #define IMAGE_REL_PPC_REL24 0x0006
|
|
1762 #define IMAGE_REL_PPC_REL14 0x0007
|
|
1763 #define IMAGE_REL_PPC_TOCREL16 0x0008
|
|
1764 #define IMAGE_REL_PPC_TOCREL14 0x0009
|
|
1765 #define IMAGE_REL_PPC_ADDR32NB 0x000A
|
|
1766 #define IMAGE_REL_PPC_SECREL 0x000B
|
|
1767 #define IMAGE_REL_PPC_SECTION 0x000C
|
|
1768 #define IMAGE_REL_PPC_IFGLUE 0x000D
|
|
1769 #define IMAGE_REL_PPC_IMGLUE 0x000E
|
|
1770 #define IMAGE_REL_PPC_SECREL16 0x000F
|
|
1771 #define IMAGE_REL_PPC_REFHI 0x0010
|
|
1772 #define IMAGE_REL_PPC_REFLO 0x0011
|
|
1773 #define IMAGE_REL_PPC_PAIR 0x0012
|
|
1774 #define IMAGE_REL_PPC_SECRELLO 0x0013
|
|
1775 #define IMAGE_REL_PPC_SECRELHI 0x0014
|
|
1776 #define IMAGE_REL_PPC_GPREL 0x0015
|
|
1777 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
|
|
1778 /* modifier bits */
|
|
1779 #define IMAGE_REL_PPC_NEG 0x0100
|
|
1780 #define IMAGE_REL_PPC_BRTAKEN 0x0200
|
|
1781 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
|
|
1782 #define IMAGE_REL_PPC_TOCDEFN 0x0800
|
|
1783
|
|
1784 /* SH3 ? relocation type */
|
|
1785 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
|
|
1786 #define IMAGE_REL_SH3_DIRECT16 0x0001
|
|
1787 #define IMAGE_REL_SH3_DIRECT 0x0002
|
|
1788 #define IMAGE_REL_SH3_DIRECT8 0x0003
|
|
1789 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
|
|
1790 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
|
|
1791 #define IMAGE_REL_SH3_DIRECT4 0x0006
|
|
1792 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
|
|
1793 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
|
|
1794 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
|
|
1795 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
|
|
1796 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
|
|
1797 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
|
|
1798 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
|
|
1799 #define IMAGE_REL_SH3_SECTION 0x000E
|
|
1800 #define IMAGE_REL_SH3_SECREL 0x000F
|
|
1801 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
|
|
1802
|
|
1803 /* ARM (Archimedes?) relocation types */
|
|
1804 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
|
|
1805 #define IMAGE_REL_ARM_ADDR 0x0001
|
|
1806 #define IMAGE_REL_ARM_ADDR32NB 0x0002
|
|
1807 #define IMAGE_REL_ARM_BRANCH24 0x0003
|
|
1808 #define IMAGE_REL_ARM_BRANCH11 0x0004
|
|
1809 #define IMAGE_REL_ARM_SECTION 0x000E
|
|
1810 #define IMAGE_REL_ARM_SECREL 0x000F
|
|
1811
|
|
1812 /* IA64 relocation types */
|
|
1813 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
|
|
1814 #define IMAGE_REL_IA64_IMM14 0x0001
|
|
1815 #define IMAGE_REL_IA64_IMM22 0x0002
|
|
1816 #define IMAGE_REL_IA64_IMM64 0x0003
|
|
1817 #define IMAGE_REL_IA64_DIR 0x0004
|
|
1818 #define IMAGE_REL_IA64_DIR64 0x0005
|
|
1819 #define IMAGE_REL_IA64_PCREL21B 0x0006
|
|
1820 #define IMAGE_REL_IA64_PCREL21M 0x0007
|
|
1821 #define IMAGE_REL_IA64_PCREL21F 0x0008
|
|
1822 #define IMAGE_REL_IA64_GPREL22 0x0009
|
|
1823 #define IMAGE_REL_IA64_LTOFF22 0x000A
|
|
1824 #define IMAGE_REL_IA64_SECTION 0x000B
|
|
1825 #define IMAGE_REL_IA64_SECREL22 0x000C
|
|
1826 #define IMAGE_REL_IA64_SECREL64I 0x000D
|
|
1827 #define IMAGE_REL_IA64_SECREL 0x000E
|
|
1828 #define IMAGE_REL_IA64_LTOFF64 0x000F
|
|
1829 #define IMAGE_REL_IA64_DIR32NB 0x0010
|
|
1830 #define IMAGE_REL_IA64_RESERVED_11 0x0011
|
|
1831 #define IMAGE_REL_IA64_RESERVED_12 0x0012
|
|
1832 #define IMAGE_REL_IA64_RESERVED_13 0x0013
|
|
1833 #define IMAGE_REL_IA64_RESERVED_14 0x0014
|
|
1834 #define IMAGE_REL_IA64_RESERVED_15 0x0015
|
|
1835 #define IMAGE_REL_IA64_RESERVED_16 0x0016
|
|
1836 #define IMAGE_REL_IA64_ADDEND 0x001F
|
|
1837
|
|
1838 /* archive format */
|
|
1839
|
|
1840 #define IMAGE_ARCHIVE_START_SIZE 8
|
|
1841 #define IMAGE_ARCHIVE_START "!<arch>\n"
|
|
1842 #define IMAGE_ARCHIVE_END "`\n"
|
|
1843 #define IMAGE_ARCHIVE_PAD "\n"
|
|
1844 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
|
|
1845 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
|
|
1846
|
|
1847 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
|
|
1848 {
|
|
1849 BYTE Name[16];
|
|
1850 BYTE Date[12];
|
|
1851 BYTE UserID[6];
|
|
1852 BYTE GroupID[6];
|
|
1853 BYTE Mode[8];
|
|
1854 BYTE Size[10];
|
|
1855 BYTE EndHeader[2];
|
|
1856 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
|
|
1857
|
|
1858 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
|
|
1859
|
|
1860 /*
|
|
1861 * Resource directory stuff
|
|
1862 */
|
|
1863 typedef struct _IMAGE_RESOURCE_DIRECTORY {
|
|
1864 DWORD Characteristics;
|
|
1865 DWORD TimeDateStamp;
|
|
1866 WORD MajorVersion;
|
|
1867 WORD MinorVersion;
|
|
1868 WORD NumberOfNamedEntries;
|
|
1869 WORD NumberOfIdEntries;
|
|
1870 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
|
|
1871 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
|
|
1872
|
|
1873 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
|
|
1874 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
|
|
1875
|
|
1876 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
|
|
1877 union {
|
|
1878 struct {
|
|
1879 unsigned NameOffset:31;
|
|
1880 unsigned NameIsString:1;
|
|
1881 } s;
|
|
1882 DWORD Name;
|
|
1883 WORD Id;
|
|
1884 } u1;
|
|
1885 union {
|
|
1886 DWORD OffsetToData;
|
|
1887 struct {
|
|
1888 unsigned OffsetToDirectory:31;
|
|
1889 unsigned DataIsDirectory:1;
|
|
1890 } s;
|
|
1891 } u2;
|
|
1892 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
|
|
1893
|
|
1894
|
|
1895 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
|
|
1896 WORD Length;
|
|
1897 CHAR NameString[ 1 ];
|
|
1898 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
|
|
1899
|
|
1900 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
|
|
1901 WORD Length;
|
|
1902 WCHAR NameString[ 1 ];
|
|
1903 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
|
|
1904
|
|
1905 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
|
|
1906 DWORD OffsetToData;
|
|
1907 DWORD Size;
|
|
1908 DWORD CodePage;
|
|
1909 DWORD ResourceHandle;
|
|
1910 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
|
|
1911
|
|
1912
|
|
1913 typedef VOID CALLBACK (*PIMAGE_TLS_CALLBACK)(
|
|
1914 LPVOID DllHandle,DWORD Reason,LPVOID Reserved
|
|
1915 );
|
|
1916
|
|
1917 typedef struct _IMAGE_TLS_DIRECTORY {
|
|
1918 DWORD StartAddressOfRawData;
|
|
1919 DWORD EndAddressOfRawData;
|
|
1920 LPDWORD AddressOfIndex;
|
|
1921 PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
|
|
1922 DWORD SizeOfZeroFill;
|
|
1923 DWORD Characteristics;
|
|
1924 } IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY;
|
|
1925
|
|
1926 typedef struct _IMAGE_DEBUG_DIRECTORY {
|
|
1927 DWORD Characteristics;
|
|
1928 DWORD TimeDateStamp;
|
|
1929 WORD MajorVersion;
|
|
1930 WORD MinorVersion;
|
|
1931 DWORD Type;
|
|
1932 DWORD SizeOfData;
|
|
1933 DWORD AddressOfRawData;
|
|
1934 DWORD PointerToRawData;
|
|
1935 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
|
|
1936
|
|
1937 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
|
|
1938 #define IMAGE_DEBUG_TYPE_COFF 1
|
|
1939 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
|
|
1940 #define IMAGE_DEBUG_TYPE_FPO 3
|
|
1941 #define IMAGE_DEBUG_TYPE_MISC 4
|
|
1942 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
|
|
1943 #define IMAGE_DEBUG_TYPE_FIXUP 6
|
|
1944 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
|
|
1945 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
|
|
1946 #define IMAGE_DEBUG_TYPE_BORLAND 9
|
|
1947 #define IMAGE_DEBUG_TYPE_RESERVED10 10
|
|
1948
|
|
1949 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
|
|
1950 DWORD NumberOfSymbols;
|
|
1951 DWORD LvaToFirstSymbol;
|
|
1952 DWORD NumberOfLinenumbers;
|
|
1953 DWORD LvaToFirstLinenumber;
|
|
1954 DWORD RvaToFirstByteOfCode;
|
|
1955 DWORD RvaToLastByteOfCode;
|
|
1956 DWORD RvaToFirstByteOfData;
|
|
1957 DWORD RvaToLastByteOfData;
|
|
1958 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
|
|
1959
|
|
1960 #define FRAME_FPO 0
|
|
1961 #define FRAME_TRAP 1
|
|
1962 #define FRAME_TSS 2
|
|
1963 #define FRAME_NONFPO 3
|
|
1964
|
|
1965 typedef struct _FPO_DATA {
|
|
1966 DWORD ulOffStart;
|
|
1967 DWORD cbProcSize;
|
|
1968 DWORD cdwLocals;
|
|
1969 WORD cdwParams;
|
|
1970 unsigned cbProlog : 8;
|
|
1971 unsigned cbRegs : 3;
|
|
1972 unsigned fHasSEH : 1;
|
|
1973 unsigned fUseBP : 1;
|
|
1974 unsigned reserved : 1;
|
|
1975 unsigned cbFrame : 2;
|
|
1976 } FPO_DATA, *PFPO_DATA;
|
|
1977
|
|
1978 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
|
|
1979 DWORD Characteristics;
|
|
1980 DWORD TimeDateStamp;
|
|
1981 WORD MajorVersion;
|
|
1982 WORD MinorVersion;
|
|
1983 DWORD GlobalFlagsClear;
|
|
1984 DWORD GlobalFlagsSet;
|
|
1985 DWORD CriticalSectionDefaultTimeout;
|
|
1986 DWORD DeCommitFreeBlockThreshold;
|
|
1987 DWORD DeCommitTotalFreeThreshold;
|
|
1988 PVOID LockPrefixTable;
|
|
1989 DWORD MaximumAllocationSize;
|
|
1990 DWORD VirtualMemoryThreshold;
|
|
1991 DWORD ProcessHeapFlags;
|
|
1992 DWORD ProcessAffinityMask;
|
|
1993 WORD CSDVersion;
|
|
1994 WORD Reserved1;
|
|
1995 PVOID EditList;
|
|
1996 DWORD Reserved[1];
|
|
1997 } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
|
|
1998
|
|
1999 typedef struct _IMAGE_FUNCTION_ENTRY {
|
|
2000 DWORD StartingAddress;
|
|
2001 DWORD EndingAddress;
|
|
2002 DWORD EndOfPrologue;
|
|
2003 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
|
|
2004
|
|
2005 /* This is the structure that appears at the very start of a .DBG file. */
|
|
2006
|
|
2007 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
|
|
2008 WORD Signature;
|
|
2009 WORD Flags;
|
|
2010 WORD Machine;
|
|
2011 WORD Characteristics;
|
|
2012 DWORD TimeDateStamp;
|
|
2013 DWORD CheckSum;
|
|
2014 DWORD ImageBase;
|
|
2015 DWORD SizeOfImage;
|
|
2016 DWORD NumberOfSections;
|
|
2017 DWORD ExportedNamesSize;
|
|
2018 DWORD DebugDirectorySize;
|
|
2019 DWORD SectionAlignment;
|
|
2020 DWORD Reserved[ 2 ];
|
|
2021 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
|
|
2022
|
|
2023 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
|
|
2024
|
|
2025
|
|
2026 typedef struct tagMESSAGE_RESOURCE_ENTRY {
|
|
2027 WORD Length;
|
|
2028 WORD Flags;
|
|
2029 BYTE Text[1];
|
|
2030 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
|
|
2031 #define MESSAGE_RESOURCE_UNICODE 0x0001
|
|
2032
|
|
2033 typedef struct tagMESSAGE_RESOURCE_BLOCK {
|
|
2034 DWORD LowId;
|
|
2035 DWORD HighId;
|
|
2036 DWORD OffsetToEntries;
|
|
2037 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
|
|
2038
|
|
2039 typedef struct tagMESSAGE_RESOURCE_DATA {
|
|
2040 DWORD NumberOfBlocks;
|
|
2041 MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
|
|
2042 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
|
|
2043
|
|
2044 /*
|
|
2045 * Here follows typedefs for security and tokens.
|
|
2046 */
|
|
2047
|
|
2048 /*
|
|
2049 * First a constant for the following typdefs.
|
|
2050 */
|
|
2051
|
|
2052 #define ANYSIZE_ARRAY 1
|
|
2053
|
|
2054 /* FIXME: Orphan. What does it point to? */
|
|
2055 typedef PVOID PACCESS_TOKEN;
|
|
2056
|
|
2057 /*
|
|
2058 * TOKEN_INFORMATION_CLASS
|
|
2059 */
|
|
2060
|
|
2061 typedef enum _TOKEN_INFORMATION_CLASS {
|
|
2062 TokenUser = 1,
|
|
2063 TokenGroups,
|
|
2064 TokenPrivileges,
|
|
2065 TokenOwner,
|
|
2066 TokenPrimaryGroup,
|
|
2067 TokenDefaultDacl,
|
|
2068 TokenSource,
|
|
2069 TokenType,
|
|
2070 TokenImpersonationLevel,
|
|
2071 TokenStatistics
|
|
2072 } TOKEN_INFORMATION_CLASS;
|
|
2073
|
|
2074 #ifndef _SECURITY_DEFINED
|
|
2075 #define _SECURITY_DEFINED
|
|
2076
|
|
2077 #include "pshpack1.h"
|
|
2078
|
|
2079 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
|
|
2080
|
|
2081 typedef struct _GENERIC_MAPPING {
|
|
2082 ACCESS_MASK GenericRead;
|
|
2083 ACCESS_MASK GenericWrite;
|
|
2084 ACCESS_MASK GenericExecute;
|
|
2085 ACCESS_MASK GenericAll;
|
|
2086 } GENERIC_MAPPING, *PGENERIC_MAPPING;
|
|
2087
|
|
2088 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
|
|
2089 #define SID_IDENTIFIER_AUTHORITY_DEFINED
|
|
2090 typedef struct {
|
|
2091 BYTE Value[6];
|
|
2092 } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
|
|
2093 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
|
|
2094
|
|
2095 #ifndef SID_DEFINED
|
|
2096 #define SID_DEFINED
|
|
2097 typedef struct _SID {
|
|
2098 BYTE Revision;
|
|
2099 BYTE SubAuthorityCount;
|
|
2100 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
|
|
2101 DWORD SubAuthority[1];
|
|
2102 } SID,*PSID;
|
|
2103 #endif /* !defined(SID_DEFINED) */
|
|
2104
|
|
2105 #define SID_REVISION (1) /* Current revision */
|
|
2106 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
|
|
2107 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
|
|
2108
|
|
2109
|
|
2110 /*
|
|
2111 * ACL
|
|
2112 */
|
|
2113
|
|
2114 #define ACL_REVISION1 1
|
|
2115 #define ACL_REVISION2 2
|
|
2116 #define ACL_REVISION3 3
|
|
2117 #define ACL_REVISION4 4
|
|
2118
|
|
2119 #define MIN_ACL_REVISION ACL_REVISION2
|
|
2120 #define MAX_ACL_REVISION ACL_REVISION4
|
|
2121
|
|
2122 typedef struct _ACL {
|
|
2123 BYTE AclRevision;
|
|
2124 BYTE Sbz1;
|
|
2125 WORD AclSize;
|
|
2126 WORD AceCount;
|
|
2127 WORD Sbz2;
|
|
2128 } ACL, *PACL;
|
|
2129
|
|
2130 /* SECURITY_DESCRIPTOR */
|
|
2131 #define SECURITY_DESCRIPTOR_REVISION 1
|
|
2132 #define SECURITY_DESCRIPTOR_REVISION1 1
|
|
2133
|
|
2134
|
|
2135 #define SE_OWNER_DEFAULTED 0x0001
|
|
2136 #define SE_GROUP_DEFAULTED 0x0002
|
|
2137 #define SE_DACL_PRESENT 0x0004
|
|
2138 #define SE_DACL_DEFAULTED 0x0008
|
|
2139 #define SE_SACL_PRESENT 0x0010
|
|
2140 #define SE_SACL_DEFAULTED 0x0020
|
|
2141 #define SE_SELF_RELATIVE 0x8000
|
|
2142
|
|
2143 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
|
|
2144 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
|
|
2145
|
|
2146 /* The security descriptor structure */
|
|
2147 typedef struct {
|
|
2148 BYTE Revision;
|
|
2149 BYTE Sbz1;
|
|
2150 SECURITY_DESCRIPTOR_CONTROL Control;
|
|
2151 DWORD Owner;
|
|
2152 DWORD Group;
|
|
2153 DWORD Sacl;
|
|
2154 DWORD Dacl;
|
|
2155 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
|
|
2156
|
|
2157 typedef struct {
|
|
2158 BYTE Revision;
|
|
2159 BYTE Sbz1;
|
|
2160 SECURITY_DESCRIPTOR_CONTROL Control;
|
|
2161 PSID Owner;
|
|
2162 PSID Group;
|
|
2163 PACL Sacl;
|
|
2164 PACL Dacl;
|
|
2165 } SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
|
|
2166
|
|
2167 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
|
|
2168
|
|
2169 #include "poppack.h"
|
|
2170
|
|
2171 #endif /* _SECURITY_DEFINED */
|
|
2172
|
|
2173 #include "pshpack1.h"
|
|
2174
|
|
2175 /*
|
|
2176 * SID_AND_ATTRIBUTES
|
|
2177 */
|
|
2178
|
|
2179 typedef struct _SID_AND_ATTRIBUTES {
|
|
2180 PSID Sid;
|
|
2181 DWORD Attributes;
|
|
2182 } SID_AND_ATTRIBUTES ;
|
|
2183
|
|
2184 /* security entities */
|
|
2185 #define SECURITY_NULL_RID (0x00000000L)
|
|
2186 #define SECURITY_WORLD_RID (0x00000000L)
|
|
2187 #define SECURITY_LOCAL_RID (0X00000000L)
|
|
2188
|
|
2189 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
|
|
2190
|
|
2191 /* S-1-1 */
|
|
2192 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
|
|
2193
|
|
2194 /* S-1-2 */
|
|
2195 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
|
|
2196
|
|
2197 /* S-1-3 */
|
|
2198 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
|
|
2199 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
|
|
2200 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
|
|
2201 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
|
|
2202 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
|
|
2203
|
|
2204 /* S-1-4 */
|
|
2205 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
|
|
2206
|
|
2207 /* S-1-5 */
|
|
2208 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
|
|
2209 #define SECURITY_DIALUP_RID 0x00000001L
|
|
2210 #define SECURITY_NETWORK_RID 0x00000002L
|
|
2211 #define SECURITY_BATCH_RID 0x00000003L
|
|
2212 #define SECURITY_INTERACTIVE_RID 0x00000004L
|
|
2213 #define SECURITY_LOGON_IDS_RID 0x00000005L
|
|
2214 #define SECURITY_SERVICE_RID 0x00000006L
|
|
2215 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
|
|
2216 #define SECURITY_PROXY_RID 0x00000008L
|
|
2217 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
|
|
2218 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
|
|
2219 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
|
|
2220 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
|
|
2221 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
|
|
2222 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
|
|
2223 #define SECURITY_NT_NON_UNIQUE 0x00000015L
|
|
2224 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
|
|
2225
|
|
2226 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
|
|
2227 #define DOMAIN_GROUP_RID_USERS 0x00000201L
|
|
2228 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
|
|
2229
|
|
2230 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
|
|
2231 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
|
|
2232 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
|
|
2233
|
|
2234 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
|
|
2235
|
|
2236 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
|
|
2237
|
|
2238 /*
|
|
2239 * TOKEN_USER
|
|
2240 */
|
|
2241
|
|
2242 typedef struct _TOKEN_USER {
|
|
2243 SID_AND_ATTRIBUTES User;
|
|
2244 } TOKEN_USER;
|
|
2245
|
|
2246 /*
|
|
2247 * TOKEN_GROUPS
|
|
2248 */
|
|
2249
|
|
2250 typedef struct _TOKEN_GROUPS {
|
|
2251 DWORD GroupCount;
|
|
2252 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
|
|
2253 } TOKEN_GROUPS;
|
|
2254
|
|
2255 /*
|
|
2256 * LUID_AND_ATTRIBUTES
|
|
2257 */
|
|
2258
|
|
2259 typedef union _LARGE_INTEGER {
|
|
2260 struct {
|
|
2261 DWORD LowPart;
|
|
2262 LONG HighPart;
|
|
2263 } DUMMYSTRUCTNAME;
|
|
2264 LONGLONG QuadPart;
|
|
2265 } LARGE_INTEGER, *LPLARGE_INTEGER, *PLARGE_INTEGER;
|
|
2266
|
|
2267 typedef union _ULARGE_INTEGER {
|
|
2268 struct {
|
|
2269 DWORD LowPart;
|
|
2270 LONG HighPart;
|
|
2271 } DUMMYSTRUCTNAME;
|
|
2272 LONGLONG QuadPart;
|
|
2273 } ULARGE_INTEGER, *LPULARGE_INTEGER, *PULARGE_INTEGER;
|
|
2274
|
|
2275 /*
|
|
2276 * Locally Unique Identifier
|
|
2277 */
|
|
2278
|
|
2279 typedef LARGE_INTEGER LUID,*PLUID;
|
|
2280
|
|
2281 typedef struct _LUID_AND_ATTRIBUTES {
|
|
2282 LUID Luid;
|
|
2283 DWORD Attributes;
|
|
2284 } LUID_AND_ATTRIBUTES;
|
|
2285
|
|
2286 /*
|
|
2287 * PRIVILEGE_SET
|
|
2288 */
|
|
2289
|
|
2290 typedef struct _PRIVILEGE_SET {
|
|
2291 DWORD PrivilegeCount;
|
|
2292 DWORD Control;
|
|
2293 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
|
|
2294 } PRIVILEGE_SET, *PPRIVILEGE_SET;
|
|
2295
|
|
2296 /*
|
|
2297 * TOKEN_PRIVILEGES
|
|
2298 */
|
|
2299
|
|
2300 typedef struct _TOKEN_PRIVILEGES {
|
|
2301 DWORD PrivilegeCount;
|
|
2302 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
|
|
2303 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
|
|
2304
|
|
2305 /*
|
|
2306 * TOKEN_OWNER
|
|
2307 */
|
|
2308
|
|
2309 typedef struct _TOKEN_OWNER {
|
|
2310 PSID Owner;
|
|
2311 } TOKEN_OWNER;
|
|
2312
|
|
2313 /*
|
|
2314 * TOKEN_PRIMARY_GROUP
|
|
2315 */
|
|
2316
|
|
2317 typedef struct _TOKEN_PRIMARY_GROUP {
|
|
2318 PSID PrimaryGroup;
|
|
2319 } TOKEN_PRIMARY_GROUP;
|
|
2320
|
|
2321
|
|
2322 /*
|
|
2323 * TOKEN_DEFAULT_DACL
|
|
2324 */
|
|
2325
|
|
2326 typedef struct _TOKEN_DEFAULT_DACL {
|
|
2327 PACL DefaultDacl;
|
|
2328 } TOKEN_DEFAULT_DACL;
|
|
2329
|
|
2330 /*
|
|
2331 * TOKEN_SOURCEL
|
|
2332 */
|
|
2333
|
|
2334 typedef struct _TOKEN_SOURCE {
|
|
2335 char Sourcename[8];
|
|
2336 LUID SourceIdentifier;
|
|
2337 } TOKEN_SOURCE;
|
|
2338
|
|
2339 /*
|
|
2340 * TOKEN_TYPE
|
|
2341 */
|
|
2342
|
|
2343 typedef enum tagTOKEN_TYPE {
|
|
2344 TokenPrimary = 1,
|
|
2345 TokenImpersonation
|
|
2346 } TOKEN_TYPE;
|
|
2347
|
|
2348 /*
|
|
2349 * SECURITY_IMPERSONATION_LEVEL
|
|
2350 */
|
|
2351
|
|
2352 typedef enum _SECURITY_IMPERSONATION_LEVEL {
|
|
2353 SecurityAnonymous,
|
|
2354 SecurityIdentification,
|
|
2355 SecurityImpersonation,
|
|
2356 SecurityDelegation
|
|
2357 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
|
|
2358
|
|
2359
|
|
2360 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
|
|
2361 * PSECURITY_CONTEXT_TRACKING_MODE;
|
|
2362 /*
|
|
2363 * Quality of Service
|
|
2364 */
|
|
2365
|
|
2366 typedef struct _SECURITY_QUALITY_OF_SERVICE {
|
|
2367 DWORD Length;
|
|
2368 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
|
|
2369 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
|
|
2370 WIN_BOOL EffectiveOnly;
|
|
2371 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
|
|
2372
|
|
2373 /*
|
|
2374 * TOKEN_STATISTICS
|
|
2375 */
|
|
2376
|
|
2377 typedef struct _TOKEN_STATISTICS {
|
|
2378 LUID TokenId;
|
|
2379 LUID AuthenticationId;
|
|
2380 LARGE_INTEGER ExpirationTime;
|
|
2381 TOKEN_TYPE TokenType;
|
|
2382 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
|
|
2383 DWORD DynamicCharged;
|
|
2384 DWORD DynamicAvailable;
|
|
2385 DWORD GroupCount;
|
|
2386 DWORD PrivilegeCount;
|
|
2387 LUID ModifiedId;
|
|
2388 } TOKEN_STATISTICS;
|
|
2389
|
|
2390 /*
|
|
2391 * ACLs of NT
|
|
2392 */
|
|
2393
|
|
2394 #define ACL_REVISION 2
|
|
2395
|
|
2396 #define ACL_REVISION1 1
|
|
2397 #define ACL_REVISION2 2
|
|
2398
|
|
2399 /* ACEs, directly starting after an ACL */
|
|
2400 typedef struct _ACE_HEADER {
|
|
2401 BYTE AceType;
|
|
2402 BYTE AceFlags;
|
|
2403 WORD AceSize;
|
|
2404 } ACE_HEADER,*PACE_HEADER;
|
|
2405
|
|
2406 /* AceType */
|
|
2407 #define ACCESS_ALLOWED_ACE_TYPE 0
|
|
2408 #define ACCESS_DENIED_ACE_TYPE 1
|
|
2409 #define SYSTEM_AUDIT_ACE_TYPE 2
|
|
2410 #define SYSTEM_ALARM_ACE_TYPE 3
|
|
2411
|
|
2412 /* inherit AceFlags */
|
|
2413 #define OBJECT_INHERIT_ACE 0x01
|
|
2414 #define CONTAINER_INHERIT_ACE 0x02
|
|
2415 #define NO_PROPAGATE_INHERIT_ACE 0x04
|
|
2416 #define INHERIT_ONLY_ACE 0x08
|
|
2417 #define VALID_INHERIT_FLAGS 0x0F
|
|
2418
|
|
2419 /* AceFlags mask for what events we (should) audit */
|
|
2420 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
|
|
2421 #define FAILED_ACCESS_ACE_FLAG 0x80
|
|
2422
|
|
2423 /* different ACEs depending on AceType
|
|
2424 * SidStart marks the begin of a SID
|
|
2425 * so the thing finally looks like this:
|
|
2426 * 0: ACE_HEADER
|
|
2427 * 4: ACCESS_MASK
|
|
2428 * 8... : SID
|
|
2429 */
|
|
2430 typedef struct _ACCESS_ALLOWED_ACE {
|
|
2431 ACE_HEADER Header;
|
|
2432 DWORD Mask;
|
|
2433 DWORD SidStart;
|
|
2434 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
|
|
2435
|
|
2436 typedef struct _ACCESS_DENIED_ACE {
|
|
2437 ACE_HEADER Header;
|
|
2438 DWORD Mask;
|
|
2439 DWORD SidStart;
|
|
2440 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
|
|
2441
|
|
2442 typedef struct _SYSTEM_AUDIT_ACE {
|
|
2443 ACE_HEADER Header;
|
|
2444 DWORD Mask;
|
|
2445 DWORD SidStart;
|
|
2446 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
|
|
2447
|
|
2448 typedef struct _SYSTEM_ALARM_ACE {
|
|
2449 ACE_HEADER Header;
|
|
2450 DWORD Mask;
|
|
2451 DWORD SidStart;
|
|
2452 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
|
|
2453
|
|
2454 typedef enum tagSID_NAME_USE {
|
|
2455 SidTypeUser = 1,
|
|
2456 SidTypeGroup,
|
|
2457 SidTypeDomain,
|
|
2458 SidTypeAlias,
|
|
2459 SidTypeWellKnownGroup,
|
|
2460 SidTypeDeletedAccount,
|
|
2461 SidTypeInvalid,
|
|
2462 SidTypeUnknown
|
|
2463 } SID_NAME_USE,*PSID_NAME_USE;
|
|
2464
|
|
2465 /* Access rights */
|
|
2466
|
|
2467 #define DELETE 0x00010000
|
|
2468 #define READ_CONTROL 0x00020000
|
|
2469 #define WRITE_DAC 0x00040000
|
|
2470 #define WRITE_OWNER 0x00080000
|
|
2471 #define SYNCHRONIZE 0x00100000
|
|
2472 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
|
|
2473
|
|
2474 #define STANDARD_RIGHTS_READ READ_CONTROL
|
|
2475 #define STANDARD_RIGHTS_WRITE READ_CONTROL
|
|
2476 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
|
|
2477
|
|
2478 #define STANDARD_RIGHTS_ALL 0x001f0000
|
|
2479
|
|
2480 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
|
|
2481
|
|
2482 #define GENERIC_READ 0x80000000
|
|
2483 #define GENERIC_WRITE 0x40000000
|
|
2484 #define GENERIC_EXECUTE 0x20000000
|
|
2485 #define GENERIC_ALL 0x10000000
|
|
2486
|
|
2487 #define MAXIMUM_ALLOWED 0x02000000
|
|
2488 #define ACCESS_SYSTEM_SECURITY 0x01000000
|
|
2489
|
|
2490 #define EVENT_MODIFY_STATE 0x0002
|
|
2491 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
|
|
2492
|
|
2493 #define SEMAPHORE_MODIFY_STATE 0x0002
|
|
2494 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
|
|
2495
|
|
2496 #define MUTEX_MODIFY_STATE 0x0001
|
|
2497 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
|
|
2498
|
|
2499 #define PROCESS_TERMINATE 0x0001
|
|
2500 #define PROCESS_CREATE_THREAD 0x0002
|
|
2501 #define PROCESS_VM_OPERATION 0x0008
|
|
2502 #define PROCESS_VM_READ 0x0010
|
|
2503 #define PROCESS_VM_WRITE 0x0020
|
|
2504 #define PROCESS_DUP_HANDLE 0x0040
|
|
2505 #define PROCESS_CREATE_PROCESS 0x0080
|
|
2506 #define PROCESS_SET_QUOTA 0x0100
|
|
2507 #define PROCESS_SET_INFORMATION 0x0200
|
|
2508 #define PROCESS_QUERY_INFORMATION 0x0400
|
|
2509 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
|
|
2510
|
|
2511 #define THREAD_TERMINATE 0x0001
|
|
2512 #define THREAD_SUSPEND_RESUME 0x0002
|
|
2513 #define THREAD_GET_CONTEXT 0x0008
|
|
2514 #define THREAD_SET_CONTEXT 0x0010
|
|
2515 #define THREAD_SET_INFORMATION 0x0020
|
|
2516 #define THREAD_QUERY_INFORMATION 0x0040
|
|
2517 #define THREAD_SET_THREAD_TOKEN 0x0080
|
|
2518 #define THREAD_IMPERSONATE 0x0100
|
|
2519 #define THREAD_DIRECT_IMPERSONATION 0x0200
|
|
2520 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
|
|
2521
|
|
2522 #define THREAD_BASE_PRIORITY_LOWRT 15
|
|
2523 #define THREAD_BASE_PRIORITY_MAX 2
|
|
2524 #define THREAD_BASE_PRIORITY_MIN -2
|
|
2525 #define THREAD_BASE_PRIORITY_IDLE -15
|
|
2526
|
|
2527 #define FILE_READ_DATA 0x0001 /* file & pipe */
|
|
2528 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
|
|
2529 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
|
|
2530 #define FILE_ADD_FILE 0x0002 /* directory */
|
|
2531 #define FILE_APPEND_DATA 0x0004 /* file */
|
|
2532 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
|
|
2533 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
|
|
2534 #define FILE_READ_EA 0x0008 /* file & directory */
|
|
2535 #define FILE_READ_PROPERTIES FILE_READ_EA
|
|
2536 #define FILE_WRITE_EA 0x0010 /* file & directory */
|
|
2537 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
|
|
2538 #define FILE_EXECUTE 0x0020 /* file */
|
|
2539 #define FILE_TRAVERSE 0x0020 /* directory */
|
|
2540 #define FILE_DELETE_CHILD 0x0040 /* directory */
|
|
2541 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
|
|
2542 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
|
|
2543 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
|
|
2544
|
|
2545 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
|
|
2546 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
|
|
2547 SYNCHRONIZE)
|
|
2548 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
|
|
2549 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
|
|
2550 FILE_APPEND_DATA | SYNCHRONIZE)
|
|
2551 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
|
|
2552 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
|
|
2553
|
|
2554
|
|
2555 /* File attribute flags
|
|
2556 */
|
|
2557 #define FILE_SHARE_READ 0x00000001L
|
|
2558 #define FILE_SHARE_WRITE 0x00000002L
|
|
2559 #define FILE_SHARE_DELETE 0x00000004L
|
|
2560 #define FILE_ATTRIBUTE_READONLY 0x00000001L
|
|
2561 #define FILE_ATTRIBUTE_HIDDEN 0x00000002L
|
|
2562 #define FILE_ATTRIBUTE_SYSTEM 0x00000004L
|
|
2563 #define FILE_ATTRIBUTE_LABEL 0x00000008L /* Not in Windows API */
|
|
2564 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010L
|
|
2565 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020L
|
|
2566 #define FILE_ATTRIBUTE_NORMAL 0x00000080L
|
|
2567 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100L
|
|
2568 #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200L
|
|
2569 #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
|
|
2570 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
|
|
2571 #define FILE_ATTRIBUTE_OFFLINE 0x00001000L
|
|
2572
|
|
2573 /* File alignments (NT) */
|
|
2574 #define FILE_BYTE_ALIGNMENT 0x00000000
|
|
2575 #define FILE_WORD_ALIGNMENT 0x00000001
|
|
2576 #define FILE_LONG_ALIGNMENT 0x00000003
|
|
2577 #define FILE_QUAD_ALIGNMENT 0x00000007
|
|
2578 #define FILE_OCTA_ALIGNMENT 0x0000000f
|
|
2579 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
|
|
2580 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
|
|
2581 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
|
|
2582 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
|
|
2583 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
|
|
2584
|
|
2585 #define REG_NONE 0 /* no type */
|
|
2586 #define REG_SZ 1 /* string type (ASCII) */
|
|
2587 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
|
|
2588 #define REG_BINARY 3 /* binary format, callerspecific */
|
|
2589 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
|
|
2590 #define REG_DWORD 4 /* DWORD in little endian format */
|
|
2591 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
|
|
2592 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
|
|
2593 #define REG_LINK 6 /* symbolic link (UNICODE) */
|
|
2594 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
|
|
2595 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
|
|
2596 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
|
|
2597 #define REG_RESOURCE_REQUIREMENTS_LIST 10
|
|
2598
|
|
2599 /* ----------------------------- begin registry ----------------------------- */
|
|
2600
|
|
2601 /* Registry security values */
|
|
2602 #define OWNER_SECURITY_INFORMATION 0x00000001
|
|
2603 #define GROUP_SECURITY_INFORMATION 0x00000002
|
|
2604 #define DACL_SECURITY_INFORMATION 0x00000004
|
|
2605 #define SACL_SECURITY_INFORMATION 0x00000008
|
|
2606
|
|
2607 #define REG_OPTION_RESERVED 0x00000000
|
|
2608 #define REG_OPTION_NON_VOLATILE 0x00000000
|
|
2609 #define REG_OPTION_VOLATILE 0x00000001
|
|
2610 #define REG_OPTION_CREATE_LINK 0x00000002
|
|
2611 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
|
|
2612 #define REG_OPTION_OPEN_LINK 0x00000008
|
|
2613 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
|
|
2614 REG_OPTION_NON_VOLATILE| \
|
|
2615 REG_OPTION_VOLATILE| \
|
|
2616 REG_OPTION_CREATE_LINK| \
|
|
2617 REG_OPTION_BACKUP_RESTORE| \
|
|
2618 REG_OPTION_OPEN_LINK)
|
|
2619
|
|
2620
|
|
2621 #define REG_CREATED_NEW_KEY 0x00000001
|
|
2622 #define REG_OPENED_EXISTING_KEY 0x00000002
|
|
2623
|
|
2624 /* For RegNotifyChangeKeyValue */
|
|
2625 #define REG_NOTIFY_CHANGE_NAME 0x1
|
|
2626
|
|
2627 #define KEY_QUERY_VALUE 0x00000001
|
|
2628 #define KEY_SET_VALUE 0x00000002
|
|
2629 #define KEY_CREATE_SUB_KEY 0x00000004
|
|
2630 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
|
|
2631 #define KEY_NOTIFY 0x00000010
|
|
2632 #define KEY_CREATE_LINK 0x00000020
|
|
2633
|
|
2634 #define KEY_READ ((STANDARD_RIGHTS_READ| \
|
|
2635 KEY_QUERY_VALUE| \
|
|
2636 KEY_ENUMERATE_SUB_KEYS| \
|
|
2637 KEY_NOTIFY) \
|
|
2638 & (~SYNCHRONIZE) \
|
|
2639 )
|
|
2640 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
|
|
2641 KEY_SET_VALUE| \
|
|
2642 KEY_CREATE_SUB_KEY) \
|
|
2643 & (~SYNCHRONIZE) \
|
|
2644 )
|
|
2645 #define KEY_EXECUTE ((KEY_READ) \
|
|
2646 & (~SYNCHRONIZE)) \
|
|
2647 )
|
|
2648 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
|
|
2649 KEY_QUERY_VALUE| \
|
|
2650 KEY_SET_VALUE| \
|
|
2651 KEY_CREATE_SUB_KEY| \
|
|
2652 KEY_ENUMERATE_SUB_KEYS| \
|
|
2653 KEY_NOTIFY| \
|
|
2654 KEY_CREATE_LINK) \
|
|
2655 & (~SYNCHRONIZE) \
|
|
2656 )
|
|
2657 /* ------------------------------ end registry ------------------------------ */
|
|
2658
|
|
2659
|
|
2660 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
|
|
2661 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
|
|
2662 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
|
|
2663 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
|
|
2664 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
|
|
2665
|
|
2666 #include "poppack.h"
|
|
2667
|
|
2668 #endif /* __WINE_WINNT_H */
|