Changeset 7202 for trunk/src/kernel32/hmdisk.cpp
- Timestamp:
- Oct 25, 2001, 3:19:05 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/hmdisk.cpp
r6987 r7202 1 /* $Id: hmdisk.cpp,v 1.1 7 2001-10-10 15:06:06 phallerExp $ */1 /* $Id: hmdisk.cpp,v 1.18 2001-10-25 13:19:05 sandervl Exp $ */ 2 2 3 3 /* … … 104 104 //Disable error popus. NT allows an app to open a cdrom/dvd drive without a disk inside 105 105 //OS/2 fails in that case with error ERROR_NOT_READY 106 OSLibDosDisableHardError(TRUE);106 ULONG oldmode = SetErrorMode(SEM_FAILCRITICALERRORS); 107 107 hFile = OSLibDosCreateFile((LPSTR)lpFileName, 108 108 pHMHandleData->dwAccess, … … 112 112 pHMHandleData->dwFlags, 113 113 hTemplate); 114 OSLibDosDisableHardError(FALSE);114 SetErrorMode(oldmode); 115 115 116 116 if (hFile != INVALID_HANDLE_ERROR || GetLastError() == ERROR_NOT_READY) … … 503 503 *lpBytesReturned = 0; 504 504 } 505 506 char temp; 507 ULONG bytesread, oldmode; 508 APIRET rc; 509 510 //Applications can use this IOCTL to check if the floppy has been changed 511 //OSLibDosGetDiskGeometry won't fail when that happens so we read one 512 //byte from the disk and return ERROR_MEDIA_CHANGED if it fails with 513 //ERROR_WRONG_DISK 514 oldmode = SetErrorMode(SEM_FAILCRITICALERRORS); 515 rc = OSLibDosRead(pHMHandleData->hHMHandle, (PVOID)&temp, 516 1, &bytesread); 517 SetErrorMode(oldmode); 518 if(rc == FALSE) { 519 dprintf(("IOCTL_DISK_GET_DRIVE_GEOMETRY: DosRead failed with rc %d", GetLastError())); 520 if(GetLastError() == ERROR_WRONG_DISK) { 521 SetLastError(ERROR_MEDIA_CHANGED); 522 return FALSE; 523 } 524 } 525 else OSLibDosSetFilePtr(pHMHandleData->hHMHandle, -1, OSLIB_SETPTR_FILE_CURRENT); 526 505 527 if(OSLibDosGetDiskGeometry(pHMHandleData->hHMHandle, drvInfo->driveLetter, pGeom) == FALSE) { 506 528 return FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.