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