home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / msysjour / vol04 / 01b / macsl / bsedos.h next >
C/C++ Source or Header  |  1988-09-15  |  22KB  |  789 lines

  1. /***************************************************************************\
  2. *
  3. * Module Name: OS2DOS.H
  4. *
  5. * OS/2 Base Include File
  6. *
  7. * Copyright (c) 1987  Microsoft Corporation
  8. * Copyright (c) 1987  IBM Corporation
  9. *
  10. *****************************************************************************
  11. *
  12. * Subcomponents marked with "+" are partially included by default
  13. *
  14. *   #define:                To include:
  15. *
  16. * + INCL_DOSPROCESS         Process and thread support
  17. *   INCL_DOSINFOSEG         InfoSeg support
  18. * + INCL_DOSFILEMGR         File Management
  19. * + INCL_DOSMEMMGR          Memory Management
  20. * + INCL_DOSSEMAPHORES      Semaphore support
  21. * + INCL_DOSDATETIME        Date/Time and Timer support
  22. *   INCL_DOSMODULEMGR       Module manager
  23. * + INCL_DOSRESOURCES       Resource support
  24. *   INCL_DOSNLS             National Language Support
  25. *   INCL_DOSSIGNALS         Signals
  26. *   INCL_DOSMONITORS        Monitors
  27. *   INCL_DOSQUEUES          Queues
  28. *   INCL_DOSSESMGR          Session Manager Support
  29. *   INCL_DOSDEVICES         Device specific, ring 2 support
  30. *   INCL_DOSPROFILE         DosProfile API
  31. *
  32. \***************************************************************************/
  33.  
  34. #define INCL_DOSINCLUDED
  35.  
  36. #ifdef INCL_DOS
  37.  
  38. #define INCL_DOSPROCESS
  39. #define INCL_DOSINFOSEG
  40. #define INCL_DOSFILEMGR
  41. #define INCL_DOSMEMMGR
  42. #define INCL_DOSSEMAPHORES
  43. #define INCL_DOSDATETIME
  44. #define INCL_DOSMODULEMGR
  45. #define INCL_DOSRESOURCES
  46. #define INCL_DOSNLS
  47. #define INCL_DOSSIGNALS
  48. #define INCL_DOSMONITORS
  49. #define INCL_DOSQUEUES
  50. #define INCL_DOSSESMGR
  51. #define INCL_DOSDEVICES
  52. #define INCL_DOSPROFILE
  53.  
  54. #endif /* INCL_DOS */
  55.  
  56. #ifdef INCL_ERRORS
  57. #define INCL_DOSERRORS
  58. #endif /* INCL_ERRORS */
  59.  
  60. #ifdef INCL_DOSPROCESS
  61.  
  62. /*** General services */
  63.  
  64. USHORT APIENTRY DosBeep(USHORT, USHORT);
  65.  
  66. /*** Process and Thread support */
  67.  
  68. VOID APIENTRY DosExit(USHORT, USHORT);
  69.  
  70. /* DosExit codes */
  71.  
  72. #define EXIT_THREAD         0
  73. #define EXIT_PROCESS        1
  74.  
  75. #endif /* common INCL_DOSPROCESS stuff */
  76.  
  77. #ifdef INCL_DOSPROCESS
  78.  
  79. typedef struct _PIDINFO {         /* pidi */
  80.     PID pid;
  81.     TID tid;
  82.     PID pidParent;
  83. } PIDINFO;
  84. typedef PIDINFO FAR *PPIDINFO;
  85.  
  86. typedef VOID (PASCAL FAR *PFNTHREAD)(/*VOID*/);
  87.  
  88. USHORT APIENTRY DosCreateThread(PFNTHREAD, PTID, PBYTE);
  89. USHORT APIENTRY DosResumeThread(TID);
  90. USHORT APIENTRY DosSuspendThread(TID);
  91.  
  92. /* Action code values */
  93.  
  94. #define DCWA_PROCESS        0
  95. #define DCWA_PROCESSTREE    1
  96.  
  97. /* Wait option values */
  98.  
  99. #define DCWW_WAIT   0
  100. #define DCWW_NOWAIT 1
  101.  
  102. typedef struct _RESULTCODES {     /* resc */
  103.     USHORT codeTerminate;
  104.     USHORT codeResult;
  105. } RESULTCODES;
  106. typedef RESULTCODES FAR *PRESULTCODES;
  107.  
  108. USHORT APIENTRY DosCwait(USHORT, USHORT, PRESULTCODES, PPID, PID);
  109. USHORT APIENTRY DosSleep(ULONG);
  110.  
  111. /* codeTerminate values (also passed to ExitList routines) */
  112.  
  113. #define TC_EXIT          0
  114. #define TC_HARDERROR     1
  115. #define TC_TRAP          2
  116. #define TC_KILLPROCESS   3
  117.  
  118. typedef VOID (PASCAL FAR *PFNEXITLIST)(/*USHORT*/);
  119.  
  120. VOID   APIENTRY DosEnterCritSec(VOID);
  121. VOID   APIENTRY DosExitCritSec(VOID);
  122. USHORT APIENTRY DosExitList(USHORT, PFNEXITLIST);
  123.  
  124. /* DosExitList functions */
  125.  
  126. #define EXLST_ADD       1
  127. #define EXLST_REMOVE    2
  128. #define EXLST_EXIT      3
  129.  
  130. USHORT APIENTRY DosExecPgm(PCHAR, SHORT, USHORT, PSZ, PSZ, PRESULTCODES, PSZ);
  131.  
  132. /* DosExecPgm functions */
  133.  
  134. #define EXEC_SYNC           0
  135. #define EXEC_ASYNC          1
  136. #define EXEC_ASYNCRESULT    2
  137. #define EXEC_TRACE          3
  138. #define EXEC_BACKGROUND     4
  139. #define EXEC_LOAD           5
  140.  
  141. USHORT APIENTRY DosGetPid(PPIDINFO);
  142. USHORT APIENTRY DosGetPPid(USHORT, PUSHORT);
  143.  
  144. USHORT APIENTRY DosGetPrty(USHORT, PUSHORT, USHORT);
  145. USHORT APIENTRY DosSetPrty(USHORT, USHORT, SHORT, USHORT);
  146.  
  147. /* Priority scopes */
  148.  
  149. #define PRTYS_PROCESS       0
  150. #define PRTYS_PROCESSTREE   1
  151. #define PRTYS_THREAD        2
  152.  
  153. /* Priority classes */
  154.  
  155. #define PRTYC_NOCHANGE      0
  156. #define PRTYC_IDLETIME      1
  157. #define PRTYC_REGULAR       2
  158. #define PRTYC_TIMECRITICAL  3
  159.  
  160. USHORT APIENTRY DosKillProcess(USHORT, PID);
  161.  
  162. #define DKP_PROCESS         0
  163. #define DKP_PROCESSTREE     1
  164.  
  165. #endif /* INCL_DOSPROCESS */
  166.  
  167.  
  168. /*** InfoSeg support */
  169.  
  170. #ifdef INCL_DOSINFOSEG
  171.  
  172. /* Global Info Seg */
  173.  
  174. typedef struct _GINFOSEG {      /* gis */
  175.     ULONG   time;
  176.     ULONG   msecs;
  177.     UCHAR   hour;
  178.     UCHAR   minutes;
  179.     UCHAR   seconds;
  180.     UCHAR   hundredths;
  181.     USHORT  timezone;
  182.     USHORT  cusecTimerInterval;
  183.     UCHAR   day;
  184.     UCHAR   month;
  185.     USHORT  year;
  186.     UCHAR   weekday;
  187.     UCHAR   uchMajorVersion;
  188.     UCHAR   uchMinorVersion;
  189.     UCHAR   chRevisionLetter;
  190.     UCHAR   sgCurrent;
  191.     UCHAR   sgMax;
  192.     UCHAR   cHugeShift;
  193.     UCHAR   fProtectModeOnly;
  194.     USHORT  pidForeground;
  195.     UCHAR   fDynamicSched;
  196.     UCHAR   csecMaxWait;
  197.     USHORT  cmsecMinSlice;
  198.     USHORT  cmsecMaxSlice;
  199.     USHORT  bootdrive;
  200.     UCHAR   amecRAS[32];
  201.     UCHAR   csgWindowableVioMax;
  202.     UCHAR   csgPMMax;
  203. } GINFOSEG;
  204. typedef GINFOSEG FAR *PGINFOSEG;
  205.  
  206. /* Local Info Seg */
  207.  
  208. typedef struct _LINFOSEG {      /* lis */
  209.     PID     pidCurrent;
  210.     PID     pidParent;
  211.     USHORT  prtyCurrent;
  212.     TID     tidCurrent;
  213.     USHORT  sgCurrent;
  214.     UCHAR   rfProcStatus;
  215.     UCHAR   dummy1;
  216.     BOOL    fForeground;
  217.     UCHAR   typeProcess;
  218.     UCHAR   dummy2;
  219.     SEL     selEnvironment;
  220.     USHORT  offCmdLine;
  221.     USHORT  cbDataSegment;
  222.     USHORT  cbStack;
  223.     USHORT  cbHeap;
  224.     HMODULE hmod;
  225.     SEL     selDS;
  226. } LINFOSEG;
  227. typedef LINFOSEG FAR *PLINFOSEG;
  228.  
  229. /* Process Type codes (local info seg typeProcess field) */
  230.  
  231. #define PT_FULLSCREEN       0       /* Full screen app. */
  232. #define PT_REALMODE         1       /* Real mode process */
  233. #define PT_WINDOWABLEVIO    2       /* VIO windowable app. */
  234. #define PT_PM               3       /* Presentation Manager app. */
  235. #define PT_DETACHED         4       /* Detached app. */
  236.  
  237. /* Process Status Flag definitions (local info seg rfProcStatus field) */
  238.  
  239. #define PS_EXITLIST         1       /* Thread is in exitlist routine */
  240.  
  241.  
  242. USHORT APIENTRY DosGetInfoSeg(PSEL, PSEL);
  243.  
  244. /* Helper macros used to convert selector to PINFOSEG or LINFOSEG */
  245.  
  246. #define MAKEPGINFOSEG(sel)  ((PGINFOSEG)MAKEP(sel, 0))
  247. #define MAKEPLINFOSEG(sel)  ((PLINFOSEG)MAKEP(sel, 0))
  248.  
  249. #endif /* INCL_DOSINFOSEG */
  250.  
  251. #ifdef INCL_DOSFILEMGR
  252.  
  253. /*** File manager */
  254.  
  255. typedef SHANDLE HFILE;     /* hf */
  256. typedef HFILE FAR *PHFILE;
  257.  
  258. USHORT APIENTRY DosOpen(PSZ, PHFILE, PUSHORT, ULONG, USHORT, USHORT, USHORT, ULONG);
  259. USHORT APIENTRY DosClose(HFILE);
  260. USHORT APIENTRY DosRead(HFILE, PVOID, USHORT, PUSHORT);
  261. USHORT APIENTRY DosWrite(HFILE, PVOID, USHORT, PUSHORT);
  262.  
  263. /* File time and date types */
  264.  
  265. typedef struct _FILESTATUS {    /* fsts */
  266.     FDATE  fdateCreation;
  267.     FTIME  ftimeCreation;
  268.     FDATE  fdateLastAccess;
  269.     FTIME  ftimeLastAccess;
  270.     FDATE  fdateLastWrite;
  271.     FTIME  ftimeLastWrite;
  272.     ULONG  cbFile;
  273.     ULONG  cbFileAlloc;
  274.     USHORT attrFile;
  275. } FILESTATUS;
  276. typedef FILESTATUS FAR *PFILESTATUS;
  277.  
  278. typedef struct _FSALLOCATE {    /* fsalloc */
  279.     ULONG  idFileSystem;
  280.     ULONG  cSectorUnit;
  281.     ULONG  cUnit;
  282.     ULONG  cUnitAvail;
  283.     USHORT cbSector;
  284. } FSALLOCATE;
  285. typedef FSALLOCATE FAR *PFSALLOCATE;
  286.  
  287. typedef SHANDLE HDIR;        /* hdir */
  288. typedef HDIR FAR *PHDIR;
  289.  
  290. USHORT APIENTRY DosDelete(PSZ, ULONG);
  291. USHORT APIENTRY DosDupHandle(HFILE, PHFILE);
  292.  
  293. USHORT APIENTRY DosQFHandState(HFILE, PUSHORT);
  294. USHORT APIENTRY DosSetFHandState(HFILE, USHORT);
  295. USHORT APIENTRY DosQHandType(HFILE, PUSHORT, PUSHORT);
  296.  
  297. USHORT APIENTRY DosReadAsync (HFILE, PULONG, PUSHORT, PVOID, USHORT, PUSHORT);
  298. USHORT APIENTRY DosWriteAsync(HFILE, PULONG, PUSHORT, PVOID, USHORT, PUSHORT);
  299.  
  300. USHORT APIENTRY DosFindFirst(PSZ, PHDIR, USHORT, PFILEFINDBUF, USHORT, PUSHORT, ULONG);
  301. USHORT APIENTRY DosFindNext(HDIR, PFILEFINDBUF, USHORT, PUSHORT);
  302. USHORT APIENTRY DosFindClose(HDIR);
  303.  
  304. USHORT APIENTRY DosNewSize(HFILE, ULONG);
  305. USHORT APIENTRY DosBufReset(HFILE);
  306.  
  307. USHORT APIENTRY DosChgFilePtr(HFILE, LONG, USHORT, PULONG);
  308.  
  309. USHORT APIENTRY DosFileLocks(HFILE, PLONG, PLONG);
  310.  
  311. USHORT APIENTRY DosMove(PSZ, PSZ, ULONG);
  312. USHORT APIENTRY DosMkDir(PSZ, ULONG);
  313. USHORT APIENTRY DosRmDir(PSZ, ULONG);
  314. USHORT APIENTRY DosSelectDisk(USHORT);
  315. USHORT APIENTRY DosQCurDisk(PUSHORT, PULONG);
  316.  
  317. USHORT APIENTRY DosChDir(PSZ, ULONG);
  318. USHORT APIENTRY DosQCurDir(USHORT, PBYTE, PUSHORT);
  319.  
  320. USHORT APIENTRY DosQFSInfo(USHORT, USHORT, PBYTE, USHORT);
  321. USHORT APIENTRY DosSetFSInfo(USHORT, USHORT, PBYTE, USHORT);
  322. USHORT APIENTRY DosQVerify(PUSHORT);
  323. USHORT APIENTRY DosSetVerify(USHORT);
  324. USHORT APIENTRY DosSetMaxFH(USHORT);
  325.  
  326. USHORT APIENTRY DosQFileInfo(HFILE, USHORT, PBYTE, USHORT);
  327. USHORT APIENTRY DosSetFileInfo(HFILE, USHORT, PBYTE, USHORT);
  328.  
  329. USHORT APIENTRY DosQFileMode(PSZ, PUSHORT, ULONG);
  330. USHORT APIENTRY DosSetFileMode(PSZ, USHORT, ULONG);
  331.  
  332. /*
  333.  *
  334.  *  Consistent names for file functions
  335.  *
  336.  *  DosQueryFileState       DosQFHandState
  337.  *  DosSetFileState         DosSetFHandState
  338.  *  DosQueryHandleType      DosQHandType
  339.  *  DosResetBuffer          DosBufReset
  340.  *  DosSetFilePtr           DosChgFilePtr
  341.  *  DosMoveFile             DosMove
  342.  *  DosMakeDirectory        DosMkdir
  343.  *  DosRemoveDirectory      DosRmdir
  344.  *  DosSetCurrentDisk       DosSelectDisk
  345.  *  DosQueryCurrentDisk     DosQCurDisk
  346.  *  DosSetCurrentDirectory  DosChdir
  347.  *  DosQueryCurrentDirectory DosQCurDir
  348.  *  DosQueryFileSystemInfo  DosQFSInfo
  349.  *  DosSetFileSystemInfo    DosSetFSInfo
  350.  *  DosQueryWriteVerify     DosQVerify
  351.  *  DosQueryFileMode        DosQFileMode
  352.  *  DosSetWriteVerify       DosSetVerify
  353.  *  DosSetMaxFileHandles    DosSetMaxFH
  354.  *  DosQueryFileInfo        DosQFileInfo
  355.  *
  356.  */
  357.  
  358. #endif /* common INCL_DOSFILEMAN */
  359.  
  360. #ifdef INCL_DOSMEMMGR
  361. /*** Memory management */
  362.  
  363. USHORT APIENTRY DosAllocSeg(USHORT, PSEL, USHORT);
  364. USHORT APIENTRY DosReallocSeg(USHORT, SEL);
  365. USHORT APIENTRY DosFreeSeg(SEL);
  366. USHORT APIENTRY DosGiveSeg(SEL, PID, PSEL);
  367. USHORT APIENTRY DosGetSeg(SEL);
  368. USHORT APIENTRY DosSizeSeg(SEL, PULONG);
  369.  
  370. /* Segment attribute flags (used with DosAllocSeg) */
  371.  
  372. #define SEG_GIVEABLE        0x0001
  373. #define SEG_GETTABLE        0x0002
  374. #define SEG_DISCARDABLE     0x0004
  375.  
  376. #endif /* common INCL_DOSMEMMGR */
  377.  
  378. #ifdef INCL_DOSMEMMGR
  379.  
  380. USHORT APIENTRY DosAllocHuge(USHORT, USHORT, PSEL, USHORT, USHORT);
  381. USHORT APIENTRY DosReallocHuge(USHORT, USHORT, SEL);
  382. USHORT APIENTRY DosGetHugeShift(PUSHORT);
  383.  
  384. USHORT APIENTRY DosAllocShrSeg(USHORT, PSZ, PSEL);
  385.  
  386. USHORT APIENTRY DosLockSeg(SEL);
  387. USHORT APIENTRY DosUnlockSeg(SEL);
  388.  
  389. USHORT APIENTRY DosGetShrSeg(PSZ, PSEL);
  390.  
  391. USHORT APIENTRY DosMemAvail(PULONG);
  392. USHORT APIENTRY DosCreateCSAlias(SEL, PSEL);
  393.  
  394. USHORT APIENTRY DosSubAlloc(SEL, PUSHORT, USHORT);
  395. USHORT APIENTRY DosSubFree(SEL, USHORT, USHORT);
  396. USHORT APIENTRY DosSubSet(SEL, USHORT, USHORT);
  397.  
  398. #endif /* INCL_DOSMEMMGR */
  399.  
  400. #ifdef INCL_DOSSEMAPHORES
  401.  
  402. /*** Semaphore support */
  403.  
  404. USHORT APIENTRY DosSemClear(HSEM);
  405. USHORT APIENTRY DosSemSet(HSEM);
  406. USHORT APIENTRY DosSemWait(HSEM, LONG);
  407. USHORT APIENTRY DosSemSetWait(HSEM, LONG);
  408. USHORT APIENTRY DosSemRequest(HSEM, LONG);
  409.  
  410. #endif /* common INCL_DOSSEMAPHORES */
  411.  
  412. #ifdef INCL_DOSSEMAPHORES
  413.  
  414. typedef LHANDLE HSYSSEM;          /* hssm */
  415. typedef HSYSSEM FAR *PHSYSSEM;
  416.  
  417. USHORT APIENTRY DosCreateSem(USHORT, PHSYSSEM, PSZ);
  418.  
  419. #define CSEM_PRIVATE    0
  420. #define CSEM_PUBLIC     1
  421.  
  422. USHORT APIENTRY DosOpenSem(PHSEM, PSZ);
  423. USHORT APIENTRY DosCloseSem(HSEM);
  424.  
  425. typedef struct _MUXSEM {        /* mxs */
  426.     USHORT zero;
  427.     HSEM   hsem;
  428. } MUXSEM;
  429. typedef MUXSEM FAR *PMUXSEM;
  430.  
  431. typedef struct _MUXSEMLIST {    /* mxsl */
  432.     USHORT  cmxs;
  433.     MUXSEM  amxs[16];
  434. } MUXSEMLIST;
  435. typedef MUXSEMLIST FAR *PMUXSEMLIST;
  436.  
  437. /*
  438.  * Since a MUXSEMLIST structure is actually a variable length
  439.  * structure, the following macro may be used to define a MUXSEMLIST
  440.  * structure having size elements, named "name".
  441.  */
  442. #define DEFINEMUXSEMLIST(name, size) \
  443.     struct {                         \
  444.         USHORT cmxs;                 \
  445.         MUXSEM amxs[size];           \
  446.     } name;
  447.  
  448. /*
  449.  * This function actually takes a far pointer to a MUXSEMLIST structure
  450.  * as its second parameter, but in order to allow its use with the
  451.  * DEFINEMUXSEMLIST macro, it is declared here as PVOID.
  452.  */
  453. USHORT APIENTRY DosMuxSemWait(PUSHORT, PVOID, LONG);
  454.  
  455.  
  456. /*** Fast safe ram semaphores */
  457.  
  458. typedef struct _DOSFSRSEM {        /* dosfsrs */
  459.     USHORT cb;
  460.     PID    pid;
  461.     TID    tid;
  462.     USHORT cUsage;
  463.     USHORT client;
  464.     ULONG  sem;
  465. } DOSFSRSEM;
  466. typedef DOSFSRSEM FAR *PDOSFSRSEM;
  467.  
  468. USHORT APIENTRY DosFSRamSemRequest(PDOSFSRSEM, LONG);
  469. USHORT APIENTRY DosFSRamSemClear(PDOSFSRSEM);
  470.  
  471. #endif /* INCL_DOSSEMAPHORES */
  472.  
  473. #ifdef INCL_DOSDATETIME
  474.  
  475. /*** Time support */
  476.  
  477. typedef struct _DATETIME {    /* date */
  478.     UCHAR   hours;
  479.     UCHAR   minutes;
  480.     UCHAR   seconds;
  481.     UCHAR   hundredths;
  482.     UCHAR   day;
  483.     UCHAR   month;
  484.     USHORT  year;
  485.     SHORT   timezone;
  486.     UCHAR   weekday;
  487. } DATETIME;
  488. typedef DATETIME FAR *PDATETIME;
  489.  
  490. USHORT APIENTRY DosGetDateTime(PDATETIME);
  491. USHORT APIENTRY DosSetDateTime(PDATETIME);
  492.  
  493. #endif /* common INCL_DOSDATETIME */
  494.  
  495. #ifdef INCL_DOSDATETIME
  496.  
  497. typedef SHANDLE HTIMER;
  498. typedef HTIMER FAR *PHTIMER;
  499.  
  500. USHORT APIENTRY DosGetTimerInt(PUSHORT);
  501.  
  502. USHORT APIENTRY DosTimerAsync(ULONG, HSEM, PHTIMER);
  503. USHORT APIENTRY DosTimerStart(ULONG, HSEM, PHTIMER);
  504. USHORT APIENTRY DosTimerStop(HTIMER);
  505.  
  506. #endif /* INCL_DOSDATETIME */
  507.  
  508.  
  509. /*** Module manager */
  510.  
  511. #ifdef INCL_DOSMODULEMGR
  512.  
  513. USHORT APIENTRY DosLoadModule(PSZ, USHORT, PSZ, PHMODULE);
  514. USHORT APIENTRY DosFreeModule(HMODULE);
  515. USHORT APIENTRY DosGetProcAddr(HMODULE, PSZ, PFN FAR *);
  516. USHORT APIENTRY DosGetModHandle(PSZ, PHMODULE);
  517. USHORT APIENTRY DosGetModName(HMODULE, USHORT, PCHAR);
  518.  
  519. #endif /* INCL_DOSMODULEMGR */
  520.  
  521. #ifdef INCL_DOSRESOURCES
  522.  
  523. /*** Resource support */
  524.  
  525. /* Predefined resource types */
  526.  
  527. #define RT_POINTER      1   /* mouse pointer shape */
  528. #define RT_BITMAP       2   /* bitmap */
  529. #define RT_MENU         3   /* menu template */
  530. #define RT_DIALOG       4   /* dialog template */
  531. #define RT_STRING       5   /* string tables */
  532. #define RT_FONTDIR      6   /* font directory */
  533. #define RT_FONT         7   /* font */
  534. #define RT_ACCELTABLE   8   /* accelerator tables */
  535. #define RT_RCDATA       9   /* binary data */
  536. #define RT_MESSAGE      10  /* error msg     tables */
  537. #define RT_DLGINCLUDE   11  /* dialog include file name */
  538. #define RT_VKEYTBL      12  /* key to vkey tables */
  539. #define RT_KEYTBL       13  /* key to UGL tables */
  540. #define RT_CHARTBL      14  /* glyph to character tables */
  541.  
  542. #endif /* common INCL_DOSRESOURCES */
  543.  
  544. #ifdef INCL_DOSRESOURCES
  545.  
  546. USHORT APIENTRY DosGetResource(HMODULE, USHORT, USHORT, PSEL);
  547.  
  548. #endif /* INCL_DOSRESOURCES */
  549.  
  550.  
  551. /*** NLS Support */
  552.  
  553. #ifdef INCL_DOSNLS
  554.  
  555. typedef struct _COUNTRYCODE { /* ctryc */
  556.     USHORT country;
  557.     USHORT codepage;
  558. } COUNTRYCODE;
  559. typedef COUNTRYCODE FAR *PCOUNTRYCODE;
  560.  
  561. typedef struct _COUNTRYINFO { /* ctryi */
  562.     USHORT country;
  563.     USHORT codepage;
  564.     USHORT fsDateFmt;
  565.     CHAR   szCurrency[5];
  566.     CHAR   szThousandsSeparator[2];
  567.     CHAR   szDecimal[2];
  568.     CHAR   szDateSeparator[2];
  569.     CHAR   szTimeSeparator[2];
  570.     UCHAR  fsCurrencyFmt;
  571.     UCHAR  cDecimalPlace;
  572.     UCHAR  fsTimeFmt;
  573.     USHORT abReserved1[2];
  574.     CHAR   szDataSeparator[2];
  575.     USHORT abReserved2[5];
  576. } COUNTRYINFO;
  577. typedef COUNTRYINFO FAR *PCOUNTRYINFO;
  578.  
  579. USHORT APIENTRY DosGetCtryInfo(USHORT, PCOUNTRYCODE, PCOUNTRYINFO, PUSHORT);
  580. USHORT APIENTRY DosGetDBCSEv(USHORT, PCOUNTRYCODE, PCHAR);
  581. USHORT APIENTRY DosCaseMap(USHORT, PCOUNTRYCODE, PCHAR);
  582. USHORT APIENTRY DosGetCollate(USHORT, PCOUNTRYCODE, PCHAR, PUSHORT);
  583. USHORT APIENTRY DosGetCp(USHORT, PUSHORT, PUSHORT);
  584. USHORT APIENTRY DosSetCp(USHORT, USHORT);
  585.  
  586. #endif /* INCL_DOSNLS */
  587.  
  588.  
  589. /*** Signal support */
  590.  
  591. #ifdef INCL_DOSSIGNALS
  592.  
  593. /* Signal Numbers for DosSetSigHandler  */
  594.  
  595. #define SIG_CTRLC           1       /* Control C            */
  596. #define SIG_BROKENPIPE      2       /* Broken Pipe          */
  597. #define SIG_KILLPROCESS     3       /* Program Termination  */
  598. #define SIG_CTRLBREAK       4       /* Control Break        */
  599. #define SIG_PFLG_A          5       /* Process Flag A       */
  600. #define SIG_PFLG_B          6       /* Process Flag B       */
  601. #define SIG_PFLG_C          7       /* Process Flag C       */
  602. #define SIG_CSIGNALS        8       /* number of signals plus one */
  603.  
  604. /* Flag Numbers for DosFlagProcess      */
  605.  
  606. #define PFLG_A              0       /* Process Flag A       */
  607. #define PFLG_B              1       /* Process Flag B       */
  608. #define PFLG_C              2       /* Process Flag C       */
  609.  
  610. /* Signal actions */
  611.  
  612. #define SIGA_KILL           0
  613. #define SIGA_IGNORE         1
  614. #define SIGA_ACCEPT         2
  615. #define SIGA_ERROR          3
  616. #define SIGA_ACKNOWLEDGE    4
  617.  
  618. /* DosHoldSignal constants */
  619.  
  620. #define HLDSIG_ENABLE       0
  621. #define HLDSIG_DISABLE      1
  622.  
  623. /* DosFlagProcess codes */
  624.  
  625. #define FLGP_SUBTREE        0
  626. #define FLGP_PID            1
  627.  
  628. typedef VOID (FAR PASCAL *PFNSIGHANDLER)(USHORT, USHORT);
  629.  
  630. USHORT APIENTRY DosSetSigHandler(PFNSIGHANDLER, PFNSIGHANDLER FAR *, PUSHORT, USHORT, USHORT);
  631. USHORT APIENTRY DosFlagProcess(PID, USHORT, USHORT, USHORT);
  632. USHORT APIENTRY DosHoldSignal(USHORT);
  633. USHORT APIENTRY DosSendSignal(USHORT, USHORT);
  634.  
  635. #endif /* INCL_DOSSIGNALS */
  636.  
  637.  
  638. /*** Monitor support */
  639.  
  640. #ifdef INCL_DOSMONITORS
  641.  
  642. typedef SHANDLE HMONITOR;    /* hmon */
  643. typedef HMONITOR FAR *PHMONITOR;
  644.  
  645. USHORT APIENTRY DosMonOpen(PSZ, PHMONITOR);
  646. USHORT APIENTRY DosMonClose(HMONITOR);
  647. USHORT APIENTRY DosMonReg(HMONITOR, PBYTE, PBYTE, USHORT, USHORT);
  648. USHORT APIENTRY DosMonRead(PBYTE, UCHAR, PBYTE, PUSHORT);
  649. USHORT APIENTRY DosMonWrite(PBYTE, PBYTE, USHORT);
  650.  
  651. #endif /* INCL_DOSMONITORS */
  652.  
  653.  
  654. /*** Pipe and queue support */
  655.  
  656. #ifdef INCL_DOSQUEUES
  657.  
  658. typedef SHANDLE HQUEUE;  /* hq */
  659. typedef HQUEUE FAR *PHQUEUE;
  660.  
  661. USHORT APIENTRY DosMakePipe(PHFILE, PHFILE, USHORT);
  662. USHORT APIENTRY DosCloseQueue(HQUEUE);
  663. USHORT APIENTRY DosCreateQueue(PHQUEUE, USHORT, PSZ);
  664. USHORT APIENTRY DosOpenQueue(PUSHORT, PHQUEUE, PSZ);
  665. USHORT APIENTRY DosPeekQueue(HQUEUE, PULONG, PUSHORT, PULONG, PUSHORT, UCHAR, PBYTE, ULONG);
  666. USHORT APIENTRY DosPurgeQueue(HQUEUE);
  667. USHORT APIENTRY DosQueryQueue(HQUEUE, PUSHORT);
  668. USHORT APIENTRY DosReadQueue(HQUEUE, PULONG, PUSHORT, PULONG, USHORT, UCHAR, PBYTE, HSEM);
  669. USHORT APIENTRY DosWriteQueue(HQUEUE, USHORT, USHORT, PBYTE, UCHAR);
  670.  
  671. USHORT APIENTRY DosError(USHORT);
  672. USHORT APIENTRY DosSetVec(USHORT, PFN, PFN);
  673. USHORT APIENTRY DosGetMessage(PCHAR FAR *, USHORT, PCHAR, USHORT, USHORT, PSZ, PUSHORT);
  674. USHORT APIENTRY DosErrClass(USHORT, PUSHORT, PUSHORT, PUSHORT);
  675. USHORT APIENTRY DosInsMessage(PCHAR FAR *, USHORT, PSZ, USHORT, PCHAR, USHORT, PUSHORT);
  676. USHORT APIENTRY DosPutMessage(USHORT, USHORT, PCHAR);
  677. USHORT APIENTRY DosSysTrace(USHORT, USHORT, USHORT, PCHAR);
  678. USHORT APIENTRY DosGetEnv(PUSHORT, PUSHORT);
  679. USHORT APIENTRY DosScanEnv(PSZ, PSZ  FAR *);
  680. USHORT APIENTRY DosSearchPath(USHORT, PSZ, PSZ, PBYTE, USHORT);
  681. USHORT APIENTRY DosGetVersion(PUSHORT);
  682. USHORT APIENTRY DosGetMachineMode(PBYTE);
  683.  
  684. #endif /* INCL_DOSQUEUES */
  685.  
  686.  
  687. /*** Session manager support */
  688.  
  689. #ifdef INCL_DOSSESMGR
  690.  
  691. typedef struct _STARTDATA {   /* stdata */
  692.     USHORT cb;
  693.     USHORT Related;
  694.     USHORT FgBg;
  695.     USHORT TraceOpt;
  696.     PSZ    PgmTitle;
  697.     PSZ    PgmName;
  698.     PBYTE  PgmInputs;
  699.     PBYTE  TermQ;
  700.     PBYTE  Environment;
  701.     USHORT InheritOpt;
  702.     USHORT SessionType;
  703.     PSZ    IconFile;
  704.     ULONG  PgmHandle;
  705.     USHORT PgmControl;
  706.     USHORT InitXPos;
  707.     USHORT InitYPos;
  708.     USHORT InitXSize;
  709.     USHORT InitYSize;
  710. } STARTDATA;
  711. typedef STARTDATA FAR *PSTARTDATA;
  712.  
  713. typedef struct _STATUSDATA { /* stsdata */
  714.     USHORT cb;
  715.     USHORT SelectInd;
  716.     USHORT BindInd;
  717. } STATUSDATA;
  718. typedef STATUSDATA FAR *PSTATUSDATA;
  719.  
  720. USHORT APIENTRY DosStartSession(PSTARTDATA, PUSHORT, PUSHORT);
  721. USHORT APIENTRY DosSetSession(USHORT, PSTATUSDATA);
  722. USHORT APIENTRY DosSelectSession(USHORT, ULONG);
  723. USHORT APIENTRY DosStopSession(USHORT, USHORT, ULONG);
  724. USHORT APIENTRY DosQAppType(PSZ, PUSHORT);
  725. USHORT APIENTRY DosSGNum(PUSHORT);
  726. USHORT APIENTRY DosSGSwitch(USHORT);
  727. USHORT APIENTRY DosSGSwitchMe(USHORT);
  728.  
  729. #endif /* INCL_DOSSESMGR */
  730.  
  731.  
  732. /*** Device support */
  733.  
  734. #ifdef INCL_DOSDEVICES
  735.  
  736. USHORT APIENTRY DosDevConfig(PVOID, USHORT, USHORT);
  737. USHORT APIENTRY DosDevIOCtl(PVOID, PVOID, USHORT, USHORT, HFILE);
  738.  
  739. USHORT APIENTRY DosCLIAccess(VOID);
  740. USHORT APIENTRY DosIOAccess(USHORT, USHORT, USHORT, USHORT);
  741. USHORT APIENTRY DosPortAccess(USHORT, USHORT, USHORT, USHORT);
  742. USHORT APIENTRY DosPhysicalDisk(USHORT, PBYTE, USHORT, PBYTE, USHORT);
  743.  
  744. USHORT APIENTRY DosR2StackRealloc(USHORT);
  745. VOID   APIENTRY DosCallback(PFN);
  746.  
  747. #endif /* INCL_DOSDEVICES */
  748.  
  749.  
  750. /*** DosProfile API support */
  751.  
  752. #ifdef INCL_DOSPROFILE
  753.  
  754. /* DosProfile ordinal number */
  755.  
  756. #define PROF_ORDINAL     133
  757.  
  758. /* DosProfile usType */
  759.  
  760. #define PROF_SYSTEM      0
  761. #define PROF_USER        1
  762. #define PROF_USEDD       2
  763. #define PROF_KERNEL      4
  764. #define PROF_VERBOSE     8
  765. #define PROF_ENABLE     16
  766.  
  767. /* DosProfile usFunc */
  768.  
  769. #define PROF_ALLOC       0
  770. #define PROF_CLEAR       1
  771. #define PROF_ON          2
  772. #define PROF_OFF         3
  773. #define PROF_DUMP        4
  774. #define PROF_FREE        5
  775.  
  776. /* DosProfile tic count granularity (DWORD) */
  777.  
  778. #define PROF_SHIFT       2
  779.  
  780. /* DosProfile module name string length */
  781.  
  782. #define PROF_MOD_NAME_SIZE   10
  783.  
  784. /* DosProfile error code for end of data */
  785.  
  786. #define PROF_END_OF_DATA     13
  787.  
  788. #endif /* INCL_DOSPROFILE */
  789.