home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / DDJ9403A.ZIP / UC394.ZIP / RINGO.H < prev    next >
Text File  |  1993-12-04  |  6KB  |  192 lines

  1. /***************************************************
  2. RINGO.H -- VMM and RINGO defines and functions
  3. by Alex Shmidt. Nov, 1993
  4. ***************************************************/
  5.  
  6. //system controls
  7. #define  Sys_Critical_Init       0x0
  8. #define  Device_Init             0x1
  9. #define  Init_Complete           0x2
  10. #define  Sys_VM_Init             0x3
  11. #define  Sys_VM_Terminate        0x4
  12. #define  System_Exit             0x5
  13. #define  Sys_Critical_Exit       0x6
  14. #define  Create_VM               0x7
  15. #define  VM_Critical_Init        0x8
  16. #define  VM_Init                 0x9
  17. #define  VM_Terminate            0xa
  18. #define  VM_Not_Executeable      0xb
  19. #define  Destroy_VM              0xc
  20. #define  VM_Suspend              0xd
  21. #define  VM_Resume               0xe
  22. #define  Set_Device_Focus        0xf
  23. #define  Begin_Message_Mode      0x10
  24. #define  End_Message_Mode        0x11
  25. #define  Reboot_Processor        0x12
  26. #define  Query_Destroy           0x13
  27. #define  Debug_Query             0x14
  28. #define  Begin_PM_App            0x15
  29. #define  End_PM_App              0x16
  30. #define  Device_Reboot_Notify    0x17
  31. #define  Crit_Reboot_Notify      0x18
  32. #define  Close_VM_Notify         0x19
  33. #define  Power_Event             0x1a
  34.  
  35. //   Flags for VM_Not_Executeable control call (passed in EDX)
  36. #define VNE_Crashed     0x1
  37. #define VNE_Nuked       0x2
  38. #define VNE_CreateFail  0x4
  39. #define VNE_CrInitFail  0x8
  40. #define VNE_InitFail    0x10
  41. #define VNE_Closed      0x20
  42.  
  43. // Flags for Begin_PM_App (passed in EDX)
  44. #define BPA_32_Bit      1
  45.  
  46. // Close_VM_Notify flags
  47. #define CVNF_Crit_Close  1
  48.  
  49. #define  VMStat_Exclusive        0x1
  50. #define  VMStat_Background       0x2
  51. #define  VMStat_Creating         0x4
  52. #define  VMStat_Suspended        0x8
  53. #define  VMStat_Not_Executeable  0x10
  54. #define  VMStat_PM_Exec          0x20
  55. #define  VMStat_PM_App           0x40
  56. #define  VMStat_PM_Use32         0x80
  57. #define  VMStat_VxD_Exec         0x100
  58. #define  VMStat_High_Pri_Back    0x200
  59. #define  VMStat_Blocked          0x400
  60. #define  VMStat_Awakening        0x800
  61. #define  VMStat_PageableV86      0x1000
  62. #define  VMStat_V86IntsLocked    0x2000
  63. #define  VMStat_TS_Sched         0x4000
  64. #define  VMStat_Idle             0x8000
  65. #define  VMStat_Closing          0x10000
  66.  
  67. typedef struct {
  68.    DWORD pgphys;
  69.    WORD  pgatr;
  70.    WORD  pgtype;
  71. }PGMAP, far *LPPGMAP;
  72.  
  73. typedef struct {
  74.    DWORD base;       // descriptor base
  75.    DWORD limit;      // descriptor limit
  76.    BYTE  dpl;        // descriptor dpl
  77.    BYTE  type;       // access type field
  78.    BYTE  gran;       // granularity byte
  79. }SEGDESCMAP, far *LPSEGDESCMAP;
  80.  
  81. typedef struct {
  82.    WORD  pdir;
  83.    WORD  ptab;
  84.    WORD  offs;
  85. }LINMAP, far *LPLINMAP;
  86.  
  87. // Global Descriptor Table
  88. typedef struct {
  89.    WORD  GDTRL;      /* GDT limit */
  90.    DWORD GDTRB;      /* GDT base */
  91. }GDTSTRUCT, far *LPGDTSTRUCT;
  92.  
  93. // Interrupt Descriptor Table
  94. typedef struct {
  95.    WORD  IDTRL;      /* IDT limit */
  96.    DWORD IDTRB;      /* IDT base */
  97. }IDTSTRUCT, far *LPIDTSTRUCT;
  98.  
  99. // Local Descriptor Table
  100. typedef struct {
  101.    WORD  LDTRS;      /* LDT register (GDT selector) */
  102.    DWORD LDTB;       /* LDT base */
  103.    WORD  LDTSL;      /* LDT limit */
  104.    DWORD LDTSR;      /* LDT selector access rights */
  105. }LDTSTRUCT, far * LPLDTSTRUCT;
  106.  
  107. // Task Register and Task State Segment
  108. typedef struct {
  109.    WORD  TREG;       /* task register */
  110.    DWORD TSSB;       /* TSS base */
  111.    WORD  TSSL;       /* TSS limit */
  112.    DWORD TSSR;       /* TSS access rights */
  113. }TSSSTRUCT, far *LPTSSSTRUCT;
  114.  
  115. // Control Registers
  116. typedef struct {
  117.    DWORD CR0R;       /* CR0 */
  118.    DWORD CR2R;       /* CR2 */
  119.    DWORD CR3R;       /* CR3 */
  120.    DWORD PDIRL;      /* Page Dir linear address */
  121. }CRSTRUCT, far *LPCRSTRUCT;
  122.  
  123. // Debug Registers
  124. typedef struct {
  125.    DWORD DR0R;       /* DR0 */
  126.    DWORD DR1R;       /* DR1 */
  127.    DWORD DR2R;       /* DR2 */
  128.    DWORD DR3R;       /* DR3 */
  129.    DWORD DR6R;       /* DR6 */
  130.    DWORD DR7R;       /* DR7 */
  131. }DRSTRUCT, far *LPDRSTRUCT;
  132.  
  133. // communicate with RINGO through this structure
  134. typedef struct {
  135.    GDTSTRUCT   SysGdt;
  136.    LDTSTRUCT   SysLdt;
  137.    IDTSTRUCT   SysIdt;
  138.    TSSSTRUCT   SysTss;
  139.    CRSTRUCT    SysCr;
  140.    DRSTRUCT    SysDr;
  141.    DWORD       VxDRoot;
  142.    WORD        VMMVer;
  143.    DWORD       VMMRev;
  144.    WORD        VMCount;
  145.    DWORD       VMHndl[10];
  146. }SYSTEMSTRUCT, *PSYSTEMSTRUCT, far *LPSYSTEMSTRUCT;
  147.  
  148. // Device Descriptor Block
  149. typedef struct {
  150.    DWORD DDB_Next;
  151.    WORD  DDB_SDK_Version;
  152.    WORD  DDB_Req_Device_Number;
  153.    BYTE  DDB_Dev_Major_Version;
  154.    BYTE  DDB_Dev_Minor_Version;
  155.    WORD  DDB_Flags;
  156.    BYTE  DDB_Name[8];
  157.    DWORD DDB_Init_Order;
  158.    DWORD DDB_Control_Proc;
  159.    DWORD DDB_V86_API_Proc;
  160.    DWORD DDB_PM_API_Proc;
  161.    void  (far *DDB_V86_API_CSIP)();
  162.    void  (far *DDB_PM_API_CSIP)();
  163.    DWORD DDB_Reference_Data;
  164.    DWORD DDB_Service_Table_Ptr;
  165.    DWORD DDB_Service_Table_Size;
  166. }DDB, far *LPDDB;
  167.  
  168. // Documented VM fields
  169. typedef struct {
  170.    DWORD CB_VM_Status;
  171.    DWORD CB_High_Linear;
  172.    DWORD CB_Client_Pointer;
  173.    DWORD CB_VMID;
  174. }VM, far *LPVM;
  175.  
  176. // WM_RINGO message structure
  177. typedef struct {
  178.    DWORD msg_VM;
  179.    DWORD msg_Param1;
  180.    DWORD msg_Param2;
  181.    DWORD msg_Param3;
  182. }MSGSTRUC, far *LPMSGSTRUC;
  183.  
  184. typedef DWORD PAGE, far *LPPAGE;
  185.  
  186. // RINGO's exports
  187. DWORD WINAPI GetSys (LPSYSTEMSTRUCT);
  188. DWORD WINAPI MapPhysToLinear (DWORD, WORD);
  189. void  WINAPI GateRegisterWindow (HWND);
  190. void  WINAPI GateUnregisterWindow (HWND);
  191. void  WINAPI NoDosBox (WORD);
  192.