"Fossies" - the Fresh Open Source Software Archive

Member "FreeBASIC-1.05.0-linux-x86_64/include/freebasic/win/winnt.bi" (31 Jan 2016, 276862 Bytes) of package /linux/privat/FreeBASIC-1.05.0-linux-x86_64.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Visual Basic source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 '' FreeBASIC binding for mingw-w64-v4.0.4
    2 ''
    3 '' based on the C header files:
    4 ''   This Software is provided under the Zope Public License (ZPL) Version 2.1.
    5 ''
    6 ''   Copyright (c) 2009, 2010 by the mingw-w64 project
    7 ''
    8 ''   See the AUTHORS file for the list of contributors to the mingw-w64 project.
    9 ''
   10 ''   This license has been certified as open source. It has also been designated
   11 ''   as GPL compatible by the Free Software Foundation (FSF).
   12 ''
   13 ''   Redistribution and use in source and binary forms, with or without
   14 ''   modification, are permitted provided that the following conditions are met:
   15 ''
   16 ''     1. Redistributions in source code must retain the accompanying copyright
   17 ''        notice, this list of conditions, and the following disclaimer.
   18 ''     2. Redistributions in binary form must reproduce the accompanying
   19 ''        copyright notice, this list of conditions, and the following disclaimer
   20 ''        in the documentation and/or other materials provided with the
   21 ''        distribution.
   22 ''     3. Names of the copyright holders must not be used to endorse or promote
   23 ''        products derived from this software without prior written permission
   24 ''        from the copyright holders.
   25 ''     4. The right to distribute this software or to use it for any purpose does
   26 ''        not give you the right to use Servicemarks (sm) or Trademarks (tm) of
   27 ''        the copyright holders.  Use of them is covered by separate agreement
   28 ''        with the copyright holders.
   29 ''     5. If any files are modified, you must cause the modified files to carry
   30 ''        prominent notices stating that you changed the files and the date of
   31 ''        any change.
   32 ''
   33 ''   Disclaimer
   34 ''
   35 ''   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
   36 ''   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   37 ''   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
   38 ''   EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
   39 ''   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   40 ''   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
   41 ''   OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   42 ''   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   43 ''   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
   44 ''   EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   45 ''
   46 '' translated to FreeBASIC by:
   47 ''   Copyright © 2015 FreeBASIC development team
   48 
   49 #pragma once
   50 
   51 #include once "crt/mem.bi"
   52 #include once "_mingw_unicode.bi"
   53 #include once "_mingw.bi"
   54 #include once "crt/ctype.bi"
   55 #include once "winapifamily.bi"
   56 #include once "apiset.bi"
   57 #include once "intrin.bi"
   58 #include once "basetsd.bi"
   59 #include once "guiddef.bi"
   60 #include once "windef.bi"
   61 
   62 '' The following symbols have been renamed:
   63 ''     typedef INT => INT_
   64 ''     typedef BOOLEAN => WINBOOLEAN
   65 ''     constant DELETE => DELETE__
   66 
   67 extern "Windows"
   68 
   69 #define _WINNT_
   70 const ANYSIZE_ARRAY = 1
   71 #define RESTRICTED_POINTER
   72 
   73 #ifdef __FB_64BIT__
   74     #define ALIGNMENT_MACHINE
   75     #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
   76     const MEMORY_ALLOCATION_ALIGNMENT = 16
   77 #else
   78     #undef ALIGNMENT_MACHINE
   79     #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
   80     const MEMORY_ALLOCATION_ALIGNMENT = 8
   81 #endif
   82 
   83 const SYSTEM_CACHE_ALIGNMENT_SIZE = 64
   84 const PRAGMA_DEPRECATED_DDK = 0
   85 type PVOID as any ptr
   86 type PVOID64 as any ptr
   87 type VOID as any
   88 type CHAR as byte
   89 type INT_ as long
   90 #define __WCHAR_DEFINED
   91 type WCHAR as wchar_t
   92 type PWCHAR as WCHAR ptr
   93 type LPWCH as WCHAR ptr
   94 type PWCH as WCHAR ptr
   95 type LPCWCH as const WCHAR ptr
   96 type PCWCH as const WCHAR ptr
   97 type NWPSTR as wstring ptr
   98 type LPWSTR as wstring ptr
   99 type PWSTR as wstring ptr
  100 type PZPWSTR as PWSTR ptr
  101 type PCZPWSTR as const PWSTR ptr
  102 type LPUWSTR as wstring ptr
  103 type PUWSTR as wstring ptr
  104 type LPCWSTR as const wstring ptr
  105 type PCWSTR as const wstring ptr
  106 type PZPCWSTR as PCWSTR ptr
  107 type LPCUWSTR as const wstring ptr
  108 type PCUWSTR as const wstring ptr
  109 type PZZWSTR as wstring ptr
  110 type PCZZWSTR as const wstring ptr
  111 type PUZZWSTR as wstring ptr
  112 type PCUZZWSTR as const wstring ptr
  113 type PNZWCH as WCHAR ptr
  114 type PCNZWCH as const WCHAR ptr
  115 type PUNZWCH as WCHAR ptr
  116 type PCUNZWCH as const WCHAR ptr
  117 
  118 #if _WIN32_WINNT = &h0602
  119     type LPCWCHAR as const WCHAR ptr
  120     type PCWCHAR as const WCHAR ptr
  121     type LPCUWCHAR as const WCHAR ptr
  122     type PCUWCHAR as const WCHAR ptr
  123     type UCSCHAR as ulong
  124 
  125     const UCSCHAR_INVALID_CHARACTER = &hffffffff
  126     const MIN_UCSCHAR = 0
  127     const MAX_UCSCHAR = &h0010ffff
  128 
  129     type PUCSCHAR as UCSCHAR ptr
  130     type PCUCSCHAR as const UCSCHAR ptr
  131     type PUCSSTR as UCSCHAR ptr
  132     type PUUCSSTR as UCSCHAR ptr
  133     type PCUCSSTR as const UCSCHAR ptr
  134     type PCUUCSSTR as const UCSCHAR ptr
  135     type PUUCSCHAR as UCSCHAR ptr
  136     type PCUUCSCHAR as const UCSCHAR ptr
  137 #endif
  138 
  139 type PCHAR as CHAR ptr
  140 type LPCH as CHAR ptr
  141 type PCH as CHAR ptr
  142 type LPCCH as const CHAR ptr
  143 type PCCH as const CHAR ptr
  144 type NPSTR as zstring ptr
  145 type LPSTR as zstring ptr
  146 type PSTR as zstring ptr
  147 type PZPSTR as PSTR ptr
  148 type PCZPSTR as const PSTR ptr
  149 type LPCSTR as const zstring ptr
  150 type PCSTR as const zstring ptr
  151 type PZPCSTR as PCSTR ptr
  152 type PZZSTR as zstring ptr
  153 type PCZZSTR as const zstring ptr
  154 type PNZCH as CHAR ptr
  155 type PCNZCH as const CHAR ptr
  156 #define _TCHAR_DEFINED
  157 
  158 #ifdef UNICODE
  159     type TCHAR as WCHAR
  160     type PTCHAR as WCHAR ptr
  161     type TBYTE as WCHAR
  162     type PTBYTE as WCHAR ptr
  163     type LPTCH as LPWSTR
  164     type PTCH as LPWSTR
  165     type PTSTR as LPWSTR
  166     type LPTSTR as LPWSTR
  167     type PCTSTR as LPCWSTR
  168     type LPCTSTR as LPCWSTR
  169     type PUTSTR as LPUWSTR
  170     type LPUTSTR as LPUWSTR
  171     type PCUTSTR as LPCUWSTR
  172     type LPCUTSTR as LPCUWSTR
  173     type LP as LPWSTR
  174     type PZZTSTR as PZZWSTR
  175     type PCZZTSTR as PCZZWSTR
  176     type PUZZTSTR as PUZZWSTR
  177     type PCUZZTSTR as PCUZZWSTR
  178     type PZPTSTR as PZPWSTR
  179     type PNZTCH as PNZWCH
  180     type PCNZTCH as PCNZWCH
  181     type PUNZTCH as PUNZWCH
  182     type PCUNZTCH as PCUNZWCH
  183     #define __TEXT(quote) wstr(quote)
  184 #else
  185     type TCHAR as byte
  186     type PTCHAR as byte ptr
  187     type TBYTE as ubyte
  188     type PTBYTE as ubyte ptr
  189     type LPTCH as LPSTR
  190     type PTCH as LPSTR
  191     type LPCTCH as LPCCH
  192     type PCTCH as LPCCH
  193     type PTSTR as LPSTR
  194     type LPTSTR as LPSTR
  195     type PUTSTR as LPSTR
  196     type LPUTSTR as LPSTR
  197     type PCTSTR as LPCSTR
  198     type LPCTSTR as LPCSTR
  199     type PCUTSTR as LPCSTR
  200     type LPCUTSTR as LPCSTR
  201     type PZZTSTR as PZZSTR
  202     type PUZZTSTR as PZZSTR
  203     type PCZZTSTR as PCZZSTR
  204     type PCUZZTSTR as PCZZSTR
  205     type PZPTSTR as PZPSTR
  206     type PNZTCH as PNZCH
  207     type PUNZTCH as PNZCH
  208     type PCNZTCH as PCNZCH
  209     type PCUNZTCH as PCNZCH
  210     #define __TEXT(quote) quote
  211 #endif
  212 
  213 type PSHORT as SHORT ptr
  214 type PLONG as LONG ptr
  215 #define ___GROUP_AFFINITY_DEFINED
  216 
  217 type _GROUP_AFFINITY
  218     Mask as KAFFINITY
  219     Group as WORD
  220     Reserved(0 to 2) as WORD
  221 end type
  222 
  223 type GROUP_AFFINITY as _GROUP_AFFINITY
  224 type PGROUP_AFFINITY as _GROUP_AFFINITY ptr
  225 type HANDLE as any ptr
  226 type PHANDLE as HANDLE ptr
  227 type FCHAR as UBYTE
  228 type FSHORT as WORD
  229 type FLONG as DWORD
  230 #define _HRESULT_DEFINED
  231 type HRESULT as LONG
  232 type CCHAR as zstring
  233 #define _LCID_DEFINED
  234 type LCID as DWORD
  235 type PLCID as PDWORD
  236 #define _LANGID_DEFINED
  237 type LANGID as WORD
  238 #define __COMPARTMENT_ID_DEFINED__
  239 
  240 type COMPARTMENT_ID as long
  241 enum
  242     UNSPECIFIED_COMPARTMENT_ID = 0
  243     DEFAULT_COMPARTMENT_ID
  244 end enum
  245 
  246 type PCOMPARTMENT_ID as COMPARTMENT_ID ptr
  247 const APPLICATION_ERROR_MASK = &h20000000
  248 const ERROR_SEVERITY_SUCCESS = &h00000000
  249 const ERROR_SEVERITY_INFORMATIONAL = &h40000000
  250 const ERROR_SEVERITY_WARNING = &h80000000
  251 const ERROR_SEVERITY_ERROR = &hC0000000
  252 
  253 type _FLOAT128
  254     LowPart as longint
  255     HighPart as longint
  256 end type
  257 
  258 type FLOAT128 as _FLOAT128
  259 type PFLOAT128 as FLOAT128 ptr
  260 #define _ULONGLONG_
  261 type LONGLONG as longint
  262 type ULONGLONG as ulongint
  263 const MAXLONGLONG = &h7fffffffffffffffll
  264 type PLONGLONG as LONGLONG ptr
  265 type PULONGLONG as ULONGLONG ptr
  266 type USN as LONGLONG
  267 #define _LARGE_INTEGER_DEFINED
  268 
  269 type _LARGE_INTEGER_u
  270     LowPart as DWORD
  271     HighPart as LONG
  272 end type
  273 
  274 union _LARGE_INTEGER
  275     type
  276         LowPart as DWORD
  277         HighPart as LONG
  278     end type
  279 
  280     u as _LARGE_INTEGER_u
  281     QuadPart as LONGLONG
  282 end union
  283 
  284 type LARGE_INTEGER as _LARGE_INTEGER
  285 type PLARGE_INTEGER as LARGE_INTEGER ptr
  286 
  287 type _ULARGE_INTEGER_u
  288     LowPart as DWORD
  289     HighPart as DWORD
  290 end type
  291 
  292 union _ULARGE_INTEGER
  293     type
  294         LowPart as DWORD
  295         HighPart as DWORD
  296     end type
  297 
  298     u as _ULARGE_INTEGER_u
  299     QuadPart as ULONGLONG
  300 end union
  301 
  302 type ULARGE_INTEGER as _ULARGE_INTEGER
  303 type PULARGE_INTEGER as ULARGE_INTEGER ptr
  304 
  305 type _LUID
  306     LowPart as DWORD
  307     HighPart as LONG
  308 end type
  309 
  310 type LUID as _LUID
  311 type PLUID as _LUID ptr
  312 #define _DWORDLONG_
  313 type DWORDLONG as ULONGLONG
  314 type PDWORDLONG as DWORDLONG ptr
  315 #define Int32x32To64(a, b) (cast(LONGLONG, cast(LONG, (a))) * cast(LONGLONG, cast(LONG, (b))))
  316 #define UInt32x32To64(a, b) (cast(ULONGLONG, culng(a)) * cast(ULONGLONG, culng(b)))
  317 #define Int64ShllMod32(a, b) (cast(ULONGLONG, (a)) shl (b))
  318 #define Int64ShraMod32(a, b) (cast(LONGLONG, (a)) shr (b))
  319 #define Int64ShrlMod32(a, b) (cast(ULONGLONG, (a)) shr (b))
  320 
  321 #ifdef __FB_64BIT__
  322     declare function _rotl8(byval Value as ubyte, byval Shift as ubyte) as ubyte
  323     declare function RotateLeft8 alias "_rotl8"(byval Value as ubyte, byval Shift as ubyte) as ubyte
  324     declare function _rotl16(byval Value as ushort, byval Shift as ubyte) as ushort
  325     declare function RotateLeft16 alias "_rotl16"(byval Value as ushort, byval Shift as ubyte) as ushort
  326     declare function _rotr8(byval Value as ubyte, byval Shift as ubyte) as ubyte
  327     declare function RotateRight8 alias "_rotr8"(byval Value as ubyte, byval Shift as ubyte) as ubyte
  328     declare function _rotr16(byval Value as ushort, byval Shift as ubyte) as ushort
  329     declare function RotateRight16 alias "_rotr16"(byval Value as ushort, byval Shift as ubyte) as ushort
  330 #endif
  331 
  332 #define RotateLeft32 _rotl
  333 #define RotateLeft64 _rotl64
  334 #define RotateRight32 _rotr
  335 #define RotateRight64 _rotr64
  336 #undef _rotl
  337 #undef _rotr
  338 declare function _rotl cdecl(byval Value as ulong, byval Shift as long) as ulong
  339 declare function _rotr cdecl(byval Value as ulong, byval Shift as long) as ulong
  340 #undef _rotl64
  341 #undef _rotr64
  342 declare function _rotl64 cdecl(byval Value as ulongint, byval Shift as long) as ulongint
  343 declare function _rotr64 cdecl(byval Value as ulongint, byval Shift as long) as ulongint
  344 const ANSI_NULL = cast(CHAR, 0)
  345 const UNICODE_NULL = cast(WCHAR, 0)
  346 const UNICODE_STRING_MAX_BYTES = cast(WORD, 65534)
  347 const UNICODE_STRING_MAX_CHARS = 32767
  348 #define _BOOLEAN_
  349 type WINBOOLEAN as UBYTE
  350 #ifndef BOOLEAN
  351     type BOOLEAN as WINBOOLEAN
  352 #endif
  353 type PBOOLEAN as WINBOOLEAN ptr
  354 #define _LIST_ENTRY_DEFINED
  355 
  356 type _LIST_ENTRY
  357     Flink as _LIST_ENTRY ptr
  358     Blink as _LIST_ENTRY ptr
  359 end type
  360 
  361 type LIST_ENTRY as _LIST_ENTRY
  362 type PLIST_ENTRY as _LIST_ENTRY ptr
  363 type PRLIST_ENTRY as _LIST_ENTRY ptr
  364 
  365 type _SINGLE_LIST_ENTRY
  366     Next as _SINGLE_LIST_ENTRY ptr
  367 end type
  368 
  369 type SINGLE_LIST_ENTRY as _SINGLE_LIST_ENTRY
  370 type PSINGLE_LIST_ENTRY as _SINGLE_LIST_ENTRY ptr
  371 
  372 type LIST_ENTRY32
  373     Flink as DWORD
  374     Blink as DWORD
  375 end type
  376 
  377 type PLIST_ENTRY32 as LIST_ENTRY32 ptr
  378 
  379 type LIST_ENTRY64
  380     Flink as ULONGLONG
  381     Blink as ULONGLONG
  382 end type
  383 
  384 type PLIST_ENTRY64 as LIST_ENTRY64 ptr
  385 #define __OBJECTID_DEFINED
  386 
  387 type _OBJECTID
  388     Lineage as GUID
  389     Uniquifier as DWORD
  390 end type
  391 
  392 type OBJECTID as _OBJECTID
  393 const MINCHAR = &h80
  394 const MAXCHAR = &h7f
  395 const MINSHORT = &h8000
  396 const MAXSHORT = &h7fff
  397 const MINLONG = &h80000000
  398 const MAXLONG = &h7fffffff
  399 const MAXBYTE = &hff
  400 const MAXWORD = &hffff
  401 const MAXDWORD = &hffffffff
  402 #define FIELD_OFFSET(type, field) cast(LONG, cast(LONG_PTR, @cptr(type ptr, 0)->field))
  403 #define RTL_FIELD_SIZE(type, field) sizeof(cptr(type ptr, 0)->field)
  404 #define RTL_SIZEOF_THROUGH_FIELD(type, field) (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
  405 #define RTL_CONTAINS_FIELD(Struct, Size, Field) ((cast(PCHAR, @(Struct)->Field) + sizeof((Struct)->Field)) <= (cast(PCHAR, (Struct)) + (Size)))
  406 #define RTL_NUMBER_OF_V1(A) (ubound(A) - lbound(A) + 1)
  407 #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
  408 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
  409 #define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
  410 #define _ARRAYSIZE(A) RTL_NUMBER_OF_V1(A)
  411 #define RTL_FIELD_TYPE(type, field) cptr(type ptr, 0)->field
  412 #define RTL_NUMBER_OF_FIELD(type, field) RTL_NUMBER_OF(RTL_FIELD_TYPE(type, field))
  413 #define RTL_PADDING_BETWEEN_FIELDS(T, F1, F2) iif(FIELD_OFFSET(T, F2) > FIELD_OFFSET(T, F1), (FIELD_OFFSET(T, F2) - FIELD_OFFSET(T, F1)) - RTL_FIELD_SIZE(T, F1), (FIELD_OFFSET(T, F1) - FIELD_OFFSET(T, F2)) - RTL_FIELD_SIZE(T, F2))
  414 #define RTL_CONST_CAST(type) (type)
  415 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE)
  416 #define COMPILETIME_OR_2FLAGS(a, b) (cast(UINT, (a)) or cast(UINT, (b)))
  417 #define COMPILETIME_OR_3FLAGS(a, b, c) ((cast(UINT, (a)) or cast(UINT, (b))) or cast(UINT, (c)))
  418 #define COMPILETIME_OR_4FLAGS(a, b, c, d) (((cast(UINT, (a)) or cast(UINT, (b))) or cast(UINT, (c))) or cast(UINT, (d)))
  419 #define COMPILETIME_OR_5FLAGS(a, b, c, d, e) ((((cast(UINT, (a)) or cast(UINT, (b))) or cast(UINT, (c))) or cast(UINT, (d))) or cast(UINT, (e)))
  420 #define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8)
  421 #define RTL_BITS_OF_FIELD(type, field) RTL_BITS_OF(RTL_FIELD_TYPE(type, field))
  422 #define CONTAINING_RECORD(address, type, field) cptr(type ptr, cast(PCHAR, (address)) - cast(ULONG_PTR, @cptr(type ptr, 0)->field))
  423 #define __PEXCEPTION_ROUTINE_DEFINED
  424 type _EXCEPTION_RECORD as _EXCEPTION_RECORD_
  425 type _CONTEXT as _CONTEXT_
  426 type PEXCEPTION_ROUTINE as function(byval ExceptionRecord as _EXCEPTION_RECORD ptr, byval EstablisherFrame as PVOID, byval ContextRecord as _CONTEXT ptr, byval DispatcherContext as PVOID) as long
  427 const VER_WORKSTATION_NT = &h40000000
  428 const VER_SERVER_NT = &h80000000
  429 const VER_SUITE_SMALLBUSINESS = &h00000001
  430 const VER_SUITE_ENTERPRISE = &h00000002
  431 const VER_SUITE_BACKOFFICE = &h00000004
  432 const VER_SUITE_COMMUNICATIONS = &h00000008
  433 const VER_SUITE_TERMINAL = &h00000010
  434 const VER_SUITE_SMALLBUSINESS_RESTRICTED = &h00000020
  435 const VER_SUITE_EMBEDDEDNT = &h00000040
  436 const VER_SUITE_DATACENTER = &h00000080
  437 const VER_SUITE_SINGLEUSERTS = &h00000100
  438 const VER_SUITE_PERSONAL = &h00000200
  439 const VER_SUITE_BLADE = &h00000400
  440 const VER_SUITE_EMBEDDED_RESTRICTED = &h00000800
  441 const VER_SUITE_SECURITY_APPLIANCE = &h00001000
  442 const VER_SUITE_STORAGE_SERVER = &h00002000
  443 const VER_SUITE_COMPUTE_SERVER = &h00004000
  444 const VER_SUITE_WH_SERVER = &h00008000
  445 const PRODUCT_UNDEFINED = &h0
  446 const PRODUCT_ULTIMATE = &h1
  447 const PRODUCT_HOME_BASIC = &h2
  448 const PRODUCT_HOME_PREMIUM = &h3
  449 const PRODUCT_ENTERPRISE = &h4
  450 const PRODUCT_HOME_BASIC_N = &h5
  451 const PRODUCT_BUSINESS = &h6
  452 const PRODUCT_STANDARD_SERVER = &h7
  453 const PRODUCT_DATACENTER_SERVER = &h8
  454 const PRODUCT_SMALLBUSINESS_SERVER = &h9
  455 const PRODUCT_ENTERPRISE_SERVER = &ha
  456 const PRODUCT_STARTER = &hb
  457 const PRODUCT_DATACENTER_SERVER_CORE = &hc
  458 const PRODUCT_STANDARD_SERVER_CORE = &hd
  459 const PRODUCT_ENTERPRISE_SERVER_CORE = &he
  460 const PRODUCT_ENTERPRISE_SERVER_IA64 = &hf
  461 const PRODUCT_BUSINESS_N = &h10
  462 const PRODUCT_WEB_SERVER = &h11
  463 const PRODUCT_CLUSTER_SERVER = &h12
  464 const PRODUCT_HOME_SERVER = &h13
  465 const PRODUCT_STORAGE_EXPRESS_SERVER = &h14
  466 const PRODUCT_STORAGE_STANDARD_SERVER = &h15
  467 const PRODUCT_STORAGE_WORKGROUP_SERVER = &h16
  468 const PRODUCT_STORAGE_ENTERPRISE_SERVER = &h17
  469 const PRODUCT_SERVER_FOR_SMALLBUSINESS = &h18
  470 const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = &h19
  471 const PRODUCT_HOME_PREMIUM_N = &h1a
  472 const PRODUCT_ENTERPRISE_N = &h1b
  473 const PRODUCT_ULTIMATE_N = &h1c
  474 const PRODUCT_WEB_SERVER_CORE = &h1d
  475 const PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT = &h1e
  476 const PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY = &h1f
  477 const PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING = &h20
  478 const PRODUCT_SERVER_FOUNDATION = &h21
  479 const PRODUCT_HOME_PREMIUM_SERVER = &h22
  480 const PRODUCT_SERVER_FOR_SMALLBUSINESS_V = &h23
  481 const PRODUCT_STANDARD_SERVER_V = &h24
  482 const PRODUCT_DATACENTER_SERVER_V = &h25
  483 const PRODUCT_ENTERPRISE_SERVER_V = &h26
  484 const PRODUCT_DATACENTER_SERVER_CORE_V = &h27
  485 const PRODUCT_STANDARD_SERVER_CORE_V = &h28
  486 const PRODUCT_ENTERPRISE_SERVER_CORE_V = &h29
  487 const PRODUCT_HYPERV = &h2a
  488 const PRODUCT_STORAGE_EXPRESS_SERVER_CORE = &h2b
  489 const PRODUCT_STORAGE_STANDARD_SERVER_CORE = &h2c
  490 const PRODUCT_STORAGE_WORKGROUP_SERVER_CORE = &h2d
  491 const PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE = &h2e
  492 const PRODUCT_STARTER_N = &h2f
  493 const PRODUCT_PROFESSIONAL = &h30
  494 const PRODUCT_PROFESSIONAL_N = &h31
  495 const PRODUCT_SB_SOLUTION_SERVER = &h32
  496 const PRODUCT_SERVER_FOR_SB_SOLUTIONS = &h33
  497 const PRODUCT_STANDARD_SERVER_SOLUTIONS = &h34
  498 const PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE = &h35
  499 const PRODUCT_SB_SOLUTION_SERVER_EM = &h36
  500 const PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM = &h37
  501 const PRODUCT_SOLUTION_EMBEDDEDSERVER = &h38
  502 const PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE = &h39
  503 const PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT = &h3B
  504 const PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL = &h3C
  505 const PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC = &h3D
  506 const PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC = &h3E
  507 const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE = &h3f
  508 const PRODUCT_CLUSTER_SERVER_V = &h40
  509 const PRODUCT_EMBEDDED = &h41
  510 const PRODUCT_STARTER_E = &h42
  511 const PRODUCT_HOME_BASIC_E = &h43
  512 const PRODUCT_HOME_PREMIUM_E = &h44
  513 const PRODUCT_PROFESSIONAL_E = &h45
  514 const PRODUCT_ENTERPRISE_E = &h46
  515 const PRODUCT_ULTIMATE_E = &h47
  516 const PRODUCT_ENTERPRISE_EVALUATION = &h48
  517 const PRODUCT_MULTIPOINT_STANDARD_SERVER = &h4C
  518 const PRODUCT_MULTIPOINT_PREMIUM_SERVER = &h4D
  519 const PRODUCT_STANDARD_EVALUATION_SERVER = &h4F
  520 const PRODUCT_DATACENTER_EVALUATION_SERVER = &h50
  521 const PRODUCT_ENTERPRISE_N_EVALUATION = &h54
  522 const PRODUCT_EMBEDDED_AUTOMOTIVE = &h55
  523 const PRODUCT_EMBEDDED_INDUSTRY_A = &h56
  524 const PRODUCT_THINPC = &h57
  525 const PRODUCT_EMBEDDED_A = &h58
  526 const PRODUCT_EMBEDDED_INDUSTRY = &h59
  527 const PRODUCT_EMBEDDED_E = &h5A
  528 const PRODUCT_EMBEDDED_INDUSTRY_E = &h5B
  529 const PRODUCT_EMBEDDED_INDUSTRY_A_E = &h5C
  530 const PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER = &h5F
  531 const PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER = &h60
  532 const PRODUCT_CORE_ARM = &h61
  533 const PRODUCT_CORE_N = &h62
  534 const PRODUCT_CORE_COUNTRYSPECIFIC = &h63
  535 const PRODUCT_CORE_SINGLELANGUAGE = &h64
  536 const PRODUCT_CORE = &h65
  537 const PRODUCT_PROFESSIONAL_WMC = &h67
  538 const PRODUCT_MOBILE_CORE = &h68
  539 const PRODUCT_UNLICENSED = &habcdabcd
  540 const LANG_NEUTRAL = &h00
  541 const LANG_INVARIANT = &h7f
  542 const LANG_AFRIKAANS = &h36
  543 const LANG_ALBANIAN = &h1c
  544 const LANG_ALSATIAN = &h84
  545 const LANG_AMHARIC = &h5e
  546 const LANG_ARABIC = &h01
  547 const LANG_ARMENIAN = &h2b
  548 const LANG_ASSAMESE = &h4d
  549 const LANG_AZERI = &h2c
  550 const LANG_AZERBAIJANI = &h2c
  551 const LANG_BANGLA = &h45
  552 const LANG_BASHKIR = &h6d
  553 const LANG_BASQUE = &h2d
  554 const LANG_BELARUSIAN = &h23
  555 const LANG_BENGALI = &h45
  556 const LANG_BRETON = &h7e
  557 const LANG_BOSNIAN = &h1a
  558 const LANG_BOSNIAN_NEUTRAL = &h781a
  559 const LANG_BULGARIAN = &h02
  560 const LANG_CATALAN = &h03
  561 const LANG_CENTRAL_KURDISH = &h92
  562 const LANG_CHEROKEE = &h5c
  563 const LANG_CHINESE = &h04
  564 const LANG_CHINESE_SIMPLIFIED = &h04
  565 const LANG_CHINESE_TRADITIONAL = &h7c04
  566 const LANG_CORSICAN = &h83
  567 const LANG_CROATIAN = &h1a
  568 const LANG_CZECH = &h05
  569 const LANG_DANISH = &h06
  570 const LANG_DARI = &h8c
  571 const LANG_DIVEHI = &h65
  572 const LANG_DUTCH = &h13
  573 const LANG_ENGLISH = &h09
  574 const LANG_ESTONIAN = &h25
  575 const LANG_FAEROESE = &h38
  576 const LANG_FARSI = &h29
  577 const LANG_FILIPINO = &h64
  578 const LANG_FINNISH = &h0b
  579 const LANG_FRENCH = &h0c
  580 const LANG_FRISIAN = &h62
  581 const LANG_FULAH = &h67
  582 const LANG_GALICIAN = &h56
  583 const LANG_GEORGIAN = &h37
  584 const LANG_GERMAN = &h07
  585 const LANG_GREEK = &h08
  586 const LANG_GREENLANDIC = &h6f
  587 const LANG_GUJARATI = &h47
  588 const LANG_HAUSA = &h68
  589 const LANG_HEBREW = &h0d
  590 const LANG_HINDI = &h39
  591 const LANG_HUNGARIAN = &h0e
  592 const LANG_ICELANDIC = &h0f
  593 const LANG_IGBO = &h70
  594 const LANG_INDONESIAN = &h21
  595 const LANG_INUKTITUT = &h5d
  596 const LANG_IRISH = &h3c
  597 const LANG_ITALIAN = &h10
  598 const LANG_JAPANESE = &h11
  599 const LANG_KANNADA = &h4b
  600 const LANG_KASHMIRI = &h60
  601 const LANG_KAZAK = &h3f
  602 const LANG_KHMER = &h53
  603 const LANG_KICHE = &h86
  604 const LANG_KINYARWANDA = &h87
  605 const LANG_KONKANI = &h57
  606 const LANG_KOREAN = &h12
  607 const LANG_KYRGYZ = &h40
  608 const LANG_LAO = &h54
  609 const LANG_LATVIAN = &h26
  610 const LANG_LITHUANIAN = &h27
  611 const LANG_LOWER_SORBIAN = &h2e
  612 const LANG_LUXEMBOURGISH = &h6e
  613 const LANG_MACEDONIAN = &h2f
  614 const LANG_MALAY = &h3e
  615 const LANG_MALAYALAM = &h4c
  616 const LANG_MALTESE = &h3a
  617 const LANG_MANIPURI = &h58
  618 const LANG_MAORI = &h81
  619 const LANG_MAPUDUNGUN = &h7a
  620 const LANG_MARATHI = &h4e
  621 const LANG_MOHAWK = &h7c
  622 const LANG_MONGOLIAN = &h50
  623 const LANG_NEPALI = &h61
  624 const LANG_NORWEGIAN = &h14
  625 const LANG_OCCITAN = &h82
  626 const LANG_ODIA = &h48
  627 const LANG_ORIYA = &h48
  628 const LANG_PASHTO = &h63
  629 const LANG_PERSIAN = &h29
  630 const LANG_POLISH = &h15
  631 const LANG_PORTUGUESE = &h16
  632 const LANG_PULAR = &h67
  633 const LANG_PUNJABI = &h46
  634 const LANG_QUECHUA = &h6b
  635 const LANG_ROMANIAN = &h18
  636 const LANG_ROMANSH = &h17
  637 const LANG_RUSSIAN = &h19
  638 const LANG_SAKHA = &h85
  639 const LANG_SAMI = &h3b
  640 const LANG_SANSKRIT = &h4f
  641 const LANG_SCOTTISH_GAELIC = &h91
  642 const LANG_SERBIAN = &h1a
  643 const LANG_SERBIAN_NEUTRAL = &h7c1a
  644 const LANG_SINDHI = &h59
  645 const LANG_SINHALESE = &h5b
  646 const LANG_SLOVAK = &h1b
  647 const LANG_SLOVENIAN = &h24
  648 const LANG_SOTHO = &h6c
  649 const LANG_SPANISH = &h0a
  650 const LANG_SWAHILI = &h41
  651 const LANG_SWEDISH = &h1d
  652 const LANG_SYRIAC = &h5a
  653 const LANG_TAJIK = &h28
  654 const LANG_TAMAZIGHT = &h5f
  655 const LANG_TAMIL = &h49
  656 const LANG_TATAR = &h44
  657 const LANG_TELUGU = &h4a
  658 const LANG_THAI = &h1e
  659 const LANG_TIBETAN = &h51
  660 const LANG_TIGRIGNA = &h73
  661 const LANG_TIGRINYA = &h73
  662 const LANG_TSWANA = &h32
  663 const LANG_TURKISH = &h1f
  664 const LANG_TURKMEN = &h42
  665 const LANG_UIGHUR = &h80
  666 const LANG_UKRAINIAN = &h22
  667 const LANG_UPPER_SORBIAN = &h2e
  668 const LANG_URDU = &h20
  669 const LANG_UZBEK = &h43
  670 const LANG_VALENCIAN = &h03
  671 const LANG_VIETNAMESE = &h2a
  672 const LANG_WELSH = &h52
  673 const LANG_WOLOF = &h88
  674 const LANG_XHOSA = &h34
  675 const LANG_YAKUT = &h85
  676 const LANG_YI = &h78
  677 const LANG_YORUBA = &h6a
  678 const LANG_ZULU = &h35
  679 const SUBLANG_NEUTRAL = &h00
  680 const SUBLANG_DEFAULT = &h01
  681 const SUBLANG_SYS_DEFAULT = &h02
  682 const SUBLANG_CUSTOM_DEFAULT = &h03
  683 const SUBLANG_CUSTOM_UNSPECIFIED = &h04
  684 const SUBLANG_UI_CUSTOM_DEFAULT = &h05
  685 const SUBLANG_AFRIKAANS_SOUTH_AFRICA = &h01
  686 const SUBLANG_ALBANIAN_ALBANIA = &h01
  687 const SUBLANG_ALSATIAN_FRANCE = &h01
  688 const SUBLANG_AMHARIC_ETHIOPIA = &h01
  689 const SUBLANG_ARABIC_SAUDI_ARABIA = &h01
  690 const SUBLANG_ARABIC_IRAQ = &h02
  691 const SUBLANG_ARABIC_EGYPT = &h03
  692 const SUBLANG_ARABIC_LIBYA = &h04
  693 const SUBLANG_ARABIC_ALGERIA = &h05
  694 const SUBLANG_ARABIC_MOROCCO = &h06
  695 const SUBLANG_ARABIC_TUNISIA = &h07
  696 const SUBLANG_ARABIC_OMAN = &h08
  697 const SUBLANG_ARABIC_YEMEN = &h09
  698 const SUBLANG_ARABIC_SYRIA = &h0a
  699 const SUBLANG_ARABIC_JORDAN = &h0b
  700 const SUBLANG_ARABIC_LEBANON = &h0c
  701 const SUBLANG_ARABIC_KUWAIT = &h0d
  702 const SUBLANG_ARABIC_UAE = &h0e
  703 const SUBLANG_ARABIC_BAHRAIN = &h0f
  704 const SUBLANG_ARABIC_QATAR = &h10
  705 const SUBLANG_ARMENIAN_ARMENIA = &h01
  706 const SUBLANG_ASSAMESE_INDIA = &h01
  707 const SUBLANG_AZERI_LATIN = &h01
  708 const SUBLANG_AZERI_CYRILLIC = &h02
  709 const SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN = &h01
  710 const SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC = &h02
  711 const SUBLANG_BANGLA_INDIA = &h01
  712 const SUBLANG_BANGLA_BANGLADESH = &h02
  713 const SUBLANG_BASHKIR_RUSSIA = &h01
  714 const SUBLANG_BASQUE_BASQUE = &h01
  715 const SUBLANG_BELARUSIAN_BELARUS = &h01
  716 const SUBLANG_BENGALI_INDIA = &h01
  717 const SUBLANG_BENGALI_BANGLADESH = &h02
  718 const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN = &h05
  719 const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC = &h08
  720 const SUBLANG_BRETON_FRANCE = &h01
  721 const SUBLANG_BULGARIAN_BULGARIA = &h01
  722 const SUBLANG_CATALAN_CATALAN = &h01
  723 const SUBLANG_CENTRAL_KURDISH_IRAQ = &h01
  724 const SUBLANG_CHEROKEE_CHEROKEE = &h01
  725 const SUBLANG_CHINESE_TRADITIONAL = &h01
  726 const SUBLANG_CHINESE_SIMPLIFIED = &h02
  727 const SUBLANG_CHINESE_HONGKONG = &h03
  728 const SUBLANG_CHINESE_SINGAPORE = &h04
  729 const SUBLANG_CHINESE_MACAU = &h05
  730 const SUBLANG_CORSICAN_FRANCE = &h01
  731 const SUBLANG_CZECH_CZECH_REPUBLIC = &h01
  732 const SUBLANG_CROATIAN_CROATIA = &h01
  733 const SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN = &h04
  734 const SUBLANG_DANISH_DENMARK = &h01
  735 const SUBLANG_DARI_AFGHANISTAN = &h01
  736 const SUBLANG_DIVEHI_MALDIVES = &h01
  737 const SUBLANG_DUTCH = &h01
  738 const SUBLANG_DUTCH_BELGIAN = &h02
  739 const SUBLANG_ENGLISH_US = &h01
  740 const SUBLANG_ENGLISH_UK = &h02
  741 const SUBLANG_ENGLISH_AUS = &h03
  742 const SUBLANG_ENGLISH_CAN = &h04
  743 const SUBLANG_ENGLISH_NZ = &h05
  744 const SUBLANG_ENGLISH_IRELAND = &h06
  745 const SUBLANG_ENGLISH_EIRE = &h06
  746 const SUBLANG_ENGLISH_SOUTH_AFRICA = &h07
  747 const SUBLANG_ENGLISH_JAMAICA = &h08
  748 const SUBLANG_ENGLISH_CARIBBEAN = &h09
  749 const SUBLANG_ENGLISH_BELIZE = &h0a
  750 const SUBLANG_ENGLISH_TRINIDAD = &h0b
  751 const SUBLANG_ENGLISH_ZIMBABWE = &h0c
  752 const SUBLANG_ENGLISH_PHILIPPINES = &h0d
  753 const SUBLANG_ENGLISH_INDIA = &h10
  754 const SUBLANG_ENGLISH_MALAYSIA = &h11
  755 const SUBLANG_ENGLISH_SINGAPORE = &h12
  756 const SUBLANG_ESTONIAN_ESTONIA = &h01
  757 const SUBLANG_FAEROESE_FAROE_ISLANDS = &h01
  758 const SUBLANG_FILIPINO_PHILIPPINES = &h01
  759 const SUBLANG_FINNISH_FINLAND = &h01
  760 const SUBLANG_FRENCH = &h01
  761 const SUBLANG_FRENCH_BELGIAN = &h02
  762 const SUBLANG_FRENCH_CANADIAN = &h03
  763 const SUBLANG_FRENCH_SWISS = &h04
  764 const SUBLANG_FRENCH_LUXEMBOURG = &h05
  765 const SUBLANG_FRENCH_MONACO = &h06
  766 const SUBLANG_FRISIAN_NETHERLANDS = &h01
  767 const SUBLANG_FULAH_SENEGAL = &h02
  768 const SUBLANG_GALICIAN_GALICIAN = &h01
  769 const SUBLANG_GEORGIAN_GEORGIA = &h01
  770 const SUBLANG_GERMAN = &h01
  771 const SUBLANG_GERMAN_SWISS = &h02
  772 const SUBLANG_GERMAN_AUSTRIAN = &h03
  773 const SUBLANG_GERMAN_LUXEMBOURG = &h04
  774 const SUBLANG_GERMAN_LIECHTENSTEIN = &h05
  775 const SUBLANG_GREEK_GREECE = &h01
  776 const SUBLANG_GREENLANDIC_GREENLAND = &h01
  777 const SUBLANG_GUJARATI_INDIA = &h01
  778 const SUBLANG_HAUSA_NIGERIA_LATIN = &h01
  779 const SUBLANG_HAUSA_NIGERIA = SUBLANG_HAUSA_NIGERIA_LATIN
  780 const SUBLANG_HAWAIIAN_US = &h01
  781 const SUBLANG_HEBREW_ISRAEL = &h01
  782 const SUBLANG_HINDI_INDIA = &h01
  783 const SUBLANG_HUNGARIAN_HUNGARY = &h01
  784 const SUBLANG_ICELANDIC_ICELAND = &h01
  785 const SUBLANG_IGBO_NIGERIA = &h01
  786 const SUBLANG_INDONESIAN_INDONESIA = &h01
  787 const SUBLANG_INUKTITUT_CANADA = &h01
  788 const SUBLANG_INUKTITUT_CANADA_LATIN = &h02
  789 const SUBLANG_IRISH_IRELAND = &h02
  790 const SUBLANG_ITALIAN = &h01
  791 const SUBLANG_ITALIAN_SWISS = &h02
  792 const SUBLANG_JAPANESE_JAPAN = &h01
  793 const SUBLANG_KANNADA_INDIA = &h01
  794 const SUBLANG_KASHMIRI_INDIA = &h02
  795 const SUBLANG_KASHMIRI_SASIA = &h02
  796 const SUBLANG_KAZAK_KAZAKHSTAN = &h01
  797 const SUBLANG_KHMER_CAMBODIA = &h01
  798 const SUBLANG_KICHE_GUATEMALA = &h01
  799 const SUBLANG_KINYARWANDA_RWANDA = &h01
  800 const SUBLANG_KONKANI_INDIA = &h01
  801 const SUBLANG_KOREAN = &h01
  802 const SUBLANG_KYRGYZ_KYRGYZSTAN = &h01
  803 const SUBLANG_LAO_LAO = &h01
  804 const SUBLANG_LAO_LAO_PDR = SUBLANG_LAO_LAO
  805 const SUBLANG_LATVIAN_LATVIA = &h01
  806 
  807 #if _WIN32_WINNT = &h0602
  808     const SUBLANG_LITHUANIAN_LITHUANIA = &h01
  809 #endif
  810 
  811 const SUBLANG_LITHUANIAN = &h01
  812 const SUBLANG_LOWER_SORBIAN_GERMANY = &h02
  813 const SUBLANG_LUXEMBOURGISH_LUXEMBOURG = &h01
  814 const SUBLANG_MACEDONIAN_MACEDONIA = &h01
  815 const SUBLANG_MALAY_MALAYSIA = &h01
  816 const SUBLANG_MALAY_BRUNEI_DARUSSALAM = &h02
  817 const SUBLANG_MALAYALAM_INDIA = &h01
  818 const SUBLANG_MALTESE_MALTA = &h01
  819 const SUBLANG_MAORI_NEW_ZEALAND = &h01
  820 const SUBLANG_MAPUDUNGUN_CHILE = &h01
  821 const SUBLANG_MARATHI_INDIA = &h01
  822 const SUBLANG_MOHAWK_MOHAWK = &h01
  823 const SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA = &h01
  824 const SUBLANG_MONGOLIAN_PRC = &h02
  825 const SUBLANG_NEPALI_NEPAL = &h01
  826 const SUBLANG_NEPALI_INDIA = &h02
  827 const SUBLANG_NORWEGIAN_BOKMAL = &h01
  828 const SUBLANG_NORWEGIAN_NYNORSK = &h02
  829 const SUBLANG_OCCITAN_FRANCE = &h01
  830 const SUBLANG_ORIYA_INDIA = &h01
  831 const SUBLANG_PASHTO_AFGHANISTAN = &h01
  832 const SUBLANG_PERSIAN_IRAN = &h01
  833 const SUBLANG_POLISH_POLAND = &h01
  834 const SUBLANG_PORTUGUESE_BRAZILIAN = &h01
  835 
  836 #if _WIN32_WINNT = &h0602
  837     const SUBLANG_PORTUGUESE_PORTUGAL = &h02
  838 #endif
  839 
  840 const SUBLANG_PORTUGUESE = &h02
  841 const SUBLANG_PULAR_SENEGAL = &h02
  842 const SUBLANG_PUNJABI_INDIA = &h01
  843 const SUBLANG_PUNJABI_PAKISTAN = &h02
  844 const SUBLANG_QUECHUA_BOLIVIA = &h01
  845 const SUBLANG_QUECHUA_ECUADOR = &h02
  846 const SUBLANG_QUECHUA_PERU = &h03
  847 const SUBLANG_ROMANIAN_ROMANIA = &h01
  848 const SUBLANG_ROMANSH_SWITZERLAND = &h01
  849 const SUBLANG_RUSSIAN_RUSSIA = &h01
  850 const SUBLANG_SAKHA_RUSSIA = &h01
  851 const SUBLANG_SAMI_NORTHERN_NORWAY = &h01
  852 const SUBLANG_SAMI_NORTHERN_SWEDEN = &h02
  853 const SUBLANG_SAMI_NORTHERN_FINLAND = &h03
  854 const SUBLANG_SAMI_LULE_NORWAY = &h04
  855 const SUBLANG_SAMI_LULE_SWEDEN = &h05
  856 const SUBLANG_SAMI_SOUTHERN_NORWAY = &h06
  857 const SUBLANG_SAMI_SOUTHERN_SWEDEN = &h07
  858 const SUBLANG_SAMI_SKOLT_FINLAND = &h08
  859 const SUBLANG_SAMI_INARI_FINLAND = &h09
  860 const SUBLANG_SANSKRIT_INDIA = &h01
  861 const SUBLANG_SCOTTISH_GAELIC = &h01
  862 const SUBLANG_SERBIAN_LATIN = &h02
  863 const SUBLANG_SERBIAN_CYRILLIC = &h03
  864 const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN = &h06
  865 const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC = &h07
  866 const SUBLANG_SERBIAN_MONTENEGRO_LATIN = &h0b
  867 const SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC = &h0c
  868 const SUBLANG_SERBIAN_SERBIA_LATIN = &h09
  869 const SUBLANG_SERBIAN_SERBIA_CYRILLIC = &h0a
  870 const SUBLANG_SINDHI_INDIA = &h01
  871 const SUBLANG_SINDHI_AFGHANISTAN = &h02
  872 const SUBLANG_SINDHI_PAKISTAN = &h02
  873 const SUBLANG_SINHALESE_SRI_LANKA = &h01
  874 const SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA = &h01
  875 const SUBLANG_SLOVAK_SLOVAKIA = &h01
  876 const SUBLANG_SLOVENIAN_SLOVENIA = &h01
  877 const SUBLANG_SPANISH = &h01
  878 const SUBLANG_SPANISH_MEXICAN = &h02
  879 const SUBLANG_SPANISH_MODERN = &h03
  880 const SUBLANG_SPANISH_GUATEMALA = &h04
  881 const SUBLANG_SPANISH_COSTA_RICA = &h05
  882 const SUBLANG_SPANISH_PANAMA = &h06
  883 const SUBLANG_SPANISH_DOMINICAN_REPUBLIC = &h07
  884 const SUBLANG_SPANISH_VENEZUELA = &h08
  885 const SUBLANG_SPANISH_COLOMBIA = &h09
  886 const SUBLANG_SPANISH_PERU = &h0a
  887 const SUBLANG_SPANISH_ARGENTINA = &h0b
  888 const SUBLANG_SPANISH_ECUADOR = &h0c
  889 const SUBLANG_SPANISH_CHILE = &h0d
  890 const SUBLANG_SPANISH_URUGUAY = &h0e
  891 const SUBLANG_SPANISH_PARAGUAY = &h0f
  892 const SUBLANG_SPANISH_BOLIVIA = &h10
  893 const SUBLANG_SPANISH_EL_SALVADOR = &h11
  894 const SUBLANG_SPANISH_HONDURAS = &h12
  895 const SUBLANG_SPANISH_NICARAGUA = &h13
  896 const SUBLANG_SPANISH_PUERTO_RICO = &h14
  897 const SUBLANG_SPANISH_US = &h15
  898 const SUBLANG_SWAHILI_KENYA = &h01
  899 
  900 #if _WIN32_WINNT = &h0602
  901     const SUBLANG_SWEDISH_SWEDEN = &h01
  902 #endif
  903 
  904 const SUBLANG_SWEDISH = &h01
  905 const SUBLANG_SWEDISH_FINLAND = &h02
  906 const SUBLANG_SYRIAC = &h01
  907 const SUBLANG_SYRIAC_SYRIA = SUBLANG_SYRIAC
  908 const SUBLANG_TAJIK_TAJIKISTAN = &h01
  909 const SUBLANG_TAMAZIGHT_ALGERIA_LATIN = &h02
  910 const SUBLANG_TAMAZIGHT_MOROCCO_TIFINAGH = &h04
  911 const SUBLANG_TAMIL_INDIA = &h01
  912 const SUBLANG_TAMIL_SRI_LANKA = &h02
  913 const SUBLANG_TATAR_RUSSIA = &h01
  914 const SUBLANG_TELUGU_INDIA = &h01
  915 const SUBLANG_THAI_THAILAND = &h01
  916 const SUBLANG_TIBETAN_PRC = &h01
  917 const SUBLANG_TIBETAN_BHUTAN = &h02
  918 const SUBLANG_TIGRIGNA_ERITREA = &h02
  919 const SUBLANG_TIGRINYA_ERITREA = &h02
  920 const SUBLANG_TIGRINYA_ETHIOPIA = &h01
  921 const SUBLANG_TSWANA_BOTSWANA = &h02
  922 const SUBLANG_TSWANA_SOUTH_AFRICA = &h01
  923 const SUBLANG_TURKISH_TURKEY = &h01
  924 const SUBLANG_TURKMEN_TURKMENISTAN = &h01
  925 const SUBLANG_UIGHUR_PRC = &h01
  926 const SUBLANG_UKRAINIAN_UKRAINE = &h01
  927 const SUBLANG_UPPER_SORBIAN_GERMANY = &h01
  928 const SUBLANG_URDU_PAKISTAN = &h01
  929 const SUBLANG_URDU_INDIA = &h02
  930 const SUBLANG_UZBEK_LATIN = &h01
  931 const SUBLANG_UZBEK_CYRILLIC = &h02
  932 const SUBLANG_VALENCIAN_VALENCIA = &h02
  933 const SUBLANG_VIETNAMESE_VIETNAM = &h01
  934 const SUBLANG_WELSH_UNITED_KINGDOM = &h01
  935 const SUBLANG_WOLOF_SENEGAL = &h01
  936 const SUBLANG_YORUBA_NIGERIA = &h01
  937 const SUBLANG_XHOSA_SOUTH_AFRICA = &h01
  938 const SUBLANG_YAKUT_RUSSIA = &h01
  939 const SUBLANG_YI_PRC = &h01
  940 const SUBLANG_ZULU_SOUTH_AFRICA = &h01
  941 const SORT_DEFAULT = &h0
  942 const SORT_INVARIANT_MATH = &h1
  943 const SORT_JAPANESE_XJIS = &h0
  944 const SORT_JAPANESE_UNICODE = &h1
  945 const SORT_JAPANESE_RADICALSTROKE = &h4
  946 const SORT_CHINESE_BIG5 = &h0
  947 const SORT_CHINESE_PRCP = &h0
  948 const SORT_CHINESE_UNICODE = &h1
  949 const SORT_CHINESE_PRC = &h2
  950 const SORT_CHINESE_BOPOMOFO = &h3
  951 const SORT_CHINESE_RADICALSTROKE = &h4
  952 const SORT_KOREAN_KSC = &h0
  953 const SORT_KOREAN_UNICODE = &h1
  954 const SORT_GERMAN_PHONE_BOOK = &h1
  955 const SORT_HUNGARIAN_DEFAULT = &h0
  956 const SORT_HUNGARIAN_TECHNICAL = &h1
  957 const SORT_GEORGIAN_TRADITIONAL = &h0
  958 const SORT_GEORGIAN_MODERN = &h1
  959 #define MAKELANGID(p, s) ((cast(WORD, (s)) shl 10) or cast(WORD, (p)))
  960 #define PRIMARYLANGID(lgid) (cast(WORD, (lgid)) and &h3ff)
  961 #define SUBLANGID(lgid) (cast(WORD, (lgid)) shr 10)
  962 const NLS_VALID_LOCALE_MASK = &h000fffff
  963 #define MAKELCID(lgid, srtid) cast(DWORD, (cast(DWORD, cast(WORD, (srtid))) shl 16) or cast(DWORD, cast(WORD, (lgid))))
  964 #define MAKESORTLCID(lgid, srtid, ver) cast(DWORD, MAKELCID(lgid, srtid) or (cast(DWORD, cast(WORD, (ver))) shl 20))
  965 #define LANGIDFROMLCID(lcid) cast(WORD, (lcid))
  966 #define SORTIDFROMLCID(lcid) cast(WORD, (cast(DWORD, (lcid)) shr 16) and &hf)
  967 #define SORTVERSIONFROMLCID(lcid) cast(WORD, (cast(DWORD, (lcid)) shr 20) and &hf)
  968 const LOCALE_NAME_MAX_LENGTH = 85
  969 #define LANG_SYSTEM_DEFAULT MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT)
  970 #define LANG_USER_DEFAULT MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)
  971 #define LOCALE_SYSTEM_DEFAULT MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT)
  972 #define LOCALE_USER_DEFAULT MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT)
  973 #define LOCALE_NEUTRAL MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT)
  974 #define LOCALE_CUSTOM_DEFAULT MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT)
  975 #define LOCALE_CUSTOM_UNSPECIFIED MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT)
  976 #define LOCALE_CUSTOM_UI_DEFAULT MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT)
  977 #define LOCALE_INVARIANT MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT)
  978 #define DEFAULT_UNREACHABLE
  979 const STATUS_WAIT_0 = cast(DWORD, &h00000000)
  980 const STATUS_ABANDONED_WAIT_0 = cast(DWORD, &h00000080)
  981 const STATUS_USER_APC = cast(DWORD, &h000000C0)
  982 const STATUS_TIMEOUT = cast(DWORD, &h00000102)
  983 const STATUS_PENDING = cast(DWORD, &h00000103)
  984 const DBG_EXCEPTION_HANDLED = cast(DWORD, &h00010001)
  985 const DBG_CONTINUE = cast(DWORD, &h00010002)
  986 const STATUS_SEGMENT_NOTIFICATION = cast(DWORD, &h40000005)
  987 const STATUS_FATAL_APP_EXIT = cast(DWORD, &h40000015)
  988 const DBG_TERMINATE_THREAD = cast(DWORD, &h40010003)
  989 const DBG_TERMINATE_PROCESS = cast(DWORD, &h40010004)
  990 const DBG_CONTROL_C = cast(DWORD, &h40010005)
  991 const DBG_PRINTEXCEPTION_C = cast(DWORD, &h40010006)
  992 const DBG_RIPEXCEPTION = cast(DWORD, &h40010007)
  993 const DBG_CONTROL_BREAK = cast(DWORD, &h40010008)
  994 const DBG_COMMAND_EXCEPTION = cast(DWORD, &h40010009)
  995 const STATUS_GUARD_PAGE_VIOLATION = cast(DWORD, &h80000001)
  996 const STATUS_DATATYPE_MISALIGNMENT = cast(DWORD, &h80000002)
  997 const STATUS_BREAKPOINT = cast(DWORD, &h80000003)
  998 const STATUS_SINGLE_STEP = cast(DWORD, &h80000004)
  999 const STATUS_LONGJUMP = cast(DWORD, &h80000026)
 1000 const STATUS_UNWIND_CONSOLIDATE = cast(DWORD, &h80000029)
 1001 const DBG_EXCEPTION_NOT_HANDLED = cast(DWORD, &h80010001)
 1002 const STATUS_ACCESS_VIOLATION = cast(DWORD, &hC0000005)
 1003 const STATUS_IN_PAGE_ERROR = cast(DWORD, &hC0000006)
 1004 const STATUS_INVALID_HANDLE = cast(DWORD, &hC0000008)
 1005 const STATUS_INVALID_PARAMETER = cast(DWORD, &hC000000D)
 1006 const STATUS_NO_MEMORY = cast(DWORD, &hC0000017)
 1007 const STATUS_ILLEGAL_INSTRUCTION = cast(DWORD, &hC000001D)
 1008 const STATUS_NONCONTINUABLE_EXCEPTION = cast(DWORD, &hC0000025)
 1009 const STATUS_INVALID_DISPOSITION = cast(DWORD, &hC0000026)
 1010 const STATUS_ARRAY_BOUNDS_EXCEEDED = cast(DWORD, &hC000008C)
 1011 const STATUS_FLOAT_DENORMAL_OPERAND = cast(DWORD, &hC000008D)
 1012 const STATUS_FLOAT_DIVIDE_BY_ZERO = cast(DWORD, &hC000008E)
 1013 const STATUS_FLOAT_INEXACT_RESULT = cast(DWORD, &hC000008F)
 1014 const STATUS_FLOAT_INVALID_OPERATION = cast(DWORD, &hC0000090)
 1015 const STATUS_FLOAT_OVERFLOW = cast(DWORD, &hC0000091)
 1016 const STATUS_FLOAT_STACK_CHECK = cast(DWORD, &hC0000092)
 1017 const STATUS_FLOAT_UNDERFLOW = cast(DWORD, &hC0000093)
 1018 const STATUS_INTEGER_DIVIDE_BY_ZERO = cast(DWORD, &hC0000094)
 1019 const STATUS_INTEGER_OVERFLOW = cast(DWORD, &hC0000095)
 1020 const STATUS_PRIVILEGED_INSTRUCTION = cast(DWORD, &hC0000096)
 1021 const STATUS_STACK_OVERFLOW = cast(DWORD, &hC00000FD)
 1022 const STATUS_DLL_NOT_FOUND = cast(DWORD, &hC0000135)
 1023 const STATUS_ORDINAL_NOT_FOUND = cast(DWORD, &hC0000138)
 1024 const STATUS_ENTRYPOINT_NOT_FOUND = cast(DWORD, &hC0000139)
 1025 const STATUS_CONTROL_C_EXIT = cast(DWORD, &hC000013A)
 1026 const STATUS_DLL_INIT_FAILED = cast(DWORD, &hC0000142)
 1027 const STATUS_FLOAT_MULTIPLE_FAULTS = cast(DWORD, &hC00002B4)
 1028 const STATUS_FLOAT_MULTIPLE_TRAPS = cast(DWORD, &hC00002B5)
 1029 const STATUS_REG_NAT_CONSUMPTION = cast(DWORD, &hC00002C9)
 1030 const STATUS_STACK_BUFFER_OVERRUN = cast(DWORD, &hC0000409)
 1031 const STATUS_INVALID_CRUNTIME_PARAMETER = cast(DWORD, &hC0000417)
 1032 const STATUS_ASSERTION_FAILURE = cast(DWORD, &hC0000420)
 1033 const STATUS_SXS_EARLY_DEACTIVATION = cast(DWORD, &hC015000F)
 1034 const STATUS_SXS_INVALID_DEACTIVATION = cast(DWORD, &hC0150010)
 1035 const MAXIMUM_WAIT_OBJECTS = 64
 1036 const MAXIMUM_SUSPEND_COUNT = MAXCHAR
 1037 type KSPIN_LOCK as ULONG_PTR
 1038 type PKSPIN_LOCK as KSPIN_LOCK ptr
 1039 
 1040 type _M128A
 1041     Low as ULONGLONG
 1042     High as LONGLONG
 1043 end type
 1044 
 1045 type M128A as _M128A
 1046 type PM128A as _M128A ptr
 1047 
 1048 type _XSAVE_FORMAT
 1049     ControlWord as WORD
 1050     StatusWord as WORD
 1051     TagWord as UBYTE
 1052     Reserved1 as UBYTE
 1053     ErrorOpcode as WORD
 1054     ErrorOffset as DWORD
 1055     ErrorSelector as WORD
 1056     Reserved2 as WORD
 1057     DataOffset as DWORD
 1058     DataSelector as WORD
 1059     Reserved3 as WORD
 1060     MxCsr as DWORD
 1061     MxCsr_Mask as DWORD
 1062     FloatRegisters(0 to 7) as M128A
 1063 
 1064     #ifdef __FB_64BIT__
 1065         XmmRegisters(0 to 15) as M128A
 1066         Reserved4(0 to 95) as UBYTE
 1067     #else
 1068         XmmRegisters(0 to 7) as M128A
 1069         Reserved4(0 to 219) as UBYTE
 1070         Cr0NpxState as DWORD
 1071     #endif
 1072 end type
 1073 
 1074 type XSAVE_FORMAT as _XSAVE_FORMAT
 1075 type PXSAVE_FORMAT as _XSAVE_FORMAT ptr
 1076 
 1077 type _XSAVE_AREA_HEADER
 1078     Mask as DWORD64
 1079     Reserved(0 to 6) as DWORD64
 1080 end type
 1081 
 1082 type XSAVE_AREA_HEADER as _XSAVE_AREA_HEADER
 1083 type PXSAVE_AREA_HEADER as _XSAVE_AREA_HEADER ptr
 1084 
 1085 type _XSAVE_AREA
 1086     LegacyState as XSAVE_FORMAT
 1087     Header as XSAVE_AREA_HEADER
 1088 end type
 1089 
 1090 type XSAVE_AREA as _XSAVE_AREA
 1091 type PXSAVE_AREA as _XSAVE_AREA ptr
 1092 
 1093 type _XSTATE_CONTEXT
 1094     Mask as DWORD64
 1095     Length as DWORD
 1096     Reserved1 as DWORD
 1097     Area as PXSAVE_AREA
 1098 
 1099     #ifndef __FB_64BIT__
 1100         Reserved2 as DWORD
 1101     #endif
 1102 
 1103     Buffer as PVOID
 1104 
 1105     #ifndef __FB_64BIT__
 1106         Reserved3 as DWORD
 1107     #endif
 1108 end type
 1109 
 1110 type XSTATE_CONTEXT as _XSTATE_CONTEXT
 1111 type PXSTATE_CONTEXT as _XSTATE_CONTEXT ptr
 1112 
 1113 type _SCOPE_TABLE_AMD64_ScopeRecord
 1114     BeginAddress as DWORD
 1115     EndAddress as DWORD
 1116     HandlerAddress as DWORD
 1117     JumpTarget as DWORD
 1118 end type
 1119 
 1120 type _SCOPE_TABLE_AMD64
 1121     Count as DWORD
 1122     ScopeRecord(0 to 0) as _SCOPE_TABLE_AMD64_ScopeRecord
 1123 end type
 1124 
 1125 type SCOPE_TABLE_AMD64 as _SCOPE_TABLE_AMD64
 1126 type PSCOPE_TABLE_AMD64 as _SCOPE_TABLE_AMD64 ptr
 1127 #define BitTest _bittest
 1128 #define BitTestAndComplement _bittestandcomplement
 1129 #define BitTestAndSet _bittestandset
 1130 #define BitTestAndReset _bittestandreset
 1131 
 1132 #ifdef __FB_64BIT__
 1133     #define BitTest64 _bittest64
 1134     #define BitTestAndComplement64 _bittestandcomplement64
 1135     #define BitTestAndSet64 _bittestandset64
 1136     #define BitTestAndReset64 _bittestandreset64
 1137 #endif
 1138 
 1139 #define BitScanForward _BitScanForward
 1140 #define BitScanReverse _BitScanReverse
 1141 
 1142 #ifdef __FB_64BIT__
 1143     #define BitScanForward64 _BitScanForward64
 1144     #define BitScanReverse64 _BitScanReverse64
 1145     #define InterlockedIncrement16 _InterlockedIncrement16
 1146     #define InterlockedDecrement16 _InterlockedDecrement16
 1147 #endif
 1148 
 1149 #define InterlockedCompareExchange16 _InterlockedCompareExchange16
 1150 
 1151 type _TEB as _TEB_
 1152 
 1153 #ifdef __FB_64BIT__
 1154     #define InterlockedAnd _InterlockedAnd
 1155     #define InterlockedOr _InterlockedOr
 1156     #define InterlockedXor _InterlockedXor
 1157     #define InterlockedIncrement _InterlockedIncrement
 1158     #define InterlockedIncrementAcquire InterlockedIncrement
 1159     #define InterlockedIncrementRelease InterlockedIncrement
 1160     #define InterlockedDecrement _InterlockedDecrement
 1161     #define InterlockedDecrementAcquire InterlockedDecrement
 1162     #define InterlockedDecrementRelease InterlockedDecrement
 1163     #define InterlockedAdd _InterlockedAdd
 1164     #define InterlockedExchange _InterlockedExchange
 1165     #define InterlockedExchangeAdd _InterlockedExchangeAdd
 1166     #define InterlockedCompareExchange _InterlockedCompareExchange
 1167     #define InterlockedCompareExchangeAcquire InterlockedCompareExchange
 1168     #define InterlockedCompareExchangeRelease InterlockedCompareExchange
 1169     #define InterlockedAnd64 _InterlockedAnd64
 1170     #define InterlockedAndAffinity InterlockedAnd64
 1171     #define InterlockedOr64 _InterlockedOr64
 1172     #define InterlockedOrAffinity InterlockedOr64
 1173     #define InterlockedXor64 _InterlockedXor64
 1174     #define InterlockedIncrement64 _InterlockedIncrement64
 1175     #define InterlockedDecrement64 _InterlockedDecrement64
 1176     #define InterlockedAdd64 _InterlockedAdd64
 1177     #define InterlockedExchange64 _InterlockedExchange64
 1178     #define InterlockedExchangeAcquire64 InterlockedExchange64
 1179     #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
 1180     #define InterlockedCompareExchange64 _InterlockedCompareExchange64
 1181     #define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64
 1182     #define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64
 1183     #define InterlockedExchangePointer _InterlockedExchangePointer
 1184     #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
 1185     #define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer
 1186     #define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer
 1187     #define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64(cptr(LONG64 ptr, a), b)
 1188     #define InterlockedIncrementSizeT(a) InterlockedIncrement64(cptr(LONG64 ptr, a))
 1189     #define InterlockedDecrementSizeT(a) InterlockedDecrement64(cptr(LONG64 ptr, a))
 1190     declare function _InterlockedAdd(byval Addend as LONG ptr, byval Value as LONG) as LONG
 1191     private function _InterlockedAdd(byval Addend as LONG ptr, byval Value as LONG) as LONG
 1192         return _InterlockedExchangeAdd(Addend, Value) + Value
 1193     end function
 1194     declare function _InterlockedAdd64(byval Addend as LONG64 ptr, byval Value as LONG64) as LONG64
 1195     private function _InterlockedAdd64(byval Addend as LONG64 ptr, byval Value as LONG64) as LONG64
 1196         return _InterlockedExchangeAdd64(Addend, Value) + Value
 1197     end function
 1198 #else
 1199     const PcTeb = &h18
 1200     #define NtCurrentTeb() cptr(_TEB ptr, __readfsdword(&h18))
 1201     #define GetCurrentFiber() cast(PVOID, __readfsdword(&h10))
 1202     #define GetFiberData() cast(PVOID, *cptr(PVOID ptr, GetCurrentFiber()))
 1203 #endif
 1204 
 1205 #ifdef __FB_64BIT__
 1206     #define GetCallersEflags() __getcallerseflags()
 1207     declare function __getcallerseflags() as ulong
 1208     declare function __segmentlimit(byval Selector as DWORD) as DWORD
 1209     declare function GetSegmentLimit alias "__segmentlimit"(byval Selector as DWORD) as DWORD
 1210     #define ReadTimeStampCounter() __rdtsc()
 1211     declare function __mulh(byval Multiplier as LONGLONG, byval Multiplicand as LONGLONG) as LONGLONG
 1212     declare function MultiplyHigh alias "__mulh"(byval Multiplier as LONGLONG, byval Multiplicand as LONGLONG) as LONGLONG
 1213     declare function __umulh(byval Multiplier as ULONGLONG, byval Multiplicand as ULONGLONG) as ULONGLONG
 1214     declare function UnsignedMultiplyHigh alias "__umulh"(byval Multiplier as ULONGLONG, byval Multiplicand as ULONGLONG) as ULONGLONG
 1215     declare function __shiftleft128(byval LowPart as DWORD64, byval HighPart as DWORD64, byval Shift as UBYTE) as DWORD64
 1216     declare function ShiftLeft128 alias "__shiftleft128"(byval LowPart as DWORD64, byval HighPart as DWORD64, byval Shift as UBYTE) as DWORD64
 1217     declare function __shiftright128(byval LowPart as DWORD64, byval HighPart as DWORD64, byval Shift as UBYTE) as DWORD64
 1218     declare function ShiftRight128 alias "__shiftright128"(byval LowPart as DWORD64, byval HighPart as DWORD64, byval Shift as UBYTE) as DWORD64
 1219     declare function _mul128(byval Multiplier as LONG64, byval Multiplicand as LONG64, byval HighProduct as LONG64 ptr) as LONG64
 1220     declare function Multiply128 alias "_mul128"(byval Multiplier as LONG64, byval Multiplicand as LONG64, byval HighProduct as LONG64 ptr) as LONG64
 1221     declare function _umul128(byval Multiplier as DWORD64, byval Multiplicand as DWORD64, byval HighProduct as DWORD64 ptr) as DWORD64
 1222     declare function UnsignedMultiply128 alias "_umul128"(byval Multiplier as DWORD64, byval Multiplicand as DWORD64, byval HighProduct as DWORD64 ptr) as DWORD64
 1223     declare function MultiplyExtract128(byval Multiplier as LONG64, byval Multiplicand as LONG64, byval Shift as UBYTE) as LONG64
 1224     declare function UnsignedMultiplyExtract128(byval Multiplier as DWORD64, byval Multiplicand as DWORD64, byval Shift as UBYTE) as DWORD64
 1225 #endif
 1226 
 1227 const EXCEPTION_READ_FAULT = 0
 1228 const EXCEPTION_WRITE_FAULT = 1
 1229 const EXCEPTION_EXECUTE_FAULT = 8
 1230 
 1231 #ifdef __FB_64BIT__
 1232     const CONTEXT_AMD64 = &h100000
 1233     const CONTEXT_CONTROL = CONTEXT_AMD64 or &h1
 1234     const CONTEXT_INTEGER = CONTEXT_AMD64 or &h2
 1235     const CONTEXT_SEGMENTS = CONTEXT_AMD64 or &h4
 1236     const CONTEXT_FLOATING_POINT = CONTEXT_AMD64 or &h8
 1237     const CONTEXT_DEBUG_REGISTERS = CONTEXT_AMD64 or &h10
 1238     const CONTEXT_FULL = (CONTEXT_CONTROL or CONTEXT_INTEGER) or CONTEXT_FLOATING_POINT
 1239     const CONTEXT_ALL = (((CONTEXT_CONTROL or CONTEXT_INTEGER) or CONTEXT_SEGMENTS) or CONTEXT_FLOATING_POINT) or CONTEXT_DEBUG_REGISTERS
 1240     const CONTEXT_EXCEPTION_ACTIVE = &h8000000
 1241     const CONTEXT_SERVICE_ACTIVE = &h10000000
 1242     const CONTEXT_EXCEPTION_REQUEST = &h40000000
 1243     const CONTEXT_EXCEPTION_REPORTING = &h80000000
 1244     const INITIAL_MXCSR = &h1f80
 1245     const INITIAL_FPCSR = &h027f
 1246 
 1247     type _XMM_SAVE_AREA32
 1248         ControlWord as WORD
 1249         StatusWord as WORD
 1250         TagWord as UBYTE
 1251         Reserved1 as UBYTE
 1252         ErrorOpcode as WORD
 1253         ErrorOffset as DWORD
 1254         ErrorSelector as WORD
 1255         Reserved2 as WORD
 1256         DataOffset as DWORD
 1257         DataSelector as WORD
 1258         Reserved3 as WORD
 1259         MxCsr as DWORD
 1260         MxCsr_Mask as DWORD
 1261         FloatRegisters(0 to 7) as M128A
 1262         XmmRegisters(0 to 15) as M128A
 1263         Reserved4(0 to 95) as UBYTE
 1264     end type
 1265 
 1266     type XMM_SAVE_AREA32 as _XMM_SAVE_AREA32
 1267     type PXMM_SAVE_AREA32 as _XMM_SAVE_AREA32 ptr
 1268     #define LEGACY_SAVE_AREA_LENGTH sizeof(XMM_SAVE_AREA32)
 1269 #else
 1270     const SIZE_OF_80387_REGISTERS = 80
 1271     const CONTEXT_i386 = &h00010000
 1272     const CONTEXT_i486 = &h00010000
 1273     const CONTEXT_CONTROL = CONTEXT_i386 or &h00000001
 1274     const CONTEXT_INTEGER = CONTEXT_i386 or &h00000002
 1275     const CONTEXT_SEGMENTS = CONTEXT_i386 or &h00000004
 1276     const CONTEXT_FLOATING_POINT = CONTEXT_i386 or &h00000008
 1277     const CONTEXT_DEBUG_REGISTERS = CONTEXT_i386 or &h00000010
 1278     const CONTEXT_EXTENDED_REGISTERS = CONTEXT_i386 or &h00000020
 1279     const CONTEXT_FULL = (CONTEXT_CONTROL or CONTEXT_INTEGER) or CONTEXT_SEGMENTS
 1280     const CONTEXT_ALL = ((((CONTEXT_CONTROL or CONTEXT_INTEGER) or CONTEXT_SEGMENTS) or CONTEXT_FLOATING_POINT) or CONTEXT_DEBUG_REGISTERS) or CONTEXT_EXTENDED_REGISTERS
 1281     const MAXIMUM_SUPPORTED_EXTENSION = 512
 1282 
 1283     type _FLOATING_SAVE_AREA
 1284         ControlWord as DWORD
 1285         StatusWord as DWORD
 1286         TagWord as DWORD
 1287         ErrorOffset as DWORD
 1288         ErrorSelector as DWORD
 1289         DataOffset as DWORD
 1290         DataSelector as DWORD
 1291         RegisterArea(0 to 79) as UBYTE
 1292         Cr0NpxState as DWORD
 1293     end type
 1294 
 1295     type FLOATING_SAVE_AREA as _FLOATING_SAVE_AREA
 1296     type PFLOATING_SAVE_AREA as FLOATING_SAVE_AREA ptr
 1297 #endif
 1298 
 1299 type _CONTEXT_
 1300     #ifdef __FB_64BIT__
 1301         P1Home as DWORD64
 1302         P2Home as DWORD64
 1303         P3Home as DWORD64
 1304         P4Home as DWORD64
 1305         P5Home as DWORD64
 1306         P6Home as DWORD64
 1307     #endif
 1308 
 1309     ContextFlags as DWORD
 1310 
 1311     #ifdef __FB_64BIT__
 1312         MxCsr as DWORD
 1313         SegCs as WORD
 1314         SegDs as WORD
 1315         SegEs as WORD
 1316         SegFs as WORD
 1317         SegGs as WORD
 1318         SegSs as WORD
 1319     #else
 1320         Dr0 as DWORD
 1321         Dr1 as DWORD
 1322         Dr2 as DWORD
 1323         Dr3 as DWORD
 1324         Dr6 as DWORD
 1325         Dr7 as DWORD
 1326         FloatSave as FLOATING_SAVE_AREA
 1327         SegGs as DWORD
 1328         SegFs as DWORD
 1329         SegEs as DWORD
 1330         SegDs as DWORD
 1331         Edi as DWORD
 1332         Esi as DWORD
 1333         Ebx as DWORD
 1334         Edx as DWORD
 1335         Ecx as DWORD
 1336         Eax as DWORD
 1337         Ebp as DWORD
 1338         Eip as DWORD
 1339         SegCs as DWORD
 1340     #endif
 1341 
 1342     EFlags as DWORD
 1343 
 1344     #ifdef __FB_64BIT__
 1345         Dr0 as DWORD64
 1346         Dr1 as DWORD64
 1347         Dr2 as DWORD64
 1348         Dr3 as DWORD64
 1349         Dr6 as DWORD64
 1350         Dr7 as DWORD64
 1351         Rax as DWORD64
 1352         Rcx as DWORD64
 1353         Rdx as DWORD64
 1354         Rbx as DWORD64
 1355         Rsp as DWORD64
 1356         Rbp as DWORD64
 1357         Rsi as DWORD64
 1358         Rdi as DWORD64
 1359         R8 as DWORD64
 1360         R9 as DWORD64
 1361         R10 as DWORD64
 1362         R11 as DWORD64
 1363         R12 as DWORD64
 1364         R13 as DWORD64
 1365         R14 as DWORD64
 1366         R15 as DWORD64
 1367         Rip as DWORD64
 1368 
 1369         union
 1370             FltSave as XMM_SAVE_AREA32
 1371             FloatSave as XMM_SAVE_AREA32
 1372 
 1373             type
 1374                 Header(0 to 1) as M128A
 1375                 Legacy(0 to 7) as M128A
 1376                 Xmm0 as M128A
 1377                 Xmm1 as M128A
 1378                 Xmm2 as M128A
 1379                 Xmm3 as M128A
 1380                 Xmm4 as M128A
 1381                 Xmm5 as M128A
 1382                 Xmm6 as M128A
 1383                 Xmm7 as M128A
 1384                 Xmm8 as M128A
 1385                 Xmm9 as M128A
 1386                 Xmm10 as M128A
 1387                 Xmm11 as M128A
 1388                 Xmm12 as M128A
 1389                 Xmm13 as M128A
 1390                 Xmm14 as M128A
 1391                 Xmm15 as M128A
 1392             end type
 1393         end union
 1394 
 1395         VectorRegister(0 to 25) as M128A
 1396         VectorControl as DWORD64
 1397         DebugControl as DWORD64
 1398         LastBranchToRip as DWORD64
 1399         LastBranchFromRip as DWORD64
 1400         LastExceptionToRip as DWORD64
 1401         LastExceptionFromRip as DWORD64
 1402     #else
 1403         Esp as DWORD
 1404         SegSs as DWORD
 1405         ExtendedRegisters(0 to 511) as UBYTE
 1406     #endif
 1407 end type
 1408 
 1409 type CONTEXT as _CONTEXT
 1410 
 1411 #ifdef __FB_64BIT__
 1412     type PCONTEXT as _CONTEXT ptr
 1413     const RUNTIME_FUNCTION_INDIRECT = &h1
 1414 
 1415     type _RUNTIME_FUNCTION
 1416         BeginAddress as DWORD
 1417         EndAddress as DWORD
 1418         UnwindData as DWORD
 1419     end type
 1420 
 1421     type RUNTIME_FUNCTION as _RUNTIME_FUNCTION
 1422     type PRUNTIME_FUNCTION as _RUNTIME_FUNCTION ptr
 1423     type PGET_RUNTIME_FUNCTION_CALLBACK as function(byval ControlPc as DWORD64, byval Context as PVOID) as PRUNTIME_FUNCTION
 1424     type POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK as function(byval Process as HANDLE, byval TableAddress as PVOID, byval Entries as PDWORD, byval Functions as PRUNTIME_FUNCTION ptr) as DWORD
 1425 
 1426     #define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback"
 1427     const UNW_FLAG_NHANDLER = &h00
 1428     const UNW_FLAG_EHANDLER = &h01
 1429     const UNW_FLAG_UHANDLER = &h02
 1430     const UNW_FLAG_CHAININFO = &h04
 1431 #else
 1432     type PCONTEXT as CONTEXT ptr
 1433 #endif
 1434 
 1435 #define _LDT_ENTRY_DEFINED
 1436 
 1437 type _LDT_ENTRY_HighWord_Bytes
 1438     BaseMid as UBYTE
 1439     Flags1 as UBYTE
 1440     Flags2 as UBYTE
 1441     BaseHi as UBYTE
 1442 end type
 1443 
 1444 type _LDT_ENTRY_HighWord_Bits
 1445     BaseMid : 8 as DWORD
 1446     as DWORD Type : 5
 1447     Dpl : 2 as DWORD
 1448     Pres : 1 as DWORD
 1449     LimitHi : 4 as DWORD
 1450     Sys : 1 as DWORD
 1451     Reserved_0 : 1 as DWORD
 1452     Default_Big : 1 as DWORD
 1453     Granularity : 1 as DWORD
 1454     BaseHi : 8 as DWORD
 1455 end type
 1456 
 1457 union _LDT_ENTRY_HighWord
 1458     Bytes as _LDT_ENTRY_HighWord_Bytes
 1459     Bits as _LDT_ENTRY_HighWord_Bits
 1460 end union
 1461 
 1462 type _LDT_ENTRY
 1463     LimitLow as WORD
 1464     BaseLow as WORD
 1465     HighWord as _LDT_ENTRY_HighWord
 1466 end type
 1467 
 1468 type LDT_ENTRY as _LDT_ENTRY
 1469 type PLDT_ENTRY as _LDT_ENTRY ptr
 1470 const EXCEPTION_NONCONTINUABLE = &h1
 1471 const EXCEPTION_UNWINDING = &h2
 1472 const EXCEPTION_EXIT_UNWIND = &h4
 1473 const EXCEPTION_STACK_INVALID = &h8
 1474 const EXCEPTION_NESTED_CALL = &h10
 1475 const EXCEPTION_TARGET_UNWIND = &h20
 1476 const EXCEPTION_COLLIDED_UNWIND = &h40
 1477 const EXCEPTION_UNWIND = &h66
 1478 #define IS_UNWINDING(f) ((f and EXCEPTION_UNWIND) <> 0)
 1479 #define IS_DISPATCHING(f) ((f and EXCEPTION_UNWIND) = 0)
 1480 #define IS_TARGET_UNWIND(f) ((f and EXCEPTION_TARGET_UNWIND) <> 0)
 1481 const EXCEPTION_MAXIMUM_PARAMETERS = 15
 1482 
 1483 type _EXCEPTION_RECORD_
 1484     ExceptionCode as DWORD
 1485     ExceptionFlags as DWORD
 1486     ExceptionRecord as _EXCEPTION_RECORD ptr
 1487     ExceptionAddress as PVOID
 1488     NumberParameters as DWORD
 1489     ExceptionInformation(0 to 14) as ULONG_PTR
 1490 end type
 1491 
 1492 type EXCEPTION_RECORD as _EXCEPTION_RECORD
 1493 type PEXCEPTION_RECORD as EXCEPTION_RECORD ptr
 1494 
 1495 type _EXCEPTION_RECORD32
 1496     ExceptionCode as DWORD
 1497     ExceptionFlags as DWORD
 1498     ExceptionRecord as DWORD
 1499     ExceptionAddress as DWORD
 1500     NumberParameters as DWORD
 1501     ExceptionInformation(0 to 14) as DWORD
 1502 end type
 1503 
 1504 type EXCEPTION_RECORD32 as _EXCEPTION_RECORD32
 1505 type PEXCEPTION_RECORD32 as _EXCEPTION_RECORD32 ptr
 1506 
 1507 type _EXCEPTION_RECORD64
 1508     ExceptionCode as DWORD
 1509     ExceptionFlags as DWORD
 1510     ExceptionRecord as DWORD64
 1511     ExceptionAddress as DWORD64
 1512     NumberParameters as DWORD
 1513     __unusedAlignment as DWORD
 1514     ExceptionInformation(0 to 14) as DWORD64
 1515 end type
 1516 
 1517 type EXCEPTION_RECORD64 as _EXCEPTION_RECORD64
 1518 type PEXCEPTION_RECORD64 as _EXCEPTION_RECORD64 ptr
 1519 
 1520 type _EXCEPTION_POINTERS
 1521     ExceptionRecord as PEXCEPTION_RECORD
 1522     ContextRecord as PCONTEXT
 1523 end type
 1524 
 1525 type EXCEPTION_POINTERS as _EXCEPTION_POINTERS
 1526 type PEXCEPTION_POINTERS as _EXCEPTION_POINTERS ptr
 1527 
 1528 #ifdef __FB_64BIT__
 1529     const UNWIND_HISTORY_TABLE_SIZE = 12
 1530 
 1531     type _UNWIND_HISTORY_TABLE_ENTRY
 1532         ImageBase as ULONG64
 1533         FunctionEntry as PRUNTIME_FUNCTION
 1534     end type
 1535 
 1536     type UNWIND_HISTORY_TABLE_ENTRY as _UNWIND_HISTORY_TABLE_ENTRY
 1537     type PUNWIND_HISTORY_TABLE_ENTRY as _UNWIND_HISTORY_TABLE_ENTRY ptr
 1538     const UNWIND_HISTORY_TABLE_NONE = 0
 1539     const UNWIND_HISTORY_TABLE_GLOBAL = 1
 1540     const UNWIND_HISTORY_TABLE_LOCAL = 2
 1541 
 1542     type _UNWIND_HISTORY_TABLE
 1543         Count as ULONG
 1544         Search as UCHAR
 1545         LowAddress as ULONG64
 1546         HighAddress as ULONG64
 1547         Entry(0 to 11) as UNWIND_HISTORY_TABLE_ENTRY
 1548     end type
 1549 
 1550     type UNWIND_HISTORY_TABLE as _UNWIND_HISTORY_TABLE
 1551     type PUNWIND_HISTORY_TABLE as _UNWIND_HISTORY_TABLE ptr
 1552     type DISPATCHER_CONTEXT as _DISPATCHER_CONTEXT
 1553     type PDISPATCHER_CONTEXT as _DISPATCHER_CONTEXT ptr
 1554 
 1555     type _DISPATCHER_CONTEXT
 1556         ControlPc as ULONG64
 1557         ImageBase as ULONG64
 1558         FunctionEntry as PRUNTIME_FUNCTION
 1559         EstablisherFrame as ULONG64
 1560         TargetIp as ULONG64
 1561         ContextRecord as PCONTEXT
 1562         LanguageHandler as PEXCEPTION_ROUTINE
 1563         HandlerData as PVOID
 1564         HistoryTable as PUNWIND_HISTORY_TABLE
 1565         ScopeIndex as ULONG
 1566         Fill0 as ULONG
 1567     end type
 1568 
 1569     type _KNONVOLATILE_CONTEXT_POINTERS
 1570         FloatingContext(0 to 15) as PM128A
 1571         IntegerContext(0 to 15) as PULONG64
 1572     end type
 1573 
 1574     type KNONVOLATILE_CONTEXT_POINTERS as _KNONVOLATILE_CONTEXT_POINTERS
 1575     type PKNONVOLATILE_CONTEXT_POINTERS as _KNONVOLATILE_CONTEXT_POINTERS ptr
 1576 #endif
 1577 
 1578 type PACCESS_TOKEN as PVOID
 1579 type PSECURITY_DESCRIPTOR as PVOID
 1580 type PSID as PVOID
 1581 type PCLAIMS_BLOB as PVOID
 1582 type ACCESS_MASK as DWORD
 1583 type PACCESS_MASK as ACCESS_MASK ptr
 1584 
 1585 const DELETE__ = &h00010000
 1586 const READ_CONTROL = &h00020000
 1587 const WRITE_DAC = &h00040000
 1588 const WRITE_OWNER = &h00080000
 1589 const SYNCHRONIZE = &h00100000
 1590 const STANDARD_RIGHTS_REQUIRED = &h000F0000
 1591 const STANDARD_RIGHTS_READ = READ_CONTROL
 1592 const STANDARD_RIGHTS_WRITE = READ_CONTROL
 1593 const STANDARD_RIGHTS_EXECUTE = READ_CONTROL
 1594 const STANDARD_RIGHTS_ALL = &h001F0000
 1595 const SPECIFIC_RIGHTS_ALL = &h0000FFFF
 1596 const ACCESS_SYSTEM_SECURITY = &h01000000
 1597 const MAXIMUM_ALLOWED = &h02000000
 1598 const GENERIC_READ = &h80000000
 1599 const GENERIC_WRITE = &h40000000
 1600 const GENERIC_EXECUTE = &h20000000
 1601 const GENERIC_ALL = &h10000000
 1602 
 1603 type _GENERIC_MAPPING
 1604     GenericRead as ACCESS_MASK
 1605     GenericWrite as ACCESS_MASK
 1606     GenericExecute as ACCESS_MASK
 1607     GenericAll as ACCESS_MASK
 1608 end type
 1609 
 1610 type GENERIC_MAPPING as _GENERIC_MAPPING
 1611 type PGENERIC_MAPPING as GENERIC_MAPPING ptr
 1612 
 1613 type _LUID_AND_ATTRIBUTES field = 4
 1614     Luid as LUID
 1615     Attributes as DWORD
 1616 end type
 1617 
 1618 type LUID_AND_ATTRIBUTES as _LUID_AND_ATTRIBUTES
 1619 type PLUID_AND_ATTRIBUTES as _LUID_AND_ATTRIBUTES ptr
 1620 type PLUID_AND_ATTRIBUTES_ARRAY as LUID_AND_ATTRIBUTES ptr
 1621 #define SID_IDENTIFIER_AUTHORITY_DEFINED
 1622 
 1623 type _SID_IDENTIFIER_AUTHORITY
 1624     Value(0 to 5) as UBYTE
 1625 end type
 1626 
 1627 type SID_IDENTIFIER_AUTHORITY as _SID_IDENTIFIER_AUTHORITY
 1628 type PSID_IDENTIFIER_AUTHORITY as _SID_IDENTIFIER_AUTHORITY ptr
 1629 #define SID_DEFINED
 1630 
 1631 type _SID
 1632     Revision as UBYTE
 1633     SubAuthorityCount as UBYTE
 1634     IdentifierAuthority as SID_IDENTIFIER_AUTHORITY
 1635     SubAuthority(0 to 0) as DWORD
 1636 end type
 1637 
 1638 type SID as _SID
 1639 type PISID as _SID ptr
 1640 const SID_REVISION = 1
 1641 const SID_MAX_SUB_AUTHORITIES = 15
 1642 const SID_RECOMMENDED_SUB_AUTHORITIES = 1
 1643 #define SECURITY_MAX_SID_SIZE ((sizeof(SID) - sizeof(DWORD)) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
 1644 const SID_HASH_SIZE = 32
 1645 
 1646 type _SID_NAME_USE as long
 1647 enum
 1648     SidTypeUser = 1
 1649     SidTypeGroup
 1650     SidTypeDomain
 1651     SidTypeAlias
 1652     SidTypeWellKnownGroup
 1653     SidTypeDeletedAccount
 1654     SidTypeInvalid
 1655     SidTypeUnknown
 1656     SidTypeComputer
 1657     SidTypeLabel
 1658 end enum
 1659 
 1660 type SID_NAME_USE as _SID_NAME_USE
 1661 type PSID_NAME_USE as _SID_NAME_USE ptr
 1662 
 1663 type _SID_AND_ATTRIBUTES
 1664     Sid as PSID
 1665     Attributes as DWORD
 1666 end type
 1667 
 1668 type SID_AND_ATTRIBUTES as _SID_AND_ATTRIBUTES
 1669 type PSID_AND_ATTRIBUTES as _SID_AND_ATTRIBUTES ptr
 1670 type PSID_AND_ATTRIBUTES_ARRAY as SID_AND_ATTRIBUTES ptr
 1671 type SID_HASH_ENTRY as ULONG_PTR
 1672 type PSID_HASH_ENTRY as ULONG_PTR ptr
 1673 
 1674 type _SID_AND_ATTRIBUTES_HASH
 1675     SidCount as DWORD
 1676     SidAttr as PSID_AND_ATTRIBUTES
 1677     Hash(0 to 31) as SID_HASH_ENTRY
 1678 end type
 1679 
 1680 type SID_AND_ATTRIBUTES_HASH as _SID_AND_ATTRIBUTES_HASH
 1681 type PSID_AND_ATTRIBUTES_HASH as _SID_AND_ATTRIBUTES_HASH ptr
 1682 #define SECURITY_NULL_SID_AUTHORITY (0, 0, 0, 0, 0, 0)
 1683 #define SECURITY_WORLD_SID_AUTHORITY (0, 0, 0, 0, 0, 1)
 1684 #define SECURITY_LOCAL_SID_AUTHORITY (0, 0, 0, 0, 0, 2)
 1685 #define SECURITY_CREATOR_SID_AUTHORITY (0, 0, 0, 0, 0, 3)
 1686 #define SECURITY_NON_UNIQUE_AUTHORITY (0, 0, 0, 0, 0, 4)
 1687 #define SECURITY_RESOURCE_MANAGER_AUTHORITY (0, 0, 0, 0, 0, 9)
 1688 const SECURITY_NULL_RID = &h00000000
 1689 const SECURITY_WORLD_RID = &h00000000
 1690 const SECURITY_LOCAL_RID = &h00000000
 1691 const SECURITY_LOCAL_LOGON_RID = &h00000001
 1692 const SECURITY_CREATOR_OWNER_RID = &h00000000
 1693 const SECURITY_CREATOR_GROUP_RID = &h00000001
 1694 const SECURITY_CREATOR_OWNER_SERVER_RID = &h00000002
 1695 const SECURITY_CREATOR_GROUP_SERVER_RID = &h00000003
 1696 const SECURITY_CREATOR_OWNER_RIGHTS_RID = &h00000004
 1697 #define SECURITY_NT_AUTHORITY (0, 0, 0, 0, 0, 5)
 1698 const SECURITY_DIALUP_RID = &h00000001
 1699 const SECURITY_NETWORK_RID = &h00000002
 1700 const SECURITY_BATCH_RID = &h00000003
 1701 const SECURITY_INTERACTIVE_RID = &h00000004
 1702 const SECURITY_LOGON_IDS_RID = &h00000005
 1703 const SECURITY_LOGON_IDS_RID_COUNT = 3
 1704 const SECURITY_SERVICE_RID = &h00000006
 1705 const SECURITY_ANONYMOUS_LOGON_RID = &h00000007
 1706 const SECURITY_PROXY_RID = &h00000008
 1707 const SECURITY_ENTERPRISE_CONTROLLERS_RID = &h00000009
 1708 const SECURITY_SERVER_LOGON_RID = SECURITY_ENTERPRISE_CONTROLLERS_RID
 1709 const SECURITY_PRINCIPAL_SELF_RID = &h0000000A
 1710 const SECURITY_AUTHENTICATED_USER_RID = &h0000000B
 1711 const SECURITY_RESTRICTED_CODE_RID = &h0000000C
 1712 const SECURITY_TERMINAL_SERVER_RID = &h0000000D
 1713 const SECURITY_REMOTE_LOGON_RID = &h0000000E
 1714 const SECURITY_THIS_ORGANIZATION_RID = &h0000000F
 1715 const SECURITY_IUSER_RID = &h00000011
 1716 const SECURITY_LOCAL_SYSTEM_RID = &h00000012
 1717 const SECURITY_LOCAL_SERVICE_RID = &h00000013
 1718 const SECURITY_NETWORK_SERVICE_RID = &h00000014
 1719 const SECURITY_NT_NON_UNIQUE = &h00000015
 1720 const SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT = 3
 1721 const SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID = &h00000016
 1722 const SECURITY_BUILTIN_DOMAIN_RID = &h00000020
 1723 const SECURITY_WRITE_RESTRICTED_CODE_RID = &h00000021
 1724 const SECURITY_PACKAGE_BASE_RID = &h00000040
 1725 const SECURITY_PACKAGE_RID_COUNT = 2
 1726 const SECURITY_PACKAGE_NTLM_RID = &h0000000A
 1727 const SECURITY_PACKAGE_SCHANNEL_RID = &h0000000E
 1728 const SECURITY_PACKAGE_DIGEST_RID = &h00000015
 1729 const SECURITY_CRED_TYPE_BASE_RID = &h00000041
 1730 const SECURITY_CRED_TYPE_RID_COUNT = 2
 1731 const SECURITY_CRED_TYPE_THIS_ORG_CERT_RID = &h00000001
 1732 const SECURITY_MIN_BASE_RID = &h00000050
 1733 const SECURITY_SERVICE_ID_BASE_RID = &h00000050
 1734 const SECURITY_SERVICE_ID_RID_COUNT = 6
 1735 const SECURITY_RESERVED_ID_BASE_RID = &h00000051
 1736 const SECURITY_APPPOOL_ID_BASE_RID = &h00000052
 1737 const SECURITY_APPPOOL_ID_RID_COUNT = 6
 1738 const SECURITY_VIRTUALSERVER_ID_BASE_RID = &h00000053
 1739 const SECURITY_VIRTUALSERVER_ID_RID_COUNT = 6
 1740 const SECURITY_USERMODEDRIVERHOST_ID_BASE_RID = &h00000054
 1741 const SECURITY_USERMODEDRIVERHOST_ID_RID_COUNT = 6
 1742 const SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_BASE_RID = &h00000055
 1743 const SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_RID_COUNT = 6
 1744 const SECURITY_WMIHOST_ID_BASE_RID = &h00000056
 1745 const SECURITY_WMIHOST_ID_RID_COUNT = 6
 1746 const SECURITY_TASK_ID_BASE_RID = &h00000057
 1747 const SECURITY_NFS_ID_BASE_RID = &h00000058
 1748 const SECURITY_COM_ID_BASE_RID = &h00000059
 1749 const SECURITY_WINDOW_MANAGER_BASE_RID = &h0000005a
 1750 const SECURITY_RDV_GFX_BASE_RID = &h0000005b
 1751 const SECURITY_DASHOST_ID_BASE_RID = &h0000005c
 1752 const SECURITY_DASHOST_ID_RID_COUNT = 6
 1753 const SECURITY_VIRTUALACCOUNT_ID_RID_COUNT = 6
 1754 const SECURITY_MAX_BASE_RID = &h0000006f
 1755 const SECURITY_MAX_ALWAYS_FILTERED = &h000003E7
 1756 const SECURITY_MIN_NEVER_FILTERED = &h000003E8
 1757 const SECURITY_OTHER_ORGANIZATION_RID = &h000003E8
 1758 const SECURITY_WINDOWSMOBILE_ID_BASE_RID = &h00000070
 1759 const DOMAIN_GROUP_RID_AUTHORIZATION_DATA_IS_COMPOUNDED = &h000001f0
 1760 const DOMAIN_GROUP_RID_AUTHORIZATION_DATA_CONTAINS_CLAIMS = &h000001f1
 1761 const DOMAIN_GROUP_RID_ENTERPRISE_READONLY_DOMAIN_CONTROLLERS = &h000001f2
 1762 const FOREST_USER_RID_MAX = &h000001F3
 1763 const DOMAIN_USER_RID_ADMIN = &h000001F4
 1764 const DOMAIN_USER_RID_GUEST = &h000001F5
 1765 const DOMAIN_USER_RID_KRBTGT = &h000001F6
 1766 const DOMAIN_USER_RID_MAX = &h000003E7
 1767 const DOMAIN_GROUP_RID_ADMINS = &h00000200
 1768 const DOMAIN_GROUP_RID_USERS = &h00000201
 1769 const DOMAIN_GROUP_RID_GUESTS = &h00000202
 1770 const DOMAIN_GROUP_RID_COMPUTERS = &h00000203
 1771 const DOMAIN_GROUP_RID_CONTROLLERS = &h00000204
 1772 const DOMAIN_GROUP_RID_CERT_ADMINS = &h00000205
 1773 const DOMAIN_GROUP_RID_SCHEMA_ADMINS = &h00000206
 1774 const DOMAIN_GROUP_RID_ENTERPRISE_ADMINS = &h00000207
 1775 const DOMAIN_GROUP_RID_POLICY_ADMINS = &h00000208
 1776 const DOMAIN_GROUP_RID_READONLY_CONTROLLERS = &h00000209
 1777 const DOMAIN_GROUP_RID_CLONEABLE_CONTROLLERS = &h0000020a
 1778 const DOMAIN_ALIAS_RID_ADMINS = &h00000220
 1779 const DOMAIN_ALIAS_RID_USERS = &h00000221
 1780 const DOMAIN_ALIAS_RID_GUESTS = &h00000222
 1781 const DOMAIN_ALIAS_RID_POWER_USERS = &h00000223
 1782 const DOMAIN_ALIAS_RID_ACCOUNT_OPS = &h00000224
 1783 const DOMAIN_ALIAS_RID_SYSTEM_OPS = &h00000225
 1784 const DOMAIN_ALIAS_RID_PRINT_OPS = &h00000226
 1785 const DOMAIN_ALIAS_RID_BACKUP_OPS = &h00000227
 1786 const DOMAIN_ALIAS_RID_REPLICATOR = &h00000228
 1787 const DOMAIN_ALIAS_RID_RAS_SERVERS = &h00000229
 1788 const DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = &h0000022A
 1789 const DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = &h0000022B
 1790 const DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = &h0000022C
 1791 const DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = &h0000022D
 1792 const DOMAIN_ALIAS_RID_MONITORING_USERS = &h0000022E
 1793 const DOMAIN_ALIAS_RID_LOGGING_USERS = &h0000022F
 1794 const DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = &h00000230
 1795 const DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = &h00000231
 1796 const DOMAIN_ALIAS_RID_DCOM_USERS = &h00000232
 1797 const DOMAIN_ALIAS_RID_IUSERS = &h00000238
 1798 const DOMAIN_ALIAS_RID_CRYPTO_OPERATORS = &h00000239
 1799 const DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP = &h0000023B
 1800 const DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP = &h0000023C
 1801 const DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP = &h0000023D
 1802 const DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP = &h0000023e
 1803 const DOMAIN_ALIAS_RID_RDS_REMOTE_ACCESS_SERVERS = &h0000023f
 1804 const DOMAIN_ALIAS_RID_RDS_ENDPOINT_SERVERS = &h00000240
 1805 const DOMAIN_ALIAS_RID_RDS_MANAGEMENT_SERVERS = &h00000241
 1806 const DOMAIN_ALIAS_RID_HYPER_V_ADMINS = &h00000242
 1807 const DOMAIN_ALIAS_RID_ACCESS_CONTROL_ASSISTANCE_OPS = &h00000243
 1808 const DOMAIN_ALIAS_RID_REMOTE_MANAGEMENT_USERS = &h00000244
 1809 #define SECURITY_APP_PACKAGE_AUTHORITY (0, 0, 0, 0, 0, 15)
 1810 const SECURITY_APP_PACKAGE_BASE_RID = &h00000002
 1811 const SECURITY_BUILTIN_APP_PACKAGE_RID_COUNT = 2
 1812 const SECURITY_APP_PACKAGE_RID_COUNT = 8
 1813 const SECURITY_CAPABILITY_BASE_RID = &h00000003
 1814 const SECURITY_BUILTIN_CAPABILITY_RID_COUNT = 2
 1815 const SECURITY_CAPABILITY_RID_COUNT = 5
 1816 const SECURITY_BUILTIN_PACKAGE_ANY_PACKAGE = &h00000001
 1817 const SECURITY_CAPABILITY_INTERNET_CLIENT = &h00000001
 1818 const SECURITY_CAPABILITY_INTERNET_CLIENT_SERVER = &h00000002
 1819 const SECURITY_CAPABILITY_PRIVATE_NETWORK_CLIENT_SERVER = &h00000003
 1820 const SECURITY_CAPABILITY_PICTURES_LIBRARY = &h00000004
 1821 const SECURITY_CAPABILITY_VIDEOS_LIBRARY = &h00000005
 1822 const SECURITY_CAPABILITY_MUSIC_LIBRARY = &h00000006
 1823 const SECURITY_CAPABILITY_DOCUMENTS_LIBRARY = &h00000007
 1824 const SECURITY_CAPABILITY_ENTERPRISE_AUTHENTICATION = &h00000008
 1825 const SECURITY_CAPABILITY_SHARED_USER_CERTIFICATES = &h00000009
 1826 const SECURITY_CAPABILITY_REMOVABLE_STORAGE = &h0000000a
 1827 const SECURITY_CAPABILITY_INTERNET_EXPLORER = &h00001000
 1828 #define SECURITY_MANDATORY_LABEL_AUTHORITY (0, 0, 0, 0, 0, 16)
 1829 const SECURITY_MANDATORY_UNTRUSTED_RID = &h00000000
 1830 const SECURITY_MANDATORY_LOW_RID = &h00001000
 1831 const SECURITY_MANDATORY_MEDIUM_RID = &h00002000
 1832 const SECURITY_MANDATORY_HIGH_RID = &h00003000
 1833 const SECURITY_MANDATORY_SYSTEM_RID = &h00004000
 1834 const SECURITY_MANDATORY_PROTECTED_PROCESS_RID = &h00005000
 1835 const SECURITY_MANDATORY_MAXIMUM_USER_RID = SECURITY_MANDATORY_SYSTEM_RID
 1836 #define MANDATORY_LEVEL_TO_MANDATORY_RID(IL) (IL * &h1000)
 1837 #define SECURITY_SCOPED_POLICY_ID_AUTHORITY (0, 0, 0, 0, 0, 17)
 1838 #define SECURITY_AUTHENTICATION_AUTHORITY (0, 0, 0, 0, 0, 18)
 1839 const SECURITY_AUTHENTICATION_AUTHORITY_RID_COUNT = 1
 1840 const SECURITY_AUTHENTICATION_AUTHORITY_ASSERTED_RID = &h00000001
 1841 const SECURITY_AUTHENTICATION_SERVICE_ASSERTED_RID = &h00000002
 1842 const SECURITY_TRUSTED_INSTALLER_RID1 = 956008885
 1843 const SECURITY_TRUSTED_INSTALLER_RID2 = 3418522649
 1844 const SECURITY_TRUSTED_INSTALLER_RID3 = 1831038044
 1845 const SECURITY_TRUSTED_INSTALLER_RID4 = 1853292631
 1846 const SECURITY_TRUSTED_INSTALLER_RID5 = 2271478464
 1847 
 1848 type WELL_KNOWN_SID_TYPE as long
 1849 enum
 1850     WinNullSid = 0
 1851     WinWorldSid = 1
 1852     WinLocalSid = 2
 1853     WinCreatorOwnerSid = 3
 1854     WinCreatorGroupSid = 4
 1855     WinCreatorOwnerServerSid = 5
 1856     WinCreatorGroupServerSid = 6
 1857     WinNtAuthoritySid = 7
 1858     WinDialupSid = 8
 1859     WinNetworkSid = 9
 1860     WinBatchSid = 10
 1861     WinInteractiveSid = 11
 1862     WinServiceSid = 12
 1863     WinAnonymousSid = 13
 1864     WinProxySid = 14
 1865     WinEnterpriseControllersSid = 15
 1866     WinSelfSid = 16
 1867     WinAuthenticatedUserSid = 17
 1868     WinRestrictedCodeSid = 18
 1869     WinTerminalServerSid = 19
 1870     WinRemoteLogonIdSid = 20
 1871     WinLogonIdsSid = 21
 1872     WinLocalSystemSid = 22
 1873     WinLocalServiceSid = 23
 1874     WinNetworkServiceSid = 24
 1875     WinBuiltinDomainSid = 25
 1876     WinBuiltinAdministratorsSid = 26
 1877     WinBuiltinUsersSid = 27
 1878     WinBuiltinGuestsSid = 28
 1879     WinBuiltinPowerUsersSid = 29
 1880     WinBuiltinAccountOperatorsSid = 30
 1881     WinBuiltinSystemOperatorsSid = 31
 1882     WinBuiltinPrintOperatorsSid = 32
 1883     WinBuiltinBackupOperatorsSid = 33
 1884     WinBuiltinReplicatorSid = 34
 1885     WinBuiltinPreWindows2000CompatibleAccessSid = 35
 1886     WinBuiltinRemoteDesktopUsersSid = 36
 1887     WinBuiltinNetworkConfigurationOperatorsSid = 37
 1888     WinAccountAdministratorSid = 38
 1889     WinAccountGuestSid = 39
 1890     WinAccountKrbtgtSid = 40
 1891     WinAccountDomainAdminsSid = 41
 1892     WinAccountDomainUsersSid = 42
 1893     WinAccountDomainGuestsSid = 43
 1894     WinAccountComputersSid = 44
 1895     WinAccountControllersSid = 45
 1896     WinAccountCertAdminsSid = 46
 1897     WinAccountSchemaAdminsSid = 47
 1898     WinAccountEnterpriseAdminsSid = 48
 1899     WinAccountPolicyAdminsSid = 49
 1900     WinAccountRasAndIasServersSid = 50
 1901     WinNTLMAuthenticationSid = 51
 1902     WinDigestAuthenticationSid = 52
 1903     WinSChannelAuthenticationSid = 53
 1904     WinThisOrganizationSid = 54
 1905     WinOtherOrganizationSid = 55
 1906     WinBuiltinIncomingForestTrustBuildersSid = 56
 1907     WinBuiltinPerfMonitoringUsersSid = 57
 1908     WinBuiltinPerfLoggingUsersSid = 58
 1909     WinBuiltinAuthorizationAccessSid = 59
 1910     WinBuiltinTerminalServerLicenseServersSid = 60
 1911     WinBuiltinDCOMUsersSid = 61
 1912     WinBuiltinIUsersSid = 62
 1913     WinIUserSid = 63
 1914     WinBuiltinCryptoOperatorsSid = 64
 1915     WinUntrustedLabelSid = 65
 1916     WinLowLabelSid = 66
 1917     WinMediumLabelSid = 67
 1918     WinHighLabelSid = 68
 1919     WinSystemLabelSid = 69
 1920     WinWriteRestrictedCodeSid = 70
 1921     WinCreatorOwnerRightsSid = 71
 1922     WinCacheablePrincipalsGroupSid = 72
 1923     WinNonCacheablePrincipalsGroupSid = 73
 1924     WinEnterpriseReadonlyControllersSid = 74
 1925     WinAccountReadonlyControllersSid = 75
 1926     WinBuiltinEventLogReadersGroup = 76
 1927     WinNewEnterpriseReadonlyControllersSid = 77
 1928     WinBuiltinCertSvcDComAccessGroup = 78
 1929     WinMediumPlusLabelSid = 79
 1930     WinLocalLogonSid = 80
 1931     WinConsoleLogonSid = 81
 1932     WinThisOrganizationCertificateSid = 82
 1933     WinApplicationPackageAuthoritySid = 83
 1934     WinBuiltinAnyPackageSid = 84
 1935     WinCapabilityInternetClientSid = 85
 1936     WinCapabilityInternetClientServerSid = 86
 1937     WinCapabilityPrivateNetworkClientServerSid = 87
 1938     WinCapabilityPicturesLibrarySid = 88
 1939     WinCapabilityVideosLibrarySid = 89
 1940     WinCapabilityMusicLibrarySid = 90
 1941     WinCapabilityDocumentsLibrarySid = 91
 1942     WinCapabilitySharedUserCertificatesSid = 92
 1943     WinCapabilityEnterpriseAuthenticationSid = 93
 1944     WinCapabilityRemovableStorageSid = 94
 1945     WinBuiltinRDSRemoteAccessServersSid = 95
 1946     WinBuiltinRDSEndpointServersSid = 96
 1947     WinBuiltinRDSManagementServersSid = 97
 1948     WinUserModeDriversSid = 98
 1949     WinBuiltinHyperVAdminsSid = 99
 1950     WinAccountCloneableControllersSid = 100
 1951     WinBuiltinAccessControlAssistanceOperatorsSid = 101
 1952     WinBuiltinRemoteManagementUsersSid = 102
 1953     WinAuthenticationAuthorityAssertedSid = 103
 1954     WinAuthenticationServiceAssertedSid = 104
 1955 end enum
 1956 
 1957 #define SYSTEM_LUID (&h3e7, &h0)
 1958 #define ANONYMOUS_LOGON_LUID (&h3e6, &h0)
 1959 #define LOCALSERVICE_LUID (&h3e5, &h0)
 1960 #define NETWORKSERVICE_LUID (&h3e4, &h0)
 1961 #define IUSER_LUID (&h3e3, &h0)
 1962 const SE_GROUP_MANDATORY = &h00000001
 1963 const SE_GROUP_ENABLED_BY_DEFAULT = &h00000002
 1964 const SE_GROUP_ENABLED = &h00000004
 1965 const SE_GROUP_OWNER = &h00000008
 1966 const SE_GROUP_USE_FOR_DENY_ONLY = &h00000010
 1967 const SE_GROUP_INTEGRITY = &h00000020
 1968 const SE_GROUP_INTEGRITY_ENABLED = &h00000040
 1969 const SE_GROUP_LOGON_ID = &hC0000000
 1970 const SE_GROUP_RESOURCE = &h20000000
 1971 const 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
 1972 const ACL_REVISION = 2
 1973 const ACL_REVISION_DS = 4
 1974 const ACL_REVISION1 = 1
 1975 const ACL_REVISION2 = 2
 1976 const MIN_ACL_REVISION = ACL_REVISION2
 1977 const ACL_REVISION3 = 3
 1978 const ACL_REVISION4 = 4
 1979 const MAX_ACL_REVISION = ACL_REVISION4
 1980 
 1981 type _ACL
 1982     AclRevision as UBYTE
 1983     Sbz1 as UBYTE
 1984     AclSize as WORD
 1985     AceCount as WORD
 1986     Sbz2 as WORD
 1987 end type
 1988 
 1989 type ACL as _ACL
 1990 type PACL as ACL ptr
 1991 
 1992 type _ACE_HEADER
 1993     AceType as UBYTE
 1994     AceFlags as UBYTE
 1995     AceSize as WORD
 1996 end type
 1997 
 1998 type ACE_HEADER as _ACE_HEADER
 1999 type PACE_HEADER as ACE_HEADER ptr
 2000 const ACCESS_MIN_MS_ACE_TYPE = &h0
 2001 const ACCESS_ALLOWED_ACE_TYPE = &h0
 2002 const ACCESS_DENIED_ACE_TYPE = &h1
 2003 const SYSTEM_AUDIT_ACE_TYPE = &h2
 2004 const SYSTEM_ALARM_ACE_TYPE = &h3
 2005 const ACCESS_MAX_MS_V2_ACE_TYPE = &h3
 2006 const ACCESS_ALLOWED_COMPOUND_ACE_TYPE = &h4
 2007 const ACCESS_MAX_MS_V3_ACE_TYPE = &h4
 2008 const ACCESS_MIN_MS_OBJECT_ACE_TYPE = &h5
 2009 const ACCESS_ALLOWED_OBJECT_ACE_TYPE = &h5
 2010 const ACCESS_DENIED_OBJECT_ACE_TYPE = &h6
 2011 const SYSTEM_AUDIT_OBJECT_ACE_TYPE = &h7
 2012 const SYSTEM_ALARM_OBJECT_ACE_TYPE = &h8
 2013 const ACCESS_MAX_MS_OBJECT_ACE_TYPE = &h8
 2014 const ACCESS_MAX_MS_V4_ACE_TYPE = &h8
 2015 const ACCESS_MAX_MS_ACE_TYPE = &h8
 2016 const ACCESS_ALLOWED_CALLBACK_ACE_TYPE = &h9
 2017 const ACCESS_DENIED_CALLBACK_ACE_TYPE = &hA
 2018 const ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE = &hB
 2019 const ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE = &hC
 2020 const SYSTEM_AUDIT_CALLBACK_ACE_TYPE = &hD
 2021 const SYSTEM_ALARM_CALLBACK_ACE_TYPE = &hE
 2022 const SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE = &hF
 2023 const SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE = &h10
 2024 const SYSTEM_MANDATORY_LABEL_ACE_TYPE = &h11
 2025 const SYSTEM_RESOURCE_ATTRIBUTE_ACE_TYPE = &h12
 2026 const SYSTEM_SCOPED_POLICY_ID_ACE_TYPE = &h13
 2027 const ACCESS_MAX_MS_V5_ACE_TYPE = &h13
 2028 const OBJECT_INHERIT_ACE = &h1
 2029 const CONTAINER_INHERIT_ACE = &h2
 2030 const NO_PROPAGATE_INHERIT_ACE = &h4
 2031 const INHERIT_ONLY_ACE = &h8
 2032 const INHERITED_ACE = &h10
 2033 const VALID_INHERIT_FLAGS = &h1F
 2034 const SUCCESSFUL_ACCESS_ACE_FLAG = &h40
 2035 const FAILED_ACCESS_ACE_FLAG = &h80
 2036 
 2037 type _ACCESS_ALLOWED_ACE
 2038     Header as ACE_HEADER
 2039     Mask as ACCESS_MASK
 2040     SidStart as DWORD
 2041 end type
 2042 
 2043 type ACCESS_ALLOWED_ACE as _ACCESS_ALLOWED_ACE
 2044 type PACCESS_ALLOWED_ACE as ACCESS_ALLOWED_ACE ptr
 2045 
 2046 type _ACCESS_DENIED_ACE
 2047     Header as ACE_HEADER
 2048     Mask as ACCESS_MASK
 2049     SidStart as DWORD
 2050 end type
 2051 
 2052 type ACCESS_DENIED_ACE as _ACCESS_DENIED_ACE
 2053 type PACCESS_DENIED_ACE as ACCESS_DENIED_ACE ptr
 2054 
 2055 type _SYSTEM_AUDIT_ACE
 2056     Header as ACE_HEADER
 2057     Mask as ACCESS_MASK
 2058     SidStart as DWORD
 2059 end type
 2060 
 2061 type SYSTEM_AUDIT_ACE as _SYSTEM_AUDIT_ACE
 2062 type PSYSTEM_AUDIT_ACE as SYSTEM_AUDIT_ACE ptr
 2063 
 2064 type _SYSTEM_ALARM_ACE
 2065     Header as ACE_HEADER
 2066     Mask as ACCESS_MASK
 2067     SidStart as DWORD
 2068 end type
 2069 
 2070 type SYSTEM_ALARM_ACE as _SYSTEM_ALARM_ACE
 2071 type PSYSTEM_ALARM_ACE as SYSTEM_ALARM_ACE ptr
 2072 
 2073 type _SYSTEM_RESOURCE_ATTRIBUTE_ACE
 2074     Header as ACE_HEADER
 2075     Mask as ACCESS_MASK
 2076     SidStart as DWORD
 2077 end type
 2078 
 2079 type SYSTEM_RESOURCE_ATTRIBUTE_ACE as _SYSTEM_RESOURCE_ATTRIBUTE_ACE
 2080 type PSYSTEM_RESOURCE_ATTRIBUTE_ACE as _SYSTEM_RESOURCE_ATTRIBUTE_ACE ptr
 2081 
 2082 type _SYSTEM_SCOPED_POLICY_ID_ACE
 2083     Header as ACE_HEADER
 2084     Mask as ACCESS_MASK
 2085     SidStart as DWORD
 2086 end type
 2087 
 2088 type SYSTEM_SCOPED_POLICY_ID_ACE as _SYSTEM_SCOPED_POLICY_ID_ACE
 2089 type PSYSTEM_SCOPED_POLICY_ID_ACE as _SYSTEM_SCOPED_POLICY_ID_ACE ptr
 2090 
 2091 type _SYSTEM_MANDATORY_LABEL_ACE
 2092     Header as ACE_HEADER
 2093     Mask as ACCESS_MASK
 2094     SidStart as DWORD
 2095 end type
 2096 
 2097 type SYSTEM_MANDATORY_LABEL_ACE as _SYSTEM_MANDATORY_LABEL_ACE
 2098 type PSYSTEM_MANDATORY_LABEL_ACE as _SYSTEM_MANDATORY_LABEL_ACE ptr
 2099 const SYSTEM_MANDATORY_LABEL_NO_WRITE_UP = &h1
 2100 const SYSTEM_MANDATORY_LABEL_NO_READ_UP = &h2
 2101 const SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP = &h4
 2102 const 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
 2103 
 2104 type _ACCESS_ALLOWED_OBJECT_ACE
 2105     Header as ACE_HEADER
 2106     Mask as ACCESS_MASK
 2107     Flags as DWORD
 2108     ObjectType as GUID
 2109     InheritedObjectType as GUID
 2110     SidStart as DWORD
 2111 end type
 2112 
 2113 type ACCESS_ALLOWED_OBJECT_ACE as _ACCESS_ALLOWED_OBJECT_ACE
 2114 type PACCESS_ALLOWED_OBJECT_ACE as _ACCESS_ALLOWED_OBJECT_ACE ptr
 2115 
 2116 type _ACCESS_DENIED_OBJECT_ACE
 2117     Header as ACE_HEADER
 2118     Mask as ACCESS_MASK
 2119     Flags as DWORD
 2120     ObjectType as GUID
 2121     InheritedObjectType as GUID
 2122     SidStart as DWORD
 2123 end type
 2124 
 2125 type ACCESS_DENIED_OBJECT_ACE as _ACCESS_DENIED_OBJECT_ACE
 2126 type PACCESS_DENIED_OBJECT_ACE as _ACCESS_DENIED_OBJECT_ACE ptr
 2127 
 2128 type _SYSTEM_AUDIT_OBJECT_ACE
 2129     Header as ACE_HEADER
 2130     Mask as ACCESS_MASK
 2131     Flags as DWORD
 2132     ObjectType as GUID
 2133     InheritedObjectType as GUID
 2134     SidStart as DWORD
 2135 end type
 2136 
 2137 type SYSTEM_AUDIT_OBJECT_ACE as _SYSTEM_AUDIT_OBJECT_ACE
 2138 type PSYSTEM_AUDIT_OBJECT_ACE as _SYSTEM_AUDIT_OBJECT_ACE ptr
 2139 
 2140 type _SYSTEM_ALARM_OBJECT_ACE
 2141     Header as ACE_HEADER
 2142     Mask as ACCESS_MASK
 2143     Flags as DWORD
 2144     ObjectType as GUID
 2145     InheritedObjectType as GUID
 2146     SidStart as DWORD
 2147 end type
 2148 
 2149 type SYSTEM_ALARM_OBJECT_ACE as _SYSTEM_ALARM_OBJECT_ACE
 2150 type PSYSTEM_ALARM_OBJECT_ACE as _SYSTEM_ALARM_OBJECT_ACE ptr
 2151 
 2152 type _ACCESS_ALLOWED_CALLBACK_ACE
 2153     Header as ACE_HEADER
 2154     Mask as ACCESS_MASK
 2155     SidStart as DWORD
 2156 end type
 2157 
 2158 type ACCESS_ALLOWED_CALLBACK_ACE as _ACCESS_ALLOWED_CALLBACK_ACE
 2159 type PACCESS_ALLOWED_CALLBACK_ACE as _ACCESS_ALLOWED_CALLBACK_ACE ptr
 2160 
 2161 type _ACCESS_DENIED_CALLBACK_ACE
 2162     Header as ACE_HEADER
 2163     Mask as ACCESS_MASK
 2164     SidStart as DWORD
 2165 end type
 2166 
 2167 type ACCESS_DENIED_CALLBACK_ACE as _ACCESS_DENIED_CALLBACK_ACE
 2168 type PACCESS_DENIED_CALLBACK_ACE as _ACCESS_DENIED_CALLBACK_ACE ptr
 2169 
 2170 type _SYSTEM_AUDIT_CALLBACK_ACE
 2171     Header as ACE_HEADER
 2172     Mask as ACCESS_MASK
 2173     SidStart as DWORD
 2174 end type
 2175 
 2176 type SYSTEM_AUDIT_CALLBACK_ACE as _SYSTEM_AUDIT_CALLBACK_ACE
 2177 type PSYSTEM_AUDIT_CALLBACK_ACE as _SYSTEM_AUDIT_CALLBACK_ACE ptr
 2178 
 2179 type _SYSTEM_ALARM_CALLBACK_ACE
 2180     Header as ACE_HEADER
 2181     Mask as ACCESS_MASK
 2182     SidStart as DWORD
 2183 end type
 2184 
 2185 type SYSTEM_ALARM_CALLBACK_ACE as _SYSTEM_ALARM_CALLBACK_ACE
 2186 type PSYSTEM_ALARM_CALLBACK_ACE as _SYSTEM_ALARM_CALLBACK_ACE ptr
 2187 
 2188 type _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
 2189     Header as ACE_HEADER
 2190     Mask as ACCESS_MASK
 2191     Flags as DWORD
 2192     ObjectType as GUID
 2193     InheritedObjectType as GUID
 2194     SidStart as DWORD
 2195 end type
 2196 
 2197 type ACCESS_ALLOWED_CALLBACK_OBJECT_ACE as _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
 2198 type PACCESS_ALLOWED_CALLBACK_OBJECT_ACE as _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE ptr
 2199 
 2200 type _ACCESS_DENIED_CALLBACK_OBJECT_ACE
 2201     Header as ACE_HEADER
 2202     Mask as ACCESS_MASK
 2203     Flags as DWORD
 2204     ObjectType as GUID
 2205     InheritedObjectType as GUID
 2206     SidStart as DWORD
 2207 end type
 2208 
 2209 type ACCESS_DENIED_CALLBACK_OBJECT_ACE as _ACCESS_DENIED_CALLBACK_OBJECT_ACE
 2210 type PACCESS_DENIED_CALLBACK_OBJECT_ACE as _ACCESS_DENIED_CALLBACK_OBJECT_ACE ptr
 2211 
 2212 type _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
 2213     Header as ACE_HEADER
 2214     Mask as ACCESS_MASK
 2215     Flags as DWORD
 2216     ObjectType as GUID
 2217     InheritedObjectType as GUID
 2218     SidStart as DWORD
 2219 end type
 2220 
 2221 type SYSTEM_AUDIT_CALLBACK_OBJECT_ACE as _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
 2222 type PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE as _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE ptr
 2223 
 2224 type _SYSTEM_ALARM_CALLBACK_OBJECT_ACE
 2225     Header as ACE_HEADER
 2226     Mask as ACCESS_MASK
 2227     Flags as DWORD
 2228     ObjectType as GUID
 2229     InheritedObjectType as GUID
 2230     SidStart as DWORD
 2231 end type
 2232 
 2233 type SYSTEM_ALARM_CALLBACK_OBJECT_ACE as _SYSTEM_ALARM_CALLBACK_OBJECT_ACE
 2234 type PSYSTEM_ALARM_CALLBACK_OBJECT_ACE as _SYSTEM_ALARM_CALLBACK_OBJECT_ACE ptr
 2235 const ACE_OBJECT_TYPE_PRESENT = &h1
 2236 const ACE_INHERITED_OBJECT_TYPE_PRESENT = &h2
 2237 
 2238 type _ACL_INFORMATION_CLASS as long
 2239 enum
 2240     AclRevisionInformation = 1
 2241     AclSizeInformation
 2242 end enum
 2243 
 2244 type ACL_INFORMATION_CLASS as _ACL_INFORMATION_CLASS
 2245 
 2246 type _ACL_REVISION_INFORMATION
 2247     AclRevision as DWORD
 2248 end type
 2249 
 2250 type ACL_REVISION_INFORMATION as _ACL_REVISION_INFORMATION
 2251 type PACL_REVISION_INFORMATION as ACL_REVISION_INFORMATION ptr
 2252 
 2253 type _ACL_SIZE_INFORMATION
 2254     AceCount as DWORD
 2255     AclBytesInUse as DWORD
 2256     AclBytesFree as DWORD
 2257 end type
 2258 
 2259 type ACL_SIZE_INFORMATION as _ACL_SIZE_INFORMATION
 2260 type PACL_SIZE_INFORMATION as ACL_SIZE_INFORMATION ptr
 2261 const SECURITY_DESCRIPTOR_REVISION = 1
 2262 const SECURITY_DESCRIPTOR_REVISION1 = 1
 2263 #define SECURITY_DESCRIPTOR_MIN_LENGTH sizeof(SECURITY_DESCRIPTOR)
 2264 type SECURITY_DESCRIPTOR_CONTROL as WORD
 2265 type PSECURITY_DESCRIPTOR_CONTROL as WORD ptr
 2266 const SE_OWNER_DEFAULTED = &h0001
 2267 const SE_GROUP_DEFAULTED = &h0002
 2268 const SE_DACL_PRESENT = &h0004
 2269 const SE_DACL_DEFAULTED = &h0008
 2270 const SE_SACL_PRESENT = &h0010
 2271 const SE_SACL_DEFAULTED = &h0020
 2272 const SE_DACL_AUTO_INHERIT_REQ = &h0100
 2273 const SE_SACL_AUTO_INHERIT_REQ = &h0200
 2274 const SE_DACL_AUTO_INHERITED = &h0400
 2275 const SE_SACL_AUTO_INHERITED = &h0800
 2276 const SE_DACL_PROTECTED = &h1000
 2277 const SE_SACL_PROTECTED = &h2000
 2278 const SE_RM_CONTROL_VALID = &h4000
 2279 const SE_SELF_RELATIVE = &h8000
 2280 
 2281 type _SECURITY_DESCRIPTOR_RELATIVE
 2282     Revision as UBYTE
 2283     Sbz1 as UBYTE
 2284     Control as SECURITY_DESCRIPTOR_CONTROL
 2285     Owner as DWORD
 2286     Group as DWORD
 2287     Sacl as DWORD
 2288     Dacl as DWORD
 2289 end type
 2290 
 2291 type SECURITY_DESCRIPTOR_RELATIVE as _SECURITY_DESCRIPTOR_RELATIVE
 2292 type PISECURITY_DESCRIPTOR_RELATIVE as _SECURITY_DESCRIPTOR_RELATIVE ptr
 2293 
 2294 type _SECURITY_DESCRIPTOR
 2295     Revision as UBYTE
 2296     Sbz1 as UBYTE
 2297     Control as SECURITY_DESCRIPTOR_CONTROL
 2298     Owner as PSID
 2299     Group as PSID
 2300     Sacl as PACL
 2301     Dacl as PACL
 2302 end type
 2303 
 2304 type SECURITY_DESCRIPTOR as _SECURITY_DESCRIPTOR
 2305 type PISECURITY_DESCRIPTOR as _SECURITY_DESCRIPTOR ptr
 2306 
 2307 type _OBJECT_TYPE_LIST
 2308     Level as WORD
 2309     Sbz as WORD
 2310     ObjectType as GUID ptr
 2311 end type
 2312 
 2313 type OBJECT_TYPE_LIST as _OBJECT_TYPE_LIST
 2314 type POBJECT_TYPE_LIST as _OBJECT_TYPE_LIST ptr
 2315 const ACCESS_OBJECT_GUID = 0
 2316 const ACCESS_PROPERTY_SET_GUID = 1
 2317 const ACCESS_PROPERTY_GUID = 2
 2318 const ACCESS_MAX_LEVEL = 4
 2319 
 2320 type _AUDIT_EVENT_TYPE as long
 2321 enum
 2322     AuditEventObjectAccess
 2323     AuditEventDirectoryServiceAccess
 2324 end enum
 2325 
 2326 type AUDIT_EVENT_TYPE as _AUDIT_EVENT_TYPE
 2327 type PAUDIT_EVENT_TYPE as _AUDIT_EVENT_TYPE ptr
 2328 const AUDIT_ALLOW_NO_PRIVILEGE = &h1
 2329 #define ACCESS_DS_SOURCE_A "DS"
 2330 #define ACCESS_DS_SOURCE_W wstr("DS")
 2331 #define ACCESS_DS_OBJECT_TYPE_NAME_A "Directory Service Object"
 2332 #define ACCESS_DS_OBJECT_TYPE_NAME_W wstr("Directory Service Object")
 2333 const SE_PRIVILEGE_ENABLED_BY_DEFAULT = &h00000001
 2334 const SE_PRIVILEGE_ENABLED = &h00000002
 2335 const SE_PRIVILEGE_REMOVED = &h00000004
 2336 const SE_PRIVILEGE_USED_FOR_ACCESS = &h80000000
 2337 const SE_PRIVILEGE_VALID_ATTRIBUTES = ((SE_PRIVILEGE_ENABLED_BY_DEFAULT or SE_PRIVILEGE_ENABLED) or SE_PRIVILEGE_REMOVED) or SE_PRIVILEGE_USED_FOR_ACCESS
 2338 const PRIVILEGE_SET_ALL_NECESSARY = 1
 2339 
 2340 type _PRIVILEGE_SET
 2341     PrivilegeCount as DWORD
 2342     Control as DWORD
 2343     Privilege(0 to 0) as LUID_AND_ATTRIBUTES
 2344 end type
 2345 
 2346 type PRIVILEGE_SET as _PRIVILEGE_SET
 2347 type PPRIVILEGE_SET as _PRIVILEGE_SET ptr
 2348 const ACCESS_REASON_TYPE_MASK = &h00ff0000
 2349 const ACCESS_REASON_DATA_MASK = &h0000ffff
 2350 const ACCESS_REASON_STAGING_MASK = &h80000000
 2351 const ACCESS_REASON_EXDATA_MASK = &h7f000000
 2352 
 2353 type _ACCESS_REASON_TYPE as long
 2354 enum
 2355     AccessReasonNone = &h00000000
 2356     AccessReasonAllowedAce = &h00010000
 2357     AccessReasonDeniedAce = &h00020000
 2358     AccessReasonAllowedParentAce = &h00030000
 2359     AccessReasonDeniedParentAce = &h00040000
 2360     AccessReasonNotGrantedByCape = &h00050000
 2361     AccessReasonNotGrantedByParentCape = &h00060000
 2362     AccessReasonNotGrantedToAppContainer = &h00070000
 2363     AccessReasonMissingPrivilege = &h00100000
 2364     AccessReasonFromPrivilege = &h00200000
 2365     AccessReasonIntegrityLevel = &h00300000
 2366     AccessReasonOwnership = &h00400000
 2367     AccessReasonNullDacl = &h00500000
 2368     AccessReasonEmptyDacl = &h00600000
 2369     AccessReasonNoSD = &h00700000
 2370     AccessReasonNoGrant = &h00800000
 2371 end enum
 2372 
 2373 type ACCESS_REASON_TYPE as _ACCESS_REASON_TYPE
 2374 type ACCESS_REASON as DWORD
 2375 
 2376 type _ACCESS_REASONS
 2377     Data(0 to 31) as ACCESS_REASON
 2378 end type
 2379 
 2380 type ACCESS_REASONS as _ACCESS_REASONS
 2381 type PACCESS_REASONS as _ACCESS_REASONS ptr
 2382 const SE_SECURITY_DESCRIPTOR_FLAG_NO_OWNER_ACE = &h00000001
 2383 const SE_SECURITY_DESCRIPTOR_FLAG_NO_LABEL_ACE = &h00000002
 2384 const SE_SECURITY_DESCRIPTOR_VALID_FLAGS = &h00000003
 2385 
 2386 type _SE_SECURITY_DESCRIPTOR
 2387     Size as DWORD
 2388     Flags as DWORD
 2389     SecurityDescriptor as PSECURITY_DESCRIPTOR
 2390 end type
 2391 
 2392 type SE_SECURITY_DESCRIPTOR as _SE_SECURITY_DESCRIPTOR
 2393 type PSE_SECURITY_DESCRIPTOR as _SE_SECURITY_DESCRIPTOR ptr
 2394 
 2395 type _SE_ACCESS_REQUEST
 2396     Size as DWORD
 2397     SeSecurityDescriptor as PSE_SECURITY_DESCRIPTOR
 2398     DesiredAccess as ACCESS_MASK
 2399     PreviouslyGrantedAccess as ACCESS_MASK
 2400     PrincipalSelfSid as PSID
 2401     GenericMapping as PGENERIC_MAPPING
 2402     ObjectTypeListCount as DWORD
 2403     ObjectTypeList as POBJECT_TYPE_LIST
 2404 end type
 2405 
 2406 type SE_ACCESS_REQUEST as _SE_ACCESS_REQUEST
 2407 type PSE_ACCESS_REQUEST as _SE_ACCESS_REQUEST ptr
 2408 
 2409 type _SE_ACCESS_REPLY
 2410     Size as DWORD
 2411     ResultListCount as DWORD
 2412     GrantedAccess as PACCESS_MASK
 2413     AccessStatus as PDWORD
 2414     AccessReason as PACCESS_REASONS
 2415     Privileges as PPRIVILEGE_SET ptr
 2416 end type
 2417 
 2418 type SE_ACCESS_REPLY as _SE_ACCESS_REPLY
 2419 type PSE_ACCESS_REPLY as _SE_ACCESS_REPLY ptr
 2420 #define SE_CREATE_TOKEN_NAME __TEXT("SeCreateTokenPrivilege")
 2421 #define SE_ASSIGNPRIMARYTOKEN_NAME __TEXT("SeAssignPrimaryTokenPrivilege")
 2422 #define SE_LOCK_MEMORY_NAME __TEXT("SeLockMemoryPrivilege")
 2423 #define SE_INCREASE_QUOTA_NAME __TEXT("SeIncreaseQuotaPrivilege")
 2424 #define SE_UNSOLICITED_INPUT_NAME __TEXT("SeUnsolicitedInputPrivilege")
 2425 #define SE_MACHINE_ACCOUNT_NAME __TEXT("SeMachineAccountPrivilege")
 2426 #define SE_TCB_NAME __TEXT("SeTcbPrivilege")
 2427 #define SE_SECURITY_NAME __TEXT("SeSecurityPrivilege")
 2428 #define SE_TAKE_OWNERSHIP_NAME __TEXT("SeTakeOwnershipPrivilege")
 2429 #define SE_LOAD_DRIVER_NAME __TEXT("SeLoadDriverPrivilege")
 2430 #define SE_SYSTEM_PROFILE_NAME __TEXT("SeSystemProfilePrivilege")
 2431 #define SE_SYSTEMTIME_NAME __TEXT("SeSystemtimePrivilege")
 2432 #define SE_PROF_SINGLE_PROCESS_NAME __TEXT("SeProfileSingleProcessPrivilege")
 2433 #define SE_INC_BASE_PRIORITY_NAME __TEXT("SeIncreaseBasePriorityPrivilege")
 2434 #define SE_CREATE_PAGEFILE_NAME __TEXT("SeCreatePagefilePrivilege")
 2435 #define SE_CREATE_PERMANENT_NAME __TEXT("SeCreatePermanentPrivilege")
 2436 #define SE_BACKUP_NAME __TEXT("SeBackupPrivilege")
 2437 #define SE_RESTORE_NAME __TEXT("SeRestorePrivilege")
 2438 #define SE_SHUTDOWN_NAME __TEXT("SeShutdownPrivilege")
 2439 #define SE_DEBUG_NAME __TEXT("SeDebugPrivilege")
 2440 #define SE_AUDIT_NAME __TEXT("SeAuditPrivilege")
 2441 #define SE_SYSTEM_ENVIRONMENT_NAME __TEXT("SeSystemEnvironmentPrivilege")
 2442 #define SE_CHANGE_NOTIFY_NAME __TEXT("SeChangeNotifyPrivilege")
 2443 #define SE_REMOTE_SHUTDOWN_NAME __TEXT("SeRemoteShutdownPrivilege")
 2444 #define SE_UNDOCK_NAME __TEXT("SeUndockPrivilege")
 2445 #define SE_SYNC_AGENT_NAME __TEXT("SeSyncAgentPrivilege")
 2446 #define SE_ENABLE_DELEGATION_NAME __TEXT("SeEnableDelegationPrivilege")
 2447 #define SE_MANAGE_VOLUME_NAME __TEXT("SeManageVolumePrivilege")
 2448 #define SE_IMPERSONATE_NAME __TEXT("SeImpersonatePrivilege")
 2449 #define SE_CREATE_GLOBAL_NAME __TEXT("SeCreateGlobalPrivilege")
 2450 #define SE_TRUSTED_CREDMAN_ACCESS_NAME __TEXT("SeTrustedCredManAccessPrivilege")
 2451 #define SE_RELABEL_NAME __TEXT("SeRelabelPrivilege")
 2452 #define SE_INC_WORKING_SET_NAME __TEXT("SeIncreaseWorkingSetPrivilege")
 2453 #define SE_TIME_ZONE_NAME __TEXT("SeTimeZonePrivilege")
 2454 #define SE_CREATE_SYMBOLIC_LINK_NAME __TEXT("SeCreateSymbolicLinkPrivilege")
 2455 
 2456 type _SECURITY_IMPERSONATION_LEVEL as long
 2457 enum
 2458     SecurityAnonymous
 2459     SecurityIdentification
 2460     SecurityImpersonation
 2461     SecurityDelegation
 2462 end enum
 2463 
 2464 type SECURITY_IMPERSONATION_LEVEL as _SECURITY_IMPERSONATION_LEVEL
 2465 type PSECURITY_IMPERSONATION_LEVEL as _SECURITY_IMPERSONATION_LEVEL ptr
 2466 const SECURITY_MAX_IMPERSONATION_LEVEL = SecurityDelegation
 2467 const SECURITY_MIN_IMPERSONATION_LEVEL = SecurityAnonymous
 2468 const DEFAULT_IMPERSONATION_LEVEL = SecurityImpersonation
 2469 #define VALID_IMPERSONATION_LEVEL(L) (((L) >= SECURITY_MIN_IMPERSONATION_LEVEL) andalso ((L) <= SECURITY_MAX_IMPERSONATION_LEVEL))
 2470 const TOKEN_ASSIGN_PRIMARY = &h0001
 2471 const TOKEN_DUPLICATE = &h0002
 2472 const TOKEN_IMPERSONATE = &h0004
 2473 const TOKEN_QUERY = &h0008
 2474 const TOKEN_QUERY_SOURCE = &h0010
 2475 const TOKEN_ADJUST_PRIVILEGES = &h0020
 2476 const TOKEN_ADJUST_GROUPS = &h0040
 2477 const TOKEN_ADJUST_DEFAULT = &h0080
 2478 const TOKEN_ADJUST_SESSIONID = &h0100
 2479 const 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
 2480 const TOKEN_ALL_ACCESS = TOKEN_ALL_ACCESS_P or TOKEN_ADJUST_SESSIONID
 2481 const TOKEN_READ = STANDARD_RIGHTS_READ or TOKEN_QUERY
 2482 const TOKEN_WRITE = ((STANDARD_RIGHTS_WRITE or TOKEN_ADJUST_PRIVILEGES) or TOKEN_ADJUST_GROUPS) or TOKEN_ADJUST_DEFAULT
 2483 const TOKEN_EXECUTE = STANDARD_RIGHTS_EXECUTE
 2484 
 2485 type _TOKEN_TYPE as long
 2486 enum
 2487     TokenPrimary = 1
 2488     TokenImpersonation
 2489 end enum
 2490 
 2491 type TOKEN_TYPE as _TOKEN_TYPE
 2492 type PTOKEN_TYPE as TOKEN_TYPE ptr
 2493 
 2494 type _TOKEN_ELEVATION_TYPE as long
 2495 enum
 2496     TokenElevationTypeDefault = 1
 2497     TokenElevationTypeFull
 2498     TokenElevationTypeLimited
 2499 end enum
 2500 
 2501 type TOKEN_ELEVATION_TYPE as _TOKEN_ELEVATION_TYPE
 2502 type PTOKEN_ELEVATION_TYPE as _TOKEN_ELEVATION_TYPE ptr
 2503 
 2504 type _TOKEN_INFORMATION_CLASS as long
 2505 enum
 2506     TokenUser = 1
 2507     TokenGroups
 2508     TokenPrivileges
 2509     TokenOwner
 2510     TokenPrimaryGroup
 2511     TokenDefaultDacl
 2512     TokenSource
 2513     TokenType
 2514     TokenImpersonationLevel
 2515     TokenStatistics
 2516     TokenRestrictedSids
 2517     TokenSessionId
 2518     TokenGroupsAndPrivileges
 2519     TokenSessionReference
 2520     TokenSandBoxInert
 2521     TokenAuditPolicy
 2522     TokenOrigin
 2523     TokenElevationType
 2524     TokenLinkedToken
 2525     TokenElevation
 2526     TokenHasRestrictions
 2527     TokenAccessInformation
 2528     TokenVirtualizationAllowed
 2529     TokenVirtualizationEnabled
 2530     TokenIntegrityLevel
 2531     TokenUIAccess
 2532     TokenMandatoryPolicy
 2533     TokenLogonSid
 2534     TokenIsAppContainer
 2535     TokenCapabilities
 2536     TokenAppContainerSid
 2537     TokenAppContainerNumber
 2538     TokenUserClaimAttributes
 2539     TokenDeviceClaimAttributes
 2540     TokenRestrictedUserClaimAttributes
 2541     TokenRestrictedDeviceClaimAttributes
 2542     TokenDeviceGroups
 2543     TokenRestrictedDeviceGroups
 2544     TokenSecurityAttributes
 2545     TokenIsRestricted
 2546     MaxTokenInfoClass
 2547 end enum
 2548 
 2549 type TOKEN_INFORMATION_CLASS as _TOKEN_INFORMATION_CLASS
 2550 type PTOKEN_INFORMATION_CLASS as _TOKEN_INFORMATION_CLASS ptr
 2551 
 2552 type _TOKEN_USER
 2553     User as SID_AND_ATTRIBUTES
 2554 end type
 2555 
 2556 type TOKEN_USER as _TOKEN_USER
 2557 type PTOKEN_USER as _TOKEN_USER ptr
 2558 
 2559 type _TOKEN_GROUPS
 2560     GroupCount as DWORD
 2561     Groups(0 to 0) as SID_AND_ATTRIBUTES
 2562 end type
 2563 
 2564 type TOKEN_GROUPS as _TOKEN_GROUPS
 2565 type PTOKEN_GROUPS as _TOKEN_GROUPS ptr
 2566 
 2567 type _TOKEN_PRIVILEGES
 2568     PrivilegeCount as DWORD
 2569     Privileges(0 to 0) as LUID_AND_ATTRIBUTES
 2570 end type
 2571 
 2572 type TOKEN_PRIVILEGES as _TOKEN_PRIVILEGES
 2573 type PTOKEN_PRIVILEGES as _TOKEN_PRIVILEGES ptr
 2574 
 2575 type _TOKEN_OWNER
 2576     Owner as PSID
 2577 end type
 2578 
 2579 type TOKEN_OWNER as _TOKEN_OWNER
 2580 type PTOKEN_OWNER as _TOKEN_OWNER ptr
 2581 
 2582 type _TOKEN_PRIMARY_GROUP
 2583     PrimaryGroup as PSID
 2584 end type
 2585 
 2586 type TOKEN_PRIMARY_GROUP as _TOKEN_PRIMARY_GROUP
 2587 type PTOKEN_PRIMARY_GROUP as _TOKEN_PRIMARY_GROUP ptr
 2588 
 2589 type _TOKEN_DEFAULT_DACL
 2590     DefaultDacl as PACL
 2591 end type
 2592 
 2593 type TOKEN_DEFAULT_DACL as _TOKEN_DEFAULT_DACL
 2594 type PTOKEN_DEFAULT_DACL as _TOKEN_DEFAULT_DACL ptr
 2595 
 2596 type _TOKEN_USER_CLAIMS
 2597     UserClaims as PCLAIMS_BLOB
 2598 end type
 2599 
 2600 type TOKEN_USER_CLAIMS as _TOKEN_USER_CLAIMS
 2601 type PTOKEN_USER_CLAIMS as _TOKEN_USER_CLAIMS ptr
 2602 
 2603 type _TOKEN_DEVICE_CLAIMS
 2604     DeviceClaims as PCLAIMS_BLOB
 2605 end type
 2606 
 2607 type TOKEN_DEVICE_CLAIMS as _TOKEN_DEVICE_CLAIMS
 2608 type PTOKEN_DEVICE_CLAIMS as _TOKEN_DEVICE_CLAIMS ptr
 2609 
 2610 type _TOKEN_GROUPS_AND_PRIVILEGES
 2611     SidCount as DWORD
 2612     SidLength as DWORD
 2613     Sids as PSID_AND_ATTRIBUTES
 2614     RestrictedSidCount as DWORD
 2615     RestrictedSidLength as DWORD
 2616     RestrictedSids as PSID_AND_ATTRIBUTES
 2617     PrivilegeCount as DWORD
 2618     PrivilegeLength as DWORD
 2619     Privileges as PLUID_AND_ATTRIBUTES
 2620     AuthenticationId as LUID
 2621 end type
 2622 
 2623 type TOKEN_GROUPS_AND_PRIVILEGES as _TOKEN_GROUPS_AND_PRIVILEGES
 2624 type PTOKEN_GROUPS_AND_PRIVILEGES as _TOKEN_GROUPS_AND_PRIVILEGES ptr
 2625 
 2626 type _TOKEN_LINKED_TOKEN
 2627     LinkedToken as HANDLE
 2628 end type
 2629 
 2630 type TOKEN_LINKED_TOKEN as _TOKEN_LINKED_TOKEN
 2631 type PTOKEN_LINKED_TOKEN as _TOKEN_LINKED_TOKEN ptr
 2632 
 2633 type _TOKEN_ELEVATION
 2634     TokenIsElevated as DWORD
 2635 end type
 2636 
 2637 type TOKEN_ELEVATION as _TOKEN_ELEVATION
 2638 type PTOKEN_ELEVATION as _TOKEN_ELEVATION ptr
 2639 
 2640 type _TOKEN_MANDATORY_LABEL
 2641     Label as SID_AND_ATTRIBUTES
 2642 end type
 2643 
 2644 type TOKEN_MANDATORY_LABEL as _TOKEN_MANDATORY_LABEL
 2645 type PTOKEN_MANDATORY_LABEL as _TOKEN_MANDATORY_LABEL ptr
 2646 const TOKEN_MANDATORY_POLICY_OFF = &h0
 2647 const TOKEN_MANDATORY_POLICY_NO_WRITE_UP = &h1
 2648 const TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN = &h2
 2649 const TOKEN_MANDATORY_POLICY_VALID_MASK = TOKEN_MANDATORY_POLICY_NO_WRITE_UP or TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN
 2650 
 2651 type _TOKEN_MANDATORY_POLICY
 2652     Policy as DWORD
 2653 end type
 2654 
 2655 type TOKEN_MANDATORY_POLICY as _TOKEN_MANDATORY_POLICY
 2656 type PTOKEN_MANDATORY_POLICY as _TOKEN_MANDATORY_POLICY ptr
 2657 
 2658 type _TOKEN_ACCESS_INFORMATION
 2659     SidHash as PSID_AND_ATTRIBUTES_HASH
 2660     RestrictedSidHash as PSID_AND_ATTRIBUTES_HASH
 2661     Privileges as PTOKEN_PRIVILEGES
 2662     AuthenticationId as LUID
 2663     TokenType as TOKEN_TYPE
 2664     ImpersonationLevel as SECURITY_IMPERSONATION_LEVEL
 2665     MandatoryPolicy as TOKEN_MANDATORY_POLICY
 2666     Flags as DWORD
 2667     AppContainerNumber as DWORD
 2668     PackageSid as PSID
 2669     CapabilitiesHash as PSID_AND_ATTRIBUTES_HASH
 2670 end type
 2671 
 2672 type TOKEN_ACCESS_INFORMATION as _TOKEN_ACCESS_INFORMATION
 2673 type PTOKEN_ACCESS_INFORMATION as _TOKEN_ACCESS_INFORMATION ptr
 2674 const POLICY_AUDIT_SUBCATEGORY_COUNT = 56
 2675 
 2676 type _TOKEN_AUDIT_POLICY
 2677     PerUserPolicy(0 to ((56 shr 1) + 1) - 1) as UCHAR
 2678 end type
 2679 
 2680 type TOKEN_AUDIT_POLICY as _TOKEN_AUDIT_POLICY
 2681 type PTOKEN_AUDIT_POLICY as _TOKEN_AUDIT_POLICY ptr
 2682 const TOKEN_SOURCE_LENGTH = 8
 2683 
 2684 type _TOKEN_SOURCE
 2685     SourceName as zstring * 8
 2686     SourceIdentifier as LUID
 2687 end type
 2688 
 2689 type TOKEN_SOURCE as _TOKEN_SOURCE
 2690 type PTOKEN_SOURCE as _TOKEN_SOURCE ptr
 2691 
 2692 type _TOKEN_STATISTICS
 2693     TokenId as LUID
 2694     AuthenticationId as LUID
 2695     ExpirationTime as LARGE_INTEGER
 2696     TokenType as TOKEN_TYPE
 2697     ImpersonationLevel as SECURITY_IMPERSONATION_LEVEL
 2698     DynamicCharged as DWORD
 2699     DynamicAvailable as DWORD
 2700     GroupCount as DWORD
 2701     PrivilegeCount as DWORD
 2702     ModifiedId as LUID
 2703 end type
 2704 
 2705 type TOKEN_STATISTICS as _TOKEN_STATISTICS
 2706 type PTOKEN_STATISTICS as _TOKEN_STATISTICS ptr
 2707 
 2708 type _TOKEN_CONTROL
 2709     TokenId as LUID
 2710     AuthenticationId as LUID
 2711     ModifiedId as LUID
 2712     TokenSource as TOKEN_SOURCE
 2713 end type
 2714 
 2715 type TOKEN_CONTROL as _TOKEN_CONTROL
 2716 type PTOKEN_CONTROL as _TOKEN_CONTROL ptr
 2717 
 2718 type _TOKEN_ORIGIN
 2719     OriginatingLogonSession as LUID
 2720 end type
 2721 
 2722 type TOKEN_ORIGIN as _TOKEN_ORIGIN
 2723 type PTOKEN_ORIGIN as _TOKEN_ORIGIN ptr
 2724 
 2725 type _MANDATORY_LEVEL as long
 2726 enum
 2727     MandatoryLevelUntrusted = 0
 2728     MandatoryLevelLow
 2729     MandatoryLevelMedium
 2730     MandatoryLevelHigh
 2731     MandatoryLevelSystem
 2732     MandatoryLevelSecureProcess
 2733     MandatoryLevelCount
 2734 end enum
 2735 
 2736 type MANDATORY_LEVEL as _MANDATORY_LEVEL
 2737 type PMANDATORY_LEVEL as _MANDATORY_LEVEL ptr
 2738 
 2739 type _TOKEN_APPCONTAINER_INFORMATION
 2740     TokenAppContainer as PSID
 2741 end type
 2742 
 2743 type TOKEN_APPCONTAINER_INFORMATION as _TOKEN_APPCONTAINER_INFORMATION
 2744 type PTOKEN_APPCONTAINER_INFORMATION as _TOKEN_APPCONTAINER_INFORMATION ptr
 2745 const CLAIM_SECURITY_ATTRIBUTE_TYPE_INVALID = &h00
 2746 const CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64 = &h01
 2747 const CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64 = &h02
 2748 const CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING = &h03
 2749 const CLAIM_SECURITY_ATTRIBUTE_TYPE_FQBN = &h04
 2750 const CLAIM_SECURITY_ATTRIBUTE_TYPE_SID = &h05
 2751 const CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN = &h06
 2752 
 2753 type _CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE
 2754     Version as DWORD64
 2755     Name as PWSTR
 2756 end type
 2757 
 2758 type CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE as _CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE
 2759 type PCLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE as _CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE ptr
 2760 
 2761 type _CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE
 2762     pValue as PVOID
 2763     ValueLength as DWORD
 2764 end type
 2765 
 2766 type CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE as _CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE
 2767 type PCLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE as _CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE ptr
 2768 const CLAIM_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING = &h10
 2769 const CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE = &h0001
 2770 const CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE = &h0002
 2771 const CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY = &h0004
 2772 const CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT = &h0008
 2773 const CLAIM_SECURITY_ATTRIBUTE_DISABLED = &h0010
 2774 const CLAIM_SECURITY_ATTRIBUTE_MANDATORY = &h0020
 2775 const CLAIM_SECURITY_ATTRIBUTE_VALID_FLAGS = ((((CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE or CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE) or CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY) or CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT) or CLAIM_SECURITY_ATTRIBUTE_DISABLED) or CLAIM_SECURITY_ATTRIBUTE_MANDATORY
 2776 const CLAIM_SECURITY_ATTRIBUTE_CUSTOM_FLAGS = &hffff0000
 2777 
 2778 union _CLAIM_SECURITY_ATTRIBUTE_V1_Values
 2779     pInt64 as PLONG64
 2780     pUint64 as PDWORD64
 2781     ppString as PWSTR ptr
 2782     pFqbn as PCLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE
 2783     pOctetString as PCLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE
 2784 end union
 2785 
 2786 type _CLAIM_SECURITY_ATTRIBUTE_V1
 2787     Name as PWSTR
 2788     ValueType as WORD
 2789     Reserved as WORD
 2790     Flags as DWORD
 2791     ValueCount as DWORD
 2792     Values as _CLAIM_SECURITY_ATTRIBUTE_V1_Values
 2793 end type
 2794 
 2795 type CLAIM_SECURITY_ATTRIBUTE_V1 as _CLAIM_SECURITY_ATTRIBUTE_V1
 2796 type PCLAIM_SECURITY_ATTRIBUTE_V1 as _CLAIM_SECURITY_ATTRIBUTE_V1 ptr
 2797 
 2798 union _CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_Values
 2799     pInt64(0 to 0) as DWORD
 2800     pUint64(0 to 0) as DWORD
 2801     ppString(0 to 0) as DWORD
 2802     pFqbn(0 to 0) as DWORD
 2803     pOctetString(0 to 0) as DWORD
 2804 end union
 2805 
 2806 type _CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1
 2807     Name as DWORD
 2808     ValueType as WORD
 2809     Reserved as WORD
 2810     Flags as DWORD
 2811     ValueCount as DWORD
 2812     Values as _CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_Values
 2813 end type
 2814 
 2815 type CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 as _CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1
 2816 type PCLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 as _CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 ptr
 2817 const CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1 = 1
 2818 const CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION = CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1
 2819 
 2820 union _CLAIM_SECURITY_ATTRIBUTES_INFORMATION_Attribute
 2821     pAttributeV1 as PCLAIM_SECURITY_ATTRIBUTE_V1
 2822 end union
 2823 
 2824 type _CLAIM_SECURITY_ATTRIBUTES_INFORMATION
 2825     Version as WORD
 2826     Reserved as WORD
 2827     AttributeCount as DWORD
 2828     Attribute as _CLAIM_SECURITY_ATTRIBUTES_INFORMATION_Attribute
 2829 end type
 2830 
 2831 type CLAIM_SECURITY_ATTRIBUTES_INFORMATION as _CLAIM_SECURITY_ATTRIBUTES_INFORMATION
 2832 type PCLAIM_SECURITY_ATTRIBUTES_INFORMATION as _CLAIM_SECURITY_ATTRIBUTES_INFORMATION ptr
 2833 const SECURITY_DYNAMIC_TRACKING = CTRUE
 2834 const SECURITY_STATIC_TRACKING = FALSE
 2835 type SECURITY_CONTEXT_TRACKING_MODE as WINBOOLEAN
 2836 type PSECURITY_CONTEXT_TRACKING_MODE as WINBOOLEAN ptr
 2837 
 2838 type _SECURITY_QUALITY_OF_SERVICE
 2839     Length as DWORD
 2840     ImpersonationLevel as SECURITY_IMPERSONATION_LEVEL
 2841     ContextTrackingMode as SECURITY_CONTEXT_TRACKING_MODE
 2842     EffectiveOnly as WINBOOLEAN
 2843 end type
 2844 
 2845 type SECURITY_QUALITY_OF_SERVICE as _SECURITY_QUALITY_OF_SERVICE
 2846 type PSECURITY_QUALITY_OF_SERVICE as _SECURITY_QUALITY_OF_SERVICE ptr
 2847 
 2848 type _SE_IMPERSONATION_STATE
 2849     Token as PACCESS_TOKEN
 2850     CopyOnOpen as WINBOOLEAN
 2851     EffectiveOnly as WINBOOLEAN
 2852     Level as SECURITY_IMPERSONATION_LEVEL
 2853 end type
 2854 
 2855 type SE_IMPERSONATION_STATE as _SE_IMPERSONATION_STATE
 2856 type PSE_IMPERSONATION_STATE as _SE_IMPERSONATION_STATE ptr
 2857 const DISABLE_MAX_PRIVILEGE = &h1
 2858 const SANDBOX_INERT = &h2
 2859 const LUA_TOKEN = &h4
 2860 const WRITE_RESTRICTED = &h8
 2861 type SECURITY_INFORMATION as DWORD
 2862 type PSECURITY_INFORMATION as DWORD ptr
 2863 const OWNER_SECURITY_INFORMATION = &h00000001
 2864 const GROUP_SECURITY_INFORMATION = &h00000002
 2865 const DACL_SECURITY_INFORMATION = &h00000004
 2866 const SACL_SECURITY_INFORMATION = &h00000008
 2867 const LABEL_SECURITY_INFORMATION = &h00000010
 2868 const ATTRIBUTE_SECURITY_INFORMATION = &h00000020
 2869 const SCOPE_SECURITY_INFORMATION = &h00000040
 2870 const BACKUP_SECURITY_INFORMATION = &h00010000
 2871 const PROTECTED_DACL_SECURITY_INFORMATION = &h80000000
 2872 const PROTECTED_SACL_SECURITY_INFORMATION = &h40000000
 2873 const UNPROTECTED_DACL_SECURITY_INFORMATION = &h20000000
 2874 const UNPROTECTED_SACL_SECURITY_INFORMATION = &h10000000
 2875 
 2876 type _SE_LEARNING_MODE_DATA_TYPE as long
 2877 enum
 2878     SeLearningModeInvalidType = 0
 2879     SeLearningModeSettings
 2880     SeLearningModeMax
 2881 end enum
 2882 
 2883 type SE_LEARNING_MODE_DATA_TYPE as _SE_LEARNING_MODE_DATA_TYPE
 2884 const SE_LEARNING_MODE_FLAG_PERMISSIVE = &h00000001
 2885 
 2886 type _SECURITY_CAPABILITIES
 2887     AppContainerSid as PSID
 2888     Capabilities as PSID_AND_ATTRIBUTES
 2889     CapabilityCount as DWORD
 2890     Reserved as DWORD
 2891 end type
 2892 
 2893 type SECURITY_CAPABILITIES as _SECURITY_CAPABILITIES
 2894 type PSECURITY_CAPABILITIES as _SECURITY_CAPABILITIES ptr
 2895 type LPSECURITY_CAPABILITIES as _SECURITY_CAPABILITIES ptr
 2896 
 2897 const PROCESS_TERMINATE = &h0001
 2898 const PROCESS_CREATE_THREAD = &h0002
 2899 const PROCESS_SET_SESSIONID = &h0004
 2900 const PROCESS_VM_OPERATION = &h0008
 2901 const PROCESS_VM_READ = &h0010
 2902 const PROCESS_VM_WRITE = &h0020
 2903 const PROCESS_DUP_HANDLE = &h0040
 2904 const PROCESS_CREATE_PROCESS = &h0080
 2905 const PROCESS_SET_QUOTA = &h0100
 2906 const PROCESS_SET_INFORMATION = &h0200
 2907 const PROCESS_QUERY_INFORMATION = &h0400
 2908 const PROCESS_SUSPEND_RESUME = &h0800
 2909 const PROCESS_QUERY_LIMITED_INFORMATION = &h1000
 2910 
 2911 #if _WIN32_WINNT = &h0602
 2912     const PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE) or &hffff
 2913 #else
 2914     const PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE) or &hfff
 2915 #endif
 2916 
 2917 #ifdef __FB_64BIT__
 2918     const MAXIMUM_PROC_PER_GROUP = 64
 2919 #else
 2920     const MAXIMUM_PROC_PER_GROUP = 32
 2921 #endif
 2922 
 2923 const MAXIMUM_PROCESSORS = MAXIMUM_PROC_PER_GROUP
 2924 const THREAD_TERMINATE = &h0001
 2925 const THREAD_SUSPEND_RESUME = &h0002
 2926 const THREAD_GET_CONTEXT = &h0008
 2927 const THREAD_SET_CONTEXT = &h0010
 2928 const THREAD_SET_INFORMATION = &h0020
 2929 const THREAD_QUERY_INFORMATION = &h0040
 2930 const THREAD_SET_THREAD_TOKEN = &h0080
 2931 const THREAD_IMPERSONATE = &h0100
 2932 const THREAD_DIRECT_IMPERSONATION = &h0200
 2933 const THREAD_SET_LIMITED_INFORMATION = &h0400
 2934 const THREAD_QUERY_LIMITED_INFORMATION = &h0800
 2935 
 2936 #if _WIN32_WINNT = &h0602
 2937     const THREAD_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE) or &hffff
 2938 #else
 2939     const THREAD_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE) or &h3ff
 2940 #endif
 2941 
 2942 const JOB_OBJECT_ASSIGN_PROCESS = &h0001
 2943 const JOB_OBJECT_SET_ATTRIBUTES = &h0002
 2944 const JOB_OBJECT_QUERY = &h0004
 2945 const JOB_OBJECT_TERMINATE = &h0008
 2946 const JOB_OBJECT_SET_SECURITY_ATTRIBUTES = &h0010
 2947 const JOB_OBJECT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE) or &h1F
 2948 
 2949 type _JOB_SET_ARRAY
 2950     JobHandle as HANDLE
 2951     MemberLevel as DWORD
 2952     Flags as DWORD
 2953 end type
 2954 
 2955 type JOB_SET_ARRAY as _JOB_SET_ARRAY
 2956 type PJOB_SET_ARRAY as _JOB_SET_ARRAY ptr
 2957 const FLS_MAXIMUM_AVAILABLE = 128
 2958 const TLS_MINIMUM_AVAILABLE = 64
 2959 
 2960 type _EXCEPTION_REGISTRATION_RECORD
 2961     union
 2962         Next as _EXCEPTION_REGISTRATION_RECORD ptr
 2963         prev as _EXCEPTION_REGISTRATION_RECORD ptr
 2964     end union
 2965 
 2966     union
 2967         Handler as PEXCEPTION_ROUTINE
 2968     end union
 2969 end type
 2970 
 2971 type EXCEPTION_REGISTRATION_RECORD as _EXCEPTION_REGISTRATION_RECORD
 2972 type PEXCEPTION_REGISTRATION_RECORD as EXCEPTION_REGISTRATION_RECORD ptr
 2973 type EXCEPTION_REGISTRATION as EXCEPTION_REGISTRATION_RECORD
 2974 type PEXCEPTION_REGISTRATION as PEXCEPTION_REGISTRATION_RECORD
 2975 #define _NT_TIB_DEFINED
 2976 
 2977 type _NT_TIB
 2978     ExceptionList as _EXCEPTION_REGISTRATION_RECORD ptr
 2979     StackBase as PVOID
 2980     StackLimit as PVOID
 2981     SubSystemTib as PVOID
 2982 
 2983     union
 2984         FiberData as PVOID
 2985         Version as DWORD
 2986     end union
 2987 
 2988     ArbitraryUserPointer as PVOID
 2989     Self as _NT_TIB ptr
 2990 end type
 2991 
 2992 type NT_TIB as _NT_TIB
 2993 type PNT_TIB as NT_TIB ptr
 2994 
 2995 type _NT_TIB32
 2996     ExceptionList as DWORD
 2997     StackBase as DWORD
 2998     StackLimit as DWORD
 2999     SubSystemTib as DWORD
 3000 
 3001     union
 3002         FiberData as DWORD
 3003         Version as DWORD
 3004     end union
 3005 
 3006     ArbitraryUserPointer as DWORD
 3007     Self as DWORD
 3008 end type
 3009 
 3010 type NT_TIB32 as _NT_TIB32
 3011 type PNT_TIB32 as _NT_TIB32 ptr
 3012 
 3013 type _NT_TIB64
 3014     ExceptionList as DWORD64
 3015     StackBase as DWORD64
 3016     StackLimit as DWORD64
 3017     SubSystemTib as DWORD64
 3018 
 3019     union
 3020         FiberData as DWORD64
 3021         Version as DWORD
 3022     end union
 3023 
 3024     ArbitraryUserPointer as DWORD64
 3025     Self as DWORD64
 3026 end type
 3027 
 3028 type NT_TIB64 as _NT_TIB64
 3029 type PNT_TIB64 as _NT_TIB64 ptr
 3030 const THREAD_BASE_PRIORITY_LOWRT = 15
 3031 const THREAD_BASE_PRIORITY_MAX = 2
 3032 const THREAD_BASE_PRIORITY_MIN = -2
 3033 const THREAD_BASE_PRIORITY_IDLE = -15
 3034 
 3035 type _UMS_CREATE_THREAD_ATTRIBUTES
 3036     UmsVersion as DWORD
 3037     UmsContext as PVOID
 3038     UmsCompletionList as PVOID
 3039 end type
 3040 
 3041 type UMS_CREATE_THREAD_ATTRIBUTES as _UMS_CREATE_THREAD_ATTRIBUTES
 3042 type PUMS_CREATE_THREAD_ATTRIBUTES as _UMS_CREATE_THREAD_ATTRIBUTES ptr
 3043 
 3044 type _QUOTA_LIMITS
 3045     PagedPoolLimit as SIZE_T_
 3046     NonPagedPoolLimit as SIZE_T_
 3047     MinimumWorkingSetSize as SIZE_T_
 3048     MaximumWorkingSetSize as SIZE_T_
 3049     PagefileLimit as SIZE_T_
 3050     TimeLimit as LARGE_INTEGER
 3051 end type
 3052 
 3053 type QUOTA_LIMITS as _QUOTA_LIMITS
 3054 type PQUOTA_LIMITS as _QUOTA_LIMITS ptr
 3055 const QUOTA_LIMITS_HARDWS_MIN_ENABLE = &h00000001
 3056 const QUOTA_LIMITS_HARDWS_MIN_DISABLE = &h00000002
 3057 const QUOTA_LIMITS_HARDWS_MAX_ENABLE = &h00000004
 3058 const QUOTA_LIMITS_HARDWS_MAX_DISABLE = &h00000008
 3059 const QUOTA_LIMITS_USE_DEFAULT_LIMITS = &h00000010
 3060 
 3061 union _RATE_QUOTA_LIMIT
 3062     RateData as DWORD
 3063 
 3064     type
 3065         RatePercent : 7 as DWORD
 3066         Reserved0 : 25 as DWORD
 3067     end type
 3068 end union
 3069 
 3070 type RATE_QUOTA_LIMIT as _RATE_QUOTA_LIMIT
 3071 type PRATE_QUOTA_LIMIT as _RATE_QUOTA_LIMIT ptr
 3072 
 3073 type _QUOTA_LIMITS_EX
 3074     PagedPoolLimit as SIZE_T_
 3075     NonPagedPoolLimit as SIZE_T_
 3076     MinimumWorkingSetSize as SIZE_T_
 3077     MaximumWorkingSetSize as SIZE_T_
 3078     PagefileLimit as SIZE_T_
 3079     TimeLimit as LARGE_INTEGER
 3080     WorkingSetLimit as SIZE_T_
 3081     Reserved2 as SIZE_T_
 3082     Reserved3 as SIZE_T_
 3083     Reserved4 as SIZE_T_
 3084     Flags as DWORD
 3085     CpuRateLimit as RATE_QUOTA_LIMIT
 3086 end type
 3087 
 3088 type QUOTA_LIMITS_EX as _QUOTA_LIMITS_EX
 3089 type PQUOTA_LIMITS_EX as _QUOTA_LIMITS_EX ptr
 3090 
 3091 type _IO_COUNTERS
 3092     ReadOperationCount as ULONGLONG
 3093     WriteOperationCount as ULONGLONG
 3094     OtherOperationCount as ULONGLONG
 3095     ReadTransferCount as ULONGLONG
 3096     WriteTransferCount as ULONGLONG
 3097     OtherTransferCount as ULONGLONG
 3098 end type
 3099 
 3100 type IO_COUNTERS as _IO_COUNTERS
 3101 type PIO_COUNTERS as IO_COUNTERS ptr
 3102 const MAX_HW_COUNTERS = 16
 3103 const THREAD_PROFILING_FLAG_DISPATCH = &h1
 3104 
 3105 type _HARDWARE_COUNTER_TYPE as long
 3106 enum
 3107     PMCCounter
 3108     MaxHardwareCounterType
 3109 end enum
 3110 
 3111 type HARDWARE_COUNTER_TYPE as _HARDWARE_COUNTER_TYPE
 3112 type PHARDWARE_COUNTER_TYPE as _HARDWARE_COUNTER_TYPE ptr
 3113 
 3114 type _PROCESS_MITIGATION_POLICY as long
 3115 enum
 3116     ProcessDEPPolicy
 3117     ProcessASLRPolicy
 3118     ProcessReserved1MitigationPolicy
 3119     ProcessStrictHandleCheckPolicy
 3120     ProcessSystemCallDisablePolicy
 3121     ProcessMitigationOptionsMask
 3122     ProcessExtensionPointDisablePolicy
 3123     MaxProcessMitigationPolicy
 3124 end enum
 3125 
 3126 type PROCESS_MITIGATION_POLICY as _PROCESS_MITIGATION_POLICY
 3127 type PPROCESS_MITIGATION_POLICY as _PROCESS_MITIGATION_POLICY ptr
 3128 
 3129 type _PROCESS_MITIGATION_ASLR_POLICY
 3130     union
 3131         Flags as DWORD
 3132 
 3133         type
 3134             EnableBottomUpRandomization : 1 as DWORD
 3135             EnableForceRelocateImages : 1 as DWORD
 3136             EnableHighEntropy : 1 as DWORD
 3137             DisallowStrippedImages : 1 as DWORD
 3138             ReservedFlags : 28 as DWORD
 3139         end type
 3140     end union
 3141 end type
 3142 
 3143 type PROCESS_MITIGATION_ASLR_POLICY as _PROCESS_MITIGATION_ASLR_POLICY
 3144 type PPROCESS_MITIGATION_ASLR_POLICY as _PROCESS_MITIGATION_ASLR_POLICY ptr
 3145 
 3146 type _PROCESS_MITIGATION_DEP_POLICY
 3147     union
 3148         Flags as DWORD
 3149 
 3150         type
 3151             Enable : 1 as DWORD
 3152             DisableAtlThunkEmulation : 1 as DWORD
 3153             ReservedFlags : 30 as DWORD
 3154         end type
 3155     end union
 3156 
 3157     Permanent as WINBOOLEAN
 3158 end type
 3159 
 3160 type PROCESS_MITIGATION_DEP_POLICY as _PROCESS_MITIGATION_DEP_POLICY
 3161 type PPROCESS_MITIGATION_DEP_POLICY as _PROCESS_MITIGATION_DEP_POLICY ptr
 3162 
 3163 type _PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY
 3164     union
 3165         Flags as DWORD
 3166 
 3167         type
 3168             RaiseExceptionOnInvalidHandleReference : 1 as DWORD
 3169             HandleExceptionsPermanentlyEnabled : 1 as DWORD
 3170             ReservedFlags : 30 as DWORD
 3171         end type
 3172     end union
 3173 end type
 3174 
 3175 type PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY as _PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY
 3176 type PPROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY as _PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY ptr
 3177 
 3178 type _PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY
 3179     union
 3180         Flags as DWORD
 3181 
 3182         type
 3183             DisallowWin32kSystemCalls : 1 as DWORD
 3184             ReservedFlags : 31 as DWORD
 3185         end type
 3186     end union
 3187 end type
 3188 
 3189 type PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY as _PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY
 3190 type PPROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY as _PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY ptr
 3191 
 3192 type _PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY
 3193     union
 3194         Flags as DWORD
 3195 
 3196         type
 3197             DisableExtensionPoints : 1 as DWORD
 3198             ReservedFlags : 31 as DWORD
 3199         end type
 3200     end union
 3201 end type
 3202 
 3203 type PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY as _PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY
 3204 type PPROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY as _PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY ptr
 3205 
 3206 type _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
 3207     TotalUserTime as LARGE_INTEGER
 3208     TotalKernelTime as LARGE_INTEGER
 3209     ThisPeriodTotalUserTime as LARGE_INTEGER
 3210     ThisPeriodTotalKernelTime as LARGE_INTEGER
 3211     TotalPageFaultCount as DWORD
 3212     TotalProcesses as DWORD
 3213     ActiveProcesses as DWORD
 3214     TotalTerminatedProcesses as DWORD
 3215 end type
 3216 
 3217 type JOBOBJECT_BASIC_ACCOUNTING_INFORMATION as _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
 3218 type PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION as _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION ptr
 3219 
 3220 type _JOBOBJECT_BASIC_LIMIT_INFORMATION
 3221     PerProcessUserTimeLimit as LARGE_INTEGER
 3222     PerJobUserTimeLimit as LARGE_INTEGER
 3223     LimitFlags as DWORD
 3224     MinimumWorkingSetSize as SIZE_T_
 3225     MaximumWorkingSetSize as SIZE_T_
 3226     ActiveProcessLimit as DWORD
 3227     Affinity as ULONG_PTR
 3228     PriorityClass as DWORD
 3229     SchedulingClass as DWORD
 3230 end type
 3231 
 3232 type JOBOBJECT_BASIC_LIMIT_INFORMATION as _JOBOBJECT_BASIC_LIMIT_INFORMATION
 3233 type PJOBOBJECT_BASIC_LIMIT_INFORMATION as _JOBOBJECT_BASIC_LIMIT_INFORMATION ptr
 3234 
 3235 type _JOBOBJECT_EXTENDED_LIMIT_INFORMATION
 3236     BasicLimitInformation as JOBOBJECT_BASIC_LIMIT_INFORMATION
 3237     IoInfo as IO_COUNTERS
 3238     ProcessMemoryLimit as SIZE_T_
 3239     JobMemoryLimit as SIZE_T_
 3240     PeakProcessMemoryUsed as SIZE_T_
 3241     PeakJobMemoryUsed as SIZE_T_
 3242 end type
 3243 
 3244 type JOBOBJECT_EXTENDED_LIMIT_INFORMATION as _JOBOBJECT_EXTENDED_LIMIT_INFORMATION
 3245 type PJOBOBJECT_EXTENDED_LIMIT_INFORMATION as _JOBOBJECT_EXTENDED_LIMIT_INFORMATION ptr
 3246 
 3247 type _JOBOBJECT_BASIC_PROCESS_ID_LIST
 3248     NumberOfAssignedProcesses as DWORD
 3249     NumberOfProcessIdsInList as DWORD
 3250     ProcessIdList(0 to 0) as ULONG_PTR
 3251 end type
 3252 
 3253 type JOBOBJECT_BASIC_PROCESS_ID_LIST as _JOBOBJECT_BASIC_PROCESS_ID_LIST
 3254 type PJOBOBJECT_BASIC_PROCESS_ID_LIST as _JOBOBJECT_BASIC_PROCESS_ID_LIST ptr
 3255 
 3256 type _JOBOBJECT_BASIC_UI_RESTRICTIONS
 3257     UIRestrictionsClass as DWORD
 3258 end type
 3259 
 3260 type JOBOBJECT_BASIC_UI_RESTRICTIONS as _JOBOBJECT_BASIC_UI_RESTRICTIONS
 3261 type PJOBOBJECT_BASIC_UI_RESTRICTIONS as _JOBOBJECT_BASIC_UI_RESTRICTIONS ptr
 3262 
 3263 type _JOBOBJECT_SECURITY_LIMIT_INFORMATION
 3264     SecurityLimitFlags as DWORD
 3265     JobToken as HANDLE
 3266     SidsToDisable as PTOKEN_GROUPS
 3267     PrivilegesToDelete as PTOKEN_PRIVILEGES
 3268     RestrictedSids as PTOKEN_GROUPS
 3269 end type
 3270 
 3271 type JOBOBJECT_SECURITY_LIMIT_INFORMATION as _JOBOBJECT_SECURITY_LIMIT_INFORMATION
 3272 type PJOBOBJECT_SECURITY_LIMIT_INFORMATION as _JOBOBJECT_SECURITY_LIMIT_INFORMATION ptr
 3273 
 3274 type _JOBOBJECT_END_OF_JOB_TIME_INFORMATION
 3275     EndOfJobTimeAction as DWORD
 3276 end type
 3277 
 3278 type JOBOBJECT_END_OF_JOB_TIME_INFORMATION as _JOBOBJECT_END_OF_JOB_TIME_INFORMATION
 3279 type PJOBOBJECT_END_OF_JOB_TIME_INFORMATION as _JOBOBJECT_END_OF_JOB_TIME_INFORMATION ptr
 3280 
 3281 type _JOBOBJECT_ASSOCIATE_COMPLETION_PORT
 3282     CompletionKey as PVOID
 3283     CompletionPort as HANDLE
 3284 end type
 3285 
 3286 type JOBOBJECT_ASSOCIATE_COMPLETION_PORT as _JOBOBJECT_ASSOCIATE_COMPLETION_PORT
 3287 type PJOBOBJECT_ASSOCIATE_COMPLETION_PORT as _JOBOBJECT_ASSOCIATE_COMPLETION_PORT ptr
 3288 
 3289 type _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
 3290     BasicInfo as JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
 3291     IoInfo as IO_COUNTERS
 3292 end type
 3293 
 3294 type JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION as _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
 3295 type PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION as _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION ptr
 3296 
 3297 type _JOBOBJECT_JOBSET_INFORMATION
 3298     MemberLevel as DWORD
 3299 end type
 3300 
 3301 type JOBOBJECT_JOBSET_INFORMATION as _JOBOBJECT_JOBSET_INFORMATION
 3302 type PJOBOBJECT_JOBSET_INFORMATION as _JOBOBJECT_JOBSET_INFORMATION ptr
 3303 
 3304 type _JOBOBJECT_RATE_CONTROL_TOLERANCE as long
 3305 enum
 3306     ToleranceLow = 1
 3307     ToleranceMedium
 3308     ToleranceHigh
 3309 end enum
 3310 
 3311 type JOBOBJECT_RATE_CONTROL_TOLERANCE as _JOBOBJECT_RATE_CONTROL_TOLERANCE
 3312 
 3313 type _JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL as long
 3314 enum
 3315     ToleranceIntervalShort = 1
 3316     ToleranceIntervalMedium
 3317     ToleranceIntervalLong
 3318 end enum
 3319 
 3320 type JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL as _JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL
 3321 
 3322 type _JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION
 3323     IoReadBytesLimit as DWORD64
 3324     IoWriteBytesLimit as DWORD64
 3325     PerJobUserTimeLimit as LARGE_INTEGER
 3326     JobMemoryLimit as DWORD64
 3327     RateControlTolerance as JOBOBJECT_RATE_CONTROL_TOLERANCE
 3328     RateControlToleranceInterval as JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL
 3329     LimitFlags as DWORD
 3330 end type
 3331 
 3332 type JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION as _JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION
 3333 type PJOBOBJECT_NOTIFICATION_LIMIT_INFORMATION as _JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION ptr
 3334 
 3335 type _JOBOBJECT_LIMIT_VIOLATION_INFORMATION
 3336     LimitFlags as DWORD
 3337     ViolationLimitFlags as DWORD
 3338     IoReadBytes as DWORD64
 3339     IoReadBytesLimit as DWORD64
 3340     IoWriteBytes as DWORD64
 3341     IoWriteBytesLimit as DWORD64
 3342     PerJobUserTime as LARGE_INTEGER
 3343     PerJobUserTimeLimit as LARGE_INTEGER
 3344     JobMemory as DWORD64
 3345     JobMemoryLimit as DWORD64
 3346     RateControlTolerance as JOBOBJECT_RATE_CONTROL_TOLERANCE
 3347     RateControlToleranceLimit as JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL
 3348 end type
 3349 
 3350 type JOBOBJECT_LIMIT_VIOLATION_INFORMATION as _JOBOBJECT_LIMIT_VIOLATION_INFORMATION
 3351 type PJOBOBJECT_LIMIT_VIOLATION_INFORMATION as _JOBOBJECT_LIMIT_VIOLATION_INFORMATION ptr
 3352 
 3353 type _JOBOBJECT_CPU_RATE_CONTROL_INFORMATION
 3354     ControlFlags as DWORD
 3355 
 3356     union
 3357         CpuRate as DWORD
 3358         Weight as DWORD
 3359     end union
 3360 end type
 3361 
 3362 type JOBOBJECT_CPU_RATE_CONTROL_INFORMATION as _JOBOBJECT_CPU_RATE_CONTROL_INFORMATION
 3363 type PJOBOBJECT_CPU_RATE_CONTROL_INFORMATION as _JOBOBJECT_CPU_RATE_CONTROL_INFORMATION ptr
 3364 const JOB_OBJECT_TERMINATE_AT_END_OF_JOB = 0
 3365 const JOB_OBJECT_POST_AT_END_OF_JOB = 1
 3366 const JOB_OBJECT_MSG_END_OF_JOB_TIME = 1
 3367 const JOB_OBJECT_MSG_END_OF_PROCESS_TIME = 2
 3368 const JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT = 3
 3369 const JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO = 4
 3370 const JOB_OBJECT_MSG_NEW_PROCESS = 6
 3371 const JOB_OBJECT_MSG_EXIT_PROCESS = 7
 3372 const JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS = 8
 3373 const JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT = 9
 3374 const JOB_OBJECT_MSG_JOB_MEMORY_LIMIT = 10
 3375 const JOB_OBJECT_MSG_NOTIFICATION_LIMIT = 11
 3376 const JOB_OBJECT_MSG_JOB_CYCLE_TIME_LIMIT = 12
 3377 const JOB_OBJECT_MSG_MINIMUM = 1
 3378 const JOB_OBJECT_MSG_MAXIMUM = 12
 3379 const JOB_OBJECT_LIMIT_WORKINGSET = &h00000001
 3380 const JOB_OBJECT_LIMIT_PROCESS_TIME = &h00000002
 3381 const JOB_OBJECT_LIMIT_JOB_TIME = &h00000004
 3382 const JOB_OBJECT_LIMIT_ACTIVE_PROCESS = &h00000008
 3383 const JOB_OBJECT_LIMIT_AFFINITY = &h00000010
 3384 const JOB_OBJECT_LIMIT_PRIORITY_CLASS = &h00000020
 3385 const JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = &h00000040
 3386 const JOB_OBJECT_LIMIT_SCHEDULING_CLASS = &h00000080
 3387 const JOB_OBJECT_LIMIT_PROCESS_MEMORY = &h00000100
 3388 const JOB_OBJECT_LIMIT_JOB_MEMORY = &h00000200
 3389 const JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = &h00000400
 3390 const JOB_OBJECT_LIMIT_BREAKAWAY_OK = &h00000800
 3391 const JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = &h00001000
 3392 const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = &h00002000
 3393 const JOB_OBJECT_LIMIT_SUBSET_AFFINITY = &h00004000
 3394 const JOB_OBJECT_LIMIT_RESERVED3 = &h00008000
 3395 const JOB_OBJECT_LIMIT_JOB_READ_BYTES = &h00010000
 3396 const JOB_OBJECT_LIMIT_JOB_WRITE_BYTES = &h00020000
 3397 const JOB_OBJECT_LIMIT_RATE_CONTROL = &h00040000
 3398 const JOB_OBJECT_LIMIT_RESERVED3 = &h00008000
 3399 const JOB_OBJECT_LIMIT_RESERVED4 = &h00010000
 3400 const JOB_OBJECT_LIMIT_RESERVED5 = &h00020000
 3401 const JOB_OBJECT_LIMIT_RESERVED6 = &h00040000
 3402 const JOB_OBJECT_LIMIT_VALID_FLAGS = &h0007ffff
 3403 const JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS = &h000000ff
 3404 const JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS = &h00007fff
 3405 const JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS = &h0007ffff
 3406 const JOB_OBJECT_NOTIFICATION_LIMIT_VALID_FLAGS = &h00070204
 3407 const JOB_OBJECT_UILIMIT_NONE = &h00000000
 3408 const JOB_OBJECT_UILIMIT_HANDLES = &h00000001
 3409 const JOB_OBJECT_UILIMIT_READCLIPBOARD = &h00000002
 3410 const JOB_OBJECT_UILIMIT_WRITECLIPBOARD = &h00000004
 3411 const JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = &h00000008
 3412 const JOB_OBJECT_UILIMIT_DISPLAYSETTINGS = &h00000010
 3413 const JOB_OBJECT_UILIMIT_GLOBALATOMS = &h00000020
 3414 const JOB_OBJECT_UILIMIT_DESKTOP = &h00000040
 3415 const JOB_OBJECT_UILIMIT_EXITWINDOWS = &h00000080
 3416 const JOB_OBJECT_UILIMIT_ALL = &h000000FF
 3417 const JOB_OBJECT_UI_VALID_FLAGS = &h000000FF
 3418 const JOB_OBJECT_SECURITY_NO_ADMIN = &h00000001
 3419 const JOB_OBJECT_SECURITY_RESTRICTED_TOKEN = &h00000002
 3420 const JOB_OBJECT_SECURITY_ONLY_TOKEN = &h00000004
 3421 const JOB_OBJECT_SECURITY_FILTER_TOKENS = &h00000008
 3422 const JOB_OBJECT_SECURITY_VALID_FLAGS = &h0000000f
 3423 const JOB_OBJECT_CPU_RATE_CONTROL_ENABLE = &h1
 3424 const JOB_OBJECT_CPU_RATE_CONTROL_WEIGHT_BASED = &h2
 3425 const JOB_OBJECT_CPU_RATE_CONTROL_HARD_CAP = &h4
 3426 const JOB_OBJECT_CPU_RATE_CONTROL_NOTIFY = &h8
 3427 const JOB_OBJECT_CPU_RATE_CONTROL_VALID_FLAGS = &hf
 3428 
 3429 type _JOBOBJECTINFOCLASS as long
 3430 enum
 3431     JobObjectBasicAccountingInformation = 1
 3432     JobObjectBasicLimitInformation
 3433     JobObjectBasicProcessIdList
 3434     JobObjectBasicUIRestrictions
 3435     JobObjectSecurityLimitInformation
 3436     JobObjectEndOfJobTimeInformation
 3437     JobObjectAssociateCompletionPortInformation
 3438     JobObjectBasicAndIoAccountingInformation
 3439     JobObjectExtendedLimitInformation
 3440     JobObjectJobSetInformation
 3441     JobObjectGroupInformation
 3442     JobObjectNotificationLimitInformation
 3443     JobObjectLimitViolationInformation
 3444     JobObjectGroupInformationEx
 3445     JobObjectCpuRateControlInformation
 3446     JobObjectCompletionFilter
 3447     JobObjectCompletionCounter
 3448     JobObjectReserved1Information = 18
 3449     JobObjectReserved2Information
 3450     JobObjectReserved3Information
 3451     JobObjectReserved4Information
 3452     JobObjectReserved5Information
 3453     JobObjectReserved6Information
 3454     JobObjectReserved7Information
 3455     JobObjectReserved8Information
 3456     MaxJobObjectInfoClass
 3457 end enum
 3458 
 3459 type JOBOBJECTINFOCLASS as _JOBOBJECTINFOCLASS
 3460 
 3461 type _FIRMWARE_TYPE as long
 3462 enum
 3463     FirmwareTypeUnknown
 3464     FirmwareTypeBios
 3465     FirmwareTypeUefi
 3466     FirmwareTypeMax
 3467 end enum
 3468 
 3469 type FIRMWARE_TYPE as _FIRMWARE_TYPE
 3470 type PFIRMWARE_TYPE as _FIRMWARE_TYPE ptr
 3471 const EVENT_MODIFY_STATE = &h0002
 3472 const EVENT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE) or &h3
 3473 const MUTANT_QUERY_STATE = &h0001
 3474 const MUTANT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE) or MUTANT_QUERY_STATE
 3475 const SEMAPHORE_MODIFY_STATE = &h0002
 3476 const SEMAPHORE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE) or &h3
 3477 const TIMER_QUERY_STATE = &h0001
 3478 const TIMER_MODIFY_STATE = &h0002
 3479 const TIMER_ALL_ACCESS = ((STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE) or TIMER_QUERY_STATE) or TIMER_MODIFY_STATE
 3480 const TIME_ZONE_ID_UNKNOWN = 0
 3481 const TIME_ZONE_ID_STANDARD = 1
 3482 const TIME_ZONE_ID_DAYLIGHT = 2
 3483 
 3484 type _LOGICAL_PROCESSOR_RELATIONSHIP as long
 3485 enum
 3486     RelationProcessorCore
 3487     RelationNumaNode
 3488     RelationCache
 3489     RelationProcessorPackage
 3490     RelationGroup
 3491     RelationAll = &hffff
 3492 end enum
 3493 
 3494 type LOGICAL_PROCESSOR_RELATIONSHIP as _LOGICAL_PROCESSOR_RELATIONSHIP
 3495 const LTP_PC_SMT = &h1
 3496 
 3497 type _PROCESSOR_CACHE_TYPE as long
 3498 enum
 3499     CacheUnified
 3500     CacheInstruction
 3501     CacheData
 3502     CacheTrace
 3503 end enum
 3504 
 3505 type PROCESSOR_CACHE_TYPE as _PROCESSOR_CACHE_TYPE
 3506 const CACHE_FULLY_ASSOCIATIVE = &hFF
 3507 
 3508 type _CACHE_DESCRIPTOR
 3509     Level as UBYTE
 3510     Associativity as UBYTE
 3511     LineSize as WORD
 3512     Size as DWORD
 3513     as PROCESSOR_CACHE_TYPE Type
 3514 end type
 3515 
 3516 type CACHE_DESCRIPTOR as _CACHE_DESCRIPTOR
 3517 type PCACHE_DESCRIPTOR as _CACHE_DESCRIPTOR ptr
 3518 
 3519 type _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_ProcessorCore
 3520     Flags as UBYTE
 3521 end type
 3522 
 3523 type _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_NumaNode
 3524     NodeNumber as DWORD
 3525 end type
 3526 
 3527 type _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
 3528     ProcessorMask as ULONG_PTR
 3529     Relationship as LOGICAL_PROCESSOR_RELATIONSHIP
 3530 
 3531     union
 3532         ProcessorCore as _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_ProcessorCore
 3533         NumaNode as _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_NumaNode
 3534         Cache as CACHE_DESCRIPTOR
 3535         Reserved(0 to 1) as ULONGLONG
 3536     end union
 3537 end type
 3538 
 3539 type SYSTEM_LOGICAL_PROCESSOR_INFORMATION as _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
 3540 type PSYSTEM_LOGICAL_PROCESSOR_INFORMATION as _SYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr
 3541 
 3542 type _PROCESSOR_RELATIONSHIP
 3543     Flags as UBYTE
 3544     Reserved(0 to 20) as UBYTE
 3545     GroupCount as WORD
 3546     GroupMask(0 to 0) as GROUP_AFFINITY
 3547 end type
 3548 
 3549 type PROCESSOR_RELATIONSHIP as _PROCESSOR_RELATIONSHIP
 3550 type PPROCESSOR_RELATIONSHIP as _PROCESSOR_RELATIONSHIP ptr
 3551 
 3552 type _NUMA_NODE_RELATIONSHIP
 3553     NodeNumber as DWORD
 3554     Reserved(0 to 19) as UBYTE
 3555     GroupMask as GROUP_AFFINITY
 3556 end type
 3557 
 3558 type NUMA_NODE_RELATIONSHIP as _NUMA_NODE_RELATIONSHIP
 3559 type PNUMA_NODE_RELATIONSHIP as _NUMA_NODE_RELATIONSHIP ptr
 3560 
 3561 type _CACHE_RELATIONSHIP
 3562     Level as UBYTE
 3563     Associativity as UBYTE
 3564     LineSize as WORD
 3565     CacheSize as DWORD
 3566     as PROCESSOR_CACHE_TYPE Type
 3567     Reserved(0 to 19) as UBYTE
 3568     GroupMask as GROUP_AFFINITY
 3569 end type
 3570 
 3571 type CACHE_RELATIONSHIP as _CACHE_RELATIONSHIP
 3572 type PCACHE_RELATIONSHIP as _CACHE_RELATIONSHIP ptr
 3573 
 3574 type _PROCESSOR_GROUP_INFO
 3575     MaximumProcessorCount as UBYTE
 3576     ActiveProcessorCount as UBYTE
 3577     Reserved(0 to 37) as UBYTE
 3578     ActiveProcessorMask as KAFFINITY
 3579 end type
 3580 
 3581 type PROCESSOR_GROUP_INFO as _PROCESSOR_GROUP_INFO
 3582 type PPROCESSOR_GROUP_INFO as _PROCESSOR_GROUP_INFO ptr
 3583 
 3584 type _GROUP_RELATIONSHIP
 3585     MaximumGroupCount as WORD
 3586     ActiveGroupCount as WORD
 3587     Reserved(0 to 19) as UBYTE
 3588     GroupInfo(0 to 0) as PROCESSOR_GROUP_INFO
 3589 end type
 3590 
 3591 type GROUP_RELATIONSHIP as _GROUP_RELATIONSHIP
 3592 type PGROUP_RELATIONSHIP as _GROUP_RELATIONSHIP ptr
 3593 
 3594 type _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
 3595     Relationship as LOGICAL_PROCESSOR_RELATIONSHIP
 3596     Size as DWORD
 3597 
 3598     union
 3599         Processor as PROCESSOR_RELATIONSHIP
 3600         NumaNode as NUMA_NODE_RELATIONSHIP
 3601         Cache as CACHE_RELATIONSHIP
 3602         Group as GROUP_RELATIONSHIP
 3603     end union
 3604 end type
 3605 
 3606 type SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX as _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
 3607 type PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX as _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX ptr
 3608 
 3609 type _SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION
 3610     CycleTime as DWORD64
 3611 end type
 3612 
 3613 type SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION as _SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION
 3614 type PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION as _SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION ptr
 3615 const PROCESSOR_INTEL_386 = 386
 3616 const PROCESSOR_INTEL_486 = 486
 3617 const PROCESSOR_INTEL_PENTIUM = 586
 3618 const PROCESSOR_INTEL_IA64 = 2200
 3619 const PROCESSOR_AMD_X8664 = 8664
 3620 const PROCESSOR_MIPS_R4000 = 4000
 3621 const PROCESSOR_ALPHA_21064 = 21064
 3622 const PROCESSOR_PPC_601 = 601
 3623 const PROCESSOR_PPC_603 = 603
 3624 const PROCESSOR_PPC_604 = 604
 3625 const PROCESSOR_PPC_620 = 620
 3626 const PROCESSOR_HITACHI_SH3 = 10003
 3627 const PROCESSOR_HITACHI_SH3E = 10004
 3628 const PROCESSOR_HITACHI_SH4 = 10005
 3629 const PROCESSOR_MOTOROLA_821 = 821
 3630 const PROCESSOR_SHx_SH3 = 103
 3631 const PROCESSOR_SHx_SH4 = 104
 3632 const PROCESSOR_STRONGARM = 2577
 3633 const PROCESSOR_ARM720 = 1824
 3634 const PROCESSOR_ARM820 = 2080
 3635 const PROCESSOR_ARM920 = 2336
 3636 const PROCESSOR_ARM_7TDMI = 70001
 3637 const PROCESSOR_OPTIL = &h494f
 3638 const PROCESSOR_ARCHITECTURE_INTEL = 0
 3639 const PROCESSOR_ARCHITECTURE_MIPS = 1
 3640 const PROCESSOR_ARCHITECTURE_ALPHA = 2
 3641 const PROCESSOR_ARCHITECTURE_PPC = 3
 3642 const PROCESSOR_ARCHITECTURE_SHX = 4
 3643 const PROCESSOR_ARCHITECTURE_ARM = 5
 3644 const PROCESSOR_ARCHITECTURE_IA64 = 6
 3645 const PROCESSOR_ARCHITECTURE_ALPHA64 = 7
 3646 const PROCESSOR_ARCHITECTURE_MSIL = 8
 3647 const PROCESSOR_ARCHITECTURE_AMD64 = 9
 3648 const PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 = 10
 3649 const PROCESSOR_ARCHITECTURE_NEUTRAL = 11
 3650 const PROCESSOR_ARCHITECTURE_UNKNOWN = &hffff
 3651 const PF_FLOATING_POINT_PRECISION_ERRATA = 0
 3652 const PF_FLOATING_POINT_EMULATED = 1
 3653 const PF_COMPARE_EXCHANGE_DOUBLE = 2
 3654 const PF_MMX_INSTRUCTIONS_AVAILABLE = 3
 3655 const PF_PPC_MOVEMEM_64BIT_OK = 4
 3656 const PF_ALPHA_BYTE_INSTRUCTIONS = 5
 3657 const PF_XMMI_INSTRUCTIONS_AVAILABLE = 6
 3658 const PF_3DNOW_INSTRUCTIONS_AVAILABLE = 7
 3659 const PF_RDTSC_INSTRUCTION_AVAILABLE = 8
 3660 const PF_PAE_ENABLED = 9
 3661 const PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10
 3662 const PF_SSE_DAZ_MODE_AVAILABLE = 11
 3663 const PF_NX_ENABLED = 12
 3664 const PF_SSE3_INSTRUCTIONS_AVAILABLE = 13
 3665 const PF_COMPARE_EXCHANGE128 = 14
 3666 const PF_COMPARE64_EXCHANGE128 = 15
 3667 const PF_CHANNELS_ENABLED = 16
 3668 const PF_XSAVE_ENABLED = 17
 3669 const PF_ARM_VFP_32_REGISTERS_AVAILABLE = 18
 3670 const PF_ARM_NEON_INSTRUCTIONS_AVAILABLE = 19
 3671 const PF_SECOND_LEVEL_ADDRESS_TRANSLATION = 20
 3672 const PF_VIRT_FIRMWARE_ENABLED = 21
 3673 const PF_RDWRFSGSBASE_AVAILABLE = 22
 3674 const PF_FASTFAIL_AVAILABLE = 23
 3675 const PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE = 24
 3676 const PF_ARM_64BIT_LOADSTORE_ATOMIC = 25
 3677 const PF_ARM_EXTERNAL_CACHE_AVAILABLE = 26
 3678 const PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE = 27
 3679 const XSTATE_LEGACY_FLOATING_POINT = 0
 3680 const XSTATE_LEGACY_SSE = 1
 3681 const XSTATE_GSSE = 2
 3682 const XSTATE_AVX = XSTATE_GSSE
 3683 const XSTATE_MASK_LEGACY_FLOATING_POINT = 1ull shl XSTATE_LEGACY_FLOATING_POINT
 3684 const XSTATE_MASK_LEGACY_SSE = 1ull shl XSTATE_LEGACY_SSE
 3685 const XSTATE_MASK_LEGACY = XSTATE_MASK_LEGACY_FLOATING_POINT or XSTATE_MASK_LEGACY_SSE
 3686 const XSTATE_MASK_GSSE = 1ull shl XSTATE_GSSE
 3687 const XSTATE_MASK_AVX = XSTATE_MASK_GSSE
 3688 const MAXIMUM_XSTATE_FEATURES = 64
 3689 
 3690 type _XSTATE_FEATURE
 3691     Offset as DWORD
 3692     Size as DWORD
 3693 end type
 3694 
 3695 type XSTATE_FEATURE as _XSTATE_FEATURE
 3696 type PXSTATE_FEATURE as _XSTATE_FEATURE ptr
 3697 
 3698 type _XSTATE_CONFIGURATION
 3699     EnabledFeatures as DWORD64
 3700     EnabledVolatileFeatures as DWORD64
 3701     Size as DWORD
 3702     OptimizedSave : 1 as DWORD
 3703     Features(0 to 63) as XSTATE_FEATURE
 3704 end type
 3705 
 3706 type XSTATE_CONFIGURATION as _XSTATE_CONFIGURATION
 3707 type PXSTATE_CONFIGURATION as _XSTATE_CONFIGURATION ptr
 3708 
 3709 type _MEMORY_BASIC_INFORMATION
 3710     BaseAddress as PVOID
 3711     AllocationBase as PVOID
 3712     AllocationProtect as DWORD
 3713     RegionSize as SIZE_T_
 3714     State as DWORD
 3715     Protect as DWORD
 3716     as DWORD Type
 3717 end type
 3718 
 3719 type MEMORY_BASIC_INFORMATION as _MEMORY_BASIC_INFORMATION
 3720 type PMEMORY_BASIC_INFORMATION as _MEMORY_BASIC_INFORMATION ptr
 3721 
 3722 type _MEMORY_BASIC_INFORMATION32
 3723     BaseAddress as DWORD
 3724     AllocationBase as DWORD
 3725     AllocationProtect as DWORD
 3726     RegionSize as DWORD
 3727     State as DWORD
 3728     Protect as DWORD
 3729     as DWORD Type
 3730 end type
 3731 
 3732 type MEMORY_BASIC_INFORMATION32 as _MEMORY_BASIC_INFORMATION32
 3733 type PMEMORY_BASIC_INFORMATION32 as _MEMORY_BASIC_INFORMATION32 ptr
 3734 
 3735 type _MEMORY_BASIC_INFORMATION64
 3736     BaseAddress as ULONGLONG
 3737     AllocationBase as ULONGLONG
 3738     AllocationProtect as DWORD
 3739     __alignment1 as DWORD
 3740     RegionSize as ULONGLONG
 3741     State as DWORD
 3742     Protect as DWORD
 3743     as DWORD Type
 3744     __alignment2 as DWORD
 3745 end type
 3746 
 3747 type MEMORY_BASIC_INFORMATION64 as _MEMORY_BASIC_INFORMATION64
 3748 type PMEMORY_BASIC_INFORMATION64 as _MEMORY_BASIC_INFORMATION64 ptr
 3749 const SECTION_QUERY = &h0001
 3750 const SECTION_MAP_WRITE = &h0002
 3751 const SECTION_MAP_READ = &h0004
 3752 const SECTION_MAP_EXECUTE = &h0008
 3753 const SECTION_EXTEND_SIZE = &h0010
 3754 const SECTION_MAP_EXECUTE_EXPLICIT = &h0020
 3755 const 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
 3756 const SESSION_QUERY_ACCESS = &h1
 3757 const SESSION_MODIFY_ACCESS = &h2
 3758 const SESSION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SESSION_QUERY_ACCESS) or SESSION_MODIFY_ACCESS
 3759 const PAGE_NOACCESS = &h01
 3760 const PAGE_READONLY = &h02
 3761 const PAGE_READWRITE = &h04
 3762 const PAGE_WRITECOPY = &h08
 3763 const PAGE_EXECUTE = &h10
 3764 const PAGE_EXECUTE_READ = &h20
 3765 const PAGE_EXECUTE_READWRITE = &h40
 3766 const PAGE_EXECUTE_WRITECOPY = &h80
 3767 const PAGE_GUARD = &h100
 3768 const PAGE_NOCACHE = &h200
 3769 const PAGE_WRITECOMBINE = &h400
 3770 const MEM_COMMIT = &h1000
 3771 const MEM_RESERVE = &h2000
 3772 const MEM_DECOMMIT = &h4000
 3773 const MEM_RELEASE = &h8000
 3774 const MEM_FREE = &h10000
 3775 const MEM_PRIVATE = &h20000
 3776 const MEM_MAPPED = &h40000
 3777 const MEM_RESET = &h80000
 3778 const MEM_TOP_DOWN = &h100000
 3779 const MEM_WRITE_WATCH = &h200000
 3780 const MEM_PHYSICAL = &h400000
 3781 const MEM_ROTATE = &h800000
 3782 const MEM_LARGE_PAGES = &h20000000
 3783 const MEM_4MB_PAGES = &h80000000
 3784 const SEC_FILE = &h800000
 3785 const SEC_IMAGE = &h1000000
 3786 const SEC_PROTECTED_IMAGE = &h2000000
 3787 const SEC_RESERVE = &h4000000
 3788 const SEC_COMMIT = &h8000000
 3789 const SEC_NOCACHE = &h10000000
 3790 const SEC_WRITECOMBINE = &h40000000
 3791 const SEC_LARGE_PAGES = &h80000000
 3792 const SEC_IMAGE_NO_EXECUTE = SEC_IMAGE or SEC_NOCACHE
 3793 const MEM_IMAGE = SEC_IMAGE
 3794 const WRITE_WATCH_FLAG_RESET = &h01
 3795 const MEM_UNMAP_WITH_TRANSIENT_BOOST = &h01
 3796 const FILE_READ_DATA = &h0001
 3797 const FILE_LIST_DIRECTORY = &h0001
 3798 const FILE_WRITE_DATA = &h0002
 3799 const FILE_ADD_FILE = &h0002
 3800 const FILE_APPEND_DATA = &h0004
 3801 const FILE_ADD_SUBDIRECTORY = &h0004
 3802 const FILE_CREATE_PIPE_INSTANCE = &h0004
 3803 const FILE_READ_EA = &h0008
 3804 const FILE_WRITE_EA = &h0010
 3805 const FILE_EXECUTE = &h0020
 3806 const FILE_TRAVERSE = &h0020
 3807 const FILE_DELETE_CHILD = &h0040
 3808 const FILE_READ_ATTRIBUTES = &h0080
 3809 const FILE_WRITE_ATTRIBUTES = &h0100
 3810 const FILE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE) or &h1FF
 3811 const FILE_GENERIC_READ = (((STANDARD_RIGHTS_READ or FILE_READ_DATA) or FILE_READ_ATTRIBUTES) or FILE_READ_EA) or SYNCHRONIZE
 3812 const FILE_GENERIC_WRITE = ((((STANDARD_RIGHTS_WRITE or FILE_WRITE_DATA) or FILE_WRITE_ATTRIBUTES) or FILE_WRITE_EA) or FILE_APPEND_DATA) or SYNCHRONIZE
 3813 const FILE_GENERIC_EXECUTE = ((STANDARD_RIGHTS_EXECUTE or FILE_READ_ATTRIBUTES) or FILE_EXECUTE) or SYNCHRONIZE
 3814 const FILE_SUPERSEDE = &h00000000
 3815 const FILE_OPEN = &h00000001
 3816 const FILE_CREATE = &h00000002
 3817 const FILE_OPEN_IF = &h00000003
 3818 const FILE_OVERWRITE = &h00000004
 3819 const FILE_OVERWRITE_IF = &h00000005
 3820 const FILE_MAXIMUM_DISPOSITION = &h00000005
 3821 const FILE_DIRECTORY_FILE = &h00000001
 3822 const FILE_WRITE_THROUGH = &h00000002
 3823 const FILE_SEQUENTIAL_ONLY = &h00000004
 3824 const FILE_NO_INTERMEDIATE_BUFFERING = &h00000008
 3825 const FILE_SYNCHRONOUS_IO_ALERT = &h00000010
 3826 const FILE_SYNCHRONOUS_IO_NONALERT = &h00000020
 3827 const FILE_NON_DIRECTORY_FILE = &h00000040
 3828 const FILE_CREATE_TREE_CONNECTION = &h00000080
 3829 const FILE_COMPLETE_IF_OPLOCKED = &h00000100
 3830 const FILE_NO_EA_KNOWLEDGE = &h00000200
 3831 const FILE_OPEN_REMOTE_INSTANCE = &h00000400
 3832 const FILE_RANDOM_ACCESS = &h00000800
 3833 const FILE_DELETE_ON_CLOSE = &h00001000
 3834 const FILE_OPEN_BY_FILE_ID = &h00002000
 3835 const FILE_OPEN_FOR_BACKUP_INTENT = &h00004000
 3836 const FILE_NO_COMPRESSION = &h00008000
 3837 
 3838 #if _WIN32_WINNT = &h0602
 3839     const FILE_OPEN_REQUIRING_OPLOCK = &h00010000
 3840     const FILE_DISALLOW_EXCLUSIVE = &h00020000
 3841 #endif
 3842 
 3843 const FILE_RESERVE_OPFILTER = &h00100000
 3844 const FILE_OPEN_REPARSE_POINT = &h00200000
 3845 const FILE_OPEN_NO_RECALL = &h00400000
 3846 const FILE_OPEN_FOR_FREE_SPACE_QUERY = &h00800000
 3847 const FILE_SHARE_READ = &h00000001
 3848 const FILE_SHARE_WRITE = &h00000002
 3849 const FILE_SHARE_DELETE = &h00000004
 3850 const FILE_SHARE_VALID_FLAGS = &h00000007
 3851 const FILE_ATTRIBUTE_READONLY = &h00000001
 3852 const FILE_ATTRIBUTE_HIDDEN = &h00000002
 3853 const FILE_ATTRIBUTE_SYSTEM = &h00000004
 3854 const FILE_ATTRIBUTE_DIRECTORY = &h00000010
 3855 const FILE_ATTRIBUTE_ARCHIVE = &h00000020
 3856 const FILE_ATTRIBUTE_DEVICE = &h00000040
 3857 const FILE_ATTRIBUTE_NORMAL = &h00000080
 3858 const FILE_ATTRIBUTE_TEMPORARY = &h00000100
 3859 const FILE_ATTRIBUTE_SPARSE_FILE = &h00000200
 3860 const FILE_ATTRIBUTE_REPARSE_POINT = &h00000400
 3861 const FILE_ATTRIBUTE_COMPRESSED = &h00000800
 3862 const FILE_ATTRIBUTE_OFFLINE = &h00001000
 3863 const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = &h00002000
 3864 const FILE_ATTRIBUTE_ENCRYPTED = &h00004000
 3865 const FILE_ATTRIBUTE_VIRTUAL = &h00010000
 3866 const FILE_NOTIFY_CHANGE_FILE_NAME = &h00000001
 3867 const FILE_NOTIFY_CHANGE_DIR_NAME = &h00000002
 3868 const FILE_NOTIFY_CHANGE_ATTRIBUTES = &h00000004
 3869 const FILE_NOTIFY_CHANGE_SIZE = &h00000008
 3870 const FILE_NOTIFY_CHANGE_LAST_WRITE = &h00000010
 3871 const FILE_NOTIFY_CHANGE_LAST_ACCESS = &h00000020
 3872 const FILE_NOTIFY_CHANGE_CREATION = &h00000040
 3873 const FILE_NOTIFY_CHANGE_SECURITY = &h00000100
 3874 const FILE_ACTION_ADDED = &h00000001
 3875 const FILE_ACTION_REMOVED = &h00000002
 3876 const FILE_ACTION_MODIFIED = &h00000003
 3877 const FILE_ACTION_RENAMED_OLD_NAME = &h00000004
 3878 const FILE_ACTION_RENAMED_NEW_NAME = &h00000005
 3879 const MAILSLOT_NO_MESSAGE = cast(DWORD, -1)
 3880 const MAILSLOT_WAIT_FOREVER = cast(DWORD, -1)
 3881 const FILE_CASE_SENSITIVE_SEARCH = &h00000001
 3882 const FILE_CASE_PRESERVED_NAMES = &h00000002
 3883 const FILE_UNICODE_ON_DISK = &h00000004
 3884 const FILE_PERSISTENT_ACLS = &h00000008
 3885 const FILE_FILE_COMPRESSION = &h00000010
 3886 const FILE_VOLUME_QUOTAS = &h00000020
 3887 const FILE_SUPPORTS_SPARSE_FILES = &h00000040
 3888 const FILE_SUPPORTS_REPARSE_POINTS = &h00000080
 3889 const FILE_SUPPORTS_REMOTE_STORAGE = &h00000100
 3890 const FILE_VOLUME_IS_COMPRESSED = &h00008000
 3891 const FILE_SUPPORTS_OBJECT_IDS = &h00010000
 3892 const FILE_SUPPORTS_ENCRYPTION = &h00020000
 3893 const FILE_NAMED_STREAMS = &h00040000
 3894 const FILE_READ_ONLY_VOLUME = &h00080000
 3895 const FILE_SEQUENTIAL_WRITE_ONCE = &h00100000
 3896 const FILE_SUPPORTS_TRANSACTIONS = &h00200000
 3897 const FILE_SUPPORTS_HARD_LINKS = &h00400000
 3898 const FILE_SUPPORTS_EXTENDED_ATTRIBUTES = &h00800000
 3899 const FILE_SUPPORTS_OPEN_BY_FILE_ID = &h01000000
 3900 const FILE_SUPPORTS_USN_JOURNAL = &h02000000
 3901 const FILE_SUPPORTS_INTEGRITY_STREAMS = &h04000000
 3902 
 3903 type FILE_ID_128
 3904     LowPart as ULONGLONG
 3905     HighPart as ULONGLONG
 3906 end type
 3907 
 3908 type PFILE_ID_128 as FILE_ID_128 ptr
 3909 
 3910 type _FILE_NOTIFY_INFORMATION
 3911     NextEntryOffset as DWORD
 3912     Action as DWORD
 3913     FileNameLength as DWORD
 3914     FileName as wstring * 1
 3915 end type
 3916 
 3917 type FILE_NOTIFY_INFORMATION as _FILE_NOTIFY_INFORMATION
 3918 type PFILE_NOTIFY_INFORMATION as _FILE_NOTIFY_INFORMATION ptr
 3919 
 3920 union _FILE_SEGMENT_ELEMENT
 3921     Buffer as PVOID64
 3922     Alignment as ULONGLONG
 3923 end union
 3924 
 3925 type FILE_SEGMENT_ELEMENT as _FILE_SEGMENT_ELEMENT
 3926 type PFILE_SEGMENT_ELEMENT as _FILE_SEGMENT_ELEMENT ptr
 3927 
 3928 type _REPARSE_GUID_DATA_BUFFER_GenericReparseBuffer
 3929     DataBuffer(0 to 0) as UBYTE
 3930 end type
 3931 
 3932 type _REPARSE_GUID_DATA_BUFFER
 3933     ReparseTag as DWORD
 3934     ReparseDataLength as WORD
 3935     Reserved as WORD
 3936     ReparseGuid as GUID
 3937     GenericReparseBuffer as _REPARSE_GUID_DATA_BUFFER_GenericReparseBuffer
 3938 end type
 3939 
 3940 type REPARSE_GUID_DATA_BUFFER as _REPARSE_GUID_DATA_BUFFER
 3941 type PREPARSE_GUID_DATA_BUFFER as _REPARSE_GUID_DATA_BUFFER ptr
 3942 #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
 3943 const MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16 * 1024
 3944 const SYMLINK_FLAG_RELATIVE = 1
 3945 const IO_REPARSE_TAG_RESERVED_ZERO = 0
 3946 const IO_REPARSE_TAG_RESERVED_ONE = 1
 3947 const IO_REPARSE_TAG_RESERVED_RANGE = IO_REPARSE_TAG_RESERVED_ONE
 3948 #define IsReparseTagMicrosoft(_tag) ((_tag) and &h80000000)
 3949 #define IsReparseTagNameSurrogate(_tag) ((_tag) and &h20000000)
 3950 const IO_REPARSE_TAG_MOUNT_POINT = &hA0000003
 3951 const IO_REPARSE_TAG_HSM = &hC0000004
 3952 const IO_REPARSE_TAG_HSM2 = &h80000006
 3953 const IO_REPARSE_TAG_SIS = &h80000007
 3954 const IO_REPARSE_TAG_WIM = &h80000008
 3955 const IO_REPARSE_TAG_CSV = &h80000009
 3956 const IO_REPARSE_TAG_DFS = &h8000000A
 3957 const IO_REPARSE_TAG_FILTER_MANAGER = &h8000000B
 3958 const IO_REPARSE_TAG_DFSR = &h80000012
 3959 const IO_REPARSE_TAG_SYMLINK = &hA000000C
 3960 const IO_REPARSE_TAG_IIS_CACHE = &hA0000010
 3961 const IO_REPARSE_TAG_DRIVE_EXTENDER = &h80000005
 3962 const IO_REPARSE_TAG_DEDUP = &h80000013
 3963 const IO_REPARSE_TAG_NFS = &h80000014
 3964 
 3965 #if _WIN32_WINNT = &h0602
 3966     const SCRUB_DATA_INPUT_FLAG_RESUME = &h00000001
 3967     const SCRUB_DATA_INPUT_FLAG_SKIP_IN_SYNC = &h00000002
 3968     const SCRUB_DATA_INPUT_FLAG_SKIP_NON_INTEGRITY_DATA = &h00000004
 3969     const SCRUB_DATA_OUTPUT_FLAG_INCOMPLETE = &h00000001
 3970     const SCRUB_DATA_OUTPUT_FLAG_NON_USER_DATA_RANGE = &h00010000
 3971 
 3972     type _SCRUB_DATA_INPUT
 3973         Size as DWORD
 3974         Flags as DWORD
 3975         MaximumIos as DWORD
 3976         Reserved(0 to 16) as DWORD
 3977         ResumeContext(0 to 815) as UBYTE
 3978     end type
 3979 
 3980     type SCRUB_DATA_INPUT as _SCRUB_DATA_INPUT
 3981     type PSCRUB_DATA_INPUT as _SCRUB_DATA_INPUT ptr
 3982 
 3983     type _SCRUB_DATA_OUTPUT
 3984         Size as DWORD
 3985         Flags as DWORD
 3986         Status as DWORD
 3987         ErrorFileOffset as ULONGLONG
 3988         ErrorLength as ULONGLONG
 3989         NumberOfBytesRepaired as ULONGLONG
 3990         NumberOfBytesFailed as ULONGLONG
 3991         InternalFileReference as ULONGLONG
 3992         Reserved(0 to 5) as DWORD
 3993         ResumeContext(0 to 815) as UBYTE
 3994     end type
 3995 
 3996     type SCRUB_DATA_OUTPUT as _SCRUB_DATA_OUTPUT
 3997     type PSCRUB_DATA_OUTPUT as _SCRUB_DATA_OUTPUT ptr
 3998 #endif
 3999 
 4000 const IO_COMPLETION_MODIFY_STATE = &h0002
 4001 const IO_COMPLETION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE) or &h3
 4002 const DUPLICATE_CLOSE_SOURCE = &h00000001
 4003 const DUPLICATE_SAME_ACCESS = &h00000002
 4004 const POWERBUTTON_ACTION_INDEX_NOTHING = 0
 4005 const POWERBUTTON_ACTION_INDEX_SLEEP = 1
 4006 const POWERBUTTON_ACTION_INDEX_HIBERNATE = 2
 4007 const POWERBUTTON_ACTION_INDEX_SHUTDOWN = 3
 4008 const POWERBUTTON_ACTION_VALUE_NOTHING = 0
 4009 const POWERBUTTON_ACTION_VALUE_SLEEP = 2
 4010 const POWERBUTTON_ACTION_VALUE_HIBERNATE = 3
 4011 const POWERBUTTON_ACTION_VALUE_SHUTDOWN = 6
 4012 const PERFSTATE_POLICY_CHANGE_IDEAL = 0
 4013 const PERFSTATE_POLICY_CHANGE_SINGLE = 1
 4014 const PERFSTATE_POLICY_CHANGE_ROCKET = 2
 4015 const PERFSTATE_POLICY_CHANGE_MAX = PERFSTATE_POLICY_CHANGE_ROCKET
 4016 const PROCESSOR_PERF_BOOST_POLICY_DISABLED = 0
 4017 const PROCESSOR_PERF_BOOST_POLICY_MAX = 100
 4018 const PROCESSOR_PERF_BOOST_MODE_DISABLED = 0
 4019 const PROCESSOR_PERF_BOOST_MODE_ENABLED = 1
 4020 const PROCESSOR_PERF_BOOST_MODE_AGGRESSIVE = 2
 4021 const PROCESSOR_PERF_BOOST_MODE_EFFICIENT_ENABLED = 3
 4022 const PROCESSOR_PERF_BOOST_MODE_EFFICIENT_AGGRESSIVE = 4
 4023 const PROCESSOR_PERF_BOOST_MODE_MAX = PROCESSOR_PERF_BOOST_MODE_EFFICIENT_AGGRESSIVE
 4024 const CORE_PARKING_POLICY_CHANGE_IDEAL = 0
 4025 const CORE_PARKING_POLICY_CHANGE_SINGLE = 1
 4026 const CORE_PARKING_POLICY_CHANGE_ROCKET = 2
 4027 const CORE_PARKING_POLICY_CHANGE_MULTISTEP = 3
 4028 const CORE_PARKING_POLICY_CHANGE_MAX = CORE_PARKING_POLICY_CHANGE_MULTISTEP
 4029 const POWER_DEVICE_IDLE_POLICY_PERFORMANCE = 0
 4030 const POWER_DEVICE_IDLE_POLICY_CONSERVATIVE = 1
 4031 
 4032 extern GUID_MAX_POWER_SAVINGS as const GUID
 4033 extern GUID_MIN_POWER_SAVINGS as const GUID
 4034 extern GUID_TYPICAL_POWER_SAVINGS as const GUID
 4035 extern NO_SUBGROUP_GUID as const GUID
 4036 extern ALL_POWERSCHEMES_GUID as const GUID
 4037 extern GUID_POWERSCHEME_PERSONALITY as const GUID
 4038 extern GUID_ACTIVE_POWERSCHEME as const GUID
 4039 extern GUID_IDLE_RESILIENCY_SUBGROUP as const GUID
 4040 extern GUID_IDLE_RESILIENCY_PERIOD as const GUID
 4041 extern GUID_DISK_COALESCING_POWERDOWN_TIMEOUT as const GUID
 4042 extern GUID_EXECUTION_REQUIRED_REQUEST_TIMEOUT as const GUID
 4043 extern GUID_VIDEO_SUBGROUP as const GUID
 4044 extern GUID_VIDEO_POWERDOWN_TIMEOUT as const GUID
 4045 extern GUID_VIDEO_ANNOYANCE_TIMEOUT as const GUID
 4046 extern GUID_VIDEO_ADAPTIVE_PERCENT_INCREASE as const GUID
 4047 extern GUID_VIDEO_DIM_TIMEOUT as const GUID
 4048 extern GUID_VIDEO_ADAPTIVE_POWERDOWN as const GUID
 4049 extern GUID_MONITOR_POWER_ON as const GUID
 4050 extern GUID_DEVICE_POWER_POLICY_VIDEO_BRIGHTNESS as const GUID
 4051 extern GUID_DEVICE_POWER_POLICY_VIDEO_DIM_BRIGHTNESS as const GUID
 4052 extern GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS as const GUID
 4053 extern GUID_VIDEO_ADAPTIVE_DISPLAY_BRIGHTNESS as const GUID
 4054 extern GUID_CONSOLE_DISPLAY_STATE as const GUID
 4055 extern GUID_ALLOW_DISPLAY_REQUIRED as const GUID
 4056 extern GUID_VIDEO_CONSOLE_LOCK_TIMEOUT as const GUID
 4057 extern GUID_ADAPTIVE_POWER_BEHAVIOR_SUBGROUP as const GUID
 4058 extern GUID_NON_ADAPTIVE_INPUT_TIMEOUT as const GUID
 4059 extern GUID_DISK_SUBGROUP as const GUID
 4060 extern GUID_DISK_POWERDOWN_TIMEOUT as const GUID
 4061 extern GUID_DISK_IDLE_TIMEOUT as const GUID
 4062 extern GUID_DISK_BURST_IGNORE_THRESHOLD as const GUID
 4063 extern GUID_DISK_ADAPTIVE_POWERDOWN as const GUID
 4064 extern GUID_SLEEP_SUBGROUP as const GUID
 4065 extern GUID_SLEEP_IDLE_THRESHOLD as const GUID
 4066 extern GUID_STANDBY_TIMEOUT as const GUID
 4067 extern GUID_UNATTEND_SLEEP_TIMEOUT as const GUID
 4068 extern GUID_HIBERNATE_TIMEOUT as const GUID
 4069 extern GUID_HIBERNATE_FASTS4_POLICY as const GUID
 4070 extern GUID_CRITICAL_POWER_TRANSITION as const GUID
 4071 extern GUID_SYSTEM_AWAYMODE as const GUID
 4072 extern GUID_ALLOW_AWAYMODE as const GUID
 4073 extern GUID_ALLOW_STANDBY_STATES as const GUID
 4074 extern GUID_ALLOW_RTC_WAKE as const GUID
 4075 extern GUID_ALLOW_SYSTEM_REQUIRED as const GUID
 4076 extern GUID_SYSTEM_BUTTON_SUBGROUP as const GUID
 4077 extern GUID_POWERBUTTON_ACTION as const GUID
 4078 extern GUID_SLEEPBUTTON_ACTION as const GUID
 4079 extern GUID_USERINTERFACEBUTTON_ACTION as const GUID
 4080 extern GUID_LIDCLOSE_ACTION as const GUID
 4081 extern GUID_LIDOPEN_POWERSTATE as const GUID
 4082 extern GUID_BATTERY_SUBGROUP as const GUID
 4083 extern GUID_BATTERY_DISCHARGE_ACTION_0 as const GUID
 4084 extern GUID_BATTERY_DISCHARGE_LEVEL_0 as const GUID
 4085 extern GUID_BATTERY_DISCHARGE_FLAGS_0 as const GUID
 4086 extern GUID_BATTERY_DISCHARGE_ACTION_1 as const GUID
 4087 extern GUID_BATTERY_DISCHARGE_LEVEL_1 as const GUID
 4088 extern GUID_BATTERY_DISCHARGE_FLAGS_1 as const GUID
 4089 extern GUID_BATTERY_DISCHARGE_ACTION_2 as const GUID
 4090 extern GUID_BATTERY_DISCHARGE_LEVEL_2 as const GUID
 4091 extern GUID_BATTERY_DISCHARGE_FLAGS_2 as const GUID
 4092 extern GUID_BATTERY_DISCHARGE_ACTION_3 as const GUID
 4093 extern GUID_BATTERY_DISCHARGE_LEVEL_3 as const GUID
 4094 extern GUID_BATTERY_DISCHARGE_FLAGS_3 as const GUID
 4095 extern GUID_PROCESSOR_SETTINGS_SUBGROUP as const GUID
 4096 extern GUID_PROCESSOR_THROTTLE_POLICY as const GUID
 4097 extern GUID_PROCESSOR_THROTTLE_MAXIMUM as const GUID
 4098 extern GUID_PROCESSOR_THROTTLE_MINIMUM as const GUID
 4099 extern GUID_PROCESSOR_ALLOW_THROTTLING as const GUID
 4100 extern GUID_PROCESSOR_IDLESTATE_POLICY as const GUID
 4101 extern GUID_PROCESSOR_PERFSTATE_POLICY as const GUID
 4102 extern GUID_PROCESSOR_PERF_INCREASE_THRESHOLD as const GUID
 4103 extern GUID_PROCESSOR_PERF_DECREASE_THRESHOLD as const GUID
 4104 extern GUID_PROCESSOR_PERF_INCREASE_POLICY as const GUID
 4105 extern GUID_PROCESSOR_PERF_DECREASE_POLICY as const GUID
 4106 extern GUID_PROCESSOR_PERF_INCREASE_TIME as const GUID
 4107 extern GUID_PROCESSOR_PERF_DECREASE_TIME as const GUID
 4108 extern GUID_PROCESSOR_PERF_TIME_CHECK as const GUID
 4109 extern GUID_PROCESSOR_PERF_BOOST_POLICY as const GUID
 4110 extern GUID_PROCESSOR_PERF_BOOST_MODE as const GUID
 4111 extern GUID_PROCESSOR_IDLE_ALLOW_SCALING as const GUID
 4112 extern GUID_PROCESSOR_IDLE_DISABLE as const GUID
 4113 extern GUID_PROCESSOR_IDLE_STATE_MAXIMUM as const GUID
 4114 extern GUID_PROCESSOR_IDLE_TIME_CHECK as const GUID
 4115 extern GUID_PROCESSOR_IDLE_DEMOTE_THRESHOLD as const GUID
 4116 extern GUID_PROCESSOR_IDLE_PROMOTE_THRESHOLD as const GUID
 4117 extern GUID_PROCESSOR_CORE_PARKING_INCREASE_THRESHOLD as const GUID
 4118 extern GUID_PROCESSOR_CORE_PARKING_DECREASE_THRESHOLD as const GUID
 4119 extern GUID_PROCESSOR_CORE_PARKING_INCREASE_POLICY as const GUID
 4120 extern GUID_PROCESSOR_CORE_PARKING_DECREASE_POLICY as const GUID
 4121 extern GUID_PROCESSOR_CORE_PARKING_MAX_CORES as const GUID
 4122 extern GUID_PROCESSOR_CORE_PARKING_MIN_CORES as const GUID
 4123 extern GUID_PROCESSOR_CORE_PARKING_INCREASE_TIME as const GUID
 4124 extern GUID_PROCESSOR_CORE_PARKING_DECREASE_TIME as const GUID
 4125 extern GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_DECREASE_FACTOR as const GUID
 4126 extern GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_THRESHOLD as const GUID
 4127 extern GUID_PROCESSOR_CORE_PARKING_AFFINITY_WEIGHTING as const GUID
 4128 extern GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_DECREASE_FACTOR as const GUID
 4129 extern GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_THRESHOLD as const GUID
 4130 extern GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_WEIGHTING as const GUID
 4131 extern GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_THRESHOLD as const GUID
 4132 extern GUID_PROCESSOR_PARKING_CORE_OVERRIDE as const GUID
 4133 extern GUID_PROCESSOR_PARKING_PERF_STATE as const GUID
 4134 extern GUID_PROCESSOR_PARKING_CONCURRENCY_THRESHOLD as const GUID
 4135 extern GUID_PROCESSOR_PARKING_HEADROOM_THRESHOLD as const GUID
 4136 extern GUID_PROCESSOR_PERF_HISTORY as const GUID
 4137 extern GUID_PROCESSOR_PERF_LATENCY_HINT as const GUID
 4138 extern GUID_PROCESSOR_DISTRIBUTE_UTILITY as const GUID
 4139 extern GUID_SYSTEM_COOLING_POLICY as const GUID
 4140 extern GUID_LOCK_CONSOLE_ON_WAKE as const GUID
 4141 extern GUID_DEVICE_IDLE_POLICY as const GUID
 4142 extern GUID_ACDC_POWER_SOURCE as const GUID
 4143 extern GUID_LIDSWITCH_STATE_CHANGE as const GUID
 4144 extern GUID_BATTERY_PERCENTAGE_REMAINING as const GUID
 4145 extern GUID_GLOBAL_USER_PRESENCE as const GUID
 4146 extern GUID_SESSION_DISPLAY_STATUS as const GUID
 4147 extern GUID_SESSION_USER_PRESENCE as const GUID
 4148 extern GUID_IDLE_BACKGROUND_TASK as const GUID
 4149 extern GUID_BACKGROUND_TASK_NOTIFICATION as const GUID
 4150 extern GUID_APPLAUNCH_BUTTON as const GUID
 4151 extern GUID_PCIEXPRESS_SETTINGS_SUBGROUP as const GUID
 4152 extern GUID_PCIEXPRESS_ASPM_POLICY as const GUID
 4153 extern GUID_ENABLE_SWITCH_FORCED_SHUTDOWN as const GUID
 4154 
 4155 type _SYSTEM_POWER_STATE as long
 4156 enum
 4157     PowerSystemUnspecified = 0
 4158     PowerSystemWorking = 1
 4159     PowerSystemSleeping1 = 2
 4160     PowerSystemSleeping2 = 3
 4161     PowerSystemSleeping3 = 4
 4162     PowerSystemHibernate = 5
 4163     PowerSystemShutdown = 6
 4164     PowerSystemMaximum = 7
 4165 end enum
 4166 
 4167 type SYSTEM_POWER_STATE as _SYSTEM_POWER_STATE
 4168 type PSYSTEM_POWER_STATE as _SYSTEM_POWER_STATE ptr
 4169 const POWER_SYSTEM_MAXIMUM = 7
 4170 
 4171 type POWER_ACTION as long
 4172 enum
 4173     PowerActionNone = 0
 4174     PowerActionReserved
 4175     PowerActionSleep
 4176     PowerActionHibernate
 4177     PowerActionShutdown
 4178     PowerActionShutdownReset
 4179     PowerActionShutdownOff
 4180     PowerActionWarmEject
 4181 end enum
 4182 
 4183 type PPOWER_ACTION as POWER_ACTION ptr
 4184 
 4185 type _DEVICE_POWER_STATE as long
 4186 enum
 4187     PowerDeviceUnspecified = 0
 4188     PowerDeviceD0
 4189     PowerDeviceD1
 4190     PowerDeviceD2
 4191     PowerDeviceD3
 4192     PowerDeviceMaximum
 4193 end enum
 4194 
 4195 type DEVICE_POWER_STATE as _DEVICE_POWER_STATE
 4196 type PDEVICE_POWER_STATE as _DEVICE_POWER_STATE ptr
 4197 
 4198 type _MONITOR_DISPLAY_STATE as long
 4199 enum
 4200     PowerMonitorOff = 0
 4201     PowerMonitorOn
 4202     PowerMonitorDim
 4203 end enum
 4204 
 4205 type MONITOR_DISPLAY_STATE as _MONITOR_DISPLAY_STATE
 4206 type PMONITOR_DISPLAY_STATE as _MONITOR_DISPLAY_STATE ptr
 4207 
 4208 type _USER_ACTIVITY_PRESENCE as long
 4209 enum
 4210     PowerUserPresent = 0
 4211     PowerUserNotPresent
 4212     PowerUserInactive
 4213     PowerUserMaximum
 4214     PowerUserInvalid = PowerUserMaximum
 4215 end enum
 4216 
 4217 type USER_ACTIVITY_PRESENCE as _USER_ACTIVITY_PRESENCE
 4218 type PUSER_ACTIVITY_PRESENCE as _USER_ACTIVITY_PRESENCE ptr
 4219 const ES_SYSTEM_REQUIRED = cast(DWORD, &h00000001)
 4220 const ES_DISPLAY_REQUIRED = cast(DWORD, &h00000002)
 4221 const ES_USER_PRESENT = cast(DWORD, &h00000004)
 4222 const ES_AWAYMODE_REQUIRED = cast(DWORD, &h00000040)
 4223 const ES_CONTINUOUS = cast(DWORD, &h80000000)
 4224 type EXECUTION_STATE as DWORD
 4225 type PEXECUTION_STATE as DWORD ptr
 4226 
 4227 type LATENCY_TIME as long
 4228 enum
 4229     LT_DONT_CARE
 4230     LT_LOWEST_LATENCY
 4231 end enum
 4232 
 4233 const DIAGNOSTIC_REASON_VERSION = 0
 4234 const POWER_REQUEST_CONTEXT_VERSION = 0
 4235 const DIAGNOSTIC_REASON_SIMPLE_STRING = &h00000001
 4236 const DIAGNOSTIC_REASON_DETAILED_STRING = &h00000002
 4237 const DIAGNOSTIC_REASON_NOT_SPECIFIED = &h80000000
 4238 const DIAGNOSTIC_REASON_INVALID_FLAGS = not &h80000003
 4239 const POWER_REQUEST_CONTEXT_SIMPLE_STRING = &h00000001
 4240 const POWER_REQUEST_CONTEXT_DETAILED_STRING = &h00000002
 4241 
 4242 type _POWER_REQUEST_TYPE as long
 4243 enum
 4244     PowerRequestDisplayRequired
 4245     PowerRequestSystemRequired
 4246     PowerRequestAwayModeRequired
 4247     PowerRequestExecutionRequired
 4248 end enum
 4249 
 4250 type POWER_REQUEST_TYPE as _POWER_REQUEST_TYPE
 4251 type PPOWER_REQUEST_TYPE as _POWER_REQUEST_TYPE ptr
 4252 const PDCAP_D0_SUPPORTED = &h00000001
 4253 const PDCAP_D1_SUPPORTED = &h00000002
 4254 const PDCAP_D2_SUPPORTED = &h00000004
 4255 const PDCAP_D3_SUPPORTED = &h00000008
 4256 const PDCAP_WAKE_FROM_D0_SUPPORTED = &h00000010
 4257 const PDCAP_WAKE_FROM_D1_SUPPORTED = &h00000020
 4258 const PDCAP_WAKE_FROM_D2_SUPPORTED = &h00000040
 4259 const PDCAP_WAKE_FROM_D3_SUPPORTED = &h00000080
 4260 const PDCAP_WARM_EJECT_SUPPORTED = &h00000100
 4261 
 4262 type CM_Power_Data_s
 4263     PD_Size as DWORD
 4264     PD_MostRecentPowerState as DEVICE_POWER_STATE
 4265     PD_Capabilities as DWORD
 4266     PD_D1Latency as DWORD
 4267     PD_D2Latency as DWORD
 4268     PD_D3Latency as DWORD
 4269     PD_PowerStateMapping(0 to 6) as DEVICE_POWER_STATE
 4270     PD_DeepestSystemWake as SYSTEM_POWER_STATE
 4271 end type
 4272 
 4273 type CM_POWER_DATA as CM_Power_Data_s
 4274 type PCM_POWER_DATA as CM_Power_Data_s ptr
 4275 
 4276 type POWER_INFORMATION_LEVEL as long
 4277 enum
 4278     SystemPowerPolicyAc
 4279     SystemPowerPolicyDc
 4280     VerifySystemPolicyAc
 4281     VerifySystemPolicyDc
 4282     SystemPowerCapabilities
 4283     SystemBatteryState
 4284     SystemPowerStateHandler
 4285     ProcessorStateHandler
 4286     SystemPowerPolicyCurrent
 4287     AdministratorPowerPolicy
 4288     SystemReserveHiberFile
 4289     ProcessorInformation
 4290     SystemPowerInformation
 4291     ProcessorStateHandler2
 4292     LastWakeTime
 4293     LastSleepTime
 4294     SystemExecutionState
 4295     SystemPowerStateNotifyHandler
 4296     ProcessorPowerPolicyAc
 4297     ProcessorPowerPolicyDc
 4298     VerifyProcessorPowerPolicyAc
 4299     VerifyProcessorPowerPolicyDc
 4300     ProcessorPowerPolicyCurrent
 4301     SystemPowerStateLogging
 4302     SystemPowerLoggingEntry
 4303     SetPowerSettingValue
 4304     NotifyUserPowerSetting
 4305     PowerInformationLevelUnused0
 4306     SystemMonitorHiberBootPowerOff
 4307     SystemVideoState
 4308     TraceApplicationPowerMessage
 4309     TraceApplicationPowerMessageEnd
 4310     ProcessorPerfStates
 4311     ProcessorIdleStates
 4312     ProcessorCap
 4313     SystemWakeSource
 4314     SystemHiberFileInformation
 4315     TraceServicePowerMessage
 4316     ProcessorLoad
 4317     PowerShutdownNotification
 4318     MonitorCapabilities
 4319     SessionPowerInit
 4320     SessionDisplayState
 4321     PowerRequestCreate
 4322     PowerRequestAction
 4323     GetPowerRequestList
 4324     ProcessorInformationEx
 4325     NotifyUserModeLegacyPowerEvent
 4326     GroupPark
 4327     ProcessorIdleDomains
 4328     WakeTimerList
 4329     SystemHiberFileSize
 4330     ProcessorIdleStatesHv
 4331     ProcessorPerfStatesHv
 4332     ProcessorPerfCapHv
 4333     ProcessorSetIdle
 4334     LogicalProcessorIdling
 4335     UserPresence
 4336     PowerSettingNotificationName
 4337     GetPowerSettingValue
 4338     IdleResiliency
 4339     SessionRITState
 4340     SessionConnectNotification
 4341     SessionPowerCleanup
 4342     SessionLockState
 4343     SystemHiberbootState
 4344     PlatformInformation
 4345     PdcInvocation
 4346     MonitorInvocation
 4347     FirmwareTableInformationRegistered
 4348     SetShutdownSelectedTime
 4349     SuspendResumeInvocation
 4350     PlmPowerRequestCreate
 4351     ScreenOff
 4352     CsDeviceNotification
 4353     PlatformRole
 4354     LastResumePerformance
 4355     DisplayBurst
 4356     ExitLatencySamplingPercentage
 4357     ApplyLowPowerScenarioSettings
 4358     PowerInformationLevelMaximum
 4359 end enum
 4360 
 4361 type POWER_USER_PRESENCE_TYPE as long
 4362 enum
 4363     UserNotPresent = 0
 4364     UserPresent = 1
 4365     UserUnknown = &hff
 4366 end enum
 4367 
 4368 type PPOWER_USER_PRESENCE_TYPE as POWER_USER_PRESENCE_TYPE ptr
 4369 
 4370 type _POWER_USER_PRESENCE
 4371     UserPresence as POWER_USER_PRESENCE_TYPE
 4372 end type
 4373 
 4374 type POWER_USER_PRESENCE as _POWER_USER_PRESENCE
 4375 type PPOWER_USER_PRESENCE as _POWER_USER_PRESENCE ptr
 4376 
 4377 type _POWER_SESSION_CONNECT
 4378     Connected as WINBOOLEAN
 4379     Console as WINBOOLEAN
 4380 end type
 4381 
 4382 type POWER_SESSION_CONNECT as _POWER_SESSION_CONNECT
 4383 type PPOWER_SESSION_CONNECT as _POWER_SESSION_CONNECT ptr
 4384 
 4385 type _POWER_SESSION_TIMEOUTS
 4386     InputTimeout as DWORD
 4387     DisplayTimeout as DWORD
 4388 end type
 4389 
 4390 type POWER_SESSION_TIMEOUTS as _POWER_SESSION_TIMEOUTS
 4391 type PPOWER_SESSION_TIMEOUTS as _POWER_SESSION_TIMEOUTS ptr
 4392 
 4393 type _POWER_SESSION_RIT_STATE
 4394     Active as WINBOOLEAN
 4395     LastInputTime as DWORD
 4396 end type
 4397 
 4398 type POWER_SESSION_RIT_STATE as _POWER_SESSION_RIT_STATE
 4399 type PPOWER_SESSION_RIT_STATE as _POWER_SESSION_RIT_STATE ptr
 4400 
 4401 type _POWER_SESSION_WINLOGON
 4402     SessionId as DWORD
 4403     Console as WINBOOLEAN
 4404     Locked as WINBOOLEAN
 4405 end type
 4406 
 4407 type POWER_SESSION_WINLOGON as _POWER_SESSION_WINLOGON
 4408 type PPOWER_SESSION_WINLOGON as _POWER_SESSION_WINLOGON ptr
 4409 
 4410 type _POWER_IDLE_RESILIENCY
 4411     CoalescingTimeout as DWORD
 4412     IdleResiliencyPeriod as DWORD
 4413 end type
 4414 
 4415 type POWER_IDLE_RESILIENCY as _POWER_IDLE_RESILIENCY
 4416 type PPOWER_IDLE_RESILIENCY as _POWER_IDLE_RESILIENCY ptr
 4417 
 4418 type POWER_MONITOR_REQUEST_REASON as long
 4419 enum
 4420     MonitorRequestReasonUnknown
 4421     MonitorRequestReasonPowerButton
 4422     MonitorRequestReasonRemoteConnection
 4423     MonitorRequestReasonScMonitorpower
 4424     MonitorRequestReasonUserInput
 4425     MonitorRequestReasonAcDcDisplayBurst
 4426     MonitorRequestReasonUserDisplayBurst
 4427     MonitorRequestReasonPoSetSystemState
 4428     MonitorRequestReasonSetThreadExecutionState
 4429     MonitorRequestReasonFullWake
 4430     MonitorRequestReasonSessionUnlock
 4431     MonitorRequestReasonScreenOffRequest
 4432     MonitorRequestReasonIdleTimeout
 4433     MonitorRequestReasonPolicyChange
 4434     MonitorRequestReasonMax
 4435 end enum
 4436 
 4437 type _POWER_MONITOR_INVOCATION
 4438     On as WINBOOLEAN
 4439     Console as WINBOOLEAN
 4440     RequestReason as POWER_MONITOR_REQUEST_REASON
 4441 end type
 4442 
 4443 type POWER_MONITOR_INVOCATION as _POWER_MONITOR_INVOCATION
 4444 type PPOWER_MONITOR_INVOCATION as _POWER_MONITOR_INVOCATION ptr
 4445 
 4446 type _RESUME_PERFORMANCE
 4447     PostTimeMs as DWORD
 4448     TotalResumeTimeMs as ULONGLONG
 4449     ResumeCompleteTimestamp as ULONGLONG
 4450 end type
 4451 
 4452 type RESUME_PERFORMANCE as _RESUME_PERFORMANCE
 4453 type PRESUME_PERFORMANCE as _RESUME_PERFORMANCE ptr
 4454 
 4455 type SYSTEM_POWER_CONDITION as long
 4456 enum
 4457     PoAc
 4458     PoDc
 4459     PoHot
 4460     PoConditionMaximum
 4461 end enum
 4462 
 4463 type SET_POWER_SETTING_VALUE
 4464     Version as DWORD
 4465     Guid as GUID
 4466     PowerCondition as SYSTEM_POWER_CONDITION
 4467     DataLength as DWORD
 4468     Data(0 to 0) as UBYTE
 4469 end type
 4470 
 4471 type PSET_POWER_SETTING_VALUE as SET_POWER_SETTING_VALUE ptr
 4472 const POWER_SETTING_VALUE_VERSION = &h1
 4473 
 4474 type NOTIFY_USER_POWER_SETTING
 4475     Guid as GUID
 4476 end type
 4477 
 4478 type PNOTIFY_USER_POWER_SETTING as NOTIFY_USER_POWER_SETTING ptr
 4479 
 4480 type _APPLICATIONLAUNCH_SETTING_VALUE
 4481     ActivationTime as LARGE_INTEGER
 4482     Flags as DWORD
 4483     ButtonInstanceID as DWORD
 4484 end type
 4485 
 4486 type APPLICATIONLAUNCH_SETTING_VALUE as _APPLICATIONLAUNCH_SETTING_VALUE
 4487 type PAPPLICATIONLAUNCH_SETTING_VALUE as _APPLICATIONLAUNCH_SETTING_VALUE ptr
 4488 
 4489 type _POWER_PLATFORM_ROLE as long
 4490 enum
 4491     PlatformRoleUnspecified = 0
 4492     PlatformRoleDesktop
 4493     PlatformRoleMobile
 4494     PlatformRoleWorkstation
 4495     PlatformRoleEnterpriseServer
 4496     PlatformRoleSOHOServer
 4497     PlatformRoleAppliancePC
 4498     PlatformRolePerformanceServer
 4499     PlatformRoleSlate
 4500     PlatformRoleMaximum
 4501 end enum
 4502 
 4503 type POWER_PLATFORM_ROLE as _POWER_PLATFORM_ROLE
 4504 type PPOWER_PLATFORM_ROLE as _POWER_PLATFORM_ROLE ptr
 4505 
 4506 type _POWER_PLATFORM_INFORMATION
 4507     AoAc as WINBOOLEAN
 4508 end type
 4509 
 4510 type POWER_PLATFORM_INFORMATION as _POWER_PLATFORM_INFORMATION
 4511 type PPOWER_PLATFORM_INFORMATION as _POWER_PLATFORM_INFORMATION ptr
 4512 const POWER_PLATFORM_ROLE_V1 = &h00000001
 4513 const POWER_PLATFORM_ROLE_V1_MAX = PlatformRolePerformanceServer + 1
 4514 const POWER_PLATFORM_ROLE_V2 = &h00000002
 4515 const POWER_PLATFORM_ROLE_V2_MAX = PlatformRoleSlate + 1
 4516 
 4517 #if _WIN32_WINNT = &h0602
 4518     const POWER_PLATFORM_ROLE_VERSION = POWER_PLATFORM_ROLE_V2
 4519     const POWER_PLATFORM_ROLE_VERSION_MAX = POWER_PLATFORM_ROLE_V2_MAX
 4520 #else
 4521     const POWER_PLATFORM_ROLE_VERSION = POWER_PLATFORM_ROLE_V1
 4522     const POWER_PLATFORM_ROLE_VERSION_MAX = POWER_PLATFORM_ROLE_V1_MAX
 4523 #endif
 4524 
 4525 type BATTERY_REPORTING_SCALE
 4526     Granularity as DWORD
 4527     Capacity as DWORD
 4528 end type
 4529 
 4530 type PBATTERY_REPORTING_SCALE as BATTERY_REPORTING_SCALE ptr
 4531 
 4532 type PPM_WMI_LEGACY_PERFSTATE
 4533     Frequency as DWORD
 4534     Flags as DWORD
 4535     PercentFrequency as DWORD
 4536 end type
 4537 
 4538 type PPPM_WMI_LEGACY_PERFSTATE as PPM_WMI_LEGACY_PERFSTATE ptr
 4539 
 4540 type PPM_WMI_IDLE_STATE
 4541     Latency as DWORD
 4542     Power as DWORD
 4543     TimeCheck as DWORD
 4544     PromotePercent as UBYTE
 4545     DemotePercent as UBYTE
 4546     StateType as UBYTE
 4547     Reserved as UBYTE
 4548     StateFlags as DWORD
 4549     Context as DWORD
 4550     IdleHandler as DWORD
 4551     Reserved1 as DWORD
 4552 end type
 4553 
 4554 type PPPM_WMI_IDLE_STATE as PPM_WMI_IDLE_STATE ptr
 4555 
 4556 type PPM_WMI_IDLE_STATES
 4557     as DWORD Type
 4558     Count as DWORD
 4559     TargetState as DWORD
 4560     OldState as DWORD
 4561     TargetProcessors as DWORD64
 4562     State(0 to 0) as PPM_WMI_IDLE_STATE
 4563 end type
 4564 
 4565 type PPPM_WMI_IDLE_STATES as PPM_WMI_IDLE_STATES ptr
 4566 
 4567 type PPM_WMI_IDLE_STATES_EX
 4568     as DWORD Type
 4569     Count as DWORD
 4570     TargetState as DWORD
 4571     OldState as DWORD
 4572     TargetProcessors as PVOID
 4573     State(0 to 0) as PPM_WMI_IDLE_STATE
 4574 end type
 4575 
 4576 type PPPM_WMI_IDLE_STATES_EX as PPM_WMI_IDLE_STATES_EX ptr
 4577 
 4578 type PPM_WMI_PERF_STATE
 4579     Frequency as DWORD
 4580     Power as DWORD
 4581     PercentFrequency as UBYTE
 4582     IncreaseLevel as UBYTE
 4583     DecreaseLevel as UBYTE
 4584     as UBYTE Type
 4585     IncreaseTime as DWORD
 4586     DecreaseTime as DWORD
 4587     Control as DWORD64
 4588     Status as DWORD64
 4589     HitCount as DWORD
 4590     Reserved1 as DWORD
 4591     Reserved2 as DWORD64
 4592     Reserved3 as DWORD64
 4593 end type
 4594 
 4595 type PPPM_WMI_PERF_STATE as PPM_WMI_PERF_STATE ptr
 4596 
 4597 type PPM_WMI_PERF_STATES
 4598     Count as DWORD
 4599     MaxFrequency as DWORD
 4600     CurrentState as DWORD
 4601     MaxPerfState as DWORD
 4602     MinPerfState as DWORD
 4603     LowestPerfState as DWORD
 4604     ThermalConstraint as DWORD
 4605     BusyAdjThreshold as UBYTE
 4606     PolicyType as UBYTE
 4607     as UBYTE Type
 4608     Reserved as UBYTE
 4609     TimerInterval as DWORD
 4610     TargetProcessors as DWORD64
 4611     PStateHandler as DWORD
 4612     PStateContext as DWORD
 4613     TStateHandler as DWORD
 4614     TStateContext as DWORD
 4615     FeedbackHandler as DWORD
 4616     Reserved1 as DWORD
 4617     Reserved2 as DWORD64
 4618     State(0 to 0) as PPM_WMI_PERF_STATE
 4619 end type
 4620 
 4621 type PPPM_WMI_PERF_STATES as PPM_WMI_PERF_STATES ptr
 4622 
 4623 type PPM_WMI_PERF_STATES_EX
 4624     Count as DWORD
 4625     MaxFrequency as DWORD
 4626     CurrentState as DWORD
 4627     MaxPerfState as DWORD
 4628     MinPerfState as DWORD
 4629     LowestPerfState as DWORD
 4630     ThermalConstraint as DWORD
 4631     BusyAdjThreshold as UBYTE
 4632     PolicyType as UBYTE
 4633     as UBYTE Type
 4634     Reserved as UBYTE
 4635     TimerInterval as DWORD
 4636     TargetProcessors as PVOID
 4637     PStateHandler as DWORD
 4638     PStateContext as DWORD
 4639     TStateHandler as DWORD
 4640     TStateContext as DWORD
 4641     FeedbackHandler as DWORD
 4642     Reserved1 as DWORD
 4643     Reserved2 as DWORD64
 4644     State(0 to 0) as PPM_WMI_PERF_STATE
 4645 end type
 4646 
 4647 type PPPM_WMI_PERF_STATES_EX as PPM_WMI_PERF_STATES_EX ptr
 4648 const PROC_IDLE_BUCKET_COUNT = 6
 4649 const PROC_IDLE_BUCKET_COUNT_EX = 16
 4650 
 4651 type PPM_IDLE_STATE_ACCOUNTING
 4652     IdleTransitions as DWORD
 4653     FailedTransitions as DWORD
 4654     InvalidBucketIndex as DWORD
 4655     TotalTime as DWORD64
 4656     IdleTimeBuckets(0 to 5) as DWORD
 4657 end type
 4658 
 4659 type PPPM_IDLE_STATE_ACCOUNTING as PPM_IDLE_STATE_ACCOUNTING ptr
 4660 
 4661 type PPM_IDLE_ACCOUNTING
 4662     StateCount as DWORD
 4663     TotalTransitions as DWORD
 4664     ResetCount as DWORD
 4665     StartTime as DWORD64
 4666     State(0 to 0) as PPM_IDLE_STATE_ACCOUNTING
 4667 end type
 4668 
 4669 type PPPM_IDLE_ACCOUNTING as PPM_IDLE_ACCOUNTING ptr
 4670 
 4671 type PPM_IDLE_STATE_BUCKET_EX
 4672     TotalTimeUs as DWORD64
 4673     MinTimeUs as DWORD
 4674     MaxTimeUs as DWORD
 4675     Count as DWORD
 4676 end type
 4677 
 4678 type PPPM_IDLE_STATE_BUCKET_EX as PPM_IDLE_STATE_BUCKET_EX ptr
 4679 
 4680 type PPM_IDLE_STATE_ACCOUNTING_EX
 4681     TotalTime as DWORD64
 4682     IdleTransitions as DWORD
 4683     FailedTransitions as DWORD
 4684     InvalidBucketIndex as DWORD
 4685     MinTimeUs as DWORD
 4686     MaxTimeUs as DWORD
 4687     CancelledTransitions as DWORD
 4688     IdleTimeBuckets(0 to 15) as PPM_IDLE_STATE_BUCKET_EX
 4689 end type
 4690 
 4691 type PPPM_IDLE_STATE_ACCOUNTING_EX as PPM_IDLE_STATE_ACCOUNTING_EX ptr
 4692 
 4693 type PPM_IDLE_ACCOUNTING_EX
 4694     StateCount as DWORD
 4695     TotalTransitions as DWORD
 4696     ResetCount as DWORD
 4697     AbortCount as DWORD
 4698     StartTime as DWORD64
 4699     State(0 to 0) as PPM_IDLE_STATE_ACCOUNTING_EX
 4700 end type
 4701 
 4702 type PPPM_IDLE_ACCOUNTING_EX as PPM_IDLE_ACCOUNTING_EX ptr
 4703 const ACPI_PPM_SOFTWARE_ALL = &hfc
 4704 const ACPI_PPM_SOFTWARE_ANY = &hfd
 4705 const ACPI_PPM_HARDWARE_ALL = &hfe
 4706 const MS_PPM_SOFTWARE_ALL = &h1
 4707 const PPM_FIRMWARE_ACPI1C2 = &h1
 4708 const PPM_FIRMWARE_ACPI1C3 = &h2
 4709 const PPM_FIRMWARE_ACPI1TSTATES = &h4
 4710 const PPM_FIRMWARE_CST = &h8
 4711 const PPM_FIRMWARE_CSD = &h10
 4712 const PPM_FIRMWARE_PCT = &h20
 4713 const PPM_FIRMWARE_PSS = &h40
 4714 const PPM_FIRMWARE_XPSS = &h80
 4715 const PPM_FIRMWARE_PPC = &h100
 4716 const PPM_FIRMWARE_PSD = &h200
 4717 const PPM_FIRMWARE_PTC = &h400
 4718 const PPM_FIRMWARE_TSS = &h800
 4719 const PPM_FIRMWARE_TPC = &h1000
 4720 const PPM_FIRMWARE_TSD = &h2000
 4721 const PPM_FIRMWARE_PCCH = &h4000
 4722 const PPM_FIRMWARE_PCCP = &h8000
 4723 const PPM_FIRMWARE_OSC = &h10000
 4724 const PPM_FIRMWARE_PDC = &h20000
 4725 const PPM_FIRMWARE_CPC = &h40000
 4726 const PPM_PERFORMANCE_IMPLEMENTATION_NONE = 0
 4727 const PPM_PERFORMANCE_IMPLEMENTATION_PSTATES = 1
 4728 const PPM_PERFORMANCE_IMPLEMENTATION_PCCV1 = 2
 4729 const PPM_PERFORMANCE_IMPLEMENTATION_CPPC = 3
 4730 const PPM_PERFORMANCE_IMPLEMENTATION_PEP = 4
 4731 const PPM_IDLE_IMPLEMENTATION_NONE = &h0
 4732 const PPM_IDLE_IMPLEMENTATION_CSTATES = &h1
 4733 const PPM_IDLE_IMPLEMENTATION_PEP = &h2
 4734 
 4735 type PPM_PERFSTATE_EVENT
 4736     State as DWORD
 4737     Status as DWORD
 4738     Latency as DWORD
 4739     Speed as DWORD
 4740     Processor as DWORD
 4741 end type
 4742 
 4743 type PPPM_PERFSTATE_EVENT as PPM_PERFSTATE_EVENT ptr
 4744 
 4745 type PPM_PERFSTATE_DOMAIN_EVENT
 4746     State as DWORD
 4747     Latency as DWORD
 4748     Speed as DWORD
 4749     Processors as DWORD64
 4750 end type
 4751 
 4752 type PPPM_PERFSTATE_DOMAIN_EVENT as PPM_PERFSTATE_DOMAIN_EVENT ptr
 4753 
 4754 type PPM_IDLESTATE_EVENT
 4755     NewState as DWORD
 4756     OldState as DWORD
 4757     Processors as DWORD64
 4758 end type
 4759 
 4760 type PPPM_IDLESTATE_EVENT as PPM_IDLESTATE_EVENT ptr
 4761 
 4762 type PPM_THERMALCHANGE_EVENT
 4763     ThermalConstraint as DWORD
 4764     Processors as DWORD64
 4765 end type
 4766 
 4767 type PPPM_THERMALCHANGE_EVENT as PPM_THERMALCHANGE_EVENT ptr
 4768 
 4769 type PPM_THERMAL_POLICY_EVENT
 4770     Mode as UBYTE
 4771     Processors as DWORD64
 4772 end type
 4773 
 4774 type PPPM_THERMAL_POLICY_EVENT as PPM_THERMAL_POLICY_EVENT ptr
 4775 extern PPM_PERFSTATE_CHANGE_GUID as const GUID
 4776 extern PPM_PERFSTATE_DOMAIN_CHANGE_GUID as const GUID
 4777 extern PPM_IDLESTATE_CHANGE_GUID as const GUID
 4778 extern PPM_PERFSTATES_DATA_GUID as const GUID
 4779 extern PPM_IDLESTATES_DATA_GUID as const GUID
 4780 extern PPM_IDLE_ACCOUNTING_GUID as const GUID
 4781 extern PPM_IDLE_ACCOUNTING_EX_GUID as const GUID
 4782 extern PPM_THERMALCONSTRAINT_GUID as const GUID
 4783 extern PPM_PERFMON_PERFSTATE_GUID as const GUID
 4784 extern PPM_THERMAL_POLICY_CHANGE_GUID as const GUID
 4785 
 4786 type POWER_ACTION_POLICY
 4787     Action as POWER_ACTION
 4788     Flags as DWORD
 4789     EventCode as DWORD
 4790 end type
 4791 
 4792 type PPOWER_ACTION_POLICY as POWER_ACTION_POLICY ptr
 4793 const POWER_ACTION_QUERY_ALLOWED = &h00000001
 4794 const POWER_ACTION_UI_ALLOWED = &h00000002
 4795 const POWER_ACTION_OVERRIDE_APPS = &h00000004
 4796 const POWER_ACTION_HIBERBOOT = &h00000008
 4797 const POWER_ACTION_PSEUDO_TRANSITION = &h08000000
 4798 const POWER_ACTION_LIGHTEST_FIRST = &h10000000
 4799 const POWER_ACTION_LOCK_CONSOLE = &h20000000
 4800 const POWER_ACTION_DISABLE_WAKES = &h40000000
 4801 const POWER_ACTION_CRITICAL = &h80000000
 4802 const POWER_LEVEL_USER_NOTIFY_TEXT = &h00000001
 4803 const POWER_LEVEL_USER_NOTIFY_SOUND = &h00000002
 4804 const POWER_LEVEL_USER_NOTIFY_EXEC = &h00000004
 4805 const POWER_USER_NOTIFY_BUTTON = &h00000008
 4806 const POWER_USER_NOTIFY_SHUTDOWN = &h00000010
 4807 const POWER_USER_NOTIFY_FORCED_SHUTDOWN = &h00000020
 4808 const POWER_FORCE_TRIGGER_RESET = &h80000000
 4809 const BATTERY_DISCHARGE_FLAGS_EVENTCODE_MASK = &h00000007
 4810 const BATTERY_DISCHARGE_FLAGS_ENABLE = &h80000000
 4811 const DISCHARGE_POLICY_CRITICAL = 0
 4812 const DISCHARGE_POLICY_LOW = 1
 4813 const NUM_DISCHARGE_POLICIES = 4
 4814 const PROCESSOR_IDLESTATE_POLICY_COUNT = &h3
 4815 
 4816 type PROCESSOR_IDLESTATE_INFO
 4817     TimeCheck as DWORD
 4818     DemotePercent as UBYTE
 4819     PromotePercent as UBYTE
 4820     Spare(0 to 1) as UBYTE
 4821 end type
 4822 
 4823 type PPROCESSOR_IDLESTATE_INFO as PROCESSOR_IDLESTATE_INFO ptr
 4824 
 4825 type SYSTEM_POWER_LEVEL
 4826     Enable as WINBOOLEAN
 4827     Spare(0 to 2) as UBYTE
 4828     BatteryLevel as DWORD
 4829     PowerPolicy as POWER_ACTION_POLICY
 4830     MinSystemState as SYSTEM_POWER_STATE
 4831 end type
 4832 
 4833 type PSYSTEM_POWER_LEVEL as SYSTEM_POWER_LEVEL ptr
 4834 
 4835 type _SYSTEM_POWER_POLICY
 4836     Revision as DWORD
 4837     PowerButton as POWER_ACTION_POLICY
 4838     SleepButton as POWER_ACTION_POLICY
 4839     LidClose as POWER_ACTION_POLICY
 4840     LidOpenWake as SYSTEM_POWER_STATE
 4841     Reserved as DWORD
 4842     Idle as POWER_ACTION_POLICY
 4843     IdleTimeout as DWORD
 4844     IdleSensitivity as UBYTE
 4845     DynamicThrottle as UBYTE
 4846     Spare2(0 to 1) as UBYTE
 4847     MinSleep as SYSTEM_POWER_STATE
 4848     MaxSleep as SYSTEM_POWER_STATE
 4849     ReducedLatencySleep as SYSTEM_POWER_STATE
 4850     WinLogonFlags as DWORD
 4851     Spare3 as DWORD
 4852     DozeS4Timeout as DWORD
 4853     BroadcastCapacityResolution as DWORD
 4854     DischargePolicy(0 to 3) as SYSTEM_POWER_LEVEL
 4855     VideoTimeout as DWORD
 4856     VideoDimDisplay as WINBOOLEAN
 4857     VideoReserved(0 to 2) as DWORD
 4858     SpindownTimeout as DWORD
 4859     OptimizeForPower as WINBOOLEAN
 4860     FanThrottleTolerance as UBYTE
 4861     ForcedThrottle as UBYTE
 4862     MinThrottle as UBYTE
 4863     OverThrottled as POWER_ACTION_POLICY
 4864 end type
 4865 
 4866 type SYSTEM_POWER_POLICY as _SYSTEM_POWER_POLICY
 4867 type PSYSTEM_POWER_POLICY as _SYSTEM_POWER_POLICY ptr
 4868 const PO_THROTTLE_NONE = 0
 4869 const PO_THROTTLE_CONSTANT = 1
 4870 const PO_THROTTLE_DEGRADE = 2
 4871 const PO_THROTTLE_ADAPTIVE = 3
 4872 const PO_THROTTLE_MAXIMUM = 4
 4873 
 4874 union PROCESSOR_IDLESTATE_POLICY_Flags
 4875     AsWORD as WORD
 4876 
 4877     type
 4878         AllowScaling : 1 as WORD
 4879         Disabled : 1 as WORD
 4880         Reserved : 14 as WORD
 4881     end type
 4882 end union
 4883 
 4884 type PROCESSOR_IDLESTATE_POLICY
 4885     Revision as WORD
 4886     Flags as PROCESSOR_IDLESTATE_POLICY_Flags
 4887     PolicyCount as DWORD
 4888     Policy(0 to 2) as PROCESSOR_IDLESTATE_INFO
 4889 end type
 4890 
 4891 type PPROCESSOR_IDLESTATE_POLICY as PROCESSOR_IDLESTATE_POLICY ptr
 4892 
 4893 type _PROCESSOR_POWER_POLICY_INFO
 4894     TimeCheck as DWORD
 4895     DemoteLimit as DWORD
 4896     PromoteLimit as DWORD
 4897     DemotePercent as UBYTE
 4898     PromotePercent as UBYTE
 4899     Spare(0 to 1) as UBYTE
 4900     AllowDemotion : 1 as DWORD
 4901     AllowPromotion : 1 as DWORD
 4902     Reserved : 30 as DWORD
 4903 end type
 4904 
 4905 type PROCESSOR_POWER_POLICY_INFO as _PROCESSOR_POWER_POLICY_INFO
 4906 type PPROCESSOR_POWER_POLICY_INFO as _PROCESSOR_POWER_POLICY_INFO ptr
 4907 
 4908 type _PROCESSOR_POWER_POLICY
 4909     Revision as DWORD
 4910     DynamicThrottle as UBYTE
 4911     Spare(0 to 2) as UBYTE
 4912     DisableCStates : 1 as DWORD
 4913     Reserved : 31 as DWORD
 4914     PolicyCount as DWORD
 4915     Policy(0 to 2) as PROCESSOR_POWER_POLICY_INFO
 4916 end type
 4917 
 4918 type PROCESSOR_POWER_POLICY as _PROCESSOR_POWER_POLICY
 4919 type PPROCESSOR_POWER_POLICY as _PROCESSOR_POWER_POLICY ptr
 4920 
 4921 union PROCESSOR_PERFSTATE_POLICY_Flags
 4922     AsBYTE as UBYTE
 4923 
 4924     type
 4925         NoDomainAccounting : 1 as UBYTE
 4926         IncreasePolicy : 2 as UBYTE
 4927         DecreasePolicy : 2 as UBYTE
 4928         Reserved : 3 as UBYTE
 4929     end type
 4930 end union
 4931 
 4932 type PROCESSOR_PERFSTATE_POLICY
 4933     Revision as DWORD
 4934     MaxThrottle as UBYTE
 4935     MinThrottle as UBYTE
 4936     BusyAdjThreshold as UBYTE
 4937 
 4938     union
 4939         Spare as UBYTE
 4940         Flags as PROCESSOR_PERFSTATE_POLICY_Flags
 4941     end union
 4942 
 4943     TimeCheck as DWORD
 4944     IncreaseTime as DWORD
 4945     DecreaseTime as DWORD
 4946     IncreasePercent as DWORD
 4947     DecreasePercent as DWORD
 4948 end type
 4949 
 4950 type PPROCESSOR_PERFSTATE_POLICY as PROCESSOR_PERFSTATE_POLICY ptr
 4951 
 4952 type _ADMINISTRATOR_POWER_POLICY
 4953     MinSleep as SYSTEM_POWER_STATE
 4954     MaxSleep as SYSTEM_POWER_STATE
 4955     MinVideoTimeout as DWORD
 4956     MaxVideoTimeout as DWORD
 4957     MinSpindownTimeout as DWORD
 4958     MaxSpindownTimeout as DWORD
 4959 end type
 4960 
 4961 type ADMINISTRATOR_POWER_POLICY as _ADMINISTRATOR_POWER_POLICY
 4962 type PADMINISTRATOR_POWER_POLICY as _ADMINISTRATOR_POWER_POLICY ptr
 4963 
 4964 type SYSTEM_POWER_CAPABILITIES
 4965     PowerButtonPresent as WINBOOLEAN
 4966     SleepButtonPresent as WINBOOLEAN
 4967     LidPresent as WINBOOLEAN
 4968     SystemS1 as WINBOOLEAN
 4969     SystemS2 as WINBOOLEAN
 4970     SystemS3 as WINBOOLEAN
 4971     SystemS4 as WINBOOLEAN
 4972     SystemS5 as WINBOOLEAN
 4973     HiberFilePresent as WINBOOLEAN
 4974     FullWake as WINBOOLEAN
 4975     VideoDimPresent as WINBOOLEAN
 4976     ApmPresent as WINBOOLEAN
 4977     UpsPresent as WINBOOLEAN
 4978     ThermalControl as WINBOOLEAN
 4979     ProcessorThrottle as WINBOOLEAN
 4980     ProcessorMinThrottle as UBYTE
 4981     ProcessorMaxThrottle as UBYTE
 4982     FastSystemS4 as WINBOOLEAN
 4983     spare2(0 to 2) as UBYTE
 4984     DiskSpinDown as WINBOOLEAN
 4985     spare3(0 to 7) as UBYTE
 4986     SystemBatteriesPresent as WINBOOLEAN
 4987     BatteriesAreShortTerm as WINBOOLEAN
 4988     BatteryScale(0 to 2) as BATTERY_REPORTING_SCALE
 4989     AcOnLineWake as SYSTEM_POWER_STATE
 4990     SoftLidWake as SYSTEM_POWER_STATE
 4991     RtcWake as SYSTEM_POWER_STATE
 4992     MinDeviceWakeState as SYSTEM_POWER_STATE
 4993     DefaultLowLatencyWake as SYSTEM_POWER_STATE
 4994 end type
 4995 
 4996 type PSYSTEM_POWER_CAPABILITIES as SYSTEM_POWER_CAPABILITIES ptr
 4997 
 4998 type SYSTEM_BATTERY_STATE
 4999     AcOnLine as WINBOOLEAN
 5000     BatteryPresent as WINBOOLEAN
 5001     Charging as WINBOOLEAN
 5002     Discharging as WINBOOLEAN
 5003     Spare1(0 to 3) as WINBOOLEAN
 5004     MaxCapacity as DWORD
 5005     RemainingCapacity as DWORD
 5006     Rate as DWORD
 5007     EstimatedTime as DWORD
 5008     DefaultAlert1 as DWORD
 5009     DefaultAlert2 as DWORD
 5010 end type
 5011 
 5012 type PSYSTEM_BATTERY_STATE as SYSTEM_BATTERY_STATE ptr
 5013 const IMAGE_DOS_SIGNATURE = &h5A4D
 5014 const IMAGE_OS2_SIGNATURE = &h454E
 5015 const IMAGE_OS2_SIGNATURE_LE = &h454C
 5016 const IMAGE_VXD_SIGNATURE = &h454C
 5017 const IMAGE_NT_SIGNATURE = &h00004550
 5018 
 5019 type _IMAGE_DOS_HEADER field = 2
 5020     e_magic as WORD
 5021     e_cblp as WORD
 5022     e_cp as WORD
 5023     e_crlc as WORD
 5024     e_cparhdr as WORD
 5025     e_minalloc as WORD
 5026     e_maxalloc as WORD
 5027     e_ss as WORD
 5028     e_sp as WORD
 5029     e_csum as WORD
 5030     e_ip as WORD
 5031     e_cs as WORD
 5032     e_lfarlc as WORD
 5033     e_ovno as WORD
 5034     e_res(0 to 3) as WORD
 5035     e_oemid as WORD
 5036     e_oeminfo as WORD
 5037     e_res2(0 to 9) as WORD
 5038     e_lfanew as LONG
 5039 end type
 5040 
 5041 type IMAGE_DOS_HEADER as _IMAGE_DOS_HEADER
 5042 type PIMAGE_DOS_HEADER as _IMAGE_DOS_HEADER ptr
 5043 
 5044 type _IMAGE_OS2_HEADER field = 2
 5045     ne_magic as WORD
 5046     ne_ver as CHAR
 5047     ne_rev as CHAR
 5048     ne_enttab as WORD
 5049     ne_cbenttab as WORD
 5050     ne_crc as LONG
 5051     ne_flags as WORD
 5052     ne_autodata as WORD
 5053     ne_heap as WORD
 5054     ne_stack as WORD
 5055     ne_csip as LONG
 5056     ne_sssp as LONG
 5057     ne_cseg as WORD
 5058     ne_cmod as WORD
 5059     ne_cbnrestab as WORD
 5060     ne_segtab as WORD
 5061     ne_rsrctab as WORD
 5062     ne_restab as WORD
 5063     ne_modtab as WORD
 5064     ne_imptab as WORD
 5065     ne_nrestab as LONG
 5066     ne_cmovent as WORD
 5067     ne_align as WORD
 5068     ne_cres as WORD
 5069     ne_exetyp as UBYTE
 5070     ne_flagsothers as UBYTE
 5071     ne_pretthunks as WORD
 5072     ne_psegrefbytes as WORD
 5073     ne_swaparea as WORD
 5074     ne_expver as WORD
 5075 end type
 5076 
 5077 type IMAGE_OS2_HEADER as _IMAGE_OS2_HEADER
 5078 type PIMAGE_OS2_HEADER as _IMAGE_OS2_HEADER ptr
 5079 
 5080 type _IMAGE_VXD_HEADER field = 2
 5081     e32_magic as WORD
 5082     e32_border as UBYTE
 5083     e32_worder as UBYTE
 5084     e32_level as DWORD
 5085     e32_cpu as WORD
 5086     e32_os as WORD
 5087     e32_ver as DWORD
 5088     e32_mflags as DWORD
 5089     e32_mpages as DWORD
 5090     e32_startobj as DWORD
 5091     e32_eip as DWORD
 5092     e32_stackobj as DWORD
 5093     e32_esp as DWORD
 5094     e32_pagesize as DWORD
 5095     e32_lastpagesize as DWORD
 5096     e32_fixupsize as DWORD
 5097     e32_fixupsum as DWORD
 5098     e32_ldrsize as DWORD
 5099     e32_ldrsum as DWORD
 5100     e32_objtab as DWORD
 5101     e32_objcnt as DWORD
 5102     e32_objmap as DWORD
 5103     e32_itermap as DWORD
 5104     e32_rsrctab as DWORD
 5105     e32_rsrccnt as DWORD
 5106     e32_restab as DWORD
 5107     e32_enttab as DWORD
 5108     e32_dirtab as DWORD
 5109     e32_dircnt as DWORD
 5110     e32_fpagetab as DWORD
 5111     e32_frectab as DWORD
 5112     e32_impmod as DWORD
 5113     e32_impmodcnt as DWORD
 5114     e32_impproc as DWORD
 5115     e32_pagesum as DWORD
 5116     e32_datapage as DWORD
 5117     e32_preload as DWORD
 5118     e32_nrestab as DWORD
 5119     e32_cbnrestab as DWORD
 5120     e32_nressum as DWORD
 5121     e32_autodata as DWORD
 5122     e32_debuginfo as DWORD
 5123     e32_debuglen as DWORD
 5124     e32_instpreload as DWORD
 5125     e32_instdemand as DWORD
 5126     e32_heapsize as DWORD
 5127     e32_res3(0 to 11) as UBYTE
 5128     e32_winresoff as DWORD
 5129     e32_winreslen as DWORD
 5130     e32_devid as WORD
 5131     e32_ddkver as WORD
 5132 end type
 5133 
 5134 type IMAGE_VXD_HEADER as _IMAGE_VXD_HEADER
 5135 type PIMAGE_VXD_HEADER as _IMAGE_VXD_HEADER ptr
 5136 
 5137 type _IMAGE_FILE_HEADER field = 4
 5138     Machine as WORD
 5139     NumberOfSections as WORD
 5140     TimeDateStamp as DWORD
 5141     PointerToSymbolTable as DWORD
 5142     NumberOfSymbols as DWORD
 5143     SizeOfOptionalHeader as WORD
 5144     Characteristics as WORD
 5145 end type
 5146 
 5147 type IMAGE_FILE_HEADER as _IMAGE_FILE_HEADER
 5148 type PIMAGE_FILE_HEADER as _IMAGE_FILE_HEADER ptr
 5149 const IMAGE_SIZEOF_FILE_HEADER = 20
 5150 const IMAGE_FILE_RELOCS_STRIPPED = &h0001
 5151 const IMAGE_FILE_EXECUTABLE_IMAGE = &h0002
 5152 const IMAGE_FILE_LINE_NUMS_STRIPPED = &h0004
 5153 const IMAGE_FILE_LOCAL_SYMS_STRIPPED = &h0008
 5154 const IMAGE_FILE_AGGRESIVE_WS_TRIM = &h0010
 5155 const IMAGE_FILE_LARGE_ADDRESS_AWARE = &h0020
 5156 const IMAGE_FILE_BYTES_REVERSED_LO = &h0080
 5157 const IMAGE_FILE_32BIT_MACHINE = &h0100
 5158 const IMAGE_FILE_DEBUG_STRIPPED = &h0200
 5159 const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = &h0400
 5160 const IMAGE_FILE_NET_RUN_FROM_SWAP = &h0800
 5161 const IMAGE_FILE_SYSTEM = &h1000
 5162 const IMAGE_FILE_DLL = &h2000
 5163 const IMAGE_FILE_UP_SYSTEM_ONLY = &h4000
 5164 const IMAGE_FILE_BYTES_REVERSED_HI = &h8000
 5165 const IMAGE_FILE_MACHINE_UNKNOWN = 0
 5166 const IMAGE_FILE_MACHINE_I386 = &h014c
 5167 const IMAGE_FILE_MACHINE_R3000 = &h0162
 5168 const IMAGE_FILE_MACHINE_R4000 = &h0166
 5169 const IMAGE_FILE_MACHINE_R10000 = &h0168
 5170 const IMAGE_FILE_MACHINE_WCEMIPSV2 = &h0169
 5171 const IMAGE_FILE_MACHINE_ALPHA = &h0184
 5172 const IMAGE_FILE_MACHINE_SH3 = &h01a2
 5173 const IMAGE_FILE_MACHINE_SH3DSP = &h01a3
 5174 const IMAGE_FILE_MACHINE_SH3E = &h01a4
 5175 const IMAGE_FILE_MACHINE_SH4 = &h01a6
 5176 const IMAGE_FILE_MACHINE_SH5 = &h01a8
 5177 const IMAGE_FILE_MACHINE_ARM = &h01c0
 5178 const IMAGE_FILE_MACHINE_ARMV7 = &h01c4
 5179 const IMAGE_FILE_MACHINE_ARMNT = &h01c4
 5180 const IMAGE_FILE_MACHINE_THUMB = &h01c2
 5181 const IMAGE_FILE_MACHINE_AM33 = &h01d3
 5182 const IMAGE_FILE_MACHINE_POWERPC = &h01F0
 5183 const IMAGE_FILE_MACHINE_POWERPCFP = &h01f1
 5184 const IMAGE_FILE_MACHINE_IA64 = &h0200
 5185 const IMAGE_FILE_MACHINE_MIPS16 = &h0266
 5186 const IMAGE_FILE_MACHINE_ALPHA64 = &h0284
 5187 const IMAGE_FILE_MACHINE_MIPSFPU = &h0366
 5188 const IMAGE_FILE_MACHINE_MIPSFPU16 = &h0466
 5189 const IMAGE_FILE_MACHINE_AXP64 = IMAGE_FILE_MACHINE_ALPHA64
 5190 const IMAGE_FILE_MACHINE_TRICORE = &h0520
 5191 const IMAGE_FILE_MACHINE_CEF = &h0CEF
 5192 const IMAGE_FILE_MACHINE_EBC = &h0EBC
 5193 const IMAGE_FILE_MACHINE_AMD64 = &h8664
 5194 const IMAGE_FILE_MACHINE_M32R = &h9041
 5195 const IMAGE_FILE_MACHINE_CEE = &hc0ee
 5196 
 5197 type _IMAGE_DATA_DIRECTORY field = 4
 5198     VirtualAddress as DWORD
 5199     Size as DWORD
 5200 end type
 5201 
 5202 type IMAGE_DATA_DIRECTORY as _IMAGE_DATA_DIRECTORY
 5203 type PIMAGE_DATA_DIRECTORY as _IMAGE_DATA_DIRECTORY ptr
 5204 const IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16
 5205 
 5206 type _IMAGE_OPTIONAL_HEADER field = 4
 5207     Magic as WORD
 5208     MajorLinkerVersion as UBYTE
 5209     MinorLinkerVersion as UBYTE
 5210     SizeOfCode as DWORD
 5211     SizeOfInitializedData as DWORD
 5212     SizeOfUninitializedData as DWORD
 5213     AddressOfEntryPoint as DWORD
 5214     BaseOfCode as DWORD
 5215     BaseOfData as DWORD
 5216     ImageBase as DWORD
 5217     SectionAlignment as DWORD
 5218     FileAlignment as DWORD
 5219     MajorOperatingSystemVersion as WORD
 5220     MinorOperatingSystemVersion as WORD
 5221     MajorImageVersion as WORD
 5222     MinorImageVersion as WORD
 5223     MajorSubsystemVersion as WORD
 5224     MinorSubsystemVersion as WORD
 5225     Win32VersionValue as DWORD
 5226     SizeOfImage as DWORD
 5227     SizeOfHeaders as DWORD
 5228     CheckSum as DWORD
 5229     Subsystem as WORD
 5230     DllCharacteristics as WORD
 5231     SizeOfStackReserve as DWORD
 5232     SizeOfStackCommit as DWORD
 5233     SizeOfHeapReserve as DWORD
 5234     SizeOfHeapCommit as DWORD
 5235     LoaderFlags as DWORD
 5236     NumberOfRvaAndSizes as DWORD
 5237     DataDirectory(0 to 15) as IMAGE_DATA_DIRECTORY
 5238 end type
 5239 
 5240 type IMAGE_OPTIONAL_HEADER32 as _IMAGE_OPTIONAL_HEADER
 5241 type PIMAGE_OPTIONAL_HEADER32 as _IMAGE_OPTIONAL_HEADER ptr
 5242 
 5243 type _IMAGE_ROM_OPTIONAL_HEADER field = 4
 5244     Magic as WORD
 5245     MajorLinkerVersion as UBYTE
 5246     MinorLinkerVersion as UBYTE
 5247     SizeOfCode as DWORD
 5248     SizeOfInitializedData as DWORD
 5249     SizeOfUninitializedData as DWORD
 5250     AddressOfEntryPoint as DWORD
 5251     BaseOfCode as DWORD
 5252     BaseOfData as DWORD
 5253     BaseOfBss as DWORD
 5254     GprMask as DWORD
 5255     CprMask(0 to 3) as DWORD
 5256     GpValue as DWORD
 5257 end type
 5258 
 5259 type IMAGE_ROM_OPTIONAL_HEADER as _IMAGE_ROM_OPTIONAL_HEADER
 5260 type PIMAGE_ROM_OPTIONAL_HEADER as _IMAGE_ROM_OPTIONAL_HEADER ptr
 5261 
 5262 type _IMAGE_OPTIONAL_HEADER64 field = 4
 5263     Magic as WORD
 5264     MajorLinkerVersion as UBYTE
 5265     MinorLinkerVersion as UBYTE
 5266     SizeOfCode as DWORD
 5267     SizeOfInitializedData as DWORD
 5268     SizeOfUninitializedData as DWORD
 5269     AddressOfEntryPoint as DWORD
 5270     BaseOfCode as DWORD
 5271     ImageBase as ULONGLONG
 5272     SectionAlignment as DWORD
 5273     FileAlignment as DWORD
 5274     MajorOperatingSystemVersion as WORD
 5275     MinorOperatingSystemVersion as WORD
 5276     MajorImageVersion as WORD
 5277     MinorImageVersion as WORD
 5278     MajorSubsystemVersion as WORD
 5279     MinorSubsystemVersion as WORD
 5280     Win32VersionValue as DWORD
 5281     SizeOfImage as DWORD
 5282     SizeOfHeaders as DWORD
 5283     CheckSum as DWORD
 5284     Subsystem as WORD
 5285     DllCharacteristics as WORD
 5286     SizeOfStackReserve as ULONGLONG
 5287     SizeOfStackCommit as ULONGLONG
 5288     SizeOfHeapReserve as ULONGLONG
 5289     SizeOfHeapCommit as ULONGLONG
 5290     LoaderFlags as DWORD
 5291     NumberOfRvaAndSizes as DWORD
 5292     DataDirectory(0 to 15) as IMAGE_DATA_DIRECTORY
 5293 end type
 5294 
 5295 type IMAGE_OPTIONAL_HEADER64 as _IMAGE_OPTIONAL_HEADER64
 5296 type PIMAGE_OPTIONAL_HEADER64 as _IMAGE_OPTIONAL_HEADER64 ptr
 5297 const IMAGE_SIZEOF_ROM_OPTIONAL_HEADER = 56
 5298 const IMAGE_SIZEOF_STD_OPTIONAL_HEADER = 28
 5299 const IMAGE_SIZEOF_NT_OPTIONAL32_HEADER = 224
 5300 const IMAGE_SIZEOF_NT_OPTIONAL64_HEADER = 240
 5301 const IMAGE_NT_OPTIONAL_HDR32_MAGIC = &h10b
 5302 const IMAGE_NT_OPTIONAL_HDR64_MAGIC = &h20b
 5303 const IMAGE_ROM_OPTIONAL_HDR_MAGIC = &h107
 5304 
 5305 #ifdef __FB_64BIT__
 5306     type IMAGE_OPTIONAL_HEADER as IMAGE_OPTIONAL_HEADER64
 5307     type PIMAGE_OPTIONAL_HEADER as PIMAGE_OPTIONAL_HEADER64
 5308     const IMAGE_SIZEOF_NT_OPTIONAL_HEADER = IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
 5309     const IMAGE_NT_OPTIONAL_HDR_MAGIC = IMAGE_NT_OPTIONAL_HDR64_MAGIC
 5310 #else
 5311     type IMAGE_OPTIONAL_HEADER as IMAGE_OPTIONAL_HEADER32
 5312     type PIMAGE_OPTIONAL_HEADER as PIMAGE_OPTIONAL_HEADER32
 5313     const IMAGE_SIZEOF_NT_OPTIONAL_HEADER = IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
 5314     const IMAGE_NT_OPTIONAL_HDR_MAGIC = IMAGE_NT_OPTIONAL_HDR32_MAGIC
 5315 #endif
 5316 
 5317 type _IMAGE_NT_HEADERS64 field = 4
 5318     Signature as DWORD
 5319     FileHeader as IMAGE_FILE_HEADER
 5320     OptionalHeader as IMAGE_OPTIONAL_HEADER64
 5321 end type
 5322 
 5323 type IMAGE_NT_HEADERS64 as _IMAGE_NT_HEADERS64
 5324 type PIMAGE_NT_HEADERS64 as _IMAGE_NT_HEADERS64 ptr
 5325 
 5326 type _IMAGE_NT_HEADERS field = 4
 5327     Signature as DWORD
 5328     FileHeader as IMAGE_FILE_HEADER
 5329     OptionalHeader as IMAGE_OPTIONAL_HEADER32
 5330 end type
 5331 
 5332 type IMAGE_NT_HEADERS32 as _IMAGE_NT_HEADERS
 5333 type PIMAGE_NT_HEADERS32 as _IMAGE_NT_HEADERS ptr
 5334 
 5335 type _IMAGE_ROM_HEADERS field = 4
 5336     FileHeader as IMAGE_FILE_HEADER
 5337     OptionalHeader as IMAGE_ROM_OPTIONAL_HEADER
 5338 end type
 5339 
 5340 type IMAGE_ROM_HEADERS as _IMAGE_ROM_HEADERS
 5341 type PIMAGE_ROM_HEADERS as _IMAGE_ROM_HEADERS ptr
 5342 
 5343 #ifdef __FB_64BIT__
 5344     type IMAGE_NT_HEADERS as IMAGE_NT_HEADERS64
 5345     type PIMAGE_NT_HEADERS as PIMAGE_NT_HEADERS64
 5346 #else
 5347     type IMAGE_NT_HEADERS as IMAGE_NT_HEADERS32
 5348     type PIMAGE_NT_HEADERS as PIMAGE_NT_HEADERS32
 5349 #endif
 5350 
 5351 #define IMAGE_FIRST_SECTION(ntheader) cast(PIMAGE_SECTION_HEADER, (cast(ULONG_PTR, ntheader) + FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader)) + cast(PIMAGE_NT_HEADERS, (ntheader))->FileHeader.SizeOfOptionalHeader)
 5352 const IMAGE_SUBSYSTEM_UNKNOWN = 0
 5353 const IMAGE_SUBSYSTEM_NATIVE = 1
 5354 const IMAGE_SUBSYSTEM_WINDOWS_GUI = 2
 5355 const IMAGE_SUBSYSTEM_WINDOWS_CUI = 3
 5356 const IMAGE_SUBSYSTEM_OS2_CUI = 5
 5357 const IMAGE_SUBSYSTEM_POSIX_CUI = 7
 5358 const IMAGE_SUBSYSTEM_NATIVE_WINDOWS = 8
 5359 const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9
 5360 const IMAGE_SUBSYSTEM_EFI_APPLICATION = 10
 5361 const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11
 5362 const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12
 5363 const IMAGE_SUBSYSTEM_EFI_ROM = 13
 5364 const IMAGE_SUBSYSTEM_XBOX = 14
 5365 const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16
 5366 const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = &h0040
 5367 const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY = &h0080
 5368 const IMAGE_DLLCHARACTERISTICS_NX_COMPAT = &h0100
 5369 const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = &h0200
 5370 const IMAGE_DLLCHARACTERISTICS_NO_SEH = &h0400
 5371 const IMAGE_DLLCHARACTERISTICS_NO_BIND = &h0800
 5372 const IMAGE_DLLCHARACTERISTICS_APPCONTAINER = &h1000
 5373 const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = &h2000
 5374 const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = &h8000
 5375 const IMAGE_DIRECTORY_ENTRY_EXPORT = 0
 5376 const IMAGE_DIRECTORY_ENTRY_IMPORT = 1
 5377 const IMAGE_DIRECTORY_ENTRY_RESOURCE = 2
 5378 const IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3
 5379 const IMAGE_DIRECTORY_ENTRY_SECURITY = 4
 5380 const IMAGE_DIRECTORY_ENTRY_BASERELOC = 5
 5381 const IMAGE_DIRECTORY_ENTRY_DEBUG = 6
 5382 const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE = 7
 5383 const IMAGE_DIRECTORY_ENTRY_GLOBALPTR = 8
 5384 const IMAGE_DIRECTORY_ENTRY_TLS = 9
 5385 const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG = 10
 5386 const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT = 11
 5387 const IMAGE_DIRECTORY_ENTRY_IAT = 12
 5388 const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT = 13
 5389 const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14
 5390 
 5391 type ANON_OBJECT_HEADER field = 4
 5392     Sig1 as WORD
 5393     Sig2 as WORD
 5394     Version as WORD
 5395     Machine as WORD
 5396     TimeDateStamp as DWORD
 5397     ClassID as CLSID
 5398     SizeOfData as DWORD
 5399 end type
 5400 
 5401 type ANON_OBJECT_HEADER_V2 field = 4
 5402     Sig1 as WORD
 5403     Sig2 as WORD
 5404     Version as WORD
 5405     Machine as WORD
 5406     TimeDateStamp as DWORD
 5407     ClassID as CLSID
 5408     SizeOfData as DWORD
 5409     Flags as DWORD
 5410     MetaDataSize as DWORD
 5411     MetaDataOffset as DWORD
 5412 end type
 5413 
 5414 type ANON_OBJECT_HEADER_BIGOBJ field = 4
 5415     Sig1 as WORD
 5416     Sig2 as WORD
 5417     Version as WORD
 5418     Machine as WORD
 5419     TimeDateStamp as DWORD
 5420     ClassID as CLSID
 5421     SizeOfData as DWORD
 5422     Flags as DWORD
 5423     MetaDataSize as DWORD
 5424     MetaDataOffset as DWORD
 5425     NumberOfSections as DWORD
 5426     PointerToSymbolTable as DWORD
 5427     NumberOfSymbols as DWORD
 5428 end type
 5429 
 5430 const IMAGE_SIZEOF_SHORT_NAME = 8
 5431 
 5432 union _IMAGE_SECTION_HEADER_Misc field = 4
 5433     PhysicalAddress as DWORD
 5434     VirtualSize as DWORD
 5435 end union
 5436 
 5437 type _IMAGE_SECTION_HEADER field = 4
 5438     Name(0 to 7) as UBYTE
 5439     Misc as _IMAGE_SECTION_HEADER_Misc
 5440     VirtualAddress as DWORD
 5441     SizeOfRawData as DWORD
 5442     PointerToRawData as DWORD
 5443     PointerToRelocations as DWORD
 5444     PointerToLinenumbers as DWORD
 5445     NumberOfRelocations as WORD
 5446     NumberOfLinenumbers as WORD
 5447     Characteristics as DWORD
 5448 end type
 5449 
 5450 type IMAGE_SECTION_HEADER as _IMAGE_SECTION_HEADER
 5451 type PIMAGE_SECTION_HEADER as _IMAGE_SECTION_HEADER ptr
 5452 const IMAGE_SIZEOF_SECTION_HEADER = 40
 5453 const IMAGE_SCN_TYPE_NO_PAD = &h00000008
 5454 const IMAGE_SCN_CNT_CODE = &h00000020
 5455 const IMAGE_SCN_CNT_INITIALIZED_DATA = &h00000040
 5456 const IMAGE_SCN_CNT_UNINITIALIZED_DATA = &h00000080
 5457 const IMAGE_SCN_LNK_OTHER = &h00000100
 5458 const IMAGE_SCN_LNK_INFO = &h00000200
 5459 const IMAGE_SCN_LNK_REMOVE = &h00000800
 5460 const IMAGE_SCN_LNK_COMDAT = &h00001000
 5461 const IMAGE_SCN_NO_DEFER_SPEC_EXC = &h00004000
 5462 const IMAGE_SCN_GPREL = &h00008000
 5463 const IMAGE_SCN_MEM_FARDATA = &h00008000
 5464 const IMAGE_SCN_MEM_PURGEABLE = &h00020000
 5465 const IMAGE_SCN_MEM_16BIT = &h00020000
 5466 const IMAGE_SCN_MEM_LOCKED = &h00040000
 5467 const IMAGE_SCN_MEM_PRELOAD = &h00080000
 5468 const IMAGE_SCN_ALIGN_1BYTES = &h00100000
 5469 const IMAGE_SCN_ALIGN_2BYTES = &h00200000
 5470 const IMAGE_SCN_ALIGN_4BYTES = &h00300000
 5471 const IMAGE_SCN_ALIGN_8BYTES = &h00400000
 5472 const IMAGE_SCN_ALIGN_16BYTES = &h00500000
 5473 const IMAGE_SCN_ALIGN_32BYTES = &h00600000
 5474 const IMAGE_SCN_ALIGN_64BYTES = &h00700000
 5475 const IMAGE_SCN_ALIGN_128BYTES = &h00800000
 5476 const IMAGE_SCN_ALIGN_256BYTES = &h00900000
 5477 const IMAGE_SCN_ALIGN_512BYTES = &h00A00000
 5478 const IMAGE_SCN_ALIGN_1024BYTES = &h00B00000
 5479 const IMAGE_SCN_ALIGN_2048BYTES = &h00C00000
 5480 const IMAGE_SCN_ALIGN_4096BYTES = &h00D00000
 5481 const IMAGE_SCN_ALIGN_8192BYTES = &h00E00000
 5482 const IMAGE_SCN_ALIGN_MASK = &h00F00000
 5483 const IMAGE_SCN_LNK_NRELOC_OVFL = &h01000000
 5484 const IMAGE_SCN_MEM_DISCARDABLE = &h02000000
 5485 const IMAGE_SCN_MEM_NOT_CACHED = &h04000000
 5486 const IMAGE_SCN_MEM_NOT_PAGED = &h08000000
 5487 const IMAGE_SCN_MEM_SHARED = &h10000000
 5488 const IMAGE_SCN_MEM_EXECUTE = &h20000000
 5489 const IMAGE_SCN_MEM_READ = &h40000000
 5490 const IMAGE_SCN_MEM_WRITE = &h80000000
 5491 const IMAGE_SCN_SCALE_INDEX = &h00000001
 5492 
 5493 type _IMAGE_SYMBOL_N_Name field = 2
 5494     Short as DWORD
 5495     Long as DWORD
 5496 end type
 5497 
 5498 union _IMAGE_SYMBOL_N field = 2
 5499     ShortName(0 to 7) as UBYTE
 5500     Name as _IMAGE_SYMBOL_N_Name
 5501     LongName(0 to 1) as DWORD
 5502 end union
 5503 
 5504 type _IMAGE_SYMBOL field = 2
 5505     N as _IMAGE_SYMBOL_N
 5506     Value as DWORD
 5507     SectionNumber as SHORT
 5508     as WORD Type
 5509     StorageClass as UBYTE
 5510     NumberOfAuxSymbols as UBYTE
 5511 end type
 5512 
 5513 type IMAGE_SYMBOL as _IMAGE_SYMBOL
 5514 type PIMAGE_SYMBOL as IMAGE_SYMBOL ptr
 5515 const IMAGE_SIZEOF_SYMBOL = 18
 5516 
 5517 type _IMAGE_SYMBOL_EX_N_Name field = 2
 5518     Short as DWORD
 5519     Long as DWORD
 5520 end type
 5521 
 5522 union _IMAGE_SYMBOL_EX_N field = 2
 5523     ShortName(0 to 7) as UBYTE
 5524     Name as _IMAGE_SYMBOL_EX_N_Name
 5525     LongName(0 to 1) as DWORD
 5526 end union
 5527 
 5528 type _IMAGE_SYMBOL_EX field = 2
 5529     N as _IMAGE_SYMBOL_EX_N
 5530     Value as DWORD
 5531     SectionNumber as LONG
 5532     as WORD Type
 5533     StorageClass as UBYTE
 5534     NumberOfAuxSymbols as UBYTE
 5535 end type
 5536 
 5537 type IMAGE_SYMBOL_EX as _IMAGE_SYMBOL_EX
 5538 type PIMAGE_SYMBOL_EX as _IMAGE_SYMBOL_EX ptr
 5539 #define IMAGE_SYM_UNDEFINED cast(SHORT, 0)
 5540 #define IMAGE_SYM_ABSOLUTE cast(SHORT, -1)
 5541 #define IMAGE_SYM_DEBUG cast(SHORT, -2)
 5542 const IMAGE_SYM_SECTION_MAX = &hFEFF
 5543 const IMAGE_SYM_SECTION_MAX_EX = MAXLONG
 5544 const IMAGE_SYM_TYPE_NULL = &h0000
 5545 const IMAGE_SYM_TYPE_VOID = &h0001
 5546 const IMAGE_SYM_TYPE_CHAR = &h0002
 5547 const IMAGE_SYM_TYPE_SHORT = &h0003
 5548 const IMAGE_SYM_TYPE_INT = &h0004
 5549 const IMAGE_SYM_TYPE_LONG = &h0005
 5550 const IMAGE_SYM_TYPE_FLOAT = &h0006
 5551 const IMAGE_SYM_TYPE_DOUBLE = &h0007
 5552 const IMAGE_SYM_TYPE_STRUCT = &h0008
 5553 const IMAGE_SYM_TYPE_UNION = &h0009
 5554 const IMAGE_SYM_TYPE_ENUM = &h000A
 5555 const IMAGE_SYM_TYPE_MOE = &h000B
 5556 const IMAGE_SYM_TYPE_BYTE = &h000C
 5557 const IMAGE_SYM_TYPE_WORD = &h000D
 5558 const IMAGE_SYM_TYPE_UINT = &h000E
 5559 const IMAGE_SYM_TYPE_DWORD = &h000F
 5560 const IMAGE_SYM_TYPE_PCODE = &h8000
 5561 const IMAGE_SYM_DTYPE_NULL = 0
 5562 const IMAGE_SYM_DTYPE_POINTER = 1
 5563 const IMAGE_SYM_DTYPE_FUNCTION = 2
 5564 const IMAGE_SYM_DTYPE_ARRAY = 3
 5565 const IMAGE_SYM_CLASS_END_OF_FUNCTION = cast(UBYTE, -1)
 5566 const IMAGE_SYM_CLASS_NULL = &h0000
 5567 const IMAGE_SYM_CLASS_AUTOMATIC = &h0001
 5568 const IMAGE_SYM_CLASS_EXTERNAL = &h0002
 5569 const IMAGE_SYM_CLASS_STATIC = &h0003
 5570 const IMAGE_SYM_CLASS_REGISTER = &h0004
 5571 const IMAGE_SYM_CLASS_EXTERNAL_DEF = &h0005
 5572 const IMAGE_SYM_CLASS_LABEL = &h0006
 5573 const IMAGE_SYM_CLASS_UNDEFINED_LABEL = &h0007
 5574 const IMAGE_SYM_CLASS_MEMBER_OF_STRUCT = &h0008
 5575 const IMAGE_SYM_CLASS_ARGUMENT = &h0009
 5576 const IMAGE_SYM_CLASS_STRUCT_TAG = &h000A
 5577 const IMAGE_SYM_CLASS_MEMBER_OF_UNION = &h000B
 5578 const IMAGE_SYM_CLASS_UNION_TAG = &h000C
 5579 const IMAGE_SYM_CLASS_TYPE_DEFINITION = &h000D
 5580 const IMAGE_SYM_CLASS_UNDEFINED_STATIC = &h000E
 5581 const IMAGE_SYM_CLASS_ENUM_TAG = &h000F
 5582 const IMAGE_SYM_CLASS_MEMBER_OF_ENUM = &h0010
 5583 const IMAGE_SYM_CLASS_REGISTER_PARAM = &h0011
 5584 const IMAGE_SYM_CLASS_BIT_FIELD = &h0012
 5585 const IMAGE_SYM_CLASS_FAR_EXTERNAL = &h0044
 5586 const IMAGE_SYM_CLASS_BLOCK = &h0064
 5587 const IMAGE_SYM_CLASS_FUNCTION = &h0065
 5588 const IMAGE_SYM_CLASS_END_OF_STRUCT = &h0066
 5589 const IMAGE_SYM_CLASS_FILE = &h0067
 5590 const IMAGE_SYM_CLASS_SECTION = &h0068
 5591 const IMAGE_SYM_CLASS_WEAK_EXTERNAL = &h0069
 5592 const IMAGE_SYM_CLASS_CLR_TOKEN = &h006B
 5593 const N_BTMASK = &h000F
 5594 const N_TMASK = &h0030
 5595 const N_TMASK1 = &h00C0
 5596 const N_TMASK2 = &h00F0
 5597 const N_BTSHFT = 4
 5598 const N_TSHIFT = 2
 5599 #define BTYPE(x) ((x) and N_BTMASK)
 5600 #define ISPTR(x) (((x) and N_TMASK) = (IMAGE_SYM_DTYPE_POINTER shl N_BTSHFT))
 5601 #define ISFCN(x) (((x) and N_TMASK) = (IMAGE_SYM_DTYPE_FUNCTION shl N_BTSHFT))
 5602 #define ISARY(x) (((x) and N_TMASK) = (IMAGE_SYM_DTYPE_ARRAY shl N_BTSHFT))
 5603 #define ISTAG(x) ((((x) = IMAGE_SYM_CLASS_STRUCT_TAG) orelse ((x) = IMAGE_SYM_CLASS_UNION_TAG)) orelse ((x) = IMAGE_SYM_CLASS_ENUM_TAG))
 5604 #define INCREF(x) (((((x) and (not N_BTMASK)) shl N_TSHIFT) or (IMAGE_SYM_DTYPE_POINTER shl N_BTSHFT)) or ((x) and N_BTMASK))
 5605 #define DECREF(x) ((((x) shr N_TSHIFT) and (not N_BTMASK)) or ((x) and N_BTMASK))
 5606 
 5607 type IMAGE_AUX_SYMBOL_TOKEN_DEF field = 2
 5608     bAuxType as UBYTE
 5609     bReserved as UBYTE
 5610     SymbolTableIndex as DWORD
 5611     rgbReserved(0 to 11) as UBYTE
 5612 end type
 5613 
 5614 type PIMAGE_AUX_SYMBOL_TOKEN_DEF as IMAGE_AUX_SYMBOL_TOKEN_DEF ptr
 5615 
 5616 type _IMAGE_AUX_SYMBOL_Sym_Misc_LnSz field = 2
 5617     Linenumber as WORD
 5618     Size as WORD
 5619 end type
 5620 
 5621 union _IMAGE_AUX_SYMBOL_Sym_Misc field = 2
 5622     LnSz as _IMAGE_AUX_SYMBOL_Sym_Misc_LnSz
 5623     TotalSize as DWORD
 5624 end union
 5625 
 5626 type _IMAGE_AUX_SYMBOL_Sym_FcnAry_Function field = 2
 5627     PointerToLinenumber as DWORD
 5628     PointerToNextFunction as DWORD
 5629 end type
 5630 
 5631 type _IMAGE_AUX_SYMBOL_Sym_FcnAry_Array field = 2
 5632     Dimension(0 to 3) as WORD
 5633 end type
 5634 
 5635 union _IMAGE_AUX_SYMBOL_Sym_FcnAry field = 2
 5636     Function as _IMAGE_AUX_SYMBOL_Sym_FcnAry_Function
 5637     Array as _IMAGE_AUX_SYMBOL_Sym_FcnAry_Array
 5638 end union
 5639 
 5640 type _IMAGE_AUX_SYMBOL_Sym field = 2
 5641     TagIndex as DWORD
 5642     Misc as _IMAGE_AUX_SYMBOL_Sym_Misc
 5643     FcnAry as _IMAGE_AUX_SYMBOL_Sym_FcnAry
 5644     TvIndex as WORD
 5645 end type
 5646 
 5647 type _IMAGE_AUX_SYMBOL_File field = 2
 5648     Name(0 to 17) as UBYTE
 5649 end type
 5650 
 5651 type _IMAGE_AUX_SYMBOL_Section field = 2
 5652     Length as DWORD
 5653     NumberOfRelocations as WORD
 5654     NumberOfLinenumbers as WORD
 5655     CheckSum as DWORD
 5656     Number as SHORT
 5657     Selection as UBYTE
 5658 end type
 5659 
 5660 type _IMAGE_AUX_SYMBOL_CRC field = 2
 5661     crc as DWORD
 5662     rgbReserved(0 to 13) as UBYTE
 5663 end type
 5664 
 5665 union _IMAGE_AUX_SYMBOL field = 2
 5666     Sym as _IMAGE_AUX_SYMBOL_Sym
 5667     File as _IMAGE_AUX_SYMBOL_File
 5668     Section as _IMAGE_AUX_SYMBOL_Section
 5669     TokenDef as IMAGE_AUX_SYMBOL_TOKEN_DEF
 5670     CRC as _IMAGE_AUX_SYMBOL_CRC
 5671 end union
 5672 
 5673 type IMAGE_AUX_SYMBOL as _IMAGE_AUX_SYMBOL
 5674 type PIMAGE_AUX_SYMBOL as _IMAGE_AUX_SYMBOL ptr
 5675 
 5676 type _IMAGE_AUX_SYMBOL_EX_Sym field = 2
 5677     WeakDefaultSymIndex as DWORD
 5678     WeakSearchType as DWORD
 5679     rgbReserved(0 to 11) as UBYTE
 5680 end type
 5681 
 5682 type _IMAGE_AUX_SYMBOL_EX_File field = 2
 5683     Name(0 to sizeof(IMAGE_SYMBOL_EX) - 1) as UBYTE
 5684 end type
 5685 
 5686 type _IMAGE_AUX_SYMBOL_EX_Section field = 2
 5687     Length as DWORD
 5688     NumberOfRelocations as WORD
 5689     NumberOfLinenumbers as WORD
 5690     CheckSum as DWORD
 5691     Number as SHORT
 5692     Selection as UBYTE
 5693     bReserved as UBYTE
 5694     HighNumber as SHORT
 5695     rgbReserved(0 to 1) as UBYTE
 5696 end type
 5697 
 5698 type _IMAGE_AUX_SYMBOL_EX_CRC field = 2
 5699     crc as DWORD
 5700     rgbReserved(0 to 15) as UBYTE
 5701 end type
 5702 
 5703 union _IMAGE_AUX_SYMBOL_EX field = 2
 5704     Sym as _IMAGE_AUX_SYMBOL_EX_Sym
 5705     File as _IMAGE_AUX_SYMBOL_EX_File
 5706     Section as _IMAGE_AUX_SYMBOL_EX_Section
 5707 
 5708     type field = 2
 5709         TokenDef as IMAGE_AUX_SYMBOL_TOKEN_DEF
 5710         rgbReserved(0 to 1) as UBYTE
 5711     end type
 5712 
 5713     CRC as _IMAGE_AUX_SYMBOL_EX_CRC
 5714 end union
 5715 
 5716 type IMAGE_AUX_SYMBOL_EX as _IMAGE_AUX_SYMBOL_EX
 5717 type PIMAGE_AUX_SYMBOL_EX as _IMAGE_AUX_SYMBOL_EX ptr
 5718 const IMAGE_SIZEOF_AUX_SYMBOL = 18
 5719 
 5720 type IMAGE_AUX_SYMBOL_TYPE as long
 5721 enum
 5722     IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1
 5723 end enum
 5724 
 5725 const IMAGE_COMDAT_SELECT_NODUPLICATES = 1
 5726 const IMAGE_COMDAT_SELECT_ANY = 2
 5727 const IMAGE_COMDAT_SELECT_SAME_SIZE = 3
 5728 const IMAGE_COMDAT_SELECT_EXACT_MATCH = 4
 5729 const IMAGE_COMDAT_SELECT_ASSOCIATIVE = 5
 5730 const IMAGE_COMDAT_SELECT_LARGEST = 6
 5731 const IMAGE_COMDAT_SELECT_NEWEST = 7
 5732 const IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1
 5733 const IMAGE_WEAK_EXTERN_SEARCH_LIBRARY = 2
 5734 const IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
 5735 
 5736 type _IMAGE_RELOCATION field = 2
 5737     union field = 2
 5738         VirtualAddress as DWORD
 5739         RelocCount as DWORD
 5740     end union
 5741 
 5742     SymbolTableIndex as DWORD
 5743     as WORD Type
 5744 end type
 5745 
 5746 type IMAGE_RELOCATION as _IMAGE_RELOCATION
 5747 type PIMAGE_RELOCATION as IMAGE_RELOCATION ptr
 5748 const IMAGE_SIZEOF_RELOCATION = 10
 5749 const IMAGE_REL_I386_ABSOLUTE = &h0000
 5750 const IMAGE_REL_I386_DIR16 = &h0001
 5751 const IMAGE_REL_I386_REL16 = &h0002
 5752 const IMAGE_REL_I386_DIR32 = &h0006
 5753 const IMAGE_REL_I386_DIR32NB = &h0007
 5754 const IMAGE_REL_I386_SEG12 = &h0009
 5755 const IMAGE_REL_I386_SECTION = &h000A
 5756 const IMAGE_REL_I386_SECREL = &h000B
 5757 const IMAGE_REL_I386_TOKEN = &h000C
 5758 const IMAGE_REL_I386_SECREL7 = &h000D
 5759 const IMAGE_REL_I386_REL32 = &h0014
 5760 const IMAGE_REL_MIPS_ABSOLUTE = &h0000
 5761 const IMAGE_REL_MIPS_REFHALF = &h0001
 5762 const IMAGE_REL_MIPS_REFWORD = &h0002
 5763 const IMAGE_REL_MIPS_JMPADDR = &h0003
 5764 const IMAGE_REL_MIPS_REFHI = &h0004
 5765 const IMAGE_REL_MIPS_REFLO = &h0005
 5766 const IMAGE_REL_MIPS_GPREL = &h0006
 5767 const IMAGE_REL_MIPS_LITERAL = &h0007
 5768 const IMAGE_REL_MIPS_SECTION = &h000A
 5769 const IMAGE_REL_MIPS_SECREL = &h000B
 5770 const IMAGE_REL_MIPS_SECRELLO = &h000C
 5771 const IMAGE_REL_MIPS_SECRELHI = &h000D
 5772 const IMAGE_REL_MIPS_TOKEN = &h000E
 5773 const IMAGE_REL_MIPS_JMPADDR16 = &h0010
 5774 const IMAGE_REL_MIPS_REFWORDNB = &h0022
 5775 const IMAGE_REL_MIPS_PAIR = &h0025
 5776 const IMAGE_REL_ALPHA_ABSOLUTE = &h0000
 5777 const IMAGE_REL_ALPHA_REFLONG = &h0001
 5778 const IMAGE_REL_ALPHA_REFQUAD = &h0002
 5779 const IMAGE_REL_ALPHA_GPREL32 = &h0003
 5780 const IMAGE_REL_ALPHA_LITERAL = &h0004
 5781 const IMAGE_REL_ALPHA_LITUSE = &h0005
 5782 const IMAGE_REL_ALPHA_GPDISP = &h0006
 5783 const IMAGE_REL_ALPHA_BRADDR = &h0007
 5784 const IMAGE_REL_ALPHA_HINT = &h0008
 5785 const IMAGE_REL_ALPHA_INLINE_REFLONG = &h0009
 5786 const IMAGE_REL_ALPHA_REFHI = &h000A
 5787 const IMAGE_REL_ALPHA_REFLO = &h000B
 5788 const IMAGE_REL_ALPHA_PAIR = &h000C
 5789 const IMAGE_REL_ALPHA_MATCH = &h000D
 5790 const IMAGE_REL_ALPHA_SECTION = &h000E
 5791 const IMAGE_REL_ALPHA_SECREL = &h000F
 5792 const IMAGE_REL_ALPHA_REFLONGNB = &h0010
 5793 const IMAGE_REL_ALPHA_SECRELLO = &h0011
 5794 const IMAGE_REL_ALPHA_SECRELHI = &h0012
 5795 const IMAGE_REL_ALPHA_REFQ3 = &h0013
 5796 const IMAGE_REL_ALPHA_REFQ2 = &h0014
 5797 const IMAGE_REL_ALPHA_REFQ1 = &h0015
 5798 const IMAGE_REL_ALPHA_GPRELLO = &h0016
 5799 const IMAGE_REL_ALPHA_GPRELHI = &h0017
 5800 const IMAGE_REL_PPC_ABSOLUTE = &h0000
 5801 const IMAGE_REL_PPC_ADDR64 = &h0001
 5802 const IMAGE_REL_PPC_ADDR32 = &h0002
 5803 const IMAGE_REL_PPC_ADDR24 = &h0003
 5804 const IMAGE_REL_PPC_ADDR16 = &h0004
 5805 const IMAGE_REL_PPC_ADDR14 = &h0005
 5806 const IMAGE_REL_PPC_REL24 = &h0006
 5807 const IMAGE_REL_PPC_REL14 = &h0007
 5808 const IMAGE_REL_PPC_TOCREL16 = &h0008
 5809 const IMAGE_REL_PPC_TOCREL14 = &h0009
 5810 const IMAGE_REL_PPC_ADDR32NB = &h000A
 5811 const IMAGE_REL_PPC_SECREL = &h000B
 5812 const IMAGE_REL_PPC_SECTION = &h000C
 5813 const IMAGE_REL_PPC_IFGLUE = &h000D
 5814 const IMAGE_REL_PPC_IMGLUE = &h000E
 5815 const IMAGE_REL_PPC_SECREL16 = &h000F
 5816 const IMAGE_REL_PPC_REFHI = &h0010
 5817 const IMAGE_REL_PPC_REFLO = &h0011
 5818 const IMAGE_REL_PPC_PAIR = &h0012
 5819 const IMAGE_REL_PPC_SECRELLO = &h0013
 5820 const IMAGE_REL_PPC_SECRELHI = &h0014
 5821 const IMAGE_REL_PPC_GPREL = &h0015
 5822 const IMAGE_REL_PPC_TOKEN = &h0016
 5823 const IMAGE_REL_PPC_TYPEMASK = &h00FF
 5824 const IMAGE_REL_PPC_NEG = &h0100
 5825 const IMAGE_REL_PPC_BRTAKEN = &h0200
 5826 const IMAGE_REL_PPC_BRNTAKEN = &h0400
 5827 const IMAGE_REL_PPC_TOCDEFN = &h0800
 5828 const IMAGE_REL_SH3_ABSOLUTE = &h0000
 5829 const IMAGE_REL_SH3_DIRECT16 = &h0001
 5830 const IMAGE_REL_SH3_DIRECT32 = &h0002
 5831 const IMAGE_REL_SH3_DIRECT8 = &h0003
 5832 const IMAGE_REL_SH3_DIRECT8_WORD = &h0004
 5833 const IMAGE_REL_SH3_DIRECT8_LONG = &h0005
 5834 const IMAGE_REL_SH3_DIRECT4 = &h0006
 5835 const IMAGE_REL_SH3_DIRECT4_WORD = &h0007
 5836 const IMAGE_REL_SH3_DIRECT4_LONG = &h0008
 5837 const IMAGE_REL_SH3_PCREL8_WORD = &h0009
 5838 const IMAGE_REL_SH3_PCREL8_LONG = &h000A
 5839 const IMAGE_REL_SH3_PCREL12_WORD = &h000B
 5840 const IMAGE_REL_SH3_STARTOF_SECTION = &h000C
 5841 const IMAGE_REL_SH3_SIZEOF_SECTION = &h000D
 5842 const IMAGE_REL_SH3_SECTION = &h000E
 5843 const IMAGE_REL_SH3_SECREL = &h000F
 5844 const IMAGE_REL_SH3_DIRECT32_NB = &h0010
 5845 const IMAGE_REL_SH3_GPREL4_LONG = &h0011
 5846 const IMAGE_REL_SH3_TOKEN = &h0012
 5847 const IMAGE_REL_SHM_PCRELPT = &h0013
 5848 const IMAGE_REL_SHM_REFLO = &h0014
 5849 const IMAGE_REL_SHM_REFHALF = &h0015
 5850 const IMAGE_REL_SHM_RELLO = &h0016
 5851 const IMAGE_REL_SHM_RELHALF = &h0017
 5852 const IMAGE_REL_SHM_PAIR = &h0018
 5853 const IMAGE_REL_SH_NOMODE = &h8000
 5854 const IMAGE_REL_ARM_ABSOLUTE = &h0000
 5855 const IMAGE_REL_ARM_ADDR32 = &h0001
 5856 const IMAGE_REL_ARM_ADDR32NB = &h0002
 5857 const IMAGE_REL_ARM_BRANCH24 = &h0003
 5858 const IMAGE_REL_ARM_BRANCH11 = &h0004
 5859 const IMAGE_REL_ARM_TOKEN = &h0005
 5860 const IMAGE_REL_ARM_GPREL12 = &h0006
 5861 const IMAGE_REL_ARM_GPREL7 = &h0007
 5862 const IMAGE_REL_ARM_BLX24 = &h0008
 5863 const IMAGE_REL_ARM_BLX11 = &h0009
 5864 const IMAGE_REL_ARM_SECTION = &h000E
 5865 const IMAGE_REL_ARM_SECREL = &h000F
 5866 const IMAGE_REL_ARM_MOV32A = &h0010
 5867 const IMAGE_REL_ARM_MOV32 = &h0010
 5868 const IMAGE_REL_ARM_MOV32T = &h0011
 5869 const IMAGE_REL_THUMB_MOV32 = &h0011
 5870 const IMAGE_REL_ARM_BRANCH20T = &h0012
 5871 const IMAGE_REL_THUMB_BRANCH20 = &h0012
 5872 const IMAGE_REL_ARM_BRANCH24T = &h0014
 5873 const IMAGE_REL_THUMB_BRANCH24 = &h0014
 5874 const IMAGE_REL_ARM_BLX23T = &h0015
 5875 const IMAGE_REL_THUMB_BLX23 = &h0015
 5876 const IMAGE_REL_AM_ABSOLUTE = &h0000
 5877 const IMAGE_REL_AM_ADDR32 = &h0001
 5878 const IMAGE_REL_AM_ADDR32NB = &h0002
 5879 const IMAGE_REL_AM_CALL32 = &h0003
 5880 const IMAGE_REL_AM_FUNCINFO = &h0004
 5881 const IMAGE_REL_AM_REL32_1 = &h0005
 5882 const IMAGE_REL_AM_REL32_2 = &h0006
 5883 const IMAGE_REL_AM_SECREL = &h0007
 5884 const IMAGE_REL_AM_SECTION = &h0008
 5885 const IMAGE_REL_AM_TOKEN = &h0009
 5886 const IMAGE_REL_AMD64_ABSOLUTE = &h0000
 5887 const IMAGE_REL_AMD64_ADDR64 = &h0001
 5888 const IMAGE_REL_AMD64_ADDR32 = &h0002
 5889 const IMAGE_REL_AMD64_ADDR32NB = &h0003
 5890 const IMAGE_REL_AMD64_REL32 = &h0004
 5891 const IMAGE_REL_AMD64_REL32_1 = &h0005
 5892 const IMAGE_REL_AMD64_REL32_2 = &h0006
 5893 const IMAGE_REL_AMD64_REL32_3 = &h0007
 5894 const IMAGE_REL_AMD64_REL32_4 = &h0008
 5895 const IMAGE_REL_AMD64_REL32_5 = &h0009
 5896 const IMAGE_REL_AMD64_SECTION = &h000A
 5897 const IMAGE_REL_AMD64_SECREL = &h000B
 5898 const IMAGE_REL_AMD64_SECREL7 = &h000C
 5899 const IMAGE_REL_AMD64_TOKEN = &h000D
 5900 const IMAGE_REL_AMD64_SREL32 = &h000E
 5901 const IMAGE_REL_AMD64_PAIR = &h000F
 5902 const IMAGE_REL_AMD64_SSPAN32 = &h0010
 5903 const IMAGE_REL_IA64_ABSOLUTE = &h0000
 5904 const IMAGE_REL_IA64_IMM14 = &h0001
 5905 const IMAGE_REL_IA64_IMM22 = &h0002
 5906 const IMAGE_REL_IA64_IMM64 = &h0003
 5907 const IMAGE_REL_IA64_DIR32 = &h0004
 5908 const IMAGE_REL_IA64_DIR64 = &h0005
 5909 const IMAGE_REL_IA64_PCREL21B = &h0006
 5910 const IMAGE_REL_IA64_PCREL21M = &h0007
 5911 const IMAGE_REL_IA64_PCREL21F = &h0008
 5912 const IMAGE_REL_IA64_GPREL22 = &h0009
 5913 const IMAGE_REL_IA64_LTOFF22 = &h000A
 5914 const IMAGE_REL_IA64_SECTION = &h000B
 5915 const IMAGE_REL_IA64_SECREL22 = &h000C
 5916 const IMAGE_REL_IA64_SECREL64I = &h000D
 5917 const IMAGE_REL_IA64_SECREL32 = &h000E
 5918 const IMAGE_REL_IA64_DIR32NB = &h0010
 5919 const IMAGE_REL_IA64_SREL14 = &h0011
 5920 const IMAGE_REL_IA64_SREL22 = &h0012
 5921 const IMAGE_REL_IA64_SREL32 = &h0013
 5922 const IMAGE_REL_IA64_UREL32 = &h0014
 5923 const IMAGE_REL_IA64_PCREL60X = &h0015
 5924 const IMAGE_REL_IA64_PCREL60B = &h0016
 5925 const IMAGE_REL_IA64_PCREL60F = &h0017
 5926 const IMAGE_REL_IA64_PCREL60I = &h0018
 5927 const IMAGE_REL_IA64_PCREL60M = &h0019
 5928 const IMAGE_REL_IA64_IMMGPREL64 = &h001A
 5929 const IMAGE_REL_IA64_TOKEN = &h001B
 5930 const IMAGE_REL_IA64_GPREL32 = &h001C
 5931 const IMAGE_REL_IA64_ADDEND = &h001F
 5932 const IMAGE_REL_CEF_ABSOLUTE = &h0000
 5933 const IMAGE_REL_CEF_ADDR32 = &h0001
 5934 const IMAGE_REL_CEF_ADDR64 = &h0002
 5935 const IMAGE_REL_CEF_ADDR32NB = &h0003
 5936 const IMAGE_REL_CEF_SECTION = &h0004
 5937 const IMAGE_REL_CEF_SECREL = &h0005
 5938 const IMAGE_REL_CEF_TOKEN = &h0006
 5939 const IMAGE_REL_CEE_ABSOLUTE = &h0000
 5940 const IMAGE_REL_CEE_ADDR32 = &h0001
 5941 const IMAGE_REL_CEE_ADDR64 = &h0002
 5942 const IMAGE_REL_CEE_ADDR32NB = &h0003
 5943 const IMAGE_REL_CEE_SECTION = &h0004
 5944 const IMAGE_REL_CEE_SECREL = &h0005
 5945 const IMAGE_REL_CEE_TOKEN = &h0006
 5946 const IMAGE_REL_M32R_ABSOLUTE = &h0000
 5947 const IMAGE_REL_M32R_ADDR32 = &h0001
 5948 const IMAGE_REL_M32R_ADDR32NB = &h0002
 5949 const IMAGE_REL_M32R_ADDR24 = &h0003
 5950 const IMAGE_REL_M32R_GPREL16 = &h0004
 5951 const IMAGE_REL_M32R_PCREL24 = &h0005
 5952 const IMAGE_REL_M32R_PCREL16 = &h0006
 5953 const IMAGE_REL_M32R_PCREL8 = &h0007
 5954 const IMAGE_REL_M32R_REFHALF = &h0008
 5955 const IMAGE_REL_M32R_REFHI = &h0009
 5956 const IMAGE_REL_M32R_REFLO = &h000A
 5957 const IMAGE_REL_M32R_PAIR = &h000B
 5958 const IMAGE_REL_M32R_SECTION = &h000C
 5959 const IMAGE_REL_M32R_SECREL32 = &h000D
 5960 const IMAGE_REL_M32R_TOKEN = &h000E
 5961 const IMAGE_REL_EBC_ABSOLUTE = &h0000
 5962 const IMAGE_REL_EBC_ADDR32NB = &h0001
 5963 const IMAGE_REL_EBC_REL32 = &h0002
 5964 const IMAGE_REL_EBC_SECTION = &h0003
 5965 const IMAGE_REL_EBC_SECREL = &h0004
 5966 #define EXT_IMM64(Value, Address, Size, InstPos, ValPos) scope : Value or= cast(ULONGLONG, ((*(Address)) shr InstPos) and ((cast(ULONGLONG, 1) shl Size) - 1)) shl ValPos : end scope
 5967 #define INS_IMM64(Value, Address, Size, InstPos, ValPos) scope : (*cast(PDWORD, Address)) = ((*cast(PDWORD, Address)) and (not (((1 shl Size) - 1) shl InstPos))) or (cast(DWORD, (cast(ULONGLONG, Value) shr ValPos) and ((cast(ULONGLONG, 1) shl Size) - 1)) shl InstPos) : end scope
 5968 const EMARCH_ENC_I17_IMM7B_INST_WORD_X = 3
 5969 const EMARCH_ENC_I17_IMM7B_SIZE_X = 7
 5970 const EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X = 4
 5971 const EMARCH_ENC_I17_IMM7B_VAL_POS_X = 0
 5972 const EMARCH_ENC_I17_IMM9D_INST_WORD_X = 3
 5973 const EMARCH_ENC_I17_IMM9D_SIZE_X = 9
 5974 const EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X = 18
 5975 const EMARCH_ENC_I17_IMM9D_VAL_POS_X = 7
 5976 const EMARCH_ENC_I17_IMM5C_INST_WORD_X = 3
 5977 const EMARCH_ENC_I17_IMM5C_SIZE_X = 5
 5978 const EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X = 13
 5979 const EMARCH_ENC_I17_IMM5C_VAL_POS_X = 16
 5980 const EMARCH_ENC_I17_IC_INST_WORD_X = 3
 5981 const EMARCH_ENC_I17_IC_SIZE_X = 1
 5982 const EMARCH_ENC_I17_IC_INST_WORD_POS_X = 12
 5983 const EMARCH_ENC_I17_IC_VAL_POS_X = 21
 5984 const EMARCH_ENC_I17_IMM41a_INST_WORD_X = 1
 5985 const EMARCH_ENC_I17_IMM41a_SIZE_X = 10
 5986 const EMARCH_ENC_I17_IMM41a_INST_WORD_POS_X = 14
 5987 const EMARCH_ENC_I17_IMM41a_VAL_POS_X = 22
 5988 const EMARCH_ENC_I17_IMM41b_INST_WORD_X = 1
 5989 const EMARCH_ENC_I17_IMM41b_SIZE_X = 8
 5990 const EMARCH_ENC_I17_IMM41b_INST_WORD_POS_X = 24
 5991 const EMARCH_ENC_I17_IMM41b_VAL_POS_X = 32
 5992 const EMARCH_ENC_I17_IMM41c_INST_WORD_X = 2
 5993 const EMARCH_ENC_I17_IMM41c_SIZE_X = 23
 5994 const EMARCH_ENC_I17_IMM41c_INST_WORD_POS_X = 0
 5995 const EMARCH_ENC_I17_IMM41c_VAL_POS_X = 40
 5996 const EMARCH_ENC_I17_SIGN_INST_WORD_X = 3
 5997 const EMARCH_ENC_I17_SIGN_SIZE_X = 1
 5998 const EMARCH_ENC_I17_SIGN_INST_WORD_POS_X = 27
 5999 const EMARCH_ENC_I17_SIGN_VAL_POS_X = 63
 6000 const X3_OPCODE_INST_WORD_X = 3
 6001 const X3_OPCODE_SIZE_X = 4
 6002 const X3_OPCODE_INST_WORD_POS_X = 28
 6003 const X3_OPCODE_SIGN_VAL_POS_X = 0
 6004 const X3_I_INST_WORD_X = 3
 6005 const X3_I_SIZE_X = 1
 6006 const X3_I_INST_WORD_POS_X = 27
 6007 const X3_I_SIGN_VAL_POS_X = 59
 6008 const X3_D_WH_INST_WORD_X = 3
 6009 const X3_D_WH_SIZE_X = 3
 6010 const X3_D_WH_INST_WORD_POS_X = 24
 6011 const X3_D_WH_SIGN_VAL_POS_X = 0
 6012 const X3_IMM20_INST_WORD_X = 3
 6013 const X3_IMM20_SIZE_X = 20
 6014 const X3_IMM20_INST_WORD_POS_X = 4
 6015 const X3_IMM20_SIGN_VAL_POS_X = 0
 6016 const X3_IMM39_1_INST_WORD_X = 2
 6017 const X3_IMM39_1_SIZE_X = 23
 6018 const X3_IMM39_1_INST_WORD_POS_X = 0
 6019 const X3_IMM39_1_SIGN_VAL_POS_X = 36
 6020 const X3_IMM39_2_INST_WORD_X = 1
 6021 const X3_IMM39_2_SIZE_X = 16
 6022 const X3_IMM39_2_INST_WORD_POS_X = 16
 6023 const X3_IMM39_2_SIGN_VAL_POS_X = 20
 6024 const X3_P_INST_WORD_X = 3
 6025 const X3_P_SIZE_X = 4
 6026 const X3_P_INST_WORD_POS_X = 0
 6027 const X3_P_SIGN_VAL_POS_X = 0
 6028 const X3_TMPLT_INST_WORD_X = 0
 6029 const X3_TMPLT_SIZE_X = 4
 6030 const X3_TMPLT_INST_WORD_POS_X = 0
 6031 const X3_TMPLT_SIGN_VAL_POS_X = 0
 6032 const X3_BTYPE_QP_INST_WORD_X = 2
 6033 const X3_BTYPE_QP_SIZE_X = 9
 6034 const X3_BTYPE_QP_INST_WORD_POS_X = 23
 6035 const X3_BTYPE_QP_INST_VAL_POS_X = 0
 6036 const X3_EMPTY_INST_WORD_X = 1
 6037 const X3_EMPTY_SIZE_X = 2
 6038 const X3_EMPTY_INST_WORD_POS_X = 14
 6039 const X3_EMPTY_INST_VAL_POS_X = 0
 6040 
 6041 union _IMAGE_LINENUMBER_Type field = 2
 6042     SymbolTableIndex as DWORD
 6043     VirtualAddress as DWORD
 6044 end union
 6045 
 6046 type _IMAGE_LINENUMBER field = 2
 6047     as _IMAGE_LINENUMBER_Type Type
 6048     Linenumber as WORD
 6049 end type
 6050 
 6051 type IMAGE_LINENUMBER as _IMAGE_LINENUMBER
 6052 type PIMAGE_LINENUMBER as IMAGE_LINENUMBER ptr
 6053 const IMAGE_SIZEOF_LINENUMBER = 6
 6054 
 6055 type _IMAGE_BASE_RELOCATION field = 4
 6056     VirtualAddress as DWORD
 6057     SizeOfBlock as DWORD
 6058 end type
 6059 
 6060 type IMAGE_BASE_RELOCATION as _IMAGE_BASE_RELOCATION
 6061 type PIMAGE_BASE_RELOCATION as IMAGE_BASE_RELOCATION ptr
 6062 const IMAGE_SIZEOF_BASE_RELOCATION = 8
 6063 const IMAGE_REL_BASED_ABSOLUTE = 0
 6064 const IMAGE_REL_BASED_HIGH = 1
 6065 const IMAGE_REL_BASED_LOW = 2
 6066 const IMAGE_REL_BASED_HIGHLOW = 3
 6067 const IMAGE_REL_BASED_HIGHADJ = 4
 6068 const IMAGE_REL_BASED_MIPS_JMPADDR = 5
 6069 const IMAGE_REL_BASED_ARM_MOV32 = 5
 6070 const IMAGE_REL_BASED_THUMB_MOV32 = 7
 6071 const IMAGE_REL_BASED_MIPS_JMPADDR16 = 9
 6072 const IMAGE_REL_BASED_IA64_IMM64 = 9
 6073 const IMAGE_REL_BASED_DIR64 = 10
 6074 const IMAGE_ARCHIVE_START_SIZE = 8
 6075 #define IMAGE_ARCHIVE_START !"!<arch>\n"
 6076 #define IMAGE_ARCHIVE_END !"`\n"
 6077 #define IMAGE_ARCHIVE_PAD !"\n"
 6078 #define IMAGE_ARCHIVE_LINKER_MEMBER "/               "
 6079 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "//              "
 6080 
 6081 type _IMAGE_ARCHIVE_MEMBER_HEADER field = 4
 6082     Name(0 to 15) as UBYTE
 6083     Date(0 to 11) as UBYTE
 6084     UserID(0 to 5) as UBYTE
 6085     GroupID(0 to 5) as UBYTE
 6086     Mode(0 to 7) as UBYTE
 6087     Size(0 to 9) as UBYTE
 6088     EndHeader(0 to 1) as UBYTE
 6089 end type
 6090 
 6091 type IMAGE_ARCHIVE_MEMBER_HEADER as _IMAGE_ARCHIVE_MEMBER_HEADER
 6092 type PIMAGE_ARCHIVE_MEMBER_HEADER as _IMAGE_ARCHIVE_MEMBER_HEADER ptr
 6093 const IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR = 60
 6094 
 6095 type _IMAGE_EXPORT_DIRECTORY field = 4
 6096     Characteristics as DWORD
 6097     TimeDateStamp as DWORD
 6098     MajorVersion as WORD
 6099     MinorVersion as WORD
 6100     Name as DWORD
 6101     Base as DWORD
 6102     NumberOfFunctions as DWORD
 6103     NumberOfNames as DWORD
 6104     AddressOfFunctions as DWORD
 6105     AddressOfNames as DWORD
 6106     AddressOfNameOrdinals as DWORD
 6107 end type
 6108 
 6109 type IMAGE_EXPORT_DIRECTORY as _IMAGE_EXPORT_DIRECTORY
 6110 type PIMAGE_EXPORT_DIRECTORY as _IMAGE_EXPORT_DIRECTORY ptr
 6111 
 6112 type _IMAGE_IMPORT_BY_NAME field = 4
 6113     Hint as WORD
 6114     Name(0 to 0) as UBYTE
 6115 end type
 6116 
 6117 type IMAGE_IMPORT_BY_NAME as _IMAGE_IMPORT_BY_NAME
 6118 type PIMAGE_IMPORT_BY_NAME as _IMAGE_IMPORT_BY_NAME ptr
 6119 
 6120 union _IMAGE_THUNK_DATA64_u1
 6121     ForwarderString as ULONGLONG
 6122     Function as ULONGLONG
 6123     Ordinal as ULONGLONG
 6124     AddressOfData as ULONGLONG
 6125 end union
 6126 
 6127 type _IMAGE_THUNK_DATA64
 6128     u1 as _IMAGE_THUNK_DATA64_u1
 6129 end type
 6130 
 6131 type IMAGE_THUNK_DATA64 as _IMAGE_THUNK_DATA64
 6132 type PIMAGE_THUNK_DATA64 as IMAGE_THUNK_DATA64 ptr
 6133 
 6134 union _IMAGE_THUNK_DATA32_u1 field = 4
 6135     ForwarderString as DWORD
 6136     Function as DWORD
 6137     Ordinal as DWORD
 6138     AddressOfData as DWORD
 6139 end union
 6140 
 6141 type _IMAGE_THUNK_DATA32 field = 4
 6142     u1 as _IMAGE_THUNK_DATA32_u1
 6143 end type
 6144 
 6145 type IMAGE_THUNK_DATA32 as _IMAGE_THUNK_DATA32
 6146 type PIMAGE_THUNK_DATA32 as IMAGE_THUNK_DATA32 ptr
 6147 const IMAGE_ORDINAL_FLAG64 = &h8000000000000000ull
 6148 const IMAGE_ORDINAL_FLAG32 = &h80000000
 6149 #define IMAGE_ORDINAL64(Ordinal) (Ordinal and &hffffull)
 6150 #define IMAGE_ORDINAL32(Ordinal) (Ordinal and &hffff)
 6151 #define IMAGE_SNAP_BY_ORDINAL64(Ordinal) ((Ordinal and IMAGE_ORDINAL_FLAG64) <> 0)
 6152 #define IMAGE_SNAP_BY_ORDINAL32(Ordinal) ((Ordinal and IMAGE_ORDINAL_FLAG32) <> 0)
 6153 type PIMAGE_TLS_CALLBACK as sub(byval DllHandle as PVOID, byval Reason as DWORD, byval Reserved as PVOID)
 6154 
 6155 type _IMAGE_TLS_DIRECTORY64 field = 4
 6156     StartAddressOfRawData as ULONGLONG
 6157     EndAddressOfRawData as ULONGLONG
 6158     AddressOfIndex as ULONGLONG
 6159     AddressOfCallBacks as ULONGLONG
 6160     SizeOfZeroFill as DWORD
 6161     Characteristics as DWORD
 6162 end type
 6163 
 6164 type IMAGE_TLS_DIRECTORY64 as _IMAGE_TLS_DIRECTORY64
 6165 type PIMAGE_TLS_DIRECTORY64 as IMAGE_TLS_DIRECTORY64 ptr
 6166 
 6167 type _IMAGE_TLS_DIRECTORY32 field = 4
 6168     StartAddressOfRawData as DWORD
 6169     EndAddressOfRawData as DWORD
 6170     AddressOfIndex as DWORD
 6171     AddressOfCallBacks as DWORD
 6172     SizeOfZeroFill as DWORD
 6173     Characteristics as DWORD
 6174 end type
 6175 
 6176 type IMAGE_TLS_DIRECTORY32 as _IMAGE_TLS_DIRECTORY32
 6177 type PIMAGE_TLS_DIRECTORY32 as IMAGE_TLS_DIRECTORY32 ptr
 6178 
 6179 #ifdef __FB_64BIT__
 6180     const IMAGE_ORDINAL_FLAG = IMAGE_ORDINAL_FLAG64
 6181     #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
 6182     type IMAGE_THUNK_DATA as IMAGE_THUNK_DATA64
 6183     type PIMAGE_THUNK_DATA as PIMAGE_THUNK_DATA64
 6184     #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
 6185     type IMAGE_TLS_DIRECTORY as IMAGE_TLS_DIRECTORY64
 6186     type PIMAGE_TLS_DIRECTORY as PIMAGE_TLS_DIRECTORY64
 6187 #else
 6188     const IMAGE_ORDINAL_FLAG = IMAGE_ORDINAL_FLAG32
 6189     #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
 6190     type IMAGE_THUNK_DATA as IMAGE_THUNK_DATA32
 6191     type PIMAGE_THUNK_DATA as PIMAGE_THUNK_DATA32
 6192     #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
 6193     type IMAGE_TLS_DIRECTORY as IMAGE_TLS_DIRECTORY32
 6194     type PIMAGE_TLS_DIRECTORY as PIMAGE_TLS_DIRECTORY32
 6195 #endif
 6196 
 6197 type _IMAGE_IMPORT_DESCRIPTOR field = 4
 6198     union field = 4
 6199         Characteristics as DWORD
 6200         OriginalFirstThunk as DWORD
 6201     end union
 6202 
 6203     TimeDateStamp as DWORD
 6204     ForwarderChain as DWORD
 6205     Name as DWORD
 6206     FirstThunk as DWORD
 6207 end type
 6208 
 6209 type IMAGE_IMPORT_DESCRIPTOR as _IMAGE_IMPORT_DESCRIPTOR
 6210 type PIMAGE_IMPORT_DESCRIPTOR as IMAGE_IMPORT_DESCRIPTOR ptr
 6211 
 6212 type _IMAGE_BOUND_IMPORT_DESCRIPTOR field = 4
 6213     TimeDateStamp as DWORD
 6214     OffsetModuleName as WORD
 6215     NumberOfModuleForwarderRefs as WORD
 6216 end type
 6217 
 6218 type IMAGE_BOUND_IMPORT_DESCRIPTOR as _IMAGE_BOUND_IMPORT_DESCRIPTOR
 6219 type PIMAGE_BOUND_IMPORT_DESCRIPTOR as _IMAGE_BOUND_IMPORT_DESCRIPTOR ptr
 6220 
 6221 type _IMAGE_BOUND_FORWARDER_REF field = 4
 6222     TimeDateStamp as DWORD
 6223     OffsetModuleName as WORD
 6224     Reserved as WORD
 6225 end type
 6226 
 6227 type IMAGE_BOUND_FORWARDER_REF as _IMAGE_BOUND_FORWARDER_REF
 6228 type PIMAGE_BOUND_FORWARDER_REF as _IMAGE_BOUND_FORWARDER_REF ptr
 6229 
 6230 union _IMAGE_DELAYLOAD_DESCRIPTOR_Attributes field = 4
 6231     AllAttributes as DWORD
 6232 
 6233     type field = 4
 6234         RvaBased : 1 as DWORD
 6235         ReservedAttributes : 31 as DWORD
 6236     end type
 6237 end union
 6238 
 6239 type _IMAGE_DELAYLOAD_DESCRIPTOR field = 4
 6240     Attributes as _IMAGE_DELAYLOAD_DESCRIPTOR_Attributes
 6241     DllNameRVA as DWORD
 6242     ModuleHandleRVA as DWORD
 6243     ImportAddressTableRVA as DWORD
 6244     ImportNameTableRVA as DWORD
 6245     BoundImportAddressTableRVA as DWORD
 6246     UnloadInformationTableRVA as DWORD
 6247     TimeDateStamp as DWORD
 6248 end type
 6249 
 6250 type IMAGE_DELAYLOAD_DESCRIPTOR as _IMAGE_DELAYLOAD_DESCRIPTOR
 6251 type PIMAGE_DELAYLOAD_DESCRIPTOR as _IMAGE_DELAYLOAD_DESCRIPTOR ptr
 6252 type PCIMAGE_DELAYLOAD_DESCRIPTOR as const IMAGE_DELAYLOAD_DESCRIPTOR ptr
 6253 
 6254 type _IMAGE_RESOURCE_DIRECTORY field = 4
 6255     Characteristics as DWORD
 6256     TimeDateStamp as DWORD
 6257     MajorVersion as WORD
 6258     MinorVersion as WORD
 6259     NumberOfNamedEntries as WORD
 6260     NumberOfIdEntries as WORD
 6261 end type
 6262 
 6263 type IMAGE_RESOURCE_DIRECTORY as _IMAGE_RESOURCE_DIRECTORY
 6264 type PIMAGE_RESOURCE_DIRECTORY as _IMAGE_RESOURCE_DIRECTORY ptr
 6265 const IMAGE_RESOURCE_NAME_IS_STRING = &h80000000
 6266 const IMAGE_RESOURCE_DATA_IS_DIRECTORY = &h80000000
 6267 
 6268 type _IMAGE_RESOURCE_DIRECTORY_ENTRY field = 4
 6269     union field = 4
 6270         type field = 4
 6271             NameOffset : 31 as DWORD
 6272             NameIsString : 1 as DWORD
 6273         end type
 6274 
 6275         Name as DWORD
 6276         Id as WORD
 6277     end union
 6278 
 6279     union field = 4
 6280         OffsetToData as DWORD
 6281 
 6282         type field = 4
 6283             OffsetToDirectory : 31 as DWORD
 6284             DataIsDirectory : 1 as DWORD
 6285         end type
 6286     end union
 6287 end type
 6288 
 6289 type IMAGE_RESOURCE_DIRECTORY_ENTRY as _IMAGE_RESOURCE_DIRECTORY_ENTRY
 6290 type PIMAGE_RESOURCE_DIRECTORY_ENTRY as _IMAGE_RESOURCE_DIRECTORY_ENTRY ptr
 6291 
 6292 type _IMAGE_RESOURCE_DIRECTORY_STRING field = 4
 6293     Length as WORD
 6294     NameString as zstring * 1
 6295 end type
 6296 
 6297 type IMAGE_RESOURCE_DIRECTORY_STRING as _IMAGE_RESOURCE_DIRECTORY_STRING
 6298 type PIMAGE_RESOURCE_DIRECTORY_STRING as _IMAGE_RESOURCE_DIRECTORY_STRING ptr
 6299 
 6300 type _IMAGE_RESOURCE_DIR_STRING_U field = 4
 6301     Length as WORD
 6302     NameString as wstring * 1
 6303 end type
 6304 
 6305 type IMAGE_RESOURCE_DIR_STRING_U as _IMAGE_RESOURCE_DIR_STRING_U
 6306 type PIMAGE_RESOURCE_DIR_STRING_U as _IMAGE_RESOURCE_DIR_STRING_U ptr
 6307 
 6308 type _IMAGE_RESOURCE_DATA_ENTRY field = 4
 6309     OffsetToData as DWORD
 6310     Size as DWORD
 6311     CodePage as DWORD
 6312     Reserved as DWORD
 6313 end type
 6314 
 6315 type IMAGE_RESOURCE_DATA_ENTRY as _IMAGE_RESOURCE_DATA_ENTRY
 6316 type PIMAGE_RESOURCE_DATA_ENTRY as _IMAGE_RESOURCE_DATA_ENTRY ptr
 6317 
 6318 type IMAGE_LOAD_CONFIG_DIRECTORY32 field = 4
 6319     Size as DWORD
 6320     TimeDateStamp as DWORD
 6321     MajorVersion as WORD
 6322     MinorVersion as WORD
 6323     GlobalFlagsClear as DWORD
 6324     GlobalFlagsSet as DWORD
 6325     CriticalSectionDefaultTimeout as DWORD
 6326     DeCommitFreeBlockThreshold as DWORD
 6327     DeCommitTotalFreeThreshold as DWORD
 6328     LockPrefixTable as DWORD
 6329     MaximumAllocationSize as DWORD
 6330     VirtualMemoryThreshold as DWORD
 6331     ProcessHeapFlags as DWORD
 6332     ProcessAffinityMask as DWORD
 6333     CSDVersion as WORD
 6334     Reserved1 as WORD
 6335     EditList as DWORD
 6336     SecurityCookie as DWORD
 6337     SEHandlerTable as DWORD
 6338     SEHandlerCount as DWORD
 6339 end type
 6340 
 6341 type PIMAGE_LOAD_CONFIG_DIRECTORY32 as IMAGE_LOAD_CONFIG_DIRECTORY32 ptr
 6342 
 6343 type IMAGE_LOAD_CONFIG_DIRECTORY64 field = 4
 6344     Size as DWORD
 6345     TimeDateStamp as DWORD
 6346     MajorVersion as WORD
 6347     MinorVersion as WORD
 6348     GlobalFlagsClear as DWORD
 6349     GlobalFlagsSet as DWORD
 6350     CriticalSectionDefaultTimeout as DWORD
 6351     DeCommitFreeBlockThreshold as ULONGLONG
 6352     DeCommitTotalFreeThreshold as ULONGLONG
 6353     LockPrefixTable as ULONGLONG
 6354     MaximumAllocationSize as ULONGLONG
 6355     VirtualMemoryThreshold as ULONGLONG
 6356     ProcessAffinityMask as ULONGLONG
 6357     ProcessHeapFlags as DWORD
 6358     CSDVersion as WORD
 6359     Reserved1 as WORD
 6360     EditList as ULONGLONG
 6361     SecurityCookie as ULONGLONG
 6362     SEHandlerTable as ULONGLONG
 6363     SEHandlerCount as ULONGLONG
 6364 end type
 6365 
 6366 type PIMAGE_LOAD_CONFIG_DIRECTORY64 as IMAGE_LOAD_CONFIG_DIRECTORY64 ptr
 6367 
 6368 #ifdef __FB_64BIT__
 6369     type IMAGE_LOAD_CONFIG_DIRECTORY as IMAGE_LOAD_CONFIG_DIRECTORY64
 6370     type PIMAGE_LOAD_CONFIG_DIRECTORY as PIMAGE_LOAD_CONFIG_DIRECTORY64
 6371 #else
 6372     type IMAGE_LOAD_CONFIG_DIRECTORY as IMAGE_LOAD_CONFIG_DIRECTORY32
 6373     type PIMAGE_LOAD_CONFIG_DIRECTORY as PIMAGE_LOAD_CONFIG_DIRECTORY32
 6374 #endif
 6375 
 6376 type _IMAGE_CE_RUNTIME_FUNCTION_ENTRY field = 4
 6377     FuncStart as DWORD
 6378     PrologLen : 8 as DWORD
 6379     FuncLen : 22 as DWORD
 6380     ThirtyTwoBit : 1 as DWORD
 6381     ExceptionFlag : 1 as DWORD
 6382 end type
 6383 
 6384 type IMAGE_CE_RUNTIME_FUNCTION_ENTRY as _IMAGE_CE_RUNTIME_FUNCTION_ENTRY
 6385 type PIMAGE_CE_RUNTIME_FUNCTION_ENTRY as _IMAGE_CE_RUNTIME_FUNCTION_ENTRY ptr
 6386 
 6387 type _IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY field = 4
 6388     BeginAddress as ULONGLONG
 6389     EndAddress as ULONGLONG
 6390     ExceptionHandler as ULONGLONG
 6391     HandlerData as ULONGLONG
 6392     PrologEndAddress as ULONGLONG
 6393 end type
 6394 
 6395 type IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY as _IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY
 6396 type PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY as _IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY ptr
 6397 
 6398 type _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY field = 4
 6399     BeginAddress as DWORD
 6400     EndAddress as DWORD
 6401     ExceptionHandler as DWORD
 6402     HandlerData as DWORD
 6403     PrologEndAddress as DWORD
 6404 end type
 6405 
 6406 type IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY as _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY
 6407 type PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY as _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY ptr
 6408 
 6409 type _IMAGE_ARM_RUNTIME_FUNCTION_ENTRY field = 4
 6410     BeginAddress as DWORD
 6411 
 6412     union field = 4
 6413         UnwindData as DWORD
 6414 
 6415         type field = 4
 6416             Flag : 2 as DWORD
 6417             FunctionLength : 11 as DWORD
 6418             Ret : 2 as DWORD
 6419             H : 1 as DWORD
 6420             Reg : 3 as DWORD
 6421             R : 1 as DWORD
 6422             L : 1 as DWORD
 6423             C : 1 as DWORD
 6424             StackAdjust : 10 as DWORD
 6425         end type
 6426     end union
 6427 end type
 6428 
 6429 type IMAGE_ARM_RUNTIME_FUNCTION_ENTRY as _IMAGE_ARM_RUNTIME_FUNCTION_ENTRY
 6430 type PIMAGE_ARM_RUNTIME_FUNCTION_ENTRY as _IMAGE_ARM_RUNTIME_FUNCTION_ENTRY ptr
 6431 
 6432 type _IMAGE_RUNTIME_FUNCTION_ENTRY field = 4
 6433     BeginAddress as DWORD
 6434     EndAddress as DWORD
 6435 
 6436     union field = 4
 6437         UnwindInfoAddress as DWORD
 6438         UnwindData as DWORD
 6439     end union
 6440 end type
 6441 
 6442 type _PIMAGE_RUNTIME_FUNCTION_ENTRY as _IMAGE_RUNTIME_FUNCTION_ENTRY ptr
 6443 type IMAGE_IA64_RUNTIME_FUNCTION_ENTRY as _IMAGE_RUNTIME_FUNCTION_ENTRY
 6444 type PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY as _PIMAGE_RUNTIME_FUNCTION_ENTRY
 6445 type IMAGE_RUNTIME_FUNCTION_ENTRY as _IMAGE_RUNTIME_FUNCTION_ENTRY
 6446 type PIMAGE_RUNTIME_FUNCTION_ENTRY as _PIMAGE_RUNTIME_FUNCTION_ENTRY
 6447 
 6448 type _IMAGE_DEBUG_DIRECTORY field = 4
 6449     Characteristics as DWORD
 6450     TimeDateStamp as DWORD
 6451     MajorVersion as WORD
 6452     MinorVersion as WORD
 6453     as DWORD Type
 6454     SizeOfData as DWORD
 6455     AddressOfRawData as DWORD
 6456     PointerToRawData as DWORD
 6457 end type
 6458 
 6459 type IMAGE_DEBUG_DIRECTORY as _IMAGE_DEBUG_DIRECTORY
 6460 type PIMAGE_DEBUG_DIRECTORY as _IMAGE_DEBUG_DIRECTORY ptr
 6461 const IMAGE_DEBUG_TYPE_UNKNOWN = 0
 6462 const IMAGE_DEBUG_TYPE_COFF = 1
 6463 const IMAGE_DEBUG_TYPE_CODEVIEW = 2
 6464 const IMAGE_DEBUG_TYPE_FPO = 3
 6465 const IMAGE_DEBUG_TYPE_MISC = 4
 6466 const IMAGE_DEBUG_TYPE_EXCEPTION = 5
 6467 const IMAGE_DEBUG_TYPE_FIXUP = 6
 6468 const IMAGE_DEBUG_TYPE_OMAP_TO_SRC = 7
 6469 const IMAGE_DEBUG_TYPE_OMAP_FROM_SRC = 8
 6470 const IMAGE_DEBUG_TYPE_BORLAND = 9
 6471 const IMAGE_DEBUG_TYPE_RESERVED10 = 10
 6472 const IMAGE_DEBUG_TYPE_CLSID = 11
 6473 
 6474 type _IMAGE_COFF_SYMBOLS_HEADER field = 4
 6475     NumberOfSymbols as DWORD
 6476     LvaToFirstSymbol as DWORD
 6477     NumberOfLinenumbers as DWORD
 6478     LvaToFirstLinenumber as DWORD
 6479     RvaToFirstByteOfCode as DWORD
 6480     RvaToLastByteOfCode as DWORD
 6481     RvaToFirstByteOfData as DWORD
 6482     RvaToLastByteOfData as DWORD
 6483 end type
 6484 
 6485 type IMAGE_COFF_SYMBOLS_HEADER as _IMAGE_COFF_SYMBOLS_HEADER
 6486 type PIMAGE_COFF_SYMBOLS_HEADER as _IMAGE_COFF_SYMBOLS_HEADER ptr
 6487 const FRAME_FPO = 0
 6488 const FRAME_TRAP = 1
 6489 const FRAME_TSS = 2
 6490 const FRAME_NONFPO = 3
 6491 
 6492 type _FPO_DATA field = 4
 6493     ulOffStart as DWORD
 6494     cbProcSize as DWORD
 6495     cdwLocals as DWORD
 6496     cdwParams as WORD
 6497     cbProlog : 8 as WORD
 6498     cbRegs : 3 as WORD
 6499     fHasSEH : 1 as WORD
 6500     fUseBP : 1 as WORD
 6501     reserved : 1 as WORD
 6502     cbFrame : 2 as WORD
 6503 end type
 6504 
 6505 type FPO_DATA as _FPO_DATA
 6506 type PFPO_DATA as _FPO_DATA ptr
 6507 const SIZEOF_RFPO_DATA = 16
 6508 const IMAGE_DEBUG_MISC_EXENAME = 1
 6509 
 6510 type _IMAGE_DEBUG_MISC field = 4
 6511     DataType as DWORD
 6512     Length as DWORD
 6513     Unicode_ as WINBOOLEAN
 6514     Reserved(0 to 2) as UBYTE
 6515     Data(0 to 0) as UBYTE
 6516 end type
 6517 
 6518 type IMAGE_DEBUG_MISC as _IMAGE_DEBUG_MISC
 6519 type PIMAGE_DEBUG_MISC as _IMAGE_DEBUG_MISC ptr
 6520 
 6521 type _IMAGE_FUNCTION_ENTRY field = 4
 6522     StartingAddress as DWORD
 6523     EndingAddress as DWORD
 6524     EndOfPrologue as DWORD
 6525 end type
 6526 
 6527 type IMAGE_FUNCTION_ENTRY as _IMAGE_FUNCTION_ENTRY
 6528 type PIMAGE_FUNCTION_ENTRY as _IMAGE_FUNCTION_ENTRY ptr
 6529 
 6530 type _IMAGE_FUNCTION_ENTRY64 field = 4
 6531     StartingAddress as ULONGLONG
 6532     EndingAddress as ULONGLONG
 6533 
 6534     union field = 4
 6535         EndOfPrologue as ULONGLONG
 6536         UnwindInfoAddress as ULONGLONG
 6537     end union
 6538 end type
 6539 
 6540 type IMAGE_FUNCTION_ENTRY64 as _IMAGE_FUNCTION_ENTRY64
 6541 type PIMAGE_FUNCTION_ENTRY64 as _IMAGE_FUNCTION_ENTRY64 ptr
 6542 
 6543 type _IMAGE_SEPARATE_DEBUG_HEADER field = 4
 6544     Signature as WORD
 6545     Flags as WORD
 6546     Machine as WORD
 6547     Characteristics as WORD
 6548     TimeDateStamp as DWORD
 6549     CheckSum as DWORD
 6550     ImageBase as DWORD
 6551     SizeOfImage as DWORD
 6552     NumberOfSections as DWORD
 6553     ExportedNamesSize as DWORD
 6554     DebugDirectorySize as DWORD
 6555     SectionAlignment as DWORD
 6556     Reserved(0 to 1) as DWORD
 6557 end type
 6558 
 6559 type IMAGE_SEPARATE_DEBUG_HEADER as _IMAGE_SEPARATE_DEBUG_HEADER
 6560 type PIMAGE_SEPARATE_DEBUG_HEADER as _IMAGE_SEPARATE_DEBUG_HEADER ptr
 6561 
 6562 type _NON_PAGED_DEBUG_INFO field = 4
 6563     Signature as WORD
 6564     Flags as WORD
 6565     Size as DWORD
 6566     Machine as WORD
 6567     Characteristics as WORD
 6568     TimeDateStamp as DWORD
 6569     CheckSum as DWORD
 6570     SizeOfImage as DWORD
 6571     ImageBase as ULONGLONG
 6572 end type
 6573 
 6574 type NON_PAGED_DEBUG_INFO as _NON_PAGED_DEBUG_INFO
 6575 type PNON_PAGED_DEBUG_INFO as _NON_PAGED_DEBUG_INFO ptr
 6576 const IMAGE_SEPARATE_DEBUG_SIGNATURE = &h4944
 6577 const NON_PAGED_DEBUG_SIGNATURE = &h494E
 6578 const IMAGE_SEPARATE_DEBUG_FLAGS_MASK = &h8000
 6579 const IMAGE_SEPARATE_DEBUG_MISMATCH = &h8000
 6580 
 6581 type _ImageArchitectureHeader field = 4
 6582     AmaskValue : 1 as ulong
 6583     Adummy1 : 7 as long
 6584     AmaskShift : 8 as ulong
 6585     Adummy2 : 16 as long
 6586     FirstEntryRVA as DWORD
 6587 end type
 6588 
 6589 type IMAGE_ARCHITECTURE_HEADER as _ImageArchitectureHeader
 6590 type PIMAGE_ARCHITECTURE_HEADER as _ImageArchitectureHeader ptr
 6591 
 6592 type _ImageArchitectureEntry field = 4
 6593     FixupInstRVA as DWORD
 6594     NewInst as DWORD
 6595 end type
 6596 
 6597 type IMAGE_ARCHITECTURE_ENTRY as _ImageArchitectureEntry
 6598 type PIMAGE_ARCHITECTURE_ENTRY as _ImageArchitectureEntry ptr
 6599 const IMPORT_OBJECT_HDR_SIG2 = &hffff
 6600 
 6601 type IMPORT_OBJECT_HEADER
 6602     Sig1 as WORD
 6603     Sig2 as WORD
 6604     Version as WORD
 6605     Machine as WORD
 6606     TimeDateStamp as DWORD
 6607     SizeOfData as DWORD
 6608 
 6609     union
 6610         Ordinal as WORD
 6611         Hint as WORD
 6612     end union
 6613 
 6614     as WORD Type : 2
 6615     NameType : 3 as WORD
 6616     Reserved : 11 as WORD
 6617 end type
 6618 
 6619 type IMPORT_OBJECT_TYPE as long
 6620 enum
 6621     IMPORT_OBJECT_CODE = 0
 6622     IMPORT_OBJECT_DATA = 1
 6623     IMPORT_OBJECT_CONST = 2
 6624 end enum
 6625 
 6626 type IMPORT_OBJECT_NAME_TYPE as long
 6627