From 42d95f5a34c5508fb0f8e0bec07957085c82fee0 Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 6 May 2004 04:01:52 +0000 Subject: [PATCH] Bring in line with other drivers. --- lib/MSWindows/win32.c | 25 ++++++++++++++++++++----- lib/MSWindows/win32_ioctl.c | 11 +++++------ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/lib/MSWindows/win32.c b/lib/MSWindows/win32.c index 1faf922e..b1ae1b75 100644 --- a/lib/MSWindows/win32.c +++ b/lib/MSWindows/win32.c @@ -1,5 +1,5 @@ /* - $Id: win32.c,v 1.11 2004/04/30 22:28:00 rocky Exp $ + $Id: win32.c,v 1.12 2004/05/06 04:01:52 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32.c,v 1.11 2004/04/30 22:28:00 rocky Exp $"; +static const char _rcsid[] = "$Id: win32.c,v 1.12 2004/05/06 04:01:52 rocky Exp $"; #include #include @@ -676,12 +676,13 @@ cdio_open_win32 (const char *psz_source_name) ones to set that up. */ CdIo * -cdio_open_am_win32 (const char *psz_source_name, const char *psz_access_mode) +cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode) { #ifdef HAVE_WIN32_CDROM CdIo *ret; _img_private_t *_data; + char *psz_source; cdio_funcs _funcs = { .eject_media = _cdio_eject_media, @@ -712,8 +713,22 @@ cdio_open_am_win32 (const char *psz_source_name, const char *psz_access_mode) _data->gen.init = false; _data->gen.fd = -1; - _set_arg_win32(_data, "source", (NULL == psz_source_name) - ? cdio_get_default_device_win32(): psz_source_name); + if (NULL == psz_orig_source) { + psz_source=cdio_get_default_device_win32(); + if (NULL == psz_source) return NULL; + _set_arg_win32(_data, "source", psz_source); + free(psz_source); + } else { + if (cdio_is_device_generic(psz_orig_source)) + _set_arg_win32(_data, "source", psz_orig_source); + else { + /* The below would be okay if all device drivers worked this way. */ +#if 0 + cdio_info ("source %s is a not a device", psz_orig_source); +#endif + return NULL; + } + } ret = cdio_new (_data, &_funcs); if (ret == NULL) return NULL; diff --git a/lib/MSWindows/win32_ioctl.c b/lib/MSWindows/win32_ioctl.c index d6a43c65..823f598e 100644 --- a/lib/MSWindows/win32_ioctl.c +++ b/lib/MSWindows/win32_ioctl.c @@ -1,5 +1,5 @@ /* - $Id: win32_ioctl.c,v 1.1 2004/04/30 08:23:23 rocky Exp $ + $Id: win32_ioctl.c,v 1.2 2004/05/06 04:01:52 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.1 2004/04/30 08:23:23 rocky Exp $"; +static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.2 2004/05/06 04:01:52 rocky Exp $"; #include #include @@ -214,11 +214,9 @@ win32ioctl_read_raw_sector (_img_private_t *env, void *buf, lsn_t lsn) sptd.SenseInfoOffset=0; /* ReadCD CDB12 command. The values were taken from MMC1 draft paper. */ - sptd.Cdb[0]=CDIO_MMC_GPCMD_READ_CD; - sptd.Cdb[1]=0; + CDIO_MMC_SET_COMMAND(sptd.Cdb, CDIO_MMC_GPCMD_READ_CD); CDIO_MMC_SET_READ_LBA(sptd.Cdb, lsn); - CDIO_MMC_SET_READ_LENGTH(sptd.Cdb, 1); sptd.Cdb[9]=0xF8; /* Raw read, 2352 bytes per sector */ @@ -469,7 +467,8 @@ win32ioctl_get_drive_cap (const void *env) offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,DataBuf); sptwb.Spt.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,SenseBuf); - sptwb.Spt.Cdb[0] = CDIO_MMC_MODE_SENSE; + + CDIO_MMC_SET_COMMAND(sptwb.Spt.Cdb, CDIO_MMC_MODE_SENSE); /*sptwb.Spt.Cdb[1] = 0x08; /+ doesn't return block descriptors */ sptwb.Spt.Cdb[1] = 0x0; sptwb.Spt.Cdb[2] = 0x2a; /*MODE_PAGE_CAPABILITIES*/;