diff --git a/src/cdrom/cdrom.c b/src/cdrom/cdrom.c index aab6cf67c..b34b01fff 100644 --- a/src/cdrom/cdrom.c +++ b/src/cdrom/cdrom.c @@ -2873,7 +2873,7 @@ cdrom_load(cdrom_t *dev, const char *fn, const int skip_insert) if ((dev->ops->is_empty != NULL) && dev->ops->is_empty(dev->local)) dev->cd_status = CD_STATUS_EMPTY; - if (dev->ops->is_dvd(dev->local)) + else if (dev->ops->is_dvd(dev->local)) dev->cd_status = CD_STATUS_DVD; else dev->cd_status = dev->ops->has_audio(dev->local) ? CD_STATUS_STOPPED : diff --git a/src/qt/win_cdrom_ioctl.c b/src/qt/win_cdrom_ioctl.c index 96b75db38..40addd591 100644 --- a/src/qt/win_cdrom_ioctl.c +++ b/src/qt/win_cdrom_ioctl.c @@ -124,7 +124,7 @@ ioctl_read_normal_toc(ioctl_t *ioctl, uint8_t *toc_buf) cur_read_toc_ex.SessionTrack = 1; const int temp = DeviceIoControl(ioctl->handle, IOCTL_CDROM_READ_TOC_EX, - &cur_read_toc_ex, 65535, + &cur_read_toc_ex, sizeof(CDROM_READ_TOC_EX), cur_full_toc, 65535, (LPDWORD) &size, NULL); ioctl_log(ioctl->log, "temp = %i\n", temp); @@ -179,7 +179,7 @@ ioctl_read_raw_toc(ioctl_t *ioctl) if (!ioctl->is_dvd) { status = DeviceIoControl(ioctl->handle, IOCTL_CDROM_READ_TOC_EX, - &cur_read_toc_ex, 65535, + &cur_read_toc_ex, sizeof(CDROM_READ_TOC_EX), cur_full_toc, 65535, (LPDWORD) &size, NULL); ioctl_log(ioctl->log, "status = %i\n", status); @@ -261,12 +261,6 @@ ioctl_read_raw_toc(ioctl_t *ioctl) free(cur_full_toc); } -static void -ioctl_read_toc(ioctl_t *ioctl) -{ - ioctl_read_raw_toc(ioctl); -} - static int ioctl_get_track(const ioctl_t *ioctl, const uint32_t sector) { raw_track_info_t *rti = (raw_track_info_t *) ioctl->cur_rti; @@ -761,13 +755,13 @@ ioctl_load(const void *local) { const ioctl_t *ioctl = (const ioctl_t *) local; - if (ioctl_open_handle((ioctl_t *) ioctl)) { - long size; - DeviceIoControl(ioctl->handle, IOCTL_STORAGE_LOAD_MEDIA, - NULL, 0, NULL, 0, - (LPDWORD) &size, NULL); + if ((ioctl->handle != NULL) || ioctl_open_handle((ioctl_t *) ioctl)) { + long size = 0; + (void) DeviceIoControl(ioctl->handle, IOCTL_STORAGE_LOAD_MEDIA, + NULL, 0, NULL, 0, + (LPDWORD) &size, NULL); - ioctl_read_toc((ioctl_t *) ioctl); + ioctl_read_raw_toc((ioctl_t *) ioctl); } }