home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v1.zip / DDKX86 / H / VDMM.H < prev    next >
Text File  |  1995-04-14  |  42KB  |  1,097 lines

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