home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vdmutils.zip / VDMUTILS.H < prev    next >
Text File  |  1997-10-22  |  26KB  |  622 lines

  1. /* Library of functions that can be called only from within an
  2.    an OS/2 Virtual DOS Machine (VDM). These generate in-line
  3.    assembler under Watcom C/C++. For any other C/C++ compiler
  4.    the external library VDMUTILS.LIB is used for external
  5.    subroutines at link time.
  6.  
  7.    Copyright (C) 1996, 1997, David W. Noon */
  8.  
  9. #ifndef VDM_UTILS_INCLUDED
  10. #define VDM_UTILS_INCLUDED
  11.  
  12. #ifndef __DOS__
  13. #error "The VDMUTILS library is only applicable to DOS programs."
  14. #endif
  15.  
  16. #if defined(__WATCOMC__) && defined(_PUSHPOP_SUPPORED)
  17.    #pragma pack(push,1)
  18. #else
  19.    #pragma pack(1)
  20. #endif
  21.  
  22. #ifdef __WATCOMC__
  23.    #ifdef __386__
  24.       #define FAR __far16
  25.    #else
  26.       #define FAR far
  27.    #endif
  28.    #define VDM_LINKAGE
  29. #else
  30.    #define FAR far
  31.    #define VDM_LINKAGE far _pascal
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #ifndef USHORT
  39. typedef unsigned short USHORT;
  40. typedef USHORT FAR *PUSHORT;
  41. #endif
  42.  
  43. #ifndef ULONG
  44. typedef unsigned long ULONG;
  45. typedef ULONG FAR *PULONG;
  46. #endif
  47.  
  48. #ifndef BYTE
  49. typedef unsigned char BYTE;
  50. typedef BYTE FAR *PBYTE;
  51. #endif
  52.  
  53. #ifndef CHAR
  54. typedef unsigned char CHAR;
  55. typedef CHAR FAR *PCHAR;
  56. #endif
  57.  
  58. #ifndef PCSZ
  59. typedef const unsigned char FAR *PCSZ;
  60. #endif
  61.  
  62. #ifndef PSZ
  63. typedef unsigned char FAR *PSZ;
  64. #endif
  65.  
  66. #ifndef PVOID
  67. typedef void FAR *PVOID;
  68. #endif
  69.  
  70. #ifndef HFILE
  71. typedef unsigned short HFILE;
  72. #endif
  73.  
  74. typedef unsigned short SHANDLE;
  75. #define NULLSHANDLE 0U
  76. typedef unsigned long LHANDLE;
  77. #define NULLHANDLE 0UL
  78.  
  79. /* The following typedefs have been liberally plagiarised from the
  80.    OS/2 Developer's Toolkit 1.3 documentation. */
  81.  
  82. typedef struct _FDATE {    /* fdate */
  83.    unsigned day   : 5;     /* binary day for directory entry */
  84.    unsigned month : 4;     /* binary month for directory entry */
  85.    unsigned year  : 7;     /* binary year for directory entry, offset from 1980 */
  86.  } FDATE;
  87.  
  88. typedef FDATE FAR *PFDATE;
  89.  
  90. typedef struct _FTIME {        /* ftime */
  91.    unsigned twosecs : 5;       /* binary number of two-second increments */
  92.    unsigned minutes : 6;       /* binary number of minutes */
  93.    unsigned hours   : 5;       /* binary number of hours */
  94.  } FTIME;
  95.  
  96. typedef FTIME FAR *PFTIME;
  97.  
  98. typedef struct _FILESTATUS {    /* fsts */
  99.    FDATE  fdateCreation;        /* date of file creation */
  100.    FTIME  ftimeCreation;        /* time of file creation */
  101.    FDATE  fdateLastAccess;      /* date of last access */
  102.    FTIME  ftimeLastAccess;      /* time of last access */
  103.    FDATE  fdateLastWrite;       /* date of last write */
  104.    FTIME  ftimeLastWrite;       /* time of last write */
  105.    ULONG  cbFile;               /* file size (end of data) */
  106.    ULONG  cbFileAlloc;          /* file allocated size */
  107.    USHORT attrFile;             /* attributes of the file */
  108.    ULONG  cbList;               /* length of EA structure */
  109.  } FILESTATUS;
  110.  
  111. typedef FILESTATUS FAR *PFILESTATUS;
  112.  
  113. typedef struct _GEA {       /* gea */
  114.    BYTE cbName;             /* name length not including NULL */
  115.    CHAR szName[1];          /* attribute name */
  116.  } GEA;
  117.  
  118. typedef GEA FAR *PGEA;
  119.  
  120. typedef struct _GEALIST {   /* geal */
  121.    ULONG  cbList;           /* total bytes of structure including full list */
  122.    GEA list[1];             /* variable length GEA structures */
  123.  } GEALIST;
  124.  
  125. typedef GEALIST FAR *PGEALIST;
  126.  
  127. typedef struct _FEA {       /* fea */
  128.    BYTE fEA;                /* flags */
  129.    BYTE cbName;             /* name length not including NULL */
  130.    USHORT cbValue;          /* value length */
  131.    CHAR szName[1];          /* attribute name */
  132. /* CHAR aValue[1];          ** attribute value -- offset varies with cbName */
  133.  } FEA;
  134.  
  135. typedef FEA FAR *PFEA;
  136.  
  137. /* Critical EA flag */
  138. #define FEA_NEEDEA                  0x80
  139.  
  140. /* EA types */
  141. #define EAT_BINARY                  0xFFFE
  142. #define EAT_ASCII                   0xFFFD
  143. #define EAT_BITMAP                  0xFFFB
  144. #define EAT_METAFILE                0xFFFA
  145. #define EAT_ICON                    0xFFF9
  146. #define EAT_EA                      0xFFEE
  147. #define EAT_MVMT                    0xFFDF
  148. #define EAT_MVST                    0xFFDE
  149. #define EAT_ASN1                    0xFFDD
  150.  
  151. typedef struct _FEALIST {   /* feal */
  152.    ULONG  cbList;           /* total bytes of structure including full list */
  153.    FEA list[1];             /* variable length FEA structures */
  154.  } FEALIST;
  155.  
  156. typedef FEALIST FAR *PFEALIST;
  157.  
  158. typedef struct _EAOP {      /* eaop */
  159.    PGEALIST fpGEAList;      /* general EA list */
  160.    PFEALIST fpFEAList;      /* full EA list */
  161.    ULONG  oError;
  162.  } EAOP;
  163.  
  164. typedef EAOP FAR *PEAOP;
  165.  
  166. /* Levels of information queried or set by file system. */
  167. #define FIL_STANDARD                1U
  168. #define FIL_QUERYEASIZE             2U
  169. #define FIL_QUERYEASFROMLIST        3U
  170. #define FIL_QUERYALLEAS             4U
  171. #define FIL_QUERYFULLNAME           5U
  172.  
  173. int VDM_LINKAGE DwnExitVDM(void);
  174. #ifdef __WATCOMC__
  175. #pragma aux DwnExitVDM = "STI"          \
  176.                          "XOR AX,AX"    \
  177.                          "HLT"          \
  178.                          "DB  02H,0FDH" \
  179.                          value [ax];
  180. #endif
  181.  
  182. void VDM_LINKAGE DwnReleaseTimeSlice(void);
  183. #ifdef __WATCOMC__
  184. /* Generic DOS delay allegedly works under all versions of Warp */
  185. #pragma aux DwnReleaseTimeSlice = "INT   28H";
  186.  
  187. /* The DPMI timeslice release is broken under Warp 4, but works under Warp 3.
  188. #pragma aux DwnReleaseTimeSlice = "MOV   AX,1680H" \
  189.                          "INT   2FH"               \
  190.                          modify [ax];
  191. */
  192.  
  193. /* BIOS delay allegedly works under all versions of Warp.
  194. #pragma aux DwnReleaseTimeSlice = "MOV   DX,977"   \
  195.                          "XOR   CX,CX"             \
  196.                          "MOV   AH,86H"            \
  197.                          "INT   15H"               \
  198.                          modify [ah cx dx];
  199. */
  200. #endif
  201.  
  202. void VDM_LINKAGE DwnSetSessionTitle(PCSZ Session_title);
  203. #ifdef __WATCOMC__
  204. #pragma aux DwnSetSessionTitle = "MOV   AX,6400H" \
  205.                          "XOR   BX,BX"            \
  206.                          "MOV   CX,636CH"         \
  207.                          "MOV   DX,1"             \
  208.                          "INT   21H"              \
  209.                          parm [es di]             \
  210.                          modify [ax bx cx dx];
  211. #endif
  212.  
  213. void VDM_LINKAGE DwnQuerySessionTitle(PSZ Session_title);
  214. #ifdef __WATCOMC__
  215. #pragma aux DwnQuerySessionTitle = "MOV   AX,6400H" \
  216.                          "XOR   BX,BX"              \
  217.                          "MOV   CX,636CH"           \
  218.                          "MOV   DX,2"               \
  219.                          "INT   21H"                \
  220.                          parm [es di]               \
  221.                          modify [ax bx cx dx];
  222. #endif
  223.  
  224. USHORT VDM_LINKAGE DwnQFileInfo(HFILE FileHandle, USHORT FileInfoLevel, PVOID FileInfoBuf, USHORT FileInfoBufSize);
  225. #ifdef __WATCOMC__
  226. #pragma aux DwnQFileInfo = "MOV   AX,5702H"          \
  227.                          "INT   21H"                 \
  228.                          "JC    SHORT 2"             \
  229.                          "XOR   AX,AX"               \
  230.                          parm [bx] [dx] [es di] [cx] \
  231.                          value [ax]                  \
  232.                          modify [ax];
  233. #endif
  234.  
  235. USHORT VDM_LINKAGE DwnQPathInfo(PCSZ PathName, USHORT PathInfoLevel, PVOID PathInfoBuf, USHORT PathInfoBufSize);
  236. #ifdef __WATCOMC__
  237. #ifdef __SW_ZDF
  238. #pragma aux DwnQPathInfo = "MOV   AX,5702H"             \
  239.                          "MOV   BX,0FFFFH"              \
  240.                          "INT   21H"                    \
  241.                          "JC    SHORT 2"                \
  242.                          "XOR   AX,AX"                  \
  243.                          parm [ds si] [dx] [es di] [cx] \
  244.                          value [ax]                     \
  245.                          modify [ax bx];
  246. #else
  247. #pragma aux DwnQPathInfo = "PUSH  DS"                   \
  248.                          "MOV   BX,0FFFFH"              \
  249.                          "MOV   DS,CX"                  \
  250.                          "MOV   CX,AX"                  \
  251.                          "MOV   AX,5702H"               \
  252.                          "INT   21H"                    \
  253.                          "JC    SHORT 2"                \
  254.                          "XOR   AX,AX"                  \
  255.                          "POP   DS"                     \
  256.                          parm [cx si] [dx] [es di] [ax] \
  257.                          value [ax]                     \
  258.                          modify [ax bx cx];
  259. #endif
  260. #endif
  261.  
  262. USHORT VDM_LINKAGE DwnSetFileInfo(HFILE FileHandle, USHORT FileInfoLevel, PVOID FileInfoBuf, USHORT FileInfoBufSize);
  263. #ifdef __WATCOMC__
  264. #pragma aux DwnSetFileInfo = "MOV   AX,5703H"        \
  265.                          "INT   21H"                 \
  266.                          "JC    SHORT 2"             \
  267.                          "XOR   AX,AX"               \
  268.                          parm [bx] [dx] [es di] [cx] \
  269.                          value [ax]                  \
  270.                          modify [ax];
  271. #endif
  272.  
  273. USHORT VDM_LINKAGE DwnSetPathInfo(PCSZ PathName, USHORT PathInfoLevel, PVOID PathInfoBuf, USHORT PathInfoBufSize);
  274. #ifdef __WATCOMC__
  275. #ifdef __SW_ZDF
  276. #pragma aux DwnSetPathInfo = "MOV   AX,5703H"           \
  277.                          "MOV   BX,0FFFFH"              \
  278.                          "INT   21H"                    \
  279.                          "JC    SHORT 2"                \
  280.                          "XOR   AX,AX"                  \
  281.                          parm [ds si] [dx] [es di] [cx] \
  282.                          value [ax]                     \
  283.                          modify [ax bx];
  284. #else
  285. #pragma aux DwnSetPathInfo = "PUSH  DS"                 \
  286.                          "MOV   BX,0FFFFH"              \
  287.                          "MOV   DS,CX"                  \
  288.                          "MOV   CX,AX"                  \
  289.                          "MOV   AX,5703H"               \
  290.                          "INT   21H"                    \
  291.                          "JC    SHORT 2"                \
  292.                          "XOR   AX,AX"                  \
  293.                          "POP   DS"                     \
  294.                          parm [cx si] [dx] [es di] [ax] \
  295.                          value [ax]                     \
  296.                          modify [ax bx cx];
  297. #endif
  298. #endif
  299.  
  300. #ifdef INCL_DOSSEMAPHORES
  301.  
  302. typedef LHANDLE HEV;
  303. typedef HEV FAR *PHEV;
  304.  
  305. typedef LHANDLE HMTX;
  306. typedef HMTX FAR *PHMTX;
  307.  
  308. typedef LHANDLE HMUX;
  309. typedef HMUX FAR *PHMUX;
  310.  
  311. typedef LHANDLE PID;
  312. typedef PID FAR *PPID;
  313.  
  314. typedef LHANDLE TID;
  315. typedef TID FAR *PTID;
  316.  
  317. #define DC_SEM_SHARED               1U
  318. #define DCMW_WAIT_ANY               0x02
  319. #define DCMW_WAIT_ALL               0x04
  320. #define SEM_INDEFINITE_WAIT         -1L
  321. #define SEM_IMMEDIATE_RETURN        0L
  322.  
  323. USHORT VDM_LINKAGE DwnCreateEventSem(PCSZ SemName, PHEV SemHandle, USHORT Attr, USHORT State);
  324. #ifdef __WATCOMC__
  325. #ifdef __SW_ZDF
  326. #pragma aux DwnCreateEventSem = "MOV   AH,64H"          \
  327.                          "MOV   BX,0144H"               \
  328.                          "MOV   CX,636CH"               \
  329.                          "INT   21H"                    \
  330.                          "JC    SHORT 2"                \
  331.                          "XOR   AX,AX"                  \
  332.                          parm [es di] [ds si] [dx] [al] \
  333.                          value [ax]                     \
  334.                          modify [ax bx cx];
  335. #else
  336. #pragma aux DwnCreateEventSem = "PUSH  DS"              \
  337.                          "MOV   AH,64H"                 \
  338.                          "MOV   DS,CX"                  \
  339.                          "MOV   BX,0144H"               \
  340.                          "MOV   CX,636CH"               \
  341.                          "INT   21H"                    \
  342.                          "JC    SHORT 2"                \
  343.                          "XOR   AX,AX"                  \
  344.                          "POP   DS"                     \
  345.                          parm [es di] [cx si] [dx] [al] \
  346.                          value [ax]                     \
  347.                          modify [ax bx cx];
  348. #endif
  349. #endif
  350.  
  351. USHORT VDM_LINKAGE DwnOpenEventSem(PCSZ SemName, PHEV SemHandle);
  352. #ifdef __WATCOMC__
  353. #ifdef __SW_ZDF
  354. #pragma aux DwnOpenEventSem = "MOV   AH,64H"            \
  355.                          "MOV   BX,0145H"               \
  356.                          "MOV   CX,636CH"               \
  357.                          "INT   21H"                    \
  358.                          "JC    SHORT 2"                \
  359.                          "XOR   AX,AX"                  \
  360.                          parm [es di] [ds si]           \
  361.                          value [ax]                     \
  362.                          modify [ax bx cx];
  363. #else
  364. #pragma aux DwnOpenEventSem = "PUSH  DS"                \
  365.                          "MOV   AH,64H"                 \
  366.                          "MOV   DS,CX"                  \
  367.                          "MOV   BX,0145H"               \
  368.                          "MOV   CX,636CH"               \
  369.                          "INT   21H"                    \
  370.                          "JC    SHORT 2"                \
  371.                          "XOR   AX,AX"                  \
  372.                          "POP   DS"                     \
  373.                          parm [es di] [cx si]           \
  374.                          value [ax]                     \
  375.                          modify [ax bx cx];
  376. #endif
  377. #endif
  378.  
  379. USHORT VDM_LINKAGE DwnCloseEventSem(HEV SemHandle);
  380. #ifdef __WATCOMC__
  381. #pragma aux DwnCloseEventSem = "MOV   AH,64H"           \
  382.                          "MOV   BX,0146H"               \
  383.                          "MOV   CX,636CH"               \
  384.                          "INT   21H"                    \
  385.                          "JC    SHORT 2"                \
  386.                          "XOR   AX,AX"                  \
  387.                          parm [dx si]                   \
  388.                          value [ax]                     \
  389.                          modify [ax bx cx];
  390. #endif
  391.  
  392. USHORT VDM_LINKAGE DwnResetEventSem(HEV SemHandle, PULONG PostCount);
  393. #ifdef __WATCOMC__
  394. #pragma aux DwnResetEventSem = "MOV   AH,64H"           \
  395.                          "MOV   BX,0147H"               \
  396.                          "MOV   CX,636CH"               \
  397.                          "INT   21H"                    \
  398.                          "JC    SHORT 2"                \
  399.                          "XOR   AX,AX"                  \
  400.                          parm [dx si] [es di]           \
  401.                          value [ax]                     \
  402.                          modify [ax bx cx];
  403. #endif
  404.  
  405. USHORT VDM_LINKAGE DwnPostEventSem(HEV SemHandle);
  406. #ifdef __WATCOMC__
  407. #pragma aux DwnPostEventSem = "MOV   AH,64H"            \
  408.                          "MOV   BX,0148H"               \
  409.                          "MOV   CX,636CH"               \
  410.                          "INT   21H"                    \
  411.                          "JC    SHORT 2"                \
  412.                          "XOR   AX,AX"                  \
  413.                          parm [dx si]                   \
  414.                          value [ax]                     \
  415.                          modify [ax bx cx];
  416. #endif
  417.  
  418. USHORT VDM_LINKAGE DwnWaitEventSem(HEV SemHandle, long Timeout);
  419. #ifdef __WATCOMC__
  420. #pragma aux DwnWaitEventSem = "MOV   AH,64H"            \
  421.                          "MOV   BX,0149H"               \
  422.                          "MOV   CX,636CH"               \
  423.                          "INT   21H"                    \
  424.                          "JC    SHORT 2"                \
  425.                          "XOR   AX,AX"                  \
  426.                          parm [dx si] [al]              \
  427.                          value [ax]                     \
  428.                          modify [ax bx cx];
  429. #endif
  430.  
  431. USHORT VDM_LINKAGE DwnQueryEventSem(HEV SemHandle, PULONG PostCount);
  432. #ifdef __WATCOMC__
  433. #pragma aux DwnQueryEventSem = "MOV   AH,64H"           \
  434.                          "MOV   BX,014AH"               \
  435.                          "MOV   CX,636CH"               \
  436.                          "INT   21H"                    \
  437.                          "JC    SHORT 2"                \
  438.                          "XOR   AX,AX"                  \
  439.                          parm [dx si] [es di]           \
  440.                          value [ax]                     \
  441.                          modify [ax bx cx];
  442. #endif
  443.  
  444. USHORT VDM_LINKAGE DwnCreateMutexSem(PCSZ SemName, PHMTX SemHandle, USHORT Attr, USHORT State);
  445. #ifdef __WATCOMC__
  446. #ifdef __SW_ZDF
  447. #pragma aux DwnCreateMutexSem = "MOV   AH,64H"          \
  448.                          "MOV   BX,014BH"               \
  449.                          "MOV   CX,636CH"               \
  450.                          "INT   21H"                    \
  451.                          "JC    SHORT 2"                \
  452.                          "XOR   AX,AX"                  \
  453.                          parm [es di] [ds si] [dx] [al] \
  454.                          value [ax]                     \
  455.                          modify [ax bx cx];
  456. #else
  457. #pragma aux DwnCreateMutexSem = "PUSH  DS"              \
  458.                          "MOV   AH,64H"                 \
  459.                          "MOV   DS,CX"                  \
  460.                          "MOV   BX,014BH"               \
  461.                          "MOV   CX,636CH"               \
  462.                          "INT   21H"                    \
  463.                          "JC    SHORT 2"                \
  464.                          "XOR   AX,AX"                  \
  465.                          "POP   DS"                     \
  466.                          parm [es di] [cx si] [dx] [al] \
  467.                          value [ax]                     \
  468.                          modify [ax bx cx];
  469. #endif
  470. #endif
  471.  
  472. USHORT VDM_LINKAGE DwnOpenMutexSem(PCSZ SemName, PHMTX SemHandle);
  473. #ifdef __WATCOMC__
  474. #pragma aux DwnOpenMutexSem = "MOV   AH,64H"            \
  475.                          "MOV   BX,014CH"               \
  476.                          "MOV   CX,636CH"               \
  477.                          "INT   21H"                    \
  478.                          "JC    SHORT 2"                \
  479.                          "XOR   AX,AX"                  \
  480.                          parm [es di] [ds si]           \
  481.                          value [ax]                     \
  482.                          modify [ax bx cx];
  483. #endif
  484.  
  485. USHORT VDM_LINKAGE DwnCloseMutexSem(HMTX SemHandle);
  486. #ifdef __WATCOMC__
  487. #pragma aux DwnCloseMutexSem = "MOV   AH,64H"           \
  488.                          "MOV   BX,014DH"               \
  489.                          "MOV   CX,636CH"               \
  490.                          "INT   21H"                    \
  491.                          "JC    SHORT 2"                \
  492.                          "XOR   AX,AX"                  \
  493.                          parm [dx si]                   \
  494.                          value [ax]                     \
  495.                          modify [ax bx cx];
  496. #endif
  497.  
  498. USHORT VDM_LINKAGE DwnRequestMutexSem(HMTX SemHandle, long TimeOut);
  499. #ifdef __WATCOMC__
  500. #pragma aux DwnRequestMutexSem = "MOV   AH,64H"         \
  501.                          "MOV   BX,014EH"               \
  502.                          "MOV   CX,636CH"               \
  503.                          "INT   21H"                    \
  504.                          "JC    SHORT 2"                \
  505.                          "XOR   AX,AX"                  \
  506.                          parm [dx si] [al]              \
  507.                          value [ax]                     \
  508.                          modify [ax bx cx];
  509. #endif
  510.  
  511. USHORT VDM_LINKAGE DwnReleaseMutexSem(HMTX SemHandle);
  512. #ifdef __WATCOMC__
  513. #pragma aux DwnReleaseMutexSem = "MOV   AH,64H"         \
  514.                          "MOV   BX,014FH"               \
  515.                          "MOV   CX,636CH"               \
  516.                          "INT   21H"                    \
  517.                          "JC    SHORT 2"                \
  518.                          "XOR   AX,AX"                  \
  519.                          parm [dx si]                   \
  520.                          value [ax]                     \
  521.                          modify [ax bx cx];
  522. #endif
  523.  
  524. /* Dos32QueryMutex() isn't supported at the moment, courtesy of IBM.
  525. USHORT VDM_LINKAGE DwnQueryMutexSem(HMTX SemHandle, PPID OwnerProcess, PTID OwnerThread, PULONG RequestCount);
  526. */
  527. #endif  /* INCL_DOSSEMAPHORES */
  528.  
  529. #ifdef INCL_DOSSESMGR
  530.  
  531. /* The following typedef has been plagiarised from the OS/2 Warp Developer's Toolkit 4.0 */
  532.  
  533. typedef struct _STARTDATA {
  534.    USHORT     Length;         /*  The length of the data structure, in bytes, including Length itself. */
  535.    USHORT     Related;        /*  An indicator which specifies whether the session created is related to the calling session. */
  536.    USHORT     FgBg;           /*  An indicator which specifies whether the new session should be started in the foreground or background. */
  537.    USHORT     TraceOpt;       /*  An indicator which specifies whether the program started in the new session should be executed under conditions for tracing. */
  538.    PCSZ       PgmTitle;       /*  Address of an ASCIIZ string that contains the program title. */
  539.    PCSZ       PgmName;        /*  The address of an ASCIIZ string that contains the file specification of the program to be loaded. */
  540.    PCSZ       PgmInputs;      /*  Either 0 or the address of an ASCIIZ string that contains the input arguments to be passed to the program. */
  541.    PCSZ       TermQ;          /*  Either 0 or the address of an ASCIIZ string that contains the file specification of a system queue. */
  542.    PCSZ       Environment;    /*  The address of an environment string to be passed to the program started in the new session. */
  543.    USHORT     InheritOpt;     /*  Specifies whether the program started in the new session should inherit the calling program's environment and open file handles. */
  544.    USHORT     SessionType;    /*  The type of session that should be created for this program. */
  545.    PCSZ       IconFile;       /*  Either 0 or the address of an ASCIIZ string that contains the file specification of an icon definition. */
  546.    ULONG      PgmHandle;      /*  Either 0 or the program handle. */
  547.    USHORT     PgmControl;     /*  An indicator which specifies the initial state for a windowed application. */
  548.    USHORT     InitXPos;       /*  The initial x-coordinate, in pels, for the initial session window. */
  549.    USHORT     InitYPos;       /*  The initial y-coordinate, in pels, for the initial session window. */
  550.    USHORT     InitXSize;      /*  The initial x extent, in pels, for the initial session window. */
  551.    USHORT     InitYSize;      /*  The initial y extent, in pels, for the initial session window. */
  552.    USHORT     Reserved;       /*  Reserved; must be zero. */
  553.    PVOID      ObjectBuffer;   /*  Buffer in which the name of the object that contributed to the failure of DosExecPgm is returned. */
  554.    ULONG      ObjectBuffLen;  /*  The length, in bytes, of the buffer pointed to by ObjectBuffer. */
  555. } STARTDATA;
  556.  
  557. typedef STARTDATA FAR *PSTARTDATA;
  558.  
  559. #define SSF_RELATED_INDEPENDENT     0x0000U
  560. #define SSF_RELATED_CHILD           0x0001U
  561.  
  562. #define SSF_FGBG_FORE               0x0000U
  563. #define SSF_FGBG_BACK               0x0001U
  564.  
  565. #define SSF_TRACEOPT_NONE           0x0000U
  566. #define SSF_TRACEOPT_TRACE          0x0001U
  567. #define SSF_TRACEOPT_TRACEALL       0x0002U
  568.  
  569. #define SSF_INHERTOPT_SHELL         0x0000U
  570. #define SSF_INHERTOPT_PARENT        0x0001U
  571.  
  572. #define SSF_TYPE_DEFAULT            0x0000U
  573. #define SSF_TYPE_FULLSCREEN         0x0001U
  574. #define SSF_TYPE_WINDOWABLEVIO      0x0002U
  575. #define SSF_TYPE_PM                 0x0003U
  576. #define SSF_TYPE_VDM                0x0004U
  577. #define SSF_TYPE_WINDOWEDVDM        0x0007U
  578.  
  579. #define SSF_CONTROL_SETPOS          0x8000U
  580. #define SSF_CONTROL_NOAUTOCLOSE     0x0008U
  581. #define SSF_CONTROL_MINIMIZE        0x0004U
  582. #define SSF_CONTROL_MAXIMIZE        0x0002U
  583. #define SSF_CONTROL_INVISIBLE       0x0001U
  584. #define SSF_CONTROL_VISIBLE         0x0000U
  585.  
  586. USHORT VDM_LINKAGE DwnStartSession(PSTARTDATA StartData);
  587. #ifdef __WATCOMC__
  588. #ifdef __SW_ZDF
  589. #pragma aux DwnStartSession = "MOV   AH,64H"            \
  590.                          "MOV   BX,0025H"               \
  591.                          "MOV   CX,636CH"               \
  592.                          "INT   21H"                    \
  593.                          parm [ds si]                   \
  594.                          value [ax]                     \
  595.                          modify [ax bx cx];
  596. #else
  597. #pragma aux DwnStartSession = "PUSH  DS"                \
  598.                          "MOV   AH,64H"                 \
  599.                          "MOV   DS,CX"                  \
  600.                          "MOV   BX,0025H"               \
  601.                          "MOV   CX,636CH"               \
  602.                          "INT   21H"                    \
  603.                          "POP   DS"                     \
  604.                          parm [cx si]                   \
  605.                          value [ax]                     \
  606.                          modify [ax bx cx];
  607. #endif
  608. #endif
  609. #endif  /* INCL_DOSSESMGR */
  610.  
  611. #ifdef __cplusplus
  612.      } /* extern "C" */
  613. #endif
  614.  
  615. #if defined(__WATCOMC__) && defined(_PUSHPOP_SUPPORED)
  616.    #pragma pack(pop)
  617. #else
  618.    #pragma pack()
  619. #endif
  620.  
  621. #endif /* VDM_UTILS_INCLUDED */
  622.