Close cdrom image file on eject (#145)

The WIN32 configuration for the cdrom was not closing the image file on
eject. This left the handle open while Bochs was running, not allowing
the image file to be modified.
This commit is contained in:
Benjamin David Lunt 2023-11-22 23:40:39 -07:00 committed by GitHub
parent 5f6e855350
commit eae6bf9396
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,7 @@ Brief summary :
- USB: Added OHCI as an EHCI Companion option. Now allows UHCI or OHCI specified as a configuration parameter.
- Disk images: Allows large VHD image files
- Enhanced the Floppy Disk emulation
- Bug fix which now closes the cdrom image file when using win32 configuration
- Documentation updates and fixes
Detailed change log :

View File

@ -147,6 +147,7 @@ cdrom_win32_c::~cdrom_win32_c(void)
if (fd >= 0) {
if (hFile != INVALID_HANDLE_VALUE)
CloseHandle(hFile);
fd = -1;
}
}
@ -210,6 +211,11 @@ void cdrom_win32_c::eject_cdrom()
DWORD lpBytesReturned;
DeviceIoControl(hFile, IOCTL_STORAGE_EJECT_MEDIA, NULL, 0, NULL, 0, &lpBytesReturned, NULL);
}
} else {
if (hFile != INVALID_HANDLE_VALUE) {
CloseHandle(hFile);
hFile = INVALID_HANDLE_VALUE;
}
}
fd = -1;
}