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