|
|
1.1 ! root 1: #include <dpmi.h> ! 2: ! 3: //#include "types.h" ! 4: typedef unsigned char BYTE; ! 5: typedef unsigned short WORD; ! 6: typedef unsigned long DWORD; ! 7: ! 8: //#include "mgenord.h" ! 9: #define MGENVXD_REGISTER_ORD 1 ! 10: #define MGENVXD_GETMEM_ORD 2 ! 11: #define MGENVXD_DEREGISTER_ORD 3 ! 12: #define MGENVXD_WAKEUP_ORD 4 ! 13: #define MGENVXD_MAKEDQS_ORD 5 ! 14: ! 15: ! 16: // Virtual 8086 API Ordinals ! 17: #define V86API_GETSELECTOR16_ORD (1) ! 18: #define V86API_GETSELECTOR32_ORD (2) ! 19: #define V86API_GETFLAT32_ORD (3) ! 20: #define V86API_MOVERP_ORD (6) ! 21: #define V86API_MOVEPR_ORD (7) ! 22: #define V86API_POST_ORD (8) ! 23: #define V86API_INIT_ORD (9) ! 24: #define V86API_UNINIT_ORD (10) ! 25: #define V86API_INSERTKEY_ORD (11) ! 26: #define V86API_REMOVEHOTKEY_ORD (12) ! 27: #define V86API_INSTALLHOTKEY_ORD (13) ! 28: #define V86API_HOOKINT48_ORD (14) ! 29: #define V86API_WAKEUPDLL_ORD (15) ! 30: ! 31: #define DPMIAPI_GETFLAT32_ORD (1) ! 32: #define DPMIAPI_POST_WINDOWS_ORD (2) ! 33: // these are DPMI functions. Make sure they don't clash with the ! 34: // other MGENVXD_XXXX functions above, or the DPMI functions! ! 35: #define MGENVXD_GETQUEUECTR_ORD 6 ! 36: #define MGENVXD_MOVENODE_ORD 7 ! 37: #define MGENVXD_GETNODE_ORD 8 ! 38: #define MGENVXD_FLUSHNODE_ORD 9 ! 39: #define MGENVXD_MCOUNT_ORD 10 ! 40: #define MGENVXD_MASTERNODE_ORD 11 ! 41: #define MGENVXD_SANITYCHECK_ORD 12 ! 42: #define MGENVXD_WAKEUPDLL_ORD 13 ! 43: #define MGENVXD_WAIT_ORD 14 ! 44: ! 45: // ! 46: #define HWND_OFFSET (0) ! 47: #define UMSG_OFFSET (1) ! 48: #define SIZEREQUEST_OFFSET (2) ! 49: #define HVXD_OFFSET (3) ! 50: #define DATUM_OFFSET (4) ! 51: #define SLOT_OFFSET (5) ! 52: #define SIZEGIVEN_OFFSET (6) ! 53: #define SELECTOR32_OFFSET (7) ! 54: #define SELECTOR16_OFFSET (8) ! 55: ! 56: //#include "magic.h" ! 57: #define MGENVXD_DEVICE_ID 0x18AA ! 58: ! 59: //#include "rtq.h" ! 60: #define RTQ_NODE struct rtq_node ! 61: ! 62: RTQ_NODE ! 63: { ! 64: RTQ_NODE *self; // Ring zero address of this node ! 65: RTQ_NODE *left; // Ring zero address of preceding node ! 66: RTQ_NODE *right; // Ring zero address of succeding node ! 67: BYTE * rtqDatum; // Ring 3 Datum of Buffer (start of preface) ! 68: BYTE * rtqInsert; // Ring 3 insertion position ! 69: WORD rtqLen; // Length of buffer, excluding preface ! 70: WORD rtqUpCtr; // Up Counter of bytes used so far ! 71: WORD rtqQCtr; // number of nodes attached ! 72: WORD padding; // DWORD alignment ! 73: }; ! 74: ! 75: #define RTQ_PARAM_MOVENODE struct rtq_param_movenode ! 76: RTQ_PARAM_MOVENODE ! 77: { ! 78: WORD rtqFromDQ; ! 79: WORD rtqToDQ; ! 80: }; ! 81: ! 82: RTQ_NODE* rtq_fetch(RTQ_NODE*, RTQ_NODE*); // To, From ! 83: ! 84: int _int86(int vector, __dpmi_regs *iregs, __dpmi_regs *oregs); ! 85: ! 86: #define CHUNNEL_INT 0x48 ! 87: ! 88: #define int386 _int86 ! 89: #define REGISTERS __dpmi_regs ! 90: ! 91: void ! 92: Yield(void) ! 93: { ! 94: __dpmi_yield(); ! 95: } ! 96: ! 97: void ! 98: PostWindowsMessage(void) ! 99: { ! 100: REGISTERS regs; ! 101: ! 102: regs.d.eax = DPMIAPI_POST_WINDOWS_ORD << 16 | MGENVXD_DEVICE_ID; ! 103: regs.d.ebx = 0; ! 104: regs.d.ecx = 0; ! 105: int386(CHUNNEL_INT, ®s, ®s); ! 106: } ! 107: ! 108: int ! 109: MGenWait(void) ! 110: { ! 111: REGISTERS regs; ! 112: ! 113: regs.d.eax = MGENVXD_WAIT_ORD << 16 | MGENVXD_DEVICE_ID; ! 114: int386(CHUNNEL_INT, ®s, ®s); ! 115: return regs.d.eax; ! 116: } ! 117: ! 118: int MGenGetQueueCtr(int qNo) ! 119: { ! 120: REGISTERS regs; ! 121: ! 122: regs.d.eax = MGENVXD_GETQUEUECTR_ORD << 16 | MGENVXD_DEVICE_ID; ! 123: regs.d.ebx = qNo; ! 124: int386(CHUNNEL_INT, ®s, ®s); ! 125: ! 126: return regs.d.eax; ! 127: } ! 128: ! 129: RTQ_NODE *MGenMoveTo(int qFrom, int qTo) ! 130: { ! 131: REGISTERS regs; ! 132: ! 133: regs.d.eax = MGENVXD_MOVENODE_ORD << 16 | MGENVXD_DEVICE_ID; ! 134: regs.d.ebx = qFrom; ! 135: regs.d.ecx = qTo; ! 136: int386(CHUNNEL_INT, ®s, ®s); ! 137: ! 138: return (RTQ_NODE *) regs.d.eax; ! 139: } ! 140: ! 141: RTQ_NODE *MGenGetNode(int q) ! 142: { ! 143: REGISTERS regs; ! 144: ! 145: regs.d.eax = MGENVXD_GETNODE_ORD << 16 | MGENVXD_DEVICE_ID; ! 146: regs.d.ebx = q; ! 147: int386(CHUNNEL_INT, ®s, ®s); ! 148: ! 149: return (RTQ_NODE *) regs.d.eax; ! 150: } ! 151: ! 152: RTQ_NODE *MGenGetMasterNode(unsigned *size) ! 153: { ! 154: REGISTERS regs; ! 155: ! 156: regs.d.eax = MGENVXD_MASTERNODE_ORD << 16 | MGENVXD_DEVICE_ID; ! 157: int386(CHUNNEL_INT, ®s, ®s); ! 158: *size = regs.d.ecx; ! 159: ! 160: return (RTQ_NODE *) regs.d.eax; ! 161: } ! 162: ! 163: RTQ_NODE *MGenFlushNodes(int qFrom, int qTo) ! 164: { ! 165: REGISTERS regs; ! 166: ! 167: regs.d.eax = MGENVXD_FLUSHNODE_ORD << 16 | MGENVXD_DEVICE_ID; ! 168: regs.d.ebx = qFrom; ! 169: regs.d.ecx = qTo; ! 170: int386(CHUNNEL_INT, ®s, ®s); ! 171: ! 172: return (RTQ_NODE *) regs.d.eax; ! 173: } ! 174: ! 175: int MGenMCount(unsigned lowerOrderBits, unsigned upperOrderBits) ! 176: { ! 177: REGISTERS regs; ! 178: ! 179: regs.d.eax = MGENVXD_MCOUNT_ORD << 16 | MGENVXD_DEVICE_ID; ! 180: regs.d.ebx = lowerOrderBits; ! 181: regs.d.ecx = upperOrderBits; ! 182: int386(CHUNNEL_INT, ®s, ®s); ! 183: ! 184: return regs.d.eax; ! 185: } ! 186: ! 187: int MGenSanityCheck(void) ! 188: { ! 189: REGISTERS regs; ! 190: ! 191: regs.d.eax = MGENVXD_SANITYCHECK_ORD << 16 | MGENVXD_DEVICE_ID; ! 192: int386(CHUNNEL_INT, ®s, ®s); ! 193: ! 194: return regs.d.eax; ! 195: } ! 196: ! 197: void MGenWakeupDll(void) ! 198: { ! 199: REGISTERS regs; ! 200: ! 201: regs.d.eax = MGENVXD_WAKEUPDLL_ORD << 16 | MGENVXD_DEVICE_ID; ! 202: int386(CHUNNEL_INT, ®s, ®s); ! 203: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.