Changeset 5398 for trunk/src/kernel32
- Timestamp:
- Mar 29, 2001, 7:39:51 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/hmdisk.cpp
r4588 r5398 1 /* $Id: hmdisk.cpp,v 1. 4 2000-11-14 14:27:02sandervl Exp $ */1 /* $Id: hmdisk.cpp,v 1.5 2001-03-29 17:39:51 sandervl Exp $ */ 2 2 3 3 /* … … 65 65 //TODO: PHYSICALDRIVEn!! 66 66 //****************************************************************************** 67 DWORD HMDeviceDiskClass::CreateFile (LPCSTR lpFileName, 68 PHMHANDLEDATA pHMHandleData, 69 PVOID lpSecurityAttributes, 70 PHMHANDLEDATA pHMHandleDataTemplate) 71 { 72 HFILE hFile; 73 HFILE hTemplate; 74 75 dprintf2(("KERNEL32: HMDeviceDiskClass::CreateFile %s(%s,%08x,%08x,%08x)\n", 76 lpHMDeviceName, 77 lpFileName, 78 pHMHandleData, 79 lpSecurityAttributes, 80 pHMHandleDataTemplate)); 81 82 if(strncmp(lpFileName, // "support" for local unc names 67 DWORD HMDeviceDiskClass::CreateFile (LPCSTR lpFileName, 68 PHMHANDLEDATA pHMHandleData, 69 PVOID lpSecurityAttributes, 70 PHMHANDLEDATA pHMHandleDataTemplate) 71 { 72 HFILE hFile; 73 HFILE hTemplate; 74 75 dprintf2(("KERNEL32: HMDeviceDiskClass::CreateFile %s(%s,%08x,%08x,%08x)\n", 76 lpHMDeviceName, 77 lpFileName, 78 pHMHandleData, 79 lpSecurityAttributes, 80 pHMHandleDataTemplate)); 81 82 //TODO: check in NT if CREATE_ALWAYS is allowed!! 83 if(pHMHandleData->dwCreation != OPEN_EXISTING) { 84 dprintf(("Invalid creation flags %x!!", pHMHandleData->dwCreation)); 85 return ERROR_INVALID_PARAMETER; 86 } 87 if(strncmp(lpFileName, // "support" for local unc names 83 88 "\\\\.\\", 84 89 4) == 0) 85 {90 { 86 91 lpFileName+=4; 87 } 88 89 hFile = OSLibDosCreateFile((LPSTR)lpFileName, 90 pHMHandleData->dwAccess, 91 pHMHandleData->dwShare, 92 (LPSECURITY_ATTRIBUTES)lpSecurityAttributes, 93 pHMHandleData->dwCreation, 94 pHMHandleData->dwFlags, 95 hTemplate); 96 97 if (hFile != INVALID_HANDLE_ERROR) 98 { 92 } 93 94 //Disable error popus. NT allows an app to open a cdrom/dvd drive without a disk inside 95 //OS/2 fails in that case with error ERROR_NOT_READY 96 OSLibDosDisableHardError(TRUE); 97 hFile = OSLibDosCreateFile((LPSTR)lpFileName, 98 pHMHandleData->dwAccess, 99 pHMHandleData->dwShare, 100 (LPSECURITY_ATTRIBUTES)lpSecurityAttributes, 101 pHMHandleData->dwCreation, 102 pHMHandleData->dwFlags, 103 hTemplate); 104 OSLibDosDisableHardError(FALSE); 105 106 if (hFile != INVALID_HANDLE_ERROR || GetLastError() == ERROR_NOT_READY) 107 { 108 if(hFile == INVALID_HANDLE_ERROR) SetLastError(NO_ERROR); 109 99 110 pHMHandleData->hHMHandle = hFile; 100 pHMHandleData->dwUserData = GetDriveTypeA(lpFileName);111 pHMHandleData->dwUserData = GetDriveTypeA(lpFileName); 101 112 return (NO_ERROR); 102 }103 else {104 dprintf(("CreateFile failed; error %d", GetLastError()));113 } 114 else { 115 dprintf(("CreateFile failed; error %d", GetLastError())); 105 116 return(GetLastError()); 106 }117 } 107 118 } 108 119 //****************************************************************************** … … 110 121 DWORD HMDeviceDiskClass::CloseHandle(PHMHANDLEDATA pHMHandleData) 111 122 { 112 return OSLibDosClose(pHMHandleData->hHMHandle); 123 if(pHMHandleData->hHMHandle) { 124 return OSLibDosClose(pHMHandleData->hHMHandle); 125 } 126 return TRUE; 113 127 } 114 128 //****************************************************************************** … … 119 133 LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) 120 134 { 121 switch(dwIoControlCode)122 {135 switch(dwIoControlCode) 136 { 123 137 case FSCTL_DELETE_REPARSE_POINT: 124 138 case FSCTL_DISMOUNT_VOLUME: … … 161 175 162 176 case IOCTL_SCSI_GET_ADDRESS: 163 164 165 DWORD (WIN32API *GetASPI32SupportInfo)();166 167 168 169 170 171 177 { 178 HINSTANCE hInstAspi; 179 DWORD (WIN32API *GetASPI32SupportInfo)(); 180 DWORD (CDECL *SendASPI32Command)(LPSRB lpSRB); 181 DWORD numAdapters, rc; 182 SRB srb; 183 int i, j, k; 184 185 if(!lpOutBuffer || nOutBufferSize < 8) { 172 186 SetLastError(ERROR_INSUFFICIENT_BUFFER); //todo: right error? 173 187 return(FALSE); 174 188 } 175 189 SCSI_ADDRESS *addr = (SCSI_ADDRESS *)lpOutBuffer; … … 223 237 SetLastError(ERROR_INVALID_PARAMETER); //todo 224 238 return FALSE; 225 239 } 226 240 227 241 case IOCTL_SCSI_RESCAN_BUS: … … 231 245 break; 232 246 233 }234 dprintf(("HMDeviceDiskClass::DeviceIoControl: unimplemented dwIoControlCode=%08lx\n", dwIoControlCode));235 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);236 return FALSE;237 } 238 //****************************************************************************** 239 //****************************************************************************** 247 } 248 dprintf(("HMDeviceDiskClass::DeviceIoControl: unimplemented dwIoControlCode=%08lx\n", dwIoControlCode)); 249 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 250 return FALSE; 251 } 252 //****************************************************************************** 253 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.