home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / BSEDOS.H < prev    next >
C/C++ Source or Header  |  1997-08-17  |  101KB  |  2,836 lines

  1. /****************************** Module Header ******************************\
  2. *
  3. * Module Name: BSEDOS.H
  4. *
  5. * OS/2 Base include file.
  6. *
  7. * Copyright (c) International Business Machines Corporation 1981, 1988-1992
  8. *
  9. * ===========================================================================
  10. *
  11. * The folowing symbols are used in this file for conditional sections.
  12. *
  13. * If INCL_BSE is defined, all subcomponents are included.
  14. *
  15. * Subcomponents marked with "+" are partially included by default:
  16. *
  17. *   #define:                To include:
  18. *
  19. * + INCL_DOSPROCESS         Process and thread support
  20. * + INCL_DOSFILEMGR         File Management
  21. * + INCL_DOSMEMMGR          Memory Management
  22. * + INCL_DOSSEMAPHORES      Semaphore support
  23. * + INCL_DOSDATETIME        Date/Time and Timer support
  24. *   INCL_DOSMODULEMGR       Module manager
  25. * + INCL_DOSRESOURCES       Resource support
  26. *   INCL_DOSNLS             National Language Support
  27. *   INCL_DOSEXCEPTIONS      Exception Management Support
  28. *   INCL_DOSMISC            Miscellaneous
  29. *   INCL_DOSMONITORS        Monitors
  30. *   INCL_DOSQUEUES          Queues
  31. *   INCL_DOSSESMGR          Session Manager Support
  32. *   INCL_DOSDEVICES         Device specific, ring 2 support
  33. *   INCL_DOSNMPIPES         Named Pipes Support
  34. *   INCL_DOSPROFILE         DosProfile API
  35. *   INCL_DOSMVDM            MVDM support
  36. *
  37. * ===========================================================================
  38. *
  39. * Comments at the end of each typedef line give the name tags used in
  40. * the assembler include version of this file.
  41. *
  42. * The assembler include version of this file excludes lines between NOINC
  43. * and INC comments.
  44. *
  45. \***************************************************************************/
  46.  
  47. /* NOINC */
  48. #if __IBMC__ || __IBMCPP__
  49.    #pragma info( none )
  50.    #ifndef __CHKHDR__
  51.       #pragma info( none )
  52.    #endif
  53.    #pragma info( restore )
  54. #endif
  55. #ifdef __cplusplus
  56.       extern "C" {
  57. #endif
  58. /* INC */
  59.  
  60. #ifndef __BSEDOS__
  61.  
  62. /* NOINC */
  63. #define __BSEDOS__
  64. /* INC */
  65.  
  66. #define INCL_DOSINCLUDED
  67.  
  68. #ifdef INCL_DOS
  69.    #define INCL_DOSPROCESS
  70.    #define INCL_DOSFILEMGR
  71.    #define INCL_DOSMEMMGR
  72.    #define INCL_DOSSEMAPHORES
  73.    #define INCL_DOSDATETIME
  74.    #define INCL_DOSMODULEMGR
  75.    #define INCL_DOSRESOURCES
  76.    #define INCL_DOSNLS
  77.    #define INCL_DOSEXCEPTIONS
  78.    #define INCL_DOSMISC
  79.    #define INCL_DOSMONITORS
  80.    #define INCL_DOSQUEUES
  81.    #define INCL_DOSSESMGR
  82.    #define INCL_DOSDEVICES
  83.    #define INCL_DOSNMPIPES
  84.    #define INCL_DOSPROFILE
  85.    #define INCL_DOSMVDM
  86. #endif /* INCL_DOS */
  87.  
  88. #ifdef INCL_ERRORS
  89.    #define INCL_DOSERRORS
  90. #endif /* INCL_ERRORS */
  91.  
  92. #if (defined(INCL_DOSPROCESS) || !defined(INCL_NOCOMMON))
  93.    /*** General services */
  94.    APIRET APIENTRY DosBeep(ULONG freq,
  95.                            ULONG dur);
  96.  
  97.    /*** Process and Thread support */
  98.    VOID APIENTRY DosExit(ULONG action,
  99.                          ULONG result);
  100.  
  101.    /* DosExit codes */
  102.    #define EXIT_THREAD        0
  103.    #define EXIT_PROCESS       1
  104. #endif /* common INCL_DOSPROCESS stuff */
  105.  
  106. #ifdef INCL_DOSPROCESS
  107. /* NOINC */
  108.    #define DosCwait           DosWaitChild
  109.    #define DosSetPrty         DosSetPriority
  110. /* INC */
  111.  
  112.    #include <bsetib.h>
  113.  
  114.    typedef  VOID APIENTRY FNTHREAD(ULONG);
  115.    typedef FNTHREAD *PFNTHREAD;
  116.  
  117.    APIRET APIENTRY DosCreateThread(PTID ptid,
  118.                                    PFNTHREAD pfn,
  119.                                    ULONG param,
  120.                                    ULONG flag,
  121.                                    ULONG cbStack);
  122.  
  123.    APIRET APIENTRY DosResumeThread(TID tid);
  124.  
  125.    APIRET APIENTRY DosSuspendThread(TID tid);
  126.  
  127.    APIRET APIENTRY DosGetInfoBlocks(PTIB *pptib,
  128.                                     PPIB *pppib);
  129.  
  130.    APIRET APIENTRY DosKillThread(TID tid);
  131.  
  132.    APIRET APIENTRY DosAllocThreadLocalMemory(ULONG cb, PULONG *p);
  133.  
  134.    APIRET APIENTRY DosFreeThreadLocalMemory(ULONG *p);
  135.  
  136.    /* Action code values */
  137.  
  138.    #define DCWA_PROCESS       0
  139.    #define DCWA_PROCESSTREE   1
  140.  
  141.    /* Wait option values */
  142.  
  143.    #define DCWW_WAIT          0
  144.    #define DCWW_NOWAIT        1
  145.  
  146. /* Thread Flags for DosCreateThread options 59468 */
  147.  
  148. #define CREATE_READY        0                   /* defect 65437  */
  149. #define CREATE_SUSPENDED    1
  150. #define STACK_SPARSE        0
  151. #define STACK_COMMITTED     2
  152.  
  153.    typedef struct _RESULTCODES       /* resc */
  154.    {
  155.       ULONG codeTerminate;
  156.       ULONG codeResult;
  157.    } RESULTCODES;
  158.    typedef RESULTCODES *PRESULTCODES;
  159.  
  160.    APIRET APIENTRY DosWaitChild(ULONG action,
  161.                                 ULONG option,
  162.                                 PRESULTCODES pres,
  163.                                 PPID ppid,
  164.                                 PID pid);
  165.  
  166.    APIRET APIENTRY DosWaitThread(PTID ptid,
  167.                                  ULONG option);
  168.  
  169.    APIRET APIENTRY DosSleep(ULONG msec);
  170.  
  171. #ifndef DBG_INCL_DOSDEBUG
  172.  
  173. #define DBG_INCL_DOSDEBUG
  174.  
  175.  
  176. /***            User's Debug Buffer structure
  177.  *
  178.  *      A pointer to a uDB is the sole parameter to DosDebug.  It
  179.  *      contains all the information required for each DosDebug
  180.  *      command.
  181.  *
  182.  */
  183.  
  184. typedef struct _uDB {           /* uDB */
  185.         unsigned long   Pid;            /* Debuggee Process id          */
  186.         unsigned long   Tid;            /* Debuggee Thread id           */
  187.         long            Cmd;            /* Command or Notification      */
  188.         long            Value;          /* Generic Data Value           */
  189.         unsigned long   Addr;           /* Debuggee Address             */
  190.         unsigned long   Buffer;         /* Debugger Buffer Address      */
  191.         unsigned long   Len;            /* Length of Range              */
  192.         unsigned long   Index;          /* Generic Identifier Index     */
  193.         unsigned long   MTE;            /* Module Table Entry Handle    */
  194.         unsigned long   EAX;            /* Register Set                 */
  195.         unsigned long   ECX;
  196.         unsigned long   EDX;
  197.         unsigned long   EBX;
  198.         unsigned long   ESP;
  199.         unsigned long   EBP;
  200.         unsigned long   ESI;
  201.         unsigned long   EDI;
  202.         unsigned long   EFlags;
  203.         unsigned long   EIP;
  204.         unsigned long   CSLim;
  205.         unsigned long   CSBase;
  206.         unsigned char   CSAcc;
  207.         unsigned char   CSAtr;
  208.         unsigned short  CS;
  209.         unsigned long   DSLim;
  210.         unsigned long   DSBase;
  211.         unsigned char   DSAcc;
  212.         unsigned char   DSAtr;
  213.         unsigned short  DS;
  214.         unsigned long   ESLim;
  215.         unsigned long   ESBase;
  216.         unsigned char   ESAcc;
  217.         unsigned char   ESAtr;
  218.         unsigned short  ES;
  219.         unsigned long   FSLim;
  220.         unsigned long   FSBase;
  221.         unsigned char   FSAcc;
  222.         unsigned char   FSAtr;
  223.         unsigned short  FS;
  224.         unsigned long   GSLim;
  225.         unsigned long   GSBase;
  226.         unsigned char   GSAcc;
  227.         unsigned char   GSAtr;
  228.         unsigned short  GS;
  229.         unsigned long   SSLim;
  230.         unsigned long   SSBase;
  231.         unsigned char   SSAcc;
  232.         unsigned char   SSAtr;
  233.         unsigned short  SS;
  234. } uDB_t;
  235.  
  236. /***            DosDebug Command Numbers
  237.  *
  238.  *      These numbers are placed in the Cmd field of the uDB on
  239.  *      entry to DosDebug.
  240.  *
  241.  *      These numbers identify which command DosDebug is requested
  242.  *      to perform.
  243.  *
  244.  */
  245.  
  246. #define DBG_C_Null              0       /* Null                         */
  247. #define DBG_C_ReadMem           1       /* Read Word                    */
  248. #define DBG_C_ReadMem_I         1       /* Read Word                    */
  249. #define DBG_C_ReadMem_D         2       /* Read Word (same as 1)        */
  250. #define DBG_C_ReadReg           3       /* Read Register Set            */
  251. #define DBG_C_WriteMem          4       /* Write Word                   */
  252. #define DBG_C_WriteMem_I        4       /* Write Word                   */
  253. #define DBG_C_WriteMem_D        5       /* Write Word (same as 4)       */
  254. #define DBG_C_WriteReg          6       /* Write Register Set           */
  255. #define DBG_C_Go                7       /* Go                           */
  256. #define DBG_C_Term              8       /* Terminate                    */
  257. #define DBG_C_SStep             9       /* Single Step                  */
  258. #define DBG_C_Stop              10      /* Stop                         */
  259. #define DBG_C_Freeze            11      /* Freeze Thread                */
  260. #define DBG_C_Resume            12      /* Resume Thread                */
  261. #define DBG_C_NumToAddr         13      /* Object Number to Address     */
  262. #define DBG_C_ReadCoRegs        14      /* Read Coprocessor Registers   */
  263. #define DBG_C_WriteCoRegs       15      /* Write Coprocessor Registers  */
  264.                                         /* 16 is reserved               */
  265. #define DBG_C_ThrdStat          17      /* Get Thread Status            */
  266. #define DBG_C_MapROAlias        18      /* Map read-only alias          */
  267. #define DBG_C_MapRWAlias        19      /* Map read-write alias         */
  268. #define DBG_C_UnMapAlias        20      /* Unmap Alias                  */
  269. #define DBG_C_Connect           21      /* Connect to Debuggee          */
  270. #define DBG_C_ReadMemBuf        22      /* Read Memory Buffer           */
  271. #define DBG_C_WriteMemBuf       23      /* Write Memory Buffer          */
  272. #define DBG_C_SetWatch          24      /* Set Watchpoint               */
  273. #define DBG_C_ClearWatch        25      /* Clear Watchpoint             */
  274. #define DBG_C_RangeStep         26      /* Range Step                   */
  275. #define DBG_C_Continue          27      /* Continue after an Exception  */
  276. #define DBG_C_AddrToObject      28      /* Address to Object            */
  277. #define DBG_C_XchgOpcode        29      /* Exchange opcode and go       */
  278. #define DBG_C_LinToSel          30      /* 32 to 16 conversion      A001*/
  279. #define DBG_C_SelToLin          31      /* 16 to 32 conversion      A001*/
  280.  
  281.  
  282. /***            DosDebug Notification Numbers
  283.  *
  284.  *      These numbers are placed in the Cmd field of the uDB upon
  285.  *      exit from DosDebug.
  286.  *
  287.  *      These numbers identify which DosDebug Event just occured,
  288.  *      or whether a particular command succeeded or failed.
  289.  *
  290.  */
  291.  
  292. #define DBG_N_Success           0L      /* Command completed successfully  */
  293. #define DBG_N_Error             -1L     /* Error detected during command   */
  294. #define DBG_N_ProcTerm          -6L     /* Process exiting - ExitList done */
  295. #define DBG_N_Exception         -7L     /* Exception detected              */
  296. #define DBG_N_ModuleLoad        -8L     /* Module loaded                   */
  297. #define DBG_N_CoError           -9L     /* Coprocessor not in use error    */
  298. #define DBG_N_ThreadTerm        -10L    /* Thread exiting - Exitlist soon  */
  299. #define DBG_N_AsyncStop         -11L    /* Async Stop detected             */
  300. #define DBG_N_NewProc           -12L    /* New Process started             */
  301. #define DBG_N_AliasFree         -13L    /* Alias needs to be freed         */
  302. #define DBG_N_Watchpoint        -14L    /* Watchpoint hit                  */
  303. #define DBG_N_ThreadCreate      -15L    /* New thread created              */
  304. #define DBG_N_ModuleFree        -16L    /* Module freed                    */
  305. #define DBG_N_RangeStep         -17L    /* Range Step completed            */
  306.  
  307. /***          - Thread Status Buffer structure
  308.  *
  309.  *      A pointer to a TStat structure is required for the
  310.  *      DBG_C_ThrdStat command.
  311.  *
  312.  *      The TStat structure returns information about a thread.
  313.  *
  314.  *      DbgState in the Thread Status buffer contains info about the
  315.  *      current state of debugging, and will have one of the following
  316.  *      values upon return :
  317.  *
  318.  *      DBG_D_Thawed, DBG_D_Frozen
  319.  *
  320.  *      TState in the Thread Status buffer contains info about the
  321.  *      scheduling state of the thread, and will have one of the
  322.  *      following values upon return.
  323.  *
  324.  *      DBG_T_Runnable, DBG_T_Suspended, DBG_T_Blocked, DBG_T_CritSec
  325.  *
  326.  *      TPriority in the Thread Status buffer contains the thread's
  327.  *      base scheduling priority.  This priority will be expressed as
  328.  *      scheduling class and delta values upon return.
  329.  *
  330.  */
  331.  
  332. typedef struct _TStat {         /* TS */
  333.         unsigned char   DbgState;       /* Thread's Debugging State      */
  334.         unsigned char   TState;         /* Thread's Scheduler State     */
  335.         unsigned short  TPriority;      /* Thread's Scheduler Priority  */
  336. } TStat_t;
  337.  
  338. /***            DbgState values
  339.  *
  340.  *      These are the possible values which can be returned
  341.  *      in the DbgState field of the TStat structure. These
  342.  *      bits identify debugging information.
  343.  *
  344.  */
  345.  
  346. #define DBG_D_Thawed    0
  347. #define DBG_D_Frozen    1
  348.  
  349. /***            TState values
  350.  *
  351.  *      These are the possible values which can be returned in
  352.  *      the TState field of the TStat structure.  These values
  353.  *      identify scheduler state information.
  354.  *
  355.  */
  356.  
  357. #define DBG_T_Runnable  0
  358. #define DBG_T_Suspended 1
  359. #define DBG_T_Blocked   2
  360. #define DBG_T_CritSec   3
  361.  
  362. /***             Coprocessor Type Parameters
  363.  *
  364.  *      These are the possible values identifying the coprocessor
  365.  *      types supported by DosDebug used when accessing the
  366.  *      coprocessor register set.
  367.  *
  368.  */
  369.  
  370. #define DBG_CO_387      1
  371.  
  372. /***EK+ DBG_LEN - Coprocessor Buffer Lengths
  373.  *
  374.  *      These are the possible values identifying the length of
  375.  *      the coprocessor buffer when accessing the coprocessor
  376.  *      register set.
  377.  *
  378.  */
  379.  
  380. #define DBG_LEN_387     108
  381.  
  382. /***            Debugging Level Parameter
  383.  *
  384.  *      This is the only possible value for the DBG_C_Connect command,
  385.  *      and identifies that debugging on the 386 envoronment is desired.
  386.  *
  387.  */
  388.  
  389. #define DBG_L_386       1
  390.  
  391. /***            Watchpoint Scope and Type Parameters
  392.  *
  393.  *      These are the possible Watchpoint Scope values, as used by
  394.  *      the DBG_C_SetWatch command.     The DBG_C_SetWatch command
  395.  *      expects a  combination (using either an ADD or an OR) of
  396.  *      the Scope and Type parameters to be passed as a single value.
  397.  *
  398.  */
  399.  
  400. /*      Watchpoint Scope Parameters     */
  401.  
  402. #define DBG_W_Global    0x00000001
  403. #define DBG_W_Local     0x00000002
  404.  
  405. /*      Watchpoint Type Parameters      */
  406.  
  407. #define DBG_W_Execute   0x00010000
  408. #define DBG_W_Write     0x00020000
  409. #define DBG_W_ReadWrite 0x00030000
  410.  
  411. /***            Object flags
  412.  *
  413.  *      This flag indicates whether the MTE field contains the object's
  414.  *      MTE after a DBG_C_AddrToObject call.
  415.  *
  416.  */
  417.  
  418. #define DBG_O_OBJMTE    0x10000000
  419.  
  420. /***            Exception chances
  421.  *
  422.  *      The three scenarios under which a debug exception is reported
  423.  *      are pre-1st, 1st, and last chance. The value field of the
  424.  *      user debug buffer will indicate which chance a given call is
  425.  *      for. Additional parameter values will be:
  426.  *
  427.  *         For pre-1st chance (XCPT_BREAKPOINT):
  428.  *              Addr   = Linear address of breakpoint
  429.  *              Buffer = XCPT_BREAKPOINT
  430.  *
  431.  *         For pre-1st change (XCPT_SINGLE_STEP):
  432.  *              Addr   = Linear address of instruction after Single Step
  433.  *              Buffer = XCPT_SINGLE_STEP
  434.  *
  435.  *         For 1st chance (all exceptions):
  436.  *              Addr   = Linear address of exception
  437.  *              Buffer = Pointer to Exception Report Record in
  438.  *                       Debuggee's context
  439.  *              Len    = Pointer to Exception Context Record in
  440.  *                       Debuggee's context
  441.  *
  442.  *         For Last chance (all exceptions):
  443.  *              Addr   = Linear address of exception
  444.  *              Buffer = Pointer to Exception Report Record in
  445.  *                       Debuggee's context
  446.  *              Len    = Pointer to Exception Context Record in
  447.  *                       Debuggee's context
  448.  *
  449.  *         For Invalid stack notification (all exceptions)
  450.  *              Addr   = Linear address of exception
  451.  *              Buffer = Exception number
  452.  */
  453.  
  454. #define DBG_X_PRE_FIRST_CHANCE  0x00000000
  455. #define DBG_X_FIRST_CHANCE      0x00000001
  456. #define DBG_X_LAST_CHANCE       0x00000002
  457. #define DBG_X_STACK_INVALID     0x00000003
  458.  
  459. #endif /* DBG_INCL_DOSDEBUG */
  460.  
  461.    APIRET APIENTRY DosDebug(PVOID pdbgbuf);
  462.  
  463.  
  464.    /* codeTerminate values (also passed to ExitList routines) */
  465.  
  466.    #define TC_EXIT            0
  467.    #define TC_HARDERROR       1
  468.    #define TC_TRAP            2
  469.    #define TC_KILLPROCESS     3
  470.    #define TC_EXCEPTION       4
  471.  
  472.    typedef VOID APIENTRY FNEXITLIST(ULONG);
  473.    typedef FNEXITLIST *PFNEXITLIST;
  474.  
  475.    APIRET APIENTRY DosEnterCritSec(VOID);
  476.  
  477.    APIRET APIENTRY DosExitCritSec(VOID);
  478.  
  479.    APIRET APIENTRY DosExitList(ULONG ordercode,
  480.                                PFNEXITLIST pfn);
  481.  
  482.    /* DosExitList functions */
  483.  
  484.    #define EXLST_ADD          1
  485.    #define EXLST_REMOVE       2
  486.    #define EXLST_EXIT         3
  487.  
  488. #ifdef __cplusplus
  489.    APIRET APIENTRY DosExecPgm(PCHAR pObjname,
  490.                               LONG cbObjname,
  491.                               ULONG execFlag,
  492.                               PCSZ  pArg,
  493.                               PCSZ  pEnv,
  494.                               PRESULTCODES pRes,
  495.                               PCSZ  pName);
  496. #else
  497.    APIRET APIENTRY DosExecPgm(PCHAR pObjname,
  498.                               LONG cbObjname,
  499.                               ULONG execFlag,
  500.                               PSZ pArg,
  501.                               PSZ pEnv,
  502.                               PRESULTCODES pRes,
  503.                               PSZ pName);
  504. #endif
  505.  
  506.    /* DosExecPgm functions */
  507.  
  508.    #define EXEC_SYNC          0
  509.    #define EXEC_ASYNC         1
  510.    #define EXEC_ASYNCRESULT   2
  511.    #define EXEC_TRACE         3
  512.    #define EXEC_BACKGROUND    4
  513.    #define EXEC_LOAD          5
  514.    #define EXEC_ASYNCRESULTDB 6
  515.  
  516.  
  517.    APIRET APIENTRY  DosSetPriority(ULONG scope,
  518.                                    ULONG ulClass,
  519.                                    LONG  delta,
  520.                                    ULONG PorTid);
  521.  
  522.    /* Priority scopes */
  523.  
  524.    #define PRTYS_PROCESS      0
  525.    #define PRTYS_PROCESSTREE  1
  526.    #define PRTYS_THREAD       2
  527.  
  528.    /* Priority classes */
  529.  
  530.    #define PRTYC_NOCHANGE     0
  531.    #define PRTYC_IDLETIME     1
  532.    #define PRTYC_REGULAR      2
  533.    #define PRTYC_TIMECRITICAL 3
  534.    #define PRTYC_FOREGROUNDSERVER 4
  535.  
  536.    /* Priority deltas */
  537.  
  538.    #define PRTYD_MINIMUM     -31
  539.    #define PRTYD_MAXIMUM      31
  540.  
  541.    APIRET APIENTRY DosKillProcess(ULONG action,
  542.                                   PID pid);
  543.  
  544.    #define DKP_PROCESSTREE    0
  545.    #define DKP_PROCESS        1
  546. #endif /* INCL_DOSPROCESS */
  547.  
  548. #ifndef INCL_SAADEFS
  549.    /*************************************************************************\
  550.    * CCHMAXPATH is the maximum fully qualified path name length including  *
  551.    * the drive letter, colon, backslashes and terminating NULL.            *
  552.    \*************************************************************************/
  553.    #define CCHMAXPATH         260
  554.  
  555.    /*************************************************************************\
  556.    * CCHMAXPATHCOMP is the maximum individual path component name length   *
  557.    * including a terminating NULL.                                         *
  558.    \*************************************************************************/
  559.    #define CCHMAXPATHCOMP     256
  560. #endif  /* !INCL_SAADEFS */
  561.  
  562. #if (defined(INCL_DOSFILEMGR) || !defined(INCL_NOCOMMON))
  563.    /*** File manager */
  564.    /* DosSetFilePtr() file position codes */
  565.  
  566.    #define FILE_BEGIN      0x0000   /* Move relative to beginning of file */
  567.    #define FILE_CURRENT    0x0001   /* Move relative to current fptr position */
  568.    #define FILE_END        0x0002   /* Move relative to end of file */
  569.  
  570.    /* DosFindFirst/Next Directory handle types */
  571.    #define HDIR_SYSTEM        1     /* Use system handle (1) */
  572.    #define HDIR_CREATE      (-1)    /* Allocate a new, unused handle */
  573.  
  574.    /* DosCopy control bits; may be or'ed together */
  575.    #define DCPY_EXISTING   0x0001   /* Copy even if target exists */
  576.    #define DCPY_APPEND     0x0002   /* Append to existing file, do not replace */
  577.    #define DCPY_FAILEAS    0x0004   /* Fail if EAs not supported on target*/
  578.  
  579.    /* DosOpen/DosQFHandState/DosQueryFileInfo et al file attributes; also */
  580.    /* known as Dos File Mode bits... */
  581.    #define FILE_NORMAL     0x0000
  582.    #define FILE_READONLY   0x0001
  583.    #define FILE_HIDDEN     0x0002
  584.    #define FILE_SYSTEM     0x0004
  585.    #define FILE_DIRECTORY  0x0010
  586.    #define FILE_ARCHIVED   0x0020
  587.  
  588.    #define FILE_IGNORE     0x10000     /* ignore file attribute in */
  589.    /* DosSetPath/File Info if */
  590.    /* this bit is set*/
  591.  
  592.    #define MUST_HAVE_READONLY      ( (FILE_READONLY  << 8) | FILE_READONLY  )
  593.    #define MUST_HAVE_HIDDEN        ( (FILE_HIDDEN    << 8) | FILE_HIDDEN    )
  594.    #define MUST_HAVE_SYSTEM        ( (FILE_SYSTEM    << 8) | FILE_SYSTEM    )
  595.    #define MUST_HAVE_DIRECTORY     ( (FILE_DIRECTORY << 8) | FILE_DIRECTORY )
  596.    #define MUST_HAVE_ARCHIVED      ( (FILE_ARCHIVED  << 8) | FILE_ARCHIVED  )
  597.  
  598.    /* DosOpen() actions */
  599.    #define FILE_EXISTED    0x0001
  600.    #define FILE_CREATED    0x0002
  601.    #define FILE_TRUNCATED  0x0003
  602.  
  603.    /* DosOpen() open flags */
  604.    #define FILE_OPEN       0x0001
  605.    #define FILE_TRUNCATE   0x0002
  606.    #define FILE_CREATE     0x0010
  607.  
  608.    /*     this nibble applies if file already exists                xxxx */
  609.    #define OPEN_ACTION_FAIL_IF_EXISTS     0x0000  /* ---- ---- ---- 0000 */
  610.    #define OPEN_ACTION_OPEN_IF_EXISTS     0x0001  /* ---- ---- ---- 0001 */
  611.    #define OPEN_ACTION_REPLACE_IF_EXISTS  0x0002  /* ---- ---- ---- 0010 */
  612.  
  613.    /*     this nibble applies if file does not exist           xxxx      */
  614.    #define OPEN_ACTION_FAIL_IF_NEW        0x0000  /* ---- ---- 0000 ---- */
  615.    #define OPEN_ACTION_CREATE_IF_NEW      0x0010  /* ---- ---- 0001 ---- */
  616.  
  617.    /* DosOpen/DosSetFHandState flags */
  618.    #define OPEN_ACCESS_READONLY           0x0000  /* ---- ---- ---- -000 */
  619.    #define OPEN_ACCESS_WRITEONLY          0x0001  /* ---- ---- ---- -001 */
  620.    #define OPEN_ACCESS_READWRITE          0x0002  /* ---- ---- ---- -010 */
  621.    #define OPEN_SHARE_DENYREADWRITE       0x0010  /* ---- ---- -001 ---- */
  622.    #define OPEN_SHARE_DENYWRITE           0x0020  /* ---- ---- -010 ---- */
  623.    #define OPEN_SHARE_DENYREAD            0x0030  /* ---- ---- -011 ---- */
  624.    #define OPEN_SHARE_DENYNONE            0x0040  /* ---- ---- -100 ---- */
  625.    #define OPEN_FLAGS_NOINHERIT           0x0080  /* ---- ---- 1--- ---- */
  626.    #define OPEN_FLAGS_NO_LOCALITY         0x0000  /* ---- -000 ---- ---- */
  627.    #define OPEN_FLAGS_SEQUENTIAL          0x0100  /* ---- -001 ---- ---- */
  628.    #define OPEN_FLAGS_RANDOM              0x0200  /* ---- -010 ---- ---- */
  629.    #define OPEN_FLAGS_RANDOMSEQUENTIAL    0x0300  /* ---- -011 ---- ---- */
  630.    #define OPEN_FLAGS_NO_CACHE            0x1000  /* ---1 ---- ---- ---- */
  631.    #define OPEN_FLAGS_FAIL_ON_ERROR       0x2000  /* --1- ---- ---- ---- */
  632.    #define OPEN_FLAGS_WRITE_THROUGH       0x4000  /* -1-- ---- ---- ---- */
  633.    #define OPEN_FLAGS_DASD                0x8000  /* 1--- ---- ---- ---- */
  634.    #define OPEN_FLAGS_NONSPOOLED          0x00040000
  635.    #define OPEN_FLAGS_PROTECTED_HANDLE 0x40000000
  636.  
  637.  
  638.    /* DosSearchPath() constants */
  639.    #define SEARCH_PATH           0x0000
  640.    #define SEARCH_CUR_DIRECTORY  0x0001
  641.    #define SEARCH_ENVIRONMENT    0x0002
  642.    #define SEARCH_IGNORENETERRS  0x0004
  643.  
  644.  
  645.    /************************************************************
  646.    EA Info Levels & Find First/Next
  647.    =========================================
  648.    API's: DosFindFirst, DosQueryFileInfo, DosQueryPathInfo, DosSetFileInfo,
  649.    DosSetPathInfo
  650.    ************************************************************/
  651.  
  652.    /* File info levels&gml All listed API's */
  653.    #define FIL_STANDARD          1     /* Info level 1, standard file info */
  654.    #define FIL_QUERYEASIZE       2     /* Level 2, return Full EA size */
  655.    #define FIL_QUERYEASFROMLIST  3     /* Level 3, return requested EA's */
  656.  
  657.    /* File info levels: Dos...PathInfo only */
  658.    #define FIL_QUERYFULLNAME     5     /* Level 5, return fully qualified
  659.    name of file */
  660.  
  661.  
  662.    /* DosFsAttach() */
  663.    /* Attact or detach */
  664.    #define FS_ATTACH             0     /* Attach file server */
  665.    #define FS_DETACH             1     /* Detach file server */
  666.    #define FS_SPOOLATTACH        2     /* Register a spooler device */
  667.    #define FS_SPOOLDETACH        3     /* De-register a spooler device */
  668.  
  669.  
  670.    /* DosFsCtl() */
  671.    /* Routing type */
  672.    #define FSCTL_HANDLE          1     /* File Handle directs req routing */
  673.    #define FSCTL_PATHNAME        2     /* Path Name directs req routing   */
  674.    #define FSCTL_FSDNAME         3     /* FSD Name directs req routing    */
  675.  
  676.    /* defined FSCTL functions */
  677.    #define FSCTL_ERROR_INFO            1  /* return error info from FSD  */
  678.    #define FSCTL_MAX_EASIZE            2  /* Max ea size for the FSD     */
  679.    #define FSCTL_GET_NEXT_ROUTE_NAME   3  /* Rtrn next valid FSD name    */
  680.    #define FSCTL_DAEMON_QUERY          4  /* FSD query for daemon rqrmnt */
  681.  
  682.    /* defined FSCTL query flags */
  683.    #define FSCTL_QUERY_COMPLETE     0x0000
  684.    #define FSCTL_QUERY_AGAIN        0x0001
  685.  
  686.    typedef struct  _EASIZEBUF     /* easizebuf struct for FSCTL fn 2  */
  687.    {                              /* max ea size                      */
  688.       USHORT  cbMaxEASize;        /* max. size of one EA              */
  689.       ULONG   cbMaxEAListSize;    /* max size of the full EA List     */
  690.    } EASIZEBUF;
  691.    typedef EASIZEBUF  *PEASIZEBUF;
  692.  
  693.    typedef struct _ROUTENAMEBUF /* routenamebuf struct for FSCTL fn 3 - return next FSD name */
  694.    {
  695.       ULONG   hRouteHandle;   /* Input- set to 0 for first name, use    */
  696.                               /*   the value returned for next name     */
  697.                               /* Output- handle to use to get next name */
  698.       UCHAR   szRouteName;    /* Registered FSD name that can be used   */
  699.                               /*   for FSCTL_FSDNAME routing type       */
  700.    } ROUTENAMEBUF;
  701.    typedef ROUTENAMEBUF *PROUTENAMEBUF;
  702.  
  703.    /* Data associated with an FSD Daemon thread spawning action  */
  704.  
  705.    typedef struct _FSDTHREAD  /* fsdthread struct for FSCTL fn 4 */
  706.    {
  707.       USHORT  usFunc;
  708.       USHORT  usStackSize;
  709.       ULONG   ulPriorityClass;
  710.       LONG    lPriorityLevel;
  711.    } FSDTHREAD;
  712.  
  713.    /* Data associated with an FSD Daemon thread requirements     */
  714.    typedef struct _FSDDAEMON  /* fsddaemon struct for FSCTL fn 4 */
  715.    {
  716.       USHORT     usNumThreads;
  717.       USHORT     usMoreFlag;
  718.       USHORT     usCallInstance;
  719.       FSDTHREAD  tdThrds[16];
  720.    } FSDDAEMON;
  721.  
  722.    /* DosQueryFSAttach() */
  723.    /* Information level types (defines method of query) */
  724.    #define FSAIL_QUERYNAME       1     /* Return data for a Drive or Device */
  725.    #define FSAIL_DEVNUMBER       2     /* Return data for Ordinal Device # */
  726.    #define FSAIL_DRVNUMBER       3     /* Return data for Ordinal Drive # */
  727.  
  728.    /* Item types (from data structure item "iType") */
  729.    #define FSAT_CHARDEV          1     /* Resident character device */
  730.    #define FSAT_PSEUDODEV        2     /* Pusedu-character device */
  731.    #define FSAT_LOCALDRV         3     /* Local drive */
  732.    #define FSAT_REMOTEDRV        4     /* Remote drive attached to FSD */
  733.  
  734.    typedef struct  _FSQBUFFER       /* fsqbuf Data structure for QFSAttach*/
  735.    {
  736.       USHORT  iType;              /* Item type */
  737.       USHORT  cbName;             /* Length of item name, sans NULL */
  738.       UCHAR   szName[1];          /* ASCIIZ item name */
  739.       USHORT  cbFSDName;          /* Length of FSD name, sans NULL */
  740.       UCHAR   szFSDName[1];       /* ASCIIZ FSD name */
  741.       USHORT  cbFSAData;          /* Length of FSD Attach data returned */
  742.       UCHAR   rgFSAData[1];       /* FSD Attach data from FSD */
  743.    } FSQBUFFER;
  744.    typedef FSQBUFFER  *PFSQBUFFER;
  745.  
  746.  
  747.    typedef struct _FSQBUFFER2       /* fsqbuf2 Data structure for QFSAttach*/
  748.    {
  749.       USHORT  iType;
  750.       USHORT  cbName;
  751.       USHORT  cbFSDName;
  752.       USHORT  cbFSAData;
  753.       UCHAR   szName[1];
  754.       UCHAR   szFSDName[1];
  755.       UCHAR   rgFSAData[1];
  756.    } FSQBUFFER2;
  757.    typedef FSQBUFFER2 *PFSQBUFFER2;
  758.  
  759.    typedef struct _SPOOLATTACH      /* spool Data structure for spooler operations */
  760.    {
  761.       USHORT  hNmPipe;              /* Named pipe handle */
  762.       ULONG   ulKey;                /* Attached key */
  763.    } SPOOLATTACH;
  764.    typedef SPOOLATTACH  *PSPOOLATTACH;
  765.  
  766.  
  767.    /*****************************************************************************
  768.    * File System Drive Information&gml DosQueryFSInfo DosSetFSInfo              *
  769.    *****************************************************************************/
  770.  
  771.    /* FS Drive Info Levels */
  772.    #define FSIL_ALLOC            1     /* Drive allocation info (Query only) */
  773.    #define FSIL_VOLSER           2     /* Drive Volum/Serial info */
  774.  
  775.    /* DosQueryFHType() */
  776.    /* Handle classes (low 8 bits of Handle Type) */
  777.    #define FHT_DISKFILE          0x0000   /* Disk file handle */
  778.    #define FHT_CHRDEV            0x0001   /* Character device handle */
  779.    #define FHT_PIPE              0x0002   /* Pipe handle */
  780.  
  781.    /* Handle bits (high 8 bits of Handle Type) */
  782.    #define FHB_DSKREMOTE         0x8000   /* Remote disk */
  783.    #define FHB_CHRDEVREMOTE      0x8000   /* Remote character device */
  784.    #define FHB_PIPEREMOTE        0x8000   /* Remote pipe */
  785.  
  786.  
  787.  
  788.    #ifndef INCL_SAADEFS
  789.       /* File time and date types */
  790. #if __IBMC__ || __IBMCPP__
  791.          typedef struct _FTIME           /* ftime */
  792.          {
  793.             UINT   twosecs : 5;
  794.             UINT   minutes : 6;
  795.             UINT   hours   : 5;
  796.          } FTIME;
  797.          typedef FTIME *PFTIME;
  798.       #else
  799.          typedef struct _FTIME           /* ftime */
  800.          {
  801.             USHORT   twosecs : 5;
  802.             USHORT   minutes : 6;
  803.             USHORT   hours   : 5;
  804.          } FTIME;
  805.          typedef FTIME *PFTIME;
  806.       #endif
  807.  
  808. #if __IBMC__ || __IBMCPP__
  809.          typedef struct _FDATE           /* fdate */
  810.          {
  811.             UINT   day     : 5;
  812.             UINT   month   : 4;
  813.             UINT   year    : 7;
  814.          } FDATE;
  815.          typedef FDATE   *PFDATE;
  816.       #else
  817.          typedef struct _FDATE           /* fdate */
  818.          {
  819.             USHORT   day     : 5;
  820.             USHORT   month   : 4;
  821.             USHORT   year    : 7;
  822.          } FDATE;
  823.          typedef FDATE   *PFDATE;
  824.       #endif
  825.    #endif /* INCL_SAADEFS */
  826.  
  827.  
  828.    typedef struct _VOLUMELABEL      /* vol */
  829.    {
  830.       BYTE cch;
  831.       CHAR szVolLabel[12];
  832.    } VOLUMELABEL;
  833.    typedef VOLUMELABEL  *PVOLUMELABEL;
  834.  
  835.    typedef struct _FSINFO      /* fsinf */
  836.    {
  837.       FDATE fdateCreation;
  838.       FTIME ftimeCreation;
  839.       VOLUMELABEL vol;
  840.    } FSINFO;
  841.    typedef FSINFO *PFSINFO;
  842.  
  843.    /* HANDTYPE values */
  844.    #define HANDTYPE_FILE         0x0000
  845.    #define HANDTYPE_DEVICE       0x0001
  846.    #define HANDTYPE_PIPE         0x0002
  847.    #define HANDTYPE_PROTECTED    0x4000
  848.    #define HANDTYPE_NETWORK      0x8000
  849.  
  850.    typedef struct _FILELOCK      /* flock */
  851.    {
  852.       LONG lOffset;
  853.       LONG lRange;
  854.    } FILELOCK;
  855.    typedef FILELOCK  *PFILELOCK;
  856.  
  857.    #ifndef __HEV__            /* INCL_SEMAPHORE may also define HEV */
  858.       #define __HEV__
  859.       typedef  ULONG    HEV;             /* hev */
  860.       typedef  HEV      *PHEV;
  861.    #endif
  862.  
  863.    typedef  ULONG  FHLOCK;
  864.    typedef  PULONG  PFHLOCK;
  865.  
  866.    APIRET APIENTRY DosSetFileLocks(HFILE hFile,
  867.                                    PFILELOCK pflUnlock,
  868.                                    PFILELOCK pflLock,
  869.                                    ULONG timeout,
  870.                                    ULONG flags);
  871.    APIRET APIENTRY DosProtectSetFileLocks(HFILE hFile,
  872.                                           PFILELOCK pflUnlock,
  873.                                           PFILELOCK pflLock,
  874.                                           ULONG timeout, ULONG flags,
  875.                                           FHLOCK fhFileHandleLockID);
  876.  
  877.    APIRET APIENTRY DosCancelLockRequest(HFILE hFile,
  878.                                         PFILELOCK pflLock);
  879.  
  880.  
  881.    #ifndef INCL_SAADEFS
  882.  
  883.       typedef struct _FILEFINDBUF     /* findbuf */
  884.       {
  885.          FDATE  fdateCreation;
  886.          FTIME  ftimeCreation;
  887.          FDATE  fdateLastAccess;
  888.          FTIME  ftimeLastAccess;
  889.          FDATE  fdateLastWrite;
  890.          FTIME  ftimeLastWrite;
  891.          ULONG  cbFile;
  892.          ULONG  cbFileAlloc;
  893.          USHORT attrFile;
  894.          UCHAR  cchName;
  895.          CHAR   achName[CCHMAXPATHCOMP];
  896.       } FILEFINDBUF;
  897.  
  898.       typedef FILEFINDBUF *PFILEFINDBUF;
  899.  
  900.       /*NOINC */
  901.       #pragma pack(2)
  902.       /*INC  */
  903.       typedef struct _FILEFINDBUF2    /* findbuf2 */
  904.       {
  905.          FDATE  fdateCreation;
  906.          FTIME  ftimeCreation;
  907.          FDATE  fdateLastAccess;
  908.          FTIME  ftimeLastAccess;
  909.          FDATE  fdateLastWrite;
  910.          FTIME  ftimeLastWrite;
  911.          ULONG  cbFile;
  912.          ULONG  cbFileAlloc;
  913.          USHORT attrFile;
  914.          ULONG  cbList;
  915.          UCHAR  cchName;
  916.          CHAR   achName[CCHMAXPATHCOMP];
  917.       } FILEFINDBUF2;
  918.       typedef FILEFINDBUF2 *PFILEFINDBUF2;
  919.  
  920.       typedef struct _FILEFINDBUF3                 /* findbuf3 */
  921.       {
  922.          ULONG   oNextEntryOffset;            /* new field */
  923.          FDATE   fdateCreation;
  924.          FTIME   ftimeCreation;
  925.          FDATE   fdateLastAccess;
  926.          FTIME   ftimeLastAccess;
  927.          FDATE   fdateLastWrite;
  928.          FTIME   ftimeLastWrite;
  929.          ULONG   cbFile;
  930.          ULONG   cbFileAlloc;
  931.          ULONG   attrFile;                    /* widened field */
  932.          UCHAR   cchName;
  933.          CHAR    achName[CCHMAXPATHCOMP];
  934.       } FILEFINDBUF3;
  935.       typedef FILEFINDBUF3 *PFILEFINDBUF3;
  936.  
  937.       typedef struct _FILEFINDBUF4                 /* findbuf4 */
  938.       {
  939.          ULONG   oNextEntryOffset;            /* new field */
  940.          FDATE   fdateCreation;
  941.          FTIME   ftimeCreation;
  942.          FDATE   fdateLastAccess;
  943.          FTIME   ftimeLastAccess;
  944.          FDATE   fdateLastWrite;
  945.          FTIME   ftimeLastWrite;
  946.          ULONG   cbFile;
  947.          ULONG   cbFileAlloc;
  948.          ULONG   attrFile;                    /* widened field */
  949.          ULONG   cbList;
  950.          UCHAR   cchName;
  951.          CHAR    achName[CCHMAXPATHCOMP];
  952.       } FILEFINDBUF4;
  953.       typedef FILEFINDBUF4  *PFILEFINDBUF4;
  954.  
  955.       /* extended attribute structures */
  956.  
  957.       typedef struct _GEA         /* gea */
  958.       {
  959.          BYTE cbName;        /* name length not including NULL */
  960.          CHAR szName[1];     /* attribute name */
  961.       } GEA;
  962.       typedef GEA *PGEA;
  963.  
  964.       typedef struct _GEALIST     /* geal */
  965.       {
  966.          ULONG cbList;       /* total bytes of structure including full list */
  967.          GEA list[1];        /* variable length GEA structures */
  968.       } GEALIST;
  969.       typedef GEALIST  *PGEALIST;
  970.  
  971.       typedef struct _FEA         /* fea */
  972.       {
  973.          BYTE fEA;           /* flags                              */
  974.          BYTE cbName;        /* name length not including NULL */
  975.          USHORT cbValue;     /* value length */
  976.       } FEA;
  977.       typedef FEA *PFEA;
  978.  
  979.       /* flags for _FEA.fEA */
  980.       #define FEA_NEEDEA         0x80     /* need EA bit */
  981.  
  982.       typedef struct _FEALIST     /* feal */
  983.       {
  984.          ULONG cbList;       /* total bytes of structure including full list */
  985.          FEA list[1];        /* variable length FEA structures */
  986.       } FEALIST;
  987.       typedef FEALIST *PFEALIST;
  988.  
  989.       typedef struct _EAOP        /* eaop */
  990.       {
  991.          PGEALIST fpGEAList; /* general EA list */
  992.          PFEALIST fpFEAList; /* full EA list */
  993.          ULONG oError;
  994.       } EAOP;
  995.       typedef EAOP *PEAOP;
  996.  
  997.       /*NOINC*/
  998.       #pragma pack(1)
  999.       /*INC*/
  1000.  
  1001.       typedef struct _FEA2         /* fea2 */
  1002.       {
  1003.          ULONG   oNextEntryOffset;    /* new field */
  1004.          BYTE    fEA;
  1005.          BYTE    cbName;
  1006.          USHORT  cbValue;
  1007.          CHAR    szName[1];           /* new field */
  1008.       } FEA2;
  1009.       typedef FEA2 *PFEA2;
  1010.  
  1011.  
  1012.       typedef struct _FEA2LIST     /* fea2l */
  1013.       {
  1014.          ULONG   cbList;
  1015.          FEA2    list[1];
  1016.       } FEA2LIST;
  1017.       typedef FEA2LIST *PFEA2LIST;
  1018.  
  1019.       typedef struct _GEA2          /* gea2 */
  1020.       {
  1021.          ULONG   oNextEntryOffset;     /* new field */
  1022.          BYTE    cbName;
  1023.          CHAR    szName[1];            /* new field */
  1024.       } GEA2;
  1025.       typedef GEA2 *PGEA2;
  1026.  
  1027.       typedef struct _GEA2LIST      /* gea2l */
  1028.       {
  1029.          ULONG   cbList;
  1030.          GEA2    list[1];
  1031.       } GEA2LIST;
  1032.       typedef GEA2LIST *PGEA2LIST;
  1033.  
  1034.       typedef struct _EAOP2         /* eaop2 */
  1035.       {
  1036.          PGEA2LIST   fpGEA2List;       /* GEA set */
  1037.          PFEA2LIST   fpFEA2List;       /* FEA set */
  1038.          ULONG       oError;           /* offset of FEA error */
  1039.       } EAOP2;
  1040.       typedef EAOP2 *PEAOP2;
  1041.  
  1042.  
  1043.       /*
  1044.       * Equates for the types of EAs that follow the convention that we have
  1045.       * established.
  1046.       *
  1047.       * Values 0xFFFE thru 0x8000 are reserved.
  1048.       * Values 0x0000 thru 0x7fff are user definable.
  1049.       * Value  0xFFFC is not used
  1050.       */
  1051.  
  1052.       #define EAT_BINARY      0xFFFE      /* length preceeded binary */
  1053.       #define EAT_ASCII       0xFFFD      /* length preceeded ASCII */
  1054.       #define EAT_BITMAP      0xFFFB      /* length preceeded bitmap */
  1055.       #define EAT_METAFILE    0xFFFA      /* length preceeded metafile */
  1056.       #define EAT_ICON        0xFFF9      /* length preceeded icon */
  1057.       #define EAT_EA          0xFFEE      /* length preceeded ASCII */
  1058.                                           /* name of associated data (#include) */
  1059.       #define EAT_MVMT        0xFFDF      /* multi-valued, multi-typed field */
  1060.       #define EAT_MVST        0xFFDE      /* multi-valued, single-typed field */
  1061.       #define EAT_ASN1        0xFFDD      /* ASN.1 field */
  1062.  
  1063.    #endif  /* !INCL_SAADEFS */
  1064.    /*NOINC*/
  1065.    #pragma pack()
  1066.    /*INC*/
  1067.  
  1068.  
  1069.  
  1070. #ifdef __cplusplus
  1071.    APIRET APIENTRY  DosOpen(PCSZ     pszFileName,
  1072.                             PHFILE pHf,
  1073.                             PULONG pulAction,
  1074.                             ULONG  cbFile,
  1075.                             ULONG  ulAttribute,
  1076.                             ULONG  fsOpenFlags,
  1077.                             ULONG  fsOpenMode,
  1078.                             PEAOP2 peaop2);
  1079. #else
  1080.    APIRET APIENTRY  DosOpen(PSZ    pszFileName,
  1081.                             PHFILE pHf,
  1082.                             PULONG pulAction,
  1083.                             ULONG  cbFile,
  1084.                             ULONG  ulAttribute,
  1085.                             ULONG  fsOpenFlags,
  1086.                             ULONG  fsOpenMode,
  1087.                             PEAOP2 peaop2);
  1088. #endif
  1089.  
  1090. #ifdef __cplusplus
  1091.    APIRET APIENTRY  DosProtectOpen(PCSZ  pszFileName,
  1092.                                    PHFILE phf,
  1093.                                    PULONG pulAction,
  1094.                                    ULONG cbFile,
  1095.                                    ULONG ulAttribute,
  1096.                                    ULONG fsOpenFlags,
  1097.                                    ULONG fsOpenMode,
  1098.                                    PEAOP2 peaop2,
  1099.                                    PFHLOCK pfhFileHandleLockID);
  1100. #else
  1101.    APIRET APIENTRY  DosProtectOpen(PSZ pszFileName,
  1102.                                    PHFILE phf,
  1103.                                    PULONG pulAction,
  1104.                                    ULONG cbFile,
  1105.                                    ULONG ulAttribute,
  1106.                                    ULONG fsOpenFlags,
  1107.                                    ULONG fsOpenMode,
  1108.                                    PEAOP2 peaop2,
  1109.                                    PFHLOCK pfhFileHandleLockID);
  1110. #endif
  1111.  
  1112.    APIRET APIENTRY  DosClose(HFILE hFile);
  1113.  
  1114.    APIRET APIENTRY  DosProtectClose(HFILE hFile,
  1115.                                     FHLOCK fhFileHandleLockID);
  1116.  
  1117.    APIRET APIENTRY  DosRead(HFILE hFile,
  1118.                             PVOID pBuffer,
  1119.                             ULONG cbRead,
  1120.                             PULONG pcbActual);
  1121.  
  1122.    APIRET APIENTRY  DosProtectRead(HFILE hFile,
  1123.                                    PVOID pBuffer,
  1124.                                    ULONG cbRead,
  1125.                                    PULONG pcbActual,
  1126.                                    FHLOCK fhFileHandleLockID);
  1127.  
  1128.    APIRET APIENTRY  DosWrite(HFILE hFile,
  1129.                              PVOID pBuffer,
  1130.                              ULONG cbWrite,
  1131.                              PULONG pcbActual);
  1132.  
  1133.    APIRET APIENTRY  DosProtectWrite(HFILE hFile,
  1134.                                     PVOID pBuffer,
  1135.                                     ULONG cbWrite,
  1136.                                     PULONG pcbActual,
  1137.                                     FHLOCK fhFileHandleLockID);
  1138.  
  1139.    /* File time and date types */
  1140.  
  1141.    typedef struct _FILESTATUS      /* fsts */
  1142.    {
  1143.       FDATE  fdateCreation;
  1144.       FTIME  ftimeCreation;
  1145.       FDATE  fdateLastAccess;
  1146.       FTIME  ftimeLastAccess;
  1147.       FDATE  fdateLastWrite;
  1148.       FTIME  ftimeLastWrite;
  1149.       ULONG  cbFile;
  1150.       ULONG  cbFileAlloc;
  1151.       USHORT attrFile;
  1152.    } FILESTATUS;
  1153.    typedef FILESTATUS *PFILESTATUS;
  1154.  
  1155.    typedef struct _FILESTATUS2     /* fsts2 */
  1156.    {
  1157.       FDATE  fdateCreation;
  1158.       FTIME  ftimeCreation;
  1159.       FDATE  fdateLastAccess;
  1160.       FTIME  ftimeLastAccess;
  1161.       FDATE  fdateLastWrite;
  1162.       FTIME  ftimeLastWrite;
  1163.       ULONG  cbFile;
  1164.       ULONG  cbFileAlloc;
  1165.       USHORT attrFile;
  1166.       ULONG  cbList;
  1167.    } FILESTATUS2;
  1168.    typedef FILESTATUS2 *PFILESTATUS2;
  1169.  
  1170.    typedef struct _FILESTATUS3     /* fsts3 */
  1171.    {
  1172.       FDATE  fdateCreation;
  1173.       FTIME  ftimeCreation;
  1174.       FDATE  fdateLastAccess;
  1175.       FTIME  ftimeLastAccess;
  1176.       FDATE  fdateLastWrite;
  1177.       FTIME  ftimeLastWrite;
  1178.       ULONG  cbFile;
  1179.       ULONG  cbFileAlloc;
  1180.       ULONG  attrFile;
  1181.    } FILESTATUS3;
  1182.    typedef FILESTATUS3 *PFILESTATUS3;
  1183.  
  1184.    typedef struct _FILESTATUS4      /* fsts4 */
  1185.    {
  1186.       FDATE  fdateCreation;
  1187.       FTIME  ftimeCreation;
  1188.       FDATE  fdateLastAccess;
  1189.       FTIME  ftimeLastAccess;
  1190.       FDATE  fdateLastWrite;
  1191.       FTIME  ftimeLastWrite;
  1192.       ULONG  cbFile;
  1193.       ULONG  cbFileAlloc;
  1194.       ULONG  attrFile;
  1195.       ULONG  cbList;
  1196.    } FILESTATUS4;
  1197.    typedef FILESTATUS4  *PFILESTATUS4;
  1198.  
  1199.  
  1200.    typedef struct _FSALLOCATE      /* fsalloc */
  1201.    {
  1202.       ULONG  idFileSystem;
  1203.       ULONG  cSectorUnit;
  1204.       ULONG  cUnit;
  1205.       ULONG  cUnitAvail;
  1206.       USHORT cbSector;
  1207.    } FSALLOCATE;
  1208.    typedef FSALLOCATE *PFSALLOCATE;
  1209.  
  1210.    typedef LHANDLE HDIR;        /* hdir */
  1211.    typedef HDIR    *PHDIR;
  1212.  
  1213.    #define DosOpen2        DosOpen
  1214.    #define DosFindFirst2   DosFindFirst
  1215.    #define DosQFHandState  DosQueryFHState
  1216.    #define DosProtectQFHandState  DosProtectQueryFHState
  1217.    #define DosSetFHandState  DosSetFHState
  1218.    #define DosProtectSetFHandState  DosProtectSetFHState
  1219.    #define DosQHandType    DosQueryHType
  1220.    #define DosQFSAttach    DosQueryFSAttach
  1221.    #define DosNewSize      DosSetFileSize
  1222.    #define DosProtectNewSize  DosProtectSetFileSize
  1223.    #define DosBufReset     DosResetBuffer
  1224.    #define DosChgFilePtr   DosSetFilePtr
  1225.    #define DosProtectChgFilePtr   DosProtectSetFilePtr
  1226.    #define DosMkDir        DosCreateDir
  1227.    #define DosMkDir2       DosCreateDir
  1228.    #define DosRmDir        DosDeleteDir
  1229.    #define DosSelectDisk   DosSetDefaultDisk
  1230.    #define DosQCurDisk     DosQueryCurrentDisk
  1231.    #define DosChDir        DosSetCurrentDir
  1232.    #define DosQCurDir      DosQueryCurrentDir
  1233.    #define DosQFSInfo      DosQueryFSInfo
  1234.    #define DosQVerify      DosQueryVerify
  1235.    #define DosQFileInfo    DosQueryFileInfo
  1236.    #define DosProtectQFileInfo    DosProtectQueryFileInfo
  1237.    #define DosQPathInfo    DosQueryPathInfo
  1238.  
  1239. #ifdef __cplusplus
  1240.    APIRET APIENTRY  DosDelete(PCSZ  pszFile);
  1241. #else
  1242.    APIRET APIENTRY  DosDelete(PSZ pszFile);
  1243. #endif
  1244.  
  1245. #ifdef __cplusplus
  1246.    APIRET APIENTRY  DosForceDelete(PCSZ  pszFile);
  1247. #else
  1248.    APIRET APIENTRY  DosForceDelete(PSZ pszFile);
  1249. #endif
  1250.  
  1251.    APIRET APIENTRY  DosDupHandle(HFILE hFile,
  1252.                                  PHFILE pHfile);
  1253.  
  1254.    APIRET APIENTRY  DosQueryFHState(HFILE hFile,
  1255.                                     PULONG pMode);
  1256.    APIRET APIENTRY  DosProtectQueryFHState(HFILE hFile,
  1257.                                            PULONG pMode,
  1258.                                            FHLOCK fhFileHandleLockID);
  1259.  
  1260.    APIRET APIENTRY  DosSetFHState(HFILE hFile,
  1261.                                   ULONG mode);
  1262.  
  1263.    APIRET APIENTRY  DosProtectSetFHState(HFILE hFile,
  1264.                                          ULONG mode,
  1265.                                          FHLOCK fhFileHandleLockID);
  1266.  
  1267.    APIRET APIENTRY  DosQueryHType(HFILE hFile,
  1268.                                   PULONG pType,
  1269.                                   PULONG pAttr);
  1270.  
  1271. #ifdef __cplusplus
  1272.    APIRET APIENTRY  DosFindFirst(PCSZ     pszFileSpec,
  1273.                                  PHDIR  phdir,
  1274.                                  ULONG  flAttribute,
  1275.                                  PVOID  pfindbuf,
  1276.                                  ULONG  cbBuf,
  1277.                                  PULONG pcFileNames,
  1278.                                  ULONG  ulInfoLevel);
  1279. #else
  1280.    APIRET APIENTRY  DosFindFirst(PSZ    pszFileSpec,
  1281.                                  PHDIR  phdir,
  1282.                                  ULONG  flAttribute,
  1283.                                  PVOID  pfindbuf,
  1284.                                  ULONG  cbBuf,
  1285.                                  PULONG pcFileNames,
  1286.                                  ULONG  ulInfoLevel);
  1287. #endif
  1288.  
  1289.    APIRET APIENTRY  DosFindNext(HDIR   hDir,
  1290.                                 PVOID  pfindbuf,
  1291.                                 ULONG  cbfindbuf,
  1292.                                 PULONG pcFilenames);
  1293.  
  1294.    APIRET APIENTRY  DosFindClose(HDIR hDir);
  1295.  
  1296. #ifdef __cplusplus
  1297.    APIRET APIENTRY  DosFSAttach(PCSZ  pszDevice,
  1298.                                 PCSZ  pszFilesystem,
  1299.                                 PVOID pData,
  1300.                                 ULONG cbData,
  1301.                                 ULONG flag);
  1302. #else
  1303.    APIRET APIENTRY  DosFSAttach(PSZ pszDevice,
  1304.                                 PSZ pszFilesystem,
  1305.                                 PVOID pData,
  1306.                                 ULONG cbData,
  1307.                                 ULONG flag);
  1308. #endif
  1309.  
  1310. #ifdef __cplusplus
  1311.    APIRET APIENTRY  DosQueryFSAttach(PCSZ     pszDeviceName,
  1312.                                      ULONG  ulOrdinal,
  1313.                                      ULONG  ulFSAInfoLevel,
  1314.                                      PFSQBUFFER2 pfsqb,
  1315.                                      PULONG pcbBuffLength);
  1316. #else
  1317.    APIRET APIENTRY  DosQueryFSAttach(PSZ    pszDeviceName,
  1318.                                      ULONG  ulOrdinal,
  1319.                                      ULONG  ulFSAInfoLevel,
  1320.                                      PFSQBUFFER2 pfsqb,
  1321.                                      PULONG pcbBuffLength);
  1322. #endif
  1323.  
  1324. #ifdef __cplusplus
  1325.    APIRET APIENTRY  DosFSCtl(PVOID pData,
  1326.                              ULONG cbData,
  1327.                              PULONG pcbData,
  1328.                              PVOID pParms,
  1329.                              ULONG cbParms,
  1330.                              PULONG pcbParms,
  1331.                              ULONG function,
  1332.                              PCSZ  pszRoute,
  1333.                              HFILE hFile,
  1334.                              ULONG method);
  1335. #else
  1336.    APIRET APIENTRY  DosFSCtl(PVOID pData,
  1337.                              ULONG cbData,
  1338.                              PULONG pcbData,
  1339.                              PVOID pParms,
  1340.                              ULONG cbParms,
  1341.                              PULONG pcbParms,
  1342.                              ULONG function,
  1343.                              PSZ pszRoute,
  1344.                              HFILE hFile,
  1345.                              ULONG method);
  1346. #endif
  1347.  
  1348.    APIRET APIENTRY  DosSetFileSize(HFILE hFile,
  1349.                                    ULONG cbSize);
  1350.  
  1351.    APIRET APIENTRY  DosProtectSetFileSize(HFILE hFile,
  1352.                                           ULONG cbSize,
  1353.                                           FHLOCK fhFileHandleLockID);
  1354.  
  1355.    APIRET APIENTRY  DosResetBuffer(HFILE hFile);
  1356.  
  1357.    APIRET APIENTRY  DosSetFilePtr(HFILE hFile,
  1358.                                   LONG ib,
  1359.                                   ULONG method,
  1360.                                   PULONG ibActual);
  1361.  
  1362.    APIRET APIENTRY  DosProtectSetFilePtr(HFILE hFile,
  1363.                                          LONG ib,
  1364.                                          ULONG method,
  1365.                                          PULONG ibActual,
  1366.                                          FHLOCK fhFileHandleLockID);
  1367.  
  1368. #ifdef __cplusplus
  1369.    APIRET APIENTRY  DosMove(PCSZ  pszOld,
  1370.                             PCSZ  pszNew);
  1371. #else
  1372.    APIRET APIENTRY  DosMove(PSZ pszOld,
  1373.                             PSZ pszNew);
  1374. #endif
  1375.  
  1376. #ifdef __cplusplus
  1377.    APIRET APIENTRY  DosCopy(PCSZ  pszOld,
  1378.                             PCSZ  pszNew,
  1379.                             ULONG option);
  1380. #else
  1381.    APIRET APIENTRY  DosCopy(PSZ pszOld,
  1382.                             PSZ pszNew,
  1383.                             ULONG option);
  1384. #endif
  1385.  
  1386. #ifdef __cplusplus
  1387.    APIRET APIENTRY  DosEditName(ULONG metalevel,
  1388.                                 PCSZ  pszSource,
  1389.                                 PCSZ  pszEdit,
  1390.                                 PBYTE pszTarget,
  1391.                                 ULONG cbTarget);
  1392. #else
  1393.    APIRET APIENTRY  DosEditName(ULONG metalevel,
  1394.                                 PSZ pszSource,
  1395.                                 PSZ pszEdit,
  1396.                                 PBYTE pszTarget,
  1397.                                 ULONG cbTarget);
  1398. #endif
  1399.  
  1400. #ifdef __cplusplus
  1401.    APIRET APIENTRY  DosCreateDir(PCSZ  pszDirName,
  1402.                                  PEAOP2 peaop2);
  1403. #else
  1404.    APIRET APIENTRY  DosCreateDir(PSZ pszDirName,
  1405.                                  PEAOP2 peaop2);
  1406. #endif
  1407.  
  1408. #ifdef __cplusplus
  1409.    APIRET APIENTRY  DosDeleteDir(PCSZ  pszDir);
  1410. #else
  1411.    APIRET APIENTRY  DosDeleteDir(PSZ pszDir);
  1412. #endif
  1413.  
  1414.    APIRET APIENTRY  DosSetDefaultDisk(ULONG disknum);
  1415.  
  1416.    APIRET APIENTRY  DosQueryCurrentDisk(PULONG pdisknum,
  1417.                                         PULONG plogical);
  1418.  
  1419. #ifdef __cplusplus
  1420.    APIRET APIENTRY  DosSetCurrentDir(PCSZ  pszDir);
  1421. #else
  1422.    APIRET APIENTRY  DosSetCurrentDir(PSZ pszDir);
  1423. #endif
  1424.  
  1425.    APIRET APIENTRY  DosQueryCurrentDir(ULONG disknum,
  1426.                                        PBYTE pBuf,
  1427.                                        PULONG pcbBuf);
  1428.  
  1429.    APIRET APIENTRY  DosQueryFSInfo(ULONG disknum,
  1430.                                    ULONG infolevel,
  1431.                                    PVOID pBuf,
  1432.                                    ULONG cbBuf);
  1433.  
  1434.    APIRET APIENTRY  DosSetFSInfo(ULONG disknum,
  1435.                                  ULONG infolevel,
  1436.                                  PVOID pBuf,
  1437.                                  ULONG cbBuf);
  1438.  
  1439.    APIRET APIENTRY  DosQueryVerify(PBOOL32 pBool);
  1440.  
  1441.    APIRET APIENTRY  DosSetVerify(BOOL32);
  1442.  
  1443.    APIRET APIENTRY  DosSetMaxFH(ULONG cFH);
  1444.  
  1445.    APIRET APIENTRY  DosSetRelMaxFH(PLONG pcbReqCount,
  1446.                                    PULONG pcbCurMaxFH);
  1447.  
  1448.    APIRET APIENTRY  DosQueryFileInfo(HFILE hf,
  1449.                                      ULONG ulInfoLevel,
  1450.                                      PVOID pInfo,
  1451.                                      ULONG cbInfoBuf);
  1452.  
  1453.    APIRET APIENTRY  DosProtectQueryFileInfo(HFILE hf,
  1454.                                             ULONG ulInfoLevel,
  1455.                                             PVOID pInfo,
  1456.                                             ULONG cbInfoBuf,
  1457.                                             FHLOCK fhFileHandleLockID);
  1458.  
  1459.    APIRET APIENTRY  DosSetFileInfo(HFILE hf,
  1460.                                    ULONG ulInfoLevel,
  1461.                                    PVOID pInfoBuf,
  1462.                                    ULONG cbInfoBuf);
  1463.  
  1464.    APIRET APIENTRY  DosProtectSetFileInfo(HFILE hf,
  1465.                                           ULONG ulInfoLevel,
  1466.                                           PVOID pInfoBuf,
  1467.                                           ULONG cbInfoBuf,
  1468.                                           FHLOCK fhFileHandleLockID);
  1469.  
  1470. #ifdef __cplusplus
  1471.    APIRET APIENTRY  DosQueryPathInfo(PCSZ    pszPathName,
  1472.                                      ULONG ulInfoLevel,
  1473.                                      PVOID pInfoBuf,
  1474.                                      ULONG cbInfoBuf);
  1475. #else
  1476.    APIRET APIENTRY  DosQueryPathInfo(PSZ   pszPathName,
  1477.                                      ULONG ulInfoLevel,
  1478.                                      PVOID pInfoBuf,
  1479.                                      ULONG cbInfoBuf);
  1480. #endif
  1481.  
  1482. #ifdef __cplusplus
  1483.    APIRET APIENTRY  DosSetPathInfo(PCSZ    pszPathName,
  1484.                                    ULONG ulInfoLevel,
  1485.                                    PVOID pInfoBuf,
  1486.                                    ULONG cbInfoBuf,
  1487.                                    ULONG flOptions);
  1488. #else
  1489.    APIRET APIENTRY  DosSetPathInfo(PSZ   pszPathName,
  1490.                                    ULONG ulInfoLevel,
  1491.                                    PVOID pInfoBuf,
  1492.                                    ULONG cbInfoBuf,
  1493.                                    ULONG flOptions);
  1494. #endif
  1495.  
  1496.    /* defines for DosSetPathInfo -pathinfo flag */
  1497.    #define DSPI_WRTTHRU    0x10    /* write through */
  1498.  
  1499.    APIRET APIENTRY  DosShutdown(ULONG ulReserved);
  1500.  
  1501.    APIRET APIENTRY  DosEnumAttribute(ULONG  ulRefType,
  1502.                                      PVOID  pvFile,
  1503.                                      ULONG  ulEntry,
  1504.                                      PVOID  pvBuf,
  1505.                                      ULONG  cbBuf,
  1506.                                      PULONG pulCount,
  1507.                                      ULONG  ulInfoLevel);
  1508.  
  1509.    APIRET APIENTRY  DosProtectEnumAttribute(ULONG ulRefType,
  1510.                                             PVOID pvFile,
  1511.                                             ULONG ulEntry,
  1512.                                             PVOID pvBuf,
  1513.                                             ULONG cbBuf,
  1514.                                             PULONG pulCount,
  1515.                                             ULONG ulInfoLevel,
  1516.                                             FHLOCK fhFileHandleLockID );
  1517.  
  1518.    /*NOINC*/
  1519.    #pragma pack(1)
  1520.    /*INC */
  1521.  
  1522.    typedef struct _DENA1 /* _dena1 level 1 info returned from DosEnumAttribute */
  1523.    {
  1524.       UCHAR       reserved;       /* 0 */
  1525.       UCHAR       cbName;         /* length of name exculding NULL */
  1526.       USHORT      cbValue;        /* length of value */
  1527.       UCHAR       szName[1];      /* variable length asciiz name */
  1528.    } DENA1;
  1529.    typedef DENA1 *PDENA1;
  1530.  
  1531.    typedef FEA2  DENA2;
  1532.    typedef PFEA2 PDENA2;
  1533.  
  1534.    /*NOINC*/
  1535.    #pragma pack()
  1536.    /*INC */
  1537.    /* Infolevels for DosEnumAttribute  */
  1538.    #define ENUMEA_LEVEL_NO_VALUE   1L      /* FEA without value */
  1539.    /* Reference types for DosEnumAttribute */
  1540.    #define ENUMEA_REFTYPE_FHANDLE  0       /* file handle */
  1541.    #define ENUMEA_REFTYPE_PATH     1       /* path name */
  1542.    #define ENUMEA_REFTYPE_MAX      ENUMEA_REFTYPE_PATH
  1543.  
  1544. #endif /* common INCL_DOSFILEMGR */
  1545.  
  1546. #if (defined(INCL_DOSMEMMGR) || !defined(INCL_NOCOMMON))
  1547.    /*** Memory management */
  1548.  
  1549.    APIRET APIENTRY  DosAllocMem(PPVOID ppb,
  1550.                                 ULONG cb,
  1551.                                 ULONG flag);
  1552.  
  1553.    APIRET APIENTRY  DosFreeMem(PVOID pb);
  1554.  
  1555.    APIRET APIENTRY  DosSetMem(PVOID pb,
  1556.                               ULONG cb,
  1557.                               ULONG flag);
  1558.  
  1559.    APIRET APIENTRY  DosGiveSharedMem(PVOID pb,
  1560.                                      PID pid,
  1561.                                      ULONG flag);
  1562.  
  1563.    APIRET APIENTRY  DosGetSharedMem(PVOID pb,
  1564.                                     ULONG flag);
  1565.  
  1566. #ifdef __cplusplus
  1567.    APIRET APIENTRY  DosGetNamedSharedMem(PPVOID ppb,
  1568.                                          PCSZ  pszName,
  1569.                                          ULONG flag);
  1570. #else
  1571.    APIRET APIENTRY  DosGetNamedSharedMem(PPVOID ppb,
  1572.                                          PSZ pszName,
  1573.                                          ULONG flag);
  1574. #endif
  1575.  
  1576. #ifdef __cplusplus
  1577.    APIRET APIENTRY  DosAllocSharedMem(PPVOID ppb,
  1578.                                       PCSZ  pszName,
  1579.                                       ULONG cb,
  1580.                                       ULONG flag);
  1581. #else
  1582.    APIRET APIENTRY  DosAllocSharedMem(PPVOID ppb,
  1583.                                       PSZ pszName,
  1584.                                       ULONG cb,
  1585.                                       ULONG flag);
  1586. #endif
  1587.  
  1588.    APIRET APIENTRY  DosQueryMem(PVOID pb,
  1589.                                 PULONG pcb,
  1590.                                 PULONG pFlag);
  1591.  
  1592.    #define DosSubAlloc     DosSubAllocMem
  1593.    #define DOSSUBALLOC     DosSubAllocMem
  1594.    APIRET APIENTRY  DosSubAllocMem(PVOID pbBase,
  1595.                                    PPVOID ppb,
  1596.                                    ULONG cb);
  1597.  
  1598.    #define DosSubFree      DosSubFreeMem
  1599.    #define DOSSUBFREE      DosSubFreeMem
  1600.    APIRET APIENTRY  DosSubFreeMem(PVOID pbBase,
  1601.                                   PVOID pb,
  1602.                                   ULONG cb);
  1603.  
  1604.    #define DosSubSet       DosSubSetMem
  1605.    #define DOSSUBSET       DosSubSetMem
  1606.    APIRET APIENTRY  DosSubSetMem(PVOID pbBase,
  1607.                                  ULONG flag,
  1608.                                  ULONG cb);
  1609.  
  1610.    #define DosSubUnset     DosSubUnsetMem
  1611.    #define DOSSUBUNSET     DosSubUnsetMem
  1612.    APIRET APIENTRY  DosSubUnsetMem(PVOID pbBase);
  1613.  
  1614.    #include <bsememf.h>    /* get flags for API                            */
  1615.  
  1616. #endif /* INCL_DOSMEMMGR */
  1617.  
  1618.  
  1619.  
  1620. #if (defined(INCL_DOSSEMAPHORES) || !defined(INCL_NOCOMMON))
  1621.  
  1622.    /*
  1623.    *     32-bit Semaphore Support
  1624.    */
  1625.  
  1626.    /* Semaphore Attributes */
  1627.  
  1628.    #define DC_SEM_SHARED   0x01   /* DosCreateMutex, DosCreateEvent, and     */
  1629.                                   /*   DosCreateMuxWait use it to indicate   */
  1630.                                   /*   whether the semaphore is shared or    */
  1631.                                   /*   private when the PSZ is null          */
  1632.    #define DCMW_WAIT_ANY   0x02   /* DosCreateMuxWait option for wait on any */
  1633.                                   /*   event/mutex to occur                  */
  1634.    #define DCMW_WAIT_ALL   0x04   /* DosCreateMuxWait option for wait on all */
  1635.                                   /*   events/mutexs to occur                */
  1636.  
  1637.    #define SEM_INDEFINITE_WAIT     -1L
  1638.    #define SEM_IMMEDIATE_RETURN     0L
  1639.  
  1640.    #ifndef __HSEM__
  1641. /* NOINC */
  1642.       #define __HSEM__
  1643.       typedef ULONG HSEM;
  1644.       typedef HSEM *PHSEM;
  1645. /* INC */
  1646.    #endif
  1647.  
  1648.    typedef struct _PSEMRECORD      /* psr */
  1649.    {
  1650.       HSEM        hsemCur;
  1651.       ULONG       ulUser;
  1652.    } SEMRECORD;
  1653.    typedef SEMRECORD *PSEMRECORD;
  1654.  
  1655. #endif /* common INCL_DOSSEMAPHORES */
  1656.  
  1657.  
  1658.  
  1659. #ifdef INCL_DOSSEMAPHORES
  1660.  
  1661.    #ifndef __HEV__            /* INCL_SEMAPHORE may also define HEV */
  1662.       #define __HEV__
  1663.       typedef  ULONG    HEV;             /* hev */
  1664.       typedef  HEV      *PHEV;
  1665.    #endif
  1666.  
  1667.    typedef  ULONG    HMTX;            /* hmtx */
  1668.    typedef  HMTX     *PHMTX;
  1669.    typedef  ULONG    HMUX;            /* hmux */
  1670.    typedef  HMUX     *PHMUX;
  1671.  
  1672. #ifdef __cplusplus
  1673.    APIRET APIENTRY  DosCreateEventSem (PCSZ  pszName,
  1674.                                        PHEV phev,
  1675.                                        ULONG flAttr,
  1676.                                        BOOL32 fState);
  1677. #else
  1678.    APIRET APIENTRY  DosCreateEventSem (PSZ pszName,
  1679.                                        PHEV phev,
  1680.                                        ULONG flAttr,
  1681.                                        BOOL32 fState);
  1682. #endif
  1683.  
  1684. #ifdef __cplusplus
  1685.    APIRET APIENTRY  DosOpenEventSem (PCSZ  pszName,
  1686.                                      PHEV phev);
  1687. #else
  1688.    APIRET APIENTRY  DosOpenEventSem (PSZ pszName,
  1689.                                      PHEV phev);
  1690. #endif
  1691.  
  1692.    APIRET APIENTRY  DosCloseEventSem (HEV hev);
  1693.  
  1694.    APIRET APIENTRY  DosResetEventSem (HEV hev,
  1695.                                       PULONG pulPostCt);
  1696.  
  1697.    APIRET APIENTRY  DosPostEventSem (HEV hev);
  1698.  
  1699.    APIRET APIENTRY  DosWaitEventSem (HEV hev,
  1700.                                      ULONG ulTimeout);
  1701.  
  1702.    APIRET APIENTRY  DosQueryEventSem (HEV hev,
  1703.                                       PULONG pulPostCt);
  1704.  
  1705. #ifdef __cplusplus
  1706.    APIRET APIENTRY  DosCreateMutexSem (PCSZ  pszName,
  1707.                                        PHMTX phmtx,
  1708.                                        ULONG flAttr,
  1709.                                        BOOL32 fState);
  1710. #else
  1711.    APIRET APIENTRY  DosCreateMutexSem (PSZ pszName,
  1712.                                        PHMTX phmtx,
  1713.                                        ULONG flAttr,
  1714.                                        BOOL32 fState);
  1715. #endif
  1716.  
  1717. #ifdef __cplusplus
  1718.    APIRET APIENTRY  DosOpenMutexSem (PCSZ  pszName,
  1719.                                      PHMTX phmtx);
  1720. #else
  1721.    APIRET APIENTRY  DosOpenMutexSem (PSZ pszName,
  1722.                                      PHMTX phmtx);
  1723. #endif
  1724.  
  1725.    APIRET APIENTRY  DosCloseMutexSem (HMTX hmtx);
  1726.  
  1727.    APIRET APIENTRY  DosRequestMutexSem (HMTX hmtx,
  1728.                                         ULONG ulTimeout);
  1729.  
  1730.    APIRET APIENTRY  DosReleaseMutexSem (HMTX hmtx);
  1731.  
  1732.    APIRET APIENTRY  DosQueryMutexSem (HMTX hmtx,
  1733.                                       PID *ppid,
  1734.                                       TID *ptid,
  1735.                                       PULONG pulCount);
  1736.  
  1737. #ifdef __cplusplus
  1738.    APIRET APIENTRY  DosCreateMuxWaitSem (PCSZ  pszName,
  1739.                                          PHMUX phmux,
  1740.                                          ULONG cSemRec,
  1741.                                          PSEMRECORD pSemRec,
  1742.                                          ULONG flAttr);
  1743. #else
  1744.    APIRET APIENTRY  DosCreateMuxWaitSem (PSZ pszName,
  1745.                                          PHMUX phmux,
  1746.                                          ULONG cSemRec,
  1747.                                          PSEMRECORD pSemRec,
  1748.                                          ULONG flAttr);
  1749. #endif
  1750.  
  1751. #ifdef __cplusplus
  1752.    APIRET APIENTRY  DosOpenMuxWaitSem (PCSZ  pszName,
  1753.                                        PHMUX phmux);
  1754. #else
  1755.    APIRET APIENTRY  DosOpenMuxWaitSem (PSZ pszName,
  1756.                                        PHMUX phmux);
  1757. #endif
  1758.  
  1759.    APIRET APIENTRY  DosCloseMuxWaitSem (HMUX hmux);
  1760.  
  1761.    APIRET APIENTRY  DosWaitMuxWaitSem (HMUX hmux,
  1762.                                        ULONG ulTimeout,
  1763.                                        PULONG pulUser);
  1764.  
  1765.    APIRET APIENTRY  DosAddMuxWaitSem (HMUX hmux,
  1766.                                       PSEMRECORD pSemRec);
  1767.  
  1768.    APIRET APIENTRY  DosDeleteMuxWaitSem (HMUX hmux,
  1769.                                          HSEM hSem);
  1770.  
  1771.    APIRET APIENTRY  DosQueryMuxWaitSem (HMUX hmux,
  1772.                                         PULONG pcSemRec,
  1773.                                         PSEMRECORD pSemRec,
  1774.                                         PULONG pflAttr);
  1775.  
  1776. #endif /* INCL_DOSSEMAPHORES */
  1777.  
  1778.  
  1779.  
  1780. #if (defined(INCL_DOSDATETIME) || !defined(INCL_NOCOMMON))
  1781.  
  1782.    /*** Time support */
  1783.  
  1784.    typedef struct _DATETIME      /* date */
  1785.    {
  1786.       UCHAR   hours;
  1787.       UCHAR   minutes;
  1788.       UCHAR   seconds;
  1789.       UCHAR   hundredths;
  1790.       UCHAR   day;
  1791.       UCHAR   month;
  1792.       USHORT  year;
  1793.       SHORT   timezone;
  1794.       UCHAR   weekday;
  1795.    } DATETIME;
  1796.    typedef DATETIME *PDATETIME;
  1797.  
  1798.    APIRET APIENTRY   DosGetDateTime(PDATETIME pdt);
  1799.  
  1800.    APIRET APIENTRY   DosSetDateTime(PDATETIME pdt);
  1801.  
  1802. #endif /* common INCL_DOSDATETIME */
  1803.  
  1804.  
  1805.  
  1806. #ifdef INCL_DOSDATETIME
  1807.  
  1808.    #define DosTimerAsync   DosAsyncTimer
  1809.    #define DosTimerStart   DosStartTimer
  1810.    #define DosTimerStop    DosStopTimer
  1811.  
  1812.    typedef LHANDLE HTIMER;
  1813.    typedef HTIMER  *PHTIMER;
  1814.  
  1815.    APIRET APIENTRY   DosAsyncTimer(ULONG msec,
  1816.                                    HSEM hsem,
  1817.                                    PHTIMER phtimer);
  1818.  
  1819.    APIRET APIENTRY   DosStartTimer(ULONG msec,
  1820.                                    HSEM hsem,
  1821.                                    PHTIMER phtimer);
  1822.  
  1823.    APIRET APIENTRY   DosStopTimer(HTIMER htimer);
  1824.  
  1825. #endif /* INCL_DOSDATETIME */
  1826.  
  1827.  
  1828.  
  1829.  
  1830. /*** Module manager */
  1831.  
  1832. #ifdef INCL_DOSMODULEMGR
  1833.  
  1834.  
  1835. #ifdef __cplusplus
  1836.    APIRET APIENTRY  DosLoadModule(PCSZ  pszName,
  1837.                                   ULONG cbName,
  1838.                                   PCSZ  pszModname,
  1839.                                   PHMODULE phmod);
  1840. #else
  1841.    APIRET APIENTRY  DosLoadModule(PSZ pszName,
  1842.                                   ULONG cbName,
  1843.                                   PSZ pszModname,
  1844.                                   PHMODULE phmod);
  1845. #endif
  1846.  
  1847.    APIRET APIENTRY  DosFreeModule(HMODULE hmod);
  1848.  
  1849. #ifdef __cplusplus
  1850.    APIRET APIENTRY  DosQueryProcAddr(HMODULE hmod,
  1851.                                      ULONG ordinal,
  1852.                                      PCSZ  pszName,
  1853.                                      PFN* ppfn);
  1854. #else
  1855.    APIRET APIENTRY  DosQueryProcAddr(HMODULE hmod,
  1856.                                      ULONG ordinal,
  1857.                                      PSZ pszName,
  1858.                                      PFN* ppfn);
  1859. #endif
  1860.  
  1861. #ifdef __cplusplus
  1862.    APIRET APIENTRY  DosQueryModuleHandle(PCSZ  pszModname,
  1863.                                          PHMODULE phmod);
  1864. #else
  1865.    APIRET APIENTRY  DosQueryModuleHandle(PSZ pszModname,
  1866.                                          PHMODULE phmod);
  1867. #endif
  1868.  
  1869.    APIRET APIENTRY  DosQueryModuleName(HMODULE hmod,
  1870.                                        ULONG cbName,
  1871.                                        PCHAR pch);
  1872.  
  1873.    #define PT_16BIT        0
  1874.    #define PT_32BIT        1
  1875.  
  1876. #ifdef __cplusplus
  1877.    APIRET APIENTRY  DosQueryProcType(HMODULE hmod,
  1878.                                      ULONG ordinal,
  1879.                                      PCSZ  pszName,
  1880.                                      PULONG pulproctype);
  1881. #else
  1882.    APIRET APIENTRY  DosQueryProcType(HMODULE hmod,
  1883.                                      ULONG ordinal,
  1884.                                      PSZ pszName,
  1885.                                      PULONG pulproctype);
  1886. #endif
  1887.  
  1888. #endif /* INCL_DOSMODULEMGR */
  1889.  
  1890.  
  1891.  
  1892. #if (defined(INCL_DOSRESOURCES) || !defined(INCL_NOCOMMON))
  1893.  
  1894.    /*** Resource support */
  1895.  
  1896.    /* Predefined resource types */
  1897.  
  1898.    #define RT_POINTER      1   /* mouse pointer shape */
  1899.    #define RT_BITMAP       2   /* bitmap */
  1900.    #define RT_MENU         3   /* menu template */
  1901.    #define RT_DIALOG       4   /* dialog template */
  1902.    #define RT_STRING       5   /* string tables */
  1903.    #define RT_FONTDIR      6   /* font directory */
  1904.    #define RT_FONT         7   /* font */
  1905.    #define RT_ACCELTABLE   8   /* accelerator tables */
  1906.    #define RT_RCDATA       9   /* binary data */
  1907.    #define RT_MESSAGE      10  /* error msg     tables */
  1908.    #define RT_DLGINCLUDE   11  /* dialog include file name */
  1909.    #define RT_VKEYTBL      12  /* key to vkey tables */
  1910.    #define RT_KEYTBL       13  /* key to UGL tables */
  1911.    #define RT_CHARTBL      14  /* glyph to character tables */
  1912.    #define RT_DISPLAYINFO  15  /* screen display information */
  1913.  
  1914.    #define RT_FKASHORT     16  /* function key area short form */
  1915.    #define RT_FKALONG      17  /* function key area long form */
  1916.  
  1917.    #define RT_HELPTABLE    18  /* Help table for Cary Help manager */
  1918.    #define RT_HELPSUBTABLE 19  /* Help subtable for Cary Help manager */
  1919.  
  1920.    #define RT_FDDIR        20  /* DBCS uniq/font driver directory */
  1921.    #define RT_FD           21  /* DBCS uniq/font driver */
  1922.  
  1923.    #define RT_MAX          22  /* 1st unused Resource Type */
  1924.    #define RT_RESNAMES     255 /* Resource ID of the resource names table */
  1925.  
  1926.  
  1927.    #define RF_ORDINALID    0x80000000L     /* ordinal id flag in resource table */
  1928.  
  1929. #endif /* common INCL_DOSRESOURCES */
  1930.  
  1931.  
  1932.  
  1933.  
  1934. #ifdef INCL_DOSRESOURCES
  1935.  
  1936.    #define DosGetResource2 DosGetResource
  1937.  
  1938.    APIRET APIENTRY  DosGetResource(HMODULE hmod,
  1939.                                    ULONG idType,
  1940.                                    ULONG idName,
  1941.                                    PPVOID ppb);
  1942.  
  1943.    APIRET APIENTRY  DosFreeResource(PVOID pb);
  1944.  
  1945.    APIRET APIENTRY  DosQueryResourceSize(HMODULE hmod,
  1946.                                          ULONG idt,
  1947.                                          ULONG idn,
  1948.                                          PULONG pulsize);
  1949.  
  1950. #endif /* INCL_DOSRESOURCES */
  1951.  
  1952.  
  1953.  
  1954.  
  1955. /*** NLS Support */
  1956.  
  1957. #ifdef INCL_DOSNLS
  1958.  
  1959.    typedef struct _COUNTRYCODE   /* ctryc */
  1960.    {
  1961.       ULONG       country;
  1962.       ULONG       codepage;
  1963.    } COUNTRYCODE;
  1964.    typedef COUNTRYCODE *PCOUNTRYCODE;
  1965.  
  1966.    typedef struct _COUNTRYINFO   /* ctryi */
  1967.    {
  1968.       ULONG       country;
  1969.       ULONG       codepage;
  1970.       ULONG       fsDateFmt;
  1971.       CHAR        szCurrency[5];
  1972.       CHAR        szThousandsSeparator[2];
  1973.       CHAR        szDecimal[2];
  1974.       CHAR        szDateSeparator[2];
  1975.       CHAR        szTimeSeparator[2];
  1976.       UCHAR       fsCurrencyFmt;
  1977.       UCHAR       cDecimalPlace;
  1978.       UCHAR       fsTimeFmt;
  1979.       USHORT      abReserved1[2];
  1980.       CHAR        szDataSeparator[2];
  1981.       USHORT      abReserved2[5];
  1982.    } COUNTRYINFO, *PCOUNTRYINFO;
  1983.  
  1984.    #define DosGetCtryInfo  DosQueryCtryInfo
  1985.    #define DosGetDBCSEv    DosQueryDBCSEnv
  1986.    #define DosCaseMap      DosMapCase
  1987.    #define DosGetCollate   DosQueryCollate
  1988.    #define DosGetCp        DosQueryCp
  1989.    #define DosSetProcCp    DosSetProcessCp
  1990.  
  1991.    APIRET APIENTRY  DosQueryCtryInfo(ULONG cb,
  1992.                                      PCOUNTRYCODE pcc,
  1993.                                      PCOUNTRYINFO pci,
  1994.                                      PULONG pcbActual);
  1995.  
  1996.    APIRET APIENTRY  DosQueryDBCSEnv(ULONG cb,
  1997.                                     PCOUNTRYCODE pcc,
  1998.                                     PCHAR pBuf);
  1999.  
  2000.    APIRET APIENTRY  DosMapCase(ULONG cb,
  2001.                                PCOUNTRYCODE pcc,
  2002.                                PCHAR pch);
  2003.  
  2004.    APIRET APIENTRY  DosQueryCollate(ULONG cb,
  2005.                                     PCOUNTRYCODE pcc,
  2006.                                     PCHAR pch,
  2007.                                     PULONG pcch);
  2008.  
  2009.    APIRET APIENTRY  DosQueryCp(ULONG cb,
  2010.                                PULONG arCP,
  2011.                                PULONG pcCP);
  2012.  
  2013.    APIRET APIENTRY  DosSetProcessCp(ULONG cp);
  2014.  
  2015. #endif /* INCL_DOSNLS */
  2016.  
  2017.  
  2018.  
  2019.  
  2020. /*** Signal support */
  2021.  
  2022. #ifdef INCL_DOSEXCEPTIONS
  2023.  
  2024.    /* DosSetSigExceptionFocus codes */
  2025.  
  2026.    #define SIG_UNSETFOCUS 0
  2027.    #define SIG_SETFOCUS 1
  2028.  
  2029.    #include <bsexcpt.h>
  2030.  
  2031.    APIRET APIENTRY  DosSetExceptionHandler(PEXCEPTIONREGISTRATIONRECORD pERegRec);
  2032.  
  2033.    APIRET APIENTRY  DosUnsetExceptionHandler(PEXCEPTIONREGISTRATIONRECORD pERegRec);
  2034.  
  2035.    APIRET APIENTRY  DosRaiseException(PEXCEPTIONREPORTRECORD pexcept);
  2036.  
  2037.    APIRET APIENTRY  DosSendSignalException(PID pid,
  2038.                                            ULONG exception);
  2039.  
  2040.    APIRET APIENTRY  DosUnwindException(PEXCEPTIONREGISTRATIONRECORD phandler,
  2041.                                        PVOID pTargetIP,
  2042.                                        PEXCEPTIONREPORTRECORD pERepRec);
  2043.  
  2044.    APIRET APIENTRY  DosSetSignalExceptionFocus(BOOL32 flag,
  2045.                                                PULONG pulTimes);
  2046.  
  2047.    APIRET APIENTRY  DosEnterMustComplete(PULONG pulNesting);
  2048.  
  2049.    APIRET APIENTRY  DosExitMustComplete(PULONG pulNesting);
  2050.  
  2051.    APIRET APIENTRY  DosAcknowledgeSignalException(ULONG ulSignalNum);
  2052.  
  2053.    APIRET APIENTRY DosQueryThreadContext(TID tid,
  2054.                                          ULONG level,
  2055.                                          PCONTEXTRECORD pcxt);
  2056.  
  2057. #endif /* INCL_DOSEXCEPTIONS */
  2058.  
  2059.  
  2060. /*** Pipe and queue support */
  2061.  
  2062. #ifdef INCL_DOSQUEUES
  2063.    #if (defined(INCL_DOSFILEMGR) || !defined(INCL_NOCOMMON))
  2064.  
  2065.       typedef LHANDLE HQUEUE;  /* hq */
  2066.       typedef HQUEUE  *PHQUEUE;
  2067.       typedef struct _REQUESTDATA     /* reqqdata */
  2068.       {
  2069.          PID         pid;
  2070.          ULONG       ulData;
  2071.       } REQUESTDATA;
  2072.       typedef REQUESTDATA *PREQUESTDATA;
  2073.  
  2074.       #define QUE_FIFO              0L
  2075.       #define QUE_LIFO              1L
  2076.       #define QUE_PRIORITY          2L
  2077.       #define QUE_NOCONVERT_ADDRESS 0L
  2078.       #define QUE_CONVERT_ADDRESS   4L
  2079.  
  2080.  
  2081.       APIRET APIENTRY  DosCreatePipe(PHFILE phfRead,
  2082.                                      PHFILE phfWrite,
  2083.                                      ULONG cb);
  2084.  
  2085.       APIRET APIENTRY  DosCloseQueue(HQUEUE hq);
  2086.  
  2087. #ifdef __cplusplus
  2088.       APIRET APIENTRY  DosCreateQueue(PHQUEUE phq,
  2089.                                       ULONG priority,
  2090.                                       PCSZ  pszName);
  2091. #else
  2092.       APIRET APIENTRY  DosCreateQueue(PHQUEUE phq,
  2093.                                       ULONG priority,
  2094.                                       PSZ pszName);
  2095. #endif
  2096.  
  2097. #ifdef __cplusplus
  2098.       APIRET APIENTRY  DosOpenQueue(PPID ppid,
  2099.                                     PHQUEUE phq,
  2100.                                     PCSZ  pszName);
  2101. #else
  2102.       APIRET APIENTRY  DosOpenQueue(PPID ppid,
  2103.                                     PHQUEUE phq,
  2104.                                     PSZ pszName);
  2105. #endif
  2106.  
  2107.       APIRET APIENTRY  DosPeekQueue(HQUEUE hq,
  2108.                                     PREQUESTDATA pRequest,
  2109.                                     PULONG pcbData,
  2110.                                     PPVOID ppbuf,
  2111.                                     PULONG element,
  2112.                                     BOOL32 nowait,
  2113.                                     PBYTE ppriority,
  2114.                                     HEV hsem);
  2115.  
  2116.       APIRET APIENTRY  DosPurgeQueue(HQUEUE hq);
  2117.  
  2118.       APIRET APIENTRY  DosQueryQueue(HQUEUE hq,
  2119.                                      PULONG pcbEntries);
  2120.  
  2121.       APIRET APIENTRY  DosReadQueue(HQUEUE hq,
  2122.                                     PREQUESTDATA pRequest,
  2123.                                     PULONG pcbData,
  2124.                                     PPVOID ppbuf,
  2125.                                     ULONG element,
  2126.                                     BOOL32 wait,
  2127.                                     PBYTE ppriority,
  2128.                                     HEV hsem);
  2129.  
  2130.       APIRET APIENTRY  DosWriteQueue(HQUEUE hq,
  2131.                                      ULONG request,
  2132.                                      ULONG cbData,
  2133.                                      PVOID pbData,
  2134.                                      ULONG priority);
  2135.  
  2136.    #else /* INCL_DOSFILEMGR || !INCL_NOCOMMON */
  2137.       #error PHFILE not defined - define INCL_DOSFILEMGR or undefine INCL_NOCOMMON
  2138.    #endif /* INCL_DOSFILEMGR || !INCL_NOCOMMON */
  2139. #endif /* INCL_DOSQUEUES */
  2140.  
  2141.  
  2142.  
  2143. #ifdef INCL_DOSMISC
  2144.  
  2145.    /* definitions for DosSearchPath control word */
  2146.    #define DSP_IMPLIEDCUR          1 /* current dir will be searched first */
  2147.    #define DSP_PATHREF             2 /* from env.variable */
  2148.    #define DSP_IGNORENETERR        4 /* ignore net errs & continue search */
  2149.  
  2150.    /* indices for DosQuerySysInfo */
  2151.    #define QSV_MAX_PATH_LENGTH        1
  2152.    #define Q_MAX_PATH_LENGTH          QSV_MAX_PATH_LENGTH
  2153.    #define QSV_MAX_TEXT_SESSIONS      2
  2154.    #define QSV_MAX_PM_SESSIONS        3
  2155.    #define QSV_MAX_VDM_SESSIONS       4
  2156.    #define QSV_BOOT_DRIVE             5 /* 1=A, 2=B, etc.                     */
  2157.    #define QSV_DYN_PRI_VARIATION      6 /* 0=Absolute, 1=Dynamic              */
  2158.    #define QSV_MAX_WAIT               7 /* seconds                            */
  2159.    #define QSV_MIN_SLICE              8 /* milli seconds                      */
  2160.    #define QSV_MAX_SLICE              9 /* milli seconds                      */
  2161.    #define QSV_PAGE_SIZE             10
  2162.    #define QSV_VERSION_MAJOR         11
  2163.    #define QSV_VERSION_MINOR         12
  2164.    #define QSV_VERSION_REVISION      13 /* Revision letter                    */
  2165.    #define QSV_MS_COUNT              14 /* Free running millisecond counter   */
  2166.    #define QSV_TIME_LOW              15 /* Low dword of time in seconds       */
  2167.    #define QSV_TIME_HIGH             16 /* High dword of time in seconds      */
  2168.    #define QSV_TOTPHYSMEM            17 /* Physical memory on system          */
  2169.    #define QSV_TOTRESMEM             18 /* Resident memory on system          */
  2170.    #define QSV_TOTAVAILMEM           19 /* Available memory for all processes */
  2171.    #define QSV_MAXPRMEM              20 /* Avail private mem for calling proc */
  2172.    #define QSV_MAXSHMEM              21 /* Avail shared mem for calling proc  */
  2173.    #define QSV_TIMER_INTERVAL        22 /* Timer interval in tenths of ms     */
  2174.    #define QSV_MAX_COMP_LENGTH       23 /* max len of one component in a name */
  2175.    #define QSV_FOREGROUND_FS_SESSION 24 /* Session ID of current fgnd FS session*/
  2176.    #define QSV_FOREGROUND_PROCESS    25 /* Process ID of current fgnd process */
  2177.    #define QSV_MAX                   QSV_MAX_COMP_LENGTH
  2178.  
  2179.    /* definitions for DosError - combine with | */
  2180.    #define FERR_DISABLEHARDERR     0x00000000L     /* disable hard error popups */
  2181.    #define FERR_ENABLEHARDERR      0x00000001L     /* enable hard error popups */
  2182.    #define FERR_ENABLEEXCEPTION    0x00000000L     /* enable exception popups */
  2183.    #define FERR_DISABLEEXCEPTION   0x00000002L     /* disable exception popups */
  2184.  
  2185.    /* definitions for DosQueryRASInfo Index */
  2186.    #define SIS_MMIOADDR            0
  2187.    #define SIS_MEC_TABLE           1
  2188.    #define SIS_SYS_LOG             2
  2189.  
  2190.    /* definitions for DosQueryExtLIBPATH and DosSetExtLIBPATH flags parameter */
  2191.    #define BEGIN_LIBPATH   1
  2192.    #define END_LIBPATH     2
  2193.  
  2194.    #define DosInsMessage   DosInsertMessage
  2195.    #define DosQSysInfo     DosQuerySysInfo
  2196.  
  2197.    APIRET APIENTRY  DosError(ULONG error);
  2198.  
  2199. #ifdef __cplusplus
  2200.    APIRET APIENTRY  DosGetMessage(PCHAR* pTable,
  2201.                                   ULONG cTable,
  2202.                                   PCHAR pBuf,
  2203.                                   ULONG cbBuf,
  2204.                                   ULONG msgnumber,
  2205.                                   PCSZ  pszFile,
  2206.                                   PULONG pcbMsg);
  2207. #else
  2208.    APIRET APIENTRY  DosGetMessage(PCHAR* pTable,
  2209.                                   ULONG cTable,
  2210.                                   PCHAR pBuf,
  2211.                                   ULONG cbBuf,
  2212.                                   ULONG msgnumber,
  2213.                                   PSZ pszFile,
  2214.                                   PULONG pcbMsg);
  2215. #endif
  2216.  
  2217.    APIRET APIENTRY  DosErrClass(ULONG code,
  2218.                                 PULONG pClass,
  2219.                                 PULONG pAction,
  2220.                                 PULONG pLocus);
  2221.  
  2222. #ifdef __cplusplus
  2223.    APIRET APIENTRY  DosInsertMessage(PCHAR* pTable,
  2224.                                      ULONG cTable,
  2225.                                      PCSZ  pszMsg,
  2226.                                      ULONG cbMsg,
  2227.                                      PCHAR pBuf,
  2228.                                      ULONG cbBuf,
  2229.                                      PULONG pcbMsg);
  2230. #else
  2231.    APIRET APIENTRY  DosInsertMessage(PCHAR* pTable,
  2232.                                      ULONG cTable,
  2233.                                      PSZ pszMsg,
  2234.                                      ULONG cbMsg,
  2235.                                      PCHAR pBuf,
  2236.                                      ULONG cbBuf,
  2237.                                      PULONG pcbMsg);
  2238. #endif
  2239.  
  2240.    APIRET APIENTRY  DosPutMessage(HFILE hfile,
  2241.                                   ULONG cbMsg,
  2242.                                   PCHAR pBuf);
  2243.  
  2244.    APIRET APIENTRY  DosQuerySysInfo(ULONG iStart,
  2245.                                     ULONG iLast,
  2246.                                     PVOID pBuf,
  2247.                                     ULONG cbBuf);
  2248.  
  2249. #ifdef __cplusplus
  2250.    APIRET APIENTRY  DosScanEnv(PCSZ  pszName,
  2251.                                PCSZ  *ppszValue);
  2252. #else
  2253.    APIRET APIENTRY  DosScanEnv(PSZ pszName,
  2254.                                PSZ *ppszValue);
  2255. #endif
  2256.  
  2257. #ifdef __cplusplus
  2258.    APIRET APIENTRY  DosSearchPath(ULONG flag,
  2259.                                   PCSZ  pszPathOrName,
  2260.                                   PCSZ  pszFilename,
  2261.                                   PBYTE pBuf,
  2262.                                   ULONG cbBuf);
  2263. #else
  2264.    APIRET APIENTRY  DosSearchPath(ULONG flag,
  2265.                                   PSZ pszPathOrName,
  2266.                                   PSZ pszFilename,
  2267.                                   PBYTE pBuf,
  2268.                                   ULONG cbBuf);
  2269. #endif
  2270.  
  2271. #ifdef __cplusplus
  2272.    APIRET APIENTRY  DosQueryMessageCP(PCHAR pb,
  2273.                                       ULONG cb,
  2274.                                       PCSZ  pszFilename,
  2275.                                       PULONG cbBuf);
  2276. #else
  2277.    APIRET APIENTRY  DosQueryMessageCP(PCHAR pb,
  2278.                                       ULONG cb,
  2279.                                       PSZ pszFilename,
  2280.                                       PULONG cbBuf);
  2281. #endif
  2282.  
  2283.    APIRET APIENTRY  DosQueryRASInfo(ULONG Index,
  2284.                                     PPVOID Addr);
  2285.  
  2286. #ifdef __cplusplus
  2287.    APIRET  APIENTRY DosSetExtLIBPATH( PCSZ  pszExtLIBPATH, ULONG flags);
  2288. #else
  2289.    APIRET  APIENTRY DosSetExtLIBPATH( PSZ pszExtLIBPATH, ULONG flags);
  2290. #endif
  2291.  
  2292. #ifdef __cplusplus
  2293.    APIRET  APIENTRY DosQueryExtLIBPATH( PCSZ  pszExtLIBPATH, ULONG flags);
  2294. #else
  2295.    APIRET  APIENTRY DosQueryExtLIBPATH( PSZ pszExtLIBPATH, ULONG flags);
  2296. #endif
  2297.  
  2298. #endif /* INCL_DOSMISC */
  2299.  
  2300.  
  2301. /*** Session manager support */
  2302.  
  2303. #ifdef INCL_DOSSESMGR
  2304.  
  2305.    typedef struct _STARTDATA     /* stdata */
  2306.    {
  2307.       USHORT  Length;
  2308.       USHORT  Related;
  2309.       USHORT  FgBg;
  2310.       USHORT  TraceOpt;
  2311.       PSZ     PgmTitle;
  2312.       PSZ     PgmName;
  2313.       PBYTE   PgmInputs;
  2314.       PBYTE   TermQ;
  2315.       PBYTE   Environment;
  2316.       USHORT  InheritOpt;
  2317.       USHORT  SessionType;
  2318.       PSZ     IconFile;
  2319.       ULONG   PgmHandle;
  2320.       USHORT  PgmControl;
  2321.       USHORT  InitXPos;
  2322.       USHORT  InitYPos;
  2323.       USHORT  InitXSize;
  2324.       USHORT  InitYSize;
  2325.       USHORT  Reserved;
  2326.       PSZ     ObjectBuffer;
  2327.       ULONG   ObjectBuffLen;
  2328.    } STARTDATA;
  2329.    typedef STARTDATA *PSTARTDATA;
  2330.  
  2331.    #define SSF_RELATED_INDEPENDENT 0
  2332.    #define SSF_RELATED_CHILD       1
  2333.  
  2334.    #define SSF_FGBG_FORE           0
  2335.    #define SSF_FGBG_BACK           1
  2336.  
  2337.    #define SSF_TRACEOPT_NONE       0
  2338.    #define SSF_TRACEOPT_TRACE      1
  2339.    #define SSF_TRACEOPT_TRACEALL   2
  2340.  
  2341.    #define SSF_INHERTOPT_SHELL     0
  2342.    #define SSF_INHERTOPT_PARENT    1
  2343.  
  2344.    /* note that these types are identical to those in pmshl.h for PROG_* */
  2345.    #define SSF_TYPE_DEFAULT        0
  2346.    #define SSF_TYPE_FULLSCREEN     1
  2347.    #define SSF_TYPE_WINDOWABLEVIO  2
  2348.    #define SSF_TYPE_PM             3
  2349.    #define SSF_TYPE_VDM            4
  2350.    #define SSF_TYPE_GROUP          5
  2351.    #define SSF_TYPE_DLL            6
  2352.    #define SSF_TYPE_WINDOWEDVDM    7
  2353.    #define SSF_TYPE_PDD            8
  2354.    #define SSF_TYPE_VDD            9
  2355.  
  2356.    /* note that these flags are identical to those in pmshl.h for SHE_* */
  2357.    #define SSF_CONTROL_VISIBLE     0x0000
  2358.    #define SSF_CONTROL_INVISIBLE   0x0001
  2359.    #define SSF_CONTROL_MAXIMIZE    0x0002
  2360.    #define SSF_CONTROL_MINIMIZE    0x0004
  2361.    #define SSF_CONTROL_NOAUTOCLOSE 0x0008
  2362.    #define SSF_CONTROL_SETPOS      0x8000
  2363.  
  2364.    typedef struct _STATUSDATA   /* stsdata */
  2365.    {
  2366.       USHORT Length;
  2367.       USHORT SelectInd;
  2368.       USHORT BondInd;
  2369.    } STATUSDATA;
  2370.    typedef STATUSDATA *PSTATUSDATA;
  2371.  
  2372.    /* SelectInd and BondInd paramater values for DosSetSession */
  2373.    #define SET_SESSION_UNCHANGED      0
  2374.    #define SET_SESSION_SELECTABLE     1
  2375.    #define SET_SESSION_NON_SELECTABLE 2
  2376.    #define SET_SESSION_BOND           1
  2377.    #define SET_SESSION_NO_BOND        2
  2378.  
  2379.    /* TargetOption (scope) parameter values for DosStopSession */
  2380.    #define STOP_SESSION_SPECIFIED     0
  2381.    #define STOP_SESSION_ALL           1
  2382.  
  2383.  
  2384. /* NOINC */
  2385.    #define DosQAppType     DosQueryAppType
  2386. /* INC */
  2387.  
  2388.    APIRET APIENTRY  DosStartSession(PSTARTDATA psd,
  2389.                                     PULONG pidSession,
  2390.                                     PPID ppid);
  2391.  
  2392.    APIRET APIENTRY  DosSetSession(ULONG idSession,
  2393.                                   PSTATUSDATA psd);
  2394.  
  2395.    APIRET APIENTRY  DosSelectSession(ULONG idSession);
  2396.  
  2397.    APIRET APIENTRY  DosStopSession(ULONG scope,
  2398.                                    ULONG idSession);
  2399.  
  2400. #ifdef __cplusplus
  2401.    APIRET APIENTRY DosQueryAppType(PCSZ  pszName,
  2402.                                    PULONG pFlags);
  2403. #else
  2404.    APIRET APIENTRY DosQueryAppType(PSZ pszName,
  2405.                                    PULONG pFlags);
  2406. #endif
  2407.  
  2408. #endif /* INCL_DOSSESMGR */
  2409.  
  2410.  
  2411.  
  2412. #if (defined(INCL_DOSSESMGR) || defined(INCL_DOSFILEMGR))
  2413.  
  2414.    /* AppType returned in by DosQueryAppType in pFlags as follows          */
  2415.    #define FAPPTYP_NOTSPEC         0x0000
  2416.    #define FAPPTYP_NOTWINDOWCOMPAT 0x0001
  2417.    #define FAPPTYP_WINDOWCOMPAT    0x0002
  2418.    #define FAPPTYP_WINDOWAPI       0x0003
  2419.    #define FAPPTYP_BOUND           0x0008
  2420.    #define FAPPTYP_DLL             0x0010
  2421.    #define FAPPTYP_DOS             0x0020
  2422.    #define FAPPTYP_PHYSDRV         0x0040  /* physical device driver       */
  2423.    #define FAPPTYP_VIRTDRV         0x0080  /* virtual device driver        */
  2424.    #define FAPPTYP_PROTDLL         0x0100  /* 'protected memory' dll       */
  2425.    #define FAPPTYP_WINDOWSREAL     0x0200  /* Windows real mode app        */
  2426.    #define FAPPTYP_WINDOWSPROT     0x0400  /* Windows protect mode app     */
  2427.    #define FAPPTYP_WINDOWSPROT31   0x1000  /* Windows 3.1 protect mode app */
  2428.    #define FAPPTYP_32BIT           0x4000
  2429.    #define FAPPTYP_EXETYPE         FAPPTYP_WINDOWAPI
  2430.  
  2431.    #define FAPPTYP_RESERVED        ~(FAPPTYP_WINDOWAPI | FAPPTYP_BOUND | FAPPTYP_DLL | FAPPTYP_DOS | FAPPTYP_PHYSDRV | FAPPTYP_VIRTDRV | FAPPTYP_PROTDLL | FAPPTYP_32BIT)
  2432.  
  2433.    #ifdef INCL_DOSFILEMGR
  2434.  
  2435.       #define EAT_APPTYP_PMAPI        0x00            /* Uses PM API */
  2436.       #define EAT_APPTYP_DOS          0x01            /* DOS APP */
  2437.       #define EAT_APPTYP_PMW          0x02            /* Window compatible */
  2438.       #define EAT_APPTYP_NOPMW        0x03            /* Not Window compatible */
  2439.       #define EAT_APPTYP_EXETYPE      0x03            /* EXE type mask */
  2440.       #define EAT_APPTYP_RESERVED     ~(EAT_APPTYP_EXETYPE)
  2441.  
  2442.    #endif /* INCL_DOSFILEMGR */
  2443.  
  2444. #endif /* INCL_DOSSESMGR || INCL_DOSFILEMGR */
  2445.  
  2446.  
  2447.  
  2448.  
  2449. /*** Device support */
  2450.  
  2451. #ifdef INCL_DOSDEVICES
  2452.  
  2453.    #define DosDevIOCtl2    DosDevIOCtl
  2454.  
  2455.    APIRET APIENTRY  DosDevConfig(PVOID pdevinfo,
  2456.                                  ULONG item);
  2457.  
  2458.    #define DEVINFO_PRINTER         0       /* Number of printers attached */
  2459.    #define DEVINFO_RS232           1       /* Number of RS232 ports */
  2460.    #define DEVINFO_FLOPPY          2       /* Number of diskette drives */
  2461.    #define DEVINFO_COPROCESSOR     3       /* Presence of math coprocessor */
  2462.    #define DEVINFO_SUBMODEL        4       /* PC Submodel Type */
  2463.    #define DEVINFO_MODEL           5       /* PC Model Type */
  2464.    #define DEVINFO_ADAPTER         6       /* Primary display adapter type */
  2465.  
  2466.    APIRET APIENTRY  DosDevIOCtl(HFILE hDevice,
  2467.                                 ULONG category,
  2468.                                 ULONG function,
  2469.                                 PVOID pParams,
  2470.                                 ULONG cbParmLenMax,
  2471.                                 PULONG pcbParmLen,
  2472.                                 PVOID pData,
  2473.                                 ULONG cbDataLenMax,
  2474.                                 PULONG pcbDataLen);
  2475.  
  2476.  
  2477.    APIRET APIENTRY  DosPhysicalDisk(ULONG function,
  2478.                                     PVOID pBuf,
  2479.                                     ULONG cbBuf,
  2480.                                     PVOID pParams,
  2481.                                     ULONG cbParams);
  2482.  
  2483.    #define INFO_COUNT_PARTITIONABLE_DISKS  1       /* # of partitionable disks */
  2484.    #define INFO_GETIOCTLHANDLE             2       /* Obtain handle            */
  2485.    #define INFO_FREEIOCTLHANDLE            3       /* Release handle           */
  2486.  
  2487. #endif /* INCL_DOSDEVICES */
  2488.  
  2489.  
  2490. /*** DosNamedPipes API Support */
  2491.  
  2492. #ifdef INCL_DOSNMPIPES
  2493.  
  2494.    /*** Data structures used with named pipes ***/
  2495.  
  2496.    typedef LHANDLE HPIPE;     /* hp */
  2497.    typedef HPIPE   *PHPIPE;
  2498.  
  2499.    typedef struct _AVAILDATA              /* AVAILDATA */
  2500.    {
  2501.       USHORT      cbpipe;            /* bytes left in the pipe */
  2502.       USHORT      cbmessage;         /* bytes left in the current message */
  2503.    } AVAILDATA;
  2504.    typedef AVAILDATA *PAVAILDATA;
  2505.  
  2506.    typedef struct _PIPEINFO               /* nmpinf */
  2507.    {
  2508.       USHORT cbOut;                  /* length of outgoing I/O buffer */
  2509.       USHORT cbIn;                   /* length of incoming I/O buffer */
  2510.       BYTE   cbMaxInst;              /* maximum number of instances   */
  2511.       BYTE   cbCurInst;              /* current number of instances   */
  2512.       BYTE   cbName;                 /* length of pipe name           */
  2513.       CHAR   szName[1];              /* start of name                 */
  2514.    } PIPEINFO;
  2515.    typedef PIPEINFO  *PPIPEINFO;
  2516.  
  2517.    typedef struct _PIPESEMSTATE    /* nmpsmst */
  2518.    {
  2519.       BYTE   fStatus;         /* type of record, 0 = EOI, 1 = read ok, */
  2520.                               /* 2 = write ok, 3 = pipe closed         */
  2521.       BYTE   fFlag;           /* additional info, 01 = waiting thread  */
  2522.       USHORT usKey;           /* user's key value                      */
  2523.       USHORT usAvail;         /* available data/space if status = 1/2  */
  2524.    } PIPESEMSTATE;
  2525.    typedef PIPESEMSTATE *PPIPESEMSTATE;
  2526.  
  2527.    #define NP_INDEFINITE_WAIT      -1
  2528.    #define NP_DEFAULT_WAIT         0L
  2529.  
  2530.    /* DosPeekNmPipe() pipe states */
  2531.  
  2532.    #define NP_STATE_DISCONNECTED   0x0001
  2533.    #define NP_STATE_LISTENING      0x0002
  2534.    #define NP_STATE_CONNECTED      0x0003
  2535.    #define NP_STATE_CLOSING        0x0004
  2536.  
  2537.    /* DosCreateNPipe open modes */
  2538.  
  2539.    #define NP_ACCESS_INBOUND       0x0000
  2540.    #define NP_ACCESS_OUTBOUND      0x0001
  2541.    #define NP_ACCESS_DUPLEX        0x0002
  2542.    #define NP_INHERIT              0x0000
  2543.    #define NP_NOINHERIT            0x0080
  2544.    #define NP_WRITEBEHIND          0x0000
  2545.    #define NP_NOWRITEBEHIND        0x4000
  2546.  
  2547.    /* DosCreateNPipe and DosQueryNPHState state */
  2548.  
  2549.    #define NP_READMODE_BYTE        0x0000
  2550.    #define NP_READMODE_MESSAGE     0x0100
  2551.    #define NP_TYPE_BYTE            0x0000
  2552.    #define NP_TYPE_MESSAGE         0x0400
  2553.    #define NP_END_CLIENT           0x0000
  2554.    #define NP_END_SERVER           0x4000
  2555.    #define NP_WAIT                 0x0000
  2556.    #define NP_NOWAIT               0x8000
  2557.    #define NP_UNLIMITED_INSTANCES  0x00FF
  2558.  
  2559.  
  2560. #ifdef __cplusplus
  2561.    APIRET APIENTRY  DosCallNPipe(PCSZ  pszName,
  2562.                                  PVOID pInbuf,
  2563.                                  ULONG cbIn,
  2564.                                  PVOID pOutbuf,
  2565.                                  ULONG cbOut,
  2566.                                  PULONG pcbActual,
  2567.                                  ULONG msec);
  2568. #else
  2569.    APIRET APIENTRY  DosCallNPipe(PSZ pszName,
  2570.                                  PVOID pInbuf,
  2571.                                  ULONG cbIn,
  2572.                                  PVOID pOutbuf,
  2573.                                  ULONG cbOut,
  2574.                                  PULONG pcbActual,
  2575.                                  ULONG msec);
  2576. #endif
  2577.  
  2578.    APIRET APIENTRY  DosConnectNPipe(HPIPE hpipe);
  2579.  
  2580.    APIRET APIENTRY  DosDisConnectNPipe(HPIPE hpipe);
  2581.  
  2582. #ifdef __cplusplus
  2583.    APIRET APIENTRY  DosCreateNPipe(PCSZ  pszName,
  2584.                                    PHPIPE pHpipe,
  2585.                                    ULONG openmode,
  2586.                                    ULONG pipemode,
  2587.                                    ULONG cbInbuf,
  2588.                                    ULONG cbOutbuf,
  2589.                                    ULONG msec);
  2590. #else
  2591.    APIRET APIENTRY  DosCreateNPipe(PSZ pszName,
  2592.                                    PHPIPE pHpipe,
  2593.                                    ULONG openmode,
  2594.                                    ULONG pipemode,
  2595.                                    ULONG cbInbuf,
  2596.                                    ULONG cbOutbuf,
  2597.                                    ULONG msec);
  2598. #endif
  2599.  
  2600.    APIRET APIENTRY  DosPeekNPipe(HPIPE hpipe,
  2601.                                  PVOID pBuf,
  2602.                                  ULONG cbBuf,
  2603.                                  PULONG pcbActual,
  2604.                                  PAVAILDATA pAvail,
  2605.                                  PULONG pState);
  2606.  
  2607.    APIRET APIENTRY  DosQueryNPHState(HPIPE hpipe,
  2608.                                      PULONG pState);
  2609.  
  2610.    APIRET APIENTRY  DosQueryNPipeInfo(HPIPE hpipe,
  2611.                                       ULONG infolevel,
  2612.                                       PVOID pBuf,
  2613.                                       ULONG cbBuf);
  2614.  
  2615.    APIRET APIENTRY  DosQueryNPipeSemState(HSEM hsem,
  2616.                                           PPIPESEMSTATE pnpss,
  2617.                                           ULONG cbBuf);
  2618.  
  2619. #ifdef __cplusplus
  2620.    APIRET APIENTRY  DosRawReadNPipe(PCSZ  pszName,
  2621.                                     ULONG cb,
  2622.                                     PULONG pLen,
  2623.                                     PVOID pBuf);
  2624. #else
  2625.    APIRET APIENTRY  DosRawReadNPipe(PSZ pszName,
  2626.                                     ULONG cb,
  2627.                                     PULONG pLen,
  2628.                                     PVOID pBuf);
  2629. #endif
  2630.  
  2631. #ifdef __cplusplus
  2632.    APIRET APIENTRY  DosRawWriteNPipe(PCSZ  pszName,
  2633.                                      ULONG cb);
  2634. #else
  2635.    APIRET APIENTRY  DosRawWriteNPipe(PSZ pszName,
  2636.                                      ULONG cb);
  2637. #endif
  2638.  
  2639.    APIRET APIENTRY  DosSetNPHState(HPIPE hpipe,
  2640.                                    ULONG state);
  2641.  
  2642.    APIRET APIENTRY  DosSetNPipeSem(HPIPE hpipe,
  2643.                                    HSEM hsem,
  2644.                                    ULONG key);
  2645.  
  2646.    APIRET APIENTRY  DosTransactNPipe(HPIPE hpipe,
  2647.                                      PVOID pOutbuf,
  2648.                                      ULONG cbOut,
  2649.                                      PVOID pInbuf,
  2650.                                      ULONG cbIn,
  2651.                                      PULONG pcbRead);
  2652.  
  2653. #ifdef __cplusplus
  2654.    APIRET APIENTRY  DosWaitNPipe(PCSZ  pszName,
  2655.                                  ULONG msec);
  2656. #else
  2657.    APIRET APIENTRY  DosWaitNPipe(PSZ pszName,
  2658.                                  ULONG msec);
  2659. #endif
  2660.  
  2661.    /* values in fStatus */
  2662.    #define NPSS_EOI                   0     /* End Of Information    */
  2663.    #define NPSS_RDATA                 1     /* read data available   */
  2664.    #define NPSS_WSPACE                2     /* write space available */
  2665.    #define NPSS_CLOSE                 3     /* pipe in CLOSING state */
  2666.  
  2667.    /* values in npss_flag */
  2668.    #define NPSS_WAIT                  0x01  /* waiting thread on end of pipe */
  2669.  
  2670.    /* defined bits in pipe mode */
  2671.    #define NP_NBLK                    0x8000 /* non-blocking read/write */
  2672.    #define NP_SERVER                  0x4000 /* set if server end       */
  2673.    #define NP_WMESG                   0x0400 /* write messages          */
  2674.    #define NP_RMESG                   0x0100 /* read as messages        */
  2675.    #define NP_ICOUNT                  0x00FF /* instance count field    */
  2676.  
  2677.  
  2678.    /*Named pipes may be in one of several states depending on the actions
  2679.    * that have been taken on it by the server end and client end.  The
  2680.    * following state/action table summarizes the valid state transitions:
  2681.    *
  2682.    * Current state           Action                  Next state
  2683.    *
  2684.    *  <none>             server DosMakeNmPipe        DISCONNECTED
  2685.    *  DISCONNECTED       server connect              LISTENING
  2686.    *  LISTENING          client open                 CONNECTED
  2687.    *  CONNECTED          server disconn              DISCONNECTED
  2688.    *  CONNECTED          client close                CLOSING
  2689.    *  CLOSING            server disconn              DISCONNECTED
  2690.    *  CONNECTED          server close                CLOSING
  2691.    *  <any other>        server close                <pipe deallocated>
  2692.    *
  2693.    * If a server disconnects his end of the pipe, the client end will enter a
  2694.    * special state in which any future operations (except close) on the file
  2695.    * descriptor associated with the pipe will return an error.
  2696.    */
  2697.  
  2698.    /*
  2699.    *      Values for named pipe state
  2700.    */
  2701.  
  2702.    #define NP_DISCONNECTED       1         /* after pipe creation or Disconnect */
  2703.    #define NP_LISTENING          2         /* after DosNmPipeConnect            */
  2704.    #define NP_CONNECTED          3         /* after Client open                 */
  2705.    #define NP_CLOSING            4         /* after Client or Server close      */
  2706.  
  2707.  
  2708. #endif /* INCL_DOSNMPIPES */
  2709.  
  2710.  
  2711.  
  2712. /*** DosProfile API support */
  2713.  
  2714. #ifdef INCL_DOSPROFILE
  2715.  
  2716.    /*** Perfview API support */
  2717.  
  2718.    APIRET APIENTRY DosTmrQueryFreq(PULONG pulTmrFreq);
  2719.  
  2720.    APIRET APIENTRY DosTmrQueryTime(PQWORD pqwTmrTime);
  2721.  
  2722.    APIRET APIENTRY DosRegisterPerfCtrs(PBYTE pbDataBlk,
  2723.                                        PBYTE pbTextBlk,
  2724.                                        ULONG flFlags);
  2725.  
  2726.    /* DosProfile ordinal number */
  2727.  
  2728.    #define PROF_ORDINAL        133
  2729.  
  2730.    /* DosProfile usType */
  2731.  
  2732.    #define PROF_SYSTEM           0
  2733.    #define PROF_USER             1
  2734.    #define PROF_USEDD            2
  2735.    #define PROF_KERNEL           4
  2736.    #define PROF_VERBOSE          8
  2737.    #define PROF_ENABLE          16
  2738.  
  2739.    /* DosProfile usFunc */
  2740.  
  2741.    #define PROF_ALLOC            0
  2742.    #define PROF_CLEAR            1
  2743.    #define PROF_ON               2
  2744.    #define PROF_OFF              3
  2745.    #define PROF_DUMP             4
  2746.    #define PROF_FREE             5
  2747.  
  2748.    /* DosProfile tic count granularity (DWORD) */
  2749.  
  2750.    #define PROF_SHIFT            2
  2751.  
  2752.    /* DosProfile module name string length */
  2753.  
  2754.    #define PROF_MOD_NAME_SIZE   10
  2755.  
  2756.    /* DosProfile error code for end of data */
  2757.  
  2758.    #define PROF_END_OF_DATA     13
  2759.  
  2760. #endif /* INCL_DOSPROFILE */
  2761.  
  2762.  
  2763.  
  2764. /* Virtual DOS Machine API support */
  2765. #ifdef INCL_DOSMVDM
  2766.  
  2767.    typedef LHANDLE   HVDD;     /* hvdd */
  2768.    typedef HVDD     *PHVDD;    /* phvdd */
  2769.  
  2770. #ifdef __cplusplus
  2771.    APIRET APIENTRY  DosOpenVDD(PCSZ  pszVDD,
  2772.                                PHVDD phvdd);
  2773. #else
  2774.    APIRET APIENTRY  DosOpenVDD(PSZ pszVDD,
  2775.                                PHVDD phvdd);
  2776. #endif
  2777.  
  2778.    APIRET APIENTRY  DosRequestVDD(HVDD hvdd,
  2779.                                   SGID sgid,
  2780.                                   ULONG cmd,
  2781.                                   ULONG cbInput,
  2782.                                   PVOID pInput,
  2783.                                   ULONG cbOutput,
  2784.                                   PVOID pOutput);
  2785.  
  2786.    APIRET APIENTRY  DosCloseVDD(HVDD hvdd);
  2787.  
  2788. #ifdef __cplusplus
  2789.    APIRET APIENTRY  DosQueryDOSProperty(SGID sgid,
  2790.                                         PCSZ  pszName,
  2791.                                         ULONG cb,
  2792.                                         PCSZ  pch);
  2793. #else
  2794.    APIRET APIENTRY  DosQueryDOSProperty(SGID sgid,
  2795.                                         PSZ pszName,
  2796.                                         ULONG cb,
  2797.                                         PSZ pch);
  2798. #endif
  2799.  
  2800. #ifdef __cplusplus
  2801.    APIRET APIENTRY  DosSetDOSProperty(SGID sgid,
  2802.                                       PCSZ  pszName,
  2803.                                       ULONG cb,
  2804.                                       PCSZ  pch);
  2805. #else
  2806.    APIRET APIENTRY  DosSetDOSProperty(SGID sgid,
  2807.                                       PSZ pszName,
  2808.                                       ULONG cb,
  2809.                                       PSZ pch);
  2810. #endif
  2811. #endif /* INCL_DOSMVDM */
  2812.  
  2813.  
  2814. #ifdef INCL_BDCALLS
  2815.  
  2816.    #include "bdcalls.h"
  2817.  
  2818. #endif /*INCL_BDCALLS */
  2819.  
  2820. #endif /* __BSEDOS__ */
  2821.  
  2822. /* NOINC */
  2823. #ifdef __cplusplus
  2824.         }
  2825. #endif
  2826. #if __IBMC__ || __IBMCPP__
  2827.    #pragma info( none )
  2828.    #ifndef __CHKHDR__
  2829.       #pragma info( restore )
  2830.    #endif
  2831.    #pragma info( restore )
  2832. #endif
  2833. /* INC */
  2834.  
  2835. /**************************** end of file **********************************/
  2836.