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

Windows编程

开发平台:

Delphi

  1. {******************************************************************************}
  2. {                                                                       }
  3. { Windows Base Services API interface Unit for Object Pascal                   }
  4. {                                                                       }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
  6. { Corporation. All Rights Reserved.                                            }
  7. {                 }
  8. { The original file is: winbase.h, released August 2001. The original Pascal   }
  9. { code is: WinBase.pas, released December 2000. The initial developer of the   }
  10. { Pascal code is Marcel van Brakel (brakelm@chello.nl).                        }
  11. {                                                                              }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
  13. { Marcel van Brakel. All Rights Reserved.                                      }
  14. {                 }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
  16. {                }
  17. { You may retrieve the latest version of this file at the Project JEDI home    }
  18. { page, located at http://delphi-jedi.org or my personal homepage located at   }
  19. { http://members.chello.nl/m.vanbrakel2                                        }
  20. {                }
  21. { The contents of this file are used with permission, subject to the Mozilla   }
  22. { Public License Version 1.1 (the "License"); you may not use this file except }
  23. { in compliance with the License. You may obtain a copy of the License at      }
  24. { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
  25. {                                                                              }
  26. { Software distributed under the License is distributed on an "AS IS" basis,   }
  27. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  28. { the specific language governing rights and limitations under the License.    }
  29. {                                                                              }
  30. { Alternatively, the contents of this file may be used under the terms of the  }
  31. { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
  32. { provisions of the LGPL License are applicable instead of those above.        }
  33. { If you wish to allow use of your version of this file only under the terms   }
  34. { of the LGPL License and not to allow others to use your version of this file }
  35. { under the MPL, indicate your decision by deleting  the provisions above and  }
  36. { replace  them with the notice and other provisions required by the LGPL      }
  37. { License.  If you do not delete the provisions above, a recipient may use     }
  38. { your version of this file under either the MPL or the LGPL License.          }
  39. {                 }
  40. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  41. {                 }
  42. {******************************************************************************}
  43. unit JwaWinBase;
  44. {$WEAKPACKAGEUNIT}
  45. {$HPPEMIT ''}
  46. {$HPPEMIT '#include "WinBase.h"'}
  47. {$HPPEMIT ''}
  48. {$I WINDEFINES.INC}
  49. {$STACKFRAMES ON}
  50. interface
  51. uses
  52.   {$IFDEF USE_DELPHI_TYPES}Windows,{$ENDIF}
  53.   JwaNtStatus, JwaWinNT, JwaWinType;
  54. const
  55.   INVALID_HANDLE_VALUE     = HANDLE(-1);
  56.   {$EXTERNALSYM INVALID_HANDLE_VALUE}
  57.   INVALID_FILE_SIZE        = DWORD($FFFFFFFF);
  58.   {$EXTERNALSYM INVALID_FILE_SIZE}
  59.   INVALID_SET_FILE_POINTER = DWORD(-1);
  60.   {$EXTERNALSYM INVALID_SET_FILE_POINTER}
  61.   INVALID_FILE_ATTRIBUTES  = DWORD(-1);
  62.   {$EXTERNALSYM INVALID_FILE_ATTRIBUTES}
  63.   FILE_BEGIN   = 0;
  64.   {$EXTERNALSYM FILE_BEGIN}
  65.   FILE_CURRENT = 1;
  66.   {$EXTERNALSYM FILE_CURRENT}
  67.   FILE_END     = 2;
  68.   {$EXTERNALSYM FILE_END}
  69.   TIME_ZONE_ID_INVALID = DWORD($FFFFFFFF);
  70.   {$EXTERNALSYM TIME_ZONE_ID_INVALID}
  71.   WAIT_FAILED   = DWORD($FFFFFFFF);
  72.   {$EXTERNALSYM WAIT_FAILED}
  73.   WAIT_OBJECT_0 = STATUS_WAIT_0 + 0;
  74.   {$EXTERNALSYM WAIT_OBJECT_0}
  75.   WAIT_ABANDONED   = STATUS_ABANDONED_WAIT_0 + 0;
  76.   {$EXTERNALSYM WAIT_ABANDONED}
  77.   WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0 + 0;
  78.   {$EXTERNALSYM WAIT_ABANDONED_0}
  79.   WAIT_IO_COMPLETION                 = STATUS_USER_APC;
  80.   {$EXTERNALSYM WAIT_IO_COMPLETION}
  81.   STILL_ACTIVE                       = STATUS_PENDING;
  82.   {$EXTERNALSYM STILL_ACTIVE}
  83.   EXCEPTION_ACCESS_VIOLATION         = STATUS_ACCESS_VIOLATION;
  84.   {$EXTERNALSYM EXCEPTION_ACCESS_VIOLATION}
  85.   EXCEPTION_DATATYPE_MISALIGNMENT    = STATUS_DATATYPE_MISALIGNMENT;
  86.   {$EXTERNALSYM EXCEPTION_DATATYPE_MISALIGNMENT}
  87.   EXCEPTION_BREAKPOINT               = STATUS_BREAKPOINT;
  88.   {$EXTERNALSYM EXCEPTION_BREAKPOINT}
  89.   EXCEPTION_SINGLE_STEP              = STATUS_SINGLE_STEP;
  90.   {$EXTERNALSYM EXCEPTION_SINGLE_STEP}
  91.   EXCEPTION_ARRAY_BOUNDS_EXCEEDED    = STATUS_ARRAY_BOUNDS_EXCEEDED;
  92.   {$EXTERNALSYM EXCEPTION_ARRAY_BOUNDS_EXCEEDED}
  93.   EXCEPTION_FLT_DENORMAL_OPERAND     = STATUS_FLOAT_DENORMAL_OPERAND;
  94.   {$EXTERNALSYM EXCEPTION_FLT_DENORMAL_OPERAND}
  95.   EXCEPTION_FLT_DIVIDE_BY_ZERO       = STATUS_FLOAT_DIVIDE_BY_ZERO;
  96.   {$EXTERNALSYM EXCEPTION_FLT_DIVIDE_BY_ZERO}
  97.   EXCEPTION_FLT_INEXACT_RESULT       = STATUS_FLOAT_INEXACT_RESULT;
  98.   {$EXTERNALSYM EXCEPTION_FLT_INEXACT_RESULT}
  99.   EXCEPTION_FLT_INVALID_OPERATION    = STATUS_FLOAT_INVALID_OPERATION;
  100.   {$EXTERNALSYM EXCEPTION_FLT_INVALID_OPERATION}
  101.   EXCEPTION_FLT_OVERFLOW             = STATUS_FLOAT_OVERFLOW;
  102.   {$EXTERNALSYM EXCEPTION_FLT_OVERFLOW}
  103.   EXCEPTION_FLT_STACK_CHECK          = STATUS_FLOAT_STACK_CHECK;
  104.   {$EXTERNALSYM EXCEPTION_FLT_STACK_CHECK}
  105.   EXCEPTION_FLT_UNDERFLOW            = STATUS_FLOAT_UNDERFLOW;
  106.   {$EXTERNALSYM EXCEPTION_FLT_UNDERFLOW}
  107.   EXCEPTION_INT_DIVIDE_BY_ZERO       = STATUS_INTEGER_DIVIDE_BY_ZERO;
  108.   {$EXTERNALSYM EXCEPTION_INT_DIVIDE_BY_ZERO}
  109.   EXCEPTION_INT_OVERFLOW             = STATUS_INTEGER_OVERFLOW;
  110.   {$EXTERNALSYM EXCEPTION_INT_OVERFLOW}
  111.   EXCEPTION_PRIV_INSTRUCTION         = STATUS_PRIVILEGED_INSTRUCTION;
  112.   {$EXTERNALSYM EXCEPTION_PRIV_INSTRUCTION}
  113.   EXCEPTION_IN_PAGE_ERROR            = STATUS_IN_PAGE_ERROR;
  114.   {$EXTERNALSYM EXCEPTION_IN_PAGE_ERROR}
  115.   EXCEPTION_ILLEGAL_INSTRUCTION      = STATUS_ILLEGAL_INSTRUCTION;
  116.   {$EXTERNALSYM EXCEPTION_ILLEGAL_INSTRUCTION}
  117.   EXCEPTION_NONCONTINUABLE_EXCEPTION = STATUS_NONCONTINUABLE_EXCEPTION;
  118.   {$EXTERNALSYM EXCEPTION_NONCONTINUABLE_EXCEPTION}
  119.   EXCEPTION_STACK_OVERFLOW           = STATUS_STACK_OVERFLOW;
  120.   {$EXTERNALSYM EXCEPTION_STACK_OVERFLOW}
  121.   EXCEPTION_INVALID_DISPOSITION      = STATUS_INVALID_DISPOSITION;
  122.   {$EXTERNALSYM EXCEPTION_INVALID_DISPOSITION}
  123.   EXCEPTION_GUARD_PAGE               = STATUS_GUARD_PAGE_VIOLATION;
  124.   {$EXTERNALSYM EXCEPTION_GUARD_PAGE}
  125.   EXCEPTION_INVALID_HANDLE           = STATUS_INVALID_HANDLE;
  126.   {$EXTERNALSYM EXCEPTION_INVALID_HANDLE}
  127.   CONTROL_C_EXIT                     = STATUS_CONTROL_C_EXIT;
  128.   {$EXTERNALSYM CONTROL_C_EXIT}
  129. procedure MoveMemory(Destination, Source: PVOID; Length: SIZE_T);
  130. {$EXTERNALSYM MoveMemory}
  131. procedure CopyMemory(Destination, Source: PVOID; Length: SIZE_T);
  132. {$EXTERNALSYM CopyMemory}
  133. procedure FillMemory(Destination: PVOID; Length: SIZE_T; Fill: BYTE);
  134. {$EXTERNALSYM FillMemory}
  135. procedure ZeroMemory(Destination: PVOID; Length: SIZE_T);
  136. {$EXTERNALSYM ZeroMemory}
  137. //#define SecureZeroMemory RtlSecureZeroMemory TODO
  138. //
  139. // File creation flags must start at the high end since they
  140. // are combined with the attributes
  141. //
  142. const
  143.   FILE_FLAG_WRITE_THROUGH      = DWORD($80000000);
  144.   {$EXTERNALSYM FILE_FLAG_WRITE_THROUGH}
  145.   FILE_FLAG_OVERLAPPED         = $40000000;
  146.   {$EXTERNALSYM FILE_FLAG_OVERLAPPED}
  147.   FILE_FLAG_NO_BUFFERING       = $20000000;
  148.   {$EXTERNALSYM FILE_FLAG_NO_BUFFERING}
  149.   FILE_FLAG_RANDOM_ACCESS      = $10000000;
  150.   {$EXTERNALSYM FILE_FLAG_RANDOM_ACCESS}
  151.   FILE_FLAG_SEQUENTIAL_SCAN    = $08000000;
  152.   {$EXTERNALSYM FILE_FLAG_SEQUENTIAL_SCAN}
  153.   FILE_FLAG_DELETE_ON_CLOSE    = $04000000;
  154.   {$EXTERNALSYM FILE_FLAG_DELETE_ON_CLOSE}
  155.   FILE_FLAG_BACKUP_SEMANTICS   = $02000000;
  156.   {$EXTERNALSYM FILE_FLAG_BACKUP_SEMANTICS}
  157.   FILE_FLAG_POSIX_SEMANTICS    = $01000000;
  158.   {$EXTERNALSYM FILE_FLAG_POSIX_SEMANTICS}
  159.   FILE_FLAG_OPEN_REPARSE_POINT = $00200000;
  160.   {$EXTERNALSYM FILE_FLAG_OPEN_REPARSE_POINT}
  161.   FILE_FLAG_OPEN_NO_RECALL     = $00100000;
  162.   {$EXTERNALSYM FILE_FLAG_OPEN_NO_RECALL}
  163.   FILE_FLAG_FIRST_PIPE_INSTANCE = $00080000;
  164.   {$EXTERNALSYM FILE_FLAG_FIRST_PIPE_INSTANCE}
  165.   CREATE_NEW        = 1;
  166.   {$EXTERNALSYM CREATE_NEW}
  167.   CREATE_ALWAYS     = 2;
  168.   {$EXTERNALSYM CREATE_ALWAYS}
  169.   OPEN_EXISTING     = 3;
  170.   {$EXTERNALSYM OPEN_EXISTING}
  171.   OPEN_ALWAYS       = 4;
  172.   {$EXTERNALSYM OPEN_ALWAYS}
  173.   TRUNCATE_EXISTING = 5;
  174.   {$EXTERNALSYM TRUNCATE_EXISTING}
  175. //
  176. // Define possible return codes from the CopyFileEx callback routine
  177. //
  178.   PROGRESS_CONTINUE = 0;
  179.   {$EXTERNALSYM PROGRESS_CONTINUE}
  180.   PROGRESS_CANCEL   = 1;
  181.   {$EXTERNALSYM PROGRESS_CANCEL}
  182.   PROGRESS_STOP     = 2;
  183.   {$EXTERNALSYM PROGRESS_STOP}
  184.   PROGRESS_QUIET    = 3;
  185.   {$EXTERNALSYM PROGRESS_QUIET}
  186. //
  187. // Define CopyFileEx callback routine state change values
  188. //
  189.   CALLBACK_CHUNK_FINISHED = $00000000;
  190.   {$EXTERNALSYM CALLBACK_CHUNK_FINISHED}
  191.   CALLBACK_STREAM_SWITCH  = $00000001;
  192.   {$EXTERNALSYM CALLBACK_STREAM_SWITCH}
  193. //
  194. // Define CopyFileEx option flags
  195. //
  196.   COPY_FILE_FAIL_IF_EXISTS        = $00000001;
  197.   {$EXTERNALSYM COPY_FILE_FAIL_IF_EXISTS}
  198.   COPY_FILE_RESTARTABLE           = $00000002;
  199.   {$EXTERNALSYM COPY_FILE_RESTARTABLE}
  200.   COPY_FILE_OPEN_SOURCE_FOR_WRITE = $00000004;
  201.   {$EXTERNALSYM COPY_FILE_OPEN_SOURCE_FOR_WRITE}
  202.   COPY_FILE_ALLOW_DECRYPTED_DESTINATION = $00000008;
  203.   {$EXTERNALSYM COPY_FILE_ALLOW_DECRYPTED_DESTINATION}
  204. //
  205. // Define ReplaceFile option flags
  206. //
  207.   REPLACEFILE_WRITE_THROUGH       = $00000001;
  208.   {$EXTERNALSYM REPLACEFILE_WRITE_THROUGH}
  209.   REPLACEFILE_IGNORE_MERGE_ERRORS = $00000002;
  210.   {$EXTERNALSYM REPLACEFILE_IGNORE_MERGE_ERRORS}
  211. //
  212. // Define the NamedPipe definitions
  213. //
  214. //
  215. // Define the dwOpenMode values for CreateNamedPipe
  216. //
  217.   PIPE_ACCESS_INBOUND  = $00000001;
  218.   {$EXTERNALSYM PIPE_ACCESS_INBOUND}
  219.   PIPE_ACCESS_OUTBOUND = $00000002;
  220.   {$EXTERNALSYM PIPE_ACCESS_OUTBOUND}
  221.   PIPE_ACCESS_DUPLEX   = $00000003;
  222.   {$EXTERNALSYM PIPE_ACCESS_DUPLEX}
  223. //
  224. // Define the Named Pipe End flags for GetNamedPipeInfo
  225. //
  226.   PIPE_CLIENT_END = $00000000;
  227.   {$EXTERNALSYM PIPE_CLIENT_END}
  228.   PIPE_SERVER_END = $00000001;
  229.   {$EXTERNALSYM PIPE_SERVER_END}
  230. //
  231. // Define the dwPipeMode values for CreateNamedPipe
  232. //
  233.   PIPE_WAIT             = $00000000;
  234.   {$EXTERNALSYM PIPE_WAIT}
  235.   PIPE_NOWAIT           = $00000001;
  236.   {$EXTERNALSYM PIPE_NOWAIT}
  237.   PIPE_READMODE_BYTE    = $00000000;
  238.   {$EXTERNALSYM PIPE_READMODE_BYTE}
  239.   PIPE_READMODE_MESSAGE = $00000002;
  240.   {$EXTERNALSYM PIPE_READMODE_MESSAGE}
  241.   PIPE_TYPE_BYTE        = $00000000;
  242.   {$EXTERNALSYM PIPE_TYPE_BYTE}
  243.   PIPE_TYPE_MESSAGE     = $00000004;
  244.   {$EXTERNALSYM PIPE_TYPE_MESSAGE}
  245. //
  246. // Define the well known values for CreateNamedPipe nMaxInstances
  247. //
  248.   PIPE_UNLIMITED_INSTANCES = 255;
  249.   {$EXTERNALSYM PIPE_UNLIMITED_INSTANCES}
  250. //
  251. // Define the Security Quality of Service bits to be passed
  252. // into CreateFile
  253. //
  254.   SECURITY_ANONYMOUS      = (Ord(SecurityAnonymous) shl 16);
  255.   {$EXTERNALSYM SECURITY_ANONYMOUS}
  256.   SECURITY_IDENTIFICATION = (Ord(SecurityIdentification) shl 16);
  257.   {$EXTERNALSYM SECURITY_IDENTIFICATION}
  258.   SECURITY_IMPERSONATION  = (Ord(SecurityImpersonation) shl 16);
  259.   {$EXTERNALSYM SECURITY_IMPERSONATION}
  260.   SECURITY_DELEGATION     = (Ord(SecurityDelegation) shl 16);
  261.   {$EXTERNALSYM SECURITY_DELEGATION}
  262.   SECURITY_CONTEXT_TRACKING = $00040000;
  263.   {$EXTERNALSYM SECURITY_CONTEXT_TRACKING}
  264.   SECURITY_EFFECTIVE_ONLY   = $00080000;
  265.   {$EXTERNALSYM SECURITY_EFFECTIVE_ONLY}
  266.   SECURITY_SQOS_PRESENT     = $00100000;
  267.   {$EXTERNALSYM SECURITY_SQOS_PRESENT}
  268.   SECURITY_VALID_SQOS_FLAGS = $001F0000;
  269.   {$EXTERNALSYM SECURITY_VALID_SQOS_FLAGS}
  270. //
  271. //  File structures
  272. //
  273. type
  274.   LPOVERLAPPED = ^OVERLAPPED;
  275.   {$EXTERNALSYM LPOVERLAPPED}
  276.   _OVERLAPPED = record
  277.     Internal: ULONG_PTR;
  278.     InternalHigh: ULONG_PTR;
  279.     Union: record
  280.     case Integer of
  281.       0: (
  282.         Offset: DWORD;
  283.         OffsetHigh: DWORD);
  284.       1: (
  285.         Pointer: PVOID);
  286.     end;
  287.     hEvent: HANDLE;
  288.   end;
  289.   {$EXTERNALSYM _OVERLAPPED}
  290.   OVERLAPPED = _OVERLAPPED;
  291.   {$EXTERNALSYM OVERLAPPED}
  292.   TOverlapped = OVERLAPPED;
  293.   POverlapped = LPOVERLAPPED;
  294.   PSECURITY_ATTRIBUTES = ^SECURITY_ATTRIBUTES;
  295.   {$EXTERNALSYM PSECURITY_ATTRIBUTES}
  296.   _SECURITY_ATTRIBUTES = record
  297.     nLength: DWORD;
  298.     lpSecurityDescriptor: LPVOID;
  299.     bInheritHandle: BOOL;
  300.   end;
  301.   {$EXTERNALSYM _SECURITY_ATTRIBUTES}
  302.   SECURITY_ATTRIBUTES = _SECURITY_ATTRIBUTES;
  303.   {$EXTERNALSYM SECURITY_ATTRIBUTES}
  304.   LPSECURITY_ATTRIBUTES = ^SECURITY_ATTRIBUTES;
  305.   {$EXTERNALSYM LPSECURITY_ATTRIBUTES}
  306.   TSecurityAttributes = SECURITY_ATTRIBUTES;
  307.   PSecurityAttributes = PSECURITY_ATTRIBUTES;
  308.   PPROCESS_INFORMATION = ^PROCESS_INFORMATION;
  309.   {$EXTERNALSYM PPROCESS_INFORMATION}
  310.   _PROCESS_INFORMATION = record
  311.     hProcess: HANDLE;
  312.     hThread: HANDLE;
  313.     dwProcessId: DWORD;
  314.     dwThreadId: DWORD;
  315.   end;
  316.   {$EXTERNALSYM _PROCESS_INFORMATION}
  317.   PROCESS_INFORMATION = _PROCESS_INFORMATION;
  318.   {$EXTERNALSYM PROCESS_INFORMATION}
  319.   LPPROCESS_INFORMATION = ^PROCESS_INFORMATION;
  320.   {$EXTERNALSYM LPPROCESS_INFORMATION}
  321.   TProcessInformation = PROCESS_INFORMATION;
  322.   PProcessInformation = PPROCESS_INFORMATION;
  323. //
  324. //  File System time stamps are represented with the following structure:
  325. //
  326.   {$IFNDEF _FILETIME_}
  327.   {$DEFINE _FILETIME_}
  328.   LPFILETIME = ^FILETIME;
  329.   {$EXTERNALSYM LPFILETIME}
  330.   _FILETIME = record
  331.     dwLowDateTime: DWORD;
  332.     dwHighDateTime: DWORD;
  333.   end;
  334.   {$EXTERNALSYM _FILETIME}
  335.   FILETIME = _FILETIME;
  336.   {$EXTERNALSYM FILETIME}
  337.   TFileTime = FILETIME;
  338.   PFileTime = LPFILETIME;
  339.   {$ENDIF}
  340. //
  341. // System time is represented with the following structure:
  342. //
  343.   LPSYSTEMTIME = ^SYSTEMTIME;
  344.   {$EXTERNALSYM LPSYSTEMTIME}
  345. {$IFDEF USE_DELPHI_TYPES}
  346.   _SYSTEMTIME = Windows._SYSTEMTIME;
  347.   SYSTEMTIME = Windows.SYSTEMTIME;
  348.   TSystemTime = Windows.TSystemTime;
  349.   PSystemtime = Windows.PSystemTime;
  350. {$ELSE}
  351.   _SYSTEMTIME = record
  352.     wYear: Word;
  353.     wMonth: Word;
  354.     wDayOfWeek: Word;
  355.     wDay: Word;
  356.     wHour: Word;
  357.     wMinute: Word;
  358.     wSecond: Word;
  359.     wMilliseconds: Word;
  360.   end;
  361.   {$EXTERNALSYM _SYSTEMTIME}
  362.   SYSTEMTIME = _SYSTEMTIME;
  363.   {$EXTERNALSYM SYSTEMTIME}
  364.   TSystemTime = SYSTEMTIME;
  365.   PSystemTime = LPSYSTEMTIME;
  366. {$ENDIF}
  367.   PTHREAD_START_ROUTINE = function (lpThreadParameter: LPVOID): DWORD; stdcall;
  368.   {$EXTERNALSYM PTHREAD_START_ROUTINE}
  369.   LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE;
  370.   {$EXTERNALSYM LPTHREAD_START_ROUTINE}
  371.   TThreadStartRoutine = PTHREAD_START_ROUTINE;
  372.   PFIBER_START_ROUTINE = procedure (lpFiberParameter: LPVOID); stdcall;
  373.   {$EXTERNALSYM PFIBER_START_ROUTINE}
  374.   LPFIBER_START_ROUTINE = PFIBER_START_ROUTINE;
  375.   {$EXTERNALSYM LPFIBER_START_ROUTINE}
  376.   TFiberStartRoutine = PFIBER_START_ROUTINE;
  377.   CRITICAL_SECTION = RTL_CRITICAL_SECTION;
  378.   {$EXTERNALSYM CRITICAL_SECTION}
  379.   PCRITICAL_SECTION = PRTL_CRITICAL_SECTION;
  380.   {$EXTERNALSYM PCRITICAL_SECTION}
  381.   LPCRITICAL_SECTION = PRTL_CRITICAL_SECTION;
  382.   {$EXTERNALSYM LPCRITICAL_SECTION}
  383.   TCriticalSection = CRITICAL_SECTION;
  384.   PCriticalSection = PCRITICAL_SECTION;
  385.   CRITICAL_SECTION_DEBUG = RTL_CRITICAL_SECTION_DEBUG;
  386.   {$EXTERNALSYM CRITICAL_SECTION_DEBUG}
  387.   PCRITICAL_SECTION_DEBUG = PRTL_CRITICAL_SECTION_DEBUG;
  388.   {$EXTERNALSYM PCRITICAL_SECTION_DEBUG}
  389.   LPCRITICAL_SECTION_DEBUG = PRTL_CRITICAL_SECTION_DEBUG;
  390.   {$EXTERNALSYM LPCRITICAL_SECTION_DEBUG}
  391.   TCriticalSectionDebug = CRITICAL_SECTION_DEBUG;
  392.   PCriticalSectionDebug = PCRITICAL_SECTION_DEBUG;  
  393.   LPLDT_ENTRY = PLDT_ENTRY;
  394.   {$EXTERNALSYM LPLDT_ENTRY}
  395.   PLdtEntry = LPLDT_ENTRY;
  396. const
  397.   MUTEX_MODIFY_STATE = MUTANT_QUERY_STATE;
  398.   {$EXTERNALSYM MUTEX_MODIFY_STATE}
  399.   MUTEX_ALL_ACCESS   = MUTANT_ALL_ACCESS;
  400.   {$EXTERNALSYM MUTEX_ALL_ACCESS}
  401. //
  402. // Serial provider type.
  403. //
  404.   SP_SERIALCOMM = DWORD($00000001);
  405.   {$EXTERNALSYM SP_SERIALCOMM}
  406. //
  407. // Provider SubTypes
  408. //
  409.   PST_UNSPECIFIED    = DWORD($00000000);
  410.   {$EXTERNALSYM PST_UNSPECIFIED}
  411.   PST_RS232          = DWORD($00000001);
  412.   {$EXTERNALSYM PST_RS232}
  413.   PST_PARALLELPORT   = DWORD($00000002);
  414.   {$EXTERNALSYM PST_PARALLELPORT}
  415.   PST_RS422          = DWORD($00000003);
  416.   {$EXTERNALSYM PST_RS422}
  417.   PST_RS423          = DWORD($00000004);
  418.   {$EXTERNALSYM PST_RS423}
  419.   PST_RS449          = DWORD($00000005);
  420.   {$EXTERNALSYM PST_RS449}
  421.   PST_MODEM          = DWORD($00000006);
  422.   {$EXTERNALSYM PST_MODEM}
  423.   PST_FAX            = DWORD($00000021);
  424.   {$EXTERNALSYM PST_FAX}
  425.   PST_SCANNER        = DWORD($00000022);
  426.   {$EXTERNALSYM PST_SCANNER}
  427.   PST_NETWORK_BRIDGE = DWORD($00000100);
  428.   {$EXTERNALSYM PST_NETWORK_BRIDGE}
  429.   PST_LAT            = DWORD($00000101);
  430.   {$EXTERNALSYM PST_LAT}
  431.   PST_TCPIP_TELNET   = DWORD($00000102);
  432.   {$EXTERNALSYM PST_TCPIP_TELNET}
  433.   PST_X25            = DWORD($00000103);
  434.   {$EXTERNALSYM PST_X25}
  435. //
  436. // Provider capabilities flags.
  437. //
  438.   PCF_DTRDSR        = DWORD($0001);
  439.   {$EXTERNALSYM PCF_DTRDSR}
  440.   PCF_RTSCTS        = DWORD($0002);
  441.   {$EXTERNALSYM PCF_RTSCTS}
  442.   PCF_RLSD          = DWORD($0004);
  443.   {$EXTERNALSYM PCF_RLSD}
  444.   PCF_PARITY_CHECK  = DWORD($0008);
  445.   {$EXTERNALSYM PCF_PARITY_CHECK}
  446.   PCF_XONXOFF       = DWORD($0010);
  447.   {$EXTERNALSYM PCF_XONXOFF}
  448.   PCF_SETXCHAR      = DWORD($0020);
  449.   {$EXTERNALSYM PCF_SETXCHAR}
  450.   PCF_TOTALTIMEOUTS = DWORD($0040);
  451.   {$EXTERNALSYM PCF_TOTALTIMEOUTS}
  452.   PCF_INTTIMEOUTS   = DWORD($0080);
  453.   {$EXTERNALSYM PCF_INTTIMEOUTS}
  454.   PCF_SPECIALCHARS  = DWORD($0100);
  455.   {$EXTERNALSYM PCF_SPECIALCHARS}
  456.   PCF_16BITMODE     = DWORD($0200);
  457.   {$EXTERNALSYM PCF_16BITMODE}
  458. //
  459. // Comm provider settable parameters.
  460. //
  461.   SP_PARITY       = DWORD($0001);
  462.   {$EXTERNALSYM SP_PARITY}
  463.   SP_BAUD         = DWORD($0002);
  464.   {$EXTERNALSYM SP_BAUD}
  465.   SP_DATABITS     = DWORD($0004);
  466.   {$EXTERNALSYM SP_DATABITS}
  467.   SP_STOPBITS     = DWORD($0008);
  468.   {$EXTERNALSYM SP_STOPBITS}
  469.   SP_HANDSHAKING  = DWORD($0010);
  470.   {$EXTERNALSYM SP_HANDSHAKING}
  471.   SP_PARITY_CHECK = DWORD($0020);
  472.   {$EXTERNALSYM SP_PARITY_CHECK}
  473.   SP_RLSD         = DWORD($0040);
  474.   {$EXTERNALSYM SP_RLSD}
  475. //
  476. // Settable baud rates in the provider.
  477. //
  478.   BAUD_075    = DWORD($00000001);
  479.   {$EXTERNALSYM BAUD_075}
  480.   BAUD_110    = DWORD($00000002);
  481.   {$EXTERNALSYM BAUD_110}
  482.   BAUD_134_5  = DWORD($00000004);
  483.   {$EXTERNALSYM BAUD_134_5}
  484.   BAUD_150    = DWORD($00000008);
  485.   {$EXTERNALSYM BAUD_150}
  486.   BAUD_300    = DWORD($00000010);
  487.   {$EXTERNALSYM BAUD_300}
  488.   BAUD_600    = DWORD($00000020);
  489.   {$EXTERNALSYM BAUD_600}
  490.   BAUD_1200   = DWORD($00000040);
  491.   {$EXTERNALSYM BAUD_1200}
  492.   BAUD_1800   = DWORD($00000080);
  493.   {$EXTERNALSYM BAUD_1800}
  494.   BAUD_2400   = DWORD($00000100);
  495.   {$EXTERNALSYM BAUD_2400}
  496.   BAUD_4800   = DWORD($00000200);
  497.   {$EXTERNALSYM BAUD_4800}
  498.   BAUD_7200   = DWORD($00000400);
  499.   {$EXTERNALSYM BAUD_7200}
  500.   BAUD_9600   = DWORD($00000800);
  501.   {$EXTERNALSYM BAUD_9600}
  502.   BAUD_14400  = DWORD($00001000);
  503.   {$EXTERNALSYM BAUD_14400}
  504.   BAUD_19200  = DWORD($00002000);
  505.   {$EXTERNALSYM BAUD_19200}
  506.   BAUD_38400  = DWORD($00004000);
  507.   {$EXTERNALSYM BAUD_38400}
  508.   BAUD_56K    = DWORD($00008000);
  509.   {$EXTERNALSYM BAUD_56K}
  510.   BAUD_128K   = DWORD($00010000);
  511.   {$EXTERNALSYM BAUD_128K}
  512.   BAUD_115200 = DWORD($00020000);
  513.   {$EXTERNALSYM BAUD_115200}
  514.   BAUD_57600  = DWORD($00040000);
  515.   {$EXTERNALSYM BAUD_57600}
  516.   BAUD_USER   = DWORD($10000000);
  517.   {$EXTERNALSYM BAUD_USER}
  518. //
  519. // Settable Data Bits
  520. //
  521.   DATABITS_5   = WORD($0001);
  522.   {$EXTERNALSYM DATABITS_5}
  523.   DATABITS_6   = WORD($0002);
  524.   {$EXTERNALSYM DATABITS_6}
  525.   DATABITS_7   = WORD($0004);
  526.   {$EXTERNALSYM DATABITS_7}
  527.   DATABITS_8   = WORD($0008);
  528.   {$EXTERNALSYM DATABITS_8}
  529.   DATABITS_16  = WORD($0010);
  530.   {$EXTERNALSYM DATABITS_16}
  531.   DATABITS_16X = WORD($0020);
  532.   {$EXTERNALSYM DATABITS_16X}
  533. //
  534. // Settable Stop and Parity bits.
  535. //
  536.   STOPBITS_10  = WORD($0001);
  537.   {$EXTERNALSYM STOPBITS_10}
  538.   STOPBITS_15  = WORD($0002);
  539.   {$EXTERNALSYM STOPBITS_15}
  540.   STOPBITS_20  = WORD($0004);
  541.   {$EXTERNALSYM STOPBITS_20}
  542.   PARITY_NONE  = WORD($0100);
  543.   {$EXTERNALSYM PARITY_NONE}
  544.   PARITY_ODD   = WORD($0200);
  545.   {$EXTERNALSYM PARITY_ODD}
  546.   PARITY_EVEN  = WORD($0400);
  547.   {$EXTERNALSYM PARITY_EVEN}
  548.   PARITY_MARK  = WORD($0800);
  549.   {$EXTERNALSYM PARITY_MARK}
  550.   PARITY_SPACE = WORD($1000);
  551.   {$EXTERNALSYM PARITY_SPACE}
  552. type
  553.   LPCOMMPROP = ^COMMPROP;
  554.   {$EXTERNALSYM LPCOMMPROP}
  555.   _COMMPROP = record
  556.     wPacketLength: Word;
  557.     wPacketVersion: Word;
  558.     dwServiceMask: DWORD;
  559.     dwReserved1: DWORD;
  560.     dwMaxTxQueue: DWORD;
  561.     dwMaxRxQueue: DWORD;
  562.     dwMaxBaud: DWORD;
  563.     dwProvSubType: DWORD;
  564.     dwProvCapabilities: DWORD;
  565.     dwSettableParams: DWORD;
  566.     dwSettableBaud: DWORD;
  567.     wSettableData: Word;
  568.     wSettableStopParity: Word;
  569.     dwCurrentTxQueue: DWORD;
  570.     dwCurrentRxQueue: DWORD;
  571.     dwProvSpec1: DWORD;
  572.     dwProvSpec2: DWORD;
  573.     wcProvChar: array [0..0] of WCHAR;
  574.   end;
  575.   {$EXTERNALSYM _COMMPROP}
  576.   COMMPROP = _COMMPROP;
  577.   {$EXTERNALSYM COMMPROP}
  578.   TCommProp = COMMPROP;
  579.   PCommProp = LPCOMMPROP;
  580. //
  581. // Set dwProvSpec1 to COMMPROP_INITIALIZED to indicate that wPacketLength
  582. // is valid before a call to GetCommProperties().
  583. //
  584. const
  585.   COMMPROP_INITIALIZED = DWORD($E73CF52E);
  586.   {$EXTERNALSYM COMMPROP_INITIALIZED}
  587. //_COMSTAT Flags (bitfield)
  588.   COMSTAT_CTS_HOLD   = 1 shl 0;
  589.   COMSTAT_DSR_HOLD   = 1 shl 1;
  590.   COMSTAT_RLSD_HOLD  = 1 shl 2;
  591.   COMSTAT_XOFF_HOLD  = 1 shl 3;
  592.   COMSTAT_XOFF_SENT  = 1 shl 4;
  593.   COMSTAT_F_EOF      = 1 shl 5;
  594.   COMSTAT_F_TXIM     = 1 shl 6;
  595. type
  596.   LPCOMSTAT = ^COMSTAT;
  597.   {$EXTERNALSYM LPCOMSTAT}
  598.   _COMSTAT = record
  599.     Flags: DWORD;
  600.     cbInQue: DWORD;
  601.     cbOutQue: DWORD;
  602.   end;
  603.   {$EXTERNALSYM _COMSTAT}
  604.   COMSTAT = _COMSTAT;
  605.   {$EXTERNALSYM COMSTAT}
  606.   TComstat = COMSTAT;
  607.   PComstat = LPCOMSTAT;
  608. //
  609. // DTR Control Flow Values.
  610. //
  611. const
  612.   DTR_CONTROL_DISABLE   = $00;
  613.   {$EXTERNALSYM DTR_CONTROL_DISABLE}
  614.   DTR_CONTROL_ENABLE    = $01;
  615.   {$EXTERNALSYM DTR_CONTROL_ENABLE}
  616.   DTR_CONTROL_HANDSHAKE = $02;
  617.   {$EXTERNALSYM DTR_CONTROL_HANDSHAKE}
  618. //
  619. // RTS Control Flow Values
  620. //
  621.   RTS_CONTROL_DISABLE   = $00;
  622.   {$EXTERNALSYM RTS_CONTROL_DISABLE}
  623.   RTS_CONTROL_ENABLE    = $01;
  624.   {$EXTERNALSYM RTS_CONTROL_ENABLE}
  625.   RTS_CONTROL_HANDSHAKE = $02;
  626.   {$EXTERNALSYM RTS_CONTROL_HANDSHAKE}
  627.   RTS_CONTROL_TOGGLE    = $03;
  628.   {$EXTERNALSYM RTS_CONTROL_TOGGLE}
  629. // _DCB.Flags
  630. const
  631.   fDcbBinary = 1 shl 0;           // Binary Mode (skip EOF check)
  632.   fDcbParity = 1 shl 1;           // Enable parity checking
  633.   fDcbOutxCtsFlow = 1 shl 2;      // CTS handshaking on output
  634.   fDcbOutxDsrFlow = 1 shl 3;      // DSR handshaking on output
  635.   fDcbDtrControl = $0030;         // DTR Flow control
  636.   fDcbDsrSensitivity = 1 shl 6;   // DSR Sensitivity
  637.   fDcbTXContinueOnXoff = 1 shl 7; // Continue TX when Xoff sent
  638.   fDcbOutX = 1 shl 8;             // Enable output X-ON/X-OFF
  639.   fDcbInX = 1 shl 9;              // Enable input X-ON/X-OFF
  640.   fDcbErrorChar = 1 shl 10;       // Enable Err Replacement
  641.   fDcbNull = 1 shl 11;            // Enable Null stripping
  642.   fDcbRtsControl = $3000;         // Rts Flow control
  643.   fAbortOnError = 1 shl 14;       // Abort all reads and writes on Error
  644. type
  645.   LPDCB = ^DCB;
  646.   {$EXTERNALSYM LPDCB}
  647.   _DCB = record
  648.     DCBlength: DWORD;      // sizeof(DCB)
  649.     BaudRate: DWORD;       // Baudrate at which running
  650.     Flags: DWORD;          // See constants above
  651.     wReserved: WORD;       // Not currently used
  652.     XonLim: WORD;          // Transmit X-ON threshold
  653.     XoffLim: WORD;         // Transmit X-OFF threshold
  654.     ByteSize: BYTE;        // Number of bits/byte, 4-8
  655.     Parity: BYTE;          // 0-4=None,Odd,Even,Mark,Space
  656.     StopBits: BYTE;        // 0,1,2 = 1, 1.5, 2
  657.     XonChar: Char;         // Tx and Rx X-ON character
  658.     XoffChar: Char;        // Tx and Rx X-OFF character
  659.     ErrorChar: Char;       // Error replacement char
  660.     EofChar: Char;         // End of Input character
  661.     EvtChar: Char;         // Received Event character
  662.     wReserved1: WORD;      // Fill for now.
  663.   end;
  664.   {$EXTERNALSYM _DCB}
  665.   DCB = _DCB;
  666.   {$EXTERNALSYM DCB}
  667.   TDCB = DCB;
  668.   PDCB = LPDCB;
  669.   LPCOMMTIMEOUTS = ^COMMTIMEOUTS;
  670.   {$EXTERNALSYM LPCOMMTIMEOUTS}
  671.   _COMMTIMEOUTS = record
  672.     ReadIntervalTimeout: DWORD;         // Maximum time between read chars.
  673.     ReadTotalTimeoutMultiplier: DWORD;  // Multiplier of characters.
  674.     ReadTotalTimeoutConstant: DWORD;    // Constant in milliseconds.
  675.     WriteTotalTimeoutMultiplier: DWORD; // Multiplier of characters.
  676.     WriteTotalTimeoutConstant: DWORD;   // Constant in milliseconds.
  677.   end;
  678.   {$EXTERNALSYM _COMMTIMEOUTS}
  679.   COMMTIMEOUTS = _COMMTIMEOUTS;
  680.   {$EXTERNALSYM COMMTIMEOUTS}
  681.   TCommTimeouts = COMMTIMEOUTS;
  682.   PCommTimeouts = LPCOMMTIMEOUTS;
  683.   LPCOMMCONFIG = ^COMMCONFIG;
  684.   {$EXTERNALSYM LPCOMMCONFIG}
  685.   _COMMCONFIG = record
  686.     dwSize: DWORD;            // Size of the entire struct
  687.     wVersion: Word;           // version of the structure
  688.     wReserved: Word;          // alignment
  689.     dcb: DCB;                 // device control block
  690.     dwProviderSubType: DWORD; // ordinal value for identifying
  691.                               // provider-defined data structure format
  692.     dwProviderOffset: DWORD;  // Specifies the offset of provider specific
  693.                               // data field in bytes from the start
  694.     dwProviderSize: DWORD;    // size of the provider-specific data field
  695.     wcProviderData: array [0..0] of WCHAR; // provider-specific data
  696.   end;
  697.   {$EXTERNALSYM _COMMCONFIG}
  698.   COMMCONFIG = _COMMCONFIG;
  699.   {$EXTERNALSYM COMMCONFIG}
  700.   TCommConfig = COMMCONFIG;
  701.   PCommConfig = LPCOMMCONFIG;
  702.   LPSYSTEM_INFO = ^SYSTEM_INFO;
  703.   {$EXTERNALSYM LPSYSTEM_INFO}
  704.   _SYSTEM_INFO = record
  705.     case Integer of
  706.     0: (
  707.       dwOemId: DWORD); // absolete, do not use
  708.     1: (
  709.       wProcessorArchitecture: WORD;
  710.       wReserved: WORD;
  711.       dwPageSize: DWORD;
  712.       lpMinimumApplicationAddress: LPVOID;
  713.       lpMaximumApplicationAddress: LPVOID;
  714.       dwActiveProcessorMask: DWORD_PTR;
  715.       dwNumberOfProcessors: DWORD;
  716.       dwProcessorType: DWORD;
  717.       dwAllocationGranularity: DWORD;
  718.       wProcessorLevel: WORD;
  719.       wProcessorRevision: WORD);
  720.   end;
  721.   {$EXTERNALSYM _SYSTEM_INFO}
  722.   SYSTEM_INFO = _SYSTEM_INFO;
  723.   {$EXTERNALSYM SYSTEM_INFO}
  724.   TSystemInfo = SYSTEM_INFO;
  725.   PSystemInfo = LPSYSTEM_INFO;
  726. //
  727. //
  728. function FreeModule(hLibModule: HMODULE): BOOL;
  729. {$EXTERNALSYM FreeModule}
  730. function MakeProcInstance(lpProc: FARPROC; hInstance: HINSTANCE): FARPROC;
  731. {$EXTERNALSYM MakeProcInstance}
  732. procedure FreeProcInstance(lpProc: FARPROC);
  733. {$EXTERNALSYM FreeProcInstance}
  734. // Global Memory Flags
  735. const
  736.   GMEM_FIXED          = $0000;
  737.   {$EXTERNALSYM GMEM_FIXED}
  738.   GMEM_MOVEABLE       = $0002;
  739.   {$EXTERNALSYM GMEM_MOVEABLE}
  740.   GMEM_NOCOMPACT      = $0010;
  741.   {$EXTERNALSYM GMEM_NOCOMPACT}
  742.   GMEM_NODISCARD      = $0020;
  743.   {$EXTERNALSYM GMEM_NODISCARD}
  744.   GMEM_ZEROINIT       = $0040;
  745.   {$EXTERNALSYM GMEM_ZEROINIT}
  746.   GMEM_MODIFY         = $0080;
  747.   {$EXTERNALSYM GMEM_MODIFY}
  748.   GMEM_DISCARDABLE    = $0100;
  749.   {$EXTERNALSYM GMEM_DISCARDABLE}
  750.   GMEM_NOT_BANKED     = $1000;
  751.   {$EXTERNALSYM GMEM_NOT_BANKED}
  752.   GMEM_SHARE          = $2000;
  753.   {$EXTERNALSYM GMEM_SHARE}
  754.   GMEM_DDESHARE       = $2000;
  755.   {$EXTERNALSYM GMEM_DDESHARE}
  756.   GMEM_NOTIFY         = $4000;
  757.   {$EXTERNALSYM GMEM_NOTIFY}
  758.   GMEM_LOWER          = GMEM_NOT_BANKED;
  759.   {$EXTERNALSYM GMEM_LOWER}
  760.   GMEM_VALID_FLAGS    = $7F72;
  761.   {$EXTERNALSYM GMEM_VALID_FLAGS}
  762.   GMEM_INVALID_HANDLE = $8000;
  763.   {$EXTERNALSYM GMEM_INVALID_HANDLE}
  764.   GHND = (GMEM_MOVEABLE or GMEM_ZEROINIT);
  765.   {$EXTERNALSYM GHND}
  766.   GPTR = (GMEM_FIXED or GMEM_ZEROINIT);
  767.   {$EXTERNALSYM GPTR}
  768. function GlobalLRUNewest(h: HANDLE): HANDLE;
  769. {$EXTERNALSYM GlobalLRUNewest}
  770. function GlobalLRUOldest(h: HANDLE): HANDLE;
  771. {$EXTERNALSYM GlobalLRUOldest}
  772. function GlobalDiscard(h: HANDLE): HANDLE;
  773. {$EXTERNALSYM GlobalDiscard}
  774. // Flags returned by GlobalFlags (in addition to GMEM_DISCARDABLE)
  775. const
  776.   GMEM_DISCARDED = $4000;
  777.   {$EXTERNALSYM GMEM_DISCARDED}
  778.   GMEM_LOCKCOUNT = $00FF;
  779.   {$EXTERNALSYM GMEM_LOCKCOUNT}
  780. type
  781.   LPMEMORYSTATUS = ^MEMORYSTATUS;
  782.   {$EXTERNALSYM LPMEMORYSTATUS}
  783.   _MEMORYSTATUS = record
  784.     dwLength: DWORD;
  785.     dwMemoryLoad: DWORD;
  786.     dwTotalPhys: SIZE_T;
  787.     dwAvailPhys: SIZE_T;
  788.     dwTotalPageFile: SIZE_T;
  789.     dwAvailPageFile: SIZE_T;
  790.     dwTotalVirtual: SIZE_T;
  791.     dwAvailVirtual: SIZE_T;
  792.   end;
  793.   {$EXTERNALSYM _MEMORYSTATUS}
  794.   MEMORYSTATUS = _MEMORYSTATUS;
  795.   {$EXTERNALSYM MEMORYSTATUS}
  796.   TMemoryStatus = MEMORYSTATUS;
  797.   PMemoryStatus = LPMEMORYSTATUS;
  798. // Local Memory Flags
  799. const
  800.   LMEM_FIXED          = $0000;
  801.   {$EXTERNALSYM LMEM_FIXED}
  802.   LMEM_MOVEABLE       = $0002;
  803.   {$EXTERNALSYM LMEM_MOVEABLE}
  804.   LMEM_NOCOMPACT      = $0010;
  805.   {$EXTERNALSYM LMEM_NOCOMPACT}
  806.   LMEM_NODISCARD      = $0020;
  807.   {$EXTERNALSYM LMEM_NODISCARD}
  808.   LMEM_ZEROINIT       = $0040;
  809.   {$EXTERNALSYM LMEM_ZEROINIT}
  810.   LMEM_MODIFY         = $0080;
  811.   {$EXTERNALSYM LMEM_MODIFY}
  812.   LMEM_DISCARDABLE    = $0F00;
  813.   {$EXTERNALSYM LMEM_DISCARDABLE}
  814.   LMEM_VALID_FLAGS    = $0F72;
  815.   {$EXTERNALSYM LMEM_VALID_FLAGS}
  816.   LMEM_INVALID_HANDLE = $8000;
  817.   {$EXTERNALSYM LMEM_INVALID_HANDLE}
  818.   LHND = (LMEM_MOVEABLE or LMEM_ZEROINIT);
  819.   {$EXTERNALSYM LHND}
  820.   LPTR = (LMEM_FIXED or LMEM_ZEROINIT);
  821.   {$EXTERNALSYM LPTR}
  822.   NONZEROLHND = (LMEM_MOVEABLE);
  823.   {$EXTERNALSYM NONZEROLHND}
  824.   NONZEROLPTR = (LMEM_FIXED);
  825.   {$EXTERNALSYM NONZEROLPTR}
  826. function LocalDiscard(h: HLOCAL): HLOCAL;
  827. {$EXTERNALSYM LocalDiscard}
  828. // Flags returned by LocalFlags (in addition to LMEM_DISCARDABLE)
  829. const
  830.   LMEM_DISCARDED = $4000;
  831.   {$EXTERNALSYM LMEM_DISCARDED}
  832.   LMEM_LOCKCOUNT = $00FF;
  833.   {$EXTERNALSYM LMEM_LOCKCOUNT}
  834. //
  835. // dwCreationFlag values
  836. //
  837.   DEBUG_PROCESS           = $00000001;
  838.   {$EXTERNALSYM DEBUG_PROCESS}
  839.   DEBUG_ONLY_THIS_PROCESS = $00000002;
  840.   {$EXTERNALSYM DEBUG_ONLY_THIS_PROCESS}
  841.   CREATE_SUSPENDED = $00000004;
  842.   {$EXTERNALSYM CREATE_SUSPENDED}
  843.   DETACHED_PROCESS = $00000008;
  844.   {$EXTERNALSYM DETACHED_PROCESS}
  845.   CREATE_NEW_CONSOLE = $00000010;
  846.   {$EXTERNALSYM CREATE_NEW_CONSOLE}
  847.   NORMAL_PRIORITY_CLASS   = $00000020;
  848.   {$EXTERNALSYM NORMAL_PRIORITY_CLASS}
  849.   IDLE_PRIORITY_CLASS     = $00000040;
  850.   {$EXTERNALSYM IDLE_PRIORITY_CLASS}
  851.   HIGH_PRIORITY_CLASS     = $00000080;
  852.   {$EXTERNALSYM HIGH_PRIORITY_CLASS}
  853.   REALTIME_PRIORITY_CLASS = $00000100;
  854.   {$EXTERNALSYM REALTIME_PRIORITY_CLASS}
  855.   CREATE_NEW_PROCESS_GROUP   = $00000200;
  856.   {$EXTERNALSYM CREATE_NEW_PROCESS_GROUP}
  857.   CREATE_UNICODE_ENVIRONMENT = $00000400;
  858.   {$EXTERNALSYM CREATE_UNICODE_ENVIRONMENT}
  859.   CREATE_SEPARATE_WOW_VDM = $00000800;
  860.   {$EXTERNALSYM CREATE_SEPARATE_WOW_VDM}
  861.   CREATE_SHARED_WOW_VDM   = $00001000;
  862.   {$EXTERNALSYM CREATE_SHARED_WOW_VDM}
  863.   CREATE_FORCEDOS         = $00002000;
  864.   {$EXTERNALSYM CREATE_FORCEDOS}
  865.   BELOW_NORMAL_PRIORITY_CLASS = $00004000;
  866.   {$EXTERNALSYM BELOW_NORMAL_PRIORITY_CLASS}
  867.   ABOVE_NORMAL_PRIORITY_CLASS = $00008000;
  868.   {$EXTERNALSYM ABOVE_NORMAL_PRIORITY_CLASS}
  869.   STACK_SIZE_PARAM_IS_A_RESERVATION = $00010000;
  870.   {$EXTERNALSYM STACK_SIZE_PARAM_IS_A_RESERVATION}
  871.   CREATE_BREAKAWAY_FROM_JOB = $01000000;
  872.   {$EXTERNALSYM CREATE_BREAKAWAY_FROM_JOB}
  873.   CREATE_PRESERVE_CODE_AUTHZ_LEVEL = $02000000;
  874.   {$EXTERNALSYM CREATE_PRESERVE_CODE_AUTHZ_LEVEL}
  875.   CREATE_DEFAULT_ERROR_MODE = $04000000;
  876.   {$EXTERNALSYM CREATE_DEFAULT_ERROR_MODE}
  877.   CREATE_NO_WINDOW          = $08000000;
  878.   {$EXTERNALSYM CREATE_NO_WINDOW}
  879.   PROFILE_USER   = $10000000;
  880.   {$EXTERNALSYM PROFILE_USER}
  881.   PROFILE_KERNEL = $20000000;
  882.   {$EXTERNALSYM PROFILE_KERNEL}
  883.   PROFILE_SERVER = $40000000;
  884.   {$EXTERNALSYM PROFILE_SERVER}
  885.   CREATE_IGNORE_SYSTEM_DEFAULT = DWORD($80000000);
  886.   {$EXTERNALSYM CREATE_IGNORE_SYSTEM_DEFAULT}
  887.   THREAD_PRIORITY_LOWEST       = THREAD_BASE_PRIORITY_MIN;
  888.   {$EXTERNALSYM THREAD_PRIORITY_LOWEST}
  889.   THREAD_PRIORITY_BELOW_NORMAL = (THREAD_PRIORITY_LOWEST+1);
  890.   {$EXTERNALSYM THREAD_PRIORITY_BELOW_NORMAL}
  891.   THREAD_PRIORITY_NORMAL       = 0;
  892.   {$EXTERNALSYM THREAD_PRIORITY_NORMAL}
  893.   THREAD_PRIORITY_HIGHEST      = THREAD_BASE_PRIORITY_MAX;
  894.   {$EXTERNALSYM THREAD_PRIORITY_HIGHEST}
  895.   THREAD_PRIORITY_ABOVE_NORMAL = (THREAD_PRIORITY_HIGHEST-1);
  896.   {$EXTERNALSYM THREAD_PRIORITY_ABOVE_NORMAL}
  897.   THREAD_PRIORITY_ERROR_RETURN = (MAXLONG);
  898.   {$EXTERNALSYM THREAD_PRIORITY_ERROR_RETURN}
  899.   THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT;
  900.   {$EXTERNALSYM THREAD_PRIORITY_TIME_CRITICAL}
  901.   THREAD_PRIORITY_IDLE          = THREAD_BASE_PRIORITY_IDLE;
  902.   {$EXTERNALSYM THREAD_PRIORITY_IDLE}
  903. //
  904. // Debug APIs
  905. //
  906.   EXCEPTION_DEBUG_EVENT      = 1;
  907.   {$EXTERNALSYM EXCEPTION_DEBUG_EVENT}
  908.   CREATE_THREAD_DEBUG_EVENT  = 2;
  909.   {$EXTERNALSYM CREATE_THREAD_DEBUG_EVENT}
  910.   CREATE_PROCESS_DEBUG_EVENT = 3;
  911.   {$EXTERNALSYM CREATE_PROCESS_DEBUG_EVENT}
  912.   EXIT_THREAD_DEBUG_EVENT    = 4;
  913.   {$EXTERNALSYM EXIT_THREAD_DEBUG_EVENT}
  914.   EXIT_PROCESS_DEBUG_EVENT   = 5;
  915.   {$EXTERNALSYM EXIT_PROCESS_DEBUG_EVENT}
  916.   LOAD_DLL_DEBUG_EVENT       = 6;
  917.   {$EXTERNALSYM LOAD_DLL_DEBUG_EVENT}
  918.   UNLOAD_DLL_DEBUG_EVENT     = 7;
  919.   {$EXTERNALSYM UNLOAD_DLL_DEBUG_EVENT}
  920.   OUTPUT_DEBUG_STRING_EVENT  = 8;
  921.   {$EXTERNALSYM OUTPUT_DEBUG_STRING_EVENT}
  922.   RIP_EVENT                  = 9;
  923.   {$EXTERNALSYM RIP_EVENT}
  924. type
  925.   LPEXCEPTION_DEBUG_INFO = ^EXCEPTION_DEBUG_INFO;
  926.   {$EXTERNALSYM LPEXCEPTION_DEBUG_INFO}
  927.   _EXCEPTION_DEBUG_INFO = record
  928.     ExceptionRecord: EXCEPTION_RECORD;
  929.     dwFirstChance: DWORD;
  930.   end;
  931.   {$EXTERNALSYM _EXCEPTION_DEBUG_INFO}
  932.   EXCEPTION_DEBUG_INFO = _EXCEPTION_DEBUG_INFO;
  933.   {$EXTERNALSYM EXCEPTION_DEBUG_INFO}
  934.   TExceptionDebugInfo = EXCEPTION_DEBUG_INFO;
  935.   PExceptionDebugInfo = LPEXCEPTION_DEBUG_INFO;
  936.   LPCREATE_THREAD_DEBUG_INFO = ^CREATE_THREAD_DEBUG_INFO;
  937.   {$EXTERNALSYM LPCREATE_THREAD_DEBUG_INFO}
  938.   _CREATE_THREAD_DEBUG_INFO = record
  939.     hThread: HANDLE;
  940.     lpThreadLocalBase: LPVOID;
  941.     lpStartAddress: LPTHREAD_START_ROUTINE;
  942.   end;
  943.   {$EXTERNALSYM _CREATE_THREAD_DEBUG_INFO}
  944.   CREATE_THREAD_DEBUG_INFO = _CREATE_THREAD_DEBUG_INFO;
  945.   {$EXTERNALSYM CREATE_THREAD_DEBUG_INFO}
  946.   TCreateThreadDebugInfo = CREATE_THREAD_DEBUG_INFO;
  947.   PCreateThreadDebugInfo = LPCREATE_THREAD_DEBUG_INFO;
  948.   LPCREATE_PROCESS_DEBUG_INFO = ^CREATE_PROCESS_DEBUG_INFO;
  949.   {$EXTERNALSYM LPCREATE_PROCESS_DEBUG_INFO}
  950.   _CREATE_PROCESS_DEBUG_INFO = record
  951.     hFile: HANDLE;
  952.     hProcess: HANDLE;
  953.     hThread: HANDLE;
  954.     lpBaseOfImage: LPVOID;
  955.     dwDebugInfoFileOffset: DWORD;
  956.     nDebugInfoSize: DWORD;
  957.     lpThreadLocalBase: LPVOID;
  958.     lpStartAddress: LPTHREAD_START_ROUTINE;
  959.     lpImageName: LPVOID;
  960.     fUnicode: Word;
  961.   end;
  962.   {$EXTERNALSYM _CREATE_PROCESS_DEBUG_INFO}
  963.   CREATE_PROCESS_DEBUG_INFO = _CREATE_PROCESS_DEBUG_INFO;
  964.   {$EXTERNALSYM CREATE_PROCESS_DEBUG_INFO}
  965.   TCreateProcessDebugInfo = CREATE_PROCESS_DEBUG_INFO;
  966.   PCreateProcessDebugInfo = LPCREATE_PROCESS_DEBUG_INFO;
  967.   LPEXIT_THREAD_DEBUG_INFO = ^EXIT_THREAD_DEBUG_INFO;
  968.   {$EXTERNALSYM LPEXIT_THREAD_DEBUG_INFO}
  969.   _EXIT_THREAD_DEBUG_INFO = record
  970.     dwExitCode: DWORD;
  971.   end;
  972.   {$EXTERNALSYM _EXIT_THREAD_DEBUG_INFO}
  973.   EXIT_THREAD_DEBUG_INFO = _EXIT_THREAD_DEBUG_INFO;
  974.   {$EXTERNALSYM EXIT_THREAD_DEBUG_INFO}
  975.   TExitThreadDebugInfo = EXIT_THREAD_DEBUG_INFO;
  976.   PExitThreadDebugInfo = LPEXIT_THREAD_DEBUG_INFO;
  977.   LPEXIT_PROCESS_DEBUG_INFO = ^EXIT_PROCESS_DEBUG_INFO;
  978.   {$EXTERNALSYM LPEXIT_PROCESS_DEBUG_INFO}
  979.   _EXIT_PROCESS_DEBUG_INFO = record
  980.     dwExitCode: DWORD;
  981.   end;
  982.   {$EXTERNALSYM _EXIT_PROCESS_DEBUG_INFO}
  983.   EXIT_PROCESS_DEBUG_INFO = _EXIT_PROCESS_DEBUG_INFO;
  984.   {$EXTERNALSYM EXIT_PROCESS_DEBUG_INFO}
  985.   TExitProcessDebugInfo = EXIT_PROCESS_DEBUG_INFO;
  986.   PExitProcessDebugInfo = LPEXIT_PROCESS_DEBUG_INFO;
  987.   LPLOAD_DLL_DEBUG_INFO = ^LOAD_DLL_DEBUG_INFO;
  988.   {$EXTERNALSYM LPLOAD_DLL_DEBUG_INFO}
  989.   _LOAD_DLL_DEBUG_INFO = record
  990.     hFile: HANDLE;
  991.     lpBaseOfDll: LPVOID;
  992.     dwDebugInfoFileOffset: DWORD;
  993.     nDebugInfoSize: DWORD;
  994.     lpImageName: LPVOID;
  995.     fUnicode: Word;
  996.   end;
  997.   {$EXTERNALSYM _LOAD_DLL_DEBUG_INFO}
  998.   LOAD_DLL_DEBUG_INFO = _LOAD_DLL_DEBUG_INFO;
  999.   {$EXTERNALSYM LOAD_DLL_DEBUG_INFO}
  1000.   TLoadDllDebugInfo = LOAD_DLL_DEBUG_INFO;
  1001.   PLoadDllDebugInfo = LPLOAD_DLL_DEBUG_INFO;
  1002.   LPUNLOAD_DLL_DEBUG_INFO = ^UNLOAD_DLL_DEBUG_INFO;
  1003.   {$EXTERNALSYM LPUNLOAD_DLL_DEBUG_INFO}
  1004.   _UNLOAD_DLL_DEBUG_INFO = record
  1005.     lpBaseOfDll: LPVOID;
  1006.   end;
  1007.   {$EXTERNALSYM _UNLOAD_DLL_DEBUG_INFO}
  1008.   UNLOAD_DLL_DEBUG_INFO = _UNLOAD_DLL_DEBUG_INFO;
  1009.   {$EXTERNALSYM UNLOAD_DLL_DEBUG_INFO}
  1010.   TUnloadDllDebugInfo = UNLOAD_DLL_DEBUG_INFO;
  1011.   PUnloadDllDebugInfo = LPUNLOAD_DLL_DEBUG_INFO;
  1012.   LPOUTPUT_DEBUG_STRING_INFO = ^OUTPUT_DEBUG_STRING_INFO;
  1013.   {$EXTERNALSYM LPOUTPUT_DEBUG_STRING_INFO}
  1014.   _OUTPUT_DEBUG_STRING_INFO = record
  1015.     lpDebugStringData: LPSTR;
  1016.     fUnicode: Word;
  1017.     nDebugStringLength: Word;
  1018.   end;
  1019.   {$EXTERNALSYM _OUTPUT_DEBUG_STRING_INFO}
  1020.   OUTPUT_DEBUG_STRING_INFO = _OUTPUT_DEBUG_STRING_INFO;
  1021.   {$EXTERNALSYM OUTPUT_DEBUG_STRING_INFO}
  1022.   TOutputDebugStringInfo = OUTPUT_DEBUG_STRING_INFO;
  1023.   POutputDebugStringInfo = LPOUTPUT_DEBUG_STRING_INFO;
  1024.   LPRIP_INFO = ^RIP_INFO;
  1025.   {$EXTERNALSYM LPRIP_INFO}
  1026.   _RIP_INFO = record
  1027.     dwError: DWORD;
  1028.     dwType: DWORD;
  1029.   end;
  1030.   {$EXTERNALSYM _RIP_INFO}
  1031.   RIP_INFO = _RIP_INFO;
  1032.   {$EXTERNALSYM RIP_INFO}
  1033.   TRipInfo = RIP_INFO;
  1034.   PRipInfo = LPRIP_INFO;
  1035.   LPDEBUG_EVENT = ^DEBUG_EVENT;
  1036.   {$EXTERNALSYM LPDEBUG_EVENT}
  1037.   _DEBUG_EVENT = record
  1038.     dwDebugEventCode: DWORD;
  1039.     dwProcessId: DWORD;
  1040.     dwThreadId: DWORD;
  1041.     case Integer of
  1042.       0: (Exception: EXCEPTION_DEBUG_INFO);
  1043.       1: (CreateThread: CREATE_THREAD_DEBUG_INFO);
  1044.       2: (CreateProcessInfo: CREATE_PROCESS_DEBUG_INFO);
  1045.       3: (ExitThread: EXIT_THREAD_DEBUG_INFO);
  1046.       4: (ExitProcess: EXIT_PROCESS_DEBUG_INFO);
  1047.       5: (LoadDll: LOAD_DLL_DEBUG_INFO);
  1048.       6: (UnloadDll: UNLOAD_DLL_DEBUG_INFO);
  1049.       7: (DebugString: OUTPUT_DEBUG_STRING_INFO);
  1050.       8: (RipInfo: RIP_INFO);
  1051.   end;
  1052.   {$EXTERNALSYM _DEBUG_EVENT}
  1053.   DEBUG_EVENT = _DEBUG_EVENT;
  1054.   {$EXTERNALSYM DEBUG_EVENT}
  1055.   TDebugEvent = DEBUG_EVENT;
  1056.   PDebugEvent = LPDEBUG_EVENT;
  1057.   LPCONTEXT = PCONTEXT;
  1058.   {$EXTERNALSYM LPCONTEXT}
  1059.   LPEXCEPTION_RECORD = PEXCEPTION_RECORD;
  1060.   {$EXTERNALSYM LPEXCEPTION_RECORD}
  1061.   LPEXCEPTION_POINTERS = PEXCEPTION_POINTERS;
  1062.   {$EXTERNALSYM LPEXCEPTION_POINTERS}
  1063. const
  1064.   DRIVE_UNKNOWN     = 0;
  1065.   {$EXTERNALSYM DRIVE_UNKNOWN}
  1066.   DRIVE_NO_ROOT_DIR = 1;
  1067.   {$EXTERNALSYM DRIVE_NO_ROOT_DIR}
  1068.   DRIVE_REMOVABLE   = 2;
  1069.   {$EXTERNALSYM DRIVE_REMOVABLE}
  1070.   DRIVE_FIXED       = 3;
  1071.   {$EXTERNALSYM DRIVE_FIXED}
  1072.   DRIVE_REMOTE      = 4;
  1073.   {$EXTERNALSYM DRIVE_REMOTE}
  1074.   DRIVE_CDROM       = 5;
  1075.   {$EXTERNALSYM DRIVE_CDROM}
  1076.   DRIVE_RAMDISK     = 6;
  1077.   {$EXTERNALSYM DRIVE_RAMDISK}
  1078. function GetFreeSpace(w: WORD): DWORD;
  1079. {$EXTERNALSYM GetFreeSpace}
  1080. const
  1081.   FILE_TYPE_UNKNOWN = $0000;
  1082.   {$EXTERNALSYM FILE_TYPE_UNKNOWN}
  1083.   FILE_TYPE_DISK    = $0001;
  1084.   {$EXTERNALSYM FILE_TYPE_DISK}
  1085.   FILE_TYPE_CHAR    = $0002;
  1086.   {$EXTERNALSYM FILE_TYPE_CHAR}
  1087.   FILE_TYPE_PIPE    = $0003;
  1088.   {$EXTERNALSYM FILE_TYPE_PIPE}
  1089.   FILE_TYPE_REMOTE  = $8000;
  1090.   {$EXTERNALSYM FILE_TYPE_REMOTE}
  1091.   STD_INPUT_HANDLE  = DWORD(-10);
  1092.   {$EXTERNALSYM STD_INPUT_HANDLE}
  1093.   STD_OUTPUT_HANDLE = DWORD(-11);
  1094.   {$EXTERNALSYM STD_OUTPUT_HANDLE}
  1095.   STD_ERROR_HANDLE  = DWORD(-12);
  1096.   {$EXTERNALSYM STD_ERROR_HANDLE}
  1097.   NOPARITY    = 0;
  1098.   {$EXTERNALSYM NOPARITY}
  1099.   ODDPARITY   = 1;
  1100.   {$EXTERNALSYM ODDPARITY}
  1101.   EVENPARITY  = 2;
  1102.   {$EXTERNALSYM EVENPARITY}
  1103.   MARKPARITY  = 3;
  1104.   {$EXTERNALSYM MARKPARITY}
  1105.   SPACEPARITY = 4;
  1106.   {$EXTERNALSYM SPACEPARITY}
  1107.   ONESTOPBIT   = 0;
  1108.   {$EXTERNALSYM ONESTOPBIT}
  1109.   ONE5STOPBITS = 1;
  1110.   {$EXTERNALSYM ONE5STOPBITS}
  1111.   TWOSTOPBITS  = 2;
  1112.   {$EXTERNALSYM TWOSTOPBITS}
  1113.   IGNORE   = 0;                // Ignore signal
  1114.   {$EXTERNALSYM IGNORE}
  1115.   INFINITE = DWORD($FFFFFFFF); // Infinite timeout
  1116.   {$EXTERNALSYM INFINITE}
  1117. //
  1118. // Baud rates at which the communication device operates
  1119. //
  1120.   CBR_110    = 110;
  1121.   {$EXTERNALSYM CBR_110}
  1122.   CBR_300    = 300;
  1123.   {$EXTERNALSYM CBR_300}
  1124.   CBR_600    = 600;
  1125.   {$EXTERNALSYM CBR_600}
  1126.   CBR_1200   = 1200;
  1127.   {$EXTERNALSYM CBR_1200}
  1128.   CBR_2400   = 2400;
  1129.   {$EXTERNALSYM CBR_2400}
  1130.   CBR_4800   = 4800;
  1131.   {$EXTERNALSYM CBR_4800}
  1132.   CBR_9600   = 9600;
  1133.   {$EXTERNALSYM CBR_9600}
  1134.   CBR_14400  = 14400;
  1135.   {$EXTERNALSYM CBR_14400}
  1136.   CBR_19200  = 19200;
  1137.   {$EXTERNALSYM CBR_19200}
  1138.   CBR_38400  = 38400;
  1139.   {$EXTERNALSYM CBR_38400}
  1140.   CBR_56000  = 56000;
  1141.   {$EXTERNALSYM CBR_56000}
  1142.   CBR_57600  = 57600;
  1143.   {$EXTERNALSYM CBR_57600}
  1144.   CBR_115200 = 115200;
  1145.   {$EXTERNALSYM CBR_115200}
  1146.   CBR_128000 = 128000;
  1147.   {$EXTERNALSYM CBR_128000}
  1148.   CBR_256000 = 256000;
  1149.   {$EXTERNALSYM CBR_256000}
  1150. //
  1151. // Error Flags
  1152. //
  1153.   CE_RXOVER   = $0001; // Receive Queue overflow
  1154.   {$EXTERNALSYM CE_RXOVER}
  1155.   CE_OVERRUN  = $0002; // Receive Overrun Error
  1156.   {$EXTERNALSYM CE_OVERRUN}
  1157.   CE_RXPARITY = $0004; // Receive Parity Error
  1158.   {$EXTERNALSYM CE_RXPARITY}
  1159.   CE_FRAME    = $0008; // Receive Framing error
  1160.   {$EXTERNALSYM CE_FRAME}
  1161.   CE_BREAK    = $0010; // Break Detected
  1162.   {$EXTERNALSYM CE_BREAK}
  1163.   CE_TXFULL   = $0100; // TX Queue is full
  1164.   {$EXTERNALSYM CE_TXFULL}
  1165.   CE_PTO      = $0200; // LPTx Timeout
  1166.   {$EXTERNALSYM CE_PTO}
  1167.   CE_IOE      = $0400; // LPTx I/O Error
  1168.   {$EXTERNALSYM CE_IOE}
  1169.   CE_DNS      = $0800; // LPTx Device not selected
  1170.   {$EXTERNALSYM CE_DNS}
  1171.   CE_OOP      = $1000; // LPTx Out-Of-Paper
  1172.   {$EXTERNALSYM CE_OOP}
  1173.   CE_MODE     = $8000; // Requested mode unsupported
  1174.   {$EXTERNALSYM CE_MODE}
  1175.   IE_BADID    = DWORD(-1); // Invalid or unsupported id
  1176.   {$EXTERNALSYM IE_BADID}
  1177.   IE_OPEN     = DWORD(-2); // Device Already Open
  1178.   {$EXTERNALSYM IE_OPEN}
  1179.   IE_NOPEN    = DWORD(-3); // Device Not Open
  1180.   {$EXTERNALSYM IE_NOPEN}
  1181.   IE_MEMORY   = DWORD(-4); // Unable to allocate queues
  1182.   {$EXTERNALSYM IE_MEMORY}
  1183.   IE_DEFAULT  = DWORD(-5); // Error in default parameters
  1184.   {$EXTERNALSYM IE_DEFAULT}
  1185.   IE_HARDWARE = DWORD(-10); // Hardware Not Present
  1186.   {$EXTERNALSYM IE_HARDWARE}
  1187.   IE_BYTESIZE = DWORD(-11); // Illegal Byte Size
  1188.   {$EXTERNALSYM IE_BYTESIZE}
  1189.   IE_BAUDRATE = DWORD(-12); // Unsupported BaudRate
  1190.   {$EXTERNALSYM IE_BAUDRATE}
  1191. //
  1192. // Events
  1193. //
  1194.   EV_RXCHAR   = $0001; // Any Character received
  1195.   {$EXTERNALSYM EV_RXCHAR}
  1196.   EV_RXFLAG   = $0002; // Received certain character
  1197.   {$EXTERNALSYM EV_RXFLAG}
  1198.   EV_TXEMPTY  = $0004; // Transmitt Queue Empty
  1199.   {$EXTERNALSYM EV_TXEMPTY}
  1200.   EV_CTS      = $0008; // CTS changed state
  1201.   {$EXTERNALSYM EV_CTS}
  1202.   EV_DSR      = $0010; // DSR changed state
  1203.   {$EXTERNALSYM EV_DSR}
  1204.   EV_RLSD     = $0020; // RLSD changed state
  1205.   {$EXTERNALSYM EV_RLSD}
  1206.   EV_BREAK    = $0040; // BREAK received
  1207.   {$EXTERNALSYM EV_BREAK}
  1208.   EV_ERR      = $0080; // Line status error occurred
  1209.   {$EXTERNALSYM EV_ERR}
  1210.   EV_RING     = $0100; // Ring signal detected
  1211.   {$EXTERNALSYM EV_RING}
  1212.   EV_PERR     = $0200; // Printer error occured
  1213.   {$EXTERNALSYM EV_PERR}
  1214.   EV_RX80FULL = $0400; // Receive buffer is 80 percent full
  1215.   {$EXTERNALSYM EV_RX80FULL}
  1216.   EV_EVENT1   = $0800; // Provider specific event 1
  1217.   {$EXTERNALSYM EV_EVENT1}
  1218.   EV_EVENT2   = $1000; // Provider specific event 2
  1219.   {$EXTERNALSYM EV_EVENT2}
  1220. //
  1221. // Escape Functions
  1222. //
  1223.   SETXOFF  = 1; // Simulate XOFF received
  1224.   {$EXTERNALSYM SETXOFF}
  1225.   SETXON   = 2; // Simulate XON received
  1226.   {$EXTERNALSYM SETXON}
  1227.   SETRTS   = 3; // Set RTS high
  1228.   {$EXTERNALSYM SETRTS}
  1229.   CLRRTS   = 4; // Set RTS low
  1230.   {$EXTERNALSYM CLRRTS}
  1231.   SETDTR   = 5; // Set DTR high
  1232.   {$EXTERNALSYM SETDTR}
  1233.   CLRDTR   = 6; // Set DTR low
  1234.   {$EXTERNALSYM CLRDTR}
  1235.   RESETDEV = 7; // Reset device if possible
  1236.   {$EXTERNALSYM RESETDEV}
  1237.   SETBREAK = 8; // Set the device break line.
  1238.   {$EXTERNALSYM SETBREAK}
  1239.   CLRBREAK = 9; // Clear the device break line.
  1240.   {$EXTERNALSYM CLRBREAK}
  1241. //
  1242. // PURGE function flags.
  1243. //
  1244.   PURGE_TXABORT = $0001; // Kill the pending/current writes to the comm port.
  1245.   {$EXTERNALSYM PURGE_TXABORT}
  1246.   PURGE_RXABORT = $0002; // Kill the pending/current reads to the comm port.
  1247.   {$EXTERNALSYM PURGE_RXABORT}
  1248.   PURGE_TXCLEAR = $0004; // Kill the transmit queue if there.
  1249.   {$EXTERNALSYM PURGE_TXCLEAR}
  1250.   PURGE_RXCLEAR = $0008; // Kill the typeahead buffer if there.
  1251.   {$EXTERNALSYM PURGE_RXCLEAR}
  1252.   LPTx = $80; // Set if ID is for LPT device
  1253.   {$EXTERNALSYM LPTx}
  1254. //
  1255. // Modem Status Flags
  1256. //
  1257.   MS_CTS_ON  = DWORD($0010);
  1258.   {$EXTERNALSYM MS_CTS_ON}
  1259.   MS_DSR_ON  = DWORD($0020);
  1260.   {$EXTERNALSYM MS_DSR_ON}
  1261.   MS_RING_ON = DWORD($0040);
  1262.   {$EXTERNALSYM MS_RING_ON}
  1263.   MS_RLSD_ON = DWORD($0080);
  1264.   {$EXTERNALSYM MS_RLSD_ON}
  1265. //
  1266. // WaitSoundState() Constants
  1267. //
  1268.   S_QUEUEEMPTY   = 0;
  1269.   {$EXTERNALSYM S_QUEUEEMPTY}
  1270.   S_THRESHOLD    = 1;
  1271.   {$EXTERNALSYM S_THRESHOLD}
  1272.   S_ALLTHRESHOLD = 2;
  1273.   {$EXTERNALSYM S_ALLTHRESHOLD}
  1274. //
  1275. // Accent Modes
  1276. //
  1277.   S_NORMAL   = 0;
  1278.   {$EXTERNALSYM S_NORMAL}
  1279.   S_LEGATO   = 1;
  1280.   {$EXTERNALSYM S_LEGATO}
  1281.   S_STACCATO = 2;
  1282.   {$EXTERNALSYM S_STACCATO}
  1283. //
  1284. // SetSoundNoise() Sources
  1285. //
  1286.   S_PERIOD512   = 0; // Freq = N/512 high pitch, less coarse hiss
  1287.   {$EXTERNALSYM S_PERIOD512}
  1288.   S_PERIOD1024  = 1; // Freq = N/1024
  1289.   {$EXTERNALSYM S_PERIOD1024}
  1290.   S_PERIOD2048  = 2; // Freq = N/2048 low pitch, more coarse hiss
  1291.   {$EXTERNALSYM S_PERIOD2048}
  1292.   S_PERIODVOICE = 3; // Source is frequency from voice channel (3)
  1293.   {$EXTERNALSYM S_PERIODVOICE}
  1294.   S_WHITE512    = 4; // Freq = N/512 high pitch, less coarse hiss
  1295.   {$EXTERNALSYM S_WHITE512}
  1296.   S_WHITE1024   = 5; // Freq = N/1024
  1297.   {$EXTERNALSYM S_WHITE1024}
  1298.   S_WHITE2048   = 6; // Freq = N/2048 low pitch, more coarse hiss
  1299.   {$EXTERNALSYM S_WHITE2048}
  1300.   S_WHITEVOICE  = 7; // Source is frequency from voice channel (3)
  1301.   {$EXTERNALSYM S_WHITEVOICE}
  1302.   S_SERDVNA = DWORD(-1); // Device not available
  1303.   {$EXTERNALSYM S_SERDVNA}
  1304.   S_SEROFM  = DWORD(-2); // Out of memory
  1305.   {$EXTERNALSYM S_SEROFM}
  1306.   S_SERMACT = DWORD(-3); // Music active
  1307.   {$EXTERNALSYM S_SERMACT}
  1308.   S_SERQFUL = DWORD(-4); // Queue full
  1309.   {$EXTERNALSYM S_SERQFUL}
  1310.   S_SERBDNT = DWORD(-5); // Invalid note
  1311.   {$EXTERNALSYM S_SERBDNT}
  1312.   S_SERDLN  = DWORD(-6); // Invalid note length
  1313.   {$EXTERNALSYM S_SERDLN}
  1314.   S_SERDCC  = DWORD(-7); // Invalid note count
  1315.   {$EXTERNALSYM S_SERDCC}
  1316.   S_SERDTP  = DWORD(-8); // Invalid tempo
  1317.   {$EXTERNALSYM S_SERDTP}
  1318.   S_SERDVL  = DWORD(-9); // Invalid volume
  1319.   {$EXTERNALSYM S_SERDVL}
  1320.   S_SERDMD  = DWORD(-10); // Invalid mode
  1321.   {$EXTERNALSYM S_SERDMD}
  1322.   S_SERDSH  = DWORD(-11); // Invalid shape
  1323.   {$EXTERNALSYM S_SERDSH}
  1324.   S_SERDPT  = DWORD(-12); // Invalid pitch
  1325.   {$EXTERNALSYM S_SERDPT}
  1326.   S_SERDFQ  = DWORD(-13); // Invalid frequency
  1327.   {$EXTERNALSYM S_SERDFQ}
  1328.   S_SERDDR  = DWORD(-14); // Invalid duration
  1329.   {$EXTERNALSYM S_SERDDR}
  1330.   S_SERDSR  = DWORD(-15); // Invalid source
  1331.   {$EXTERNALSYM S_SERDSR}
  1332.   S_SERDST  = DWORD(-16); // Invalid state
  1333.   {$EXTERNALSYM S_SERDST}
  1334.   NMPWAIT_WAIT_FOREVER     = DWORD($ffffffff);
  1335.   {$EXTERNALSYM NMPWAIT_WAIT_FOREVER}
  1336.   NMPWAIT_NOWAIT           = $00000001;
  1337.   {$EXTERNALSYM NMPWAIT_NOWAIT}
  1338.   NMPWAIT_USE_DEFAULT_WAIT = $00000000;
  1339.   {$EXTERNALSYM NMPWAIT_USE_DEFAULT_WAIT}
  1340.   FS_CASE_IS_PRESERVED      = FILE_CASE_PRESERVED_NAMES;
  1341.   {$EXTERNALSYM FS_CASE_IS_PRESERVED}
  1342.   FS_CASE_SENSITIVE         = FILE_CASE_SENSITIVE_SEARCH;
  1343.   {$EXTERNALSYM FS_CASE_SENSITIVE}
  1344.   FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK;
  1345.   {$EXTERNALSYM FS_UNICODE_STORED_ON_DISK}
  1346.   FS_PERSISTENT_ACLS        = FILE_PERSISTENT_ACLS;
  1347.   {$EXTERNALSYM FS_PERSISTENT_ACLS}
  1348.   FS_VOL_IS_COMPRESSED      = FILE_VOLUME_IS_COMPRESSED;
  1349.   {$EXTERNALSYM FS_VOL_IS_COMPRESSED}
  1350.   FS_FILE_COMPRESSION       = FILE_FILE_COMPRESSION;
  1351.   {$EXTERNALSYM FS_FILE_COMPRESSION}
  1352.   FS_FILE_ENCRYPTION        = FILE_SUPPORTS_ENCRYPTION;
  1353.   {$EXTERNALSYM FS_FILE_ENCRYPTION}
  1354.   FILE_MAP_COPY       = SECTION_QUERY;
  1355.   {$EXTERNALSYM FILE_MAP_COPY}
  1356.   FILE_MAP_WRITE      = SECTION_MAP_WRITE;
  1357.   {$EXTERNALSYM FILE_MAP_WRITE}
  1358.   FILE_MAP_READ       = SECTION_MAP_READ;
  1359.   {$EXTERNALSYM FILE_MAP_READ}
  1360.   FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS;
  1361.   {$EXTERNALSYM FILE_MAP_ALL_ACCESS}
  1362.   OF_READ             = $00000000;
  1363.   {$EXTERNALSYM OF_READ}
  1364.   OF_WRITE            = $00000001;
  1365.   {$EXTERNALSYM OF_WRITE}
  1366.   OF_READWRITE        = $00000002;
  1367.   {$EXTERNALSYM OF_READWRITE}
  1368.   OF_SHARE_COMPAT     = $00000000;
  1369.   {$EXTERNALSYM OF_SHARE_COMPAT}
  1370.   OF_SHARE_EXCLUSIVE  = $00000010;
  1371.   {$EXTERNALSYM OF_SHARE_EXCLUSIVE}
  1372.   OF_SHARE_DENY_WRITE = $00000020;
  1373.   {$EXTERNALSYM OF_SHARE_DENY_WRITE}
  1374.   OF_SHARE_DENY_READ  = $00000030;
  1375.   {$EXTERNALSYM OF_SHARE_DENY_READ}
  1376.   OF_SHARE_DENY_NONE  = $00000040;
  1377.   {$EXTERNALSYM OF_SHARE_DENY_NONE}
  1378.   OF_PARSE            = $00000100;
  1379.   {$EXTERNALSYM OF_PARSE}
  1380.   OF_DELETE           = $00000200;
  1381.   {$EXTERNALSYM OF_DELETE}
  1382.   OF_VERIFY           = $00000400;
  1383.   {$EXTERNALSYM OF_VERIFY}
  1384.   OF_CANCEL           = $00000800;
  1385.   {$EXTERNALSYM OF_CANCEL}
  1386.   OF_CREATE           = $00001000;
  1387.   {$EXTERNALSYM OF_CREATE}
  1388.   OF_PROMPT           = $00002000;
  1389.   {$EXTERNALSYM OF_PROMPT}
  1390.   OF_EXIST            = $00004000;
  1391.   {$EXTERNALSYM OF_EXIST}
  1392.   OF_REOPEN           = $00008000;
  1393.   {$EXTERNALSYM OF_REOPEN}
  1394.   OFS_MAXPATHNAME = 128;
  1395.   {$EXTERNALSYM OFS_MAXPATHNAME}
  1396. type
  1397.   LPOFSTRUCT = ^OFSTRUCT;
  1398.   {$EXTERNALSYM LPOFSTRUCT}
  1399.   _OFSTRUCT = record
  1400.     cBytes: Byte;
  1401.     fFixedDisk: Byte;
  1402.     nErrCode: Word;
  1403.     Reserved1: Word;
  1404.     Reserved2: Word;
  1405.     szPathName: array [0..OFS_MAXPATHNAME - 1] of CHAR;
  1406.   end;
  1407.   {$EXTERNALSYM _OFSTRUCT}
  1408.   OFSTRUCT = _OFSTRUCT;
  1409.   {$EXTERNALSYM OFSTRUCT}
  1410.   TOfStruct = OFSTRUCT;
  1411.   POfStruct = LPOFSTRUCT;
  1412. //
  1413. // The Risc compilers support intrinsic functions for interlocked
  1414. // increment, decrement, and exchange.
  1415. //
  1416. function InterlockedIncrement(var lpAddend: LONG): LONG; stdcall;
  1417. {$EXTERNALSYM InterlockedIncrement}
  1418. function InterlockedDecrement(var lpAddend: LONG): LONG; stdcall;
  1419. {$EXTERNALSYM InterlockedDecrement}
  1420. function InterlockedExchange(var Target: LONG; Value: LONG): LONG; stdcall;
  1421. {$EXTERNALSYM InterlockedExchange}
  1422. function InterlockedExchangePointer(var Target: PVOID; Value: PVOID): PVOID;
  1423. {$EXTERNALSYM InterlockedExchangePointer}
  1424. function InterlockedExchangeAdd(var Addend: LONG; Value: LONG): LONG; stdcall;
  1425. {$EXTERNALSYM InterlockedExchangeAdd}
  1426. function InterlockedCompareExchange(var Destination: LONG; Exchange: LONG;
  1427.   Comperand: LONG): LONG; stdcall;
  1428. {$EXTERNALSYM InterlockedCompareExchange}
  1429. function InterlockedCompareExchangePointer(var Destination: PVOID;
  1430.   Exchange, Comperand: PVOID): PVOID;
  1431. {$EXTERNALSYM InterlockedCompareExchangePointer}
  1432. procedure InitializeSListHead(ListHead: PSLIST_HEADER); stdcall;
  1433. {$EXTERNALSYM InitializeSListHead}
  1434. function InterlockedPopEntrySList(ListHead: PSLIST_HEADER): PSLIST_ENTRY; stdcall;
  1435. {$EXTERNALSYM InterlockedPopEntrySList}
  1436. function InterlockedPushEntrySList(ListHead: PSLIST_HEADER; ListEntry: PSLIST_ENTRY): PSLIST_ENTRY; stdcall;
  1437. {$EXTERNALSYM InterlockedPushEntrySList}
  1438. function InterlockedFlushSList(ListHead: PSLIST_HEADER): PSLIST_ENTRY; stdcall;
  1439. {$EXTERNALSYM InterlockedFlushSList}
  1440. function QueryDepthSList(ListHead: PSLIST_HEADER): USHORT; stdcall;
  1441. {$EXTERNALSYM QueryDepthSList}
  1442. function FreeResource(hResData: HGLOBAL): BOOL; stdcall;
  1443. {$EXTERNALSYM FreeResource}
  1444. function LockResource(hResData: HGLOBAL): LPVOID; stdcall;
  1445. {$EXTERNALSYM LockResource}
  1446. function UnlockResource(hResData: HANDLE): BOOL;
  1447. {$EXTERNALSYM UnlockResource}
  1448. const
  1449.   MAXINTATOM = $C000;
  1450.   {$EXTERNALSYM MAXINTATOM}
  1451.   INVALID_ATOM = ATOM(0);
  1452.   {$EXTERNALSYM INVALID_ATOM}
  1453. type
  1454.   MAKEINTATOMA = PAnsiChar;
  1455.   MAKEINTATOMW = PWideChar;
  1456. {$IFDEF UNICODE}
  1457.   MAKEINTATOM = MAKEINTATOMW;
  1458.   {$EXTERNALSYM MAKEINTATOM}
  1459. {$ELSE}
  1460.   MAKEINTATOM = MAKEINTATOMA;
  1461.   {$EXTERNALSYM MAKEINTATOM}
  1462. {$ENDIF}
  1463. function FreeLibrary(hLibModule: HMODULE): BOOL; stdcall;
  1464. {$EXTERNALSYM FreeLibrary}
  1465. procedure FreeLibraryAndExitThread(hLibModule: HMODULE; dwExitCode: DWORD); stdcall;
  1466. {$EXTERNALSYM FreeLibraryAndExitThread}
  1467. function DisableThreadLibraryCalls(hLibModule: HMODULE): BOOL; stdcall;
  1468. {$EXTERNALSYM DisableThreadLibraryCalls}
  1469. function GetProcAddress(hModule: HMODULE; lpProcName: LPCSTR): FARPROC; stdcall;
  1470. {$EXTERNALSYM GetProcAddress}
  1471. function GetVersion: DWORD; stdcall;
  1472. {$EXTERNALSYM GetVersion)}
  1473. function GlobalAlloc(uFlags: UINT; dwBytes: SIZE_T): HGLOBAL; stdcall;
  1474. {$EXTERNALSYM GlobalAlloc}
  1475. function GlobalReAlloc(hMem: HGLOBAL; dwBytes: SIZE_T; uFlags: UINT): HGLOBAL; stdcall;
  1476. {$EXTERNALSYM GlobalReAlloc}
  1477. function GlobalSize(hMem: HGLOBAL): SIZE_T; stdcall;
  1478. {$EXTERNALSYM GlobalSize}
  1479. function GlobalFlags(hMem: HGLOBAL): UINT; stdcall;
  1480. {$EXTERNALSYM GlobalFlags}
  1481. function GlobalLock(hMem: HGLOBAL): LPVOID; stdcall;
  1482. {$EXTERNALSYM GlobalLock}
  1483. //!!!MWH My version  win31 = DWORD WINAPI GlobalHandle(UINT)
  1484. function GlobalHandle(pMem: LPCVOID): HGLOBAL; stdcall;
  1485. {$EXTERNALSYM GlobalHandle}
  1486. function GlobalUnlock(hMem: HGLOBAL): BOOL; stdcall;
  1487. {$EXTERNALSYM GlobalUnlock}
  1488. function GlobalFree(hMem: HGLOBAL): HGLOBAL; stdcall;
  1489. {$EXTERNALSYM GlobalFree}
  1490. function GlobalCompact(dwMinFree: DWORD): SIZE_T; stdcall;
  1491. {$EXTERNALSYM GlobalCompact}
  1492. procedure GlobalFix(hMem: HGLOBAL); stdcall;
  1493. {$EXTERNALSYM GlobalFix}
  1494. procedure GlobalUnfix(hMem: HGLOBAL); stdcall;
  1495. {$EXTERNALSYM GlobalUnfix}
  1496. function GlobalWire(hMem: HGLOBAL): LPVOID; stdcall;
  1497. {$EXTERNALSYM GlobalWire}
  1498. function GlobalUnWire(hMem: HGLOBAL): BOOL; stdcall;
  1499. {$EXTERNALSYM GlobalUnWire}
  1500. procedure GlobalMemoryStatus(var lpBuffer: MEMORYSTATUS); stdcall;
  1501. {$EXTERNALSYM GlobalMemoryStatus}
  1502. type
  1503.   LPMEMORYSTATUSEX = ^MEMORYSTATUSEX;
  1504.   {$EXTERNALSYM LPMEMORYSTATUSEX}
  1505.   _MEMORYSTATUSEX = record
  1506.     dwLength: DWORD;
  1507.     dwMemoryLoad: DWORD;
  1508.     ullTotalPhys: DWORDLONG;
  1509.     ullAvailPhys: DWORDLONG;
  1510.     ullTotalPageFile: DWORDLONG;
  1511.     ullAvailPageFile: DWORDLONG;
  1512.     ullTotalVirtual: DWORDLONG;
  1513.     ullAvailVirtual: DWORDLONG;
  1514.     ullAvailExtendedVirtual: DWORDLONG;
  1515.   end;
  1516.   {$EXTERNALSYM _MEMORYSTATUSEX}
  1517.   MEMORYSTATUSEX = _MEMORYSTATUSEX;
  1518.   {$EXTERNALSYM MEMORYSTATUSEX}
  1519.   TMemoryStatusEx = MEMORYSTATUSEX;
  1520.   PMemoryStatusEx = LPMEMORYSTATUSEX;
  1521. function GlobalMemoryStatusEx(var lpBuffer: MEMORYSTATUSEX): BOOL; stdcall;
  1522. {$EXTERNALSYM GlobalMemoryStatusEx}
  1523. function LocalAlloc(uFlags: UINT; uBytes: SIZE_T): HLOCAL; stdcall;
  1524. {$EXTERNALSYM LocalAlloc}
  1525. function LocalReAlloc(hMem: HLOCAL; uBytes: SIZE_T; uFlags: UINT): HLOCAL; stdcall;
  1526. {$EXTERNALSYM LocalReAlloc}
  1527. function LocalLock(hMem: HLOCAL): LPVOID; stdcall;
  1528. {$EXTERNALSYM LocalLock}
  1529. function LocalHandle(pMem: LPCVOID): HLOCAL; stdcall;
  1530. {$EXTERNALSYM LocalHandle}
  1531. function LocalUnlock(hMem: HLOCAL): BOOL; stdcall;
  1532. {$EXTERNALSYM LocalUnlock}
  1533. function LocalSize(hMem: HLOCAL): SIZE_T; stdcall;
  1534. {$EXTERNALSYM LocalSize}
  1535. function LocalFlags(hMem: HLOCAL): UINT; stdcall;
  1536. {$EXTERNALSYM LocalFlags}
  1537. function LocalFree(hMem: HLOCAL): HLOCAL; stdcall;
  1538. {$EXTERNALSYM LocalFree}
  1539. function LocalShrink(hMem: HLOCAL; cbNewSize: UINT): SIZE_T; stdcall;
  1540. {$EXTERNALSYM LocalShrink}
  1541. function LocalCompact(uMinFree: UINT): SIZE_T; stdcall;
  1542. {$EXTERNALSYM LocalCompact}
  1543. function FlushInstructionCache(hProcess: HANDLE; lpBaseAddress: LPCVOID;
  1544.   dwSize: DWORD): BOOL; stdcall;
  1545. {$EXTERNALSYM FlushInstructionCache}
  1546. function VirtualAlloc(lpAddress: LPVOID; dwSize: SIZE_T; flAllocationType: DWORD;
  1547.   flProtect: DWORD): LPVOID; stdcall;
  1548. {$EXTERNALSYM VirtualAlloc}
  1549. function VirtualFree(lpAddress: LPVOID; dwSize: SIZE_T; dwFreeType: DWORD): BOOL; stdcall;
  1550. {$EXTERNALSYM VirtualFree}
  1551. function VirtualProtect(lpAddress: LPVOID; dwSize: SIZE_T; flNewProtect: DWORD;
  1552.   lpflOldProtect: PDWORD): BOOL; stdcall;
  1553. {$EXTERNALSYM VirtualProtect}
  1554. function VirtualQuery(lpAddress: LPCVOID; var lpBuffer: MEMORY_BASIC_INFORMATION;
  1555.   dwLength: DWORD): DWORD; stdcall;
  1556. {$EXTERNALSYM VirtualQuery}
  1557. function VirtualAllocEx(hProcess: HANDLE; lpAddress: LPVOID; dwSize: SIZE_T;
  1558.   flAllocationType: DWORD; flProtect: DWORD): LPVOID; stdcall;
  1559. {$EXTERNALSYM VirtualAllocEx}
  1560. function GetWriteWatch(dwFlags: DWORD; lpBaseAddress: PVOID;
  1561.   dwRegionSize: SIZE_T; var lpAddresses: PVOID; var lpdwCount: ULONG_PTR;
  1562.   var lpdwGranularity: ULONG): UINT; stdcall;
  1563. {$EXTERNALSYM GetWriteWatch}
  1564. function ResetWriteWatch(lpBaseAddress: LPVOID; dwRegionSize: SIZE_T): UINT; stdcall;
  1565. {$EXTERNALSYM ResetWriteWatch}
  1566. function GetLargePageMinimum: SIZE_T; stdcall;
  1567. {$EXTERNALSYM GetLargePageMinimum}
  1568. function VirtualFreeEx(hProcess: HANDLE; lpAddress: LPVOID; dwSize: SIZE_T;
  1569.   dwFreeType: DWORD): BOOL; stdcall;
  1570. {$EXTERNALSYM VirtualFreeEx}
  1571. function VirtualProtectEx(hProcess: HANDLE; lpAddress: LPVOID; dwSize: SIZE_T;
  1572.   flNewProtect: DWORD; lpflOldProtect: PDWORD): BOOL; stdcall;
  1573. {$EXTERNALSYM VirtualProtectEx}
  1574. function VirtualQueryEx(hProcess: HANDLE; lpAddress: LPCVOID;
  1575.   var lpBuffer: MEMORY_BASIC_INFORMATION; dwLength: DWORD): DWORD; stdcall;
  1576. {$EXTERNALSYM VirtualQueryEx}
  1577. function HeapCreate(flOptions: DWORD; dwInitialSize: SIZE_T;
  1578.   dwMaximumSize: SIZE_T): HANDLE; stdcall;
  1579. {$EXTERNALSYM HeapCreate}
  1580. function HeapDestroy(hHeap: HANDLE): BOOL; stdcall;
  1581. {$EXTERNALSYM HeapDestroy}
  1582. function HeapAlloc(hHeap: HANDLE; dwFlags: DWORD; dwBytes: SIZE_T): LPVOID; stdcall;
  1583. {$EXTERNALSYM HeapAlloc}
  1584. function HeapReAlloc(hHeap: HANDLE; dwFlags: DWORD; lpMem: LPVOID; dwBytes: SIZE_T): LPVOID; stdcall;
  1585. {$EXTERNALSYM HeapReAlloc}
  1586. function HeapFree(hHeap: HANDLE; dwFlags: DWORD; lpMem: LPVOID): BOOL; stdcall;
  1587. {$EXTERNALSYM HeapFree}
  1588. function HeapSize(hHeap: HANDLE; dwFlags: DWORD; lpMem: LPCVOID): SIZE_T; stdcall;
  1589. {$EXTERNALSYM HeapSize}
  1590. function HeapValidate(hHeap: HANDLE; dwFlags: DWORD; lpMem: LPCVOID): BOOL; stdcall;
  1591. {$EXTERNALSYM HeapValidate}
  1592. function HeapCompact(hHeap: HANDLE; dwFlags: DWORD): SIZE_T; stdcall;
  1593. {$EXTERNALSYM HeapCompact}
  1594. function GetProcessHeap: HANDLE; stdcall;
  1595. {$EXTERNALSYM GetProcessHeap)}
  1596. function GetProcessHeaps(NumberOfHeaps: DWORD; var ProcessHeaps: HANDLE): DWORD; stdcall;
  1597. {$EXTERNALSYM GetProcessHeaps}
  1598. type
  1599.   PPROCESS_HEAP_ENTRY = ^PROCESS_HEAP_ENTRY;
  1600.   {$EXTERNALSYM PPROCESS_HEAP_ENTRY}
  1601.   _PROCESS_HEAP_ENTRY = record
  1602.     lpData: PVOID;
  1603.     cbData: DWORD;
  1604.     cbOverhead: BYTE;
  1605.     iRegionIndex: BYTE;
  1606.     wFlags: WORD;
  1607.     case Integer of
  1608.       0: (
  1609.         hMem: HANDLE;
  1610.         dwReserved: array [0..2] of DWORD);
  1611.       1: (
  1612.         dwComittedSize: DWORD;
  1613.         dwUnComittedSize: DWORD;
  1614.         lpFirstBlock: LPVOID;
  1615.         lpLastBlock: LPVOID);
  1616.   end;
  1617.   {$EXTERNALSYM _PROCESS_HEAP_ENTRY}
  1618.   PROCESS_HEAP_ENTRY = _PROCESS_HEAP_ENTRY;
  1619.   {$EXTERNALSYM PROCESS_HEAP_ENTRY}
  1620.   LPPROCESS_HEAP_ENTRY = ^PROCESS_HEAP_ENTRY;
  1621.   {$EXTERNALSYM LPPROCESS_HEAP_ENTRY}
  1622.   TProcessHeapEntry = PROCESS_HEAP_ENTRY;
  1623.   PProcessHeapEntry = PPROCESS_HEAP_ENTRY;
  1624. const
  1625.   PROCESS_HEAP_REGION            = $0001;
  1626.   {$EXTERNALSYM PROCESS_HEAP_REGION}
  1627.   PROCESS_HEAP_UNCOMMITTED_RANGE = $0002;
  1628.   {$EXTERNALSYM PROCESS_HEAP_UNCOMMITTED_RANGE}
  1629.   PROCESS_HEAP_ENTRY_BUSY        = $0004;
  1630.   {$EXTERNALSYM PROCESS_HEAP_ENTRY_BUSY}
  1631.   PROCESS_HEAP_ENTRY_MOVEABLE    = $0010;
  1632.   {$EXTERNALSYM PROCESS_HEAP_ENTRY_MOVEABLE}
  1633.   PROCESS_HEAP_ENTRY_DDESHARE    = $0020;
  1634.   {$EXTERNALSYM PROCESS_HEAP_ENTRY_DDESHARE}
  1635. function HeapLock(hHeap: HANDLE): BOOL; stdcall;
  1636. {$EXTERNALSYM HeapLock}
  1637. function HeapUnlock(hHeap: HANDLE): BOOL; stdcall;
  1638. {$EXTERNALSYM HeapUnlock}
  1639. function HeapWalk(hHeap: HANDLE; var lpEntry: PROCESS_HEAP_ENTRY): BOOL; stdcall;
  1640. {$EXTERNALSYM HeapWalk}
  1641. function HeapSetInformation(HeapHandle: HANDLE; HeapInformationClass: HEAP_INFORMATION_CLASS;
  1642.   HeapInformation: PVOID; HeapInformationLength: SIZE_T): BOOL; stdcall;
  1643. {$EXTERNALSYM HeapSetInformation}
  1644. function HeapQueryInformation(HeapHandle: HANDLE; HeapInformationClass: HEAP_INFORMATION_CLASS;
  1645.   HeapInformation: PVOID; HeapInformationLength: SIZE_T; ReturnLength: PSIZE_T): BOOL; stdcall;
  1646. {$EXTERNALSYM HeapQueryInformation}
  1647. // GetBinaryType return values.
  1648. const
  1649.   SCS_32BIT_BINARY = 0;
  1650.   {$EXTERNALSYM SCS_32BIT_BINARY}
  1651.   SCS_DOS_BINARY   = 1;
  1652.   {$EXTERNALSYM SCS_DOS_BINARY}
  1653.   SCS_WOW_BINARY   = 2;
  1654.   {$EXTERNALSYM SCS_WOW_BINARY}
  1655.   SCS_PIF_BINARY   = 3;
  1656.   {$EXTERNALSYM SCS_PIF_BINARY}
  1657.   SCS_POSIX_BINARY = 4;
  1658.   {$EXTERNALSYM SCS_POSIX_BINARY}
  1659.   SCS_OS216_BINARY = 5;
  1660.   {$EXTERNALSYM SCS_OS216_BINARY}
  1661.   SCS_64BIT_BINARY = 6;
  1662.   {$EXTERNALSYM SCS_64BIT_BINARY}
  1663.   SCS_THIS_PLATFORM_BINARY = SCS_32BIT_BINARY;
  1664.   {$EXTERNALSYM SCS_THIS_PLATFORM_BINARY}
  1665. function GetBinaryTypeA(lpApplicationName: LPCSTR; var lpBinaryType: DWORD): BOOL; stdcall;
  1666. {$EXTERNALSYM GetBinaryTypeA}
  1667. function GetBinaryTypeW(lpApplicationName: LPCWSTR; var lpBinaryType: DWORD): BOOL; stdcall;
  1668. {$EXTERNALSYM GetBinaryTypeW}
  1669. {$IFDEF UNICODE}
  1670. function GetBinaryType(lpApplicationName: LPCWSTR; var lpBinaryType: DWORD): BOOL; stdcall;
  1671. {$EXTERNALSYM GetBinaryType}
  1672. {$ELSE}
  1673. function GetBinaryType(lpApplicationName: LPCSTR; var lpBinaryType: DWORD): BOOL; stdcall;
  1674. {$EXTERNALSYM GetBinaryType}
  1675. {$ENDIF}
  1676. function GetShortPathNameA(lpszLongPath: LPCSTR; lpszShortPath: LPSTR;
  1677.   cchBuffer: DWORD): DWORD; stdcall;
  1678. {$EXTERNALSYM GetShortPathNameA}
  1679. function GetShortPathNameW(lpszLongPath: LPCWSTR; lpszShortPath: LPWSTR;
  1680.   cchBuffer: DWORD): DWORD; stdcall;
  1681. {$EXTERNALSYM GetShortPathNameW}
  1682. {$IFDEF UNICODE}
  1683. function GetShortPathName(lpszLongPath: LPCWSTR; lpszShortPath: LPWSTR;
  1684.   cchBuffer: DWORD): DWORD; stdcall;
  1685. {$EXTERNALSYM GetShortPathName}
  1686. {$ELSE}
  1687. function GetShortPathName(lpszLongPath: LPCSTR; lpszShortPath: LPSTR;
  1688.   cchBuffer: DWORD): DWORD; stdcall;
  1689. {$EXTERNALSYM GetShortPathName}
  1690. {$ENDIF}
  1691. function GetLongPathNameA(lpszShortPath: LPCSTR; lpszLongPath: LPSTR;
  1692.   cchBuffer: DWORD): DWORD; stdcall;
  1693. {$EXTERNALSYM GetLongPathNameA}
  1694. function GetLongPathNameW(lpszShortPath: LPCWSTR; lpszLongPath: LPWSTR;
  1695.   cchBuffer: DWORD): DWORD; stdcall;
  1696. {$EXTERNALSYM GetLongPathNameW}
  1697. {$IFDEF UNICODE}
  1698. function GetLongPathName(lpszShortPath: LPCWSTR; lpszLongPath: LPWSTR;
  1699.   cchBuffer: DWORD): DWORD; stdcall;
  1700. {$EXTERNALSYM GetLongPathName}
  1701. {$ELSE}
  1702. function GetLongPathName(lpszShortPath: LPCSTR; lpszLongPath: LPSTR;
  1703.   cchBuffer: DWORD): DWORD; stdcall;
  1704. {$EXTERNALSYM GetLongPathName}
  1705. {$ENDIF}
  1706. function GetProcessAffinityMask(hProcess: HANDLE;
  1707.   var lpProcessAffinityMask, lpSystemAffinityMask: DWORD_PTR): BOOL; stdcall;
  1708. {$EXTERNALSYM GetProcessAffinityMask}
  1709. function SetProcessAffinityMask(hProcess: HANDLE;
  1710.   dwProcessAffinityMask: DWORD_PTR): BOOL; stdcall;
  1711. {$EXTERNALSYM SetProcessAffinityMask}
  1712. function GetProcessTimes(hProcess: HANDLE; var lpCreationTime, lpExitTime,
  1713.   lpKernelTime, lpUserTime: FILETIME): BOOL; stdcall;
  1714. {$EXTERNALSYM GetProcessTimes}
  1715. function GetProcessIoCounters(hProcess: HANDLE; var lpIoCounters: IO_COUNTERS): BOOL; stdcall;
  1716. {$EXTERNALSYM GetProcessIoCounters}
  1717. function GetProcessWorkingSetSize(hProcess: HANDLE;
  1718.   var lpMinimumWorkingSetSize, lpMaximumWorkingSetSize: SIZE_T): BOOL; stdcall;
  1719. {$EXTERNALSYM GetProcessWorkingSetSize}
  1720. function SetProcessWorkingSetSize(hProcess: HANDLE; dwMinimumWorkingSetSize,
  1721.   dwMaximumWorkingSetSize: SIZE_T): BOOL; stdcall;
  1722. {$EXTERNALSYM SetProcessWorkingSetSize}
  1723. function OpenProcess(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  1724.   dwProcessId: DWORD): HANDLE; stdcall;
  1725. {$EXTERNALSYM OpenProcess}
  1726. function GetCurrentProcess: HANDLE; stdcall;
  1727. {$EXTERNALSYM GetCurrentProcess}
  1728. function GetCurrentProcessId: DWORD; stdcall;
  1729. {$EXTERNALSYM GetCurrentProcessId}
  1730. procedure ExitProcess(uExitCode: UINT); stdcall;
  1731. {$EXTERNALSYM ExitProcess}
  1732. function TerminateProcess(hProcess: HANDLE; uExitCode: UINT): BOOL; stdcall;
  1733. {$EXTERNALSYM TerminateProcess}
  1734. function GetExitCodeProcess(hProcess: HANDLE; var lpExitCode: DWORD): BOOL; stdcall;
  1735. {$EXTERNALSYM GetExitCodeProcess}
  1736. procedure FatalExit(ExitCode: Integer); stdcall;
  1737. {$EXTERNALSYM FatalExit}
  1738. {$IFNDEF UNICODE}
  1739. function GetEnvironmentStrings: LPSTR; stdcall;
  1740. {$EXTERNALSYM GetEnvironmentStrings}
  1741. {$ENDIF}
  1742. function GetEnvironmentStringsW: LPWSTR; stdcall;
  1743. {$EXTERNALSYM GetEnvironmentStringsW}
  1744. {$IFDEF UNICODE}
  1745. function GetEnvironmentStrings: LPWSTR; stdcall;
  1746. {$EXTERNALSYM GetEnvironmentStrings}
  1747. {$ELSE}
  1748. function GetEnvironmentStringsA: LPSTR; stdcall;
  1749. {$EXTERNALSYM GetEnvironmentStringsA}
  1750. {$ENDIF}
  1751. function FreeEnvironmentStringsA(pstr: LPSTR): BOOL; stdcall;
  1752. {$EXTERNALSYM FreeEnvironmentStringsA}
  1753. function FreeEnvironmentStringsW(pstr: LPWSTR): BOOL; stdcall;
  1754. {$EXTERNALSYM FreeEnvironmentStringsW}
  1755. {$IFDEF UNICODE}
  1756. function FreeEnvironmentStrings(pstr: LPWSTR): BOOL; stdcall;
  1757. {$EXTERNALSYM FreeEnvironmentStrings}
  1758. {$ELSE}
  1759. function FreeEnvironmentStrings(pstr: LPSTR): BOOL; stdcall;
  1760. {$EXTERNALSYM FreeEnvironmentStrings}
  1761. {$ENDIF}
  1762. procedure RaiseException(dwExceptionCode: DWORD; dwExceptionFlags: DWORD;
  1763.   nNumberOfArguments: DWORD; lpArguments: PULONG_PTR); stdcall;
  1764. {$EXTERNALSYM RaiseException}
  1765. function UnhandledExceptionFilter(ExceptionInfo: PEXCEPTION_POINTERS): LONG; stdcall;
  1766. {$EXTERNALSYM UnhandledExceptionFilter}
  1767. type
  1768.   PTOP_LEVEL_EXCEPTION_FILTER = function (ExceptionInfo: PEXCEPTION_POINTERS): LONG; stdcall;
  1769.   {$EXTERNALSYM PTOP_LEVEL_EXCEPTION_FILTER}
  1770.   LPTOP_LEVEL_EXCEPTION_FILTER = PTOP_LEVEL_EXCEPTION_FILTER;
  1771.   {$EXTERNALSYM LPTOP_LEVEL_EXCEPTION_FILTER}
  1772.   TTopLevelExceptionFilter = PTOP_LEVEL_EXCEPTION_FILTER;
  1773. function SetUnhandledExceptionFilter(lpTopLevelExceptionFilter: LPTOP_LEVEL_EXCEPTION_FILTER): LPTOP_LEVEL_EXCEPTION_FILTER; stdcall;
  1774. {$EXTERNALSYM SetUnhandledExceptionFilter}
  1775. //
  1776. // Fiber creation flags
  1777. //
  1778. const
  1779.   FIBER_FLAG_FLOAT_SWITCH = $1;     // context switch floating point
  1780.   {$EXTERNALSYM FIBER_FLAG_FLOAT_SWITCH}
  1781. function CreateFiber(dwStackSize: DWORD; lpStartAddress: LPFIBER_START_ROUTINE;
  1782.   lpParameter: LPVOID): LPVOID; stdcall;
  1783. {$EXTERNALSYM CreateFiber}
  1784. function CreateFiberEx(dwStackCommitSize, dwStackReserveSize: SIZE_T; dwFlags: DWORD;
  1785.   lpStartAddress: LPFIBER_START_ROUTINE; lpParameter: LPVOID): LPVOID; stdcall;
  1786. {$EXTERNALSYM CreateFiberEx}
  1787. procedure DeleteFiber(lpFiber: LPVOID); stdcall;
  1788. {$EXTERNALSYM DeleteFiber}
  1789. function ConvertThreadToFiber(lpParameter: LPVOID): LPVOID; stdcall;
  1790. {$EXTERNALSYM ConvertThreadToFiber}
  1791. function ConvertThreadToFiberEx(lpParameter: LPVOID; dwFlags: DWORD): LPVOID; stdcall;
  1792. {$EXTERNALSYM ConvertThreadToFiberEx}
  1793. function ConvertFiberToThread: BOOL; stdcall;
  1794. {$EXTERNALSYM ConvertFiberToThread}
  1795. procedure SwitchToFiber(lpFiber: LPVOID); stdcall;
  1796. {$EXTERNALSYM SwitchToFiber}
  1797. function SwitchToThread: BOOL; stdcall;
  1798. {$EXTERNALSYM SwitchToThread}
  1799. function CreateThread(lpThreadAttributes: LPSECURITY_ATTRIBUTES;
  1800.   dwStackSize: DWORD; lpStartAddress: LPTHREAD_START_ROUTINE; lpParameter: LPVOID;
  1801.   dwCreationFlags: DWORD; lpThreadId: LPDWORD): HANDLE; stdcall;
  1802. {$EXTERNALSYM CreateThread}
  1803. function CreateRemoteThread(hProcess: HANDLE;
  1804.   lpThreadAttributes: LPSECURITY_ATTRIBUTES; dwStackSize: DWORD;
  1805.   lpStartAddress: LPTHREAD_START_ROUTINE; lpParameter: LPVOID;
  1806.   dwCreationFlags: DWORD; lpThreadId: LPDWORD): HANDLE; stdcall;
  1807. {$EXTERNALSYM CreateRemoteThread}
  1808. function GetCurrentThread: HANDLE; stdcall;
  1809. {$EXTERNALSYM GetCurrentThread}
  1810. function GetCurrentThreadId: DWORD; stdcall;
  1811. {$EXTERNALSYM GetCurrentThreadId}
  1812. function GetProcessIdOfThread(Thread: HANDLE): DWORD; stdcall;
  1813. {$EXTERNALSYM GetProcessIdOfThread}
  1814. function GetThreadId(Thread: HANDLE): DWORD; stdcall;
  1815. {$EXTERNALSYM GetThreadId}
  1816. function GetProcessId(Process: HANDLE): DWORD; stdcall;
  1817. {$EXTERNALSYM GetProcessId}
  1818. function GetCurrentProcessorNumber: DWORD; stdcall;
  1819. {$EXTERNALSYM GetCurrentProcessorNumber}
  1820. function SetThreadAffinityMask(hThread: HANDLE;
  1821.   dwThreadAffinityMask: DWORD_PTR): DWORD_PTR; stdcall;
  1822. {$EXTERNALSYM SetThreadAffinityMask}
  1823. function SetThreadIdealProcessor(hThread: HANDLE; dwIdealProcessor: DWORD): DWORD; stdcall;
  1824. {$EXTERNALSYM SetThreadIdealProcessor}
  1825. function SetProcessPriorityBoost(hProcess: HANDLE;
  1826.   bDisablePriorityBoost: BOOL): BOOL; stdcall;
  1827. {$EXTERNALSYM SetProcessPriorityBoost}
  1828. function GetProcessPriorityBoost(hProcess: HANDLE;
  1829.   var pDisablePriorityBoost: BOOL): BOOL; stdcall;
  1830. {$EXTERNALSYM GetProcessPriorityBoost}
  1831. function RequestWakeupLatency(latency: LATENCY_TIME): BOOL; stdcall;
  1832. {$EXTERNALSYM RequestWakeupLatency}
  1833. function IsSystemResumeAutomatic: BOOL; stdcall;
  1834. {$EXTERNALSYM IsSystemResumeAutomatic}
  1835. function OpenThread(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  1836.   dwThreadId: DWORD): HANDLE; stdcall;
  1837. {$EXTERNALSYM OpenThread}
  1838. function SetThreadPriority(hThread: HANDLE; nPriority: Integer): BOOL; stdcall;
  1839. {$EXTERNALSYM SetThreadPriority}
  1840. function SetThreadPriorityBoost(hThread: HANDLE; bDisablePriorityBoost: BOOL): BOOL; stdcall;
  1841. {$EXTERNALSYM SetThreadPriorityBoost}
  1842. function GetThreadPriorityBoost(hThread: HANDLE;
  1843.   var pDisablePriorityBoost: BOOL): BOOL; stdcall;
  1844. {$EXTERNALSYM GetThreadPriorityBoost}
  1845. function GetThreadPriority(hThread: HANDLE): Integer; stdcall;
  1846. {$EXTERNALSYM GetThreadPriority}
  1847. function GetThreadTimes(hThread: HANDLE; var lpCreationTime, lpExitTime,
  1848.   lpKernelTime, lpUserTime: FILETIME): BOOL; stdcall;
  1849. {$EXTERNALSYM GetThreadTimes}
  1850. procedure ExitThread(dwExitCode: DWORD); stdcall;
  1851. {$EXTERNALSYM ExitThread}
  1852. function TerminateThread(hThread: HANDLE; dwExitCode: DWORD): BOOL; stdcall;
  1853. {$EXTERNALSYM TerminateThread}
  1854. function GetExitCodeThread(hThread: HANDLE; var lpExitCode: DWORD): BOOL; stdcall;
  1855. {$EXTERNALSYM GetExitCodeThread}
  1856. function GetThreadSelectorEntry(hThread: HANDLE; dwSelector: DWORD;
  1857.   var lpSelectorEntry: LDT_ENTRY): BOOL; stdcall;
  1858. {$EXTERNALSYM GetThreadSelectorEntry}
  1859. function SetThreadExecutionState(esFlags: EXECUTION_STATE): EXECUTION_STATE; stdcall;
  1860. {$EXTERNALSYM SetThreadExecutionState}
  1861. function GetLastError: DWORD; stdcall;
  1862. {$EXTERNALSYM GetLastError}
  1863. procedure SetLastError(dwErrCode: DWORD); stdcall;
  1864. {$EXTERNALSYM SetLastError}
  1865. procedure RestoreLastError(dwErrCode: DWORD); stdcall;
  1866. {$EXTERNALSYM RestoreLastError}
  1867. type
  1868.    PRESTORE_LAST_ERROR = procedure (dwErrCode: DWORD); stdcall;
  1869.    {$EXTERNALSYM PRESTORE_LAST_ERROR}
  1870. const
  1871.   RESTORE_LAST_ERROR_NAME_A = 'RestoreLastError';
  1872.   {$EXTERNALSYM RESTORE_LAST_ERROR_NAME_A}
  1873.   RESTORE_LAST_ERROR_NAME_W = WideString('RestoreLastError');
  1874.   {$EXTERNALSYM RESTORE_LAST_ERROR_NAME_W}
  1875.   RESTORE_LAST_ERROR_NAME   = __TEXT('RestoreLastError');
  1876.   {$EXTERNALSYM RESTORE_LAST_ERROR_NAME}
  1877. function HasOverlappedIoCompleted(const lpOverlapped: OVERLAPPED): BOOL;
  1878. {$EXTERNALSYM HasOverlappedIoCompleted}
  1879. function GetOverlappedResult(hFile: HANDLE; const lpOverlapped: OVERLAPPED;
  1880.   var lpNumberOfBytesTransferred: DWORD; bWait: BOOL): BOOL; stdcall;
  1881. {$EXTERNALSYM GetOverlappedResult}
  1882. function CreateIoCompletionPort(FileHandle: HANDLE; ExistingCompletionPort: HANDLE;
  1883.   CompletionKey: ULONG_PTR; NumberOfConcurrentThreads: DWORD): HANDLE; stdcall;
  1884. {$EXTERNALSYM CreateIoCompletionPort}
  1885. function GetQueuedCompletionStatus(CompletionPort: HANDLE;
  1886.   var lpNumberOfBytesTransferred: DWORD; var lpCompletionKey: ULONG_PTR;
  1887.   var lpOverlapped: LPOVERLAPPED; dwMilliseconds: DWORD): BOOL; stdcall;
  1888. {$EXTERNALSYM GetQueuedCompletionStatus}
  1889. function PostQueuedCompletionStatus(CompletionPort: HANDLE;
  1890.   dwNumberOfBytesTransferred: DWORD; dwCompletionKey: ULONG_PTR;
  1891.   lpOverlapped: LPOVERLAPPED): BOOL; stdcall;
  1892. {$EXTERNALSYM PostQueuedCompletionStatus}
  1893. const
  1894.   SEM_FAILCRITICALERRORS     = $0001;
  1895.   {$EXTERNALSYM SEM_FAILCRITICALERRORS}
  1896.   SEM_NOGPFAULTERRORBOX      = $0002;
  1897.   {$EXTERNALSYM SEM_NOGPFAULTERRORBOX}
  1898.   SEM_NOALIGNMENTFAULTEXCEPT = $0004;
  1899.   {$EXTERNALSYM SEM_NOALIGNMENTFAULTEXCEPT}
  1900.   SEM_NOOPENFILEERRORBOX     = $8000;
  1901.   {$EXTERNALSYM SEM_NOOPENFILEERRORBOX}
  1902. function SetErrorMode(uMode: UINT): UINT; stdcall;
  1903. {$EXTERNALSYM SetErrorMode}
  1904. function ReadProcessMemory(hProcess: HANDLE; lpBaseAddress: LPCVOID;
  1905.   lpBuffer: LPVOID; nSize: DWORD; lpNumberOfBytesRead: LPDWORD): BOOL; stdcall;
  1906. {$EXTERNALSYM ReadProcessMemory}
  1907. function WriteProcessMemory(hProcess: HANDLE; lpBaseAddress: LPVOID;
  1908.   lpBuffer: LPVOID; nSize: DWORD; lpNumberOfBytesWritten: LPDWORD): BOOL; stdcall;
  1909. {$EXTERNALSYM WriteProcessMemory}
  1910. function GetThreadContext(hThread: HANDLE; var lpContext: CONTEXT): BOOL; stdcall;
  1911. {$EXTERNALSYM GetThreadContext}
  1912. function SetThreadContext(hThread: HANDLE; const lpContext: CONTEXT): BOOL; stdcall;
  1913. {$EXTERNALSYM SetThreadContext}
  1914. function SuspendThread(hThread: HANDLE): DWORD; stdcall;
  1915. {$EXTERNALSYM SuspendThread}
  1916. function ResumeThread(hThread: HANDLE): DWORD; stdcall;
  1917. {$EXTERNALSYM ResumeThread}
  1918. type
  1919.   PAPCFUNC = procedure (dwParam: ULONG_PTR); stdcall;
  1920.   {$EXTERNALSYM PAPCFUNC}
  1921.   TApcFunc = PAPCFUNC;
  1922. function QueueUserAPC(pfnAPC: PAPCFUNC; hThread: HANDLE; dwData: ULONG_PTR): DWORD; stdcall;
  1923. {$EXTERNALSYM QueueUserAPC}
  1924. function IsDebuggerPresent: BOOL; stdcall;
  1925. {$EXTERNALSYM IsDebuggerPresent}
  1926. procedure DebugBreak; stdcall;
  1927. {$EXTERNALSYM DebugBreak}
  1928. function WaitForDebugEvent(var lpDebugEvent: DEBUG_EVENT; dwMilliseconds: DWORD): BOOL; stdcall;
  1929. {$EXTERNALSYM WaitForDebugEvent}
  1930. function ContinueDebugEvent(dwProcessId: DWORD; dwThreadId: DWORD;
  1931.   dwContinueStatus: DWORD): BOOL; stdcall;
  1932. {$EXTERNALSYM ContinueDebugEvent}
  1933. function DebugActiveProcess(dwProcessId: DWORD): BOOL; stdcall;
  1934. {$EXTERNALSYM DebugActiveProcess}
  1935. function DebugActiveProcessStop(dwProcessId: DWORD): BOOL; stdcall;
  1936. {$EXTERNALSYM DebugActiveProcessStop}
  1937. function DebugSetProcessKillOnExit(KillOnExit: BOOL): BOOL; stdcall;
  1938. {$EXTERNALSYM DebugSetProcessKillOnExit}
  1939. function DebugBreakProcess(Process: HANDLE): BOOL; stdcall;
  1940. {$EXTERNALSYM DebugBreakProcess}
  1941. procedure InitializeCriticalSection(var lpCriticalSection: CRITICAL_SECTION); stdcall;
  1942. {$EXTERNALSYM InitializeCriticalSection}
  1943. procedure EnterCriticalSection(var lpCriticalSection: CRITICAL_SECTION); stdcall;
  1944. {$EXTERNALSYM EnterCriticalSection}
  1945. procedure LeaveCriticalSection(var lpCriticalSection: CRITICAL_SECTION); stdcall;
  1946. {$EXTERNALSYM LeaveCriticalSection}
  1947. function InitializeCriticalSectionAndSpinCount(var lpCriticalSection: CRITICAL_SECTION;
  1948.   dwSpinCount: DWORD): BOOL; stdcall;
  1949. {$EXTERNALSYM InitializeCriticalSectionAndSpinCount}
  1950. function SetCriticalSectionSpinCount(var lpCriticalSection: CRITICAL_SECTION;
  1951.   dwSpinCount: DWORD): DWORD; stdcall;
  1952. {$EXTERNALSYM SetCriticalSectionSpinCount}
  1953. function TryEnterCriticalSection(var lpCriticalSection: CRITICAL_SECTION): BOOL; stdcall;
  1954. {$EXTERNALSYM TryEnterCriticalSection}
  1955. procedure DeleteCriticalSection(var lpCriticalSection: CRITICAL_SECTION); stdcall;
  1956. {$EXTERNALSYM DeleteCriticalSection}
  1957. function SetEvent(hEvent: HANDLE): BOOL; stdcall;
  1958. {$EXTERNALSYM SetEvent}
  1959. function ResetEvent(hEvent: HANDLE): BOOL; stdcall;
  1960. {$EXTERNALSYM ResetEvent}
  1961. function PulseEvent(hEvent: HANDLE): BOOL; stdcall;
  1962. {$EXTERNALSYM PulseEvent}
  1963. function ReleaseSemaphore(hSemaphore: HANDLE; lReleaseCount: LONG;
  1964.   lpPreviousCount: LPLONG): BOOL; stdcall;
  1965. {$EXTERNALSYM ReleaseSemaphore}
  1966. function ReleaseMutex(hMutex: HANDLE): BOOL; stdcall;
  1967. {$EXTERNALSYM ReleaseMutex}
  1968. function WaitForSingleObject(hHandle: HANDLE; dwMilliseconds: DWORD): DWORD; stdcall;
  1969. {$EXTERNALSYM WaitForSingleObject}
  1970. function WaitForMultipleObjects(nCount: DWORD; lpHandles: PHANDLE; bWaitAll: BOOL;
  1971.   dwMilliseconds: DWORD): DWORD; stdcall;
  1972. {$EXTERNALSYM WaitForMultipleObjects}
  1973. procedure Sleep(dwMilliseconds: DWORD); stdcall;
  1974. {$EXTERNALSYM Sleep}
  1975. function LoadResource(hModule: HMODULE; hResInfo: HRSRC): HGLOBAL; stdcall;
  1976. {$EXTERNALSYM LoadResource}
  1977. function SizeofResource(hModule: HMODULE; hResInfo: HRSRC): DWORD; stdcall;
  1978. {$EXTERNALSYM SizeofResource}
  1979. function GlobalDeleteAtom(nAtom: ATOM): ATOM; stdcall;
  1980. {$EXTERNALSYM GlobalDeleteAtom}
  1981. function InitAtomTable(nSize: DWORD): BOOL; stdcall;
  1982. {$EXTERNALSYM InitAtomTable}
  1983. function DeleteAtom(nAtom: ATOM): ATOM; stdcall;
  1984. {$EXTERNALSYM DeleteAtom}
  1985. function SetHandleCount(uNumber: UINT): UINT; stdcall;
  1986. {$EXTERNALSYM SetHandleCount}
  1987. function GetLogicalDrives: DWORD; stdcall;
  1988. {$EXTERNALSYM GetLogicalDrives}
  1989. function LockFile(hFile: HANDLE; dwFileOffsetLow: DWORD; dwFileOffsetHigh: DWORD;
  1990.   nNumberOfBytesToLockLow: DWORD; nNumberOfBytesToLockHigh: DWORD): BOOL; stdcall;
  1991. {$EXTERNALSYM LockFile}
  1992. function UnlockFile(hFile: HANDLE; dwFileOffsetLow: DWORD; dwFileOffsetHigh: DWORD;
  1993.   nNumberOfBytesToUnlockLow: DWORD; nNumberOfBytesToUnlockHigh: DWORD): BOOL; stdcall;
  1994. {$EXTERNALSYM UnlockFile}
  1995. function LockFileEx(hFile: HANDLE; dwFlags: DWORD; dwReserved: DWORD;
  1996.   nNumberOfBytesToLockLow: DWORD; nNumberOfBytesToLockHigh: DWORD;
  1997.   const lpOverlapped: OVERLAPPED): BOOL; stdcall;
  1998. {$EXTERNALSYM LockFileEx}
  1999. const
  2000.   LOCKFILE_FAIL_IMMEDIATELY = $00000001;
  2001.   {$EXTERNALSYM LOCKFILE_FAIL_IMMEDIATELY}
  2002.   LOCKFILE_EXCLUSIVE_LOCK   = $00000002;
  2003.   {$EXTERNALSYM LOCKFILE_EXCLUSIVE_LOCK}
  2004. function UnlockFileEx(hFile: HANDLE; dwReserved: DWORD;
  2005.   nNumberOfBytesToUnlockLow: DWORD; nNumberOfBytesToUnlockHigh: DWORD;
  2006.   const lpOverlapped: OVERLAPPED): BOOL; stdcall;
  2007. {$EXTERNALSYM UnlockFileEx}
  2008. type
  2009.   PBY_HANDLE_FILE_INFORMATION = ^BY_HANDLE_FILE_INFORMATION;
  2010.   {$EXTERNALSYM PBY_HANDLE_FILE_INFORMATION}
  2011.   _BY_HANDLE_FILE_INFORMATION = record
  2012.     dwFileAttributes: DWORD;
  2013.     ftCreationTime: FILETIME;
  2014.     ftLastAccessTime: FILETIME;
  2015.     ftLastWriteTime: FILETIME;
  2016.     dwVolumeSerialNumber: DWORD;
  2017.     nFileSizeHigh: DWORD;
  2018.     nFileSizeLow: DWORD;
  2019.     nNumberOfLinks: DWORD;
  2020.     nFileIndexHigh: DWORD;
  2021.     nFileIndexLow: DWORD;
  2022.   end;
  2023.   {$EXTERNALSYM _BY_HANDLE_FILE_INFORMATION}
  2024.   BY_HANDLE_FILE_INFORMATION = _BY_HANDLE_FILE_INFORMATION;
  2025.   {$EXTERNALSYM BY_HANDLE_FILE_INFORMATION}
  2026.   LPBY_HANDLE_FILE_INFORMATION = ^BY_HANDLE_FILE_INFORMATION;
  2027.   {$EXTERNALSYM LPBY_HANDLE_FILE_INFORMATION}
  2028.   TByHandleFileInformation = BY_HANDLE_FILE_INFORMATION;
  2029.   PByHandleFileInformation = PBY_HANDLE_FILE_INFORMATION;
  2030. function GetFileInformationByHandle(hFile: HANDLE;
  2031.   var lpFileInformation: BY_HANDLE_FILE_INFORMATION): BOOL; stdcall;
  2032. {$EXTERNALSYM GetFileInformationByHandle}
  2033. function GetFileType(hFile: HANDLE): DWORD; stdcall;
  2034. {$EXTERNALSYM GetFileType}
  2035. function GetFileSize(hFile: HANDLE; lpFileSizeHigh: LPDWORD): DWORD; stdcall;
  2036. {$EXTERNALSYM GetFileSize}
  2037. function GetFileSizeEx(hFile: HANDLE; var lpFileSize: LARGE_INTEGER): BOOL; stdcall;
  2038. {$EXTERNALSYM GetFileSizeEx}
  2039. function GetStdHandle(nStdHandle: DWORD): HANDLE; stdcall;
  2040. {$EXTERNALSYM GetStdHandle}
  2041. function SetStdHandle(nStdHandle: DWORD; hHandle: HANDLE): BOOL; stdcall;
  2042. {$EXTERNALSYM SetStdHandle}
  2043. function WriteFile(hFile: HANDLE; lpBuffer: LPCVOID; nNumberOfBytesToWrite: DWORD;
  2044.   lpNumberOfBytesWritten: LPDWORD; lpOverlapped: LPOVERLAPPED): BOOL; stdcall;
  2045. {$EXTERNALSYM WriteFile}
  2046. function ReadFile(hFile: HANDLE; lpBuffer: LPVOID; nNumberOfBytesToRead: DWORD;
  2047.   lpNumberOfBytesRead: LPDWORD; lpOverlapped: LPOVERLAPPED): BOOL; stdcall;
  2048. {$EXTERNALSYM ReadFile}
  2049. function FlushFileBuffers(hFile: HANDLE): BOOL; stdcall;
  2050. {$EXTERNALSYM FlushFileBuffers}
  2051. function DeviceIoControl(hDevice: HANDLE; dwIoControlCode: DWORD;
  2052.   lpInBuffer: LPVOID; nInBufferSize: DWORD; lpOutBuffer: LPVOID;
  2053.   nOutBufferSize: DWORD; lpBytesReturned: LPDWORD;
  2054.   lpOverlapped: LPOVERLAPPED): BOOL; stdcall;
  2055. {$EXTERNALSYM DeviceIoControl}
  2056. function RequestDeviceWakeup(hDevice: HANDLE): BOOL; stdcall;
  2057. {$EXTERNALSYM RequestDeviceWakeup}
  2058. function CancelDeviceWakeupRequest(hDevice: HANDLE): BOOL; stdcall;
  2059. {$EXTERNALSYM CancelDeviceWakeupRequest}
  2060. function GetDevicePowerState(hDevice: HANDLE; var pfOn: BOOL): BOOL; stdcall;
  2061. {$EXTERNALSYM GetDevicePowerState}
  2062. function SetMessageWaitingIndicator(hMsgIndicator: HANDLE; ulMsgCount: ULONG): BOOL; stdcall;
  2063. {$EXTERNALSYM SetMessageWaitingIndicator}
  2064. function SetEndOfFile(hFile: HANDLE): BOOL; stdcall;
  2065. {$EXTERNALSYM SetEndOfFile}
  2066. function SetFilePointer(hFile: HANDLE; lDistanceToMove: LONG;
  2067.   lpDistanceToMoveHigh: PLONG; dwMoveMethod: DWORD): DWORD; stdcall;
  2068. {$EXTERNALSYM SetFilePointer}
  2069. function SetFilePointerEx(hFile: HANDLE; liDistanceToMove: LARGE_INTEGER;
  2070.   lpNewFilePointer: PLARGE_INTEGER; dwMoveMethod: DWORD): BOOL; stdcall;
  2071. {$EXTERNALSYM SetFilePointerEx}
  2072. function FindClose(hFindFile: HANDLE): BOOL; stdcall;
  2073. {$EXTERNALSYM FindClose}
  2074. function GetFileTime(hFile: HANDLE; lpCreationTime, lpLastAccessTime,
  2075.   lpLastWriteTime: PFILETIME): BOOL; stdcall;
  2076. {$EXTERNALSYM GetFileTime}
  2077. function SetFileTime(hFile: HANDLE; lpCreationTime, lpLastAccessTime,
  2078.   lpLastWriteTime: PFILETIME): BOOL; stdcall;
  2079. {$EXTERNALSYM SetFileTime}
  2080. function SetFileValidData(hFile: HANDLE; ValidDataLength: LONGLONG): BOOL; stdcall;
  2081. {$EXTERNALSYM SetFileValidData}
  2082. function SetFileShortNameA(hFile: HANDLE; lpShortName: LPCSTR): BOOL; stdcall;
  2083. {$EXTERNALSYM SetFileShortNameA}
  2084. function SetFileShortNameW(hFile: HANDLE; lpShortName: LPCWSTR): BOOL; stdcall;
  2085. {$EXTERNALSYM SetFileShortNameW}
  2086. {$IFDEF UNICODE}
  2087. function SetFileShortName(hFile: HANDLE; lpShortName: LPCWSTR): BOOL; stdcall;
  2088. {$EXTERNALSYM SetFileShortName}
  2089. {$ELSE}
  2090. function SetFileShortName(hFile: HANDLE; lpShortName: LPCSTR): BOOL; stdcall;
  2091. {$EXTERNALSYM SetFileShortName}
  2092. {$ENDIF}
  2093. function CloseHandle(hObject: HANDLE): BOOL; stdcall;
  2094. {$EXTERNALSYM CloseHandle}
  2095. function DuplicateHandle(hSourceProcessHandle: HANDLE; hSourceHandle: HANDLE;
  2096.   hTargetProcessHandle: HANDLE; lpTargetHandle: LPHANDLE;
  2097.   dwDesiredAccess: DWORD; bInheritHandle: BOOL; dwOptions: DWORD): BOOL; stdcall;
  2098. {$EXTERNALSYM DuplicateHandle}
  2099. function GetHandleInformation(hObject: HANDLE; var lpdwFlags: DWORD): BOOL; stdcall;
  2100. {$EXTERNALSYM GetHandleInformation}
  2101. function SetHandleInformation(hObject: HANDLE; dwMask: DWORD; dwFlags: DWORD): BOOL; stdcall;
  2102. {$EXTERNALSYM SetHandleInformation}
  2103. const
  2104.   HANDLE_FLAG_INHERIT            = $00000001;
  2105.   {$EXTERNALSYM HANDLE_FLAG_INHERIT}
  2106.   HANDLE_FLAG_PROTECT_FROM_CLOSE = $00000002;
  2107.   {$EXTERNALSYM HANDLE_FLAG_PROTECT_FROM_CLOSE}
  2108.   HINSTANCE_ERROR                = 32;
  2109.   {$EXTERNALSYM HINSTANCE_ERROR}
  2110. function LoadModule(lpModuleName: LPCSTR; lpParameterBlock: LPVOID): DWORD; stdcall;
  2111. {$EXTERNALSYM LoadModule}
  2112. function WinExec(lpCmdLine: LPCSTR; uCmdShow: UINT): UINT; stdcall;
  2113. {$EXTERNALSYM WinExec}
  2114. function ClearCommBreak(hFile: HANDLE): BOOL; stdcall;
  2115. {$EXTERNALSYM ClearCommBreak}
  2116. function ClearCommError(hFile: HANDLE; var lpErrors: DWORD;
  2117.   lpStat: LPCOMSTAT): BOOL; stdcall;
  2118. {$EXTERNALSYM ClearCommError}
  2119. function SetupComm(hFile: HANDLE; dwInQueue: DWORD; dwOutQueue: DWORD): BOOL; stdcall;
  2120. {$EXTERNALSYM SetupComm}
  2121. function EscapeCommFunction(hFile: HANDLE; dwFunc: DWORD): BOOL; stdcall;
  2122. {$EXTERNALSYM EscapeCommFunction}
  2123. function GetCommConfig(hCommDev: HANDLE; var lpCC: COMMCONFIG;
  2124.   var lpdwSize: DWORD): BOOL; stdcall;
  2125. {$EXTERNALSYM GetCommConfig}
  2126. function GetCommMask(hFile: HANDLE; var lpEvtMask: DWORD): BOOL; stdcall;
  2127. {$EXTERNALSYM GetCommMask}
  2128. function GetCommProperties(hFile: HANDLE; var lpCommProp: COMMPROP): BOOL; stdcall;
  2129. {$EXTERNALSYM GetCommProperties}
  2130. function GetCommModemStatus(hFile: HANDLE; var lpModemStat: DWORD): BOOL; stdcall;
  2131. {$EXTERNALSYM GetCommModemStatus}
  2132. function GetCommState(hFile: HANDLE; var lpDCB: DCB): BOOL; stdcall;
  2133. {$EXTERNALSYM GetCommState}
  2134. function GetCommTimeouts(hFile: HANDLE; var lpCommTimeouts: COMMTIMEOUTS): BOOL; stdcall;
  2135. {$EXTERNALSYM GetCommTimeouts}
  2136. function PurgeComm(hFile: HANDLE; dwFlags: DWORD): BOOL; stdcall;
  2137. {$EXTERNALSYM PurgeComm}
  2138. function SetCommBreak(hFile: HANDLE): BOOL; stdcall;
  2139. {$EXTERNALSYM SetCommBreak}
  2140. function SetCommConfig(hCommDev: HANDLE; const lpCC: COMMCONFIG; dwSize: DWORD): BOOL; stdcall;
  2141. {$EXTERNALSYM SetCommConfig}
  2142. function SetCommMask(hFile: HANDLE; dwEvtMask: DWORD): BOOL; stdcall;
  2143. {$EXTERNALSYM SetCommMask}
  2144. function SetCommState(hFile: HANDLE; const lpDCB: DCB): BOOL; stdcall;
  2145. {$EXTERNALSYM SetCommState}
  2146. function SetCommTimeouts(hFile: HANDLE; const lpCommTimeouts: COMMTIMEOUTS): BOOL; stdcall;
  2147. {$EXTERNALSYM SetCommTimeouts}
  2148. function TransmitCommChar(hFile: HANDLE; cChar: Char): BOOL; stdcall;
  2149. {$EXTERNALSYM TransmitCommChar}
  2150. function WaitCommEvent(hFile: HANDLE; var lpEvtMask: DWORD;
  2151.   lpOverlapped: LPOVERLAPPED): BOOL; stdcall;
  2152. {$EXTERNALSYM WaitCommEvent}
  2153. function SetTapePosition(hDevice: HANDLE; dwPositionMethod, dwPartition,
  2154.   dwOffsetLow, dwOffsetHigh: DWORD; bImmediate: BOOL): DWORD; stdcall;
  2155. {$EXTERNALSYM SetTapePosition}
  2156. function GetTapePosition(hDevice: HANDLE; dwPositionType: DWORD;
  2157.   var lpdwPartition, lpdwOffsetLow: LPDWORD; lpdwOffsetHigh: LPDWORD): DWORD; stdcall;
  2158. {$EXTERNALSYM GetTapePosition}
  2159. function PrepareTape(hDevice: HANDLE; dwOperation: DWORD; bImmediate: BOOL): DWORD; stdcall;
  2160. {$EXTERNALSYM PrepareTape}
  2161. function EraseTape(hDevice: HANDLE; dwEraseType: DWORD; bImmediate: BOOL): DWORD; stdcall;
  2162. {$EXTERNALSYM EraseTape}
  2163. function CreateTapePartition(hDevice: HANDLE; dwPartitionMethod: DWORD;
  2164.   dwCount: DWORD; dwSize: DWORD): DWORD; stdcall;
  2165. {$EXTERNALSYM CreateTapePartition}
  2166. function WriteTapemark(hDevice: HANDLE; dwTapemarkType: DWORD;
  2167.   dwTapemarkCount: DWORD; bImmediate: BOOL): DWORD; stdcall;
  2168. {$EXTERNALSYM WriteTapemark}
  2169. function GetTapeStatus(hDevice: HANDLE): DWORD; stdcall;
  2170. {$EXTERNALSYM GetTapeStatus}
  2171. function GetTapeParameters(hDevice: HANDLE; dwOperation: DWORD;
  2172.   var lpdwSize: DWORD; lpTapeInformation: LPVOID): DWORD; stdcall;
  2173. {$EXTERNALSYM GetTapeParameters}
  2174. const
  2175.   GET_TAPE_MEDIA_INFORMATION = 0;
  2176.   {$EXTERNALSYM GET_TAPE_MEDIA_INFORMATION}
  2177.   GET_TAPE_DRIVE_INFORMATION = 1;
  2178.   {$EXTERNALSYM GET_TAPE_DRIVE_INFORMATION}
  2179. function SetTapeParameters(hDevice: HANDLE; dwOperation: DWORD; lpTapeInformation: LPVOID): DWORD; stdcall;
  2180. {$EXTERNALSYM SetTapeParameters}
  2181. const
  2182.   SET_TAPE_MEDIA_INFORMATION = 0;
  2183.   {$EXTERNALSYM SET_TAPE_MEDIA_INFORMATION}
  2184.   SET_TAPE_DRIVE_INFORMATION = 1;
  2185.   {$EXTERNALSYM SET_TAPE_DRIVE_INFORMATION}
  2186. function Beep(dwFreq: DWORD; dwDuration: DWORD): BOOL; stdcall;
  2187. {$EXTERNALSYM Beep}
  2188. function MulDiv(nNumber, nNumerator, nDenominator: Integer): Integer; stdcall;
  2189. {$EXTERNALSYM MulDiv}
  2190. procedure GetSystemTime(var lpSystemTime: SYSTEMTIME); stdcall;
  2191. {$EXTERNALSYM GetSystemTime}
  2192. procedure GetSystemTimeAsFileTime(var lpSystemTimeAsFileTime: FILETIME); stdcall;
  2193. {$EXTERNALSYM GetSystemTimeAsFileTime}
  2194. function SetSystemTime(var lpSystemTime: SYSTEMTIME): BOOL; stdcall;
  2195. {$EXTERNALSYM SetSystemTime}
  2196. procedure GetLocalTime(var lpSystemTime: SYSTEMTIME); stdcall;
  2197. {$EXTERNALSYM GetLocalTime}
  2198. function SetLocalTime(var lpSystemTime: SYSTEMTIME): BOOL; stdcall;
  2199. {$EXTERNALSYM SetLocalTime}
  2200. procedure GetSystemInfo(var lpSystemInfo: SYSTEM_INFO); stdcall;
  2201. {$EXTERNALSYM GetSystemInfo}
  2202. procedure GetNativeSystemInfo(lpSystemInfo: LPSYSTEM_INFO); stdcall;
  2203. {$EXTERNALSYM GetNativeSystemInfo}
  2204. function IsProcessorFeaturePresent(ProcessorFeature: DWORD): BOOL; stdcall;
  2205. {$EXTERNALSYM IsProcessorFeaturePresent}
  2206. type
  2207.   PTIME_ZONE_INFORMATION = ^TIME_ZONE_INFORMATION;
  2208.   {$EXTERNALSYM PTIME_ZONE_INFORMATION}
  2209.   _TIME_ZONE_INFORMATION = record
  2210.     Bias: LONG;
  2211.     StandardName: array [0..31] of WCHAR;
  2212.     StandardDate: SYSTEMTIME;
  2213.     StandardBias: LONG;
  2214.     DaylightName: array [0..31] of WCHAR;
  2215.     DaylightDate: SYSTEMTIME;
  2216.     DaylightBias: LONG;
  2217.   end;
  2218.   {$EXTERNALSYM _TIME_ZONE_INFORMATION}
  2219.   TIME_ZONE_INFORMATION = _TIME_ZONE_INFORMATION;
  2220.   {$EXTERNALSYM TIME_ZONE_INFORMATION}
  2221.   LPTIME_ZONE_INFORMATION = ^TIME_ZONE_INFORMATION;
  2222.   {$EXTERNALSYM LPTIME_ZONE_INFORMATION}
  2223.   TTimeZoneInformation = TIME_ZONE_INFORMATION;
  2224.   PTimeZoneInformation = PTIME_ZONE_INFORMATION;
  2225. function SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation: LPTIME_ZONE_INFORMATION;
  2226.   var lpUniversalTime, lpLocalTime: SYSTEMTIME): BOOL; stdcall;
  2227. {$EXTERNALSYM SystemTimeToTzSpecificLocalTime}
  2228. function TzSpecificLocalTimeToSystemTime(const lpTimeZoneInformation: TIME_ZONE_INFORMATION;
  2229.   const lpLocalTime: SYSTEMTIME; var lpUniversalTime: SYSTEMTIME): BOOL; stdcall;
  2230. {$EXTERNALSYM TzSpecificLocalTimeToSystemTime}
  2231. function GetTimeZoneInformation(var lpTimeZoneInformation: TIME_ZONE_INFORMATION): DWORD; stdcall;
  2232. {$EXTERNALSYM GetTimeZoneInformation}
  2233. function SetTimeZoneInformation(const lpTimeZoneInformation: TIME_ZONE_INFORMATION): BOOL; stdcall;
  2234. {$EXTERNALSYM SetTimeZoneInformation}
  2235. //
  2236. // Routines to convert back and forth between system time and file time
  2237. //
  2238. function SystemTimeToFileTime(const lpSystemTime: SYSTEMTIME; var lpFileTime: FILETIME): BOOL; stdcall;
  2239. {$EXTERNALSYM SystemTimeToFileTime}
  2240. function FileTimeToLocalFileTime(const lpFileTime: FILETIME; var lpLocalFileTime: FILETIME): BOOL; stdcall;
  2241. {$EXTERNALSYM FileTimeToLocalFileTime}
  2242. function LocalFileTimeToFileTime(const lpLocalFileTime: FILETIME; var lpFileTime: FILETIME): BOOL; stdcall;
  2243. {$EXTERNALSYM LocalFileTimeToFileTime}
  2244. function FileTimeToSystemTime(const lpFileTime: FILETIME; var lpSystemTime: SYSTEMTIME): BOOL; stdcall;
  2245. {$EXTERNALSYM FileTimeToSystemTime}
  2246. function CompareFileTime(const lpFileTime1, lpFileTime2: FILETIME): LONG; stdcall;
  2247. {$EXTERNALSYM CompareFileTime}
  2248. function FileTimeToDosDateTime(const lpFileTime: FILETIME; var lpFatDate,
  2249.   lpFatTime: WORD): BOOL; stdcall;
  2250. {$EXTERNALSYM FileTimeToDosDateTime}
  2251. function DosDateTimeToFileTime(wFatDate, wFatTime: WORD; var lpFileTime: FILETIME): BOOL; stdcall;
  2252. {$EXTERNALSYM DosDateTimeToFileTime}
  2253. function GetTickCount: DWORD; stdcall;
  2254. {$EXTERNALSYM GetTickCount}
  2255. function SetSystemTimeAdjustment(dwTimeAdjustment: DWORD;
  2256.   bTimeAdjustmentDisabled: BOOL): BOOL; stdcall;
  2257. {$EXTERNALSYM SetSystemTimeAdjustment}
  2258. function GetSystemTimeAdjustment(var lpTimeAdjustment, lpTimeIncrement: DWORD;
  2259.   var lpTimeAdjustmentDisabled: BOOL): BOOL; stdcall;
  2260. {$EXTERNALSYM GetSystemTimeAdjustment}
  2261. function FormatMessageA(dwFlags: DWORD; lpSource: LPCVOID; dwMessageId: DWORD;
  2262.   dwLanguageId: DWORD; lpBuffer: LPSTR; nSize: DWORD; Arguments: Pointer): DWORD; stdcall;
  2263. {$EXTERNALSYM FormatMessageA}
  2264. function FormatMessageW(dwFlags: DWORD; lpSource: LPCVOID; dwMessageId: DWORD;
  2265.   dwLanguageId: DWORD; lpBuffer: LPWSTR; nSize: DWORD; Arguments: Pointer): DWORD; stdcall;
  2266. {$EXTERNALSYM FormatMessageW}
  2267. {$IFDEF UNICODE}
  2268. function FormatMessage(dwFlags: DWORD; lpSource: LPCVOID; dwMessageId: DWORD;
  2269.   dwLanguageId: DWORD; lpBuffer: LPWSTR; nSize: DWORD; Arguments: Pointer): DWORD; stdcall;
  2270. {$EXTERNALSYM FormatMessage}
  2271. {$ELSE}
  2272. function FormatMessage(dwFlags: DWORD; lpSource: LPCVOID; dwMessageId: DWORD;
  2273.   dwLanguageId: DWORD; lpBuffer: LPSTR; nSize: DWORD; Arguments: Pointer): DWORD; stdcall;
  2274. {$EXTERNALSYM FormatMessage}
  2275. {$ENDIF}
  2276. const
  2277.   FORMAT_MESSAGE_ALLOCATE_BUFFER = $00000100;
  2278.   {$EXTERNALSYM FORMAT_MESSAGE_ALLOCATE_BUFFER}
  2279.   FORMAT_MESSAGE_IGNORE_INSERTS  = $00000200;
  2280.   {$EXTERNALSYM FORMAT_MESSAGE_IGNORE_INSERTS}
  2281.   FORMAT_MESSAGE_FROM_STRING     = $00000400;
  2282.   {$EXTERNALSYM FORMAT_MESSAGE_FROM_STRING}
  2283.   FORMAT_MESSAGE_FROM_HMODULE    = $00000800;
  2284.   {$EXTERNALSYM FORMAT_MESSAGE_FROM_HMODULE}
  2285.   FORMAT_MESSAGE_FROM_SYSTEM     = $00001000;
  2286.   {$EXTERNALSYM FORMAT_MESSAGE_FROM_SYSTEM}
  2287.   FORMAT_MESSAGE_ARGUMENT_ARRAY  = $00002000;
  2288.   {$EXTERNALSYM FORMAT_MESSAGE_ARGUMENT_ARRAY}
  2289.   FORMAT_MESSAGE_MAX_WIDTH_MASK  = $000000FF;
  2290.   {$EXTERNALSYM FORMAT_MESSAGE_MAX_WIDTH_MASK}
  2291. function CreatePipe(var hReadPipe, hWritePipe: HANDLE;
  2292.   lpPipeAttributes: LPSECURITY_ATTRIBUTES; nSize: DWORD): BOOL; stdcall;
  2293. {$EXTERNALSYM CreatePipe}
  2294. function ConnectNamedPipe(hNamedPipe: HANDLE; lpOverlapped: LPOVERLAPPED): BOOL; stdcall;
  2295. {$EXTERNALSYM ConnectNamedPipe}
  2296. function DisconnectNamedPipe(hNamedPipe: HANDLE): BOOL; stdcall;
  2297. {$EXTERNALSYM DisconnectNamedPipe}
  2298. function SetNamedPipeHandleState(hNamedPipe: HANDLE; var lpMode: DWORD;
  2299.   lpMaxCollectionCount: LPDWORD; lpCollectDataTimeout: LPDWORD): BOOL; stdcall;
  2300. {$EXTERNALSYM SetNamedPipeHandleState}
  2301. function GetNamedPipeInfo(hNamedPipe: HANDLE; lpFlags, lpOutBufferSize,
  2302.   lpInBufferSize, lpMaxInstances: LPDWORD): BOOL; stdcall;
  2303. {$EXTERNALSYM GetNamedPipeInfo}
  2304. function PeekNamedPipe(hNamedPipe: HANDLE; lpBuffer: LPVOID; nBufferSize: DWORD;
  2305.   lpBytesRead, lpTotalBytesAvail, lpBytesLeftThisMessage: LPDWORD): BOOL; stdcall;
  2306. {$EXTERNALSYM PeekNamedPipe}
  2307. function TransactNamedPipe(hNamedPipe: HANDLE; lpInBuffer: LPVOID;
  2308.   nInBufferSize: DWORD; lpOutBuffer: LPVOID; nOutBufferSize: DWORD;
  2309.   lpBytesRead: LPDWORD; lpOverlapped: LPOVERLAPPED): BOOL; stdcall;
  2310. {$EXTERNALSYM TransactNamedPipe}
  2311. function CreateMailslotA(lpName: LPCSTR; nMaxMessageSize, lReadTimeout: DWORD;
  2312.   lpSecurityAttributes: LPSECURITY_ATTRIBUTES): HANDLE; stdcall;
  2313. {$EXTERNALSYM CreateMailslotA}
  2314. function CreateMailslotW(lpName: LPCWSTR; nMaxMessageSize, lReadTimeout: DWORD;
  2315.   lpSecurityAttributes: LPSECURITY_ATTRIBUTES): HANDLE; stdcall;
  2316. {$EXTERNALSYM CreateMailslotW}
  2317. {$IFDEF UNICODE}
  2318. function CreateMailslot(lpName: LPCWSTR; nMaxMessageSize, lReadTimeout: DWORD;
  2319.   lpSecurityAttributes: LPSECURITY_ATTRIBUTES): HANDLE; stdcall;
  2320. {$EXTERNALSYM CreateMailslot}
  2321. {$ELSE}
  2322. function CreateMailslot(lpName: LPCSTR; nMaxMessageSize, lReadTimeout: DWORD;
  2323.   lpSecurityAttributes: LPSECURITY_ATTRIBUTES): HANDLE; stdcall;
  2324. {$EXTERNALSYM CreateMailslot}
  2325. {$ENDIF}
  2326. function GetMailslotInfo(hMailslot: HANDLE; lpMaxMessageSize, lpNextSize,
  2327.   lpMessageCount, lpReadTimeout: LPDWORD): BOOL; stdcall;
  2328. {$EXTERNALSYM GetMailslotInfo}
  2329. function SetMailslotInfo(hMailslot: HANDLE; lReadTimeout: DWORD): BOOL; stdcall;
  2330. {$EXTERNALSYM SetMailslotInfo}
  2331. function MapViewOfFile(hFileMappingObject: HANDLE; dwDesiredAccess: DWORD;
  2332.   dwFileOffsetHigh, dwFileOffsetLow: DWORD; dwNumberOfBytesToMap: SIZE_T): LPVOID; stdcall;
  2333. {$EXTERNALSYM MapViewOfFile}
  2334. function FlushViewOfFile(lpBaseAddress: LPCVOID; dwNumberOfBytesToFlush: SIZE_T): BOOL; stdcall;
  2335. {$EXTERNALSYM FlushViewOfFile}
  2336. function UnmapViewOfFile(lpBaseAddress: LPCVOID): BOOL; stdcall;
  2337. {$EXTERNALSYM UnmapViewOfFile}
  2338. //
  2339. // File Encryption API
  2340. //
  2341. function EncryptFileA(lpFileName: LPCSTR): BOOL; stdcall;
  2342. {$EXTERNALSYM EncryptFileA}
  2343. function EncryptFileW(lpFileName: LPCWSTR): BOOL; stdcall;
  2344. {$EXTERNALSYM EncryptFileW}
  2345. {$IFDEF UNICODE}
  2346. function EncryptFile(lpFileName: LPCWSTR): BOOL; stdcall;
  2347. {$EXTERNALSYM EncryptFile}
  2348. {$ELSE}
  2349. function EncryptFile(lpFileName: LPCSTR): BOOL; stdcall;
  2350. {$EXTERNALSYM EncryptFile}
  2351. {$ENDIF}
  2352. function DecryptFileA(lpFileName: LPCSTR; dwReserved: DWORD): BOOL; stdcall;
  2353. {$EXTERNALSYM DecryptFileA}
  2354. function DecryptFileW(lpFileName: LPCWSTR; dwReserved: DWORD): BOOL; stdcall;
  2355. {$EXTERNALSYM DecryptFileW}
  2356. {$IFDEF UNICODE}
  2357. function DecryptFile(lpFileName: LPCWSTR; dwReserved: DWORD): BOOL; stdcall;
  2358. {$EXTERNALSYM DecryptFile}
  2359. {$ELSE}
  2360. function DecryptFile(lpFileName: LPCSTR; dwReserved: DWORD): BOOL; stdcall;
  2361. {$EXTERNALSYM DecryptFile}
  2362. {$ENDIF}
  2363. //
  2364. //  Encryption Status Value
  2365. //
  2366. const
  2367.   FILE_ENCRYPTABLE        = 0;
  2368.   {$EXTERNALSYM FILE_ENCRYPTABLE}
  2369.   FILE_IS_ENCRYPTED       = 1;
  2370.   {$EXTERNALSYM FILE_IS_ENCRYPTED}
  2371.   FILE_SYSTEM_ATTR        = 2;
  2372.   {$EXTERNALSYM FILE_SYSTEM_ATTR}
  2373.   FILE_ROOT_DIR           = 3;
  2374.   {$EXTERNALSYM FILE_ROOT_DIR}
  2375.   FILE_SYSTEM_DIR         = 4;
  2376.   {$EXTERNALSYM FILE_SYSTEM_DIR}
  2377.   FILE_UNKNOWN            = 5;
  2378.   {$EXTERNALSYM FILE_UNKNOWN}
  2379.   FILE_SYSTEM_NOT_SUPPORT = 6;
  2380.   {$EXTERNALSYM FILE_SYSTEM_NOT_SUPPORT}
  2381.   FILE_USER_DISALLOWED    = 7;
  2382.   {$EXTERNALSYM FILE_USER_DISALLOWED}
  2383.   FILE_READ_ONLY          = 8;
  2384.   {$EXTERNALSYM FILE_READ_ONLY}
  2385.   FILE_DIR_DISALLOWED     = 9;
  2386.   {$EXTERNALSYM FILE_DIR_DISALLOWED}
  2387. function FileEncryptionStatusA(lpFileName: LPCSTR; var lpStatus: DWORD): BOOL; stdcall;
  2388. {$EXTERNALSYM FileEncryptionStatusA}
  2389. function FileEncryptionStatusW(lpFileName: LPCWSTR; var lpStatus: DWORD): BOOL; stdcall;
  2390. {$EXTERNALSYM FileEncryptionStatusW}
  2391. {$IFDEF UNICODE}
  2392. function FileEncryptionStatus(lpFileName: LPCWSTR; var lpStatus: DWORD): BOOL; stdcall;
  2393. {$EXTERNALSYM FileEncryptionStatus}
  2394. {$ELSE}
  2395. function FileEncryptionStatus(lpFileName: LPCSTR; var lpStatus: DWORD): BOOL; stdcall;
  2396. {$EXTERNALSYM FileEncryptionStatus}
  2397. {$ENDIF}
  2398. //
  2399. // Currently defined recovery flags
  2400. //
  2401. const
  2402.   EFS_USE_RECOVERY_KEYS = ($1);
  2403.   {$EXTERNALSYM EFS_USE_RECOVERY_KEYS}
  2404. type
  2405.   PFE_EXPORT_FUNC = function (pbData: PBYTE; pvCallbackContext: PVOID;
  2406.     ulLength: ULONG): DWORD; stdcall;
  2407.   {$EXTERNALSYM PFE_EXPORT_FUNC}
  2408.   PFE_IMPORT_FUNC = function (pbData: PBYTE; pvCallbackContext: PVOID;
  2409.     ulLength: PULONG): DWORD; stdcall;
  2410.   {$EXTERNALSYM PFE_IMPORT_FUNC}
  2411. //
  2412. //  OpenRaw flag values
  2413. //
  2414. const
  2415.   CREATE_FOR_IMPORT = (1);
  2416.   {$EXTERNALSYM CREATE_FOR_IMPORT}
  2417.   CREATE_FOR_DIR    = (2);
  2418.   {$EXTERNALSYM CREATE_FOR_DIR}
  2419.   OVERWRITE_HIDDEN  = (4);
  2420.   {$EXTERNALSYM OVERWRITE_HIDDEN}
  2421. function OpenEncryptedFileRawA(lpFileName: LPCSTR; ulFlags: ULONG;
  2422.   pvContext: PVOID): DWORD; stdcall;
  2423. {$EXTERNALSYM OpenEncryptedFileRawA}
  2424. function OpenEncryptedFileRawW(lpFileName: LPCWSTR; ulFlags: ULONG;
  2425.   pvContext: PVOID): DWORD; stdcall;
  2426. {$EXTERNALSYM OpenEncryptedFileRawW}
  2427. {$IFDEF UNICODE}
  2428. function OpenEncryptedFileRaw(lpFileName: LPCWSTR; ulFlags: ULONG;
  2429.   pvContext: PVOID): DWORD; stdcall;
  2430. {$EXTERNALSYM OpenEncryptedFileRaw}
  2431. {$ELSE}
  2432. function OpenEncryptedFileRaw(lpFileName: LPCSTR; ulFlags: ULONG;
  2433.   pvContext: PVOID): DWORD; stdcall;
  2434. {$EXTERNALSYM OpenEncryptedFileRaw}
  2435. {$ENDIF}
  2436. function ReadEncryptedFileRaw(pfExportCallback: PFE_EXPORT_FUNC;
  2437.   pvCallbackContext: PVOID; pvContext: PVOID): DWORD; stdcall;
  2438. {$EXTERNALSYM ReadEncryptedFileRaw}
  2439. function WriteEncryptedFileRaw(pfImportCallback: PFE_IMPORT_FUNC;
  2440.   pvCallbackContext: PVOID; pvContext: PVOID): DWORD; stdcall;
  2441. {$EXTERNALSYM WriteEncryptedFileRaw}
  2442. procedure CloseEncryptedFileRaw(pvContext: PVOID); stdcall;
  2443. {$EXTERNALSYM CloseEncryptedFileRaw}
  2444. //
  2445. // _l Compat Functions
  2446. //
  2447. function lstrcmpA(lpString1, lpString2: LPCSTR): Integer; stdcall;
  2448. {$EXTERNALSYM lstrcmpA}
  2449. function lstrcmpW(lpString1, lpString2: LPCWSTR): Integer; stdcall;
  2450. {$EXTERNALSYM lstrcmpW}
  2451. {$IFDEF UNICODE}
  2452. function lstrcmp(lpString1, lpString2: LPCWSTR): Integer; stdcall;
  2453. {$EXTERNALSYM lstrcmp}
  2454. {$ELSE}
  2455. function lstrcmp(lpString1, lpString2: LPCSTR): Integer; stdcall;
  2456. {$EXTERNALSYM lstrcmp}
  2457. {$ENDIF}
  2458. function lstrcmpiA(lpString1, lpString2: LPCSTR): Integer; stdcall;
  2459. {$EXTERNALSYM lstrcmpiA}
  2460. function lstrcmpiW(lpString1, lpString2: LPCWSTR): Integer; stdcall;
  2461. {$EXTERNALSYM lstrcmpiW}
  2462. {$IFDEF UNICODE}
  2463. function lstrcmpi(lpString1, lpString2: LPCWSTR): Integer; stdcall;
  2464. {$EXTERNALSYM lstrcmpi}
  2465. {$ELSE}
  2466. function lstrcmpi(lpString1, lpString2: LPCSTR): Integer; stdcall;
  2467. {$EXTERNALSYM lstrcmpi}
  2468. {$ENDIF}
  2469. function lstrcpynA(lpString1: LPSTR; lpString2: LPCSTR; iMaxLength: Integer): LPSTR; stdcall;
  2470. {$EXTERNALSYM lstrcpynA}
  2471. function lstrcpynW(lpString1: LPWSTR; lpString2: LPCWSTR; iMaxLength: Integer): LPWSTR; stdcall;
  2472. {$EXTERNALSYM lstrcpynW}
  2473. {$IFDEF UNICODE}
  2474. function lstrcpyn(lpString1: LPWSTR; lpString2: LPCWSTR; iMaxLength: Integer): LPWSTR; stdcall;
  2475. {$EXTERNALSYM lstrcpyn}
  2476. {$ELSE}
  2477. function lstrcpyn(lpString1: LPSTR; lpString2: LPCSTR; iMaxLength: Integer): LPSTR; stdcall;
  2478. {$EXTERNALSYM lstrcpyn}
  2479. {$ENDIF}
  2480. function lstrcpyA(lpString1: LPSTR; lpString2: LPCSTR): LPSTR; stdcall;
  2481. {$EXTERNALSYM lstrcpyA}
  2482. function lstrcpyW(lpString1: LPWSTR; lpString2: LPCWSTR): LPWSTR; stdcall;
  2483. {$EXTERNALSYM lstrcpyW}
  2484. {$IFDEF UNICODE}
  2485. function lstrcpy(lpString1: LPWSTR; lpString2: LPCWSTR): LPWSTR; stdcall;
  2486. {$EXTERNALSYM lstrcpy}
  2487. {$ELSE}
  2488. function lstrcpy(lpString1: LPSTR; lpString2: LPCSTR): LPSTR; stdcall;
  2489. {$EXTERNALSYM lstrcpy}
  2490. {$ENDIF}
  2491. function lstrcatA(lpString1: LPSTR; lpString2: LPCSTR): LPSTR; stdcall;
  2492. {$EXTERNALSYM lstrcatA}
  2493. function lstrcatW(lpString1: LPWSTR; lpString2: LPCWSTR): LPWSTR; stdcall;
  2494. {$EXTERNALSYM lstrcatW}
  2495. {$IFDEF UNICODE}
  2496. function lstrcat(lpString1: LPWSTR; lpString2: LPCWSTR): LPWSTR; stdcall;
  2497. {$EXTERNALSYM lstrcat}
  2498. {$ELSE}
  2499. function lstrcat(lpString1: LPSTR; lpString2: LPCSTR): LPSTR; stdcall;
  2500. {$EXTERNALSYM lstrcat}
  2501. {$ENDIF}
  2502. function lstrlenA(lpString: LPCSTR): Integer; stdcall;
  2503. {$EXTERNALSYM lstrlenA}
  2504. function lstrlenW(lpString: LPCWSTR): Integer; stdcall;
  2505. {$EXTERNALSYM lstrlenW}
  2506. {$IFDEF UNICODE}
  2507. function lstrlen(lpString: LPCWSTR): Integer; stdcall;
  2508. {$EXTERNALSYM lstrlen}
  2509. {$ELSE}
  2510. function lstrlen(lpString: LPCSTR): Integer; stdcall;
  2511. {$EXTERNALSYM lstrlen}
  2512. {$ENDIF}
  2513. function OpenFile(lpFileName: LPCSTR; var lpReOpenBuff: OFSTRUCT; uStyle: UINT): HFILE; stdcall;
  2514. {$EXTERNALSYM OpenFile}
  2515. function _lopen(lpPathName: LPCSTR; iReadWrite: Integer): HFILE; stdcall;
  2516. {$EXTERNALSYM _lopen}
  2517. function _lcreat(lpPathName: LPCSTR; iAttribute: Integer): HFILE; stdcall;
  2518. {$EXTERNALSYM _lcreat}
  2519. function _lread(hFile: HFILE; lpBuffer: LPVOID; uBytes: UINT): UINT; stdcall;
  2520. {$EXTERNALSYM _lread}
  2521. function _lwrite(hFile: HFILE; lpBuffer: LPCSTR; uBytes: UINT): UINT; stdcall;
  2522. {$EXTERNALSYM _lwrite}
  2523. function _hread(hFile: HFILE; lpBuffer: LPVOID; lBytes: Longint): Longint; stdcall;
  2524. {$EXTERNALSYM _hread}
  2525. function _hwrite(hFile: HFILE; lpBuffer: LPCSTR; lBytes: Longint): Longint; stdcall;
  2526. {$EXTERNALSYM _hwrite}
  2527. function _lclose(hFile: HFILE): HFILE; stdcall;
  2528. {$EXTERNALSYM _lclose}
  2529. function _llseek(hFile: HFILE; lOffset: LONG; iOrigin: Integer): LONG; stdcall;
  2530. {$EXTERNALSYM _llseek}
  2531. function IsTextUnicode(lpBuffer: LPVOID; cb: Integer; lpi: LPINT): BOOL; stdcall;
  2532. {$EXTERNALSYM IsTextUnicode}
  2533. type
  2534.   PFLS_CALLBACK_FUNCTION = procedure (lpFlsData: PVOID); stdcall;
  2535.   {$EXTERNALSYM PFLS_CALLBACK_FUNCTION}
  2536.   TFlsCallbackFunction = PFLS_CALLBACK_FUNCTION;
  2537. const
  2538.   FLS_OUT_OF_INDEXES = DWORD($FFFFFFFF);
  2539.   {$EXTERNALSYM FLS_OUT_OF_INDEXES}
  2540. function FlsAlloc(lpCallback: PFLS_CALLBACK_FUNCTION): DWORD; stdcall;
  2541. {$EXTERNALSYM FlsAlloc}
  2542. function FlsGetValue(dwFlsIndex: DWORD): DWORD; stdcall;
  2543. {$EXTERNALSYM FlsGetValue}
  2544. function FlsSetValue(dwFlsIndex: DWORD; lpFlsData: PVOID): DWORD; stdcall;
  2545. {$EXTERNALSYM FlsSetValue}
  2546. function FlsFree(dwFlsIndex: DWORD): DWORD; stdcall;
  2547. {$EXTERNALSYM FlsFree}
  2548. const
  2549.   TLS_OUT_OF_INDEXES = DWORD($FFFFFFFF);
  2550.   {$EXTERNALSYM TLS_OUT_OF_INDEXES}
  2551. function TlsAlloc: DWORD; stdcall;
  2552. {$EXTERNALSYM TlsAlloc}
  2553. function TlsGetValue(dwTlsIndex: DWORD): LPVOID; stdcall;
  2554. {$EXTERNALSYM TlsGetValue}
  2555. function TlsSetValue(dwTlsIndex: DWORD; lpTlsValue: LPVOID): BOOL; stdcall;
  2556. {$EXTERNALSYM TlsSetValue}
  2557. function TlsFree(dwTlsIndex: DWORD): BOOL; stdcall;
  2558. {$EXTERNALSYM TlsFree}
  2559. type
  2560.   LPOVERLAPPED_COMPLETION_ROUTINE = procedure (dwErrorCode: DWORD;
  2561.     dwNumberOfBytesTransfered: DWORD; lpOverlapped: LPOVERLAPPED); stdcall;
  2562.   {$EXTERNALSYM LPOVERLAPPED_COMPLETION_ROUTINE}
  2563.   TOverlappedCompletionRoutine = LPOVERLAPPED_COMPLETION_ROUTINE;
  2564. function SleepEx(dwMilliseconds: DWORD; bAlertable: BOOL): DWORD; stdcall;
  2565. {$EXTERNALSYM SleepEx}
  2566. function WaitForSingleObjectEx(hHandle: HANDLE; dwMilliseconds: DWORD;
  2567.   bAlertable: BOOL): DWORD; stdcall;
  2568. {$EXTERNALSYM WaitForSingleObjectEx}
  2569. function WaitForMultipleObjectsEx(nCount: DWORD; lpHandles: PHANDLE;
  2570.   bWaitAll: BOOL; dwMilliseconds: DWORD; bAlertable: BOOL): DWORD; stdcall;
  2571. {$EXTERNALSYM WaitForMultipleObjectsEx}
  2572. function SignalObjectAndWait(hObjectToSignal: HANDLE; hObjectToWaitOn: HANDLE;
  2573.   dwMilliseconds: DWORD; bAlertable: BOOL): DWORD; stdcall;
  2574. {$EXTERNALSYM SignalObjectAndWait}
  2575. function ReadFileEx(hFile: HANDLE; lpBuffer: LPVOID; nNumberOfBytesToRead: DWORD;
  2576.   lpOverlapped: LPOVERLAPPED; lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE): BOOL; stdcall;
  2577. {$EXTERNALSYM ReadFileEx}
  2578. function WriteFileEx(hFile: HANDLE; lpBuffer: LPCVOID; nNumberOfBytesToWrite: DWORD;
  2579.   lpOverlapped: LPOVERLAPPED; lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE): BOOL; stdcall;
  2580. {$EXTERNALSYM WriteFileEx}
  2581. function BackupRead(hFile: HANDLE; lpBuffer: LPBYTE;
  2582.   nNumberOfBytesToRead: DWORD; var lpNumberOfBytesRead: DWORD;
  2583.   bAbort, bProcessSecurity: BOOL; var lpContext: LPVOID): BOOL; stdcall;
  2584. {$EXTERNALSYM BackupRead}
  2585. function BackupSeek(hFile: HANDLE; dwLowBytesToSeek, dwHighBytesToSeek: DWORD;
  2586.   var lpdwLowByteSeeked, lpdwHighByteSeeked: DWORD; var lpContext: LPVOID): BOOL; stdcall;
  2587. {$EXTERNALSYM BackupSeek}
  2588. function BackupWrite(hFile: HANDLE; lpBuffer: LPBYTE; nNumberOfBytesToWrite: DWORD;
  2589.   var lpNumberOfBytesWritten: DWORD; bAbort, bProcessSecurity: BOOL;
  2590.   var lpContext: LPVOID): BOOL; stdcall;
  2591. {$EXTERNALSYM BackupWrite}
  2592. //
  2593. //  Stream id structure
  2594. //
  2595. type
  2596.   LPWIN32_STREAM_ID = ^WIN32_STREAM_ID;
  2597.   {$EXTERNALSYM LPWIN32_STREAM_ID}
  2598.   _WIN32_STREAM_ID = record
  2599.     dwStreamId: DWORD;
  2600.     dwStreamAttributes: DWORD;
  2601.     Size: TLargeInteger;
  2602.     dwStreamNameSize: DWORD;
  2603.     cStreamName: array [0..ANYSIZE_ARRAY - 1] of WCHAR;
  2604.   end;
  2605.   {$EXTERNALSYM _WIN32_STREAM_ID}
  2606.   WIN32_STREAM_ID = _WIN32_STREAM_ID;
  2607.   {$EXTERNALSYM WIN32_STREAM_ID}
  2608.   TWin32StreamId = WIN32_STREAM_ID;
  2609.   PWin32StreamId = LPWIN32_STREAM_ID;
  2610. //
  2611. //  Stream Ids
  2612. //
  2613. const
  2614.   BACKUP_INVALID        = $00000000;
  2615.   {$EXTERNALSYM BACKUP_INVALID}
  2616.   BACKUP_DATA           = $00000001;
  2617.   {$EXTERNALSYM BACKUP_DATA}
  2618.   BACKUP_EA_DATA        = $00000002;
  2619.   {$EXTERNALSYM BACKUP_EA_DATA}
  2620.   BACKUP_SECURITY_DATA  = $00000003;
  2621.   {$EXTERNALSYM BACKUP_SECURITY_DATA}
  2622.   BACKUP_ALTERNATE_DATA = $00000004;
  2623.   {$EXTERNALSYM BACKUP_ALTERNATE_DATA}
  2624.   BACKUP_LINK           = $00000005;
  2625.   {$EXTERNALSYM BACKUP_LINK}
  2626.   BACKUP_PROPERTY_DATA  = $00000006;
  2627.   {$EXTERNALSYM BACKUP_PROPERTY_DATA}
  2628.   BACKUP_OBJECT_ID      = $00000007;
  2629.   {$EXTERNALSYM BACKUP_OBJECT_ID}
  2630.   BACKUP_REPARSE_DATA   = $00000008;
  2631.   {$EXTERNALSYM BACKUP_REPARSE_DATA}
  2632.   BACKUP_SPARSE_BLOCK   = $00000009;
  2633.   {$EXTERNALSYM BACKUP_SPARSE_BLOCK}
  2634. //
  2635. //  Stream Attributes
  2636. //
  2637. const
  2638.   STREAM_NORMAL_ATTRIBUTE    = $00000000;
  2639.   {$EXTERNALSYM STREAM_NORMAL_ATTRIBUTE}
  2640.   STREAM_MODIFIED_WHEN_READ  = $00000001;
  2641.   {$EXTERNALSYM STREAM_MODIFIED_WHEN_READ}
  2642.   STREAM_CONTAINS_SECURITY   = $00000002;
  2643.   {$EXTERNALSYM STREAM_CONTAINS_SECURITY}
  2644.   STREAM_CONTAINS_PROPERTIES = $00000004;
  2645.   {$EXTERNALSYM STREAM_CONTAINS_PROPERTIES}
  2646.   STREAM_SPARSE_ATTRIBUTE    = $00000008;
  2647.   {$EXTERNALSYM STREAM_SPARSE_ATTRIBUTE}
  2648. function ReadFileScatter(hFile: HANDLE; aSegmentArray: PFILE_SEGMENT_ELEMENT;
  2649.   nNumberOfBytesToRead: DWORD; lpReserved: LPDWORD; lpOverlapped: LPOVERLAPPED): BOOL; stdcall;
  2650. {$EXTERNALSYM ReadFileScatter}
  2651. function WriteFileGather(hFile: HANDLE; aSegmentArray: PFILE_SEGMENT_ELEMENT;
  2652.   nNumberOfBytesToWrite: DWORD; lpReserved: LPDWORD; lpOverlapped: LPOVERLAPPED): BOOL; stdcall;
  2653. {$EXTERNALSYM WriteFileGather}
  2654. //
  2655. // Dual Mode API below this line. Dual Mode Structures also included.
  2656. //
  2657. const
  2658.   STARTF_USESHOWWINDOW    = $00000001;
  2659.   {$EXTERNALSYM STARTF_USESHOWWINDOW}
  2660.   STARTF_USESIZE          = $00000002;
  2661.   {$EXTERNALSYM STARTF_USESIZE}
  2662.   STARTF_USEPOSITION      = $00000004;
  2663.   {$EXTERNALSYM STARTF_USEPOSITION}
  2664.   STARTF_USECOUNTCHARS    = $00000008;
  2665.   {$EXTERNALSYM STARTF_USECOUNTCHARS}
  2666.   STARTF_USEFILLATTRIBUTE = $00000010;
  2667.   {$EXTERNALSYM STARTF_USEFILLATTRIBUTE}
  2668.   STARTF_RUNFULLSCREEN    = $00000020; // ignored for non-x86 platforms
  2669.   {$EXTERNALSYM STARTF_RUNFULLSCREEN}
  2670.   STARTF_FORCEONFEEDBACK  = $00000040;
  2671.   {$EXTERNALSYM STARTF_FORCEONFEEDBACK}
  2672.   STARTF_FORCEOFFFEEDBACK = $00000080;
  2673.   {$EXTERNALSYM STARTF_FORCEOFFFEEDBACK}
  2674.   STARTF_USESTDHANDLES    = $00000100;
  2675.   {$EXTERNALSYM STARTF_USESTDHANDLES}
  2676.   STARTF_USEHOTKEY = $00000200;
  2677.   {$EXTERNALSYM STARTF_USEHOTKEY}
  2678. type
  2679.   LPSTARTUPINFOA = ^STARTUPINFOA;
  2680.   {$EXTERNALSYM LPSTARTUPINFOA}
  2681.   _STARTUPINFOA = record
  2682.     cb: DWORD;
  2683.     lpReserved: LPSTR;
  2684.     lpDesktop: LPSTR;
  2685.     lpTitle: LPSTR;
  2686.     dwX: DWORD;
  2687.     dwY: DWORD;
  2688.     dwXSize: DWORD;
  2689.     dwYSize: DWORD;
  2690.     dwXCountChars: DWORD;
  2691.     dwYCountChars: DWORD;
  2692.     dwFillAttribute: DWORD;
  2693.     dwFlags: DWORD;
  2694.     wShowWindow: WORD;
  2695.     cbReserved2: WORD;
  2696.     lpReserved2: LPBYTE;
  2697.     hStdInput: HANDLE;
  2698.     hStdOutput: HANDLE;
  2699.     hStdError: HANDLE;
  2700.   end;
  2701.   {$EXTERNALSYM _STARTUPINFOA}
  2702.   STARTUPINFOA = _STARTUPINFOA;
  2703.   {$EXTERNALSYM STARTUPINFOA}
  2704.   TStartupInfoA = STARTUPINFOA;
  2705.   PStartupInfoA = LPSTARTUPINFOA;
  2706.   LPSTARTUPINFOW = ^STARTUPINFOW;
  2707.   {$EXTERNALSYM LPSTARTUPINFOW}
  2708.   _STARTUPINFOW = record
  2709.     cb: DWORD;
  2710.     lpReserved: LPWSTR;
  2711.     lpDesktop: LPWSTR;
  2712.     lpTitle: LPWSTR;
  2713.     dwX: DWORD;
  2714.     dwY: DWORD;
  2715.     dwXSize: DWORD;
  2716.     dwYSize: DWORD;
  2717.     dwXCountChars: DWORD;
  2718.     dwYCountChars: DWORD;
  2719.     dwFillAttribute: DWORD;
  2720.     dwFlags: DWORD;
  2721.     wShowWindow: WORD;
  2722.     cbReserved2: WORD;
  2723.     lpReserved2: LPBYTE;
  2724.     hStdInput: HANDLE;
  2725.     hStdOutput: HANDLE;
  2726.     hStdError: HANDLE;
  2727.   end;
  2728.   {$EXTERNALSYM _STARTUPINFOW}
  2729.   STARTUPINFOW = _STARTUPINFOW;
  2730.   {$EXTERNALSYM STARTUPINFOW}
  2731.   TStartupInfoW = STARTUPINFOW;
  2732.   PStartupInfoW = LPSTARTUPINFOW;
  2733. {$IFDEF UNICODE}
  2734.   STARTUPINFO = STARTUPINFOW;
  2735.   {$EXTERNALSYM STARTUPINFO}
  2736.   LPSTARTUPINFO = LPSTARTUPINFOW;
  2737.   {$EXTERNALSYM LPSTARTUPINFO}
  2738.   TStartupInfo = TStartupInfoW;
  2739.   PStartupInfo = PStartupInfoW;
  2740. {$ELSE}
  2741.   STARTUPINFO = STARTUPINFOA;
  2742.   {$EXTERNALSYM STARTUPINFO}
  2743.   LPSTARTUPINFO = LPSTARTUPINFOA;
  2744.   {$EXTERNALSYM LPSTARTUPINFO}
  2745.   TStartupInfo = TStartupInfoA;
  2746.   PStartupInfo = PStartupInfoA;
  2747. {$ENDIF}
  2748. const
  2749.   SHUTDOWN_NORETRY = $00000001;
  2750.   {$EXTERNALSYM SHUTDOWN_NORETRY}
  2751. type
  2752.   PWIN32_FIND_DATAA = ^WIN32_FIND_DATAA;
  2753.   {$EXTERNALSYM PWIN32_FIND_DATAA}
  2754.   _WIN32_FIND_DATAA = record
  2755.     dwFileAttributes: DWORD;
  2756.     ftCreationTime: FILETIME;
  2757.     ftLastAccessTime: FILETIME;
  2758.     ftLastWriteTime: FILETIME;
  2759.     nFileSizeHigh: DWORD;
  2760.     nFileSizeLow: DWORD;
  2761.     dwReserved0: DWORD;
  2762.     dwReserved1: DWORD;
  2763.     cFileName: array [0..MAX_PATH - 1] of CHAR;
  2764.     cAlternateFileName: array [0..13] of CHAR;
  2765.   end;
  2766.   {$EXTERNALSYM _WIN32_FIND_DATAA}
  2767.   WIN32_FIND_DATAA = _WIN32_FIND_DATAA;
  2768.   {$EXTERNALSYM WIN32_FIND_DATAA}
  2769.   LPWIN32_FIND_DATAA = ^WIN32_FIND_DATAA;
  2770.   {$EXTERNALSYM LPWIN32_FIND_DATAA}
  2771.   TWin32FindDataA = WIN32_FIND_DATAA;
  2772.   PWin32FindDataA = PWIN32_FIND_DATAA;
  2773.   PWIN32_FIND_DATAW = ^WIN32_FIND_DATAW;
  2774.   {$EXTERNALSYM PWIN32_FIND_DATAW}
  2775.   _WIN32_FIND_DATAW = record
  2776.     dwFileAttributes: DWORD;
  2777.     ftCreationTime: FILETIME;
  2778.     ftLastAccessTime: FILETIME;
  2779.     ftLastWriteTime: FILETIME;
  2780.     nFileSizeHigh: DWORD;
  2781.     nFileSizeLow: DWORD;
  2782.     dwReserved0: DWORD;
  2783.     dwReserved1: DWORD;
  2784.     cFileName: array [0..MAX_PATH - 1] of WCHAR;
  2785.     cAlternateFileName: array [0..13] of WCHAR;
  2786.   end;
  2787.   {$EXTERNALSYM _WIN32_FIND_DATAW}
  2788.   WIN32_FIND_DATAW = _WIN32_FIND_DATAW;
  2789.   {$EXTERNALSYM WIN32_FIND_DATAW}
  2790.   LPWIN32_FIND_DATAW = ^WIN32_FIND_DATAW;
  2791.   {$EXTERNALSYM LPWIN32_FIND_DATAW}
  2792.   TWin32FindDataW = WIN32_FIND_DATAW;
  2793.   PWin32FindDataW = PWIN32_FIND_DATAW;
  2794. {$IFDEF UNICODE}
  2795.   WIN32_FIND_DATA = WIN32_FIND_DATAW;
  2796.   {$EXTERNALSYM WIN32_FIND_DATA}
  2797.   PWIN32_FIND_DATA = PWIN32_FIND_DATAW;
  2798.   {$EXTERNALSYM PWIN32_FIND_DATA}
  2799.   LPWIN32_FIND_DATA = LPWIN32_FIND_DATAW;
  2800.   {$EXTERNALSYM LPWIN32_FIND_DATA}
  2801.   TWin32FindData = TWin32FindDataW;
  2802.   PWin32FindData = PWin32FindDataW;
  2803. {$ELSE}
  2804.   WIN32_FIND_DATA = WIN32_FIND_DATAA;
  2805.   {$EXTERNALSYM WIN32_FIND_DATA}
  2806.   PWIN32_FIND_DATA = PWIN32_FIND_DATAA;
  2807.   {$EXTERNALSYM PWIN32_FIND_DATA}
  2808.   LPWIN32_FIND_DATA = LPWIN32_FIND_DATAA;
  2809.   {$EXTERNALSYM LPWIN32_FIND_DATA}
  2810.   TWin32FindData = TWin32FindDataA;
  2811.   PWin32FindData = PWin32FindDataA;
  2812. {$ENDIF}
  2813.   LPWIN32_FILE_ATTRIBUTE_DATA = ^WIN32_FILE_ATTRIBUTE_DATA;
  2814.   {$EXTERNALSYM LPWIN32_FILE_ATTRIBUTE_DATA}
  2815.   _WIN32_FILE_ATTRIBUTE_DATA = record
  2816.     dwFileAttributes: DWORD;
  2817.     ftCreationTime: FILETIME;
  2818.     ftLastAccessTime: FILETIME;
  2819.     ftLastWriteTime: FILETIME;
  2820.     nFileSizeHigh: DWORD;
  2821.     nFileSizeLow: DWORD;
  2822.   end;
  2823.   {$EXTERNALSYM _WIN32_FILE_ATTRIBUTE_DATA}
  2824.   WIN32_FILE_ATTRIBUTE_DATA = _WIN32_FILE_ATTRIBUTE_DATA;
  2825.   {$EXTERNALSYM WIN32_FILE_ATTRIBUTE_DATA}
  2826.   TWin32FileAttributeData = WIN32_FILE_ATTRIBUTE_DATA;
  2827.   PWin32FileAttributeData = LPWIN32_FILE_ATTRIBUTE_DATA;
  2828. function CreateMutexA(lpMutexAttributes: LPSECURITY_ATTRIBUTES; bInitialOwner: BOOL; lpName: LPCSTR): HANDLE;
  2829. {$EXTERNALSYM CreateMutexA}
  2830. function CreateMutexW(lpMutexAttributes: LPSECURITY_ATTRIBUTES; bInitialOwner: BOOL; lpName: LPCWSTR): HANDLE;
  2831. {$EXTERNALSYM CreateMutexW}
  2832. {$IFDEF UNICODE}
  2833. function CreateMutex(lpMutexAttributes: LPSECURITY_ATTRIBUTES;
  2834.   bInitialOwner: BOOL; lpName: LPCWSTR): HANDLE;
  2835. {$EXTERNALSYM CreateMutex}
  2836. {$ELSE}
  2837. function CreateMutex(lpMutexAttributes: LPSECURITY_ATTRIBUTES;
  2838.   bInitialOwner: BOOL; lpName: LPCSTR): HANDLE;
  2839. {$EXTERNALSYM CreateMutex}
  2840. {$ENDIF}
  2841. function OpenMutexA(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: LPCSTR): HANDLE; stdcall;
  2842. {$EXTERNALSYM OpenMutexA}
  2843. function OpenMutexW(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: LPCWSTR): HANDLE; stdcall;
  2844. {$EXTERNALSYM OpenMutexW}
  2845. {$IFDEF UNICODE}
  2846. function OpenMutex(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: LPCWSTR): HANDLE; stdcall;
  2847. {$EXTERNALSYM OpenMutex}
  2848. {$ELSE}
  2849. function OpenMutex(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: LPCSTR): HANDLE; stdcall;
  2850. {$EXTERNALSYM OpenMutex}
  2851. {$ENDIF}
  2852. function CreateEventA(lpEventAttributes: LPSECURITY_ATTRIBUTES;
  2853.   bManualReset, bInitialState: BOOL; lpName: LPCSTR): HANDLE; stdcall;
  2854. {$EXTERNALSYM CreateEventA}
  2855. function CreateEventW(lpEventAttributes: LPSECURITY_ATTRIBUTES;
  2856.   bManualReset, bInitialState: BOOL; lpName: LPCWSTR): HANDLE; stdcall;
  2857. {$EXTERNALSYM CreateEventW}
  2858. {$IFDEF UNICODE}
  2859. function CreateEvent(lpEventAttributes: LPSECURITY_ATTRIBUTES;
  2860.   bManualReset, bInitialState: BOOL; lpName: LPCWSTR): HANDLE; stdcall;
  2861. {$EXTERNALSYM CreateEvent}
  2862. {$ELSE}
  2863. function CreateEvent(lpEventAttributes: LPSECURITY_ATTRIBUTES;
  2864.   bManualReset, bInitialState: BOOL; lpName: LPCSTR): HANDLE; stdcall;
  2865. {$EXTERNALSYM CreateEvent}
  2866. {$ENDIF}
  2867. function OpenEventA(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: LPCSTR): HANDLE; stdcall;
  2868. {$EXTERNALSYM OpenEventA}
  2869. function OpenEventW(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: LPCWSTR): HANDLE; stdcall;
  2870. {$EXTERNALSYM OpenEventW}
  2871. {$IFDEF UNICODE}
  2872. function OpenEvent(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: LPCWSTR): HANDLE; stdcall;
  2873. {$EXTERNALSYM OpenEvent}
  2874. {$ELSE}
  2875. function OpenEvent(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: LPCSTR): HANDLE; stdcall;
  2876. {$EXTERNALSYM OpenEvent}
  2877. {$ENDIF}
  2878. function CreateSemaphoreA(lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES;
  2879.   lInitialCount, lMaximumCount: LONG; lpName: LPCSTR): HANDLE; stdcall;
  2880. {$EXTERNALSYM CreateSemaphoreA}
  2881. function CreateSemaphoreW(lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES;
  2882.   lInitialCount, lMaximumCount: LONG; lpName: LPCWSTR): HANDLE; stdcall;
  2883. {$EXTERNALSYM CreateSemaphoreW}
  2884. {$IFDEF UNICODE}
  2885. function CreateSemaphore(lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES;
  2886.   lInitialCount, lMaximumCount: LONG; lpName: LPCWSTR): HANDLE; stdcall;
  2887. {$EXTERNALSYM CreateSemaphore}
  2888. {$ELSE}
  2889. function CreateSemaphore(lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES;
  2890.   lInitialCount, lMaximumCount: LONG; lpName: LPCSTR): HANDLE; stdcall;
  2891. {$EXTERNALSYM CreateSemaphore}
  2892. {$ENDIF}
  2893. function OpenSemaphoreA(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2894.   lpName: LPCSTR): HANDLE; stdcall;
  2895. {$EXTERNALSYM OpenSemaphoreA}
  2896. function OpenSemaphoreW(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2897.   lpName: LPCWSTR): HANDLE; stdcall;
  2898. {$EXTERNALSYM OpenSemaphoreW}
  2899. {$IFDEF UNICODE}
  2900. function OpenSemaphore(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2901.   lpName: LPCWSTR): HANDLE; stdcall;
  2902. {$EXTERNALSYM OpenSemaphore}
  2903. {$ELSE}
  2904. function OpenSemaphore(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2905.   lpName: LPCSTR): HANDLE; stdcall;
  2906. {$EXTERNALSYM OpenSemaphore}
  2907. {$ENDIF}
  2908. type
  2909.   PTIMERAPCROUTINE = procedure (lpArgToCompletionRoutine: LPVOID;
  2910.     dwTimerLowValue, dwTimerHighValue: DWORD); stdcall;
  2911.   {$EXTERNALSYM PTIMERAPCROUTINE}
  2912.   TTimerApcRoutine = PTIMERAPCROUTINE;
  2913. function CreateWaitableTimerA(lpTimerAttributes: LPSECURITY_ATTRIBUTES;
  2914.   bManualReset: BOOL; lpTimerName: LPCSTR): HANDLE; stdcall;
  2915. {$EXTERNALSYM CreateWaitableTimerA}
  2916. function CreateWaitableTimerW(lpTimerAttributes: LPSECURITY_ATTRIBUTES;
  2917.   bManualReset: BOOL; lpTimerName: LPCWSTR): HANDLE; stdcall;
  2918. {$EXTERNALSYM CreateWaitableTimerW}
  2919. {$IFDEF UNICODE}
  2920. function CreateWaitableTimer(lpTimerAttributes: LPSECURITY_ATTRIBUTES;
  2921.   bManualReset: BOOL; lpTimerName: LPCWSTR): HANDLE; stdcall;
  2922. {$EXTERNALSYM CreateWaitableTimer}
  2923. {$ELSE}
  2924. function CreateWaitableTimer(lpTimerAttributes: LPSECURITY_ATTRIBUTES;
  2925.   bManualReset: BOOL; lpTimerName: LPCSTR): HANDLE; stdcall;
  2926. {$EXTERNALSYM CreateWaitableTimer}
  2927. {$ENDIF}
  2928. function OpenWaitableTimerA(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2929.   lpTimerName: LPCSTR): HANDLE; stdcall;
  2930. {$EXTERNALSYM OpenWaitableTimerA}
  2931. function OpenWaitableTimerW(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2932.   lpTimerName: LPCWSTR): HANDLE; stdcall;
  2933. {$EXTERNALSYM OpenWaitableTimerW}
  2934. {$IFDEF UNICODE}
  2935. function OpenWaitableTimer(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2936.   lpTimerName: LPCWSTR): HANDLE; stdcall;
  2937. {$EXTERNALSYM OpenWaitableTimer}
  2938. {$ELSE}
  2939. function OpenWaitableTimer(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2940.   lpTimerName: LPCSTR): HANDLE; stdcall;
  2941. {$EXTERNALSYM OpenWaitableTimer}
  2942. {$ENDIF}
  2943. function SetWaitableTimer(hTimer: HANDLE; var lpDueTime: LARGE_INTEGER;
  2944.   lPeriod: LONG; pfnCompletionRoutine: PTIMERAPCROUTINE;
  2945.   lpArgToCompletionRoutine: LPVOID; fResume: BOOL): BOOL; stdcall;
  2946. {$EXTERNALSYM SetWaitableTimer}
  2947. function CancelWaitableTimer(hTimer: HANDLE): BOOL; stdcall;
  2948. {$EXTERNALSYM CancelWaitableTimer}
  2949. function CreateFileMappingA(hFile: HANDLE; lpFileMappingAttributes: LPSECURITY_ATTRIBUTES;
  2950.   flProtect, dwMaximumSizeHigh, dwMaximumSizeLow: DWORD; lpName: LPCSTR): HANDLE; stdcall;
  2951. {$EXTERNALSYM CreateFileMappingA}
  2952. function CreateFileMappingW(hFile: HANDLE; lpFileMappingAttributes: LPSECURITY_ATTRIBUTES;
  2953.   flProtect, dwMaximumSizeHigh, dwMaximumSizeLow: DWORD; lpName: LPCWSTR): HANDLE; stdcall;
  2954. {$EXTERNALSYM CreateFileMappingW}
  2955. {$IFDEF UNICODE}
  2956. function CreateFileMapping(hFile: HANDLE; lpFileMappingAttributes: LPSECURITY_ATTRIBUTES;
  2957.   flProtect, dwMaximumSizeHigh, dwMaximumSizeLow: DWORD; lpName: LPCWSTR): HANDLE; stdcall;
  2958. {$EXTERNALSYM CreateFileMapping}
  2959. {$ELSE}
  2960. function CreateFileMapping(hFile: HANDLE; lpFileMappingAttributes: LPSECURITY_ATTRIBUTES;
  2961.   flProtect, dwMaximumSizeHigh, dwMaximumSizeLow: DWORD; lpName: LPCSTR): HANDLE; stdcall;
  2962. {$EXTERNALSYM CreateFileMapping}
  2963. {$ENDIF}
  2964. function OpenFileMappingA(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2965.   lpName: LPCSTR): HANDLE; stdcall;
  2966. {$EXTERNALSYM OpenFileMappingA}
  2967. function OpenFileMappingW(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2968.   lpName: LPCWSTR): HANDLE; stdcall;
  2969. {$EXTERNALSYM OpenFileMappingW}
  2970. {$IFDEF UNICODE}
  2971. function OpenFileMapping(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2972.   lpName: LPCWSTR): HANDLE; stdcall;
  2973. {$EXTERNALSYM OpenFileMapping}
  2974. {$ELSE}
  2975. function OpenFileMapping(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  2976.   lpName: LPCSTR): HANDLE; stdcall;
  2977. {$EXTERNALSYM OpenFileMapping}
  2978. {$ENDIF}
  2979. function GetLogicalDriveStringsA(nBufferLength: DWORD; lpBuffer: LPSTR): DWORD; stdcall;
  2980. {$EXTERNALSYM GetLogicalDriveStringsA}
  2981. function GetLogicalDriveStringsW(nBufferLength: DWORD; lpBuffer: LPWSTR): DWORD; stdcall;
  2982. {$EXTERNALSYM GetLogicalDriveStringsW}
  2983. {$IFDEF UNICODE}
  2984. function GetLogicalDriveStrings(nBufferLength: DWORD; lpBuffer: LPWSTR): DWORD; stdcall;
  2985. {$EXTERNALSYM GetLogicalDriveStrings}
  2986. {$ELSE}
  2987. function GetLogicalDriveStrings(nBufferLength: DWORD; lpBuffer: LPSTR): DWORD; stdcall;
  2988. {$EXTERNALSYM GetLogicalDriveStrings}
  2989. {$ENDIF}
  2990. type
  2991.   _MEMORY_RESOURCE_NOTIFICATION_TYPE = (
  2992.     LowMemoryResourceNotification,
  2993.     HighMemoryResourceNotification);
  2994.   {$EXTERNALSYM _MEMORY_RESOURCE_NOTIFICATION_TYPE}
  2995.   MEMORY_RESOURCE_NOTIFICATION_TYPE = _MEMORY_RESOURCE_NOTIFICATION_TYPE;
  2996.   {$EXTERNALSYM MEMORY_RESOURCE_NOTIFICATION_TYPE}
  2997.   TMemoryResourceNotification = MEMORY_RESOURCE_NOTIFICATION_TYPE;
  2998. function CreateMemoryResourceNotification(NotificationType: MEMORY_RESOURCE_NOTIFICATION_TYPE): HANDLE; stdcall;
  2999. {$EXTERNALSYM CreateMemoryResourceNotification}
  3000. function QueryMemoryResourceNotification(ResourceNotificationHandle: HANDLE;
  3001.   ResourceState: BOOL): BOOL; stdcall;
  3002. {$EXTERNALSYM QueryMemoryResourceNotification}
  3003. function LoadLibraryA(lpLibFileName: LPCSTR): HMODULE; stdcall;
  3004. {$EXTERNALSYM LoadLibraryA}
  3005. function LoadLibraryW(lpLibFileName: LPCWSTR): HMODULE; stdcall;
  3006. {$EXTERNALSYM LoadLibraryW}
  3007. {$IFDEF UNICODE}
  3008. function LoadLibrary(lpLibFileName: LPCWSTR): HMODULE; stdcall;
  3009. {$EXTERNALSYM LoadLibrary}
  3010. {$ELSE}
  3011. function LoadLibrary(lpLibFileName: LPCSTR): HMODULE; stdcall;
  3012. {$EXTERNALSYM LoadLibrary}
  3013. {$ENDIF}
  3014. function LoadLibraryExA(lpLibFileName: LPCSTR; hFile: HANDLE; dwFlags: DWORD): HMODULE; stdcall;
  3015. {$EXTERNALSYM LoadLibraryExA}
  3016. function LoadLibraryExW(lpLibFileName: LPCWSTR; hFile: HANDLE; dwFlags: DWORD): HMODULE; stdcall;
  3017. {$EXTERNALSYM LoadLibraryExW}
  3018. {$IFDEF UNICODE}
  3019. function LoadLibraryEx(lpLibFileName: LPCWSTR; hFile: HANDLE; dwFlags: DWORD): HMODULE; stdcall;
  3020. {$EXTERNALSYM LoadLibraryEx}
  3021. {$ELSE}
  3022. function LoadLibraryEx(lpLibFileName: LPCSTR; hFile: HANDLE; dwFlags: DWORD): HMODULE; stdcall;
  3023. {$EXTERNALSYM LoadLibraryEx}
  3024. {$ENDIF}
  3025. const
  3026.   DONT_RESOLVE_DLL_REFERENCES   = $00000001;
  3027.   {$EXTERNALSYM DONT_RESOLVE_DLL_REFERENCES}
  3028.   LOAD_LIBRARY_AS_DATAFILE      = $00000002;
  3029.   {$EXTERNALSYM LOAD_LIBRARY_AS_DATAFILE}
  3030.   LOAD_WITH_ALTERED_SEARCH_PATH = $00000008;
  3031.   {$EXTERNALSYM LOAD_WITH_ALTERED_SEARCH_PATH}
  3032.   LOAD_IGNORE_CODE_AUTHZ_LEVEL  = $00000010;
  3033.   {$EXTERNALSYM LOAD_IGNORE_CODE_AUTHZ_LEVEL}
  3034. function GetModuleFileNameA(hModule: HMODULE; lpFilename: LPSTR; nSize: DWORD): DWORD; stdcall;
  3035. {$EXTERNALSYM GetModuleFileNameA}
  3036. function GetModuleFileNameW(hModule: HMODULE; lpFilename: LPWSTR; nSize: DWORD): DWORD; stdcall;
  3037. {$EXTERNALSYM GetModuleFileNameW}
  3038. {$IFDEF UNICODE}
  3039. function GetModuleFileName(hModule: HMODULE; lpFilename: LPWSTR; nSize: DWORD): DWORD; stdcall;
  3040. {$EXTERNALSYM GetModuleFileName}
  3041. {$ELSE}
  3042. function GetModuleFileName(hModule: HMODULE; lpFilename: LPSTR; nSize: DWORD): DWORD; stdcall;
  3043. {$EXTERNALSYM GetModuleFileName}
  3044. {$ENDIF}
  3045. function GetModuleHandleA(lpModuleName: LPCSTR): HMODULE; stdcall;
  3046. {$EXTERNALSYM GetModuleHandleA}
  3047. function GetModuleHandleW(lpModuleName: LPCWSTR): HMODULE; stdcall;
  3048. {$EXTERNALSYM GetModuleHandleW}
  3049. {$IFDEF UNICODE}
  3050. function GetModuleHandle(lpModuleName: LPCWSTR): HMODULE; stdcall;
  3051. {$EXTERNALSYM GetModuleHandle}
  3052. {$ELSE}
  3053. function GetModuleHandle(lpModuleName: LPCSTR): HMODULE; stdcall;
  3054. {$EXTERNALSYM GetModuleHandle}
  3055. {$ENDIF}
  3056. const
  3057.   GET_MODULE_HANDLE_EX_FLAG_PIN                = ($00000001);
  3058.   {$EXTERNALSYM GET_MODULE_HANDLE_EX_FLAG_PIN}
  3059.   GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT = ($00000002);
  3060.   {$EXTERNALSYM GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT}
  3061.   GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS       = ($00000004);
  3062.   {$EXTERNALSYM GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS}
  3063. type
  3064.   PGET_MODULE_HANDLE_EXA = function (dwFlags: DWORD; lpModuleName: LPCSTR; var phModule: HMODULE): BOOL; stdcall;
  3065.   {$EXTERNALSYM PGET_MODULE_HANDLE_EXA}
  3066.   PGET_MODULE_HANDLE_EXW = function (dwFlags: DWORD; lpModuleName: LPCWSTR; var phModule: HMODULE): BOOL; stdcall;
  3067.   {$EXTERNALSYM PGET_MODULE_HANDLE_EXW}
  3068. {$IFDEF UNICODE}
  3069.   PGET_MODULE_HANDLE_EX = PGET_MODULE_HANDLE_EXW;
  3070.   {$EXTERNALSYM PGET_MODULE_HANDLE_EX}
  3071. {$ELSE}
  3072.   PGET_MODULE_HANDLE_EX = PGET_MODULE_HANDLE_EXA;
  3073.   {$EXTERNALSYM PGET_MODULE_HANDLE_EX}
  3074. {$ENDIF}
  3075. function GetModuleHandleExA(dwFlags: DWORD; lpModuleName: LPCSTR; var phModule: HMODULE): BOOL; stdcall;
  3076. {$EXTERNALSYM GetModuleHandleExA}
  3077. function GetModuleHandleExW(dwFlags: DWORD; lpModuleName: LPCWSTR; var phModule: HMODULE): BOOL; stdcall;
  3078. {$EXTERNALSYM GetModuleHandleExW}
  3079. {$IFDEF UNICODE}
  3080. function GetModuleHandleEx(dwFlags: DWORD; lpModuleName: LPCWSTR; var phModule: HMODULE): BOOL; stdcall;
  3081. {$EXTERNALSYM GetModuleHandleEx}
  3082. {$ELSE}
  3083. function GetModuleHandleEx(dwFlags: DWORD; lpModuleName: LPCSTR; var phModule: HMODULE): BOOL; stdcall;
  3084. {$EXTERNALSYM GetModuleHandleEx}
  3085. {$ENDIF}
  3086. function CreateProcessA(lpApplicationName: LPCSTR; lpCommandLine: LPSTR;
  3087.   lpProcessAttributes, lpThreadAttributes: LPSECURITY_ATTRIBUTES;
  3088.   bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment: LPVOID;
  3089.   lpCurrentDirectory: LPCSTR; const lpStartupInfo: STARTUPINFOA;
  3090.   var lpProcessInformation: PROCESS_INFORMATION): BOOL; stdcall;
  3091. {$EXTERNALSYM CreateProcessA}
  3092. function CreateProcessW(lpApplicationName: LPCWSTR; lpCommandLine: LPWSTR;
  3093.   lpProcessAttributes, lpThreadAttributes: LPSECURITY_ATTRIBUTES;
  3094.   bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment: LPVOID;
  3095.   lpCurrentDirectory: LPCWSTR; const lpStartupInfo: STARTUPINFOW;
  3096.   var lpProcessInformation: PROCESS_INFORMATION): BOOL; stdcall;
  3097. {$EXTERNALSYM CreateProcessW}
  3098. {$IFDEF UNICODE}
  3099. function CreateProcess(lpApplicationName: LPCWSTR; lpCommandLine: LPWSTR;
  3100.   lpProcessAttributes, lpThreadAttributes: LPSECURITY_ATTRIBUTES;
  3101.   bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment: LPVOID;
  3102.   lpCurrentDirectory: LPCWSTR; const lpStartupInfo: STARTUPINFOW;
  3103.   var lpProcessInformation: PROCESS_INFORMATION): BOOL; stdcall;
  3104. {$EXTERNALSYM CreateProcess}
  3105. {$ELSE}
  3106. function CreateProcess(lpApplicationName: LPCSTR; lpCommandLine: LPSTR;
  3107.   lpProcessAttributes, lpThreadAttributes: LPSECURITY_ATTRIBUTES;
  3108.   bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment: LPVOID;
  3109.   lpCurrentDirectory: LPCSTR; const lpStartupInfo: STARTUPINFOA;
  3110.   var lpProcessInformation: PROCESS_INFORMATION): BOOL; stdcall;
  3111. {$EXTERNALSYM CreateProcess}
  3112. {$ENDIF}
  3113. function SetProcessShutdownParameters(dwLevel, dwFlags: DWORD): BOOL; stdcall;
  3114. {$EXTERNALSYM SetProcessShutdownParameters}
  3115. function GetProcessShutdownParameters(var lpdwLevel, lpdwFlags: DWORD): BOOL; stdcall;
  3116. {$EXTERNALSYM GetProcessShutdownParameters}
  3117. function GetProcessVersion(ProcessId: DWORD): DWORD; stdcall;
  3118. {$EXTERNALSYM GetProcessVersion}
  3119. procedure FatalAppExitA(uAction: UINT; lpMessageText: LPCSTR); stdcall;
  3120. {$EXTERNALSYM FatalAppExitA}
  3121. procedure FatalAppExitW(uAction: UINT; lpMessageText: LPCWSTR); stdcall;
  3122. {$EXTERNALSYM FatalAppExitW}
  3123. {$IFDEF UNICODE}
  3124. procedure FatalAppExit(uAction: UINT; lpMessageText: LPCWSTR); stdcall;
  3125. {$EXTERNALSYM FatalAppExit}
  3126. {$ELSE}
  3127. procedure FatalAppExit(uAction: UINT; lpMessageText: LPCSTR); stdcall;
  3128. {$EXTERNALSYM FatalAppExit}
  3129. {$ENDIF}
  3130. procedure GetStartupInfoA(var lpStartupInfo: STARTUPINFOA); stdcall;
  3131. {$EXTERNALSYM GetStartupInfoA}
  3132. procedure GetStartupInfoW(var lpStartupInfo: STARTUPINFOW); stdcall;
  3133. {$EXTERNALSYM GetStartupInfoW}
  3134. {$IFDEF UNICODE}
  3135. procedure GetStartupInfo(var lpStartupInfo: STARTUPINFOW); stdcall;
  3136. {$EXTERNALSYM GetStartupInfo}
  3137. {$ELSE}
  3138. procedure GetStartupInfo(var lpStartupInfo: STARTUPINFOA); stdcall;
  3139. {$EXTERNALSYM GetStartupInfo}
  3140. {$ENDIF}
  3141. function GetCommandLineA: LPSTR; stdcall;
  3142. {$EXTERNALSYM GetCommandLineA}
  3143. function GetCommandLineW: LPWSTR; stdcall;
  3144. {$EXTERNALSYM GetCommandLineW}
  3145. {$IFDEF UNICODE}
  3146. function GetCommandLine: LPWSTR; stdcall;
  3147. {$EXTERNALSYM GetCommandLine}
  3148. {$ELSE}
  3149. function GetCommandLine: LPSTR; stdcall;
  3150. {$EXTERNALSYM GetCommandLine}
  3151. {$ENDIF}
  3152. function GetEnvironmentVariableA(lpName: LPCSTR; lpBuffer: LPSTR; nSize: DWORD): DWORD; stdcall;
  3153. {$EXTERNALSYM GetEnvironmentVariableA}
  3154. function GetEnvironmentVariableW(lpName: LPCWSTR; lpBuffer: LPWSTR; nSize: DWORD): DWORD; stdcall;
  3155. {$EXTERNALSYM GetEnvironmentVariableW}
  3156. {$IFDEF UNICODE}
  3157. function GetEnvironmentVariable(lpName: LPCWSTR; lpBuffer: LPWSTR; nSize: DWORD): DWORD; stdcall;
  3158. {$EXTERNALSYM GetEnvironmentVariable}
  3159. {$ELSE}
  3160. function GetEnvironmentVariable(lpName: LPCSTR; lpBuffer: LPSTR; nSize: DWORD): DWORD; stdcall;
  3161. {$EXTERNALSYM GetEnvironmentVariable}
  3162. {$ENDIF}
  3163. function SetEnvironmentVariableA(lpName, lpValue: LPCSTR): BOOL; stdcall;
  3164. {$EXTERNALSYM SetEnvironmentVariableA}
  3165. function SetEnvironmentVariableW(lpName, lpValue: LPCWSTR): BOOL; stdcall;
  3166. {$EXTERNALSYM SetEnvironmentVariableW}
  3167. {$IFDEF UNICODE}
  3168. function SetEnvironmentVariable(lpName, lpValue: LPCWSTR): BOOL; stdcall;
  3169. {$EXTERNALSYM SetEnvironmentVariable}
  3170. {$ELSE}
  3171. function SetEnvironmentVariable(lpName, lpValue: LPCSTR): BOOL; stdcall;
  3172. {$EXTERNALSYM SetEnvironmentVariable}
  3173. {$ENDIF}
  3174. function ExpandEnvironmentStringsA(lpSrc: LPCSTR; lpDst: LPSTR; nSize: DWORD): DWORD; stdcall;
  3175. {$EXTERNALSYM ExpandEnvironmentStringsA}
  3176. function ExpandEnvironmentStringsW(lpSrc: LPCWSTR; lpDst: LPWSTR; nSize: DWORD): DWORD; stdcall;
  3177. {$EXTERNALSYM ExpandEnvironmentStringsW}
  3178. {$IFDEF UNICODE}
  3179. function ExpandEnvironmentStrings(lpSrc: LPCWSTR; lpDst: LPWSTR; nSize: DWORD): DWORD; stdcall;
  3180. {$EXTERNALSYM ExpandEnvironmentStrings}
  3181. {$ELSE}
  3182. function ExpandEnvironmentStrings(lpSrc: LPCSTR; lpDst: LPSTR; nSize: DWORD): DWORD; stdcall;
  3183. {$EXTERNALSYM ExpandEnvironmentStrings}
  3184. {$ENDIF}
  3185. function GetFirmwareEnvironmentVariableA(lpName, lpGuid: LPCSTR; pBuffer: PVOID;
  3186.   nSize: DWORD): DWORD; stdcall;
  3187. {$EXTERNALSYM GetFirmwareEnvironmentVariableA}
  3188. function GetFirmwareEnvironmentVariableW(lpName, lpGuid: LPCWSTR; pBuffer: PVOID;
  3189.   nSize: DWORD): DWORD; stdcall;
  3190. {$EXTERNALSYM GetFirmwareEnvironmentVariableW}
  3191. {$IFDEF UNICODE}
  3192. function GetFirmwareEnvironmentVariable(lpName, lpGuid: LPCWSTR; pBuffer: PVOID;
  3193.   nSize: DWORD): DWORD; stdcall;
  3194. {$EXTERNALSYM GetFirmwareEnvironmentVariable}
  3195. {$ELSE}
  3196. function GetFirmwareEnvironmentVariable(lpName, lpGuid: LPCSTR; pBuffer: PVOID;
  3197.   nSize: DWORD): DWORD; stdcall;
  3198. {$EXTERNALSYM GetFirmwareEnvironmentVariable}
  3199. {$ENDIF}
  3200. function SetFirmwareEnvironmentVariableA(lpName, lpGuid: LPCSTR; pValue: PVOID;
  3201.   nSize: DWORD): BOOL; stdcall;
  3202. {$EXTERNALSYM SetFirmwareEnvironmentVariableA}
  3203. function SetFirmwareEnvironmentVariableW(lpName, lpGuid: LPCWSTR; pValue: PVOID;
  3204.   nSize: DWORD): BOOL; stdcall;
  3205. {$EXTERNALSYM SetFirmwareEnvironmentVariableW}
  3206. {$IFDEF UNICODE}
  3207. function SetFirmwareEnvironmentVariable(lpName, lpGuid: LPCWSTR; pValue: PVOID;
  3208.   nSize: DWORD): BOOL; stdcall;
  3209. {$EXTERNALSYM SetFirmwareEnvironmentVariable}
  3210. {$ELSE}
  3211. function SetFirmwareEnvironmentVariable(lpName, lpGuid: LPCSTR; pValue: PVOID;
  3212.   nSize: DWORD): BOOL; stdcall;
  3213. {$EXTERNALSYM SetFirmwareEnvironmentVariable}
  3214. {$ENDIF}
  3215. procedure OutputDebugStringA(lpOutputString: LPCSTR); stdcall;
  3216. {$EXTERNALSYM OutputDebugStringA}
  3217. procedure OutputDebugStringW(lpOutputString: LPCWSTR); stdcall;
  3218. {$EXTERNALSYM OutputDebugStringW}
  3219. {$IFDEF UNICODE}
  3220. procedure OutputDebugString(lpOutputString: LPCWSTR); stdcall;
  3221. {$EXTERNALSYM OutputDebugString}
  3222. {$ELSE}
  3223. procedure OutputDebugString(lpOutputString: LPCSTR); stdcall;
  3224. {$EXTERNALSYM OutputDebugString}
  3225. {$ENDIF}
  3226. function FindResourceA(hModule: HMODULE; lpName, lpType: LPCSTR): HRSRC; stdcall;
  3227. {$EXTERNALSYM FindResourceA}
  3228. function FindResourceW(hModule: HMODULE; lpName, lpType: LPCWSTR): HRSRC; stdcall;
  3229. {$EXTERNALSYM FindResourceW}
  3230. {$IFDEF UNICODE}
  3231. function FindResource(hModule: HMODULE; lpName, lpType: LPCWSTR): HRSRC; stdcall;
  3232. {$EXTERNALSYM FindResource}
  3233. {$ELSE}
  3234. function FindResource(hModule: HMODULE; lpName, lpType: LPCSTR): HRSRC; stdcall;
  3235. {$EXTERNALSYM FindResource}
  3236. {$ENDIF}
  3237. function FindResourceExA(hModule: HMODULE; lpType, lpName: LPCSTR; wLanguage: WORD): HRSRC; stdcall;
  3238. {$EXTERNALSYM FindResourceExA}
  3239. function FindResourceExW(hModule: HMODULE; lpType, lpName: LPCWSTR; wLanguage: WORD): HRSRC; stdcall;
  3240. {$EXTERNALSYM FindResourceExW}
  3241. {$IFDEF UNICODE}
  3242. function FindResourceEx(hModule: HMODULE; lpType, lpName: LPCWSTR; wLanguage: WORD): HRSRC; stdcall;
  3243. {$EXTERNALSYM FindResourceEx}
  3244. {$ELSE}
  3245. function FindResourceEx(hModule: HMODULE; lpType, lpName: LPCSTR; wLanguage: WORD): HRSRC; stdcall;
  3246. {$EXTERNALSYM FindResourceEx}
  3247. {$ENDIF}
  3248. type
  3249.   ENUMRESTYPEPROCA = function (hModule: HMODULE; lpType: LPSTR; lParam: LONG_PTR): BOOL; stdcall;
  3250.   {$EXTERNALSYM ENUMRESTYPEPROCA}
  3251.   ENUMRESTYPEPROCW = function (hModule: HMODULE; lpType: LPWSTR; lParam: LONG_PTR): BOOL; stdcall;
  3252.   {$EXTERNALSYM ENUMRESTYPEPROCW}
  3253.   TEnumResTypeProcA = ENUMRESTYPEPROCA;
  3254.   TEnumResTypeProcW = ENUMRESTYPEPROCW;
  3255. {$IFDEF UNICODE}
  3256.   ENUMRESTYPEPROC = function (hModule: HMODULE; lpType: LPWSTR; lParam: LONG_PTR): BOOL; stdcall;
  3257.   {$EXTERNALSYM ENUMRESTYPEPROC}
  3258.   TEnumResTypeProc = ENUMRESTYPEPROCW;
  3259. {$ELSE}
  3260.   ENUMRESTYPEPROC = function (hModule: HMODULE; lpType: LPSTR; lParam: LONG_PTR): BOOL; stdcall;
  3261.   {$EXTERNALSYM ENUMRESTYPEPROC}
  3262.   TEnumResTypeProc = ENUMRESTYPEPROCA;
  3263. {$ENDIF}
  3264.   ENUMRESNAMEPROCA = function (hModule: HMODULE; lpType: LPCSTR; lpName: LPSTR;
  3265.     lParam: LONG_PTR): BOOL; stdcall;
  3266.   {$EXTERNALSYM ENUMRESNAMEPROCA}
  3267.   ENUMRESNAMEPROCW = function (hModule: HMODULE; lpType: LPCWSTR; lpName: LPWSTR;
  3268.     lParam: LONG_PTR): BOOL; stdcall;
  3269.   {$EXTERNALSYM ENUMRESNAMEPROCW}
  3270.   TEnumResNameProcA = ENUMRESNAMEPROCA;
  3271.   TEnumResNameProcW = ENUMRESNAMEPROCW;
  3272. {$IFDEF UNICODE}
  3273.   ENUMRESNAMEPROC = function (hModule: HMODULE; lpType: LPCWSTR; lpName: LPWSTR;
  3274.     lParam: LONG_PTR): BOOL; stdcall;
  3275.   {$EXTERNALSYM ENUMRESNAMEPROC}
  3276.   TEnumResNameProc = ENUMRESNAMEPROCW;
  3277. {$ELSE}
  3278.   ENUMRESNAMEPROC = function (hModule: HMODULE; lpType: LPCSTR; lpName: LPSTR;
  3279.     lParam: LONG_PTR): BOOL; stdcall;
  3280.   {$EXTERNALSYM ENUMRESNAMEPROC}
  3281.   TEnumResNameProc = ENUMRESNAMEPROCA;
  3282. {$ENDIF}
  3283.   ENUMRESLANGPROCA = function (hModule: HMODULE; lpType, lpName: LPCSTR;
  3284.     wLanguage: WORD; lParam: LONG_PTR): BOOL; stdcall;
  3285.   {$EXTERNALSYM ENUMRESLANGPROCA}
  3286.   ENUMRESLANGPROCW = function (hModule: HMODULE; lpType, lpName: LPCWSTR;
  3287.     wLanguage: WORD; lParam: LONG_PTR): BOOL; stdcall;
  3288.   {$EXTERNALSYM ENUMRESLANGPROCW}
  3289.   TEnumResLangProcA = ENUMRESLANGPROCA;
  3290.   TEnumResLangProcW = ENUMRESLANGPROCW;
  3291. {$IFDEF UNICODE}
  3292.   ENUMRESLANGPROC = function (hModule: HMODULE; lpType, lpName: LPCWSTR;
  3293.     wLanguage: WORD; lParam: LONG_PTR): BOOL; stdcall;
  3294.   {$EXTERNALSYM ENUMRESLANGPROC}
  3295.   TEnumResLangProc = ENUMRESLANGPROCW;
  3296. {$ELSE}
  3297.   ENUMRESLANGPROC = function (hModule: HMODULE; lpType, lpName: LPCSTR;
  3298.     wLanguage: WORD; lParam: LONG_PTR): BOOL; stdcall;
  3299.   {$EXTERNALSYM ENUMRESLANGPROC}
  3300.   TEnumResLangProc = ENUMRESLANGPROCA;
  3301. {$ENDIF}
  3302. function EnumResourceTypesA(hModule: HMODULE; lpEnumFunc: ENUMRESTYPEPROCA;
  3303.   lParam: LONG_PTR): BOOL; stdcall;
  3304. {$EXTERNALSYM EnumResourceTypesA}
  3305. function EnumResourceTypesW(hModule: HMODULE; lpEnumFunc: ENUMRESTYPEPROCW;
  3306.   lParam: LONG_PTR): BOOL; stdcall;
  3307. {$EXTERNALSYM EnumResourceTypesW}
  3308. {$IFDEF UNICODE}
  3309. function EnumResourceTypes(hModule: HMODULE; lpEnumFunc: ENUMRESTYPEPROCW;
  3310.   lParam: LONG_PTR): BOOL; stdcall;
  3311. {$EXTERNALSYM EnumResourceTypes}
  3312. {$ELSE}
  3313. function EnumResourceTypes(hModule: HMODULE; lpEnumFunc: ENUMRESTYPEPROCA;
  3314.   lParam: LONG_PTR): BOOL; stdcall;
  3315. {$EXTERNALSYM EnumResourceTypes}
  3316. {$ENDIF}
  3317. function EnumResourceNamesA(hModule: HMODULE; lpType: LPCSTR;
  3318.   lpEnumFunc: ENUMRESNAMEPROCA; lParam: LONG_PTR): BOOL; stdcall;
  3319. {$EXTERNALSYM EnumResourceNamesA}
  3320. function EnumResourceNamesW(hModule: HMODULE; lpType: LPCWSTR;
  3321.   lpEnumFunc: ENUMRESNAMEPROCW; lParam: LONG_PTR): BOOL; stdcall;
  3322. {$EXTERNALSYM EnumResourceNamesW}
  3323. {$IFDEF UNICODE}
  3324. function EnumResourceNames(hModule: HMODULE; lpType: LPCWSTR;
  3325.   lpEnumFunc: ENUMRESNAMEPROCW; lParam: LONG_PTR): BOOL; stdcall;
  3326. {$EXTERNALSYM EnumResourceNames}
  3327. {$ELSE}
  3328. function EnumResourceNames(hModule: HMODULE; lpType: LPCSTR;
  3329.   lpEnumFunc: ENUMRESNAMEPROCA; lParam: LONG_PTR): BOOL; stdcall;
  3330. {$EXTERNALSYM EnumResourceNames}
  3331. {$ENDIF}
  3332. function EnumResourceLanguagesA(hModule: HMODULE; lpType, lpName: LPCSTR;
  3333.   lpEnumFunc: ENUMRESLANGPROCA; lParam: LONG_PTR): BOOL; stdcall;
  3334. {$EXTERNALSYM EnumResourceLanguagesA}
  3335. function EnumResourceLanguagesW(hModule: HMODULE; lpType, lpName: LPCWSTR;
  3336.   lpEnumFunc: ENUMRESLANGPROCW; lParam: LONG_PTR): BOOL; stdcall;
  3337. {$EXTERNALSYM EnumResourceLanguagesW}
  3338. {$IFDEF UNICODE}
  3339. function EnumResourceLanguages(hModule: HMODULE; lpType, lpName: LPCWSTR;
  3340.   lpEnumFunc: ENUMRESLANGPROCW; lParam: LONG_PTR): BOOL; stdcall;
  3341. {$EXTERNALSYM EnumResourceLanguages}
  3342. {$ELSE}
  3343. function EnumResourceLanguages(hModule: HMODULE; lpType, lpName: LPCSTR;
  3344.   lpEnumFunc: ENUMRESLANGPROCA; lParam: LONG_PTR): BOOL; stdcall;
  3345. {$EXTERNALSYM EnumResourceLanguages}
  3346. {$ENDIF}
  3347. function BeginUpdateResourceA(pFileName: LPCSTR; bDeleteExistingResources: BOOL): HANDLE; stdcall;
  3348. {$EXTERNALSYM BeginUpdateResourceA}
  3349. function BeginUpdateResourceW(pFileName: LPCWSTR; bDeleteExistingResources: BOOL): HANDLE; stdcall;
  3350. {$EXTERNALSYM BeginUpdateResourceW}
  3351. {$IFDEF UNICODE}
  3352. function BeginUpdateResource(pFileName: LPCWSTR; bDeleteExistingResources: BOOL): HANDLE; stdcall;
  3353. {$EXTERNALSYM BeginUpdateResource}
  3354. {$ELSE}
  3355. function BeginUpdateResource(pFileName: LPCSTR; bDeleteExistingResources: BOOL): HANDLE; stdcall;
  3356. {$EXTERNALSYM BeginUpdateResource}
  3357. {$ENDIF}
  3358. function UpdateResourceA(hUpdate: HANDLE; lpType, lpName: LPCSTR;
  3359.   wLanguage: WORD; lpData: LPVOID; cbData: DWORD): BOOL; stdcall;
  3360. {$EXTERNALSYM UpdateResourceA}
  3361. function UpdateResourceW(hUpdate: HANDLE; lpType, lpName: LPCWSTR;
  3362.   wLanguage: WORD; lpData: LPVOID; cbData: DWORD): BOOL; stdcall;
  3363. {$EXTERNALSYM UpdateResourceW}
  3364. {$IFDEF UNICODE}
  3365. function UpdateResource(hUpdate: HANDLE; lpType, lpName: LPCWSTR;
  3366.   wLanguage: WORD; lpData: LPVOID; cbData: DWORD): BOOL; stdcall;
  3367. {$EXTERNALSYM UpdateResource}
  3368. {$ELSE}
  3369. function UpdateResource(hUpdate: HANDLE; lpType, lpName: LPCSTR;
  3370.   wLanguage: WORD; lpData: LPVOID; cbData: DWORD): BOOL; stdcall;
  3371. {$EXTERNALSYM UpdateResource}
  3372. {$ENDIF}
  3373. function EndUpdateResourceA(hUpdate: HANDLE; fDiscard: BOOL): BOOL; stdcall;
  3374. {$EXTERNALSYM EndUpdateResourceA}
  3375. function EndUpdateResourceW(hUpdate: HANDLE; fDiscard: BOOL): BOOL; stdcall;
  3376. {$EXTERNALSYM EndUpdateResourceW}
  3377. {$IFDEF UNICODE}
  3378. function EndUpdateResource(hUpdate: HANDLE; fDiscard: BOOL): BOOL; stdcall;
  3379. {$EXTERNALSYM EndUpdateResource}
  3380. {$ELSE}
  3381. function EndUpdateResource(hUpdate: HANDLE; fDiscard: BOOL): BOOL; stdcall;
  3382. {$EXTERNALSYM EndUpdateResource}
  3383. {$ENDIF}
  3384. function GlobalAddAtomA(lpString: LPCSTR): ATOM; stdcall;
  3385. {$EXTERNALSYM GlobalAddAtomA}
  3386. function GlobalAddAtomW(lpString: LPCWSTR): ATOM; stdcall;
  3387. {$EXTERNALSYM GlobalAddAtomW}
  3388. {$IFDEF UNICODE}
  3389. function GlobalAddAtom(lpString: LPCWSTR): ATOM; stdcall;
  3390. {$EXTERNALSYM GlobalAddAtom}
  3391. {$ELSE}
  3392. function GlobalAddAtom(lpString: LPCSTR): ATOM; stdcall;
  3393. {$EXTERNALSYM GlobalAddAtom}
  3394. {$ENDIF}
  3395. function GlobalFindAtomA(lpString: LPCSTR): ATOM; stdcall;
  3396. {$EXTERNALSYM GlobalFindAtomA}
  3397. function GlobalFindAtomW(lpString: LPCWSTR): ATOM; stdcall;
  3398. {$EXTERNALSYM GlobalFindAtomW}
  3399. {$IFDEF UNICODE}
  3400. function GlobalFindAtom(lpString: LPCWSTR): ATOM; stdcall;
  3401. {$EXTERNALSYM GlobalFindAtom}
  3402. {$ELSE}
  3403. function GlobalFindAtom(lpString: LPCSTR): ATOM; stdcall;
  3404. {$EXTERNALSYM GlobalFindAtom}
  3405. {$ENDIF}
  3406. function GlobalGetAtomNameA(nAtom: ATOM; lpBuffer: LPSTR; nSize: Integer): UINT; stdcall;
  3407. {$EXTERNALSYM GlobalGetAtomNameA}
  3408. function GlobalGetAtomNameW(nAtom: ATOM; lpBuffer: LPWSTR; nSize: Integer): UINT; stdcall;
  3409. {$EXTERNALSYM GlobalGetAtomNameW}
  3410. {$IFDEF UNICODE}
  3411. function GlobalGetAtomName(nAtom: ATOM; lpBuffer: LPWSTR; nSize: Integer): UINT; stdcall;
  3412. {$EXTERNALSYM GlobalGetAtomName}
  3413. {$ELSE}
  3414. function GlobalGetAtomName(nAtom: ATOM; lpBuffer: LPSTR; nSize: Integer): UINT; stdcall;
  3415. {$EXTERNALSYM GlobalGetAtomName}
  3416. {$ENDIF}
  3417. function AddAtomA(lpString: LPCSTR): ATOM; stdcall;
  3418. {$EXTERNALSYM AddAtomA}
  3419. function AddAtomW(lpString: LPCWSTR): ATOM; stdcall;
  3420. {$EXTERNALSYM AddAtomW}
  3421. {$IFDEF UNICODE}
  3422. function AddAtom(lpString: LPCWSTR): ATOM; stdcall;
  3423. {$EXTERNALSYM AddAtom}
  3424. {$ELSE}
  3425. function AddAtom(lpString: LPCSTR): ATOM; stdcall;
  3426. {$EXTERNALSYM AddAtom}
  3427. {$ENDIF}
  3428. function FindAtomA(lpString: LPCSTR): ATOM; stdcall;
  3429. {$EXTERNALSYM FindAtomA}
  3430. function FindAtomW(lpString: LPCWSTR): ATOM; stdcall;
  3431. {$EXTERNALSYM FindAtomW}
  3432. {$IFDEF UNICODE}
  3433. function FindAtom(lpString: LPCWSTR): ATOM; stdcall;
  3434. {$EXTERNALSYM FindAtom}
  3435. {$ELSE}
  3436. function FindAtom(lpString: LPCSTR): ATOM; stdcall;
  3437. {$EXTERNALSYM FindAtom}
  3438. {$ENDIF}
  3439. function GetAtomNameA(nAtom: ATOM; lpBuffer: LPSTR; nSize: Integer): UINT; stdcall;
  3440. {$EXTERNALSYM GetAtomNameA}
  3441. function GetAtomNameW(nAtom: ATOM; lpBuffer: LPWSTR; nSize: Integer): UINT; stdcall;
  3442. {$EXTERNALSYM GetAtomNameW}
  3443. {$IFDEF UNICODE}
  3444. function GetAtomName(nAtom: ATOM; lpBuffer: LPWSTR; nSize: Integer): UINT; stdcall;
  3445. {$EXTERNALSYM GetAtomName}
  3446. {$ELSE}
  3447. function GetAtomName(nAtom: ATOM; lpBuffer: LPSTR; nSize: Integer): UINT; stdcall;
  3448. {$EXTERNALSYM GetAtomName}
  3449. {$ENDIF}
  3450. function GetProfileIntA(lpAppName, lpKeyName: LPCSTR; nDefault: Integer): UINT; stdcall;
  3451. {$EXTERNALSYM GetProfileIntA}
  3452. function GetProfileIntW(lpAppName, lpKeyName: LPCWSTR; nDefault: Integer): UINT; stdcall;
  3453. {$EXTERNALSYM GetProfileIntW}
  3454. {$IFDEF UNICODE}
  3455. function GetProfileInt(lpAppName, lpKeyName: LPCWSTR; nDefault: Integer): UINT; stdcall;
  3456. {$EXTERNALSYM GetProfileInt}
  3457. {$ELSE}
  3458. function GetProfileInt(lpAppName, lpKeyName: LPCSTR; nDefault: Integer): UINT; stdcall;
  3459. {$EXTERNALSYM GetProfileInt}
  3460. {$ENDIF}
  3461. function GetProfileStringA(lpAppName, lpKeyName, lpDefault: LPCSTR;
  3462.   lpReturnedString: LPSTR; nSize: DWORD): DWORD; stdcall;
  3463. {$EXTERNALSYM GetProfileStringA}
  3464. function GetProfileStringW(lpAppName, lpKeyName, lpDefault: LPCWSTR;
  3465.   lpReturnedString: LPWSTR; nSize: DWORD): DWORD; stdcall;
  3466. {$EXTERNALSYM GetProfileStringW}
  3467. {$IFDEF UNICODE}
  3468. function GetProfileString(lpAppName, lpKeyName, lpDefault: LPCWSTR;
  3469.   lpReturnedString: LPWSTR; nSize: DWORD): DWORD; stdcall;
  3470. {$EXTERNALSYM GetProfileString}
  3471. {$ELSE}
  3472. function GetProfileString(lpAppName, lpKeyName, lpDefault: LPCSTR;
  3473.   lpReturnedString: LPSTR; nSize: DWORD): DWORD; stdcall;
  3474. {$EXTERNALSYM GetProfileString}
  3475. {$ENDIF}
  3476. function WriteProfileStringA(lpAppName, lpKeyName, lpString: LPCSTR): BOOL; stdcall;
  3477. {$EXTERNALSYM WriteProfileStringA}
  3478. function WriteProfileStringW(lpAppName, lpKeyName, lpString: LPCWSTR): BOOL; stdcall;
  3479. {$EXTERNALSYM WriteProfileStringW}
  3480. {$IFDEF UNICODE}
  3481. function WriteProfileString(lpAppName, lpKeyName, lpString: LPCWSTR): BOOL; stdcall;
  3482. {$EXTERNALSYM WriteProfileString}
  3483. {$ELSE}
  3484. function WriteProfileString(lpAppName, lpKeyName, lpString: LPCSTR): BOOL; stdcall;
  3485. {$EXTERNALSYM WriteProfileString}
  3486. {$ENDIF}
  3487. function GetProfileSectionA(lpAppName: LPCSTR; lpReturnedString: LPSTR;
  3488.   nSize: DWORD): DWORD; stdcall;
  3489. {$EXTERNALSYM GetProfileSectionA}
  3490. function GetProfileSectionW(lpAppName: LPCWSTR; lpReturnedString: LPWSTR;
  3491.   nSize: DWORD): DWORD; stdcall;
  3492. {$EXTERNALSYM GetProfileSectionW}
  3493. {$IFDEF UNICODE}
  3494. function GetProfileSection(lpAppName: LPCWSTR; lpReturnedString: LPWSTR;
  3495.   nSize: DWORD): DWORD; stdcall;
  3496. {$EXTERNALSYM GetProfileSection}
  3497. {$ELSE}
  3498. function GetProfileSection(lpAppName: LPCSTR; lpReturnedString: LPSTR;
  3499.   nSize: DWORD): DWORD; stdcall;
  3500. {$EXTERNALSYM GetProfileSection}
  3501. {$ENDIF}
  3502. function WriteProfileSectionA(lpAppName, lpString: LPCSTR): BOOL; stdcall;
  3503. {$EXTERNALSYM WriteProfileSectionA}
  3504. function WriteProfileSectionW(lpAppName, lpString: LPCWSTR): BOOL; stdcall;
  3505. {$EXTERNALSYM WriteProfileSectionW}
  3506. {$IFDEF UNICODE}
  3507. function WriteProfileSection(lpAppName, lpString: LPCWSTR): BOOL; stdcall;
  3508. {$EXTERNALSYM WriteProfileSection}
  3509. {$ELSE}
  3510. function WriteProfileSection(lpAppName, lpString: LPCSTR): BOOL; stdcall;
  3511. {$EXTERNALSYM WriteProfileSection}
  3512. {$ENDIF}
  3513. function GetPrivateProfileIntA(lpAppName, lpKeyName: LPCSTR; nDefault: Integer;
  3514.   lpFileName: LPCSTR): UINT; stdcall;
  3515. {$EXTERNALSYM GetPrivateProfileIntA}
  3516. function GetPrivateProfileIntW(lpAppName, lpKeyName: LPCWSTR; nDefault: Integer;
  3517.   lpFileName: LPCWSTR): UINT; stdcall;
  3518. {$EXTERNALSYM GetPrivateProfileIntW}
  3519. {$IFDEF UNICODE}
  3520. function GetPrivateProfileInt(lpAppName, lpKeyName: LPCWSTR; nDefault: Integer;
  3521.   lpFileName: LPCWSTR): UINT; stdcall;
  3522. {$EXTERNALSYM GetPrivateProfileInt}
  3523. {$ELSE}
  3524. function GetPrivateProfileInt(lpAppName, lpKeyName: LPCSTR; nDefault: Integer;
  3525.   lpFileName: LPCSTR): UINT; stdcall;
  3526. {$EXTERNALSYM GetPrivateProfileInt}
  3527. {$ENDIF}
  3528. function GetPrivateProfileStringA(lpAppName, lpKeyName, lpDefault: LPCSTR;
  3529.   lpReturnedString: LPSTR; nSize: DWORD; lpFileName: LPCSTR): DWORD; stdcall;
  3530. {$EXTERNALSYM GetPrivateProfileStringA}
  3531. function GetPrivateProfileStringW(lpAppName, lpKeyName, lpDefault: LPCWSTR;
  3532.   lpReturnedString: LPWSTR; nSize: DWORD; lpFileName: LPCWSTR): DWORD; stdcall;
  3533. {$EXTERNALSYM GetPrivateProfileStringW}
  3534. {$IFDEF UNICODE}
  3535. function GetPrivateProfileString(lpAppName, lpKeyName, lpDefault: LPCWSTR;
  3536.   lpReturnedString: LPWSTR; nSize: DWORD; lpFileName: LPCWSTR): DWORD; stdcall;
  3537. {$EXTERNALSYM GetPrivateProfileString}
  3538. {$ELSE}
  3539. function GetPrivateProfileString(lpAppName, lpKeyName, lpDefault: LPCSTR;
  3540.   lpReturnedString: LPSTR; nSize: DWORD; lpFileName: LPCSTR): DWORD; stdcall;
  3541. {$EXTERNALSYM GetPrivateProfileString}
  3542. {$ENDIF}
  3543. function WritePrivateProfileStringA(lpAppName, lpKeyName, lpString,
  3544.   lpFileName: LPCSTR): BOOL; stdcall;
  3545. {$EXTERNALSYM WritePrivateProfileStringA}
  3546. function WritePrivateProfileStringW(lpAppName, lpKeyName, lpString,
  3547.   lpFileName: LPCWSTR): BOOL; stdcall;
  3548. {$EXTERNALSYM WritePrivateProfileStringW}
  3549. {$IFDEF UNICODE}
  3550. function WritePrivateProfileString(lpAppName, lpKeyName, lpString,
  3551.   lpFileName: LPCWSTR): BOOL; stdcall;
  3552. {$EXTERNALSYM WritePrivateProfileString}
  3553. {$ELSE}
  3554. function WritePrivateProfileString(lpAppName, lpKeyName, lpString,
  3555.   lpFileName: LPCSTR): BOOL; stdcall;
  3556. {$EXTERNALSYM WritePrivateProfileString}
  3557. {$ENDIF}
  3558. function GetPrivateProfileSectionA(lpAppName: LPCSTR; lpReturnedString: LPSTR;
  3559.   nSize: DWORD; lpFileName: LPCSTR): DWORD; stdcall;
  3560. {$EXTERNALSYM GetPrivateProfileSectionA}
  3561. function GetPrivateProfileSectionW(lpAppName: LPCWSTR; lpReturnedString: LPWSTR;
  3562.   nSize: DWORD; lpFileName: LPCWSTR): DWORD; stdcall;
  3563. {$EXTERNALSYM GetPrivateProfileSectionW}
  3564. {$IFDEF UNICODE}
  3565. function GetPrivateProfileSection(lpAppName: LPCWSTR; lpReturnedString: LPWSTR;
  3566.   nSize: DWORD; lpFileName: LPCWSTR): DWORD; stdcall;
  3567. {$EXTERNALSYM GetPrivateProfileSection}
  3568. {$ELSE}
  3569. function GetPrivateProfileSection(lpAppName: LPCSTR; lpReturnedString: LPSTR;
  3570.   nSize: DWORD; lpFileName: LPCSTR): DWORD; stdcall;
  3571. {$EXTERNALSYM GetPrivateProfileSection}
  3572. {$ENDIF}
  3573. function WritePrivateProfileSectionA(lpAppName, lpString, lpFileName: LPCSTR): BOOL; stdcall;
  3574. {$EXTERNALSYM WritePrivateProfileSectionA}
  3575. function WritePrivateProfileSectionW(lpAppName, lpString, lpFileName: LPCWSTR): BOOL; stdcall;
  3576. {$EXTERNALSYM WritePrivateProfileSectionW}
  3577. {$IFDEF UNICODE}
  3578. function WritePrivateProfileSection(lpAppName, lpString, lpFileName: LPCWSTR): BOOL; stdcall;
  3579. {$EXTERNALSYM WritePrivateProfileSection}
  3580. {$ELSE}
  3581. function WritePrivateProfileSection(lpAppName, lpString, lpFileName: LPCSTR): BOOL; stdcall;
  3582. {$EXTERNALSYM WritePrivateProfileSection}
  3583. {$ENDIF}
  3584. function GetPrivateProfileSectionNamesA(lpszReturnBuffer: LPSTR; nSize: DWORD;
  3585.   lpFileName: LPCSTR): DWORD; stdcall;
  3586. {$EXTERNALSYM GetPrivateProfileSectionNamesA}
  3587. function GetPrivateProfileSectionNamesW(lpszReturnBuffer: LPWSTR; nSize: DWORD;
  3588.   lpFileName: LPCWSTR): DWORD; stdcall;
  3589. {$EXTERNALSYM GetPrivateProfileSectionNamesW}
  3590. {$IFDEF UNICODE}
  3591. function GetPrivateProfileSectionNames(lpszReturnBuffer: LPWSTR; nSize: DWORD;
  3592.   lpFileName: LPCWSTR): DWORD; stdcall;
  3593. {$EXTERNALSYM GetPrivateProfileSectionNames}
  3594. {$ELSE}
  3595. function GetPrivateProfileSectionNames(lpszReturnBuffer: LPSTR; nSize: DWORD;
  3596.   lpFileName: LPCSTR): DWORD; stdcall;
  3597. {$EXTERNALSYM GetPrivateProfileSectionNames}
  3598. {$ENDIF}
  3599. function GetPrivateProfileStructA(lpszSection, lpszKey: LPCSTR; lpStruct: LPVOID;
  3600.   uSizeStruct: UINT; szFile: LPCSTR): BOOL; stdcall;
  3601. {$EXTERNALSYM GetPrivateProfileStructA}
  3602. function GetPrivateProfileStructW(lpszSection, lpszKey: LPCWSTR; lpStruct: LPVOID;
  3603.   uSizeStruct: UINT; szFile: LPCWSTR): BOOL; stdcall;
  3604. {$EXTERNALSYM GetPrivateProfileStructW}
  3605. {$IFDEF UNICODE}
  3606. function GetPrivateProfileStruct(lpszSection, lpszKey: LPCWSTR; lpStruct: LPVOID;
  3607.   uSizeStruct: UINT; szFile: LPCWSTR): BOOL; stdcall;
  3608. {$EXTERNALSYM GetPrivateProfileStruct}
  3609. {$ELSE}
  3610. function GetPrivateProfileStruct(lpszSection, lpszKey: LPCSTR; lpStruct: LPVOID;
  3611.   uSizeStruct: UINT; szFile: LPCSTR): BOOL; stdcall;
  3612. {$EXTERNALSYM GetPrivateProfileStruct}
  3613. {$ENDIF}
  3614. function WritePrivateProfileStructA(lpszSection, lpszKey: LPCSTR; lpStruct: LPVOID;
  3615.   uSizeStruct: UINT; szFile: LPCSTR): BOOL; stdcall;
  3616. {$EXTERNALSYM WritePrivateProfileStructA}
  3617. function WritePrivateProfileStructW(lpszSection, lpszKey: LPCWSTR; lpStruct: LPVOID;
  3618.   uSizeStruct: UINT; szFile: LPCWSTR): BOOL; stdcall;
  3619. {$EXTERNALSYM WritePrivateProfileStructW}
  3620. {$IFDEF UNICODE}
  3621. function WritePrivateProfileStruct(lpszSection, lpszKey: LPCWSTR; lpStruct: LPVOID;
  3622.   uSizeStruct: UINT; szFile: LPCWSTR): BOOL; stdcall;
  3623. {$EXTERNALSYM WritePrivateProfileStruct}
  3624. {$ELSE}
  3625. function WritePrivateProfileStruct(lpszSection, lpszKey: LPCSTR; lpStruct: LPVOID;
  3626.   uSizeStruct: UINT; szFile: LPCSTR): BOOL; stdcall;
  3627. {$EXTERNALSYM WritePrivateProfileStruct}
  3628. {$ENDIF}
  3629. function GetDriveTypeA(lpRootPathName: LPCSTR): UINT; stdcall;
  3630. {$EXTERNALSYM GetDriveTypeA}
  3631. function GetDriveTypeW(lpRootPathName: LPCWSTR): UINT; stdcall;
  3632. {$EXTERNALSYM GetDriveTypeW}
  3633. {$IFDEF UNICODE}
  3634. function GetDriveType(lpRootPathName: LPCWSTR): UINT; stdcall;
  3635. {$EXTERNALSYM GetDriveType}
  3636. {$ELSE}
  3637. function GetDriveType(lpRootPathName: LPCSTR): UINT; stdcall;
  3638. {$EXTERNALSYM GetDriveType}
  3639. {$ENDIF}
  3640. function GetSystemDirectoryA(lpBuffer: LPSTR; uSize: UINT): UINT; stdcall;
  3641. {$EXTERNALSYM GetSystemDirectoryA}
  3642. function GetSystemDirectoryW(lpBuffer: LPWSTR; uSize: UINT): UINT; stdcall;
  3643. {$EXTERNALSYM GetSystemDirectoryW}
  3644. {$IFDEF UNICODE}
  3645. function GetSystemDirectory(lpBuffer: LPWSTR; uSize: UINT): UINT; stdcall;
  3646. {$EXTERNALSYM GetSystemDirectory}
  3647. {$ELSE}
  3648. function GetSystemDirectory(lpBuffer: LPSTR; uSize: UINT): UINT; stdcall;
  3649. {$EXTERNALSYM GetSystemDirectory}
  3650. {$ENDIF}
  3651. function GetTempPathA(nBufferLength: DWORD; lpBuffer: LPSTR): DWORD; stdcall;
  3652. {$EXTERNALSYM GetTempPathA}
  3653. function GetTempPathW(nBufferLength: DWORD; lpBuffer: LPWSTR): DWORD; stdcall;
  3654. {$EXTERNALSYM GetTempPathW}
  3655. {$IFDEF UNICODE}
  3656. function GetTempPath(nBufferLength: DWORD; lpBuffer: LPWSTR): DWORD; stdcall;
  3657. {$EXTERNALSYM GetTempPath}
  3658. {$ELSE}
  3659. function GetTempPath(nBufferLength: DWORD; lpBuffer: LPSTR): DWORD; stdcall;
  3660. {$EXTERNALSYM GetTempPath}
  3661. {$ENDIF}
  3662. function GetTempFileNameA(lpPathName, lpPrefixString: LPCSTR; uUnique: UINT;
  3663.   lpTempFileName: LPSTR): UINT; stdcall;
  3664. {$EXTERNALSYM GetTempFileNameA}
  3665. function GetTempFileNameW(lpPathName, lpPrefixString: LPCWSTR; uUnique: UINT;
  3666.   lpTempFileName: LPWSTR): UINT; stdcall;
  3667. {$EXTERNALSYM GetTempFileNameW}
  3668. {$IFDEF UNICODE}
  3669. function GetTempFileName(lpPathName, lpPrefixString: LPCWSTR; uUnique: UINT;
  3670.   lpTempFileName: LPWSTR): UINT; stdcall;
  3671. {$EXTERNALSYM GetTempFileName}
  3672. {$ELSE}
  3673. function GetTempFileName(lpPathName, lpPrefixString: LPCSTR; uUnique: UINT;
  3674.   lpTempFileName: LPSTR): UINT; stdcall;
  3675. {$EXTERNALSYM GetTempFileName}
  3676. {$ENDIF}
  3677. function GetWindowsDirectoryA(lpBuffer: LPSTR; uSize: UINT): UINT; stdcall;
  3678. {$EXTERNALSYM GetWindowsDirectoryA}
  3679. function GetWindowsDirectoryW(lpBuffer: LPWSTR; uSize: UINT): UINT; stdcall;
  3680. {$EXTERNALSYM GetWindowsDirectoryW}
  3681. {$IFDEF UNICODE}
  3682. function GetWindowsDirectory(lpBuffer: LPWSTR; uSize: UINT): UINT; stdcall;
  3683. {$EXTERNALSYM GetWindowsDirectory}
  3684. {$ELSE}
  3685. function GetWindowsDirectory(lpBuffer: LPSTR; uSize: UINT): UINT; stdcall;
  3686. {$EXTERNALSYM GetWindowsDirectory}
  3687. {$ENDIF}
  3688. function GetSystemWindowsDirectoryA(lpBuffer: LPSTR; uSize: UINT): UINT; stdcall;
  3689. {$EXTERNALSYM GetSystemWindowsDirectoryA}
  3690. function GetSystemWindowsDirectoryW(lpBuffer: LPWSTR; uSize: UINT): UINT; stdcall;
  3691. {$EXTERNALSYM GetSystemWindowsDirectoryW}
  3692. {$IFDEF UNICODE}
  3693. function GetSystemWindowsDirectory(lpBuffer: LPWSTR; uSize: UINT): UINT; stdcall;
  3694. {$EXTERNALSYM GetSystemWindowsDirectory}
  3695. {$ELSE}
  3696. function GetSystemWindowsDirectory(lpBuffer: LPSTR; uSize: UINT): UINT; stdcall;
  3697. {$EXTERNALSYM GetSystemWindowsDirectory}
  3698. {$ENDIF}
  3699. function GetSystemWow64DirectoryA(lpBuffer: LPSTR; uSize: UINT): UINT; stdcall;
  3700. {$EXTERNALSYM GetSystemWow64DirectoryA}
  3701. function GetSystemWow64DirectoryW(lpBuffer: LPWSTR; uSize: UINT): UINT; stdcall;
  3702. {$EXTERNALSYM GetSystemWow64DirectoryW}
  3703. {$IFDEF UNICODE}
  3704. function GetSystemWow64Directory(lpBuffer: LPWSTR; uSize: UINT): UINT; stdcall;
  3705. {$EXTERNALSYM GetSystemWow64Directory}
  3706. {$ELSE}
  3707. function GetSystemWow64Directory(lpBuffer: LPSTR; uSize: UINT): UINT; stdcall;
  3708. {$EXTERNALSYM GetSystemWow64Directory}
  3709. {$ENDIF}
  3710. //
  3711. // for GetProcAddress
  3712. //
  3713. type
  3714.   PGET_SYSTEM_WOW64_DIRECTORY_A = function (lpBuffer: LPSTR; uSize: UINT): UINT; stdcall;
  3715.   {$EXTERNALSYM PGET_SYSTEM_WOW64_DIRECTORY_A}
  3716.   PGET_SYSTEM_WOW64_DIRECTORY_W = function (lpBuffer: LPWSTR; uSize: UINT): UINT; stdcall;
  3717.   {$EXTERNALSYM PGET_SYSTEM_WOW64_DIRECTORY_W}
  3718. //
  3719. // GetProcAddress only accepts GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A,
  3720. // GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A, GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A.
  3721. // The others are if you want to use the strings in some other way.
  3722. //
  3723. const
  3724.   GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A = 'GetSystemWow64DirectoryA';
  3725.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A}
  3726.   GET_SYSTEM_WOW64_DIRECTORY_NAME_A_W = WideString('GetSystemWow64DirectoryA');
  3727.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_A_W}
  3728.   GET_SYSTEM_WOW64_DIRECTORY_NAME_A_T = __TEXT('GetSystemWow64DirectoryA');
  3729.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_A_T}
  3730.   GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A = 'GetSystemWow64DirectoryW';
  3731.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A}
  3732.   GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W = WideString('GetSystemWow64DirectoryW');
  3733.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W}
  3734.   GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T = __TEXT('GetSystemWow64DirectoryW');
  3735.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T}
  3736. {$IFDEF UNICODE}
  3737.   GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A = GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A;
  3738.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A}
  3739.   GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W = GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W;
  3740.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W}
  3741.   GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T = GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T;
  3742.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T}
  3743. {$ELSE}
  3744.   GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A = GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A;
  3745.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A}
  3746.   GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W = GET_SYSTEM_WOW64_DIRECTORY_NAME_A_W;
  3747.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W}
  3748.   GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T = GET_SYSTEM_WOW64_DIRECTORY_NAME_A_T;
  3749.   {$EXTERNALSYM GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T}
  3750. {$ENDIF}
  3751. function SetCurrentDirectoryA(lpPathName: LPCSTR): BOOL; stdcall;
  3752. {$EXTERNALSYM SetCurrentDirectoryA}
  3753. function SetCurrentDirectoryW(lpPathName: LPCWSTR): BOOL; stdcall;
  3754. {$EXTERNALSYM SetCurrentDirectoryW}
  3755. {$IFDEF UNICODE}
  3756. function SetCurrentDirectory(lpPathName: LPCWSTR): BOOL; stdcall;
  3757. {$EXTERNALSYM SetCurrentDirectory}
  3758. {$ELSE}
  3759. function SetCurrentDirectory(lpPathName: LPCSTR): BOOL; stdcall;
  3760. {$EXTERNALSYM SetCurrentDirectory}
  3761. {$ENDIF}
  3762. function GetCurrentDirectoryA(nBufferLength: DWORD; lpBuffer: LPSTR): DWORD; stdcall;
  3763. {$EXTERNALSYM GetCurrentDirectoryA}
  3764. function GetCurrentDirectoryW(nBufferLength: DWORD; lpBuffer: LPWSTR): DWORD; stdcall;
  3765. {$EXTERNALSYM GetCurrentDirectoryW}
  3766. {$IFDEF UNICODE}
  3767. function GetCurrentDirectory(nBufferLength: DWORD; lpBuffer: LPWSTR): DWORD; stdcall;
  3768. {$EXTERNALSYM GetCurrentDirectory}
  3769. {$ELSE}
  3770. function GetCurrentDirectory(nBufferLength: DWORD; lpBuffer: LPSTR): DWORD; stdcall;
  3771. {$EXTERNALSYM GetCurrentDirectory}
  3772. {$ENDIF}
  3773. //#if _WIN32_WINNT >= 0x0502
  3774. function SetDllDirectoryA(lpPathName: LPCSTR): BOOL; stdcall;
  3775. {$EXTERNALSYM SetDllDirectoryA}
  3776. function SetDllDirectoryW(lpPathName: LPCWSTR): BOOL; stdcall;
  3777. {$EXTERNALSYM SetDllDirectoryW}
  3778. {$IFDEF UNICODE}
  3779. function SetDllDirectory(lpPathName: LPCWSTR): BOOL; stdcall;
  3780. {$EXTERNALSYM SetDllDirectory}
  3781. {$ELSE}
  3782. function SetDllDirectory(lpPathName: LPCSTR): BOOL; stdcall;
  3783. {$EXTERNALSYM SetDllDirectory}
  3784. {$ENDIF}
  3785. function GetDllDirectoryA(nBufferLength: DWORD; lpBuffer: LPSTR): DWORD; stdcall;
  3786. {$EXTERNALSYM GetDllDirectoryA}
  3787. function GetDllDirectoryW(nBufferLength: DWORD; lpBuffer: LPWSTR): DWORD; stdcall;
  3788. {$EXTERNALSYM GetDllDirectoryW}
  3789. {$IFDEF UNICODE}
  3790. function GetDllDirectory(nBufferLength: DWORD; lpBuffer: LPWSTR): DWORD; stdcall;
  3791. {$EXTERNALSYM GetDllDirectory}
  3792. {$ELSE}
  3793. function GetDllDirectory(nBufferLength: DWORD; lpBuffer: LPSTR): DWORD; stdcall;
  3794. {$EXTERNALSYM GetDllDirectory}
  3795. {$ENDIF}
  3796. //#endif // _WIN32_WINNT >= 0x0502
  3797. function GetDiskFreeSpaceA(lpRootPathName: LPCSTR; var lpSectorsPerCluster,
  3798.   lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters: DWORD): BOOL; stdcall;
  3799. {$EXTERNALSYM GetDiskFreeSpaceA}
  3800. function GetDiskFreeSpaceW(lpRootPathName: LPCWSTR; var lpSectorsPerCluster,
  3801.   lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters: DWORD): BOOL; stdcall;
  3802. {$EXTERNALSYM GetDiskFreeSpaceW}
  3803. {$IFDEF UNICODE}
  3804. function GetDiskFreeSpace(lpRootPathName: LPCWSTR; var lpSectorsPerCluster,
  3805.   lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters: DWORD): BOOL; stdcall;
  3806. {$EXTERNALSYM GetDiskFreeSpace}
  3807. {$ELSE}
  3808. function GetDiskFreeSpace(lpRootPathName: LPCSTR; lpSectorsPerCluster,
  3809.   lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters: DWORD): BOOL; stdcall;
  3810. {$EXTERNALSYM GetDiskFreeSpace}
  3811. {$ENDIF}
  3812. function GetDiskFreeSpaceExA(lpDirectoryName: LPCSTR; var lpFreeBytesAvailableToCaller,
  3813.   lpTotalNumberOfBytes: ULARGE_INTEGER; lpTotalNumberOfFreeBytes: PULARGE_INTEGER): BOOL; stdcall;
  3814. {$EXTERNALSYM GetDiskFreeSpaceExA}
  3815. function GetDiskFreeSpaceExW(lpDirectoryName: LPCWSTR; var lpFreeBytesAvailableToCaller,
  3816.   lpTotalNumberOfBytes: ULARGE_INTEGER; lpTotalNumberOfFreeBytes: PULARGE_INTEGER): BOOL; stdcall;
  3817. {$EXTERNALSYM GetDiskFreeSpaceExW}
  3818. {$IFDEF UNICODE}
  3819. function GetDiskFreeSpaceEx(lpDirectoryName: LPCWSTR; var lpFreeBytesAvailableToCaller,
  3820.   lpTotalNumberOfBytes: ULARGE_INTEGER; lpTotalNumberOfFreeBytes: PULARGE_INTEGER): BOOL; stdcall;
  3821. {$EXTERNALSYM GetDiskFreeSpaceEx}
  3822. {$ELSE}
  3823. function GetDiskFreeSpaceEx(lpDirectoryName: LPCSTR; var lpFreeBytesAvailableToCaller,
  3824.   lpTotalNumberOfBytes: ULARGE_INTEGER; lpTotalNumberOfFreeBytes: PULARGE_INTEGER): BOOL; stdcall;
  3825. {$EXTERNALSYM GetDiskFreeSpaceEx}
  3826. {$ENDIF}
  3827. function CreateDirectoryA(lpPathName: LPCSTR; lpSecurityAttributes: LPSECURITY_ATTRIBUTES): BOOL; stdcall;
  3828. {$EXTERNALSYM CreateDirectoryA}
  3829. function CreateDirectoryW(lpPathName: LPCWSTR; lpSecurityAttributes: LPSECURITY_ATTRIBUTES): BOOL; stdcall;
  3830. {$EXTERNALSYM CreateDirectoryW}
  3831. {$IFDEF UNICODE}
  3832. function CreateDirectory(lpPathName: LPCWSTR; lpSecurityAttributes: LPSECURITY_ATTRIBUTES): BOOL; stdcall;
  3833. {$EXTERNALSYM CreateDirectory}
  3834. {$ELSE}