JwaWinNT.pas
上传用户:davidchvip
上传日期:2009-07-28
资源大小:1749k
文件大小:336k
源码类别:

Windows编程

开发平台:

Delphi

  1.     //    struct  // WinNT fields
  2.     //    {
  3.     unknown1: DWORD;             // 1Ch
  4.     processID: DWORD;            // 20h
  5.     threadID: DWORD;             // 24h
  6.     unknown2: DWORD;             // 28h
  7.     //    } WINNT;
  8.     //} TIB_UNION2;
  9.     pvTLSArray: PVOID;          // (PPVOID!) 2Ch Thread Local Storage array
  10.     //union                      // 30h (NT/Win95 differences)
  11.     //{
  12.     //    struct  // Win95 fields
  13.     //    {
  14.     //        PVOID*  pProcess;  // 30h Pointer to owning process database
  15.     //    } WIN95;
  16.     //} TIB_UNION3;
  17.   end;
  18.   {$EXTERNALSYM _NT_TIB}
  19.   NT_TIB = _NT_TIB;
  20.   {$EXTERNALSYM NT_TIB}
  21.   TNtTib = NT_TIB;
  22.   PNtTib = ^TNtTib;
  23. //
  24. // 32 and 64 bit specific version for wow64 and the debugger
  25. //
  26.   PNT_TIB32 = ^NT_TIB32;
  27.   {$EXTERNALSYM PNT_TIB32}
  28.   _NT_TIB32 = record
  29.     ExceptionList: DWORD;
  30.     StackBase: DWORD;
  31.     StackLimit: DWORD;
  32.     SubSystemTib: DWORD;
  33.     Union: record
  34.     case Integer of
  35.       0: (FiberData: DWORD);
  36.       1: (Version: DWORD);
  37.     end;
  38.     ArbitraryUserPointer: DWORD;
  39.     Self: DWORD;
  40.   end;
  41.   {$EXTERNALSYM _NT_TIB32}
  42.   NT_TIB32 = _NT_TIB32;
  43.   {$EXTERNALSYM NT_TIB32}
  44.   TNtTib32 = NT_TIB32;
  45.   PNtTib32 = ^TNtTib32;
  46.   PNT_TIB64 = ^NT_TIB64;
  47.   {$EXTERNALSYM PNT_TIB64}
  48.   _NT_TIB64 = record
  49.     ExceptionList: DWORD64;
  50.     StackBase: DWORD64;
  51.     StackLimit: DWORD64;
  52.     SubSystemTib: DWORD64;
  53.     Union: record
  54.     case Integer of
  55.       0: (FiberData: DWORD64);
  56.       1: (Version: DWORD);
  57.     end;
  58.     ArbitraryUserPointer: DWORD64;
  59.     Self: DWORD64;
  60.   end;
  61.   {$EXTERNALSYM _NT_TIB64}
  62.   NT_TIB64 = _NT_TIB64;
  63.   {$EXTERNALSYM NT_TIB64}
  64.   TNtTib64 = NT_TIB64;
  65.   PNtTib64 = ^TNtTib64;
  66. //
  67. // Define function to return the current Thread Environment Block
  68. //
  69. function NtCurrentTeb: PNT_TIB;
  70. {$EXTERNALSYM NtCurrentTeb}
  71. const
  72.   THREAD_BASE_PRIORITY_LOWRT = 15;         // value that gets a thread to LowRealtime-1
  73.   {$EXTERNALSYM THREAD_BASE_PRIORITY_LOWRT}
  74.   THREAD_BASE_PRIORITY_MAX   = 2;          // maximum thread base priority boost
  75.   {$EXTERNALSYM THREAD_BASE_PRIORITY_MAX}
  76.   THREAD_BASE_PRIORITY_MIN   = DWORD(-2);  // minimum thread base priority boost
  77.   {$EXTERNALSYM THREAD_BASE_PRIORITY_MIN}
  78.   THREAD_BASE_PRIORITY_IDLE  = DWORD(-15); // value that gets a thread to idle
  79.   {$EXTERNALSYM THREAD_BASE_PRIORITY_IDLE}
  80. type
  81.   PQUOTA_LIMITS = ^QUOTA_LIMITS;
  82.   {$EXTERNALSYM PQUOTA_LIMITS}
  83.   _QUOTA_LIMITS = record
  84.     PagedPoolLimit: SIZE_T;
  85.     NonPagedPoolLimit: SIZE_T;
  86.     MinimumWorkingSetSize: SIZE_T;
  87.     MaximumWorkingSetSize: SIZE_T;
  88.     PagefileLimit: SIZE_T;
  89.     TimeLimit: LARGE_INTEGER;
  90.   end;
  91.   {$EXTERNALSYM _QUOTA_LIMITS}
  92.   QUOTA_LIMITS = _QUOTA_LIMITS;
  93.   {$EXTERNALSYM QUOTA_LIMITS}
  94.   TQuotaLimits = QUOTA_LIMITS;
  95.   PQuotaLimits = PQUOTA_LIMITS;
  96. const
  97.   QUOTA_LIMITS_HARDWS_ENABLE  = $00000001;
  98.   {$EXTERNALSYM QUOTA_LIMITS_HARDWS_ENABLE}
  99.   QUOTA_LIMITS_HARDWS_DISABLE = $00000002;
  100.   {$EXTERNALSYM QUOTA_LIMITS_HARDWS_DISABLE}
  101. type
  102.   _QUOTA_LIMITS_EX = record
  103.     PagedPoolLimit: SIZE_T;
  104.     NonPagedPoolLimit: SIZE_T;
  105.     MinimumWorkingSetSize: SIZE_T;
  106.     MaximumWorkingSetSize: SIZE_T;
  107.     PagefileLimit: SIZE_T;
  108.     TimeLimit: LARGE_INTEGER;
  109.     Reserved1: SIZE_T;
  110.     Reserved2: SIZE_T;
  111.     Reserved3: SIZE_T;
  112.     Reserved4: SIZE_T;
  113.     Flags: DWORD;
  114.     Reserved5: DWORD;
  115.   end;
  116.   {$EXTERNALSYM _QUOTA_LIMITS_EX}
  117.   QUOTA_LIMITS_EX = _QUOTA_LIMITS_EX;
  118.   {$EXTERNALSYM QUOTA_LIMITS_EX}
  119.   PQUOTA_LIMITS_EX = ^QUOTA_LIMITS_EX;
  120.   {$EXTERNALSYM PQUOTA_LIMITS_EX}
  121.   TQuotaLimitsEx = QUOTA_LIMITS_EX;
  122.   PQuotaLimitsEx = PQUOTA_LIMITS_EX;  
  123.   PIO_COUNTERS = ^IO_COUNTERS;
  124.   {$EXTERNALSYM PIO_COUNTERS}
  125.   _IO_COUNTERS = record
  126.     ReadOperationCount: Int64;
  127.     WriteOperationCount: Int64;
  128.     OtherOperationCount: Int64;
  129.     ReadTransferCount: Int64;
  130.     WriteTransferCount: Int64;
  131.     OtherTransferCount: Int64;
  132.   end;
  133.   {$EXTERNALSYM _IO_COUNTERS}
  134.   IO_COUNTERS = _IO_COUNTERS;
  135.   {$EXTERNALSYM IO_COUNTERS}
  136.   TIoCounters = IO_COUNTERS;
  137.   PIoCounters = PIO_COUNTERS;
  138.   PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION = ^JOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
  139.   {$EXTERNALSYM PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION}
  140.   _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION = record
  141.     TotalUserTime: LARGE_INTEGER;
  142.     TotalKernelTime: LARGE_INTEGER;
  143.     ThisPeriodTotalUserTime: LARGE_INTEGER;
  144.     ThisPeriodTotalKernelTime: LARGE_INTEGER;
  145.     TotalPageFaultCount: DWORD;
  146.     TotalProcesses: DWORD;
  147.     ActiveProcesses: DWORD;
  148.     TotalTerminatedProcesses: DWORD;
  149.   end;
  150.   {$EXTERNALSYM _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION}
  151.   JOBOBJECT_BASIC_ACCOUNTING_INFORMATION = _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
  152.   {$EXTERNALSYM JOBOBJECT_BASIC_ACCOUNTING_INFORMATION}
  153.   TJobObjectBasicAccountingInformation = JOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
  154.   PJobObjectBasicAccountingInformation = PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
  155.   PJOBOBJECT_BASIC_LIMIT_INFORMATION = ^JOBOBJECT_BASIC_LIMIT_INFORMATION;
  156.   {$EXTERNALSYM PJOBOBJECT_BASIC_LIMIT_INFORMATION}
  157.   _JOBOBJECT_BASIC_LIMIT_INFORMATION = record
  158.     PerProcessUserTimeLimit: LARGE_INTEGER;
  159.     PerJobUserTimeLimit: LARGE_INTEGER;
  160.     LimitFlags: DWORD;
  161.     MinimumWorkingSetSize: SIZE_T;
  162.     MaximumWorkingSetSize: SIZE_T;
  163.     ActiveProcessLimit: DWORD;
  164.     Affinity: ULONG_PTR;
  165.     PriorityClass: DWORD;
  166.     SchedulingClass: DWORD;
  167.   end;
  168.   {$EXTERNALSYM _JOBOBJECT_BASIC_LIMIT_INFORMATION}
  169.   JOBOBJECT_BASIC_LIMIT_INFORMATION = _JOBOBJECT_BASIC_LIMIT_INFORMATION;
  170.   {$EXTERNALSYM JOBOBJECT_BASIC_LIMIT_INFORMATION}
  171.   TJobObjectBasicLimitInformation = JOBOBJECT_BASIC_LIMIT_INFORMATION;
  172.   PJobObjectBasicLimitInformation = PJOBOBJECT_BASIC_LIMIT_INFORMATION;
  173.   PJOBOBJECT_EXTENDED_LIMIT_INFORMATION = ^JOBOBJECT_EXTENDED_LIMIT_INFORMATION;
  174.   {$EXTERNALSYM PJOBOBJECT_EXTENDED_LIMIT_INFORMATION}
  175.   _JOBOBJECT_EXTENDED_LIMIT_INFORMATION = record
  176.     BasicLimitInformation: JOBOBJECT_BASIC_LIMIT_INFORMATION;
  177.     IoInfo: IO_COUNTERS;
  178.     ProcessMemoryLimit: SIZE_T;
  179.     JobMemoryLimit: SIZE_T;
  180.     PeakProcessMemoryUsed: SIZE_T;
  181.     PeakJobMemoryUsed: SIZE_T;
  182.   end;
  183.   {$EXTERNALSYM _JOBOBJECT_EXTENDED_LIMIT_INFORMATION}
  184.   JOBOBJECT_EXTENDED_LIMIT_INFORMATION = _JOBOBJECT_EXTENDED_LIMIT_INFORMATION;
  185.   {$EXTERNALSYM JOBOBJECT_EXTENDED_LIMIT_INFORMATION}
  186.   TJobObjectExtendedLimitInformation = JOBOBJECT_EXTENDED_LIMIT_INFORMATION;
  187.   PJobObjectExtendedLimitInformation = PJOBOBJECT_EXTENDED_LIMIT_INFORMATION;
  188.   PJOBOBJECT_BASIC_PROCESS_ID_LIST = ^JOBOBJECT_BASIC_PROCESS_ID_LIST;
  189.   {$EXTERNALSYM PJOBOBJECT_BASIC_PROCESS_ID_LIST}
  190.   _JOBOBJECT_BASIC_PROCESS_ID_LIST = record
  191.     NumberOfAssignedProcesses: DWORD;
  192.     NumberOfProcessIdsInList: DWORD;
  193.     ProcessIdList: array [0..0] of ULONG_PTR;
  194.   end;
  195.   {$EXTERNALSYM _JOBOBJECT_BASIC_PROCESS_ID_LIST}
  196.   JOBOBJECT_BASIC_PROCESS_ID_LIST = _JOBOBJECT_BASIC_PROCESS_ID_LIST;
  197.   {$EXTERNALSYM JOBOBJECT_BASIC_PROCESS_ID_LIST}
  198.   TJobObjectBasicProcessIdList = JOBOBJECT_BASIC_PROCESS_ID_LIST;
  199.   PJobObjectBasicProcessIdList = PJOBOBJECT_BASIC_PROCESS_ID_LIST;
  200.   PJOBOBJECT_BASIC_UI_RESTRICTIONS = ^JOBOBJECT_BASIC_UI_RESTRICTIONS;
  201.   {$EXTERNALSYM PJOBOBJECT_BASIC_UI_RESTRICTIONS}
  202.   _JOBOBJECT_BASIC_UI_RESTRICTIONS = record
  203.     UIRestrictionsClass: DWORD;
  204.   end;
  205.   {$EXTERNALSYM _JOBOBJECT_BASIC_UI_RESTRICTIONS}
  206.   JOBOBJECT_BASIC_UI_RESTRICTIONS = _JOBOBJECT_BASIC_UI_RESTRICTIONS;
  207.   {$EXTERNALSYM JOBOBJECT_BASIC_UI_RESTRICTIONS}
  208.   TJobObjectBasicUiRestrictions = JOBOBJECT_BASIC_UI_RESTRICTIONS;
  209.   PJobObjectBasicUiRestrictions = PJOBOBJECT_BASIC_UI_RESTRICTIONS;
  210.   PJOBOBJECT_SECURITY_LIMIT_INFORMATION = ^JOBOBJECT_SECURITY_LIMIT_INFORMATION;
  211.   {$EXTERNALSYM PJOBOBJECT_SECURITY_LIMIT_INFORMATION}
  212.   _JOBOBJECT_SECURITY_LIMIT_INFORMATION = record
  213.     SecurityLimitFlags : DWORD;
  214.     JobToken : THandle;
  215.     SidsToDisable : PTOKEN_GROUPS;
  216.     PrivilegesToDelete : PTOKEN_PRIVILEGES;
  217.     RestrictedSids : PTOKEN_GROUPS;
  218.   end;
  219.   {$EXTERNALSYM _JOBOBJECT_SECURITY_LIMIT_INFORMATION}
  220.   JOBOBJECT_SECURITY_LIMIT_INFORMATION = _JOBOBJECT_SECURITY_LIMIT_INFORMATION;
  221.   {$EXTERNALSYM JOBOBJECT_SECURITY_LIMIT_INFORMATION}
  222.   TJobObjectSecurityLimitInformation = JOBOBJECT_SECURITY_LIMIT_INFORMATION;
  223.   PJobObjectSecurityLimitInformation = PJOBOBJECT_SECURITY_LIMIT_INFORMATION;
  224.   PJOBOBJECT_END_OF_JOB_TIME_INFORMATION = ^JOBOBJECT_END_OF_JOB_TIME_INFORMATION;
  225.   {$EXTERNALSYM PJOBOBJECT_END_OF_JOB_TIME_INFORMATION}
  226.   _JOBOBJECT_END_OF_JOB_TIME_INFORMATION = record
  227.     EndOfJobTimeAction: DWORD;
  228.   end;
  229.   {$EXTERNALSYM _JOBOBJECT_END_OF_JOB_TIME_INFORMATION}
  230.   JOBOBJECT_END_OF_JOB_TIME_INFORMATION = _JOBOBJECT_END_OF_JOB_TIME_INFORMATION;
  231.   {$EXTERNALSYM JOBOBJECT_END_OF_JOB_TIME_INFORMATION}
  232.   TJobObjectEndOfJobTimeInformation = JOBOBJECT_END_OF_JOB_TIME_INFORMATION;
  233.   PJobObjectEndOfJobTimeInformation = PJOBOBJECT_END_OF_JOB_TIME_INFORMATION;
  234.   PJOBOBJECT_ASSOCIATE_COMPLETION_PORT = ^JOBOBJECT_ASSOCIATE_COMPLETION_PORT;
  235.   {$EXTERNALSYM PJOBOBJECT_ASSOCIATE_COMPLETION_PORT}
  236.   _JOBOBJECT_ASSOCIATE_COMPLETION_PORT = record
  237.     CompletionKey: Pointer;
  238.     CompletionPort: THandle;
  239.   end;
  240.   {$EXTERNALSYM _JOBOBJECT_ASSOCIATE_COMPLETION_PORT}
  241.   JOBOBJECT_ASSOCIATE_COMPLETION_PORT = _JOBOBJECT_ASSOCIATE_COMPLETION_PORT;
  242.   {$EXTERNALSYM JOBOBJECT_ASSOCIATE_COMPLETION_PORT}
  243.   TJobObjectAssociateCompletionPort = JOBOBJECT_ASSOCIATE_COMPLETION_PORT;
  244.   PJobObjectAssociateCompletionPort = PJOBOBJECT_ASSOCIATE_COMPLETION_PORT;
  245.   PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION = ^JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
  246.   {$EXTERNALSYM PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION}
  247.   _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION = record
  248.     BasicInfo: JOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
  249.     IoInfo: IO_COUNTERS;
  250.   end;
  251.   {$EXTERNALSYM _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION}
  252.   JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION = _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
  253.   {$EXTERNALSYM JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION}
  254.   TJobObjectBasicAndIoAccountingInformation = JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
  255.   PJobObjectBasicAndIoAccountingInformation = PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
  256.   _JOBOBJECT_JOBSET_INFORMATION = record
  257.     MemberLevel: DWORD;
  258.   end;
  259.   {$EXTERNALSYM _JOBOBJECT_JOBSET_INFORMATION}
  260.   JOBOBJECT_JOBSET_INFORMATION = _JOBOBJECT_JOBSET_INFORMATION;
  261.   {$EXTERNALSYM JOBOBJECT_JOBSET_INFORMATION}
  262.   PJOBOBJECT_JOBSET_INFORMATION = ^JOBOBJECT_JOBSET_INFORMATION;
  263.   {$EXTERNALSYM PJOBOBJECT_JOBSET_INFORMATION}
  264.   TJobObjectSetInformation = JOBOBJECT_JOBSET_INFORMATION;
  265.   PJobObjectSetInformation = PJOBOBJECT_JOBSET_INFORMATION;  
  266. const
  267.   JOB_OBJECT_TERMINATE_AT_END_OF_JOB = 0;
  268.   {$EXTERNALSYM JOB_OBJECT_TERMINATE_AT_END_OF_JOB}
  269.   JOB_OBJECT_POST_AT_END_OF_JOB      = 1;
  270.   {$EXTERNALSYM JOB_OBJECT_POST_AT_END_OF_JOB}
  271. //
  272. // Completion Port Messages for job objects
  273. //
  274. // These values are returned via the lpNumberOfBytesTransferred parameter
  275. //
  276.   JOB_OBJECT_MSG_END_OF_JOB_TIME       = 1;
  277.   {$EXTERNALSYM JOB_OBJECT_MSG_END_OF_JOB_TIME}
  278.   JOB_OBJECT_MSG_END_OF_PROCESS_TIME   = 2;
  279.   {$EXTERNALSYM JOB_OBJECT_MSG_END_OF_PROCESS_TIME}
  280.   JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT  = 3;
  281.   {$EXTERNALSYM JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT}
  282.   JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO   = 4;
  283.   {$EXTERNALSYM JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO}
  284.   JOB_OBJECT_MSG_NEW_PROCESS           = 6;
  285.   {$EXTERNALSYM JOB_OBJECT_MSG_NEW_PROCESS}
  286.   JOB_OBJECT_MSG_EXIT_PROCESS          = 7;
  287.   {$EXTERNALSYM JOB_OBJECT_MSG_EXIT_PROCESS}
  288.   JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS = 8;
  289.   {$EXTERNALSYM JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS}
  290.   JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT  = 9;
  291.   {$EXTERNALSYM JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT}
  292.   JOB_OBJECT_MSG_JOB_MEMORY_LIMIT      = 10;
  293.   {$EXTERNALSYM JOB_OBJECT_MSG_JOB_MEMORY_LIMIT}
  294. //
  295. // Basic Limits
  296. //
  297.   JOB_OBJECT_LIMIT_WORKINGSET        = $00000001;
  298.   {$EXTERNALSYM JOB_OBJECT_LIMIT_WORKINGSET}
  299.   JOB_OBJECT_LIMIT_PROCESS_TIME      = $00000002;
  300.   {$EXTERNALSYM JOB_OBJECT_LIMIT_PROCESS_TIME}
  301.   JOB_OBJECT_LIMIT_JOB_TIME          = $00000004;
  302.   {$EXTERNALSYM JOB_OBJECT_LIMIT_JOB_TIME}
  303.   JOB_OBJECT_LIMIT_ACTIVE_PROCESS    = $00000008;
  304.   {$EXTERNALSYM JOB_OBJECT_LIMIT_ACTIVE_PROCESS}
  305.   JOB_OBJECT_LIMIT_AFFINITY          = $00000010;
  306.   {$EXTERNALSYM JOB_OBJECT_LIMIT_AFFINITY}
  307.   JOB_OBJECT_LIMIT_PRIORITY_CLASS    = $00000020;
  308.   {$EXTERNALSYM JOB_OBJECT_LIMIT_PRIORITY_CLASS}
  309.   JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = $00000040;
  310.   {$EXTERNALSYM JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME}
  311.   JOB_OBJECT_LIMIT_SCHEDULING_CLASS  = $00000080;
  312.   {$EXTERNALSYM JOB_OBJECT_LIMIT_SCHEDULING_CLASS}
  313. //
  314. // Extended Limits
  315. //
  316.   JOB_OBJECT_LIMIT_PROCESS_MEMORY             = $00000100;
  317.   {$EXTERNALSYM JOB_OBJECT_LIMIT_PROCESS_MEMORY}
  318.   JOB_OBJECT_LIMIT_JOB_MEMORY                 = $00000200;
  319.   {$EXTERNALSYM JOB_OBJECT_LIMIT_JOB_MEMORY}
  320.   JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = $00000400;
  321.   {$EXTERNALSYM JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION}
  322.   JOB_OBJECT_LIMIT_BREAKAWAY_OK               = $00000800;
  323.   {$EXTERNALSYM JOB_OBJECT_LIMIT_BREAKAWAY_OK}
  324.   JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK        = $00001000;
  325.   {$EXTERNALSYM JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK}
  326.   JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE          = $00002000;
  327.   {$EXTERNALSYM JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE}
  328.   JOB_OBJECT_LIMIT_RESERVED2 = $00004000;
  329.   {$EXTERNALSYM JOB_OBJECT_LIMIT_RESERVED2}
  330.   JOB_OBJECT_LIMIT_RESERVED3 = $00008000;
  331.   {$EXTERNALSYM JOB_OBJECT_LIMIT_RESERVED3}
  332.   JOB_OBJECT_LIMIT_RESERVED4 = $00010000;
  333.   {$EXTERNALSYM JOB_OBJECT_LIMIT_RESERVED4}
  334.   JOB_OBJECT_LIMIT_RESERVED5 = $00020000;
  335.   {$EXTERNALSYM JOB_OBJECT_LIMIT_RESERVED5}
  336.   JOB_OBJECT_LIMIT_RESERVED6 = $00040000;
  337.   {$EXTERNALSYM JOB_OBJECT_LIMIT_RESERVED6}
  338.   JOB_OBJECT_LIMIT_VALID_FLAGS = $0007ffff;
  339.   {$EXTERNALSYM JOB_OBJECT_LIMIT_VALID_FLAGS}
  340.   JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS    = $000000ff;
  341.   {$EXTERNALSYM JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS}
  342.   JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS = $00003fff;
  343.   {$EXTERNALSYM JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS}
  344.   JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS = $0007ffff;
  345.   {$EXTERNALSYM JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS}
  346. //
  347. // UI restrictions for jobs
  348. //
  349.   JOB_OBJECT_UILIMIT_NONE = $00000000;
  350.   {$EXTERNALSYM JOB_OBJECT_UILIMIT_NONE}
  351.   JOB_OBJECT_UILIMIT_HANDLES          = $00000001;
  352.   {$EXTERNALSYM JOB_OBJECT_UILIMIT_HANDLES}
  353.   JOB_OBJECT_UILIMIT_READCLIPBOARD    = $00000002;
  354.   {$EXTERNALSYM JOB_OBJECT_UILIMIT_READCLIPBOARD}
  355.   JOB_OBJECT_UILIMIT_WRITECLIPBOARD   = $00000004;
  356.   {$EXTERNALSYM JOB_OBJECT_UILIMIT_WRITECLIPBOARD}
  357.   JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = $00000008;
  358.   {$EXTERNALSYM JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS}
  359.   JOB_OBJECT_UILIMIT_DISPLAYSETTINGS  = $00000010;
  360.   {$EXTERNALSYM JOB_OBJECT_UILIMIT_DISPLAYSETTINGS}
  361.   JOB_OBJECT_UILIMIT_GLOBALATOMS      = $00000020;
  362.   {$EXTERNALSYM JOB_OBJECT_UILIMIT_GLOBALATOMS}
  363.   JOB_OBJECT_UILIMIT_DESKTOP          = $00000040;
  364.   {$EXTERNALSYM JOB_OBJECT_UILIMIT_DESKTOP}
  365.   JOB_OBJECT_UILIMIT_EXITWINDOWS      = $00000080;
  366.   {$EXTERNALSYM JOB_OBJECT_UILIMIT_EXITWINDOWS}
  367.   JOB_OBJECT_UILIMIT_ALL = $000000FF;
  368.   {$EXTERNALSYM JOB_OBJECT_UILIMIT_ALL}
  369.   JOB_OBJECT_UI_VALID_FLAGS = $000000FF;
  370.   {$EXTERNALSYM JOB_OBJECT_UI_VALID_FLAGS}
  371.   JOB_OBJECT_SECURITY_NO_ADMIN         = $00000001;
  372.   {$EXTERNALSYM JOB_OBJECT_SECURITY_NO_ADMIN}
  373.   JOB_OBJECT_SECURITY_RESTRICTED_TOKEN = $00000002;
  374.   {$EXTERNALSYM JOB_OBJECT_SECURITY_RESTRICTED_TOKEN}
  375.   JOB_OBJECT_SECURITY_ONLY_TOKEN       = $00000004;
  376.   {$EXTERNALSYM JOB_OBJECT_SECURITY_ONLY_TOKEN}
  377.   JOB_OBJECT_SECURITY_FILTER_TOKENS    = $00000008;
  378.   {$EXTERNALSYM JOB_OBJECT_SECURITY_FILTER_TOKENS}
  379.   JOB_OBJECT_SECURITY_VALID_FLAGS = $0000000f;
  380.   {$EXTERNALSYM JOB_OBJECT_SECURITY_VALID_FLAGS}
  381. type
  382.   _JOBOBJECTINFOCLASS = (
  383.     JobObjectInfoClassPadding0,
  384.     JobObjectBasicAccountingInformation,
  385.     JobObjectBasicLimitInformation,
  386.     JobObjectBasicProcessIdList,
  387.     JobObjectBasicUIRestrictions,
  388.     JobObjectSecurityLimitInformation,
  389.     JobObjectEndOfJobTimeInformation,
  390.     JobObjectAssociateCompletionPortInformation,
  391.     JobObjectBasicAndIoAccountingInformation,
  392.     JobObjectExtendedLimitInformation,
  393.     JobObjectJobSetInformation,
  394.     MaxJobObjectInfoClass);
  395.   {$EXTERNALSYM _JOBOBJECTINFOCLASS}
  396.   JOBOBJECTINFOCLASS = _JOBOBJECTINFOCLASS;
  397.   {$EXTERNALSYM JOBOBJECTINFOCLASS}
  398.   TJobObjectInfoClass = JOBOBJECTINFOCLASS;
  399. const
  400.   EVENT_MODIFY_STATE = $0002;
  401.   {$EXTERNALSYM EVENT_MODIFY_STATE}
  402.   EVENT_ALL_ACCESS   = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or $3);
  403.   {$EXTERNALSYM EVENT_ALL_ACCESS}
  404.   MUTANT_QUERY_STATE = $0001;
  405.   {$EXTERNALSYM MUTANT_QUERY_STATE}
  406.   MUTANT_ALL_ACCESS      = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or MUTANT_QUERY_STATE);
  407.   {$EXTERNALSYM MUTANT_ALL_ACCESS}
  408.   SEMAPHORE_MODIFY_STATE = $0002;
  409.   {$EXTERNALSYM SEMAPHORE_MODIFY_STATE}
  410.   SEMAPHORE_ALL_ACCESS   = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or $3);
  411.   {$EXTERNALSYM SEMAPHORE_ALL_ACCESS}
  412. //
  413. // Timer Specific Access Rights.
  414. //
  415.   TIMER_QUERY_STATE  = $0001;
  416.   {$EXTERNALSYM TIMER_QUERY_STATE}
  417.   TIMER_MODIFY_STATE = $0002;
  418.   {$EXTERNALSYM TIMER_MODIFY_STATE}
  419.   TIMER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or TIMER_QUERY_STATE or TIMER_MODIFY_STATE);
  420.   {$EXTERNALSYM TIMER_ALL_ACCESS}
  421.   TIME_ZONE_ID_UNKNOWN  = 0;
  422.   {$EXTERNALSYM TIME_ZONE_ID_UNKNOWN}
  423.   TIME_ZONE_ID_STANDARD = 1;
  424.   {$EXTERNALSYM TIME_ZONE_ID_STANDARD}
  425.   TIME_ZONE_ID_DAYLIGHT = 2;
  426.   {$EXTERNALSYM TIME_ZONE_ID_DAYLIGHT}
  427. type
  428.   _LOGICAL_PROCESSOR_RELATIONSHIP = (RelationProcessorCore, RelationNumaNode);
  429.   {$EXTERNALSYM _LOGICAL_PROCESSOR_RELATIONSHIP}
  430.   LOGICAL_PROCESSOR_RELATIONSHIP = _LOGICAL_PROCESSOR_RELATIONSHIP;
  431.   {$EXTERNALSYM LOGICAL_PROCESSOR_RELATIONSHIP}
  432.   TLogicalProcessorRelationship = LOGICAL_PROCESSOR_RELATIONSHIP;
  433. const
  434.   LTP_PC_SMT = $1;
  435.   {$EXTERNALSYM LTP_PC_SMT}
  436. type
  437.   _SYSTEM_LOGICAL_PROCESSOR_INFORMATION = record
  438.     ProcessorMask: ULONG_PTR;
  439.     Relationship: LOGICAL_PROCESSOR_RELATIONSHIP;
  440.     case Integer of
  441.       0: (Flags: BYTE); // ProcessorCore
  442.       1: (NodeNumber: DWORD); // NumaNode
  443.       2: (Reserved: array [0..1] of ULONGLONG);
  444.   end;
  445.   {$EXTERNALSYM _SYSTEM_LOGICAL_PROCESSOR_INFORMATION}
  446.   SYSTEM_LOGICAL_PROCESSOR_INFORMATION = _SYSTEM_LOGICAL_PROCESSOR_INFORMATION;
  447.   {$EXTERNALSYM SYSTEM_LOGICAL_PROCESSOR_INFORMATION}
  448.   PSYSTEM_LOGICAL_PROCESSOR_INFORMATION = ^SYSTEM_LOGICAL_PROCESSOR_INFORMATION;
  449.   TSystemLogicalProcessorInformation = SYSTEM_LOGICAL_PROCESSOR_INFORMATION;
  450.   PSystemLogicalProcessorInformation = PSYSTEM_LOGICAL_PROCESSOR_INFORMATION;  
  451. const
  452.   PROCESSOR_INTEL_386     = 386;
  453.   {$EXTERNALSYM PROCESSOR_INTEL_386}
  454.   PROCESSOR_INTEL_486     = 486;
  455.   {$EXTERNALSYM PROCESSOR_INTEL_486}
  456.   PROCESSOR_INTEL_PENTIUM = 586;
  457.   {$EXTERNALSYM PROCESSOR_INTEL_PENTIUM}
  458.   PROCESSOR_INTEL_IA64    = 2200;
  459.   {$EXTERNALSYM PROCESSOR_INTEL_IA64}
  460.   PROCESSOR_AMD_X8664     = 8664;
  461.   {$EXTERNALSYM PROCESSOR_AMD_X8664}
  462.   PROCESSOR_MIPS_R4000    = 4000; // incl R4101 & R3910 for Windows CE
  463.   {$EXTERNALSYM PROCESSOR_MIPS_R4000}
  464.   PROCESSOR_ALPHA_21064   = 21064;
  465.   {$EXTERNALSYM PROCESSOR_ALPHA_21064}
  466.   PROCESSOR_PPC_601       = 601;
  467.   {$EXTERNALSYM PROCESSOR_PPC_601}
  468.   PROCESSOR_PPC_603       = 603;
  469.   {$EXTERNALSYM PROCESSOR_PPC_603}
  470.   PROCESSOR_PPC_604       = 604;
  471.   {$EXTERNALSYM PROCESSOR_PPC_604}
  472.   PROCESSOR_PPC_620       = 620;
  473.   {$EXTERNALSYM PROCESSOR_PPC_620}
  474.   PROCESSOR_HITACHI_SH3   = 10003; // Windows CE
  475.   {$EXTERNALSYM PROCESSOR_HITACHI_SH3}
  476.   PROCESSOR_HITACHI_SH3E  = 10004; // Windows CE
  477.   {$EXTERNALSYM PROCESSOR_HITACHI_SH3E}
  478.   PROCESSOR_HITACHI_SH4   = 10005; // Windows CE
  479.   {$EXTERNALSYM PROCESSOR_HITACHI_SH4}
  480.   PROCESSOR_MOTOROLA_821  = 821; // Windows CE
  481.   {$EXTERNALSYM PROCESSOR_MOTOROLA_821}
  482.   PROCESSOR_SHx_SH3       = 103; // Windows CE
  483.   {$EXTERNALSYM PROCESSOR_SHx_SH3}
  484.   PROCESSOR_SHx_SH4       = 104; // Windows CE
  485.   {$EXTERNALSYM PROCESSOR_SHx_SH4}
  486.   PROCESSOR_STRONGARM     = 2577; // Windows CE - 0xA11
  487.   {$EXTERNALSYM PROCESSOR_STRONGARM}
  488.   PROCESSOR_ARM720        = 1824; // Windows CE - 0x720
  489.   {$EXTERNALSYM PROCESSOR_ARM720}
  490.   PROCESSOR_ARM820        = 2080; // Windows CE - 0x820
  491.   {$EXTERNALSYM PROCESSOR_ARM820}
  492.   PROCESSOR_ARM920        = 2336; // Windows CE - 0x920
  493.   {$EXTERNALSYM PROCESSOR_ARM920}
  494.   PROCESSOR_ARM_7TDMI     = 70001; // Windows CE
  495.   {$EXTERNALSYM PROCESSOR_ARM_7TDMI}
  496.   PROCESSOR_OPTIL         = $494f; // MSIL
  497.   {$EXTERNALSYM PROCESSOR_OPTIL}
  498.   PROCESSOR_ARCHITECTURE_INTEL   = 0;
  499.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_INTEL}
  500.   PROCESSOR_ARCHITECTURE_MIPS    = 1;
  501.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_MIPS}
  502.   PROCESSOR_ARCHITECTURE_ALPHA   = 2;
  503.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_ALPHA}
  504.   PROCESSOR_ARCHITECTURE_PPC     = 3;
  505.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_PPC}
  506.   PROCESSOR_ARCHITECTURE_SHX     = 4;
  507.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_SHX}
  508.   PROCESSOR_ARCHITECTURE_ARM     = 5;
  509.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_ARM}
  510.   PROCESSOR_ARCHITECTURE_IA64    = 6;
  511.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_IA64}
  512.   PROCESSOR_ARCHITECTURE_ALPHA64 = 7;
  513.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_ALPHA64}
  514.   PROCESSOR_ARCHITECTURE_MSIL    = 8;
  515.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_MSIL}
  516.   PROCESSOR_ARCHITECTURE_AMD64         = 9;
  517.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_AMD64}
  518.   PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 = 10;
  519.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_IA32_ON_WIN64}
  520.   PROCESSOR_ARCHITECTURE_UNKNOWN = $FFFF;
  521.   {$EXTERNALSYM PROCESSOR_ARCHITECTURE_UNKNOWN}
  522.   PF_FLOATING_POINT_PRECISION_ERRATA = 0;
  523.   {$EXTERNALSYM PF_FLOATING_POINT_PRECISION_ERRATA}
  524.   PF_FLOATING_POINT_EMULATED         = 1;
  525.   {$EXTERNALSYM PF_FLOATING_POINT_EMULATED}
  526.   PF_COMPARE_EXCHANGE_DOUBLE         = 2;
  527.   {$EXTERNALSYM PF_COMPARE_EXCHANGE_DOUBLE}
  528.   PF_MMX_INSTRUCTIONS_AVAILABLE      = 3;
  529.   {$EXTERNALSYM PF_MMX_INSTRUCTIONS_AVAILABLE}
  530.   PF_PPC_MOVEMEM_64BIT_OK            = 4;
  531.   {$EXTERNALSYM PF_PPC_MOVEMEM_64BIT_OK}
  532.   PF_ALPHA_BYTE_INSTRUCTIONS         = 5;
  533.   {$EXTERNALSYM PF_ALPHA_BYTE_INSTRUCTIONS}
  534.   PF_XMMI_INSTRUCTIONS_AVAILABLE     = 6;
  535.   {$EXTERNALSYM PF_XMMI_INSTRUCTIONS_AVAILABLE}
  536.   PF_3DNOW_INSTRUCTIONS_AVAILABLE    = 7;
  537.   {$EXTERNALSYM PF_3DNOW_INSTRUCTIONS_AVAILABLE}
  538.   PF_RDTSC_INSTRUCTION_AVAILABLE     = 8;
  539.   {$EXTERNALSYM PF_RDTSC_INSTRUCTION_AVAILABLE}
  540.   PF_PAE_ENABLED                     = 9;
  541.   {$EXTERNALSYM PF_PAE_ENABLED}
  542.   PF_XMMI64_INSTRUCTIONS_AVAILABLE   = 10;
  543.   {$EXTERNALSYM PF_XMMI64_INSTRUCTIONS_AVAILABLE}
  544. type
  545.   PMEMORY_BASIC_INFORMATION = ^MEMORY_BASIC_INFORMATION;
  546.   {$EXTERNALSYM PMEMORY_BASIC_INFORMATION}
  547.   _MEMORY_BASIC_INFORMATION = record
  548.     BaseAddress: Pointer;
  549.     AllocationBase: Pointer;
  550.     AllocationProtect: DWORD;
  551.     RegionSize: SIZE_T;
  552.     State: DWORD;
  553.     Protect: DWORD;
  554.     Type_: DWORD;
  555.   end;
  556.   {$EXTERNALSYM _MEMORY_BASIC_INFORMATION}
  557.   MEMORY_BASIC_INFORMATION = _MEMORY_BASIC_INFORMATION;
  558.   {$EXTERNALSYM MEMORY_BASIC_INFORMATION}
  559.   TMemoryBasicInformation = MEMORY_BASIC_INFORMATION;
  560.   PMemoryBasicInformation = PMEMORY_BASIC_INFORMATION;
  561.   PMEMORY_BASIC_INFORMATION32 = ^MEMORY_BASIC_INFORMATION32;
  562.   {$EXTERNALSYM PMEMORY_BASIC_INFORMATION32}
  563.   _MEMORY_BASIC_INFORMATION32 = record
  564.     BaseAddress: DWORD;
  565.     AllocationBase: DWORD;
  566.     AllocationProtect: DWORD;
  567.     RegionSize: DWORD;
  568.     State: DWORD;
  569.     Protect: DWORD;
  570.     Type_: DWORD;
  571.   end;
  572.   {$EXTERNALSYM _MEMORY_BASIC_INFORMATION32}
  573.   MEMORY_BASIC_INFORMATION32 = _MEMORY_BASIC_INFORMATION32;
  574.   {$EXTERNALSYM MEMORY_BASIC_INFORMATION32}
  575.   TMemoryBasicInformation32 = MEMORY_BASIC_INFORMATION32;
  576.   PMemoryBasicInformation32 = PMEMORY_BASIC_INFORMATION32;
  577.   PMEMORY_BASIC_INFORMATION64 = ^MEMORY_BASIC_INFORMATION64;
  578.   {$EXTERNALSYM PMEMORY_BASIC_INFORMATION64}
  579.   _MEMORY_BASIC_INFORMATION64 = record
  580.     BaseAddress: ULONGLONG;
  581.     AllocationBase: ULONGLONG;
  582.     AllocationProtect: DWORD;
  583.     __alignment1: DWORD;
  584.     RegionSize: ULONGLONG;
  585.     State: DWORD;
  586.     Protect: DWORD;
  587.     Type_: DWORD;
  588.     __alignment2: DWORD;
  589.   end;
  590.   {$EXTERNALSYM _MEMORY_BASIC_INFORMATION64}
  591.   MEMORY_BASIC_INFORMATION64 = _MEMORY_BASIC_INFORMATION64;
  592.   {$EXTERNALSYM MEMORY_BASIC_INFORMATION64}
  593.   TMemoryBasicInformation64 = MEMORY_BASIC_INFORMATION64;
  594.   PMemoryBasicInformation64 = PMEMORY_BASIC_INFORMATION64;
  595. const
  596.   SECTION_QUERY       = $0001;
  597.   {$EXTERNALSYM SECTION_QUERY}
  598.   SECTION_MAP_WRITE   = $0002;
  599.   {$EXTERNALSYM SECTION_MAP_WRITE}
  600.   SECTION_MAP_READ    = $0004;
  601.   {$EXTERNALSYM SECTION_MAP_READ}
  602.   SECTION_MAP_EXECUTE = $0008;
  603.   {$EXTERNALSYM SECTION_MAP_EXECUTE}
  604.   SECTION_EXTEND_SIZE = $0010;
  605.   {$EXTERNALSYM SECTION_EXTEND_SIZE}
  606.   SECTION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SECTION_QUERY or
  607.     SECTION_MAP_WRITE or SECTION_MAP_READ or SECTION_MAP_EXECUTE or
  608.     SECTION_EXTEND_SIZE);
  609.   {$EXTERNALSYM SECTION_ALL_ACCESS}
  610.   PAGE_NOACCESS          = $01;
  611.   {$EXTERNALSYM PAGE_NOACCESS}
  612.   PAGE_READONLY          = $02;
  613.   {$EXTERNALSYM PAGE_READONLY}
  614.   PAGE_READWRITE         = $04;
  615.   {$EXTERNALSYM PAGE_READWRITE}
  616.   PAGE_WRITECOPY         = $08;
  617.   {$EXTERNALSYM PAGE_WRITECOPY}
  618.   PAGE_EXECUTE           = $10;
  619.   {$EXTERNALSYM PAGE_EXECUTE}
  620.   PAGE_EXECUTE_READ      = $20;
  621.   {$EXTERNALSYM PAGE_EXECUTE_READ}
  622.   PAGE_EXECUTE_READWRITE = $40;
  623.   {$EXTERNALSYM PAGE_EXECUTE_READWRITE}
  624.   PAGE_EXECUTE_WRITECOPY = $80;
  625.   {$EXTERNALSYM PAGE_EXECUTE_WRITECOPY}
  626.   PAGE_GUARD             = $100;
  627.   {$EXTERNALSYM PAGE_GUARD}
  628.   PAGE_NOCACHE           = $200;
  629.   {$EXTERNALSYM PAGE_NOCACHE}
  630.   PAGE_WRITECOMBINE      = $400;
  631.   {$EXTERNALSYM PAGE_WRITECOMBINE}
  632.   MEM_COMMIT             = $1000;
  633.   {$EXTERNALSYM MEM_COMMIT}
  634.   MEM_RESERVE            = $2000;
  635.   {$EXTERNALSYM MEM_RESERVE}
  636.   MEM_DECOMMIT           = $4000;
  637.   {$EXTERNALSYM MEM_DECOMMIT}
  638.   MEM_RELEASE            = $8000;
  639.   {$EXTERNALSYM MEM_RELEASE}
  640.   MEM_FREE               = $10000;
  641.   {$EXTERNALSYM MEM_FREE}
  642.   MEM_PRIVATE            = $20000;
  643.   {$EXTERNALSYM MEM_PRIVATE}
  644.   MEM_MAPPED             = $40000;
  645.   {$EXTERNALSYM MEM_MAPPED}
  646.   MEM_RESET              = $80000;
  647.   {$EXTERNALSYM MEM_RESET}
  648.   MEM_TOP_DOWN           = $100000;
  649.   {$EXTERNALSYM MEM_TOP_DOWN}
  650.   MEM_WRITE_WATCH        = $200000;
  651.   {$EXTERNALSYM MEM_WRITE_WATCH}
  652.   MEM_PHYSICAL           = $400000;
  653.   {$EXTERNALSYM MEM_PHYSICAL}
  654.   MEM_LARGE_PAGES        = $20000000;
  655.   {$EXTERNALSYM MEM_LARGE_PAGES}
  656.   MEM_4MB_PAGES          = DWORD($80000000);
  657.   {$EXTERNALSYM MEM_4MB_PAGES}
  658.   SEC_FILE               = $800000;
  659.   {$EXTERNALSYM SEC_FILE}
  660.   SEC_IMAGE              = $1000000;
  661.   {$EXTERNALSYM SEC_IMAGE}
  662.   SEC_RESERVE            = $4000000;
  663.   {$EXTERNALSYM SEC_RESERVE}
  664.   SEC_COMMIT             = DWORD($8000000);
  665.   {$EXTERNALSYM SEC_COMMIT}
  666.   SEC_NOCACHE            = $10000000;
  667.   {$EXTERNALSYM SEC_NOCACHE}
  668.   MEM_IMAGE              = SEC_IMAGE;
  669.   {$EXTERNALSYM MEM_IMAGE}
  670.   WRITE_WATCH_FLAG_RESET = $01;
  671.   {$EXTERNALSYM WRITE_WATCH_FLAG_RESET}
  672. //
  673. // Define access rights to files and directories
  674. //
  675. //
  676. // The FILE_READ_DATA and FILE_WRITE_DATA constants are also defined in
  677. // devioctl.h as FILE_READ_ACCESS and FILE_WRITE_ACCESS. The values for these
  678. // constants *MUST* always be in sync.
  679. // The values are redefined in devioctl.h because they must be available to
  680. // both DOS and NT.
  681. //
  682.   FILE_READ_DATA            = ($0001); // file & pipe
  683.   {$EXTERNALSYM FILE_READ_DATA}
  684.   FILE_LIST_DIRECTORY       = ($0001); // directory
  685.   {$EXTERNALSYM FILE_LIST_DIRECTORY}
  686.   FILE_WRITE_DATA           = ($0002); // file & pipe
  687.   {$EXTERNALSYM FILE_WRITE_DATA}
  688.   FILE_ADD_FILE             = ($0002); // directory
  689.   {$EXTERNALSYM FILE_ADD_FILE}
  690.   FILE_APPEND_DATA          = ($0004); // file
  691.   {$EXTERNALSYM FILE_APPEND_DATA}
  692.   FILE_ADD_SUBDIRECTORY     = ($0004); // directory
  693.   {$EXTERNALSYM FILE_ADD_SUBDIRECTORY}
  694.   FILE_CREATE_PIPE_INSTANCE = ($0004); // named pipe
  695.   {$EXTERNALSYM FILE_CREATE_PIPE_INSTANCE}
  696.   FILE_READ_EA = ($0008); // file & directory
  697.   {$EXTERNALSYM FILE_READ_EA}
  698.   FILE_WRITE_EA = ($0010); // file & directory
  699.   {$EXTERNALSYM FILE_WRITE_EA}
  700.   FILE_EXECUTE = ($0020); // file
  701.   {$EXTERNALSYM FILE_EXECUTE}
  702.   FILE_TRAVERSE = ($0020); // directory
  703.   {$EXTERNALSYM FILE_TRAVERSE}
  704.   FILE_DELETE_CHILD = ($0040); // directory
  705.   {$EXTERNALSYM FILE_DELETE_CHILD}
  706.   FILE_READ_ATTRIBUTES = ($0080); // all
  707.   {$EXTERNALSYM FILE_READ_ATTRIBUTES}
  708.   FILE_WRITE_ATTRIBUTES = ($0100); // all
  709.   {$EXTERNALSYM FILE_WRITE_ATTRIBUTES}
  710.   FILE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or $1FF);
  711.   {$EXTERNALSYM FILE_ALL_ACCESS}
  712.   FILE_GENERIC_READ = (STANDARD_RIGHTS_READ or FILE_READ_DATA or
  713.     FILE_READ_ATTRIBUTES or FILE_READ_EA or SYNCHRONIZE);
  714.   {$EXTERNALSYM FILE_GENERIC_READ}
  715.   FILE_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE or FILE_WRITE_DATA or
  716.     FILE_WRITE_ATTRIBUTES or FILE_WRITE_EA or FILE_APPEND_DATA or SYNCHRONIZE);
  717.   {$EXTERNALSYM FILE_GENERIC_WRITE}
  718.   FILE_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE or FILE_READ_ATTRIBUTES or
  719.     FILE_EXECUTE or SYNCHRONIZE);
  720.   {$EXTERNALSYM FILE_GENERIC_EXECUTE}
  721.   FILE_SHARE_READ                    = $00000001;
  722.   {$EXTERNALSYM FILE_SHARE_READ}
  723.   FILE_SHARE_WRITE                   = $00000002;
  724.   {$EXTERNALSYM FILE_SHARE_WRITE}
  725.   FILE_SHARE_DELETE                  = $00000004;
  726.   {$EXTERNALSYM FILE_SHARE_DELETE}
  727.   FILE_ATTRIBUTE_READONLY            = $00000001;
  728.   {$EXTERNALSYM FILE_ATTRIBUTE_READONLY}
  729.   FILE_ATTRIBUTE_HIDDEN              = $00000002;
  730.   {$EXTERNALSYM FILE_ATTRIBUTE_HIDDEN}
  731.   FILE_ATTRIBUTE_SYSTEM              = $00000004;
  732.   {$EXTERNALSYM FILE_ATTRIBUTE_SYSTEM}
  733.   FILE_ATTRIBUTE_DIRECTORY           = $00000010;
  734.   {$EXTERNALSYM FILE_ATTRIBUTE_DIRECTORY}
  735.   FILE_ATTRIBUTE_ARCHIVE             = $00000020;
  736.   {$EXTERNALSYM FILE_ATTRIBUTE_ARCHIVE}
  737.   FILE_ATTRIBUTE_DEVICE              = $00000040;
  738.   {$EXTERNALSYM FILE_ATTRIBUTE_DEVICE}
  739.   FILE_ATTRIBUTE_NORMAL              = $00000080;
  740.   {$EXTERNALSYM FILE_ATTRIBUTE_NORMAL}
  741.   FILE_ATTRIBUTE_TEMPORARY           = $00000100;
  742.   {$EXTERNALSYM FILE_ATTRIBUTE_TEMPORARY}
  743.   FILE_ATTRIBUTE_SPARSE_FILE         = $00000200;
  744.   {$EXTERNALSYM FILE_ATTRIBUTE_SPARSE_FILE}
  745.   FILE_ATTRIBUTE_REPARSE_POINT       = $00000400;
  746.   {$EXTERNALSYM FILE_ATTRIBUTE_REPARSE_POINT}
  747.   FILE_ATTRIBUTE_COMPRESSED          = $00000800;
  748.   {$EXTERNALSYM FILE_ATTRIBUTE_COMPRESSED}
  749.   FILE_ATTRIBUTE_OFFLINE             = $00001000;
  750.   {$EXTERNALSYM FILE_ATTRIBUTE_OFFLINE}
  751.   FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = $00002000;
  752.   {$EXTERNALSYM FILE_ATTRIBUTE_NOT_CONTENT_INDEXED}
  753.   FILE_ATTRIBUTE_ENCRYPTED           = $00004000;
  754.   {$EXTERNALSYM FILE_ATTRIBUTE_ENCRYPTED}
  755.   FILE_NOTIFY_CHANGE_FILE_NAME       = $00000001;
  756.   {$EXTERNALSYM FILE_NOTIFY_CHANGE_FILE_NAME}
  757.   FILE_NOTIFY_CHANGE_DIR_NAME        = $00000002;
  758.   {$EXTERNALSYM FILE_NOTIFY_CHANGE_DIR_NAME}
  759.   FILE_NOTIFY_CHANGE_ATTRIBUTES      = $00000004;
  760.   {$EXTERNALSYM FILE_NOTIFY_CHANGE_ATTRIBUTES}
  761.   FILE_NOTIFY_CHANGE_SIZE            = $00000008;
  762.   {$EXTERNALSYM FILE_NOTIFY_CHANGE_SIZE}
  763.   FILE_NOTIFY_CHANGE_LAST_WRITE      = $00000010;
  764.   {$EXTERNALSYM FILE_NOTIFY_CHANGE_LAST_WRITE}
  765.   FILE_NOTIFY_CHANGE_LAST_ACCESS     = $00000020;
  766.   {$EXTERNALSYM FILE_NOTIFY_CHANGE_LAST_ACCESS}
  767.   FILE_NOTIFY_CHANGE_CREATION        = $00000040;
  768.   {$EXTERNALSYM FILE_NOTIFY_CHANGE_CREATION}
  769.   FILE_NOTIFY_CHANGE_SECURITY        = $00000100;
  770.   {$EXTERNALSYM FILE_NOTIFY_CHANGE_SECURITY}
  771.   FILE_ACTION_ADDED                  = $00000001;
  772.   {$EXTERNALSYM FILE_ACTION_ADDED}
  773.   FILE_ACTION_REMOVED                = $00000002;
  774.   {$EXTERNALSYM FILE_ACTION_REMOVED}
  775.   FILE_ACTION_MODIFIED               = $00000003;
  776.   {$EXTERNALSYM FILE_ACTION_MODIFIED}
  777.   FILE_ACTION_RENAMED_OLD_NAME       = $00000004;
  778.   {$EXTERNALSYM FILE_ACTION_RENAMED_OLD_NAME}
  779.   FILE_ACTION_RENAMED_NEW_NAME       = $00000005;
  780.   {$EXTERNALSYM FILE_ACTION_RENAMED_NEW_NAME}
  781.   MAILSLOT_NO_MESSAGE                = DWORD(-1);
  782.   {$EXTERNALSYM MAILSLOT_NO_MESSAGE}
  783.   MAILSLOT_WAIT_FOREVER              = DWORD(-1);
  784.   {$EXTERNALSYM MAILSLOT_WAIT_FOREVER}
  785.   FILE_CASE_SENSITIVE_SEARCH         = $00000001;
  786.   {$EXTERNALSYM FILE_CASE_SENSITIVE_SEARCH}
  787.   FILE_CASE_PRESERVED_NAMES          = $00000002;
  788.   {$EXTERNALSYM FILE_CASE_PRESERVED_NAMES}
  789.   FILE_UNICODE_ON_DISK               = $00000004;
  790.   {$EXTERNALSYM FILE_UNICODE_ON_DISK}
  791.   FILE_PERSISTENT_ACLS               = $00000008;
  792.   {$EXTERNALSYM FILE_PERSISTENT_ACLS}
  793.   FILE_FILE_COMPRESSION              = $00000010;
  794.   {$EXTERNALSYM FILE_FILE_COMPRESSION}
  795.   FILE_VOLUME_QUOTAS                 = $00000020;
  796.   {$EXTERNALSYM FILE_VOLUME_QUOTAS}
  797.   FILE_SUPPORTS_SPARSE_FILES         = $00000040;
  798.   {$EXTERNALSYM FILE_SUPPORTS_SPARSE_FILES}
  799.   FILE_SUPPORTS_REPARSE_POINTS       = $00000080;
  800.   {$EXTERNALSYM FILE_SUPPORTS_REPARSE_POINTS}
  801.   FILE_SUPPORTS_REMOTE_STORAGE       = $00000100;
  802.   {$EXTERNALSYM FILE_SUPPORTS_REMOTE_STORAGE}
  803.   FILE_VOLUME_IS_COMPRESSED          = $00008000;
  804.   {$EXTERNALSYM FILE_VOLUME_IS_COMPRESSED}
  805.   FILE_SUPPORTS_OBJECT_IDS           = $00010000;
  806.   {$EXTERNALSYM FILE_SUPPORTS_OBJECT_IDS}
  807.   FILE_SUPPORTS_ENCRYPTION           = $00020000;
  808.   {$EXTERNALSYM FILE_SUPPORTS_ENCRYPTION}
  809.   FILE_NAMED_STREAMS                 = $00040000;
  810.   {$EXTERNALSYM FILE_NAMED_STREAMS}
  811.   FILE_READ_ONLY_VOLUME              = $00080000;
  812.   {$EXTERNALSYM FILE_READ_ONLY_VOLUME}
  813. //
  814. // Define the file notification information structure
  815. //
  816. type
  817.   PFILE_NOTIFY_INFORMATION = ^FILE_NOTIFY_INFORMATION;
  818.   {$EXTERNALSYM PFILE_NOTIFY_INFORMATION}
  819.   _FILE_NOTIFY_INFORMATION = record
  820.     NextEntryOffset: DWORD;
  821.     Action: DWORD;
  822.     FileNameLength: DWORD;
  823.     FileName: array [0..0] of WCHAR;
  824.   end;
  825.   {$EXTERNALSYM _FILE_NOTIFY_INFORMATION}
  826.   FILE_NOTIFY_INFORMATION = _FILE_NOTIFY_INFORMATION;
  827.   {$EXTERNALSYM FILE_NOTIFY_INFORMATION}
  828.   TFileNotifyInformation = FILE_NOTIFY_INFORMATION;
  829.   PFileNotifyInformation = PFILE_NOTIFY_INFORMATION;
  830. //
  831. // Define segement buffer structure for scatter/gather read/write.
  832. //
  833. type
  834.   PFILE_SEGMENT_ELEMENT = ^FILE_SEGMENT_ELEMENT;
  835.   {$EXTERNALSYM PFILE_SEGMENT_ELEMENT}
  836.   _FILE_SEGMENT_ELEMENT = record
  837.     case Integer of
  838.       0: (Buffer: PVOID64);
  839.       1: (Alignment: ULONGLONG);
  840.   end;
  841.   {$EXTERNALSYM _FILE_SEGMENT_ELEMENT}
  842.   FILE_SEGMENT_ELEMENT = _FILE_SEGMENT_ELEMENT;
  843.   {$EXTERNALSYM FILE_SEGMENT_ELEMENT}
  844.   TFileSegmentElement = FILE_SEGMENT_ELEMENT;
  845.   PFileSegmentElement = PFILE_SEGMENT_ELEMENT;
  846. //
  847. // The reparse GUID structure is used by all 3rd party layered drivers to
  848. // store data in a reparse point. For non-Microsoft tags, The GUID field
  849. // cannot be GUID_NULL.
  850. // The constraints on reparse tags are defined below.
  851. // Microsoft tags can also be used with this format of the reparse point buffer.
  852. //
  853.   TGenericReparseBuffer = record
  854.     DataBuffer: array [0..0] of BYTE;
  855.   end;
  856.   PREPARSE_GUID_DATA_BUFFER = ^REPARSE_GUID_DATA_BUFFER;
  857.   {$EXTERNALSYM PREPARSE_GUID_DATA_BUFFER}
  858.   _REPARSE_GUID_DATA_BUFFER = record
  859.     ReparseTag: DWORD;
  860.     ReparseDataLength: WORD;
  861.     Reserved: WORD;
  862.     ReparseGuid: GUID;
  863.     GenericReparseBuffer: TGenericReparseBuffer;
  864.   end;
  865.   {$EXTERNALSYM _REPARSE_GUID_DATA_BUFFER}
  866.   REPARSE_GUID_DATA_BUFFER = _REPARSE_GUID_DATA_BUFFER;
  867.   {$EXTERNALSYM REPARSE_GUID_DATA_BUFFER}
  868.   TReparseGuidDataBuffer = REPARSE_GUID_DATA_BUFFER;
  869.   PReparseGuidDataBuffer = PREPARSE_GUID_DATA_BUFFER;
  870. const
  871.   REPARSE_GUID_DATA_BUFFER_HEADER_SIZE = 24;
  872.   {$EXTERNALSYM REPARSE_GUID_DATA_BUFFER_HEADER_SIZE}
  873. //
  874. // Maximum allowed size of the reparse data.
  875. //
  876. const
  877.   MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16 * 1024;
  878.   {$EXTERNALSYM MAXIMUM_REPARSE_DATA_BUFFER_SIZE}
  879. //
  880. // Predefined reparse tags.
  881. // These tags need to avoid conflicting with IO_REMOUNT defined in ntosincio.h
  882. //
  883.   IO_REPARSE_TAG_RESERVED_ZERO = (0);
  884.   {$EXTERNALSYM IO_REPARSE_TAG_RESERVED_ZERO}
  885.   IO_REPARSE_TAG_RESERVED_ONE  = (1);
  886.   {$EXTERNALSYM IO_REPARSE_TAG_RESERVED_ONE}
  887. //
  888. // The value of the following constant needs to satisfy the following conditions:
  889. //  (1) Be at least as large as the largest of the reserved tags.
  890. //  (2) Be strictly smaller than all the tags in use.
  891. //
  892.   IO_REPARSE_TAG_RESERVED_RANGE = IO_REPARSE_TAG_RESERVED_ONE;
  893.   {$EXTERNALSYM IO_REPARSE_TAG_RESERVED_RANGE}
  894. //
  895. // The reparse tags are a DWORD. The 32 bits are laid out as follows:
  896. //
  897. //   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  898. //   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  899. //  +-+-+-+-+-----------------------+-------------------------------+
  900. //  |M|R|N|R|     Reserved bits     |       Reparse Tag Value       |
  901. //  +-+-+-+-+-----------------------+-------------------------------+
  902. //
  903. // M is the Microsoft bit. When set to 1, it denotes a tag owned by Microsoft.
  904. //   All ISVs must use a tag with a 0 in this position.
  905. //   Note: If a Microsoft tag is used by non-Microsoft software, the
  906. //   behavior is not defined.
  907. //
  908. // R is reserved.  Must be zero for non-Microsoft tags.
  909. //
  910. // N is name surrogate. When set to 1, the file represents another named
  911. //   entity in the system.
  912. //
  913. // The M and N bits are OR-able.
  914. // The following macros check for the M and N bit values:
  915. //
  916. //
  917. // Macro to determine whether a reparse point tag corresponds to a tag
  918. // owned by Microsoft.
  919. //
  920. function IsReparseTagMicrosoft(Tag: ULONG): Boolean;
  921. {$EXTERNALSYM IsReparseTagMicrosoft}
  922. //
  923. // Macro to determine whether a reparse point tag corresponds to a file
  924. // that is to be displayed with the slow icon overlay.
  925. //
  926. function IsReparseTagHighLatency(Tag: ULONG): Boolean;
  927. {$EXTERNALSYM IsReparseTagHighLatency}
  928. //
  929. // Macro to determine whether a reparse point tag is a name surrogate
  930. //
  931. function IsReparseTagNameSurrogate(Tag: ULONG): Boolean;
  932. {$EXTERNALSYM IsReparseTagNameSurrogate}
  933. const
  934.   IO_REPARSE_TAG_MOUNT_POINT = DWORD($A0000003);
  935.   {$EXTERNALSYM IO_REPARSE_TAG_MOUNT_POINT}
  936.   IO_REPARSE_TAG_HSM         = DWORD($C0000004);
  937.   {$EXTERNALSYM IO_REPARSE_TAG_HSM}
  938.   IO_REPARSE_TAG_SIS         = DWORD($80000007);
  939.   {$EXTERNALSYM IO_REPARSE_TAG_SIS}
  940.   IO_REPARSE_TAG_DFS         = DWORD($8000000A);
  941.   {$EXTERNALSYM IO_REPARSE_TAG_DFS}
  942.   IO_REPARSE_TAG_FILTER_MANAGER = DWORD($8000000B);
  943.   {$EXTERNALSYM IO_REPARSE_TAG_FILTER_MANAGER}
  944.   IO_COMPLETION_MODIFY_STATE = $0002;
  945.   {$EXTERNALSYM IO_COMPLETION_MODIFY_STATE}
  946.   IO_COMPLETION_ALL_ACCESS   = DWORD(STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or $3);
  947.   {$EXTERNALSYM IO_COMPLETION_ALL_ACCESS}
  948.   DUPLICATE_CLOSE_SOURCE     = $00000001;
  949.   {$EXTERNALSYM DUPLICATE_CLOSE_SOURCE}
  950.   DUPLICATE_SAME_ACCESS      = $00000002;
  951.   {$EXTERNALSYM DUPLICATE_SAME_ACCESS}
  952. type
  953.   _SYSTEM_POWER_STATE = (
  954.     PowerSystemUnspecified,
  955.     PowerSystemWorking,
  956.     PowerSystemSleeping1,
  957.     PowerSystemSleeping2,
  958.     PowerSystemSleeping3,
  959.     PowerSystemHibernate,
  960.     PowerSystemShutdown,
  961.     PowerSystemMaximum);
  962.   {$EXTERNALSYM _SYSTEM_POWER_STATE}
  963.   SYSTEM_POWER_STATE = _SYSTEM_POWER_STATE;
  964.   {$EXTERNALSYM SYSTEM_POWER_STATE}
  965.   PSYSTEM_POWER_STATE = ^SYSTEM_POWER_STATE;
  966.   {$EXTERNALSYM PSYSTEM_POWER_STATE}
  967.   TSystemPowerState = SYSTEM_POWER_STATE;
  968.   PSystemPowerState = PSYSTEM_POWER_STATE;
  969. const
  970.   POWER_SYSTEM_MAXIMUM = 7;
  971.   {$EXTERNALSYM POWER_SYSTEM_MAXIMUM}
  972. type
  973.   POWER_ACTION = (
  974.     PowerActionNone,
  975.     PowerActionReserved,
  976.     PowerActionSleep,
  977.     PowerActionHibernate,
  978.     PowerActionShutdown,
  979.     PowerActionShutdownReset,
  980.     PowerActionShutdownOff,
  981.     PowerActionWarmEject);
  982.   {$EXTERNALSYM POWER_ACTION}
  983.   PPOWER_ACTION = ^POWER_ACTION;
  984.   {$EXTERNALSYM PPOWER_ACTION}
  985.   TPowerAction = POWER_ACTION;
  986.   PPowerAction = PPOWER_ACTION;
  987.   _DEVICE_POWER_STATE = (
  988.     PowerDeviceUnspecified,
  989.     PowerDeviceD0,
  990.     PowerDeviceD1,
  991.     PowerDeviceD2,
  992.     PowerDeviceD3,
  993.     PowerDeviceMaximum);
  994.   {$EXTERNALSYM _DEVICE_POWER_STATE}
  995.   DEVICE_POWER_STATE = _DEVICE_POWER_STATE;
  996.   {$EXTERNALSYM DEVICE_POWER_STATE}
  997.   PDEVICE_POWER_STATE = ^DEVICE_POWER_STATE;
  998.   {$EXTERNALSYM PDEVICE_POWER_STATE}
  999.   TDevicePowerState = DEVICE_POWER_STATE;
  1000.   PDevicePowerState = PDEVICE_POWER_STATE;
  1001. const
  1002.   ES_SYSTEM_REQUIRED  = DWORD($00000001);
  1003.   {$EXTERNALSYM ES_SYSTEM_REQUIRED}
  1004.   ES_DISPLAY_REQUIRED = DWORD($00000002);
  1005.   {$EXTERNALSYM ES_DISPLAY_REQUIRED}
  1006.   ES_USER_PRESENT     = DWORD($00000004);
  1007.   {$EXTERNALSYM ES_USER_PRESENT}
  1008.   ES_CONTINUOUS       = DWORD($80000000);
  1009.   {$EXTERNALSYM ES_CONTINUOUS}
  1010. type
  1011.   EXECUTION_STATE = DWORD;
  1012.   {$EXTERNALSYM EXECUTION_STATE}
  1013.   LATENCY_TIME = (LT_DONT_CARE, LT_LOWEST_LATENCY);
  1014.   {$EXTERNALSYM LATENCY_TIME}
  1015.   TLatencyTime = LATENCY_TIME;
  1016. //-----------------------------------------------------------------------------
  1017. // Device Power Information
  1018. // Accessable via CM_Get_DevInst_Registry_Property_Ex(CM_DRP_DEVICE_POWER_DATA)
  1019. //-----------------------------------------------------------------------------
  1020. const
  1021.   PDCAP_D0_SUPPORTED           = $00000001;
  1022.   {$EXTERNALSYM PDCAP_D0_SUPPORTED}
  1023.   PDCAP_D1_SUPPORTED           = $00000002;
  1024.   {$EXTERNALSYM PDCAP_D1_SUPPORTED}
  1025.   PDCAP_D2_SUPPORTED           = $00000004;
  1026.   {$EXTERNALSYM PDCAP_D2_SUPPORTED}
  1027.   PDCAP_D3_SUPPORTED           = $00000008;
  1028.   {$EXTERNALSYM PDCAP_D3_SUPPORTED}
  1029.   PDCAP_WAKE_FROM_D0_SUPPORTED = $00000010;
  1030.   {$EXTERNALSYM PDCAP_WAKE_FROM_D0_SUPPORTED}
  1031.   PDCAP_WAKE_FROM_D1_SUPPORTED = $00000020;
  1032.   {$EXTERNALSYM PDCAP_WAKE_FROM_D1_SUPPORTED}
  1033.   PDCAP_WAKE_FROM_D2_SUPPORTED = $00000040;
  1034.   {$EXTERNALSYM PDCAP_WAKE_FROM_D2_SUPPORTED}
  1035.   PDCAP_WAKE_FROM_D3_SUPPORTED = $00000080;
  1036.   {$EXTERNALSYM PDCAP_WAKE_FROM_D3_SUPPORTED}
  1037.   PDCAP_WARM_EJECT_SUPPORTED   = $00000100;
  1038.   {$EXTERNALSYM PDCAP_WARM_EJECT_SUPPORTED}
  1039. type
  1040.   CM_Power_Data_s = record
  1041.     PD_Size: DWORD;
  1042.     PD_MostRecentPowerState: DEVICE_POWER_STATE;
  1043.     PD_Capabilities: DWORD;
  1044.     PD_D1Latency: DWORD;
  1045.     PD_D2Latency: DWORD;
  1046.     PD_D3Latency: DWORD;
  1047.     PD_PowerStateMapping: array [0..POWER_SYSTEM_MAXIMUM - 1] of DEVICE_POWER_STATE;
  1048.     PD_DeepestSystemWake: SYSTEM_POWER_STATE;
  1049.   end;
  1050.   {$EXTERNALSYM CM_Power_Data_s}
  1051.   CM_POWER_DATA = CM_Power_Data_s;
  1052.   {$EXTERNALSYM CM_POWER_DATA}
  1053.   PCM_POWER_DATA = ^CM_POWER_DATA;
  1054.   {$EXTERNALSYM PCM_POWER_DATA}
  1055.   TCmPowerData = CM_POWER_DATA;
  1056.   PCmPowerData = PCM_POWER_DATA;
  1057.   POWER_INFORMATION_LEVEL = (
  1058.     SystemPowerPolicyAc,
  1059.     SystemPowerPolicyDc,
  1060.     VerifySystemPolicyAc,
  1061.     VerifySystemPolicyDc,
  1062.     SystemPowerCapabilities,
  1063.     SystemBatteryState,
  1064.     SystemPowerStateHandler,
  1065.     ProcessorStateHandler,
  1066.     SystemPowerPolicyCurrent,
  1067.     AdministratorPowerPolicy,
  1068.     SystemReserveHiberFile,
  1069.     ProcessorInformation,
  1070.     SystemPowerInformation,
  1071.     ProcessorStateHandler2,
  1072.     LastWakeTime,                                   // Compare with KeQueryInterruptTime()
  1073.     LastSleepTime,                                  // Compare with KeQueryInterruptTime()
  1074.     SystemExecutionState,
  1075.     SystemPowerStateNotifyHandler,
  1076.     ProcessorPowerPolicyAc,
  1077.     ProcessorPowerPolicyDc,
  1078.     VerifyProcessorPowerPolicyAc,
  1079.     VerifyProcessorPowerPolicyDc,
  1080.     ProcessorPowerPolicyCurrent,
  1081.     SystemPowerStateLogging,
  1082.     SystemPowerLoggingEntry);
  1083.   {$EXTERNALSYM POWER_INFORMATION_LEVEL}
  1084.   TPowerInformationLevel = POWER_INFORMATION_LEVEL;
  1085. //
  1086. // System power manager capabilities
  1087. //
  1088.   BATTERY_REPORTING_SCALE = record
  1089.     Granularity: DWORD;
  1090.     Capacity: DWORD;
  1091.   end;
  1092.   {$EXTERNALSYM BATTERY_REPORTING_SCALE}
  1093.   PBATTERY_REPORTING_SCALE = ^BATTERY_REPORTING_SCALE;
  1094.   {$EXTERNALSYM PBATTERY_REPORTING_SCALE}
  1095.   TBatteryReportingScale = BATTERY_REPORTING_SCALE;
  1096.   PBatteryReportingScale = PBATTERY_REPORTING_SCALE;
  1097. // Power Policy Management interfaces
  1098. //
  1099.   PPOWER_ACTION_POLICY = ^POWER_ACTION_POLICY;
  1100.   {$EXTERNALSYM PPOWER_ACTION_POLICY}
  1101.   POWER_ACTION_POLICY = record
  1102.     Action: POWER_ACTION;
  1103.     Flags: DWORD;
  1104.     EventCode: DWORD;
  1105.   end;
  1106.   {$EXTERNALSYM POWER_ACTION_POLICY}
  1107.   TPowerActionPolicy = POWER_ACTION_POLICY;
  1108.   PPowerActionPolicy = PPOWER_ACTION_POLICY;
  1109. // POWER_ACTION_POLICY->Flags:
  1110. const
  1111.   POWER_ACTION_QUERY_ALLOWED  = $00000001;
  1112.   {$EXTERNALSYM POWER_ACTION_QUERY_ALLOWED}
  1113.   POWER_ACTION_UI_ALLOWED     = $00000002;
  1114.   {$EXTERNALSYM POWER_ACTION_UI_ALLOWED}
  1115.   POWER_ACTION_OVERRIDE_APPS  = $00000004;
  1116.   {$EXTERNALSYM POWER_ACTION_OVERRIDE_APPS}
  1117.   POWER_ACTION_LIGHTEST_FIRST = $10000000;
  1118.   {$EXTERNALSYM POWER_ACTION_LIGHTEST_FIRST}
  1119.   POWER_ACTION_LOCK_CONSOLE   = $20000000;
  1120.   {$EXTERNALSYM POWER_ACTION_LOCK_CONSOLE}
  1121.   POWER_ACTION_DISABLE_WAKES  = $40000000;
  1122.   {$EXTERNALSYM POWER_ACTION_DISABLE_WAKES}
  1123.   POWER_ACTION_CRITICAL       = DWORD($80000000);
  1124.   {$EXTERNALSYM POWER_ACTION_CRITICAL}
  1125. // POWER_ACTION_POLICY->EventCode flags
  1126.   POWER_LEVEL_USER_NOTIFY_TEXT  = $00000001;
  1127.   {$EXTERNALSYM POWER_LEVEL_USER_NOTIFY_TEXT}
  1128.   POWER_LEVEL_USER_NOTIFY_SOUND = $00000002;
  1129.   {$EXTERNALSYM POWER_LEVEL_USER_NOTIFY_SOUND}
  1130.   POWER_LEVEL_USER_NOTIFY_EXEC  = $00000004;
  1131.   {$EXTERNALSYM POWER_LEVEL_USER_NOTIFY_EXEC}
  1132.   POWER_USER_NOTIFY_BUTTON      = $00000008;
  1133.   {$EXTERNALSYM POWER_USER_NOTIFY_BUTTON}
  1134.   POWER_USER_NOTIFY_SHUTDOWN    = $00000010;
  1135.   {$EXTERNALSYM POWER_USER_NOTIFY_SHUTDOWN}
  1136.   POWER_FORCE_TRIGGER_RESET     = DWORD($80000000);
  1137.   {$EXTERNALSYM POWER_FORCE_TRIGGER_RESET}
  1138. // system battery drain policies
  1139. type
  1140.   PSYSTEM_POWER_LEVEL = ^SYSTEM_POWER_LEVEL;
  1141.   {$EXTERNALSYM PSYSTEM_POWER_LEVEL}
  1142.   SYSTEM_POWER_LEVEL = record
  1143.     Enable: BOOLEAN;
  1144.     Spare: array [0..3 - 1] of BYTE;
  1145.     BatteryLevel: DWORD;
  1146.     PowerPolicy: POWER_ACTION_POLICY;
  1147.     MinSystemState: SYSTEM_POWER_STATE;
  1148.   end;
  1149.   {$EXTERNALSYM SYSTEM_POWER_LEVEL}
  1150.   TSystemPowerLevel = SYSTEM_POWER_LEVEL;
  1151.   PSystemPowerLevel = PSYSTEM_POWER_LEVEL;
  1152. // Discharge policy constants
  1153. const
  1154.   NUM_DISCHARGE_POLICIES    = 4;
  1155.   {$EXTERNALSYM NUM_DISCHARGE_POLICIES}
  1156.   DISCHARGE_POLICY_CRITICAL = 0;
  1157.   {$EXTERNALSYM DISCHARGE_POLICY_CRITICAL}
  1158.   DISCHARGE_POLICY_LOW      = 1;
  1159.   {$EXTERNALSYM DISCHARGE_POLICY_LOW}
  1160. //
  1161. // Throttling policies
  1162. //
  1163.   PO_THROTTLE_NONE     = 0;
  1164.   {$EXTERNALSYM PO_THROTTLE_NONE}
  1165.   PO_THROTTLE_CONSTANT = 1;
  1166.   {$EXTERNALSYM PO_THROTTLE_CONSTANT}
  1167.   PO_THROTTLE_DEGRADE  = 2;
  1168.   {$EXTERNALSYM PO_THROTTLE_DEGRADE}
  1169.   PO_THROTTLE_ADAPTIVE = 3;
  1170.   {$EXTERNALSYM PO_THROTTLE_ADAPTIVE}
  1171.   PO_THROTTLE_MAXIMUM  = 4; // not a policy, just a limit
  1172.   {$EXTERNALSYM PO_THROTTLE_MAXIMUM}
  1173. // system power policies
  1174. type
  1175.   PSYSTEM_POWER_POLICY = ^SYSTEM_POWER_POLICY;
  1176.   {$EXTERNALSYM PSYSTEM_POWER_POLICY}
  1177.   _SYSTEM_POWER_POLICY = record
  1178.     Revision: DWORD; // 1
  1179.     // events
  1180.     PowerButton: POWER_ACTION_POLICY;
  1181.     SleepButton: POWER_ACTION_POLICY;
  1182.     LidClose: POWER_ACTION_POLICY;
  1183.     LidOpenWake: SYSTEM_POWER_STATE;
  1184.     Reserved: DWORD;
  1185.     // "system idle" detection
  1186.     Idle: POWER_ACTION_POLICY;
  1187.     IdleTimeout: DWORD;
  1188.     IdleSensitivity: BYTE;
  1189.     // dynamic throttling policy
  1190.     //      PO_THROTTLE_NONE, PO_THROTTLE_CONSTANT, PO_THROTTLE_DEGRADE, or PO_THROTTLE_ADAPTIVE
  1191.     DynamicThrottle: BYTE;
  1192.     Spare2: array [0..1] of BYTE;
  1193.     // meaning of power action "sleep"
  1194.     MinSleep: SYSTEM_POWER_STATE;
  1195.     MaxSleep: SYSTEM_POWER_STATE;
  1196.     ReducedLatencySleep: SYSTEM_POWER_STATE;
  1197.     WinLogonFlags: DWORD;
  1198.     // parameters for dozing
  1199.     Spare3: DWORD;
  1200.     DozeS4Timeout: DWORD;
  1201.     // battery policies
  1202.     BroadcastCapacityResolution: DWORD;
  1203.     DischargePolicy: array [0..NUM_DISCHARGE_POLICIES - 1] of SYSTEM_POWER_LEVEL;
  1204.     // video policies
  1205.     VideoTimeout: DWORD;
  1206.     VideoDimDisplay: BOOLEAN;
  1207.     VideoReserved: array [0..2] of DWORD;
  1208.     // hard disk policies
  1209.     SpindownTimeout: DWORD;
  1210.     // processor policies
  1211.     OptimizeForPower: LongBool;
  1212.     FanThrottleTolerance: BYTE;
  1213.     ForcedThrottle: BYTE;
  1214.     MinThrottle: BYTE;
  1215.     OverThrottled: POWER_ACTION_POLICY;
  1216.   end;
  1217.   {$EXTERNALSYM _SYSTEM_POWER_POLICY}
  1218.   SYSTEM_POWER_POLICY = _SYSTEM_POWER_POLICY;
  1219.   {$EXTERNALSYM SYSTEM_POWER_POLICY}
  1220.   TSystemPowerPolicy = SYSTEM_POWER_POLICY;
  1221.   PSystemPowerPolicy = PSYSTEM_POWER_POLICY;
  1222. // processor power policy state
  1223.   PPROCESSOR_POWER_POLICY_INFO = ^PROCESSOR_POWER_POLICY_INFO;
  1224.   {$EXTERNALSYM PPROCESSOR_POWER_POLICY_INFO}
  1225.   _PROCESSOR_POWER_POLICY_INFO = record
  1226.     // Time based information (will be converted to kernel units)
  1227.     TimeCheck: DWORD; // in US
  1228.     DemoteLimit: DWORD; // in US
  1229.     PromoteLimit: DWORD; // in US
  1230.     // Percentage based information
  1231.     DemotePercent: BYTE;
  1232.     PromotePercent: BYTE;
  1233.     Spare: array [0..1] of BYTE;
  1234.     // Flags
  1235.     Flags: DWORD;
  1236.     //DWORD                   AllowDemotion:1;
  1237.     //DWORD                   AllowPromotion:1;
  1238.     //DWORD                   Reserved:30;
  1239.   end;
  1240.   {$EXTERNALSYM _PROCESSOR_POWER_POLICY_INFO}
  1241.   PROCESSOR_POWER_POLICY_INFO = _PROCESSOR_POWER_POLICY_INFO;
  1242.   {$EXTERNALSYM PROCESSOR_POWER_POLICY_INFO}
  1243.   TProcessorPowerPolicyInfo = PROCESSOR_POWER_POLICY_INFO;
  1244.   PProcessorPowerPolicyInfo = PPROCESSOR_POWER_POLICY_INFO;
  1245. // processor power policy
  1246.   PPROCESSOR_POWER_POLICY = ^PROCESSOR_POWER_POLICY;
  1247.   {$EXTERNALSYM PPROCESSOR_POWER_POLICY}
  1248.   _PROCESSOR_POWER_POLICY = record
  1249.     Revision: DWORD; // 1
  1250.     // Dynamic Throttling Policy
  1251.     DynamicThrottle: BYTE;
  1252.     Spare: array [0..2] of BYTE;
  1253.     // Flags
  1254.     Reserved: DWORD;
  1255.     //DWORD                       DisableCStates:1;
  1256.     //DWORD                       Reserved:31;
  1257.     // System policy information
  1258.     // The Array is last, in case it needs to be grown and the structure
  1259.     // revision incremented.
  1260.     PolicyCount: DWORD;
  1261.     Policy: array [0..2] of PROCESSOR_POWER_POLICY_INFO;
  1262.   end;
  1263.   {$EXTERNALSYM _PROCESSOR_POWER_POLICY}
  1264.   PROCESSOR_POWER_POLICY = _PROCESSOR_POWER_POLICY;
  1265.   {$EXTERNALSYM PROCESSOR_POWER_POLICY}
  1266.   TProcessorPowerPolicy = PROCESSOR_POWER_POLICY;
  1267.   PProcessorPowerPolicy = PPROCESSOR_POWER_POLICY;
  1268. // administrator power policy overrides
  1269.   PADMINISTRATOR_POWER_POLICY = ^ADMINISTRATOR_POWER_POLICY;
  1270.   {$EXTERNALSYM PADMINISTRATOR_POWER_POLICY}
  1271.   _ADMINISTRATOR_POWER_POLICY = record
  1272.     // meaning of power action "sleep"
  1273.     MinSleep: SYSTEM_POWER_STATE;
  1274.     MaxSleep: SYSTEM_POWER_STATE;
  1275.     // video policies
  1276.     MinVideoTimeout: DWORD;
  1277.     MaxVideoTimeout: DWORD;
  1278.     // disk policies
  1279.     MinSpindownTimeout: DWORD;
  1280.     MaxSpindownTimeout: DWORD;
  1281.   end;
  1282.   {$EXTERNALSYM _ADMINISTRATOR_POWER_POLICY}
  1283.   ADMINISTRATOR_POWER_POLICY = _ADMINISTRATOR_POWER_POLICY;
  1284.   {$EXTERNALSYM ADMINISTRATOR_POWER_POLICY}
  1285.   TAdministratorPowerPolicy = ADMINISTRATOR_POWER_POLICY;
  1286.   PAdministratorPowerPolicy = PADMINISTRATOR_POWER_POLICY;
  1287.   PSYSTEM_POWER_CAPABILITIES = ^SYSTEM_POWER_CAPABILITIES;
  1288.   {$EXTERNALSYM PSYSTEM_POWER_CAPABILITIES}
  1289.   SYSTEM_POWER_CAPABILITIES = record
  1290.     // Misc supported system features
  1291.     PowerButtonPresent: BOOLEAN;
  1292.     SleepButtonPresent: BOOLEAN;
  1293.     LidPresent: BOOLEAN;
  1294.     SystemS1: BOOLEAN;
  1295.     SystemS2: BOOLEAN;
  1296.     SystemS3: BOOLEAN;
  1297.     SystemS4: BOOLEAN; // hibernate
  1298.     SystemS5: BOOLEAN; // off
  1299.     HiberFilePresent: BOOLEAN;
  1300.     FullWake: BOOLEAN;
  1301.     VideoDimPresent: BOOLEAN;
  1302.     ApmPresent: BOOLEAN;
  1303.     UpsPresent: BOOLEAN;
  1304.     // Processors
  1305.     ThermalControl: BOOLEAN;
  1306.     ProcessorThrottle: BOOLEAN;
  1307.     ProcessorMinThrottle: BYTE;
  1308.     ProcessorMaxThrottle: BYTE;
  1309.     spare2: array [0..4 - 1] of BYTE;
  1310.     // Disk
  1311.     DiskSpinDown: BOOLEAN;
  1312.     spare3: array [0..8 - 1] of BYTE;
  1313.     // System Battery
  1314.     SystemBatteriesPresent: BOOLEAN;
  1315.     BatteriesAreShortTerm: BOOLEAN;
  1316.     BatteryScale: array [0..3 - 1] of BATTERY_REPORTING_SCALE;
  1317.     // Wake
  1318.     AcOnLineWake: SYSTEM_POWER_STATE;
  1319.     SoftLidWake: SYSTEM_POWER_STATE;
  1320.     RtcWake: SYSTEM_POWER_STATE;
  1321.     MinDeviceWakeState: SYSTEM_POWER_STATE; // note this may change on driver load
  1322.     DefaultLowLatencyWake: SYSTEM_POWER_STATE;
  1323.   end;
  1324.   {$EXTERNALSYM SYSTEM_POWER_CAPABILITIES}
  1325.   TSystemPowerCapabilities = SYSTEM_POWER_CAPABILITIES;
  1326.   PSystemPowerCapabilities = PSYSTEM_POWER_CAPABILITIES;
  1327.   PSYSTEM_BATTERY_STATE = ^SYSTEM_BATTERY_STATE;
  1328.   {$EXTERNALSYM PSYSTEM_BATTERY_STATE}
  1329.   SYSTEM_BATTERY_STATE = record
  1330.     AcOnLine: BOOLEAN;
  1331.     BatteryPresent: BOOLEAN;
  1332.     Charging: BOOLEAN;
  1333.     Discharging: BOOLEAN;
  1334.     Spare1: array [0..3] of BOOLEAN;
  1335.     MaxCapacity: DWORD;
  1336.     RemainingCapacity: DWORD;
  1337.     Rate: DWORD;
  1338.     EstimatedTime: DWORD;
  1339.     DefaultAlert1: DWORD;
  1340.     DefaultAlert2: DWORD;
  1341.   end;
  1342.   {$EXTERNALSYM SYSTEM_BATTERY_STATE}
  1343.   TSystemBatteryState = SYSTEM_BATTERY_STATE;
  1344.   PSystemBatteryState = PSYSTEM_BATTERY_STATE;
  1345. //
  1346. // Image Format
  1347. //
  1348. // #include "pshpack4.h"                   // 4 byte packing is the default
  1349. const
  1350.   IMAGE_DOS_SIGNATURE    = $5A4D; // MZ
  1351.   {$EXTERNALSYM IMAGE_DOS_SIGNATURE}
  1352.   IMAGE_OS2_SIGNATURE    = $454E; // NE
  1353.   {$EXTERNALSYM IMAGE_OS2_SIGNATURE}
  1354.   IMAGE_OS2_SIGNATURE_LE = $454C; // LE
  1355.   {$EXTERNALSYM IMAGE_OS2_SIGNATURE_LE}
  1356.   IMAGE_VXD_SIGNATURE    = $454C; // LE
  1357.   {$EXTERNALSYM IMAGE_VXD_SIGNATURE}
  1358.   IMAGE_NT_SIGNATURE     = $00004550; // PE00
  1359.   {$EXTERNALSYM IMAGE_NT_SIGNATURE}
  1360. // #include "pshpack2.h"                   // 16 bit headers are 2 byte packed
  1361. type
  1362.   // DOS .EXE header
  1363.   PIMAGE_DOS_HEADER = ^IMAGE_DOS_HEADER;
  1364.   {$EXTERNALSYM PIMAGE_DOS_HEADER}
  1365.   _IMAGE_DOS_HEADER = record
  1366.     e_magic: Word;     // Magic number
  1367.     e_cblp: Word;      // Bytes on last page of file
  1368.     e_cp: Word;        // Pages in file
  1369.     e_crlc: Word;      // Relocations
  1370.     e_cparhdr: Word;   // Size of header in paragraphs
  1371.     e_minalloc: Word;  // Minimum extra paragraphs needed
  1372.     e_maxalloc: Word;  // Maximum extra paragraphs needed
  1373.     e_ss: Word;        // Initial (relative) SS value
  1374.     e_sp: Word;        // Initial SP value
  1375.     e_csum: Word;      // Checksum
  1376.     e_ip: Word;        // Initial IP value
  1377.     e_cs: Word;        // Initial (relative) CS value
  1378.     e_lfarlc: Word;    // File address of relocation table
  1379.     e_ovno: Word;      // Overlay number
  1380.     e_res: array [0..3] of Word;    // Reserved words
  1381.     e_oemid: Word;     // OEM identifier (for e_oeminfo)
  1382.     e_oeminfo: Word;   // OEM information; e_oemid specific
  1383.     e_res2: array [0..9] of Word;  // Reserved words
  1384.     e_lfanew: Longint; // File address of new exe header
  1385.   end;
  1386.   {$EXTERNALSYM _IMAGE_DOS_HEADER}
  1387.   IMAGE_DOS_HEADER = _IMAGE_DOS_HEADER;
  1388.   {$EXTERNALSYM IMAGE_DOS_HEADER}
  1389.   TImageDosHeader = IMAGE_DOS_HEADER;
  1390.   PImageDosHeader = PIMAGE_DOS_HEADER;
  1391.   // OS/2 .EXE header
  1392.   PIMAGE_OS2_HEADER = ^IMAGE_OS2_HEADER;
  1393.   {$EXTERNALSYM PIMAGE_OS2_HEADER}
  1394.   _IMAGE_OS2_HEADER = record
  1395.     ne_magic: Word;        // Magic number
  1396.     ne_ver: CHAR;          // Version number
  1397.     ne_rev: CHAR;          // Revision number
  1398.     ne_enttab: Word;       // Offset of Entry Table
  1399.     ne_cbenttab: Word;     // Number of bytes in Entry Table
  1400.     ne_crc: Longint;       // Checksum of whole file
  1401.     ne_flags: Word;        // Flag word
  1402.     ne_autodata: Word;     // Automatic data segment number
  1403.     ne_heap: Word;         // Initial heap allocation
  1404.     ne_stack: Word;        // Initial stack allocation
  1405.     ne_csip: Longint;      // Initial CS:IP setting
  1406.     ne_sssp: Longint;      // Initial SS:SP setting
  1407.     ne_cseg: Word;         // Count of file segments
  1408.     ne_cmod: Word;         // Entries in Module Reference Table
  1409.     ne_cbnrestab: Word;    // Size of non-resident name table
  1410.     ne_segtab: Word;       // Offset of Segment Table
  1411.     ne_rsrctab: Word;      // Offset of Resource Table
  1412.     ne_restab: Word;       // Offset of resident name table
  1413.     ne_modtab: Word;       // Offset of Module Reference Table
  1414.     ne_imptab: Word;       // Offset of Imported Names Table
  1415.     ne_nrestab: Longint;   // Offset of Non-resident Names Table
  1416.     ne_cmovent: Word;      // Count of movable entries
  1417.     ne_align: Word;        // Segment alignment shift count
  1418.     ne_cres: Word;         // Count of resource segments
  1419.     ne_exetyp: Byte;       // Target Operating system
  1420.     ne_flagsothers: Byte;  // Other .EXE flags
  1421.     ne_pretthunks: Word;   // offset to return thunks
  1422.     ne_psegrefbytes: Word; // offset to segment ref. bytes
  1423.     ne_swaparea: Word;     // Minimum code swap area size
  1424.     ne_expver: Word;       // Expected Windows version number
  1425.   end;
  1426.   {$EXTERNALSYM _IMAGE_OS2_HEADER}
  1427.   IMAGE_OS2_HEADER = _IMAGE_OS2_HEADER;
  1428.   {$EXTERNALSYM IMAGE_OS2_HEADER}
  1429.   TImageOs2Header = IMAGE_OS2_HEADER;
  1430.   PImageOs2Header = PIMAGE_OS2_HEADER;
  1431.   // Windows VXD header
  1432.   PIMAGE_VXD_HEADER = ^IMAGE_VXD_HEADER;
  1433.   {$EXTERNALSYM PIMAGE_VXD_HEADER}
  1434.   _IMAGE_VXD_HEADER = record
  1435.     e32_magic: Word;         // Magic number
  1436.     e32_border: Byte;        // The byte ordering for the VXD
  1437.     e32_worder: Byte;        // The word ordering for the VXD
  1438.     e32_level: DWORD;        // The EXE format level for now = 0
  1439.     e32_cpu: Word;           // The CPU type
  1440.     e32_os: Word;            // The OS type
  1441.     e32_ver: DWORD;          // Module version
  1442.     e32_mflags: DWORD;       // Module flags
  1443.     e32_mpages: DWORD;       // Module # pages
  1444.     e32_startobj: DWORD;     // Object # for instruction pointer
  1445.     e32_eip: DWORD;          // Extended instruction pointer
  1446.     e32_stackobj: DWORD;     // Object # for stack pointer
  1447.     e32_esp: DWORD;          // Extended stack pointer
  1448.     e32_pagesize: DWORD;     // VXD page size
  1449.     e32_lastpagesize: DWORD; // Last page size in VXD
  1450.     e32_fixupsize: DWORD;    // Fixup section size
  1451.     e32_fixupsum: DWORD;     // Fixup section checksum
  1452.     e32_ldrsize: DWORD;      // Loader section size
  1453.     e32_ldrsum: DWORD;       // Loader section checksum
  1454.     e32_objtab: DWORD;       // Object table offset
  1455.     e32_objcnt: DWORD;       // Number of objects in module
  1456.     e32_objmap: DWORD;       // Object page map offset
  1457.     e32_itermap: DWORD;      // Object iterated data map offset
  1458.     e32_rsrctab: DWORD;      // Offset of Resource Table
  1459.     e32_rsrccnt: DWORD;      // Number of resource entries
  1460.     e32_restab: DWORD;       // Offset of resident name table
  1461.     e32_enttab: DWORD;       // Offset of Entry Table
  1462.     e32_dirtab: DWORD;       // Offset of Module Directive Table
  1463.     e32_dircnt: DWORD;       // Number of module directives
  1464.     e32_fpagetab: DWORD;     // Offset of Fixup Page Table
  1465.     e32_frectab: DWORD;      // Offset of Fixup Record Table
  1466.     e32_impmod: DWORD;       // Offset of Import Module Name Table
  1467.     e32_impmodcnt: DWORD;    // Number of entries in Import Module Name Table
  1468.     e32_impproc: DWORD;      // Offset of Import Procedure Name Table
  1469.     e32_pagesum: DWORD;      // Offset of Per-Page Checksum Table
  1470.     e32_datapage: DWORD;     // Offset of Enumerated Data Pages
  1471.     e32_preload: DWORD;      // Number of preload pages
  1472.     e32_nrestab: DWORD;      // Offset of Non-resident Names Table
  1473.     e32_cbnrestab: DWORD;    // Size of Non-resident Name Table
  1474.     e32_nressum: DWORD;      // Non-resident Name Table Checksum
  1475.     e32_autodata: DWORD;     // Object # for automatic data object
  1476.     e32_debuginfo: DWORD;    // Offset of the debugging information
  1477.     e32_debuglen: DWORD;     // The length of the debugging info. in bytes
  1478.     e32_instpreload: DWORD;  // Number of instance pages in preload section of VXD file
  1479.     e32_instdemand: DWORD;   // Number of instance pages in demand load section of VXD file
  1480.     e32_heapsize: DWORD;     // Size of heap - for 16-bit apps
  1481.     e32_res3: array [0..11] of Byte;      // Reserved words
  1482.     e32_winresoff: DWORD;
  1483.     e32_winreslen: DWORD;
  1484.     e32_devid: Word;         // Device ID for VxD
  1485.     e32_ddkver: Word;        // DDK version for VxD
  1486.   end;
  1487.   {$EXTERNALSYM _IMAGE_VXD_HEADER}
  1488.   IMAGE_VXD_HEADER = _IMAGE_VXD_HEADER;
  1489.   {$EXTERNALSYM IMAGE_VXD_HEADER}
  1490.   TImageVxdHeader = IMAGE_VXD_HEADER;
  1491.   PImageVxdHeader = PIMAGE_VXD_HEADER;
  1492. // #include "poppack.h"                    // Back to 4 byte packing
  1493. //
  1494. // File header format.
  1495. //
  1496.   PIMAGE_FILE_HEADER = ^IMAGE_FILE_HEADER;
  1497.   {$EXTERNALSYM PIMAGE_FILE_HEADER}
  1498.   _IMAGE_FILE_HEADER = record
  1499.     Machine: WORD;
  1500.     NumberOfSections: WORD;
  1501.     TimeDateStamp: DWORD;
  1502.     PointerToSymbolTable: DWORD;
  1503.     NumberOfSymbols: DWORD;
  1504.     SizeOfOptionalHeader: WORD;
  1505.     Characteristics: WORD;
  1506.   end;
  1507.   {$EXTERNALSYM _IMAGE_FILE_HEADER}
  1508.   IMAGE_FILE_HEADER = _IMAGE_FILE_HEADER;
  1509.   {$EXTERNALSYM IMAGE_FILE_HEADER}
  1510.   TImageFileHeader = IMAGE_FILE_HEADER;
  1511.   PImageFileHeader = PIMAGE_FILE_HEADER;
  1512. const
  1513.   IMAGE_SIZEOF_FILE_HEADER = 20;
  1514.   {$EXTERNALSYM IMAGE_SIZEOF_FILE_HEADER}
  1515.   IMAGE_FILE_RELOCS_STRIPPED         = $0001; // Relocation info stripped from file.
  1516.   {$EXTERNALSYM IMAGE_FILE_RELOCS_STRIPPED}
  1517.   IMAGE_FILE_EXECUTABLE_IMAGE        = $0002; // File is executable  (i.e. no unresolved externel references).
  1518.   {$EXTERNALSYM IMAGE_FILE_EXECUTABLE_IMAGE}
  1519.   IMAGE_FILE_LINE_NUMS_STRIPPED      = $0004; // Line nunbers stripped from file.
  1520.   {$EXTERNALSYM IMAGE_FILE_LINE_NUMS_STRIPPED}
  1521.   IMAGE_FILE_LOCAL_SYMS_STRIPPED     = $0008; // Local symbols stripped from file.
  1522.   {$EXTERNALSYM IMAGE_FILE_LOCAL_SYMS_STRIPPED}
  1523.   IMAGE_FILE_AGGRESIVE_WS_TRIM       = $0010; // Agressively trim working set
  1524.   {$EXTERNALSYM IMAGE_FILE_AGGRESIVE_WS_TRIM}
  1525.   IMAGE_FILE_LARGE_ADDRESS_AWARE     = $0020; // App can handle >2gb addresses
  1526.   {$EXTERNALSYM IMAGE_FILE_LARGE_ADDRESS_AWARE}
  1527.   IMAGE_FILE_BYTES_REVERSED_LO       = $0080; // Bytes of machine word are reversed.
  1528.   {$EXTERNALSYM IMAGE_FILE_BYTES_REVERSED_LO}
  1529.   IMAGE_FILE_32BIT_MACHINE           = $0100; // 32 bit word machine.
  1530.   {$EXTERNALSYM IMAGE_FILE_32BIT_MACHINE}
  1531.   IMAGE_FILE_DEBUG_STRIPPED          = $0200; // Debugging info stripped from file in .DBG file
  1532.   {$EXTERNALSYM IMAGE_FILE_DEBUG_STRIPPED}
  1533.   IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = $0400; // If Image is on removable media, copy and run from the swap file.
  1534.   {$EXTERNALSYM IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP}
  1535.   IMAGE_FILE_NET_RUN_FROM_SWAP       = $0800; // If Image is on Net, copy and run from the swap file.
  1536.   {$EXTERNALSYM IMAGE_FILE_NET_RUN_FROM_SWAP}
  1537.   IMAGE_FILE_SYSTEM                  = $1000; // System File.
  1538.   {$EXTERNALSYM IMAGE_FILE_SYSTEM}
  1539.   IMAGE_FILE_DLL                     = $2000; // File is a DLL.
  1540.   {$EXTERNALSYM IMAGE_FILE_DLL}
  1541.   IMAGE_FILE_UP_SYSTEM_ONLY          = $4000; // File should only be run on a UP machine
  1542.   {$EXTERNALSYM IMAGE_FILE_UP_SYSTEM_ONLY}
  1543.   IMAGE_FILE_BYTES_REVERSED_HI       = $8000; // Bytes of machine word are reversed.
  1544.   {$EXTERNALSYM IMAGE_FILE_BYTES_REVERSED_HI}
  1545.   IMAGE_FILE_MACHINE_UNKNOWN   = 0;
  1546.   {$EXTERNALSYM IMAGE_FILE_MACHINE_UNKNOWN}
  1547.   IMAGE_FILE_MACHINE_I386      = $014c; // Intel 386.
  1548.   {$EXTERNALSYM IMAGE_FILE_MACHINE_I386}
  1549.   IMAGE_FILE_MACHINE_R3000     = $0162; // MIPS little-endian, 0x160 big-endian
  1550.   {$EXTERNALSYM IMAGE_FILE_MACHINE_R3000}
  1551.   IMAGE_FILE_MACHINE_R4000     = $0166; // MIPS little-endian
  1552.   {$EXTERNALSYM IMAGE_FILE_MACHINE_R4000}
  1553.   IMAGE_FILE_MACHINE_R10000    = $0168; // MIPS little-endian
  1554.   {$EXTERNALSYM IMAGE_FILE_MACHINE_R10000}
  1555.   IMAGE_FILE_MACHINE_WCEMIPSV2 = $0169; // MIPS little-endian WCE v2
  1556.   {$EXTERNALSYM IMAGE_FILE_MACHINE_WCEMIPSV2}
  1557.   IMAGE_FILE_MACHINE_ALPHA     = $0184; // Alpha_AXP
  1558.   {$EXTERNALSYM IMAGE_FILE_MACHINE_ALPHA}
  1559.   IMAGE_FILE_MACHINE_SH3       = $01a2; // SH3 little-endian
  1560.   {$EXTERNALSYM IMAGE_FILE_MACHINE_SH3}
  1561.   IMAGE_FILE_MACHINE_SH3DSP    = $01a3;
  1562.   {$EXTERNALSYM IMAGE_FILE_MACHINE_SH3DSP}
  1563.   IMAGE_FILE_MACHINE_SH3E      = $01a4; // SH3E little-endian
  1564.   {$EXTERNALSYM IMAGE_FILE_MACHINE_SH3E}
  1565.   IMAGE_FILE_MACHINE_SH4       = $01a6; // SH4 little-endian
  1566.   {$EXTERNALSYM IMAGE_FILE_MACHINE_SH4}
  1567.   IMAGE_FILE_MACHINE_SH5       = $01a8; // SH5
  1568.   {$EXTERNALSYM IMAGE_FILE_MACHINE_SH5}
  1569.   IMAGE_FILE_MACHINE_ARM       = $01c0; // ARM Little-Endian
  1570.   {$EXTERNALSYM IMAGE_FILE_MACHINE_ARM}
  1571.   IMAGE_FILE_MACHINE_THUMB     = $01c2;
  1572.   {$EXTERNALSYM IMAGE_FILE_MACHINE_THUMB}
  1573.   IMAGE_FILE_MACHINE_AM33      = $01d3;
  1574.   {$EXTERNALSYM IMAGE_FILE_MACHINE_AM33}
  1575.   IMAGE_FILE_MACHINE_POWERPC   = $01F0; // IBM PowerPC Little-Endian
  1576.   {$EXTERNALSYM IMAGE_FILE_MACHINE_POWERPC}
  1577.   IMAGE_FILE_MACHINE_POWERPCFP = $01f1;
  1578.   {$EXTERNALSYM IMAGE_FILE_MACHINE_POWERPCFP}
  1579.   IMAGE_FILE_MACHINE_IA64      = $0200; // Intel 64
  1580.   {$EXTERNALSYM IMAGE_FILE_MACHINE_IA64}
  1581.   IMAGE_FILE_MACHINE_MIPS16    = $0266; // MIPS
  1582.   {$EXTERNALSYM IMAGE_FILE_MACHINE_MIPS16}
  1583.   IMAGE_FILE_MACHINE_ALPHA64   = $0284; // ALPHA64
  1584.   {$EXTERNALSYM IMAGE_FILE_MACHINE_ALPHA64}
  1585.   IMAGE_FILE_MACHINE_MIPSFPU   = $0366; // MIPS
  1586.   {$EXTERNALSYM IMAGE_FILE_MACHINE_MIPSFPU}
  1587.   IMAGE_FILE_MACHINE_MIPSFPU16 = $0466; // MIPS
  1588.   {$EXTERNALSYM IMAGE_FILE_MACHINE_MIPSFPU16}
  1589.   IMAGE_FILE_MACHINE_AXP64     = IMAGE_FILE_MACHINE_ALPHA64;
  1590.   {$EXTERNALSYM IMAGE_FILE_MACHINE_AXP64}
  1591.   IMAGE_FILE_MACHINE_TRICORE   = $0520; // Infineon
  1592.   {$EXTERNALSYM IMAGE_FILE_MACHINE_TRICORE}
  1593.   IMAGE_FILE_MACHINE_CEF       = $0CEF;
  1594.   {$EXTERNALSYM IMAGE_FILE_MACHINE_CEF}
  1595.   IMAGE_FILE_MACHINE_EBC       = $0EBC; // EFI Byte Code
  1596.   {$EXTERNALSYM IMAGE_FILE_MACHINE_EBC}
  1597.   IMAGE_FILE_MACHINE_AMD64     = $8664; // AMD64 (K8)
  1598.   {$EXTERNALSYM IMAGE_FILE_MACHINE_AMD64}
  1599.   IMAGE_FILE_MACHINE_M32R      = $9041; // M32R little-endian
  1600.   {$EXTERNALSYM IMAGE_FILE_MACHINE_M32R}
  1601.   IMAGE_FILE_MACHINE_CEE       = $C0EE;
  1602.   {$EXTERNALSYM IMAGE_FILE_MACHINE_CEE}
  1603. //
  1604. // Directory format.
  1605. //
  1606. type
  1607.   PIMAGE_DATA_DIRECTORY = ^IMAGE_DATA_DIRECTORY;
  1608.   {$EXTERNALSYM PIMAGE_DATA_DIRECTORY}
  1609.   _IMAGE_DATA_DIRECTORY = record
  1610.     VirtualAddress: DWORD;
  1611.     Size: DWORD;
  1612.   end;
  1613.   {$EXTERNALSYM _IMAGE_DATA_DIRECTORY}
  1614.   IMAGE_DATA_DIRECTORY = _IMAGE_DATA_DIRECTORY;
  1615.   {$EXTERNALSYM IMAGE_DATA_DIRECTORY}
  1616.   TImageDataDirectory = IMAGE_DATA_DIRECTORY;
  1617.   PImageDataDirectory = PIMAGE_DATA_DIRECTORY;
  1618. const
  1619.   IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16;
  1620.   {$EXTERNALSYM IMAGE_NUMBEROF_DIRECTORY_ENTRIES}
  1621. //
  1622. // Optional header format.
  1623. //
  1624. type
  1625.   PIMAGE_OPTIONAL_HEADER32 = ^IMAGE_OPTIONAL_HEADER32;
  1626.   {$EXTERNALSYM PIMAGE_OPTIONAL_HEADER32}
  1627.   _IMAGE_OPTIONAL_HEADER = record
  1628.     //
  1629.     // Standard fields.
  1630.     //
  1631.     Magic: Word;
  1632.     MajorLinkerVersion: Byte;
  1633.     MinorLinkerVersion: Byte;
  1634.     SizeOfCode: DWORD;
  1635.     SizeOfInitializedData: DWORD;
  1636.     SizeOfUninitializedData: DWORD;
  1637.     AddressOfEntryPoint: DWORD;
  1638.     BaseOfCode: DWORD;
  1639.     BaseOfData: DWORD;
  1640.     //
  1641.     // NT additional fields.
  1642.     //
  1643.     ImageBase: DWORD;
  1644.     SectionAlignment: DWORD;
  1645.     FileAlignment: DWORD;
  1646.     MajorOperatingSystemVersion: Word;
  1647.     MinorOperatingSystemVersion: Word;
  1648.     MajorImageVersion: Word;
  1649.     MinorImageVersion: Word;
  1650.     MajorSubsystemVersion: Word;
  1651.     MinorSubsystemVersion: Word;
  1652.     Win32VersionValue: DWORD;
  1653.     SizeOfImage: DWORD;
  1654.     SizeOfHeaders: DWORD;
  1655.     CheckSum: DWORD;
  1656.     Subsystem: Word;
  1657.     DllCharacteristics: Word;
  1658.     SizeOfStackReserve: DWORD;
  1659.     SizeOfStackCommit: DWORD;
  1660.     SizeOfHeapReserve: DWORD;
  1661.     SizeOfHeapCommit: DWORD;
  1662.     LoaderFlags: DWORD;
  1663.     NumberOfRvaAndSizes: DWORD;
  1664.     DataDirectory: array [0..IMAGE_NUMBEROF_DIRECTORY_ENTRIES - 1] of IMAGE_DATA_DIRECTORY;
  1665.   end;
  1666.   {$EXTERNALSYM _IMAGE_OPTIONAL_HEADER}
  1667.   IMAGE_OPTIONAL_HEADER32 = _IMAGE_OPTIONAL_HEADER;
  1668.   {$EXTERNALSYM IMAGE_OPTIONAL_HEADER32}
  1669.   TImageOptionalHeader32 = IMAGE_OPTIONAL_HEADER32;
  1670.   PImageOptionalHeader32 = PIMAGE_OPTIONAL_HEADER32;
  1671.   PIMAGE_ROM_OPTIONAL_HEADER = ^IMAGE_ROM_OPTIONAL_HEADER;
  1672.   {$EXTERNALSYM PIMAGE_ROM_OPTIONAL_HEADER}
  1673.   _IMAGE_ROM_OPTIONAL_HEADER = record
  1674.     Magic: Word;
  1675.     MajorLinkerVersion: Byte;
  1676.     MinorLinkerVersion: Byte;
  1677.     SizeOfCode: DWORD;
  1678.     SizeOfInitializedData: DWORD;
  1679.     SizeOfUninitializedData: DWORD;
  1680.     AddressOfEntryPoint: DWORD;
  1681.     BaseOfCode: DWORD;
  1682.     BaseOfData: DWORD;
  1683.     BaseOfBss: DWORD;
  1684.     GprMask: DWORD;
  1685.     CprMask: array [0..3] of DWORD;
  1686.     GpValue: DWORD;
  1687.   end;
  1688.   {$EXTERNALSYM _IMAGE_ROM_OPTIONAL_HEADER}
  1689.   IMAGE_ROM_OPTIONAL_HEADER = _IMAGE_ROM_OPTIONAL_HEADER;
  1690.   {$EXTERNALSYM IMAGE_ROM_OPTIONAL_HEADER}
  1691.   TImageRomOptionalHeader = IMAGE_ROM_OPTIONAL_HEADER;
  1692.   PImageRomOptionalHeader = PIMAGE_ROM_OPTIONAL_HEADER;
  1693.   PIMAGE_OPTIONAL_HEADER64 = ^IMAGE_OPTIONAL_HEADER64;
  1694.   {$EXTERNALSYM PIMAGE_OPTIONAL_HEADER64}
  1695.   _IMAGE_OPTIONAL_HEADER64 = record
  1696.     Magic: Word;
  1697.     MajorLinkerVersion: Byte;
  1698.     MinorLinkerVersion: Byte;
  1699.     SizeOfCode: DWORD;
  1700.     SizeOfInitializedData: DWORD;
  1701.     SizeOfUninitializedData: DWORD;
  1702.     AddressOfEntryPoint: DWORD;
  1703.     BaseOfCode: DWORD;
  1704.     ImageBase: Int64;
  1705.     SectionAlignment: DWORD;
  1706.     FileAlignment: DWORD;
  1707.     MajorOperatingSystemVersion: Word;
  1708.     MinorOperatingSystemVersion: Word;
  1709.     MajorImageVersion: Word;
  1710.     MinorImageVersion: Word;
  1711.     MajorSubsystemVersion: Word;
  1712.     MinorSubsystemVersion: Word;
  1713.     Win32VersionValue: DWORD;
  1714.     SizeOfImage: DWORD;
  1715.     SizeOfHeaders: DWORD;
  1716.     CheckSum: DWORD;
  1717.     Subsystem: Word;
  1718.     DllCharacteristics: Word;
  1719.     SizeOfStackReserve: Int64;
  1720.     SizeOfStackCommit: Int64;
  1721.     SizeOfHeapReserve: Int64;
  1722.     SizeOfHeapCommit: Int64;
  1723.     LoaderFlags: DWORD;
  1724.     NumberOfRvaAndSizes: DWORD;
  1725.     DataDirectory: array [0..IMAGE_NUMBEROF_DIRECTORY_ENTRIES - 1] of IMAGE_DATA_DIRECTORY;
  1726.   end;
  1727.   {$EXTERNALSYM _IMAGE_OPTIONAL_HEADER64}
  1728.   IMAGE_OPTIONAL_HEADER64 = _IMAGE_OPTIONAL_HEADER64;
  1729.   {$EXTERNALSYM IMAGE_OPTIONAL_HEADER64}
  1730.   TImageOptionalHeader64 = IMAGE_OPTIONAL_HEADER64;
  1731.   PImageOptionalHeader64 = PIMAGE_OPTIONAL_HEADER64;
  1732. const
  1733.   IMAGE_SIZEOF_ROM_OPTIONAL_HEADER  = 56;
  1734.   {$EXTERNALSYM IMAGE_SIZEOF_ROM_OPTIONAL_HEADER}
  1735.   IMAGE_SIZEOF_STD_OPTIONAL_HEADER  = 28;
  1736.   {$EXTERNALSYM IMAGE_SIZEOF_STD_OPTIONAL_HEADER}
  1737.   IMAGE_SIZEOF_NT_OPTIONAL32_HEADER = 224;
  1738.   {$EXTERNALSYM IMAGE_SIZEOF_NT_OPTIONAL32_HEADER}
  1739.   IMAGE_SIZEOF_NT_OPTIONAL64_HEADER = 240;
  1740.   {$EXTERNALSYM IMAGE_SIZEOF_NT_OPTIONAL64_HEADER}
  1741.   IMAGE_NT_OPTIONAL_HDR32_MAGIC = $10b;
  1742.   {$EXTERNALSYM IMAGE_NT_OPTIONAL_HDR32_MAGIC}
  1743.   IMAGE_NT_OPTIONAL_HDR64_MAGIC = $20b;
  1744.   {$EXTERNALSYM IMAGE_NT_OPTIONAL_HDR64_MAGIC}
  1745.   IMAGE_ROM_OPTIONAL_HDR_MAGIC  = $107;
  1746.   {$EXTERNALSYM IMAGE_ROM_OPTIONAL_HDR_MAGIC}
  1747. type
  1748.   IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER32;
  1749.   {$EXTERNALSYM IMAGE_OPTIONAL_HEADER}
  1750.   PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER32;
  1751.   {$EXTERNALSYM PIMAGE_OPTIONAL_HEADER}
  1752. const
  1753.   IMAGE_SIZEOF_NT_OPTIONAL_HEADER = IMAGE_SIZEOF_NT_OPTIONAL32_HEADER;
  1754.   {$EXTERNALSYM IMAGE_SIZEOF_NT_OPTIONAL_HEADER}
  1755.   IMAGE_NT_OPTIONAL_HDR_MAGIC     = IMAGE_NT_OPTIONAL_HDR32_MAGIC;
  1756.   {$EXTERNALSYM IMAGE_NT_OPTIONAL_HDR_MAGIC}
  1757. type
  1758.   PIMAGE_NT_HEADERS64 = ^IMAGE_NT_HEADERS64;
  1759.   {$EXTERNALSYM PIMAGE_NT_HEADERS64}
  1760.   _IMAGE_NT_HEADERS64 = record
  1761.     Signature: DWORD;
  1762.     FileHeader: IMAGE_FILE_HEADER;
  1763.     OptionalHeader: IMAGE_OPTIONAL_HEADER64;
  1764.   end;
  1765.   {$EXTERNALSYM _IMAGE_NT_HEADERS64}
  1766.   IMAGE_NT_HEADERS64 = _IMAGE_NT_HEADERS64;
  1767.   {$EXTERNALSYM IMAGE_NT_HEADERS64}
  1768.   TImageNtHeaders64 = IMAGE_NT_HEADERS64;
  1769.   PImageNtHeaders64 = PIMAGE_NT_HEADERS64;
  1770.   PIMAGE_NT_HEADERS32 = ^IMAGE_NT_HEADERS32;
  1771.   {$EXTERNALSYM PIMAGE_NT_HEADERS32}
  1772.   _IMAGE_NT_HEADERS = record
  1773.     Signature: DWORD;
  1774.     FileHeader: IMAGE_FILE_HEADER;
  1775.     OptionalHeader: IMAGE_OPTIONAL_HEADER32;
  1776.   end;
  1777.   {$EXTERNALSYM _IMAGE_NT_HEADERS}
  1778.   IMAGE_NT_HEADERS32 = _IMAGE_NT_HEADERS;
  1779.   {$EXTERNALSYM IMAGE_NT_HEADERS32}
  1780.   TImageNtHeaders32 = IMAGE_NT_HEADERS32;
  1781.   PImageNtHeaders32 = PIMAGE_NT_HEADERS32;
  1782.   PIMAGE_ROM_HEADERS = ^IMAGE_ROM_HEADERS;
  1783.   {$EXTERNALSYM PIMAGE_ROM_HEADERS}
  1784.   _IMAGE_ROM_HEADERS = record
  1785.     FileHeader: IMAGE_FILE_HEADER;
  1786.     OptionalHeader: IMAGE_ROM_OPTIONAL_HEADER;
  1787.   end;
  1788.   {$EXTERNALSYM _IMAGE_ROM_HEADERS}
  1789.   IMAGE_ROM_HEADERS = _IMAGE_ROM_HEADERS;
  1790.   {$EXTERNALSYM IMAGE_ROM_HEADERS}
  1791.   TImageRomHeaders = IMAGE_ROM_HEADERS;
  1792.   PImageRomHeaders = PIMAGE_ROM_HEADERS;
  1793.   IMAGE_NT_HEADERS = IMAGE_NT_HEADERS32;
  1794.   {$EXTERNALSYM IMAGE_NT_HEADERS}
  1795.   PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS32;
  1796.   {$EXTERNALSYM PIMAGE_NT_HEADERS}
  1797. // Subsystem Values
  1798. const
  1799.   IMAGE_SUBSYSTEM_UNKNOWN                 = 0; // Unknown subsystem.
  1800.   {$EXTERNALSYM IMAGE_SUBSYSTEM_UNKNOWN}
  1801.   IMAGE_SUBSYSTEM_NATIVE                  = 1; // Image doesn't require a subsystem.
  1802.   {$EXTERNALSYM IMAGE_SUBSYSTEM_NATIVE}
  1803.   IMAGE_SUBSYSTEM_WINDOWS_GUI             = 2; // Image runs in the Windows GUI subsystem.
  1804.   {$EXTERNALSYM IMAGE_SUBSYSTEM_WINDOWS_GUI}
  1805.   IMAGE_SUBSYSTEM_WINDOWS_CUI             = 3; // Image runs in the Windows character subsystem.
  1806.   {$EXTERNALSYM IMAGE_SUBSYSTEM_WINDOWS_CUI}
  1807.   IMAGE_SUBSYSTEM_OS2_CUI                 = 5; // image runs in the OS/2 character subsystem.
  1808.   {$EXTERNALSYM IMAGE_SUBSYSTEM_OS2_CUI}
  1809.   IMAGE_SUBSYSTEM_POSIX_CUI               = 7; // image runs in the Posix character subsystem.
  1810.   {$EXTERNALSYM IMAGE_SUBSYSTEM_POSIX_CUI}
  1811.   IMAGE_SUBSYSTEM_NATIVE_WINDOWS          = 8; // image is a native Win9x driver.
  1812.   {$EXTERNALSYM IMAGE_SUBSYSTEM_NATIVE_WINDOWS}
  1813.   IMAGE_SUBSYSTEM_WINDOWS_CE_GUI          = 9; // Image runs in the Windows CE subsystem.
  1814.   {$EXTERNALSYM IMAGE_SUBSYSTEM_WINDOWS_CE_GUI}
  1815.   IMAGE_SUBSYSTEM_EFI_APPLICATION         = 10;
  1816.   {$EXTERNALSYM IMAGE_SUBSYSTEM_EFI_APPLICATION}
  1817.   IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11;
  1818.   {$EXTERNALSYM IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER}
  1819.   IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER      = 12;
  1820.   {$EXTERNALSYM IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER}
  1821.   IMAGE_SUBSYSTEM_EFI_ROM                 = 13;
  1822.   {$EXTERNALSYM IMAGE_SUBSYSTEM_EFI_ROM}
  1823.   IMAGE_SUBSYSTEM_XBOX                    = 14;
  1824.   {$EXTERNALSYM IMAGE_SUBSYSTEM_XBOX}
  1825. // DllCharacteristics Entries
  1826. //      IMAGE_LIBRARY_PROCESS_INIT           0x0001     // Reserved.
  1827. //      IMAGE_LIBRARY_PROCESS_TERM           0x0002     // Reserved.
  1828. //      IMAGE_LIBRARY_THREAD_INIT            0x0004     // Reserved.
  1829. //      IMAGE_LIBRARY_THREAD_TERM            0x0008     // Reserved.
  1830.   IMAGE_DLLCHARACTERISTICS_NO_BIND = $0800; // Do not bind this image.
  1831.   {$EXTERNALSYM IMAGE_DLLCHARACTERISTICS_NO_BIND}
  1832. //                                           0x1000     // Reserved.
  1833.   IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = $2000; // Driver uses WDM model
  1834.   {$EXTERNALSYM IMAGE_DLLCHARACTERISTICS_WDM_DRIVER}
  1835. //                                           0x4000     // Reserved.
  1836.   IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = $8000;
  1837.   {$EXTERNALSYM IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE}
  1838. // Directory Entries
  1839.   IMAGE_DIRECTORY_ENTRY_EXPORT    = 0; // Export Directory
  1840.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_EXPORT}
  1841.   IMAGE_DIRECTORY_ENTRY_IMPORT    = 1; // Import Directory
  1842.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_IMPORT}
  1843.   IMAGE_DIRECTORY_ENTRY_RESOURCE  = 2; // Resource Directory
  1844.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_RESOURCE}
  1845.   IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3; // Exception Directory
  1846.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_EXCEPTION}
  1847.   IMAGE_DIRECTORY_ENTRY_SECURITY  = 4; // Security Directory
  1848.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_SECURITY}
  1849.   IMAGE_DIRECTORY_ENTRY_BASERELOC = 5; // Base Relocation Table
  1850.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_BASERELOC}
  1851.   IMAGE_DIRECTORY_ENTRY_DEBUG     = 6; // Debug Directory
  1852.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_DEBUG}
  1853. //      IMAGE_DIRECTORY_ENTRY_COPYRIGHT       7   // (X86 usage)
  1854.   IMAGE_DIRECTORY_ENTRY_ARCHITECTURE   = 7; // Architecture Specific Data
  1855.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_ARCHITECTURE}
  1856.   IMAGE_DIRECTORY_ENTRY_GLOBALPTR      = 8; // RVA of GP
  1857.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_GLOBALPTR}
  1858.   IMAGE_DIRECTORY_ENTRY_TLS            = 9; // TLS Directory
  1859.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_TLS}
  1860.   IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG    = 10; // Load Configuration Directory
  1861.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG}
  1862.   IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT   = 11; // Bound Import Directory in headers
  1863.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT}
  1864.   IMAGE_DIRECTORY_ENTRY_IAT            = 12; // Import Address Table
  1865.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_IAT}
  1866.   IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT   = 13; // Delay Load Import Descriptors
  1867.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT}
  1868.   IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14; // COM Runtime descriptor
  1869.   {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR}
  1870. //
  1871. // Non-COFF Object file header
  1872. //
  1873. type
  1874.   PAnonObjectHeader = ^ANON_OBJECT_HEADER;
  1875.   ANON_OBJECT_HEADER = record
  1876.     Sig1: Word;        // Must be IMAGE_FILE_MACHINE_UNKNOWN
  1877.     Sig2: Word;        // Must be 0xffff
  1878.     Version: Word;     // >= 1 (implies the CLSID field is present)
  1879.     Machine: Word;
  1880.     TimeDateStamp: DWORD;
  1881.     ClassID: CLSID;    // Used to invoke CoCreateInstance
  1882.     SizeOfData: DWORD; // Size of data that follows the header
  1883.   end;
  1884.   {$EXTERNALSYM ANON_OBJECT_HEADER}
  1885.   TAnonObjectHeader = ANON_OBJECT_HEADER;
  1886. //
  1887. // Section header format.
  1888. //
  1889. const
  1890.   IMAGE_SIZEOF_SHORT_NAME = 8;
  1891.   {$EXTERNALSYM IMAGE_SIZEOF_SHORT_NAME}
  1892. type
  1893.   TImgSecHdrMisc = record
  1894.     case Integer of
  1895.       0: (PhysicalAddress: DWORD);
  1896.       1: (VirtualSize: DWORD);
  1897.   end;
  1898.   PIMAGE_SECTION_HEADER = ^IMAGE_SECTION_HEADER;
  1899.   {$EXTERNALSYM PIMAGE_SECTION_HEADER}
  1900.   _IMAGE_SECTION_HEADER = record
  1901.     Name: array [0..IMAGE_SIZEOF_SHORT_NAME - 1] of BYTE;
  1902.     Misc: TImgSecHdrMisc;
  1903.     VirtualAddress: DWORD;
  1904.     SizeOfRawData: DWORD;
  1905.     PointerToRawData: DWORD;
  1906.     PointerToRelocations: DWORD;
  1907.     PointerToLinenumbers: DWORD;
  1908.     NumberOfRelocations: WORD;
  1909.     NumberOfLinenumbers: WORD;
  1910.     Characteristics: DWORD;
  1911.   end;
  1912.   {$EXTERNALSYM _IMAGE_SECTION_HEADER}
  1913.   IMAGE_SECTION_HEADER = _IMAGE_SECTION_HEADER;
  1914.   {$EXTERNALSYM IMAGE_SECTION_HEADER}
  1915.   TImageSectionHeader = IMAGE_SECTION_HEADER;
  1916.   PImageSectionHeader = PIMAGE_SECTION_HEADER;
  1917. const
  1918.   IMAGE_SIZEOF_SECTION_HEADER = 40;
  1919.   {$EXTERNALSYM IMAGE_SIZEOF_SECTION_HEADER}
  1920. //
  1921. // Section characteristics.
  1922. //
  1923. //      IMAGE_SCN_TYPE_REG                   0x00000000  // Reserved.
  1924. //      IMAGE_SCN_TYPE_DSECT                 0x00000001  // Reserved.
  1925. //      IMAGE_SCN_TYPE_NOLOAD                0x00000002  // Reserved.
  1926. //      IMAGE_SCN_TYPE_GROUP                 0x00000004  // Reserved.
  1927.   IMAGE_SCN_TYPE_NO_PAD = $00000008; // Reserved.
  1928.   {$EXTERNALSYM IMAGE_SCN_TYPE_NO_PAD}
  1929. //      IMAGE_SCN_TYPE_COPY                  0x00000010  // Reserved.
  1930.   IMAGE_SCN_CNT_CODE               = $00000020; // Section contains code.
  1931.   {$EXTERNALSYM IMAGE_SCN_CNT_CODE}
  1932.   IMAGE_SCN_CNT_INITIALIZED_DATA   = $00000040; // Section contains initialized data.
  1933.   {$EXTERNALSYM IMAGE_SCN_CNT_INITIALIZED_DATA}
  1934.   IMAGE_SCN_CNT_UNINITIALIZED_DATA = $00000080; // Section contains uninitialized data.
  1935.   {$EXTERNALSYM IMAGE_SCN_CNT_UNINITIALIZED_DATA}
  1936.   IMAGE_SCN_LNK_OTHER = $00000100; // Reserved.
  1937.   {$EXTERNALSYM IMAGE_SCN_LNK_OTHER}
  1938.   IMAGE_SCN_LNK_INFO  = $00000200; // Section contains comments or some other type of information.
  1939.   {$EXTERNALSYM IMAGE_SCN_LNK_INFO}
  1940. //      IMAGE_SCN_TYPE_OVER                  0x00000400  // Reserved.
  1941.   IMAGE_SCN_LNK_REMOVE = $00000800; // Section contents will not become part of image.
  1942.   {$EXTERNALSYM IMAGE_SCN_LNK_REMOVE}
  1943.   IMAGE_SCN_LNK_COMDAT = $00001000; // Section contents comdat.
  1944.   {$EXTERNALSYM IMAGE_SCN_LNK_COMDAT}
  1945. //                                           0x00002000  // Reserved.
  1946. //      IMAGE_SCN_MEM_PROTECTED - Obsolete   0x00004000
  1947.   IMAGE_SCN_NO_DEFER_SPEC_EXC = $00004000; // Reset speculative exceptions handling bits in the TLB entries for this section.
  1948.   {$EXTERNALSYM IMAGE_SCN_NO_DEFER_SPEC_EXC}
  1949.   IMAGE_SCN_GPREL             = $00008000; // Section content can be accessed relative to GP
  1950.   {$EXTERNALSYM IMAGE_SCN_GPREL}
  1951.   IMAGE_SCN_MEM_FARDATA       = $00008000;
  1952.   {$EXTERNALSYM IMAGE_SCN_MEM_FARDATA}
  1953. //      IMAGE_SCN_MEM_SYSHEAP  - Obsolete    0x00010000
  1954.   IMAGE_SCN_MEM_PURGEABLE = $00020000;
  1955.   {$EXTERNALSYM IMAGE_SCN_MEM_PURGEABLE}
  1956.   IMAGE_SCN_MEM_16BIT     = $00020000;
  1957.   {$EXTERNALSYM IMAGE_SCN_MEM_16BIT}
  1958.   IMAGE_SCN_MEM_LOCKED    = $00040000;
  1959.   {$EXTERNALSYM IMAGE_SCN_MEM_LOCKED}
  1960.   IMAGE_SCN_MEM_PRELOAD   = $00080000;
  1961.   {$EXTERNALSYM IMAGE_SCN_MEM_PRELOAD}
  1962.   IMAGE_SCN_ALIGN_1BYTES    = $00100000;
  1963.   {$EXTERNALSYM IMAGE_SCN_ALIGN_1BYTES}
  1964.   IMAGE_SCN_ALIGN_2BYTES    = $00200000;
  1965.   {$EXTERNALSYM IMAGE_SCN_ALIGN_2BYTES}
  1966.   IMAGE_SCN_ALIGN_4BYTES    = $00300000;
  1967.   {$EXTERNALSYM IMAGE_SCN_ALIGN_4BYTES}
  1968.   IMAGE_SCN_ALIGN_8BYTES    = $00400000;
  1969.   {$EXTERNALSYM IMAGE_SCN_ALIGN_8BYTES}
  1970.   IMAGE_SCN_ALIGN_16BYTES   = $00500000; // Default alignment if no others are specified.
  1971.   {$EXTERNALSYM IMAGE_SCN_ALIGN_16BYTES}
  1972.   IMAGE_SCN_ALIGN_32BYTES   = $00600000;
  1973.   {$EXTERNALSYM IMAGE_SCN_ALIGN_32BYTES}
  1974.   IMAGE_SCN_ALIGN_64BYTES   = $00700000;
  1975.   {$EXTERNALSYM IMAGE_SCN_ALIGN_64BYTES}
  1976.   IMAGE_SCN_ALIGN_128BYTES  = $00800000;
  1977.   {$EXTERNALSYM IMAGE_SCN_ALIGN_128BYTES}
  1978.   IMAGE_SCN_ALIGN_256BYTES  = $00900000;
  1979.   {$EXTERNALSYM IMAGE_SCN_ALIGN_256BYTES}
  1980.   IMAGE_SCN_ALIGN_512BYTES  = $00A00000;
  1981.   {$EXTERNALSYM IMAGE_SCN_ALIGN_512BYTES}
  1982.   IMAGE_SCN_ALIGN_1024BYTES = $00B00000;
  1983.   {$EXTERNALSYM IMAGE_SCN_ALIGN_1024BYTES}
  1984.   IMAGE_SCN_ALIGN_2048BYTES = $00C00000;
  1985.   {$EXTERNALSYM IMAGE_SCN_ALIGN_2048BYTES}
  1986.   IMAGE_SCN_ALIGN_4096BYTES = $00D00000;
  1987.   {$EXTERNALSYM IMAGE_SCN_ALIGN_4096BYTES}
  1988.   IMAGE_SCN_ALIGN_8192BYTES = $00E00000;
  1989.   {$EXTERNALSYM IMAGE_SCN_ALIGN_8192BYTES}
  1990. // Unused                                    0x00F00000
  1991.   IMAGE_SCN_ALIGN_MASK = $00F00000;
  1992.   {$EXTERNALSYM IMAGE_SCN_ALIGN_MASK}
  1993.   IMAGE_SCN_LNK_NRELOC_OVFL = $01000000; // Section contains extended relocations.
  1994.   {$EXTERNALSYM IMAGE_SCN_LNK_NRELOC_OVFL}
  1995.   IMAGE_SCN_MEM_DISCARDABLE = $02000000; // Section can be discarded.
  1996.   {$EXTERNALSYM IMAGE_SCN_MEM_DISCARDABLE}
  1997.   IMAGE_SCN_MEM_NOT_CACHED  = $04000000; // Section is not cachable.
  1998.   {$EXTERNALSYM IMAGE_SCN_MEM_NOT_CACHED}
  1999.   IMAGE_SCN_MEM_NOT_PAGED   = $08000000; // Section is not pageable.
  2000.   {$EXTERNALSYM IMAGE_SCN_MEM_NOT_PAGED}
  2001.   IMAGE_SCN_MEM_SHARED      = $10000000; // Section is shareable.
  2002.   {$EXTERNALSYM IMAGE_SCN_MEM_SHARED}
  2003.   IMAGE_SCN_MEM_EXECUTE     = $20000000; // Section is executable.
  2004.   {$EXTERNALSYM IMAGE_SCN_MEM_EXECUTE}
  2005.   IMAGE_SCN_MEM_READ        = $40000000; // Section is readable.
  2006.   {$EXTERNALSYM IMAGE_SCN_MEM_READ}
  2007.   IMAGE_SCN_MEM_WRITE       = DWORD($80000000); // Section is writeable.
  2008.   {$EXTERNALSYM IMAGE_SCN_MEM_WRITE}
  2009. //
  2010. // TLS Chaacteristic Flags
  2011. //
  2012.   IMAGE_SCN_SCALE_INDEX = $00000001; // Tls index is scaled
  2013.   {$EXTERNALSYM IMAGE_SCN_SCALE_INDEX}
  2014. // #include "pshpack2.h"                       // Symbols, relocs, and linenumbers are 2 byte packed
  2015. //
  2016. // Symbol format.
  2017. //
  2018. type
  2019.   TImageSymbolN = record
  2020.     case Integer of
  2021.       0: (
  2022.         ShortName: array [0..7] of BYTE);
  2023.       1: (
  2024.         Short: DWORD;     // if 0, use LongName
  2025.         Long: DWORD);     // offset into string table
  2026.       2: (
  2027.         LongName: array [0..1] of DWORD);
  2028.   end;
  2029.   PIMAGE_SYMBOL = ^IMAGE_SYMBOL;
  2030.   {$EXTERNALSYM PIMAGE_SYMBOL}
  2031.   _IMAGE_SYMBOL = record
  2032.     N: TImageSymbolN;
  2033.     Value: DWORD;
  2034.     SectionNumber: SHORT;
  2035.     Type_: WORD;
  2036.     StorageClass: BYTE;
  2037.     NumberOfAuxSymbols: BYTE;
  2038.   end;
  2039.   {$EXTERNALSYM _IMAGE_SYMBOL}
  2040.   IMAGE_SYMBOL = _IMAGE_SYMBOL;
  2041.   {$EXTERNALSYM IMAGE_SYMBOL}
  2042.   TImageSymbol = IMAGE_SYMBOL;
  2043.   PImageSymbol = PIMAGE_SYMBOL;
  2044. const
  2045.   IMAGE_SIZEOF_SYMBOL = 18;
  2046.   {$EXTERNALSYM IMAGE_SIZEOF_SYMBOL}
  2047. //
  2048. // Section values.
  2049. //
  2050. // Symbols have a section number of the section in which they are
  2051. // defined. Otherwise, section numbers have the following meanings:
  2052. //
  2053.   IMAGE_SYM_UNDEFINED = SHORT(0);  // Symbol is undefined or is common.
  2054.   {$EXTERNALSYM IMAGE_SYM_UNDEFINED}
  2055.   IMAGE_SYM_ABSOLUTE  = SHORT(-1); // Symbol is an absolute value.
  2056.   {$EXTERNALSYM IMAGE_SYM_ABSOLUTE}
  2057.   IMAGE_SYM_DEBUG     = SHORT(-2); // Symbol is a special debug item.
  2058.   {$EXTERNALSYM IMAGE_SYM_DEBUG}
  2059.   IMAGE_SYM_SECTION_MAX = SHORT($FEFF ); // Values 0xFF00-0xFFFF are special
  2060.   {$EXTERNALSYM IMAGE_SYM_SECTION_MAX}
  2061. //
  2062. // Type (fundamental) values.
  2063. //
  2064.   IMAGE_SYM_TYPE_NULL   = $0000; // no type.
  2065.   {$EXTERNALSYM IMAGE_SYM_TYPE_NULL}
  2066.   IMAGE_SYM_TYPE_VOID   = $0001;
  2067.   {$EXTERNALSYM IMAGE_SYM_TYPE_VOID}
  2068.   IMAGE_SYM_TYPE_CHAR   = $0002; // type character.
  2069.   {$EXTERNALSYM IMAGE_SYM_TYPE_CHAR}
  2070.   IMAGE_SYM_TYPE_SHORT  = $0003; // type short integer.
  2071.   {$EXTERNALSYM IMAGE_SYM_TYPE_SHORT}
  2072.   IMAGE_SYM_TYPE_INT    = $0004;
  2073.   {$EXTERNALSYM IMAGE_SYM_TYPE_INT}
  2074.   IMAGE_SYM_TYPE_LONG   = $0005;
  2075.   {$EXTERNALSYM IMAGE_SYM_TYPE_LONG}
  2076.   IMAGE_SYM_TYPE_FLOAT  = $0006;
  2077.   {$EXTERNALSYM IMAGE_SYM_TYPE_FLOAT}
  2078.   IMAGE_SYM_TYPE_DOUBLE = $0007;
  2079.   {$EXTERNALSYM IMAGE_SYM_TYPE_DOUBLE}
  2080.   IMAGE_SYM_TYPE_STRUCT = $0008;
  2081.   {$EXTERNALSYM IMAGE_SYM_TYPE_STRUCT}
  2082.   IMAGE_SYM_TYPE_UNION  = $0009;
  2083.   {$EXTERNALSYM IMAGE_SYM_TYPE_UNION}
  2084.   IMAGE_SYM_TYPE_ENUM   = $000A; // enumeration.
  2085.   {$EXTERNALSYM IMAGE_SYM_TYPE_ENUM}
  2086.   IMAGE_SYM_TYPE_MOE    = $000B; // member of enumeration.
  2087.   {$EXTERNALSYM IMAGE_SYM_TYPE_MOE}
  2088.   IMAGE_SYM_TYPE_BYTE   = $000C;
  2089.   {$EXTERNALSYM IMAGE_SYM_TYPE_BYTE}
  2090.   IMAGE_SYM_TYPE_WORD   = $000D;
  2091.   {$EXTERNALSYM IMAGE_SYM_TYPE_WORD}
  2092.   IMAGE_SYM_TYPE_UINT   = $000E;
  2093.   {$EXTERNALSYM IMAGE_SYM_TYPE_UINT}
  2094.   IMAGE_SYM_TYPE_DWORD  = $000F;
  2095.   {$EXTERNALSYM IMAGE_SYM_TYPE_DWORD}
  2096.   IMAGE_SYM_TYPE_PCODE  = $8000;
  2097.   {$EXTERNALSYM IMAGE_SYM_TYPE_PCODE}
  2098. //
  2099. // Type (derived) values.
  2100. //
  2101.   IMAGE_SYM_DTYPE_NULL     = 0; // no derived type.
  2102.   {$EXTERNALSYM IMAGE_SYM_DTYPE_NULL}
  2103.   IMAGE_SYM_DTYPE_POINTER  = 1; // pointer.
  2104.   {$EXTERNALSYM IMAGE_SYM_DTYPE_POINTER}
  2105.   IMAGE_SYM_DTYPE_FUNCTION = 2; // function.
  2106.   {$EXTERNALSYM IMAGE_SYM_DTYPE_FUNCTION}
  2107.   IMAGE_SYM_DTYPE_ARRAY    = 3; // array.
  2108.   {$EXTERNALSYM IMAGE_SYM_DTYPE_ARRAY}
  2109. //
  2110. // Storage classes.
  2111. //
  2112.   IMAGE_SYM_CLASS_END_OF_FUNCTION  = BYTE(-1);
  2113.   {$EXTERNALSYM IMAGE_SYM_CLASS_END_OF_FUNCTION}
  2114.   IMAGE_SYM_CLASS_NULL             = $0000;
  2115.   {$EXTERNALSYM IMAGE_SYM_CLASS_NULL}
  2116.   IMAGE_SYM_CLASS_AUTOMATIC        = $0001;
  2117.   {$EXTERNALSYM IMAGE_SYM_CLASS_AUTOMATIC}
  2118.   IMAGE_SYM_CLASS_EXTERNAL         = $0002;
  2119.   {$EXTERNALSYM IMAGE_SYM_CLASS_EXTERNAL}
  2120.   IMAGE_SYM_CLASS_STATIC           = $0003;
  2121.   {$EXTERNALSYM IMAGE_SYM_CLASS_STATIC}
  2122.   IMAGE_SYM_CLASS_REGISTER         = $0004;
  2123.   {$EXTERNALSYM IMAGE_SYM_CLASS_REGISTER}
  2124.   IMAGE_SYM_CLASS_EXTERNAL_DEF     = $0005;
  2125.   {$EXTERNALSYM IMAGE_SYM_CLASS_EXTERNAL_DEF}
  2126.   IMAGE_SYM_CLASS_LABEL            = $0006;
  2127.   {$EXTERNALSYM IMAGE_SYM_CLASS_LABEL}
  2128.   IMAGE_SYM_CLASS_UNDEFINED_LABEL  = $0007;
  2129.   {$EXTERNALSYM IMAGE_SYM_CLASS_UNDEFINED_LABEL}
  2130.   IMAGE_SYM_CLASS_MEMBER_OF_STRUCT = $0008;
  2131.   {$EXTERNALSYM IMAGE_SYM_CLASS_MEMBER_OF_STRUCT}
  2132.   IMAGE_SYM_CLASS_ARGUMENT         = $0009;
  2133.   {$EXTERNALSYM IMAGE_SYM_CLASS_ARGUMENT}
  2134.   IMAGE_SYM_CLASS_STRUCT_TAG       = $000A;
  2135.   {$EXTERNALSYM IMAGE_SYM_CLASS_STRUCT_TAG}
  2136.   IMAGE_SYM_CLASS_MEMBER_OF_UNION  = $000B;
  2137.   {$EXTERNALSYM IMAGE_SYM_CLASS_MEMBER_OF_UNION}
  2138.   IMAGE_SYM_CLASS_UNION_TAG        = $000C;
  2139.   {$EXTERNALSYM IMAGE_SYM_CLASS_UNION_TAG}
  2140.   IMAGE_SYM_CLASS_TYPE_DEFINITION  = $000D;
  2141.   {$EXTERNALSYM IMAGE_SYM_CLASS_TYPE_DEFINITION}
  2142.   IMAGE_SYM_CLASS_UNDEFINED_STATIC = $000E;
  2143.   {$EXTERNALSYM IMAGE_SYM_CLASS_UNDEFINED_STATIC}
  2144.   IMAGE_SYM_CLASS_ENUM_TAG         = $000F;
  2145.   {$EXTERNALSYM IMAGE_SYM_CLASS_ENUM_TAG}
  2146.   IMAGE_SYM_CLASS_MEMBER_OF_ENUM   = $0010;
  2147.   {$EXTERNALSYM IMAGE_SYM_CLASS_MEMBER_OF_ENUM}
  2148.   IMAGE_SYM_CLASS_REGISTER_PARAM   = $0011;
  2149.   {$EXTERNALSYM IMAGE_SYM_CLASS_REGISTER_PARAM}
  2150.   IMAGE_SYM_CLASS_BIT_FIELD        = $0012;
  2151.   {$EXTERNALSYM IMAGE_SYM_CLASS_BIT_FIELD}
  2152.   IMAGE_SYM_CLASS_FAR_EXTERNAL = $0044;
  2153.   {$EXTERNALSYM IMAGE_SYM_CLASS_FAR_EXTERNAL}
  2154.   IMAGE_SYM_CLASS_BLOCK         = $0064;
  2155.   {$EXTERNALSYM IMAGE_SYM_CLASS_BLOCK}
  2156.   IMAGE_SYM_CLASS_FUNCTION      = $0065;
  2157.   {$EXTERNALSYM IMAGE_SYM_CLASS_FUNCTION}
  2158.   IMAGE_SYM_CLASS_END_OF_STRUCT = $0066;
  2159.   {$EXTERNALSYM IMAGE_SYM_CLASS_END_OF_STRUCT}
  2160.   IMAGE_SYM_CLASS_FILE          = $0067;
  2161.   {$EXTERNALSYM IMAGE_SYM_CLASS_FILE}
  2162. // new
  2163.   IMAGE_SYM_CLASS_SECTION       = $0068;
  2164.   {$EXTERNALSYM IMAGE_SYM_CLASS_SECTION}
  2165.   IMAGE_SYM_CLASS_WEAK_EXTERNAL = $0069;
  2166.   {$EXTERNALSYM IMAGE_SYM_CLASS_WEAK_EXTERNAL}
  2167.   IMAGE_SYM_CLASS_CLR_TOKEN     = $006B;
  2168.   {$EXTERNALSYM IMAGE_SYM_CLASS_CLR_TOKEN}
  2169. // type packing constants
  2170.   N_BTMASK = $000F;
  2171.   {$EXTERNALSYM N_BTMASK}
  2172.   N_TMASK  = $0030;
  2173.   {$EXTERNALSYM N_TMASK}
  2174.   N_TMASK1 = $00C0;
  2175.   {$EXTERNALSYM N_TMASK1}
  2176.   N_TMASK2 = $00F0;
  2177.   {$EXTERNALSYM N_TMASK2}
  2178.   N_BTSHFT = 4;
  2179.   {$EXTERNALSYM N_BTSHFT}
  2180.   N_TSHIFT = 2;
  2181.   {$EXTERNALSYM N_TSHIFT}
  2182. // MACROS
  2183. // Basic Type of  x
  2184. function BTYPE(x: DWORD): DWORD;
  2185. {$EXTERNALSYM BTYPE}
  2186. // Is x a pointer?
  2187. function ISPTR(x: DWORD): Boolean;
  2188. {$EXTERNALSYM ISPTR}
  2189. // Is x a function?
  2190. function ISFCN(x: DWORD): Boolean;
  2191. {$EXTERNALSYM ISFCN}
  2192. // Is x an array?
  2193. function ISARY(x: DWORD): Boolean;
  2194. {$EXTERNALSYM ISARY}
  2195. // Is x a structure, union, or enumeration TAG?
  2196. function ISTAG(x: DWORD): Boolean;
  2197. {$EXTERNALSYM ISTAG}
  2198. //
  2199. // Auxiliary entry format.
  2200. //
  2201. type
  2202.   TImgAuzSymSymMisc = record
  2203.     case Integer of
  2204.       0: (
  2205.         Linenumber: WORD;             // declaration line number
  2206.         Size: WORD);                  // size of struct, union, or enum
  2207.       1: (
  2208.         TotalSize: DWORD);
  2209.   end;
  2210.   TImgAuzSymSymFcnAry = record
  2211.     case Integer of
  2212.       0: ( // if ISFCN, tag, or .bb
  2213.         PointerToLinenumber: DWORD;
  2214.         PointerToNextFunction: DWORD);
  2215.       1: ( // if ISARY, up to 4 dimen.
  2216.         Dimension: array [0..3] of WORD);
  2217.   end;
  2218.   TImgAuxSymSym = record
  2219.     TagIndex: DWORD;                      // struct, union, or enum tag index
  2220.     Misc: TImgAuzSymSymMisc;
  2221.     FcnAry: TImgAuzSymSymFcnAry;
  2222.     TvIndex: WORD;                        // tv index
  2223.   end;
  2224.   TImgAuxSymFile = record
  2225.     Name: array [0..IMAGE_SIZEOF_SYMBOL - 1] of BYTE;
  2226.   end;
  2227.   TImgAuxSymSection = record
  2228.     Length: DWORD;                         // section length
  2229.     NumberOfRelocations: WORD;             // number of relocation entries
  2230.     NumberOfLinenumbers: WORD;             // number of line numbers
  2231.     CheckSum: DWORD;                       // checksum for communal
  2232.     Number: SHORT;                         // section number to associate with
  2233.     Selection: BYTE;                       // communal selection type
  2234.   end;
  2235.   PIMAGE_AUX_SYMBOL = ^IMAGE_AUX_SYMBOL;
  2236.   {$EXTERNALSYM PIMAGE_AUX_SYMBOL}
  2237.   _IMAGE_AUX_SYMBOL = record
  2238.     case Integer of
  2239.       0: (Sym: TImgAuxSymSym);
  2240.       1: (File_: TImgAuxSymFile);
  2241.       2: (Section: TImgAuxSymSection);
  2242.   end;
  2243.   {$EXTERNALSYM _IMAGE_AUX_SYMBOL}
  2244.   IMAGE_AUX_SYMBOL = _IMAGE_AUX_SYMBOL;
  2245.   {$EXTERNALSYM IMAGE_AUX_SYMBOL}
  2246.   TImageAuxSymbol = IMAGE_AUX_SYMBOL;
  2247.   PImageAuxSymbol = PIMAGE_AUX_SYMBOL;
  2248. const
  2249.   IMAGE_SIZEOF_AUX_SYMBOL = 18;
  2250.   {$EXTERNALSYM IMAGE_SIZEOF_AUX_SYMBOL}
  2251.   IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1;
  2252.   {$EXTERNALSYM IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF}
  2253. type
  2254.   IMAGE_AUX_SYMBOL_TYPE = DWORD;
  2255.   {$EXTERNALSYM IMAGE_AUX_SYMBOL_TYPE}
  2256.   TImageAuxSymbolType = IMAGE_AUX_SYMBOL_TYPE;
  2257.   IMAGE_AUX_SYMBOL_TOKEN_DEF = packed record
  2258.     bAuxType: BYTE;                  // IMAGE_AUX_SYMBOL_TYPE
  2259.     bReserved: BYTE;                 // Must be 0
  2260.     SymbolTableIndex: DWORD;
  2261.     rgbReserved: array [0..11] of BYTE;           // Must be 0
  2262.   end;
  2263.   {$EXTERNALSYM IMAGE_AUX_SYMBOL_TOKEN_DEF}
  2264.   PIMAGE_AUX_SYMBOL_TOKEN_DEF = ^IMAGE_AUX_SYMBOL_TOKEN_DEF;
  2265.   {$EXTERNALSYM PIMAGE_AUX_SYMBOL_TOKEN_DEF}
  2266.   TImageAuxSymbolTokenDef = IMAGE_AUX_SYMBOL_TOKEN_DEF;
  2267.   PImageAuxSymbolTokenDef = PIMAGE_AUX_SYMBOL_TOKEN_DEF;
  2268. //
  2269. // Communal selection types.
  2270. //
  2271. const
  2272.   IMAGE_COMDAT_SELECT_NODUPLICATES = 1;
  2273.   {$EXTERNALSYM IMAGE_COMDAT_SELECT_NODUPLICATES}
  2274.   IMAGE_COMDAT_SELECT_ANY          = 2;
  2275.   {$EXTERNALSYM IMAGE_COMDAT_SELECT_ANY}
  2276.   IMAGE_COMDAT_SELECT_SAME_SIZE    = 3;
  2277.   {$EXTERNALSYM IMAGE_COMDAT_SELECT_SAME_SIZE}
  2278.   IMAGE_COMDAT_SELECT_EXACT_MATCH  = 4;
  2279.   {$EXTERNALSYM IMAGE_COMDAT_SELECT_EXACT_MATCH}
  2280.   IMAGE_COMDAT_SELECT_ASSOCIATIVE  = 5;
  2281.   {$EXTERNALSYM IMAGE_COMDAT_SELECT_ASSOCIATIVE}
  2282.   IMAGE_COMDAT_SELECT_LARGEST      = 6;
  2283.   {$EXTERNALSYM IMAGE_COMDAT_SELECT_LARGEST}
  2284.   IMAGE_COMDAT_SELECT_NEWEST       = 7;
  2285.   {$EXTERNALSYM IMAGE_COMDAT_SELECT_NEWEST}
  2286.   IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1;
  2287.   {$EXTERNALSYM IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY}
  2288.   IMAGE_WEAK_EXTERN_SEARCH_LIBRARY   = 2;
  2289.   {$EXTERNALSYM IMAGE_WEAK_EXTERN_SEARCH_LIBRARY}
  2290.   IMAGE_WEAK_EXTERN_SEARCH_ALIAS     = 3;
  2291.   {$EXTERNALSYM IMAGE_WEAK_EXTERN_SEARCH_ALIAS}
  2292. //
  2293. // Relocation format.
  2294. //
  2295. type
  2296.   TImgRelocUnion = record
  2297.     case Integer of
  2298.       0: (VirtualAddress: DWORD);
  2299.       1: (RelocCount: DWORD);  // Set to the real count when IMAGE_SCN_LNK_NRELOC_OVFL is set
  2300.   end;
  2301.   PIMAGE_RELOCATION = ^IMAGE_RELOCATION;
  2302.   {$EXTERNALSYM PIMAGE_RELOCATION}
  2303.   _IMAGE_RELOCATION = record
  2304.     Union: TImgRelocUnion;
  2305.     SymbolTableIndex: DWORD;
  2306.     Type_: WORD;
  2307.   end;
  2308.   {$EXTERNALSYM _IMAGE_RELOCATION}
  2309.   IMAGE_RELOCATION = _IMAGE_RELOCATION;
  2310.   {$EXTERNALSYM IMAGE_RELOCATION}
  2311.   TImageRelocation = IMAGE_RELOCATION;
  2312.   PImageRelocation = PIMAGE_RELOCATION;
  2313. const
  2314.   IMAGE_SIZEOF_RELOCATION = 10;
  2315.   {$EXTERNALSYM IMAGE_SIZEOF_RELOCATION}
  2316. //
  2317. // I386 relocation types.
  2318. //
  2319.   IMAGE_REL_I386_ABSOLUTE = $0000; // Reference is absolute, no relocation is necessary
  2320.   {$EXTERNALSYM IMAGE_REL_I386_ABSOLUTE}
  2321.   IMAGE_REL_I386_DIR16    = $0001; // Direct 16-bit reference to the symbols virtual address
  2322.   {$EXTERNALSYM IMAGE_REL_I386_DIR16}
  2323.   IMAGE_REL_I386_REL16    = $0002; // PC-relative 16-bit reference to the symbols virtual address
  2324.   {$EXTERNALSYM IMAGE_REL_I386_REL16}
  2325.   IMAGE_REL_I386_DIR32    = $0006; // Direct 32-bit reference to the symbols virtual address
  2326.   {$EXTERNALSYM IMAGE_REL_I386_DIR32}
  2327.   IMAGE_REL_I386_DIR32NB  = $0007; // Direct 32-bit reference to the symbols virtual address, base not included
  2328.   {$EXTERNALSYM IMAGE_REL_I386_DIR32NB}
  2329.   IMAGE_REL_I386_SEG12    = $0009; // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
  2330.   {$EXTERNALSYM IMAGE_REL_I386_SEG12}
  2331.   IMAGE_REL_I386_SECTION  = $000A;
  2332.   {$EXTERNALSYM IMAGE_REL_I386_SECTION}
  2333.   IMAGE_REL_I386_SECREL   = $000B;
  2334.   {$EXTERNALSYM IMAGE_REL_I386_SECREL}
  2335.   IMAGE_REL_MIPS_SECRELLO = $000C; // Low 16-bit section relative referemce (used for >32k TLS)
  2336.   {$EXTERNALSYM IMAGE_REL_MIPS_SECRELLO}
  2337.   IMAGE_REL_MIPS_SECRELHI = $000D; // High 16-bit section relative reference (used for >32k TLS)
  2338.   {$EXTERNALSYM IMAGE_REL_MIPS_SECRELHI}
  2339.   IMAGE_REL_I386_REL32    = $0014; // PC-relative 32-bit reference to the symbols virtual address
  2340.   {$EXTERNALSYM IMAGE_REL_I386_REL32}
  2341. //
  2342. // MIPS relocation types.
  2343. //
  2344.   IMAGE_REL_MIPS_ABSOLUTE  = $0000; // Reference is absolute, no relocation is necessary
  2345.   {$EXTERNALSYM IMAGE_REL_MIPS_ABSOLUTE}
  2346.   IMAGE_REL_MIPS_REFHALF   = $0001;
  2347.   {$EXTERNALSYM IMAGE_REL_MIPS_REFHALF}
  2348.   IMAGE_REL_MIPS_REFWORD   = $0002;
  2349.   {$EXTERNALSYM IMAGE_REL_MIPS_REFWORD}
  2350.   IMAGE_REL_MIPS_JMPADDR   = $0003;
  2351.   {$EXTERNALSYM IMAGE_REL_MIPS_JMPADDR}
  2352.   IMAGE_REL_MIPS_REFHI     = $0004;
  2353.   {$EXTERNALSYM IMAGE_REL_MIPS_REFHI}
  2354.   IMAGE_REL_MIPS_REFLO     = $0005;
  2355.   {$EXTERNALSYM IMAGE_REL_MIPS_REFLO}
  2356.   IMAGE_REL_MIPS_GPREL     = $0006;
  2357.   {$EXTERNALSYM IMAGE_REL_MIPS_GPREL}
  2358.   IMAGE_REL_MIPS_LITERAL   = $0007;
  2359.   {$EXTERNALSYM IMAGE_REL_MIPS_LITERAL}
  2360.   IMAGE_REL_MIPS_SECTION   = $000A;
  2361.   {$EXTERNALSYM IMAGE_REL_MIPS_SECTION}
  2362.   IMAGE_REL_MIPS_SECREL    = $000B;
  2363.   {$EXTERNALSYM IMAGE_REL_MIPS_SECREL}
  2364.   //IMAGE_REL_MIPS_SECRELLO  = $000C; // Low 16-bit section relative referemce (used for >32k TLS)
  2365.   //{$EXTERNALSYM IMAGE_REL_MIPS_SECRELLO}
  2366.   //IMAGE_REL_MIPS_SECRELHI  = $000D; // High 16-bit section relative reference (used for >32k TLS)
  2367.   //{$EXTERNALSYM IMAGE_REL_MIPS_SECRELHI}
  2368.   IMAGE_REL_MIPS_TOKEN     = $000E; // clr token
  2369.   {$EXTERNALSYM IMAGE_REL_MIPS_TOKEN}
  2370.   IMAGE_REL_MIPS_JMPADDR16 = $0010;
  2371.   {$EXTERNALSYM IMAGE_REL_MIPS_JMPADDR16}
  2372.   IMAGE_REL_MIPS_REFWORDNB = $0022;
  2373.   {$EXTERNALSYM IMAGE_REL_MIPS_REFWORDNB}
  2374.   IMAGE_REL_MIPS_PAIR      = $0025;
  2375.   {$EXTERNALSYM IMAGE_REL_MIPS_PAIR}
  2376. //
  2377. // Alpha Relocation types.
  2378. //
  2379.   IMAGE_REL_ALPHA_ABSOLUTE       = $0000;
  2380.   {$EXTERNALSYM IMAGE_REL_ALPHA_ABSOLUTE}
  2381.   IMAGE_REL_ALPHA_REFLONG        = $0001;
  2382.   {$EXTERNALSYM IMAGE_REL_ALPHA_REFLONG}
  2383.   IMAGE_REL_ALPHA_REFQUAD        = $0002;
  2384.   {$EXTERNALSYM IMAGE_REL_ALPHA_REFQUAD}
  2385.   IMAGE_REL_ALPHA_GPREL32        = $0003;
  2386.   {$EXTERNALSYM IMAGE_REL_ALPHA_GPREL32}
  2387.   IMAGE_REL_ALPHA_LITERAL        = $0004;
  2388.   {$EXTERNALSYM IMAGE_REL_ALPHA_LITERAL}
  2389.   IMAGE_REL_ALPHA_LITUSE         = $0005;
  2390.   {$EXTERNALSYM IMAGE_REL_ALPHA_LITUSE}
  2391.   IMAGE_REL_ALPHA_GPDISP         = $0006;
  2392.   {$EXTERNALSYM IMAGE_REL_ALPHA_GPDISP}
  2393.   IMAGE_REL_ALPHA_BRADDR         = $0007;
  2394.   {$EXTERNALSYM IMAGE_REL_ALPHA_BRADDR}
  2395.   IMAGE_REL_ALPHA_HINT           = $0008;
  2396.   {$EXTERNALSYM IMAGE_REL_ALPHA_HINT}
  2397.   IMAGE_REL_ALPHA_INLINE_REFLONG = $0009;
  2398.   {$EXTERNALSYM IMAGE_REL_ALPHA_INLINE_REFLONG}
  2399.   IMAGE_REL_ALPHA_REFHI          = $000A;
  2400.   {$EXTERNALSYM IMAGE_REL_ALPHA_REFHI}
  2401.   IMAGE_REL_ALPHA_REFLO          = $000B;
  2402.   {$EXTERNALSYM IMAGE_REL_ALPHA_REFLO}
  2403.   IMAGE_REL_ALPHA_PAIR           = $000C;
  2404.   {$EXTERNALSYM IMAGE_REL_ALPHA_PAIR}
  2405.   IMAGE_REL_ALPHA_MATCH          = $000D;
  2406.   {$EXTERNALSYM IMAGE_REL_ALPHA_MATCH}
  2407.   IMAGE_REL_ALPHA_SECTION        = $000E;
  2408.   {$EXTERNALSYM IMAGE_REL_ALPHA_SECTION}
  2409.   IMAGE_REL_ALPHA_SECREL         = $000F;
  2410.   {$EXTERNALSYM IMAGE_REL_ALPHA_SECREL}
  2411.   IMAGE_REL_ALPHA_REFLONGNB      = $0010;
  2412.   {$EXTERNALSYM IMAGE_REL_ALPHA_REFLONGNB}
  2413.   IMAGE_REL_ALPHA_SECRELLO       = $0011; // Low 16-bit section relative reference
  2414.   {$EXTERNALSYM IMAGE_REL_ALPHA_SECRELLO}
  2415.   IMAGE_REL_ALPHA_SECRELHI       = $0012; // High 16-bit section relative reference
  2416.   {$EXTERNALSYM IMAGE_REL_ALPHA_SECRELHI}
  2417.   IMAGE_REL_ALPHA_REFQ3          = $0013; // High 16 bits of 48 bit reference
  2418.   {$EXTERNALSYM IMAGE_REL_ALPHA_REFQ3}
  2419.   IMAGE_REL_ALPHA_REFQ2          = $0014; // Middle 16 bits of 48 bit reference
  2420.   {$EXTERNALSYM IMAGE_REL_ALPHA_REFQ2}
  2421.   IMAGE_REL_ALPHA_REFQ1          = $0015; // Low 16 bits of 48 bit reference
  2422.   {$EXTERNALSYM IMAGE_REL_ALPHA_REFQ1}
  2423.   IMAGE_REL_ALPHA_GPRELLO        = $0016; // Low 16-bit GP relative reference
  2424.   {$EXTERNALSYM IMAGE_REL_ALPHA_GPRELLO}
  2425.   IMAGE_REL_ALPHA_GPRELHI        = $0017; // High 16-bit GP relative reference
  2426.   {$EXTERNALSYM IMAGE_REL_ALPHA_GPRELHI}
  2427. //
  2428. // IBM PowerPC relocation types.
  2429. //
  2430.   IMAGE_REL_PPC_ABSOLUTE = $0000; // NOP
  2431.   {$EXTERNALSYM IMAGE_REL_PPC_ABSOLUTE}
  2432.   IMAGE_REL_PPC_ADDR64   = $0001; // 64-bit address
  2433.   {$EXTERNALSYM IMAGE_REL_PPC_ADDR64}
  2434.   IMAGE_REL_PPC_ADDR32   = $0002; // 32-bit address
  2435.   {$EXTERNALSYM IMAGE_REL_PPC_ADDR32}
  2436.   IMAGE_REL_PPC_ADDR24   = $0003; // 26-bit address, shifted left 2 (branch absolute)
  2437.   {$EXTERNALSYM IMAGE_REL_PPC_ADDR24}
  2438.   IMAGE_REL_PPC_ADDR16   = $0004; // 16-bit address
  2439.   {$EXTERNALSYM IMAGE_REL_PPC_ADDR16}
  2440.   IMAGE_REL_PPC_ADDR14   = $0005; // 16-bit address, shifted left 2 (load doubleword)
  2441.   {$EXTERNALSYM IMAGE_REL_PPC_ADDR14}
  2442.   IMAGE_REL_PPC_REL24    = $0006; // 26-bit PC-relative offset, shifted left 2 (branch relative)
  2443.   {$EXTERNALSYM IMAGE_REL_PPC_REL24}
  2444.   IMAGE_REL_PPC_REL14    = $0007; // 16-bit PC-relative offset, shifted left 2 (br cond relative)
  2445.   {$EXTERNALSYM IMAGE_REL_PPC_REL14}
  2446.   IMAGE_REL_PPC_TOCREL16 = $0008; // 16-bit offset from TOC base
  2447.   {$EXTERNALSYM IMAGE_REL_PPC_TOCREL16}
  2448.   IMAGE_REL_PPC_TOCREL14 = $0009; // 16-bit offset from TOC base, shifted left 2 (load doubleword)
  2449.   {$EXTERNALSYM IMAGE_REL_PPC_TOCREL14}
  2450.   IMAGE_REL_PPC_ADDR32NB = $000A; // 32-bit addr w/o image base
  2451.   {$EXTERNALSYM IMAGE_REL_PPC_ADDR32NB}
  2452.   IMAGE_REL_PPC_SECREL   = $000B; // va of containing section (as in an image sectionhdr)
  2453.   {$EXTERNALSYM IMAGE_REL_PPC_SECREL}
  2454.   IMAGE_REL_PPC_SECTION  = $000C; // sectionheader number
  2455.   {$EXTERNALSYM IMAGE_REL_PPC_SECTION}
  2456.   IMAGE_REL_PPC_IFGLUE   = $000D; // substitute TOC restore instruction iff symbol is glue code
  2457.   {$EXTERNALSYM IMAGE_REL_PPC_IFGLUE}
  2458.   IMAGE_REL_PPC_IMGLUE   = $000E; // symbol is glue code; virtual address is TOC restore instruction
  2459.   {$EXTERNALSYM IMAGE_REL_PPC_IMGLUE}
  2460.   IMAGE_REL_PPC_SECREL16 = $000F; // va of containing section (limited to 16 bits)
  2461.   {$EXTERNALSYM IMAGE_REL_PPC_SECREL16}
  2462.   IMAGE_REL_PPC_REFHI    = $0010;
  2463.   {$EXTERNALSYM IMAGE_REL_PPC_REFHI}
  2464.   IMAGE_REL_PPC_REFLO    = $0011;
  2465.   {$EXTERNALSYM IMAGE_REL_PPC_REFLO}
  2466.   IMAGE_REL_PPC_PAIR     = $0012;
  2467.   {$EXTERNALSYM IMAGE_REL_PPC_PAIR}
  2468.   IMAGE_REL_PPC_SECRELLO = $0013; // Low 16-bit section relative reference (used for >32k TLS)
  2469.   {$EXTERNALSYM IMAGE_REL_PPC_SECRELLO}
  2470.   IMAGE_REL_PPC_SECRELHI = $0014; // High 16-bit section relative reference (used for >32k TLS)
  2471.   {$EXTERNALSYM IMAGE_REL_PPC_SECRELHI}
  2472.   IMAGE_REL_PPC_GPREL    = $0015;
  2473.   {$EXTERNALSYM IMAGE_REL_PPC_GPREL}
  2474.   IMAGE_REL_PPC_TOKEN    = $0016; // clr token
  2475.   {$EXTERNALSYM IMAGE_REL_PPC_TOKEN}
  2476.   IMAGE_REL_PPC_TYPEMASK = $00FF; // mask to isolate above values in IMAGE_RELOCATION.Type
  2477.   {$EXTERNALSYM IMAGE_REL_PPC_TYPEMASK}
  2478. // Flag bits in IMAGE_RELOCATION.TYPE
  2479.   IMAGE_REL_PPC_NEG      = $0100; // subtract reloc value rather than adding it
  2480.   {$EXTERNALSYM IMAGE_REL_PPC_NEG}
  2481.   IMAGE_REL_PPC_BRTAKEN  = $0200; // fix branch prediction bit to predict branch taken
  2482.   {$EXTERNALSYM IMAGE_REL_PPC_BRTAKEN}
  2483.   IMAGE_REL_PPC_BRNTAKEN = $0400; // fix branch prediction bit to predict branch not taken
  2484.   {$EXTERNALSYM IMAGE_REL_PPC_BRNTAKEN}
  2485.   IMAGE_REL_PPC_TOCDEFN  = $0800; // toc slot defined in file (or, data in toc)
  2486.   {$EXTERNALSYM IMAGE_REL_PPC_TOCDEFN}
  2487. //
  2488. // Hitachi SH3 relocation types.
  2489. //
  2490.   IMAGE_REL_SH3_ABSOLUTE        = $0000; // No relocation
  2491.   {$EXTERNALSYM IMAGE_REL_SH3_ABSOLUTE}
  2492.   IMAGE_REL_SH3_DIRECT16        = $0001; // 16 bit direct
  2493.   {$EXTERNALSYM IMAGE_REL_SH3_DIRECT16}
  2494.   IMAGE_REL_SH3_DIRECT32        = $0002; // 32 bit direct
  2495.   {$EXTERNALSYM IMAGE_REL_SH3_DIRECT32}
  2496.   IMAGE_REL_SH3_DIRECT8         = $0003; // 8 bit direct, -128..255
  2497.   {$EXTERNALSYM IMAGE_REL_SH3_DIRECT8}
  2498.   IMAGE_REL_SH3_DIRECT8_WORD    = $0004; // 8 bit direct .W (0 ext.)
  2499.   {$EXTERNALSYM IMAGE_REL_SH3_DIRECT8_WORD}
  2500.   IMAGE_REL_SH3_DIRECT8_LONG    = $0005; // 8 bit direct .L (0 ext.)
  2501.   {$EXTERNALSYM IMAGE_REL_SH3_DIRECT8_LONG}
  2502.   IMAGE_REL_SH3_DIRECT4         = $0006; // 4 bit direct (0 ext.)
  2503.   {$EXTERNALSYM IMAGE_REL_SH3_DIRECT4}
  2504.   IMAGE_REL_SH3_DIRECT4_WORD    = $0007; // 4 bit direct .W (0 ext.)
  2505.   {$EXTERNALSYM IMAGE_REL_SH3_DIRECT4_WORD}
  2506.   IMAGE_REL_SH3_DIRECT4_LONG    = $0008; // 4 bit direct .L (0 ext.)
  2507.   {$EXTERNALSYM IMAGE_REL_SH3_DIRECT4_LONG}
  2508.   IMAGE_REL_SH3_PCREL8_WORD     = $0009; // 8 bit PC relative .W
  2509.   {$EXTERNALSYM IMAGE_REL_SH3_PCREL8_WORD}
  2510.   IMAGE_REL_SH3_PCREL8_LONG     = $000A; // 8 bit PC relative .L
  2511.   {$EXTERNALSYM IMAGE_REL_SH3_PCREL8_LONG}
  2512.   IMAGE_REL_SH3_PCREL12_WORD    = $000B; // 12 LSB PC relative .W
  2513.   {$EXTERNALSYM IMAGE_REL_SH3_PCREL12_WORD}
  2514.   IMAGE_REL_SH3_STARTOF_SECTION = $000C; // Start of EXE section
  2515.   {$EXTERNALSYM IMAGE_REL_SH3_STARTOF_SECTION}
  2516.   IMAGE_REL_SH3_SIZEOF_SECTION  = $000D; // Size of EXE section
  2517.   {$EXTERNALSYM IMAGE_REL_SH3_SIZEOF_SECTION}
  2518.   IMAGE_REL_SH3_SECTION         = $000E; // Section table index
  2519.   {$EXTERNALSYM IMAGE_REL_SH3_SECTION}
  2520.   IMAGE_REL_SH3_SECREL          = $000F; // Offset within section
  2521.   {$EXTERNALSYM IMAGE_REL_SH3_SECREL}
  2522.   IMAGE_REL_SH3_DIRECT32_NB     = $0010; // 32 bit direct not based
  2523.   {$EXTERNALSYM IMAGE_REL_SH3_DIRECT32_NB}
  2524.   IMAGE_REL_SH3_GPREL4_LONG     = $0011; // GP-relative addressing
  2525.   {$EXTERNALSYM IMAGE_REL_SH3_GPREL4_LONG}
  2526.   IMAGE_REL_SH3_TOKEN           = $0012; // clr token
  2527.   {$EXTERNALSYM IMAGE_REL_SH3_TOKEN}
  2528.   IMAGE_REL_ARM_ABSOLUTE = $0000; // No relocation required
  2529.   {$EXTERNALSYM IMAGE_REL_ARM_ABSOLUTE}
  2530.   IMAGE_REL_ARM_ADDR32   = $0001; // 32 bit address
  2531.   {$EXTERNALSYM IMAGE_REL_ARM_ADDR32}
  2532.   IMAGE_REL_ARM_ADDR32NB = $0002; // 32 bit address w/o image base
  2533.   {$EXTERNALSYM IMAGE_REL_ARM_ADDR32NB}
  2534.   IMAGE_REL_ARM_BRANCH24 = $0003; // 24 bit offset << 2 & sign ext.
  2535.   {$EXTERNALSYM IMAGE_REL_ARM_BRANCH24}
  2536.   IMAGE_REL_ARM_BRANCH11 = $0004; // Thumb: 2 11 bit offsets
  2537.   {$EXTERNALSYM IMAGE_REL_ARM_BRANCH11}
  2538.   IMAGE_REL_ARM_TOKEN    = $0005; // clr token
  2539.   {$EXTERNALSYM IMAGE_REL_ARM_TOKEN}
  2540.   IMAGE_REL_ARM_GPREL12  = $0006; // GP-relative addressing (ARM)
  2541.   {$EXTERNALSYM IMAGE_REL_ARM_GPREL12}
  2542.   IMAGE_REL_ARM_GPREL7   = $0007; // GP-relative addressing (Thumb)
  2543.   {$EXTERNALSYM IMAGE_REL_ARM_GPREL7}
  2544.   IMAGE_REL_ARM_BLX24    = $0008;
  2545.   {$EXTERNALSYM IMAGE_REL_ARM_BLX24}
  2546.   IMAGE_REL_ARM_BLX11    = $0009;
  2547.   {$EXTERNALSYM IMAGE_REL_ARM_BLX11}
  2548.   IMAGE_REL_ARM_SECTION  = $000E; // Section table index
  2549.   {$EXTERNALSYM IMAGE_REL_ARM_SECTION}
  2550.   IMAGE_REL_ARM_SECREL   = $000F; // Offset within section
  2551.   {$EXTERNALSYM IMAGE_REL_ARM_SECREL}
  2552.   IMAGE_REL_AM_ABSOLUTE = $0000;
  2553.   {$EXTERNALSYM IMAGE_REL_AM_ABSOLUTE}
  2554.   IMAGE_REL_AM_ADDR32   = $0001;
  2555.   {$EXTERNALSYM IMAGE_REL_AM_ADDR32}
  2556.   IMAGE_REL_AM_ADDR32NB = $0002;
  2557.   {$EXTERNALSYM IMAGE_REL_AM_ADDR32NB}
  2558.   IMAGE_REL_AM_CALL32   = $0003;
  2559.   {$EXTERNALSYM IMAGE_REL_AM_CALL32}
  2560.   IMAGE_REL_AM_FUNCINFO = $0004;
  2561.   {$EXTERNALSYM IMAGE_REL_AM_FUNCINFO}
  2562.   IMAGE_REL_AM_REL32_1  = $0005;
  2563.   {$EXTERNALSYM IMAGE_REL_AM_REL32_1}
  2564.   IMAGE_REL_AM_REL32_2  = $0006;
  2565.   {$EXTERNALSYM IMAGE_REL_AM_REL32_2}
  2566.   IMAGE_REL_AM_SECREL   = $0007;
  2567.   {$EXTERNALSYM IMAGE_REL_AM_SECREL}
  2568.   IMAGE_REL_AM_SECTION  = $0008;
  2569.   {$EXTERNALSYM IMAGE_REL_AM_SECTION}
  2570.   IMAGE_REL_AM_TOKEN    = $0009;
  2571.   {$EXTERNALSYM IMAGE_REL_AM_TOKEN}
  2572. //
  2573. // X86-64 relocations
  2574. //
  2575.   IMAGE_REL_AMD64_ABSOLUTE = $0000; // Reference is absolute, no relocation is necessary
  2576.   {$EXTERNALSYM IMAGE_REL_AMD64_ABSOLUTE}
  2577.   IMAGE_REL_AMD64_ADDR64   = $0001; // 64-bit address (VA).
  2578.   {$EXTERNALSYM IMAGE_REL_AMD64_ADDR64}
  2579.   IMAGE_REL_AMD64_ADDR32   = $0002; // 32-bit address (VA).
  2580.   {$EXTERNALSYM IMAGE_REL_AMD64_ADDR32}
  2581.   IMAGE_REL_AMD64_ADDR32NB = $0003; // 32-bit address w/o image base (RVA).
  2582.   {$EXTERNALSYM IMAGE_REL_AMD64_ADDR32NB}
  2583.   IMAGE_REL_AMD64_REL32    = $0004; // 32-bit relative address from byte following reloc
  2584.   {$EXTERNALSYM IMAGE_REL_AMD64_REL32}
  2585.   IMAGE_REL_AMD64_REL32_1  = $0005; // 32-bit relative address from byte distance 1 from reloc
  2586.   {$EXTERNALSYM IMAGE_REL_AMD64_REL32_1}
  2587.   IMAGE_REL_AMD64_REL32_2  = $0006; // 32-bit relative address from byte distance 2 from reloc
  2588.   {$EXTERNALSYM IMAGE_REL_AMD64_REL32_2}
  2589.   IMAGE_REL_AMD64_REL32_3  = $0007; // 32-bit relative address from byte distance 3 from reloc
  2590.   {$EXTERNALSYM IMAGE_REL_AMD64_REL32_3}
  2591.   IMAGE_REL_AMD64_REL32_4  = $0008; // 32-bit relative address from byte distance 4 from reloc
  2592.   {$EXTERNALSYM IMAGE_REL_AMD64_REL32_4}
  2593.   IMAGE_REL_AMD64_REL32_5  = $0009; // 32-bit relative address from byte distance 5 from reloc
  2594.   {$EXTERNALSYM IMAGE_REL_AMD64_REL32_5}
  2595.   IMAGE_REL_AMD64_SECTION  = $000A; // Section index
  2596.   {$EXTERNALSYM IMAGE_REL_AMD64_SECTION}
  2597.   IMAGE_REL_AMD64_SECREL   = $000B; // 32 bit offset from base of section containing target
  2598.   {$EXTERNALSYM IMAGE_REL_AMD64_SECREL}
  2599.   IMAGE_REL_AMD64_SECREL7  = $000C; // 7 bit unsigned offset from base of section containing target
  2600.   {$EXTERNALSYM IMAGE_REL_AMD64_SECREL7}
  2601.   IMAGE_REL_AMD64_TOKEN    = $000D; // 32 bit metadata token
  2602.   {$EXTERNALSYM IMAGE_REL_AMD64_TOKEN}
  2603. //
  2604. // IA64 relocation types.
  2605. //
  2606.   IMAGE_REL_IA64_ABSOLUTE  = $0000;
  2607.   {$EXTERNALSYM IMAGE_REL_IA64_ABSOLUTE}
  2608.   IMAGE_REL_IA64_IMM14     = $0001;
  2609.   {$EXTERNALSYM IMAGE_REL_IA64_IMM14}
  2610.   IMAGE_REL_IA64_IMM22     = $0002;
  2611.   {$EXTERNALSYM IMAGE_REL_IA64_IMM22}
  2612.   IMAGE_REL_IA64_IMM64     = $0003;
  2613.   {$EXTERNALSYM IMAGE_REL_IA64_IMM64}
  2614.   IMAGE_REL_IA64_DIR32     = $0004;
  2615.   {$EXTERNALSYM IMAGE_REL_IA64_DIR32}
  2616.   IMAGE_REL_IA64_DIR64     = $0005;
  2617.   {$EXTERNALSYM IMAGE_REL_IA64_DIR64}
  2618.   IMAGE_REL_IA64_PCREL21B  = $0006;
  2619.   {$EXTERNALSYM IMAGE_REL_IA64_PCREL21B}
  2620.   IMAGE_REL_IA64_PCREL21M  = $0007;
  2621.   {$EXTERNALSYM IMAGE_REL_IA64_PCREL21M}
  2622.   IMAGE_REL_IA64_PCREL21F  = $0008;
  2623.   {$EXTERNALSYM IMAGE_REL_IA64_PCREL21F}
  2624.   IMAGE_REL_IA64_GPREL22   = $0009;
  2625.   {$EXTERNALSYM IMAGE_REL_IA64_GPREL22}
  2626.   IMAGE_REL_IA64_LTOFF22   = $000A;
  2627.   {$EXTERNALSYM IMAGE_REL_IA64_LTOFF22}
  2628.   IMAGE_REL_IA64_SECTION   = $000B;
  2629.   {$EXTERNALSYM IMAGE_REL_IA64_SECTION}
  2630.   IMAGE_REL_IA64_SECREL22  = $000C;
  2631.   {$EXTERNALSYM IMAGE_REL_IA64_SECREL22}
  2632.   IMAGE_REL_IA64_SECREL64I = $000D;
  2633.   {$EXTERNALSYM IMAGE_REL_IA64_SECREL64I}
  2634.   IMAGE_REL_IA64_SECREL32  = $000E;
  2635.   {$EXTERNALSYM IMAGE_REL_IA64_SECREL32}
  2636. //
  2637.   IMAGE_REL_IA64_DIR32NB    = $0010;
  2638.   {$EXTERNALSYM IMAGE_REL_IA64_DIR32NB}
  2639.   IMAGE_REL_IA64_SREL14     = $0011;
  2640.   {$EXTERNALSYM IMAGE_REL_IA64_SREL14}
  2641.   IMAGE_REL_IA64_SREL22     = $0012;
  2642.   {$EXTERNALSYM IMAGE_REL_IA64_SREL22}
  2643.   IMAGE_REL_IA64_SREL32     = $0013;
  2644.   {$EXTERNALSYM IMAGE_REL_IA64_SREL32}
  2645.   IMAGE_REL_IA64_UREL32     = $0014;
  2646.   {$EXTERNALSYM IMAGE_REL_IA64_UREL32}
  2647.   IMAGE_REL_IA64_PCREL60X   = $0015; // This is always a BRL and never converted
  2648.   {$EXTERNALSYM IMAGE_REL_IA64_PCREL60X}
  2649.   IMAGE_REL_IA64_PCREL60B   = $0016; // If possible, convert to MBB bundle with NOP.B in slot 1
  2650.   {$EXTERNALSYM IMAGE_REL_IA64_PCREL60B}
  2651.   IMAGE_REL_IA64_PCREL60F   = $0017; // If possible, convert to MFB bundle with NOP.F in slot 1
  2652.   {$EXTERNALSYM IMAGE_REL_IA64_PCREL60F}
  2653.   IMAGE_REL_IA64_PCREL60I   = $0018; // If possible, convert to MIB bundle with NOP.I in slot 1
  2654.   {$EXTERNALSYM IMAGE_REL_IA64_PCREL60I}
  2655.   IMAGE_REL_IA64_PCREL60M   = $0019; // If possible, convert to MMB bundle with NOP.M in slot 1
  2656.   {$EXTERNALSYM IMAGE_REL_IA64_PCREL60M}
  2657.   IMAGE_REL_IA64_IMMGPREL64 = $001A;
  2658.   {$EXTERNALSYM IMAGE_REL_IA64_IMMGPREL64}
  2659.   IMAGE_REL_IA64_TOKEN      = $001B; // clr token
  2660.   {$EXTERNALSYM IMAGE_REL_IA64_TOKEN}
  2661.   IMAGE_REL_IA64_GPREL32    = $001C;
  2662.   {$EXTERNALSYM IMAGE_REL_IA64_GPREL32}
  2663.   IMAGE_REL_IA64_ADDEND     = $001F;
  2664.   {$EXTERNALSYM IMAGE_REL_IA64_ADDEND}
  2665. //
  2666. // CEF relocation types.
  2667. //
  2668.   IMAGE_REL_CEF_ABSOLUTE = $0000; // Reference is absolute, no relocation is necessary
  2669.   {$EXTERNALSYM IMAGE_REL_CEF_ABSOLUTE}
  2670.   IMAGE_REL_CEF_ADDR32   = $0001; // 32-bit address (VA).
  2671.   {$EXTERNALSYM IMAGE_REL_CEF_ADDR32}
  2672.   IMAGE_REL_CEF_ADDR64   = $0002; // 64-bit address (VA).
  2673.   {$EXTERNALSYM IMAGE_REL_CEF_ADDR64}
  2674.   IMAGE_REL_CEF_ADDR32NB = $0003; // 32-bit address w/o image base (RVA).
  2675.   {$EXTERNALSYM IMAGE_REL_CEF_ADDR32NB}
  2676.   IMAGE_REL_CEF_SECTION  = $0004; // Section index
  2677.   {$EXTERNALSYM IMAGE_REL_CEF_SECTION}
  2678.   IMAGE_REL_CEF_SECREL   = $0005; // 32 bit offset from base of section containing target
  2679.   {$EXTERNALSYM IMAGE_REL_CEF_SECREL}
  2680.   IMAGE_REL_CEF_TOKEN    = $0006; // 32 bit metadata token
  2681.   {$EXTERNALSYM IMAGE_REL_CEF_TOKEN}
  2682. //
  2683. // clr relocation types.
  2684. //
  2685.   IMAGE_REL_CEE_ABSOLUTE = $0000; // Reference is absolute, no relocation is necessary
  2686.   {$EXTERNALSYM IMAGE_REL_CEE_ABSOLUTE}
  2687.   IMAGE_REL_CEE_ADDR32   = $0001; // 32-bit address (VA).
  2688.   {$EXTERNALSYM IMAGE_REL_CEE_ADDR32}
  2689.   IMAGE_REL_CEE_ADDR64   = $0002; // 64-bit address (VA).
  2690.   {$EXTERNALSYM IMAGE_REL_CEE_ADDR64}
  2691.   IMAGE_REL_CEE_ADDR32NB = $0003; // 32-bit address w/o image base (RVA).
  2692.   {$EXTERNALSYM IMAGE_REL_CEE_ADDR32NB}
  2693.   IMAGE_REL_CEE_SECTION  = $0004; // Section index
  2694.   {$EXTERNALSYM IMAGE_REL_CEE_SECTION}
  2695.   IMAGE_REL_CEE_SECREL   = $0005; // 32 bit offset from base of section containing target
  2696.   {$EXTERNALSYM IMAGE_REL_CEE_SECREL}
  2697.   IMAGE_REL_CEE_TOKEN    = $0006; // 32 bit metadata token
  2698.   {$EXTERNALSYM IMAGE_REL_CEE_TOKEN}
  2699.   IMAGE_REL_M32R_ABSOLUTE = $0000; // No relocation required
  2700.   {$EXTERNALSYM IMAGE_REL_M32R_ABSOLUTE}
  2701.   IMAGE_REL_M32R_ADDR32   = $0001; // 32 bit address
  2702.   {$EXTERNALSYM IMAGE_REL_M32R_ADDR32}
  2703.   IMAGE_REL_M32R_ADDR32NB = $0002; // 32 bit address w/o image base
  2704.   {$EXTERNALSYM IMAGE_REL_M32R_ADDR32NB}
  2705.   IMAGE_REL_M32R_ADDR24   = $0003; // 24 bit address
  2706.   {$EXTERNALSYM IMAGE_REL_M32R_ADDR24}
  2707.   IMAGE_REL_M32R_GPREL16  = $0004; // GP relative addressing
  2708.   {$EXTERNALSYM IMAGE_REL_M32R_GPREL16}
  2709.   IMAGE_REL_M32R_PCREL24  = $0005; // 24 bit offset << 2 & sign ext.
  2710.   {$EXTERNALSYM IMAGE_REL_M32R_PCREL24}
  2711.   IMAGE_REL_M32R_PCREL16  = $0006; // 16 bit offset << 2 & sign ext.
  2712.   {$EXTERNALSYM IMAGE_REL_M32R_PCREL16}
  2713.   IMAGE_REL_M32R_PCREL8   = $0007; // 8 bit offset << 2 & sign ext.
  2714.   {$EXTERNALSYM IMAGE_REL_M32R_PCREL8}
  2715.   IMAGE_REL_M32R_REFHALF  = $0008; // 16 MSBs
  2716.   {$EXTERNALSYM IMAGE_REL_M32R_REFHALF}
  2717.   IMAGE_REL_M32R_REFHI    = $0009; // 16 MSBs; adj for LSB sign ext.
  2718.   {$EXTERNALSYM IMAGE_REL_M32R_REFHI}
  2719.   IMAGE_REL_M32R_REFLO    = $000A; // 16 LSBs
  2720.   {$EXTERNALSYM IMAGE_REL_M32R_REFLO}
  2721.   IMAGE_REL_M32R_PAIR     = $000B; // Link HI and LO
  2722.   {$EXTERNALSYM IMAGE_REL_M32R_PAIR}
  2723.   IMAGE_REL_M32R_SECTION  = $000C; // Section table index
  2724.   {$EXTERNALSYM IMAGE_REL_M32R_SECTION}
  2725.   IMAGE_REL_M32R_SECREL32 = $000D; // 32 bit section relative reference
  2726.   {$EXTERNALSYM IMAGE_REL_M32R_SECREL32}
  2727.   IMAGE_REL_M32R_TOKEN    = $000E; // clr token
  2728.   {$EXTERNALSYM IMAGE_REL_M32R_TOKEN}
  2729. // Please contact INTEL to get IA64-specific information
  2730. (* TODO
  2731. #define EXT_IMM64(Value, Address, Size, InstPos, ValPos)
  2732.     Value |= (((ULONGLONG)((*(Address) >> InstPos) & (((ULONGLONG)1 << Size) - 1))) << ValPos)  // Intel-IA64-Filler
  2733. #define INS_IMM64(Value, Address, Size, InstPos, ValPos)  /* Intel-IA64-Filler */
  2734.     *(PDWORD)Address = (*(PDWORD)Address & ~(((1 << Size) - 1) << InstPos)) | /* Intel-IA64-Filler */
  2735.           ((DWORD)((((ULONGLONG)Value >> ValPos) & (((ULONGLONG)1 << Size) - 1))) << InstPos)  // Intel-IA64-Filler
  2736. *)
  2737. const
  2738.   EMARCH_ENC_I17_IMM7B_INST_WORD_X     = 3; // Intel-IA64-Filler
  2739.   {$EXTERNALSYM EMARCH_ENC_I17_IMM7B_INST_WORD_X}
  2740.   EMARCH_ENC_I17_IMM7B_SIZE_X          = 7; // Intel-IA64-Filler
  2741.   {$EXTERNALSYM EMARCH_ENC_I17_IMM7B_SIZE_X}
  2742.   EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X = 4; // Intel-IA64-Filler
  2743.   {$EXTERNALSYM EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X}
  2744.   EMARCH_ENC_I17_IMM7B_VAL_POS_X       = 0; // Intel-IA64-Filler
  2745.   {$EXTERNALSYM EMARCH_ENC_I17_IMM7B_VAL_POS_X}
  2746.   EMARCH_ENC_I17_IMM9D_INST_WORD_X     = 3; // Intel-IA64-Filler
  2747.   {$EXTERNALSYM EMARCH_ENC_I17_IMM9D_INST_WORD_X}
  2748.   EMARCH_ENC_I17_IMM9D_SIZE_X          = 9; // Intel-IA64-Filler
  2749.   {$EXTERNALSYM EMARCH_ENC_I17_IMM9D_SIZE_X}
  2750.   EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X = 18; // Intel-IA64-Filler
  2751.   {$EXTERNALSYM EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X}
  2752.   EMARCH_ENC_I17_IMM9D_VAL_POS_X       = 7; // Intel-IA64-Filler
  2753.   {$EXTERNALSYM EMARCH_ENC_I17_IMM9D_VAL_POS_X}
  2754.   EMARCH_ENC_I17_IMM5C_INST_WORD_X     = 3; // Intel-IA64-Filler
  2755.   {$EXTERNALSYM EMARCH_ENC_I17_IMM5C_INST_WORD_X}
  2756.   EMARCH_ENC_I17_IMM5C_SIZE_X          = 5; // Intel-IA64-Filler
  2757.   {$EXTERNALSYM EMARCH_ENC_I17_IMM5C_SIZE_X}
  2758.   EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X = 13; // Intel-IA64-Filler
  2759.   {$EXTERNALSYM EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X}
  2760.   EMARCH_ENC_I17_IMM5C_VAL_POS_X       = 16; // Intel-IA64-Filler
  2761.   {$EXTERNALSYM EMARCH_ENC_I17_IMM5C_VAL_POS_X}
  2762.   EMARCH_ENC_I17_IC_INST_WORD_X     = 3; // Intel-IA64-Filler
  2763.   {$EXTERNALSYM EMARCH_ENC_I17_IC_INST_WORD_X}
  2764.   EMARCH_ENC_I17_IC_SIZE_X          = 1; // Intel-IA64-Filler
  2765.   {$EXTERNALSYM EMARCH_ENC_I17_IC_SIZE_X}
  2766.   EMARCH_ENC_I17_IC_INST_WORD_POS_X = 12; // Intel-IA64-Filler
  2767.   {$EXTERNALSYM EMARCH_ENC_I17_IC_INST_WORD_POS_X}
  2768.   EMARCH_ENC_I17_IC_VAL_POS_X       = 21; // Intel-IA64-Filler
  2769.   {$EXTERNALSYM EMARCH_ENC_I17_IC_VAL_POS_X}
  2770.   EMARCH_ENC_I17_IMM41a_INST_WORD_X     = 1; // Intel-IA64-Filler
  2771.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41a_INST_WORD_X}
  2772.   EMARCH_ENC_I17_IMM41a_SIZE_X          = 10; // Intel-IA64-Filler
  2773.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41a_SIZE_X}
  2774.   EMARCH_ENC_I17_IMM41a_INST_WORD_POS_X = 14; // Intel-IA64-Filler
  2775.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41a_INST_WORD_POS_X}
  2776.   EMARCH_ENC_I17_IMM41a_VAL_POS_X       = 22; // Intel-IA64-Filler
  2777.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41a_VAL_POS_X}
  2778.   EMARCH_ENC_I17_IMM41b_INST_WORD_X     = 1; // Intel-IA64-Filler
  2779.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41b_INST_WORD_X}
  2780.   EMARCH_ENC_I17_IMM41b_SIZE_X          = 8; // Intel-IA64-Filler
  2781.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41b_SIZE_X}
  2782.   EMARCH_ENC_I17_IMM41b_INST_WORD_POS_X = 24; // Intel-IA64-Filler
  2783.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41b_INST_WORD_POS_X}
  2784.   EMARCH_ENC_I17_IMM41b_VAL_POS_X       = 32; // Intel-IA64-Filler
  2785.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41b_VAL_POS_X}
  2786.   EMARCH_ENC_I17_IMM41c_INST_WORD_X     = 2; // Intel-IA64-Filler
  2787.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41c_INST_WORD_X}
  2788.   EMARCH_ENC_I17_IMM41c_SIZE_X          = 23; // Intel-IA64-Filler
  2789.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41c_SIZE_X}
  2790.   EMARCH_ENC_I17_IMM41c_INST_WORD_POS_X = 0; // Intel-IA64-Filler
  2791.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41c_INST_WORD_POS_X}
  2792.   EMARCH_ENC_I17_IMM41c_VAL_POS_X       = 40; // Intel-IA64-Filler
  2793.   {$EXTERNALSYM EMARCH_ENC_I17_IMM41c_VAL_POS_X}
  2794.   EMARCH_ENC_I17_SIGN_INST_WORD_X     = 3; // Intel-IA64-Filler
  2795.   {$EXTERNALSYM EMARCH_ENC_I17_SIGN_INST_WORD_X}
  2796.   EMARCH_ENC_I17_SIGN_SIZE_X          = 1; // Intel-IA64-Filler
  2797.   {$EXTERNALSYM EMARCH_ENC_I17_SIGN_SIZE_X}
  2798.   EMARCH_ENC_I17_SIGN_INST_WORD_POS_X = 27; // Intel-IA64-Filler
  2799.   {$EXTERNALSYM EMARCH_ENC_I17_SIGN_INST_WORD_POS_X}
  2800.   EMARCH_ENC_I17_SIGN_VAL_POS_X       = 63; // Intel-IA64-Filler
  2801.   {$EXTERNALSYM EMARCH_ENC_I17_SIGN_VAL_POS_X}
  2802. //
  2803. // Line number format.
  2804. //
  2805. type