Changeset 4259 for trunk/src/kernel32/hmdisk.cpp
- Timestamp:
- Sep 14, 2000, 9:08:36 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/hmdisk.cpp
r4257 r4259 1 /* $Id: hmdisk.cpp,v 1. 2 2000-09-13 21:14:18sandervl Exp $ */1 /* $Id: hmdisk.cpp,v 1.3 2000-09-14 19:08:36 sandervl Exp $ */ 2 2 3 3 /* … … 10 10 * 11 11 */ 12 #define INCL_DOSPROFILE 13 #define INCL_DOSDEVICES 14 #define INCL_DOSDEVIOCTL 15 #define INCL_GPI 16 #define INCL_DOSFILEMGR /* File Manager values */ 17 #define INCL_DOSERRORS /* DOS Error values */ 18 #define INCL_DOSPROCESS /* DOS Process values */ 19 #define INCL_DOSMISC /* DOS Miscellanous values */ 20 #include <os2wrap.h> //Odin32 OS/2 api wrappers 12 #include <os2win.h> 21 13 #include <string.h> 22 14 23 #include <win32type.h>24 #include <win32api.h>25 15 #include <misc.h> 26 16 #include "hmdisk.h" … … 28 18 #include <win\winioctl.h> 29 19 #include <win\ntddscsi.h> 20 #include <win\wnaspi32.h> 21 #include <win\aspi.h> 30 22 31 23 #define DBG_LOCALLOG DBG_hmdisk … … 68 60 { 69 61 pHMHandleData->hHMHandle = hFile; 62 pHMHandleData->dwUserData = GetDriveTypeA(lpFileName); 70 63 return (NO_ERROR); 71 64 } … … 131 124 case IOCTL_SCSI_GET_ADDRESS: 132 125 { 126 HINSTANCE hInstAspi; 127 DWORD (WIN32API *GetASPI32SupportInfo)(); 128 DWORD (CDECL *SendASPI32Command)(LPSRB lpSRB); 129 DWORD numAdapters, rc; 130 SRB srb; 131 int i, j, k; 132 133 133 if(!lpOutBuffer || nOutBufferSize < 8) { 134 SetLastError(ERROR_INSUFFICIENT_BUFFER _W); //todo: right error?134 SetLastError(ERROR_INSUFFICIENT_BUFFER); //todo: right error? 135 135 return(FALSE); 136 136 } 137 //TODO: Not finished yet (need to query id + lun of drive)138 137 SCSI_ADDRESS *addr = (SCSI_ADDRESS *)lpOutBuffer; 139 138 addr->Length = sizeof(SCSI_ADDRESS); 140 139 addr->PortNumber = 0; 141 140 addr->PathId = 0; 142 addr->TargetId = 1; 143 addr->Lun = 3; 141 hInstAspi = LoadLibraryA("WNASPI32.DLL"); 142 if(hInstAspi == NULL) { 143 SetLastError(ERROR_INVALID_PARAMETER); //todo 144 return FALSE; 145 } 146 *(FARPROC *)&GetASPI32SupportInfo = GetProcAddress(hInstAspi, "GetASPI32SupportInfo"); 147 *(FARPROC *)&SendASPI32Command = GetProcAddress(hInstAspi, "SendASPI32Command"); 148 numAdapters = GetASPI32SupportInfo(); 149 if(LOBYTE(numAdapters) == 0) goto failure; 150 151 memset(&srb, 0, sizeof(srb)); 152 srb.common.SRB_Cmd = SC_HA_INQUIRY; 153 rc = SendASPI32Command(&srb); 154 155 for(i=0;i<LOBYTE(numAdapters);i++) { 156 for(j=0;j<8;j++) { 157 for(k=0;k<16;k++) { 158 memset(&srb, 0, sizeof(srb)); 159 srb.common.SRB_Cmd = SC_GET_DEV_TYPE; 160 srb.devtype.SRB_HaId = i; 161 srb.devtype.SRB_Target = j; 162 srb.devtype.SRB_Lun = k; 163 rc = SendASPI32Command(&srb); 164 if(rc == SS_COMP) { 165 if(srb.devtype.SRB_DeviceType == SS_DEVTYPE_CDROM && 166 pHMHandleData->dwUserData == DRIVE_CDROM) 167 { 168 goto done; 169 } 170 } 171 } 172 } 173 } 174 done: 175 if(rc == SS_COMP) { 176 addr->TargetId = j; 177 addr->Lun = k; 178 SetLastError(ERROR_SUCCESS); 179 } 180 else SetLastError(ERROR_FILE_NOT_FOUND); //todo 181 FreeLibrary(hInstAspi); 144 182 return TRUE; 183 failure: 184 FreeLibrary(hInstAspi); 185 SetLastError(ERROR_INVALID_PARAMETER); //todo 186 return FALSE; 145 187 } 188 146 189 case IOCTL_SCSI_RESCAN_BUS: 147 190 case IOCTL_SCSI_GET_DUMP_POINTERS: … … 152 195 } 153 196 dprintf(("HMDeviceDiskClass::DeviceIoControl: unimplemented dwIoControlCode=%08lx\n", dwIoControlCode)); 154 SetLastError( ERROR_CALL_NOT_IMPLEMENTED_W);197 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 155 198 return FALSE; 156 199 }
Note:
See TracChangeset
for help on using the changeset viewer.