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

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