diff --git a/bochs/CHANGES b/bochs/CHANGES index 80cb3dcee..4366aebaf 100644 --- a/bochs/CHANGES +++ b/bochs/CHANGES @@ -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 : diff --git a/bochs/iodev/hdimage/cdrom_win32.cc b/bochs/iodev/hdimage/cdrom_win32.cc index 765b96ee7..ffecc48eb 100644 --- a/bochs/iodev/hdimage/cdrom_win32.cc +++ b/bochs/iodev/hdimage/cdrom_win32.cc @@ -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; }