home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / borhead.zip / BSEDOS.H < prev    next >
C/C++ Source or Header  |  1994-11-09  |  76KB  |  2,143 lines

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