home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v1.zip / DDKX86 / H / BSEDOS.H < prev    next >
C/C++ Source or Header  |  1995-04-14  |  66KB  |  1,845 lines

  1. /*DDK*************************************************************************/
  2. /*                                                                           */
  3. /* COPYRIGHT (C) Microsoft Corporation, 1989                                 */
  4. /* COPYRIGHT    Copyright (C) 1995 IBM Corporation                           */
  5. /*                                                                           */
  6. /*    The following IBM OS/2 WARP source code is provided to you solely for  */
  7. /*    the purpose of assisting you in your development of OS/2 WARP device   */
  8. /*    drivers. You may use this code in accordance with the IBM License      */
  9. /*    Agreement provided in the IBM Device Driver Source Kit for OS/2. This  */
  10. /*    Copyright statement may not be removed.                                */
  11. /*                                                                           */
  12. /*****************************************************************************/
  13. /*static char *SCCSID = "@(#)bsedos.h   6.29 92/03/10";*/
  14. /***************************************************************************\
  15. *
  16. * Module Name: BSEDOS.H
  17. *
  18. * OS/2 Base Include File
  19. *
  20. *
  21. *****************************************************************************
  22. *
  23. * Subcomponents marked with "+" are partially included by default
  24. *
  25. *   #define:                To include:
  26. *
  27. * + INCL_DOSPROCESS         Process and thread support
  28. * + INCL_DOSFILEMGR         File Management
  29. * + INCL_DOSMEMMGR          Memory Management
  30. * + INCL_DOSSEMAPHORES      Semaphore support
  31. * + INCL_DOSDATETIME        Date/Time and Timer support
  32. *   INCL_DOSMODULEMGR       Module manager
  33. * + INCL_DOSRESOURCES       Resource support
  34. *   INCL_DOSNLS             National Language Support
  35. *   INCL_DOSEXCEPTIONS      Exceptions
  36. *   INCL_DOSMISC            Miscellaneous
  37. *   INCL_DOSMONITORS        Monitors
  38. *   INCL_DOSQUEUES          Queues
  39. *   INCL_DOSSESMGR          Session Manager Support
  40. *   INCL_DOSDEVICES         Device specific, ring 2 support
  41. *   INCL_DOSNMPIPES         Named Pipes Support
  42. *   INCL_DOSPROFILE         DosProfile API
  43. *   INCL_DOSMVDM            MVDM support
  44. *
  45. \***************************************************************************/
  46.  
  47. #define INCL_DOSINCLUDED
  48.  
  49. #ifndef INCL_BASEINCLUDED
  50. #if !(defined(INCL_32) || defined(INCL_16))
  51. #ifdef M_I386
  52.     #define INCL_32
  53. #else /* not M_I386 */
  54.     #define INCL_16
  55. #endif /* M_I386 */
  56. #endif /* INCL_32 || INCL_16 */
  57.  
  58. /* XLATOFF */
  59. #if defined(INCL_16)
  60. #pragma message ("32-bit Base API included when using 16-bit compiler")
  61. #endif /* INCL_16 */
  62. /* XLATON */
  63. #endif /* INCL_BASEINCLUDED */
  64.  
  65. #ifdef INCL_32  /* This #ifdef brackets the rest of this entire */
  66.                         /* file.  It is used to include either the      */
  67.                         /* 32-bit or 16-bit base definitions.  No       */
  68.                         /* definitions (other than 16/32-bit            */
  69.                         /* determination) must be placed above this.    */
  70.  
  71. #ifdef INCL_DOS
  72.  
  73. #define INCL_DOSPROCESS
  74. #define INCL_DOSFILEMGR
  75. #define INCL_DOSMEMMGR
  76. #define INCL_DOSSEMAPHORES
  77. #define INCL_DOSDATETIME
  78. #define INCL_DOSMODULEMGR
  79. #define INCL_DOSRESOURCES
  80. #define INCL_DOSNLS
  81. #define INCL_DOSEXCEPTIONS
  82. #define INCL_DOSMISC
  83. #define INCL_DOSMONITORS
  84. #define INCL_DOSQUEUES
  85. #define INCL_DOSSESMGR
  86. #define INCL_DOSDEVICES
  87. #define INCL_DOSNMPIPES
  88. #define INCL_DOSPROFILE
  89. #define INCL_DOSMVDM
  90.  
  91. #endif /* INCL_DOS */
  92.  
  93. #ifdef INCL_ERRORS
  94. #define INCL_DOSERRORS
  95. #endif /* INCL_ERRORS */
  96.  
  97. #if (defined(INCL_DOSPROCESS) || !defined(INCL_NOCOMMON))
  98.  
  99. /*** General services */
  100.  
  101. APIRET  APIENTRY        DosBeep(ULONG freq, ULONG dur);
  102.  
  103. /*** Process and Thread support */
  104.  
  105. VOID    APIENTRY        DosExit(ULONG action, ULONG result);
  106.  
  107. /* DosExit codes */
  108.  
  109. #define EXIT_THREAD         0
  110. #define EXIT_PROCESS        1
  111.  
  112. #endif /* common INCL_DOSPROCESS stuff */
  113.  
  114. #ifdef INCL_DOSPROCESS
  115.  
  116. /* XLATOFF */
  117. #define DosCwait        DosWaitChild
  118. #define DosSetPrty      DosSetPriority
  119. /* XLATON */
  120.  
  121. #include <bsetib.h>
  122.  
  123. typedef VOID (*PFNTHREAD)(VOID);
  124.  
  125. APIRET  APIENTRY        DosCreateThread(PTID ptid, PFNTHREAD pfn, ULONG param, ULONG flag, ULONG cbStack);
  126.  
  127. APIRET  APIENTRY        DosResumeThread(TID tid);
  128.  
  129. APIRET  APIENTRY        DosSuspendThread(TID tid);
  130.  
  131. APIRET  APIENTRY        DosGetInfoBlocks(PTIB *pptib,PPIB *pppib);
  132.  
  133. APIRET  APIENTRY        DosKillThread(TID tid);
  134.  
  135. APIRET APIENTRY DosAllocThreadLocalMemory(ULONG cb, PULONG *p);
  136. APIRET APIENTRY DosFreeThreadLocalMemory(ULONG *p);
  137.  
  138. /* Action code values */
  139.  
  140. #define DCWA_PROCESS        0
  141. #define DCWA_PROCESSTREE    1
  142.  
  143. /* Wait option values */
  144.  
  145. #define DCWW_WAIT   0
  146. #define DCWW_NOWAIT 1
  147.  
  148. /* Thread Flags for DosCreateThread options 59468 */
  149.  
  150. #define CREATE_READY        0
  151. #define CREATE_SUSPENDED    1
  152. #define STACK_SPARSE        0
  153. #define STACK_COMMITTED     2
  154.  
  155. typedef struct _RESULTCODES {     /* resc */
  156.     ULONG codeTerminate;
  157.     ULONG codeResult;
  158. } RESULTCODES;
  159. typedef RESULTCODES     *PRESULTCODES;
  160.  
  161. APIRET  APIENTRY        DosWaitChild(ULONG action, ULONG option, PRESULTCODES pres, PPID ppid, PID pid);
  162.  
  163. APIRET  APIENTRY        DosWaitThread(PTID ptid, ULONG option);
  164.  
  165. APIRET  APIENTRY        DosSleep(ULONG msec);
  166.  
  167. APIRET  APIENTRY        DosDebug(PVOID pdbgbuf);
  168.  
  169.  
  170. /* codeTerminate values (also passed to ExitList routines) */
  171.  
  172. #define TC_EXIT          0
  173. #define TC_HARDERROR     1
  174. #define TC_TRAP          2
  175. #define TC_KILLPROCESS   3
  176. #define TC_EXCEPTION     4
  177.  
  178. typedef VOID    (*PFNEXITLIST)(ULONG);
  179.  
  180. APIRET  APIENTRY        DosEnterCritSec(VOID);
  181.  
  182. APIRET  APIENTRY        DosExitCritSec(VOID);
  183.  
  184. APIRET  APIENTRY        DosExitList(ULONG ordercode, PFNEXITLIST pfn);
  185.  
  186. /* DosExitList functions */
  187.  
  188. #define EXLST_ADD       1
  189. #define EXLST_REMOVE    2
  190. #define EXLST_EXIT      3
  191.  
  192. APIRET  APIENTRY        DosExecPgm(PCHAR pObjname, LONG cbObjname, ULONG execFlag, PSZ pArg, PSZ pEnv, PRESULTCODES pRes, PSZ pName);
  193.  
  194. /* DosExecPgm functions */
  195.  
  196. #define EXEC_SYNC           0
  197. #define EXEC_ASYNC          1
  198. #define EXEC_ASYNCRESULT    2
  199. #define EXEC_TRACE          3
  200. #define EXEC_BACKGROUND     4
  201. #define EXEC_LOAD           5
  202. #define EXEC_ASYNCRESULTDB  6
  203.  
  204.  
  205. APIRET  APIENTRY        DosSetPriority(ULONG scope, ULONG class, LONG delta, ULONG PorTid);
  206.  
  207. /* Priority scopes */
  208.  
  209. #define PRTYS_PROCESS       0
  210. #define PRTYS_PROCESSTREE   1
  211. #define PRTYS_THREAD        2
  212.  
  213. /* Priority classes */
  214.  
  215. #define PRTYC_NOCHANGE      0
  216. #define PRTYC_IDLETIME      1
  217. #define PRTYC_REGULAR       2
  218. #define PRTYC_TIMECRITICAL  3
  219. #define PRTYC_FOREGROUNDSERVER  4
  220.  
  221. /* Priority deltas */
  222.  
  223. #define PRTYD_MINIMUM      -31
  224. #define PRTYD_MAXIMUM       31
  225.  
  226. APIRET  APIENTRY        DosKillProcess(ULONG action, PID pid);
  227.  
  228. #define DKP_PROCESSTREE     0
  229. #define DKP_PROCESS         1
  230.  
  231. #endif /* INCL_DOSPROCESS */
  232.  
  233. #ifndef INCL_SAADEFS
  234.  
  235. /*
  236.  * CCHMAXPATH is the maximum fully qualified path name length including
  237.  * the drive letter, colon, backslashes and terminating NULL.
  238.  */
  239. #define CCHMAXPATH      260
  240.  
  241. /*
  242.  * CCHMAXPATHCOMP is the maximum individual path component name length
  243.  * including a terminating NULL.
  244.  */
  245. #define CCHMAXPATHCOMP  256
  246.  
  247. #endif  /* !INCL_SAADEFS */
  248.  
  249. #if (defined(INCL_DOSFILEMGR) || !defined(INCL_NOCOMMON))
  250.  
  251. /*** File manager */
  252.  
  253. /* DosSetFilePtr() file position codes */
  254.  
  255. #define FILE_BEGIN      0x0000  /* Move relative to beginning of file */
  256. #define FILE_CURRENT    0x0001  /* Move relative to current fptr position */
  257. #define FILE_END        0x0002  /* Move relative to end of file */
  258.  
  259. /* DosFindFirst/Next Directory handle types */
  260.  
  261. #define HDIR_SYSTEM     1       /* Use system handle (1) */
  262. #define HDIR_CREATE     (-1)    /* Allocate a new, unused handle */
  263.  
  264. /* DosCopy control bits; may be or'ed together */
  265. #define DCPY_EXISTING   0x00001         /* Copy even if target exists */
  266. #define DCPY_APPEND     0x00002         /* Append to existing file, do not replace */
  267. #define DCPY_FAILEAS    0x00004         /* Fail if EAs not supported on target*/
  268.  
  269. /* DosOpen/DosQFHandState/DosQueryFileInfo et al file attributes; also */
  270. /* known as Dos File Mode bits... */
  271. #define FILE_NORMAL     0x0000
  272. #define FILE_READONLY   0x0001
  273. #define FILE_HIDDEN     0x0002
  274. #define FILE_SYSTEM     0x0004
  275. #define FILE_DIRECTORY  0x0010
  276. #define FILE_ARCHIVED   0x0020
  277.  
  278.  
  279. #define MUST_HAVE_READONLY      ( (FILE_READONLY  << 8) | FILE_READONLY  )
  280. #define MUST_HAVE_HIDDEN        ( (FILE_HIDDEN    << 8) | FILE_HIDDEN    )
  281. #define MUST_HAVE_SYSTEM        ( (FILE_SYSTEM    << 8) | FILE_SYSTEM    )
  282. #define MUST_HAVE_DIRECTORY     ( (FILE_DIRECTORY << 8) | FILE_DIRECTORY )
  283. #define MUST_HAVE_ARCHIVED      ( (FILE_ARCHIVED  << 8) | FILE_ARCHIVED  )
  284.  
  285. /* DosOpen() actions */
  286.  
  287. #define FILE_EXISTED    0x0001
  288. #define FILE_CREATED    0x0002
  289. #define FILE_TRUNCATED  0x0003
  290.  
  291. /* DosOpen() open flags */
  292. #define FILE_OPEN                  0x0001
  293. #define FILE_TRUNCATE              0x0002
  294. #define FILE_CREATE                0x0010
  295.  
  296. /*     this nibble applies if file already exists                xxxx */
  297.  
  298. #define OPEN_ACTION_FAIL_IF_EXISTS     0x0000  /* ---- ---- ---- 0000 */
  299. #define OPEN_ACTION_OPEN_IF_EXISTS     0x0001  /* ---- ---- ---- 0001 */
  300. #define OPEN_ACTION_REPLACE_IF_EXISTS  0x0002  /* ---- ---- ---- 0010 */
  301.  
  302. /*     this nibble applies if file does not exist           xxxx      */
  303.  
  304. #define OPEN_ACTION_FAIL_IF_NEW        0x0000  /* ---- ---- 0000 ---- */
  305. #define OPEN_ACTION_CREATE_IF_NEW      0x0010  /* ---- ---- 0001 ---- */
  306.  
  307. /* DosOpen/DosSetFHandState flags */
  308.  
  309. #define OPEN_ACCESS_READONLY        0x0000  /* ---- ---- ---- -000 */
  310. #define OPEN_ACCESS_WRITEONLY       0x0001  /* ---- ---- ---- -001 */
  311. #define OPEN_ACCESS_READWRITE       0x0002  /* ---- ---- ---- -010 */
  312. #define OPEN_SHARE_DENYREADWRITE    0x0010  /* ---- ---- -001 ---- */
  313. #define OPEN_SHARE_DENYWRITE        0x0020  /* ---- ---- -010 ---- */
  314. #define OPEN_SHARE_DENYREAD         0x0030  /* ---- ---- -011 ---- */
  315. #define OPEN_SHARE_DENYNONE         0x0040  /* ---- ---- -100 ---- */
  316. #define OPEN_FLAGS_NOINHERIT        0x0080  /* ---- ---- 1--- ---- */
  317. #define OPEN_FLAGS_NO_LOCALITY      0x0000  /* ---- -000 ---- ---- */
  318. #define OPEN_FLAGS_SEQUENTIAL       0x0100  /* ---- -001 ---- ---- */
  319. #define OPEN_FLAGS_RANDOM           0x0200  /* ---- -010 ---- ---- */
  320. #define OPEN_FLAGS_RANDOMSEQUENTIAL 0x0300  /* ---- -011 ---- ---- */
  321. #define OPEN_FLAGS_NO_CACHE         0x1000  /* ---1 ---- ---- ---- */
  322. #define OPEN_FLAGS_FAIL_ON_ERROR    0x2000  /* --1- ---- ---- ---- */
  323. #define OPEN_FLAGS_WRITE_THROUGH    0x4000  /* -1-- ---- ---- ---- */
  324. #define OPEN_FLAGS_DASD             0x8000  /* 1--- ---- ---- ---- */
  325. #define OPEN_FLAGS_NONSPOOLED       0x00040000
  326. #define OPEN_FLAGS_PROTECTED_HANDLE 0x40000000
  327.  
  328.  
  329. /* DosSearchPath() constants */
  330.  
  331. #define SEARCH_PATH            0x0000
  332. #define SEARCH_CUR_DIRECTORY   0x0001
  333. #define SEARCH_ENVIRONMENT     0x0002
  334. #define SEARCH_IGNORENETERRS   0x0004
  335.  
  336.  
  337. /************************************************************
  338. EA Info Levels & Find First/Next
  339. =========================================
  340. API's: DosFindFirst, DosQueryFileInfo, DosQueryPathInfo, DosSetFileInfo,
  341.        DosSetPathInfo
  342. ************************************************************/
  343.  
  344. /* File info levels&gml All listed API's */
  345. #define FIL_STANDARD            1       /* Info level 1, standard file info */
  346. #define FIL_QUERYEASIZE         2       /* Level 2, return Full EA size */
  347. #define FIL_QUERYEASFROMLIST    3       /* Level 3, return requested EA's */
  348.  
  349. /* File info levels: Dos...PathInfo only */
  350. #define FIL_QUERYFULLNAME       5       /* Level 5, return fully qualified
  351.                                            name of file */
  352. /* DosFsAttach() */
  353. /* Attact or detach */
  354. #define FS_ATTACH       0       /* Attach file server */
  355. #define FS_DETACH       1       /* Detach file server */
  356. #define FS_SPOOLATTACH  2       /* Register a spooler device */
  357. #define FS_SPOOLDETACH  3       /* De-register a spooler device */
  358.  
  359.  
  360. /* DosFsCtl() */
  361. /* Routing type */
  362. #define FSCTL_HANDLE    1       /* File Handle directs req routing */
  363. #define FSCTL_PATHNAME  2       /* Path Name directs req routing */
  364. #define FSCTL_FSDNAME   3       /* FSD Name directs req routing */
  365.  
  366. /* defined FSCTL functions */
  367. #define FSCTL_ERROR_INFO        1       /* return error info from FSD */
  368. #define FSCTL_MAX_EASIZE        2       /* Max ea size for the FSD */
  369.  
  370. typedef struct  _EASIZEBUF {    /* struct for FSCTL fn 2 - max ea size */
  371.         USHORT  cbMaxEASize;    /* max. size of one EA */
  372.         ULONG   cbMaxEAListSize;        /* max size of the full EA List */
  373. } EASIZEBUF;
  374. typedef EASIZEBUF FAR * PEASIZEBUF;
  375.  
  376.  
  377. /* DosQueryFSAttach() */
  378. /* Information level types (defines method of query) */
  379. #define FSAIL_QUERYNAME 1       /* Return data for a Drive or Device */
  380. #define FSAIL_DEVNUMBER 2       /* Return data for Ordinal Device # */
  381. #define FSAIL_DRVNUMBER 3       /* Return data for Ordinal Drive # */
  382.  
  383. /* Item types (from data structure item "iType") */
  384. #define FSAT_CHARDEV    1       /* Resident character device */
  385. #define FSAT_PSEUDODEV  2       /* Pseudo-character device */
  386. #define FSAT_LOCALDRV   3       /* Local drive */
  387. #define FSAT_REMOTEDRV  4       /* Remote drive attached to FSD */
  388.  
  389.  
  390. typedef struct  _FSQBUFFER {    /* fsqbuf Data structure for QFSAttach*/
  391.     USHORT      iType;          /* Item type */
  392.     USHORT      cbName;         /* Length of item name, sans NULL */
  393.     UCHAR       szName[1];      /* ASCIIZ item name */
  394.     USHORT      cbFSDName;      /* Length of FSD name, sans NULL */
  395.     UCHAR       szFSDName[1];   /* ASCIIZ FSD name */
  396.     USHORT      cbFSAData;      /* Length of FSD Attach data returned */
  397.     UCHAR       rgFSAData[1];   /* FSD Attach data from FSD */
  398. } FSQBUFFER;
  399. typedef FSQBUFFER FAR *PFSQBUFFER;
  400.  
  401.  
  402. typedef struct _FSQBUFFER2 {    /* fsqbuf Data structure for QFSAttach*/
  403.     USHORT  iType;
  404.     USHORT  cbName;
  405.     USHORT  cbFSDName;
  406.     USHORT  cbFSAData;
  407.     UCHAR   szName[1];
  408.     UCHAR   szFSDName[1];
  409.     UCHAR   rgFSAData[1];
  410. } FSQBUFFER2;
  411.  
  412. typedef FSQBUFFER2 FAR * PFSQBUFFER2;
  413.  
  414. typedef struct _SPOOLATTACH {   /* Data structure for spooler operations */
  415.     USHORT      hNmPipe;        /* Named pipe handle                     */
  416.     ULONG       ulKey;          /* Attached key                          */
  417. } SPOOLATTACH;
  418. typedef SPOOLATTACH FAR *PSPOOLATTACH;
  419.  
  420. /***********
  421. File System Drive Information&gml DosQueryFSInfo DosSetFSInfo
  422. ***********/
  423.  
  424. /* FS Drive Info Levels */
  425. #define FSIL_ALLOC      1       /* Drive allocation info (Query only) */
  426. #define FSIL_VOLSER     2       /* Drive Volum/Serial info */
  427.  
  428. /* DosQueryFHType() */
  429. /* Handle classes (low 8 bits of Handle Type) */
  430. #define FHT_DISKFILE    0x0000          /* Disk file handle */
  431. #define FHT_CHRDEV      0x0001          /* Character device handle */
  432. #define FHT_PIPE        0x0002          /* Pipe handle */
  433.  
  434. /* Handle bits (high 8 bits of Handle Type) */
  435. #define FHB_DSKREMOTE           0x8000  /* Remote disk */
  436. #define FHB_CHRDEVREMOTE        0x8000  /* Remote character device */
  437. #define FHB_PIPEREMOTE          0x8000  /* Remote pipe */
  438.  
  439. #ifndef INCL_SAADEFS
  440.  
  441. /* File time and date types */
  442.  
  443. typedef struct _FTIME {         /* ftime */
  444.     USHORT twosecs : 5;
  445.     USHORT minutes : 6;
  446.     USHORT hours   : 5;
  447. } FTIME;
  448. typedef FTIME   *PFTIME;
  449.  
  450. typedef struct _FDATE {         /* fdate */
  451.     USHORT day     : 5;
  452.     USHORT month   : 4;
  453.     USHORT year    : 7;
  454. } FDATE;
  455. typedef FDATE   *PFDATE;
  456.  
  457. #endif /* INCL_SAADEFS */
  458.  
  459. typedef struct _VOLUMELABEL {    /* vol */
  460.     BYTE cch;
  461.     CHAR szVolLabel[12];
  462. } VOLUMELABEL;
  463. typedef VOLUMELABEL FAR *PVOLUMELABEL;
  464.  
  465. typedef struct _FSINFO {    /* fsinf */
  466.     ULONG ulVSN;
  467.     VOLUMELABEL vol;
  468. } FSINFO;
  469. typedef FSINFO FAR *PFSINFO;
  470.  
  471. /* HANDTYPE values */
  472.  
  473. #define HANDTYPE_FILE     0x0000
  474. #define HANDTYPE_DEVICE   0x0001
  475. #define HANDTYPE_PIPE     0x0002
  476. #define HANDTYPE_PROTECTED 0x4000
  477. #define HANDTYPE_NETWORK  0x8000
  478.  
  479. typedef struct _FILELOCK {    /* flock */
  480.     LONG lOffset;
  481.     LONG lRange;
  482. } FILELOCK;
  483. typedef FILELOCK FAR *PFILELOCK;
  484.  
  485. typedef SHANDLE HFILE;     /* hf */
  486. typedef HFILE   *PHFILE;
  487.  
  488. typedef  ULONG    HEV;             /* hev */
  489. typedef  HEV      *PHEV;
  490. typedef  ULONG  FHLOCK;
  491. typedef  PULONG  PFHLOCK;
  492.  
  493. APIRET  APIENTRY        DosSetFileLocks(HFILE hFile, PFILELOCK pflUnlock, PFILELOCK pflLock, ULONG timeout, ULONG flags);
  494. APIRET  APIENTRY        DosProtectSetFileLocks(HFILE hFile,
  495.                                                PFILELOCK pflUnlock,
  496.                                                PFILELOCK pflLock,
  497.                                                ULONG timeout, ULONG flags,
  498.                                                FHLOCK fhFileHandleLockID);
  499.  
  500. APIRET  APIENTRY        DosCancelLockRequest(HFILE hFile, PFILELOCK pflLock);
  501.  
  502. #ifndef INCL_SAADEFS
  503.  
  504. typedef struct _FILEFINDBUF {   /* findbuf */
  505.     FDATE  fdateCreation;
  506.     FTIME  ftimeCreation;
  507.     FDATE  fdateLastAccess;
  508.     FTIME  ftimeLastAccess;
  509.     FDATE  fdateLastWrite;
  510.     FTIME  ftimeLastWrite;
  511.     ULONG  cbFile;
  512.     ULONG  cbFileAlloc;
  513.     USHORT attrFile;
  514.     UCHAR  cchName;
  515.     CHAR   achName[CCHMAXPATHCOMP];
  516. } FILEFINDBUF;
  517. typedef FILEFINDBUF     *PFILEFINDBUF;
  518.  
  519. /* XLATOFF */
  520. #pragma pack(2)
  521. /* XLATON */
  522.  
  523. typedef struct _FILEFINDBUF2 {  /* findbuf2 */
  524.     FDATE  fdateCreation;
  525.     FTIME  ftimeCreation;
  526.     FDATE  fdateLastAccess;
  527.     FTIME  ftimeLastAccess;
  528.     FDATE  fdateLastWrite;
  529.     FTIME  ftimeLastWrite;
  530.     ULONG  cbFile;
  531.     ULONG  cbFileAlloc;
  532.     USHORT attrFile;
  533.     ULONG  cbList;
  534.     UCHAR  cchName;
  535.     CHAR   achName[CCHMAXPATHCOMP];
  536. } FILEFINDBUF2;
  537. typedef FILEFINDBUF2    *PFILEFINDBUF2;
  538.  
  539. /* XLATOFF */
  540. #pragma pack()
  541. /* XLATON */
  542.  
  543. typedef struct _FILEFINDBUF3 {   /* findbuf3 */
  544.     ULONG   oNextEntryOffset;                   /* new field */
  545.     FDATE   fdateCreation;
  546.     FTIME   ftimeCreation;
  547.     FDATE   fdateLastAccess;
  548.     FTIME   ftimeLastAccess;
  549.     FDATE   fdateLastWrite;
  550.     FTIME   ftimeLastWrite;
  551.     ULONG   cbFile;
  552.     ULONG   cbFileAlloc;
  553.     ULONG   attrFile;                           /* widened field */
  554.     UCHAR   cchName;
  555.     CHAR    achName[CCHMAXPATHCOMP];
  556. } FILEFINDBUF3;
  557. typedef FILEFINDBUF3    *PFILEFINDBUF3;
  558.  
  559. typedef struct _FILEFINDBUF4 {   /* findbuf4 */
  560.     ULONG   oNextEntryOffset;                   /* new field */
  561.     FDATE   fdateCreation;
  562.     FTIME   ftimeCreation;
  563.     FDATE   fdateLastAccess;
  564.     FTIME   ftimeLastAccess;
  565.     FDATE   fdateLastWrite;
  566.     FTIME   ftimeLastWrite;
  567.     ULONG   cbFile;
  568.     ULONG   cbFileAlloc;
  569.     ULONG   attrFile;                           /* widened field */
  570.     ULONG   cbList;
  571.     UCHAR   cchName;
  572.     CHAR    achName[CCHMAXPATHCOMP];
  573. } FILEFINDBUF4;
  574. typedef FILEFINDBUF4    *PFILEFINDBUF4;
  575.  
  576. /* extended attribute structures */
  577.  
  578. typedef struct _GEA {       /* gea */
  579.     BYTE cbName;            /* name length not including NULL */
  580.     CHAR szName[1];         /* attribute name */
  581. } GEA;
  582. typedef GEA     *PGEA;
  583.  
  584. typedef struct _GEALIST {   /* geal */
  585.     ULONG cbList;           /* total bytes of structure including full list */
  586.     GEA list[1];            /* variable length GEA structures */
  587. } GEALIST;
  588. typedef GEALIST* PGEALIST;
  589.  
  590. typedef struct _FEA {       /* fea */
  591.     BYTE fEA;               /* flags                              */
  592.     BYTE cbName;            /* name length not including NULL */
  593.     USHORT cbValue;         /* value length */
  594. } FEA;
  595. typedef FEA     *PFEA;
  596.  
  597. /* flags for _FEA.fEA */
  598.  
  599. #define FEA_NEEDEA 0x80     /* need EA bit */
  600.  
  601. typedef struct _FEALIST {   /* feal */
  602.     ULONG cbList;           /* total bytes of structure including full list */
  603.     FEA list[1];            /* variable length FEA structures */
  604. } FEALIST;
  605. typedef FEALIST* PFEALIST;
  606.  
  607. typedef struct _EAOP {      /* eaop */
  608.     PGEALIST fpGEAList;     /* general EA list */
  609.     PFEALIST fpFEAList;     /* full EA list */
  610.     ULONG oError;
  611. } EAOP;
  612. typedef EAOP* PEAOP;
  613.  
  614.  
  615. /* XLATOFF */
  616. #pragma pack(1)
  617. /* XLATON */
  618.  
  619. typedef struct _FEA2 {      /* fea2 */
  620.     ULONG   oNextEntryOffset;                   /* new field */
  621.     BYTE    fEA;
  622.     BYTE    cbName;
  623.     USHORT  cbValue;
  624.     CHAR    szName[1];                          /* new field */
  625. } FEA2;
  626.  
  627. typedef FEA2 *PFEA2;
  628.  
  629. /* flags for _FEA.fEA */
  630.  
  631. #define FEA_NEEDEA 0x80     /* need EA bit */
  632.  
  633. typedef struct _FEA2LIST {    /* fea2l */
  634.     ULONG   cbList;
  635.     FEA2    list[1];
  636. } FEA2LIST;
  637.  
  638. typedef FEA2LIST *PFEA2LIST;
  639.  
  640. typedef struct _GEA2 {        /* gea2 */
  641.     ULONG   oNextEntryOffset;                   /* new field */
  642.     BYTE    cbName;
  643.     CHAR    szName[1];                          /* new field */
  644. } GEA2;
  645.  
  646. typedef GEA2 *PGEA2;
  647.  
  648. typedef struct _GEA2LIST {    /* gea2l */
  649.     ULONG   cbList;
  650.     GEA2    list[1];
  651. } GEA2LIST;
  652.  
  653. typedef GEA2LIST *PGEA2LIST;
  654.  
  655. typedef struct _EAOP2 {      /* eaop2 */
  656.     PGEA2LIST   fpGEA2List;                     /* GEA set */
  657.     PFEA2LIST   fpFEA2List;                     /* FEA set */
  658.     ULONG       oError;                         /* offset of FEA error */
  659. } EAOP2;
  660.  
  661. typedef EAOP2 *PEAOP2;
  662.  
  663. /* XLATOFF */
  664. #pragma pack()
  665. /* XLATON */
  666.  
  667. /*
  668.  * Equates for the types of EAs that follow the convention that we have
  669.  * established.
  670.  *
  671.  * Values 0xFFFE thru 0x8000 are reserved.
  672.  * Values 0x0000 thru 0x7fff are user definable.
  673.  * Value  0xFFFC is not used
  674.  */
  675.  
  676. #define EAT_BINARY      0xFFFE          /* length preceeded binary */
  677. #define EAT_ASCII       0xFFFD          /* length preceeded ASCII */
  678. #define EAT_BITMAP      0xFFFB          /* length preceeded bitmap */
  679. #define EAT_METAFILE    0xFFFA          /* length preceeded metafile */
  680. #define EAT_ICON        0xFFF9          /* length preceeded icon */
  681. #define EAT_EA          0xFFEE          /* length preceeded ASCII */
  682.                                         /* name of associated data (#include) */
  683. #define EAT_MVMT        0xFFDF          /* multi-valued, multi-typed field */
  684. #define EAT_MVST        0xFFDE          /* multi-valued, single-typed field */
  685. #define EAT_ASN1        0xFFDD          /* ASN.1 field */
  686.  
  687. /* XLATOFF */
  688. #pragma pack(1)
  689. /* XLATON */
  690.  
  691. typedef struct _CNPATH {      /* CHANGENOTIFYPATH */
  692.     ULONG   oNextEntryOffset;
  693.     ULONG   wFlags;
  694.     USHORT  cbName;
  695.     CHAR    szName[1];
  696. } CNPATH;
  697.  
  698. typedef CNPATH *PCNPATH;
  699.  
  700. typedef struct _CNINFO {      /* CHANGENOTIFYINFO */
  701.     ULONG   oNextEntryOffset;
  702.     CHAR    bAction;
  703.     USHORT  cbName;
  704.     CHAR    szName[1];
  705. } CNINFO;
  706.  
  707. typedef CNINFO *PCNINFO;
  708.  
  709. /* XLATOFF */
  710. #pragma pack()
  711. /* XLATON */
  712.  
  713. /*
  714.  *  Equates for ChangeNotifyInfo baction field
  715.  *
  716.  */
  717.  
  718. #define             RCNF_FILE_ADDED        0x0001
  719. #define             RCNF_FILE_DELETED      0x0002
  720. #define             RCNF_DIR_ADDED         0x0003
  721. #define             RCNF_DIR_DELETED       0x0004
  722. #define             RCNF_MOVED_IN          0x0005
  723. #define             RCNF_MOVED_OUT         0x0006
  724. #define             RCNF_CHANGED           0x0007
  725. #define             RCNF_OLDNAME           0x0008
  726. #define             RCNF_NEWNAME           0x0009
  727. #define             RCNF_DEVICE_ATTACHED   0x000A
  728. #define             RCNF_DEVICE_DETACHED   0x000B
  729.  
  730. #endif  /* !INCL_SAADEFS */
  731.  
  732. APIRET  APIENTRY        DosOpen(PSZ pszFileName, PHFILE phf, PULONG pulAction, ULONG cbFile, ULONG ulAttribute, ULONG fsOpenFlags, ULONG fsOpenMode, PEAOP2 peaop2 );
  733. APIRET  APIENTRY        DosProtectOpen(PSZ pszFileName, PHFILE phf,
  734.                                        PULONG pulAction, ULONG cbFile,
  735.                                        ULONG ulAttribute, ULONG fsOpenFlags,
  736.                                        ULONG fsOpenMode, PEAOP2 peaop2,
  737.                                        PFHLOCK pfhFileHandleLockID);
  738.  
  739. APIRET  APIENTRY        DosClose(HFILE hFile);
  740. APIRET  APIENTRY        DosProtectClose(HFILE hFile, FHLOCK fhFileHandleLockID);
  741.  
  742. APIRET  APIENTRY        DosRead(HFILE hFile, PVOID pBuffer, ULONG cbRead, PULONG pcbActual);
  743. APIRET  APIENTRY        DosProtectRead(HFILE hFile, PVOID pBuffer,
  744.                                        ULONG cbRead, PULONG pcbActual,
  745.                                        FHLOCK fhFileHandleLockID);
  746.  
  747. APIRET  APIENTRY        DosWrite(HFILE hFile, PVOID pBuffer, ULONG cbWrite, PULONG pcbActual);
  748. APIRET  APIENTRY        DosProtectWrite(HFILE hFile, PVOID pBuffer,
  749.                                         ULONG cbWrite, PULONG pcbActual,
  750.                                         FHLOCK fhFileHandleLockID);
  751.  
  752. /* File time and date types */
  753.  
  754. typedef struct _FILESTATUS {    /* fsts */
  755.     FDATE  fdateCreation;
  756.     FTIME  ftimeCreation;
  757.     FDATE  fdateLastAccess;
  758.     FTIME  ftimeLastAccess;
  759.     FDATE  fdateLastWrite;
  760.     FTIME  ftimeLastWrite;
  761.     ULONG  cbFile;
  762.     ULONG  cbFileAlloc;
  763.     USHORT attrFile;
  764. } FILESTATUS;
  765. typedef FILESTATUS      *PFILESTATUS;
  766.  
  767. typedef struct _FILESTATUS2 {   /* fsts2 */
  768.     FDATE  fdateCreation;
  769.     FTIME  ftimeCreation;
  770.     FDATE  fdateLastAccess;
  771.     FTIME  ftimeLastAccess;
  772.     FDATE  fdateLastWrite;
  773.     FTIME  ftimeLastWrite;
  774.     ULONG  cbFile;
  775.     ULONG  cbFileAlloc;
  776.     USHORT attrFile;
  777.     ULONG  cbList;
  778. } FILESTATUS2;
  779. typedef FILESTATUS2     *PFILESTATUS2;
  780.  
  781.  
  782. typedef struct _FILESTATUS3 {   /* fsts3 */
  783.     FDATE  fdateCreation;
  784.     FTIME  ftimeCreation;
  785.     FDATE  fdateLastAccess;
  786.     FTIME  ftimeLastAccess;
  787.     FDATE  fdateLastWrite;
  788.     FTIME  ftimeLastWrite;
  789.     ULONG  cbFile;
  790.     ULONG  cbFileAlloc;
  791.     ULONG  attrFile;
  792. } FILESTATUS3;
  793. typedef FILESTATUS3     *PFILESTATUS3;
  794.  
  795. typedef struct _FILESTATUS4 {    /* fsts4 */
  796.     FDATE  fdateCreation;
  797.     FTIME  ftimeCreation;
  798.     FDATE  fdateLastAccess;
  799.     FTIME  ftimeLastAccess;
  800.     FDATE  fdateLastWrite;
  801.     FTIME  ftimeLastWrite;
  802.     ULONG  cbFile;
  803.     ULONG  cbFileAlloc;
  804.     ULONG  attrFile;
  805.     ULONG  cbList;
  806. } FILESTATUS4;
  807. typedef FILESTATUS4     *PFILESTATUS4;
  808.  
  809.  
  810. typedef struct _FSALLOCATE {    /* fsalloc */
  811.     ULONG  idFileSystem;
  812.     ULONG  cSectorUnit;
  813.     ULONG  cUnit;
  814.     ULONG  cUnitAvail;
  815.     USHORT cbSector;
  816. } FSALLOCATE;
  817. typedef FSALLOCATE      *PFSALLOCATE;
  818.  
  819. typedef SHANDLE HDIR;        /* hdir */
  820. typedef HDIR    *PHDIR;
  821.  
  822. /* XLATOFF */
  823. #define DosOpen2        DosOpen
  824. #define DosFindFirst2   DosFindFirst
  825. #define DosQFHandState  DosQueryFHState
  826. #define DosProtectQFHandState  DosProtectQueryFHState
  827. #define DosSetFHandState        DosSetFHState
  828. #define DosProtectSetFHandState        DosProtectSetFHState
  829. #define DosQHandType    DosQueryHType
  830. #define DosQFSAttach    DosQueryFSAttach
  831. #define DosNewSize      DosSetFileSize
  832. #define DosProtectNewSize      DosProtectSetFileSize
  833. #define DosBufReset     DosResetBuffer
  834. #define DosChgFilePtr   DosSetFilePtr
  835. #define DosProtectChgFilePtr   DosProtectSetFilePtr
  836. #define DosMkDir        DosCreateDir
  837. #define DosMkDir2       DosCreateDir
  838. #define DosRmDir        DosDeleteDir
  839. #define DosSelectDisk   DosSetDefaultDisk
  840. #define DosQCurDisk     DosQueryCurrentDisk
  841. #define DosChDir        DosSetCurrentDir
  842. #define DosQCurDir      DosQueryCurrentDir
  843. #define DosQFSInfo      DosQueryFSInfo
  844. #define DosQVerify      DosQueryVerify
  845. #define DosQFileInfo    DosQueryFileInfo
  846. #define DosProtectQFileInfo    DosProtectQueryFileInfo
  847. #define DosQPathInfo    DosQueryPathInfo
  848. /* XLATON */
  849.  
  850. APIRET  APIENTRY DosOpenChangeNotify(PCNPATH PathBuf, ULONG LogSize, PHDIR hdir,
  851.                                      ULONG ulReserved);
  852. APIRET  APIENTRY DosResetChangeNotify(PCNINFO LogBuf, ULONG BufferSize,
  853.                                       PULONG LogCount, HDIR hdir);
  854. APIRET  APIENTRY DosCloseChangeNotify(HDIR hdir);
  855.  
  856. APIRET  APIENTRY        DosDelete(PSZ pszFile);
  857.  
  858. APIRET  APIENTRY        DosForceDelete(PSZ pszFile);
  859.  
  860. APIRET  APIENTRY        DosDupHandle(HFILE hFile, PHFILE pHfile);
  861.  
  862. APIRET  APIENTRY        DosQueryFHState(HFILE hFile, PULONG pMode);
  863. APIRET  APIENTRY        DosProtectQueryFHState(HFILE hFile, PULONG pMode,
  864.                                                FHLOCK fhFileHandleLockID);
  865.  
  866. APIRET  APIENTRY        DosSetFHState(HFILE hFile, ULONG mode);
  867. APIRET  APIENTRY        DosProtectSetFHState(HFILE hFile, ULONG mode,
  868.                                              FHLOCK fhFileHandleLockID);
  869.  
  870. APIRET  APIENTRY        DosQueryHType(HFILE hFile, PULONG pType, PULONG pAttr);
  871.  
  872. APIRET  APIENTRY        DosFindFirst(PSZ pszFileSpec, PHDIR phdir, ULONG flAttribute, PVOID pfindbuf, ULONG cbBuf, PULONG pcFileNames, ULONG ulInfoLevel );
  873.  
  874. APIRET  APIENTRY        DosFindNext(HDIR hdir, PVOID pfindbuf, ULONG cbfindbuf, PULONG pcFilenames );
  875.  
  876. APIRET  APIENTRY        DosFindClose(HDIR hDir);
  877.  
  878. APIRET  APIENTRY        DosFSAttach(PSZ pszDevice, PSZ pszFilesystem, PVOID pData, ULONG cbData, ULONG flag);
  879.  
  880. APIRET  APIENTRY        DosQueryFSAttach(PSZ pszDeviceName, ULONG ulOrdinal, ULONG ulFSAInfoLevel, PFSQBUFFER2 pfsqb, PULONG pcbBuffLength );
  881.  
  882. APIRET  APIENTRY        DosFSCtl(PVOID pData, ULONG cbData, PULONG pcbData, PVOID pParms, ULONG cbParms, PULONG pcbParms, ULONG function, PSZ pszRoute, HFILE hFile, ULONG method);
  883.  
  884. APIRET  APIENTRY        DosSetFileSize(HFILE hFile, ULONG cbSize);
  885. APIRET  APIENTRY        DosProtectSetFileSize(HFILE hFile, ULONG cbSize,
  886.                                               FHLOCK fhFileHandleLockID);
  887.  
  888. APIRET  APIENTRY        DosResetBuffer(HFILE hFile);
  889.  
  890. APIRET  APIENTRY        DosSetFilePtr(HFILE hFile, LONG ib, ULONG method, PULONG ibActual);
  891. APIRET  APIENTRY        DosProtectSetFilePtr(HFILE hFile, LONG ib,
  892.                                              ULONG method, PULONG ibActual,
  893.                                              FHLOCK fhFileHandleLockID);
  894.  
  895. APIRET  APIENTRY        DosMove(PSZ pszOld, PSZ pszNew);
  896.  
  897. APIRET  APIENTRY        DosCopy(PSZ pszOld, PSZ pszNew, ULONG option);
  898.  
  899. APIRET  APIENTRY        DosEditName(ULONG metalevel, PSZ pszSource, PSZ pszEdit, PBYTE pszTarget, ULONG cbTarget);
  900.  
  901. APIRET  APIENTRY        DosCreateDir(PSZ pszDirName, PEAOP2 peaop2 );
  902.  
  903. APIRET  APIENTRY        DosDeleteDir(PSZ pszDir);
  904.  
  905. APIRET  APIENTRY        DosSetDefaultDisk(ULONG disknum);
  906.  
  907. APIRET  APIENTRY        DosQueryCurrentDisk(PULONG pdisknum, PULONG plogical);
  908.  
  909. APIRET  APIENTRY        DosSetCurrentDir(PSZ pszDir);
  910.  
  911. APIRET  APIENTRY        DosQueryCurrentDir(ULONG disknum, PBYTE pBuf, PULONG pcbBuf);
  912.  
  913. APIRET  APIENTRY        DosQueryFSInfo(ULONG disknum, ULONG infolevel, PVOID pBuf, ULONG cbBuf);
  914.  
  915. APIRET  APIENTRY        DosSetFSInfo(ULONG disknum, ULONG infolevel, PVOID pBuf, ULONG cbBuf);
  916.  
  917. APIRET  APIENTRY        DosQueryVerify(PBOOL32 pBool);
  918.  
  919. APIRET  APIENTRY        DosSetVerify(BOOL32);
  920.  
  921. APIRET  APIENTRY        DosSetMaxFH(ULONG cFH);
  922.  
  923. APIRET  APIENTRY        DosSetRelMaxFH(PLONG pcbReqCount, PULONG pcbCurMaxFH);
  924.  
  925. APIRET  APIENTRY        DosQueryFileInfo(HFILE hf, ULONG ulInfoLevel, PVOID pInfo,  ULONG cbInfoBuf );
  926. APIRET  APIENTRY        DosProtectQueryFileInfo(HFILE hf, ULONG ulInfoLevel,
  927.                                                 PVOID pInfo, ULONG cbInfoBuf,
  928.                                                 FHLOCK fhFileHandleLockID);
  929.  
  930. APIRET  APIENTRY        DosSetFileInfo(HFILE hf, ULONG ulInfoLevel, PVOID pInfoBuf, ULONG cbInfoBuf );
  931. APIRET  APIENTRY        DosProtectSetFileInfo(HFILE hf, ULONG ulInfoLevel,
  932.                                               PVOID pInfoBuf, ULONG cbInfoBuf,
  933.                                               FHLOCK fhFileHandleLockID);
  934.  
  935. APIRET  APIENTRY        DosQueryPathInfo(PSZ pszPathName, ULONG ulInfoLevel, PVOID pInfoBuf, ULONG cbInfoBuf );
  936.  
  937. APIRET  APIENTRY        DosSetPathInfo(PSZ pszPathName, ULONG ulInfoLevel, PVOID pInfoBuf, ULONG cbInfoBuf, ULONG flOptions );
  938.  
  939. /* defines for DosSetPathInfo -pathinfo flag */
  940. #define DSPI_WRTTHRU    0x10    /* write through */
  941.  
  942. APIRET  APIENTRY        DosShutdown(ULONG ulReserved);
  943.  
  944. APIRET  APIENTRY        DosEnumAttribute(ULONG ulRefType, PVOID pvFile, ULONG ulEntry, PVOID pvBuf, ULONG cbBuf, PULONG pulCount, ULONG ulInfoLevel );
  945.  
  946. APIRET  APIENTRY        DosProtectEnumAttribute(ULONG ulRefType, PVOID pvFile, ULONG ulEntry, PVOID pvBuf, ULONG cbBuf, PULONG pulCount, ULONG ulInfoLevel, FHLOCK fhFileHandleLockID );
  947.  
  948. /* XLATOFF */
  949. #pragma pack(1)
  950. /* XLATON */
  951.  
  952. typedef struct _DENA1 { /* _dena1 level 1 info returned from DosEnumAttribute */
  953.     UCHAR       reserved;       /* 0 */
  954.     UCHAR       cbName;         /* length of name exculding NULL */
  955.     USHORT      cbValue;        /* length of value */
  956.     UCHAR       szName[1];      /* variable length asciiz name */
  957. } DENA1;
  958. typedef DENA1 FAR *PDENA1;
  959.  
  960. /* XLATOFF */
  961. #pragma pack()
  962. /* XLATON */
  963.  
  964. typedef FEA2 DENA2;
  965. typedef PFEA2 PDENA2;
  966.  
  967. /* Infolevels for DosEnumAttribute  */
  968. #define ENUMEA_LEVEL_NO_VALUE   1L      /* FEA without value */
  969. /* Reference types for DosEnumAttribute */
  970. #define ENUMEA_REFTYPE_FHANDLE  0       /* file handle */
  971. #define ENUMEA_REFTYPE_PATH     1       /* path name */
  972. #define ENUMEA_REFTYPE_MAX      ENUMEA_REFTYPE_PATH
  973.  
  974. #endif /* common INCL_DOSFILEMGR */
  975.  
  976. #if (defined(INCL_DOSMEMMGR) || !defined(INCL_NOCOMMON))
  977. /*** Memory management */
  978.  
  979. APIRET  APIENTRY        DosAllocMem(PPVOID ppb, ULONG cb, ULONG flag);
  980.  
  981. APIRET  APIENTRY        DosFreeMem(PVOID pb);
  982.  
  983. APIRET  APIENTRY        DosSetMem(PVOID pb, ULONG cb, ULONG flag);
  984.  
  985. APIRET  APIENTRY        DosGiveSharedMem(PVOID pb, PID pid, ULONG flag);
  986.  
  987. APIRET  APIENTRY        DosGetSharedMem(PVOID pb, ULONG flag);
  988.  
  989. APIRET  APIENTRY        DosGetNamedSharedMem(PPVOID ppb, PSZ pszName, ULONG flag);
  990.  
  991. APIRET  APIENTRY        DosAllocSharedMem(PPVOID ppb, PSZ pszName, ULONG cb, ULONG flag);
  992.  
  993. APIRET  APIENTRY        DosQueryMem(PVOID pb, PULONG pcb, PULONG pFlag);
  994.  
  995. #define DosSubAlloc     DosSubAllocMem
  996. #define DOSSUBALLOC     DosSubAllocMem
  997. APIRET  APIENTRY        DosSubAllocMem(PVOID pbBase, PPVOID ppb, ULONG cb);
  998.  
  999. #define DosSubFree      DosSubFreeMem
  1000. #define DOSSUBFREE      DosSubFreeMem
  1001. APIRET  APIENTRY        DosSubFreeMem(PVOID pbBase, PVOID pb, ULONG cb);
  1002.  
  1003. #define DosSubSet       DosSubSetMem
  1004. #define DOSSUBSET       DosSubSetMem
  1005. APIRET  APIENTRY        DosSubSetMem(PVOID pbBase, ULONG flag, ULONG cb);
  1006.  
  1007. #define DosSubUnset     DosSubUnsetMem
  1008. #define DOSSUBUNSET     DosSubUnsetMem
  1009. APIRET  APIENTRY        DosSubUnsetMem(PVOID pbBase);
  1010.  
  1011. #include <bsememf.h>    /* get flags for API                            */
  1012.  
  1013. #endif /* INCL_DOSMEMMGR */
  1014.  
  1015. #if (defined(INCL_DOSSEMAPHORES) || !defined(INCL_NOCOMMON))
  1016.  
  1017. /*
  1018.  *     32-bit Semaphore Support
  1019.  */
  1020.  
  1021. /* Semaphore Attributes */
  1022.  
  1023. #define DC_SEM_SHARED   0x01      /* DosCreateMutex, DosCreateEvent, and     */
  1024.                                   /*   DosCreateMuxWait use it to indicate   */
  1025.                                   /*   whether the semaphore is shared or    */
  1026.                                   /*   private when the PSZ is null          */
  1027. #define DCMW_WAIT_ANY   0x02      /* DosCreateMuxWait option for wait on any */
  1028.                                   /*   event/mutex to occur                  */
  1029. #define DCMW_WAIT_ALL   0x04      /* DosCreateMuxWait option for wait on all */
  1030.                                   /*   events/mutexs to occur                */
  1031.  
  1032. /* PMxxxxxx */
  1033. #define DC_SEM_PM       0x40      /* PM Shared Event Semaphore.              */
  1034.  
  1035. #define PM_EVENT_POSTED 3000      /* PM Shared Event Posted                  */
  1036.  
  1037. #define SEM_INDEFINITE_WAIT      0xFFFFFFFF
  1038. #define SEM_IMMEDIATE_RETURN     0L
  1039.  
  1040. typedef struct _PSEMRECORD {    /* psr */
  1041.     HSEM        hsemCur;
  1042.     ULONG       ulUser;
  1043. } SEMRECORD;
  1044. typedef SEMRECORD       *PSEMRECORD;
  1045.  
  1046. #endif /* common INCL_DOSSEMAPHORES */
  1047.  
  1048. #ifdef INCL_DOSSEMAPHORES
  1049.  
  1050. typedef  ULONG    HEV;             /* hev */
  1051. typedef  HEV      *PHEV;
  1052. typedef  ULONG    HMTX;            /* hmtx */
  1053. typedef  HMTX     *PHMTX;
  1054. typedef  ULONG    HMUX;            /* hmux */
  1055. typedef  HMUX     *PHMUX;
  1056.  
  1057. APIRET  APIENTRY        DosCreateEventSem (PSZ pszName, PHEV phev, ULONG flAttr, BOOL32 fState);
  1058. APIRET  APIENTRY        DosOpenEventSem (PSZ pszName, PHEV phev);
  1059. APIRET  APIENTRY        DosCloseEventSem (HEV hev);
  1060. APIRET  APIENTRY        DosResetEventSem (HEV hev, PULONG pulPostCt);
  1061. APIRET  APIENTRY        DosPostEventSem (HEV hev);
  1062. APIRET  APIENTRY        DosWaitEventSem (HEV hev, ULONG ulTimeout);
  1063. APIRET  APIENTRY        DosQueryEventSem (HEV hev, PULONG pulPostCt);
  1064.  
  1065. APIRET  APIENTRY        DosCreateMutexSem (PSZ pszName, PHMTX phmtx, ULONG flAttr, BOOL32 fState);
  1066. APIRET  APIENTRY        DosOpenMutexSem (PSZ pszName, PHMTX phmtx);
  1067. APIRET  APIENTRY        DosCloseMutexSem (HMTX hmtx);
  1068. APIRET  APIENTRY        DosRequestMutexSem (HMTX hmtx, ULONG ulTimeout);
  1069. APIRET  APIENTRY        DosReleaseMutexSem (HMTX hmtx);
  1070. APIRET  APIENTRY        DosQueryMutexSem (HMTX hmtx, PPID ppid, PTID ptid, PULONG pulCount);
  1071.  
  1072. APIRET  APIENTRY        DosCreateMuxWaitSem (PSZ pszName, PHMUX phmux, ULONG cSemRec, PSEMRECORD pSemRec, ULONG flAttr);
  1073. APIRET  APIENTRY        DosOpenMuxWaitSem (PSZ pszName, PHMUX phmux);
  1074. APIRET  APIENTRY        DosCloseMuxWaitSem (HMUX hmux);
  1075. APIRET  APIENTRY        DosWaitMuxWaitSem (HMUX hmux, ULONG ulTimeout, PULONG pulUser);
  1076. APIRET  APIENTRY        DosAddMuxWaitSem (HMUX hmux, PSEMRECORD pSemRec);
  1077. APIRET  APIENTRY        DosDeleteMuxWaitSem (HMUX hmux, HSEM hSem);
  1078. APIRET  APIENTRY        DosQueryMuxWaitSem (HMUX hmux, PULONG pcSemRec, PSEMRECORD pSemRec, PULONG pflAttr);
  1079.  
  1080. APIRET  APIENTRY        DosPMPostEventSem (HEV hev);
  1081. APIRET  APIENTRY        DosPMWaitEventSem (HEV pmhev, HEV hev, ULONG ulTimeout);
  1082. APIRET  APIENTRY        DosPMRequestMutexSem (HEV hev, HMTX hmtx, ULONG ulTimeout);
  1083. APIRET  APIENTRY        DosPMWaitMuxWaitSem (HEV hev, HMUX hmux, ULONG ulTimeout, PULONG pulUser);
  1084.  
  1085. #endif /* INCL_DOSSEMAPHORES */
  1086.  
  1087. #if (defined(INCL_DOSDATETIME) || !defined(INCL_NOCOMMON))
  1088.  
  1089. /*** Time support */
  1090.  
  1091. typedef struct _DATETIME {    /* date */
  1092.     UCHAR   hours;
  1093.     UCHAR   minutes;
  1094.     UCHAR   seconds;
  1095.     UCHAR   hundredths;
  1096.     UCHAR   day;
  1097.     UCHAR   month;
  1098.     USHORT  year;
  1099.     SHORT   timezone;
  1100.     UCHAR   weekday;
  1101. } DATETIME;
  1102. typedef DATETIME        *PDATETIME;
  1103.  
  1104. APIRET  APIENTRY        DosGetDateTime(PDATETIME pdt);
  1105.  
  1106. APIRET  APIENTRY        DosSetDateTime(PDATETIME pdt);
  1107.  
  1108. #endif /* common INCL_DOSDATETIME */
  1109.  
  1110. #ifdef INCL_DOSDATETIME
  1111.  
  1112. /* XLATOFF */
  1113. #define DosTimerAsync   DosAsyncTimer
  1114. #define DosTimerStart   DosStartTimer
  1115. #define DosTimerStop    DosStopTimer
  1116. /* XLATON */
  1117.  
  1118. typedef SHANDLE HTIMER;
  1119. typedef HTIMER  *PHTIMER;
  1120.  
  1121. APIRET  APIENTRY        DosAsyncTimer(ULONG msec, HSEM hsem, PHTIMER phtimer);
  1122.  
  1123. APIRET  APIENTRY        DosStartTimer(ULONG msec, HSEM hsem, PHTIMER phtimer);
  1124.  
  1125. APIRET  APIENTRY        DosStopTimer(HTIMER htimer);
  1126.  
  1127. #endif /* INCL_DOSDATETIME */
  1128.  
  1129.  
  1130. /*** Module manager */
  1131.  
  1132. #ifdef INCL_DOSMODULEMGR
  1133.  
  1134. /* XLATOFF */
  1135. #define DosGetProcAddr          DosQueryProcAddr
  1136. #define DosGetModHandle         DosQueryModuleHandle
  1137. #define DosGetModName           DosQueryModuleName
  1138. /* XLATON */
  1139.  
  1140. APIRET  APIENTRY  DosLoadModule(PSZ pszName, ULONG cbName, PSZ pszModname, PHMODULE phmod);
  1141.  
  1142. APIRET  APIENTRY  DosFreeModule(HMODULE hmod);
  1143.  
  1144. APIRET  APIENTRY  DosQueryProcAddr(HMODULE hmod, ULONG ordinal, PSZ pszName,PFN* ppfn);
  1145.  
  1146. APIRET  APIENTRY  DosQueryModuleHandle(PSZ pszModname, PHMODULE phmod);
  1147.  
  1148. APIRET  APIENTRY  DosQueryModuleName(HMODULE hmod, ULONG cbName, PCHAR pch);
  1149.  
  1150. #define PT_16BIT  0
  1151. #define PT_32BIT  1
  1152.  
  1153. APIRET  APIENTRY  DosQueryProcType(HMODULE hmod, ULONG ordinal, PSZ pszName, PULONG pulproctype);
  1154.  
  1155. APIRET  APIENTRY  DosQueryModFromEIP(HMODULE *phMod, ULONG *pObjNum, ULONG BuffLen, PCHAR pBuff, ULONG *pOffset, ULONG Address);
  1156.  
  1157. #define HW_CFG_MCA              0x00000001
  1158. #define HW_CFG_EISA             0x00000002
  1159. #define HW_CFG_ABIOS_SUPPORTED  0x00000004
  1160. #define HW_CFG_ABIOS_PRESENT    0x00000008
  1161.  
  1162. APIRET  APIENTRY DosQueryABIOSSupport(ULONG reserved);
  1163.  
  1164. #endif /* INCL_DOSMODULEMGR */
  1165.  
  1166. #if (defined(INCL_DOSRESOURCES) || !defined(INCL_NOCOMMON))
  1167.  
  1168. /*** Resource support */
  1169.  
  1170. /* Predefined resource types */
  1171.  
  1172. #define RT_POINTER      1   /* mouse pointer shape */
  1173. #define RT_BITMAP       2   /* bitmap */
  1174. #define RT_MENU         3   /* menu template */
  1175. #define RT_DIALOG       4   /* dialog template */
  1176. #define RT_STRING       5   /* string tables */
  1177. #define RT_FONTDIR      6   /* font directory */
  1178. #define RT_FONT         7   /* font */
  1179. #define RT_ACCELTABLE   8   /* accelerator tables */
  1180. #define RT_RCDATA       9   /* binary data */
  1181. #define RT_MESSAGE      10  /* error msg     tables */
  1182. #define RT_DLGINCLUDE   11  /* dialog include file name */
  1183. #define RT_VKEYTBL      12  /* key to vkey tables */
  1184. #define RT_KEYTBL       13  /* key to UGL tables */
  1185. #define RT_CHARTBL      14  /* glyph to character tables */
  1186. #define RT_DISPLAYINFO  15  /* screen display information */
  1187.  
  1188. #define RT_FKASHORT     16  /* function key area short form */
  1189. #define RT_FKALONG      17  /* function key area long form */
  1190.  
  1191. #define RT_HELPTABLE    18  /* Help table for Cary Help manager */
  1192. #define RT_HELPSUBTABLE 19  /* Help subtable for Cary Help manager */
  1193.  
  1194. #define RT_FDDIR        20  /* DBCS uniq/font driver directory */
  1195. #define RT_FD           21  /* DBCS uniq/font driver */
  1196.  
  1197. #define RT_MAX          22  /* 1st unused Resource Type */
  1198.  
  1199.  
  1200. #define RF_ORDINALID    0x80000000L     /* ordinal id flag in resource table */
  1201.  
  1202. #endif /* common INCL_DOSRESOURCES */
  1203.  
  1204. #ifdef INCL_DOSRESOURCES
  1205.  
  1206. /* XLATOFF */
  1207. #define DosGetResource2 DosGetResource
  1208. /* XLATON */
  1209.  
  1210. APIRET  APIENTRY        DosGetResource(HMODULE hmod, ULONG idType, ULONG idName, PPVOID ppb);
  1211.  
  1212. APIRET  APIENTRY        DosFreeResource(PVOID pb);
  1213.  
  1214. APIRET  APIENTRY        DosQueryResourceSize(HMODULE hmod, ULONG idt, ULONG idn, PULONG pulsize);
  1215.  
  1216. #endif /* INCL_DOSRESOURCES */
  1217.  
  1218.  
  1219. /*** NLS Support */
  1220.  
  1221. #ifdef INCL_DOSNLS
  1222.  
  1223. typedef struct _COUNTRYCODE { /* ctryc */
  1224.     ULONG       country;
  1225.     ULONG       codepage;
  1226. } COUNTRYCODE;
  1227. typedef COUNTRYCODE     *PCOUNTRYCODE;
  1228.  
  1229. typedef struct _COUNTRYINFO { /* ctryi */
  1230.     ULONG       country;
  1231.     ULONG       codepage;
  1232.     ULONG       fsDateFmt;
  1233.     CHAR        szCurrency[5];
  1234.     CHAR        szThousandsSeparator[2];
  1235.     CHAR        szDecimal[2];
  1236.     CHAR        szDateSeparator[2];
  1237.     CHAR        szTimeSeparator[2];
  1238.     UCHAR       fsCurrencyFmt;
  1239.     UCHAR       cDecimalPlace;
  1240.     UCHAR       fsTimeFmt;
  1241.     USHORT      abReserved1[2];
  1242.     CHAR        szDataSeparator[2];
  1243.     USHORT      abReserved2[5];
  1244. } COUNTRYINFO;
  1245. typedef COUNTRYINFO     *PCOUNTRYINFO;
  1246.  
  1247. /* XLATOFF */
  1248. #define DosGetCtryInfo  DosQueryCtryInfo
  1249. #define DosGetDBCSEv    DosQueryDBCSEnv
  1250. #define DosCaseMap      DosMapCase
  1251. #define DosGetCollate   DosQueryCollate
  1252. #define DosGetCp        DosQueryCp
  1253. #define DosSetProcCp    DosSetProcessCp
  1254. /* XLATON */
  1255.  
  1256. APIRET  APIENTRY        DosQueryCtryInfo(ULONG cb, PCOUNTRYCODE pcc, PCOUNTRYINFO pci, PULONG pcbActual);
  1257.  
  1258. APIRET  APIENTRY        DosQueryDBCSEnv(ULONG cb, PCOUNTRYCODE pcc, PCHAR pBuf);
  1259.  
  1260. APIRET  APIENTRY        DosMapCase(ULONG cb, PCOUNTRYCODE pcc, PCHAR pch);
  1261.  
  1262. APIRET  APIENTRY        DosQueryCollate(ULONG cb, PCOUNTRYCODE pcc, PCHAR pch, PULONG pcch);
  1263.  
  1264. APIRET  APIENTRY        DosQueryCp(ULONG cb, PULONG arCP, PULONG pcCP);
  1265.  
  1266. APIRET  APIENTRY        DosSetProcessCp(ULONG cp);
  1267.  
  1268. #endif /* INCL_DOSNLS */
  1269.  
  1270.  
  1271. /*** Signal support */
  1272.  
  1273. #ifdef INCL_DOSEXCEPTIONS
  1274.  
  1275. /* DosSetSigExceptionFocus codes */
  1276.  
  1277. #define SIG_UNSETFOCUS 0
  1278. #define SIG_SETFOCUS 1
  1279.  
  1280. #include <bsexcpt.h>
  1281.  
  1282. APIRET  APIENTRY        DosSetExceptionHandler(PEXCEPTIONREGISTRATIONRECORD pERegRec);
  1283.  
  1284. APIRET  APIENTRY        DosUnsetExceptionHandler(PEXCEPTIONREGISTRATIONRECORD pERegRec);
  1285.  
  1286. APIRET  APIENTRY        DosRaiseException(PEXCEPTIONREPORTRECORD pexcept);
  1287.  
  1288. APIRET  APIENTRY        DosSendSignalException(PID pid, ULONG exception);
  1289.  
  1290. APIRET  APIENTRY        DosUnwindException(PEXCEPTIONREGISTRATIONRECORD phandler, PVOID pTargetIP, PEXCEPTIONREPORTRECORD pERepRec);
  1291.  
  1292. APIRET  APIENTRY        DosSetSignalExceptionFocus(BOOL32 flag, PULONG pulTimes);
  1293.  
  1294. APIRET  APIENTRY        DosEnterMustComplete(PULONG pulNesting);
  1295.  
  1296. APIRET  APIENTRY        DosExitMustComplete(PULONG pulNesting);
  1297.  
  1298. APIRET  APIENTRY        DosAcknowledgeSignalException(ULONG ulSignalNum);
  1299.  
  1300. #endif /* INCL_DOSEXCEPTIONS */
  1301.  
  1302.  
  1303. /*** Pipe and queue support */
  1304.  
  1305. #ifdef INCL_DOSQUEUES
  1306. #if (defined(INCL_DOSFILEMGR) || !defined(INCL_NOCOMMON))
  1307.  
  1308. typedef SHANDLE HQUEUE;  /* hq */
  1309. typedef HQUEUE  *PHQUEUE;
  1310. typedef struct _REQUESTDATA {   /* reqqdata */
  1311.     PID         pid;
  1312.     ULONG       ulData;
  1313. } REQUESTDATA;
  1314. typedef REQUESTDATA     *PREQUESTDATA;
  1315.  
  1316. #define QUE_FIFO              0L
  1317. #define QUE_LIFO              1L
  1318. #define QUE_PRIORITY          2L
  1319. #define QUE_NOCONVERT_ADDRESS 0L
  1320. #define QUE_CONVERT_ADDRESS   4L
  1321.  
  1322. /* XLATOFF */
  1323. #define DosMakePipe     DosCreatePipe
  1324. /* XLATON */
  1325.  
  1326. APIRET  APIENTRY        DosCreatePipe(PHFILE phfRead, PHFILE phfWrite, ULONG cb);
  1327.  
  1328. APIRET  APIENTRY        DosCloseQueue(HQUEUE hq);
  1329.  
  1330. APIRET  APIENTRY        DosCreateQueue(PHQUEUE phq, ULONG priority, PSZ pszName);
  1331.  
  1332. APIRET  APIENTRY        DosOpenQueue(PPID ppid, PHQUEUE phq, PSZ pszName);
  1333.  
  1334. APIRET  APIENTRY        DosPeekQueue(HQUEUE hq, PREQUESTDATA pRequest, PULONG pcbData, PPVOID ppbuf, PULONG element, BOOL32 nowait, PBYTE ppriority, HEV hsem);
  1335.  
  1336. APIRET  APIENTRY        DosPurgeQueue(HQUEUE hq);
  1337.  
  1338. APIRET  APIENTRY        DosQueryQueue(HQUEUE hq, PULONG pcbEntries);
  1339.  
  1340. APIRET  APIENTRY        DosReadQueue(HQUEUE hq, PREQUESTDATA pRequest, PULONG pcbData, PPVOID ppbuf, ULONG element, BOOL32 wait, PBYTE ppriority, HEV hsem);
  1341.  
  1342. APIRET  APIENTRY        DosWriteQueue(HQUEUE hq, ULONG request, ULONG cbData, PVOID pbData, ULONG priority);
  1343.  
  1344. #else /* INCL_DOSFILEMGR || !INCL_NOCOMMON */
  1345. #error PHFILE not defined - define INCL_DOSFILEMGR or undefine INCL_NOCOMMON
  1346. #endif /* INCL_DOSFILEMGR || !INCL_NOCOMMON */
  1347. #endif /* INCL_DOSQUEUES */
  1348.  
  1349. #ifdef INCL_DOSMISC
  1350.  
  1351. /* definitions for DosSearchPath control word */
  1352. #define DSP_IMPLIEDCUR          1 /* current dir will be searched first */
  1353. #define DSP_PATHREF             2 /* from env.variable */
  1354. #define DSP_IGNORENETERR        4 /* ignore net errs & continue search */
  1355.  
  1356. /* indices for DosQuerySysInfo */
  1357. #define QSV_MAX_PATH_LENGTH     1
  1358. #define Q_MAX_PATH_LENGTH       QSV_MAX_PATH_LENGTH
  1359. #define QSV_MAX_TEXT_SESSIONS   2
  1360. #define QSV_MAX_PM_SESSIONS     3
  1361. #define QSV_MAX_VDM_SESSIONS    4
  1362. #define QSV_BOOT_DRIVE          5       /* 1=A, 2=B, etc. */
  1363. #define QSV_DYN_PRI_VARIATION   6       /* 0=Absolute, 1=Dynamic */
  1364. #define QSV_MAX_WAIT            7       /* seconds */
  1365. #define QSV_MIN_SLICE           8       /* milli seconds */
  1366. #define QSV_MAX_SLICE           9       /* milli seconds */
  1367. #define QSV_PAGE_SIZE           10
  1368. #define QSV_VERSION_MAJOR       11
  1369. #define QSV_VERSION_MINOR       12
  1370. #define QSV_VERSION_REVISION    13      /* Revision letter */
  1371. #define QSV_MS_COUNT            14      /* Free running millisecond counter */
  1372. #define QSV_TIME_LOW            15      /* Low dword of time in seconds */
  1373. #define QSV_TIME_HIGH           16      /* High dword of time in seconds */
  1374. #define QSV_TOTPHYSMEM          17      /* Physical memory on system */
  1375. #define QSV_TOTRESMEM           18      /* Resident memory on system */
  1376. #define QSV_TOTAVAILMEM         19      /* Available memory for all processes */
  1377. #define QSV_MAXPRMEM            20      /* Avail private mem for calling proc */
  1378. #define QSV_MAXSHMEM            21      /* Avail shared mem for calling proc */
  1379. #define QSV_TIMER_INTERVAL      22      /* Timer interval in tenths of ms */
  1380. #define QSV_MAX_COMP_LENGTH     23      /* max len of one component in a name */
  1381. #define QSV_FGND_SG_ID          24      /* Foreground Screen Group ID 26215   */
  1382. #define QSV_FGND_PID            25      /* Foreground Process ID      26215   */
  1383. #define QSV_MAX                 QSV_MAX_COMP_LENGTH
  1384.  
  1385. /* definitions for DosError - combine with | */
  1386. #define FERR_DISABLEHARDERR     0x00000000L     /* disable hard error popups */
  1387. #define FERR_ENABLEHARDERR      0x00000001L     /* enable hard error popups */
  1388. #define FERR_ENABLEEXCEPTION    0x00000000L     /* enable exception popups */
  1389. #define FERR_DISABLEEXCEPTION   0x00000002L     /* disable exception popups */
  1390.  
  1391. /* definitions for DosDumpProcess */
  1392. #define DDP_DISABLEPROCDUMP     0x00000000L     /* disable process dumps */
  1393. #define DDP_ENABLEPROCDUMP      0x00000001L     /* enable process dumps */
  1394. #define DDP_PERFORMPROCDUMP     0x00000002L     /* perform process dump */
  1395.  
  1396. /* definitions for DosSuppressPopUps */
  1397. #define SPU_DISABLESUPPRESSION  0x00000000L     /* disable popup suppression */
  1398. #define SPU_ENABLESUPPRESSION   0x00000001L     /* enable popup suppression */
  1399.  
  1400. /* definitions for DosQueryRASInfo Index */
  1401. #define SIS_MMIOADDR            0
  1402. #define SIS_MEC_TABLE           1
  1403. #define SIS_SYS_LOG             2
  1404.  
  1405. /* definitions for DosQueryExtLIBPATH and DosSetExtLIBPATH flags parameter */
  1406. #define BEGIN_LIBPATH   1
  1407. #define END_LIBPATH     2
  1408.  
  1409. /* XLATOFF */
  1410. #define DosInsMessage   DosInsertMessage
  1411. #define DosQSysInfo     DosQuerySysInfo
  1412. /* XLATON */
  1413.  
  1414. APIRET  APIENTRY        DosError(ULONG error);
  1415.  
  1416. APIRET  APIENTRY        DosGetMessage(PCHAR* pTable, ULONG cTable, PCHAR pBuf, ULONG cbBuf, ULONG msgnumber, PSZ pszFile, PULONG pcbMsg);
  1417.  
  1418. APIRET  APIENTRY        DosErrClass(ULONG code, PULONG pClass, PULONG pAction, PULONG pLocus);
  1419.  
  1420. APIRET  APIENTRY        DosInsertMessage(PCHAR* pTable, ULONG cTable, PSZ pszMsg, ULONG cbMsg, PCHAR pBuf, ULONG cbBuf, PULONG pcbMsg);
  1421.  
  1422. APIRET  APIENTRY        DosPutMessage(HFILE hfile, ULONG cbMsg, PCHAR pBuf);
  1423.  
  1424. APIRET  APIENTRY        DosQuerySysInfo(ULONG iStart, ULONG iLast, PVOID pBuf, ULONG cbBuf);
  1425.  
  1426. APIRET  APIENTRY        DosScanEnv(PSZ pszName, PSZ *ppszValue);
  1427.  
  1428. APIRET  APIENTRY        DosSearchPath(ULONG flag, PSZ pszPathOrName, PSZ pszFilename, PBYTE pBuf, ULONG cbBuf);
  1429.  
  1430. APIRET  APIENTRY        DosQueryMessageCP(PCHAR pb, ULONG cb, PSZ pszFilename, PULONG cbBuf);
  1431.  
  1432. APIRET  APIENTRY        DosQueryRASInfo(ULONG Index, PPVOID Addr);
  1433.  
  1434. APIRET  APIENTRY        DosForceSystemDump(ULONG reserved);
  1435.  
  1436. APIRET  APIENTRY        DosDumpProcess(ULONG Flag, ULONG Drive, PID Pid);
  1437.  
  1438. APIRET  APIENTRY        DosSuppressPopUps(ULONG Flag, ULONG Drive);
  1439.  
  1440. APIRET  APIENTRY        DosSetExtLIBPATH( PSZ pszExtLIBPATH, ULONG flags);
  1441.  
  1442. APIRET  APIENTRY        DosQueryExtLIBPATH( PSZ pszExtLIBPATH, ULONG flags);
  1443.  
  1444. APIRET  APIENTRY        DosVerifyPidTid(PID Pid, TID Tid);   /* 88344 */
  1445.  
  1446. #endif /* INCL_DOSMISC */
  1447.  
  1448.  
  1449. /*** Session manager support */
  1450.  
  1451. #ifdef INCL_DOSSESMGR
  1452.  
  1453. typedef struct _STARTDATA {   /* stdata */
  1454.     USHORT  Length;
  1455.     USHORT  Related;
  1456.     USHORT  FgBg;
  1457.     USHORT  TraceOpt;
  1458.     PSZ     PgmTitle;
  1459.     PSZ     PgmName;
  1460.     PBYTE   PgmInputs;
  1461.     PBYTE   TermQ;
  1462.     PBYTE   Environment;
  1463.     USHORT  InheritOpt;
  1464.     USHORT  SessionType;
  1465.     PSZ     IconFile;
  1466.     ULONG   PgmHandle;
  1467.     USHORT  PgmControl;
  1468.     USHORT  InitXPos;
  1469.     USHORT  InitYPos;
  1470.     USHORT  InitXSize;
  1471.     USHORT  InitYSize;
  1472.     USHORT  Reserved;
  1473.     PSZ     ObjectBuffer;
  1474.     ULONG   ObjectBuffLen;
  1475. } STARTDATA;
  1476. typedef STARTDATA       *PSTARTDATA;
  1477.  
  1478. #define SSF_RELATED_INDEPENDENT 0
  1479. #define SSF_RELATED_CHILD       1
  1480.  
  1481. #define SSF_FGBG_FORE           0
  1482. #define SSF_FGBG_BACK           1
  1483.  
  1484. #define SSF_TRACEOPT_NONE       0
  1485. #define SSF_TRACEOPT_TRACE      1
  1486. #define SSF_TRACEOPT_TRACEALL   2
  1487.  
  1488. #define SSF_INHERTOPT_SHELL     0
  1489. #define SSF_INHERTOPT_PARENT    1
  1490.  
  1491. /* note that these types are identical to those in pmshl.h for PROG_* */
  1492. #define SSF_TYPE_DEFAULT        0
  1493. #define SSF_TYPE_FULLSCREEN     1
  1494. #define SSF_TYPE_WINDOWABLEVIO  2
  1495. #define SSF_TYPE_PM             3
  1496. #define SSF_TYPE_VDM            4
  1497. #define SSF_TYPE_GROUP          5
  1498. #define SSF_TYPE_DLL            6
  1499. #define SSF_TYPE_WINDOWEDVDM    7
  1500. #define SSF_TYPE_PDD            8
  1501. #define SSF_TYPE_VDD            9
  1502.  
  1503. /* note that these flags are identical to those in pmshl.h for SHE_* */
  1504. #define SSF_CONTROL_VISIBLE     0x0000
  1505. #define SSF_CONTROL_INVISIBLE   0x0001
  1506. #define SSF_CONTROL_MAXIMIZE    0x0002
  1507. #define SSF_CONTROL_MINIMIZE    0x0004
  1508. #define SSF_CONTROL_NOAUTOCLOSE 0x0008
  1509. #define SSF_CONTROL_SETPOS      0x8000
  1510.  
  1511. typedef struct _STATUSDATA { /* stsdata */
  1512.     USHORT Length;
  1513.     USHORT SelectInd;
  1514.     USHORT BondInd;
  1515. } STATUSDATA;
  1516. typedef STATUSDATA      *PSTATUSDATA;
  1517.  
  1518. /* SelectInd and BondInd paramater values for DosSetSession */
  1519. #define SET_SESSION_UNCHANGED      0
  1520. #define SET_SESSION_SELECTABLE     1
  1521. #define SET_SESSION_NON_SELECTABLE 2
  1522. #define SET_SESSION_BOND           1
  1523. #define SET_SESSION_NO_BOND        2
  1524.  
  1525. /* TargetOption (scope) parameter values for DosStopSession */
  1526. #define STOP_SESSION_SPECIFIED     0
  1527. #define STOP_SESSION_ALL           1
  1528.  
  1529. /* XLATOFF */
  1530. #define DosQAppType     DosQueryAppType
  1531. /* XLATON */
  1532.  
  1533. APIRET  APIENTRY        DosStartSession(PSTARTDATA psd, PULONG pidSession, PPID ppid);
  1534.  
  1535. APIRET  APIENTRY        DosSetSession(ULONG idSession, PSTATUSDATA psd);
  1536.  
  1537. APIRET  APIENTRY        DosSelectSession(ULONG idSession);
  1538.  
  1539. APIRET  APIENTRY        DosStopSession(ULONG scope, ULONG idSession);
  1540.  
  1541. APIRET  APIENTRY        DosQueryAppType(PSZ pszName, PULONG pFlags);
  1542.  
  1543. #endif /* INCL_DOSSESMGR */
  1544.  
  1545. #if (defined(INCL_DOSSESMGR) || defined(INCL_DOSFILEMGR))
  1546.  
  1547. /* AppType returned in by DosQueryAppType in pFlags as follows          */
  1548. #define FAPPTYP_NOTSPEC         0x00000000
  1549. #define FAPPTYP_NOTWINDOWCOMPAT 0x00000001
  1550. #define FAPPTYP_WINDOWCOMPAT    0x00000002
  1551. #define FAPPTYP_WINDOWAPI       0x00000003
  1552. #define FAPPTYP_BOUND           0x00000008
  1553. #define FAPPTYP_DLL             0x00000010
  1554. #define FAPPTYP_DOS             0x00000020
  1555. #define FAPPTYP_PHYSDRV         0x00000040 /* physical device driver       */
  1556. #define FAPPTYP_VIRTDRV         0x00000080 /* virtual device driver        */
  1557. #define FAPPTYP_PROTDLL         0x00000100 /* 'protected memory' dll       */
  1558. #define FAPPTYP_WINDOWSREAL     0x00000200 /*         real mode app        */
  1559. #define FAPPTYP_WINDOWSPROT     0x00000400 /*         protect mode app     */
  1560. #define FAPPTYP_WINDOWSPROT31   0x00001000 /*         3.1 protect mode app */
  1561. #define FAPPTYP_32BIT           0x00004000
  1562. #define FAPPTYP_EXETYPE         FAPPTYP_WINDOWAPI
  1563.  
  1564. #define FAPPTYP_RESERVED        ~(FAPPTYP_WINDOWAPI | FAPPTYP_BOUND | FAPPTYP_DLL | FAPPTYP_DOS | FAPPTYP_PHYSDRV | FAPPTYP_VIRTDRV | FAPPTYP_PROTDLL | FAPPTYP_32BIT)
  1565.  
  1566. #ifdef INCL_DOSFILEMGR
  1567.  
  1568. #define EAT_APPTYP_PMAPI        0x00            /* Uses PM API */
  1569. #define EAT_APPTYP_DOS          0x01            /* DOS APP */
  1570. #define EAT_APPTYP_PMW          0x02            /* Window compatible */
  1571. #define EAT_APPTYP_NOPMW        0x03            /* Not Window compatible */
  1572. #define EAT_APPTYP_EXETYPE      0x03            /* EXE type mask */
  1573. #define EAT_APPTYP_RESERVED     ~(EAT_APPTYP_EXETYPE)
  1574.  
  1575. #endif /* INCL_DOSFILEMGR */
  1576.  
  1577. #endif /* INCL_DOSSESMGR || INCL_DOSFILEMGR */
  1578.  
  1579.  
  1580. /*** Device support */
  1581.  
  1582. #ifdef INCL_DOSDEVICES
  1583.  
  1584. /* XLATOFF */
  1585. #define DosDevIOCtl2    DosDevIOCtl
  1586. /* XLATON */
  1587.  
  1588. APIRET  APIENTRY        DosDevConfig(PVOID pdevinfo, ULONG item);
  1589. #define DEVINFO_PRINTER         0       /* Number of printers attached */
  1590. #define DEVINFO_RS232           1       /* Number of RS232 ports */
  1591. #define DEVINFO_FLOPPY          2       /* Number of diskette drives */
  1592. #define DEVINFO_COPROCESSOR     3       /* Presence of math coprocessor */
  1593. #define DEVINFO_SUBMODEL        4       /* PC Submodel Type */
  1594. #define DEVINFO_MODEL           5       /* PC Model Type */
  1595. #define DEVINFO_ADAPTER         6       /* Primary display adapter type */
  1596.  
  1597. APIRET  APIENTRY        DosDevIOCtl(HFILE hDevice, ULONG category, ULONG function, PVOID pParams, ULONG cbParmLenMax, PULONG pcbParmLen, PVOID pData, ULONG cbDataLenMax, PULONG pcbDataLen);
  1598.  
  1599.  
  1600. APIRET  APIENTRY        DosPhysicalDisk(ULONG function, PVOID pBuf, ULONG cbBuf, PVOID pParams, ULONG cbParams);
  1601. #define INFO_COUNT_PARTITIONABLE_DISKS  1       /* # of partitionable disks */
  1602. #define INFO_GETIOCTLHANDLE             2       /* Obtain handle            */
  1603. #define INFO_FREEIOCTLHANDLE            3       /* Release handle           */
  1604.  
  1605. #endif /* INCL_DOSDEVICES */
  1606.  
  1607.  
  1608. /*** DosNamedPipes API Support */
  1609.  
  1610. #ifdef INCL_DOSNMPIPES
  1611.  
  1612. /*** Data structures used with named pipes ***/
  1613.  
  1614. typedef SHANDLE HPIPE;     /* hp */
  1615. typedef HPIPE   *PHPIPE;
  1616.  
  1617. typedef struct _AVAILDATA {             /* AVAILDATA */
  1618.     USHORT      cbpipe;                 /* bytes left in the pipe */
  1619.     USHORT      cbmessage;              /* bytes left in the current message */
  1620. } AVAILDATA;
  1621. typedef AVAILDATA FAR *PAVAILDATA;
  1622.  
  1623. typedef struct _PIPEINFO {              /* nmpinf */
  1624.     USHORT cbOut;                       /* length of outgoing I/O buffer */
  1625.     USHORT cbIn;                        /* length of incoming I/O buffer */
  1626.     BYTE   cbMaxInst;                   /* maximum number of instances   */
  1627.     BYTE   cbCurInst;                   /* current number of instances   */
  1628.     BYTE   cbName;                      /* length of pipe name           */
  1629.     CHAR   szName[1];                   /* start of name                 */
  1630. } PIPEINFO;
  1631. typedef PIPEINFO FAR *PPIPEINFO;
  1632.  
  1633. typedef struct _PIPESEMSTATE {  /* nmpsmst */
  1634.     BYTE   fStatus;             /* type of record, 0 = EOI, 1 = read ok, */
  1635.                                 /* 2 = write ok, 3 = pipe closed         */
  1636.     BYTE   fFlag;               /* additional info, 01 = waiting thread  */
  1637.     USHORT usKey;               /* user's key value                      */
  1638.     USHORT usAvail;             /* available data/space if status = 1/2  */
  1639. } PIPESEMSTATE;
  1640. typedef PIPESEMSTATE FAR *PPIPESEMSTATE;
  1641.  
  1642. #define NP_INDEFINITE_WAIT      -1
  1643. #define NP_DEFAULT_WAIT         0L
  1644.  
  1645. /* DosPeekNmPipe() pipe states */
  1646.  
  1647. #define NP_STATE_DISCONNECTED   0x0001
  1648. #define NP_STATE_LISTENING      0x0002
  1649. #define NP_STATE_CONNECTED      0x0003
  1650. #define NP_STATE_CLOSING        0x0004
  1651.  
  1652. /* DosCreateNPipe open modes */
  1653.  
  1654. #define NP_ACCESS_INBOUND       0x0000
  1655. #define NP_ACCESS_OUTBOUND      0x0001
  1656. #define NP_ACCESS_DUPLEX        0x0002
  1657. #define NP_INHERIT              0x0000
  1658. #define NP_NOINHERIT            0x0080
  1659. #define NP_WRITEBEHIND          0x0000
  1660. #define NP_NOWRITEBEHIND        0x4000
  1661.  
  1662. /* DosCreateNPipe and DosQueryNPHState state */
  1663.  
  1664. #define NP_READMODE_BYTE        0x0000
  1665. #define NP_READMODE_MESSAGE     0x0100
  1666. #define NP_TYPE_BYTE            0x0000
  1667. #define NP_TYPE_MESSAGE         0x0400
  1668. #define NP_END_CLIENT           0x0000
  1669. #define NP_END_SERVER           0x4000
  1670. #define NP_WAIT                 0x0000
  1671. #define NP_NOWAIT               0x8000
  1672. #define NP_UNLIMITED_INSTANCES  0x00FF
  1673.  
  1674. /* XLATOFF */
  1675. #define DosCallNmPipe   DosCallNPipe
  1676. #define DosConnectNmPipe        DosConnectNPipe
  1677. #define DosDisConnectNmPipe     DosDisConnectNPipe
  1678. #define DosMakeNmPipe   DosCreateNPipe
  1679. #define DosPeekNmPipe   DosPeekNPipe
  1680. #define DosQNmPHandState        DosQueryNPHState
  1681. #define DosQNmPipeInfo  DosQueryNPipeInfo
  1682. #define DosQNmPipeSemState      DosQueryNPipeSemState
  1683. #define DosRawReadNmPipe        DosRawReadNPipe
  1684. #define DosRawWriteNmPipe       DosRawWriteNPipe
  1685. #define DosSetNmPHandState      DosSetNPHState
  1686. #define DosSetNmPipeSem DosSetNPipeSem
  1687. #define DosTransactNmPipe       DosTransactNPipe
  1688. #define DosWaitNmPipe   DosWaitNPipe
  1689. /* XLATON */
  1690.  
  1691. APIRET  APIENTRY        DosCallNPipe(PSZ pszName, PVOID pInbuf, ULONG cbIn, PVOID pOutbuf, ULONG cbOut, PULONG pcbActual, ULONG msec);
  1692.  
  1693. APIRET  APIENTRY        DosConnectNPipe(HPIPE hpipe);
  1694.  
  1695. APIRET  APIENTRY        DosDisConnectNPipe(HPIPE hpipe);
  1696.  
  1697. APIRET  APIENTRY        DosCreateNPipe(PSZ pszName, PHPIPE pHpipe, ULONG openmode, ULONG pipemode, ULONG cbInbuf, ULONG cbOutbuf, ULONG msec);
  1698.  
  1699. APIRET  APIENTRY        DosPeekNPipe(HPIPE hpipe, PVOID pBuf, ULONG cbBuf, PULONG pcbActual, PAVAILDATA pAvail, PULONG pState);
  1700.  
  1701. APIRET  APIENTRY        DosQueryNPHState(HPIPE hpipe, PULONG pState);
  1702.  
  1703. APIRET  APIENTRY        DosQueryNPipeInfo(HPIPE hpipe, ULONG infolevel, PVOID pBuf, ULONG cbBuf);
  1704.  
  1705. APIRET  APIENTRY        DosQueryNPipeSemState(HSEM hsem, PPIPESEMSTATE pnpss, ULONG cbBuf);
  1706.  
  1707. APIRET  APIENTRY        DosSetNPHState(HPIPE hpipe, ULONG state);
  1708.  
  1709. APIRET  APIENTRY        DosSetNPipeSem(HPIPE hpipe, HSEM hsem, ULONG key);
  1710.  
  1711. APIRET  APIENTRY        DosTransactNPipe(HPIPE hpipe, PVOID pOutbuf, ULONG cbOut, PVOID pInbuf, ULONG cbIn, PULONG pcbRead);
  1712.  
  1713. APIRET  APIENTRY        DosWaitNPipe(PSZ pszName, ULONG msec);
  1714.  
  1715. /* values in fStatus */
  1716. #define NPSS_EOI                   0     /* End Of Information    */
  1717. #define NPSS_RDATA                 1     /* read data available   */
  1718. #define NPSS_WSPACE                2     /* write space available */
  1719. #define NPSS_CLOSE                 3     /* pipe in CLOSING state */
  1720.  
  1721. /* values in npss_flag */
  1722. #define NPSS_WAIT                  0x01  /* waiting thread on end of pipe */
  1723.  
  1724. /* defined bits in pipe mode */
  1725. #define NP_NBLK                    0x8000 /* non-blocking read/write */
  1726. #define NP_SERVER                  0x4000 /* set if server end       */
  1727. #define NP_WMESG                   0x0400 /* write messages          */
  1728. #define NP_RMESG                   0x0100 /* read as messages        */
  1729. #define NP_ICOUNT                  0x00FF /* instance count field    */
  1730.  
  1731.  
  1732. /*      Named pipes may be in one of several states depending on the actions
  1733.  *      that have been taken on it by the server end and client end.  The
  1734.  *      following state/action table summarizes the valid state transitions:
  1735.  *
  1736.  *      Current state           Action                  Next state
  1737.  *
  1738.  *       <none>             server DosMakeNmPipe        DISCONNECTED
  1739.  *       DISCONNECTED       server connect              LISTENING
  1740.  *       LISTENING          client open                 CONNECTED
  1741.  *       CONNECTED          server disconn              DISCONNECTED
  1742.  *       CONNECTED          client close                CLOSING
  1743.  *       CLOSING            server disconn              DISCONNECTED
  1744.  *       CONNECTED          server close                CLOSING
  1745.  *       <any other>        server close                <pipe deallocated>
  1746.  *
  1747.  *      If a server disconnects his end of the pipe, the client end will enter a
  1748.  *      special state in which any future operations (except close) on the file
  1749.  *      descriptor associated with the pipe will return an error.
  1750.  */
  1751.  
  1752. /*
  1753.  *      Values for named pipe state
  1754.  */
  1755.  
  1756. #define NP_DISCONNECTED            1    /* after pipe creation or Disconnect */
  1757. #define NP_LISTENING               2    /* after DosNmPipeConnect            */
  1758. #define NP_CONNECTED               3    /* after Client open                 */
  1759. #define NP_CLOSING                 4    /* after Client or Server close      */
  1760.  
  1761.  
  1762. #endif /* INCL_DOSNMPIPES */
  1763.  
  1764.  
  1765. /*** DosProfile API support */
  1766.  
  1767. #ifdef INCL_DOSPROFILE
  1768.  
  1769. /*** Perfview API support */
  1770.  
  1771. APIRET  APIENTRY        DosTmrQueryFreq(PULONG pulTmrFreq);
  1772. APIRET  APIENTRY        DosTmrQueryTime(PQWORD pqwTmrTime);
  1773. APIRET  APIENTRY        DosRegisterPerfCtrs(PBYTE pbDataBlk, PBYTE pbTextBlk, ULONG flFlags);
  1774.  
  1775. /* DosProfile ordinal number */
  1776.  
  1777. #define PROF_ORDINAL     133
  1778.  
  1779. /* DosProfile usType */
  1780.  
  1781. #define PROF_SYSTEM      0
  1782. #define PROF_USER        1
  1783. #define PROF_USEDD       2
  1784. #define PROF_KERNEL      4
  1785. #define PROF_VERBOSE     8
  1786. #define PROF_ENABLE     16
  1787.  
  1788. /* DosProfile usFunc */
  1789.  
  1790. #define PROF_ALLOC       0
  1791. #define PROF_CLEAR       1
  1792. #define PROF_ON          2
  1793. #define PROF_OFF         3
  1794. #define PROF_DUMP        4
  1795. #define PROF_FREE        5
  1796.  
  1797. /* DosProfile tic count granularity (DWORD) */
  1798.  
  1799. #define PROF_SHIFT       2
  1800.  
  1801. /* DosProfile module name string length */
  1802.  
  1803. #define PROF_MOD_NAME_SIZE   10
  1804.  
  1805. /* DosProfile error code for end of data */
  1806.  
  1807. #define PROF_END_OF_DATA     13
  1808.  
  1809. #endif /* INCL_DOSPROFILE */
  1810.  
  1811.  
  1812. /*** Virtual DOS Machine API support */
  1813.  
  1814. #ifdef INCL_DOSMVDM
  1815.  
  1816. typedef LHANDLE   HVDD;     /* hvdd */
  1817. typedef HVDD FAR *PHVDD;    /* phvdd */
  1818.  
  1819. APIRET  APIENTRY DosOpenVDD(PSZ pszVDD, PHVDD phvdd);
  1820.  
  1821. APIRET  APIENTRY DosRequestVDD(HVDD hvdd, SGID sgid, ULONG cmd,
  1822.                                ULONG cbInput, PVOID pInput,
  1823.                                ULONG cbOutput, PVOID pOutput);
  1824.  
  1825. APIRET  APIENTRY DosCloseVDD(HVDD hvdd);
  1826.  
  1827. APIRET  APIENTRY DosQueryDOSProperty(SGID sgid, PSZ pszName,
  1828.                                      ULONG cb, PSZ pch);
  1829.  
  1830. APIRET  APIENTRY DosSetDOSProperty(SGID sgid, PSZ pszName,
  1831.                                    ULONG cb, PSZ pch);
  1832. #endif /* INCL_DOSMVDM */
  1833.  
  1834.  
  1835. /* The following #else/#endif corresponds to a #if near the top of this */
  1836. /* file.  The next three lines include the 16-bit version of this file, */
  1837. /* hence these lines MUST be the last lines in this include file.       */
  1838. #else /* not INCL_32 */
  1839.  
  1840. #ifdef INCL_16
  1841. #include <bsedos16.h>
  1842. #endif /* INCL_16 */
  1843.  
  1844. #endif /* INCL_32 */
  1845.