home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c034 / 7.ddi / INC11 / BSEDOS.H$ / BSEDOS.bin
Encoding:
Text File  |  1990-01-09  |  29.0 KB  |  1,075 lines

  1. /**************************************************************************\
  2. *
  3. * Module Name: BSEDOS.H
  4. *
  5. * OS/2 Base Include File
  6. *
  7. * Copyright (c) 1987-1990, Microsoft Corporation. All rights reserved.
  8. *
  9. ****************************************************************************
  10. *
  11. * Subcomponents marked with "+" are partially included by default
  12. *
  13. *   #define:                To include:
  14. *
  15. * + INCL_DOSPROCESS         Process and thread support
  16. *   INCL_DOSINFOSEG         InfoSeg support
  17. * + INCL_DOSFILEMGR         File Management
  18. * + INCL_DOSMEMMGR          Memory Management
  19. * + INCL_DOSSEMAPHORES      Semaphore support
  20. * + INCL_DOSDATETIME        Date/Time and Timer support
  21. *   INCL_DOSMODULEMGR       Module manager
  22. * + INCL_DOSRESOURCES       Resource support
  23. *   INCL_DOSNLS             National Language Support
  24. *   INCL_DOSSIGNALS         Signals
  25. *   INCL_DOSMONITORS        Monitors
  26. *   INCL_DOSQUEUES          Queues
  27. *   INCL_DOSSESMGR          Session Manager Support
  28. *   INCL_DOSDEVICES         Device specific, ring 2 support
  29. *   INCL_DOSNMPIPES         Named Pipes Support
  30. *   INCL_DOSPROFILE         DosProfile API
  31. *   INCL_DOSTRACE           Trace support
  32. *   INCL_DOSMISC            Miscellanious functions
  33. *
  34. \**************************************************************************/
  35.  
  36. #define INCL_DOSINCLUDED
  37.  
  38. #ifdef INCL_DOS
  39.  
  40. #define INCL_DOSPROCESS
  41. #define INCL_DOSINFOSEG
  42. #define INCL_DOSFILEMGR
  43. #define INCL_DOSMEMMGR
  44. #define INCL_DOSSEMAPHORES
  45. #define INCL_DOSDATETIME
  46. #define INCL_DOSMODULEMGR
  47. #define INCL_DOSRESOURCES
  48. #define INCL_DOSNLS
  49. #define INCL_DOSSIGNALS
  50. #define INCL_DOSMONITORS
  51. #define INCL_DOSQUEUES
  52. #define INCL_DOSSESMGR
  53. #define INCL_DOSDEVICES
  54. #define INCL_DOSNMPIPES
  55. #define INCL_DOSPROFILE
  56. #define INCL_DOSTRACE
  57. #define INCL_DOSMISC
  58.  
  59. #endif /* INCL_DOS */
  60.  
  61. #ifdef INCL_ERRORS
  62. #define INCL_DOSERRORS
  63. #endif /* INCL_ERRORS */
  64.  
  65. #if (defined(INCL_DOSPROCESS) || !defined(INCL_NOCOMMON))
  66.  
  67. /*** General services */
  68.  
  69. USHORT APIENTRY DosBeep(USHORT, USHORT);
  70.  
  71. /*** Process and Thread support */
  72.  
  73. VOID APIENTRY DosExit(USHORT, USHORT);
  74.  
  75. /* DosExit codes */
  76.  
  77. #define EXIT_THREAD         0
  78. #define EXIT_PROCESS        1
  79.  
  80. #endif /* common INCL_DOSPROCESS stuff */
  81.  
  82. #ifdef INCL_DOSPROCESS
  83.  
  84. typedef struct _PIDINFO {         /* pidi */
  85.     PID pid;
  86.     TID tid;
  87.     PID pidParent;
  88. } PIDINFO;
  89. typedef PIDINFO FAR *PPIDINFO;
  90.  
  91. typedef VOID (FAR *PFNTHREAD)(VOID);
  92.  
  93. USHORT APIENTRY DosCreateThread(PFNTHREAD, PTID, PBYTE);
  94. USHORT APIENTRY DosResumeThread(TID);
  95. USHORT APIENTRY DosSuspendThread(TID);
  96.  
  97. /* DosCWait fScope code values */
  98.  
  99. #define DCWA_PROCESS        0
  100. #define DCWA_PROCESSTREE    1
  101.  
  102. /* DosCWait wait option values */
  103.  
  104. #define DCWW_WAIT   0
  105. #define DCWW_NOWAIT 1
  106.  
  107. typedef struct _RESULTCODES {     /* resc */
  108.     USHORT codeTerminate;
  109.     USHORT codeResult;
  110. } RESULTCODES;
  111. typedef RESULTCODES FAR *PRESULTCODES;
  112.  
  113. USHORT APIENTRY DosCwait(USHORT, USHORT, PRESULTCODES, PPID, PID);
  114. USHORT APIENTRY DosSleep(ULONG);
  115.  
  116. /* DosExitList codeTerminate values (also passed to ExitList routines) */
  117.  
  118. #define TC_EXIT          0
  119. #define TC_HARDERROR     1
  120. #define TC_TRAP          2
  121. #define TC_KILLPROCESS   3
  122.  
  123. typedef VOID (PASCAL FAR *PFNEXITLIST)(USHORT);
  124.  
  125. USHORT   APIENTRY DosEnterCritSec(VOID);
  126. USHORT   APIENTRY DosExitCritSec(VOID);
  127. USHORT APIENTRY DosExitList(USHORT, PFNEXITLIST);
  128.  
  129. /* DosExitList functions */
  130.  
  131. #define EXLST_ADD       1
  132. #define EXLST_REMOVE    2
  133. #define EXLST_EXIT      3
  134.  
  135. USHORT APIENTRY DosExecPgm(PCHAR, SHORT, USHORT, PSZ, PSZ, PRESULTCODES,
  136.                            PSZ);
  137.  
  138. /* DosExecPgm functions */
  139.  
  140. #define EXEC_SYNC           0
  141. #define EXEC_ASYNC          1
  142. #define EXEC_ASYNCRESULT    2
  143. #define EXEC_TRACE          3
  144. #define EXEC_BACKGROUND     4
  145.  
  146. USHORT APIENTRY DosGetPID(PPIDINFO);
  147. USHORT APIENTRY DosGetPPID(USHORT, PUSHORT);
  148.  
  149. USHORT APIENTRY DosGetPrty(USHORT, PUSHORT, USHORT);
  150. USHORT APIENTRY DosSetPrty(USHORT, USHORT, SHORT, USHORT);
  151.  
  152. /* Priority scopes */
  153.  
  154. #define PRTYS_PROCESS       0
  155. #define PRTYS_PROCESSTREE   1
  156. #define PRTYS_THREAD        2
  157.  
  158. /* Priority classes */
  159.  
  160. #define PRTYC_NOCHANGE      0
  161. #define PRTYC_IDLETIME      1
  162. #define PRTYC_REGULAR       2
  163. #define PRTYC_TIMECRITICAL  3
  164.  
  165. /* Priority deltas */
  166.  
  167. #define PRTYD_MINIMUM      (-31)
  168. #define PRTYD_MAXIMUM        31
  169.  
  170. USHORT APIENTRY DosKillProcess(USHORT, PID);
  171.  
  172. #define DKP_PROCESSTREE     0
  173. #define DKP_PROCESS         1
  174.  
  175. #endif /* INCL_DOSPROCESS */
  176.  
  177.  
  178. /*** InfoSeg support */
  179.  
  180. #ifdef INCL_DOSINFOSEG
  181.  
  182. /* Global Info Seg */
  183.  
  184. typedef struct _GINFOSEG {      /* gis */
  185.     ULONG   time;
  186.     ULONG   msecs;
  187.     UCHAR   hour;
  188.     UCHAR   minutes;
  189.     UCHAR   seconds;
  190.     UCHAR   hundredths;
  191.     USHORT  timezone;
  192.     USHORT  cusecTimerInterval;
  193.     UCHAR   day;
  194.     UCHAR   month;
  195.     USHORT  year;
  196.     UCHAR   weekday;
  197.     UCHAR   uchMajorVersion;
  198.     UCHAR   uchMinorVersion;
  199.     UCHAR   chRevisionLetter;
  200.     UCHAR   sgCurrent;
  201.     UCHAR   sgMax;
  202.     UCHAR   cHugeShift;
  203.     UCHAR   fProtectModeOnly;
  204.     USHORT  pidForeground;
  205.     UCHAR   fDynamicSched;
  206.     UCHAR   csecMaxWait;
  207.     USHORT  cmsecMinSlice;
  208.     USHORT  cmsecMaxSlice;
  209.     USHORT  bootdrive;
  210.     UCHAR   amecRAS[32];
  211.     UCHAR   csgWindowableVioMax;
  212.     UCHAR   csgPMMax;
  213. } GINFOSEG;
  214. typedef GINFOSEG FAR *PGINFOSEG;
  215.  
  216. /* Local Info Seg */
  217.  
  218. typedef struct _LINFOSEG {      /* lis */
  219.     PID     pidCurrent;
  220.     PID     pidParent;
  221.     USHORT  prtyCurrent;
  222.     TID     tidCurrent;
  223.     USHORT  sgCurrent;
  224.     UCHAR   rfProcStatus;
  225.     UCHAR   dummy1;
  226.     BOOL    fForeground;
  227.     UCHAR   typeProcess;
  228.     UCHAR   dummy2;
  229.     SEL     selEnvironment;
  230.     USHORT  offCmdLine;
  231.     USHORT  cbDataSegment;
  232.     USHORT  cbStack;
  233.     USHORT  cbHeap;
  234.     HMODULE hmod;
  235.     SEL     selDS;
  236. } LINFOSEG;
  237. typedef LINFOSEG FAR *PLINFOSEG;
  238.  
  239. /* Process Type codes (local info seg typeProcess field) */
  240.  
  241. #define PT_FULLSCREEN     0  /* Full screen app.          */
  242. #define PT_REALMODE       1  /* Real mode process         */
  243. #define PT_WINDOWABLEVIO  2  /* VIO windowable app.       */
  244. #define PT_PM             3  /* Presentation Manager app. */
  245. #define PT_DETACHED       4  /* Detached app.             */
  246.  
  247. /* Process Status Flag definitions (local info seg rfProcStatus field) */
  248.  
  249. #define PS_EXITLIST         1       /* Thread is in exitlist routine */
  250.  
  251.  
  252. USHORT APIENTRY DosGetInfoSeg(PSEL, PSEL);
  253.  
  254. /* Helper macros used to convert selector to PINFOSEG or LINFOSEG */
  255.  
  256. #define MAKEPGINFOSEG(sel)  ((PGINFOSEG)MAKEP(sel, 0))
  257. #define MAKEPLINFOSEG(sel)  ((PLINFOSEG)MAKEP(sel, 0))
  258.  
  259. #endif /* INCL_DOSINFOSEG */
  260.  
  261. #if (defined(INCL_DOSFILEMGR) || !defined(INCL_NOCOMMON))
  262.  
  263. /*** File manager */
  264.  
  265. /* DosChgFilePtr() file position codes */
  266.  
  267. #define FILE_BEGIN      0x0000
  268. #define FILE_CURRENT    0x0001
  269. #define FILE_END        0x0002
  270.  
  271. /* Directory handle types */
  272.  
  273. #define HDIR_SYSTEM  0x0001
  274. #define HDIR_CREATE  0xFFFF
  275.  
  276. /* Dosopen/DosQFHandState file attributes */
  277.  
  278. #define FILE_NORMAL     0x0000
  279. #define FILE_READONLY   0x0001
  280. #define FILE_HIDDEN     0x0002
  281. #define FILE_SYSTEM     0x0004
  282. #define FILE_DIRECTORY  0x0010
  283. #define FILE_ARCHIVED   0x0020
  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.  
  293. #define FILE_OPEN      0x0001
  294. #define FILE_TRUNCATE  0x0002
  295. #define FILE_CREATE    0x0010
  296.  
  297. /* DosOpen/DosSetFHandState flags */
  298.  
  299. #define OPEN_ACCESS_READONLY      0x0000
  300. #define OPEN_ACCESS_WRITEONLY     0x0001
  301. #define OPEN_ACCESS_READWRITE     0x0002
  302. #define OPEN_SHARE_DENYREADWRITE  0x0010
  303. #define OPEN_SHARE_DENYWRITE      0x0020
  304. #define OPEN_SHARE_DENYREAD       0x0030
  305. #define OPEN_SHARE_DENYNONE       0x0040
  306. #define OPEN_FLAGS_NOINHERIT      0x0080
  307. #define OPEN_FLAGS_FAIL_ON_ERROR  0x2000
  308. #define OPEN_FLAGS_WRITE_THROUGH  0x4000
  309. #define OPEN_FLAGS_DASD           0x8000
  310.  
  311. /* DosSearchPath() constants */
  312.  
  313. #define SEARCH_PATH            0x0000
  314. #define SEARCH_CUR_DIRECTORY   0x0001
  315. #define SEARCH_ENVIRONMENT     0x0002
  316.  
  317. USHORT APIENTRY DosOpen(PSZ, PHFILE, PUSHORT, ULONG, USHORT, USHORT, USHORT,
  318.                         ULONG);
  319. USHORT APIENTRY DosClose(HFILE);
  320. USHORT APIENTRY DosRead(HFILE, PVOID, USHORT, PUSHORT);
  321. USHORT APIENTRY DosWrite(HFILE, PVOID, USHORT, PUSHORT);
  322.  
  323. /* File time and date types */
  324.  
  325. typedef struct _FILESTATUS {    /* fsts */
  326.     FDATE  fdateCreation;
  327.     FTIME  ftimeCreation;
  328.     FDATE  fdateLastAccess;
  329.     FTIME  ftimeLastAccess;
  330.     FDATE  fdateLastWrite;
  331.     FTIME  ftimeLastWrite;
  332.     ULONG  cbFile;
  333.     ULONG  cbFileAlloc;
  334.     USHORT attrFile;
  335. } FILESTATUS;
  336. typedef FILESTATUS FAR *PFILESTATUS;
  337.  
  338. typedef struct _FSALLOCATE {    /* fsalloc */
  339.     ULONG  idFileSystem;
  340.     ULONG  cSectorUnit;
  341.     ULONG  cUnit;
  342.     ULONG  cUnitAvail;
  343.     USHORT cbSector;
  344. } FSALLOCATE;
  345. typedef FSALLOCATE FAR *PFSALLOCATE;
  346.  
  347. typedef struct _VOLUMELABEL {    /* vol */
  348.     BYTE cch;
  349.     CHAR szVolLabel[12];
  350. } VOLUMELABEL;
  351. typedef VOLUMELABEL FAR *PVOLUMELABEL;
  352.  
  353. typedef struct _FSINFO {    /* fsinf */
  354.     FDATE fdateCreation;
  355.     FTIME ftimeCreation;
  356.     VOLUMELABEL vol;
  357. } FSINFO;
  358. typedef FSINFO FAR *PFSINFO;
  359.  
  360. /* HANDTYPE values */
  361.  
  362. #define HANDTYPE_FILE     0x00
  363. #define HANDTYPE_DEVICE   0x01
  364. #define HANDTYPE_PIPE     0x02
  365. #define HANDTYPE_NETWORK  0x80
  366.  
  367. typedef struct _FILELOCK {    /* flock */
  368.     LONG lOffset;
  369.     LONG lRange;
  370. } FILELOCK;
  371. typedef FILELOCK FAR *PFILELOCK;
  372.  
  373. typedef SHANDLE HDIR;        /* hdir */
  374. typedef HDIR FAR *PHDIR;
  375.  
  376. USHORT APIENTRY DosDelete(PSZ, ULONG);
  377. USHORT APIENTRY DosDupHandle(HFILE, PHFILE);
  378.  
  379. USHORT APIENTRY DosQFHandState(HFILE, PUSHORT);
  380. USHORT APIENTRY DosSetFHandState(HFILE, USHORT);
  381. USHORT APIENTRY DosQHandType(HFILE, PUSHORT, PUSHORT);
  382.  
  383. USHORT APIENTRY DosReadAsync (HFILE, PULONG, PUSHORT, PVOID, USHORT,
  384.                               PUSHORT);
  385. USHORT APIENTRY DosWriteAsync(HFILE, PULONG, PUSHORT, PVOID, USHORT,
  386.                               PUSHORT);
  387.  
  388. USHORT APIENTRY DosFindFirst(PSZ, PHDIR, USHORT, PFILEFINDBUF, USHORT,
  389.                              PUSHORT, ULONG);
  390. USHORT APIENTRY DosFindNext(HDIR, PFILEFINDBUF, USHORT, PUSHORT);
  391. USHORT APIENTRY DosFindClose(HDIR);
  392. USHORT APIENTRY DosSearchPath(USHORT, PSZ, PSZ, PBYTE, USHORT);
  393.  
  394. USHORT APIENTRY DosNewSize(HFILE, ULONG);
  395. USHORT APIENTRY DosBufReset(HFILE);
  396.  
  397. USHORT APIENTRY DosChgFilePtr(HFILE, LONG, USHORT, PULONG);
  398.  
  399. USHORT APIENTRY DosFileLocks(HFILE, PFILELOCK, PFILELOCK);
  400.  
  401. USHORT APIENTRY DosMove(PSZ, PSZ, ULONG);
  402. USHORT APIENTRY DosMkDir(PSZ, ULONG);
  403. USHORT APIENTRY DosRmDir(PSZ, ULONG);
  404. USHORT APIENTRY DosSelectDisk(USHORT);
  405. USHORT APIENTRY DosQCurDisk(PUSHORT, PULONG);
  406.  
  407. USHORT APIENTRY DosChDir(PSZ, ULONG);
  408. USHORT APIENTRY DosQCurDir(USHORT, PBYTE, PUSHORT);
  409.  
  410. USHORT APIENTRY DosQFSInfo(USHORT, USHORT, PBYTE, USHORT);
  411. USHORT APIENTRY DosSetFSInfo(USHORT, USHORT, PBYTE, USHORT);
  412. USHORT APIENTRY DosQVerify(PBOOL);
  413. USHORT APIENTRY DosSetVerify(USHORT);
  414. USHORT APIENTRY DosSetMaxFH(USHORT);
  415.  
  416. USHORT APIENTRY DosQFileInfo(HFILE, USHORT, PFILESTATUS, USHORT);
  417. USHORT APIENTRY DosSetFileInfo(HFILE, USHORT, PFILESTATUS, USHORT);
  418.  
  419. USHORT APIENTRY DosQFileMode(PSZ, PUSHORT, ULONG);
  420. USHORT APIENTRY DosSetFileMode(PSZ, USHORT, ULONG);
  421.  
  422. #endif /* common INCL_DOSFILEMAN */
  423.  
  424. #if (defined(INCL_DOSMEMMGR) || !defined(INCL_NOCOMMON))
  425. /*** Memory management */
  426.  
  427. USHORT APIENTRY DosAllocSeg(USHORT, PSEL, USHORT);
  428. USHORT APIENTRY DosReallocSeg(USHORT, SEL);
  429. USHORT APIENTRY DosFreeSeg(SEL);
  430. USHORT APIENTRY DosGiveSeg(SEL, PID, PSEL);
  431. USHORT APIENTRY DosGetSeg(SEL);
  432. USHORT APIENTRY DosSizeSeg(SEL, PULONG);
  433.  
  434. /* Segment attribute flags (used with DosAllocSeg) */
  435.  
  436. #define SEG_NONSHARED       0x0000
  437. #define SEG_GIVEABLE        0x0001
  438. #define SEG_GETTABLE        0x0002
  439. #define SEG_DISCARDABLE     0x0004
  440.  
  441. #endif /* common INCL_DOSMEMMGR */
  442.  
  443. #ifdef INCL_DOSMEMMGR
  444.  
  445. USHORT APIENTRY DosAllocHuge(USHORT, USHORT, PSEL, USHORT, USHORT);
  446. USHORT APIENTRY DosReallocHuge(USHORT, USHORT, SEL);
  447. USHORT APIENTRY DosGetHugeShift(PUSHORT);
  448.  
  449. USHORT APIENTRY DosAllocShrSeg(USHORT, PSZ, PSEL);
  450.  
  451. USHORT APIENTRY DosLockSeg(SEL);
  452. USHORT APIENTRY DosUnlockSeg(SEL);
  453.  
  454. USHORT APIENTRY DosGetShrSeg(PSZ, PSEL);
  455.  
  456. USHORT APIENTRY DosMemAvail(PULONG);
  457. USHORT APIENTRY DosCreateCSAlias(SEL, PSEL);
  458.  
  459. USHORT APIENTRY DosSubAlloc(SEL, PUSHORT, USHORT);
  460. USHORT APIENTRY DosSubFree(SEL, USHORT, USHORT);
  461. USHORT APIENTRY DosSubSet(SEL, USHORT, USHORT);
  462.  
  463. #endif /* INCL_DOSMEMMGR */
  464.  
  465. #if (defined(INCL_DOSSEMAPHORES) || !defined(INCL_NOCOMMON))
  466.  
  467. /*** Semaphore support */
  468.  
  469. #define SEM_INDEFINITE_WAIT    (-1L)
  470. #define SEM_IMMEDIATE_RETURN     0L
  471.  
  472. USHORT APIENTRY DosSemClear(HSEM);
  473. USHORT APIENTRY DosSemSet(HSEM);
  474. USHORT APIENTRY DosSemWait(HSEM, LONG);
  475. USHORT APIENTRY DosSemSetWait(HSEM, LONG);
  476. USHORT APIENTRY DosSemRequest(HSEM, LONG);
  477.  
  478. #endif /* common INCL_DOSSEMAPHORES */
  479.  
  480. #ifdef INCL_DOSSEMAPHORES
  481.  
  482. typedef LHANDLE HSYSSEM;          /* hssm */
  483. typedef HSYSSEM FAR *PHSYSSEM;
  484.  
  485. USHORT APIENTRY DosCreateSem(USHORT, PHSYSSEM, PSZ);
  486.  
  487. #define CSEM_PRIVATE    0
  488. #define CSEM_PUBLIC     1
  489.  
  490. USHORT APIENTRY DosOpenSem(PHSEM, PSZ);
  491. USHORT APIENTRY DosCloseSem(HSEM);
  492.  
  493. typedef struct _MUXSEM {        /* mxs */
  494.     USHORT zero;
  495.     HSEM   hsem;
  496. } MUXSEM;
  497. typedef MUXSEM FAR *PMUXSEM;
  498.  
  499. typedef struct _MUXSEMLIST {    /* mxsl */
  500.     USHORT  cmxs;
  501.     MUXSEM  amxs[16];
  502. } MUXSEMLIST;
  503. typedef MUXSEMLIST FAR *PMUXSEMLIST;
  504.  
  505. /*
  506.  * Since a MUXSEMLIST structure is actually a variable length
  507.  * structure, the following macro may be used to define a MUXSEMLIST
  508.  * structure having size elements, named "name".
  509.  */
  510. #define DEFINEMUXSEMLIST(name, size) \
  511.     struct {                         \
  512.         USHORT cmxs;                 \
  513.         MUXSEM amxs[size];           \
  514.     } name;
  515.  
  516. /*
  517.  * This function actually takes a far pointer to a MUXSEMLIST structure
  518.  * as its second parameter, but in order to allow its use with the
  519.  * DEFINEMUXSEMLIST macro, it is declared here as PVOID.
  520.  */
  521. USHORT APIENTRY DosMuxSemWait(PUSHORT, PVOID, LONG);
  522.  
  523.  
  524. /*** Fast safe ram semaphores */
  525.  
  526. typedef struct _DOSFSRSEM {        /* dosfsrs */
  527.     USHORT cb;
  528.     PID    pid;
  529.     TID    tid;
  530.     USHORT cUsage;
  531.     USHORT client;
  532.     ULONG  sem;
  533. } DOSFSRSEM;
  534. typedef DOSFSRSEM FAR *PDOSFSRSEM;
  535.  
  536. USHORT APIENTRY DosFSRamSemRequest(PDOSFSRSEM, LONG);
  537. USHORT APIENTRY DosFSRamSemClear(PDOSFSRSEM);
  538.  
  539. #endif /* INCL_DOSSEMAPHORES */
  540.  
  541. #if (defined(INCL_DOSDATETIME) || !defined(INCL_NOCOMMON))
  542.  
  543. /*** Time support */
  544.  
  545. typedef struct _DATETIME {    /* date */
  546.     UCHAR   hours;
  547.     UCHAR   minutes;
  548.     UCHAR   seconds;
  549.     UCHAR   hundredths;
  550.     UCHAR   day;
  551.     UCHAR   month;
  552.     USHORT  year;
  553.     SHORT   timezone;
  554.     UCHAR   weekday;
  555. } DATETIME;
  556. typedef DATETIME FAR *PDATETIME;
  557.  
  558. USHORT APIENTRY DosGetDateTime(PDATETIME);
  559. USHORT APIENTRY DosSetDateTime(PDATETIME);
  560.  
  561. #endif /* common INCL_DOSDATETIME */
  562.  
  563. #ifdef INCL_DOSDATETIME
  564.  
  565. typedef SHANDLE HTIMER;
  566. typedef HTIMER FAR *PHTIMER;
  567.  
  568. USHORT APIENTRY DosTimerAsync(ULONG, HSEM, PHTIMER);
  569. USHORT APIENTRY DosTimerStart(ULONG, HSEM, PHTIMER);
  570. USHORT APIENTRY DosTimerStop(HTIMER);
  571.  
  572. #endif /* INCL_DOSDATETIME */
  573.  
  574.  
  575. /*** Module manager */
  576.  
  577. #ifdef INCL_DOSMODULEMGR
  578.  
  579. USHORT APIENTRY DosLoadModule(PSZ, USHORT, PSZ, PHMODULE);
  580. USHORT APIENTRY DosFreeModule(HMODULE);
  581. USHORT APIENTRY DosGetProcAddr(HMODULE, PSZ, PPFN);
  582. USHORT APIENTRY DosGetModHandle(PSZ, PHMODULE);
  583. USHORT APIENTRY DosGetModName(HMODULE, USHORT, PCHAR);
  584.  
  585. #endif /* INCL_DOSMODULEMGR */
  586.  
  587. #if (defined(INCL_DOSRESOURCES) || !defined(INCL_NOCOMMON))
  588.  
  589. /*** Resource support */
  590.  
  591. /* Predefined resource types */
  592.  
  593. #define RT_POINTER      1   /* mouse pointer shape        */
  594. #define RT_BITMAP       2   /* bitmap                     */
  595. #define RT_MENU         3   /* menu template              */
  596. #define RT_DIALOG       4   /* dialog template            */
  597. #define RT_STRING       5   /* string tables              */
  598. #define RT_FONTDIR      6   /* font directory             */
  599. #define RT_FONT         7   /* font                       */
  600. #define RT_ACCELTABLE   8   /* accelerator tables         */
  601. #define RT_RCDATA       9   /* binary data                */
  602. #define RT_MESSAGE      10  /* error msg     tables       */
  603. #define RT_DLGINCLUDE   11  /* dialog include file name   */
  604. #define RT_VKEYTBL      12  /* key to vkey tables         */
  605. #define RT_KEYTBL       13  /* key to UGL tables          */
  606. #define RT_CHARTBL      14  /* glyph to character tables  */
  607. #define RT_DISPLAYINFO  15  /* screen display information */
  608.  
  609. #endif /* common INCL_DOSRESOURCES */
  610.  
  611. #ifdef INCL_DOSRESOURCES
  612.  
  613. USHORT APIENTRY DosGetResource(HMODULE, USHORT, USHORT, PSEL);
  614.  
  615. #endif /* INCL_DOSRESOURCES */
  616.  
  617.  
  618. /*** NLS Support */
  619.  
  620. #ifdef INCL_DOSNLS
  621.  
  622. typedef struct _COUNTRYCODE { /* ctryc */
  623.     USHORT country;
  624.     USHORT codepage;
  625. } COUNTRYCODE;
  626. typedef COUNTRYCODE FAR *PCOUNTRYCODE;
  627.  
  628. /* fsDateFmt */
  629.  
  630. #define DATEFMT_MM_DD_YY  0x0000
  631. #define DATEFMT_DD_MM_YY  0x0001
  632. #define DATEFMT_YY_MM_DD  0x0002
  633.  
  634. /* fsCurrencyFmt */
  635.  
  636. #define CURRENCY_FOLLOW   0x0001
  637. #define CURRENCY_SPACE    0x0002
  638. #define CURRENCY_DECIMAL  0x0004
  639.  
  640. typedef struct _COUNTRYINFO { /* ctryi */
  641.     USHORT country;
  642.     USHORT codepage;
  643.     USHORT fsDateFmt;
  644.     CHAR   szCurrency[5];
  645.     CHAR   szThousandsSeparator[2];
  646.     CHAR   szDecimal[2];
  647.     CHAR   szDateSeparator[2];
  648.     CHAR   szTimeSeparator[2];
  649.     UCHAR  fsCurrencyFmt;
  650.     UCHAR  cDecimalPlace;
  651.     UCHAR  fsTimeFmt;
  652.     USHORT abReserved1[2];
  653.     CHAR   szDataSeparator[2];
  654.     USHORT abReserved2[5];
  655. } COUNTRYINFO;
  656. typedef COUNTRYINFO FAR *PCOUNTRYINFO;
  657.  
  658. USHORT APIENTRY DosGetCtryInfo(USHORT, PCOUNTRYCODE, PCOUNTRYINFO, PUSHORT);
  659. USHORT APIENTRY DosGetDBCSEv(USHORT, PCOUNTRYCODE, PCHAR);
  660. USHORT APIENTRY DosCaseMap(USHORT, PCOUNTRYCODE, PCHAR);
  661. USHORT APIENTRY DosGetCollate(USHORT, PCOUNTRYCODE, PCHAR, PUSHORT);
  662. USHORT APIENTRY DosGetCp(USHORT, PUSHORT, PUSHORT);
  663. USHORT APIENTRY DosSetCp(USHORT, USHORT);
  664. USHORT APIENTRY DosSetProcCp(USHORT, USHORT);
  665.  
  666. #endif /* INCL_DOSNLS */
  667.  
  668.  
  669. /*** Signal support */
  670.  
  671. #ifdef INCL_DOSSIGNALS
  672.  
  673. /* DosSetSigHandler signal numbers */
  674.  
  675. #define SIG_CTRLC           1       /* Control C            */
  676. #define SIG_BROKENPIPE      2       /* Broken Pipe          */
  677. #define SIG_KILLPROCESS     3       /* Program Termination  */
  678. #define SIG_CTRLBREAK       4       /* Control Break        */
  679. #define SIG_PFLG_A          5       /* Process Flag A       */
  680. #define SIG_PFLG_B          6       /* Process Flag B       */
  681. #define SIG_PFLG_C          7       /* Process Flag C       */
  682. #define SIG_CSIGNALS        8       /* number of signals plus one */
  683.  
  684. /* DosFlagProcess flag numbers */
  685.  
  686. #define PFLG_A              0       /* Process Flag A */
  687. #define PFLG_B              1       /* Process Flag B */
  688. #define PFLG_C              2       /* Process Flag C */
  689.  
  690. /* Signal actions */
  691.  
  692. #define SIGA_KILL           0
  693. #define SIGA_IGNORE         1
  694. #define SIGA_ACCEPT         2
  695. #define SIGA_ERROR          3
  696. #define SIGA_ACKNOWLEDGE    4
  697.  
  698. /* DosHoldSignal constants */
  699.  
  700. #define HLDSIG_ENABLE       0
  701. #define HLDSIG_DISABLE      1
  702.  
  703. /* DosFlagProcess codes */
  704.  
  705. #define FLGP_SUBTREE        0
  706. #define FLGP_PID            1
  707.  
  708. typedef VOID (PASCAL FAR *PFNSIGHANDLER)(USHORT, USHORT);
  709.  
  710. USHORT APIENTRY DosSetSigHandler(PFNSIGHANDLER, PFNSIGHANDLER FAR *,
  711.                                  PUSHORT, USHORT, USHORT);
  712. USHORT APIENTRY DosFlagProcess(PID, USHORT, USHORT, USHORT);
  713. USHORT APIENTRY DosHoldSignal(USHORT);
  714. USHORT APIENTRY DosSendSignal(USHORT, USHORT);
  715.  
  716. #endif /* INCL_DOSSIGNALS */
  717.  
  718.  
  719. /*** Monitor support */
  720.  
  721. #ifdef INCL_DOSMONITORS
  722.  
  723. #define MONITOR_DEFAULT 0x0000
  724. #define MONITOR_BEGIN   0x0001
  725. #define MONITOR_END     0x0002
  726.  
  727. typedef SHANDLE HMONITOR;    /* hmon */
  728. typedef HMONITOR FAR *PHMONITOR;
  729.  
  730. typedef struct _MONIN {    /* mnin */
  731.     USHORT cb;
  732.     BYTE abReserved[18];
  733.     BYTE abBuffer[108];
  734. } MONIN;
  735. typedef MONIN FAR *PMONIN;
  736.  
  737. typedef struct _MONOUT {    /* mnout */
  738.     USHORT cb;
  739.     UCHAR buffer[18];
  740.     BYTE abBuf[108];
  741. } MONOUT;
  742. typedef MONOUT FAR *PMONOUT;
  743.  
  744. USHORT APIENTRY DosMonOpen(PSZ, PHMONITOR);
  745. USHORT APIENTRY DosMonClose(HMONITOR);
  746. USHORT APIENTRY DosMonReg(HMONITOR, PBYTE, PBYTE, USHORT, USHORT);
  747. USHORT APIENTRY DosMonRead(PBYTE, UCHAR, PBYTE, PUSHORT);
  748. USHORT APIENTRY DosMonWrite(PBYTE, PBYTE, USHORT);
  749.  
  750. #endif /* INCL_DOSMONITORS */
  751.  
  752.  
  753. /*** Pipe and queue support */
  754.  
  755. #ifdef INCL_DOSQUEUES
  756.  
  757. /* DosCreateQueue() priority */
  758.  
  759. #define QUE_FIFO       0x0000
  760. #define QUE_LIFO       0x0001
  761. #define QUE_PRIORITY   0x0002
  762.  
  763. /* DosMakeNmPipe open modes */
  764.  
  765. #define PIPE_ACCESS_INBOUND       0x0000
  766. #define PIPE_ACCESS_OUTBOUND      0x0001
  767. #define PIPE_ACCESS_DUPLEX        0x0002
  768. #define PIPE_INHERIT              0x0000
  769. #define PIPE_NOINHERIT            0x0080
  770. #define PIPE_WRITEBEHIND          0x0000
  771. #define PIPE_NOWRITEBEHIND        0x4000
  772.  
  773. /* DosMakeNmPipe and DosQNmPHandState state */
  774.  
  775. #define PIPE_READMODE_BYTE        0x0000
  776. #define PIPE_READMODE_MESSAGE     0x0100
  777. #define PIPE_TYPE_BYTE            0x0000
  778. #define PIPE_TYPE_MESSAGE         0x0400
  779. #define PIPE_END_CLIENT           0x0000
  780. #define PIPE_END_SERVER           0x4000
  781. #define PIPE_WAIT                 0x0000
  782. #define PIPE_NOWAIT               0x8000
  783. #define PIPE_UNLIMITED_INSTANCES  0x00FF
  784.  
  785.  
  786. typedef struct _QUEUERESULT {    /* qresc */
  787.     PID pidProcess;
  788.     USHORT usEventCode;
  789. } QUEUERESULT;
  790. typedef QUEUERESULT FAR *PQUEUERESULT;
  791.  
  792. typedef SHANDLE HQUEUE;  /* hq */
  793. typedef HQUEUE FAR *PHQUEUE;
  794.  
  795. USHORT APIENTRY DosMakePipe(PHFILE, PHFILE, USHORT);
  796. USHORT APIENTRY DosCloseQueue(HQUEUE);
  797. USHORT APIENTRY DosCreateQueue(PHQUEUE, USHORT, PSZ);
  798. USHORT APIENTRY DosOpenQueue(PUSHORT, PHQUEUE, PSZ);
  799. USHORT APIENTRY DosPeekQueue(HQUEUE, PQUEUERESULT, PUSHORT, PVOID FAR *,
  800.                              PUSHORT, UCHAR, PBYTE, ULONG);
  801. USHORT APIENTRY DosPurgeQueue(HQUEUE);
  802. USHORT APIENTRY DosQueryQueue(HQUEUE, PUSHORT);
  803. USHORT APIENTRY DosReadQueue(HQUEUE, PQUEUERESULT, PUSHORT, PVOID FAR *,
  804.                              USHORT, UCHAR, PBYTE, HSEM);
  805. USHORT APIENTRY DosWriteQueue(HQUEUE, USHORT, USHORT, PBYTE, UCHAR);
  806.  
  807. #endif /* INCL_DOSQUEUES */
  808.  
  809. /*** Trace support */
  810.  
  811. #ifdef INCL_DOSTRACE
  812.  
  813. typedef struct PTRACEBUF {    /* ptrcbf */
  814.     PID    pid;
  815.     TID    tid;
  816.     USHORT cmd;
  817.     USHORT value;
  818.     USHORT offv;
  819.     USHORT segv;
  820.     USHORT mte;
  821.     USHORT rAX;
  822.     USHORT rBX;
  823.     USHORT rCX;
  824.     USHORT rDX;
  825.     USHORT rSI;
  826.     USHORT rDI;
  827.     USHORT rBP;
  828.     USHORT rDS;
  829.     USHORT rES;
  830.     USHORT rIP;
  831.     USHORT rCS;
  832.     USHORT rF;
  833.     USHORT rSP;
  834.     USHORT rSS;
  835. } PTRACEBUF;
  836. typedef PTRACEBUF FAR *PPTRACEBUF;
  837.  
  838. USHORT APIENTRY DosPTrace(PBYTE);
  839.  
  840. #endif /* INCL_DOSTRACE */
  841.  
  842. /*** Session manager support */
  843.  
  844. #ifdef INCL_DOSSESMGR
  845.  
  846. /* DosQAppType() application types */
  847.  
  848. #define NOTSPECIFIED    0x0000
  849. #define NOTWINDOCOMPAT  0x0001
  850. #define WINDOWCOMPAT    0x0002
  851. #define WINDOWAPI       0x0003
  852. #define BOUND           0x0004
  853. #define DYNAMICLINK     0x0008
  854. #define DOSFORMAT       0x0010
  855.  
  856. typedef struct _STARTDATA {   /* stdata */
  857.     USHORT Length;
  858.     USHORT Related;
  859.     USHORT FgBg;
  860.     USHORT TraceOpt;
  861.     PSZ    PgmTitle;
  862.     PSZ    PgmName;
  863.     PBYTE  PgmInputs;
  864.     PBYTE  TermQ;
  865.     PBYTE  Environment;
  866.     USHORT InheritOpt;
  867.     USHORT SessionType;
  868.     PSZ    IconFile;
  869.     ULONG  PgmHandle;
  870.     USHORT PgmControl;
  871.     USHORT InitXPos;
  872.     USHORT InitYPos;
  873.     USHORT InitXSize;
  874.     USHORT InitYSize;
  875. } STARTDATA;
  876. typedef STARTDATA FAR *PSTARTDATA;
  877.  
  878. /* STATUSDATA.SelectInd constants */
  879.  
  880. #define TARGET_UNCHANGED       0x0000
  881. #define TARGET_SELECTABLE      0x0001
  882. #define TARGET_NOT_SELECTABLE  0x0002
  883.  
  884. /* STATUSDATA.BindInd constants */
  885.  
  886. #define BIND_UNCHANGED  0x0000
  887. #define BIND_CHILD      0x0001
  888. #define BIND_NONE       0x0002
  889.  
  890. typedef struct _STATUSDATA { /* stsdata */
  891.     USHORT Length;
  892.     USHORT SelectInd;
  893.     USHORT BondInd;
  894. } STATUSDATA;
  895. typedef STATUSDATA FAR *PSTATUSDATA;
  896.  
  897. USHORT APIENTRY DosStartSession(PSTARTDATA, PUSHORT, PUSHORT);
  898. USHORT APIENTRY DosSetSession(USHORT, PSTATUSDATA);
  899. USHORT APIENTRY DosSelectSession(USHORT, ULONG);
  900. USHORT APIENTRY DosStopSession(USHORT, USHORT, ULONG);
  901. USHORT APIENTRY DosQAppType(PSZ, PUSHORT);
  902.  
  903. #endif /* INCL_DOSSESMGR */
  904.  
  905.  
  906. /*** Device support */
  907.  
  908. #if (defined(INCL_DOSDEVICES) || defined(INCL_DOSDEVIOCTL))
  909.  
  910. /* DosPhysicalDisk() physical disk information */
  911.  
  912. #define INFO_COUNT_PARTITIONABLE_DISKS  0x0001
  913. #define INFO_GETIOCTLHANDLE             0x0002
  914. #define INFO_FREEIOCTLHANDLE            0x0003
  915.  
  916. /* DosDevConfig information requests */
  917.  
  918. #define DEVINFO_PRINTER      0x0000
  919. #define DEVINFO_RS232        0x0001
  920. #define DEVINFO_FLOPPY       0x0002
  921. #define DEVINFO_COPROCESSOR  0x0003
  922. #define DEVINFO_SUBMODEL     0x0004
  923. #define DEVINFO_MODEL        0x0005
  924. #define DEVINFO_ADAPTER      0x0006
  925.  
  926.  
  927. USHORT APIENTRY DosDevConfig(PVOID, USHORT, USHORT);
  928. USHORT APIENTRY DosDevIOCtl(PVOID, PVOID, USHORT, USHORT, HFILE);
  929.  
  930. USHORT APIENTRY DosCLIAccess(VOID);
  931. USHORT APIENTRY DosPortAccess(USHORT, USHORT, USHORT, USHORT);
  932. USHORT APIENTRY DosPhysicalDisk(USHORT, PBYTE, USHORT, PBYTE, USHORT);
  933.  
  934. USHORT APIENTRY DosR2StackRealloc(USHORT);
  935. VOID   APIENTRY DosCallback(PFN);
  936.  
  937. #endif /* INCL_DOSDEVICES */
  938.  
  939.  
  940. /*** DosNamedPipes API Support */
  941.  
  942. #ifdef INCL_DOSNMPIPES
  943.  
  944. /* DosPeekNmPipe() pipe states */
  945.  
  946. #define PIPE_STATE_DISCONNECTED  0x0001
  947. #define PIPE_STATE_LISTENING     0x0002
  948. #define PIPE_STATE_CONNECTED     0x0003
  949. #define PIPE_STATE_CLOSING       0x0004
  950.  
  951. /* DosMakeNmPipe constants */
  952.  
  953. #define PIPE_ACCESS_INBOUND   0x0000
  954. #define PIPE_ACCESS_OUTBOUND  0x0001
  955. #define PIPE_ACCESS_DUPLEX    0x0002
  956. #define PIPE_INHERIT          0x0000
  957. #define PIPE_NOINHERIT        0x0080
  958. #define PIPE_WRITEBEHIND      0x0000
  959. #define PIPE_NOWRITEBEHIND    0x4000
  960.  
  961. typedef struct _PIPEINFO {    /* nmpinf */
  962.     USHORT cbOut;
  963.     USHORT cbIn;
  964.     BYTE   cbMaxInst;
  965.     BYTE   cbCurInst;
  966.     BYTE   cbName;
  967.     CHAR   szName[1];
  968. } PIPEINFO;
  969. typedef PIPEINFO FAR *PPIPEINFO;
  970.  
  971. typedef SHANDLE HPIPE;     /* hp */
  972. typedef HPIPE FAR *PHPIPE;
  973.  
  974. USHORT APIENTRY DosCallNmPipe(PSZ, PBYTE, USHORT, PBYTE, USHORT, PUSHORT,
  975.                               ULONG);
  976. USHORT APIENTRY DosConnectNmPipe(HPIPE);
  977. USHORT APIENTRY DosDisConnectNmPipe(HPIPE);
  978. USHORT APIENTRY DosMakeNmPipe(PSZ, PHPIPE, USHORT, USHORT, USHORT, USHORT,
  979.                               ULONG);
  980. USHORT APIENTRY DosPeekNmPipe(HPIPE, PBYTE, USHORT, PUSHORT, PUSHORT,
  981.                               PUSHORT);
  982. USHORT APIENTRY DosQNmPHandState(HPIPE, PUSHORT);
  983. USHORT APIENTRY DosQNmPipeInfo(HPIPE, USHORT, PBYTE, USHORT);
  984. USHORT APIENTRY DosQNmPipeSemState(HSEM, PBYTE, USHORT);
  985. USHORT APIENTRY DosSetNmPHandState(HPIPE, USHORT);
  986. USHORT APIENTRY DosSetNmPipeSem(HPIPE, HSEM, USHORT);
  987. USHORT APIENTRY DosTransactNmPipe(HPIPE, PBYTE, USHORT, PBYTE, USHORT,
  988.                                   PUSHORT);
  989. USHORT APIENTRY DosWaitNmPipe(PSZ, ULONG);
  990.  
  991. #endif /* INCL_DOSNMPIPES */
  992.  
  993. /*** DosProfile API support */
  994.  
  995. #ifdef INCL_DOSPROFILE
  996.  
  997. /* DosProfile ordinal number */
  998.  
  999. #define PROF_ORDINAL     133
  1000.  
  1001. /* DosProfile usType */
  1002.  
  1003. #define PROF_SYSTEM      0
  1004. #define PROF_USER        1
  1005. #define PROF_USEDD       2
  1006. #define PROF_KERNEL      4
  1007. #define PROF_VERBOSE     8
  1008. #define PROF_ENABLE     16
  1009.  
  1010. /* DosProfile usFunc */
  1011.  
  1012. #define PROF_ALLOC       0
  1013. #define PROF_CLEAR       1
  1014. #define PROF_ON          2
  1015. #define PROF_OFF         3
  1016. #define PROF_DUMP        4
  1017. #define PROF_FREE        5
  1018.  
  1019. /* DosProfile tic count granularity (DWORD) */
  1020.  
  1021. #define PROF_SHIFT       2
  1022.  
  1023. /* DosProfile module name string length */
  1024.  
  1025. #define PROF_MOD_NAME_SIZE   10
  1026.  
  1027. /* DosProfile error code for end of data */
  1028.  
  1029. #define PROF_END_OF_DATA     13
  1030.  
  1031. #endif /* INCL_DOSPROFILE */
  1032.  
  1033. #ifdef INCL_DOSMISC
  1034.  
  1035. /*** Miscelanious functions ***/
  1036.  
  1037. /* DosError() error-handling types */
  1038.  
  1039. #define HARDERROR_ENABLE   0x0001
  1040. #define HARDERROR_DISABLE  0x0000
  1041. #define EXCEPTION_ENABLE   0x0000
  1042. #define EXCEPTION_DISABLE  0x0002
  1043.  
  1044. /* DosGetMachineMode() machine modes */
  1045.  
  1046. #define MODE_REAL       0x0000
  1047. #define MODE_PROTECTED  0x0001
  1048.  
  1049. /* DosSetVec vectors */
  1050.  
  1051. #define VECTOR_DIVIDE_BY_ZERO   0x0000
  1052. #define VECTOR_OVERFLOW         0x0004
  1053. #define VECTOR_OUTOFBOUNDS      0x0005
  1054. #define VECTOR_INVALIDOPCODE    0x0006
  1055. #define VECTOR_NO_EXTENSION     0x0007
  1056. #define VECTOR_EXTENSION_ERROR  0x0010
  1057.  
  1058.  
  1059. USHORT APIENTRY DosError(USHORT);
  1060. USHORT APIENTRY DosErrClass(USHORT, PUSHORT, PUSHORT, PUSHORT);
  1061. USHORT APIENTRY DosSetVec(USHORT, PFN, PPFN);
  1062. USHORT APIENTRY DosQSysInfo(USHORT, PBYTE, USHORT);
  1063. USHORT APIENTRY DosGetEnv(PUSHORT, PUSHORT);
  1064. USHORT APIENTRY DosScanEnv(PSZ, PSZ  FAR *);
  1065. USHORT APIENTRY DosGetVersion(PUSHORT);
  1066. USHORT APIENTRY DosGetMachineMode(PBYTE);
  1067.  
  1068. USHORT APIENTRY DosGetMessage(PCHAR FAR *, USHORT, PCHAR, USHORT, USHORT,
  1069.                               PSZ, PUSHORT);
  1070. USHORT APIENTRY DosInsMessage(PCHAR FAR *, USHORT, PSZ, USHORT, PCHAR,
  1071.                               USHORT, PUSHORT);
  1072. USHORT APIENTRY DosPutMessage(HFILE, USHORT, PCHAR);
  1073.  
  1074. #endif /* INCL_DOSMISC */
  1075.