MSWindows/*: get access mode working better. ASPI support is faulty though

freebsd.c: it's "ioctl" not "IOCTL";
cdrdao: it's cdrdao, not "toc"
cd-info: slightly better error message?
This commit is contained in:
rocky
2004-05-16 13:33:26 +00:00
parent cb7c0e870a
commit 2a54d504c0
5 changed files with 28 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: freebsd.c,v 1.12 2004/05/13 04:32:13 rocky Exp $ $Id: freebsd.c,v 1.13 2004/05/16 13:33:26 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: freebsd.c,v 1.12 2004/05/13 04:32:13 rocky Exp $"; static const char _rcsid[] = "$Id: freebsd.c,v 1.13 2004/05/16 13:33:26 rocky Exp $";
#include "freebsd.h" #include "freebsd.h"
@@ -42,7 +42,7 @@ str_to_access_mode_freebsd(const char *psz_access_mode)
if (NULL==psz_access_mode) return default_access_mode; if (NULL==psz_access_mode) return default_access_mode;
if (!strcmp(psz_access_mode, "IOCTL")) if (!strcmp(psz_access_mode, "ioctl"))
return _AM_IOCTL; return _AM_IOCTL;
else if (!strcmp(psz_access_mode, "CAM")) else if (!strcmp(psz_access_mode, "CAM"))
return _AM_CAM; return _AM_CAM;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: aspi32.c,v 1.5 2004/05/10 03:28:55 rocky Exp $ $Id: aspi32.c,v 1.6 2004/05/16 13:33:28 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: aspi32.c,v 1.5 2004/05/10 03:28:55 rocky Exp $"; static const char _rcsid[] = "$Id: aspi32.c,v 1.6 2004/05/16 13:33:28 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -182,7 +182,15 @@ wnaspi32_init_win32 (_img_private_t *env)
long (*lpSendCommand)( void* ) = NULL; long (*lpSendCommand)( void* ) = NULL;
DWORD dwSupportInfo; DWORD dwSupportInfo;
int i, j, i_num_adapters; int i, j, i_num_adapters;
char c_drive = env->gen.source_name[0]; char c_drive;
if (2 == strlen(env->gen.source_name) && isalpha(env->gen.source_name[0]) )
{
c_drive = env->gen.source_name[0];
} else if ( 6 == strlen(env->gen.source_name)
&& isalpha(env->gen.source_name[4] )) {
c_drive = env->gen.source_name[4];
}
hASPI = LoadLibrary( "wnaspi32.dll" ); hASPI = LoadLibrary( "wnaspi32.dll" );
if( hASPI != NULL ) { if( hASPI != NULL ) {

View File

@@ -1,5 +1,5 @@
/* /*
$Id: win32.c,v 1.15 2004/05/13 01:49:01 rocky Exp $ $Id: win32.c,v 1.16 2004/05/16 13:33:28 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: win32.c,v 1.15 2004/05/13 01:49:01 rocky Exp $"; static const char _rcsid[] = "$Id: win32.c,v 1.16 2004/05/16 13:33:28 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -85,7 +85,7 @@ str_to_access_mode_win32(const char *psz_access_mode)
else if (!strcmp(psz_access_mode, "ASPI")) else if (!strcmp(psz_access_mode, "ASPI"))
return _AM_ASPI; return _AM_ASPI;
else { else {
cdio_warn ("unknown access type: %s. Default 'ioctl' used.", cdio_warn ("unknown access type: %s. Default used.",
psz_access_mode); psz_access_mode);
return default_access_mode; return default_access_mode;
} }
@@ -144,7 +144,7 @@ _cdio_init_win32 (void *user_data)
env->b_aspi_init = false; env->b_aspi_init = false;
env->b_ioctl_init = false; env->b_ioctl_init = false;
if ( WIN_NT ) { if ( _AM_IOCTL == env->access_mode ) {
return win32ioctl_init_win32(env); return win32ioctl_init_win32(env);
} else { } else {
return wnaspi32_init_win32(env); return wnaspi32_init_win32(env);
@@ -155,7 +155,7 @@ _cdio_init_win32 (void *user_data)
Release and free resources associated with cd. Release and free resources associated with cd.
*/ */
static void static void
_cdio_win32_free (void *user_data) _free_win32 (void *user_data)
{ {
_img_private_t *env = user_data; _img_private_t *env = user_data;
@@ -686,7 +686,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
cdio_funcs _funcs = { cdio_funcs _funcs = {
.eject_media = _cdio_eject_media, .eject_media = _cdio_eject_media,
.free = _cdio_win32_free, .free = _free_win32,
.get_arg = _cdio_get_arg, .get_arg = _cdio_get_arg,
.get_default_device = cdio_get_default_device_win32, .get_default_device = cdio_get_default_device_win32,
.get_devices = cdio_get_devices_win32, .get_devices = cdio_get_devices_win32,
@@ -710,6 +710,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
}; };
_data = _cdio_malloc (sizeof (_img_private_t)); _data = _cdio_malloc (sizeof (_img_private_t));
_data->access_mode = str_to_access_mode_win32(psz_access_mode);
_data->gen.init = false; _data->gen.init = false;
_data->gen.fd = -1; _data->gen.fd = -1;
@@ -719,7 +720,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
_set_arg_win32(_data, "source", psz_source); _set_arg_win32(_data, "source", psz_source);
free(psz_source); free(psz_source);
} else { } else {
if (cdio_is_device_generic(psz_orig_source)) if (cdio_is_device_win32(psz_orig_source))
_set_arg_win32(_data, "source", psz_orig_source); _set_arg_win32(_data, "source", psz_orig_source);
else { else {
/* The below would be okay if all device drivers worked this way. */ /* The below would be okay if all device drivers worked this way. */
@@ -736,7 +737,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
if (_cdio_init_win32(_data)) if (_cdio_init_win32(_data))
return ret; return ret;
else { else {
_cdio_win32_free (_data); _free_win32 (_data);
return NULL; return NULL;
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cdrdao.c,v 1.7 2004/05/13 01:50:24 rocky Exp $ $Id: cdrdao.c,v 1.8 2004/05/16 13:33:30 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
toc reading routine adapted from cuetools toc reading routine adapted from cuetools
@@ -25,7 +25,7 @@
(*.cue). (*.cue).
*/ */
static const char _rcsid[] = "$Id: cdrdao.c,v 1.7 2004/05/13 01:50:24 rocky Exp $"; static const char _rcsid[] = "$Id: cdrdao.c,v 1.8 2004/05/16 13:33:30 rocky Exp $";
#include "cdio_assert.h" #include "cdio_assert.h"
#include "cdio_private.h" #include "cdio_private.h"
@@ -1203,7 +1203,7 @@ CdIo *
cdio_open_am_cdrdao (const char *psz_source_name, const char *psz_access_mode) cdio_open_am_cdrdao (const char *psz_source_name, const char *psz_access_mode)
{ {
if (psz_access_mode != NULL && strcmp(psz_access_mode, "image")) if (psz_access_mode != NULL && strcmp(psz_access_mode, "image"))
cdio_warn ("there is only one access mode, 'image' for toc. Arg %s ignored", cdio_warn ("there is only one access mode, 'image' for cdrdao. Arg %s ignored",
psz_access_mode); psz_access_mode);
return cdio_open_cdrdao(psz_source_name); return cdio_open_cdrdao(psz_source_name);
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cd-info.c,v 1.61 2004/05/13 01:50:28 rocky Exp $ $Id: cd-info.c,v 1.62 2004/05/16 13:33:40 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org> Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
@@ -796,7 +796,7 @@ main(int argc, const char *argv[])
case IMAGE_DEVICE: case IMAGE_DEVICE:
cdio = cdio_open_am (source_name, DRIVER_DEVICE, opts.access_mode); cdio = cdio_open_am (source_name, DRIVER_DEVICE, opts.access_mode);
if (cdio==NULL) { if (cdio==NULL) {
err_exit("%s: Error in automatically selecting device for input %s\n", err_exit("%s: Error in automatically selecting CD-image driver for input %s\n",
program_name, source_name); program_name, source_name);
} }
break; break;