|
|
1.1 ! root 1: /* IOSDCLS.H -- C-language declarations for IOS drivers ! 2: Copyright (C) 1995 by Walter Oney ! 3: All rights reserved ! 4: */ ! 5: ! 6: #define WANTVXDWRAPS ! 7: #include <basedef.h> ! 8: #include <vmm.h> ! 9: ! 10: #include <aep.h> ! 11: #include <blockdev.h> ! 12: #include <config.h> ! 13: #include <dcb.h> ! 14: #include <ddb.h> ! 15: #include <drp.h> ! 16: #include <dvt.h> ! 17: #include <ida.h> ! 18: #include <ilb.h> ! 19: #include <ior.h> ! 20: #include <iop.h> ! 21: #include <irs.h> ! 22: #include <isp.h> ! 23: #include <ivt.h> ! 24: #include <sgd.h> ! 25: #include <vrp.h> ! 26: ! 27: #undef _IRS_H /* suppress extra IOS_Requestor_Service in VXDWRAPS */ ! 28: #include <vxdwraps.h> ! 29: ! 30: /* Some annoying inconsistencies in typedef spelling: */ ! 31: ! 32: typedef pIOP PIOP; ! 33: typedef pDDB PDDB; ! 34: ! 35: /* ! 36: IOS.H is useless for C-language users, so do what it should have done: ! 37: */ ! 38: ! 39: #define IOS_DEVICE_ID 0x0010 ! 40: ! 41: #define IOS_Service Declare_Service ! 42: #pragma warning(disable:4003) /* not enough parameters */ ! 43: ! 44: Begin_Service_Table(IOS) ! 45: ! 46: IOS_Service(IOS_Get_Version, LOCAL) ! 47: IOS_Service(IOS_BD_Register_Device) ! 48: IOS_Service(IOS_Find_Int13_Drive) ! 49: IOS_Service(IOS_Get_Device_List) ! 50: IOS_Service(IOS_SendCommand) ! 51: IOS_Service(IOS_BD_Command_Complete) ! 52: IOS_Service(IOS_Synchronous_Command) ! 53: IOS_Service(IOS_Register) ! 54: IOS_Service(IOS_Requestor_Service) ! 55: IOS_Service(IOS_Exclusive_Access) ! 56: IOS_Service(IOS_Send_Next_Command) ! 57: IOS_Service(IOS_Set_Async_Time_Out) ! 58: IOS_Service(IOS_Signal_Semaphore_No_Switch) ! 59: IOS_Service(IOSIdleStatus) ! 60: IOS_Service(IOSMapIORSToI24) ! 61: IOS_Service(IOSMapIORSToI21) ! 62: ! 63: #ifdef INITLOG ! 64: IOS_Service(PrintLog) ! 65: #endif ! 66: ! 67: End_Service_Table(IOS) ! 68: ! 69: #pragma warning(default:4003) ! 70: ! 71: #define IOSEA_LOCK_THREAD (1 << 8) ! 72: ! 73: #ifndef Not_VxD ! 74: #pragma warning(disable:4035) /* missing return value */ ! 75: #define NAKED __declspec(naked) ! 76: ! 77: ! 78: ! 79: ! 80: ! 81: VXDINLINE VOID IOS_SendCommand(PIOR ior, PDCB bdd) ! 82: { ! 83: _asm mov esi, ior ! 84: _asm mov edi, bdd ! 85: VxDCall(IOS_SendCommand) ! 86: } ! 87: ! 88: VXDINLINE VOID IOS_BD_Command_Complete(PIOR ior) ! 89: { ! 90: _asm mov esi, ior ! 91: VxDCall(IOS_BD_Command_Complete) ! 92: } ! 93: ! 94: ! 95: ! 96: VXDINLINE VOID IOS_Register(PDRP drp) ! 97: { ! 98: _asm push drp ! 99: VxDCall(IOS_Register) ! 100: _asm add esp,4 ! 101: } ! 102: ! 103: ! 104: ! 105: /* ! 106: Interfaces to routines via IOS linkage block (ILB). ! 107: THESE DEFINITIONS ASSUME YOU HAVE AN ILB NAMED "theILB" ! 108: */ ! 109: ! 110: #ifndef FIELDOFFSET ! 111: #define FIELDOFFSET(type, field) ((DWORD)(&((type *)0)->field)) ! 112: #endif ! 113: ! 114: extern ILB theILB; ! 115: ! 116: VXDINLINE PIOP NAKED IlbDequeueIop(PDCB dcb) ! 117: { ! 118: _asm jmp [theILB.ILB_dequeue_iop] ! 119: } ! 120: ! 121: VXDINLINE VOID NAKED IlbDprintf(char *ctl, ...) ! 122: { ! 123: _asm jmp [theILB.ILB_dprintf_rtn] ! 124: } ! 125: ! 126: VXDINLINE VOID NAKED IlbEnqueueIop(PIOP iop, PDCB dcb) ! 127: { ! 128: _asm jmp [theILB.ILB_enqueue_iop] ! 129: } ! 130: ! 131: VXDINLINE DWORD NAKED IlbIntIoCriteria(PIOP iop) ! 132: { ! 133: _asm jmp [theILB.ILB_int_io_criteria_rtn] ! 134: } ! 135: ! 136: VXDINLINE VOID IlbInternalRequest(PIOP iop, PDCB dcb, PVOID calldown) ! 137: { ! 138: _asm pushad ;added ! 139: ! 140: _asm mov edi, iop ! 141: _asm mov ebx, dcb ! 142: _asm mov edx, calldown ! 143: /* (* (VOID (*)()) theILB.ILB_internal_request)(); */ ! 144: _asm call [theILB.ILB_internal_request] ! 145: ! 146: _asm popad ;added ! 147: } ! 148: ! 149: VXDINLINE DWORD NAKED IlbIoCriteria(PIOR ior) ! 150: { ! 151: _asm jmp [theILB.ILB_io_criteria_rtn] ! 152: } ! 153: ! 154: VXDINLINE DWORD NAKED IlbService(PVOID isp) /* really has (PISP) arg */ ! 155: { ! 156: _asm jmp [theILB.ILB_service_rtn] ! 157: } ! 158: ! 159: VXDINLINE VOID NAKED IlbWait10thSec() ! 160: { ! 161: _asm jmp [theILB.ILB_Wait_10th_Sec] ! 162: } ! 163: ! 164: /* ! 165: IOS Service Request wrappers. These avoid the baroque nonsense of explicitly ! 166: filling in the appropriate packet structure. TANSTAAFL, but at least it's ! 167: less typing in the program! ! 168: */ ! 169: ! 170: VXDINLINE PVOID IspAllocMem(USHORT size, USHORT type, UCHAR flags) ! 171: { ! 172: ISP_mem_alloc isp = {{ISP_ALLOC_MEM, 0}, size, 0, type, flags}; ! 173: IlbService(&isp); ! 174: if (isp.ISP_mem_a_hdr.ISP_result == 0) ! 175: return (PVOID) isp.ISP_mem_ptr; ! 176: return NULL; ! 177: } ! 178: ! 179: VXDINLINE BOOL IspAssociateDcb(PDCB dcb, CHAR drive, UCHAR flags) ! 180: { ! 181: ISP_dcb_associate isp = {{ISP_ASSOCIATE_DCB, 0}, (ULONG) dcb, drive, flags}; ! 182: IlbService(&isp); ! 183: return isp.ISP_d_a_hdr.ISP_result == 0; ! 184: } ! 185: ! 186: VXDINLINE BOOL IspBroadcastAep(PAEP aep) ! 187: { ! 188: ISP_AEP_BROADCAST isp = {{ISP_BROADCAST_AEP, 0}, aep}; ! 189: IlbService(&isp); ! 190: return isp.ISP_baep_hdr.ISP_result == 0; ! 191: } ! 192: ! 193: VXDINLINE PDCB IspCreateDcb(USHORT size) ! 194: { ! 195: ISP_dcb_create isp = {{ISP_CREATE_DCB, 0}, size}; ! 196: IlbService(&isp); ! 197: if (isp.ISP_dcb_hdr.ISP_result == 0) ! 198: return (PDCB) isp.ISP_dcb_ptr; ! 199: return NULL; ! 200: } ! 201: ! 202: VXDINLINE PDDB IspCreateDdb(USHORT size, UCHAR flags) ! 203: { ! 204: ISP_ddb_create isp = {{ISP_CREATE_DDB, 0}, size, 0, flags}; ! 205: IlbService(&isp); ! 206: if (isp.ISP_ddb_hdr.ISP_result == 0) ! 207: return (PDDB) isp.ISP_ddb_ptr; ! 208: return NULL; ! 209: } ! 210: ! 211: ! 212: ! 213: ! 214: ! 215: VXDINLINE PIOP IspCreateIop(USHORT size, ULONG delta, UCHAR flags) ! 216: { ! 217: ISP_IOP_alloc isp = {{ISP_CREATE_IOP, 0}, size, delta, 0, flags}; ! 218: IlbService(&isp); ! 219: if ( (isp.ISP_i_c_hdr.ISP_result == 0) && (isp.ISP_IOP_ptr!=NULL)) ! 220: return (PIOP) (isp.ISP_IOP_ptr + delta - FIELDOFFSET(IOP, IOP_ior)); /* ptr is to memory block, NOT the IOP (?!) */ ! 221: return NULL; ! 222: } ! 223: ! 224: ! 225: ! 226: ! 227: ! 228: VXDINLINE PIOR IspCreateIor(USHORT size, ULONG delta, UCHAR flags) ! 229: { ! 230: ISP_IOP_alloc isp = {{ISP_CREATE_IOP, 0}, size, delta, 0, flags}; ! 231: IlbService(&isp); ! 232: if (isp.ISP_i_c_hdr.ISP_result == 0) ! 233: return (PIOR) (isp.ISP_IOP_ptr + delta); /* ptr is to memory block, NOT the IOP (?!) */ ! 234: return NULL; ! 235: } ! 236: ! 237: VXDINLINE BOOL IspDeallocDdb(PDDB ddb) ! 238: { ! 239: ISP_DDB_DEALLOC isp = {{ISP_DEALLOC_DDB, 0}, (ULONG) ddb, theILB.ILB_dvt}; ! 240: IlbService(&isp); ! 241: return isp.ISP_ddb_d_hdr.ISP_result == 0; ! 242: } ! 243: ! 244: VXDINLINE BOOL IspDeallocMem(PVOID p) ! 245: { ! 246: ISP_mem_dealloc isp = {{ISP_DEALLOC_MEM, 0}, (ULONG) p}; ! 247: IlbService(&isp); ! 248: return isp.ISP_mem_da_hdr.ISP_result == 0; ! 249: } ! 250: ! 251: VXDINLINE BOOL IspDeleteLdmEntry(ULONG drive) ! 252: { ! 253: ISP_FIND_LDM isp = {{ISP_DELETE_LDM_ENTRY, 0}, drive}; ! 254: IlbService(&isp); ! 255: return isp.ISP_fldm_hdr.ISP_result == 0; ! 256: } ! 257: ! 258: VXDINLINE BOOL IspDestroyDcb(PDCB dcb) ! 259: { ! 260: ISP_DCB_DESTROY isp = {{ISP_DESTROY_DCB, 0}, (ULONG) dcb}; ! 261: IlbService(&isp); ! 262: return isp.ISP_ddb_d_hdr.ISP_result == 0; /* not a typo! it's really spelled "ddb_d_hdr" instead of "dcb_d_hdr" */ ! 263: } ! 264: ! 265: VXDINLINE BOOL IspDeviceArrived(PDCB dcb, ULONG flags) ! 266: { ! 267: ISP_DEV_ARRIVED isp = {{ISP_DEVICE_ARRIVED, 0}, dcb, flags}; ! 268: IlbService(&isp); ! 269: return isp.ISP_d_arrived_hdr.ISP_result == 0; ! 270: } ! 271: ! 272: VXDINLINE BOOL IspDeviceRemoved(PDCB dcb, ULONG flags) ! 273: { ! 274: ISP_DEV_REMOVED isp = {{ISP_DEVICE_REMOVED, 0}, dcb, flags}; ! 275: IlbService(&isp); ! 276: return isp.ISP_d_removed_hdr.ISP_result == 0; ! 277: } ! 278: ! 279: VXDINLINE BOOL IspDisassociateDcb(ULONG drive) ! 280: { ! 281: /* {{function result} ULONG} */ ! 282: ISP_DISASSOC_DCB isp = {{ISP_DISASSOCIATE_DCB, 0}, drive}; ! 283: IlbService(&isp); ! 284: return isp.ISP_dis_dcb_hdr.ISP_result == 0; ! 285: } ! 286: ! 287: VXDINLINE UCHAR IspDriveLetterPick(PDCB dcb, UCHAR flags) ! 288: { ! 289: ISP_pick_drive_letter isp = {{ISP_DRIVE_LETTER_PICK, 0}, dcb, {0, 0}, flags}; ! 290: IlbService(&isp); ! 291: if (isp.ISP_p_d_l_hdr.ISP_result == 0) ! 292: return isp.ISP_p_d_l_letter[0]; ! 293: return 0; ! 294: } ! 295: ! 296: VXDINLINE UCHAR IspDriveLetterPickPref(PDCB dcb, UCHAR flags,UCHAR preffered) ! 297: { ! 298: ! 299: ISP_pick_drive_letter isp = {{ISP_DRIVE_LETTER_PICK, 0}, dcb, {0, 0}, flags}; ! 300: isp.ISP_p_d_l_letter[0]=preffered; /* +'A'; */ ! 301: isp.ISP_p_d_l_letter[1]=preffered+1; /* 'A'; */ ! 302: IlbService(&isp); ! 303: if (isp.ISP_p_d_l_hdr.ISP_result == 0) ! 304: return isp.ISP_p_d_l_letter[0]; ! 305: return 255; ! 306: } ! 307: ! 308: ! 309: ! 310: ! 311: VXDINLINE PVOID IspFindLdmEntry(ULONG drive) ! 312: { ! 313: ISP_FIND_LDM isp = {{ISP_DELETE_LDM_ENTRY, 0}, drive}; ! 314: if (isp.ISP_fldm_hdr.ISP_result == 0) ! 315: return isp.ISP_fldm_pldm; ! 316: return NULL; ! 317: } ! 318: ! 319: VXDINLINE PDCB IspGetDcb(ULONG drive) ! 320: { ! 321: ISP_dcb_get isp = {{ISP_GET_DCB, 0}, 0, drive}; ! 322: IlbService(&isp); ! 323: if (isp.ISP_g_d_hdr.ISP_result == 0) ! 324: return (PDCB) isp.ISP_g_d_dcb; ! 325: return NULL; ! 326: } ! 327: ! 328: VXDINLINE PDCB IspGetFirstNextDcb(PDCB dcb, BYTE type) ! 329: { ! 330: ISP_GET_FRST_NXT_DCB isp = {{ISP_GET_FIRST_NEXT_DCB, 0}, (ULONG) dcb, 0, type}; ! 331: IlbService(&isp); ! 332: if (isp.ISP_gfnd_hdr.ISP_result == 0) ! 333: return (PDCB) isp.ISP_gfnd_found_dcb; ! 334: return NULL; ! 335: } ! 336: ! 337: VXDINLINE BOOL IspInsertCalldown(PDCB dcb, VOID (*calldown)(PIOP), PDDB ddb, USHORT expand, DWORD demand, UCHAR loadgroup) ! 338: { ! 339: ISP_calldown_insert isp = {{ISP_INSERT_CALLDOWN, 0}, (ULONG) dcb, (PVOID) calldown, (ULONG) ddb, expand, demand, loadgroup}; ! 340: IlbService(&isp); ! 341: return isp.ISP_i_cd_hdr.ISP_result == 0; ! 342: } ! 343: ! 344: VXDINLINE ULONG IspQueryMatchingDcbs(PDCB dcb) ! 345: { ! 346: ISP_QUERY_MATCH isp = {{ISP_QUERY_MATCHING_DCBS, 0}, dcb}; ! 347: IlbService(&isp); ! 348: if (isp.ISP_q_match_hdr.ISP_result == 0) ! 349: return isp.ISP_q_match_drives; ! 350: return 0; ! 351: } ! 352: ! 353: VXDINLINE BOOL IspRegistryRead(PDCB dcb, char* keyname, PDWORD ptype, PDWORD psize, PVOID buffer) ! 354: { ! 355: ISP_read_registry isp = {{ISP_REGISTRY_READ, 0}, dcb, keyname, ptype, psize, buffer}; ! 356: IlbService(&isp); ! 357: return isp.ISP_r_r_hdr.ISP_result == 0; ! 358: } ! 359: ! 360: VXDINLINE BOOL IspQueryRemoveDcb(PDCB dcb, ULONG flags) ! 361: { ! 362: ISP_QUERY_REMOVE isp = {{ISP_QUERY_REMOVE_DCB, 0}, dcb, flags}; ! 363: IlbService(&isp); ! 364: return isp.ISP_q_remove_hdr.ISP_result == 0; ! 365: } ! 366: ! 367: ! 368: ! 369: VXDINLINE BOOL SaveClientState(CLIENT_STRUCT * s) ! 370: { ! 371: ! 372: ! 373: _asm push edi ! 374: _asm mov edi,[s] ! 375: ! 376: VxDCall (Save_Client_State) ! 377: ! 378: _asm pop edi ! 379: ! 380: return FALSE; ! 381: } ! 382: ! 383: ! 384: ! 385: VXDINLINE BOOL RestoreClientState(CLIENT_STRUCT * s) ! 386: { ! 387: ! 388: ! 389: _asm push esi ! 390: _asm mov esi,[s] ! 391: ! 392: VxDCall (Restore_Client_State) ! 393: ! 394: _asm pop esi ! 395: ! 396: return FALSE; ! 397: } ! 398: ! 399: ! 400: #pragma warning(default:4035) ! 401: #endif /* Not_VxD */ ! 402:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.