home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cdisk.zip / VDD / VDMM.H < prev    next >
Text File  |  1993-02-17  |  40KB  |  1,064 lines

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