home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / detk45he.zip / VDMM.H < prev    next >
Text File  |  1999-03-15  |  42KB  |  1,103 lines

  1. /***************************************************************************
  2. *
  3. * Module Name: VDMM.H
  4. *
  5. * OS/2 public header file.
  6. *
  7. * Copyright (c) 1987 - 1992  IBM Corporation
  8. *
  9. *****************************************************************************/
  10.  
  11.  
  12. /****************************************/
  13. /*            VDMM Defines              */
  14. /****************************************/
  15.  
  16.  
  17. #define CURRENT_VDM                     ((HVDM)0)
  18.  
  19. /***ET+ VDHAllocMem: flOptions                                   */
  20.  
  21. #define VDHAM_FIXED                     0x0000
  22. #define VDHAM_SWAPPABLE                 0x0001
  23.  
  24. /*end*/
  25.  
  26. /***ET+ VDHAllocPage: flOptions values                           */
  27.  
  28. #define VDHAP_SPECIFIC                  0x0001
  29. #define VDHAP_SYSTEM                    0x0002
  30. #define VDHAP_FIXED                     0x0004
  31. #define VDHAP_SWAPPABLE                 0x0000
  32. #define VDHAP_PHYSICAL                  0x0008
  33. /*end*/
  34.  
  35.  
  36. /***ET+ VDHMapPages: flOptions values                            */
  37.  
  38. #define VDHMT_INVALID                   0x0001
  39. #define VDHMT_LINEAR                    0x0002
  40. #define VDHMT_PHYSICAL                  0x0003
  41. #define VDHMT_BLACK_HOLE                0x0004
  42. /*end*/
  43.  
  44. /***ET+ VDHInstallFaultHook: flOptions values                    */
  45.  
  46. #define VDHIFH_ADDR                     0x0001
  47. /*end*/
  48.  
  49. /***ET+ VDHAllocMem Flags: flOptions Value                       */
  50.  
  51. #define VDHCBP_SWAPPABLE                0x0001
  52. /*end*/
  53.  
  54. /***ET+ VDHSetPriority: flClass values                           */
  55.  
  56. #define VDHSP_NO_CHANGE                 0x00000000
  57. #define VDHSP_IDLE                      0x00000001
  58. #define VDHSP_REGULAR                   0x00000002
  59. #define VDHSP_TIME_CRITICAL             0x00000003
  60. #define VDHSP_SERVER                    0x00000004
  61. #define VDHSP_SIMULATED_INTERRUPT       0x00000005
  62.  
  63. #define VDHSP_CLASS_MASK                0x0000ffff
  64. #define VDHSP_NUM_CLASSES               5
  65.  
  66. #define VDHSP_DEFAULT_ACTION            0x00000000
  67. #define VDHSP_START_USE                 0x00010000
  68. #define VDHSP_CONTINUE_USE              0x00020000
  69. #define VDHSP_END_USE                   0x00030000
  70.  
  71. #define VDHSP_ACTION_MASK               0xffff0000
  72. /*end*/
  73.  
  74. /***ET+ VDHYield - flags                                        */
  75.  
  76. #define VDH_YIELD_TIME_CRITICAL         1
  77. /*end*/
  78.  
  79. /***ET+ VDHLockMem flags - flOptions                            */
  80.  
  81. #define VDHLM_RESIDENT                  0x0000
  82. #define VDHLM_READ                      0x0001
  83. #define VDHLM_WRITE                     0x0002
  84. #define VDHLM_CONTIGUOUS                0x0004
  85. #define VDHLM_NOBLOCK                   0x0008
  86. #define VDHLM_16M                       0x0010
  87. #define VDHLM_ALIGN                     0x0020
  88.  
  89. #define VDHLM_NO_ADDR                   -1
  90. /*end*/
  91.  
  92. #define VDH_FAILURE                     0
  93. #define VDH_SUCCESS                     1
  94.  
  95. /***ET+ VDM States and VDD Exit defines
  96.  *
  97.  *  These are VDM states for which VDDs get notification. Few of them
  98.  *  like PDB_* are not truely VDM state changes but they are useful
  99.  *  events for which few VDDs may be interested. For arguments passed
  100.  *  and callable contexts see VDHInstallUserHook.
  101.  */
  102.  
  103. #define VDM_CREATE                      0   /* A VDM is being created       */
  104. #define VDM_TERMINATE                   1   /* A VDM is being terminated    */
  105. #define VDM_FOREGROUND                  2   /* A VDM coming to foreground   */
  106. #define VDM_BACKGROUND                  3   /* A VDM going to background    */
  107. #define VDD_EXIT                        4   /* MVDM shutting down           */
  108. #define VDM_VDD_CREATE_DONE             5   /* Called Soon after VDM_CREATE */
  109. #define VDM_PDB_DESTROY                 6   /* A PDB destroyed in a VDM     */
  110. #define VDM_PDB_CHANGE                  7   /* A new PDB is switched to     */
  111. #define VDM_CODEPAGE_CHANGE             8   /* A new code page is activated */
  112. #define VDM_TITLE_CHANGE                9   /* VDM Title change event       */
  113. #define VDM_MEMORY_MAPPED_IN            10  /* Memory mapped in             */
  114. #define VDM_MEMORY_UN_MAPPED            11  /* Memory unmapped              */
  115. #define VDM_CREATE_DONE                 12  /* VDM created successfully     */
  116. #define VDM_BEGIN_VPM_TASK              13  /* VPM task initially started   */
  117. #define VDM_END_VPM_TASK                14  /* VPM task terminated          */
  118. /*end*/
  119.  
  120. /***ET+ VDHPopup Flags                                          */
  121.  
  122. #define VDHP_FAIL                       0x0001
  123. #define VDHP_TERMINATE_SESSION          0x0002
  124. #define VDHP_RETRY                      0x0004
  125. #define VDHP_IGNORE                     0x0008
  126. /*end*/
  127.  
  128. /***ET+ VDHOpen: ActionTaken Flags                              */
  129.  
  130. #define VDHOPEN_FILE_EXISTED            0x0001
  131. #define VDHOPEN_FILE_CREATED            0x0002
  132. #define VDHOPEN_FILE_TRUNCATED          0x0003
  133. /*end*/
  134.  
  135. /***ET+ VDHOpen: FileAttribute Flags                            */
  136.  
  137. #define VDHOPEN_FILE_NORMAL             0x0000
  138. #define VDHOPEN_FILE_READONLY           0x0001
  139. #define VDHOPEN_FILE_HIDDEN             0x0002
  140. #define VDHOPEN_FILE_SYSTEM             0x0004
  141. #define VDHOPEN_FILE_DIRECTORY          0x0010
  142. #define VDHOPEN_FILE_ARCHIVED           0x0020
  143. /*end*/
  144.  
  145. /***ET+ VDHOpen: OpenFlag Flags                                 */
  146.  
  147. #define VDHOPEN_FILE_OPEN               0x0001
  148. #define VDHOPEN_FILE_REPLACE            0x0002
  149. #define VDHOPEN_FILE_CREATE             0x0010
  150.  
  151. /*     this nibble applies if file already exists                      xxxx */
  152.  
  153. #define VDHOPEN_ACTION_FAIL_IF_EXISTS     0x0000     /* ---- ---- ---- 0000 */
  154. #define VDHOPEN_ACTION_OPEN_IF_EXISTS     0x0001     /* ---- ---- ---- 0001 */
  155. #define VDHOPEN_ACTION_REPLACE_IF_EXISTS  0x0002     /* ---- ---- ---- 0010 */
  156.  
  157. /*     this nibble applies if file does not exist                 xxxx      */
  158.  
  159. #define VDHOPEN_ACTION_FAIL_IF_NEW        0x0000     /* ---- ---- 0000 ---- */
  160. #define VDHOPEN_ACTION_CREATE_IF_NEW      0x0010     /* ---- ---- 0001 ---- */
  161. /*end*/
  162.  
  163. /***ET+ VDHOpen: OpenMode Flags                                 */
  164.  
  165. #define VDHOPEN_ACCESS_READONLY           0x0000     /* ---- ---- ---- -000 */
  166. #define VDHOPEN_ACCESS_WRITEONLY          0x0001     /* ---- ---- ---- -001 */
  167. #define VDHOPEN_ACCESS_READWRITE          0x0002     /* ---- ---- ---- -010 */
  168. #define VDHOPEN_SHARE_DENYREADWRITE       0x0010     /* ---- ---- -001 ---- */
  169. #define VDHOPEN_SHARE_DENYWRITE           0x0020     /* ---- ---- -010 ---- */
  170. #define VDHOPEN_SHARE_DENYREAD            0x0030     /* ---- ---- -011 ---- */
  171. #define VDHOPEN_SHARE_DENYNONE            0x0040     /* ---- ---- -100 ---- */
  172. #define VDHOPEN_FLAGS_NOINHERIT           0x0080     /* ---- ---- 1--- ---- */
  173. #define VDHOPEN_FLAGS_NO_LOCALITY         0x0000     /* ---- -000 ---- ---- */
  174. #define VDHOPEN_FLAGS_SEQUENTIAL          0x0100     /* ---- -001 ---- ---- */
  175. #define VDHOPEN_FLAGS_RANDOM              0x0200     /* ---- -010 ---- ---- */
  176. #define VDHOPEN_FLAGS_RANDOMSEQUENTIAL    0x0300     /* ---- -011 ---- ---- */
  177. #define VDHOPEN_FLAGS_NO_CACHE            0x1000     /* ---1 ---- ---- ---- */
  178. #define VDHOPEN_FLAGS_FAIL_ON_ERROR       0x2000     /* --1- ---- ---- ---- */
  179. #define VDHOPEN_FLAGS_WRITE_THROUGH       0x4000     /* -1-- ---- ---- ---- */
  180. #define VDHOPEN_FLAGS_DASD                0x8000     /* 1--- ---- ---- ---- */
  181. #define VDHOPEN_FLAGS_NONSPOOLED          0x00040000
  182. /*end*/
  183.  
  184. /***ET+ VDHSeek: ultype options                                 */
  185.  
  186. #define VDHSK_ABSOLUTE                  0
  187. #define VDHSK_CURRENT_POSITION          1
  188. #define VDHSK_END_OF_FILE               2
  189. /*end*/
  190.  
  191. /***ET+ VDHPhysicalDisk: functions                              */
  192.  
  193. #define VDHPHYD_GET_DISKS               1
  194. #define VDHPHYD_GET_HANDLE              2
  195. #define VDHPHYD_RELEASE_HANDLE          3
  196. /*end*/
  197.  
  198. /***ET+ VDHCreateSem Flags                                      */
  199.  
  200. #define VDH_EVENTSEM                    0x0000
  201. #define VDH_MUTEXSEM                    0x0001
  202. /*end*/
  203.  
  204. /***ET+ VDHArmTimerHook Flags                                   */
  205.  
  206. #define VDH_TIMER_INTERRUPT_HOOK        ((HVDM)1)
  207. #define VDH_TIMER_GLOBAL_CONTEXT        ((HVDM)-1)
  208.  
  209. /***ET+ VDHQuerySysValue ordinals                               */
  210.  
  211. /* Global Values          Ordinal      Type   Units      Range */
  212.  
  213. #define VDHGSV_DAY              0   // ULONG  days       1 <= x <= 31
  214. #define VDHGSV_MONTH            1   // ULONG  months     1 <= x <= 12
  215. #define VDHGSV_YEAR             2   // ULONG  years   1980 <= x <= MAXULONG
  216. #define VDHGSV_DAYOFWEEK        3   // ULONG  days       0 <= x <= 6
  217. #define VDHGSV_HOUR             4   // ULONG  hours      0 <= x <  24
  218. #define VDHGSV_MINUTE           5   // ULONG  minutes    0 <= x <  60
  219. #define VDHGSV_SECOND           6   // ULONG  secs       0 <= x <  60
  220. #define VDHGSV_HUNDREDTH        7   // ULONG  1/100s     0 <= x <  100
  221. #define VDHGSV_SECONDS1970      8   // ULONG  secs       0 <= x <= MAXULONG
  222. #define VDHGSV_TIMEZONE         9   // ULONG  minutes    0 <= x <= MAXULONG
  223. #define VDHGSV_MSECSBOOT       10   // ULONG  ms         0 <= x <= MAXULONG
  224. #define VDHGSV_TIMERINTERVAL   11   // ULONG  ms         0 <= x <= 1000
  225. #define VDHGSV_DYNVARIATION    12   // BOOL              TRUE/FALSE
  226. #define VDHGSV_MAXWAIT         13   // ULONG  secs       0 <= x <= MAXULONG
  227. #define VDHGSV_MINTIMESLICE    14   // ULONG  ms         0 <= x <= MAXULONG
  228. #define VDHGSV_MAXTIMESLICE    15   // ULONG  ms         0 <= x <= MAXULONG
  229. #define VDHGSV_YIELD           16   // BOOL              TRUE/FALSE
  230. #define VDHGSV_TCYIELD         17   // BOOL              TRUE/FALSE
  231. #define VDHGSV_VERMAJOR        18   // ULONG             0 <= x <= MAXULONG
  232. #define VDHGSV_VERMINOR        19   // ULONG             0 <= x <= MAXULONG
  233. #define VDHGSV_VERREVISION     20   // CHAR              A <= x <= Z
  234. #define VDHGSV_MACHINETYPE     21   // ULONG             MACHINE_TYPE_*
  235. #define VDHGSV_BLACKHOLEADDR   22   // PVOID  bytes      0 <= x <= MAXULONG
  236. #define VDHGSV_BLACKHOLESIZE   23   // ULONG  bytes      0 <= x <= MAXULONG
  237. #define VDHGSV_FGNDSESSIONID   24   // ULONG             0 <= x <  MAXSESSIONS
  238. #define VDHGSV_MAXFPSESSIONS   25   // ULONG            //TO BE DELETED
  239. #define VDHGSV_MAXWPSESSIONS   26   // ULONG            //TO BE DELETED
  240. #define VDHGSV_MAXPMSESSIONS   27   // ULONG            //TO BE DELETED
  241. #define VDHGSV_RESERVESESSIONS 28   // Reserved         //TO BE DELETED
  242. #define VDHGSV_ARPLADDR        29   // ULONG
  243. #define VDHGSV_MACHINEINFO     30   // ULONG ptr to System Configuration Table
  244. #define VDHGSV_PPOSREGS        31   // ULONG pointer to POS Regs structure
  245. #define VDHGSV_PICMASK         32   // ULONG original PIC mask values   6.13
  246. #define VDHGSV_IRETADDR        33   // ULONG address of IRET in ROM
  247. #define VDHGSV_BOOTDRV         34   // ULONG            1=A:,2=B:,3=C:,etc.
  248. #define VDHGSV_MMIOADDR        35   // ULONG mmio address
  249. #define VDHGSV_MECADDR         36   // ULONG mec table address
  250. /* if you add a new entry, please update GSVMAX in src\dos\mvdm\vdmvdh.h */
  251.  
  252. /* Local Values           Ordinal      Type   Units      Range */
  253.  
  254. #define VDHLSV_HVDM          4096   // HVDM
  255. #define VDHLSV_PID           4097   // PID
  256. #define VDHLSV_PCRF          4098   // PCRF
  257. #define VDHLSV_SESSIONID     4099   // ULONG             N <= x <  MAXSESSIONS
  258. #define VDHLSV_FOREGROUND    4100   // BOOL              TRUE/FALSE
  259. #define VDHLSV_RMSIZE        4101   // ULONG  kbytes     0 <  x <= 640
  260. #define VDHLSV_CODEPAGEID    4102   // ULONG             See DosGetCP
  261. #define VDHLSV_PRIORITYCLASS 4103   // ULONG             See VDHSetPriority
  262. #define VDHLSV_PRIORITYLEVEL 4104   // ULONG             See VDHSetPriority
  263. #define VDHLSV_VPICBASE      4105   // UCHAR[4]
  264.  
  265. /*
  266.  * Locations of base vectors in PIC base vector array returned from
  267.  *    VDHQuerySysValue
  268.  */
  269.  
  270. #define VPMMASTER_PORT_INDEX            0
  271. #define VPMSLAVE_PORT_INDEX             1
  272.  
  273. /*end*/
  274.  
  275. /***ET+ Return values for VDHGSV_MACHINETYPE */
  276.  
  277. #define MACHINE_TYPE_AT         1
  278. #define MACHINE_TYPE_PS2        2
  279. #define MACHINE_TYPE_PARKCITY   3
  280. /*end*/
  281.  
  282. /***ET+ Timeout values for semaphore services */
  283.  
  284. #define SEM_INDEFINITE_WAIT    -1
  285. #define SEM_IMMEDIATE_RETURN    0
  286. /*end*/
  287.  
  288. /***ET+ VDD-to_PDD commands (used internally during VDHOpenPDD) */
  289.  
  290. #define PDDCMD_REGISTER         0   // to register VDD entry point with PDD
  291. #define PDDCMD_DEREGISTER       1   // To deregister a VDD at MVDM shutdown
  292. /*end*/
  293.  
  294. /*** VDHDecodeProperty defines ***/
  295. #define VDH_DP_DECIMAL          10
  296. #define VDH_DP_HEX              16
  297.  
  298.  
  299. /****************************************/
  300. /*          VDMM Data Types             */
  301. /****************************************/
  302.  
  303.  
  304. /***ET+ MISC VDMM data types
  305.  */
  306. typedef HANDLE  HVDM;
  307. typedef HVDM    *PHVDM;
  308. typedef HANDLE  HBLOCK;                         // Block pool handle
  309. typedef ULONG   HLOCK;                          // Memory lock handle
  310. typedef ULONG   HVDD;                           // VDD Handle
  311. typedef PSZ     *PPSZ;                          // Pointer to PSZ
  312. typedef HVDD    *PHVDD;                         // VDD Handle Pointer
  313. typedef ULONG   VDHSEM;                         // It should be VOID
  314. typedef VDHSEM  *HVDHSEM;                       // but vddvdh.inc has
  315. typedef HVDHSEM *PHVDHSEM;                      // problems with it
  316. typedef VOID    (*HOOKENTRY PFAULTHOOK)(PVDM);
  317. typedef VOID    (*HOOKENTRY PTIMERHOOK)(ULONG);
  318. /*end*/
  319.  
  320. /***ET+ HHOOK - hook handle
  321.  *
  322.  *      This is the handle return from the VDHAllocHook and used with
  323.  *      the VDHArm functions.
  324.  */
  325.  
  326. typedef PVOID HHOOK;                            // hook handle
  327. typedef HHOOK *PHHOOK;                          // pointer to hook handle
  328. /*end*/
  329.  
  330.  
  331. /***ET+ Pointer types for VDD-PDD communication and V86 address manipulation
  332.  */
  333.  
  334. #define FAR16           NEAR                    // (pseudo 16:16 modifier)
  335. typedef VOID FAR16     *F16PVOID;               // f16p (pseudo 16:16 pointer)
  336.  
  337. #define FARV86          NEAR                    // (pseudo-V86 modifier)
  338. typedef VOID FARV86    *VPVOID;                 // vp (pseudo-V86 pointer)
  339. typedef VPVOID FAR     *PVPVOID;                // pvp
  340. /*end*/
  341.  
  342.  
  343. #define F16PNULL        ((F16PVOID)0)
  344. #define F16PFROMP(p)    ((F16PVOID)(((ULONG)VDHQuerySel(p)<<16) | (USHORT)(p)))
  345. #define F16PFROMSSP(p)  ((F16PVOID)(((ULONG)VDHQuerySel(SSToDS(p))<<16) | (USHORT)(p)))
  346.  
  347.  
  348.  
  349. /***ET+ FNPDD - PDD function for "standard" VDD-to-PDD communication
  350.  *
  351.  *  ENTRY
  352.  *      ulFun - function code
  353.  *
  354.  *      ul1   - function-specific;
  355.  *              if a pointer, it will generally be 16:16, and
  356.  *              will generally be an input buffer, the first
  357.  *              word of which is the length of the entire buffer
  358.  *
  359.  *      ul2   - function-specific;
  360.  *              if a pointer, it will generally be 16:16, and
  361.  *              will generally be an output buffer, the first
  362.  *              word of which is the length of the entire buffer
  363.  *
  364.  *      if uFunc == PDDCMD_REGISTER (from VDM Manager during VDHOpenPDD)
  365.  *          ul1.off == VDD's CS
  366.  *          ul1.sel == zero
  367.  *          ul2.off == low 16-bits of EIP for VDD entry point
  368.  *          ul2.sel == high 16-bits of EIP for VDD entry point
  369.  *
  370.  *  EXIT
  371.  *      SUCCESS
  372.  *          !0
  373.  *      FAILURE
  374.  *           0 (the nature of the failure, such as an error code,
  375.  *              if needed, should be returned in the ul2 output buffer)
  376.  *
  377.  *  CALLING CONVENTIONS
  378.  *      32-bit PASCAL calling conventions.  More specifically:
  379.  *
  380.  *      Parameters are pushed on the stack from left to right, and are
  381.  *      removed by the callee.  The callee preserves EBX, ESI, EDI, EBP,
  382.  *      DS and ES.  Assuming the PDD function is completely 16-bit
  383.  *      (with the exception of any 16:32 calls back to the VDD, and the
  384.  *      16:32 RETFD to return to the VDD), the high words of all the
  385.  *      extended registers are preserved by virtue of being unused by the
  386.  *      PDD.  Therefore, only BX, SI, DI, BP, DS and ES need to be explicitly
  387.  *      preserved.
  388.  *
  389.  *      Furthermore, the PDD is responsible for loading its own DS.  To
  390.  *      do this, it must have a word in its code segment fixed-up to contain
  391.  *      its data segment selector.
  392.  *
  393.  *      The return code from the PDD must be in AX;  0 implies failure,
  394.  *      whereas a non-zero (generally meaningful) value implies success.
  395.  */
  396.  
  397. typedef SBOOL (*VDDENTRY FPFNVDD)(ULONG, F16PVOID, F16PVOID);   /* fpfnvdd */
  398. typedef SBOOL (*PDDENTRY FPFNPDD)(ULONG, F16PVOID, F16PVOID);   /* fpfnvdd */
  399. /*end*/
  400.  
  401.  
  402. /***ET+ FNVDD - VDD function for "standard" PDD-to-VDD communication
  403.  *
  404.  *  ENTRY
  405.  *      ulFun - function code
  406.  *
  407.  *      ul1   - function-specific;
  408.  *              if a pointer, it will generally be 16:16, and
  409.  *              will generally be an input buffer, the first
  410.  *              word of which is the length of the entire buffer
  411.  *
  412.  *      ul2   - function-specific;
  413.  *              if a pointer, it will generally be 16:16, and
  414.  *              will generally be an output buffer, the first
  415.  *              word of which is the length of the entire buffer
  416.  *
  417.  *  EXIT
  418.  *      SUCCESS
  419.  *          !0
  420.  *      FAILURE
  421.  *           0 (the nature of the failure, such as an error code,
  422.  *              if needed, should be returned in the ul2 output buffer)
  423.  *
  424.  *  CALLING CONVENTIONS
  425.  *      32-bit PASCAL calling conventions.  More specifically:
  426.  *
  427.  *      Parameters are pushed on the stack from left to right, and are
  428.  *      removed by the callee.  The callee must preserve EBX, ESI, EDI, EBP,
  429.  *      DS and ES.
  430.  *
  431.  *
  432.  *      The return code from the VDD must be in AX;  0 implies failure,
  433.  *      whereas a non-zero (generally meaningful) value implies success.
  434.  */
  435.  
  436. typedef SBOOL (*VDDENTRY FPFNVDD)(ULONG, F16PVOID, F16PVOID);   /* fpfnvdd */
  437. /*end*/
  438.  
  439.  
  440. #define VDDREQ_PASS -1
  441.  
  442. /***ET+ FNSYSREQ - DOS32RequestVDD VDD function-type
  443.  *
  444.  *  ENTRY
  445.  *      sgid  - screen group
  446.  *      ulFun - function code
  447.  *      nbIn  - Input buffer size, in bytes (0 if no input buffer)
  448.  *      pIn   - Input buffer
  449.  *      nbOut - Output buffer size, in bytes (0 if no output buffer)
  450.  *      pOut  - Output buffer
  451.  *  EXIT
  452.  *      SUCCESS
  453.  *          Zero
  454.  *      FAILURE
  455.  *          Error code, or -1 to pass control to next VDD
  456.  *
  457.  *  CALLING CONVENTIONS
  458.  *      32-bit small-model PASCAL calling conventions.  More specifically:
  459.  *
  460.  *      Parameters are pushed on the stack from left to right, and are
  461.  *      removed by the callee.  The callee will preserve EBX, ESI, EDI, EBP,
  462.  *      DS and ES.  DS is assumed to contain the callee's DGROUP selector
  463.  *      on entry.  EAX must be set to the return code on exit.
  464.  */
  465.  
  466. typedef LONG (*EXPENTRY PFNSYSREQ)(SGID, ULONG, ULONG, PVOID, ULONG, PVOID);
  467. /*end*/
  468.  
  469. /***ET+ FNDEVREQ - VDHRequestVDD VDD function-type
  470.  *
  471.  *  ENTRY
  472.  *      hvdm  - handle to vdm
  473.  *      ulFun - function code
  474.  *      ul1   - function-specific;
  475.  *              if a pointer, it will generally be 0:32, and
  476.  *              will generally be an input buffer;  if the size of the
  477.  *              buffer is not implied, the first dword of the buffer should
  478.  *              contain a total size
  479.  *      ul2   - function-specific;
  480.  *              if a pointer, it will generally be 0:32, and
  481.  *              will generally be an output buffer;  if the size of the
  482.  *              buffer is not implied, the first dword of the buffer should
  483.  *              contain a total size
  484.  *  EXIT
  485.  *      SUCCESS
  486.  *          Non-zero value (other than -1)
  487.  *      FAILURE
  488.  *          FALSE, or -1 to pass control to next VDD (in the first case,
  489.  *          the VDD should use VDHSetError to describe the error condition)
  490.  *
  491.  *  CALLING CONVENTIONS
  492.  *      32-bit small-model PASCAL calling conventions.  More specifically:
  493.  *
  494.  *      Parameters are pushed on the stack from left to right, and are
  495.  *      removed by the callee.  The callee will preserve EBX, ESI, EDI, EBP,
  496.  *      DS and ES.  DS is assumed to contain the callee's DGROUP selector
  497.  *      on entry.  EAX must be set to the return code on exit.
  498.  */
  499.  
  500. typedef LONG (*EXPENTRY PFNDEVREQ)(HVDM, ULONG, PVOID, PVOID);
  501. /*end*/
  502.  
  503.  
  504. /***ET+ PFNVDHRP - VDD property function
  505.  *
  506.  *      This function performs property setting and validation.
  507.  *
  508.  *      The set operation may be requested at any time after a VDM is created.
  509.  *
  510.  *      The Validation operation may be requested at any time (even before
  511.  *      the a VDM is created.  Validation will be requested only for
  512.  *      VDMP_STRING and VDMP_MLSTR types, since all other types can be
  513.  *      validated using the information supplied by VDHRegisterProperty.
  514.  *
  515.  *      ENTRY op   = Operation to perform (enumeration)
  516.  *                   VDHPROP_VALIDATE
  517.  *                       Validate property for any process.  Only called
  518.  *                       for VDMP_STRING and VDMP_MLSTR properties.
  519.  *                   VDHPROP_SET
  520.  *                       Set an already validated property for specified
  521.  *                       HVDM.  The return code is ignored.
  522.  *            hvdm = Handle of VDM.  Undefined if op = VDHPROP_VALIDATE.
  523.  *            cb   = Count of bytes pointed to by pch.
  524.  *                   Value depends upon proptype:
  525.  *                     VDMPROP_BOOL
  526.  *                        Undefined.
  527.  *                     VDMPROP_INT
  528.  *                        Undefined.
  529.  *                     VDMPROP_ENUM
  530.  *                        Length of ASCIIZ string, including NULL terminator.
  531.  *                     VDMPROP_STRING
  532.  *                        Length of ASCIIZ string, including NULL terminator.
  533.  *                     VDMPROP_MLSTR
  534.  *                        Length of ASCIIZ string, including NULL terminator.
  535.  *
  536.  *            pch  = Value to set/validate.
  537.  *                   The format depends on the proptype:
  538.  *                     VDMPROP_BOOL
  539.  *                        pch is interpreted as a BOOL.
  540.  *                        Value 0 is FALSE; !0 is TRUE.
  541.  *                     VDMPROP_INT
  542.  *                        pch is interpreted as a ULONG. It is guaranteed
  543.  *                        to meet the registered bounds.
  544.  *                     VDMPROP_ENUM
  545.  *                        pch points to an ASCIIZ string. It is guaranteed
  546.  *                        to be one of the registered enumeration strings.
  547.  *                     VDMPROP_STRING
  548.  *                        pch points to an ASCIIZ string.  It is guaranteed
  549.  *                        to be less than or equal to the registered maximum
  550.  *                        string length.
  551.  *                     VDMPROP_MLSTR
  552.  *                        pch points to an ASCIIZ string.  Multiple lines
  553.  *                        are separated by a line feed (0x0A).  It is
  554.  *                        guaranteed to be less than or equal to the
  555.  *                        registered maximum string length.
  556.  *
  557.  *
  558.  *      EXIT-SUCCESS
  559.  *          returns 0
  560.  *
  561.  *      EXIT-FAILURE
  562.  *          returns non-zero error code
  563.  *              ERROR_INVALID_DATA
  564.  *                  This should be returned if the value is not valid.
  565.  *
  566.  *      CONTEXT
  567.  *          Task
  568.  */
  569.  
  570. typedef ULONG (*EXPENTRY PFNVDHRP)(ULONG, HVDM, ULONG, PSZ);
  571. /*end*/
  572.  
  573.  
  574. /***ET+ PENUMHOOK - VDD hooks for VDHEnumerateVDMs
  575.  *
  576.  *  ENTRY
  577.  *      hvdm  - VDM handle
  578.  *      ulData - Handler data
  579.  *
  580.  *  EXIT
  581.  *      SUCCESS
  582.  *          TRUE
  583.  *      FAILURE
  584.  *           FALSE
  585.  *
  586.  *  CALLING CONVENTIONS
  587.  *      32-bit small-model PASCAL calling conventions.  More specifically:
  588.  *
  589.  *      Parameters are pushed on the stack from left to right, and are
  590.  *      removed by the callee.  The callee will preserve EBX, ESI, EDI, EBP,
  591.  *      DS and ES.  DS is assumed to contain the callee's DGROUP selector
  592.  *      on entry.  EAX must be set to the return code on exit.
  593.  */
  594.  
  595. typedef BOOL (*HOOKENTRY PENUMHOOK)(HVDM,ULONG);                  /* penumh */
  596. /*end*/
  597.  
  598.  
  599. /***ET+ USERHOOK - VDD user-event-hook function
  600.  *
  601.  *  ENTRY
  602.  *      hvdm  - VDM handle
  603.  *
  604.  *  EXIT
  605.  *      SUCCESS
  606.  *          !0
  607.  *      FAILURE
  608.  *           0 (failure is only support for the VDM_CREATE hook, and
  609.  *              implies that the VDD cannot support/sustain another VDM).
  610.  *
  611.  *  CALLING CONVENTIONS
  612.  *      32-bit small-model PASCAL calling conventions.  More specifically:
  613.  *
  614.  *      Parameters are pushed on the stack from left to right, and are
  615.  *      removed by the callee.  The callee will preserve EBX, ESI, EDI, EBP,
  616.  *      DS and ES.  DS is assumed to contain the callee's DGROUP selector
  617.  *      on entry.  EAX must be set to the return code on exit.
  618.  */
  619.  
  620. typedef BOOL (*HOOKENTRY PUSERHOOK)();                  /* puserh */
  621. /*end*/
  622.  
  623. /* Definition for thread routine
  624.  */
  625. typedef VOID ((*PVDDTHREAD)(VOID));
  626. typedef PULONG PVDDTID;
  627.  
  628.  
  629. /***ET+ VDHPAGELIST - structure to describe dis-contiguous physical ranges
  630.  *                    for VDHLockMem
  631.  *
  632.  *      vdhpl_paddr - base physical address of one range
  633.  *      vdhpl_cb    - bytes contiguously mapped from vdhpl_paddr
  634.  */
  635. typedef struct VDHPageList_s { /* vdhpl */
  636.     ULONG     vdhpl_paddr;
  637.     ULONG     vdhpl_cb;
  638. } VDHPAGELIST;
  639. typedef VDHPAGELIST *PVDHPAGELIST; /* pvdhpl */
  640.  
  641.  
  642. /***ET+ VDHMAPTARGET - target area definition for VDHMapPages
  643.  *
  644.  *      vdhmt_laddr - Target address in V86-space (0 <= vdhmt_laddr < 1M+64K)
  645.  *                    to be mapped.
  646.  *      vdhmt_cpg   - Count of pages to map
  647.  *      vdhmt_hmap  - Mapping handle
  648.  */
  649. typedef struct VDHMapTarget_s { /* vdhmt */
  650.     ULONG     vdhmt_laddr;  // address in v86-space for mapping
  651.     ULONG     vdhmt_cpg;    // count of pages to map
  652.     ULONG     vdhmt_hmap;   // handle of mapping.  Must be zero on first call
  653.                             // to VDHMapPages for region.
  654. } VDHMAPTARGET;
  655. typedef VDHMAPTARGET *PVDHMAPTARGET; /* pvdhmt */
  656. /*end*/
  657.  
  658.  
  659. /***ET+ VDHMAPSOURCE - source area definition for VDHMapPages
  660.  *
  661.  *      vdhms_laddr - Source address to be mapped.
  662.  *      vdhms_hobj  - Object handle.
  663.  */
  664. typedef struct VDHMapSource_s { /* vdhms */
  665.     ULONG   vdhms_laddr;    // linear address of source memory object
  666.     ULONG   vdhms_hobj;     // memory object handle
  667. } VDHMAPSOURCE;
  668. typedef VDHMAPSOURCE *PVDHMAPSOURCE; /* pvdhms */
  669. /*end*/
  670.  
  671.  
  672. /***ET+ VDHQuerySem: SemState structure                           */
  673.  
  674. typedef struct  VDHSemState_s {
  675.         UCHAR   vss_SemType;         // VDH_EVENTSEM/VDH_MUTEXSEM
  676.         UCHAR   vss_fOwned;          // 0 -> Not Owned; 1 -> Owned
  677.         USHORT  vss_fWaiter;         // 0 -> No one waiting; 1 -> Waiting
  678.         USHORT  vss_cRequest;        // request count in mutex case
  679.         TID     vss_tid;             // tid of the owner if owned
  680. }VDHSEMSTATE;
  681.  
  682. typedef VDHSEMSTATE    *PVDHSEMSTATE;
  683. /*end*/
  684.  
  685. /* Defines for POS Registers */
  686. #define     POS_MAX_SIZE          8     // Count of POS registers
  687. #define     POS_MAX_SLOT          8     // Maximum number of slots in machine
  688. #define     POS_CEN_ARB_REG    0x90     // Central Arbitration register
  689. #define     POS_SEL_FDBK_REG   0x91     // Card Selected Feedback
  690. #define     POS_SYS_CTRLA_REG  0x92     // System Control Port A
  691. #define     POS_SYS_SETUP_REG  0x94     // System setup/enable register
  692. #define     POS_ADP_SETUP_REG  0x96     // Adapter setup/enable register
  693. #define     POS_BASE_REG      0x100     // Base POS register
  694. #define     POS_TOP_REG       0x107     // Highest POS Register
  695. #define     POS_NULLPORT       0xFF     // null value for ports not active
  696. #define     POS_CARDFEEDBACK   0xFE     // pretend to send back card selected
  697. #define     POS_PLANAR_SELECT  0x80     // port 94 bit value to select planar
  698. #define     POS_VIDEO_SELECT   0x20     // port 94 bit value to select video
  699. #define     POS_OPTION_SELECT  0x08     // port 96 bit value to select card
  700.  
  701. /* Structure for POS Registers */
  702.  
  703. typedef struct _POS_s {
  704.   BYTE    aPOSReg[POS_MAX_SIZE];
  705. } POS_s;
  706. typedef POS_s *PPOS;
  707.  
  708. typedef struct _POSREGS {
  709.   POS_s   VideoPOS;                     // Video POS data
  710.   POS_s   PlanarPOS;                    // Planar POS data
  711.   POS_s   SlotPOS[POS_MAX_SLOT];        // Adapter POS data
  712.   BYTE    Port90;                       // Central Arbiter
  713.   BYTE    Port92;                       // System Control Port A
  714.   BYTE    Port94;                       // System setup/enable reg
  715.   BYTE    Port96;                       // Adapter setup/enable reg
  716. } POSREGS;
  717. typedef POSREGS *PPOSREGS;
  718.  
  719. typedef struct _SYS_CONFIG_TABLE {
  720.   USHORT  Reserve;                      // Reserved
  721.   BYTE    Model;                        // Model byte
  722.   BYTE    Submodel;                     // Submodel byte
  723.   BYTE    BIOS_revision;                // BIOS revision level
  724.   BYTE    Reserve1;                     // Reserved
  725.   BYTE    Reserve2;                     // Reserved
  726.   BYTE    Reserve3;                     // Reserved
  727.   BYTE    Reserve4;                     // Reserved
  728.   BYTE    Reserve5;                     // Reserved
  729. } SYS_CONFIG_TABLE;
  730. typedef SYS_CONFIG_TABLE *PSYS_CONFIG_TABLE;
  731.  
  732. /* VDD initialization routine prototype */
  733.  
  734. BOOL    EXPENTRY VDDInit(PSZ);
  735.  
  736.  
  737. /****************************************/
  738. /*            VDMM Macros               */
  739. /****************************************/
  740.  
  741.  
  742. /*  Accessing VDM data:
  743.  *
  744.  *  If the context is the desired VDM, then the following works for
  745.  *  ROM BIOS data area access, using the dynamically-fixed-up-to-zero
  746.  *  VDMBase data structure:
  747.  *
  748.  *      VDMBase.rb_field = 0;
  749.  *
  750.  *  For instance data, if you put all of it inside a structure, the instance
  751.  *  of which is VDMData, and create a type, PVDMDATA, that points to such a
  752.  *  structure, you can reference instance data like so:
  753.  *
  754.  *      VDMData.fFgnd = TRUE;
  755.  *
  756.  *  And if you have a PVOID (p) created with PFROMVP or PFROMVADDR, use:
  757.  *
  758.  *      *(PBYTE)p = 0;
  759.  *
  760.  *
  761.  *  If the context is NOT the desired VDM, then you have to use the
  762.  *  VDM's handle (hvdm).  For ROM BIOS data area access, use the "pVDMBase"
  763.  *  macro:
  764.  *
  765.  *      pVDMBase(hvdm)->rb_field = 0;
  766.  *
  767.  *  For instance data, reference similarly with the "pVDMData" macro:
  768.  *
  769.  *      pVDMData(hvdm)->fFgnd = TRUE;
  770.  *
  771.  *  And if you have a PVOID (p) created with PFROMVP or PFROMVADDR, you can
  772.  *  use the "pVDM" macro to convert the pointer to one that is valid for the
  773.  *  given VDM and of the given type:
  774.  *
  775.  *      *pVDM(hvdm,PBYTE,p) = 0;
  776.  *
  777.  *  An alternative to "pVDMData" (but not preferred, because it is less
  778.  *  maintainable and overrides type-checking) if you don't want to put all
  779.  *  your instance data in a structure, is:
  780.  *
  781.  *      REFHVDM(hvdm,BOOL,VDMData.fFgnd) = TRUE;
  782.  *
  783.  *  Note that for any *resident* instance data, the same guidelines apply;
  784.  *  simply substitute VDMRESDATA for VDMDATA.
  785.  */
  786.  
  787.  
  788. // To reference pre-defined VDM data (ie, ROM BIOS stuff) with an hvdm
  789. #define pVDMBase(hvdm)          ((PVDMBASE)(hvdm))
  790.  
  791. // To reference instance data with an hvdm
  792. #define pVDMData(hvdm)          ((PVDMDATA)((ULONG)&VDMData+(ULONG)(hvdm)))
  793. #define pVDMResData(hvdm)       ((PVDMRESDATA)((ULONG)&VDMResData+(ULONG)(hvdm)))
  794.  
  795. // To reference arbitrary VDM data with an hvdm and arbitrary pointer
  796. #define pVDM(hvdm,type,p)       ((type)((PBYTE)(p)+(ULONG)(hvdm)))
  797.  
  798. // To dereference an instance variable with a hvdm (not preferred)
  799. #define REFHVDM(hvdm,type,var)  (*((type *)((PBYTE)&(var) + (ULONG)(hvdm))))
  800.  
  801. #ifdef  VDHSTRICT
  802.  
  803. #define ASSERTTASK            VDHAssertTask()
  804. #define ASSERTVDMTASK         VDHAssertVDMTask()
  805. #define ASSERTTASKONLY        VDHAssertTaskOnly()
  806. #define ASSERTVDMTASKONLY     VDHAssertVDMTaskOnly()
  807. #define ASSERTINITONLY        VDHAssertInitOnly()
  808. #define CHECKHVDM(hvdm)       VDHCheckHVDM(hvdm)
  809.  
  810. #else
  811.  
  812. #define ASSERTTASK            //
  813. #define ASSERTVDMTASK         //
  814. #define ASSERTTASKONLY        //
  815. #define ASSERTVDMTASKONLY     //
  816. #define ASSERTINITONLY        //
  817. #define CHECKHVDM(hvdm)       //
  818.  
  819. #endif
  820.  
  821.  
  822.  
  823.  
  824. //ifdef VDHSTRICT
  825. //      ASSERTTASK        macro
  826. //                  PCall VDHAssertTask
  827. //                  endm
  828. //      ASSERTVDMTASK     macro
  829. //                  PCall VDHAssertVDMTask
  830. //                  endm
  831. //      ASSERTTASKONLY    macro
  832. //                  PCall VDHAssertTaskOnly
  833. //                  endm
  834. //      ASSERTVDMTASKONLY macro
  835. //                  PCall VDHAssertVDMTaskOnly
  836. //                  endm
  837. //      ASSERTINITONLY    macro
  838. //                  PCall VDHAssertInitOnly
  839. //                  endm
  840. //      CHECKHVDM         macro hvdm
  841. //                  PCall VDHCheckHVDM, hvdm
  842. //                  endm
  843. //else
  844. //      ASSERTTASK        macro
  845. //                        endm
  846. //      ASSERTVDMTASK     macro
  847. //                        endm
  848. //      ASSERTTASKONLY    macro
  849. //                        endm
  850. //      ASSERTVDMTASKONLY macro
  851. //                        endm
  852. //      ASSERTINITONLY    macro
  853. //                        endm
  854. //      CHECKHVDM         macro hvdm
  855. //                        endm
  856. //endif
  857.  
  858.  
  859.  
  860. /****************************************/
  861. /*      VDMM Function Prototype         */
  862. /****************************************/
  863.  
  864.  
  865. //      Memory Management Function Prototypes
  866.  
  867. BOOL        VDHENTRY VDHAllocSharedMem(ULONG, PULONG, PULONG);     //175866
  868. VOID        VDHENTRY VDHFreeSharedMem(ULONG, ULONG);               //175866
  869. PVOID       VDHENTRY VDHAllocMem(ULONG cb, ULONG flOptions);
  870. VOID        VDHENTRY VDHFreeMem(PVOID);
  871. PVOID       VDHENTRY VDHAllocDosMem(ULONG cb);
  872. HBLOCK      VDHENTRY VDHCreateBlockPool(ULONG cbBlock, ULONG flOptions);
  873. PVOID       VDHENTRY VDHAllocBlock(HBLOCK);
  874. VOID        VDHENTRY VDHFreeBlock(HBLOCK,PVOID);
  875. VOID        VDHENTRY VDHDestroyBlockPool(HBLOCK);
  876. VOID        VDHENTRY VDHCopyMem(PVOID,PVOID,ULONG);
  877. BOOL        VDHENTRY VDHExchangeMem(PVOID,PVOID,ULONG);
  878.  
  879. /* bwb start */
  880. struct pagelist_s *ppl;
  881.  
  882. HLOCK       VDHENTRY VDHLockMem(PVOID,
  883.                                 ULONG,
  884.                                 ULONG,
  885.                                 struct pagelist_s *ppl,
  886.                                 PULONG);
  887. #if 0
  888. HLOCK       VDHENTRY VDHLockMem(PVOID,ULONG,ULONG,PVOID,PVOID);
  889. #endif
  890. /* bwb end */
  891.  
  892. VOID        VDHENTRY VDHUnlockMem(HLOCK);
  893. SEL         VDHENTRY VDHQuerySel(PVOID);
  894. PVOID       VDHENTRY VDHQueryLin(F16PVOID);
  895. SEL         VDHENTRY VDHCreateSel(PVOID,ULONG);
  896. VOID        VDHENTRY VDHDestroySel(SEL);
  897. ULONG       VDHENTRY VDHGetCodePageFont(ULONG,ULONG,PPVOID);
  898. VOID        VDHENTRY VDHReleaseCodePageFont(PVOID);
  899. ULONG       VDHENTRY VDHAllocUserMem(ULONG, ULONG, PVOID);
  900. ULONG       VDHENTRY VDHFreeUserMem(PVOID);
  901. ULONG       VDHENTRY VDHSetUserMem(PVOID, ULONG, ULONG);
  902. ULONG       VDHENTRY VDHQueryUserMem(PVOID, PULONG, PULONG);
  903. VOID        VDHENTRY VDHQueryArena(ULONG, PULONG);
  904.  
  905. //      Page Management Function Prototypes
  906.  
  907. PVOID       VDHENTRY VDHAllocPages(PVOID,ULONG,ULONG);
  908. PVOID       VDHENTRY VDHReallocPages(PVOID,ULONG,ULONG);
  909. VOID        VDHENTRY VDHFreePages(PVOID);
  910. PVOID       VDHENTRY VDHFindFreePages(PVOID,PULONG);
  911. ULONG       VDHENTRY VDHGetDirtyPageInfo(HVDM,PVOID,ULONG);
  912. ULONG       VDHENTRY VDHQueryFreePages(VOID);
  913. BOOL        VDHENTRY VDHReservePages(PVOID,ULONG);
  914. VOID        VDHENTRY VDHUnreservePages(PVOID,ULONG);
  915. BOOL        VDHENTRY VDHMapPages(PVDHMAPSOURCE,PVDHMAPTARGET,ULONG);
  916. BOOL        VDHENTRY VDHInstallFaultHook(HVDM,PVOID,ULONG,PFAULTHOOK,BOOL);
  917. VOID        VDHENTRY VDHRemoveFaultHook(HVDM,PVOID,ULONG,PFAULTHOOK);
  918. PVOID       VDHENTRY VDHAllocDMABuffer(ULONG,BOOL,PULONG);
  919. VOID        VDHENTRY VDHFreeDMABuffer(PVOID);
  920.  
  921.  
  922. //      Inter-DD Communication Function Prototypes
  923.  
  924. FPFNPDD     VDHENTRY VDHOpenPDD(PSZ,FPFNVDD);
  925. BOOL        VDHENTRY VDHRegisterVDD(PSZ,PFNSYSREQ,PFNDEVREQ);
  926. HVDD        VDHENTRY VDHOpenVDD(PSZ);
  927. VOID        VDHENTRY VDHCloseVDD(HVDD);
  928. BOOL        VDHENTRY VDHRequestVDD(HVDD,HVDM,ULONG,PVOID,PVOID);
  929. ULONG       VDHENTRY VDHGetError(VOID);
  930. VOID        VDHENTRY VDHSetError(ULONG);
  931. BOOL        VDHENTRY VDHInstallUserHook(ULONG,PUSERHOOK);
  932. BOOL        VDHENTRY VDHEnumerateVDMs(PENUMHOOK,ULONG);
  933. HVDM        VDHENTRY VDHHandleFromSGID(SGID);
  934. HVDM        VDHENTRY VDHHandleFromPID(PID);
  935. ULONG       VDHENTRY VDHQuerySysValue(HVDM,ULONG);
  936. VOID        VDHENTRY VDHPutSysValue(ULONG,ULONG);
  937. BOOL        VDHENTRY VDHOpen(PSZ,PHFILE,PULONG,ULONG,ULONG,ULONG,ULONG,PVOID);
  938. VOID        VDHENTRY VDHClose(HFILE);
  939. ULONG       VDHENTRY VDHRead(HFILE,PVOID,ULONG);
  940. ULONG       VDHENTRY VDHWrite(HFILE,PVOID,ULONG);
  941. ULONG       VDHENTRY VDHSeek(HFILE,ULONG,ULONG);
  942. BOOL        VDHENTRY VDHDevIOCtl(HFILE,ULONG,ULONG,PVOID,ULONG,PULONG,PVOID,ULONG,PULONG);
  943. BOOL        VDHENTRY VDHFSCtl(PVOID,ULONG,PULONG,PVOID,ULONG,PULONG,ULONG,PSZ,HFILE,ULONG);
  944. BOOL        VDHENTRY VDHPhysicalDisk(ULONG,PULONG,ULONG,PULONG,ULONG);
  945. ULONG       VDHENTRY VDHViewHandle(HFILE,USHORT);
  946. ULONG       VDHENTRY VDHJFNFromHandle(HFILE);
  947.  
  948.  
  949. //      Semaphore Function Prototypes
  950.  
  951. BOOL        VDHENTRY VDHCreateSem(PHVDHSEM, ULONG);
  952. VOID        VDHENTRY VDHDestroySem(HVDHSEM);
  953. VOID        VDHENTRY VDHQuerySem(HVDHSEM,PVDHSEMSTATE);
  954. VOID        VDHENTRY VDHResetEventSem(HVDHSEM);
  955. VOID        VDHENTRY VDHPostEventSem(HVDHSEM);
  956. BOOL        VDHENTRY VDHWaitEventSem(HVDHSEM,ULONG);
  957. BOOL        VDHENTRY VDHRequestMutexSem(HVDHSEM,ULONG);
  958. VOID        VDHENTRY VDHReleaseMutexSem(HVDHSEM);
  959.  
  960. //      Timer Function Prototypes
  961.  
  962. VOID        VDHENTRY VDHArmTimerHook(HHOOK,ULONG,HVDM);
  963. BOOL        VDHENTRY VDHDisarmTimerHook(HHOOK);
  964.  
  965. //      Sound Function Prototypes
  966.  
  967. BOOL        VDHENTRY VDHDevBeep(ULONG, ULONG);
  968.  
  969. //      Property Function Prototypes
  970.  
  971. BOOL        VDHENTRY VDHRegisterProperty(PSZ,PSZ,ULONG,VPTYPE,VPORD,ULONG,PVOID,PVOID,PFNVDHRP);
  972. ULONG       VDHENTRY VDHQueryProperty(PSZ);
  973. BOOL        VDHENTRY VDHDecodeProperty(PPSZ,PULONG,PULONG,ULONG);
  974.  
  975. //      Process Control Function Prototypes
  976.  
  977. BOOL        VDHENTRY VDHPopup(PSZZ,ULONG,ULONG,PULONG,ULONG,PSZ);
  978. VOID        VDHENTRY VDHKillVDM(HVDM);
  979. VOID        VDHENTRY VDHHaltSystem(VOID);
  980. VOID        VDHENTRY VDHSetPriority(HVDM,ULONG,LONG);
  981. BOOL        VDHENTRY VDHFreezeVDM(HVDM);
  982. VOID        VDHENTRY VDHThawVDM(HVDM);
  983. BOOL        VDHENTRY VDHIsVDMFrozen(HVDM);
  984. VOID        VDHENTRY VDHYield(BOOL);
  985. BOOL        VDHENTRY VDHCreateThread(PVDDTID, PVDDTHREAD);
  986. VOID        VDHENTRY VDHExitThread(ULONG);
  987. BOOL        VDHENTRY VDHInstallFaultHandler(PVOID);
  988.  
  989. //      Perfview Prototypes
  990.  
  991. INT         VDHENTRY VDHRegisterPerfCtrs(PBYTE,PBYTE,ULONG);
  992.  
  993. //      Miscellaneous Function Prototypes (for kernel debugging only)
  994.  
  995. VOID        VDHENTRY VDHAssertTask(VOID);
  996. VOID        VDHENTRY VDHAssertVDMTask(VOID);
  997. VOID        VDHENTRY VDHAssertTaskOnly(VOID);
  998. VOID        VDHENTRY VDHAssertVDMTaskOnly(VOID);
  999. VOID        VDHENTRY VDHAssertInitOnly(VOID);
  1000. VOID        VDHENTRY VDHCheckHVDM(HVDM);
  1001. INT         CENTRY   VDHPanic(PCHAR, ...);
  1002. VOID        VDHENTRY VDHSetTimer0(ULONG);
  1003. ULONG       VDHENTRY VDHSetMaxFileHandles(ULONG);
  1004.  
  1005.  
  1006. #define     PANIC VDHPanic
  1007.  
  1008.  
  1009.  
  1010. //;*** PANICXX - Issue a panic if condition XX is set
  1011. //;
  1012. //;   ENTRY
  1013. //;       msg    quoted error message
  1014. //;
  1015. //;   EXAMPLES
  1016. //;       PANIC  <"VPICSetVIRR: invalid handle %u">,<h>
  1017. //;
  1018. //;     or
  1019. //;
  1020. //;       IFDEF  VDDSTRICT
  1021. //;       or     ebx,ebx
  1022. //;       PANICZ <"em86ReflectInt: null pointer">
  1023. //;       ENDIF
  1024. //;
  1025. //
  1026. //?PANIC  macro   cond,msg,args
  1027. //        local   l1,szMsg
  1028. //        ifndef  VDHPanic
  1029. //        DefCode IMPORT,GLOBAL,C
  1030. //        DefFn   VDHPanic
  1031. //        EndCode
  1032. //        endif
  1033. //        ifnb    <cond>
  1034. //        j&cond  short l1
  1035. //        endif
  1036. //        ?a substr <msg>,1,1
  1037. //        % ifidn <?a>,<">
  1038. //        DefData LOCAL,CONST,C
  1039. //        SZ      szMsg,<msg,0>
  1040. //        EndData
  1041. //        CallFn  VDHPanic,<FLAToffset szMsg>,args
  1042. //        else
  1043. //        CallFn  VDHPanic,<FLAToffset msg>,args
  1044. //        endif
  1045. //        ifnb    <cond>
  1046. //l1:
  1047. //        endif
  1048. //        endm
  1049. //
  1050. //PANIC   equ     <?PANIC ,>
  1051. //PANICC  equ     <?PANIC nc,>
  1052. //PANICNC equ     <?PANIC c,>
  1053. //PANICZ  equ     <?PANIC nz,>
  1054. //PANICNZ equ     <?PANIC z,>
  1055. //PANICE  equ     <?PANIC ne,>
  1056. //PANICNE equ     <?PANIC e,>
  1057. //PANICB  equ     <?PANIC ae,>
  1058. //PANICBE equ     <?PANIC a,>
  1059. //PANICA  equ     <?PANIC be,>
  1060. //PANICAE equ     <?PANIC b,>
  1061.  
  1062.  
  1063. #ifdef  VDDDEBUG
  1064.  
  1065. INT     CENTRY   printf(PCHAR, ...);
  1066.  
  1067. //c-begin
  1068. #define PRINTDEBUG  printf
  1069. //c-end
  1070.  
  1071. //masm-begin
  1072. //PRINTDEBUG macro msg,args
  1073. //        local   szMsg
  1074. //        ifndef  printf
  1075. //        DefCode IMPORT,GLOBAL,C
  1076. //        DefFn   printf
  1077. //        EndCode
  1078. //        endif
  1079. //        ?a substr <msg>,1,1
  1080. //        % ifidn <?a>,<">
  1081. //        DefData LOCAL,CONST,C
  1082. //        SZ      szMsg,<msg,0>
  1083. //        EndData
  1084. //        CallFn  printf,< <FLAToffset szMsg>,<args> >
  1085. //        else
  1086. //        CallFn  printf,< <FLAToffset msg>,<args> >
  1087. //        endif
  1088. //        endm
  1089. //masm-end
  1090.  
  1091. #else
  1092.  
  1093.  
  1094. #define PRINTDEBUG(x)
  1095.  
  1096.  
  1097. //masm-begin
  1098. //PRINTDEBUG macro msg
  1099. //      endm
  1100. //masm-end
  1101.  
  1102. #endif
  1103.