source: branch/egtra-gdiplus/WinNT.ab

Last change on this file was 237, checked in by イグトランス (egtra), 18 years ago

#_fullcompileで検出されたエラーの修正(明らかに判るもののみ)

File size: 217.6 KB
Line 
1' winnt.ab
2
3#ifndef _WINNT_
4#define _WINNT_
5
6'#include <ctype.h>
7Const ANYSIZE_ARRAY = 1
8
9'#include <specstrings.h>
10
11'RESTRICTED_POINTER
12
13'UNALIGNED
14'UNALIGNED64
15
16#ifdef _WIN64
17Const MAX_NATURAL_ALIGNMENT = SizeOf (QWord)
18Const MEMORY_ALLOCATION_ALIGNMENT = 16
19#else
20Const MAX_NATURAL_ALIGNMENT = SizeOf (DWord)
21Const MEMORY_ALLOCATION_ALIGNMENT = 8
22#endif
23
24'TYPE_ALIGNMENT
25'PROBE_ALIGNMENT
26'PROBE_ALIGNMENT32
27
28'Const C_ASSERT(e) = 0
29
30'#require <basetsd.ab>
31#ifdef _WIN64
32TypeDef LONG_PTR = Int64
33TypeDef ULONG_PTR = QWord
34TypeDef HALF_PTR = Long
35TypeDef UHALF_PTR = DWord
36#else
37TypeDef LONG_PTR = Long
38TypeDef ULONG_PTR = DWord
39TypeDef HALF_PTR = Integer
40TypeDef UHALF_PTR = Word
41#endif
42TypeDef DWORD_PTR = ULONG_PTR
43
44TypeDef SIZE_T = ULONG_PTR
45TypeDef SSIZE_T = LONG_PTR
46
47Const SYSTEM_CACHE_ALIGNMENT_SIZE = 64
48
49Const DECLSPEC_CACHEALIGN = 4
50/*
51#ifdef DEPRECATE_DDK_FUNCTIONS
52#ifdef _NTDDK_
53#define DECLSPEC_DEPRECATED_DDK DECLSPEC_DEPRECATED
54#ifdef DEPRECATE_SUPPORTED
55#define PRAGMA_DEPRECATED_DDK 1
56#endif
57#else
58#define DECLSPEC_DEPRECATED_DDK
59#define PRAGMA_DEPRECATED_DDK 1
60#endif
61#else
62#define DECLSPEC_DEPRECATED_DDK
63#define PRAGMA_DEPRECATED_DDK 0
64#endif
65*/
66
67TypeDef PVOID = VoidPtr
68#ifdef _WIN64
69TypeDef PVOID64 = VoidPtr
70#else
71TypeDef PVOID64 = QWord
72#endif
73
74'#ifndef VOID
75'#define VOID void
76TypeDef CHAR = SByte
77TypeDef SHORT = Integer
78TypeDef LONG = Long
79TypeDef INT = Long
80'#endif
81
82TypeDef WCHAR = Word
83
84TypeDef PWCHAR = *WCHAR
85TypeDef LPWCH = *WCHAR
86TypeDef PWCH = *WCHAR
87TypeDef LPCWCH = *WCHAR
88TypeDef NWPSTR = *WCHAR
89TypeDef LPWSTR = *WCHAR
90TypeDef PWSTR = *WCHAR
91TypeDef PZPWSTR = *PWSTR
92TypeDef PCZPWSTR = *PWSTR
93TypeDef LPUWSTR = *WCHAR
94TypeDef PUWSTR = *WCHAR
95TypeDef LPCWSTR = *WCHAR
96TypeDef PCWSTR = *WCHAR
97TypeDef PZPCWSTR = *PCWSTR
98TypeDef LPCUWSTR = *WCHAR
99TypeDef PCUWSTR = *WCHAR
100
101TypeDef LPCWCHAR = *WCHAR
102TypeDef PCWCHAR = *WCHAR
103TypeDef LPCUWCHAR = *WCHAR
104TypeDef PCUWCHAR = *WCHAR
105
106TypeDef UCSCHAR = DWord
107
108Const UCSCHAR_INVALID_CHARACTER = &hffffffff As UCSCHAR
109Const MIN_UCSCHAR = 0 As UCSCHAR
110Const MAX_UCSCHAR = &h0010ffff As UCSCHAR
111
112TypeDef PUCSCHAR = *UCSCHAR
113TypeDef PCUCSCHAR = *UCSCHAR
114
115TypeDef PUCSSTR = *UCSCHAR
116TypeDef PUUCSSTR = *UCSCHAR
117
118TypeDef PCUCSSTR = *UCSCHAR
119TypeDef PCUUCSSTR = *UCSCHAR
120
121TypeDef PUUCSCHAR = *UCSCHAR
122TypeDef PCUUCSCHAR = *UCSCHAR
123
124TypeDef PCHAR = *CHAR
125TypeDef LPCH = *CHAR
126TypeDef PCH = *CHAR
127TypeDef LPCCH = *CHAR
128TypeDef PCCH = *CHAR
129
130TypeDef NPSTR = *CHAR
131TypeDef LPSTR = *CHAR
132TypeDef PSTR = *CHAR
133TypeDef PZPSTR = *PSTR
134TypeDef PCZPSTR = *PSTR
135TypeDef PCSTR = *CHAR
136TypeDef LPCSTR = *CHAR
137TypeDef PZPCSTR = *PCSTR
138
139#ifdef UNICODE
140
141#ifndef _TCHAR_DEFINED
142TypeDef TCHAR = WCHAR
143TypeDef PTCHAR = *WCHAR
144TypeDef TBYTE = WCHAR
145TypeDef PTBYTE = *WCHAR
146#define _TCHAR_DEFINED
147#endif
148
149TypeDef PTCH = PWCH
150TypeDef LPTCH = LPWCH
151TypeDef PTSTR = PWSTR
152TypeDef LPTSTR = LPWSTR
153TypeDef PCTSTR = PCWSTR
154TypeDef LPCTSTR = LPCWSTR
155TypeDef PUTSTR = PUWSTR
156TypeDef LPUTSTR = LPUWSTR
157TypeDef PCUTSTR = PCUWSTR
158TypeDef LPCUTSTR = LPCUWSTR
159'TypeDef LP = LPWSTR
160
161#else
162
163#ifndef _TCHAR_DEFINED
164TypeDef TCHAR = Char
165TypeDef PTCHAR = *Char
166TypeDef TBYTE = Byte
167TypeDef PTBYTE = *Byte
168#define _TCHAR_DEFINED
169#endif
170
171TypeDef PTCH = PCH
172TypeDef LPTCH = LPCH
173TypeDef PTSTR = PSTR
174TypeDef LPTSTR = LPSTR
175TypeDef PUTSTR = PSTR
176TypeDef LPUTSTR = LPSTR
177TypeDef PCTSTR = PCSTR
178TypeDef LPCTSTR = LPCSTR
179TypeDef PCUTSTR = PCSTR
180TypeDef LPCUTSTR = LPCSTR
181#endif
182
183'TypeDef PSHORT = SHORT
184'TypeDef PLONG = *Long
185
186TypeDef HANDLE = VoidPtr
187TypeDef PHANDLE = *HANDLE
188
189TypeDef FCHAR = Byte
190TypeDef FSHORT = Word
191TypeDef FLONG = DWord
192
193#ifndef _HRESULT_DEFINED
194#define _HRESULT_DEFINED
195TypeDef HRESULT = Long
196#endif
197
198TypeDef CCHAR = CHAR
199TypeDef LCID = DWord
200TypeDef PLCID = *DWord
201TypeDef LANGID = Word
202Const APPLICATION_ERROR_MASK = &h20000000
203Const ERROR_SEVERITY_SUCCESS = &h00000000
204Const ERROR_SEVERITY_INFORMATIONAL = &h40000000
205Const ERROR_SEVERITY_WARNING = &h80000000
206Const ERROR_SEVERITY_ERROR = &hC0000000
207
208Type FLOAT128
209 LowPart As Int64
210 HighPart As Int64
211End Type
212TypeDef PFLOAT128 = FLOAT128
213
214'#define _ULONGLONG_
215TypeDef LONGLONG = Int64
216TypeDef ULONGLONG = QWord
217
218Const MAXLONGLONG = (&h7fffffffffffffff)
219'#endif
220
221TypeDef PLONGLONG = *LONGLONG
222TypeDef PULONGLONG = *ULONGLONG
223
224TypeDef USN = LONGLONG
225
226Type LARGE_INTEGER
227 LowPart As DWord
228 HighPart As Long
229End Type
230TypeDef PLARGE_INTEGER = *LARGE_INTEGER
231
232Type ULARGE_INTEGER
233 LowPart As DWord
234 HighPart As DWord
235End Type
236TypeDef PULARGE_INTEGER = *ULARGE_INTEGER
237
238Type LUID
239 LowPart As DWord
240 HighPart As Long
241End Type
242TypeDef PLUID = *LUID
243
244'#define _DWORDLONG_
245'TypeDef DWORDLONG = ULONGLONG
246'TypeDef PDWORDLONG = DWORDLONG
247
248Const Int32x32To64(a, b) = (((a) As Long) As Int64 * ((b) As Long) As Int64)
249Const UInt32x32To64(a, b) = (((a) As DWord) As QWord * ((b) As DWord) As QWord)
250Const Int64ShllMod32(a, b) = ((a) As QWord << (b))
251Const Int64ShraMod32(a, b) = ((a) As Int64 >> (b))
252Const Int64ShrlMod32(a, b) = ((a) As QWord >> (b))
253
254Const ANSI_NULL = (0 As CHAR)
255Const UNICODE_NULL = (0 As WCHAR)
256Const UNICODE_STRING_MAX_BYTES = (65534 As Word)
257Const UNICODE_STRING_MAX_CHARS = (32767)
258TypeDef BOOLEAN = BYTE
259TypeDef PBOOLEAN = *BOOLEAN
260
261Type LIST_ENTRY
262 Flink As *LIST_ENTRY
263 Blink As *LIST_ENTRY
264End Type
265TypeDef PLIST_ENTRY = *LIST_ENTRY
266TypeDef PRLIST_ENTRY = *LIST_ENTRY
267
268Type SINGLE_LIST_ENTRY
269 Next As *SINGLE_LIST_ENTRY
270End Type
271TypeDef PSINGLE_LIST_ENTRY = *SINGLE_LIST_ENTRY
272
273Type LIST_ENTRY32
274 Flink As DWord
275 Blink As DWord
276End Type
277TypeDef PLIST_ENTRY32 = *LIST_ENTRY32
278
279Type LIST_ENTRY64
280 Flink As QWord
281 Blink As QWord
282End Type
283TypeDef PLIST_ENTRY64 = *LIST_ENTRY64
284
285#require <guiddef.ab>
286
287#ifndef __OBJECTID_DEFINED
288#define __OBJECTID_DEFINED
289
290Type OBJECTID
291 Lineage As GUID
292 Uniquifier As DWord
293End Type
294#endif
295
296Const MINCHAR = &h80
297Const MAXCHAR = &h7f
298Const MINSHORT = &h8000
299Const MAXSHORT = &h7fff
300Const MINLONG = &h80000000
301Const MAXLONG = &h7fffffff
302Const MAXBYTE = &hff
303Const MAXWORD = &hffff
304Const MAXDWORD = &hffffffff
305
306'FIELD_OFFSET
307'RTL_FIELD_SIZE
308'RTL_SIZEOF_THROUGH_FIELD
309'RTL_CONTAINS_FIELD
310Const RTL_NUMBER_OF_V1(A) = (Len (A) \ Len(A[0]))
311'RtlpNumberOf
312Const RTL_NUMBER_OF(A) = RTL_NUMBER_OF_V1(A)
313Const ARRAYSIZE(A) = RTL_NUMBER_OF_V1(A) 'RTL_NUMBER_OF_V2(A)
314Const _ARRAYSIZE(A) = RTL_NUMBER_OF_V1(A)
315'RTL_FIELD_TYPE
316'RTL_NUMBER_OF_FIELD
317'RTL_PADDING_BETWEEN_FIELDS
318'RTL_CONST_CAST
319'RTL_BITS_OF
320'RTL_BITS_OF_FIELD
321'CONTAINING_RECORD
322
323Const VER_SERVER_NT = &h80000000
324Const VER_WORKSTATION_NT = &h40000000
325Const VER_SUITE_SMALLBUSINESS = &h00000001
326Const VER_SUITE_ENTERPRISE = &h00000002
327Const VER_SUITE_BACKOFFICE = &h00000004
328Const VER_SUITE_COMMUNICATIONS = &h00000008
329Const VER_SUITE_TERMINAL = &h00000010
330Const VER_SUITE_SMALLBUSINESS_RESTRICTED = &h00000020
331Const VER_SUITE_EMBEDDEDNT = &h00000040
332Const VER_SUITE_DATACENTER = &h00000080
333Const VER_SUITE_SINGLEUSERTS = &h00000100
334Const VER_SUITE_PERSONAL = &h00000200
335Const VER_SUITE_BLADE = &h00000400
336Const VER_SUITE_EMBEDDED_RESTRICTED = &h00000800
337Const VER_SUITE_SECURITY_APPLIANCE = &h00001000
338Const VER_SUITE_STORAGE_SERVER = &h00002000
339Const VER_SUITE_COMPUTE_SERVER = &h00004000
340
341Const PRODUCT_UNDEFINED = &h00000000
342
343Const PRODUCT_ULTIMATE = &h00000001
344Const PRODUCT_HOME_BASIC = &h00000002
345Const PRODUCT_HOME_PREMIUM = &h00000003
346Const PRODUCT_ENTERPRISE = &h00000004
347Const PRODUCT_HOME_BASIC_N = &h00000005
348Const PRODUCT_BUSINESS = &h00000006
349Const PRODUCT_STANDARD_SERVER = &h00000007
350Const PRODUCT_DATACENTER_SERVER = &h00000008
351Const PRODUCT_SMALLBUSINESS_SERVER = &h00000009
352Const PRODUCT_ENTERPRISE_SERVER = &h0000000A
353Const PRODUCT_STARTER = &h0000000B
354Const PRODUCT_DATACENTER_SERVER_CORE = &h0000000C
355Const PRODUCT_STANDARD_SERVER_CORE = &h0000000D
356Const PRODUCT_ENTERPRISE_SERVER_CORE = &h0000000E
357Const PRODUCT_ENTERPRISE_SERVER_IA64 = &h0000000F
358Const PRODUCT_BUSINESS_N = &h00000010
359Const PRODUCT_WEB_SERVER = &h00000011
360Const PRODUCT_CLUSTER_SERVER = &h00000012
361Const PRODUCT_HOME_SERVER = &h00000013
362Const PRODUCT_STORAGE_EXPRESS_SERVER = &h00000014
363Const PRODUCT_STORAGE_STANDARD_SERVER = &h00000015
364Const PRODUCT_STORAGE_WORKGROUP_SERVER = &h00000016
365Const PRODUCT_STORAGE_ENTERPRISE_SERVER = &h00000017
366Const PRODUCT_SERVER_FOR_SMALLBUSINESS = &h00000018
367Const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = &h00000019
368
369Const PRODUCT_UNLICENSED = &hABCDABCD
370
371'#require <sdkddkver.ab>
372
373' Primary language IDs.
374Const LANG_NEUTRAL = &h00
375Const LANG_INVARIANT = &h7f
376
377Const LANG_AFRIKAANS = &h36
378Const LANG_ALBANIAN = &h1c
379Const LANG_ALSATIAN = &h84
380Const LANG_AMHARIC = &h5e
381Const LANG_ARABIC = &h01
382Const LANG_ARMENIAN = &h2b
383Const LANG_ASSAMESE = &h4d
384Const LANG_AZERI = &h2c
385Const LANG_BASHKIR = &h6d
386Const LANG_BASQUE = &h2d
387Const LANG_BELARUSIAN = &h23
388Const LANG_BENGALI = &h45
389Const LANG_BRETON = &h7e
390Const LANG_BOSNIAN = &h1a
391Const LANG_BOSNIAN_NEUTRAL = &h781a
392Const LANG_BULGARIAN = &h02
393Const LANG_CATALAN = &h03
394Const LANG_CHINESE = &h04
395Const LANG_CHINESE_SIMPLIFIED = &h04
396Const LANG_CHINESE_TRADITIONAL = &h7c04
397Const LANG_CORSICAN = &h83
398Const LANG_CROATIAN = &h1a
399Const LANG_CZECH = &h05
400Const LANG_DANISH = &h06
401Const LANG_DARI = &h8c
402Const LANG_DIVEHI = &h65
403Const LANG_DUTCH = &h13
404Const LANG_ENGLISH = &h09
405Const LANG_ESTONIAN = &h25
406Const LANG_FAEROESE = &h38
407Const LANG_FARSI = &h29
408Const LANG_FILIPINO = &h64
409Const LANG_FINNISH = &h0b
410Const LANG_FRENCH = &h0c
411Const LANG_FRISIAN = &h62
412Const LANG_GALICIAN = &h56
413Const LANG_GEORGIAN = &h37
414Const LANG_GERMAN = &h07
415Const LANG_GREEK = &h08
416Const LANG_GREENLANDIC = &h6f
417Const LANG_GUJARATI = &h47
418Const LANG_HAUSA = &h68
419Const LANG_HEBREW = &h0d
420Const LANG_HINDI = &h39
421Const LANG_HUNGARIAN = &h0e
422Const LANG_ICELANDIC = &h0f
423Const LANG_IGBO = &h70
424Const LANG_INDONESIAN = &h21
425Const LANG_INUKTITUT = &h5d
426Const LANG_IRISH = &h3c
427Const LANG_ITALIAN = &h10
428Const LANG_JAPANESE = &h11
429Const LANG_KANNADA = &h4b
430Const LANG_KASHMIRI = &h60
431Const LANG_KAZAK = &h3f
432Const LANG_KHMER = &h53
433Const LANG_KICHE = &h86
434Const LANG_KINYARWANDA = &h87
435Const LANG_KONKANI = &h57
436Const LANG_KOREAN = &h12
437Const LANG_KYRGYZ = &h40
438Const LANG_LAO = &h54
439Const LANG_LATVIAN = &h26
440Const LANG_LITHUANIAN = &h27
441Const LANG_LOWER_SORBIAN = &h2e
442Const LANG_LUXEMBOURGISH = &h6e
443Const LANG_MACEDONIAN = &h2f
444Const LANG_MALAY = &h3e
445Const LANG_MALAYALAM = &h4c
446Const LANG_MALTESE = &h3a
447Const LANG_MANIPURI = &h58
448Const LANG_MAORI = &h81
449Const LANG_MAPUDUNGUN = &h7a
450Const LANG_MARATHI = &h4e
451Const LANG_MOHAWK = &h7c
452Const LANG_MONGOLIAN = &h50
453Const LANG_NEPALI = &h61
454Const LANG_NORWEGIAN = &h14
455Const LANG_OCCITAN = &h82
456Const LANG_ORIYA = &h48
457Const LANG_PASHTO = &h63
458Const LANG_PERSIAN = &h29
459Const LANG_POLISH = &h15
460Const LANG_PORTUGUESE = &h16
461Const LANG_PUNJABI = &h46
462Const LANG_QUECHUA = &h6b
463Const LANG_ROMANIAN = &h18
464Const LANG_ROMANSH = &h17
465Const LANG_RUSSIAN = &h19
466Const LANG_SAMI = &h3b
467Const LANG_SANSKRIT = &h4f
468Const LANG_SERBIAN = &h1a
469Const LANG_SERBIAN_NEUTRAL = &h7c1a
470Const LANG_SINDHI = &h59
471Const LANG_SINHALESE = &h5b
472Const LANG_SLOVAK = &h1b
473Const LANG_SLOVENIAN = &h24
474Const LANG_SOTHO = &h6c
475Const LANG_SPANISH = &h0a
476Const LANG_SWAHILI = &h41
477Const LANG_SWEDISH = &h1d
478Const LANG_SYRIAC = &h5a
479Const LANG_TAJIK = &h28
480Const LANG_TAMAZIGHT = &h5f
481Const LANG_TAMIL = &h49
482Const LANG_TATAR = &h44
483Const LANG_TELUGU = &h4a
484Const LANG_THAI = &h1e
485Const LANG_TIBETAN = &h51
486Const LANG_TIGRIGNA = &h73
487Const LANG_TSWANA = &h32
488Const LANG_TURKISH = &h1f
489Const LANG_TURKMEN = &h42
490Const LANG_UIGHUR = &h80
491Const LANG_UKRAINIAN = &h22
492Const LANG_UPPER_SORBIAN = &h2e
493Const LANG_URDU = &h20
494Const LANG_UZBEK = &h43
495Const LANG_VIETNAMESE = &h2a
496Const LANG_WELSH = &h52
497Const LANG_WOLOF = &h88
498Const LANG_XHOSA = &h34
499Const LANG_YAKUT = &h85
500Const LANG_YI = &h78
501Const LANG_YORUBA = &h6a
502Const LANG_ZULU = &h35
503
504' Sublanguage IDs.
505Const SUBLANG_NEUTRAL = &h00
506Const SUBLANG_DEFAULT = &h01
507Const SUBLANG_SYS_DEFAULT = &h02
508Const SUBLANG_CUSTOM_DEFAULT = &h03
509Const SUBLANG_CUSTOM_UNSPECIFIED = &h04
510Const SUBLANG_UI_CUSTOM_DEFAULT = &h05
511
512Const SUBLANG_AFRIKAANS_SOUTH_AFRICA = &h01
513Const SUBLANG_ALBANIAN_ALBANIA = &h01
514Const SUBLANG_ALSATIAN_FRANCE = &h01
515Const SUBLANG_AMHARIC_ETHIOPIA = &h01
516Const SUBLANG_ARABIC_SAUDI_ARABIA = &h01
517Const SUBLANG_ARABIC_IRAQ = &h02
518Const SUBLANG_ARABIC_EGYPT = &h03
519Const SUBLANG_ARABIC_LIBYA = &h04
520Const SUBLANG_ARABIC_ALGERIA = &h05
521Const SUBLANG_ARABIC_MOROCCO = &h06
522Const SUBLANG_ARABIC_TUNISIA = &h07
523Const SUBLANG_ARABIC_OMAN = &h08
524Const SUBLANG_ARABIC_YEMEN = &h09
525Const SUBLANG_ARABIC_SYRIA = &h0a
526Const SUBLANG_ARABIC_JORDAN = &h0b
527Const SUBLANG_ARABIC_LEBANON = &h0c
528Const SUBLANG_ARABIC_KUWAIT = &h0d
529Const SUBLANG_ARABIC_UAE = &h0e
530Const SUBLANG_ARABIC_BAHRAIN = &h0f
531Const SUBLANG_ARABIC_QATAR = &h10
532Const SUBLANG_ARMENIAN_ARMENIA = &h01
533Const SUBLANG_ASSAMESE_INDIA = &h01
534Const SUBLANG_AZERI_LATIN = &h01
535Const SUBLANG_AZERI_CYRILLIC = &h02
536Const SUBLANG_BASHKIR_RUSSIA = &h01
537Const SUBLANG_BASQUE_BASQUE = &h01
538Const SUBLANG_BELARUSIAN_BELARUS = &h01
539Const SUBLANG_BENGALI_INDIA = &h01
540Const SUBLANG_BENGALI_BANGLADESH = &h02
541Const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN = &h05
542Const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC = &h08
543Const SUBLANG_BRETON_FRANCE = &h01
544Const SUBLANG_BULGARIAN_BULGARIA = &h01
545Const SUBLANG_CATALAN_CATALAN = &h01
546Const SUBLANG_CHINESE_TRADITIONAL = &h01
547Const SUBLANG_CHINESE_SIMPLIFIED = &h02
548Const SUBLANG_CHINESE_HONGKONG = &h03
549Const SUBLANG_CHINESE_SINGAPORE = &h04
550Const SUBLANG_CHINESE_MACAU = &h05
551Const SUBLANG_CORSICAN_FRANCE = &h01
552Const SUBLANG_CZECH_CZECH_REPUBLIC = &h01
553Const SUBLANG_CROATIAN_CROATIA = &h01
554Const SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN = &h04
555Const SUBLANG_DANISH_DENMARK = &h01
556Const SUBLANG_DARI_AFGHANISTAN = &h01
557Const SUBLANG_DIVEHI_MALDIVES = &h01
558Const SUBLANG_DUTCH = &h01
559Const SUBLANG_DUTCH_BELGIAN = &h02
560Const SUBLANG_ENGLISH_US = &h01
561Const SUBLANG_ENGLISH_UK = &h02
562Const SUBLANG_ENGLISH_AUS = &h03
563Const SUBLANG_ENGLISH_CAN = &h04
564Const SUBLANG_ENGLISH_NZ = &h05
565Const SUBLANG_ENGLISH_EIRE = &h06
566Const SUBLANG_ENGLISH_SOUTH_AFRICA = &h07
567Const SUBLANG_ENGLISH_JAMAICA = &h08
568Const SUBLANG_ENGLISH_CARIBBEAN = &h09
569Const SUBLANG_ENGLISH_BELIZE = &h0a
570Const SUBLANG_ENGLISH_TRINIDAD = &h0b
571Const SUBLANG_ENGLISH_ZIMBABWE = &h0c
572Const SUBLANG_ENGLISH_PHILIPPINES = &h0d
573Const SUBLANG_ENGLISH_INDIA = &h10
574Const SUBLANG_ENGLISH_MALAYSIA = &h11
575Const SUBLANG_ENGLISH_SINGAPORE = &h12
576Const SUBLANG_ESTONIAN_ESTONIA = &h01
577Const SUBLANG_FAEROESE_FAROE_ISLANDS = &h01
578Const SUBLANG_FILIPINO_PHILIPPINES = &h01
579Const SUBLANG_FINNISH_FINLAND = &h01
580Const SUBLANG_FRENCH = &h01
581Const SUBLANG_FRENCH_BELGIAN = &h02
582Const SUBLANG_FRENCH_CANADIAN = &h03
583Const SUBLANG_FRENCH_SWISS = &h04
584Const SUBLANG_FRENCH_LUXEMBOURG = &h05
585Const SUBLANG_FRENCH_MONACO = &h06
586Const SUBLANG_FRISIAN_NETHERLANDS = &h01
587Const SUBLANG_GALICIAN_GALICIAN = &h01
588Const SUBLANG_GEORGIAN_GEORGIA = &h01
589Const SUBLANG_GERMAN = &h01
590Const SUBLANG_GERMAN_SWISS = &h02
591Const SUBLANG_GERMAN_AUSTRIAN = &h03
592Const SUBLANG_GERMAN_LUXEMBOURG = &h04
593Const SUBLANG_GERMAN_LIECHTENSTEIN = &h05
594Const SUBLANG_GREEK_GREECE = &h01
595Const SUBLANG_GREENLANDIC_GREENLAND = &h01
596Const SUBLANG_GUJARATI_INDIA = &h01
597Const SUBLANG_HAUSA_NIGERIA_LATIN = &h01
598Const SUBLANG_HEBREW_ISRAEL = &h01
599Const SUBLANG_HINDI_INDIA = &h01
600Const SUBLANG_HUNGARIAN_HUNGARY = &h01
601Const SUBLANG_ICELANDIC_ICELAND = &h01
602Const SUBLANG_IGBO_NIGERIA = &h01
603Const SUBLANG_INDONESIAN_INDONESIA = &h01
604Const SUBLANG_INUKTITUT_CANADA = &h01
605Const SUBLANG_INUKTITUT_CANADA_LATIN = &h02
606Const SUBLANG_IRISH_IRELAND = &h02
607Const SUBLANG_ITALIAN = &h01
608Const SUBLANG_ITALIAN_SWISS = &h02
609Const SUBLANG_JAPANESE_JAPAN = &h01
610Const SUBLANG_KANNADA_INDIA = &h01
611Const SUBLANG_KASHMIRI_SASIA = &h02
612Const SUBLANG_KASHMIRI_INDIA = &h02
613Const SUBLANG_KAZAK_KAZAKHSTAN = &h01
614Const SUBLANG_KHMER_CAMBODIA = &h01
615Const SUBLANG_KICHE_GUATEMALA = &h01
616Const SUBLANG_KINYARWANDA_RWANDA = &h01
617Const SUBLANG_KONKANI_INDIA = &h01
618Const SUBLANG_KOREAN = &h01
619Const SUBLANG_KYRGYZ_KYRGYZSTAN = &h01
620Const SUBLANG_LAO_LAO = &h01
621Const SUBLANG_LATVIAN_LATVIA = &h01
622Const SUBLANG_LITHUANIAN = &h01
623Const SUBLANG_LOWER_SORBIAN_GERM = &h02
624Const SUBLANG_LUXEMBOURGISH_LUXEMBOURG = &h01
625Const SUBLANG_MACEDONIAN_MACEDONIA = &h01
626Const SUBLANG_MALAY_MALAYSIA = &h01
627Const SUBLANG_MALAY_BRUNEI_DARUSSALAM = &h02
628Const SUBLANG_MALAYALAM_INDIA = &h01
629Const SUBLANG_MALTESE_MALTA = &h01
630Const SUBLANG_MAORI_NEW_ZEALAND = &h01
631Const SUBLANG_MAPUDUNGUN_CHILE = &h01
632Const SUBLANG_MARATHI_INDIA = &h01
633Const SUBLANG_MOHAWK_MOHAWK = &h01
634Const SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA = &h01
635Const SUBLANG_MONGOLIAN_PRC = &h02
636Const SUBLANG_NEPALI_INDIA = &h02
637Const SUBLANG_NEPALI_NEPAL = &h01
638Const SUBLANG_NORWEGIAN_BOKMAL = &h01
639Const SUBLANG_NORWEGIAN_NYNORSK = &h02
640Const SUBLANG_OCCITAN_FRANCE = &h01
641Const SUBLANG_ORIYA_INDIA = &h01
642Const SUBLANG_PASHTO_AFGHANISTAN = &h01
643Const SUBLANG_PERSIAN_IRAN = &h01
644Const SUBLANG_POLISH_POLAND = &h01
645Const SUBLANG_PORTUGUESE = &h02
646Const SUBLANG_PORTUGUESE_BRAZILIAN = &h01
647Const SUBLANG_PUNJABI_INDIA = &h01
648Const SUBLANG_QUECHUA_BOLIVIA = &h01
649Const SUBLANG_QUECHUA_ECUADOR = &h02
650Const SUBLANG_QUECHUA_PERU = &h03
651Const SUBLANG_ROMANIAN_ROMANIA = &h01
652Const SUBLANG_ROMANSH_SWITZERLAND = &h01
653Const SUBLANG_RUSSIAN_RUSSIA = &h01
654Const SUBLANG_SAMI_NORTHERN_NORWAY = &h01
655Const SUBLANG_SAMI_NORTHERN_SWEDEN = &h02
656Const SUBLANG_SAMI_NORTHERN_FINLAND = &h03
657Const SUBLANG_SAMI_LULE_NORWAY = &h04
658Const SUBLANG_SAMI_LULE_SWEDEN = &h05
659Const SUBLANG_SAMI_SOUTHERN_NORWAY = &h06
660Const SUBLANG_SAMI_SOUTHERN_SWEDEN = &h07
661Const SUBLANG_SAMI_SKOLT_FINLAND = &h08
662Const SUBLANG_SAMI_INARI_FINLAND = &h09
663Const SUBLANG_SANSKRIT_INDIA = &h01
664Const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN = &h06
665Const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC = &h07
666Const SUBLANG_SERBIAN_CROATIA = &h01
667Const SUBLANG_SERBIAN_LATIN = &h02
668Const SUBLANG_SERBIAN_CYRILLIC = &h03
669Const SUBLANG_SINDHI_INDIA = &h01
670Const SUBLANG_SINDHI_PAKISTAN = &h02
671Const SUBLANG_SINDHI_AFGHANISTAN = &h02
672Const SUBLANG_SINHALESE_SRI_LANKA = &h01
673Const SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA = &h01
674Const SUBLANG_SLOVAK_SLOVAKIA = &h01
675Const SUBLANG_SLOVENIAN_SLOVENIA = &h01
676Const SUBLANG_SPANISH = &h01
677Const SUBLANG_SPANISH_MEXICAN = &h02
678Const SUBLANG_SPANISH_MODERN = &h03
679Const SUBLANG_SPANISH_GUATEMALA = &h04
680Const SUBLANG_SPANISH_COSTA_RICA = &h05
681Const SUBLANG_SPANISH_PANAMA = &h06
682Const SUBLANG_SPANISH_DOMINICAN_REPUBLIC = &h07
683Const SUBLANG_SPANISH_VENEZUELA = &h08
684Const SUBLANG_SPANISH_COLOMBIA = &h09
685Const SUBLANG_SPANISH_PERU = &h0a
686Const SUBLANG_SPANISH_ARGENTINA = &h0b
687Const SUBLANG_SPANISH_ECUADOR = &h0c
688Const SUBLANG_SPANISH_CHILE = &h0d
689Const SUBLANG_SPANISH_URUGUAY = &h0e
690Const SUBLANG_SPANISH_PARAGUAY = &h0f
691Const SUBLANG_SPANISH_BOLIVIA = &h10
692Const SUBLANG_SPANISH_EL_SALVADOR = &h11
693Const SUBLANG_SPANISH_HONDURAS = &h12
694Const SUBLANG_SPANISH_NICARAGUA = &h13
695Const SUBLANG_SPANISH_PUERTO_RICO = &h14
696Const SUBLANG_SPANISH_US = &h15
697Const SUBLANG_SWAHILI_KENYA = &h01
698Const SUBLANG_SWEDISH = &h01
699Const SUBLANG_SWEDISH_FINLAND = &h02
700Const SUBLANG_SYRIAC_SYRIA = &h01
701Const SUBLANG_TAJIK_TAJIKISTAN = &h01
702Const SUBLANG_TAMAZIGHT_ALGERIA_LATIN = &h02
703Const SUBLANG_TAMIL_INDIA = &h01
704Const SUBLANG_TATAR_RUSSIA = &h01
705Const SUBLANG_TELUGU_INDIA = &h01
706Const SUBLANG_THAI_THAILAND = &h01
707Const SUBLANG_TIBETAN_PRC = &h01
708Const SUBLANG_TIGRIGNA_ERITREA = &h02
709Const SUBLANG_TSWANA_SOUTH_AFRICA = &h01
710Const SUBLANG_TURKISH_TURKEY = &h01
711Const SUBLANG_TURKMEN_TURKMENISTAN = &h01
712Const SUBLANG_UIGHUR_PRC = &h01
713Const SUBLANG_UKRAINIAN_UKRAINE = &h01
714Const SUBLANG_UPPER_SORBIAN_GERMANY = &h01
715Const SUBLANG_URDU_PAKISTAN = &h01
716Const SUBLANG_URDU_INDIA = &h02
717Const SUBLANG_UZBEK_LATIN = &h01
718Const SUBLANG_UZBEK_CYRILLIC = &h02
719Const SUBLANG_VIETNAMESE_VIETNAM = &h01
720Const SUBLANG_WELSH_UNITED_KINGDOM = &h01
721Const SUBLANG_WOLOF_SENEGAL = &h01
722Const SUBLANG_XHOSA_SOUTH_AFRICA = &h01
723Const SUBLANG_YAKUT_RUSSIA = &h01
724Const SUBLANG_YI_PRC = &h01
725Const SUBLANG_YORUBA_NIGERIA = &h01
726Const SUBLANG_ZULU_SOUTH_AFRICA = &h01
727
728' Sorting IDs.
729Const SORT_DEFAULT = &h0
730
731Const SORT_INVARIANT_MATH = &h1
732
733Const SORT_JAPANESE_XJIS = &h0
734Const SORT_JAPANESE_UNICODE = &h1
735Const SORT_JAPANESE_RADICALSTROKE = &h4
736
737Const SORT_CHINESE_BIG5 = &h0
738Const SORT_CHINESE_PRCP = &h0
739Const SORT_CHINESE_UNICODE = &h1
740Const SORT_CHINESE_PRC = &h2
741Const SORT_CHINESE_BOPOMOFO = &h3
742
743Const SORT_KOREAN_KSC = &h0
744Const SORT_KOREAN_UNICODE = &h1
745
746Const SORT_GERMAN_PHONE_BOOK = &h1
747
748Const SORT_HUNGARIAN_DEFAULT = &h0
749Const SORT_HUNGARIAN_TECHNICAL = &h1
750
751Const SORT_GEORGIAN_TRADITIONAL = &h0
752Const SORT_GEORGIAN_MODERN = &h1
753
754Const MAKELANGID(p, s) = ((((s) As Word) << 10) Or (p) As Word)
755Const PRIMARYLANGID(lgid) = ((lgid) As Word And &h3ff)
756Const SUBLANGID(lgid) = ((lgid) As Word >> 10)
757
758Const NLS_VALID_LOCALE_MASK = &h000fffff
759
760Const MAKELCID(lgid, srtid) = ((((((srtid) As Word) As DWord) << 16) Or (((lgid) As Word) As DWord)) As DWord)
761Const MAKESORTLCID(lgid, srtid, ver) = (((MAKELCID(lgid, srtid)) Or ((((ver) As Word)) As DWord << 20)) As DWord)
762Const LANGIDFROMLCID(lcid) = ((lcid) As Word)
763Const SORTIDFROMLCID(lcid) = (((((lcid) As DWord) >> 16) And &hf) As Word)
764Const SORTVERSIONFROMLCID(lcid) = (((((lcid) As DWord) >> 20) And &hf) As Word)
765
766Const LOCALE_NAME_MAX_LENGTH = 85
767
768Const LANG_SYSTEM_DEFAULT = (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
769Const LANG_USER_DEFAULT = (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
770
771Const LOCALE_SYSTEM_DEFAULT = (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
772Const LOCALE_USER_DEFAULT = (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
773
774Const LOCALE_CUSTOM_DEFAULT = (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT))
775Const LOCALE_CUSTOM_UNSPECIFIED = (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT))
776Const LOCALE_CUSTOM_UI_DEFAULT = (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT))
777Const LOCALE_NEUTRAL = (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT))
778Const LOCALE_INVARIANT = (MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT))
779
780' DEFAULT_UNREACHABLE
781
782#ifndef WIN32_NO_STATUS
783Const STATUS_WAIT_0 = (&h00000000 As DWord)
784Const STATUS_ABANDONED_WAIT_0 = (&h00000080 As DWord)
785Const STATUS_USER_APC = (&h000000C0 As DWord)
786Const STATUS_TIMEOUT = (&h00000102 As DWord)
787Const STATUS_PENDING = (&h00000103 As DWord)
788Const DBG_EXCEPTION_HANDLED = (&h00010001 As DWord)
789Const DBG_CONTINUE = (&h00010002 As DWord)
790Const STATUS_SEGMENT_NOTIFICATION = (&h40000005 As DWord)
791Const DBG_TERMINATE_THREAD = (&h40010003 As DWord)
792Const DBG_TERMINATE_PROCESS = (&h40010004 As DWord)
793Const DBG_CONTROL_C = (&h40010005 As DWord)
794Const DBG_CONTROL_BREAK = (&h40010008 As DWord)
795Const DBG_COMMAND_EXCEPTION = (&h40010009 As DWord)
796Const STATUS_GUARD_PAGE_VIOLATION = (&h80000001 As DWord)
797Const STATUS_DATATYPE_MISALIGNMENT = (&h80000002 As DWord)
798Const STATUS_BREAKPOINT = (&h80000003 As DWord)
799Const STATUS_SINGLE_STEP = (&h80000004 As DWord)
800Const DBG_EXCEPTION_NOT_HANDLED = (&h80010001 As DWord)
801Const STATUS_ACCESS_VIOLATION = (&hC0000005 As DWord)
802Const STATUS_IN_PAGE_ERROR = (&hC0000006 As DWord)
803Const STATUS_INVALID_HANDLE = (&hC0000008 As DWord)
804Const STATUS_NO_MEMORY = (&hC0000017 As DWord)
805Const STATUS_ILLEGAL_INSTRUCTION = (&hC000001D As DWord)
806Const STATUS_NONCONTINUABLE_EXCEPTION = (&hC0000025 As DWord)
807Const STATUS_INVALID_DISPOSITION = (&hC0000026 As DWord)
808Const STATUS_ARRAY_BOUNDS_EXCEEDED = (&hC000008C As DWord)
809Const STATUS_FLOAT_DENORMAL_OPERAND = (&hC000008D As DWord)
810Const STATUS_FLOAT_DIVIDE_BY_ZERO = (&hC000008E As DWord)
811Const STATUS_FLOAT_INEXACT_RESULT = (&hC000008F As DWord)
812Const STATUS_FLOAT_INVALID_OPERATION = (&hC0000090 As DWord)
813Const STATUS_FLOAT_OVERFLOW = (&hC0000091 As DWord)
814Const STATUS_FLOAT_STACK_CHECK = (&hC0000092 As DWord)
815Const STATUS_FLOAT_UNDERFLOW = (&hC0000093 As DWord)
816Const STATUS_INTEGER_DIVIDE_BY_ZERO = (&hC0000094 As DWord)
817Const STATUS_INTEGER_OVERFLOW = (&hC0000095 As DWord)
818Const STATUS_PRIVILEGED_INSTRUCTION = (&hC0000096 As DWord)
819Const STATUS_STACK_OVERFLOW = (&hC00000FD As DWord)
820Const STATUS_CONTROL_C_EXIT = (&hC000013A As DWord)
821Const STATUS_FLOAT_MULTIPLE_FAULTS = (&hC00002B4 As DWord)
822Const STATUS_FLOAT_MULTIPLE_TRAPS = (&hC00002B5 As DWord)
823Const STATUS_REG_NAT_CONSUMPTION = (&hC00002C9 As DWord)
824'#if defined(STATUS_SUCCESS) || (_WIN32_WINNT > 0x0500) || (_WIN32_FUSION >= 0x0100)
825Const STATUS_SXS_EARLY_DEACTIVATION = (&hC015000F As DWord)
826Const STATUS_SXS_INVALID_DEACTIVATION = (&hC0150010 As DWord)
827'#endif
828#endif
829
830Const MAXIMUM_WAIT_OBJECTS = 64
831
832Const MAXIMUM_SUSPEND_COUNT = MAXCHAR
833
834TypeDef KSPIN_LOCK = ULONG_PTR
835TypeDef PKSPIN_LOCK = KSPIN_LOCK
836
837#ifdef _WIN64
838
839Const EXCEPTION_READ_FAULT = 0
840Const EXCEPTION_WRITE_FAULT = 1
841Const EXCEPTION_EXECUTE_FAULT = 8
842
843Const CONTEXT_AMD64 = &h100000
844
845Const CONTEXT_CONTROL = (CONTEXT_AMD64 Or &h1)
846Const CONTEXT_INTEGER = (CONTEXT_AMD64 Or &h2)
847Const CONTEXT_SEGMENTS = (CONTEXT_AMD64 Or &h4)
848Const CONTEXT_FLOATING_POINT = (CONTEXT_AMD64 Or &h8)
849Const CONTEXT_DEBUG_REGISTERS = (CONTEXT_AMD64 Or &h10)
850
851Const CONTEXT_FULL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_FLOATING_POINT)
852
853Const CONTEXT_ALL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_SEGMENTS Or CONTEXT_FLOATING_POINT Or CONTEXT_DEBUG_REGISTERS)
854
855Const CONTEXT_EXCEPTION_ACTIVE = &h8000000
856Const CONTEXT_SERVICE_ACTIVE = &h10000000
857Const CONTEXT_EXCEPTION_REQUEST = &h40000000
858Const CONTEXT_EXCEPTION_REPORTING = &h80000000
859
860Const INITIAL_MXCSR = &h1f80
861Const INITIAL_FPCSR = &h027f
862
863Type Align(16) M128A
864 Low As QWord
865 High As Int64
866End Type
867TypeDef PM128A = *M128A
868
869Type XMM_SAVE_AREA32
870 ControlWord As Word
871 StatusWord As Word
872 TagWord As Byte
873 Reserved1 As Byte
874 ErrorOpcode As Word
875 ErrorOffset As DWord
876 ErrorSelector As Word
877 Reserved2 As Word
878 DataOffset As DWord
879 DataSelector As Word
880 Reserved3 As Word
881 MxCsr As DWord
882 MxCsr_Mask As DWord
883 FloatRegisters[ELM(8)] As M128A
884 XmmRegisters[ELM(16)] As M128A
885 Reserved4[ELM(96)] As Byte
886End Type
887TypeDef PXMM_SAVE_AREA32 = *XMM_SAVE_AREA32
888
889Const LEGACY_SAVE_AREA_LENGTH = SizeOf (XMM_SAVE_AREA32)
890
891Type Align(16) CONTEXT
892 'Register parameter home addresses.
893 P1Home As QWord
894 P2Home As QWord
895 P3Home As QWord
896 P4Home As QWord
897 P5Home As QWord
898 P6Home As QWord
899 'Control flags.
900 ContextFlags As DWord
901 MxCsr As DWord
902 'Segment Registers and processor flags.
903 SegCs As Word
904 SegDs As Word
905 SegEs As Word
906 SegFs As Word
907 SegGs As Word
908 SegSs As Word
909 EFlags As DWord
910 'Debug registers
911 Dr0 As QWord
912 Dr1 As QWord
913 Dr2 As QWord
914 Dr3 As QWord
915 Dr6 As QWord
916 Dr7 As QWord
917 'Integer registers.
918 Rax As QWord
919 Rcx As QWord
920 Rdx As QWord
921 Rbx As QWord
922 Rsp As QWord
923 Rbp As QWord
924 Rsi As QWord
925 Rdi As QWord
926 R8 As QWord
927 R9 As QWord
928 R10 As QWord
929 R11 As QWord
930 R12 As QWord
931 R13 As QWord
932 R14 As QWord
933 R15 As QWord
934 'Program counter.
935 Rip As QWord
936 'MMX/floating point state.
937 Header[ELM(2)] As M128A
938 Legacy[ELM(8)] As M128A
939 Xmm0 As M128A
940 Xmm1 As M128A
941 Xmm2 As M128A
942 Xmm3 As M128A
943 Xmm4 As M128A
944 Xmm5 As M128A
945 Xmm6 As M128A
946 Xmm7 As M128A
947 Xmm8 As M128A
948 Xmm9 As M128A
949 Xmm10 As M128A
950 Xmm11 As M128A
951 Xmm12 As M128A
952 Xmm13 As M128A
953 Xmm14 As M128A
954 Xmm15 As M128A
955 Reserve[ELM(96)] As Byte
956 'Vector registers
957 VectorRegisters[ELM(26)] As M128A
958 VectorControl As QWord
959 'Special debug control registers.
960 DebugControl As QWord
961 LastBranchToRip As QWord
962 LastBranchFromRip As QWord
963 LastExceptionToRip As QWord
964 LastExceptionFromRip As QWord
965End Type
966TypeDef PCONTEXT = *CONTEXT
967
968Const RUNTIME_FUNCTION_INDIRECT = &h1
969
970Type RUNTIME_FUNCTION
971 BeginAddress As DWord
972 EndAddress As DWord
973 UnwindData As DWord
974End Type
975TypeDef PRUNTIME_FUNCTION = *RUNTIME_FUNCTION
976
977TypeDef PGET_RUNTIME_FUNCTION_CALLBACK = *Function(ControlPc As QWord, Context As PVOID) As PRUNTIME_FUNCTION
978
979TypeDef POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK = *Function(Process As HANDLE, TableAddress As PVOID, Entries As *DWord, ByRef Functions As PRUNTIME_FUNCTION) As DWord
980
981Const OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME = "OutOfProcessFunctionTableCallback"
982
983Declare Sub RtlRestoreContext Lib "kernel32" (ByRef ContextRecord As CONTEXT, ExceptionRecord As *EXCEPTION_RECORD)
984Declare Function RtlAddFunctionTable Lib "kernel32" (FunctionTable As PRUNTIME_FUNCTION, EntryCount As DWord, BaseAddress As QWord) As BOOLEAN
985Declare Function RtlInstallFunctionTableCallback Lib "kernel32" (TableIdentifier As QWord, BaseAddress As QWord, Length As DWord, Callback As PGET_RUNTIME_FUNCTION_CALLBACK, Context As PVOID, OutOfProcessCallbackDll As PCWSTR) As BOOLEAN
986Declare Function RtlDeleteFunctionTable Lib "kernel32" (FunctionTable As PRUNTIME_FUNCTION) As BOOLEAN
987
988'#endif '_WIN64
989#else
990'#ifdef _WIN32
991'InterlockedBitTestAndSet
992'InterlockedBitTestAndReset
993'InterlockedBitTestAndComplement
994
995
996'MemoryBarrier
997'PreFetchCacheLine
998'ReadForWriteAccess
999
1000'ReadPMC
1001'ReadTimeStampCounter
1002
1003'DbgRaiseAssertionFailure
1004
1005'GetFiberData
1006'GetCurrentFibe
1007
1008Const EXCEPTION_READ_FAULT = 0
1009Const EXCEPTION_WRITE_FAULT = 1
1010Const EXCEPTION_EXECUTE_FAULT = 8
1011
1012Const SIZE_OF_80387_REGISTERS = 80
1013
1014Const CONTEXT_i386 = &h00010000
1015Const CONTEXT_i486 = &h00010000
1016
1017Const CONTEXT_CONTROL = (CONTEXT_i386 Or &h00000001) ' SS:SP, CS:IP, FLAGS, BP
1018Const CONTEXT_INTEGER = (CONTEXT_i386 Or &h00000002) ' AX, BX, CX, DX, SI, DI
1019Const CONTEXT_SEGMENTS = (CONTEXT_i386 Or &h00000004) ' DS, ES, FS, GS
1020Const CONTEXT_FLOATING_POINT = (CONTEXT_i386 Or &h00000008) ' 387 state
1021Const CONTEXT_DEBUG_REGISTERS = (CONTEXT_i386 Or &h00000010) ' DB 0-3,6,7
1022Const CONTEXT_EXTENDED_REGISTERS = (CONTEXT_i386 Or &h00000020) ' cpu specific extensions
1023Const CONTEXT_FULL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_SEGMENTS)
1024Const CONTEXT_ALL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_SEGMENTS Or CONTEXT_FLOATING_POINT Or CONTEXT_DEBUG_REGISTERS Or CONTEXT_EXTENDED_REGISTERS)
1025
1026Const MAXIMUM_SUPPORTED_EXTENSION = 512
1027
1028Type FLOATING_SAVE_AREA
1029 ControlWord As DWord
1030 StatusWord As DWord
1031 TagWord As DWord
1032 ErrorOffset As DWord
1033 ErrorSelector As DWord
1034 DataOffset As DWord
1035 DataSelector As DWord
1036 RegisterArea[ELM(SIZE_OF_80387_REGISTERS)] As Byte
1037 Cr0NpxState As DWord
1038End Type
1039TypeDef PFLOATING_SAVE_AREA = FLOATING_SAVE_AREA
1040
1041Type CONTEXT
1042 ContextFlags As DWord
1043
1044 Dr0 As DWord
1045 Dr1 As DWord
1046 Dr2 As DWord
1047 Dr3 As DWord
1048 Dr6 As DWord
1049 Dr7 As DWord
1050
1051 FloatSave As FLOATING_SAVE_AREA
1052
1053 SegGs As DWord
1054 SegFs As DWord
1055 SegEs As DWord
1056 SegDs As DWord
1057
1058 Edi As DWord
1059 Esi As DWord
1060 Ebx As DWord
1061 Edx As DWord
1062 Ecx As DWord
1063 Eax As DWord
1064
1065 Ebp As DWord
1066 Eip As DWord
1067 SegCs As DWord
1068 EFlags As DWord
1069 Esp As DWord
1070 SegSs As DWord
1071
1072 ExtendedRegisters[ELM(MAXIMUM_SUPPORTED_EXTENSION)] As Byte
1073End Type
1074
1075TypeDef PCONTEXT = *CONTEXT
1076
1077#endif
1078
1079#ifndef _LDT_ENTRY_DEFINED
1080#define _LDT_ENTRY_DEFINED
1081
1082Type LDT_ENTRY
1083 LimitLow As Word
1084 BaseLow As Word
1085 BaseMid As Byte
1086 Flags1 As Byte
1087 Flags2 As Byte
1088 BaseHi As Byte
1089End Type
1090TypeDef PLDT_ENTRY = *LDT_ENTRY
1091
1092#endif
1093
1094Const WOW64_CONTEXT_i386 = &h00010000
1095Const WOW64_CONTEXT_i486 = &h00010000
1096
1097Const WOW64_CONTEXT_CONTROL = (WOW64_CONTEXT_i386 Or &h00000001) ' SS:SP, CS:IP, FLAGS, BP
1098Const WOW64_CONTEXT_INTEGER = (WOW64_CONTEXT_i386 Or &h00000002) ' AX, BX, CX, DX, SI, DI
1099Const WOW64_CONTEXT_SEGMENTS = (WOW64_CONTEXT_i386 Or &h00000004) ' DS, ES, FS, GS
1100Const WOW64_CONTEXT_FLOATING_POINT = (WOW64_CONTEXT_i386 Or &h00000008) ' 387 state
1101Const WOW64_CONTEXT_DEBUG_REGISTERS = (WOW64_CONTEXT_i386 Or &h00000010) ' DB 0-3,6,7
1102Const WOW64_CONTEXT_EXTENDED_REGISTERS = (WOW64_CONTEXT_i386 Or &h00000020) ' cpu specific extensions
1103Const WOW64_CONTEXT_FULL = (WOW64_CONTEXT_CONTROL Or WOW64_CONTEXT_INTEGER Or WOW64_CONTEXT_SEGMENTS)
1104Const WOW64_CONTEXT_ALL = (WOW64_CONTEXT_CONTROL Or WOW64_CONTEXT_INTEGER Or WOW64_CONTEXT_SEGMENTS Or WOW64_CONTEXT_FLOATING_POINT Or WOW64_CONTEXT_DEBUG_REGISTERS Or WOW64_CONTEXT_EXTENDED_REGISTERS)
1105
1106Const WOW64_SIZE_OF_80387_REGISTERS = 80
1107
1108Const WOW64_MAXIMUM_SUPPORTED_EXTENSION = 512
1109
1110Type WOW64_FLOATING_SAVE_AREA
1111 ControlWord As DWord
1112 StatusWord As DWord
1113 TagWord As DWord
1114 ErrorOffset As DWord
1115 ErrorSelector As DWord
1116 DataOffset As DWord
1117 DataSelector As DWord
1118 RegisterArea[ELM(WOW64_SIZE_OF_80387_REGISTERS)] As Byte
1119 Cr0NpxState As DWord
1120End Type
1121TypeDef PWOW64_FLOATING_SAVE_AREA = *WOW64_FLOATING_SAVE_AREA
1122
1123Type WOW64_CONTEXT
1124 ContextFlags As DWord
1125
1126 Dr0 As DWord
1127 Dr1 As DWord
1128 Dr2 As DWord
1129 Dr3 As DWord
1130 Dr6 As DWord
1131 Dr7 As DWord
1132
1133 FloatSave As WOW64_FLOATING_SAVE_AREA
1134
1135 SegGs As DWord
1136 SegFs As DWord
1137 SegEs As DWord
1138 SegDs As DWord
1139
1140 Edi As DWord
1141 Esi As DWord
1142 Ebx As DWord
1143 Edx As DWord
1144 Ecx As DWord
1145 Eax As DWord
1146
1147 Ebp As DWord
1148 Eip As DWord
1149 SegCs As DWord
1150 EFlags As DWord
1151 Esp As DWord
1152 SegSs As DWord
1153
1154 ExtendedRegisters[ELM(WOW64_MAXIMUM_SUPPORTED_EXTENSION)] As Byte
1155End Type
1156
1157TypeDef PWOW64_CONTEXT = *WOW64_CONTEXT
1158
1159Const EXCEPTION_NONCONTINUABLE = &h1
1160Const EXCEPTION_MAXIMUM_PARAMETERS = 15
1161
1162Type EXCEPTION_RECORD
1163 ExceptionCode As DWord
1164 ExceptionFlags As DWord
1165 ExceptionRecord As *EXCEPTION_RECORD
1166 ExceptionAddress As PVOID
1167 NumberParameters As DWord
1168 ExceptionInformation[ELM(EXCEPTION_MAXIMUM_PARAMETERS)] As ULONG_PTR
1169End Type
1170TypeDef PEXCEPTION_RECORD = *EXCEPTION_RECORD
1171
1172Type EXCEPTION_RECORD32
1173 ExceptionCode As DWord
1174 ExceptionFlags As DWord
1175 ExceptionRecord As DWord
1176 ExceptionAddress As DWord
1177 NumberParameters As DWord
1178 ExceptionInformation[ELM(EXCEPTION_MAXIMUM_PARAMETERS)] As DWord
1179End Type
1180TypeDef PEXCEPTION_RECORD32 = *EXCEPTION_RECORD32
1181
1182Type EXCEPTION_RECORD64
1183 ExceptionCode As DWord
1184 ExceptionFlags As DWord
1185 ExceptionRecord As QWord
1186 ExceptionAddress As QWord
1187 NumberParameters As DWord
1188 __unusedAlignment As DWord
1189 ExceptionInformation[ELM(EXCEPTION_MAXIMUM_PARAMETERS)] As QWord
1190End Type
1191TypeDef PEXCEPTION_RECORD64 = *EXCEPTION_RECORD64
1192
1193Type EXCEPTION_POINTERS
1194 ExceptionRecord As PEXCEPTION_RECORD
1195 ContextRecord As PCONTEXT
1196End Type
1197TypeDef PEXCEPTION_POINTERS = *EXCEPTION_POINTERS
1198
1199TypeDef PACCESS_TOKEN = PVOID
1200'TypeDef PSECURITY_DESCRIPTOR = PVOID
1201'TypeDef PSID = PVOID
1202
1203'ACCESS MASK
1204TypeDef ACCESS_MASK = DWord
1205TypeDef PACCESS_MASK = *ACCESS_MASK
1206
1207'ACCESS TYPES
1208
1209'Const DELETE = (&h00010000)
1210Const READ_CONTROL = (&h00020000)
1211Const WRITE_DAC = (&h00040000)
1212Const WRITE_OWNER = (&h00080000)
1213Const SYNCHRONIZE = (&h00100000)
1214
1215Const STANDARD_RIGHTS_REQUIRED = (&h000F0000)
1216
1217Const STANDARD_RIGHTS_READ = (READ_CONTROL)
1218Const STANDARD_RIGHTS_WRITE = (READ_CONTROL)
1219Const STANDARD_RIGHTS_EXECUTE = (READ_CONTROL)
1220
1221Const STANDARD_RIGHTS_ALL = (&h001F0000)
1222
1223Const SPECIFIC_RIGHTS_ALL = (&h0000FFFF)
1224
1225Const ACCESS_SYSTEM_SECURITY = (&h01000000)
1226
1227Const MAXIMUM_ALLOWED = (&h02000000)
1228
1229Const GENERIC_READ = (&h80000000)
1230Const GENERIC_WRITE = (&h40000000)
1231Const GENERIC_EXECUTE = (&h20000000)
1232Const GENERIC_ALL = (&h10000000)
1233
1234Type GENERIC_MAPPING
1235 GenericRead As ACCESS_MASK
1236 GenericWrite As ACCESS_MASK
1237 GenericExecute As ACCESS_MASK
1238 GenericAll As ACCESS_MASK
1239End Type
1240TypeDef PGENERIC_MAPPING = *GENERIC_MAPPING
1241
1242' LUID_AND_ATTRIBUTES
1243Type Align(4) LUID_AND_ATTRIBUTES
1244 Luid As LUID
1245 Attributes As DWord
1246End Type
1247'TypeDef LUID_AND_ATTRIBUTES_ARRAY = LUID_AND_ATTRIBUTES[ANYSIZE_ARRAY]
1248'TypeDef PLUID_AND_ATTRIBUTES_ARRAY = *LUID_AND_ATTRIBUTES_ARRAY
1249
1250' Security Id (SID)
1251
1252#ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
1253#define SID_IDENTIFIER_AUTHORITY_DEFINED
1254Type SID_IDENTIFIER_AUTHORITY
1255 Value[ELM(6)] As Byte
1256End Type
1257TypeDef PSID_IDENTIFIER_AUTHORITY = *SID_IDENTIFIER_AUTHORITY
1258#endif
1259
1260#ifndef SID_DEFINED
1261#define SID_DEFINED
1262Type SID
1263 Revision As Byte
1264 SubAuthorityCount As Byte
1265 IdentifierAuthority As SID_IDENTIFIER_AUTHORITY
1266 SubAuthority[ELM(ANYSIZE_ARRAY)] As DWord
1267End Type
1268TypeDef PSID = *SID
1269#endif
1270
1271Const SID_REVISION = (1)
1272Const SID_MAX_SUB_AUTHORITIES = (15)
1273Const SID_RECOMMENDED_SUB_AUTHORITIES = (1)
1274
1275Const SECURITY_MAX_SID_SIZE = (SizeOf (SID) - SizeOf (DWord) + (SID_MAX_SUB_AUTHORITIES * SizeOf (DWord)))
1276
1277Enum SID_NAME_USE
1278 SidTypeUser = 1
1279 SidTypeGroup
1280 SidTypeDomain
1281 SidTypeAlias
1282 SidTypeWellKnownGroup
1283 SidTypeDeletedAccount
1284 SidTypeInvalid
1285 SidTypeUnknown
1286 SidTypeComputer
1287 SidTypeLabel
1288End Enum
1289TypeDef PSID_NAME_USE = *SID_NAME_USE
1290
1291Type SID_AND_ATTRIBUTES
1292 Sid As PSID
1293 Attributes As DWord
1294End Type
1295TypeDef PSID_AND_ATTRIBUTES = *SID_AND_ATTRIBUTES
1296
1297'TypeDef SID_AND_ATTRIBUTES_ARRAY = SID_AND_ATTRIBUTES[ANYSIZE_ARRAY]
1298'TypeDef PSID_AND_ATTRIBUTES_ARRAY = *SID_AND_ATTRIBUTES_ARRAY
1299
1300Const SID_HASH_SIZE = 32
1301TypeDef SID_HASH_ENTRY = ULONG_PTR
1302TypeDef PSID_HASH_ENTRY = *SID_HASH_ENTRY
1303
1304Type SID_AND_ATTRIBUTES_HASH
1305 SidCount As DWord
1306 SidAttr As PSID_AND_ATTRIBUTES
1307 Hash[ELM(SID_HASH_SIZE)] As SID_HASH_ENTRY
1308End Type
1309TypeDef PSID_AND_ATTRIBUTES_HASH = *SID_AND_ATTRIBUTES_HASH
1310
1311' Universal well-known SIDs
1312'Const SECURITY_NULL_SID_AUTHORITY = [0, 0, 0, 0, 0, 0] As SID_IDENTIFIER_AUTHORITY
1313'Const SECURITY_WORLD_SID_AUTHORITY = [0, 0, 0, 0, 0, 1] As SID_IDENTIFIER_AUTHORITY
1314'Const SECURITY_LOCAL_SID_AUTHORITY = [0, 0, 0, 0, 0, 2] As SID_IDENTIFIER_AUTHORITY
1315'Const SECURITY_CREATOR_SID_AUTHORITY = [0, 0, 0, 0, 0, 3] As SID_IDENTIFIER_AUTHORITY
1316'Const SECURITY_NON_UNIQUE_AUTHORITY = [0, 0, 0, 0, 0, 4] As SID_IDENTIFIER_AUTHORITY
1317'Const SECURITY_RESOURCE_MANAGER_AUTHORITY = [0, 0, 0, 0, 0, 9] As SID_IDENTIFIER_AUTHORITY
1318
1319Const SECURITY_NULL_RID = (&h00000000)
1320Const SECURITY_WORLD_RID = (&h00000000)
1321Const SECURITY_LOCAL_RID = (&h00000000)
1322
1323Const SECURITY_CREATOR_OWNER_RID = (&h00000000)
1324Const SECURITY_CREATOR_GROUP_RID = (&h00000001)
1325
1326Const SECURITY_CREATOR_OWNER_SERVER_RID = (&h00000002)
1327Const SECURITY_CREATOR_GROUP_SERVER_RID = (&h00000003)
1328
1329Const SECURITY_CREATOR_OWNER_RIGHTS_RID = (&h00000004)
1330
1331' NT well-known SIDs
1332'Const SECURITY_NT_AUTHORITY = [0, 0, 0, 0, 0, 9] As SID_IDENTIFIER_AUTHORITY
1333
1334Const SECURITY_DIALUP_RID = (&h00000001)
1335Const SECURITY_NETWORK_RID = (&h00000002)
1336Const SECURITY_BATCH_RID = (&h00000003)
1337Const SECURITY_INTERACTIVE_RID = (&h00000004)
1338Const SECURITY_LOGON_IDS_RID = (&h00000005)
1339Const SECURITY_LOGON_IDS_RID_COUNT = (3)
1340Const SECURITY_SERVICE_RID = (&h00000006)
1341Const SECURITY_ANONYMOUS_LOGON_RID = (&h00000007)
1342Const SECURITY_PROXY_RID = (&h00000008)
1343Const SECURITY_ENTERPRISE_CONTROLLERS_RID = (&h00000009)
1344Const SECURITY_SERVER_LOGON_RID = SECURITY_ENTERPRISE_CONTROLLERS_RID
1345Const SECURITY_PRINCIPAL_SELF_RID = (&h0000000A)
1346Const SECURITY_AUTHENTICATED_USER_RID = (&h0000000B)
1347Const SECURITY_RESTRICTED_CODE_RID = (&h0000000C)
1348Const SECURITY_TERMINAL_SERVER_RID = (&h0000000D)
1349Const SECURITY_REMOTE_LOGON_RID = (&h0000000E)
1350Const SECURITY_THIS_ORGANIZATION_RID = (&h0000000F)
1351Const SECURITY_IUSER_RID = (&h00000011)
1352Const SECURITY_LOCAL_SYSTEM_RID = (&h00000012)
1353Const SECURITY_LOCAL_SERVICE_RID = (&h00000013)
1354Const SECURITY_NETWORK_SERVICE_RID = (&h00000014)
1355
1356Const SECURITY_NT_NON_UNIQUE = (&h00000015)
1357Const SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT = (3)
1358
1359Const SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID = (&h00000016)
1360
1361Const SECURITY_BUILTIN_DOMAIN_RID = (&h00000020)
1362Const SECURITY_WRITE_RESTRICTED_CODE_RID = (&h00000021)
1363
1364
1365Const SECURITY_PACKAGE_BASE_RID = (&h00000040)
1366Const SECURITY_PACKAGE_RID_COUNT = (2)
1367Const SECURITY_PACKAGE_NTLM_RID = (&h0000000A)
1368Const SECURITY_PACKAGE_SCHANNEL_RID = (&h0000000E)
1369Const SECURITY_PACKAGE_DIGEST_RID = (&h00000015)
1370
1371Const SECURITY_SERVICE_ID_BASE_RID = (&h00000050)
1372Const SECURITY_SERVICE_ID_RID_COUNT = (6)
1373
1374Const SECURITY_RESERVED_ID_BASE_RID = (&h00000051)
1375
1376Const SECURITY_MAX_ALWAYS_FILTERED = (&h000003E7)
1377Const SECURITY_MIN_NEVER_FILTERED = (&h000003E8)
1378
1379Const SECURITY_OTHER_ORGANIZATION_RID = (&h000003E8)
1380
1381' well-known domain relative sub-authority values (RIDs)...
1382' Well-known users ...
1383Const FOREST_USER_RID_MAX = (&h000001F3)
1384
1385Const DOMAIN_USER_RID_ADMIN = (&h000001F4)
1386Const DOMAIN_USER_RID_GUEST = (&h000001F5)
1387Const DOMAIN_USER_RID_KRBTGT = (&h000001F6)
1388
1389Const DOMAIN_USER_RID_MAX = (&h000003E7)
1390
1391' well-known groups ...
1392Const DOMAIN_GROUP_RID_ADMINS = (&h00000200)
1393Const DOMAIN_GROUP_RID_USERS = (&h00000201)
1394Const DOMAIN_GROUP_RID_GUESTS = (&h00000202)
1395Const DOMAIN_GROUP_RID_COMPUTERS = (&h00000203)
1396Const DOMAIN_GROUP_RID_CONTROLLERS = (&h00000204)
1397Const DOMAIN_GROUP_RID_CERT_ADMINS = (&h00000205)
1398Const DOMAIN_GROUP_RID_SCHEMA_ADMINS = (&h00000206)
1399Const DOMAIN_GROUP_RID_ENTERPRISE_ADMINS = (&h00000207)
1400Const DOMAIN_GROUP_RID_POLICY_ADMINS = (&h00000208)
1401Const DOMAIN_GROUP_RID_READONLY_CONTROLLERS = (&h00000209)
1402
1403' well-known aliases ...
1404Const DOMAIN_ALIAS_RID_ADMINS = (&h00000220)
1405Const DOMAIN_ALIAS_RID_USERS = (&h00000221)
1406Const DOMAIN_ALIAS_RID_GUESTS = (&h00000222)
1407Const DOMAIN_ALIAS_RID_POWER_USERS = (&h00000223)
1408
1409Const DOMAIN_ALIAS_RID_ACCOUNT_OPS = (&h00000224)
1410Const DOMAIN_ALIAS_RID_SYSTEM_OPS = (&h00000225)
1411Const DOMAIN_ALIAS_RID_PRINT_OPS = (&h00000226)
1412Const DOMAIN_ALIAS_RID_BACKUP_OPS = (&h00000227)
1413
1414Const DOMAIN_ALIAS_RID_REPLICATOR = (&h00000228)
1415Const DOMAIN_ALIAS_RID_RAS_SERVERS = (&h00000229)
1416Const DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = (&h0000022A)
1417Const DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = (&h0000022B)
1418Const DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = (&h0000022C)
1419Const DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = (&h0000022D)
1420
1421Const DOMAIN_ALIAS_RID_MONITORING_USERS = (&h0000022E)
1422Const DOMAIN_ALIAS_RID_LOGGING_USERS = (&h0000022F)
1423Const DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = (&h00000230)
1424Const DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = (&h00000231)
1425Const DOMAIN_ALIAS_RID_DCOM_USERS = (&h00000232)
1426Const DOMAIN_ALIAS_RID_IUSERS = (&h00000238)
1427Const DOMAIN_ALIAS_RID_CRYPTO_OPERATORS = (&h00000239)
1428Const DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP = (&h0000023B)
1429Const DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP = (&h0000023C)
1430Const DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP = (&h0000023D)
1431
1432'Const SECURITY_MANDATORY_LABEL_AUTHORITY = [0, 0, 0, 0 ,0, 16] As SID_IDENTIFIER_AUTHORITY
1433Const SECURITY_MANDATORY_UNTRUSTED_RID = (&h00000000)
1434Const SECURITY_MANDATORY_LOW_RID = (&h00001000)
1435Const SECURITY_MANDATORY_MEDIUM_RID = (&h00002000)
1436Const SECURITY_MANDATORY_HIGH_RID = (&h00003000)
1437Const SECURITY_MANDATORY_SYSTEM_RID = (&h00004000)
1438Const SECURITY_MANDATORY_PROTECTED_PROCESS_RID = (&h00005000)
1439
1440
1441Const SECURITY_MANDATORY_MAXIMUM_USER_RID = SECURITY_MANDATORY_SYSTEM_RID
1442
1443Const MANDATORY_LEVEL_TO_MANDATORY_RID(I) = (I * &h1000)
1444
1445' Well known SID definitions for lookup.
1446Const Enum WELL_KNOWN_SID_TYPE
1447 WinNullSid = 0
1448 WinWorldSid = 1
1449 WinLocalSid = 2
1450 WinCreatorOwnerSid = 3
1451 WinCreatorGroupSid = 4
1452 WinCreatorOwnerServerSid = 5
1453 WinCreatorGroupServerSid = 6
1454 WinNtAuthoritySid = 7
1455 WinDialupSid = 8
1456 WinNetworkSid = 9
1457 WinBatchSid = 10
1458 WinInteractiveSid = 11
1459 WinServiceSid = 12
1460 WinAnonymousSid = 13
1461 WinProxySid = 14
1462 WinEnterpriseControllersSid = 15
1463 WinSelfSid = 16
1464 WinAuthenticatedUserSid = 17
1465 WinRestrictedCodeSid = 18
1466 WinTerminalServerSid = 19
1467 WinRemoteLogonIdSid = 20
1468 WinLogonIdsSid = 21
1469 WinLocalSystemSid = 22
1470 WinLocalServiceSid = 23
1471 WinNetworkServiceSid = 24
1472 WinBuiltinDomainSid = 25
1473 WinBuiltinAdministratorsSid = 26
1474 WinBuiltinUsersSid = 27
1475 WinBuiltinGuestsSid = 28
1476 WinBuiltinPowerUsersSid = 29
1477 WinBuiltinAccountOperatorsSid = 30
1478 WinBuiltinSystemOperatorsSid = 31
1479 WinBuiltinPrintOperatorsSid = 32
1480 WinBuiltinBackupOperatorsSid = 33
1481 WinBuiltinReplicatorSid = 34
1482 WinBuiltinPreWindows2000CompatibleAccessSid = 35
1483 WinBuiltinRemoteDesktopUsersSid = 36
1484 WinBuiltinNetworkConfigurationOperatorsSid = 37
1485 WinAccountAdministratorSid = 38
1486 WinAccountGuestSid = 39
1487 WinAccountKrbtgtSid = 40
1488 WinAccountDomainAdminsSid = 41
1489 WinAccountDomainUsersSid = 42
1490 WinAccountDomainGuestsSid = 43
1491 WinAccountComputersSid = 44
1492 WinAccountControllersSid = 45
1493 WinAccountCertAdminsSid = 46
1494 WinAccountSchemaAdminsSid = 47
1495 WinAccountEnterpriseAdminsSid = 48
1496 WinAccountPolicyAdminsSid = 49
1497 WinAccountRasAndIasServersSid = 50
1498 WinNTLMAuthenticationSid = 51
1499 WinDigestAuthenticationSid = 52
1500 WinSChannelAuthenticationSid = 53
1501 WinThisOrganizationSid = 54
1502 WinOtherOrganizationSid = 55
1503 WinBuiltinIncomingForestTrustBuildersSid = 56
1504 WinBuiltinPerfMonitoringUsersSid = 57
1505 WinBuiltinPerfLoggingUsersSid = 58
1506 WinBuiltinAuthorizationAccessSid = 59
1507 WinBuiltinTerminalServerLicenseServersSid = 60
1508 WinBuiltinDCOMUsersSid = 61
1509 WinBuiltinIUsersSid = 62
1510 WinIUserSid = 63
1511 WinBuiltinCryptoOperatorsSid = 64
1512 WinUntrustedLabelSid = 65
1513 WinLowLabelSid = 66
1514 WinMediumLabelSid = 67
1515 WinHighLabelSid = 68
1516 WinSystemLabelSid = 69
1517 WinWriteRestrictedCodeSid = 70
1518 WinCreatorOwnerRightsSid = 71
1519 WinCacheablePrincipalsGroupSid = 72
1520 WinNonCacheablePrincipalsGroupSid = 73
1521 WinEnterpriseReadonlyControllersSid = 74
1522 WinAccountReadonlyControllersSid = 75
1523 WinBuiltinEventLogReadersGroup = 76
1524End Enum
1525
1526'Const SYSTEM_LUID = [&h3e7, &h0] As LUID
1527'Const ANONYMOUS_LOGON_LUID = [&h3e6, &h0] As LUID
1528'Const LOCALSERVICE_LUID = [&h3e5, &h0] As LUID
1529'Const NETWORKSERVICE_LUID = [&h3e4, &h0] As LUID
1530'Const IUSER_LUID = [&h3e3, &h0] As LUID
1531
1532' User and Group related SID attributes
1533
1534' Group attributes
1535Const SE_GROUP_MANDATORY = (&h00000001)
1536Const SE_GROUP_ENABLED_BY_DEFAULT = (&h00000002)
1537Const SE_GROUP_ENABLED = (&h00000004)
1538Const SE_GROUP_OWNER = (&h00000008)
1539Const SE_GROUP_USE_FOR_DENY_ONLY = (&h00000010)
1540Const SE_GROUP_INTEGRITY = (&h00000020)
1541Const SE_GROUP_INTEGRITY_ENABLED = (&h00000040)
1542Const SE_GROUP_LOGON_ID = (&hC0000000)
1543Const SE_GROUP_RESOURCE = (&h20000000)
1544
1545Const SE_GROUP_VALID_ATTRIBUTES = (SE_GROUP_MANDATORY Or SE_GROUP_ENABLED_BY_DEFAULT Or SE_GROUP_ENABLED Or SE_GROUP_OWNER Or SE_GROUP_USE_FOR_DENY_ONLY Or SE_GROUP_LOGON_ID Or SE_GROUP_RESOURCE Or SE_GROUP_INTEGRITY Or SE_GROUP_INTEGRITY_ENABLED)
1546
1547' ACL and ACE
1548Const ACL_REVISION = (2)
1549Const ACL_REVISION_DS = (4)
1550
1551Const ACL_REVISION1 = (1)
1552Const MIN_ACL_REVISION = ACL_REVISION2
1553Const ACL_REVISION2 = (2)
1554Const ACL_REVISION3 = (3)
1555Const ACL_REVISION4 = (4)
1556Const MAX_ACL_REVISION = ACL_REVISION4
1557
1558Type ACL
1559 AclRevision As Byte
1560 Sbz1 As Byte
1561 AclSize As Word
1562 AceCount As Word
1563 Sbz2 As Word
1564End Type
1565TypeDef PACL = ACL
1566
1567Type ACE_HEADER
1568 AceType As Byte
1569 AceFlags As Byte
1570 AceSize As Word
1571End Type
1572TypeDef PACE_HEADER = *ACE_HEADER
1573
1574Const ACCESS_MIN_MS_ACE_TYPE = (&h0)
1575Const ACCESS_ALLOWED_ACE_TYPE = (&h0)
1576Const ACCESS_DENIED_ACE_TYPE = (&h1)
1577Const SYSTEM_AUDIT_ACE_TYPE = (&h2)
1578Const SYSTEM_ALARM_ACE_TYPE = (&h3)
1579Const ACCESS_MAX_MS_V2_ACE_TYPE = (&h3)
1580
1581Const ACCESS_ALLOWED_COMPOUND_ACE_TYPE = (&h4)
1582Const ACCESS_MAX_MS_V3_ACE_TYPE = (&h4)
1583
1584Const ACCESS_MIN_MS_OBJECT_ACE_TYPE = (&h5)
1585Const ACCESS_ALLOWED_OBJECT_ACE_TYPE = (&h5)
1586Const ACCESS_DENIED_OBJECT_ACE_TYPE = (&h6)
1587Const SYSTEM_AUDIT_OBJECT_ACE_TYPE = (&h7)
1588Const SYSTEM_ALARM_OBJECT_ACE_TYPE = (&h8)
1589Const ACCESS_MAX_MS_OBJECT_ACE_TYPE = (&h8)
1590
1591Const ACCESS_MAX_MS_V4_ACE_TYPE = (&h8)
1592Const ACCESS_MAX_MS_ACE_TYPE = (&h8)
1593
1594Const ACCESS_ALLOWED_CALLBACK_ACE_TYPE = (&h9)
1595Const ACCESS_DENIED_CALLBACK_ACE_TYPE = (&hA)
1596Const ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE = (&hB)
1597Const ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE = (&hC)
1598Const SYSTEM_AUDIT_CALLBACK_ACE_TYPE = (&hD)
1599Const SYSTEM_ALARM_CALLBACK_ACE_TYPE = (&hE)
1600Const SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE = (&hF)
1601Const SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE = (&h10)
1602
1603Const SYSTEM_MANDATORY_LABEL_ACE_TYPE = (&h11)
1604Const ACCESS_MAX_MS_V5_ACE_TYPE = (&h11)
1605
1606Const OBJECT_INHERIT_ACE = (&h1)
1607Const CONTAINER_INHERIT_ACE = (&h2)
1608Const NO_PROPAGATE_INHERIT_ACE = (&h4)
1609Const INHERIT_ONLY_ACE = (&h8)
1610Const INHERITED_ACE = (&h10)
1611Const VALID_INHERIT_FLAGS = (&h1F)
1612
1613Const SUCCESSFUL_ACCESS_ACE_FLAG = (&h40)
1614Const FAILED_ACCESS_ACE_FLAG = (&h80)
1615
1616Type ACCESS_ALLOWED_ACE
1617 Header As ACE_HEADER
1618 Mask As ACCESS_MASK
1619 SidStart As DWord
1620End Type
1621TypeDef PACCESS_ALLOWED_ACE = *ACCESS_ALLOWED_ACE
1622
1623Type ACCESS_DENIED_ACE
1624 Header As ACE_HEADER
1625 Mask As ACCESS_MASK
1626 SidStart As DWord
1627End Type
1628TypeDef PACCESS_DENIED_ACE = *ACCESS_DENIED_ACE
1629
1630Type SYSTEM_AUDIT_ACE
1631 Header As ACE_HEADER
1632 Mask As ACCESS_MASK
1633 SidStart As DWord
1634End Type
1635TypeDef PSYSTEM_AUDIT_ACE = *SYSTEM_AUDIT_ACE
1636
1637Type SYSTEM_ALARM_ACE
1638 Header As ACE_HEADER
1639 Mask As ACCESS_MASK
1640 SidStart As DWord
1641End Type
1642TypeDef PSYSTEM_ALARM_ACE = *SYSTEM_ALARM_ACE
1643
1644Type SYSTEM_MANDATORY_LABEL_ACE
1645 Header As ACE_HEADER
1646 Mask As ACCESS_MASK
1647 SidStart As DWord
1648End Type
1649TypeDef PSYSTEM_MANDATORY_LABEL_ACE = *SYSTEM_MANDATORY_LABEL_ACE
1650
1651Const SYSTEM_MANDATORY_LABEL_NO_WRITE_UP = &h1
1652Const SYSTEM_MANDATORY_LABEL_NO_READ_UP = &h2
1653Const SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP = &h4
1654
1655Const SYSTEM_MANDATORY_LABEL_VALID_MASK = (SYSTEM_MANDATORY_LABEL_NO_WRITE_UP Or SYSTEM_MANDATORY_LABEL_NO_READ_UP Or SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP)
1656
1657Type ACCESS_ALLOWED_OBJECT_ACE
1658 Header As ACE_HEADER
1659 Mask As ACCESS_MASK
1660 Flags As DWord
1661 ObjectType As GUID
1662 InheritedObjectType As GUID
1663 SidStart As DWord
1664End Type
1665TypeDef PACCESS_ALLOWED_OBJECT_ACE = *ACCESS_ALLOWED_OBJECT_ACE
1666
1667Type ACCESS_DENIED_OBJECT_ACE
1668 Header As ACE_HEADER
1669 Mask As ACCESS_MASK
1670 Flags As DWord
1671 ObjectType As GUID
1672 InheritedObjectType As GUID
1673 SidStart As DWord
1674End Type
1675TypeDef PACCESS_DENIED_OBJECT_ACE = *ACCESS_DENIED_OBJECT_ACE
1676
1677Type SYSTEM_AUDIT_OBJECT_ACE
1678 Header As ACE_HEADER
1679 Mask As ACCESS_MASK
1680 Flags As DWord
1681 ObjectType As GUID
1682 InheritedObjectType As GUID
1683 SidStart As DWord
1684End Type
1685TypeDef PSYSTEM_AUDIT_OBJECT_ACE = *SYSTEM_AUDIT_OBJECT_ACE
1686
1687Type SYSTEM_ALARM_OBJECT_ACE
1688 Header As ACE_HEADER
1689 Mask As ACCESS_MASK
1690 Flags As DWord
1691 ObjectType As GUID
1692 InheritedObjectType As GUID
1693 SidStart As DWord
1694End Type
1695TypeDef PSYSTEM_ALARM_OBJECT_ACE = *SYSTEM_ALARM_OBJECT_ACE
1696
1697Type ACCESS_ALLOWED_CALLBACK_ACE
1698 Header As ACE_HEADER
1699 Mask As ACCESS_MASK
1700 SidStart As DWord
1701End Type
1702TypeDef PACCESS_ALLOWED_CALLBACK_ACE = *ACCESS_ALLOWED_CALLBACK_ACE
1703
1704Type ACCESS_DENIED_CALLBACK_ACE
1705 Header As ACE_HEADER
1706 Mask As ACCESS_MASK
1707 SidStart As DWord
1708End Type
1709TypeDef PACCESS_DENIED_CALLBACK_ACE = *ACCESS_DENIED_CALLBACK_ACE
1710
1711Type SYSTEM_AUDIT_CALLBACK_ACE
1712 Header As ACE_HEADER
1713 Mask As ACCESS_MASK
1714 SidStart As DWord
1715End Type
1716TypeDef PSYSTEM_AUDIT_CALLBACK_ACE = *SYSTEM_AUDIT_CALLBACK_ACE
1717
1718Type SYSTEM_ALARM_CALLBACK_ACE
1719 Header As ACE_HEADER
1720 Mask As ACCESS_MASK
1721 SidStart As DWord
1722End Type
1723TypeDef PSYSTEM_ALARM_CALLBACK_ACE = *SYSTEM_ALARM_CALLBACK_ACE
1724
1725Type ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
1726 Header As ACE_HEADER
1727 Mask As ACCESS_MASK
1728 Flags As DWord
1729 ObjectType As GUID
1730 InheritedObjectType As GUID
1731 SidStart As DWord
1732End Type
1733TypeDef PACCESS_ALLOWED_CALLBACK_OBJECT_ACE = *ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
1734
1735Type ACCESS_DENIED_CALLBACK_OBJECT_ACE
1736 Header As ACE_HEADER
1737 Mask As ACCESS_MASK
1738 Flags As DWord
1739 ObjectType As GUID
1740 InheritedObjectType As GUID
1741 SidStart As DWord
1742End Type
1743TypeDef PACCESS_DENIED_CALLBACK_OBJECT_ACE = *ACCESS_DENIED_CALLBACK_OBJECT_ACE
1744
1745Type SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
1746 Header As ACE_HEADER
1747 Mask As ACCESS_MASK
1748 Flags As DWord
1749 ObjectType As GUID
1750 InheritedObjectType As GUID
1751 SidStart As DWord
1752End Type
1753TypeDef PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE = *SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
1754
1755Type SYSTEM_ALARM_CALLBACK_OBJECT_ACE
1756 Header As ACE_HEADER
1757 Mask As ACCESS_MASK
1758 Flags As DWord
1759 ObjectType As GUID
1760 InheritedObjectType As GUID
1761 SidStart As DWord
1762End Type
1763TypeDef PSYSTEM_ALARM_CALLBACK_OBJECT_ACE = *SYSTEM_ALARM_CALLBACK_OBJECT_ACE
1764
1765Const ACE_OBJECT_TYPE_PRESENT = &h1
1766Const ACE_INHERITED_OBJECT_TYPE_PRESENT = &h2
1767
1768Enum ACL_INFORMATION_CLASS
1769 AclRevisionInformation = 1
1770 AclSizeInformation
1771End Enum
1772
1773Type ACL_REVISION_INFORMATION
1774 AclRevision As DWord
1775End Type
1776TypeDef PACL_REVISION_INFORMATION = *ACL_REVISION_INFORMATION
1777
1778Type ACL_SIZE_INFORMATION
1779AceCount As DWord
1780AclBytesInUse As DWord
1781AclBytesFree As DWord
1782End Type
1783TypeDef PACL_SIZE_INFORMATION = *ACL_SIZE_INFORMATION
1784
1785' SECURITY_DESCRIPTOR
1786Const SECURITY_DESCRIPTOR_REVISION = (1)
1787Const SECURITY_DESCRIPTOR_REVISION1 = (1)
1788
1789Const SECURITY_DESCRIPTOR_MIN_LENGTH = (SizeOf (SECURITY_DESCRIPTOR))
1790
1791TypeDef SECURITY_DESCRIPTOR_CONTROL = Word
1792TypeDef PSECURITY_DESCRIPTOR_CONTROL = *SECURITY_DESCRIPTOR_CONTROL
1793
1794Const SE_OWNER_DEFAULTED = (&h0001)
1795Const SE_GROUP_DEFAULTED = (&h0002)
1796Const SE_DACL_PRESENT = (&h0004)
1797Const SE_DACL_DEFAULTED = (&h0008)
1798Const SE_SACL_PRESENT = (&h0010)
1799Const SE_SACL_DEFAULTED = (&h0020)
1800Const SE_DACL_AUTO_INHERIT_REQ = (&h0100)
1801Const SE_SACL_AUTO_INHERIT_REQ = (&h0200)
1802Const SE_DACL_AUTO_INHERITED = (&h0400)
1803Const SE_SACL_AUTO_INHERITED = (&h0800)
1804Const SE_DACL_PROTECTED = (&h1000)
1805Const SE_SACL_PROTECTED = (&h2000)
1806Const SE_RM_CONTROL_VALID = (&h4000)
1807Const SE_SELF_RELATIVE = (&h8000)
1808
1809Type SECURITY_DESCRIPTOR_RELATIVE
1810 Revision As Byte
1811 Sbz1 As Byte
1812 Control As SECURITY_DESCRIPTOR_CONTROL
1813 Owner As DWord
1814 Group As DWord
1815 Sacl As DWord
1816 Dacl As DWord
1817End Type
1818TypeDef PSECURITY_DESCRIPTOR_RELATIVE = *SECURITY_DESCRIPTOR_RELATIVE
1819
1820Type SECURITY_DESCRIPTOR
1821 Revision As Byte
1822 Sbz1 As Byte
1823 Control As SECURITY_DESCRIPTOR_CONTROL
1824 Owner As PSID
1825 Group As PSID
1826 Sacl As PACL
1827 Dacl As PACL
1828End Type
1829TypeDef PSECURITY_DESCRIPTOR = *SECURITY_DESCRIPTOR
1830
1831Type OBJECT_TYPE_LIST
1832 Level As Word
1833 Sbz As Word
1834 ObjectType As *GUID
1835End Type
1836TypeDef POBJECT_TYPE_LIST = *OBJECT_TYPE_LIST
1837
1838Const ACCESS_OBJECT_GUID = 0
1839Const ACCESS_PROPERTY_SET_GUID = 1
1840Const ACCESS_PROPERTY_GUID = 2
1841
1842Const ACCESS_MAX_LEVEL = 4
1843
1844Const Enum AUDIT_EVENT_TYPE
1845 AuditEventObjectAccess,
1846 AuditEventDirectoryServiceAccess
1847End Enum
1848TypeDef PAUDIT_EVENT_TYPE = *AUDIT_EVENT_TYPE
1849
1850Const AUDIT_ALLOW_NO_PRIVILEGE = &h1
1851
1852'Const ACCESS_DS_SOURCE_A = "DS"
1853'Const ACCESS_DS_SOURCE_W = L"DS"
1854'Const ACCESS_DS_OBJECT_TYPE_NAME_A = "Directory Service Object"
1855'Const ACCESS_DS_OBJECT_TYPE_NAME_W = L"Directory Service Object"
1856Const ACCESS_DS_SOURCE = "DS"
1857Const ACCESS_DS_OBJECT_TYPE_NAME = "Directory Service Object"
1858
1859Const SE_PRIVILEGE_ENABLED_BY_DEFAULT = (&h00000001)
1860Const SE_PRIVILEGE_ENABLED = (&h00000002)
1861Const SE_PRIVILEGE_REMOVED = (&h00000004)
1862Const SE_PRIVILEGE_USED_FOR_ACCESS = (&h80000000)
1863
1864Const SE_PRIVILEGE_VALID_ATTRIBUTES = (SE_PRIVILEGE_ENABLED_BY_DEFAULT Or SE_PRIVILEGE_ENABLED Or SE_PRIVILEGE_REMOVED Or SE_PRIVILEGE_USED_FOR_ACCESS)
1865
1866Const PRIVILEGE_SET_ALL_NECESSARY = (1)
1867
1868Type PRIVILEGE_SET
1869 PrivilegeCount As DWord
1870 Control As DWord
1871 Privilege[ELM(ANYSIZE_ARRAY)] As LUID_AND_ATTRIBUTES
1872End Type
1873TypeDef PPRIVILEGE_SET = *PRIVILEGE_SET
1874
1875' NT Defined Privileges
1876Const SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege"
1877Const SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege"
1878Const SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege"
1879Const SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege"
1880Const SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege"
1881Const SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege"
1882Const SE_TCB_NAME = "SeTcbPrivilege"
1883Const SE_SECURITY_NAME = "SeSecurityPrivilege"
1884Const SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege"
1885Const SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege"
1886Const SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege"
1887Const SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege"
1888Const SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege"
1889Const SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege"
1890Const SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege"
1891Const SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege"
1892Const SE_BACKUP_NAME = "SeBackupPrivilege"
1893Const SE_RESTORE_NAME = "SeRestorePrivilege"
1894Const SE_SHUTDOWN_NAME = "SeShutdownPrivilege"
1895Const SE_DEBUG_NAME = "SeDebugPrivilege"
1896Const SE_AUDIT_NAME = "SeAuditPrivilege"
1897Const SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege"
1898Const SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege"
1899Const SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege"
1900Const SE_UNDOCK_NAME = "SeUndockPrivilege"
1901Const SE_SYNC_AGENT_NAME = "SeSyncAgentPrivilege"
1902Const SE_ENABLE_DELEGATION_NAME = "SeEnableDelegationPrivilege"
1903Const SE_MANAGE_VOLUME_NAME = "SeManageVolumePrivilege"
1904Const SE_IMPERSONATE_NAME = "SeImpersonatePrivilege"
1905Const SE_CREATE_GLOBAL_NAME = "SeCreateGlobalPrivilege"
1906Const SE_TRUSTED_CREDMAN_ACCESS_NAME = "SeTrustedCredManAccessPrivilege"
1907Const SE_RELABEL_NAME = "SeRelabelPrivilege"
1908Const SE_INC_WORKING_SET_NAME = "SeIncreaseWorkingSetPrivilege"
1909Const SE_TIME_ZONE_NAME = "SeTimeZonePrivilege"
1910Const SE_CREATE_SYMBOLIC_LINK_NAME = "SeCreateSymbolicLinkPrivilege"
1911
1912' Security Quality Of Service
1913Const Enum SECURITY_IMPERSONATION_LEVEL
1914 SecurityAnonymous
1915 SecurityIdentification
1916 SecurityImpersonation
1917 SecurityDelegation
1918End Enum
1919TypeDef PSECURITY_IMPERSONATION_LEVEL = *SECURITY_IMPERSONATION_LEVEL
1920
1921Const SECURITY_MAX_IMPERSONATION_LEVEL = SecurityDelegation
1922Const SECURITY_MIN_IMPERSONATION_LEVEL = SecurityAnonymous
1923Const DEFAULT_IMPERSONATION_LEVEL = SecurityImpersonation
1924Const VALID_IMPERSONATION_LEVEL(L) = (((L) >= SECURITY_MIN_IMPERSONATION_LEVEL) And ((L) <= SECURITY_MAX_IMPERSONATION_LEVEL))
1925
1926' Token Object Definitions
1927
1928' Token Specific Access Rights.
1929Const TOKEN_ASSIGN_PRIMARY = (&h0001)
1930Const TOKEN_DUPLICATE = (&h0002)
1931Const TOKEN_IMPERSONATE = (&h0004)
1932Const TOKEN_QUERY = (&h0008)
1933Const TOKEN_QUERY_SOURCE = (&h0010)
1934Const TOKEN_ADJUST_PRIVILEGES = (&h0020)
1935Const TOKEN_ADJUST_GROUPS = (&h0040)
1936Const TOKEN_ADJUST_DEFAULT = (&h0080)
1937Const TOKEN_ADJUST_SESSIONID = (&h0100)
1938
1939Const TOKEN_ALL_ACCESS_P = (STANDARD_RIGHTS_REQUIRED Or TOKEN_ASSIGN_PRIMARY Or TOKEN_DUPLICATE Or TOKEN_IMPERSONATE Or TOKEN_QUERY Or TOKEN_QUERY_SOURCE Or TOKEN_ADJUST_PRIVILEGES Or TOKEN_ADJUST_GROUPS Or TOKEN_ADJUST_DEFAULT)
1940'#if ((defined(_WIN32_WINNT) And (_WIN32_WINNT > &h0400)) Or (!defined(_WIN32_WINNT)))
1941Const TOKEN_ALL_ACCESS = (TOKEN_ALL_ACCESS_P Or TOKEN_ADJUST_SESSIONID)
1942'#else
1943'Const TOKEN_ALL_ACCESS = (TOKEN_ALL_ACCESS_P)
1944'#endif
1945Const TOKEN_READ = (STANDARD_RIGHTS_READ Or TOKEN_QUERY)
1946Const TOKEN_WRITE = (STANDARD_RIGHTS_WRITE Or TOKEN_ADJUST_PRIVILEGES Or TOKEN_ADJUST_GROUPS Or TOKEN_ADJUST_DEFAULT)
1947Const TOKEN_EXECUTE = (STANDARD_RIGHTS_EXECUTE)
1948
1949' Token Types
1950Const Enum TOKEN_TYPE
1951 TokenPrimary = 1
1952 TokenImpersonation
1953End Enum
1954TypeDef PTOKEN_TYPE = *TOKEN_TYPE
1955
1956Const Enum TOKEN_ELEVATION_TYPE
1957 TokenElevationTypeDefault = 1
1958 TokenElevationTypeFull
1959 TokenElevationTypeLimited
1960End Enum
1961TypeDef PTOKEN_ELEVATION_TYPE = TOKEN_ELEVATION_TYPE
1962
1963' Token Information Classes.
1964Const Enum TOKEN_INFORMATION_CLASS
1965 TokenUser = 1
1966 TokenGroups
1967 TokenPrivileges
1968 TokenOwner
1969 TokenPrimaryGroup
1970 TokenDefaultDacl
1971 TokenSource
1972 TokenType
1973 TokenImpersonationLevel
1974 TokenStatistics
1975 TokenRestrictedSids
1976 TokenSessionId
1977 TokenGroupsAndPrivileges
1978 TokenSessionReference
1979 TokenSandBoxInert
1980 TokenAuditPolicy
1981 TokenOrigin
1982 TokenElevationType
1983 TokenLinkedToken
1984 TokenElevation
1985 TokenHasRestrictions
1986 TokenAccessInformation
1987 TokenVirtualizationAllowed
1988 TokenVirtualizationEnabled
1989 TokenIntegrityLevel
1990 TokenUIAccess
1991 TokenMandatoryPolicy
1992 TokenLogonSid
1993 MaxTokenInfoClass
1994End Enum
1995TypeDef PTOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS
1996
1997Type TOKEN_USER
1998 User As SID_AND_ATTRIBUTES
1999End Type
2000TypeDef PTOKEN_USER = *TOKEN_USER
2001
2002Type TOKEN_GROUPS
2003 GroupCount As DWord
2004 Groups[ELM(ANYSIZE_ARRAY)] As SID_AND_ATTRIBUTES
2005End Type
2006TypeDef PTOKEN_GROUPS = *TOKEN_GROUPS
2007
2008Type TOKEN_PRIVILEGES
2009 PrivilegeCount As DWord
2010 Privileges[ELM(ANYSIZE_ARRAY)] As LUID_AND_ATTRIBUTES
2011End Type
2012TypeDef PTOKEN_PRIVILEGES = *TOKEN_PRIVILEGES
2013
2014Type TOKEN_OWNER
2015 Owner As PSID
2016End Type
2017TypeDef PTOKEN_OWNER = TOKEN_OWNER
2018
2019Type TOKEN_PRIMARY_GROUP
2020 PrimaryGroup As PSID
2021End Type
2022TypeDef PTOKEN_PRIMARY_GROUP = TOKEN_PRIMARY_GROUP
2023
2024Type TOKEN_DEFAULT_DACL
2025 DefaultDacl As PACL
2026End Type
2027TypeDef PTOKEN_DEFAULT_DACL = *TOKEN_DEFAULT_DACL
2028
2029Type TOKEN_GROUPS_AND_PRIVILEGES
2030 SidCount As DWord
2031 SidLength As DWord
2032 Sids As PSID_AND_ATTRIBUTES
2033 RestrictedSidCount As DWord
2034 RestrictedSidLength As DWord
2035 RestrictedSids As PSID_AND_ATTRIBUTES
2036 PrivilegeCount As DWord
2037 PrivilegeLength As DWord
2038 Privileges As VoidPtr 'PLUID_AND_ATTRIBUTES
2039 AuthenticationId As LUID
2040End Type
2041TypeDef PTOKEN_GROUPS_AND_PRIVILEGES = *TOKEN_GROUPS_AND_PRIVILEGES
2042
2043Type TOKEN_LINKED_TOKEN
2044 LinkedToken As HANDLE
2045End Type
2046TypeDef PTOKEN_LINKED_TOKEN = *TOKEN_LINKED_TOKEN
2047
2048Type TOKEN_ELEVATION
2049 TokenIsElevated As DWord
2050End Type
2051TypeDef PTOKEN_ELEVATION = *TOKEN_ELEVATION
2052
2053Type TOKEN_MANDATORY_LABEL
2054 Label As SID_AND_ATTRIBUTES
2055End Type
2056TypeDef PTOKEN_MANDATORY_LABEL = *TOKEN_MANDATORY_LABEL
2057
2058Const TOKEN_MANDATORY_POLICY_OFF = &h0
2059Const TOKEN_MANDATORY_POLICY_NO_WRITE_UP = &h1
2060Const TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN = &h2
2061
2062Const TOKEN_MANDATORY_POLICY_VALID_MASK = (TOKEN_MANDATORY_POLICY_NO_WRITE_UP Or TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN)
2063
2064Type TOKEN_MANDATORY_POLICY
2065 Policy As DWord
2066End Type
2067TypeDef PTOKEN_MANDATORY_POLICY = *TOKEN_MANDATORY_POLICY
2068
2069Type TOKEN_ACCESS_INFORMATION
2070 SidHash As PSID_AND_ATTRIBUTES_HASH
2071 RestrictedSidHash As PSID_AND_ATTRIBUTES_HASH
2072 Privileges As PTOKEN_PRIVILEGES
2073 AuthenticationId As LUID
2074 TokenType As TOKEN_TYPE
2075 ImpersonationLevel As SECURITY_IMPERSONATION_LEVEL
2076 MandatoryPolicy As TOKEN_MANDATORY_POLICY
2077 Flags As DWord
2078End Type
2079TypeDef PTOKEN_ACCESS_INFORMATION = *TOKEN_ACCESS_INFORMATION
2080
2081Const POLICY_AUDIT_SUBCATEGORY_COUNT = (50)
2082
2083Type TOKEN_AUDIT_POLICY
2084 PerUserPolicy[ELM(((POLICY_AUDIT_SUBCATEGORY_COUNT) >> 1) + 1)] As Byte
2085End Type
2086TypeDef PTOKEN_AUDIT_POLICY = TOKEN_AUDIT_POLICY
2087
2088Const TOKEN_SOURCE_LENGTH = 8
2089
2090Type TOKEN_SOURCE
2091 SourceName[ELM(TOKEN_SOURCE_LENGTH)] As CHAR
2092 SourceIdentifier As LUID
2093End Type
2094TypeDef PTOKEN_SOURCE = *TOKEN_SOURCE
2095
2096Type TOKEN_STATISTICS
2097 TokenId As LUID
2098 AuthenticationId As LUID
2099 ExpirationTime As LARGE_INTEGER
2100 TokenType As TOKEN_TYPE
2101 ImpersonationLevel As SECURITY_IMPERSONATION_LEVEL
2102 DynamicCharged As DWord
2103 DynamicAvailable As DWord
2104 GroupCount As DWord
2105 PrivilegeCount As DWord
2106 ModifiedId As LUID
2107End Type
2108TypeDef PTOKEN_STATISTICS = *TOKEN_STATISTICS
2109
2110Type TOKEN_CONTROL
2111 TokenId As LUID
2112 AuthenticationId As LUID
2113 ModifiedId As LUID
2114 TokenSource As TOKEN_SOURCE
2115End Type
2116TypeDef PTOKEN_CONTROL = *TOKEN_CONTROL
2117
2118Type TOKEN_ORIGIN
2119 OriginatingLogonSession As LUID
2120End Type
2121TypeDef PTOKEN_ORIGIN = *TOKEN_ORIGIN
2122
2123Const Enum MANDATORY_LEVEL
2124 MandatoryLevelUntrusted = 0
2125 MandatoryLevelLow
2126 MandatoryLevelMedium
2127 MandatoryLevelHigh
2128 MandatoryLevelSystem
2129 MandatoryLevelSecureProcess
2130 MandatoryLevelCount
2131End Enum
2132TypeDef PMANDATORY_LEVEL = *MANDATORY_LEVEL
2133
2134Const SECURITY_DYNAMIC_TRACKING = (TRUE)
2135Const SECURITY_STATIC_TRACKING = (FALSE)
2136
2137TypeDef SECURITY_CONTEXT_TRACKING_MODE = BOOLEAN
2138TypeDef PSECURITY_CONTEXT_TRACKING_MODE = *BOOLEAN
2139
2140Type SECURITY_QUALITY_OF_SERVICE
2141 Length As DWord
2142 ImpersonationLevel As SECURITY_IMPERSONATION_LEVEL
2143 ContextTrackingMode As SECURITY_CONTEXT_TRACKING_MODE
2144 EffectiveOnly As BOOLEAN
2145End Type
2146TypeDef PSECURITY_QUALITY_OF_SERVICE = *SECURITY_QUALITY_OF_SERVICE
2147
2148Type SE_IMPERSONATION_STATE
2149 Token As PACCESS_TOKEN
2150 CopyOnOpen As BOOLEAN
2151 EffectiveOnly As BOOLEAN
2152 Level As SECURITY_IMPERSONATION_LEVEL
2153End Type
2154TypeDef PSE_IMPERSONATION_STATE = *SE_IMPERSONATION_STATE
2155
2156Const DISABLE_MAX_PRIVILEGE = &h1
2157Const SANDBOX_INERT = &h2
2158Const LUA_TOKEN = &h4
2159Const WRITE_RESTRICTED = &h8
2160
2161TypeDef SECURITY_INFORMATION = DWord
2162TypeDef PSECURITY_INFORMATION = *DWord
2163
2164Const OWNER_SECURITY_INFORMATION = (&h00000001)
2165Const GROUP_SECURITY_INFORMATION = (&h00000002)
2166Const DACL_SECURITY_INFORMATION = (&h00000004)
2167Const SACL_SECURITY_INFORMATION = (&h00000008)
2168Const LABEL_SECURITY_INFORMATION = (&h00000010)
2169
2170Const PROTECTED_DACL_SECURITY_INFORMATION = (&h80000000)
2171Const PROTECTED_SACL_SECURITY_INFORMATION = (&h40000000)
2172Const UNPROTECTED_DACL_SECURITY_INFORMATION = (&h20000000)
2173Const UNPROTECTED_SACL_SECURITY_INFORMATION = (&h10000000)
2174
2175Const PROCESS_TERMINATE = (&h0001)
2176Const PROCESS_CREATE_THREAD = (&h0002)
2177Const PROCESS_SET_SESSIONID = (&h0004)
2178Const PROCESS_VM_OPERATION = (&h0008)
2179Const PROCESS_VM_READ = (&h0010)
2180Const PROCESS_VM_WRITE = (&h0020)
2181Const PROCESS_DUP_HANDLE = (&h0040)
2182Const PROCESS_CREATE_PROCESS = (&h0080)
2183Const PROCESS_SET_QUOTA = (&h0100)
2184Const PROCESS_SET_INFORMATION = (&h0200)
2185Const PROCESS_QUERY_INFORMATION = (&h0400)
2186Const PROCESS_SUSPEND_RESUME = (&h0800)
2187Const PROCESS_QUERY_LIMITED_INFORMATION = (&h1000)
2188'#if (NTDDI_VERSION >= NTDDI_LONGHORN)
2189'Const PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &hFFFF)
2190'#else
2191Const PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &hFFF)
2192'#endif
2193
2194#ifdef _WIN64
2195Const MAXIMUM_PROCESSORS = 64
2196#else
2197Const MAXIMUM_PROCESSORS = 32
2198#endif
2199
2200Const THREAD_TERMINATE = (&h0001)
2201Const THREAD_SUSPEND_RESUME = (&h0002)
2202Const THREAD_GET_CONTEXT = (&h0008)
2203Const THREAD_SET_CONTEXT = (&h0010)
2204Const THREAD_QUERY_INFORMATION = (&h0040)
2205Const THREAD_SET_INFORMATION = (&h0020)
2206Const THREAD_SET_THREAD_TOKEN = (&h0080)
2207Const THREAD_IMPERSONATE = (&h0100)
2208Const THREAD_DIRECT_IMPERSONATION = (&h0200)
2209Const THREAD_SET_LIMITED_INFORMATION = (&h0400)
2210Const THREAD_QUERY_LIMITED_INFORMATION = (&h0800)
2211'#if (NTDDI_VERSION >= NTDDI_LONGHORN)
2212'Const THREAD_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &hFFFF)
2213'#else
2214Const THREAD_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h3FF)
2215'#endif
2216Const JOB_OBJECT_ASSIGN_PROCESS = (&h0001)
2217Const JOB_OBJECT_SET_ATTRIBUTES = (&h0002)
2218Const JOB_OBJECT_QUERY = (&h0004)
2219Const JOB_OBJECT_TERMINATE = (&h0008)
2220Const JOB_OBJECT_SET_SECURITY_ATTRIBUTES = (&h0010)
2221Const JOB_OBJECT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h1F)
2222
2223Type JOB_SET_ARRAY
2224 JobHandle As HANDLE
2225 MemberLevel As DWord
2226 Flags As DWord
2227End Type
2228TypeDef PJOB_SET_ARRAY = *JOB_SET_ARRAY
2229
2230Const FLS_MAXIMUM_AVAILABLE = 128
2231Const TLS_MINIMUM_AVAILABLE = 64
2232
2233Type NT_TIB
2234 ExceptionList As VoidPtr '*EXCEPTION_REGISTRATION_RECORD
2235 StackBase As PVOID
2236 StackLimit As PVOID
2237 SubSystemTib As PVOID
2238' Union
2239 FiberData As PVOID
2240' Version As DWord
2241' End Union
2242 PVOID ArbitraryUserPointer As PVOID
2243 Self As *NT_TIB
2244End Type
2245TypeDef PNT_TIB = *NT_TIB
2246
2247Type NT_TIB32
2248 ExceptionList As DWord
2249 StackBase As DWord
2250 StackLimit As DWord
2251 SubSystemTib As DWord
2252' Union
2253 FiberData As DWord
2254' Version As DWord
2255' End Union
2256 ArbitraryUserPointer As DWord
2257 Self As DWord
2258End Type
2259TypeDef PNT_TIB32 = *NT_TIB32
2260
2261Type NT_TIB64
2262 ExceptionList As QWord
2263 StackBase As QWord
2264 StackLimit As QWord
2265 SubSystemTib As QWord
2266' Union
2267 FiberData As QWord
2268' Version As QWord
2269' End Union
2270 ArbitraryUserPointer As QWord
2271 Self As QWord
2272End Type
2273TypeDef PNT_TIB64 = *NT_TIB64
2274
2275Const THREAD_BASE_PRIORITY_LOWRT = 15
2276Const THREAD_BASE_PRIORITY_MAX = 2
2277Const THREAD_BASE_PRIORITY_MIN = (-2)
2278Const THREAD_BASE_PRIORITY_IDLE = (-15)
2279
2280Type QUOTA_LIMITS
2281 PagedPoolLimit As SIZE_T
2282 NonPagedPoolLimit As SIZE_T
2283 MinimumWorkingSetSize As SIZE_T
2284 MaximumWorkingSetSize As SIZE_T
2285 PagefileLimit As SIZE_T
2286 TimeLimit As LARGE_INTEGER
2287End Type
2288TypeDef PQUOTA_LIMITS = *QUOTA_LIMITS
2289
2290Const QUOTA_LIMITS_HARDWS_MIN_ENABLE = &h00000001
2291Const QUOTA_LIMITS_HARDWS_MIN_DISABLE = &h00000002
2292Const QUOTA_LIMITS_HARDWS_MAX_ENABLE = &h00000004
2293Const QUOTA_LIMITS_HARDWS_MAX_DISABLE = &h00000008
2294Const QUOTA_LIMITS_USE_DEFAULT_LIMITS = &h00000010
2295
2296Const PS_RATE_PHASE_BITS = 4
2297Const PS_RATE_PHASE_MASK = ((1 As DWord << PS_RATE_PHASE_BITS) - 1)
2298
2299Const Enum PS_RATE_PHASE
2300 PsRateOneSecond = 0
2301 PsRateTwoSecond
2302 PsRateThreeSecond
2303 PsRateMaxPhase
2304End Enum
2305
2306Type RATE_QUOTA_LIMIT
2307 RateData As DWord
2308 dummy As DWord
2309' Type
2310' DWORD RatePhase : PS_RATE_PHASE_BITS;
2311' DWORD RatePercent : 28;
2312' End Type
2313End Type
2314TypeDef PRATE_QUOTA_LIMIT = *RATE_QUOTA_LIMIT
2315
2316'#if !defined(SORTPP_PASS) && !defined(MIDL_PASS) && !defined(RC_INVOKED) && defined(_WIN64) && !defined(_X86AMD64_)
2317'C_ASSERT (sizeof (DWORD) * 8 - PS_RATE_PHASE_BITS == 28);
2318'#endif
2319
2320Type QUOTA_LIMITS_EX
2321 PagedPoolLimit As SIZE_T
2322 NonPagedPoolLimit As SIZE_T
2323 MinimumWorkingSetSize As SIZE_T
2324 MaximumWorkingSetSize As SIZE_T
2325 PagefileLimit As SIZE_T
2326 TimeLimit As LARGE_INTEGER
2327 WorkingSetLimit As SIZE_T
2328 Reserved2 As SIZE_T
2329 Reserved3 As SIZE_T
2330 Reserved4 As SIZE_T
2331 Flags As DWord
2332 CpuRateLimit As RATE_QUOTA_LIMIT
2333End Type
2334TypeDef PQUOTA_LIMITS_EX = *QUOTA_LIMITS_EX
2335
2336Type IO_COUNTERS
2337 ReadOperationCount As QWord
2338 WriteOperationCount As QWord
2339 OtherOperationCount As QWord
2340 ReadTransferCount As QWord
2341 WriteTransferCount As QWord
2342 OtherTransferCount As QWord
2343End Type
2344TypeDef PIO_COUNTERS = IO_COUNTERS
2345
2346Type JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
2347 TotalUserTime As LARGE_INTEGER
2348 TotalKernelTime As LARGE_INTEGER
2349 ThisPeriodTotalUserTime As LARGE_INTEGER
2350 ThisPeriodTotalKernelTime As LARGE_INTEGER
2351 TotalPageFaultCount As DWord
2352 TotalProcesses As DWord
2353 ActiveProcesses As DWord
2354 TotalTerminatedProcesses As DWord
2355End Type
2356TypeDef PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION = *JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
2357
2358Type JOBOBJECT_BASIC_LIMIT_INFORMATION
2359 PerProcessUserTimeLimit As LARGE_INTEGER
2360 PerJobUserTimeLimit As LARGE_INTEGER
2361 LimitFlags As DWord
2362 MinimumWorkingSetSize As SIZE_T
2363 MaximumWorkingSetSize As SIZE_T
2364 ActiveProcessLimit As DWord
2365 Affinity As ULONG_PTR
2366 PriorityClass As DWord
2367 SchedulingClass As DWord
2368End Type
2369TypeDef PJOBOBJECT_BASIC_LIMIT_INFORMATION = *JOBOBJECT_BASIC_LIMIT_INFORMATION
2370
2371Type JOBOBJECT_EXTENDED_LIMIT_INFORMATION
2372 BasicLimitInformation As JOBOBJECT_BASIC_LIMIT_INFORMATION
2373 IoInfo As IO_COUNTERS
2374 ProcessMemoryLimit As SIZE_T
2375 JobMemoryLimitt As SIZE_T
2376 PeakProcessMemoryUsedt As SIZE_T
2377 PeakJobMemoryUsedt As SIZE_T
2378End Type
2379TypeDef PJOBOBJECT_EXTENDED_LIMIT_INFORMATION = *JOBOBJECT_EXTENDED_LIMIT_INFORMATION
2380
2381Type JOBOBJECT_BASIC_PROCESS_ID_LIST
2382 NumberOfAssignedProcesses As DWord
2383 NumberOfProcessIdsInList As DWord
2384 ProcessIdList[1] As ULONG_PTR
2385End Type
2386TypeDef PJOBOBJECT_BASIC_PROCESS_ID_LIST = *JOBOBJECT_BASIC_PROCESS_ID_LIST
2387
2388Type JOBOBJECT_BASIC_UI_RESTRICTIONS
2389 UIRestrictionsClass As DWord
2390End Type
2391TypeDef PJOBOBJECT_BASIC_UI_RESTRICTIONS = *JOBOBJECT_BASIC_UI_RESTRICTIONS
2392
2393Type JOBOBJECT_SECURITY_LIMIT_INFORMATION
2394 SecurityLimitFlags As DWord
2395 JobToken As HANDLE
2396 SidsToDisable As PTOKEN_GROUPS
2397 PrivilegesToDelete As PTOKEN_PRIVILEGES
2398 RestrictedSids As PTOKEN_GROUPS
2399End Type
2400TypeDef PJOBOBJECT_SECURITY_LIMIT_INFORMATION = *JOBOBJECT_SECURITY_LIMIT_INFORMATION
2401
2402Type JOBOBJECT_END_OF_JOB_TIME_INFORMATION
2403 EndOfJobTimeAction As DWord
2404End Type
2405TypeDef PJOBOBJECT_END_OF_JOB_TIME_INFORMATION = *JOBOBJECT_END_OF_JOB_TIME_INFORMATION
2406
2407Type JOBOBJECT_ASSOCIATE_COMPLETION_PORT
2408 CompletionKey As PVOID
2409 CompletionPort As HANDLE
2410End Type
2411TypeDef PJOBOBJECT_ASSOCIATE_COMPLETION_PORT = *JOBOBJECT_ASSOCIATE_COMPLETION_PORT
2412
2413Type JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
2414 BasicInfo As JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
2415 IoInfo As IO_COUNTERS
2416End Type
2417TypeDef PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION = *JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
2418
2419Type JOBOBJECT_JOBSET_INFORMATION
2420 MemberLevel As DWord
2421End Type
2422TypeDef PJOBOBJECT_JOBSET_INFORMATION = *JOBOBJECT_JOBSET_INFORMATION
2423
2424Const JOB_OBJECT_TERMINATE_AT_END_OF_JOB = 0
2425Const JOB_OBJECT_POST_AT_END_OF_JOB = 1
2426
2427' Completion Port Messages for job objects
2428Const JOB_OBJECT_MSG_END_OF_JOB_TIME = 1
2429Const JOB_OBJECT_MSG_END_OF_PROCESS_TIME = 2
2430Const JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT = 3
2431Const JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO = 4
2432Const JOB_OBJECT_MSG_NEW_PROCESS = 6
2433Const JOB_OBJECT_MSG_EXIT_PROCESS = 7
2434Const JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS = 8
2435Const JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT = 9
2436Const JOB_OBJECT_MSG_JOB_MEMORY_LIMIT = 10
2437
2438' Basic Limits
2439Const JOB_OBJECT_LIMIT_WORKINGSET = &h00000001
2440Const JOB_OBJECT_LIMIT_PROCESS_TIME = &h00000002
2441Const JOB_OBJECT_LIMIT_JOB_TIME = &h00000004
2442Const JOB_OBJECT_LIMIT_ACTIVE_PROCESS = &h00000008
2443Const JOB_OBJECT_LIMIT_AFFINITY = &h00000010
2444Const JOB_OBJECT_LIMIT_PRIORITY_CLASS = &h00000020
2445Const JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = &h00000040
2446Const JOB_OBJECT_LIMIT_SCHEDULING_CLASS = &h00000080
2447
2448' Extended Limits
2449Const JOB_OBJECT_LIMIT_PROCESS_MEMORY = &h00000100
2450Const JOB_OBJECT_LIMIT_JOB_MEMORY = &h00000200
2451Const JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = &h00000400
2452Const JOB_OBJECT_LIMIT_BREAKAWAY_OK = &h00000800
2453Const JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = &h00001000
2454Const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = &h00002000
2455
2456Const JOB_OBJECT_LIMIT_RESERVED2 = &h00004000
2457Const JOB_OBJECT_LIMIT_RESERVED3 = &h00008000
2458Const JOB_OBJECT_LIMIT_RESERVED4 = &h00010000
2459Const JOB_OBJECT_LIMIT_RESERVED5 = &h00020000
2460Const JOB_OBJECT_LIMIT_RESERVED6 = &h00040000
2461
2462
2463Const JOB_OBJECT_LIMIT_VALID_FLAGS = &h0007ffff
2464
2465Const JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS = &h000000ff
2466Const JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS = &h00003fff
2467Const JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS = &h0007ffff
2468
2469' UI restrictions for jobs
2470Const JOB_OBJECT_UILIMIT_NONE = &h00000000
2471
2472Const JOB_OBJECT_UILIMIT_HANDLES = &h00000001
2473Const JOB_OBJECT_UILIMIT_READCLIPBOARD = &h00000002
2474Const JOB_OBJECT_UILIMIT_WRITECLIPBOARD = &h00000004
2475Const JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = &h00000008
2476Const JOB_OBJECT_UILIMIT_DISPLAYSETTINGS = &h00000010
2477Const JOB_OBJECT_UILIMIT_GLOBALATOMS = &h00000020
2478Const JOB_OBJECT_UILIMIT_DESKTOP = &h00000040
2479Const JOB_OBJECT_UILIMIT_EXITWINDOWS = &h00000080
2480
2481Const JOB_OBJECT_UILIMIT_ALL = &h000000FF
2482
2483Const JOB_OBJECT_UI_VALID_FLAGS = &h000000FF
2484
2485Const JOB_OBJECT_SECURITY_NO_ADMIN = &h00000001
2486Const JOB_OBJECT_SECURITY_RESTRICTED_TOKEN = &h00000002
2487Const JOB_OBJECT_SECURITY_ONLY_TOKEN = &h00000004
2488Const JOB_OBJECT_SECURITY_FILTER_TOKENS = &h00000008
2489
2490Const JOB_OBJECT_SECURITY_VALID_FLAGS = &h0000000f
2491
2492Enum JOBOBJECTINFOCLASS
2493 JobObjectBasicAccountingInformation = 1
2494 JobObjectBasicLimitInformation
2495 JobObjectBasicProcessIdList
2496 JobObjectBasicUIRestrictions
2497 JobObjectSecurityLimitInformation
2498 JobObjectEndOfJobTimeInformation
2499 JobObjectAssociateCompletionPortInformation
2500 JobObjectBasicAndIoAccountingInformation
2501 JobObjectExtendedLimitInformation
2502 JobObjectJobSetInformation
2503 MaxJobObjectInfoClass
2504End Enum
2505
2506Const EVENT_MODIFY_STATE = &h0002
2507Const EVENT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h3)
2508Const MUTANT_QUERY_STATE = &h0001
2509
2510Const MUTANT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or MUTANT_QUERY_STATE)
2511Const SEMAPHORE_MODIFY_STATE = &h0002
2512Const SEMAPHORE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h3)
2513
2514' Timer Specific Access Rights.
2515Const TIMER_QUERY_STATE = &h0001
2516Const TIMER_MODIFY_STATE = &h0002
2517
2518Const TIMER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or TIMER_QUERY_STATE Or TIMER_MODIFY_STATE)
2519
2520Const TIME_ZONE_ID_UNKNOWN = 0
2521Const TIME_ZONE_ID_STANDARD = 1
2522Const TIME_ZONE_ID_DAYLIGHT = 2
2523
2524Enum LOGICAL_PROCESSOR_RELATIONSHIP
2525 RelationProcessorCore
2526 RelationNumaNode
2527 RelationCache
2528 RelationProcessorPackage
2529End Enum
2530
2531Const LTP_PC_SMT = 1
2532
2533Enum PROCESSOR_CACHE_TYPE
2534 CacheUnified
2535 CacheInstruction
2536 CacheData
2537 CacheTrace
2538End Enum
2539
2540Const CACHE_FULLY_ASSOCIATIVE = &hFF
2541
2542Type CACHE_DESCRIPTOR
2543 Level As Byte
2544 Associativity As Byte
2545 LineSize As Word
2546 Size As DWord
2547 Type_ As PROCESSOR_CACHE_TYPE
2548End Type
2549TypeDef PCACHE_DESCRIPTOR = *CACHE_DESCRIPTOR
2550
2551Type SYSTEM_LOGICAL_PROCESSOR_INFORMATION
2552 ProcessorMask As ULONG_PTR
2553 Relationship As LOGICAL_PROCESSOR_RELATIONSHIP
2554' Union
2555' struct {
2556' Flags As Byte
2557' } ProcessorCore;
2558' struct {
2559' NodeNumber As DWord
2560' } NumaNode;
2561 Cache As CACHE_DESCRIPTOR
2562' Reserved[ELM(2)] As ULONGLONG
2563' End Union
2564End Type
2565TypeDef PSYSTEM_LOGICAL_PROCESSOR_INFORMATION = *SYSTEM_LOGICAL_PROCESSOR_INFORMATION
2566
2567Const PROCESSOR_INTEL_386 = 386
2568Const PROCESSOR_INTEL_486 = 486
2569Const PROCESSOR_INTEL_PENTIUM = 586
2570Const PROCESSOR_INTEL_IA64 = 2200
2571Const PROCESSOR_AMD_X8664 = 8664
2572Const PROCESSOR_MIPS_R4000 = 4000 ' incl R4101 & R3910 for Windows CE
2573Const PROCESSOR_ALPHA_21064 = 21064
2574Const PROCESSOR_PPC_601 = 601
2575Const PROCESSOR_PPC_603 = 603
2576Const PROCESSOR_PPC_604 = 604
2577Const PROCESSOR_PPC_620 = 620
2578Const PROCESSOR_HITACHI_SH3 = 10003 ' Windows CE
2579Const PROCESSOR_HITACHI_SH3E = 10004 ' Windows CE
2580Const PROCESSOR_HITACHI_SH4 = 10005 ' Windows CE
2581Const PROCESSOR_MOTOROLA_821 = 821 ' Windows CE
2582Const PROCESSOR_SHx_SH3 = 103 ' Windows CE
2583Const PROCESSOR_SHx_SH4 = 104 ' Windows CE
2584Const PROCESSOR_STRONGARM = 2577 ' Windows CE - 0xA11
2585Const PROCESSOR_ARM720 = 1824 ' Windows CE - 0x720
2586Const PROCESSOR_ARM820 = 2080 ' Windows CE - 0x820
2587Const PROCESSOR_ARM920 = 2336 ' Windows CE - 0x920
2588Const PROCESSOR_ARM_7TDMI = 70001 ' Windows CE
2589Const PROCESSOR_OPTIL = &h494f ' MSIL
2590
2591Const PROCESSOR_ARCHITECTURE_INTEL = 0
2592Const PROCESSOR_ARCHITECTURE_MIPS = 1
2593Const PROCESSOR_ARCHITECTURE_ALPHA = 2
2594Const PROCESSOR_ARCHITECTURE_PPC = 3
2595Const PROCESSOR_ARCHITECTURE_SHX = 4
2596Const PROCESSOR_ARCHITECTURE_ARM = 5
2597Const PROCESSOR_ARCHITECTURE_IA64 = 6
2598Const PROCESSOR_ARCHITECTURE_ALPHA64 = 7
2599Const PROCESSOR_ARCHITECTURE_MSIL = 8
2600Const PROCESSOR_ARCHITECTURE_AMD64 = 9
2601Const PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 = 10
2602
2603Const PROCESSOR_ARCHITECTURE_UNKNOWN = &hFFFF
2604
2605Const PF_FLOATING_POINT_PRECISION_ERRATA = 0
2606Const PF_FLOATING_POINT_EMULATED = 1
2607Const PF_COMPARE_EXCHANGE_DOUBLE = 2
2608Const PF_MMX_INSTRUCTIONS_AVAILABLE = 3
2609Const PF_PPC_MOVEMEM_64BIT_OK = 4
2610Const PF_ALPHA_BYTE_INSTRUCTIONS = 5
2611Const PF_XMMI_INSTRUCTIONS_AVAILABLE = 6
2612Const PF_3DNOW_INSTRUCTIONS_AVAILABLE = 7
2613Const PF_RDTSC_INSTRUCTION_AVAILABLE = 8
2614Const PF_PAE_ENABLED = 9
2615Const PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10
2616Const PF_SSE_DAZ_MODE_AVAILABLE = 11
2617Const PF_NX_ENABLED = 12
2618Const PF_SSE3_INSTRUCTIONS_AVAILABLE = 13
2619Const PF_COMPARE_EXCHANGE128 = 14
2620Const PF_COMPARE64_EXCHANGE128 = 15
2621Const PF_CHANNELS_ENABLED = 16
2622
2623Type MEMORY_BASIC_INFORMATION
2624 BaseAddress As VoidPtr
2625 AllocationBase As VoidPtr
2626 AllocationProtect As DWord
2627 RegionSize As SIZE_T
2628 State As DWord
2629 Protect As DWord
2630 MBIType As DWord
2631End Type
2632TypeDef PMEMORY_BASIC_INFORMATION = *MEMORY_BASIC_INFORMATION
2633
2634Type MEMORY_BASIC_INFORMATION32
2635 BaseAddress As DWord
2636 AllocationBase As DWord
2637 AllocationProtect As DWord
2638 RegionSize As DWord
2639 State As DWord
2640 Protect As DWord
2641 Type_ As DWord
2642End Type
2643TypeDef PMEMORY_BASIC_INFORMATION32 = *MEMORY_BASIC_INFORMATION32
2644
2645Type Align(16) MEMORY_BASIC_INFORMATION64
2646 BaseAddress As QWord
2647 AllocationBase As QWord
2648 AllocationProtect As DWord
2649 __alignment1 As DWord
2650 RegionSize As QWord
2651 State As DWord
2652 Protect As DWord
2653 Type_ As DWord
2654 __alignment2 As DWord
2655End Type
2656TypeDef PMEMORY_BASIC_INFORMATION64 = *MEMORY_BASIC_INFORMATION64
2657
2658Const SECTION_QUERY = &h0001
2659Const SECTION_MAP_WRITE = &h0002
2660Const SECTION_MAP_READ = &h0004
2661Const SECTION_MAP_EXECUTE = &h0008
2662Const SECTION_EXTEND_SIZE = &h0010
2663Const SECTION_MAP_EXECUTE_EXPLICIT = &h0020
2664
2665Const SECTION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SECTION_QUERY Or SECTION_MAP_WRITE Or SECTION_MAP_READ Or SECTION_MAP_EXECUTE Or SECTION_EXTEND_SIZE)
2666
2667Const SESSION_QUERY_ACCESS = &h0001
2668Const SESSION_MODIFY_ACCESS = &h0002
2669
2670Const SESSION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SESSION_QUERY_ACCESS Or SESSION_MODIFY_ACCESS)
2671
2672Const PAGE_NOACCESS = &h01
2673Const PAGE_READONLY = &h02
2674Const PAGE_READWRITE = &h04
2675Const PAGE_WRITECOPY = &h08
2676Const PAGE_EXECUTE = &h10
2677Const PAGE_EXECUTE_READ = &h20
2678Const PAGE_EXECUTE_READWRITE = &h40
2679Const PAGE_EXECUTE_WRITECOPY = &h80
2680Const PAGE_GUARD = &h100
2681Const PAGE_NOCACHE = &h200
2682Const PAGE_WRITECOMBINE = &h400
2683Const MEM_COMMIT = &h1000
2684Const MEM_RESERVE = &h2000
2685Const MEM_DECOMMIT = &h4000
2686Const MEM_RELEASE = &h8000
2687Const MEM_FREE = &h10000
2688Const MEM_PRIVATE = &h20000
2689Const MEM_MAPPED = &h40000
2690Const MEM_RESET = &h80000
2691Const MEM_TOP_DOWN = &h100000
2692Const MEM_WRITE_WATCH = &h200000
2693Const MEM_PHYSICAL = &h400000
2694Const MEM_ROTATE = &h800000
2695Const MEM_LARGE_PAGES = &h20000000
2696Const MEM_4MB_PAGES = &h80000000
2697Const SEC_FILE = &h800000
2698Const SEC_IMAGE = &h1000000
2699Const SEC_PROTECTED_IMAGE = &h2000000
2700Const SEC_RESERVE = &h4000000
2701Const SEC_COMMIT = &h8000000
2702Const SEC_NOCACHE = &h10000000
2703Const SEC_WRITECOMBINE = &h40000000
2704Const SEC_LARGE_PAGES = &h80000000
2705Const MEM_IMAGE = SEC_IMAGE
2706Const WRITE_WATCH_FLAG_RESET = &h01
2707
2708' Define access rights to files and directories
2709Const FILE_READ_DATA = &h0001 ' file & pipe
2710Const FILE_LIST_DIRECTORY = &h0001 ' directory
2711
2712Const FILE_WRITE_DATA = &h0002 ' file & pipe
2713Const FILE_ADD_FILE = &h0002 ' directory
2714
2715Const FILE_APPEND_DATA = &h0004 ' file
2716Const FILE_ADD_SUBDIRECTORY = &h0004 ' directory
2717Const FILE_CREATE_PIPE_INSTANCE = &h0004 ' named pipe
2718
2719
2720Const FILE_READ_EA = &h0008 ' file & directory
2721
2722Const FILE_WRITE_EA = &h0010 ' file & directory
2723
2724Const FILE_EXECUTE = &h0020 ' file
2725Const FILE_TRAVERSE = &h0020 ' directory
2726
2727Const FILE_DELETE_CHILD = &h0040 ' directory
2728
2729Const FILE_READ_ATTRIBUTES = &h0080 ' all
2730
2731Const FILE_WRITE_ATTRIBUTES = &h0100 ' all
2732
2733Const FILE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h1FF)
2734Const FILE_GENERIC_READ = (STANDARD_RIGHTS_READ Or FILE_READ_DATA Or FILE_READ_ATTRIBUTES Or FILE_READ_EA Or SYNCHRONIZE)
2735Const FILE_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE Or FILE_WRITE_DATA Or FILE_WRITE_ATTRIBUTES Or FILE_WRITE_EA Or FILE_APPEND_DATA Or SYNCHRONIZE)
2736Const FILE_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or FILE_READ_ATTRIBUTES Or FILE_EXECUTE Or SYNCHRONIZE)
2737
2738Const FILE_SHARE_READ = &h00000001
2739Const FILE_SHARE_WRITE = &h00000002
2740Const FILE_SHARE_DELETE = &h00000004
2741Const FILE_ATTRIBUTE_READONLY = &h00000001
2742Const FILE_ATTRIBUTE_HIDDEN = &h00000002
2743Const FILE_ATTRIBUTE_SYSTEM = &h00000004
2744Const FILE_ATTRIBUTE_DIRECTORY = &h00000010
2745Const FILE_ATTRIBUTE_ARCHIVE = &h00000020
2746Const FILE_ATTRIBUTE_DEVICE = &h00000040
2747Const FILE_ATTRIBUTE_NORMAL = &h00000080
2748Const FILE_ATTRIBUTE_TEMPORARY = &h00000100
2749Const FILE_ATTRIBUTE_SPARSE_FILE = &h00000200
2750Const FILE_ATTRIBUTE_REPARSE_POINT = &h00000400
2751Const FILE_ATTRIBUTE_COMPRESSED = &h00000800
2752Const FILE_ATTRIBUTE_OFFLINE = &h00001000
2753Const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = &h00002000
2754Const FILE_ATTRIBUTE_ENCRYPTED = &h00004000
2755Const FILE_ATTRIBUTE_VIRTUAL = &h00010000
2756Const FILE_NOTIFY_CHANGE_FILE_NAME = &h00000001
2757Const FILE_NOTIFY_CHANGE_DIR_NAME = &h00000002
2758Const FILE_NOTIFY_CHANGE_ATTRIBUTES = &h00000004
2759Const FILE_NOTIFY_CHANGE_SIZE = &h00000008
2760Const FILE_NOTIFY_CHANGE_LAST_WRITE = &h00000010
2761Const FILE_NOTIFY_CHANGE_LAST_ACCESS = &h00000020
2762Const FILE_NOTIFY_CHANGE_CREATION = &h00000040
2763Const FILE_NOTIFY_CHANGE_SECURITY = &h00000100
2764Const FILE_ACTION_ADDED = &h00000001
2765Const FILE_ACTION_REMOVED = &h00000002
2766Const FILE_ACTION_MODIFIED = &h00000003
2767Const FILE_ACTION_RENAMED_OLD_NAME = &h00000004
2768Const FILE_ACTION_RENAMED_NEW_NAME = &h00000005
2769Const MAILSLOT_NO_MESSAGE = (-1 As DWord)
2770Const MAILSLOT_WAIT_FOREVER = (-1 As DWord)
2771Const FILE_CASE_SENSITIVE_SEARCH = &h00000001
2772Const FILE_CASE_PRESERVED_NAMES = &h00000002
2773Const FILE_UNICODE_ON_DISK = &h00000004
2774Const FILE_PERSISTENT_ACLS = &h00000008
2775Const FILE_FILE_COMPRESSION = &h00000010
2776Const FILE_VOLUME_QUOTAS = &h00000020
2777Const FILE_SUPPORTS_SPARSE_FILES = &h00000040
2778Const FILE_SUPPORTS_REPARSE_POINTS = &h00000080
2779Const FILE_SUPPORTS_REMOTE_STORAGE = &h00000100
2780Const FILE_VOLUME_IS_COMPRESSED = &h00008000
2781Const FILE_SUPPORTS_OBJECT_IDS = &h00010000
2782Const FILE_SUPPORTS_ENCRYPTION = &h00020000
2783Const FILE_NAMED_STREAMS = &h00040000
2784Const FILE_READ_ONLY_VOLUME = &h00080000
2785Const FILE_SEQUENTIAL_WRITE_ONCE = &h00100000
2786Const FILE_SUPPORTS_TRANSACTIONS = &h00200000
2787
2788Type FILE_NOTIFY_INFORMATION
2789 NextEntryOffset As DWord
2790 Action As DWord
2791 FileNameLength As DWord
2792 FileName[ELM(1)] As WCHAR
2793End Type
2794TypeDef PFILE_NOTIFY_INFORMATION = *FILE_NOTIFY_INFORMATION
2795
2796Type /*Union*/ FILE_SEGMENT_ELEMENT
2797 Buffer As PVOID64
2798' Alignment As QWord
2799End Type 'Union
2800TypeDef PFILE_SEGMENT_ELEMENT = *FILE_SEGMENT_ELEMENT
2801
2802Type REPARSE_GUID_DATA_BUFFER
2803 ReparseTag As DWord
2804 ReparseDataLength As Word
2805 Reserved As Word
2806 ReparseGuid As GUID
2807' struct {
2808 DataBuffer[ELM(1)] As Byte
2809' } GenericReparseBuffer;
2810End Type
2811TypeDef PREPARSE_GUID_DATA_BUFFER = *REPARSE_GUID_DATA_BUFFER
2812
2813'Const REPARSE_GUID_DATA_BUFFER_HEADER_SIZE = FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
2814
2815' Maximum allowed size of the reparse data.
2816Const MAXIMUM_REPARSE_DATA_BUFFER_SIZE = (16 * 1024)
2817
2818' Predefined reparse tags.
2819Const IO_REPARSE_TAG_RESERVED_ZERO = 0
2820Const IO_REPARSE_TAG_RESERVED_ONE = 1
2821
2822Const IO_REPARSE_TAG_RESERVED_RANGE = IO_REPARSE_TAG_RESERVED_ONE
2823
2824
2825Const IsReparseTagMicrosoft(_tag) = ((_tag) And &h80000000)
2826Const IsReparseTagNameSurrogate(_tag) = ((_tag) And &h0000000)
2827
2828Const IO_REPARSE_TAG_MOUNT_POINT = &hA0000003
2829Const IO_REPARSE_TAG_HSM = &hC0000004
2830Const IO_REPARSE_TAG_SIS = &h80000007
2831Const IO_REPARSE_TAG_DFS = &h8000000A
2832Const IO_REPARSE_TAG_SYMLINK = &hA000000C
2833Const IO_REPARSE_TAG_DFSR = &h80000012
2834
2835Const IO_COMPLETION_MODIFY_STATE = &h0002
2836Const IO_COMPLETION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h3)
2837
2838Const DUPLICATE_CLOSE_SOURCE = &h00000001
2839Const DUPLICATE_SAME_ACCESS = &h00000002
2840/*
2841' Define GUIDs which represent well-known power schemes
2842
2843DEFINE_GUID( GUID_MAX_POWER_SAVINGS, 0xA1841308, 0x3541, 0x4FAB, 0xBC, 0x81, 0xF7, 0x15, 0x56, 0xF2, 0x0B, 0x4A );
2844DEFINE_GUID( GUID_MIN_POWER_SAVINGS, 0x8C5E7FDA, 0xE8BF, 0x4A96, 0x9A, 0x85, 0xA6, 0xE2, 0x3A, 0x8C, 0x63, 0x5C );
2845DEFINE_GUID( GUID_TYPICAL_POWER_SAVINGS, 0x381B4222, 0xF694, 0x41F0, 0x96, 0x85, 0xFF, 0x5B, 0xB2, 0x60, 0xDF, 0x2E );
2846DEFINE_GUID( NO_SUBGROUP_GUID, 0xFEA3413E, 0x7E05, 0x4911, 0x9A, 0x71, 0x70, 0x03, 0x31, 0xF1, 0xC2, 0x94 );
2847DEFINE_GUID( ALL_POWERSCHEMES_GUID, 0x68A1E95E, 0x13EA, 0x41E1, 0x80, 0x11, 0x0C, 0x49, 0x6C, 0xA4, 0x90, 0xB0 );
2848DEFINE_GUID( GUID_POWERSCHEME_PERSONALITY, 0x245D8541, 0x3943, 0x4422, 0xB0, 0x25, 0x13, 0xA7, 0x84, 0xF6, 0x79, 0xB7 );
2849DEFINE_GUID( GUID_ACTIVE_POWERSCHEME, 0x31F9F286, 0x5084, 0x42FE, 0xB7, 0x20, 0x2B, 0x02, 0x64, 0x99, 0x37, 0x63 );
2850
2851' Define GUIDs which represent well-known power settings
2852
2853' Video settings
2854
2855DEFINE_GUID( GUID_VIDEO_SUBGROUP, 0x7516B95F, 0xF776, 0x4464, 0x8C, 0x53, 0x06, 0x16, 0x7F, 0x40, 0xCC, 0x99 );
2856DEFINE_GUID( GUID_VIDEO_POWERDOWN_TIMEOUT, 0x3C0BC021, 0xC8A8, 0x4E07, 0xA9, 0x73, 0x6B, 0x14, 0xCB, 0xCB, 0x2B, 0x7E );
2857DEFINE_GUID( GUID_VIDEO_ADAPTIVE_POWERDOWN, 0x90959D22, 0xD6A1, 0x49B9, 0xAF, 0x93, 0xBC, 0xE8, 0x85, 0xAD, 0x33, 0x5B );
2858DEFINE_GUID( GUID_MONITOR_POWER_ON, 0x02731015, 0x4510, 0x4526, 0x99, 0xE6, 0xE5, 0xA1, 0x7E, 0xBD, 0x1A, 0xEA );
2859
2860' Harddisk settings
2861DEFINE_GUID( GUID_DISK_SUBGROUP, 0x0012EE47, 0x9041, 0x4B5D, 0x9B, 0x77, 0x53, 0x5F, 0xBA, 0x8B, 0x14, 0x42 );
2862DEFINE_GUID( GUID_DISK_POWERDOWN_TIMEOUT, 0x6738E2C4, 0xE8A5, 0x4A42, 0xB1, 0x6A, 0xE0, 0x40, 0xE7, 0x69, 0x75, 0x6E );
2863DEFINE_GUID( GUID_DISK_ADAPTIVE_POWERDOWN, 0x396A32E1, 0x499A, 0x40B2, 0x91, 0x24, 0xA9, 0x6A, 0xFE, 0x70, 0x76, 0x67 );
2864
2865' System sleep settings
2866DEFINE_GUID( GUID_SLEEP_SUBGROUP, 0x238C9FA8, 0x0AAD, 0x41ED, 0x83, 0xF4, 0x97, 0xBE, 0x24, 0x2C, 0x8F, 0x20 );
2867DEFINE_GUID( GUID_SLEEP_IDLE_THRESHOLD, 0x81cd32e0, 0x7833, 0x44f3, 0x87, 0x37, 0x70, 0x81, 0xf3, 0x8d, 0x1f, 0x70 );
2868DEFINE_GUID( GUID_STANDBY_TIMEOUT, 0x29F6C1DB, 0x86DA, 0x48C5, 0x9F, 0xDB, 0xF2, 0xB6, 0x7B, 0x1F, 0x44, 0xDA );
2869DEFINE_GUID( GUID_HIBERNATE_TIMEOUT, 0x9D7815A6, 0x7EE4, 0x497E, 0x88, 0x88, 0x51, 0x5A, 0x05, 0xF0, 0x23, 0x64 );
2870DEFINE_GUID( GUID_HIBERNATE_FASTS4_POLICY, 0x94AC6D29, 0x73CE, 0x41A6, 0x80, 0x9F, 0x63, 0x63, 0xBA, 0x21, 0xB4, 0x7E );
2871DEFINE_GUID( GUID_CRITICAL_POWER_TRANSITION, 0xB7A27025, 0xE569, 0x46c2, 0xA5, 0x04, 0x2B, 0x96, 0xCA, 0xD2, 0x25, 0xA1);
2872DEFINE_GUID( GUID_SYSTEM_AWAYMODE, 0x98A7F580, 0x01F7, 0x48AA, 0x9C, 0x0F, 0x44, 0x35, 0x2C, 0x29, 0xE5, 0xC0 );
2873DEFINE_GUID( GUID_ALLOW_AWAYMODE, 0x25dfa149, 0x5dd1, 0x4736, 0xb5, 0xab, 0xe8, 0xa3, 0x7b, 0x5b, 0x81, 0x87 );
2874DEFINE_GUID( GUID_ALLOW_STANDBY_STATES, 0xabfc2519, 0x3608, 0x4c2a, 0x94, 0xea, 0x17, 0x1b, 0x0e, 0xd5, 0x46, 0xab );
2875DEFINE_GUID( GUID_ALLOW_RTC_WAKE, 0xBD3B718A, 0x0680, 0x4D9D, 0x8A, 0xB2, 0xE1, 0xD2, 0xB4, 0xAC, 0x80, 0x6D );
2876
2877' System button actions
2878DEFINE_GUID( GUID_SYSTEM_BUTTON_SUBGROUP, 0x4F971E89, 0xEEBD, 0x4455, 0xA8, 0xDE, 0x9E, 0x59, 0x04, 0x0E, 0x73, 0x47 );
2879DEFINE_GUID( GUID_POWERBUTTON_ACTION, 0x7648EFA3, 0xDD9C, 0x4E3E, 0xB5, 0x66, 0x50, 0xF9, 0x29, 0x38, 0x62, 0x80 );
2880DEFINE_GUID( GUID_POWERBUTTON_ACTION_FLAGS, 0x857E7FAC, 0x034B, 0x4704, 0xAB, 0xB1, 0xBC, 0xA5, 0x4A, 0xA3, 0x14, 0x78 );
2881DEFINE_GUID( GUID_SLEEPBUTTON_ACTION, 0x96996BC0, 0xAD50, 0x47EC, 0x92, 0x3B, 0x6F, 0x41, 0x87, 0x4D, 0xD9, 0xEB );
2882DEFINE_GUID( GUID_SLEEPBUTTON_ACTION_FLAGS, 0x2A160AB1, 0xB69D, 0x4743, 0xB7, 0x18, 0xBF, 0x14, 0x41, 0xD5, 0xE4, 0x93 );
2883DEFINE_GUID( GUID_USERINTERFACEBUTTON_ACTION, 0xA7066653, 0x8D6C, 0x40A8, 0x91, 0x0E, 0xA1, 0xF5, 0x4B, 0x84, 0xC7, 0xE5 );
2884DEFINE_GUID( GUID_LIDCLOSE_ACTION, 0x5CA83367, 0x6E45, 0x459F, 0xA2, 0x7B, 0x47, 0x6B, 0x1D, 0x01, 0xC9, 0x36 );
2885DEFINE_GUID( GUID_LIDCLOSE_ACTION_FLAGS, 0x97E969AC, 0x0D6C, 0x4D08, 0x92, 0x7C, 0xD7, 0xBD, 0x7A, 0xD7, 0x85, 0x7B );
2886DEFINE_GUID( GUID_LIDOPEN_POWERSTATE, 0x99FF10E7, 0x23B1, 0x4C07, 0xA9, 0xD1, 0x5C, 0x32, 0x06, 0xD7, 0x41, 0xB4 );
2887
2888' Battery Discharge Settings
2889DEFINE_GUID( GUID_BATTERY_SUBGROUP, 0xE73A048D, 0xBF27, 0x4F12, 0x97, 0x31, 0x8B, 0x20, 0x76, 0xE8, 0x89, 0x1F );
2890' 4 battery discharge alarm settings.
2891DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_0, 0x637EA02F, 0xBBCB, 0x4015, 0x8E, 0x2C, 0xA1, 0xC7, 0xB9, 0xC0, 0xB5, 0x46 );
2892DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_0, 0x9A66D8D7, 0x4FF7, 0x4EF9, 0xB5, 0xA2, 0x5A, 0x32, 0x6C, 0xA2, 0xA4, 0x69 );
2893DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_0, 0x5dbb7c9f, 0x38e9, 0x40d2, 0x97, 0x49, 0x4f, 0x8a, 0x0e, 0x9f, 0x64, 0x0f );
2894
2895DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_1, 0xD8742DCB, 0x3E6A, 0x4B3C, 0xB3, 0xFE, 0x37, 0x46, 0x23, 0xCD, 0xCF, 0x06 );
2896DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_1, 0x8183BA9A, 0xE910, 0x48DA, 0x87, 0x69, 0x14, 0xAE, 0x6D, 0xC1, 0x17, 0x0A );
2897DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_1, 0xbcded951, 0x187b, 0x4d05, 0xbc, 0xcc, 0xf7, 0xe5, 0x19, 0x60, 0xc2, 0x58 );
2898
2899DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_2, 0x421CBA38, 0x1A8E, 0x4881, 0xAC, 0x89, 0xE3, 0x3A, 0x8B, 0x04, 0xEC, 0xE4 );
2900DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_2, 0x07A07CA2, 0xADAF, 0x40D7, 0xB0, 0x77, 0x53, 0x3A, 0xAD, 0xED, 0x1B, 0xFA );
2901DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_2, 0x7fd2f0c4, 0xfeb7, 0x4da3, 0x81, 0x17, 0xe3, 0xfb, 0xed, 0xc4, 0x65, 0x82 );
2902
2903DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_3, 0x80472613, 0x9780, 0x455E, 0xB3, 0x08, 0x72, 0xD3, 0x00, 0x3C, 0xF2, 0xF8 );
2904DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_3, 0x58AFD5A6, 0xC2DD, 0x47D2, 0x9F, 0xBF, 0xEF, 0x70, 0xCC, 0x5C, 0x59, 0x65 );
2905DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_3, 0x73613ccf, 0xdbfa, 0x4279, 0x83, 0x56, 0x49, 0x35, 0xf6, 0xbf, 0x62, 0xf3 );
2906
2907' Processor power settings
2908DEFINE_GUID( GUID_PROCESSOR_SETTINGS_SUBGROUP, 0x54533251, 0x82BE, 0x4824, 0x96, 0xC1, 0x47, 0xB6, 0x0B, 0x74, 0x0D, 0x00 );
2909DEFINE_GUID( GUID_PROCESSOR_THROTTLE_POLICY, 0x57027304, 0x4AF6, 0x4104, 0x92, 0x60, 0xE3, 0xD9, 0x52, 0x48, 0xFC, 0x36 );
2910DEFINE_GUID( GUID_PROCESSOR_THROTTLE_MAXIMUM, 0xBC5038F7, 0x23E0, 0x4960, 0x96, 0xDA, 0x33, 0xAB, 0xAF, 0x59, 0x35, 0xEC );
2911DEFINE_GUID( GUID_PROCESSOR_THROTTLE_MINIMUM, 0x893DEE8E, 0x2BEF, 0x41E0, 0x89, 0xC6, 0xB5, 0x5D, 0x09, 0x29, 0x96, 0x4C );
2912DEFINE_GUID( GUID_PROCESSOR_IDLESTATE_POLICY, 0x68f262a7, 0xf621, 0x4069, 0xb9, 0xa5, 0x48, 0x74, 0x16, 0x9b, 0xe2, 0x3c);
2913DEFINE_GUID( GUID_PROCESSOR_PERFSTATE_POLICY, 0xBBDC3814, 0x18E9, 0x4463, 0x8A, 0x55, 0xD1, 0x97, 0x32, 0x7C, 0x45, 0xC0);
2914DEFINE_GUID( GUID_SYSTEM_COOLING_POLICY, 0x94D3A615, 0xA899, 0x4AC5, 0xAE, 0x2B, 0xE4, 0xD8, 0xF6, 0x34, 0x36, 0x7F);
2915
2916' Lock Console on Wake
2917DEFINE_GUID( GUID_LOCK_CONSOLE_ON_WAKE, 0x0E796BDB, 0x100D, 0x47D6, 0xA2, 0xD5, 0xF7, 0xD2, 0xDA, 0xA5, 0x1F, 0x51 );
2918
2919' AC/DC power source
2920DEFINE_GUID( GUID_ACDC_POWER_SOURCE, 0x5D3E9A59, 0xE9D5, 0x4B00, 0xA6, 0xBD, 0xFF, 0x34, 0xFF, 0x51, 0x65, 0x48 );
2921
2922' Lid state changes
2923DEFINE_GUID( GUID_LIDSWITCH_STATE_CHANGE, 0xBA3E0F4D, 0xB817, 0x4094, 0xA2, 0xD1, 0xD5, 0x63, 0x79, 0xE6, 0xA0, 0xF3 );
2924
2925' Battery life remaining
2926DEFINE_GUID( GUID_BATTERY_PERCENTAGE_REMAINING, 0xA7AD8041, 0xB45A, 0x4CAE, 0x87, 0xA3, 0xEE, 0xCB, 0xB4, 0x68, 0xA9, 0xE1 );
2927DEFINE_GUID( GUID_IDLE_BACKGROUND_TASK, 0x515C31D8, 0xF734, 0x163D, 0xA0, 0xFD, 0x11, 0xA0, 0x8C, 0x91, 0xE8, 0xF1 );
2928DEFINE_GUID( GUID_BACKGROUND_TASK_NOTIFICATION, 0xCF23F240, 0x2A54, 0x48D8, 0xB1, 0x14, 0xDE, 0x15, 0x18, 0xFF, 0x05, 0x2E );
2929DEFINE_GUID( GUID_APPLAUNCH_BUTTON, 0x1A689231, 0x7399, 0x4E9A, 0x8F, 0x99, 0xB7, 0x1F, 0x99, 0x9D, 0xB3, 0xFA );
2930DEFINE_GUID( GUID_PCIEXPRESS_SETTINGS_SUBGROUP, 0x501a4d13, 0x42af,0x4429, 0x9f, 0xd1, 0xa8, 0x21, 0x8c, 0x26, 0x8e, 0x20 );
2931DEFINE_GUID( GUID_PCIEXPRESS_ASPM_POLICY, 0xee12f906, 0xd277, 0x404b, 0xb6, 0xda, 0xe5, 0xfa, 0x1a, 0x57, 0x6d, 0xf5 );
2932*/
2933Enum SYSTEM_POWER_STATE
2934 PowerSystemUnspecified = 0
2935 PowerSystemWorking = 1
2936 PowerSystemSleeping1 = 2
2937 PowerSystemSleeping2 = 3
2938 PowerSystemSleeping3 = 4
2939 PowerSystemHibernate = 5
2940 PowerSystemShutdown = 6
2941 PowerSystemMaximum = 7
2942End Enum
2943TypeDef PSYSTEM_POWER_STATE = *SYSTEM_POWER_STATE
2944
2945Const POWER_SYSTEM_MAXIMUM = 7
2946
2947Enum POWER_ACTION
2948 PowerActionNone = 0
2949 PowerActionReserved
2950 PowerActionSleep
2951 PowerActionHibernate
2952 PowerActionShutdown
2953 PowerActionShutdownReset
2954 PowerActionShutdownOff
2955 PowerActionWarmEject
2956End Enum
2957TypeDef PPOWER_ACTION = *POWER_ACTION
2958
2959Enum DEVICE_POWER_STATE
2960 PowerDeviceUnspecified = 0
2961 PowerDeviceD0
2962 PowerDeviceD1
2963 PowerDeviceD2
2964 PowerDeviceD3
2965 PowerDeviceMaximum
2966End Enum
2967TypeDef PDEVICE_POWER_STATE = *DEVICE_POWER_STATE
2968
2969Const ES_SYSTEM_REQUIRED = (&h00000001 As DWord)
2970Const ES_DISPLAY_REQUIRED = (&h00000002 As DWord)
2971Const ES_USER_PRESENT = (&h00000004 As DWord)
2972Const ES_AWAYMODE_REQUIRED = (&h00000040 As DWord)
2973Const ES_CONTINUOUS = (&h80000000 As DWord)
2974
2975TypeDef EXECUTION_STATE = DWord
2976
2977Enum LATENCY_TIME
2978 LT_DONT_CARE
2979 LT_LOWEST_LATENCY
2980End Enum
2981
2982'#if (NTDDI_VERSION >= NTDDI_WINXP)
2983
2984' Device Power Information
2985Const PDCAP_D0_SUPPORTED = &h00000001
2986Const PDCAP_D1_SUPPORTED = &h00000002
2987Const PDCAP_D2_SUPPORTED = &h00000004
2988Const PDCAP_D3_SUPPORTED = &h00000008
2989Const PDCAP_WAKE_FROM_D0_SUPPORTED = &h00000010
2990Const PDCAP_WAKE_FROM_D1_SUPPORTED = &h00000020
2991Const PDCAP_WAKE_FROM_D2_SUPPORTED = &h00000040
2992Const PDCAP_WAKE_FROM_D3_SUPPORTED = &h00000080
2993Const PDCAP_WARM_EJECT_SUPPORTED = &h00000100
2994
2995Type CM_POWER_DATA
2996 PD_Size As DWord
2997 PD_MostRecentPowerState As DEVICE_POWER_STATE
2998 PD_Capabilities As DWord
2999 PD_D1Latency As DWord
3000 PD_D2Latency As DWord
3001 PD_D3Latency As DWord
3002 PD_PowerStateMapping[POWER_SYSTEM_MAXIMUM] As DEVICE_POWER_STATE
3003 PD_DeepestSystemWake As SYSTEM_POWER_STATE
3004End Type
3005TypeDef PCM_POWER_DATA = *CM_POWER_DATA
3006
3007'#endif // (NTDDI_VERSION >= NTDDI_WINXP)
3008
3009Enum POWER_INFORMATION_LEVEL
3010 SystemPowerPolicyAc
3011 SystemPowerPolicyDc
3012 VerifySystemPolicyAc
3013 VerifySystemPolicyDc
3014 SystemPowerCapabilities
3015 SystemBatteryState
3016 SystemPowerStateHandler
3017 ProcessorStateHandler
3018 SystemPowerPolicyCurrent
3019 AdministratorPowerPolicy
3020 SystemReserveHiberFile
3021 ProcessorInformation
3022 SystemPowerInformation
3023 ProcessorStateHandler2
3024 LastWakeTime ' Compare with KeQueryInterruptTime()
3025 LastSleepTime ' Compare with KeQueryInterruptTime()
3026 SystemExecutionState
3027 SystemPowerStateNotifyHandler
3028 ProcessorPowerPolicyAc
3029 ProcessorPowerPolicyDc
3030 VerifyProcessorPowerPolicyAc
3031 VerifyProcessorPowerPolicyDc
3032 ProcessorPowerPolicyCurrent
3033 SystemPowerStateLogging
3034 SystemPowerLoggingEntry
3035 SetPowerSettingValue
3036 NotifyUserPowerSetting
3037 GetPowerTransitionVetoes
3038 SetPowerTransitionVeto
3039 SystemVideoState
3040 TraceApplicationPowerMessage
3041 TraceApplicationPowerMessageEnd
3042 ProcessorPerfStates
3043 ProcessorIdleStates
3044 ProcessorThrottleStates
3045 SystemWakeSource
3046 SystemHiberFileInformation
3047 TraceServicePowerMessage
3048 ProcessorLoad
3049 PowerShutdownNotification
3050End Enum
3051
3052' Power Transition Vetos
3053Const PO_TRANSITION_VETO_TYPE_WINDOW = &h00000001
3054Const PO_TRANSITION_VETO_TYPE_SERVICE = &h00000002
3055'Const PO_TRANSITION_VETO_TYPE_DRIVER = &h00000004
3056
3057Const PO_TRANSITION_VETO_TYPE_ALL = (PO_TRANSITION_VETO_TYPE_WINDOW Or PO_TRANSITION_VETO_TYPE_SERVICE)
3058
3059Type PO_TRANSITION_VETO_REASON
3060 ResourceId As DWord
3061 ModuleNameOffset As DWord
3062End Type
3063TypeDef PPO_TRANSITION_VETO_REASON = *PO_TRANSITION_VETO_REASON
3064
3065Type PO_TRANSITION_VETO_WINDOW
3066 Handle As HANDLE
3067End Type
3068TypeDef PPO_TRANSITION_VETO_WINDOW = *PO_TRANSITION_VETO_WINDOW
3069
3070Type PO_TRANSITION_VETO_SERVICE
3071 ServiceNameOffset As DWord
3072End Type
3073TypeDef PPO_TRANSITION_VETO_SERVICE = *PO_TRANSITION_VETO_SERVICE
3074
3075/*
3076Type PO_TRANSITION_VETO_DRIVER
3077 InstancePathOffset As DWord
3078 DriverNameOffset As DWord
3079End Type
3080TypeDef PPO_TRANSITION_VETO_DRIVER = *PO_TRANSITION_VETO_DRIVER
3081*/
3082
3083Type PO_TRANSITION_VETO
3084 Type_ As DWord
3085 Reason As PO_TRANSITION_VETO_REASON
3086 ProcessId As DWord
3087' Union
3088 Window_ As PO_TRANSITION_VETO_WINDOW
3089' Service As PO_TRANSITION_VETO_SERVICE
3090' ' Driver As PO_TRANSITION_VETO_DRIVER
3091' End Union
3092End Type
3093TypeDef PPO_TRANSITION_VETO = *PO_TRANSITION_VETO
3094
3095Type PO_TRANSITION_VETOES
3096 Count As DWord
3097 Vetoes[ELM(ANYSIZE_ARRAY)] As PO_TRANSITION_VETO
3098End Type
3099TypeDef PPO_TRANSITION_VETOES = *PO_TRANSITION_VETOES
3100
3101Enum SYSTEM_POWER_CONDITION
3102 PoAc
3103 PoDc
3104 PoHot
3105 PoConditionMaximum
3106End Enum
3107
3108Type SET_POWER_SETTING_VALUE
3109 Version As DWord
3110 Guid As GUID
3111 PowerCondition As SYSTEM_POWER_CONDITION
3112 DataLength As DWord
3113 Data[ELM(ANYSIZE_ARRAY)] As Byte
3114End Type
3115TypeDef PSET_POWER_SETTING_VALUE = *SET_POWER_SETTING_VALUE
3116
3117Const POWER_SETTING_VALUE_VERSION = &h1
3118
3119Type NOTIFY_USER_POWER_SETTING
3120 Guid As GUID
3121End Type
3122TypeDef PNOTIFY_USER_POWER_SETTING = *NOTIFY_USER_POWER_SETTING
3123
3124Type APPLICATIONLAUNCH_SETTING_VALUE
3125 ActivationTime As LARGE_INTEGER
3126 Flags As DWord
3127 ButtonInstanceID As DWord
3128End Type
3129TypeDef PAPPLICATIONLAUNCH_SETTING_VALUE = *APPLICATIONLAUNCH_SETTING_VALUE
3130
3131Enum POWER_PLATFORM_ROLE
3132 PlatformRoleUnspecified = 0
3133 PlatformRoleDesktop
3134 PlatformRoleMobile
3135 PlatformRoleWorkstation
3136 PlatformRoleEnterpriseServer
3137 PlatformRoleSOHOServer
3138 PlatformRoleAppliancePC
3139 PlatformRolePerformanceServer
3140 PlatformRoleMaximum
3141End Enum
3142
3143Enum PO_WAKE_SOURCE_TYPE
3144 DeviceWakeSourceType
3145 FixedWakeSourceType
3146End Enum
3147TypeDef PPO_WAKE_SOURCE_TYPE = *PO_WAKE_SOURCE_TYPE
3148
3149Enum PO_FIXED_WAKE_SOURCE_TYPE
3150 FixedWakeSourcePowerButton
3151 FixedWakeSourceSleepButton
3152 FixedWakeSourceRtc
3153End Enum
3154TypeDef PPO_FIXED_WAKE_SOURCE_TYPE = *PO_FIXED_WAKE_SOURCE_TYPE
3155
3156Type PO_WAKE_SOURCE_HEADER
3157 Type_ As PO_WAKE_SOURCE_TYPE
3158 Size As DWord
3159End Type
3160TypeDef PPO_WAKE_SOURCE_HEADER = *PO_WAKE_SOURCE_HEADER
3161
3162Type PO_WAKE_SOURCE_DEVICE
3163 Header As PO_WAKE_SOURCE_HEADER
3164 InstancePath[ELM(ANYSIZE_ARRAY)] As WCHAR
3165End Type
3166TypeDef PPO_WAKE_SOURCE_DEVICE = *PO_WAKE_SOURCE_DEVICE
3167
3168Type PO_WAKE_SOURCE_FIXED
3169 Header As PO_WAKE_SOURCE_HEADER
3170 FixedWakeSourceType As PO_FIXED_WAKE_SOURCE_TYPE
3171End Type
3172TypeDef PPO_WAKE_SOURCE_FIXED = *PO_WAKE_SOURCE_FIXED
3173
3174Type PO_WAKE_SOURCE_INFO
3175 Count As DWord
3176 Offsets[ELM(ANYSIZE_ARRAY)] As DWord
3177End Type
3178TypeDef PPO_WAKE_SOURCE_INFO = *PO_WAKE_SOURCE_INFO
3179
3180Type PO_WAKE_SOURCE_HISTORY
3181 Count As DWord
3182 Offsets[ELM(ANYSIZE_ARRAY)] As DWord
3183End Type
3184TypeDef PPO_WAKE_SOURCE_HISTORY = *PO_WAKE_SOURCE_HISTORY
3185
3186'#if (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_)
3187Type BATTERY_REPORTING_SCALE
3188 Granularity As DWord
3189 Capacity As DWord
3190End Type
3191TypeDef PBATTERY_REPORTING_SCALE = *BATTERY_REPORTING_SCALE
3192'#endif
3193
3194Type PPM_SIMULATED_PROCESSOR_LOAD
3195 Enabled As BOOLEAN
3196 PercentBusy[ELM(MAXIMUM_PROCESSORS)] As Byte
3197End Type
3198TypeDef PPPM_SIMULATED_PROCESSOR_LOAD = *PPM_SIMULATED_PROCESSOR_LOAD
3199
3200Type PPM_WMI_LEGACY_PERFSTATE
3201 Frequency As DWord
3202 Flags As DWord
3203 PercentFrequency As DWord
3204End Type
3205TypeDef PPPM_WMI_LEGACY_PERFSTATE = *PPM_WMI_LEGACY_PERFSTATE
3206
3207Type PPM_WMI_IDLE_STATE
3208 Latency As DWord
3209 Power As DWord
3210 TimeCheck As DWord
3211 PromotePercent As Byte
3212 DemotePercent As Byte
3213 StateType As Byte
3214 Reserved As Byte
3215 StateFlags As DWord
3216 Context As DWord
3217 IdleHandler As DWord
3218 Reserved1 As DWord
3219End Type
3220TypeDef PPPM_WMI_IDLE_STATE = *PPM_WMI_IDLE_STATE
3221
3222Type PPM_WMI_IDLE_STATES
3223 Type_ As DWord
3224 Count As DWord
3225 TargetState As DWord
3226 OldState As DWord
3227 TargetProcessors As QWord
3228 State[ELM(ANYSIZE_ARRAY)] As PPM_WMI_IDLE_STATE
3229End Type
3230TypeDef PPPM_WMI_IDLE_STATES = *PPM_WMI_IDLE_STATES
3231
3232Type PPM_WMI_PERF_STATE
3233 Frequency As DWord
3234 Power As DWord
3235 PercentFrequency As Byte
3236 IncreaseLevel As Byte
3237 DecreaseLevel As Byte
3238 Type_ As Byte
3239 IncreaseTime As DWord
3240 DecreaseTime As DWord
3241 Control As QWord
3242 Status As QWord
3243 HitCount As DWord
3244 Reserved1 As DWord
3245 Reserved2 As QWord
3246 Reserved3 As QWord
3247End Type
3248TypeDef PPPM_WMI_PERF_STATE = *PPM_WMI_PERF_STATE
3249
3250Type PPM_WMI_PERF_STATES
3251 Count As DWord
3252 MaxFrequency As DWord
3253 CurrentState As DWord
3254 MaxPerfState As DWord
3255 MinPerfState As DWord
3256 LowestPerfState As DWord
3257 ThermalConstraint As DWord
3258 BusyAdjThreshold As Byte
3259 PolicyType As Byte
3260 Type_ As Byte
3261 Reserved As Byte
3262 TimerInterval As DWord
3263 TargetProcessors As QWord
3264 PStateHandler As DWord
3265 PStateContext As DWord
3266 TStateHandler As DWord
3267 TStateContext As DWord
3268 FeedbackHandler As DWord
3269 Reserved1 As DWord
3270 Reserved2 As QWord
3271 State[ELM(ANYSIZE_ARRAY)] As PPM_WMI_PERF_STATE
3272End Type
3273TypeDef PPPM_WMI_PERF_STATES = *PPM_WMI_PERF_STATES
3274
3275Const PROC_IDLE_BUCKET_COUNT = 6
3276
3277Type PPM_IDLE_STATE_ACCOUNTING
3278 IdleTransitions As DWord
3279 FailedTransitions As DWord
3280 InvalidBucketIndex As DWord
3281 TotalTime As QWord
3282 IdleTimeBuckets[ELM(PROC_IDLE_BUCKET_COUNT)] As DWord
3283End Type
3284TypeDef PPPM_IDLE_STATE_ACCOUNTING = *PPM_IDLE_STATE_ACCOUNTING
3285
3286Type PPM_IDLE_ACCOUNTING
3287 StateCount As DWord
3288 TotalTransitions As DWord
3289 ResetCount As DWord
3290 StartTime As QWord
3291 State[ELM(ANYSIZE_ARRAY)] As PPM_IDLE_STATE_ACCOUNTING
3292End Type
3293TypeDef PPPM_IDLE_ACCOUNTING = *PPM_IDLE_ACCOUNTING
3294
3295Const ACPI_PPM_SOFTWARE_ALL = &hFC
3296Const ACPI_PPM_SOFTWARE_ANY = &hFD
3297Const ACPI_PPM_HARDWARE_ALL = &hFE
3298
3299Const MS_PPM_SOFTWARE_ALL = &h1
3300
3301' Processor Power Management WMI interface.
3302/*
3303// {A5B32DDD-7F39-4abc-B892-900E43B59EBB}
3304DEFINE_GUID(PPM_PERFSTATE_CHANGE_GUID,
33050xa5b32ddd, 0x7f39, 0x4abc, 0xb8, 0x92, 0x90, 0xe, 0x43, 0xb5, 0x9e, 0xbb);
3306
3307// {995e6b7f-d653-497a-b978-36a30c29bf01}
3308DEFINE_GUID(PPM_PERFSTATE_DOMAIN_CHANGE_GUID,
33090x995e6b7f, 0xd653, 0x497a, 0xb9, 0x78, 0x36, 0xa3, 0xc, 0x29, 0xbf, 0x1);
3310
3311// {4838fe4f-f71c-4e51-9ecc-8430a7ac4c6c}
3312DEFINE_GUID(PPM_IDLESTATE_CHANGE_GUID,
33130x4838fe4f, 0xf71c, 0x4e51, 0x9e, 0xcc, 0x84, 0x30, 0xa7, 0xac, 0x4c, 0x6c);
3314
3315// {5708cc20-7d40-4bf4-b4aa-2b01338d0126}
3316DEFINE_GUID(PPM_PERFSTATES_DATA_GUID,
33170x5708cc20, 0x7d40, 0x4bf4, 0xb4, 0xaa, 0x2b, 0x01, 0x33, 0x8d, 0x01, 0x26);
3318
3319// {ba138e10-e250-4ad7-8616-cf1a7ad410e7}
3320DEFINE_GUID(PPM_IDLESTATES_DATA_GUID,
33210xba138e10, 0xe250, 0x4ad7, 0x86, 0x16, 0xcf, 0x1a, 0x7a, 0xd4, 0x10, 0xe7);
3322
3323// {e2a26f78-ae07-4ee0-a30f-ce354f5a94cd}
3324DEFINE_GUID(PPM_IDLE_ACCOUNTING_GUID,
33250xe2a26f78, 0xae07, 0x4ee0, 0xa3, 0x0f, 0xce, 0x54, 0xf5, 0x5a, 0x94, 0xcd);
3326
3327// {a852c2c8-1a4c-423b-8c2c-f30d82931a88}
3328DEFINE_GUID(PPM_THERMALCONSTRAINT_GUID,
33290xa852c2c8, 0x1a4c, 0x423b, 0x8c, 0x2c, 0xf3, 0x0d, 0x82, 0x93, 0x1a, 0x88);
3330
3331// {7fd18652-0cfe-40d2-b0a1-0b066a87759e}
3332DEFINE_GUID(PPM_PERFMON_PERFSTATE_GUID,
33330x7fd18652, 0xcfe, 0x40d2, 0xb0, 0xa1, 0xb, 0x6, 0x6a, 0x87, 0x75, 0x9e);
3334
3335// {48f377b8-6880-4c7b-8bdc-380176c6654d}
3336DEFINE_GUID(PPM_THERMAL_POLICY_CHANGE_GUID,
33370x48f377b8, 0x6880, 0x4c7b, 0x8b, 0xdc, 0x38, 0x1, 0x76, 0xc6, 0x65, 0x4d);
3338*/
3339Type PPM_PERFSTATE_EVENT
3340 State As DWord
3341 Status As DWord
3342 Latency As DWord
3343 Speed As DWord
3344 Processor As DWord
3345End Type
3346TypeDef PPPM_PERFSTATE_EVENT = *PPM_PERFSTATE_EVENT
3347
3348Type PPM_PERFSTATE_DOMAIN_EVENT
3349 State As DWord
3350 Latency As DWord
3351 Speed As DWord
3352 Processors As QWord
3353End Type
3354TypeDef PPPM_PERFSTATE_DOMAIN_EVENT = *PPM_PERFSTATE_DOMAIN_EVENT
3355
3356Type PPM_IDLESTATE_EVENT
3357 NewState As DWord
3358 OldState As DWord
3359 Processors As QWord
3360End Type
3361TypeDef PPPM_IDLESTATE_EVENT = *PPM_IDLESTATE_EVENT
3362
3363Type PPM_THERMALCHANGE_EVENT
3364 ThermalConstraint As DWord
3365 Processors As QWord
3366End Type
3367TypeDef PPPM_THERMALCHANGE_EVENT = *PPM_THERMALCHANGE_EVENT
3368
3369Type PPM_THERMAL_POLICY_EVENT
3370 Mode As Byte
3371 Processors As QWord
3372End Type
3373TypeDef PPPM_THERMAL_POLICY_EVENT = *PPM_THERMAL_POLICY_EVENT
3374
3375Type POWER_ACTION_POLICY
3376 Action As POWER_ACTION
3377 Flags As DWord
3378 EventCode As DWord
3379End Type
3380TypeDef PPOWER_ACTION_POLICY = *POWER_ACTION_POLICY
3381
3382' POWER_ACTION_POLICY->Flags:
3383Const POWER_ACTION_QUERY_ALLOWED = &h00000001
3384Const POWER_ACTION_UI_ALLOWED = &h00000002
3385Const POWER_ACTION_OVERRIDE_APPS = &h00000004
3386Const POWER_ACTION_LIGHTEST_FIRST = &h10000000
3387Const POWER_ACTION_LOCK_CONSOLE = &h20000000
3388Const POWER_ACTION_DISABLE_WAKES = &h40000000
3389Const POWER_ACTION_CRITICAL = &h80000000
3390
3391' POWER_ACTION_POLICY->EventCode flags
3392Const POWER_LEVEL_USER_NOTIFY_TEXT = &h00000001
3393Const POWER_LEVEL_USER_NOTIFY_SOUND = &h00000002
3394Const POWER_LEVEL_USER_NOTIFY_EXEC = &h00000004
3395Const POWER_USER_NOTIFY_BUTTON = &h00000008
3396Const POWER_USER_NOTIFY_SHUTDOWN = &h00000010
3397Const POWER_FORCE_TRIGGER_RESET = &h80000000
3398
3399Const BATTERY_DISCHARGE_FLAGS_EVENTCODE_MASK = &h00000007
3400Const BATTERY_DISCHARGE_FLAGS_ENABLE = &h80000000
3401
3402Type SYSTEM_POWER_LEVEL
3403 Enable As BOOLEAN
3404 Spare[ELM(3)] As Byte
3405 BatteryLevel As DWord
3406 PowerPolicy As POWER_ACTION_POLICY
3407 MinSystemState As POWER_ACTION_POLICY
3408End Type
3409TypeDef PSYSTEM_POWER_LEVEL = *SYSTEM_POWER_LEVEL
3410
3411Const NUM_DISCHARGE_POLICIES = 4
3412Const DISCHARGE_POLICY_CRITICAL= 0
3413Const DISCHARGE_POLICY_LOW = 1
3414
3415Type SYSTEM_POWER_POLICY
3416 Revision As DWord
3417
3418 PowerButton As POWER_ACTION_POLICY
3419 SleepButton As POWER_ACTION_POLICY
3420 LidClose As POWER_ACTION_POLICY
3421 LidOpenWake As SYSTEM_POWER_STATE
3422 Reserved As DWord
3423
3424 Idle As POWER_ACTION_POLICY
3425 IdleTimeout As DWord
3426 IdleSensitivity As Byte
3427
3428 DynamicThrottle As Byte
3429 Spare2[ELM(2)] As Byte
3430
3431 MinSleep As SYSTEM_POWER_STATE
3432 MaxSleep As SYSTEM_POWER_STATE
3433 ReducedLatencySleep As SYSTEM_POWER_STATE
3434 WinLogonFlags As DWord
3435
3436 Spare3 As DWord
3437
3438 DozeS4Timeout As DWord
3439
3440 BroadcastCapacityResolution; As DWord
3441 DischargePolicy[ELM(NUM_DISCHARGE_POLICIES)] As SYSTEM_POWER_LEVEL
3442
3443 VideoTimeout As DWord
3444 VideoDimDisplay As BOOLEAN
3445 VideoReserved[ELM(3)] As DWord
3446
3447 SpindownTimeout As DWord
3448
3449 OptimizeForPower As BOOLEAN
3450 FanThrottleTolerance As Byte
3451 ForcedThrottle As Byte
3452 MinThrottle As Byte
3453 OverThrottled As POWER_ACTION_POLICY
3454End Type
3455TypeDef PSYSTEM_POWER_POLICY = *SYSTEM_POWER_POLICY
3456
3457' processor power policy state
3458
3459Const PROCESSOR_IDLESTATE_POLICY_COUNT = &h3
3460
3461Type PROCESSOR_IDLESTATE_INFO
3462 TimeCheck As DWord
3463 DemotePercent As Byte
3464 PromotePercent As Byte
3465 Spare[ELM(2)] As Byte
3466End Type
3467TypeDef PPROCESSOR_IDLESTATE_INFO = *PROCESSOR_IDLESTATE_INFO
3468
3469Type PROCESSOR_IDLESTATE_POLICY
3470 Revision As Word
3471 FlagsAsWRORD As Word
3472' Union
3473' AsWORD As Word
3474' struct {
3475' WORD AllowScaling : 1;
3476' WORD Disabled : 1;
3477' WORD Reserved : 14;
3478' };
3479' } Flags;
3480
3481 PolicyCount As DWord
3482 Policy[ELM(PROCESSOR_IDLESTATE_POLICY_COUNT)] As PROCESSOR_IDLESTATE_INFO
3483End Type
3484TypeDef PPROCESSOR_IDLESTATE_POLICY = *PROCESSOR_IDLESTATE_POLICY
3485
3486Const PO_THROTTLE_NONE = 0
3487Const PO_THROTTLE_CONSTANT = 1
3488Const PO_THROTTLE_DEGRADE = 2
3489Const PO_THROTTLE_ADAPTIVE = 3
3490Const PO_THROTTLE_MAXIMUM = 4
3491
3492Type PROCESSOR_POWER_POLICY_INFO
3493 TimeCheck As DWord
3494 DemoteLimit As DWord
3495 PromoteLimit As DWord
3496
3497 DemotePercent As Byte
3498 PromotePercent As Byte
3499 Spare[ELM(2)] As Byte
3500 Allow As DWord
3501' AllowDemotion:1 As DWord
3502' AllowPromotion:1 As DWord
3503' Reserved:30 As DWord
3504End Type
3505TypeDef PPROCESSOR_POWER_POLICY_INFO = *PROCESSOR_POWER_POLICY_INFO
3506
3507Type PROCESSOR_POWER_POLICY
3508 Revision As DWord
3509
3510 DynamicThrottle As Byte
3511 Spare[ELM(3)] As Byte
3512
3513 DisableCStates/*:1*/ As DWord
3514' Reserved:31 As DWord
3515
3516 PolicyCount As DWord
3517 Policy[ELM(3)] As PROCESSOR_POWER_POLICY_INFO
3518End Type
3519TypeDef PPROCESSOR_POWER_POLICY = *PROCESSOR_POWER_POLICY
3520
3521' Processor Perf State Policy.
3522Const PERFSTATE_POLICY_CHANGE_IDEAL = &h00
3523Const PERFSTATE_POLICY_CHANGE_SINGLE = &h01
3524Const PERFSTATE_POLICY_CHANGE_ROCKET = &h02
3525Const PERFSTATE_POLICY_CHANGE_MAX = PERFSTATE_POLICY_CHANGE_ROCKET
3526
3527Type PROCESSOR_PERFSTATE_POLICY 'アラインメント平気か?
3528 Revision As DWord
3529 MaxThrottle As Byte
3530 MinThrottle As Byte
3531 BusyAdjThreshold As Byte
3532 FlagsAsBYTE As Byte '下の共用体メンバの部分
3533' Union
3534' Spare As Byte
3535' Union
3536' AsBYTE As Byte
3537' Type
3538' NoDomainAccounting : 1 As Byte
3539' IncreasePolicy: 2 As Byte
3540' DecreasePolicy: 2 As Byte
3541' Reserved : 3 As Byte
3542' End Type
3543' } Flags;
3544' };
3545 TimeCheck As DWord
3546 IncreaseTime As DWord
3547 DecreaseTime As DWord
3548 IncreasePercent As DWord
3549 DecreasePercent As DWord
3550End Type
3551TypeDef PPROCESSOR_PERFSTATE_POLICY = *PROCESSOR_PERFSTATE_POLICY
3552
3553Type ADMINISTRATOR_POWER_POLICY
3554 MinSleep As SYSTEM_POWER_STATE
3555 MaxSleep As SYSTEM_POWER_STATE
3556
3557 MinVideoTimeout As DWord
3558 MaxVideoTimeout As DWord
3559
3560 MinSpindownTimeout As DWord
3561 MaxSpindownTimeout As DWord
3562End Type
3563TypeDef PADMINISTRATOR_POWER_POLICY = *ADMINISTRATOR_POWER_POLICY
3564
3565Type SYSTEM_POWER_CAPABILITIES
3566 PowerButtonPresent As BOOLEAN
3567 SleepButtonPresent As BOOLEAN
3568 LidPresent As BOOLEAN
3569 SystemS1 As BOOLEAN
3570 SystemS2 As BOOLEAN
3571 SystemS3 As BOOLEAN
3572 SystemS4 As BOOLEAN
3573 SystemS5 As BOOLEAN
3574 HiberFilePresent As BOOLEAN
3575 FullWake As BOOLEAN
3576 VideoDimPresent As BOOLEAN
3577 ApmPresent As BOOLEAN
3578 UpsPresent As BOOLEAN
3579
3580 ThermalControl As BOOLEAN
3581 ProcessorThrottle As BOOLEAN
3582 ProcessorMinThrottle As Byte
3583
3584'#if (NTDDI_VERSION < NTDDI_WINXP)
3585' ProcessorThrottleScale As Byte
3586' spare2[ELM(4)] As Byte
3587'#else
3588 ProcessorMaxThrottle As Byte
3589 FastSystemS4 As BOOLEAN
3590 spare2[(3)] As Byte
3591'#endif // (NTDDI_VERSION < NTDDI_WINXP)
3592
3593 DiskSpinDown As BOOLEAN
3594 spare3[ELM(8)] As Byte
3595
3596 SystemBatteriesPresent As BOOLEAN
3597 BatteriesAreShortTerm As BOOLEAN
3598 BatteryScale[ELM(3)] As BATTERY_REPORTING_SCALE
3599
3600 AcOnLineWake As SYSTEM_POWER_STATE
3601 SoftLidWake As SYSTEM_POWER_STATE
3602 RtcWake As SYSTEM_POWER_STATE
3603 MinDeviceWakeState As SYSTEM_POWER_STATE
3604 DefaultLowLatencyWake As SYSTEM_POWER_STATE
3605End Type
3606TypeDef PSYSTEM_POWER_CAPABILITIES = *SYSTEM_POWER_CAPABILITIES
3607
3608Type SYSTEM_BATTERY_STATE
3609 AcOnLine As BOOLEAN
3610 BatteryPresent As BOOLEAN
3611 Charging As BOOLEAN
3612 Discharging As BOOLEAN
3613 Spare1[ELM(4)] As BOOLEAN
3614
3615 MaxCapacity As DWord
3616 RemainingCapacity As DWord
3617 Rate As DWord
3618 EstimatedTime As DWord
3619
3620 DefaultAlert1 As DWord
3621 DefaultAlert2 As DWord
3622End Type
3623TypeDef PSYSTEM_BATTERY_STATE = *SYSTEM_BATTERY_STATE
3624
3625Const IMAGE_DOS_SIGNATURE = &h5A4D ' MZ
3626Const IMAGE_OS2_SIGNATURE = &h454E ' NE
3627Const IMAGE_OS2_SIGNATURE_LE = &h454C ' LE
3628Const IMAGE_VXD_SIGNATURE = &h454C ' LE
3629Const IMAGE_NT_SIGNATURE = &h00004550 ' PE00
3630
3631Type Align(2) IMAGE_DOS_HEADER ' DOS .EXE header
3632 e_magic As Word ' Magic number
3633 e_cblp As Word ' Bytes on last page of file
3634 e_cp As Word ' Pages in file
3635 e_crlc As Word ' Relocations
3636 e_cparhdr As Word ' Size of header in paragraphs
3637 e_minalloc As Word ' Minimum extra paragraphs needed
3638 e_maxalloc As Word ' Maximum extra paragraphs needed
3639 e_ss As Word ' Initial (relative) SS value
3640 e_sp As Word ' Initial SP value
3641 e_csum As Word ' Checksum
3642 e_ip As Word ' Initial IP value
3643 e_cs As Word ' Initial (relative) CS value
3644 e_lfarlc As Word ' File address of relocation table
3645 e_ovno As Word ' Overlay number
3646 e_res[ELM(4)] As Word ' Reserved words
3647 e_oemid As Word ' OEM identifier (for e_oeminfo)
3648 e_oeminfo As Word ' OEM information; e_oemid specific
3649 e_res2[ELM(10)] As Word ' Reserved words
3650 e_lfanew As Long ' File address of new exe header
3651End Type
3652TypeDef PIMAGE_DOS_HEADER = *IMAGE_DOS_HEADER
3653
3654Type Align(2) IMAGE_OS2_HEADER ' OS/2 .EXE header
3655 ne_magic As Word ' Magic number
3656 ne_ver As CHAR ' Version number
3657 ne_rev As CHAR ' Revision number
3658 ne_enttab As Word ' Offset of Entry Table
3659 ne_cbenttab As Word ' Number of bytes in Entry Table
3660 ne_crc As Long ' Checksum of whole file
3661 ne_flags As Word ' Flag word
3662 ne_autodata As Word ' Automatic data segment number
3663 ne_heap As Word ' Initial heap allocation
3664 ne_stack As Word ' Initial stack allocation
3665 ne_csip As Long ' Initial CS:IP setting
3666 ne_sssp As Long ' Initial SS:SP setting
3667 ne_cseg As Word ' Count of file segments
3668 ne_cmod As Word ' Entries in Module Reference Table
3669 ne_cbnrestab As Word ' Size of non-resident name table
3670 ne_segtab As Word ' Offset of Segment Table
3671 ne_rsrctab As Word ' Offset of Resource Table
3672 ne_restab As Word ' Offset of resident name table
3673 ne_modtab As Word ' Offset of Module Reference Table
3674 ne_imptab As Word ' Offset of Imported Names Table
3675 ne_nrestab As Long ' Offset of Non-resident Names Table
3676 ne_cmovent As Word ' Count of movable entries
3677 ne_align As Word ' Segment alignment shift count
3678 ne_cres As Word ' Count of resource segments
3679 ne_exetyp As Byte ' Target Operating system
3680 ne_flagsothers As Byte ' Other .EXE flags
3681 ne_pretthunks As Word ' offset to return thunks
3682 ne_psegrefbytes As Word ' offset to segment ref. bytes
3683 ne_swaparea As Word ' Minimum code swap area size
3684 ne_expver As Word ' Expected Windows version number
3685End Type
3686TypeDef PIMAGE_OS2_HEADER = *IMAGE_OS2_HEADER
3687
3688Type Align(2) IMAGE_VXD_HEADER ' Windows VXD header
3689 e32_magic As Word ' Magic number
3690 e32_border As Byte ' The byte ordering for the VXD
3691 e32_worder As Byte ' The word ordering for the VXD
3692 e32_level As DWord ' The EXE format level for now = 0
3693 e32_cpu As Word ' The CPU type
3694 e32_os As Word ' The OS type
3695 e32_ver As DWord ' Module version
3696 e32_mflags As DWord ' Module flags
3697 e32_mpages As DWord ' Module # pages
3698 e32_startobj As DWord ' Object # for instruction pointer
3699 e32_eip As DWord ' Extended instruction pointer
3700 e32_stackobj As DWord ' Object # for stack pointer
3701 e32_esp As DWord ' Extended stack pointer
3702 e32_pagesize As DWord ' VXD page size
3703 e32_lastpagesize As DWord ' Last page size in VXD
3704 e32_fixupsize As DWord ' Fixup section size
3705 e32_fixupsum As DWord ' Fixup section checksum
3706 e32_ldrsize As DWord ' Loader section size
3707 e32_ldrsum As DWord ' Loader section checksum
3708 e32_objtab As DWord ' Object table offset
3709 e32_objcnt As DWord ' Number of objects in module
3710 e32_objmap As DWord ' Object page map offset
3711 e32_itermap As DWord ' Object iterated data map offset
3712 e32_rsrctab As DWord ' Offset of Resource Table
3713 e32_rsrccnt As DWord ' Number of resource entries
3714 e32_restab As DWord ' Offset of resident name table
3715 e32_enttab As DWord ' Offset of Entry Table
3716 e32_dirtab As DWord ' Offset of Module Directive Table
3717 e32_dircnt As DWord ' Number of module directives
3718 e32_fpagetab As DWord ' Offset of Fixup Page Table
3719 e32_frectab As DWord ' Offset of Fixup Record Table
3720 e32_impmod As DWord ' Offset of Import Module Name Table
3721 e32_impmodcnt As DWord ' Number of entries in Import Module Name Table
3722 e32_impproc As DWord ' Offset of Import Procedure Name Table
3723 e32_pagesum As DWord ' Offset of Per-Page Checksum Table
3724 e32_datapage As DWord ' Offset of Enumerated Data Pages
3725 e32_preload As DWord ' Number of preload pages
3726 e32_nrestab As DWord ' Offset of Non-resident Names Table
3727 e32_cbnrestab As DWord ' Size of Non-resident Name Table
3728 e32_nressum As DWord ' Non-resident Name Table Checksum
3729 e32_autodata As DWord ' Object # for automatic data object
3730 e32_debuginfo As DWord ' Offset of the debugging information
3731 e32_debuglen As DWord ' The length of the debugging info. in bytes
3732 e32_instpreload As DWord ' Number of instance pages in preload section of VXD file
3733 e32_instdemand As DWord ' Number of instance pages in demand load section of VXD file
3734 e32_heapsize As DWord ' Size of heap - for 16-bit apps
3735 e32_res3[ELM(12)] As Byte ' Reserved words
3736 e32_winresoff As DWord
3737 e32_winreslen As DWord
3738 e32_devid As Word ' Device ID for VxD
3739 e32_ddkver As Word ' DDK version for VxD
3740End Type
3741TypeDef PIMAGE_VXD_HEADER = *IMAGE_VXD_HEADER
3742
3743' File header format.
3744Type Align(4) IMAGE_FILE_HEADER
3745 Machine As Word
3746 NumberOfSections As Word
3747 TimeDateStamp As DWord
3748 PointerToSymbolTable As DWord
3749 NumberOfSymbols As DWord
3750 SizeOfOptionalHeader As Word
3751 Characteristics As Word
3752End Type
3753TypeDef PIMAGE_FILE_HEADER = *IMAGE_FILE_HEADER
3754
3755Const IMAGE_SIZEOF_FILE_HEADER = 20
3756
3757Const IMAGE_FILE_RELOCS_STRIPPED = &h0001 ' Relocation info stripped from file.
3758Const IMAGE_FILE_EXECUTABLE_IMAGE = &h0002 ' File is executable (i.e. no unresolved externel references).
3759Const IMAGE_FILE_LINE_NUMS_STRIPPED = &h0004 ' Line nunbers stripped from file.
3760Const IMAGE_FILE_LOCAL_SYMS_STRIPPED = &h0008 ' Local symbols stripped from file.
3761Const IMAGE_FILE_AGGRESIVE_WS_TRIM = &h0010 ' Agressively trim working set
3762Const IMAGE_FILE_LARGE_ADDRESS_AWARE = &h0020 ' App can handle >2gb addresses
3763Const IMAGE_FILE_BYTES_REVERSED_LO = &h0080 ' Bytes of machine word are reversed.
3764Const IMAGE_FILE_32BIT_MACHINE = &h0100 ' 32 bit word machine.
3765Const IMAGE_FILE_DEBUG_STRIPPED = &h0200 ' Debugging info stripped from file in .DBG file
3766Const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = &h0400 ' If Image is on removable media, copy and run from the swap file.
3767Const IMAGE_FILE_NET_RUN_FROM_SWAP = &h0800 ' If Image is on Net, copy and run from the swap file.
3768Const IMAGE_FILE_SYSTEM = &h1000 ' System File.
3769Const IMAGE_FILE_DLL = &h2000 ' File is a DLL.
3770Const IMAGE_FILE_UP_SYSTEM_ONLY = &h4000 ' File should only be run on a UP machine
3771Const IMAGE_FILE_BYTES_REVERSED_HI = &h8000 ' Bytes of machine word are reversed.
3772
3773Const IMAGE_FILE_MACHINE_UNKNOWN = 0
3774Const IMAGE_FILE_MACHINE_I386 = &h014c ' Intel 386.
3775Const IMAGE_FILE_MACHINE_R3000 = &h0162 ' MIPS little-endian, 0x160 big-endian
3776Const IMAGE_FILE_MACHINE_R4000 = &h0166 ' MIPS little-endian
3777Const IMAGE_FILE_MACHINE_R10000 = &h0168 ' MIPS little-endian
3778Const IMAGE_FILE_MACHINE_WCEMIPSV2 = &h0169 ' MIPS little-endian WCE v2
3779Const IMAGE_FILE_MACHINE_ALPHA = &h0184 ' Alpha_AXP
3780Const IMAGE_FILE_MACHINE_SH3 = &h01a2 ' SH3 little-endian
3781Const IMAGE_FILE_MACHINE_SH3DSP = &h01a3
3782Const IMAGE_FILE_MACHINE_SH3E = &h01a4 ' SH3E little-endian
3783Const IMAGE_FILE_MACHINE_SH4 = &h01a6 ' SH4 little-endian
3784Const IMAGE_FILE_MACHINE_SH5 = &h01a8 ' SH5
3785Const IMAGE_FILE_MACHINE_ARM = &h01c0 ' ARM Little-Endian
3786Const IMAGE_FILE_MACHINE_THUMB = &h01c2
3787Const IMAGE_FILE_MACHINE_AM33 = &h01d3
3788Const IMAGE_FILE_MACHINE_POWERPC = &h01F0 ' IBM PowerPC Little-Endian
3789Const IMAGE_FILE_MACHINE_POWERPCFP = &h01f1
3790Const IMAGE_FILE_MACHINE_IA64 = &h0200 ' Intel 64
3791Const IMAGE_FILE_MACHINE_MIPS16 = &h0266 ' MIPS
3792Const IMAGE_FILE_MACHINE_ALPHA64 = &h0284 ' ALPHA64
3793Const IMAGE_FILE_MACHINE_MIPSFPU = &h0366 ' MIPS
3794Const IMAGE_FILE_MACHINE_MIPSFPU16 = &h0466 ' MIPS
3795Const IMAGE_FILE_MACHINE_AXP64 = IMAGE_FILE_MACHINE_ALPHA64
3796Const IMAGE_FILE_MACHINE_TRICORE = &h0520 ' Infineon
3797Const IMAGE_FILE_MACHINE_CEF = &h0CEF
3798Const IMAGE_FILE_MACHINE_EBC = &h0EBC ' EFI Byte Code
3799Const IMAGE_FILE_MACHINE_AMD64 = &h8664 ' AMD64 (K8)
3800Const IMAGE_FILE_MACHINE_M32R = &h9041 ' M32R little-endian
3801Const IMAGE_FILE_MACHINE_CEE = &hC0EE
3802
3803' Directory format.
3804Type IMAGE_DATA_DIRECTORY
3805 VirtualAddress As DWord
3806 Size As DWord
3807End Type
3808TypeDef PIMAGE_DATA_DIRECTORY = *IMAGE_DATA_DIRECTORY
3809
3810Const IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16
3811
3812' Optional header format.
3813Type IMAGE_OPTIONAL_HEADER32
3814 Magic As Word
3815 MajorLinkerVersion As Byte
3816 MinorLinkerVersion As Byte
3817 SizeOfCode As DWord
3818 SizeOfInitializedData As DWord
3819 SizeOfUninitializedData As DWord
3820 AddressOfEntryPoint As DWord
3821 BaseOfCode As DWord
3822 BaseOfData As DWord
3823
3824 ImageBase As DWord
3825 SectionAlignment As DWord
3826 FileAlignment As DWord
3827 MajorOperatingSystemVersion As Word
3828 MinorOperatingSystemVersion As Word
3829 MajorImageVersion As Word
3830 MinorImageVersion As Word
3831 MajorSubsystemVersion As Word
3832 MinorSubsystemVersion As Word
3833 Win32VersionValue As Word
3834 SizeOfImage As DWord
3835 SizeOfHeaders As DWord
3836 CheckSum As DWord
3837 Subsystem As Word
3838 DllCharacteristics As Word
3839 SizeOfStackReserve As DWord
3840 SizeOfStackCommit As DWord
3841 SizeOfHeapReserve As DWord
3842 SizeOfHeapCommit As DWord
3843 LoaderFlags As DWord
3844 NumberOfRvaAndSizes As DWord
3845 DataDirectory[ELM(IMAGE_NUMBEROF_DIRECTORY_ENTRIES)] As IMAGE_DATA_DIRECTORY
3846End Type
3847TypeDef PIMAGE_OPTIONAL_HEADER32 = *IMAGE_OPTIONAL_HEADER32
3848
3849Type IMAGE_ROM_OPTIONAL_HEADER
3850 Magic As Word
3851 MajorLinkerVersion As Byte
3852 MinorLinkerVersion As Byte
3853 SizeOfCode As DWord
3854 SizeOfInitializedData As DWord
3855 SizeOfUninitializedData As DWord
3856 AddressOfEntryPoint As DWord
3857 BaseOfCode As DWord
3858 BaseOfData As DWord
3859 BaseOfBss As DWord
3860 GprMask As DWord
3861 CprMask[ELM(4)] As DWord
3862 GpValue As DWord
3863End Type
3864TypeDef PIMAGE_ROM_OPTIONAL_HEADER = *IMAGE_ROM_OPTIONAL_HEADER
3865
3866Type IMAGE_OPTIONAL_HEADER64
3867 Magic As Word
3868 MajorLinkerVersion As Byte
3869 MinorLinkerVersion As Byte
3870 SizeOfCode As DWord
3871 SizeOfInitializedData As DWord
3872 SizeOfUninitializedData As DWord
3873 AddressOfEntryPoint As DWord
3874 BaseOfCode As DWord
3875 ImageBase As QWord
3876 SectionAlignment As DWord
3877 FileAlignment As DWord
3878 MajorOperatingSystemVersion As Word
3879 MinorOperatingSystemVersion As Word
3880 MajorImageVersion As Word
3881 MinorImageVersion As Word
3882 MajorSubsystemVersion As Word
3883 MinorSubsystemVersion As Word
3884 Win32VersionValue As DWord
3885 SizeOfImage As DWord
3886 SizeOfHeaders As DWord
3887 CheckSum As DWord
3888 Subsystem As Word
3889 DllCharacteristics As Word
3890 SizeOfStackReserve As QWord
3891 SizeOfStackCommit As QWord
3892 SizeOfHeapReserve As QWord
3893 SizeOfHeapCommit As QWord
3894 LoaderFlags As DWord
3895 NumberOfRvaAndSizes As DWord
3896 DataDirectory[ELM(IMAGE_NUMBEROF_DIRECTORY_ENTRIES)] As IMAGE_DATA_DIRECTORY
3897End Type
3898TypeDef PIMAGE_OPTIONAL_HEADER64 = *IMAGE_OPTIONAL_HEADER64
3899
3900Const IMAGE_NT_OPTIONAL_HDR32_MAGIC = &h10b
3901Const IMAGE_NT_OPTIONAL_HDR64_MAGIC = &h20b
3902Const IMAGE_ROM_OPTIONAL_HDR_MAGIC = &h107
3903
3904#ifdef _WIN64
3905TypeDef IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER64
3906TypeDef PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER64
3907Const IMAGE_NT_OPTIONAL_HDR_MAGIC = IMAGE_NT_OPTIONAL_HDR64_MAGIC
3908#else
3909TypeDef IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER32
3910TypeDef PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER32
3911Const IMAGE_NT_OPTIONAL_HDR_MAGIC = IMAGE_NT_OPTIONAL_HDR32_MAGIC
3912#endif
3913
3914Type IMAGE_NT_HEADERS64
3915 Signature As DWord
3916 FileHeader As IMAGE_FILE_HEADER
3917 OptionalHeader As IMAGE_OPTIONAL_HEADER64
3918End Type
3919TypeDef PIMAGE_NT_HEADERS64 = *IMAGE_NT_HEADERS64
3920
3921Type IMAGE_NT_HEADERS32
3922 Signature As DWord
3923 FileHeader As IMAGE_FILE_HEADER
3924 OptionalHeader As IMAGE_OPTIONAL_HEADER32
3925End Type
3926TypeDef PIMAGE_NT_HEADERS32 = *IMAGE_NT_HEADERS32
3927
3928Type IMAGE_ROM_HEADERS
3929 FileHeader As IMAGE_FILE_HEADER
3930 OptionalHeader As IMAGE_ROM_OPTIONAL_HEADER
3931End Type
3932TypeDef PIMAGE_ROM_HEADERS = *IMAGE_ROM_HEADERS
3933
3934#ifdef _WIN64
3935TypeDef IMAGE_NT_HEADERS = IMAGE_NT_HEADERS64
3936TypeDef PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS64
3937#else
3938TypeDef IMAGE_NT_HEADERS = IMAGE_NT_HEADERS32
3939TypeDef PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS32
3940#endif
3941/*
3942Const IMAGE_FIRST_SECTION( ntheader ) ( \_
3943 ((ntheader) As ULONG_PTR + _
3944 FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + _
3945 ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader _
3946 ) As PIMAGE_SECTION_HEADER)
3947*/
3948Const IMAGE_SUBSYSTEM_UNKNOWN = 0 ' Unknown subsystem.
3949Const IMAGE_SUBSYSTEM_NATIVE = 1 ' Image doesn't require a subsystem.
3950Const IMAGE_SUBSYSTEM_WINDOWS_GUI = 2 ' Image runs in the Windows GUI subsystem.
3951Const IMAGE_SUBSYSTEM_WINDOWS_CUI = 3 ' Image runs in the Windows character subsystem.
3952Const IMAGE_SUBSYSTEM_OS2_CUI = 5 ' image runs in the OS/2 character subsystem.
3953Const IMAGE_SUBSYSTEM_POSIX_CUI = 7 ' image runs in the Posix character subsystem.
3954Const IMAGE_SUBSYSTEM_NATIVE_WINDOWS = 8 ' image is a native Win9x driver.
3955Const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9 ' Image runs in the Windows CE subsystem.
3956Const IMAGE_SUBSYSTEM_EFI_APPLICATION = 10 '
3957Const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11 '
3958Const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12 '
3959Const IMAGE_SUBSYSTEM_EFI_ROM = 13
3960Const IMAGE_SUBSYSTEM_XBOX = 14
3961Const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16
3962
3963' IMAGE_LIBRARY_PROCESS_INIT = &h0001 ' Reserved.
3964' IMAGE_LIBRARY_PROCESS_TERM = &h0002 ' Reserved.
3965' IMAGE_LIBRARY_THREAD_INIT = &h0004 ' Reserved.
3966' IMAGE_LIBRARY_THREAD_TERM = &h0008 ' Reserved.
3967Const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = &h0040 ' DLL can move.
3968Const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY = &h0080 ' Code Integrity Image
3969Const IMAGE_DLLCHARACTERISTICS_NX_COMPAT = &h0100 ' Image is NX compatible
3970Const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = &h0200 ' Image understands isolation and doesn't want it
3971Const IMAGE_DLLCHARACTERISTICS_NO_SEH = &h0400 ' Image does not use SEH. No SE handler may reside in this image
3972Const IMAGE_DLLCHARACTERISTICS_NO_BIND = &h0800 ' Do not bind this image.
3973' = &h1000 ' Reserved.
3974Const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = &h2000 ' Driver uses WDM model
3975' = &h4000 ' Reserved.
3976Const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = &h8000
3977
3978Const IMAGE_DIRECTORY_ENTRY_EXPORT = 0 ' Export Directory
3979Const IMAGE_DIRECTORY_ENTRY_IMPORT = 1 ' Import Directory
3980Const IMAGE_DIRECTORY_ENTRY_RESOURCE = 2 ' Resource Directory
3981Const IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3 ' Exception Directory
3982Const IMAGE_DIRECTORY_ENTRY_SECURITY = 4 ' Security Directory
3983Const IMAGE_DIRECTORY_ENTRY_BASERELOC = 5 ' Base Relocation Table
3984Const IMAGE_DIRECTORY_ENTRY_DEBUG = 6 ' Debug Directory
3985' IMAGE_DIRECTORY_ENTRY_COPYRIGHT = 7 ' (X86 usage)
3986Const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE = 7 ' Architecture Specific Data
3987Const IMAGE_DIRECTORY_ENTRY_GLOBALPTR = 8 ' RVA of GP
3988Const IMAGE_DIRECTORY_ENTRY_TLS = 9 ' TLS Directory
3989Const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG = 10 ' Load Configuration Directory
3990Const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT = 11 ' Bound Import Directory in headers
3991Const IMAGE_DIRECTORY_ENTRY_IAT = 12 ' Import Address Table
3992Const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT = 13 ' Delay Load Import Descriptors
3993Const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14 ' COM Runtime descriptor
3994
3995' Non-COFF Object file header
3996Type ANON_OBJECT_HEADER
3997 Sig1 As Word ' Must be IMAGE_FILE_MACHINE_UNKNOWN
3998 Sig2 As Word ' Must be 0xffff
3999 Version As Word ' >= 1 (implies the CLSID field is present)
4000 Machine As Word
4001 TimeDateStamp As DWord
4002 ClassID As CLSID ' Used to invoke CoCreateInstance
4003 SizeOfData As DWord ' Size of data that follows the header
4004End Type
4005
4006Type ANON_OBJECT_HEADER_V2
4007 Sig1 As Word ' Must be IMAGE_FILE_MACHINE_UNKNOWN
4008 Sig2 As Word ' Must be 0xffff
4009 Version As Word ' >= 2 (implies the Flags field is present - otherwise V1)
4010 Machine As Word
4011 TimeDateStamp As DWord
4012 ClassID As CLSID ' Used to invoke CoCreateInstance
4013 SizeOfData As DWord ' Size of data that follows the header
4014 Flags As DWord ' 0x1 -> contains metadata
4015 MetaDataSize As DWord ' Size of CLR metadata
4016 MetaDataOffset As DWord ' Offset of CLR metadata
4017End Type
4018
4019Const IMAGE_SIZEOF_SHORT_NAME = 8
4020
4021Type IMAGE_SECTION_HEADER
4022 Name[ELM(IMAGE_SIZEOF_SHORT_NAME)] As Byte
4023 'Union
4024 PhysicalAddress As DWord
4025' VirtualSize As DWord
4026' } Misc
4027 VirtualAddress As DWord
4028 SizeOfRawData As DWord
4029 PointerToRawData As DWord
4030 PointerToRelocations As DWord
4031 PointerToLinenumbers As DWord
4032 NumberOfRelocations As Word
4033 NumberOfLinenumbers As Word
4034 Characteristics As DWord
4035End Type
4036TypeDef PIMAGE_SECTION_HEADER = *IMAGE_SECTION_HEADER
4037
4038Const IMAGE_SIZEOF_SECTION_HEADER = 40
4039
4040' Section characteristics.
4041' IMAGE_SCN_TYPE_REG = &h00000000 ' Reserved.
4042' IMAGE_SCN_TYPE_DSECT = &h00000001 ' Reserved.
4043' IMAGE_SCN_TYPE_NOLOAD = &h00000002 ' Reserved.
4044' IMAGE_SCN_TYPE_GROUP = &h00000004 ' Reserved.
4045Const IMAGE_SCN_TYPE_NO_PAD = &h00000008 ' Reserved.
4046' IMAGE_SCN_TYPE_COPY = &h00000010 ' Reserved.
4047
4048Const IMAGE_SCN_CNT_CODE = &h00000020 ' Section contains code.
4049Const IMAGE_SCN_CNT_INITIALIZED_DATA = &h00000040 ' Section contains initialized data.
4050Const IMAGE_SCN_CNT_UNINITIALIZED_DATA = &h00000080 ' Section contains uninitialized data.
4051
4052Const IMAGE_SCN_LNK_OTHER = &h00000100 ' Reserved.
4053Const IMAGE_SCN_LNK_INFO = &h00000200 ' Section contains comments or some other type of information.
4054' IMAGE_SCN_TYPE_OVER = &h00000400 ' Reserved.
4055Const IMAGE_SCN_LNK_REMOVE = &h00000800 ' Section contents will not become part of image.
4056Const IMAGE_SCN_LNK_COMDAT = &h00001000 ' Section contents comdat.
4057' = &h00002000 ' Reserved.
4058' IMAGE_SCN_MEM_PROTECTED - Obsolete = &h00004000
4059Const IMAGE_SCN_NO_DEFER_SPEC_EXC = &h00004000 ' Reset speculative exceptions handling bits in the TLB entries for this section.
4060Const IMAGE_SCN_GPREL = &h00008000 ' Section content can be accessed relative to GP
4061Const IMAGE_SCN_MEM_FARDATA = &h00008000
4062' IMAGE_SCN_MEM_SYSHEAP - Obsolete = &h00010000
4063Const IMAGE_SCN_MEM_PURGEABLE = &h00020000
4064Const IMAGE_SCN_MEM_16BIT = &h00020000
4065Const IMAGE_SCN_MEM_LOCKED = &h00040000
4066Const IMAGE_SCN_MEM_PRELOAD = &h00080000
4067
4068Const IMAGE_SCN_ALIGN_1BYTES = &h00100000 '
4069Const IMAGE_SCN_ALIGN_2BYTES = &h00200000 '
4070Const IMAGE_SCN_ALIGN_4BYTES = &h00300000 '
4071Const IMAGE_SCN_ALIGN_8BYTES = &h00400000 '
4072Const IMAGE_SCN_ALIGN_16BYTES = &h00500000 ' Default alignment if no others are specified.
4073Const IMAGE_SCN_ALIGN_32BYTES = &h00600000 '
4074Const IMAGE_SCN_ALIGN_64BYTES = &h00700000 '
4075Const IMAGE_SCN_ALIGN_128BYTES = &h00800000 '
4076Const IMAGE_SCN_ALIGN_256BYTES = &h00900000 '
4077Const IMAGE_SCN_ALIGN_512BYTES = &h00A00000 '
4078Const IMAGE_SCN_ALIGN_1024BYTES = &h00B00000 '
4079Const IMAGE_SCN_ALIGN_2048BYTES = &h00C00000 '
4080Const IMAGE_SCN_ALIGN_4096BYTES = &h00D00000 '
4081Const IMAGE_SCN_ALIGN_8192BYTES = &h00E00000 '
4082' Unused = &h00F00000
4083Const IMAGE_SCN_ALIGN_MASK = &h00F00000
4084
4085Const IMAGE_SCN_LNK_NRELOC_OVFL = &h01000000 ' Section contains extended relocations.
4086Const IMAGE_SCN_MEM_DISCARDABLE = &h02000000 ' Section can be discarded.
4087Const IMAGE_SCN_MEM_NOT_CACHED = &h04000000 ' Section is not cachable.
4088Const IMAGE_SCN_MEM_NOT_PAGED = &h08000000 ' Section is not pageable.
4089Const IMAGE_SCN_MEM_SHARED = &h10000000 ' Section is shareable.
4090Const IMAGE_SCN_MEM_EXECUTE = &h20000000 ' Section is executable.
4091Const IMAGE_SCN_MEM_READ = &h40000000 ' Section is readable.
4092Const IMAGE_SCN_MEM_WRITE = &h80000000 ' Section is writeable.
4093
4094' TLS Chaacteristic Flags
4095Const IMAGE_SCN_SCALE_INDEX = &h00000001 ' Tls index is scaled
4096
4097' Symbol format.
4098Type Align(2) IMAGE_SYMBOL
4099' Union
4100 ShortName[ELM(8)] As Byte
4101' Type
4102' Short As DWord
4103' Long As DWord
4104' } Name
4105' LongName[ELM(2)] As DWord ' PBYTE [ELM(2)]
4106' } N
4107 Value AS DWord
4108 SectionNumber As Integer
4109 Type_ As Word
4110 StorageClass As Byte
4111 NumberOfAuxSymbols As Byte
4112End Type
4113TypeDef PIMAGE_SYMBOL = * /*UNALIGNED*/ IMAGE_SYMBOL
4114
4115Const IMAGE_SIZEOF_SYMBOL = 18
4116
4117' Section values.
4118Const IMAGE_SYM_UNDEFINED = 0 As Integer ' Symbol is undefined or is common.
4119Const IMAGE_SYM_ABSOLUTE = -1 As Integer ' Symbol is an absolute value.
4120Const IMAGE_SYM_DEBUG = -2 As Integer ' Symbol is a special debug item.
4121Const IMAGE_SYM_SECTION_MAX = &hFEFF ' Values 0xFF00-0xFFFF are special
4122
4123' Type (fundamental) values.
4124
4125Const IMAGE_SYM_TYPE_NULL = &h0000 ' no type.
4126Const IMAGE_SYM_TYPE_VOID = &h0001 '
4127Const IMAGE_SYM_TYPE_CHAR = &h0002 ' type character.
4128Const IMAGE_SYM_TYPE_SHORT = &h0003 ' type short integer.
4129Const IMAGE_SYM_TYPE_INT = &h0004 '
4130Const IMAGE_SYM_TYPE_LONG = &h0005 '
4131Const IMAGE_SYM_TYPE_FLOAT = &h0006 '
4132Const IMAGE_SYM_TYPE_DOUBLE = &h0007 '
4133Const IMAGE_SYM_TYPE_STRUCT = &h0008 '
4134Const IMAGE_SYM_TYPE_UNION = &h0009 '
4135Const IMAGE_SYM_TYPE_ENUM = &h000A ' enumeration.
4136Const IMAGE_SYM_TYPE_MOE = &h000B ' member of enumeration.
4137Const IMAGE_SYM_TYPE_BYTE = &h000C '
4138Const IMAGE_SYM_TYPE_WORD = &h000D '
4139Const IMAGE_SYM_TYPE_UINT = &h000E '
4140Const IMAGE_SYM_TYPE_DWORD = &h000F '
4141Const IMAGE_SYM_TYPE_PCODE = &h8000 '
4142
4143'Type (derived) values.
4144
4145Const IMAGE_SYM_DTYPE_NULL = 0 ' no derived type.
4146Const IMAGE_SYM_DTYPE_POINTER = 1 ' pointer.
4147Const IMAGE_SYM_DTYPE_FUNCTION = 2 ' function.
4148Const IMAGE_SYM_DTYPE_ARRAY = 3 ' array.
4149
4150' Storage classes.
4151Const IMAGE_SYM_CLASS_END_OF_FUNCTION = -1 As Byte
4152Const IMAGE_SYM_CLASS_NULL = &h0000
4153Const IMAGE_SYM_CLASS_AUTOMATIC = &h0001
4154Const IMAGE_SYM_CLASS_EXTERNAL = &h0002
4155Const IMAGE_SYM_CLASS_STATIC = &h0003
4156Const IMAGE_SYM_CLASS_REGISTER = &h0004
4157Const IMAGE_SYM_CLASS_EXTERNAL_DEF = &h0005
4158Const IMAGE_SYM_CLASS_LABEL = &h0006
4159Const IMAGE_SYM_CLASS_UNDEFINED_LABEL = &h0007
4160Const IMAGE_SYM_CLASS_MEMBER_OF_STRUCT = &h0008
4161Const IMAGE_SYM_CLASS_ARGUMENT = &h0009
4162Const IMAGE_SYM_CLASS_STRUCT_TAG = &h000A
4163Const IMAGE_SYM_CLASS_MEMBER_OF_UNION = &h000B
4164Const IMAGE_SYM_CLASS_UNION_TAG = &h000C
4165Const IMAGE_SYM_CLASS_TYPE_DEFINITION = &h000D
4166Const IMAGE_SYM_CLASS_UNDEFINED_STATIC = &h000E
4167Const IMAGE_SYM_CLASS_ENUM_TAG = &h000F
4168Const IMAGE_SYM_CLASS_MEMBER_OF_ENUM = &h0010
4169Const IMAGE_SYM_CLASS_REGISTER_PARAM = &h0011
4170Const IMAGE_SYM_CLASS_BIT_FIELD = &h0012
4171
4172Const IMAGE_SYM_CLASS_FAR_EXTERNAL = &h0044
4173
4174Const IMAGE_SYM_CLASS_BLOCK = &h0064
4175Const IMAGE_SYM_CLASS_FUNCTION = &h0065
4176Const IMAGE_SYM_CLASS_END_OF_STRUCT = &h0066
4177Const IMAGE_SYM_CLASS_FILE = &h0067
4178' new
4179Const IMAGE_SYM_CLASS_SECTION = &h0068
4180Const IMAGE_SYM_CLASS_WEAK_EXTERNAL = &h0069
4181
4182Const IMAGE_SYM_CLASS_CLR_TOKEN = &h006B
4183
4184' type packing constants
4185Const N_BTMASK = &h000F
4186Const N_TMASK = &h0030
4187Const N_TMASK1 = &h00C0
4188Const N_TMASK2 = &h00F0
4189Const N_BTSHFT = 4
4190Const N_TSHIFT = 2
4191
4192Const BTYPE(x) = ((x) And N_BTMASK)
4193
4194#ifndef ISPTR
4195#define ISPTR
4196Const ISPTR(x) = (((x) And N_TMASK) = (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
4197#endif
4198
4199#ifndef ISFCN
4200#define ISFCN
4201Const ISFCN(x) = (((x) And N_TMASK) = (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
4202#endif
4203
4204#ifndef ISARY
4205#define ISARY
4206Const ISARY(x) = (((x) And N_TMASK) = (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
4207#endif
4208
4209#ifndef ISTAG
4210#define ISTAG
4211Const ISTAG(x) = ((x) = IMAGE_SYM_CLASS_STRUCT_TAG Or (x) = IMAGE_SYM_CLASS_UNION_TAG Or (x) = IMAGE_SYM_CLASS_ENUM_TAG)
4212#endif
4213
4214#ifndef INCREF
4215#define INCREF
4216Const INCREF(x) = ((((x) And (Not N_BTMASK)) << N_TSHIFT) Or (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT) Or ((x) And N_BTMASK))
4217#endif
4218
4219#ifndef DECREF
4220#define DECREF
4221Const DECREF(x) = ((((x) >> N_TSHIFT) And (Not N_BTMASK)) Or ((x) And N_BTMASK))
4222#endif
4223
4224' Auxiliary entry format.
4225Type /*Union*/ Align(2) IMAGE_AUX_SYMBOL
4226' Type
4227' TagIndex As DWord ' struct, union, or enum tag index
4228' Union
4229' Type
4230' Linenumber As Word ' declaration line number
4231' Size As Word ' size of struct, union, or enum
4232' } LnSz
4233' TotalSize As DWord
4234' } Misc
4235' Union
4236' Type ' if ISFCN, tag, or .bb
4237' PointerToLinenumber As DWord
4238' PointerToNextFunction As DWord
4239' } Function
4240' Type ' if ISARY, up to 4 dimen.
4241' Dimension[ELM(4)] As Word
4242' } Array
4243' } FcnAry
4244' TvIndex As Word ' tv index
4245' } Sym
4246' Type
4247' Name[ELM(IMAGE_SIZEOF_SYMBOL)] As Byte
4248' } File
4249' Type
4250 Length As DWord ' section length
4251 NumberOfRelocations As Word ' number of relocation entries
4252 NumberOfLinenumbers As Word ' number of line numbers
4253 CheckSum As DWord ' checksum for communal
4254 Number As Integer ' section number to associate with
4255 Selection As Byte ' communal selection type
4256' } Section
4257End Type 'Union
4258TypeDef PIMAGE_AUX_SYMBOL = * /*UNALIGNED*/ IMAGE_AUX_SYMBOL
4259
4260Enum IMAGE_AUX_SYMBOL_TYPE
4261 IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1
4262End Enum
4263
4264Type Align(2) IMAGE_AUX_SYMBOL_TOKEN_DEF
4265 bAuxType As Byte
4266 bReserved As Byte
4267 SymbolTableIndex As DWord
4268 rgbReserved[ELM(12)] As Byte
4269End Type
4270TypeDef PIMAGE_AUX_SYMBOL_TOKEN_DEF = * /*UNALIGNED*/ IMAGE_AUX_SYMBOL_TOKEN_DEF
4271
4272' Communal selection types.
4273Const IMAGE_COMDAT_SELECT_NODUPLICATES = 1
4274Const IMAGE_COMDAT_SELECT_ANY = 2
4275Const IMAGE_COMDAT_SELECT_SAME_SIZE = 3
4276Const IMAGE_COMDAT_SELECT_EXACT_MATCH = 4
4277Const IMAGE_COMDAT_SELECT_ASSOCIATIVE = 5
4278Const IMAGE_COMDAT_SELECT_LARGEST = 6
4279Const IMAGE_COMDAT_SELECT_NEWEST = 7
4280
4281Const IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1
4282Const IMAGE_WEAK_EXTERN_SEARCH_LIBRARY = 2
4283Const IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
4284
4285' Relocation format.
4286Type Align(2) IMAGE_RELOCATION
4287' Union
4288' VirtualAddress As DWord
4289 RelocCount As DWord
4290' End Union
4291 SymbolTableIndex As DWord
4292 Type_ As Word
4293End Type
4294TypeDef PIMAGE_RELOCATION = * /*UNALIGNED*/ IMAGE_RELOCATION
4295
4296' I386 relocation types.
4297Const IMAGE_REL_I386_ABSOLUTE = &h0000 ' Reference is absolute, no relocation is necessary
4298Const IMAGE_REL_I386_DIR16 = &h0001 ' Direct 16-bit reference to the symbols virtual address
4299Const IMAGE_REL_I386_REL16 = &h0002 ' PC-relative 16-bit reference to the symbols virtual address
4300Const IMAGE_REL_I386_DIR32 = &h0006 ' Direct 32-bit reference to the symbols virtual address
4301Const IMAGE_REL_I386_DIR32NB = &h0007 ' Direct 32-bit reference to the symbols virtual address, base not included
4302Const IMAGE_REL_I386_SEG12 = &h0009 ' Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
4303Const IMAGE_REL_I386_SECTION = &h000A
4304Const IMAGE_REL_I386_SECREL = &h000B
4305Const IMAGE_REL_I386_TOKEN = &h000C ' clr token
4306Const IMAGE_REL_I386_SECREL7 = &h000D ' 7 bit offset from base of section containing target
4307Const IMAGE_REL_I386_REL32 = &h0014 ' PC-relative 32-bit reference to the symbols virtual address
4308
4309' MIPS relocation types.
4310Const IMAGE_REL_MIPS_ABSOLUTE = &h0000 ' Reference is absolute, no relocation is necessary
4311Const IMAGE_REL_MIPS_REFHALF = &h0001
4312Const IMAGE_REL_MIPS_REFWORD = &h0002
4313Const IMAGE_REL_MIPS_JMPADDR = &h0003
4314Const IMAGE_REL_MIPS_REFHI = &h0004
4315Const IMAGE_REL_MIPS_REFLO = &h0005
4316Const IMAGE_REL_MIPS_GPREL = &h0006
4317Const IMAGE_REL_MIPS_LITERAL = &h0007
4318Const IMAGE_REL_MIPS_SECTION = &h000A
4319Const IMAGE_REL_MIPS_SECREL = &h000B
4320Const IMAGE_REL_MIPS_SECRELLO = &h000C ' Low 16-bit section relative referemce (used for >32k TLS)
4321Const IMAGE_REL_MIPS_SECRELHI = &h000D ' High 16-bit section relative reference (used for >32k TLS)
4322Const IMAGE_REL_MIPS_TOKEN = &h000E ' clr token
4323Const IMAGE_REL_MIPS_JMPADDR16 = &h0010
4324Const IMAGE_REL_MIPS_REFWORDNB = &h0022
4325Const IMAGE_REL_MIPS_PAIR = &h0025
4326
4327' Alpha Relocation types.
4328Const IMAGE_REL_ALPHA_ABSOLUTE = &h0000
4329Const IMAGE_REL_ALPHA_REFLONG = &h0001
4330Const IMAGE_REL_ALPHA_REFQUAD = &h0002
4331Const IMAGE_REL_ALPHA_GPREL32 = &h0003
4332Const IMAGE_REL_ALPHA_LITERAL = &h0004
4333Const IMAGE_REL_ALPHA_LITUSE = &h0005
4334Const IMAGE_REL_ALPHA_GPDISP = &h0006
4335Const IMAGE_REL_ALPHA_BRADDR = &h0007
4336Const IMAGE_REL_ALPHA_HINT = &h0008
4337Const IMAGE_REL_ALPHA_INLINE_REFLONG= &h0009
4338Const IMAGE_REL_ALPHA_REFHI = &h000A
4339Const IMAGE_REL_ALPHA_REFLO = &h000B
4340Const IMAGE_REL_ALPHA_PAIR = &h000C
4341Const IMAGE_REL_ALPHA_MATCH = &h000D
4342Const IMAGE_REL_ALPHA_SECTION = &h000E
4343Const IMAGE_REL_ALPHA_SECREL = &h000F
4344Const IMAGE_REL_ALPHA_REFLONGNB = &h0010
4345Const IMAGE_REL_ALPHA_SECRELLO = &h0011 ' Low 16-bit section relative reference
4346Const IMAGE_REL_ALPHA_SECRELHI = &h0012 ' High 16-bit section relative reference
4347Const IMAGE_REL_ALPHA_REFQ3 = &h0013 ' High 16 bits of 48 bit reference
4348Const IMAGE_REL_ALPHA_REFQ2 = &h0014 ' Middle 16 bits of 48 bit reference
4349Const IMAGE_REL_ALPHA_REFQ1 = &h0015 ' Low 16 bits of 48 bit reference
4350Const IMAGE_REL_ALPHA_GPRELLO = &h0016 ' Low 16-bit GP relative reference
4351Const IMAGE_REL_ALPHA_GPRELHI = &h0017 ' High 16-bit GP relative reference
4352
4353' IBM PowerPC relocation types.
4354Const IMAGE_REL_PPC_ABSOLUTE = &h0000 ' NOP
4355Const IMAGE_REL_PPC_ADDR64 = &h0001 ' 64-bit address
4356Const IMAGE_REL_PPC_ADDR32 = &h0002 ' 32-bit address
4357Const IMAGE_REL_PPC_ADDR24 = &h0003 ' 26-bit address, shifted left 2 (branch absolute)
4358Const IMAGE_REL_PPC_ADDR16 = &h0004 ' 16-bit address
4359Const IMAGE_REL_PPC_ADDR14 = &h0005 ' 16-bit address, shifted left 2 (load doubleword)
4360Const IMAGE_REL_PPC_REL24 = &h0006 ' 26-bit PC-relative offset, shifted left 2 (branch relative)
4361Const IMAGE_REL_PPC_REL14 = &h0007 ' 16-bit PC-relative offset, shifted left 2 (br cond relative)
4362Const IMAGE_REL_PPC_TOCREL16 = &h0008 ' 16-bit offset from TOC base
4363Const IMAGE_REL_PPC_TOCREL14 = &h0009 ' 16-bit offset from TOC base, shifted left 2 (load doubleword)
4364
4365Const IMAGE_REL_PPC_ADDR32NB = &h000A ' 32-bit addr w/o image base
4366Const IMAGE_REL_PPC_SECREL = &h000B ' va of containing section (as in an image sectionhdr)
4367Const IMAGE_REL_PPC_SECTION = &h000C ' sectionheader number
4368Const IMAGE_REL_PPC_IFGLUE = &h000D ' substitute TOC restore instruction iff symbol is glue code
4369Const IMAGE_REL_PPC_IMGLUE = &h000E ' symbol is glue code; virtual address is TOC restore instruction
4370Const IMAGE_REL_PPC_SECREL16 = &h000F ' va of containing section (limited to 16 bits)
4371Const IMAGE_REL_PPC_REFHI = &h0010
4372Const IMAGE_REL_PPC_REFLO = &h0011
4373Const IMAGE_REL_PPC_PAIR = &h0012
4374Const IMAGE_REL_PPC_SECRELLO = &h0013 ' Low 16-bit section relative reference (used for >32k TLS)
4375Const IMAGE_REL_PPC_SECRELHI = &h0014 ' High 16-bit section relative reference (used for >32k TLS)
4376Const IMAGE_REL_PPC_GPREL = &h0015
4377Const IMAGE_REL_PPC_TOKEN = &h0016 ' clr token
4378
4379Const IMAGE_REL_PPC_TYPEMASK = &h00FF ' mask to isolate above values in IMAGE_RELOCATION.Type
4380
4381' Flag bits in IMAGE_RELOCATION.TYPE
4382
4383Const IMAGE_REL_PPC_NEG = &h0100 ' subtract reloc value rather than adding it
4384Const IMAGE_REL_PPC_BRTAKEN = &h0200 ' fix branch prediction bit to predict branch taken
4385Const IMAGE_REL_PPC_BRNTAKEN = &h0400 ' fix branch prediction bit to predict branch not taken
4386Const IMAGE_REL_PPC_TOCDEFN = &h0800 ' toc slot defined in file (or, data in toc)
4387
4388' Hitachi SH3 relocation types.
4389Const IMAGE_REL_SH3_ABSOLUTE = &h0000 ' No relocation
4390Const IMAGE_REL_SH3_DIRECT16 = &h0001 ' 16 bit direct
4391Const IMAGE_REL_SH3_DIRECT32 = &h0002 ' 32 bit direct
4392Const IMAGE_REL_SH3_DIRECT8 = &h0003 ' 8 bit direct, -128..255
4393Const IMAGE_REL_SH3_DIRECT8_WORD = &h0004 ' 8 bit direct .W (0 ext.)
4394Const IMAGE_REL_SH3_DIRECT8_LONG = &h0005 ' 8 bit direct .L (0 ext.)
4395Const IMAGE_REL_SH3_DIRECT4 = &h0006 ' 4 bit direct (0 ext.)
4396Const IMAGE_REL_SH3_DIRECT4_WORD = &h0007 ' 4 bit direct .W (0 ext.)
4397Const IMAGE_REL_SH3_DIRECT4_LONG = &h0008 ' 4 bit direct .L (0 ext.)
4398Const IMAGE_REL_SH3_PCREL8_WORD = &h0009 ' 8 bit PC relative .W
4399Const IMAGE_REL_SH3_PCREL8_LONG = &h000A ' 8 bit PC relative .L
4400Const IMAGE_REL_SH3_PCREL12_WORD = &h000B ' 12 LSB PC relative .W
4401Const IMAGE_REL_SH3_STARTOF_SECTION = &h000C ' Start of EXE section
4402Const IMAGE_REL_SH3_SIZEOF_SECTION = &h000D ' Size of EXE section
4403Const IMAGE_REL_SH3_SECTION = &h000E ' Section table index
4404Const IMAGE_REL_SH3_SECREL = &h000F ' Offset within section
4405Const IMAGE_REL_SH3_DIRECT32_NB = &h0010 ' 32 bit direct not based
4406Const IMAGE_REL_SH3_GPREL4_LONG = &h0011 ' GP-relative addressing
4407Const IMAGE_REL_SH3_TOKEN = &h0012 ' clr token
4408Const IMAGE_REL_SHM_PCRELPT = &h0013 ' Offset from current
4409 ' instruction in longwords
4410 ' if not NOMODE, insert the
4411 ' inverse of the low bit at
4412 ' bit 32 to select PTA/PTB
4413Const IMAGE_REL_SHM_REFLO = &h0014 ' Low bits of 32-bit address
4414Const IMAGE_REL_SHM_REFHALF = &h0015 ' High bits of 32-bit address
4415Const IMAGE_REL_SHM_RELLO = &h0016 ' Low bits of relative reference
4416Const IMAGE_REL_SHM_RELHALF = &h0017 ' High bits of relative reference
4417Const IMAGE_REL_SHM_PAIR = &h0018 ' offset operand for relocation
4418
4419Const IMAGE_REL_SH_NOMODE = &h8000 ' relocation ignores section mode
4420
4421
4422Const IMAGE_REL_ARM_ABSOLUTE = &h0000 ' No relocation required
4423Const IMAGE_REL_ARM_ADDR32 = &h0001 ' 32 bit address
4424Const IMAGE_REL_ARM_ADDR32NB = &h0002 ' 32 bit address w/o image base
4425Const IMAGE_REL_ARM_BRANCH24 = &h0003 ' 24 bit offset << 2 & sign ext.
4426Const IMAGE_REL_ARM_BRANCH11 = &h0004 ' Thumb: 2 11 bit offsets
4427Const IMAGE_REL_ARM_TOKEN = &h0005 ' clr token
4428Const IMAGE_REL_ARM_GPREL12 = &h0006 ' GP-relative addressing (ARM)
4429Const IMAGE_REL_ARM_GPREL7 = &h0007 ' GP-relative addressing (Thumb)
4430Const IMAGE_REL_ARM_BLX24 = &h0008
4431Const IMAGE_REL_ARM_BLX11 = &h0009
4432Const IMAGE_REL_ARM_SECTION = &h000E ' Section table index
4433Const IMAGE_REL_ARM_SECREL = &h000F ' Offset within section
4434
4435Const IMAGE_REL_AM_ABSOLUTE = &h0000
4436Const IMAGE_REL_AM_ADDR32 = &h0001
4437Const IMAGE_REL_AM_ADDR32NB = &h0002
4438Const IMAGE_REL_AM_CALL32 = &h0003
4439Const IMAGE_REL_AM_FUNCINFO = &h0004
4440Const IMAGE_REL_AM_REL32_1 = &h0005
4441Const IMAGE_REL_AM_REL32_2 = &h0006
4442Const IMAGE_REL_AM_SECREL = &h0007
4443Const IMAGE_REL_AM_SECTION = &h0008
4444Const IMAGE_REL_AM_TOKEN = &h0009
4445
4446' x64 relocations
4447Const IMAGE_REL_AMD64_ABSOLUTE = &h0000 ' Reference is absolute, no relocation is necessary
4448Const IMAGE_REL_AMD64_ADDR64 = &h0001 ' 64-bit address (VA).
4449Const IMAGE_REL_AMD64_ADDR32 = &h0002 ' 32-bit address (VA).
4450Const IMAGE_REL_AMD64_ADDR32NB = &h0003 ' 32-bit address w/o image base (RVA).
4451Const IMAGE_REL_AMD64_REL32 = &h0004 ' 32-bit relative address from byte following reloc
4452Const IMAGE_REL_AMD64_REL32_1 = &h0005 ' 32-bit relative address from byte distance 1 from reloc
4453Const IMAGE_REL_AMD64_REL32_2 = &h0006 ' 32-bit relative address from byte distance 2 from reloc
4454Const IMAGE_REL_AMD64_REL32_3 = &h0007 ' 32-bit relative address from byte distance 3 from reloc
4455Const IMAGE_REL_AMD64_REL32_4 = &h0008 ' 32-bit relative address from byte distance 4 from reloc
4456Const IMAGE_REL_AMD64_REL32_5 = &h0009 ' 32-bit relative address from byte distance 5 from reloc
4457Const IMAGE_REL_AMD64_SECTION = &h000A ' Section index
4458Const IMAGE_REL_AMD64_SECREL = &h000B ' 32 bit offset from base of section containing target
4459Const IMAGE_REL_AMD64_SECREL7 = &h000C ' 7 bit unsigned offset from base of section containing target
4460Const IMAGE_REL_AMD64_TOKEN = &h000D ' 32 bit metadata token
4461Const IMAGE_REL_AMD64_SREL32 = &h000E ' 32 bit signed span-dependent value emitted into object
4462Const IMAGE_REL_AMD64_PAIR = &h000F
4463Const IMAGE_REL_AMD64_SSPAN32 = &h0010 ' 32 bit signed span-dependent value applied at link time
4464
4465' IA64 relocation types.
4466
4467Const IMAGE_REL_IA64_ABSOLUTE = &h0000
4468Const IMAGE_REL_IA64_IMM14 = &h0001
4469Const IMAGE_REL_IA64_IMM22 = &h0002
4470Const IMAGE_REL_IA64_IMM64 = &h0003
4471Const IMAGE_REL_IA64_DIR32 = &h0004
4472Const IMAGE_REL_IA64_DIR64 = &h0005
4473Const IMAGE_REL_IA64_PCREL21B = &h0006
4474Const IMAGE_REL_IA64_PCREL21M = &h0007
4475Const IMAGE_REL_IA64_PCREL21F = &h0008
4476Const IMAGE_REL_IA64_GPREL22 = &h0009
4477Const IMAGE_REL_IA64_LTOFF22 = &h000A
4478Const IMAGE_REL_IA64_SECTION = &h000B
4479Const IMAGE_REL_IA64_SECREL22 = &h000C
4480Const IMAGE_REL_IA64_SECREL64I = &h000D
4481Const IMAGE_REL_IA64_SECREL32 = &h000E
4482'
4483Const IMAGE_REL_IA64_DIR32NB = &h0010
4484Const IMAGE_REL_IA64_SREL14 = &h0011
4485Const IMAGE_REL_IA64_SREL22 = &h0012
4486Const IMAGE_REL_IA64_SREL32 = &h0013
4487Const IMAGE_REL_IA64_UREL32 = &h0014
4488Const IMAGE_REL_IA64_PCREL60X = &h0015 ' This is always a BRL and never converted
4489Const IMAGE_REL_IA64_PCREL60B = &h0016 ' If possible, convert to MBB bundle with NOP.B in slot 1
4490Const IMAGE_REL_IA64_PCREL60F = &h0017 ' If possible, convert to MFB bundle with NOP.F in slot 1
4491Const IMAGE_REL_IA64_PCREL60I = &h0018 ' If possible, convert to MIB bundle with NOP.I in slot 1
4492Const IMAGE_REL_IA64_PCREL60M = &h0019 ' If possible, convert to MMB bundle with NOP.M in slot 1
4493Const IMAGE_REL_IA64_IMMGPREL64 = &h001A
4494Const IMAGE_REL_IA64_TOKEN = &h001B ' clr token
4495Const IMAGE_REL_IA64_GPREL32 = &h001C
4496Const IMAGE_REL_IA64_ADDEND = &h001F
4497
4498' CEF relocation types.
4499Const IMAGE_REL_CEF_ABSOLUTE = &h0000 ' Reference is absolute, no relocation is necessary
4500Const IMAGE_REL_CEF_ADDR32 = &h0001 ' 32-bit address (VA).
4501Const IMAGE_REL_CEF_ADDR64 = &h0002 ' 64-bit address (VA).
4502Const IMAGE_REL_CEF_ADDR32NB = &h0003 ' 32-bit address w/o image base (RVA).
4503Const IMAGE_REL_CEF_SECTION = &h0004 ' Section index
4504Const IMAGE_REL_CEF_SECREL = &h0005 ' 32 bit offset from base of section containing target
4505Const IMAGE_REL_CEF_TOKEN = &h0006 ' 32 bit metadata token
4506
4507' clr relocation types.
4508Const IMAGE_REL_CEE_ABSOLUTE = &h0000 ' Reference is absolute, no relocation is necessary
4509Const IMAGE_REL_CEE_ADDR32 = &h0001 ' 32-bit address (VA).
4510Const IMAGE_REL_CEE_ADDR64 = &h0002 ' 64-bit address (VA).
4511Const IMAGE_REL_CEE_ADDR32NB = &h0003 ' 32-bit address w/o image base (RVA).
4512Const IMAGE_REL_CEE_SECTION = &h0004 ' Section index
4513Const IMAGE_REL_CEE_SECREL = &h0005 ' 32 bit offset from base of section containing target
4514Const IMAGE_REL_CEE_TOKEN = &h0006 ' 32 bit metadata token
4515
4516
4517Const IMAGE_REL_M32R_ABSOLUTE = &h0000 ' No relocation required
4518Const IMAGE_REL_M32R_ADDR32 = &h0001 ' 32 bit address
4519Const IMAGE_REL_M32R_ADDR32NB = &h0002 ' 32 bit address w/o image base
4520Const IMAGE_REL_M32R_ADDR24 = &h0003 ' 24 bit address
4521Const IMAGE_REL_M32R_GPREL16 = &h0004 ' GP relative addressing
4522Const IMAGE_REL_M32R_PCREL24 = &h0005 ' 24 bit offset << 2 & sign ext.
4523Const IMAGE_REL_M32R_PCREL16 = &h0006 ' 16 bit offset << 2 & sign ext.
4524Const IMAGE_REL_M32R_PCREL8 = &h0007 ' 8 bit offset << 2 & sign ext.
4525Const IMAGE_REL_M32R_REFHALF = &h0008 ' 16 MSBs
4526Const IMAGE_REL_M32R_REFHI = &h0009 ' 16 MSBs; adj for LSB sign ext.
4527Const IMAGE_REL_M32R_REFLO = &h000A ' 16 LSBs
4528Const IMAGE_REL_M32R_PAIR = &h000B ' Link HI and LO
4529Const IMAGE_REL_M32R_SECTION = &h000C ' Section table index
4530Const IMAGE_REL_M32R_SECREL32 = &h000D ' 32 bit section relative reference
4531Const IMAGE_REL_M32R_TOKEN = &h000E ' clr token
4532
4533Const IMAGE_REL_EBC_ABSOLUTE = &h0000 ' No relocation required
4534Const IMAGE_REL_EBC_ADDR32NB = &h0001 ' 32 bit address w/o image base
4535Const IMAGE_REL_EBC_REL32 = &h0002 ' 32-bit relative address from byte following reloc
4536Const IMAGE_REL_EBC_SECTION = &h0003 ' Section table index
4537Const IMAGE_REL_EBC_SECREL = &h0004 ' Offset within section
4538
4539'Const EXT_IMM64(Value, Address, Size, InstPos, ValPos) /* Intel-IA64-Filler * / \
4540' Value |= (((ULONGLONG)((*(Address) >> InstPos) & (((ULONGLONG)1 << Size) - 1))) << ValPos) // Intel-IA64-Filler
4541
4542'Const INS_IMM64(Value, Address, Size, InstPos, ValPos) /* Intel-IA64-Filler * /\
4543' *(PDWORD)Address = (*(PDWORD)Address & ~(((1 << Size) - 1) << InstPos)) | /* Intel-IA64-Filler * /\
4544' ((DWORD)((((ULONGLONG)Value >> ValPos) & (((ULONGLONG)1 << Size) - 1))) << InstPos) // Intel-IA64-Filler
4545
4546Const EMARCH_ENC_I17_IMM7B_INST_WORD_X = 3 ' Intel-IA64-Filler
4547Const EMARCH_ENC_I17_IMM7B_SIZE_X = 7 ' Intel-IA64-Filler
4548Const EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X = 4 ' Intel-IA64-Filler
4549Const EMARCH_ENC_I17_IMM7B_VAL_POS_X = 0 ' Intel-IA64-Filler
4550
4551Const EMARCH_ENC_I17_IMM9D_INST_WORD_X = 3 ' Intel-IA64-Filler
4552Const EMARCH_ENC_I17_IMM9D_SIZE_X = 9 ' Intel-IA64-Filler
4553Const EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X = 18 ' Intel-IA64-Filler
4554Const EMARCH_ENC_I17_IMM9D_VAL_POS_X = 7 ' Intel-IA64-Filler
4555
4556Const EMARCH_ENC_I17_IMM5C_INST_WORD_X = 3 ' Intel-IA64-Filler
4557Const EMARCH_ENC_I17_IMM5C_SIZE_X = 5 ' Intel-IA64-Filler
4558Const EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X = 13 ' Intel-IA64-Filler
4559Const EMARCH_ENC_I17_IMM5C_VAL_POS_X = 16 ' Intel-IA64-Filler
4560
4561Const EMARCH_ENC_I17_IC_INST_WORD_X = 3 ' Intel-IA64-Filler
4562Const EMARCH_ENC_I17_IC_SIZE_X = 1 ' Intel-IA64-Filler
4563Const EMARCH_ENC_I17_IC_INST_WORD_POS_X = 12 ' Intel-IA64-Filler
4564Const EMARCH_ENC_I17_IC_VAL_POS_X = 21 ' Intel-IA64-Filler
4565
4566Const EMARCH_ENC_I17_IMM41a_INST_WORD_X = 1 ' Intel-IA64-Filler
4567Const EMARCH_ENC_I17_IMM41a_SIZE_X = 10 ' Intel-IA64-Filler
4568Const EMARCH_ENC_I17_IMM41a_INST_WORD_POS_X = 14 ' Intel-IA64-Filler
4569Const EMARCH_ENC_I17_IMM41a_VAL_POS_X = 22 ' Intel-IA64-Filler
4570
4571Const EMARCH_ENC_I17_IMM41b_INST_WORD_X = 1 ' Intel-IA64-Filler
4572Const EMARCH_ENC_I17_IMM41b_SIZE_X = 8 ' Intel-IA64-Filler
4573Const EMARCH_ENC_I17_IMM41b_INST_WORD_POS_X = 24 ' Intel-IA64-Filler
4574Const EMARCH_ENC_I17_IMM41b_VAL_POS_X = 32 ' Intel-IA64-Filler
4575
4576Const EMARCH_ENC_I17_IMM41c_INST_WORD_X = 2 ' Intel-IA64-Filler
4577Const EMARCH_ENC_I17_IMM41c_SIZE_X = 23 ' Intel-IA64-Filler
4578Const EMARCH_ENC_I17_IMM41c_INST_WORD_POS_X = 0 ' Intel-IA64-Filler
4579Const EMARCH_ENC_I17_IMM41c_VAL_POS_X = 40 ' Intel-IA64-Filler
4580
4581Const EMARCH_ENC_I17_SIGN_INST_WORD_X = 3 ' Intel-IA64-Filler
4582Const EMARCH_ENC_I17_SIGN_SIZE_X = 1 ' Intel-IA64-Filler
4583Const EMARCH_ENC_I17_SIGN_INST_WORD_POS_X = 27 ' Intel-IA64-Filler
4584Const EMARCH_ENC_I17_SIGN_VAL_POS_X = 63 ' Intel-IA64-Filler
4585
4586Const X3_OPCODE_INST_WORD_X = 3 ' Intel-IA64-Filler
4587Const X3_OPCODE_SIZE_X = 4 ' Intel-IA64-Filler
4588Const X3_OPCODE_INST_WORD_POS_X = 28 ' Intel-IA64-Filler
4589Const X3_OPCODE_SIGN_VAL_POS_X = 0 ' Intel-IA64-Filler
4590
4591Const X3_I_INST_WORD_X = 3 ' Intel-IA64-Filler
4592Const X3_I_SIZE_X = 1 ' Intel-IA64-Filler
4593Const X3_I_INST_WORD_POS_X = 27 ' Intel-IA64-Filler
4594Const X3_I_SIGN_VAL_POS_X = 59 ' Intel-IA64-Filler
4595
4596Const X3_D_WH_INST_WORD_X = 3 ' Intel-IA64-Filler
4597Const X3_D_WH_SIZE_X = 3 ' Intel-IA64-Filler
4598Const X3_D_WH_INST_WORD_POS_X = 24 ' Intel-IA64-Filler
4599Const X3_D_WH_SIGN_VAL_POS_X = 0 ' Intel-IA64-Filler
4600
4601Const X3_IMM20_INST_WORD_X = 3 ' Intel-IA64-Filler
4602Const X3_IMM20_SIZE_X = 20 ' Intel-IA64-Filler
4603Const X3_IMM20_INST_WORD_POS_X = 4 ' Intel-IA64-Filler
4604Const X3_IMM20_SIGN_VAL_POS_X = 0 ' Intel-IA64-Filler
4605
4606Const X3_IMM39_1_INST_WORD_X = 2 ' Intel-IA64-Filler
4607Const X3_IMM39_1_SIZE_X = 23 ' Intel-IA64-Filler
4608Const X3_IMM39_1_INST_WORD_POS_X = 0 ' Intel-IA64-Filler
4609Const X3_IMM39_1_SIGN_VAL_POS_X = 36 ' Intel-IA64-Filler
4610
4611Const X3_IMM39_2_INST_WORD_X = 1 ' Intel-IA64-Filler
4612Const X3_IMM39_2_SIZE_X = 16 ' Intel-IA64-Filler
4613Const X3_IMM39_2_INST_WORD_POS_X = 16 ' Intel-IA64-Filler
4614Const X3_IMM39_2_SIGN_VAL_POS_X = 20 ' Intel-IA64-Filler
4615
4616Const X3_P_INST_WORD_X = 3 ' Intel-IA64-Filler
4617Const X3_P_SIZE_X = 4 ' Intel-IA64-Filler
4618Const X3_P_INST_WORD_POS_X = 0 ' Intel-IA64-Filler
4619Const X3_P_SIGN_VAL_POS_X = 0 ' Intel-IA64-Filler
4620
4621Const X3_TMPLT_INST_WORD_X = 0 ' Intel-IA64-Filler
4622Const X3_TMPLT_SIZE_X = 4 ' Intel-IA64-Filler
4623Const X3_TMPLT_INST_WORD_POS_X = 0 ' Intel-IA64-Filler
4624Const X3_TMPLT_SIGN_VAL_POS_X = 0 ' Intel-IA64-Filler
4625
4626Const X3_BTYPE_QP_INST_WORD_X = 2 ' Intel-IA64-Filler
4627Const X3_BTYPE_QP_SIZE_X = 9 ' Intel-IA64-Filler
4628Const X3_BTYPE_QP_INST_WORD_POS_X = 23 ' Intel-IA64-Filler
4629Const X3_BTYPE_QP_INST_VAL_POS_X = 0 ' Intel-IA64-Filler
4630
4631Const X3_EMPTY_INST_WORD_X = 1 ' Intel-IA64-Filler
4632Const X3_EMPTY_SIZE_X = 2 ' Intel-IA64-Filler
4633Const X3_EMPTY_INST_WORD_POS_X = 14 ' Intel-IA64-Filler
4634Const X3_EMPTY_INST_VAL_POS_X = 0 ' Intel-IA64-Filler
4635
4636' Line number format.
4637Type Align(2) IMAGE_LINENUMBER
4638' Union
4639 SymbolTableIndex As DWord
4640' VirtualAddress As DWord
4641' End Union
4642 Linenumber As Word
4643End Type
4644TypeDef PIMAGE_LINENUMBER = * /*UNALIGNED*/ IMAGE_LINENUMBER
4645
4646' Based relocation format.
4647Type IMAGE_BASE_RELOCATION
4648 VirtualAddress As DWord
4649 SizeOfBlock As DWord
4650' TypeOffset[ELM(1)] As Word
4651End Type
4652TypeDef PIMAGE_BASE_RELOCATION = * /*UNALIGNED*/ IMAGE_BASE_RELOCATION
4653
4654' Based relocation types.
4655Const IMAGE_REL_BASED_ABSOLUTE = 0
4656Const IMAGE_REL_BASED_HIGH = 1
4657Const IMAGE_REL_BASED_LOW = 2
4658Const IMAGE_REL_BASED_HIGHLOW = 3
4659Const IMAGE_REL_BASED_HIGHADJ = 4
4660Const IMAGE_REL_BASED_MIPS_JMPADDR = 5
4661Const IMAGE_REL_BASED_MIPS_JMPADDR16 = 9
4662Const IMAGE_REL_BASED_IA64_IMM64 = 9
4663Const IMAGE_REL_BASED_DIR64 = 10
4664
4665' Archive format.
4666Const IMAGE_ARCHIVE_START_SIZE = 8
4667Const IMAGE_ARCHIVE_START = Ex"!<arch>\n"
4668Const IMAGE_ARCHIVE_END = Ex"`\n"
4669Const IMAGE_ARCHIVE_PAD = Ex"\n"
4670Const IMAGE_ARCHIVE_LINKER_MEMBER = Ex"/ "
4671Const IMAGE_ARCHIVE_LONGNAMES_MEMBER = Ex"// "
4672
4673Type IMAGE_ARCHIVE_MEMBER_HEADER
4674 Name[ELM(16)] As Byte
4675 Date[ELM(12)] As Byte
4676 UserID[ELM(6)] As Byte
4677 GroupID[ELM(6)] As Byte
4678 Mode[ELM(8)] As Byte
4679 Size[ELM(10)] As Byte
4680 EndHeader[ELM(2)] As Byte
4681End Type
4682TypeDef PIMAGE_ARCHIVE_MEMBER_HEADER = *IMAGE_ARCHIVE_MEMBER_HEADER
4683
4684Const IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR = 60
4685
4686' DLL support.
4687
4688' Export Format
4689Type IMAGE_EXPORT_DIRECTORY
4690 Characteristics As DWord
4691 TimeDateStamp As DWord
4692 MajorVersion As DWord
4693 MinorVersion As DWord
4694 Name As Word
4695 Base As Word
4696 NumberOfFunctions As DWord
4697 NumberOfNames As DWord
4698 AddressOfFunctions As DWord
4699 AddressOfNames As DWord
4700 AddressOfNameOrdinals As DWord
4701End Type
4702TypeDef PIMAGE_EXPORT_DIRECTORY = *IMAGE_EXPORT_DIRECTORY
4703
4704' Import Format
4705Type IMAGE_IMPORT_BY_NAME
4706 Hint As Word
4707 Name[ELM(1)] As Byte
4708End Type
4709TypeDef PIMAGE_IMPORT_BY_NAME = *IMAGE_IMPORT_BY_NAME
4710
4711Type Align(8) IMAGE_THUNK_DATA64
4712' Union
4713 ForwarderString As QWord 'PBYTE
4714' Function_ As QWord 'PDWORD
4715' Ordinal As QWord
4716' AddressOfData As QWord 'PIMAGE_IMPORT_BY_NAME
4717' } u1
4718End Type
4719TypeDef PIMAGE_THUNK_DATA64 = *IMAGE_THUNK_DATA64
4720
4721Type IMAGE_THUNK_DATA32
4722' Union
4723 ForwarderString As DWORD 'PBYTE
4724' Function_ As DWORD 'PDWORD
4725' Ordinal As DWORD
4726' AddressOfData As DWORD 'PIMAGE_IMPORT_BY_NAME
4727' } u1
4728End Type
4729TypeDef PIMAGE_THUNK_DATA32 = *IMAGE_THUNK_DATA32
4730
4731Const IMAGE_ORDINAL_FLAG64 = &h8000000000000000
4732Const IMAGE_ORDINAL_FLAG32 = &h80000000
4733Const IMAGE_ORDINAL64(Ordinal) = (Ordinal And &hffff)
4734Const IMAGE_ORDINAL32(Ordinal) = (Ordinal And &hffff)
4735Const IMAGE_SNAP_BY_ORDINAL64(Ordinal) = ((Ordinal And IMAGE_ORDINAL_FLAG64) <> 0)
4736Const IMAGE_SNAP_BY_ORDINAL32(Ordinal) = ((Ordinal And IMAGE_ORDINAL_FLAG32) <> 0)
4737
4738' Thread Local Storage
4739TypeDef PIMAGE_TLS_CALLBACK = *Sub(DllHandle As PVOID, Reason As DWord, Reserved As PVOID)
4740
4741Type IMAGE_TLS_DIRECTORY64
4742 StartAddressOfRawData As QWord
4743 EndAddressOfRawData As QWord
4744 AddressOfIndex As QWord 'PDWORD
4745 AddressOfCallBacks As QWord 'PIMAGE_TLS_CALLBACK *
4746 SizeOfZeroFill As DWord
4747 Characteristics As DWord
4748End Type
4749TypeDef PIMAGE_TLS_DIRECTORY64 = *IMAGE_TLS_DIRECTORY64
4750
4751Type IMAGE_TLS_DIRECTORY32
4752 StartAddressOfRawData As DWord
4753 EndAddressOfRawData As DWord
4754 AddressOfIndex As DWord 'PDWORD
4755 AddressOfCallBacks As DWord 'PIMAGE_TLS_CALLBACK *
4756 SizeOfZeroFill As DWord
4757 Characteristics As DWord
4758End Type
4759TypeDef PIMAGE_TLS_DIRECTORY32 = *IMAGE_TLS_DIRECTORY32
4760
4761#ifdef _WIN64
4762Const IMAGE_ORDINAL_FLAG = IMAGE_ORDINAL_FLAG64
4763Const IMAGE_ORDINAL(Ordinal) = IMAGE_ORDINAL64(Ordinal)
4764TypeDef IMAGE_THUNK_DATA = IMAGE_THUNK_DATA64
4765TypeDef PIMAGE_THUNK_DATA = PIMAGE_THUNK_DATA64
4766Const IMAGE_SNAP_BY_ORDINAL(Ordinal) = IMAGE_SNAP_BY_ORDINAL64(Ordinal)
4767TypeDef IMAGE_TLS_DIRECTORY = IMAGE_TLS_DIRECTORY64
4768TypeDef PIMAGE_TLS_DIRECTORY = PIMAGE_TLS_DIRECTORY64
4769#else
4770Const IMAGE_ORDINAL_FLAG = IMAGE_ORDINAL_FLAG32
4771Const IMAGE_ORDINAL(Ordinal) = IMAGE_ORDINAL32(Ordinal)
4772TypeDef IMAGE_THUNK_DATA = IMAGE_THUNK_DATA32
4773TypeDef PIMAGE_THUNK_DATA = PIMAGE_THUNK_DATA32
4774Const IMAGE_SNAP_BY_ORDINAL(Ordinal) = IMAGE_SNAP_BY_ORDINAL32(Ordinal)
4775TypeDef IMAGE_TLS_DIRECTORY = IMAGE_TLS_DIRECTORY32
4776TypeDef PIMAGE_TLS_DIRECTORY = PIMAGE_TLS_DIRECTORY32
4777#endif
4778
4779Type IMAGE_IMPORT_DESCRIPTOR
4780' Union
4781 Characteristics As DWord
4782' OriginalFirstThunk As DWord
4783' End Union
4784 TimeDateStamp As DWord
4785 ForwarderChain As DWord
4786 Name As DWord
4787 FirstThunk As DWord
4788End Type
4789TypeDef PIMAGE_IMPORT_DESCRIPTOR = * /*UNALIGNED*/ IMAGE_IMPORT_DESCRIPTOR
4790
4791' New format import descriptors pointed to by DataDirectory[ IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT ]
4792Type IMAGE_BOUND_IMPORT_DESCRIPTOR
4793 TimeDateStamp As DWord
4794 OffsetModuleName As Word
4795 NumberOfModuleForwarderRefs As Word
4796End Type
4797TypeDef PIMAGE_BOUND_IMPORT_DESCRIPTOR = IMAGE_BOUND_IMPORT_DESCRIPTOR
4798
4799Type IMAGE_BOUND_FORWARDER_REF
4800 TimeDateStamp As DWord
4801 OffsetModuleName As Word
4802 Reserved As Word
4803End Type
4804TypeDef PIMAGE_BOUND_FORWARDER_REF = *IMAGE_BOUND_FORWARDER_REF
4805
4806' Resource Format.
4807Type IMAGE_RESOURCE_DIRECTORY
4808 Characteristics As DWord
4809 TimeDateStamp As DWord
4810 MajorVersion As Word
4811 MinorVersion As Word
4812 NumberOfNamedEntries As Word
4813 NumberOfIdEntries As Word
4814End Type
4815TypeDef PIMAGE_RESOURCE_DIRECTORY = *IMAGE_RESOURCE_DIRECTORY
4816
4817Const IMAGE_RESOURCE_NAME_IS_STRING = &h80000000
4818Const IMAGE_RESOURCE_DATA_IS_DIRECTORY = &h80000000
4819
4820Type IMAGE_RESOURCE_DIRECTORY_ENTRY
4821' Union
4822' Type
4823' NameOffset : 31 As DWord
4824' NameIsString : As DWord
4825' End Type
4826 Name As DWord
4827' Id As DWord
4828' End Union
4829' Union
4830 OffsetToData As DWord
4831' Type
4832' OffsetToDirectory : 31 As DWord
4833' DataIsDirectory : 1 As DWord
4834' End Type
4835' End Union
4836End Type
4837TypeDef PIMAGE_RESOURCE_DIRECTORY_ENTRY = *IMAGE_RESOURCE_DIRECTORY_ENTRY
4838
4839Type IMAGE_RESOURCE_DIRECTORY_STRING
4840 Length As Word
4841 NameString[ELM(1)] As CHAR
4842End Type
4843TypeDef PIMAGE_RESOURCE_DIRECTORY_STRING = *IMAGE_RESOURCE_DIRECTORY_STRING
4844
4845Type IMAGE_RESOURCE_DIR_STRING_U
4846 Length As Word
4847 NameString[ELM(1)] As WCHAR
4848End Type
4849TypeDef PIMAGE_RESOURCE_DIR_STRING_U = *IMAGE_RESOURCE_DIR_STRING_U
4850
4851Type IMAGE_RESOURCE_DATA_ENTRY
4852 OffsetToData As DWord
4853 Size As DWord
4854 CodePage As DWord
4855 Reserved As DWord
4856End Type
4857TypeDef PIMAGE_RESOURCE_DATA_ENTRY = *IMAGE_RESOURCE_DATA_ENTRY
4858
4859' Load Configuration Directory Entry
4860
4861Type IMAGE_LOAD_CONFIG_DIRECTORY32
4862 Size As DWord
4863 TimeDateStamp As DWord
4864 MajorVersion As Word
4865 MinorVersion As Word
4866 GlobalFlagsClear As DWord
4867 GlobalFlagsSet As DWord
4868 CriticalSectionDefaultTimeout As DWord
4869 DeCommitFreeBlockThreshold As DWord
4870 DeCommitTotalFreeThreshold As DWord
4871 LockPrefixTable As DWord
4872 MaximumAllocationSize As DWord
4873 VirtualMemoryThreshold As DWord
4874 ProcessHeapFlags As DWord
4875 ProcessAffinityMask As DWord
4876 CSDVersion As Word
4877 Reserved1 As Word
4878 EditList As DWord
4879 SecurityCookie As DWord
4880 SEHandlerTable As DWord
4881 SEHandlerCount As DWord
4882End Type
4883TypeDef PIMAGE_LOAD_CONFIG_DIRECTORY32 = *IMAGE_LOAD_CONFIG_DIRECTORY32
4884
4885Type IMAGE_LOAD_CONFIG_DIRECTORY64
4886 Size As DWord
4887 TimeDateStamp As DWord
4888 MajorVersion As Word
4889 MinorVersion As Word
4890 GlobalFlagsClear As DWord
4891 GlobalFlagsSet As DWord
4892 CriticalSectionDefaultTimeout As DWord
4893 DeCommitFreeBlockThreshold As QWord
4894 DeCommitTotalFreeThreshold As QWord
4895 LockPrefixTable As QWord
4896 MaximumAllocationSize As QWord
4897 VirtualMemoryThreshold As QWord
4898 ProcessAffinityMask As QWord
4899 ProcessHeapFlags As DWord
4900 CSDVersion As Word
4901 Reserved1 As Word
4902 EditList As QWord
4903 SecurityCookie As QWord
4904 SEHandlerTable As QWord
4905 SEHandlerCount As QWord
4906End Type
4907TypeDef PIMAGE_LOAD_CONFIG_DIRECTORY64 = *IMAGE_LOAD_CONFIG_DIRECTORY64
4908
4909#ifdef _WIN64
4910TypeDef IMAGE_LOAD_CONFIG_DIRECTORY = IMAGE_LOAD_CONFIG_DIRECTORY64
4911TypeDef PIMAGE_LOAD_CONFIG_DIRECTORY = PIMAGE_LOAD_CONFIG_DIRECTORY64
4912#else
4913TypeDef IMAGE_LOAD_CONFIG_DIRECTORY = IMAGE_LOAD_CONFIG_DIRECTORY32
4914TypeDef PIMAGE_LOAD_CONFIG_DIRECTORY = PIMAGE_LOAD_CONFIG_DIRECTORY32
4915#endif
4916
4917' WIN CE Exception table format
4918
4919' Function table entry format
4920
4921Type IMAGE_CE_RUNTIME_FUNCTION_ENTRY
4922 FuncStart As DWord
4923 dummy As DWord
4924' PrologLen : 8 As DWord
4925' FuncLen : 22 As DWord
4926' ThirtyTwoBit : 1 As DWord
4927' ExceptionFlag : 1 As DWord
4928End Type
4929TypeDef PIMAGE_CE_RUNTIME_FUNCTION_ENTRY = *IMAGE_CE_RUNTIME_FUNCTION_ENTRY
4930
4931Type IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY
4932 BeginAddress As QWord
4933 EndAddress As QWord
4934 ExceptionHandler As QWord
4935 HandlerData As QWord
4936 PrologEndAddress As QWord
4937End Type
4938TypeDef PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY = *IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY
4939
4940Type IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY
4941 BeginAddress As DWord
4942 EndAddress As DWord
4943 ExceptionHandler As DWord
4944 HandlerData As DWord
4945 PrologEndAddress As DWord
4946End Type
4947TypeDef PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY = *IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY
4948
4949Type _IMAGE_RUNTIME_FUNCTION_ENTRY
4950 BeginAddress As DWord
4951 EndAddress As DWord
4952 UnwindInfoAddress As DWord
4953End Type
4954TypeDef _PIMAGE_RUNTIME_FUNCTION_ENTRY = *_IMAGE_RUNTIME_FUNCTION_ENTRY
4955
4956TypeDef IMAGE_IA64_RUNTIME_FUNCTION_ENTRY = _IMAGE_RUNTIME_FUNCTION_ENTRY
4957TypeDef PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY = _PIMAGE_RUNTIME_FUNCTION_ENTRY
4958
4959TypeDef IMAGE_RUNTIME_FUNCTION_ENTRY = _IMAGE_RUNTIME_FUNCTION_ENTRY
4960TypeDef PIMAGE_RUNTIME_FUNCTION_ENTRY = _PIMAGE_RUNTIME_FUNCTION_ENTRY
4961
4962' Debug Format
4963Type IMAGE_DEBUG_DIRECTORY
4964 Characteristics As DWord
4965 TimeDateStamp As DWord
4966 MajorVersion As Word
4967 MinorVersion As Word
4968 Type_ As DWord
4969 SizeOfData As DWord
4970 AddressOfRawData As DWord
4971 PointerToRawData As DWord
4972End Type
4973TypeDef PIMAGE_DEBUG_DIRECTORY = *IMAGE_DEBUG_DIRECTORY
4974
4975Const IMAGE_DEBUG_TYPE_UNKNOWN = 0
4976Const IMAGE_DEBUG_TYPE_COFF = 1
4977Const IMAGE_DEBUG_TYPE_CODEVIEW = 2
4978Const IMAGE_DEBUG_TYPE_FPO = 3
4979Const IMAGE_DEBUG_TYPE_MISC = 4
4980Const IMAGE_DEBUG_TYPE_EXCEPTION = 5
4981Const IMAGE_DEBUG_TYPE_FIXUP = 6
4982Const IMAGE_DEBUG_TYPE_OMAP_TO_SRC = 7
4983Const IMAGE_DEBUG_TYPE_OMAP_FROM_SRC = 8
4984Const IMAGE_DEBUG_TYPE_BORLAND = 9
4985Const IMAGE_DEBUG_TYPE_RESERVED10 = 10
4986Const IMAGE_DEBUG_TYPE_CLSID = 11
4987
4988Type IMAGE_COFF_SYMBOLS_HEADER
4989 NumberOfSymbols As DWord
4990 LvaToFirstSymbol As DWord
4991 NumberOfLinenumbers As DWord
4992 LvaToFirstLinenumber As DWord
4993 RvaToFirstByteOfCode As DWord
4994 RvaToLastByteOfCode As DWord
4995 RvaToFirstByteOfData As DWord
4996 RvaToLastByteOfData As DWord
4997End Type
4998TypeDef PIMAGE_COFF_SYMBOLS_HEADER = *IMAGE_COFF_SYMBOLS_HEADER
4999
5000Const FRAME_FPO = 0
5001Const FRAME_TRAP = 1
5002Const FRAME_TSS = 2
5003Const FRAME_NONFPO = 3
5004
5005Type FPO_DATA
5006 ulOffStart As DWord
5007 cbProcSize As DWord
5008 cdwLocals As DWord
5009 cdwParams As Word
5010 dummy As Word
5011' cbProlog : 8 As Word
5012' cbRegs : 3 As Word
5013' fHasSEH : 1 As Word
5014' fUseBP : 1 As Word
5015' reserved : 1 As Word
5016' cbFrame : 2 As Word
5017End Type
5018TypeDef PFPO_DATA = *FPO_DATA
5019Const SIZEOF_RFPO_DATA = 16
5020
5021Const IMAGE_DEBUG_MISC_EXENAME = 1
5022
5023Type IMAGE_DEBUG_MISC
5024 DataType As DWord
5025 Length As DWord
5026 Unicode As BOOLEAN
5027 Reserved[ELM(3)] As Byte
5028 Data[ELM(1)] As Byte
5029End Type
5030TypeDef PIMAGE_DEBUG_MISC = *IMAGE_DEBUG_MISC
5031
5032Type IMAGE_FUNCTION_ENTRY
5033 StartingAddress As DWord
5034 EndingAddress As DWord
5035 EndOfPrologue As DWord
5036End Type
5037TypeDef PIMAGE_FUNCTION_ENTRY = *IMAGE_FUNCTION_ENTRY
5038
5039Type IMAGE_FUNCTION_ENTRY64
5040 StartingAddress As QWord
5041 EndingAddress As QWord
5042' Union
5043 EndOfPrologue As QWord
5044' UnwindInfoAddress As QWord
5045'End Union
5046End Type
5047TypeDef PIMAGE_FUNCTION_ENTRY64 = *IMAGE_FUNCTION_ENTRY64
5048
5049Type IMAGE_SEPARATE_DEBUG_HEADER
5050 Signature As Word
5051 Flags As Word
5052 Machine As Word
5053 Characteristics As Word
5054 TimeDateStamp As DWord
5055 CheckSum As DWord
5056 ImageBase As DWord
5057 SizeOfImage As DWord
5058 NumberOfSections As DWord
5059 ExportedNamesSize As DWord
5060 DebugDirectorySize As DWord
5061 SectionAlignment As DWord
5062 Reserved[ELM(2)] As DWord
5063End Type
5064TypeDef PIMAGE_SEPARATE_DEBUG_HEADER = *IMAGE_SEPARATE_DEBUG_HEADER
5065
5066Type NON_PAGED_DEBUG_INFO
5067 Signature As Word
5068 Flags As Word
5069 Size As DWord
5070 Machine As Word
5071 Characteristics As Word
5072 TimeDateStamp As DWord
5073 CheckSum As DWord
5074 SizeOfImage As DWord
5075 ImageBase As QWord
5076End Type
5077TypeDef PNON_PAGED_DEBUG_INFO = *NON_PAGED_DEBUG_INFO
5078
5079Const IMAGE_SEPARATE_DEBUG_SIGNATURE = &h4449 'DI
5080Const NON_PAGED_DEBUG_SIGNATURE = &h4E49 ' NI
5081
5082Const IMAGE_SEPARATE_DEBUG_FLAGS_MASK = &h8000
5083Const IMAGE_SEPARATE_DEBUG_MISMATCH = &h8000
5084
5085Type IMAGE_ARCHITECTURE_HEADER
5086 AmaskValue As Byte
5087' AmaskValue: 1 As DWord
5088' : 7 As Long
5089 AmaskShift As Byte
5090' AmaskShift: 8 As DWord
5091 dummy As Word
5092' : 16 As Long
5093 FirstEntryRVA As DWord
5094End Type
5095TypeDef PIMAGE_ARCHITECTURE_HEADER = *IMAGE_ARCHITECTURE_HEADER
5096
5097Type IMAGE_ARCHITECTURE_ENTRY
5098 FixupInstRVA As DWord
5099 NewInst As DWord
5100End Type
5101TypeDef PIMAGE_ARCHITECTURE_ENTRY = *IMAGE_ARCHITECTURE_ENTRY
5102
5103Const IMPORT_OBJECT_HDR_SIG2 = &hffff
5104
5105Type IMPORT_OBJECT_HEADER
5106 Sig1 As Word
5107 Sig2 As Word
5108 Version As Word
5109 Machine As Word
5110 TimeDateStamp As DWord
5111 SizeOfData As DWord
5112
5113' Union
5114 Ordinal As Word
5115' Hint As Word
5116' End Union
5117
5118 Reserved As Word
5119' Type : 2 As Word
5120' NameType : 3 As Word
5121' Reserved : 11 As Word
5122End Type
5123
5124Enum IMPORT_OBJECT_TYPE
5125 IMPORT_OBJECT_CODE = 0
5126 IMPORT_OBJECT_DATA = 1
5127 IMPORT_OBJECT_CONST = 2
5128End Enum
5129
5130Enum IMPORT_OBJECT_NAME_TYPE
5131 IMPORT_OBJECT_ORDINAL = 0
5132 IMPORT_OBJECT_NAME = 1
5133 IMPORT_OBJECT_NAME_NO_PREFIX = 2
5134 IMPORT_OBJECT_NAME_UNDECORATE = 3
5135End Enum
5136
5137#ifndef __IMAGE_COR20_HEADER_DEFINED__
5138#define __IMAGE_COR20_HEADER_DEFINED__
5139
5140Enum ReplacesCorHdrNumericDefines
5141' COM+ Header entry point flags.
5142 COMIMAGE_FLAGS_ILONLY = &h00000001
5143 COMIMAGE_FLAGS_32BITREQUIRED = &h00000002
5144 COMIMAGE_FLAGS_IL_LIBRARY = &h00000004
5145 COMIMAGE_FLAGS_STRONGNAMESIGNED = &h00000008
5146 COMIMAGE_FLAGS_TRACKDEBUGDATA = &h00010000
5147' Version flags for image.
5148 COR_VERSION_MAJOR_V2 = 2
5149 COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2
5150 COR_VERSION_MINOR = 0
5151 COR_DELETED_NAME_LENGTH = 8
5152 COR_VTABLEGAP_NAME_LENGTH = 8
5153' Maximum size of a NativeType descriptor.
5154 NATIVE_TYPE_MAX_CB = 1
5155 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE= &hFF
5156' Consts for the MIH FLAGS
5157 IMAGE_COR_MIH_METHODRVA = &h01
5158 IMAGE_COR_MIH_EHRVA = &h02
5159 IMAGE_COR_MIH_BASICBLOCK = &h08
5160' V-table constants
5161 COR_VTABLE_32BIT = &h01 ' V-table slots are 32-bits in size.
5162 COR_VTABLE_64BIT = &h02 ' V-table slots are 64-bits in size.
5163 COR_VTABLE_FROM_UNMANAGED = &h04 ' If set, transition from unmanaged.
5164 COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN = &h08 ' If set, transition from unmanaged with keeping the current appdomain.
5165 COR_VTABLE_CALL_MOST_DERIVED = &h10 ' Call most derived method described by
5166' EATJ constants
5167 IMAGE_COR_EATJ_THUNK_SIZE = 32 ' Size of a jump thunk reserved range.
5168' Max name lengths
5169 '@todo: Change to unlimited name lengths.
5170 MAX_CLASS_NAME = 1024
5171 MAX_PACKAGE_NAME = 1024
5172End Enum
5173
5174' CLR 2.0 header structure.
5175Type IMAGE_COR20_HEADER
5176 ' Header versioning
5177 cb As DWord
5178 MajorRuntimeVersion As Word
5179 MinorRuntimeVersion As Word
5180 ' Symbol table and startup information
5181 MetaData As IMAGE_DATA_DIRECTORY
5182 Flags As DWord
5183 EntryPointToken As DWord
5184 ' Binding information
5185 Resources As IMAGE_DATA_DIRECTORY
5186 StrongNameSignature As IMAGE_DATA_DIRECTORY
5187 ' Regular fixup and binding information
5188 CodeManagerTable As IMAGE_DATA_DIRECTORY
5189 VTableFixups As IMAGE_DATA_DIRECTORY
5190 ExportAddressTableJumps As IMAGE_DATA_DIRECTORY
5191 ' Precompiled image info (internal use only - set to zero)
5192 ManagedNativeHeader As IMAGE_DATA_DIRECTORY
5193End Type
5194TypeDef PIMAGE_COR20_HEADER = *IMAGE_COR20_HEADER
5195
5196#endif
5197
5198' for move macros
5199'#include <string.h>
5200
5201#ifndef _SLIST_HEADER_
5202#define _SLIST_HEADER_
5203
5204#ifdef _WIN64
5205Type Align(16) SLIST_ENTRY
5206 Next_ As *SLIST_ENTRY
5207End Type
5208TypeDef PSLIST_ENTRY = *SLIST_ENTRY
5209#else
5210TypeDef SLIST_ENTRY = SINGLE_LIST_ENTRY
5211'TypeDef _SLIST_ENTRY = _SINGLE_LIST_ENTRY
5212TypeDef PSLIST_ENTRY = PSINGLE_LIST_ENTRY
5213#endif
5214
5215#ifdef _WIN64
5216
5217Type /*Union*/ Align(16) SLIST_HEADER
5218' Type ' original struct
5219 Alignment As QWord
5220 Region As QWord
5221' End Type
5222' Type ' 8-byte header
5223' Depth:16 As QWord
5224' Sequence:9 As QWord
5225' NextEntry:39 As QWord
5226' HeaderType:1 As QWord ' 0: 8-byte As QWord 1: 16-byte
5227' Init:1 As QWord ' 0: uninitialized As QWord 1: initialized
5228' Reserved:59 As QWord
5229' Region:3 As QWord
5230' } Header8
5231' Type ' 16-byte header
5232' Depth:16 As QWord
5233' Sequence:48 As QWord
5234' HeaderType:1 As QWord ' 0: 8-byte As QWord 1: 16-byte
5235' Init:1 As QWord ' 0: uninitialized As QWord 1: initialized
5236' Reserved:2 As QWord
5237' NextEntry:60 As QWord ' last 4 bits are always 0's
5238' } Header16
5239End Type 'Union
5240TypeDef PSLIST_HEADER = *SLIST_HEADER
5241
5242#else
5243
5244Type /*Union*/ SLIST_HEADER
5245' Alignment As QWord
5246' Type
5247 Next_ As SLIST_ENTRY
5248 Depth As Word
5249 Sequence As Word
5250' End Type
5251End Type 'Union
5252TypeDef PSLIST_HEADER = *SLIST_HEADER
5253
5254#endif
5255
5256#endif
5257
5258Declare Sub RtlInitializeSListHead Lib "kernel32" (/*IN*/ ByRef ListHead As SLIST_HEADER)
5259Declare Function RtlFirstEntrySList Lib "kernel32" (/*IN*/ ByRef ListHead As /*Const*/ SLIST_HEADER) As PSLIST_ENTRY
5260Declare Function RtlInterlockedPopEntrySList Lib "kernel32" (/*IN*/ ByRef ListHead As SLIST_HEADER) As PSLIST_ENTRY
5261Declare Function RtlInterlockedPushEntrySList Lib "kernel32" (/*IN*/ ByRef ListHead As SLIST_HEADER, /*IN*/ ListEntry As PSLIST_ENTRY) As PSLIST_ENTRY
5262Declare Function RtlInterlockedFlushSList Lib "kernel32" (/*IN*/ ByRef ListHead As SLIST_HEADER) As PSLIST_ENTRY
5263Declare Function RtlQueryDepthSList Lib "kernel32" (/*IN*/ ByRef ListHead As SLIST_HEADER) As Word
5264
5265#ifndef _RTL_RUN_ONCE_DEF
5266#define _RTL_RUN_ONCE_DEF
5267
5268'Const RTL_RUN_ONCE_INIT {0} 'Static initializer
5269
5270Const RTL_RUN_ONCE_CHECK_ONLY = &h00000001
5271Const RTL_RUN_ONCE_ASYNC = &h00000002
5272Const RTL_RUN_ONCE_INIT_FAILED = &h00000004
5273
5274Const RTL_RUN_ONCE_CTX_RESERVED_BITS = 2
5275
5276Type /*Union*/ RTL_RUN_ONCE
5277 Ptr As VoidPtr
5278End Type 'Union
5279TypeDef PRTL_RUN_ONCE = *RTL_RUN_ONCE
5280
5281TypeDef PRTL_RUN_ONCE_INIT_FN = *Function(ByRef RunOnce As RTL_RUN_ONCE, Parameter As VoidPtr, ByRef Context As VoidPtr) As DWord'LOGICAL
5282#endif
5283
5284Declare Sub RtlRunOnceInitialize Lib "kernel32" (ByRef RunOnce As RTL_RUN_ONCE)
5285Declare Function RtlRunOnceExecuteOnce Lib "kernel32" (ByRef RunOnce As RTL_RUN_ONCE, InitFn As PRTL_RUN_ONCE_INIT_FN, Parameter As PVOID, ByRef Context As PVOID) As DWord
5286Declare Function RtlRunOnceBeginInitialize Lib "kernel32" (ByRef RunOnce As RTL_RUN_ONCE, Flags As DWord, ByRef Context As PVOID) As DWord
5287Declare Function RtlRunOnceComplete Lib "kernel32" (ByRef RunOnce As RTL_RUN_ONCE, Flags As DWord, Context As PVOID) As DWord
5288
5289Const HEAP_NO_SERIALIZE = &h00000001
5290Const HEAP_GROWABLE = &h00000002
5291Const HEAP_GENERATE_EXCEPTIONS = &h00000004
5292Const HEAP_ZERO_MEMORY = &h00000008
5293Const HEAP_REALLOC_IN_PLACE_ONLY = &h00000010
5294Const HEAP_TAIL_CHECKING_ENABLED = &h00000020
5295Const HEAP_FREE_CHECKING_ENABLED = &h00000040
5296Const HEAP_DISABLE_COALESCE_ON_FREE = &h00000080
5297Const HEAP_CREATE_ALIGN_16 = &h00010000
5298Const HEAP_CREATE_ENABLE_TRACING = &h00020000
5299Const HEAP_CREATE_ENABLE_EXECUTE = &h00040000
5300Const HEAP_MAXIMUM_TAG = &h0FFF
5301Const HEAP_PSEUDO_TAG_FLAG = &h8000
5302Const HEAP_TAG_SHIFT = 18
5303
5304Const HEAP_MAKE_TAG_FLAGS (TagBase /*As DWord*/, Tag /*As DWord*/) /*As DWord*/ = (((TagBase) + ((Tag) << HEAP_TAG_SHIFT)) As DWord)
5305
5306'#if (NTDDI_VERSION > NTDDI_WINXP)
5307'Declare Function RtlCaptureStackBackTrace Lib "kernel32" (FramesToSkip As DWord, FramesToCapture A sDWord, ByRef BackTrace As PVOID, BackTraceHash As *DWord) As Word
5308'#endif
5309
5310'#if (NTDDI_VERSION > NTDDI_WIN2K)
5311'Declare Sub RtlCaptureContext Lib "kernel32" (ByRef ContextRecord As CONTEXT)
5312'#endif
5313
5314Const IS_TEXT_UNICODE_ASCII16 = &h0001
5315Const IS_TEXT_UNICODE_REVERSE_ASCII16 = &h0010
5316
5317Const IS_TEXT_UNICODE_STATISTICS = &h0002
5318Const IS_TEXT_UNICODE_REVERSE_STATISTICS = &h0020
5319
5320Const IS_TEXT_UNICODE_CONTROLS = &h0004
5321Const IS_TEXT_UNICODE_REVERSE_CONTROLS = &h0040
5322
5323Const IS_TEXT_UNICODE_SIGNATURE = &h0008
5324Const IS_TEXT_UNICODE_REVERSE_SIGNATURE = &h0080
5325
5326Const IS_TEXT_UNICODE_ILLEGAL_CHARS = &h0100
5327Const IS_TEXT_UNICODE_ODD_LENGTH = &h0200
5328Const IS_TEXT_UNICODE_DBCS_LEADBYTE = &h0400
5329Const IS_TEXT_UNICODE_NULL_BYTES = &h1000
5330
5331Const IS_TEXT_UNICODE_UNICODE_MASK = &h000F
5332Const IS_TEXT_UNICODE_REVERSE_MASK = &h00F0
5333Const IS_TEXT_UNICODE_NOT_UNICODE_MASK = &h0F00
5334Const IS_TEXT_UNICODE_NOT_ASCII_MASK = &hF000
5335
5336Const COMPRESSION_FORMAT_NONE = &h0000
5337Const COMPRESSION_FORMAT_DEFAULT = &h0001
5338Const COMPRESSION_FORMAT_LZNT1 = &h0002
5339Const COMPRESSION_ENGINE_STANDARD = &h0000
5340Const COMPRESSION_ENGINE_MAXIMUM = &h0100
5341Const COMPRESSION_ENGINE_HIBER = &h0200
5342
5343'#if _DBG_MEMCPY_INLINE_ && !defined(MIDL_PASS) && !defined(_MEMCPY_INLINE_) && !defined(_CRTBLD)
5344'#define _MEMCPY_INLINE_
5345/*
5346FORCEINLINE
5347PVOID
5348__cdecl
5349memcpy_inline (
5350 void *dst,
5351 const void *src,
5352 size_t size
5353 )
5354{
5355 if (((char *)dst > (char *)src) &&
5356 ((char *)dst < ((char *)src + size))) {
5357 __debugbreak();
5358 }
5359 return memcpy(dst, src, size);
5360}
5361Const memcpy memcpy_inline
5362*/
5363'#endif
5364
5365'#if (NTDDI_VERSION >= NTDDI_WIN2K)
5366'Declare Function RtlCompareMemory Lib "kernel32" (Source1 As VoidPtr, Source2 As VoidPtr, Length As SIZE_T) As SIZE_T
5367'#endif
5368/*
5369Const RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length)))
5370Const RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
5371Const RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length))
5372Const RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
5373Const RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
5374*/
5375Function RtlSecureZeroMemory(ptr As VoidPtr, cnt As SIZE_T) As VoidPtr
5376 Dim vptr = ptr As * /*Volatile*/ Byte
5377#ifdef _WIN64
5378 __stosb(vptr, 0, cnt)
5379#else
5380
5381 While (cnt > 0)
5382 vptr = 0
5383 vptr++
5384 cnt--
5385 Wend
5386#endif
5387 RtlSecureZeroMemory = ptr
5388End Function
5389
5390Const SEF_DACL_AUTO_INHERIT = &h01
5391Const SEF_SACL_AUTO_INHERIT = &h02
5392Const SEF_DEFAULT_DESCRIPTOR_FOR_OBJECT = &h04
5393Const SEF_AVOID_PRIVILEGE_CHECK = &h08
5394Const SEF_AVOID_OWNER_CHECK = &h10
5395Const SEF_DEFAULT_OWNER_FROM_PARENT = &h20
5396Const SEF_DEFAULT_GROUP_FROM_PARENT = &h40
5397Const SEF_MACL_NO_WRITE_UP = &h100
5398Const SEF_MACL_NO_READ_UP = &h200
5399Const SEF_MACL_NO_EXECUTE_UP = &h400
5400Const SEF_AVOID_OWNER_RESTRICTION = &h1000
5401
5402Const SEF_MACL_VALID_FLAGS = (SEF_MACL_NO_WRITE_UP OR SEF_MACL_NO_READ_UP Or SEF_MACL_NO_EXECUTE_UP)
5403
5404Type MESSAGE_RESOURCE_ENTRY
5405 Length As Word
5406 Flags As Word
5407 Text[ELM(1)] As Byte
5408End Type
5409TypeDef PMESSAGE_RESOURCE_ENTRY = *MESSAGE_RESOURCE_ENTRY
5410
5411Const MESSAGE_RESOURCE_UNICODE = &h0001
5412
5413Type MESSAGE_RESOURCE_BLOCK
5414 LowId As DWord
5415 HighId As DWord
5416 OffsetToEntries As DWord
5417End Type
5418TypeDef PMESSAGE_RESOURCE_BLOCK = *MESSAGE_RESOURCE_BLOCK
5419
5420Type MESSAGE_RESOURCE_DATA
5421 NumberOfBlocks As DWord
5422 Blocks[ELM(1)] As MESSAGE_RESOURCE_BLOCK
5423End Type
5424TypeDef PMESSAGE_RESOURCE_DATA = *MESSAGE_RESOURCE_DATA
5425
5426Type OSVERSIONINFOA
5427 dwOSVersionInfoSize As DWord
5428 dwMajorVersion As DWord
5429 dwMinorVersion As DWord
5430 dwBuildNumber As DWord
5431 dwPlatformId As DWord
5432 szCSDVersion[ELM(128)] As CHAR
5433End Type
5434TypeDef POSVERSIONINFOA = *OSVERSIONINFOA
5435TypeDef LPOSVERSIONINFOA = *OSVERSIONINFOA
5436Type OSVERSIONINFOW
5437 dwOSVersionInfoSize As DWord
5438 dwMajorVersion As DWord
5439 dwMinorVersion As DWord
5440 dwBuildNumber As DWord
5441 dwPlatformId As DWord
5442 szCSDVersion[ELM(128)] As WCHAR
5443End Type
5444TypeDef POSVERSIONINFOW = *OSVERSIONINFOW
5445TypeDef LPOSVERSIONINFOW = *OSVERSIONINFOW
5446TypeDef RTL_OSVERSIONINFOW = OSVERSIONINFOW
5447TypeDef PRTL_OSVERSIONINFOW = *OSVERSIONINFOW
5448#ifdef UNICODE
5449TypeDef OSVERSIONINFO = OSVERSIONINFOW
5450TypeDef POSVERSIONINFO = POSVERSIONINFOW
5451TypeDef LPOSVERSIONINFO = LPOSVERSIONINFOW
5452#else
5453TypeDef OSVERSIONINFO = OSVERSIONINFOA
5454TypeDef POSVERSIONINFO = POSVERSIONINFOA
5455TypeDef LPOSVERSIONINFO = LPOSVERSIONINFOA
5456#endif
5457Type OSVERSIONINFOEXA
5458 dwOSVersionInfoSize As DWord
5459 dwMajorVersion As DWord
5460 dwMinorVersion As DWord
5461 dwBuildNumber As DWord
5462 dwPlatformId As DWord
5463 szCSDVersion[ELM(128)] As CHAR
5464 wServicePackMajor As Word
5465 wServicePackMinor As Word
5466 wSuiteMask As Word
5467 wProductType As Byte
5468 wReserved As Byte
5469End Type
5470TypeDef POSVERSIONINFOEXA = *OSVERSIONINFOEXA
5471TypeDef LPOSVERSIONINFOEXA = *OSVERSIONINFOEXA
5472Type OSVERSIONINFOEXW
5473 dwOSVersionInfoSize As DWord
5474 dwMajorVersion As DWord
5475 dwMinorVersion As DWord
5476 dwBuildNumber As DWord
5477 dwPlatformId As DWord
5478 szCSDVersion[ELM(128)] As WCHAR
5479 wServicePackMajor As Word
5480 wServicePackMinor As Word
5481 wSuiteMask As Word
5482 wProductType As Byte
5483 wReserved As Byte
5484End Type
5485TypeDef POSVERSIONINFOEXW = *OSVERSIONINFOEXW
5486TypeDef LPOSVERSIONINFOEXW = *OSVERSIONINFOEXW
5487TypeDef RTL_OSVERSIONINFOEXW = OSVERSIONINFOEXW
5488TypeDef PRTL_OSVERSIONINFOEXW = *OSVERSIONINFOEXW
5489#ifdef UNICODE
5490TypeDef OSVERSIONINFOEX = OSVERSIONINFOEXW
5491TypeDef POSVERSIONINFOEX = POSVERSIONINFOEXW
5492TypeDef LPOSVERSIONINFOEX = LPOSVERSIONINFOEXW
5493#else
5494TypeDef OSVERSIONINFOEX = OSVERSIONINFOEXA
5495TypeDef POSVERSIONINFOEX = POSVERSIONINFOEXA
5496TypeDef LPOSVERSIONINFOEX = LPOSVERSIONINFOEXA
5497#endif
5498
5499' RtlVerifyVersionInfo() conditions
5500Const VER_EQUAL = 1
5501Const VER_GREATER = 2
5502Const VER_GREATER_EQUAL = 3
5503Const VER_LESS = 4
5504Const VER_LESS_EQUAL = 5
5505Const VER_AND = 6
5506Const VER_OR = 7
5507
5508Const VER_CONDITION_MASK = 7
5509Const VER_NUM_BITS_PER_CONDITION_MASK = 3
5510
5511' RtlVerifyVersionInfo() type mask bits
5512Const VER_MINORVERSION = 0000001
5513Const VER_MAJORVERSION = 0000002
5514Const VER_BUILDNUMBER = 0000004
5515Const VER_PLATFORMID = 0000008
5516Const VER_SERVICEPACKMINOR = 0000010
5517Const VER_SERVICEPACKMAJOR = 0000020
5518Const VER_SUITENAME = 0000040
5519Const VER_PRODUCT_TYPE = 0000080
5520
5521' RtlVerifyVersionInfo() os product type values
5522Const VER_NT_WORKSTATION = 0000001
5523Const VER_NT_DOMAIN_CONTROLLER = 0000002
5524Const VER_NT_SERVER = 0000003
5525
5526' dwPlatformId defines:
5527Const VER_PLATFORM_WIN32s = 0
5528Const VER_PLATFORM_WIN32_WINDOWS = 1
5529Const VER_PLATFORM_WIN32_NT = 2
5530Const VER_PLATFORM_WIN32_CE = 3
5531
5532' VerifyVersionInfo() macro to set the condition mask
5533' VER_SET_CONDITION
5534
5535'#if (NTDDI_VERSION >= NTDDI_WIN2K)
5536'Declare Function VerSetConditionMask Lib "kernel32" (ConditionMask As QWord, TypeMask As DWord, Condition As Byte) As QWord
5537'#endif
5538
5539'#if (NTDDI_VERSION >= NTDDI_LONGHORN)
5540'Declare Function RtlGetProductInfo Lib "kernel32" (OSMajorVersion As DWord, OSMinorVersion As DWord, SpMajorVersion As DWord, SpMinorVersion As DWord, ByRef ReturnedProductType As DWord) As BOOLEAN
5541'#endif
5542
5543Type RTL_CRITICAL_SECTION_DEBUG
5544 Type_ As Word
5545 CreatorBackTraceIndex As Word
5546 CriticalSection As VoidPtr '!*RTL_CRITICAL_SECTION
5547 ProcessLocksList As LIST_ENTRY
5548 EntryCount As DWord
5549 ContentionCount As DWord
5550 Flags As DWord
5551 CreatorBackTraceIndexHigh As Word
5552 SpareWORD As Word
5553End Type
5554TypeDef PRTL_CRITICAL_SECTION_DEBUG = *RTL_CRITICAL_SECTION_DEBUG
5555TypeDef RTL_RESOURCE_DEBUG = RTL_CRITICAL_SECTION_DEBUG
5556TypeDef PRTL_RESOURCE_DEBUG = *RTL_RESOURCE_DEBUG
5557
5558Const RTL_CRITSECT_TYPE = 0
5559Const RTL_RESOURCE_TYPE = 1
5560
5561Const RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO = &h01000000
5562Const RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN = &h02000000
5563Const RTL_CRITICAL_SECTION_FLAG_STATIC_INIT = &h04000000
5564Const RTL_CRITICAL_SECTION_ALL_FLAG_BITS = &hFF000000
5565Const RTL_CRITICAL_SECTION_FLAG_RESERVED = (RTL_CRITICAL_SECTION_ALL_FLAG_BITS And (Not (RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO Or RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN Or RTL_CRITICAL_SECTION_FLAG_STATIC_INIT)))
5566
5567Const RTL_CRITICAL_SECTION_DEBUG_FLAG_STATIC_INIT = &h00000001
5568
5569Type Align(8) RTL_CRITICAL_SECTION
5570 DebugInfo As PRTL_CRITICAL_SECTION_DEBUG
5571 LockCount As Long
5572 RecursionCount As Long
5573 OwningThread As HANDLE
5574 LockSemaphore As HANDLE
5575 SpinCount As ULONG_PTR
5576End Type
5577TypeDef PRTL_CRITICAL_SECTION = *RTL_CRITICAL_SECTION
5578
5579Type RTL_SRWLOCK
5580 Ptr As VoidPtr
5581End Type
5582TypeDef PRTL_SRWLOCK = *RTL_SRWLOCK
5583'Const RTL_SRWLOCK_INIT {0}
5584Type RTL_CONDITION_VARIABLE
5585 Ptr As VoidPtr
5586End Type
5587TypeDef PRTL_CONDITION_VARIABLE = *RTL_CONDITION_VARIABLE
5588'Const RTL_CONDITION_VARIABLE_INIT {0}
5589Const RTL_CONDITION_VARIABLE_LOCKMODE_SHARED = &h1
5590TypeDef PVECTORED_EXCEPTION_HANDLER = *Function(ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
5591
5592Enum HEAP_INFORMATION_CLASS
5593 HeapCompatibilityInformation
5594 HeapEnableTerminationOnCorruption
5595End Enum
5596
5597Const WT_EXECUTEDEFAULT = &h00000000
5598Const WT_EXECUTEINIOTHREAD = &h00000001
5599Const WT_EXECUTEINUITHREAD = &h00000002
5600Const WT_EXECUTEINWAITTHREAD = &h00000004
5601Const WT_EXECUTEONLYONCE = &h00000008
5602Const WT_EXECUTEINTIMERTHREAD = &h00000020
5603Const WT_EXECUTELONGFUNCTION = &h00000010
5604Const WT_EXECUTEINPERSISTENTIOTHREAD = &h00000040
5605Const WT_EXECUTEINPERSISTENTTHREAD = &h00000080
5606Const WT_TRANSFER_IMPERSONATION = &h00000100
5607'Const WT_SET_MAX_THREADPOOL_THREADS(Flags, Limit) ((Flags) Or= (Limit)<<16)
5608TypeDef WAITORTIMERCALLBACKFUNC = *Sub(p As VoidPtr, b As Boolean)
5609TypeDef WORKERCALLBACKFUNC = *Sub(p As VoidPtr)
5610TypeDef APC_CALLBACK_FUNCTION = *Sub(dw AS DWord, p1 As VoidPtr, p2 As VoidPtr)
5611TypeDef PFLS_CALLBACK_FUNCTION = *Sub(lpFlsData As VoidPtr)
5612Const WT_EXECUTEINLONGTHREAD = &h00000010
5613Const WT_EXECUTEDELETEWAIT = &h00000008
5614
5615Enum ACTIVATION_CONTEXT_INFO_CLASS
5616 ActivationContextBasicInformation = 1
5617 ActivationContextDetailedInformation = 2
5618 AssemblyDetailedInformationInActivationContext = 3
5619 FileInformationInAssemblyOfAssemblyInActivationContext = 4
5620 RunlevelInformationInActivationContext = 5
5621 MaxActivationContextInfoClass
5622 ' compatibility with old names
5623 AssemblyDetailedInformationInActivationContxt = 3
5624 FileInformationInAssemblyOfAssemblyInActivationContxt = 4
5625End Enum
5626
5627TypeDef ACTIVATIONCONTEXTINFOCLASS = ACTIVATION_CONTEXT_INFO_CLASS
5628
5629Type ACTIVATION_CONTEXT_QUERY_INDEX
5630 ulAssemblyIndex As DWord
5631 ulFileIndexInAssembly; As DWord
5632End Type
5633TypeDef PACTIVATION_CONTEXT_QUERY_INDEX = *ACTIVATION_CONTEXT_QUERY_INDEX
5634
5635TypeDef PCACTIVATION_CONTEXT_QUERY_INDEX = * /*Const*/ ACTIVATION_CONTEXT_QUERY_INDEX
5636
5637Const ACTIVATION_CONTEXT_PATH_TYPE_NONE = 1
5638Const ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE = 2
5639Const ACTIVATION_CONTEXT_PATH_TYPE_URL = 3
5640Const ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF = 4
5641
5642Type ASSEMBLY_FILE_DETAILED_INFORMATION
5643 ulFlags As DWord
5644 ulFilenameLength As PCWSTR
5645 ulPathLength As PCWSTR
5646 lpFileName As PCWSTR
5647 lpFilePath As PCWSTR
5648End Type
5649TypeDef PASSEMBLY_FILE_DETAILED_INFORMATION = *ASSEMBLY_FILE_DETAILED_INFORMATION
5650TypeDef PCASSEMBLY_FILE_DETAILED_INFORMATION = * /*Const*/ ASSEMBLY_FILE_DETAILED_INFORMATION
5651
5652' compatibility with old names
5653TypeDef _ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION = ASSEMBLY_FILE_DETAILED_INFORMATION
5654TypeDef ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION = ASSEMBLY_FILE_DETAILED_INFORMATION
5655TypeDef PASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION = PASSEMBLY_FILE_DETAILED_INFORMATION
5656TypeDef PCASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION = PCASSEMBLY_FILE_DETAILED_INFORMATION
5657
5658Type ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
5659 ulFlags As DWord
5660 ulEncodedAssemblyIdentityLength As DWord
5661 ulManifestPathType As DWord
5662 liManifestLastWriteTime As LARGE_INTEGER
5663 ulPolicyPathType As DWord
5664 ulPolicyPathLength As DWord
5665 liPolicyLastWriteTime As LARGE_INTEGER
5666 ulMetadataSatelliteRosterIndex As DWord
5667 ulManifestVersionMajor As DWord
5668 ulManifestVersionMinor As DWord
5669 ulPolicyVersionMajor As DWord
5670 ulPolicyVersionMinor As DWord
5671 ulAssemblyDirectoryNameLength As DWord
5672 lpAssemblyEncodedAssemblyIdentity As PCWSTR
5673 lpAssemblyManifestPath As PCWSTR
5674 lpAssemblyPolicyPath As PCWSTR
5675 lpAssemblyDirectoryName As PCWSTR
5676 ulFileCount As DWord
5677End Type
5678TypeDef PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION = *ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
5679TypeDef PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION = * /*Const*/ ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
5680
5681Enum ACTCTX_REQUESTED_RUN_LEVEL
5682 ACTCTX_RUN_LEVEL_UNSPECIFIED = 0
5683 ACTCTX_RUN_LEVEL_AS_INVOKER
5684 ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE
5685 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN
5686 ACTCTX_RUN_LEVEL_NUMBERS
5687End Enum
5688
5689Type ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
5690 ulFlags As DWord
5691 RunLevel As ACTCTX_REQUESTED_RUN_LEVEL
5692 UiAccess As DWord
5693End Type
5694TypeDef PACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION = ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
5695TypeDef PCACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION = * /*Const*/ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
5696
5697Type ACTIVATION_CONTEXT_DETAILED_INFORMATION
5698 dwFlags As DWord
5699 ulFormatVersion As DWord
5700 ulAssemblyCount As DWord
5701 ulRootManifestPathType As DWord
5702 ulRootManifestPathChars As DWord
5703 ulRootConfigurationPathType As DWord
5704 ulRootConfigurationPathChars As DWord
5705 ulAppDirPathType As DWord
5706 ulAppDirPathChars As DWord
5707 lpRootManifestPath As PCWSTR
5708 lpRootConfigurationPath As PCWSTR
5709 lpAppDirPath As PCWSTR
5710End Type
5711TypeDef PACTIVATION_CONTEXT_DETAILED_INFORMATION = *ACTIVATION_CONTEXT_DETAILED_INFORMATION
5712TypeDef PCACTIVATION_CONTEXT_DETAILED_INFORMATION = * /*Const*/ ACTIVATION_CONTEXT_DETAILED_INFORMATION
5713
5714Const DLL_PROCESS_ATTACH = 1
5715Const DLL_THREAD_ATTACH = 2
5716Const DLL_THREAD_DETACH = 3
5717Const DLL_PROCESS_DETACH = 0
5718
5719Const EVENTLOG_SEQUENTIAL_READ = &h0001
5720Const EVENTLOG_SEEK_READ = &h0002
5721Const EVENTLOG_FORWARDS_READ = &h0004
5722Const EVENTLOG_BACKWARDS_READ = &h0008
5723
5724Const EVENTLOG_SUCCESS = &h0000
5725Const EVENTLOG_ERROR_TYPE = &h0001
5726Const EVENTLOG_WARNING_TYPE = &h0002
5727Const EVENTLOG_INFORMATION_TYPE = &h0004
5728Const EVENTLOG_AUDIT_SUCCESS = &h0008
5729Const EVENTLOG_AUDIT_FAILURE = &h0010
5730
5731Const EVENTLOG_START_PAIRED_EVENT = &h0001
5732Const EVENTLOG_END_PAIRED_EVENT = &h0002
5733Const EVENTLOG_END_ALL_PAIRED_EVENTS = &h0004
5734Const EVENTLOG_PAIRED_EVENT_ACTIVE = &h0008
5735Const EVENTLOG_PAIRED_EVENT_INACTIVE = &h0010
5736
5737Type EVENTLOGRECORD
5738 Length As DWord
5739 Reserved As DWord
5740 RecordNumber As DWord
5741 TimeGenerated As DWord
5742 TimeWritten As DWord
5743 EventID As DWord
5744 EventType As Word
5745 NumStrings As Word
5746 EventCategory As Word
5747 ReservedFlags As Word
5748 ClosingRecordNumber As DWord
5749 StringOffset As DWord
5750 UserSidLength As DWord
5751 UserSidOffset As DWord
5752 DataLength As DWord
5753 DataOffset As DWord
5754 ' Then follow:
5755 ' WCHAR SourceName[]
5756 ' WCHAR Computername[]
5757 ' SID UserSid
5758 ' WCHAR Strings[]
5759 ' BYTE Data[]
5760 ' CHAR Pad[]
5761 ' DWORD Length;
5762End Type
5763TypeDef PEVENTLOGRECORD = *EVENTLOGRECORD
5764
5765Const MAXLOGICALLOGNAMESIZE = 256
5766
5767Type EVENTSFORLOGFILE
5768 ulSize As DWord
5769 szLogicalLogFile[ELM(MAXLOGICALLOGNAMESIZE)] As WCHAR
5770 ulNumRecords As DWord
5771 pEventLogRecords[ELM(ANYSIZE_ARRAY)] As EVENTLOGRECORD 'pEventLogRecords[] As EVENTLOGRECORD
5772End Type
5773TypeDef PEVENTSFORLOGFILE = *EVENTSFORLOGFILE
5774
5775Type PACKEDEVENTINFO
5776 ulSize As DWord
5777 ulNumEventsForLogFile As DWord
5778 ulOffsets[ELM(ANYSIZE_ARRAY)] As DWord 'ulOffsets[] As DWord
5779End Type
5780TypeDef PPACKEDEVENTINFO = *PACKEDEVENTINFO
5781
5782Const KEY_QUERY_VALUE = &h0001
5783Const KEY_SET_VALUE = &h0002
5784Const KEY_CREATE_SUB_KEY = &h0004
5785Const KEY_ENUMERATE_SUB_KEYS = &h0008
5786Const KEY_NOTIFY = &h0010
5787Const KEY_CREATE_LINK = &h0020
5788Const KEY_WOW64_32KEY = &h0200
5789Const KEY_WOW64_64KEY = &h0100
5790Const KEY_WOW64_RES = &h0300
5791Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
5792Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
5793Const KEY_EXECUTE = ((KEY_READ) And (Not SYNCHRONIZE))
5794Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))
5795Const REG_OPTION_RESERVED = &h00000000
5796Const REG_OPTION_NON_VOLATILE = &h00000000
5797Const REG_OPTION_VOLATILE = &h00000001
5798Const REG_OPTION_CREATE_LINK = &h00000002
5799Const REG_OPTION_BACKUP_RESTORE = &h00000004
5800Const REG_OPTION_OPEN_LINK = &h00000008
5801Const REG_LEGAL_OPTION = (REG_OPTION_RESERVED Or REG_OPTION_NON_VOLATILE Or REG_OPTION_VOLATILE Or REG_OPTION_CREATE_LINK Or REG_OPTION_BACKUP_RESTORE Or REG_OPTION_OPEN_LINK)
5802Const REG_CREATED_NEW_KEY = &h00000001
5803Const REG_OPENED_EXISTING_KEY = &h00000002
5804
5805Const REG_STANDARD_FORMAT = 1
5806Const REG_LATEST_FORMAT = 2
5807Const REG_NO_COMPRESSION = 4
5808
5809Const REG_WHOLE_HIVE_VOLATILE = &h00000001
5810Const REG_REFRESH_HIVE = &h00000002
5811Const REG_NO_LAZY_FLUSH = &h00000004
5812Const REG_FORCE_RESTORE = &h00000008
5813Const REG_APP_HIVE = &h00000010
5814Const REG_PROCESS_PRIVATE = &h00000020
5815Const REG_START_JOURNAL = &h00000040
5816Const REG_HIVE_EXACT_FILE_GROWTH = &h00000080
5817Const REG_HIVE_NO_RM = &h00000100
5818Const REG_HIVE_SINGLE_LOG = &h00000200
5819
5820Const REG_FORCE_UNLOAD = 1
5821
5822Const REG_NOTIFY_CHANGE_NAME = &h00000001
5823Const REG_NOTIFY_CHANGE_ATTRIBUTES = &h00000002
5824Const REG_NOTIFY_CHANGE_LAST_SET = &h00000004
5825Const REG_NOTIFY_CHANGE_SECURITY = &h00000008
5826
5827Const REG_LEGAL_CHANGE_FILTER = (REG_NOTIFY_CHANGE_NAME Or REG_NOTIFY_CHANGE_ATTRIBUTES Or REG_NOTIFY_CHANGE_LAST_SET Or REG_NOTIFY_CHANGE_SECURITY)
5828
5829Const REG_NONE = 0
5830Const REG_SZ = 1
5831Const REG_EXPAND_SZ = 2
5832
5833Const REG_BINARY = 3
5834Const REG_DWORD = 4
5835Const REG_DWORD_LITTLE_ENDIAN = 4
5836Const REG_DWORD_BIG_ENDIAN = 5
5837Const REG_LINK = 6
5838Const REG_MULTI_SZ = 7
5839Const REG_RESOURCE_LIST = 8
5840Const REG_FULL_RESOURCE_DESCRIPTOR = 9
5841Const REG_RESOURCE_REQUIREMENTS_LIST = 10
5842Const REG_QWORD = 11
5843Const REG_QWORD_LITTLE_ENDIAN = 11
5844
5845Const SERVICE_KERNEL_DRIVER = &h00000001
5846Const SERVICE_FILE_SYSTEM_DRIVER = &h00000002
5847Const SERVICE_ADAPTER = &h00000004
5848Const SERVICE_RECOGNIZER_DRIVER = &h00000008
5849
5850Const SERVICE_DRIVER = (SERVICE_KERNEL_DRIVER Or SERVICE_FILE_SYSTEM_DRIVER Or SERVICE_RECOGNIZER_DRIVER)
5851
5852Const SERVICE_WIN32_OWN_PROCESS = &h00000010
5853Const SERVICE_WIN32_SHARE_PROCESS = &h00000020
5854Const SERVICE_WIN32 = (SERVICE_WIN32_OWN_PROCESS Or SERVICE_WIN32_SHARE_PROCESS)
5855
5856Const SERVICE_INTERACTIVE_PROCESS = &h00000100
5857
5858Const SERVICE_TYPE_ALL = (SERVICE_WIN32 Or SERVICE_ADAPTER Or SERVICE_DRIVER Or SERVICE_INTERACTIVE_PROCESS)
5859
5860Const SERVICE_BOOT_START = &h00000000
5861Const SERVICE_SYSTEM_START = &h00000001
5862Const SERVICE_AUTO_START = &h00000002
5863Const SERVICE_DEMAND_START = &h00000003
5864Const SERVICE_DISABLED = &h00000004
5865
5866Const SERVICE_ERROR_IGNORE = &h00000000
5867Const SERVICE_ERROR_NORMAL = &h00000001
5868Const SERVICE_ERROR_SEVERE = &h00000002
5869Const SERVICE_ERROR_CRITICAL = &h00000003
5870
5871Enum _SERVICE_NODE_TYPE
5872 DriverType = SERVICE_KERNEL_DRIVER
5873 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER
5874 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS
5875 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS
5876 AdapterType = SERVICE_ADAPTER
5877 RecognizerType = SERVICE_RECOGNIZER_DRIVER
5878End Enum
5879
5880Enum SERVICE_LOAD_TYPE
5881 BootLoad = SERVICE_BOOT_START
5882 SystemLoad = SERVICE_SYSTEM_START
5883 AutoLoad = SERVICE_AUTO_START
5884 DemandLoad = SERVICE_DEMAND_START
5885 DisableLoad = SERVICE_DISABLED
5886End Enum
5887
5888Enum SERVICE_ERROR_TYPE
5889 IgnoreError = SERVICE_ERROR_IGNORE
5890 NormalError = SERVICE_ERROR_NORMAL
5891 SevereError = SERVICE_ERROR_SEVERE
5892 CriticalError = SERVICE_ERROR_CRITICAL
5893End Enum
5894
5895Const TAPE_ERASE_SHORT = 0
5896Const TAPE_ERASE_LONG = 1
5897
5898Type TAPE_ERASE
5899 Type_ As DWord
5900 Immediate As BOOLEAN
5901End Type
5902TypeDef PTAPE_ERASE = *TAPE_ERASE
5903
5904Const TAPE_LOAD = 0
5905Const TAPE_UNLOAD = 1
5906Const TAPE_TENSION = 2
5907Const TAPE_LOCK = 3
5908Const TAPE_UNLOCK = 4
5909Const TAPE_FORMAT = 5
5910
5911Type TAPE_PREPARE
5912 Operation As DWord
5913 Immediate As BOOLEAN
5914End Type
5915TypeDef PTAPE_PREPARE = *TAPE_PREPARE
5916
5917Const TAPE_SETMARKS = 0
5918Const TAPE_FILEMARKS = 1
5919Const TAPE_SHORT_FILEMARKS = 2
5920Const TAPE_LONG_FILEMARKS = 3
5921
5922Type TAPE_WRITE_MARKS
5923 Type_ As DWord
5924 Count As DWord
5925 Immediate As BOOLEAN
5926End Type
5927TypeDef PTAPE_WRITE_MARKS = *TAPE_WRITE_MARKS
5928
5929Const TAPE_ABSOLUTE_POSITION = 0
5930Const TAPE_LOGICAL_POSITION = 1
5931Const TAPE_PSEUDO_LOGICAL_POSITION = 2
5932
5933Type TAPE_GET_POSITION
5934 Type_ As DWord
5935 Partition As DWord
5936 Offset As LARGE_INTEGER
5937End Type
5938TypeDef PTAPE_GET_POSITION = *TAPE_GET_POSITION
5939
5940Const TAPE_REWIND = 0
5941Const TAPE_ABSOLUTE_BLOCK = 1
5942Const TAPE_LOGICAL_BLOCK = 2
5943Const TAPE_PSEUDO_LOGICAL_BLOCK = 3
5944Const TAPE_SPACE_END_OF_DATA = 4
5945Const TAPE_SPACE_RELATIVE_BLOCKS = 5
5946Const TAPE_SPACE_FILEMARKS = 6
5947Const TAPE_SPACE_SEQUENTIAL_FMKS = 7
5948Const TAPE_SPACE_SETMARKS = 8
5949Const TAPE_SPACE_SEQUENTIAL_SMKS = 9
5950
5951Type TAPE_SET_POSITION
5952 Method As DWord
5953 Partition As DWord
5954 Offset As LARGE_INTEGER
5955 Immediate As BOOLEAN
5956End Type
5957TypeDef PTAPE_SET_POSITION = *TAPE_SET_POSITION
5958
5959Const TAPE_DRIVE_FIXED = &h00000001
5960Const TAPE_DRIVE_SELECT = &h00000002
5961Const TAPE_DRIVE_INITIATOR = &h00000004
5962
5963Const TAPE_DRIVE_ERASE_SHORT = &h00000010
5964Const TAPE_DRIVE_ERASE_LONG = &h00000020
5965Const TAPE_DRIVE_ERASE_BOP_ONLY = &h00000040
5966Const TAPE_DRIVE_ERASE_IMMEDIATE = &h00000080
5967
5968Const TAPE_DRIVE_TAPE_CAPACITY = &h00000100
5969Const TAPE_DRIVE_TAPE_REMAINING = &h00000200
5970Const TAPE_DRIVE_FIXED_BLOCK = &h00000400
5971Const TAPE_DRIVE_VARIABLE_BLOCK = &h00000800
5972
5973Const TAPE_DRIVE_WRITE_PROTECT = &h00001000
5974Const TAPE_DRIVE_EOT_WZ_SIZE = &h00002000
5975
5976Const TAPE_DRIVE_ECC = &h00010000
5977Const TAPE_DRIVE_COMPRESSION = &h00020000
5978Const TAPE_DRIVE_PADDING = &h00040000
5979Const TAPE_DRIVE_REPORT_SMKS = &h00080000
5980
5981Const TAPE_DRIVE_GET_ABSOLUTE_BLK = &h00100000
5982Const TAPE_DRIVE_GET_LOGICAL_BLK = &h00200000
5983Const TAPE_DRIVE_SET_EOT_WZ_SIZE = &h00400000
5984
5985Const TAPE_DRIVE_EJECT_MEDIA = &h01000000
5986Const TAPE_DRIVE_CLEAN_REQUESTS = &h02000000
5987Const TAPE_DRIVE_SET_CMP_BOP_ONLY = &h04000000
5988
5989Const TAPE_DRIVE_RESERVED_BIT = &h80000000
5990
5991Const TAPE_DRIVE_LOAD_UNLOAD = &h80000001
5992Const TAPE_DRIVE_TENSION = &h80000002
5993Const TAPE_DRIVE_LOCK_UNLOCK = &h80000004
5994Const TAPE_DRIVE_REWIND_IMMEDIATE = &h80000008
5995
5996Const TAPE_DRIVE_SET_BLOCK_SIZE = &h80000010
5997Const TAPE_DRIVE_LOAD_UNLD_IMMED = &h80000020
5998Const TAPE_DRIVE_TENSION_IMMED = &h80000040
5999Const TAPE_DRIVE_LOCK_UNLK_IMMED = &h80000080
6000
6001Const TAPE_DRIVE_SET_ECC = &h80000100
6002Const TAPE_DRIVE_SET_COMPRESSION = &h80000200
6003Const TAPE_DRIVE_SET_PADDING = &h80000400
6004Const TAPE_DRIVE_SET_REPORT_SMKS = &h80000800
6005
6006Const TAPE_DRIVE_ABSOLUTE_BLK = &h80001000
6007Const TAPE_DRIVE_ABS_BLK_IMMED = &h80002000
6008Const TAPE_DRIVE_LOGICAL_BLK = &h80004000
6009Const TAPE_DRIVE_LOG_BLK_IMMED = &h80008000
6010
6011Const TAPE_DRIVE_END_OF_DATA = &h80010000
6012Const TAPE_DRIVE_RELATIVE_BLKS = &h80020000
6013Const TAPE_DRIVE_FILEMARKS = &h80040000
6014Const TAPE_DRIVE_SEQUENTIAL_FMKS = &h80080000
6015
6016Const TAPE_DRIVE_SETMARKS = &h80100000
6017Const TAPE_DRIVE_SEQUENTIAL_SMKS = &h80200000
6018Const TAPE_DRIVE_REVERSE_POSITION = &h80400000
6019Const TAPE_DRIVE_SPACE_IMMEDIATE = &h80800000
6020
6021Const TAPE_DRIVE_WRITE_SETMARKS = &h81000000
6022Const TAPE_DRIVE_WRITE_FILEMARKS = &h82000000
6023Const TAPE_DRIVE_WRITE_SHORT_FMKS = &h84000000
6024Const TAPE_DRIVE_WRITE_LONG_FMKS = &h88000000
6025
6026Const TAPE_DRIVE_WRITE_MARK_IMMED = &h90000000
6027Const TAPE_DRIVE_FORMAT = &hA0000000
6028Const TAPE_DRIVE_FORMAT_IMMEDIATE = &hC0000000
6029Const TAPE_DRIVE_HIGH_FEATURES = &h80000000
6030
6031Type TAPE_GET_DRIVE_PARAMETERS
6032 ECC As BOOLEAN
6033 Compression As BOOLEAN
6034 DataPadding As BOOLEAN
6035 ReportSetmarks As BOOLEAN
6036 DefaultBlockSize As DWord
6037 MaximumBlockSize As DWord
6038 MinimumBlockSize As DWord
6039 MaximumPartitionCount As DWord
6040 FeaturesLow As DWord
6041 FeaturesHigh As DWord
6042 EOTWarningZoneSize As DWord
6043End Type
6044TypeDef PTAPE_GET_DRIVE_PARAMETERS = *TAPE_GET_DRIVE_PARAMETERS
6045
6046Type TAPE_SET_DRIVE_PARAMETERS
6047 ECC As BOOLEAN
6048 Compression As BOOLEAN
6049 DataPadding As BOOLEAN
6050 ReportSetmarks As BOOLEAN
6051 EOTWarningZoneSize As DWord
6052End Type
6053TypeDef PTAPE_SET_DRIVE_PARAMETERS = *TAPE_SET_DRIVE_PARAMETERS
6054
6055Type TAPE_GET_MEDIA_PARAMETERS
6056 Capacity As LARGE_INTEGER
6057 Remaining As LARGE_INTEGER
6058 BlockSize As DWord
6059 PartitionCount As DWord
6060 WriteProtected As BOOLEAN
6061End Type
6062TypeDef PTAPE_GET_MEDIA_PARAMETERS = *TAPE_GET_MEDIA_PARAMETERS
6063
6064Type TAPE_SET_MEDIA_PARAMETERS
6065 BlockSize As DWord
6066End Type
6067TypeDef PTAPE_SET_MEDIA_PARAMETERS = *TAPE_SET_MEDIA_PARAMETERS
6068
6069Const TAPE_FIXED_PARTITIONS = 0
6070Const TAPE_SELECT_PARTITIONS = 1
6071Const TAPE_INITIATOR_PARTITIONS = 2
6072
6073Type TAPE_CREATE_PARTITION
6074 Method As DWord
6075 Count As DWord
6076 Size As DWord
6077End Type
6078TypeDef PTAPE_CREATE_PARTITION = *TAPE_CREATE_PARTITION
6079
6080Const TAPE_QUERY_DRIVE_PARAMETERS = 0
6081Const TAPE_QUERY_MEDIA_CAPACITY = 1
6082Const TAPE_CHECK_FOR_DRIVE_PROBLEM = 2
6083Const TAPE_QUERY_IO_ERROR_DATA = 3
6084Const TAPE_QUERY_DEVICE_ERROR_DATA = 4
6085
6086Type TAPE_WMI_OPERATIONS
6087 Method As DWord
6088 DataBufferSize As DWord
6089 DataBuffer As VoidPtr
6090End Type
6091TypeDef PTAPE_WMI_OPERATIONS = *TAPE_WMI_OPERATIONS
6092
6093Enum TAPE_DRIVE_PROBLEM_TYPE
6094 TapeDriveProblemNone
6095 TapeDriveReadWriteWarning
6096 TapeDriveReadWriteError
6097 TapeDriveReadWarning
6098 TapeDriveWriteWarning
6099 TapeDriveReadError
6100 TapeDriveWriteError
6101 TapeDriveHardwareError
6102 TapeDriveUnsupportedMedia
6103 TapeDriveScsiConnectionError
6104 TapeDriveTimetoClean
6105 TapeDriveCleanDriveNow
6106 TapeDriveMediaLifeExpired
6107 TapeDriveSnappedTape
6108End Enum
6109
6110#ifndef _NTTMAPI_
6111#define _NTTMAPI_
6112
6113'#include <ktmtypes.ab>
6114
6115' Types for Nt level TM calls
6116Const TRANSACTIONMANAGER_QUERY_INFORMATION = &h0001
6117Const TRANSACTIONMANAGER_SET_INFORMATION = &h0002
6118Const TRANSACTIONMANAGER_RECOVER = &h0004
6119Const TRANSACTIONMANAGER_RENAME = &h0008
6120Const TRANSACTIONMANAGER_CREATE_RM = &h0010
6121Const TRANSACTIONMANAGER_BIND_TRANSACTION = &h0020
6122Const TRANSACTIONMANAGER_GENERIC_READ = (STANDARD_RIGHTS_READ Or TRANSACTIONMANAGER_QUERY_INFORMATION)
6123Const TRANSACTIONMANAGER_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE Or TRANSACTIONMANAGER_SET_INFORMATION Or TRANSACTIONMANAGER_RECOVER Or TRANSACTIONMANAGER_RENAME Or TRANSACTIONMANAGER_CREATE_RM)
6124Const TRANSACTIONMANAGER_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE)
6125Const TRANSACTIONMANAGER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or TRANSACTIONMANAGER_GENERIC_READ Or TRANSACTIONMANAGER_GENERIC_WRITE Or TRANSACTIONMANAGER_GENERIC_EXECUTE Or TRANSACTIONMANAGER_BIND_TRANSACTION)
6126
6127Const TRANSACTION_QUERY_INFORMATION = &h0001
6128Const TRANSACTION_SET_INFORMATION = &h0002
6129Const TRANSACTION_ENLIST = &h0004
6130Const TRANSACTION_COMMIT = &h0008
6131Const TRANSACTION_ROLLBACK = &h0010
6132Const TRANSACTION_PROPAGATE = &h0020
6133Const TRANSACTION_SAVEPOINT = &h0040
6134Const TRANSACTION_MARSHALL = ( TRANSACTION_QUERY_INFORMATION )
6135Const TRANSACTION_GENERIC_READ = (STANDARD_RIGHTS_READ Or TRANSACTION_QUERY_INFORMATION Or SYNCHRONIZE)
6136Const TRANSACTION_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE Or TRANSACTION_SET_INFORMATION Or TRANSACTION_COMMIT Or TRANSACTION_ENLIST Or TRANSACTION_ROLLBACK Or TRANSACTION_PROPAGATE Or TRANSACTION_SAVEPOINT Or SYNCHRONIZE)
6137Const TRANSACTION_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or TRANSACTION_COMMIT Or TRANSACTION_ROLLBACK Or SYNCHRONIZE)
6138Const TRANSACTION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or TRANSACTION_GENERIC_READ Or TRANSACTION_GENERIC_WRITE Or TRANSACTION_GENERIC_EXECUTE)
6139Const TRANSACTION_RESOURCE_MANAGER_RIGHTS = (TRANSACTION_GENERIC_READ Or STANDARD_RIGHTS_WRITE Or TRANSACTION_SET_INFORMATION Or TRANSACTION_ENLIST Or TRANSACTION_ROLLBACK Or TRANSACTION_PROPAGATE Or SYNCHRONIZE)
6140
6141Const RESOURCEMANAGER_QUERY_INFORMATION = &h0001
6142Const RESOURCEMANAGER_SET_INFORMATION = &h0002
6143Const RESOURCEMANAGER_RECOVER = &h0004
6144Const RESOURCEMANAGER_ENLIST = &h0008
6145Const RESOURCEMANAGER_GET_NOTIFICATION = &h0010
6146Const RESOURCEMANAGER_REGISTER_PROTOCOL = &h0020
6147Const RESOURCEMANAGER_COMPLETE_PROPAGATION = &h0040
6148Const RESOURCEMANAGER_GENERIC_READ = (STANDARD_RIGHTS_READ Or RESOURCEMANAGER_QUERY_INFORMATION Or SYNCHRONIZE)
6149Const RESOURCEMANAGER_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE Or RESOURCEMANAGER_SET_INFORMATION Or RESOURCEMANAGER_RECOVER Or RESOURCEMANAGER_ENLIST Or RESOURCEMANAGER_GET_NOTIFICATION Or RESOURCEMANAGER_REGISTER_PROTOCOL Or RESOURCEMANAGER_COMPLETE_PROPAGATION Or SYNCHRONIZE)
6150Const RESOURCEMANAGER_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or RESOURCEMANAGER_RECOVER Or RESOURCEMANAGER_ENLIST Or RESOURCEMANAGER_GET_NOTIFICATION Or RESOURCEMANAGER_COMPLETE_PROPAGATION Or SYNCHRONIZE)
6151Const RESOURCEMANAGER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or RESOURCEMANAGER_GENERIC_READ Or RESOURCEMANAGER_GENERIC_WRITE Or RESOURCEMANAGER_GENERIC_EXECUTE)
6152
6153
6154Const ENLISTMENT_QUERY_INFORMATION = &h0001
6155Const ENLISTMENT_SET_INFORMATION = &h0002
6156Const ENLISTMENT_RECOVER = &h0004
6157Const ENLISTMENT_SUBORDINATE_RIGHTS = &h0008
6158Const ENLISTMENT_SUPERIOR_RIGHTS = &h0010
6159Const ENLISTMENT_GENERIC_READ = (STANDARD_RIGHTS_READ Or ENLISTMENT_QUERY_INFORMATION)
6160Const ENLISTMENT_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE Or ENLISTMENT_SET_INFORMATION Or ENLISTMENT_RECOVER Or ENLISTMENT_SUBORDINATE_RIGHTS Or ENLISTMENT_SUPERIOR_RIGHTS)
6161Const ENLISTMENT_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or ENLISTMENT_RECOVER Or ENLISTMENT_SUBORDINATE_RIGHTS Or ENLISTMENT_SUPERIOR_RIGHTS)
6162Const ENLISTMENT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or ENLISTMENT_GENERIC_READ Or ENLISTMENT_GENERIC_WRITE Or ENLISTMENT_GENERIC_EXECUTE)
6163
6164' Transaction outcomes.
6165
6166Enum TRANSACTION_OUTCOME
6167 TransactionOutcomeUndetermined = 1
6168 TransactionOutcomeCommitted
6169 TransactionOutcomeAborted
6170End Enum
6171
6172
6173Enum TRANSACTION_STATE
6174 TransactionStateNormal = 1
6175 TransactionStateIndoubt
6176 TransactionStateCommittedNotify
6177End Enum
6178
6179Type TRANSACTION_BASIC_INFORMATION
6180 TransactionId As GUID
6181 State As DWord
6182 Outcome As DWord
6183End Type
6184TypeDef PTRANSACTION_BASIC_INFORMATION = *TRANSACTION_BASIC_INFORMATION
6185
6186Type TRANSACTIONMANAGER_BASIC_INFORMATION
6187 TmIdentity As GUID
6188 VirtualClock As LARGE_INTEGER
6189End Type
6190TypeDef PTRANSACTIONMANAGER_BASIC_INFORMATION = *TRANSACTIONMANAGER_BASIC_INFORMATION
6191
6192Type TRANSACTIONMANAGER_LOG_INFORMATION
6193 LogIdentity As GUID
6194End Type
6195TypeDef PTRANSACTIONMANAGER_LOG_INFORMATION = *TRANSACTIONMANAGER_LOG_INFORMATION
6196
6197Type TRANSACTIONMANAGER_LOGPATH_INFORMATION
6198 LogPathLength As DWord
6199 /*__field_ecount(LogPathLength)*/ LogPath[ELM(1)] As WCHAR 'Variable size
6200' Data[ELM(1)] 'Variable size data not declared
6201End Type
6202TypeDef PTRANSACTIONMANAGER_LOGPATH_INFORMATION = *TRANSACTIONMANAGER_LOGPATH_INFORMATION
6203
6204Type TRANSACTION_PROPERTIES_INFORMATION
6205 IsolationLevel As DWord
6206 IsolationFlags As DWord
6207 Timeout As LARGE_INTEGER
6208 Outcome As DWord
6209 DescriptionLength As DWord
6210 Description[ELM(1)] As WCHAR 'Variable size
6211' Data[ELM(1)] 'Variable size data not declared
6212End Type
6213TypeDef PTRANSACTION_PROPERTIES_INFORMATION = *TRANSACTION_PROPERTIES_INFORMATION
6214
6215Type TRANSACTION_BIND_INFORMATION
6216 TmHandle As HANDLE
6217End Type
6218TypeDef PTRANSACTION_BIND_INFORMATION = *TRANSACTION_BIND_INFORMATION
6219
6220Type TRANSACTION_ENLISTMENT_PAIR
6221 EnlistmentId As GUID
6222 ResourceManagerId As GUID
6223End Type
6224TypeDef PTRANSACTION_ENLISTMENT_PAIR = *TRANSACTION_ENLISTMENT_PAIR
6225
6226Type TRANSACTION_ENLISTMENTS_INFORMATION
6227 NumberOfEnlistments As DWord
6228 EnlistmentPair[ELM(1)] As TRANSACTION_ENLISTMENT_PAIR 'Variable size
6229End Type
6230TypeDef PTRANSACTION_ENLISTMENTS_INFORMATION = *TRANSACTION_ENLISTMENTS_INFORMATION
6231
6232Type TRANSACTION_FULL_INFORMATION
6233 NameLength As DWord
6234End Type
6235TypeDef PTRANSACTION_FULL_INFORMATION = *TRANSACTION_FULL_INFORMATION
6236
6237Type RESOURCEMANAGER_BASIC_INFORMATION
6238 ResourceManagerId As GUID
6239 DescriptionLength As DWord
6240 Description[ELM(1)] As WCHAR 'Variable size
6241End Type
6242TypeDef PRESOURCEMANAGER_BASIC_INFORMATION = *RESOURCEMANAGER_BASIC_INFORMATION
6243
6244Type RESOURCEMANAGER_COMPLETION_INFORMATION
6245 IoCompletionPortHandle As HANDLE
6246 CompletionKey As ULONG_PTR
6247End Type
6248TypeDef PRESOURCEMANAGER_COMPLETION_INFORMATION = *RESOURCEMANAGER_COMPLETION_INFORMATION
6249
6250Type TRANSACTION_NAME_INFORMATION
6251 NameLength As DWord
6252 Name[ELM(1)] As WCHAR 'Variable length string
6253End Type
6254TypeDef PTRANSACTION_NAME_INFORMATION = *TRANSACTION_NAME_INFORMATION
6255
6256Enum TRANSACTION_INFORMATION_CLASS
6257 TransactionBasicInformation
6258 TransactionPropertiesInformation
6259 TransactionEnlistmentInformation
6260 TransactionFullInformation
6261 TransactionBindInformation
6262' TransactionNameInformation
6263End Enum
6264
6265Enum TRANSACTIONMANAGER_INFORMATION_CLASS
6266 TransactionManagerBasicInformation
6267 TransactionManagerLogInformation
6268 TransactionManagerLogPathInformation
6269 TransactionManagerOnlineProbeInformation
6270End Enum
6271
6272Enum RESOURCEMANAGER_INFORMATION_CLASS
6273 ResourceManagerBasicInformation
6274 ResourceManagerCompletionInformation
6275 ResourceManagerFullInformation
6276 ResourceManagerNameInformation
6277End Enum
6278
6279Type ENLISTMENT_BASIC_INFORMATION
6280 EnlistmentId As GUID
6281 TransactionId As GUID
6282 ResourceManagerId As GUID
6283End Type
6284TypeDef PENLISTMENT_BASIC_INFORMATION = *ENLISTMENT_BASIC_INFORMATION
6285
6286Enum ENLISTMENT_INFORMATION_CLASS
6287 EnlistmentBasicInformation
6288 EnlistmentRecoveryInformation
6289 EnlistmentFullInformation
6290 EnlistmentNameInformation
6291End Enum
6292
6293Type TRANSACTION_LIST_ENTRY
6294' UOW As UOW
6295End Type
6296
6297TypeDef PTRANSACTION_LIST_ENTRY = *TRANSACTION_LIST_ENTRY
6298
6299Type TRANSACTION_LIST_INFORMATION
6300 NumberOfTransactions As DWord
6301 TransactionInformation[ELM(1)] As TRANSACTION_LIST_ENTRY
6302End Type
6303TypeDef PTRANSACTION_LIST_INFORMATION = *TRANSACTION_LIST_INFORMATION
6304
6305' Types of objects known to the kernel transaction manager.
6306Enum KTMOBJECT_TYPE
6307 KTMOBJECT_TRANSACTION
6308 KTMOBJECT_TRANSACTION_MANAGER
6309 KTMOBJECT_RESOURCE_MANAGER
6310 KTMOBJECT_ENLISTMENT
6311 KTMOBJECT_INVALID
6312End Enum
6313TypeDef PKTMOBJECT_TYPE = *KTMOBJECT_TYPE
6314
6315' KTMOBJECT_CURSOR
6316Type KTMOBJECT_CURSOR
6317 LastQuery As GUID
6318 ObjectIdCount As DWord
6319 ObjectIds[ELM(1)] As GUID
6320End Type
6321TypeDef PKTMOBJECT_CURSOR = *KTMOBJECT_CURSOR
6322
6323#endif
6324
6325TypeDef TP_VERSION = DWord
6326TypeDef PTP_VERSION = *TP_VERSION
6327
6328TypeDef PTP_CALLBACK_INSTANCE = VoidPtr
6329'typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE, *PTP_CALLBACK_INSTANCE;
6330
6331TypeDef PTP_SIMPLE_CALLBACK = *Sub(Instance As PTP_CALLBACK_INSTANCE, Context As VoidPtr)
6332TypeDef PTP_POOL = VoidPtr
6333'typedef struct _TP_POOL TP_POOL, *PTP_POOL;
6334TypeDef PTP_CLEANUP_GROUP = VoidPtr
6335'typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP, *PTP_CLEANUP_GROUP;
6336TypeDef PTP_CLEANUP_GROUP_CANCEL_CALLBACK = *Sub(ObjectContext As VoidPtr, CleanupContext As VoidPtr)
6337
6338TypeDef PACTIVATION_CONTEXT = VoidPtr
6339
6340Type TP_CALLBACK_ENVIRON
6341 Version As TP_VERSION
6342 Pool As PTP_POOL
6343 CleanupGroup As PTP_CLEANUP_GROUP
6344 CleanupGroupCancelCallback As PTP_CLEANUP_GROUP_CANCEL_CALLBACK
6345 RaceDll As VoidPtr
6346 ActivationContext As PACTIVATION_CONTEXT
6347 FinalizationCallback As PTP_SIMPLE_CALLBACK
6348' Union
6349 Flags As DWord
6350' Type
6351' LongFunction : 1 As DWord
6352' Private_ : 31 As DWord
6353' } s;
6354' End Union
6355End Type
6356TypeDef PTP_CALLBACK_ENVIRON = *TP_CALLBACK_ENVIRON
6357
6358Sub /*FORCEINLINE*/ TpInitializeCallbackEnviron(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON)
6359 With CallbackEnviron
6360 .Version = 1
6361 .Pool = NULL
6362 .CleanupGroup = NULL
6363 .CleanupGroupCancelCallback = NULL
6364 .RaceDll = NULL
6365 .ActivationContext = NULL
6366 .FinalizationCallback = NULL
6367 .Flags = 0
6368 End With
6369End Sub
6370
6371Sub /*FORCEINLINE*/ TpSetCallbackThreadpool(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON, Pool As PTP_POOL)
6372 CallbackEnviron.Pool = Pool
6373End Sub
6374
6375Sub /*FORCEINLINE*/ TpSetCallbackCleanupGroup(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON, CleanupGroup As PTP_CLEANUP_GROUP, CleanupGroupCancelCallback As PTP_CLEANUP_GROUP_CANCEL_CALLBACK)
6376 CallbackEnviron.CleanupGroup = CleanupGroup
6377 CallbackEnviron.CleanupGroupCancelCallback = CleanupGroupCancelCallback
6378End Sub
6379
6380Sub /*FORCEINLINE*/ TpSetCallbackActivationContext(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON, ActivationContext As PACTIVATION_CONTEXT)
6381 CallbackEnviron.ActivationContext = ActivationContext
6382End Sub
6383
6384Sub /*FORCEINLINE*/ TpSetCallbackNoActivationContext(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON)
6385 CallbackEnviron.ActivationContext = (-1 As LONG_PTR) As PACTIVATION_CONTEXT
6386End Sub
6387
6388Sub /*FORCEINLINE*/ TpSetCallbackLongFunction(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON)
6389 CallbackEnviron.Flags = 1 'u.s.LongFunction = 1
6390End Sub
6391
6392Sub /*FORCEINLINE*/ TpSetCallbackRaceWithDll(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON, DllHandle As VoidPtr)
6393 CallbackEnviron.RaceDll = DllHandle
6394End Sub
6395
6396Sub /*FORCEINLINE*/ TpSetCallbackFinalizationCallback(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON, FinalizationCallback As PTP_SIMPLE_CALLBACK)
6397 CallbackEnviron.FinalizationCallback = FinalizationCallback
6398End Sub
6399
6400Sub /*FORCEINLINE*/ TpDestroyCallbackEnviron(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON)
6401' UNREFERENCED_PARAMETER(CallbackEnviron)
6402End Sub
6403
6404TypeDef PTP_WORK = VoidPtr
6405'typedef struct _TP_WORK TP_WORK, *PTP_WORK;
6406
6407TypeDef PTP_WORK_CALLBACK = *Sub(Instance As PTP_CALLBACK_INSTANCE, Context As VoidPtr, Work As PTP_WORK)
6408
6409TypeDef PTP_TIMER = *VoidPtr
6410'typedef struct _TP_TIMER TP_TIMER, *PTP_TIMER;
6411
6412TypeDef PTP_TIMER_CALLBACK = *Sub(Instance As PTP_CALLBACK_INSTANCE, Context As VoidPtr, Timer As PTP_TIMER)
6413
6414TypeDef TP_WAIT_RESULT = DWord
6415
6416TypeDef PTP_WAIT = VoidPtr
6417'typedef struct _TP_WAIT TP_WAIT, *PTP_WAIT;
6418
6419TypeDef PTP_WAIT_CALLBACK = *Sub(Instance As PTP_CALLBACK_INSTANCE, Context As VoidPtr, Wait As PTP_WAIT, WaitResult As TP_WAIT_RESULT)
6420
6421TypeDef PTP_IO = VoidPtr
6422'typedef struct _TP_IO TP_IO, *PTP_IO;
6423
6424'NtCurrentTeb()
6425'GetCurrentFiber()
6426'GetFiberData ()
6427
6428'#if (_WIN32_WINNT > 0x0500) Or (_WIN32_FUSION >= 0x0100) Or ISOLATION_AWARE_ENABLED
6429Const ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION = 1
6430Const ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION = 2
6431Const ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION = 3
6432Const ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION = 4
6433Const ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION = 5
6434Const ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION = 6
6435Const ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION = 7
6436Const ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE = 8
6437Const ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES = 9
6438Const ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS = 10
6439'#endif // winnt_only
6440
6441#endif
Note: See TracBrowser for help on using the repository browser.