1 {
2     This file is part of the Free Pascal run time library.
3     Copyright (c) 2014 by the Free Pascal development team.
4 
5     Additional OS/2 API functions implemented in DOSCALL1.DLL:
6     - File handling (64-bit functions available in WSeB/MCP/eCS and
7       protected access to file handles as available in OS/2 2.1+)
8     - Certain SMP related functions for querying and setting status
9       of processors and thread and system affinity (available
10       in SMP-ready versions of OS/2 kernels)
11     - Support for working with extended LIBPATH (available in
12       OS/2 Warp 4.0 and higher).
13     Availability of individual functions is checked dynamically during
14     initialization and fake (simulated) functions are used if running
15     under an OS/2 version not providing the respective functionality.
16 
17     See the file COPYING.FPC, included in this distribution,
18     for details about the copyright.
19 
20     This program is distributed in the hope that it will be useful,
21     but WITHOUT ANY WARRANTY; without even the implied warranty of
22     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 
24  **********************************************************************}
25 
26 unit DosCall2;
27 
28 {***************************************************************************}
29 interface
30 {***************************************************************************}
31 
32 uses
33   DosCalls, Strings;
34 
35 const
36 (* Status in DosGet/SetProcessorStatus *)
37   PROC_OFFLINE = 0; (* Processor is offline *)
38   PROC_ONLINE = 1;  (* Processor is online *)
39 (* Scope in DosQueryThreadAffinity *)
40   AFNTY_THREAD = 0; (* Return the current threads processor affinity mask. *)
41   AFNTY_SYSTEM = 1; (* Return the system's current capable processor affinity
42                        mask. *)
43 (* Flags in DosQuery/SetExtLibPath *)
44   BEGIN_LIBPATH = 1; (* The new path is searched before the LIBPATH. *)
45   END_LIBPATH = 2;   (* The new path is searched after the LIBPATH. *)
46 
47 (* Constants for DosSuppressPopups *)
48   SPU_DisableSuppression = 0;
49   SPU_EnableSuppression = 1;
50 
51 (* Constants for DosDumpProcess *)
52   DDP_DisableProcDump = 0;
53   DDP_EnableProcDump = 1;
54   DDP_PerformProcDump = 2;
55 
56 (* Constants for DosPerfSysCall *)
57   Cmd_KI_Enable = $60;
58   Cmd_KI_RdCnt = $63;
59   Cmd_SoftTrace_Log = $14;
60 
61 (* Constants for DosQueryABIOSSupport *)
62   HW_Cfg_MCA = 1;
63   HW_Cfg_EISA = 2;
64   HW_Cfg_ABIOS_Supported = 4;
65   HW_Cfg_ABIOS_Present = 8;
66   HW_Cfg_PCI = 16;
67   HW_Cfg_OEM_ABIOS = 32;
68   HW_Cfg_IBM_ABIOS = 0;
69   HW_Cfg_Pentium_CPU = 64;
70 
71 (* Constants for DosQueryThreadContext - Level *)
72   Context_Control = 1; { Control registers: SS:ESP, CS:EIP, EFLAGS and EBP }
73   Context_Integer = 2; { EAX, EBX, ECX, EDX, ESI and EDI }
74   Context_Segments = 4; { Segment registers:  DS, ES, FS, and GS }
75   Context_Floating_Point = 8; { Numeric coprocessor state }
76   Context_Full = 15; { All of the above }
77 
78 
79 
80 type
81   TFileLockL = record
82    case boolean of
83     false:
84      (Offset: int64;  (* Offset to beginning of the lock (or unlock) range.  *)
85        Range: int64); (* Length of the lock (or unlock) range in bytes.      *)
86                       (* Length of 0 => locking (or unlocking) not required. *)
87     true:
88      (lOffset: int64;
89       lRange: int64);
90   end;
91   PFileLockL = ^TFileLockL;
92 
93   TMPAffinity = record
94    Mask: array [0..1] of cardinal;
95   end;
96   PMPAffinity = ^TMPAffinity;
97 
98   TCPUUtil = record
99    TotalLow,
100    TotalHigh,
101    IdleLow,
102    IdleHigh,
103    BusyLow,
104    BusyHigh,
105    IntrLow,
106    IntrHigh: cardinal;
107   end;
108   PCPUUtil = ^TCPUUtil;
109 
110 
DosOpenLnull111 function DosOpenL (FileName: PChar; var Handle: THandle;
112                         var Action: cardinal; InitSize: int64;
113                         Attrib, OpenFlags, FileMode: cardinal;
114                                                  EA: pointer): cardinal; cdecl;
115 
DosSetFilePtrLnull116 function DosSetFilePtrL (Handle: THandle; Pos: int64; Method: cardinal;
117                                         var PosActual: int64): cardinal; cdecl;
118 
DosSetFileSizeLnull119 function DosSetFileSizeL (Handle: THandle; Size: int64): cardinal; cdecl;
120 
DosProtectOpennull121 function DosProtectOpen (FileName: PChar; var Handle: longint;
122                          var Action: longint; InitSize, Attrib,
123                          OpenFlags, OpenMode: longint; ea: PEAOp2;
124                               var FileHandleLockID: cardinal): cardinal; cdecl;
125 
DosProtectOpennull126 function DosProtectOpen (const FileName: string; var Handle: longint;
127                          var Action: longint; InitSize, Attrib,
128                          OpenFlags, OpenMode: longint; ea: PEAOp2;
129                                      var FileHandleLockID: cardinal): cardinal;
130 
DosProtectOpennull131 function DosProtectOpen (const FileName: string; var Handle: THandle;
132                          var Action: cardinal; InitSize, Attrib,
133                          OpenFlags, OpenMode: cardinal; ea: PEAOp2;
134                                      var FileHandleLockID: cardinal): cardinal;
135 
DosProtectReadnull136 function DosProtectRead (Handle: longint; var Buffer; Count: longint;
137            var ActCount: longint; FileHandleLockID: cardinal): cardinal; cdecl;
138 
DosProtectWritenull139 function DosProtectWrite (Handle: longint; const Buffer; Count: longint;
140                           var ActCount: longint;
141                                   FileHandleLockID: cardinal): cardinal; cdecl;
142 
DosProtectSetFilePtrnull143 function DosProtectSetFilePtr (Handle: longint; Pos, Method: longint;
144                                var PosActual: longint;
145                                   FileHandleLockID: cardinal): cardinal; cdecl;
146 
DosProtectSetFilePtrnull147 function DosProtectSetFilePtr (Handle: THandle; Pos: longint;
148                                          FileHandleLockID: cardinal): cardinal;
149 
DosProtectGetFilePtrnull150 function DosProtectGetFilePtr (Handle: longint;
151                  var PosActual: longint; FileHandleLockID: cardinal): cardinal;
152 
DosProtectGetFilePtrnull153 function DosProtectGetFilePtr (Handle: THandle;
154                 var PosActual: cardinal; FileHandleLockID: cardinal): cardinal;
155 
DosProtectEnumAttributenull156 function DosProtectEnumAttribute (Handle: THandle; Entry: cardinal; var Buf;
157                                   BufSize: cardinal; var Count: cardinal;
158                                   InfoLevel: cardinal;
159                                          FileHandleLockID: cardinal): cardinal;
160 
DosProtectEnumAttributenull161 function DosProtectEnumAttribute (const FileName: string; Entry: cardinal;
162                                   var Buf; BufSize: cardinal;
163                                   var Count: cardinal; InfoLevel: cardinal;
164                                          FileHandleLockID: cardinal): cardinal;
165 
DosProtectOpennull166 function DosProtectOpen (FileName: PChar; var Handle: THandle;
167                               var Action: cardinal; InitSize, Attrib,
168                               OpenFlags, OpenMode: cardinal; ea: PEAOp2;
169                               var FileHandleLockID: cardinal): cardinal; cdecl;
170 
DosProtectClosenull171 function DosProtectClose (Handle: THandle;
172                                   FileHandleLockID: cardinal): cardinal; cdecl;
173 
DosProtectReadnull174 function DosProtectRead (Handle: THandle; var Buffer; Count: cardinal;
175           var ActCount: cardinal; FileHandleLockID: cardinal): cardinal; cdecl;
176 
DosProtectWritenull177 function DosProtectWrite (Handle: THandle; const Buffer; Count: cardinal;
178                           var ActCount: cardinal;
179                                   FileHandleLockID: cardinal): cardinal; cdecl;
180 
DosProtectSetFilePtrnull181 function DosProtectSetFilePtr (Handle: THandle; Pos: longint;
182                                Method: cardinal; var PosActual: cardinal;
183                                   FileHandleLockID: cardinal): cardinal; cdecl;
184 
DosProtectSetFileSizenull185 function DosProtectSetFileSize (Handle: THandle; Size: cardinal;
186                                   FileHandleLockID: cardinal): cardinal; cdecl;
187 
DosProtectQueryFHStatenull188 function DosProtectQueryFHState (Handle: THandle; var FileMode: cardinal;
189                                   FileHandleLockID: cardinal): cardinal; cdecl;
190 
DosProtectSetFHStatenull191 function DosProtectSetFHState (Handle: THandle; FileMode: cardinal;
192                                   FileHandleLockID: cardinal): cardinal; cdecl;
193 
DosProtectQueryFileInfonull194 function DosProtectQueryFileInfo (Handle: THandle; InfoLevel: cardinal;
195                             AFileStatus: PFileStatus; FileStatusLen: cardinal;
196                                   FileHandleLockID: cardinal): cardinal; cdecl;
197 
DosProtectSetFileInfonull198 function DosProtectSetFileInfo (Handle: THandle; InfoLevel: cardinal;
199                             AFileStatus: PFileStatus; FileStatusLen: cardinal;
200                                   FileHandleLockID: cardinal): cardinal; cdecl;
201 
DosProtectEnumAttributenull202 function DosProtectEnumAttribute (RefType: cardinal; AFile: pointer;
203                                   Entry: cardinal; var Buf; BufSize: cardinal;
204                                   var Count: cardinal; InfoLevel: cardinal;
205                                   FileHandleLockID: cardinal): cardinal; cdecl;
206 
DosProtectSetFileLocksnull207 function DosProtectSetFileLocks (Handle: THandle;
208                                       var Unlock, Lock: TFileLock;
209                                       Timeout, Flags: cardinal;
210                                   FileHandleLockID: cardinal): cardinal; cdecl;
211 
212 
213 (*
214  DosCancelLockRequestL cancels an outstanding DosSetFileLocksL request.
215  If two threads in a process are waiting on a lock file range, and another
216  thread issues DosCancelLockRequestL for that lock file range, then both
217  waiting threads are released.
218  Not all file-system drivers (FSDs) can cancel an outstanding lock request.
219  Local Area Network (LAN) servers cannot cancel an outstanding lock request
220  if they use a version of the operating system prior to OS/2 Version 2.00.
221 
222 Possible results:
223      0 No_Error
224      6 Error_Invalid_Handle
225     87 Error_Invalid_Parameter
226    173 Error_Cancel_Violation
227 
228  Handle = File handle used in the DosSetFileLocksL function
229           that is to be cancelled.
230  Lock   = Specification of the lock request to be cancelled.
231 *)
DosCancelLockRequestLnull232 function DosCancelLockRequestL (Handle: THandle;
233                                         var Lock: TFileLockL): cardinal; cdecl;
234 
235 (*
236 DosProtectSetFileLocksL locks and unlocks a range of an open file.
237 
238 Parameters:
239  Handle = file handle
240  Unlock = record containing the offset and length of a range to be unlocked
241  Lock = record containing the offset and length of a range to be locked
242  Timeout = the maximum time that the process is to wait for the requested locks
243            (in milliseconds)
244  Flags = bit mask specifying action to be taken.
245      Bits 31..2 are reserved.
246      Bit 1 (Atomic) means request for atomic locking - if the bit is set
247         and the lock range is equal to the unlock range, an atomic lock occurs.
248         If this bit is set to 1 and the lock range is not equal to the unlock
249         range, an error is returned. If this bit is set to 0, then the lock
250         may or may not occur atomically with the unlock.
251      Bit 0 (Share) defines the type of access that other processes may have
252         to the file range that is being locked. If this bit is set to 0
253         (default), other processes have no access to the locked file range.
254         The current process has exclusive access to the locked file range,
255         which must not overlap any other locked file range. If this bit is set
256         to 1, the current process and other processes have shared read only
257         access to the locked file range. A file range with shared access may
258         overlap any other file range with shared access, but must not overlap
259         any other file range with exclusive access.
260 
261  FileHandleLockID = filehandle lockid returned by a previous DosProtectOpenL.
262 
263 Possible return codes:
264 0 NO_ERROR
265 6 ERROR_INVALID_HANDLE
266 33 ERROR_LOCK_VIOLATION
267 36 ERROR_SHARING_BUFFER_EXCEEDED
268 87 ERROR_INVALID_PARAMETER
269 95 ERROR_INTERRUPT
270 174 ERROR_ATOMIC_LOCK_NOT_SUPPORTED
271 175 ERROR_READ_LOCKS_NOT_SUPPORTED
272 
273 Remarks:
274 DosProtectSetFileLocksL allows a process to lock and unlock a range in a file.
275 The time during which a file range is locked should be short.
276 
277 If the lock and unlock ranges are both zero, ERROR_LOCK_VIOLATION is returned
278 to the caller.
279 
280 If you only want to lock a file range, set the unlock file offset and the
281 unlock range length to zero.
282 
283 If you only want to unlock a file range, set the lock file offset and the lock
284 range length to zero.
285 
286 When the Atomic bit of flags is set to 0, and DosProtectSetFileLocksL specifies
287 a lock operation and an unlock operation, the unlock operation occurs first,
288 and then the lock operation is performed. If an error occurs during the unlock
289 operation, an error code is returned and the lock operation is not performed.
290 If an error occurs during the lock operation, an error code is returned and the
291 unlock remains in effect if it was successful.
292 
293 The lock operation is atomic when all of these conditions are met:
294 - The Atomic bit is set to 1 in flags
295 - The unlock range is the same as the lock range
296 - The process has shared access to the file range, and has requested exclusive
297   access to it; or the process has exclusive access to the file range, and has
298   requested shared access to it.
299 
300 Some file system drivers (FSDs) may not support atomic lock operations.
301 Versions of the operating system prior to OS/2 Version 2.00 do not support
302 atomic lock operations. If the application receives the error code
303 ERROR_ATOMIC_LOCK_NOT_SUPPORTED, the application should unlock the file range
304 and then lock it using a non-atomic operation (with the atomic bit set to 0
305 in Flags). The application should also refresh its internal buffers before
306 making any changes to the file.
307 
308 If you issue DosProtectClose to close a file with locks still in effect,
309 the locks are released in no defined sequence.
310 
311 If you end a process with a file open, and you have locks in effect in that
312 file, the file is closed and the locks are released in no defined sequence.
313 
314 The locked range can be anywhere in the logical file. Locking beyond the end
315 of the file is not an error. A file range to be locked exclusively must first
316 be cleared of any locked file sub-ranges or overlapping locked file ranges.
317 
318 If you repeat DosProtectSetFileLocksL for the same file handle and file range,
319 then you duplicate access to the file range. Access to locked file ranges
320 is not duplicated across DosExecPgm. The proper method of using locks is
321 to attempt to lock the file range, and to examine the return value.
322 
323 The following table shows the level of access granted when the accessed file
324 range is locked with an exclusive lock or a shared lock.  Owner  refers to
325 a process that owns the lock.  Non-owner  refers to a process that does not own
326 the lock.
327 
328  Action       Exclusive Lock             Shared Lock
329 ===================================================================
330  Owner read   Success                    Success
331 -------------------------------------------------------------------
332  Non-owner    Wait for unlock. Return    Success
333  read         error code after time-out.
334 -------------------------------------------------------------------
335  Owner write  Success                    Wait for unlock. Return
336                                          error code after time-out.
337 -------------------------------------------------------------------
338  Non-owner    Wait for unlock. Return    Wait for unlock. Return
339  write        error code after time-out. error code after time-out.
340 -------------------------------------------------------------------
341 
342 
343 If only locking is specified, DosProtectSetFileLocksL locks the specified file
344 range using Lock. If the lock operation cannot be accomplished, an error is
345 returned, and the file range is not locked.
346 
347 After the lock request is processed, a file range can be unlocked using the
348 Unlock parameter of another DosProtectSetFileLocksL request. If unlocking
349 cannot be accomplished, an error is returned.
350 
351 Instead of denying read/write access to an entire file by specifying access
352 and sharing modes with DosProtectOpenL requests, a process attempts to lock
353 only the range needed for read/write access and examines the error code
354 returned.
355 
356 Once a specified file range is locked exclusively, read and write access by
357 another process is denied until the file range is unlocked. If both unlocking
358 and locking are specified by DosProtectSetFileLocksL, the unlocking operation
359 is performed first, then locking is done.
360 *)
DosProtectSetFileLocksLnull361 function DosProtectSetFileLocksL (Handle: THandle; var Unlock: TFileLockL;
362                    var Lock: TFileLockL; Timeout: cardinal; Flags: cardinal;
363                                   FileHandleLockID: cardinal): cardinal; cdecl;
364 
365 (*
366 DosSetFileLocksL locks and unlocks a range of an open file.
367 
368 Parameters:
369  Handle = file handle
370  Unlock = record containing the offset and length of a range to be unlocked
371  Lock = record containing the offset and length of a range to be locked
372  Timeout = the maximum time that the process is to wait for the requested locks
373            (in milliseconds)
374  Flags = bit mask specifying action to be taken.
375      Bits 31..2 are reserved.
376      Bit 1 (Atomic) means request for atomic locking - if the bit is set
377         and the lock range is equal to the unlock range, an atomic lock occurs.
378         If this bit is set to 1 and the lock range is not equal to the unlock
379         range, an error is returned. If this bit is set to 0, then the lock
380         may or may not occur atomically with the unlock.
381      Bit 0 (Share) defines the type of access that other processes may have
382         to the file range that is being locked. If this bit is set to 0
383         (default), other processes have no access to the locked file range.
384         The current process has exclusive access to the locked file range,
385         which must not overlap any other locked file range. If this bit is set
386         to 1, the current process and other processes have shared read only
387         access to the locked file range. A file range with shared access may
388         overlap any other file range with shared access, but must not overlap
389         any other file range with exclusive access.
390 
391 Possible return codes:
392   0 NO_ERROR
393   1 ERROR_INVALID_FUNCTION
394   6 ERROR_INVALID_HANDLE
395  33 ERROR_LOCK_VIOLATION
396  36 ERROR_SHARING_BUFFER_EXCEEDED
397  87 ERROR_INVALID_PARAMETER
398  95 ERROR_INTERRUPT
399 174 ERROR_ATOMIC_LOCK_NOT_SUPPORTED
400 175 ERROR_READ_LOCKS_NOT_SUPPORTED
401 
402 Remarks:
403 DosSetFileLocksL allows a process to lock and unlock a range in a file. The
404 time during which a file range is locked should be short.
405 
406 If the lock and unlock ranges are both zero, ERROR_LOCK_VIOLATION is returned
407 to the caller.
408 
409 If you only want to lock a file range, set the unlock file offset and the
410 unlock range length to zero.
411 
412 If you only want to unlock a file range, set the lock file offset and the lock
413 range length to zero.
414 
415 When the Atomic bit of flags is set to 0, and DosSetFileLocksL specifies a lock
416 operation and an unlock operation, the unlock operation occurs first, and then
417 the lock operation is performed. If an error occurs during the unlock
418 operation, an error code is returned and the lock operation is not performed.
419 If an error occurs during the lock operation, an error code is returned and the
420 unlock remains in effect if it was successful.
421 
422 The lock operation is atomic when all of these conditions are met:
423 - The Atomic bit is set to 1 in flags
424 - The unlock range is the same as the lock range
425 - The process has shared access to the file range, and has requested exclusive
426   access to it; or the process has exclusive access to the file range, and has
427   requested shared access to it.
428 
429 Some file system drivers (FSDs) may not support atomic lock operations.
430 Versions of the operating system prior to OS/2 Version 2.00 do not support
431 atomic lock operations. If the application receives the error code
432 ERROR_ATOMIC_LOCK_NOT_SUPPORTED, the application should unlock the file range
433 and then lock it using a non-atomic operation (with the atomic bit set to 0 in
434 flags). The application should also refresh its internal buffers before making
435 any changes to the file.
436 
437 If you issue DosClose to close a file with locks still in effect, the locks are
438 released in no defined sequence.
439 
440 If you end a process with a file open, and you have locks in effect in that
441 file, the file is closed and the locks are released in no defined sequence.
442 
443 The locked range can be anywhere in the logical file. Locking beyond the end of
444 the file is not an error. A file range to be locked exclusively must first be
445 cleared of any locked file subranges or overlapping locked file ranges.
446 
447 If you repeat DosSetFileLocksL for the same file handle and file range, then
448 you duplicate access to the file range. Access to locked file ranges is not
449 duplicated across DosExecPgm. The proper method of using locks is to attempt to
450 lock the file range, and to examine the return value.
451 
452 The following table shows the level of access granted when the accessed file
453 range is locked with an exclusive lock or a shared lock.  Owner  refers to
454 a process that owns the lock.  Non-owner  refers to a process that does not own
455 the lock.
456 
457  Action       Exclusive Lock             Shared Lock
458 ===================================================================
459  Owner read   Success                    Success
460 -------------------------------------------------------------------
461  Non-owner    Wait for unlock. Return    Success
462  read         error code after time-out.
463 -------------------------------------------------------------------
464  Owner write  Success                    Wait for unlock. Return
465                                          error code after time-out.
466 -------------------------------------------------------------------
467  Non-owner    Wait for unlock. Return    Wait for unlock. Return
468  write        error code after time-out. error code after time-out.
469 -------------------------------------------------------------------
470 
471 If only locking is specified, DosSetFileLocksL locks the specified file range
472 using Lock. If the lock operation cannot be accomplished, an error is
473 returned, and the file range is not locked.
474 
475 After the lock request is processed, a file range can be unlocked using the
476 Unlock parameter of another DosSetFileLocksL request. If unlocking cannot be
477 accomplished, an error is returned.
478 
479 Instead of denying read/write access to an entire file by specifying access and
480 sharing modes with DosOpenL requests, a process attempts to lock only the range
481 needed for read/write access and examines the error code returned.
482 
483 Once a specified file range is locked exclusively, read and write access by
484 another process is denied until the file range is unlocked. If both unlocking
485 and locking are specified by DosSetFileLocksL, the unlocking operation is
486 performed first, then locking is done.
487 *)
DosSetFileLocksLnull488 function DosSetFileLocksL (Handle: THandle; var Unlock: TFileLockL;
489     var Lock: TFileLockL; Timeout: cardinal; Flags: cardinal): cardinal; cdecl;
490 
491 (*
492 DosProtectOpenL opens a new file, an existing file, or a replacement for an
493 existing file and returns a protected file handle. An open file can have
494 extended attributes.
495 
496 Parameters:
497  FileName = ASCIIZ path name of the file or device to be opened.
498  Handle = handle for the file is returned here.
499  Action = value that specifies the action taken by DosProtectOpenL is returned
500           here; if DosProtectOpenL fails, this value has no meaning, otherwise,
501           it is one of the following values:
502    1 FILE_EXISTED - file already existed.
503    2 FILE_CREATED - file was created.
504    3 FILE_TRUNCATED - file existed and was changed to a given size (file was
505                       replaced).
506  InitSize = new logical size of the file (end of data, EOD), in bytes; this
507             parameter is significant only when creating a new file or replacing
508             an existing one. Otherwise, it is ignored. It is an error to create
509             or replace a file with a nonzero length if the OpenMode
510             Access-Mode flag is set to read-only.
511  Attrib = file attributes; this parameter contains the following bit fields:
512       Bits Description
513 
514      31..6 - reserved, must be 0.
515          5 FILE_ARCHIVED (0x00000020) - file has been archived.
516          4 FILE_DIRECTORY (0x00000010) - file is a subdirectory.
517          3 - reserved, must be 0.
518          2 FILE_SYSTEM (0x00000004) - file is a system file.
519          1 FILE_HIDDEN (0x00000002) - file is hidden and does not appear in
520                                       a directory listing.
521          0 FILE_READONLY (0x00000001) - file can be read from, but not written
522                                         to.
523          0 FILE_NORMAL (0x00000000) - file can be read from or written to.
524 
525 File attributes apply only if the file is created. These bits may be set
526 individually or in combination. For example, an attribute value of 0x00000021
527 (bits 5 and 0 set to 1) indicates a read-only file that has been archived.
528 
529  OpenFlags = the action to be taken depending on whether the file exists or
530              does not exist. This parameter contains the following bit fields:
531      Bits Description
532     31..8 - reserved, must be 0.
533      7..4 - the following flags apply if the file does not exist:
534         0000 OPEN_ACTION_FAIL_IF_NEW
535              Open an existing file; fail if the file does not exist.
536         0001 OPEN_ACTION_CREATE_IF_NEW
537              Create the file if the file does not exist.
538      3..0 The following flags apply if the file does not exist:
539         0000 OPEN_ACTION_FAIL_IF_EXISTS
540              Open the file; fail if the file already exists.
541         0001 OPEN_ACTION_OPEN_IF_EXISTS
542              Open the file if it already exists.
543         0010 OPEN_ACTION_REPLACE_IF_EXISTS
544              Replace the file if it already exists.
545 
546  OpenMode = the mode of the open function. This parameter contains the
547             following bit fields:
548       Bits Description
549         31 - reserved, must be zero.
550         30 OPEN_FLAGS_PROTECTED_HANDLE (0x40000000) - protected file handle flag.
551              0 - unprotected Handle
552              1 - protected Handle
553   Protected handle requires the FileHandleLockID to be specified on subsequent
554   DosProtectxxxx calls.
555 
556   Unprotected handle requires the FileHandleLockID value to be specified as
557   zero on subsequent DosProtectxxxx calls. An unprotected handle may be used
558   with the unprotected calls such as DosRead and DosWrite.
559 
560         29 OPEN_SHARE_DENYLEGACY (0x10000000)
561            Deny read/write access by the DosOpen command:
562              0 - allow read/write access by the DosOpen command.
563              1 - deny read/write access by the DosOpen command.
564   A file opened by DosOpenL will not be allowed to grow larger than 2GB while
565   that same file is open via a legacy DosOpen call. Setting this bit to 1 will
566   prevent access by the obsolete DosOpen API and ensure that no error will
567   occur when growing the file.
568     28..16 - reserved, must be zero.
569         15 OPEN_FLAGS_DASD (0x00008000)
570            Direct Open flag:
571              0 - FileName represents a file to be opened normally.
572              1 - FileName is drive (such as C or A), and represents a mounted
573                  disk or diskette volume to be opened for direct access.
574         14 OPEN_FLAGS_WRITE_THROUGH (0x00004000)
575            Write-Through flag:
576              0 - writes to the file may go through the file-system driver's
577                  cache; the file-system driver writes the sectors when the
578                  cache is full or the file is closed.
579              1 - writes to the file may go through the file-system driver's
580                  cache, but the sectors are written (the actual file I/O
581                  operation is completed) before a synchronous write call
582                  returns. This state of the file defines it as a synchronous
583                  file. For synchronous files, this bit must be set, because the
584                  data must be written to the medium for synchronous write
585                  operations.
586   This bit flag is not inherited by child processes.
587        13 OPEN_FLAGS_FAIL_ON_ERROR (0x00002000)
588           Fail-Errors flag. Media I/O errors are handled as follows:
589             0 - reported through the system critical-error handler.
590             1 - reported directly to the caller by way of a return code.
591   Media I/O errors generated through Category 08h Logical Disk Control IOCtl
592   Commands always get reported directly to the caller by way of return code.
593   The Fail-Errors function applies only to non-IOCtl handle-based file I/O
594   calls.
595 
596   This flag bit is not inherited by child processes.
597 
598        12 OPEN_FLAGS_NO_CACHE (0x00001000)
599           No-Cache/Cache flag:
600             0 - the file-system driver should place data from I/O operations
601                 into its cache.
602             1 - I/O operations to the file need not be done through the
603                 file-system driver's cache.
604   The setting of this bit determines whether file-system drivers should place
605   data into the cache. Like the write-through bit, this is a per-handle bit,
606   and is not inherited by child processes.
607        11 - reserved; must be 0.
608     10..8 - the locality of reference flags contain information about how the
609             application is to get access to the file. The values are as
610             follows:
611           000 OPEN_FLAGS_NO_LOCALITY (0x00000000)
612               No locality known.
613           001 OPEN_FLAGS_SEQUENTIAL (0x00000100)
614               Mainly sequential access.
615           010 OPEN_FLAGS_RANDOM (0x00000200)
616               Mainly random access.
617           011 OPEN_FLAGS_RANDOMSEQUENTIAL (0x00000300)
618               Random with some locality.
619         7 OPEN_FLAGS_NOINHERIT (0x00000080)
620           Inheritance flag:
621             0 - file handle is inherited by a process created from a call to
622                 DosExecPgm.
623             1 - file handle is private to the current process.
624   This bit is not inherited by child processes.
625     6..4 Sharing Mode flags; this field defines any restrictions to file
626          access placed by the caller on other processes. The values are as
627          follows:
628          001 OPEN_SHARE_DENYREADWRITE (0x00000010)
629              Deny read write access.
630          010 OPEN_SHARE_DENYWRITE (0x00000020)
631              Deny write access.
632          011 OPEN_SHARE_DENYREAD (0x00000030)
633              Deny read access.
634          100 OPEN_SHARE_DENYNONE (0x00000040)
635              Deny neither read nor write access (deny none).
636          Any other value is invalid.
637        3 Reserved; must be 0.
638     2..0 Access-Mode flags. This field defines the file access required by the
639          caller. The values are as follows:
640          000 OPEN_ACCESS_READONLY (0x00000000)
641          Read-only access
642          001 OPEN_ACCESS_WRITEONLY (0x00000001)
643          Write-only access
644          010 OPEN_ACCESS_READWRITE (0x00000002)
645          Read/write access.
646          Any other value is invalid, as are any other combinations.
647 
648 File sharing requires the cooperation of sharing processes. This cooperation is
649 communicated through sharing and access modes. Any sharing restrictions placed
650 on a file opened by a process are removed when the process closes the file with
651 a DosClose request.
652 
653 Sharing Mode:
654 Specifies the type of file access that other processes may have. For example,
655 if other processes can continue to read the file while your process is
656 operating on it, specify Deny Write. The sharing mode prevents other processes
657 from writing to the file but still allows them to read it.
658 
659 Access Mode:
660 Specifies the type of file access (access mode) needed by your process. For
661 example, if your process requires read/write access, and another process has
662 already opened the file with a sharing mode of Deny None, your DosProtectOpenL
663 request succeeds. However, if the file is open with a sharing mode of Deny
664 Write, the process is denied access.
665 
666 If the file is inherited by a child process, all sharing and access
667 restrictions also are inherited.
668 
669 If an open file handle is duplicated by a call to DosDupHandle, all sharing and
670 access restrictions also are duplicated.
671 
672  EA = pointer to an extended attribute buffer. The address of the
673       extended-attribute buffer, which contains an EAOP2 structure. The
674       fpFEA2List field in the EAOP2 structure points to a data area where the
675       relevant FEA2 list is to be found. The fpGEA2List and oError fields are
676       ignored.
677 Output fpGEA2List and fpFEA2List are unchanged. The area that fpFEA2List points
678 to is unchanged. If an error occurred during the set, oError is the offset of
679 the FEA2 entry where the error occurred. The return code from DosProtectOpenL
680 is the error code for that error condition. If no error occurred, oError is
681 undefined.
682 
683  EA is nil, then no extended attributes are defined for the file. If extended
684  attributes are not to be defined or modified, the pointer EA must be set to
685  nil.
686 
687  FileHandleLockID = 32-bit LockID for the file handle is returned here.
688 
689 Possible return codes:
690   0 NO_ERROR
691   2 ERROR_FILE_NOT_FOUND
692   3 ERROR_PATH_NOT_FOUND
693   4 ERROR_TOO_MANY_OPEN_FILES
694   5 ERROR_ACCESS_DENIED
695  12 ERROR_INVALID_ACCESS
696  26 ERROR_NOT_DOS_DISK
697  32 ERROR_SHARING_VIOLATION
698  36 ERROR_SHARING_BUFFER_EXCEEDED
699  82 ERROR_CANNOT_MAKE
700  87 ERROR_INVALID_PARAMETER
701  99 ERROR_DEVICE_IN_USE
702 108 ERROR_DRIVE_LOCKED
703 110 ERROR_OPEN_FAILED
704 112 ERROR_DISK_FULL
705 206 ERROR_FILENAME_EXCED_RANGE
706 231 ERROR_PIPE_BUSY
707 
708 Remarks:
709 A successful DosProtectOpenL request returns a handle and a 32-bit LockID for
710 accessing the file. The read/write pointer is set at the first byte of the
711 file. The position of the pointer can be changed with DosProtectSetFilePtrL or
712 by read and write operations on the file.
713 
714 The file s date and time can be queried with DosProtectQueryFileInfo. They are
715 set with DosProtectSetFileInfo.
716 
717 The read-only attribute of a file can be set with the ATTRIB command.
718 
719 ulAttribute cannot be set to Volume Label. To set volume-label information,
720 issue DosProtectSetFileInfo with a logical drive number. Volume labels cannot
721 be opened.
722 
723 InitSize affects the size of the file only when the file is new or is
724 a replacement. If an existing file is opened, cbFile is ignored. To change the
725 size of the existing file, issue DosProtectSetFileSizeL.
726 
727 The value in InitSize is a recommended size. If the full size cannot be
728 allocated, the open request may still succeed. The file system makes
729 a reasonable attempt to allocate the new size in an area that is as nearly
730 contiguous as possible on the medium. When the file size is extended, the
731 values of the new bytes are undefined.
732 
733 The Direct Open bit provides direct access to an entire disk or diskette
734 volume, independent of the file system. This mode of opening the volume that is
735 currently on the drive returns a handle to the calling function; the handle
736 represents the logical volume as a single file. The calling function specifies
737 this handle with a DosDevIOCtl Category 8, DSK_LOCKDRIVE request to prevent
738 other processes from accessing the logical volume. When you are finished using
739 the logical volume, issue a DosDevIOCtl Category 8, DSK_UNLOCKDRIVE request to
740 allow other processes to access the logical volume.
741 
742 The file-handle state bits can be set by DosProtectOpenL and
743 DosProtectSetFHState. An application can query the file-handle state bits, as
744 well as the rest of the Open Mode field, by issuing DosProtectQueryFHState.
745 
746 You can use an TEAOP2 structure to set extended attributes in EA when creating
747 a file, replacing an existing file, or truncating an existing file. No extended
748 attributes are set when an existing file is just opened.
749 
750 A replacement operation is logically equivalent to atomically deleting and
751 re-creating the file. This means that any extended attributes associated with
752 the file also are deleted before the file is re-created.
753 
754 The FileHandleLockID returned is required on each of the DosProtectxxx
755 functions. An incorrect pfhFileHandleLockID on subsequent DosProtectxxx calls
756 results in an ERROR_ACCESS_DENIED return code.
757 
758 The DosProtectxxx functions can be used with a NULL filehandle LockID, if the
759 subject filehandle was obtained from DosOpen.
760 *)
DosProtectOpenLnull761 function DosProtectOpenL (FileName: PChar; var Handle: THandle;
762                          var Action: cardinal; InitSize: int64; Attrib,
763                          OpenFlags, OpenMode: cardinal; EA: PEAOp2;
764                               var FileHandleLockID: cardinal): cardinal; cdecl;
765 
766 
767 (*
768 DosProtectSetFilePtrL moves the read or write pointer according to the type
769 of move specified.
770 
771 Parameters:
772  Handle = the handle returned by a previous DosOpenL function.
773  Pos = The signed distance (offset) to move, in bytes.
774  Method = The method of moving - location in the file at which the read/write
775           pointer starts before adding the Pos offset. The values and their
776           meanings are as shown in the following list:
777     0 FILE_BEGIN - move the pointer from the beginning of the file.
778     1 FILE_CURRENT - move the pointer from the current location of the
779                      read/write pointer.
780     2 FILE_END - move the pointer from the end of the file; use this method
781                  to determine a file's size.
782  PosActual = address of the new pointer location.
783  FileHandleLockID = The filehandle lockid returned by a previous
784                     DosProtectOpenL.
785 
786 Possible return codes:
787   0 NO_ERROR
788   1 ERROR_INVALID_FUNCTION
789   6 ERROR_INVALID_HANDLE
790 132 ERROR_SEEK_ON_DEVICE
791 131 ERROR_NEGATIVE_SEEK
792 130 ERROR_DIRECT_ACCESS_HANDLE
793 
794 Remarks:
795 
796 The read/write pointer in a file is a signed 64-bit number. A negative value
797 for Pos moves the pointer backward in the file; a positive value moves it
798 forward. DosProtectSetFilePtrL cannot be used to move to a negative position in
799 the file.
800 
801 DosProtectSetFilePtrL cannot be used for a character device or pipe.
802 *)
DosProtectSetFilePtrLnull803 function DosProtectSetFilePtrL (Handle: THandle; Pos: int64;
804                               Method: cardinal; var PosActual: int64;
805                                   FileHandleLockID: cardinal): cardinal; cdecl;
806 (*
807 DosProtectSetFileSizeL changes the size of a file.
808 
809 Parameters:
810  Handle = handle of the file whose size to be changed.
811  Size = new size, in bytes, of the file.
812  FileHandleLockID = the filehandle lockid obtained from DosProtectOpenL.
813 
814 Possible return codes:
815   0 NO_ERROR
816   5 ERROR_ACCESS_DENIED
817   6 ERROR_INVALID_HANDLE
818  26 ERROR_NOT_DOS_DISK
819  33 ERROR_LOCK_VIOLATION
820  87 ERROR_INVALID_PARAMETER
821 112 ERROR_DISK_FULL
822 
823 Remarks:
824 
825 When DosProtectSetFileSizeL is issued, the file must be open in a mode that
826 allows write access.
827 
828 The size of the open file can be truncated or extended. If the file size is
829 being extended, the file system tries to allocate additional bytes in
830 a contiguous (or nearly contiguous) space on the medium. The values of the new
831 bytes are undefined.
832 *)
DosProtectSetFileSizeLnull833 function DosProtectSetFileSizeL (Handle: THandle; Size: int64;
834                                   FileHandleLockID: cardinal): cardinal; cdecl;
835 
836 (*
837 DosGetProcessorStatus allows checking status of individual processors
838 in a SMP machine.
839 
840 Parameters:
841 ProcID = Procesor ID numbered 1 through n, where there are n processors in
842          total.
843 Status = Returned processor status defined as follows:
844   PROC_OFFLINE 0x00000000 Processor is offline
845   PROC_ONLINE 0x00000001 Processor is online
846 
847 Possible return codes:
848  0 NO_ERROR
849 87 ERROR_INVALID_PARAMETER
850 *)
DosGetProcessorStatusnull851 function DosGetProcessorStatus (ProcID: cardinal;
852                                         var Status: cardinal): cardinal; cdecl;
853 
854 
855 (*
856 DosSetProcessorStatus sets the ONLINE or OFFLINE status of a processor on
857 an SMP system. The processor status may be queried using DosGetProcessorStatus.
858 ONLINE status implies the processor is available for running work. OFFLINE
859 status implies the processor is not available for running work. The processor
860 that executes DosSetProcessorStatus must be ONLINE.
861 
862 Parameters:
863 ProcID = Processor ID numbered from 1 through n, where there are n processors
864          in total.
865 Status = Requested processor status defined as follows:
866   PROC_OFFLINE 0x00000000 Processor is offline.
867   PROC_ONLINE 0x00000001 Processor is online.
868 
869 Possible return codes:
870  0 NO_ERROR
871 87 ERROR_INVALID_PARAMETER
872 *)
DosSetProcessorStatusnull873 function DosSetProcessorStatus (ProcID: cardinal;
874                                             Status: cardinal): cardinal; cdecl;
875 
876 (*
877 DosQueryThreadAffinity allows a thread to inquire for the current thread's
878 processor affinity mask and the system's capable processor affinity mask.
879 
880 Parameters:
881 Scope = Scope of the query defined by one of the following values:
882   AFNTY_THREAD Return the current threads processor affinity mask.
883   AFNTY_SYSTEM Return the system's current capable processor affinity mask.
884 AffinityMask = Affinity mask is returned here; processors 0..31 are in Mask [0]
885                and processors 32..63 are in Mask [1].
886 
887 Possible return codes:
888 13 ERROR_INVALID_DATA
889 87 ERROR_INVALID_PARAMETER
890 *)
DosQueryThreadAffinitynull891 function DosQueryThreadAffinity (Scope: cardinal;
892                                var AffinityMask: TMPAffinity): cardinal; cdecl;
893 
894 (*
895 DosQueryExtLibPath returns the current path to be searched before or after the
896 system LIBPATH when locating DLLs.
897 
898 Parameters:
899 ExtLIBPATH = Buffer for receiving the extended LIBPATH string.
900 
901 ???
902 If the buffer pointed to by this parameter is not large enough to hold
903 the extended LIBPATH or an extended LIBPATH is not currently defined, this
904 parameter returns a pointer to a NULL string.
905 ??? How is it detected if the size is not passed???
906 
907 Flags - flag indicating when the new path is searched - possible values:
908   BEGIN_LIBPATH - The new path is searched before the LIBPATH.
909   END_LIBPATH - The new path is searched after the LIBPATH.
910 
911 Possible return codes:
912   0 NO_ERROR
913  87 ERROR_INVALID_PARAMETER
914 122 ERROR_INSUFFICIENT_BUFER
915 *)
DosQueryExtLibPathnull916 function DosQueryExtLibPath (ExtLibPath: PChar; Flags: cardinal): cardinal;
917                                                                          cdecl;
918 
919 (*
920 DosSetExtLibPath defines the current path to be searched before or after the
921 system LIBPATH when locating DLLs.
922 
923 Parameters:
924 ExtLIBPATH = New extended LIBPATH string. Maximum size is 1024 bytes.
925              A pointer to a NULL string removes the extended LIBPATH.
926 Flags = When the new path is searched - possible values:
927   BEGIN_LIBPATH (1) - the new path is searched before the LIBPATH.
928   END_LIBPATH (2) - the new path is searched after the LIBPATH.
929 
930 The LIBPATH string is an environment variable found in the CONFIG.SYS file
931 consisting of a set of paths. If a fully-qualified path is not specified when
932 a module is loaded, the system searches these paths to find the DLL.
933 
934 There are two extended LIBPATH strings, BeginLIBPATH and EndLIBPATH.
935 BeginLIBPATH is searched before the system LIBPATH, and EndLIBPATH is searched
936 after both BeginLIBPATH and the system LIBPATH. These extended LIBPATHs can be
937 set either from the command line using the "SET" command, or by calling
938 DosSetExtLIBPATH. When DosSetExtLIBPATH is called, all modifications become
939 specific to that process. Initial settings can be set for all processes in the
940 system by setting the values in CONFIG.SYS using the "set" command.
941 
942 Note: The extended LIBPATHs are not true environment variables, and do not
943 appear when querying the environment.
944 
945 Every process inherits the settings of BeginLIBPATH and EndLIBPATH from the
946 process that starts it. If the extended library paths are initialized in
947 CONFIG.SYS, those extended library paths become the initial settings for new
948 processes. If a process changes BeginLIBPATH or EndLIBPATH and starts a new
949 process, the new child process inherits the changed contents. Child processes
950 that inherit their parent's extended LIBPATHs maintain their own copy.
951 Modifications made by the parent after the child has been created have no
952 effect on the children.
953 
954 This function permits the use of two symbols within the path string:
955 %BeginLIBPATH% and %EndLIBPATH%. These symbols are replaced with the current
956 string settings for the extended library paths.
957 
958 The LIBPATHs strings are only searched when the specified DLL is not currently
959 loaded. The only way to guarantee that the DLL being used is the correct
960 version is to set the fully-qualified path in DosLoadModule. When a request is
961 made to load a module and a path is not specified, the system searches the
962 paths in the LIBPATH string and uses the first instance of the specified DLL it
963 finds. If the new paths are added to the search strings, the system does not
964 check those directories to see if a different version exists. Consequently, if
965 two processes started from different directories use the same DLL, but
966 different versions of that DLL exist in both directories, the version of the
967 DLL loaded by the first process is the one used by both processes. The only way
968 to prevent this from occurring is to specify the path to the DLL when
969 DosLoadModule is called.
970 
971 Consequently, if one process sets its BeginLIBPATH to C:\PROCESS1\DLL and loads
972 the DLL MYAPP.DLL from that directory, and then a second process sets its
973 BeginLIBPATH to C:\PROCESS2\DLL and there is for a different version of
974 MYAPP.DLL in C:\PROCESS2\DLL, the second process will link to the DLL from
975 C:\PROCESS1\DLL since it was already loaded.
976 
977 Both BeginLIBPATH and EndLIBPATH can be set from the command line using the SET
978 command.
979 
980 Possible return codes:
981 0 NO_ERROR
982 8 ERROR_NOT_ENOUGH_MEMORY
983 87 ERROR_INVALID_PARAMETER
984 161 ERROR_BAD_PATHNAME
985 *)
DosSetExtLibPathnull986 function DosSetExtLibPath (ExtLibPath: PChar; Flags: cardinal): cardinal;
987                                                                          cdecl;
988 
989 (*
990 DosQueryModFromEIP queries a module handle and name from a given flat address.
991 It takes a flat 32 bit address as a parameter and returns information about the
992 module (a protected mode application currently executing) owning the storage.
993 
994 Parameters:
995 HMod = Address of a location in which the module handle is returned.
996 ObjNum = Address of a cardinal where the module object number corresponding to
997          the Address is returned. The object number is zero based.
998 BuffLen = Length of the user supplied buffer pointed to by Buff.
999 Buff = Address of a user supplied buffer in which the module name is returned.
1000 Offset = Address where the offset to the object corresponding to the Address is
1001          returned. The offset is zero based.
1002 Address = Input address to be queried.
1003 
1004 Possible return codes:
1005   0 NO_ERROR
1006  87 ERROR_INVALID_PARAMETER
1007 487 ERROR_INVALID_ADDRESS
1008 *)
DosQueryModFromEIPnull1009 function DosQueryModFromEIP (var HMod: THandle; var ObjNum: cardinal;
1010                          BuffLen: cardinal; Buff: PChar; var Offset: cardinal;
1011                                             Address: PtrUInt): cardinal; cdecl;
1012 
1013 
1014 (*
1015 DosDumpProcess initiates a process dump from a specified process. This may be used as part of an error handling routine to gather information about an error that may be analyzed later using the OS/2 System Dump Formatter. Configuration of Process Dump may be done using the PDUMPSYS, PDUMPUSR, and PROCDUMP commands.
1016 
1017 Parameters:
1018 Flag = Function to be performed (one of DDP_* constants).
1019   DDP_DISABLEPROCDUMP (0) - disable process dumps
1020   DDP_ENABLEPROCDUMP  (1) - enable process dumps
1021   DDP_PERFORMPROCDUMP (2) - perform process dump (if the user enabled it using
1022                             the PROCDUMP command; ERROR_INVALID_PARAMETER is
1023                             returned otherwise)
1024 Drive = The ASCII character for the drive on which process dump files are
1025         to be created, or 0 to use the drive originally specified by the user
1026         using the PROCDUMP command. This is required only with the
1027         DDP_ENABLEPROCDUMP (PROCDUMP command allows customizing fully the drive
1028         and path).
1029 PID = The process to be dumped. 0 specifies the current process; otherwise
1030       a valid process ID must be specified. This parameter is actioned only
1031       with DDP_PERFORMPROCDUMP.
1032 
1033 Possible return Codes.
1034  0 NO_ERROR
1035 87 ERROR_INVALID PARAMETER
1036 
1037 Remarks:
1038 Use the PDUMPUSR command to specify what information will be dumped.
1039 
1040 Use the PROCDUMP command to customize options per process and in particular
1041 to specify whether child or parent process will be dumped.
1042 
1043 For maximum flexibility the use of DosDumpProcess should be limited
1044 to the DDP_PERFORMPROCDUMP function. This allows you to specify whether
1045 Process Dump should be enabled through the use of the PROCDUMP command.
1046 You may customize Process Dump completely through use of the PDUMPUSR,
1047 PDUMPSYS, AND PROCDUMP commands. For further information, see PROCDUMP.DOC
1048 in the OS2\SYSTEM\RAS directory. DDP_ENABLEPROCDUMP and DDP_DISABLEPROCDUMP
1049 are provided for backwards compatibility only.
1050 *)
DosDumpProcessnull1051 function DosDumpProcess (Flag: cardinal; Drive: char;
1052                                                PID: cardinal): cardinal; cdecl;
1053 
1054 
1055 (*
1056 Suppress application trap popups and log them to the file POPUPLOG.OS2.
1057 
1058 Parameters:
1059 Flag = Flag indicating whether pop-up suppression should be enabled
1060        or disabled (one of SPU_* constants - 0 or 1).
1061 Drive = The drive letter for the log file (used only when pop-up suppression is
1062         enabled).
1063 
1064 Remarks:
1065 When pop-ups are suppressed through DosSuppressPopUps, the system does not
1066 display trap screens on the user's terminal. The user will not be required
1067 to respond to the abort, retry, continue message. Instead, the system displays
1068 message SYS3571 and logs the name of the process to the POPUPLOG.OS2 log file
1069 in the root directory of the specified drive. The system will also log
1070 the message inserts in the log file.
1071 
1072 If the log file does not exist, the system will create it. If the log file
1073 exists, the system appends to it. If the system cannot open the file (for
1074 example, because the drive does not exist), the system will not log the pop-up
1075 information.
1076 
1077 When pop-up suppression is enabled, the system overrides any settings
1078 established by DosError on a per-process basis.
1079 
1080 This API overrides the potential initial setting (e.g. 'SUPPRESSPOPUPS=c')
1081 in CONFIG.SYS.
1082 
1083 The drive letter for the log file may also be specified on the
1084 DosSuppressPopUps API.
1085 
1086 If an invalid flag (a flag other than SPU_ENABLESUPPRESSION
1087 or SPU_DISABLESUPPRESSION) or an invalid drive (a drive other than an upper- or
1088 lowercase letter) is specified on DosSuppressPopUps, the system returns error
1089 code ERROR_INVALID_PARAMETER. Otherwise, the system returns NO_ERROR.
1090 
1091 Possible error codes:
1092  0 NO_ERROR
1093 87 ERROR_INVALID_PARAMETER
1094 *)
DosSuppressPopupsnull1095 function DosSuppressPopups (Flag: cardinal; Drive: char): cardinal; cdecl;
1096 
1097 
1098 (*
1099 DosPerfSysCall retrieves system performance information and performs software
1100 tracing.
1101 
1102 Parameters:
1103 Command = Command to be performed; the following commands are accepted:
1104   CMD_KI_RDCNT ($63) - reads CPU utilization information in both uniprocessor
1105                        and symmetric multi-processor (SMP) environments by
1106                        taking a snapshot of the time stamp counters. To
1107                        determine CPU utilization, the application must compute
1108                        the difference between two time stamp snapshots using 64
1109                        bit aritimetic.
1110   CMD_SOFTTRACE_LOG ($14) - records software trace information.
1111 Parm1 (CPUUtil) = Command-specific. In case of CMD_KI_RDCNT, pointer to
1112                   TCPUUtil record. In case of CMD_SOFTTRACE_LOG, major code for
1113                   the trace entry in the range of 0 to 255. Major codes 184
1114                   ($B8) and 185 ($B9) have been reserved for IBM customer use.
1115                   Major code 1 is reserved for exclusive use by IBM.
1116 Parm2 = Command-specific. In case of CMD_KI_RdCnt, it must be 0. In case of
1117         CMD_SOFTTRACE_LOG, minor code for the trace entry in the range of
1118         0 to 255.
1119 Parm3 (HookData) = Command-specific. In case of CMD_KI_RdCnt, it must be 0. In
1120                    case of CMD_SOFTTRACE_LOG, pointer to a HOOKDATA data
1121                    structure (see example code).
1122 
1123 Possible return codes:
1124 0 NO_ERROR
1125 1 ERROR_INVALID_FUNCTION
1126 
1127 Remarks:
1128 DosPerfSysCall is a general purpose performance function. This function accepts
1129 four parameters. The first parameter is the command requested. The other three
1130 parameters are command specific.
1131 
1132 Some functions of DosPerfSysCall may have a dependency on Intel Pentium or
1133 Pentium-Pro (or higher) support. If a function cannot be provided because OS/2
1134 is not running on a processor with the required features, a return code will
1135 indicate an attempt to use an unsupported function.
1136 
1137 Example code (C):
1138   int main (int argc, char *argv[])
1139   {
1140      APIRET     rc;
1141      BYTE       HookBuffer [256];
1142      HOOKDATA   Hookdata = {0,HookBuffer};
1143      ULONG      ulMajor, ulMinor;
1144      *((PULONG)  HookBuffer[0]) = 1;
1145      *((PULONG)  HookBuffer[4]) = 2;
1146      *((PULONG)  HookBuffer[8]) = 3;
1147      strcpy((PSZ  HookBuffer[12], "Test of 3 ULONG values and a string.")
1148      HookData.ulLength = 12 + strlen((PSZ HookBuffer[12]) + 1;
1149 
1150      ulMajor = 0x00b8
1151      ulMinor = 0x0001
1152 
1153      rc = DosPerfSystCall(CMD_SOFTTRACE_LOG, ulMajor, ulMinor, (ULONG)  HookData);
1154      if (rc != NO_ERROR) {
1155        fprintf (stderr, "CMD_SOFTTRACE_LOG failed   rc = %u\n", rc);
1156        return 1;
1157        }
1158 
1159      return NO_ERROR;
1160   }
1161 *)
DosPerfSysCallnull1162 function DosPerfSysCall (Command, Parm1, Parm2,
1163                                              Parm3: cardinal): cardinal; cdecl;
DosPerfSysCallnull1164 function DosPerfSysCall (Command, Parm1, Parm2: cardinal;
1165                                                 var HookData): cardinal; cdecl;
DosPerfSysCallnull1166 function DosPerfSysCall (Command: cardinal; var CpuUtil: TCPUUtil; Parm2,
1167                                              Parm3: cardinal): cardinal; cdecl;
1168 
1169 
1170 (*
1171 Query context of a suspended thread.
1172 
1173 Parameters:
1174 TID = Thread ID
1175 Level = Desired level of information
1176 Context = Thread context record
1177 
1178 DosQueryThreadContext returns the context record of a suspended thread.
1179 A thread may be suspended by using DosSuspendThread or DosEnterCritSec.
1180 If DosSuspendThread is used, the caller must allow some time for OS/2 to
1181 suspend the thread before querying its context.
1182 
1183 Note: Values from the thread context should be used only when the state
1184 of the target thread is known.
1185 
1186 Possible return codes:
1187   0 NO_ERROR
1188  87 ERROR_INVALID_PARAMETER
1189  90 ERROR_NOT_FROZEN
1190 115 ERROR_PROTECTION_VIOLATION
1191 309 ERROR_INVALID_THREADID
1192 *)
DosQueryThreadContextnull1193 function DosQueryThreadContext (TID: cardinal; Level: cardinal;
1194                                  var Context: TContextRecord): cardinal; cdecl;
1195 
1196 
1197 (*
1198 DosQueryABIOSSupport returns flags that indicate various basic hardware
1199 configurations.
1200 
1201 Parameters:
1202 Reserved = Must be set to 0, no other value is defined.
1203 
1204 The result of this function contains combination of flags (HW_Cfg_* constants)
1205 signalizing the underlying hardware configuration.
1206 *)
DosQueryABIOSSupportnull1207 function DosQueryABIOSSupport (Reserved: cardinal): cardinal; cdecl;
1208 
1209 
1210 {***************************************************************************}
1211 implementation
1212 {***************************************************************************}
1213 
1214 uses
1215   OS2Def;
1216 
1217 
DummyDosCancelLockRequestLnull1218 function DummyDosCancelLockRequestL (Handle: THandle; var Lock: TFileLockL): cardinal; cdecl;
1219 var
1220   Lock0: TFileLock;
1221 begin
1222   if (Lock.Offset > high (longint)) or (Lock.Range > high (longint)) or
1223                                      (Lock.Offset < 0) or (Lock.Range < 0) then
1224    DummyDosCancelLockRequestL := Error_Invalid_Parameter
1225   else
1226    begin
1227     Lock0.Offset := longint (Lock.Offset);
1228     Lock0.Range := longint (Lock.Range);
1229     DummyDosCancelLockRequestL := DosCancelLockRequest (Handle, Lock0);
1230    end;
1231 end;
1232 
1233 
DummyDosProtectSetFileLocksLnull1234 function DummyDosProtectSetFileLocksL (Handle: THandle; var Unlock: TFileLockL;
1235                    var Lock: TFileLockL; Timeout: cardinal; Flags: cardinal;
1236                                   FileHandleLockID: cardinal): cardinal; cdecl;
1237 var
1238   Lock0: TFileLock;
1239   UnLock0: TFileLock;
1240 begin
1241   if (Lock.Offset > high (longint)) or (Lock.Range > high (longint)) or
1242        (Unlock.Offset > high (longint)) or (Unlock.Range > high (longint)) then
1243    DummyDosProtectSetFileLocksL := Error_Invalid_Parameter
1244   else
1245    begin
1246     Lock0.Offset := longint (Lock.Offset);
1247     Lock0.Range := longint (Lock.Range);
1248     Unlock0.Offset := longint (Unlock.Offset);
1249     Unlock0.Range := longint (Lock.Range);
1250     DummyDosProtectSetFileLocksL := DosProtectSetFileLocks (Handle, Unlock0,
1251                                       Lock0, Timeout, Flags, FileHandleLockID);
1252    end;
1253 end;
1254 
1255 
DummyDosSetFileLocksLnull1256 function DummyDosSetFileLocksL (Handle: THandle; var Unlock: TFileLockL;
1257     var Lock: TFileLockL; Timeout: cardinal; Flags: cardinal): cardinal; cdecl;
1258 var
1259   Lock0: TFileLock;
1260   UnLock0: TFileLock;
1261 begin
1262   if (Lock.Offset > high (longint)) or (Lock.Range > high (longint)) or
1263       (Lock.Offset < 0) or (Lock.Range < 0) or
1264       (Unlock.Offset < 0) or (Unlock.Range < 0) or
1265        (Unlock.Offset > high (longint)) or (Unlock.Range > high (longint)) then
1266    DummyDosSetFileLocksL := Error_Invalid_Parameter
1267   else
1268    begin
1269     Lock0.Offset := longint (Lock.Offset);
1270     Lock0.Range := longint (Lock.Range);
1271     Unlock0.Offset := longint (Unlock.Offset);
1272     Unlock0.Range := longint (Lock.Range);
1273     DummyDosSetFileLocksL := DosSetFileLocks (Handle, Unlock0, Lock0, Timeout,
1274                                                                         Flags);
1275    end;
1276 end;
1277 
1278 
DummyDosProtectOpenLnull1279 function DummyDosProtectOpenL (FileName: PChar; var Handle: THandle;
1280                          var Action: cardinal; InitSize: int64; Attrib,
1281                          OpenFlags, OpenMode: cardinal; EA: PEAOp2;
1282                               var FileHandleLockID: cardinal): cardinal; cdecl;
1283 begin
1284   if InitSize > high (longint) then
1285    DummyDosProtectOpenL := Error_Invalid_Parameter
1286   else
1287    DummyDosProtectOpenL := DosProtectOpen (FileName, Handle, Action,
1288         longint (InitSize), Attrib, OpenFlags, OpenMode, EA, FileHandleLockID);
1289 end;
1290 
1291 
DummyDosProtectSetFilePtrLnull1292 function DummyDosProtectSetFilePtrL (Handle: THandle; Pos: int64;
1293                               Method: cardinal; var PosActual: int64;
1294                                   FileHandleLockID: cardinal): cardinal; cdecl;
1295 var
1296   PosActual0: cardinal;
1297 begin
1298   if (Pos < low (longint)) or (Pos > high (longint)) then
1299    DummyDosProtectSetFilePtrL := Error_Invalid_Parameter
1300   else
1301    begin
1302     DummyDosProtectSetFilePtrL := DosProtectSetFilePtr (Handle, longint (Pos),
1303                                          Method, PosActual0, FileHandleLockID);
1304     PosActual := PosActual0;
1305    end;
1306 end;
1307 
1308 
DummyDosProtectSetFileSizeLnull1309 function DummyDosProtectSetFileSizeL (Handle: THandle; Size: int64;
1310                                   FileHandleLockID: cardinal): cardinal; cdecl;
1311 begin
1312   if (Size > high (cardinal)) then
1313    DummyDosProtectSetFileSizeL := Error_Invalid_Parameter
1314   else
1315    DummyDosProtectSetFileSizeL := DosProtectSetFileSize (Handle,
1316                                             cardinal (Size), FileHandleLockID);
1317 end;
1318 
1319 
DummyDosProtectSetFileLocksnull1320 function DummyDosProtectSetFileLocks (Handle: THandle;
1321                                       var Unlock, Lock: TFileLock;
1322                                       Timeout, Flags: cardinal;
1323                                   FileHandleLockID: cardinal): cardinal; cdecl;
1324 begin
1325   if FileHandleLockID <> 0 then
1326    DummyDosProtectSetFileLocks := Error_Invalid_Parameter
1327   else
1328    DummyDosProtectSetFileLocks := DosSetFileLocks (Handle, Unlock, Lock,
1329                                                                Timeout, Flags);
1330 end;
1331 
1332 
DummyDosProtectOpennull1333 function DummyDosProtectOpen (FileName: PChar; var Handle: THandle;
1334                               var Action: cardinal; InitSize, Attrib,
1335                               OpenFlags, OpenMode: cardinal; ea: PEAOp2;
1336                               var FileHandleLockID: cardinal): cardinal; cdecl;
1337 begin
1338   DummyDosProtectOpen := DosOpen (FileName, Handle, Action, InitSize, Attrib,
1339                                                       OpenFlags, OpenMode, EA);
1340   FileHandleLockID := 0;
1341 end;
1342 
1343 
DummyDosProtectClosenull1344 function DummyDosProtectClose (Handle: THandle;
1345                                   FileHandleLockID: cardinal): cardinal; cdecl;
1346 begin
1347   DummyDosProtectClose := DosClose (Handle);
1348 end;
1349 
1350 
DummyDosProtectReadnull1351 function DummyDosProtectRead (Handle: THandle; var Buffer; Count: cardinal;
1352           var ActCount: cardinal; FileHandleLockID: cardinal): cardinal; cdecl;
1353 begin
1354   DummyDosProtectRead := DosRead (Handle, Buffer, Count, ActCount);
1355 end;
1356 
1357 
DummyDosProtectWritenull1358 function DummyDosProtectWrite (Handle: THandle; const Buffer; Count: cardinal;
1359                                 var ActCount: cardinal;
1360                                   FileHandleLockID: cardinal): cardinal; cdecl;
1361 begin
1362   DummyDosProtectWrite := DosWrite (Handle, Buffer, Count, ActCount);
1363 end;
1364 
1365 
DummyDosProtectSetFilePtrnull1366 function DummyDosProtectSetFilePtr (Handle: THandle; Pos: longint;
1367                                     Method: cardinal; var PosActual: cardinal;
1368                                   FileHandleLockID: cardinal): cardinal; cdecl;
1369 begin
1370   DummyDosProtectSetFilePtr := DosSetFilePtr (Handle, Pos, Method, PosActual);
1371 end;
1372 
1373 
DummyDosProtectSetFileSizenull1374 function DummyDosProtectSetFileSize (Handle: THandle; Size: cardinal;
1375                                   FileHandleLockID: cardinal): cardinal; cdecl;
1376 begin
1377   DummyDosProtectSetFileSize := DosSetFileSize (Handle, Size);
1378 end;
1379 
1380 
DummyDosProtectQueryFHStatenull1381 function DummyDosProtectQueryFHState (Handle: THandle; var FileMode: cardinal;
1382                                   FileHandleLockID: cardinal): cardinal; cdecl;
1383 begin
1384   DummyDosProtectQueryFHState := DosQueryFHState (Handle, FileMode);
1385 end;
1386 
1387 
DummyDosProtectSetFHStatenull1388 function DummyDosProtectSetFHState (Handle: THandle; FileMode: cardinal;
1389                                   FileHandleLockID: cardinal): cardinal; cdecl;
1390 begin
1391   DummyDosProtectSetFHState := DosSetFHState (Handle, FileMode);
1392 end;
1393 
1394 
DummyDosProtectQueryFileInfonull1395 function DummyDosProtectQueryFileInfo (Handle: THandle; InfoLevel: cardinal;
1396                             AFileStatus: PFileStatus; FileStatusLen: cardinal;
1397                                   FileHandleLockID: cardinal): cardinal; cdecl;
1398 begin
1399   DummyDosProtectQueryFileInfo := DosQueryFileInfo (Handle, InfoLevel,
1400                                                    AFileStatus, FileStatusLen);
1401 end;
1402 
1403 
DummyDosProtectSetFileInfonull1404 function DummyDosProtectSetFileInfo (Handle: THandle; InfoLevel: cardinal;
1405                             AFileStatus: PFileStatus; FileStatusLen: cardinal;
1406                                   FileHandleLockID: cardinal): cardinal; cdecl;
1407 begin
1408   DummyDosProtectSetFileInfo := DosSetFileInfo (Handle, InfoLevel,
1409                                                    AFileStatus, FileStatusLen);
1410 end;
1411 
1412 
DummyDosProtectEnumAttributenull1413 function DummyDosProtectEnumAttribute (RefType: cardinal; AFile: pointer;
1414                                   Entry: cardinal; var Buf; BufSize: cardinal;
1415                                      var Count: cardinal; InfoLevel: cardinal;
1416                                   FileHandleLockID: cardinal): cardinal; cdecl;
1417 begin
1418   DummyDosProtectEnumAttribute := DosEnumAttribute (RefType, AFile, Entry,
1419                                                Buf, BufSize, Count, InfoLevel);
1420 end;
1421 
1422 
DummyDosGetProcessorStatusnull1423 function DummyDosGetProcessorStatus (ProcID: cardinal;
1424                                         var Status: cardinal): cardinal; cdecl;
1425 begin
1426   if ProcID = 1 then
1427    begin
1428     Status := 1;
1429     DummyDosGetProcessorStatus := No_Error;
1430    end
1431   else
1432    DummyDosGetProcessorStatus := Error_Invalid_Parameter;
1433 end;
1434 
1435 
DummyDosSetProcessorStatusnull1436 function DummyDosSetProcessorStatus (ProcID: cardinal;
1437                                             Status: cardinal): cardinal; cdecl;
1438 begin
1439   DummyDosSetProcessorStatus := Error_Invalid_Parameter;
1440 end;
1441 
1442 
DummyDosQueryThreadAffinitynull1443 function DummyDosQueryThreadAffinity (Scope: cardinal;
1444                                var AffinityMask: TMPAffinity): cardinal; cdecl;
1445 begin
1446   DummyDosQueryThreadAffinity := Error_Invalid_Function;
endnull1447 end;
1448 
1449 
DummyDosSetThreadAffinitynull1450 function DummyDosSetThreadAffinity (var AffinityMask: TMPAffinity): cardinal;
1451                                                                          cdecl;
1452 begin
1453   DummyDosSetThreadAffinity := Error_Invalid_Function;
endnull1454 end;
1455 
1456 
DummyDosQueryExtLibPathnull1457 function DummyDosQueryExtLibPath (ExtLibPath: PChar;
1458                                              Flags: cardinal): cardinal; cdecl;
1459 begin
1460   if ExtLibPath <> nil then
1461    begin
1462     ExtLibPath := #0;
1463     DummyDosQueryExtLibPath := No_Error;
1464    end
1465   else
1466    DummyDosQueryExtLibPath := Error_Invalid_Parameter;
1467 end;
1468 
1469 
DummyDosSetExtLibPathnull1470 function DummyDosSetExtLibPath (ExtLibPath: PChar; Flags: cardinal): cardinal;
1471                                                                          cdecl;
1472 begin
1473   DummyDosSetExtLibPath := Error_Not_Enough_Memory;
1474 end;
1475 
1476 
DummyDosQueryModFromEIPnull1477 function DummyDosQueryModFromEIP (var HMod: THandle; var ObjNum: cardinal;
1478                          BuffLen: cardinal; Buff: PChar; var Offset: cardinal;
1479                                             Address: PtrUInt): cardinal; cdecl;
1480 begin
1481   DummyDosQueryModFromEIP := Error_Invalid_Parameter;
1482   HMod := THandle (-1);
1483   ObjNum := 0;
1484   if Buff <> nil then
1485    Buff^ := #0;
1486   Offset := 0;
1487 end;
1488 
1489 
DummyDosDumpProcessnull1490 function DummyDosDumpProcess (Flag: cardinal; Drive: cardinal;
1491                                                PID: cardinal): cardinal; cdecl;
1492 begin
1493   DummyDosDumpProcess := Error_Invalid_Function;
endnull1494 end;
1495 
1496 
DummyDosSuppressPopupsnull1497 function DummyDosSuppressPopups (Flag: cardinal; Drive: char): cardinal; cdecl;
1498 begin
1499   DummyDosSuppressPopups := Error_Invalid_Function;
endnull1500 end;
1501 
1502 
DummyDosPerfSysCallnull1503 function DummyDosPerfSysCall (Command, Parm1, Parm2,
1504                                              Parm3: cardinal): cardinal; cdecl;
1505 begin
1506   DummyDosPerfSysCall := Error_Invalid_Function;
endnull1507 end;
1508 
1509 
DummyDosQueryThreadContextnull1510 function DummyDosQueryThreadContext (TID: cardinal; Level: cardinal;
1511                                  var Context: TContextRecord): cardinal; cdecl;
1512 begin
1513   DummyDosQueryThreadContext := Error_Invalid_Function;
endnull1514 end;
1515 
1516 
DummyDosQueryABIOSSupportnull1517 function DummyDosQueryABIOSSupport (Reserved: cardinal): cardinal; cdecl;
1518 begin
1519   DummyDosQueryABIOSSupport := 0;
1520 end;
1521 
1522 
1523 
1524 type
1525   TDosProtectOpen = function (FileName: PChar; var Handle: THandle;
1526                               var Action: cardinal; InitSize, Attrib,
1527                               OpenFlags, OpenMode: cardinal; ea: PEAOp2;
1528                               var FileHandleLockID: cardinal): cardinal; cdecl;
1529 
1530   TDosProtectClose = function (Handle: THandle;
1531                                   FileHandleLockID: cardinal): cardinal; cdecl;
1532 
1533   TDosProtectRead = function (Handle: THandle; var Buffer; Count: cardinal;
1534           var ActCount: cardinal; FileHandleLockID: cardinal): cardinal; cdecl;
1535 
1536   TDosProtectWrite = function (Handle: THandle; const Buffer; Count: cardinal;
1537                                var ActCount: cardinal;
1538                                   FileHandleLockID: cardinal): cardinal; cdecl;
1539 
1540   TDosProtectSetFilePtr = function (Handle: THandle; Pos: longint;
1541                                     Method: cardinal; var PosActual: cardinal;
1542                                   FileHandleLockID: cardinal): cardinal; cdecl;
1543 
1544   TDosProtectSetFileSize = function (Handle: THandle; Size: cardinal;
1545                                   FileHandleLockID: cardinal): cardinal; cdecl;
1546 
1547   TDosProtectQueryFHState = function (Handle: THandle; var FileMode: cardinal;
1548                                   FileHandleLockID: cardinal): cardinal; cdecl;
1549 
1550   TDosProtectSetFHState = function (Handle: THandle; FileMode: cardinal;
1551                                   FileHandleLockID: cardinal): cardinal; cdecl;
1552 
1553   TDosProtectQueryFileInfo = function (Handle: THandle; InfoLevel: cardinal;
1554                             AFileStatus: PFileStatus; FileStatusLen: cardinal;
1555                                   FileHandleLockID: cardinal): cardinal; cdecl;
1556 
1557   TDosProtectSetFileInfo = function (Handle: THandle; InfoLevel: cardinal;
1558                             AFileStatus: PFileStatus; FileStatusLen: cardinal;
1559                                   FileHandleLockID: cardinal): cardinal; cdecl;
1560 
1561   TDosProtectEnumAttribute = function (RefType: cardinal; AFile: pointer;
1562                                   Entry: cardinal; var Buf; BufSize: cardinal;
1563                                   var Count: cardinal; InfoLevel: cardinal;
1564                                   FileHandleLockID: cardinal): cardinal; cdecl;
1565 
1566   TDosProtectSetFileLocks = function (Handle: THandle;
1567                                       var Unlock, Lock: TFileLock;
1568                                       Timeout, Flags: cardinal;
1569                                   FileHandleLockID: cardinal): cardinal; cdecl;
1570 
1571   TDosCancelLockRequestL = function (Handle: THandle; var Lock: TFileLockL):
1572                                                                cardinal; cdecl;
1573 
1574   TDosProtectSetFileLocksL = function (Handle: THandle; var Unlock: TFileLockL;
1575                    var Lock: TFileLockL; Timeout: cardinal; Flags: cardinal;
1576                                   FileHandleLockID: cardinal): cardinal; cdecl;
1577 
1578   TDosSetFileLocksL = function (Handle: THandle; var Unlock: TFileLockL;
1579     var Lock: TFileLockL; Timeout: cardinal; Flags: cardinal): cardinal; cdecl;
1580 
1581   TDosProtectOpenL = function (FileName: PChar; var Handle: THandle;
1582                          var Action: cardinal; InitSize: int64; Attrib,
1583                          OpenFlags, OpenMode: cardinal; EA: PEAOp2;
1584                               var FileHandleLockID: cardinal): cardinal; cdecl;
1585 
1586   TDosProtectSetFilePtrL = function (Handle: THandle; Pos: int64;
1587           Method: cardinal;
1588             var PosActual: int64; FileHandleLockID: cardinal): cardinal; cdecl;
1589 
1590   TDosProtectSetFileSizeL = function (Handle: THandle; Size: int64;
1591                                   FileHandleLockID: cardinal): cardinal; cdecl;
1592 
1593   TDosGetProcessorStatus = function (ProcID: cardinal;
1594                                         var Status: cardinal): cardinal; cdecl;
1595 
1596   TDosSetProcessorStatus = function (ProcID: cardinal;
1597                                             Status: cardinal): cardinal; cdecl;
1598 
1599   TDosQueryThreadAffinity = function (Scope: cardinal;
1600                                var AffinityMask: TMPAffinity): cardinal; cdecl;
1601 
1602   TDosSetThreadAffinity = function (var AffinityMask: TMPAffinity): cardinal;
1603                                                                          cdecl;
1604 
1605   TDosQueryExtLibPath = function (ExtLibPath: PChar;
1606                                              Flags: cardinal): cardinal; cdecl;
1607 
1608   TDosSetExtLibPath = function (ExtLibPath: PChar; Flags: cardinal): cardinal;
1609                                                                          cdecl;
1610 
1611   TDosQueryModFromEIP = function (var HMod: THandle; var ObjNum: cardinal;
1612                          BuffLen: cardinal; Buff: PChar; var Offset: cardinal;
1613                                             Address: PtrUInt): cardinal; cdecl;
1614 
1615   TDosDumpProcess = function (Flag: cardinal; Drive: cardinal;
1616                                                PID: cardinal): cardinal; cdecl;
1617 
1618   TDosSuppressPopups = function (Flag: cardinal; Drive: char): cardinal; cdecl;
1619 
1620   TDosPerfSysCall = function (Command, Parm1, Parm2,
1621                                              Parm3: cardinal): cardinal; cdecl;
1622 
1623   TDosQueryThreadContext = function (TID: cardinal; Level: cardinal;
1624                                  var Context: TContextRecord): cardinal; cdecl;
1625 
1626   TDosQueryABIOSSupport = function (Reserved: cardinal): cardinal; cdecl;
1627 
1628 
1629 
1630 const
1631   Sys_DosCancelLockRequestL: TDosCancelLockRequestL =
1632                                                    @DummyDosCancelLockRequestL;
1633   Sys_DosSetFileLocksL: TDosSetFileLocksL = @DummyDosSetFileLocksL;
1634   Sys_DosProtectSetFileLocksL: TDosProtectSetFileLocksL =
1635                                                  @DummyDosProtectSetFileLocksL;
1636   Sys_DosProtectOpenL: TDosProtectOpenL = @DummyDosProtectOpenL;
1637   Sys_DosProtectSetFilePtrL: TDosProtectSetFilePtrL =
1638                                                    @DummyDosProtectSetFilePtrL;
1639   Sys_DosProtectSetFileSizeL: TDosProtectSetFileSizeL =
1640                                                   @DummyDosProtectSetFileSizeL;
1641   Sys_DosProtectOpen: TDosProtectOpen = @DummyDosProtectOpen;
1642   Sys_DosProtectClose: TDosProtectClose = @DummyDosProtectClose;
1643   Sys_DosProtectRead: TDosProtectRead = @DummyDosProtectRead;
1644   Sys_DosProtectWrite: TDosProtectWrite = @DummyDosProtectWrite;
1645   Sys_DosProtectSetFilePtr: TDosProtectSetFilePtr = @DummyDosProtectSetFilePtr;
1646   Sys_DosProtectSetFileSize: TDosProtectSetFileSize =
1647                                                    @DummyDosProtectSetFileSize;
1648   Sys_DosProtectQueryFHState: TDosProtectQueryFHState =
1649                                                   @DummyDosProtectQueryFHState;
1650   Sys_DosProtectSetFHState: TDosProtectSetFHState = @DummyDosProtectSetFHState;
1651   Sys_DosProtectQueryFileInfo: TDosProtectQueryFileInfo =
1652                                                  @DummyDosProtectQueryFileInfo;
1653   Sys_DosProtectSetFileInfo: TDosProtectSetFileInfo =
1654                                                    @DummyDosProtectSetFileInfo;
1655   Sys_DosProtectEnumAttribute: TDosProtectEnumAttribute =
1656                                                  @DummyDosProtectEnumAttribute;
1657   Sys_DosProtectSetFileLocks: TDosProtectSetFileLocks =
1658                                                   @DummyDosProtectSetFileLocks;
1659   Sys_DosGetProcessorStatus: TDosGetProcessorStatus =
1660                                                    @DummyDosGetProcessorStatus;
1661   Sys_DosSetProcessorStatus: TDosSetProcessorStatus =
1662                                                    @DummyDosSetProcessorStatus;
1663   Sys_DosQueryThreadAffinity: TDosQueryThreadAffinity =
1664                                                   @DummyDosQueryThreadAffinity;
1665   Sys_DosSetThreadAffinity: TDosSetThreadAffinity = @DummyDosSetThreadAffinity;
1666   Sys_DosQueryExtLibPath: TDosQueryExtLibPath = @DummyDosQueryExtLibPath;
1667   Sys_DosSetExtLibPath: TDosSetExtLibPath = @DummyDosSetExtLibPath;
1668   Sys_DosQueryModFromEIP: TDosQueryModFromEIP = @DummyDosQueryModFromEIP;
1669   Sys_DosDumpProcess: TDosDumpProcess = @DummyDosDumpProcess;
1670   Sys_DosSuppressPopups: TDosSuppressPopups = @DummyDosSuppressPopups;
1671   Sys_DosPerfSysCall: TDosPerfSysCall = @DummyDosPerfSysCall;
1672   Sys_DosQueryThreadContext: TDosQueryThreadContext =
1673                                                    @DummyDosQueryThreadContext;
1674   Sys_DosQueryABIOSSupport: TDosQueryABIOSSupport = @DummyDosQueryABIOSSupport;
1675 
1676 
1677 
DosOpenLnull1678 function DosOpenL (FileName: PChar; var Handle: THandle;
1679                         var Action: cardinal; InitSize: int64;
1680                         Attrib, OpenFlags, FileMode: cardinal;
1681                                          EA: pointer): cardinal; cdecl; inline;
1682 begin
1683   DosOpenL := Sys_DosOpenL (FileName, Handle, Action, InitSize, Attrib,
1684                                                       OpenFlags, FileMode, EA);
1685 end;
1686 
1687 
DosSetFilePtrLnull1688 function DosSetFilePtrL (Handle: THandle; Pos: int64; Method: cardinal;
1689                                 var PosActual: int64): cardinal; cdecl; inline;
1690 begin
1691   DosSetFilePtrL := Sys_DosSetFilePtrL (Handle, Pos, Method, PosActual);
1692 end;
1693 
1694 
DosSetFileSizeLnull1695 function DosSetFileSizeL (Handle: THandle; Size: int64): cardinal; cdecl;
1696                                                                         inline;
1697 begin
1698   DosSetFileSizeL := Sys_DosSetFileSizeL (Handle, Size);
1699 end;
1700 
1701 
DosProtectOpennull1702 function DosProtectOpen (FileName: PChar; var Handle: THandle;
1703                               var Action: cardinal; InitSize, Attrib,
1704                               OpenFlags, OpenMode: cardinal; EA: PEAOp2;
1705                       var FileHandleLockID: cardinal): cardinal; cdecl; inline;
1706 begin
1707   DosProtectOpen := Sys_DosProtectOpen (FileName, Handle, Action, InitSize,
1708                             Attrib, OpenFlags, OpenMode, EA, FileHandleLockID);
1709 end;
1710 
1711 
DosProtectClosenull1712 function DosProtectClose (Handle: THandle;
1713                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1714 begin
1715   DosProtectClose := Sys_DosProtectClose (Handle, FileHandleLockID);
1716 end;
1717 
1718 
DosProtectReadnull1719 function DosProtectRead (Handle: THandle; var Buffer; Count: cardinal;
1720   var ActCount: cardinal; FileHandleLockID: cardinal): cardinal; cdecl; inline;
1721 begin
1722   DosProtectRead := Sys_DosProtectRead (Handle, Buffer, Count, ActCount,
1723                                                              FileHandleLockID);
1724 end;
1725 
1726 
DosProtectWritenull1727 function DosProtectWrite (Handle: THandle; const Buffer; Count: cardinal;
1728                           var ActCount: cardinal;
1729                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1730 begin
1731   DosProtectWrite := Sys_DosProtectWrite (Handle, Buffer, Count, ActCount,
1732                                                              FileHandleLockID);
1733 end;
1734 
1735 
DosProtectSetFilePtrnull1736 function DosProtectSetFilePtr (Handle: THandle; Pos: longint;
1737                                Method: cardinal; var PosActual: cardinal;
1738                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1739 begin
1740   DosProtectSetFilePtr := Sys_DosProtectSetFilePtr (Handle, Pos, Method,
1741                                                   PosActual, FileHandleLockID);
1742 end;
1743 
1744 
DosProtectSetFileSizenull1745 function DosProtectSetFileSize (Handle: THandle; Size: cardinal;
1746                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1747 begin
1748   DosProtectSetFileSize := Sys_DosProtectSetFileSize (Handle, Size,
1749                                                              FileHandleLockID);
1750 end;
1751 
1752 
DosProtectQueryFHStatenull1753 function DosProtectQueryFHState (Handle: THandle; var FileMode: cardinal;
1754                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1755 begin
1756   DosProtectQueryFHState := Sys_DosProtectQueryFHState (Handle, FileMode,
1757                                                              FileHandleLockID);
1758 end;
1759 
1760 
DosProtectSetFHStatenull1761 function DosProtectSetFHState (Handle: THandle; FileMode: cardinal;
1762                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1763 begin
1764   DosProtectSetFHState := Sys_DosProtectSetFHState (Handle, FileMode,
1765                                                              FileHandleLockID);
1766 end;
1767 
1768 
DosProtectQueryFileInfonull1769 function DosProtectQueryFileInfo (Handle: THandle; InfoLevel: cardinal;
1770                             AFileStatus: PFileStatus; FileStatusLen: cardinal;
1771                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1772 begin
1773   DosProtectQueryFileInfo := Sys_DosProtectQueryFileInfo (Handle, InfoLevel,
1774                                  AFileStatus, FileStatusLen, FileHandleLockID);
1775 end;
1776 
1777 
DosProtectSetFileInfonull1778 function DosProtectSetFileInfo (Handle: THandle; InfoLevel: cardinal;
1779                             AFileStatus: PFileStatus; FileStatusLen: cardinal;
1780                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1781 begin
1782   DosProtectSetFileInfo := Sys_DosProtectSetFileInfo (Handle, InfoLevel,
1783                                  AFileStatus, FileStatusLen, FileHandleLockID);
1784 end;
1785 
1786 
DosProtectEnumAttributenull1787 function DosProtectEnumAttribute (RefType: cardinal; AFile: pointer;
1788                                   Entry: cardinal; var Buf; BufSize: cardinal;
1789                                   var Count: cardinal; InfoLevel: cardinal;
1790                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1791 begin
1792   DosProtectEnumAttribute := Sys_DosProtectEnumAttribute (RefType, AFile,
1793                       Entry, Buf, BufSize, Count, InfoLevel, FileHandleLockID);
1794 end;
1795 
1796 
DosProtectSetFileLocksnull1797 function DosProtectSetFileLocks (Handle: THandle;
1798                                  var Unlock, Lock: TFileLock;
1799                                  Timeout, Flags: cardinal;
1800                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1801 begin
1802   DosProtectSetFileLocks := Sys_DosProtectSetFileLocks (Handle, Unlock, Lock,
1803                                              Timeout, Flags, FileHandleLockID);
1804 end;
1805 
1806 
DosProtectOpennull1807 function DosProtectOpen (FileName: PChar; var Handle: longint;
1808                          var Action: longint; InitSize, Attrib,
1809                          OpenFlags, OpenMode: longint; ea: PEAOp2;
1810                       var FileHandleLockID: cardinal): cardinal; cdecl; inline;
1811 begin
1812   DosProtectOpen := Sys_DosProtectOpen (FileName, THandle (Handle),
1813             cardinal (Action), cardinal (InitSize), cardinal (Attrib),
1814               cardinal (OpenFlags), cardinal (OpenMode), EA, FileHandleLockID);
1815 end;
1816 
1817 
DosProtectOpennull1818 function DosProtectOpen (const FileName: string; var Handle: longint;
1819                          var Action: longint; InitSize, Attrib,
1820                          OpenFlags, OpenMode: longint; ea: PEAOp2;
1821                                      var FileHandleLockID: cardinal): cardinal;
1822 var
1823   T: array [0..255] of char;
1824 begin
1825   StrPCopy (@T, FileName);
1826   DosProtectOpen := Sys_DosProtectOpen (@T, THandle (Handle),
1827          cardinal (Action), cardinal (InitSize), cardinal (Attrib),
1828               cardinal (OpenFlags), cardinal (OpenMode), EA, FileHandleLockID);
1829 end;
1830 
1831 
DosProtectOpennull1832 function DosProtectOpen (const FileName: string; var Handle: THandle;
1833                          var Action: cardinal; InitSize, Attrib,
1834                          OpenFlags, OpenMode: cardinal; ea: PEAOp2;
1835                                var FileHandleLockID: cardinal): cardinal;
1836 var
1837   T: array [0..255] of char;
1838 begin
1839   StrPCopy (@T, FileName);
1840   DosProtectOpen := Sys_DosProtectOpen (@T, Handle, Action, InitSize, Attrib,
1841                                     OpenFlags, OpenMode, EA, FileHandleLockID);
1842 end;
1843 
1844 
DosProtectReadnull1845 function DosProtectRead (Handle: longint; var Buffer; Count: longint;
1846    var ActCount: longint; FileHandleLockID: cardinal): cardinal; cdecl; inline;
1847 begin
1848   DosProtectRead := Sys_DosProtectRead (THandle (Handle), Buffer,
1849                       cardinal (Count), cardinal (ActCount), FileHandleLockID);
1850 end;
1851 
1852 
DosProtectWritenull1853 function DosProtectWrite (Handle: longint; const Buffer; Count: longint;
1854                           var ActCount: longint;
1855                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1856 begin
1857   DosProtectWrite := Sys_DosProtectWrite (THandle (Handle), Buffer,
1858                       cardinal (Count), cardinal (ActCount), FileHandleLockID);
1859 end;
1860 
1861 
DosProtectSetFilePtrnull1862 function DosProtectSetFilePtr (Handle: longint; Pos, Method: longint;
1863                                var PosActual: longint;
1864                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1865 begin
1866   DosProtectSetFilePtr := Sys_DosProtectSetFilePtr (THandle (Handle),
1867     cardinal (Pos), cardinal (Method), cardinal (PosActual), FileHandleLockID);
1868 end;
1869 
1870 
DosProtectSetFilePtrnull1871 function DosProtectSetFilePtr (Handle: THandle; Pos: longint;
1872                                          FileHandleLockID: cardinal): cardinal;
1873 var
1874   PosActual: cardinal;
1875 begin
1876   DosProtectSetFilePtr := DosProtectSetFilePtr (Handle, Pos, 0, PosActual,
1877                                                              FileHandleLockID);
1878 end;
1879 
1880 
DosProtectGetFilePtrnull1881 function DosProtectGetFilePtr (Handle: longint;
1882                  var PosActual: longint; FileHandleLockID: cardinal): cardinal;
1883 begin
1884   DosProtectGetFilePtr := DosProtectSetFilePtr (THandle (Handle), 0, 1,
1885                                        cardinal (PosActual), FileHandleLockID);
1886 end;
1887 
1888 
DosProtectGetFilePtrnull1889 function DosProtectGetFilePtr (Handle: THandle;
1890                 var PosActual: cardinal; FileHandleLockID: cardinal): cardinal;
1891 begin
1892   DosProtectGetFilePtr := DosProtectSetFilePtr (Handle, 0, 1, PosActual,
1893                                                              FileHandleLockID);
1894 end;
1895 
1896 
DosProtectEnumAttributenull1897 function DosProtectEnumAttribute (Handle: THandle; Entry: cardinal; var Buf;
1898                                   BufSize: cardinal; var Count: cardinal;
1899                                   InfoLevel: cardinal;
1900                                          FileHandleLockID: cardinal): cardinal;
1901 begin
1902     DosProtectEnumAttribute := DosProtectEnumAttribute (0, @Handle, Entry, Buf,
1903                                   BufSize, Count, InfoLevel, FileHandleLockID);
1904 end;
1905 
1906 
DosProtectEnumAttributenull1907 function DosProtectEnumAttribute (const FileName: string; Entry: cardinal;
1908                                   var Buf; BufSize: cardinal;
1909                                   var Count: cardinal; InfoLevel: cardinal;
1910                                          FileHandleLockID: cardinal): cardinal;
1911 var
1912   T: array [0..255] of char;
1913 begin
1914   StrPCopy (@T, FileName);
1915   DosProtectEnumAttribute := DosProtectEnumAttribute (1, @T, Entry, Buf,
1916                                   BufSize, Count, InfoLevel, FileHandleLockID);
1917 end;
1918 
1919 
DosCancelLockRequestLnull1920 function DosCancelLockRequestL (Handle: THandle;
1921                                 var Lock: TFileLockL): cardinal; cdecl; inline;
1922 begin
1923   DosCancelLockRequestL := Sys_DosCancelLockRequestL (Handle, Lock);
1924 end;
1925 
1926 
DosProtectSetFileLocksLnull1927 function DosProtectSetFileLocksL (Handle: THandle; var Unlock: TFileLockL;
1928                    var Lock: TFileLockL; Timeout: cardinal; Flags: cardinal;
1929                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1930 begin
1931   DosProtectSetFileLocksL := Sys_DosProtectSetFileLocksL (Handle, Unlock, Lock,
1932                                              Timeout, Flags, FileHandleLockID);
1933 end;
1934 
1935 
DosSetFileLocksLnull1936 function DosSetFileLocksL (Handle: THandle; var Unlock: TFileLockL;
1937     var Lock: TFileLockL; Timeout: cardinal; Flags: cardinal): cardinal; cdecl;
1938                                                                         inline;
1939 begin
1940   DosSetFileLocksL := Sys_DosSetFileLocksL (Handle, Unlock, Lock, Timeout,
1941                                                                         Flags);
1942 end;
1943 
1944 
DosProtectOpenLnull1945 function DosProtectOpenL (FileName: PChar; var Handle: THandle;
1946                          var Action: cardinal; InitSize: int64; Attrib,
1947                          OpenFlags, OpenMode: cardinal; EA: PEAOp2;
1948                       var FileHandleLockID: cardinal): cardinal; cdecl; inline;
1949 begin
1950   DosProtectOpenL := Sys_DosProtectOpenL (FileName, Handle, Action, InitSize,
1951                             Attrib, OpenFlags, OpenMode, EA, FileHandleLockID);
1952 end;
1953 
1954 
DosProtectSetFilePtrLnull1955 function DosProtectSetFilePtrL (Handle: THandle; Pos: int64;
1956                               Method: cardinal; var PosActual: int64;
1957                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1958 begin
1959   DosProtectSetFilePtrL := Sys_DosProtectSetFilePtrL (Handle, Pos, Method,
1960                                                   PosActual, FileHandleLockID);
1961 end;
1962 
1963 
DosProtectSetFileSizeLnull1964 function DosProtectSetFileSizeL (Handle: THandle; Size: int64;
1965                           FileHandleLockID: cardinal): cardinal; cdecl; inline;
1966 begin
1967   DosProtectSetFileSizeL := Sys_DosProtectSetFileSizeL (Handle, Size,
1968                                                              FileHandleLockID);
1969 end;
1970 
1971 
DosGetProcessorStatusnull1972 function DosGetProcessorStatus (ProcID: cardinal;
1973                                 var Status: cardinal): cardinal; cdecl; inline;
1974 begin
1975   DosGetProcessorStatus := Sys_DosGetProcessorStatus (ProcID, Status);
1976 end;
1977 
1978 
DosSetProcessorStatusnull1979 function DosSetProcessorStatus (ProcID: cardinal;
1980                                     Status: cardinal): cardinal; cdecl; inline;
1981 begin
1982   DosSetProcessorStatus := Sys_DosSetProcessorStatus (ProcID, Status);
1983 end;
1984 
1985 
DosQueryThreadAffinitynull1986 function DosQueryThreadAffinity (Scope: cardinal;
1987                        var AffinityMask: TMPAffinity): cardinal; cdecl; inline;
1988 begin
1989   DosQueryThreadAffinity := Sys_DosQueryThreadAffinity (Scope, AffinityMask);
1990 end;
1991 
1992 
DosSetThreadAffinitynull1993 function DosSetThreadAffinity (var AffinityMask: TMPAffinity): cardinal; cdecl;
1994                                                                         inline;
1995 begin
1996   DosSetThreadAffinity := Sys_DosSetThreadAffinity (AffinityMask);
1997 end;
1998 
1999 
DosQueryExtLibPathnull2000 function DosQueryExtLibPath (ExtLibPath: PChar; Flags: cardinal): cardinal;
2001                                                                  cdecl; inline;
2002 begin
2003   DosQueryExtLibPath := Sys_DosQueryExtLibPath (ExtLibPath, Flags);
2004 end;
2005 
2006 
DosSetExtLibPathnull2007 function DosSetExtLibPath (ExtLibPath: PChar; Flags: cardinal): cardinal;
2008                                                                  cdecl; inline;
2009 begin
2010   DosSetExtLibPath := Sys_DosSetExtLibPath (ExtLibPath, Flags);
2011 end;
2012 
2013 
DosQueryModFromEIPnull2014 function DosQueryModFromEIP (var HMod: THandle; var ObjNum: cardinal;
2015                          BuffLen: cardinal; Buff: PChar; var Offset: cardinal;
2016                                     Address: PtrUInt): cardinal; cdecl; inline;
2017 begin
2018   DosQueryModFromEIP := Sys_DosQueryModFromEIP (HMod, ObjNum, BuffLen, Buff,
2019                                                               Offset, Address);
2020 end;
2021 
2022 
DosDumpProcessnull2023 function DosDumpProcess (Flag: cardinal; Drive: char;
2024                                        PID: cardinal): cardinal; cdecl; inline;
2025 begin
2026   DosDumpProcess := Sys_DosDumpProcess (Flag, cardinal (Drive), PID);
2027 end;
2028 
2029 
DosSuppressPopupsnull2030 function DosSuppressPopups (Flag: cardinal;
2031                                          Drive: char): cardinal; cdecl; inline;
2032 begin
2033   DosSuppressPopups := Sys_DosSuppressPopups (Flag, Drive);
2034 end;
2035 
2036 
DosPerfSysCallnull2037 function DosPerfSysCall (Command, Parm1, Parm2,
2038                                      Parm3: cardinal): cardinal; cdecl; inline;
2039 begin
2040   DosPerfSysCall := Sys_DosPerfSysCall (Command, Parm1, Parm2, Parm3);
2041 end;
2042 
2043 
DosPerfSysCallnull2044 function DosPerfSysCall (Command, Parm1, Parm2: cardinal;
2045                                                 var HookData): cardinal; cdecl;
2046 begin
2047   DosPerfSysCall := Sys_DosPerfSysCall (Command, Parm1, Parm2,
2048                                                            PtrUInt (HookData));
2049 end;
2050 
2051 
DosPerfSysCallnull2052 function DosPerfSysCall (Command: cardinal; var CpuUtil: TCPUUtil; Parm2,
2053                                              Parm3: cardinal): cardinal; cdecl;
2054 begin
2055   DosPerfSysCall := Sys_DosPerfSysCall (Command, PtrUInt (@CPUUtil), Parm2,
2056                                                                         Parm3);
2057 end;
2058 
2059 
DosQueryThreadContextnull2060 function DosQueryThreadContext (TID: cardinal; Level: cardinal;
2061                          var Context: TContextRecord): cardinal; cdecl; inline;
2062 begin
2063   DosQueryThreadContext := Sys_DosQueryThreadContext (TID, Level, Context);
2064 end;
2065 
2066 
DosQueryABIOSSupportnull2067 function DosQueryABIOSSupport (Reserved: cardinal): cardinal; cdecl; inline;
2068 begin
2069   DosQueryABIOSSupport := Sys_DosQueryABIOSSupport (Reserved);
2070 end;
2071 
2072 
2073 var
2074   P: pointer;
2075 
2076 begin
2077   if FSApi64 then
2078   (* DosCallsHandle successfully initialized during initialization of unit *)
2079   (* System and basic 64-bit functions were loaded successfully.           *)
2080    begin
2081     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32CancelLockRequestL, nil, P)
2082                                                                        = 0 then
2083      Sys_DosCancelLockRequestL := TDosCancelLockRequestL (P);
2084     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectSetFileLocksL, nil, P)
2085                                                                        = 0 then
2086      Sys_DosProtectSetFileLocksL := TDosProtectSetFileLocksL (P);
2087     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32SetFileLocksL, nil, P)
2088                                                                        = 0 then
2089      Sys_DosSetFileLocksL := TDosSetFileLocksL (P);
2090     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectOpenL, nil, P) = 0
2091                                                                            then
2092      Sys_DosProtectOpenL := TDosProtectOpenL (P);
2093     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectSetFilePtrL, nil, P)
2094                                                                        = 0 then
2095      Sys_DosProtectSetFilePtrL := TDosProtectSetFilePtrL (P);
2096     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectSetFileSizeL, nil, P)
2097                                                                        = 0 then
2098      Sys_DosProtectSetFileSizeL := TDosProtectSetFileSizeL (P);
2099    end;
2100 
2101   if DosCallsHandle = THandle (-1) then
2102    Exit;
2103 
2104   if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectOpen, nil, P) = 0 then
2105    begin
2106     Sys_DosProtectOpen := TDosProtectOpen (P);
2107     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectClose, nil, P) = 0
2108                                                                            then
2109      Sys_DosProtectClose := TDosProtectClose (P);
2110     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectRead, nil, P) = 0 then
2111      Sys_DosProtectRead := TDosProtectRead (P);
2112     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectWrite, nil, P) = 0
2113                                                                            then
2114      Sys_DosProtectWrite := TDosProtectWrite (P);
2115     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectSetFilePtr, nil,
2116                                                                     P) = 0 then
2117      Sys_DosProtectSetFilePtr := TDosProtectSetFilePtr (P);
2118     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectSetFileSize, nil,
2119                                                                     P) = 0 then
2120      Sys_DosProtectSetFileSize := TDosProtectSetFileSize (P);
2121     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectQueryFHState, nil,
2122                                                                     P) = 0 then
2123      Sys_DosProtectQueryFHState := TDosProtectQueryFHState (P);
2124     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectSetFHState, nil,
2125                                                                     P) = 0 then
2126      Sys_DosProtectSetFHState := TDosProtectSetFHState (P);
2127     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectQueryFileInfo, nil,
2128                                                                     P) = 0 then
2129      Sys_DosProtectQueryFileInfo := TDosProtectQueryFileInfo (P);
2130     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectSetFileInfo, nil,
2131                                                                     P) = 0 then
2132      Sys_DosProtectSetFileInfo := TDosProtectSetFileInfo (P);
2133     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectEnumAttribute, nil,
2134                                                                     P) = 0 then
2135      Sys_DosProtectEnumAttribute := TDosProtectEnumAttribute (P);
2136     if DosQueryProcAddr (DosCallsHandle, Ord_Dos32ProtectSetFileLocks, nil,
2137                                                                     P) = 0 then
2138      Sys_DosProtectSetFileLocks := TDosProtectSetFileLocks (P);
2139    end;
2140 
2141    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32GetProcessorStatus, nil,
2142                                                                     P) = 0 then
2143     Sys_DosGetProcessorStatus := TDosGetProcessorStatus (P);
2144    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32SetProcessorStatus, nil,
2145                                                                     P) = 0 then
2146     Sys_DosSetProcessorStatus := TDosSetProcessorStatus (P);
2147    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32QueryThreadAffinity, nil,
2148                                                                     P) = 0 then
2149     Sys_DosQueryThreadAffinity := TDosQueryThreadAffinity (P);
2150    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32SetThreadAffinity, nil,
2151                                                                     P) = 0 then
2152     Sys_DosSetThreadAffinity := TDosSetThreadAffinity (P);
2153    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32QueryExtLibPath, nil,
2154                                                                     P) = 0 then
2155     Sys_DosQueryExtLibPath := TDosQueryExtLibPath (P);
2156    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32SetExtLibPath, nil,
2157                                                                     P) = 0 then
2158     Sys_DosSetExtLibPath := TDosSetExtLibPath (P);
2159    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32QueryModFromEIP, nil,
2160                                                                     P) = 0 then
2161     Sys_DosQueryModFromEIP := TDosQueryModFromEIP (P);
2162    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32DumpProcess, nil, P) = 0 then
2163     Sys_DosDumpProcess := TDosDumpProcess (P);
2164    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32SuppressPopups, nil,
2165                                                                     P) = 0 then
2166     Sys_DosSuppressPopups := TDosSuppressPopups (P);
2167    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32PerfSysCall, nil, P) = 0 then
2168     Sys_DosPerfSysCall := TDosPerfSysCall (P);
2169    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32QueryThreadContext, nil,
2170                                                                     P) = 0 then
2171     Sys_DosQueryThreadContext := TDosQueryThreadContext (P);
2172    if DosQueryProcAddr (DosCallsHandle, Ord_Dos32QueryABIOSSupport, nil,
2173                                                                     P) = 0 then
2174     Sys_DosQueryABIOSSupport := TDosQueryABIOSSupport (P);
2175 end.
2176 
2177 (*
2178 Todo:
2179 DosCreateSpinLock     = DOSCALLS.449 - might be simulated using semaphores on non-SMP
2180 DosAcquireSpinLock    = DOSCALLS.450 - might be simulated using semaphores on non-SMP
2181 DosReleaseSpinLock    = DOSCALLS.451 - might be simulated using semaphores on non-SMP
2182 DosFreeSpinLock       = DOSCALLS.452 - might be simulated using semaphores on non-SMP
2183 
2184 type
2185   TSpinLock = cardinal;
2186   HSpinLock = TSpinLock;
2187   PSpinLock = ^TSpinLock;
2188   PHSpinLock = PSpinLock;
2189 
2190 function DosCreateSpinLock (var SpinLock: TSpinLock): cardinal; cdecl;
2191 procedure DosAcquireSpinLock (SpinLock: TSpinLock); cdecl;
2192 procedure DosReleaseSpinLock (SpinLock: TSpinLock); cdecl;
2193 function DosFreeSpinLock (SpinLock: TSpinLock): cardinal; cdecl;
2194 
2195  DosQueryModFromEIP - may be simulated by returning empty value if not available or possibly by using data returned by DosQuerySysState (if they are equal across different OS/2 versions?)
2196 
2197 ___ function Dos16QueryModFromCS (...): ...
2198 external 'DOSCALLS' index 359;
2199 
2200 
2201  DosVerifyPidTid - may be implemented by analyzing information returned by DosQuerySysState
2202 
2203 x DosQueryExtLibPath - may be simulated by providing empty result if not available
2204 x DosSetExtLibPath - may be simulated by returning ERROR_NOT_ENOUGH_MEMORY if not available
2205 
2206   Dos32AcquireSpinLock              | DOSCALLS | SMP   | SMP
2207   Dos32FreeSpinLock                 | DOSCALLS | SMP   | SMP
2208 x  Dos32GetProcessorStatus           | DOSCALLS | SMP   | SMP
2209   Dos32ReleaseSpinLock              | DOSCALLS | SMP   | SMP
2210 x  Dos32SetProcessorStatus           | DOSCALLS | SMP   | SMP
2211   Dos32TestPSD                      | DOSCALLS | SMP   | SMP
2212 
2213 x  Dos32QueryThreadAffinity          | DOSCALLS | PROC  | 2.45
2214 (x)  Dos32QueryThreadContext           | DOSCALLS | XCPT  | 2.40
2215 x  Dos32SetThreadAffinity            | DOSCALLS | PROC  | 2.45
2216 
2217   Dos32AllocThreadLocalMemory       | DOSCALLS | PROC  | 2.30
2218   Dos32FreeThreadLocalMemory        | DOSCALLS | PROC  | 2.30
2219   Dos32ListIO                       | DOSCALLS | FILE  | 2.45
2220 x  Dos32ProtectClose                 | DOSCALLS | FILE  | 2.10
2221 x  Dos32ProtectEnumAttribute         | DOSCALLS | FILE  | 2.10
2222 x  Dos32ProtectOpen                  | DOSCALLS | FILE  | 2.10
2223 x  Dos32ProtectQueryFHState          | DOSCALLS | FILE  | 2.10
2224 x  Dos32ProtectQueryFileInfo         | DOSCALLS | FILE  | 2.10
2225 x  Dos32ProtectRead                  | DOSCALLS | FILE  | 2.10
2226 x  Dos32ProtectSetFHState            | DOSCALLS | FILE  | 2.10
2227 x  Dos32ProtectSetFileInfo           | DOSCALLS | FILE  | 2.10
2228 x  Dos32ProtectSetFileLocks          | DOSCALLS | FILE  | 2.10
2229 x  Dos32ProtectSetFilePtr            | DOSCALLS | FILE  | 2.10
2230 x  Dos32ProtectSetFileSize           | DOSCALLS | FILE  | 2.10
2231 x  Dos32ProtectWrite                 | DOSCALLS | FILE  | 2.10
2232   Dos32QueryABIOSSupport            | DOSCALLS | MOD   | 2.10
2233 (x)  Dos32QueryModFromEIP              | DOSCALLS | MOD   | 2.10
2234 (x)  Dos32SuppressPopUps               | DOSCALLS | MISC  | 2.10
2235   Dos32VerifyPidTid                 | DOSCALLS | MISC  | 2.30
2236 *)
2237