Commit 1fe93345 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

- support for reading labels and serial nums from device

- "reasonable" misc/cdrom.c device handling - much improved audio CD support - serial number overwrite bug fix - spelling fixes
parent 027187df
......@@ -242,7 +242,7 @@ static DWORD CDAUDIO_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpOpe
}
wmcda->wNotifyDeviceID = dwDeviceID;
if (CDAUDIO_Open(&wmcda->wcda) == -1) {
if (CDAUDIO_Open(&wmcda->wcda, -1) == -1) {
--wmcda->nUseCount;
return MCIERR_HARDWARE;
}
......
*** VOLUME LABEL
If a program depends on the correct label and/or serial number for the
CD-Rom, you can use the following command to extract that information:
dd if=<your cdrom device> bs=1 skip=32808 count=32
You need read access to the device, so perhaps you have to do it as root.
Put the resulting string (without trailing blanks) into your
wine.ini/.winerc file like:
Label=<the label>
*** SERIAL NUMBER
[FIXME: if someone knows how to get the serial number in Linux, please
put this information here].
If you have access to a Win32 system and C-compiler, you can compile the
following program to extract this information:
------------------------- begin volinfo.c ---------------------------
#include <windows.h>
#include <stdio.h>
int main(int argc,char **argv[])
{
char drive, root[]="C:\\", label[1002], fsname[1002];
DWORD serial, flags, filenamelen, labellen = 1000, fsnamelen = 1000;
printf("Drive Serial Flags Filename-Length "
"Label Fsname\n");
for (drive = 'C'; drive <= 'Z'; drive++)
{
root[0] = drive;
if (GetVolumeInformationA(root,label,labellen,&serial,
&filenamelen,&flags,fsname,fsnamelen))
{
strcat(label,"\""); strcat (fsname,"\"");
printf("%c:\\ 0x%08lx 0x%08lx %15ld \"%-20s \"%-20s\n",
drive, (long) serial, (long) flags, (long) filenamelen,
label, fsname);
}
}
return 0;
}
Probably you can get that information also from the File Manager in
Windows.
------------------------- end volinfo.c -----------------------------
*** DRIVE LETTER
Some installed programs only look for the CD-Rom in the drive letter
that the CD-Rom had when the program was installed. In this case, make
sure you use the correct letter, especially if you installed the
program under Windows and are now trying to run it in Wine.
Some programs reportedly store the drive letter in their .INI file,
so you might look there and try to change it.
Drive labels and serial numbers with wine
-----------------------------------------
Until now, your only possibility of specifying drive volume labels
and serial numbers was to set them manually in the wine config file.
By now, wine can read them directly from the device as well. This may be
useful for many Win 9x games or for setup programs distributed on CD-ROMs
that check for volume label.
WHAT'S SUPPORTED ?
* FAT systems (types 'hd' and 'floppy'): reads labels and serial num's.
* Iso9660 ('cdrom'): reads labels only.
HOW TO SET UP ?
Reading labels and serial numbers just works automagically if
you specify a 'Device=' line in the [Drive X] section in your wine.conf.
Note that the device has to exist and must be accessible if you do this,
though.
If you don't do that, then you should give fixed 'Label=' or 'Serial=' entries
in wine.conf, as Wine returns these entries instead if no device is given.
If they don't exist, then Wine will return default values (label "Drive X"
and serial 12345678).
Now a seldom needed one:
If you want to give a 'Device=' entry *only* for drive raw sector accesses, but
not for reading the volume info from the device (i.e. you want a *fixed*,
preconfigured label), you need to specify 'ReadVolInfo=0' to tell Wine to skip
the volume reading.
EXAMPLES
*** Simple example of cdrom and floppy; labels will be read from the device on
both cdrom and floppy; serial numbers on floppy only:
[Drive A]
Path=/mnt/floppy
Type=floppy
Device=/dev/fd0
Filesystem=msdos
[Drive R]
Path=/mnt/cdrom
Type=cdrom
Device=/dev/hda1
Filesystem=win95
*** CD-ROM. We want to override the label:
[Drive J]
Path=/mnt/cdrom
Type=cdrom
Label=X234GCDSE
; note that the device isn't really needed here as we have a fixed label
Device=/dev/cdrom
Filesystem=msdos
TODO / OPEN ISSUES
- The cdrom label can be read only if the data track of the disk resides in
the first track and the cdrom is iso9660.
- Better checking for FAT superblock (it now check's only one byte).
- Support for labels/serial num's WRITING.
- Can the label be longer than 11 chars? (iso9660 has 32 chars).
- What about reading ext2 volume label? ....
Petr Tomasek changes by: Andreas Mohr
<tomasek@etf.cuni.cz> <a.mohr@mailto.de>
Nov 14 1999 Jan 25 2000
......@@ -54,7 +54,8 @@ typedef struct {
#define WINE_CDA_STOP 0x04
#define WINE_CDA_PAUSE 0x05
int CDAUDIO_Open(WINE_CDAUDIO* wcda);
int CDAUDIO_Open(WINE_CDAUDIO* wcda, int drive);
int CDAUDIO_GetMediaType(WINE_CDAUDIO* wcda);
int CDAUDIO_Close(WINE_CDAUDIO* wcda);
int CDAUDIO_Reset(WINE_CDAUDIO* wcda);
int CDAUDIO_Play(WINE_CDAUDIO* wcda, DWORD start, DWORD stop);
......@@ -74,5 +75,9 @@ BOOL CDAUDIO_GetCDStatus(WINE_CDAUDIO* wcda);
#define CDROM_DATA_TRACK 0x04
#endif
/* values borrowed from Linux 2.2.x cdrom.h */
#define CDS_NO_INFO 0
#define CDS_AUDIO 100
#endif
......@@ -128,48 +128,49 @@ const int dbch_seh = 116;
const int dbch_selector = 117;
const int dbch_sendmsg = 118;
const int dbch_server = 119;
const int dbch_shell = 120;
const int dbch_snoop = 121;
const int dbch_sound = 122;
const int dbch_static = 123;
const int dbch_statusbar = 124;
const int dbch_storage = 125;
const int dbch_stress = 126;
const int dbch_string = 127;
const int dbch_syscolor = 128;
const int dbch_system = 129;
const int dbch_tab = 130;
const int dbch_tape = 131;
const int dbch_tapi = 132;
const int dbch_task = 133;
const int dbch_text = 134;
const int dbch_thread = 135;
const int dbch_thunk = 136;
const int dbch_timer = 137;
const int dbch_toolbar = 138;
const int dbch_toolhelp = 139;
const int dbch_tooltips = 140;
const int dbch_trackbar = 141;
const int dbch_treeview = 142;
const int dbch_ttydrv = 143;
const int dbch_tweak = 144;
const int dbch_typelib = 145;
const int dbch_updown = 146;
const int dbch_ver = 147;
const int dbch_virtual = 148;
const int dbch_vxd = 149;
const int dbch_wave = 150;
const int dbch_win = 151;
const int dbch_win16drv = 152;
const int dbch_win32 = 153;
const int dbch_wing = 154;
const int dbch_winsock = 155;
const int dbch_winspool = 156;
const int dbch_wnet = 157;
const int dbch_x11 = 158;
const int dbch_x11drv = 159;
const int dbch_setupx = 120;
const int dbch_shell = 121;
const int dbch_snoop = 122;
const int dbch_sound = 123;
const int dbch_static = 124;
const int dbch_statusbar = 125;
const int dbch_storage = 126;
const int dbch_stress = 127;
const int dbch_string = 128;
const int dbch_syscolor = 129;
const int dbch_system = 130;
const int dbch_tab = 131;
const int dbch_tape = 132;
const int dbch_tapi = 133;
const int dbch_task = 134;
const int dbch_text = 135;
const int dbch_thread = 136;
const int dbch_thunk = 137;
const int dbch_timer = 138;
const int dbch_toolbar = 139;
const int dbch_toolhelp = 140;
const int dbch_tooltips = 141;
const int dbch_trackbar = 142;
const int dbch_treeview = 143;
const int dbch_ttydrv = 144;
const int dbch_tweak = 145;
const int dbch_typelib = 146;
const int dbch_updown = 147;
const int dbch_ver = 148;
const int dbch_virtual = 149;
const int dbch_vxd = 150;
const int dbch_wave = 151;
const int dbch_win = 152;
const int dbch_win16drv = 153;
const int dbch_win32 = 154;
const int dbch_wing = 155;
const int dbch_winsock = 156;
const int dbch_winspool = 157;
const int dbch_wnet = 158;
const int dbch_x11 = 159;
const int dbch_x11drv = 160;
#define DEBUG_CHANNEL_COUNT 160
#define DEBUG_CHANNEL_COUNT 161
char __debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = {
{1, 1, 0, 0},
......@@ -331,6 +332,7 @@ char __debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = {
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0}
};
......@@ -455,6 +457,7 @@ const char * const debug_ch_name[DEBUG_CHANNEL_COUNT] = {
"selector",
"sendmsg",
"server",
"setupx",
"shell",
"snoop",
"sound",
......
......@@ -35,6 +35,7 @@ extern int DRIVE_FindDriveRoot( const char **path );
extern const char * DRIVE_GetRoot( int drive );
extern const char * DRIVE_GetDosCwd( int drive );
extern const char * DRIVE_GetUnixCwd( int drive );
extern const char * DRIVE_GetDevice( int drive );
extern const char * DRIVE_GetLabel( int drive );
extern DWORD DRIVE_GetSerialNumber( int drive );
extern int DRIVE_SetSerialNumber( int drive, DWORD serial );
......
......@@ -13,7 +13,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
printf("Drive Serial Flags Filename-Length "
"Label Fsname\n");
for (drive = 'C'; drive <= 'Z'; drive++)
for (drive = 'A'; drive <= 'Z'; drive++)
{
root[0] = drive;
if (GetVolumeInformation(root,label,labellen,&serial,
......
......@@ -11,29 +11,53 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include "cdrom.h"
#include "drive.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(cdaudio)
#if defined(__NetBSD__)
# define CDAUDIO_DEV "/dev/rcd0d"
#elif defined(__FreeBSD__)
# define CDAUDIO_DEV "/dev/rcd0c"
#else
# define CDAUDIO_DEV "/dev/cdrom"
#endif
#define MAX_CDAUDIO_TRACKS 256
/**************************************************************************
* CDAUDIO_Open [internal]
*
* drive = 0, 1, ...
* or -1 (figure it out)
*/
int CDAUDIO_Open(WINE_CDAUDIO* wcda)
int CDAUDIO_Open(WINE_CDAUDIO* wcda, int drive)
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
wcda->unixdev = open(CDAUDIO_DEV, O_RDONLY | O_NONBLOCK, 0);
int i;
BOOL avail = FALSE;
const char *dev;
if (drive == -1)
{
for (i=0; i < MAX_DOS_DRIVES; i++)
if (DRIVE_GetType(i) == TYPE_CDROM)
{
drive = i;
avail = TRUE;
break;
}
}
else
avail = TRUE;
if (avail == FALSE)
{
WARN("No CD-ROM #%d found !\n", drive);
return -1;
}
if ((dev = DRIVE_GetDevice(drive)) == NULL)
{
WARN("No device entry for CD-ROM #%d (drive %c:) found !\n",
drive, 'A' + drive);
return -1;
}
wcda->unixdev = open(dev, O_RDONLY | O_NONBLOCK, 0);
if (wcda->unixdev == -1) {
WARN("can't open '%s'!. errno=%d\n", CDAUDIO_DEV, errno);
WARN("can't open '%s'!. errno=%d\n", dev, errno);
return -1;
}
wcda->cdaMode = WINE_CDA_OPEN; /* to force reading tracks info */
......@@ -45,8 +69,16 @@ int CDAUDIO_Open(WINE_CDAUDIO* wcda)
wcda->lpdwTrackPos = NULL;
wcda->lpbTrackFlags = NULL;
return 0;
}
/**************************************************************************
* CDAUDIO_GetMediaType [internal]
*/
int CDAUDIO_GetMediaType(WINE_CDAUDIO* wcda)
{
#ifdef linux
return ioctl(wcda->unixdev, CDROM_DISC_STATUS);
#else
wcda->unixdev = -1;
return -1;
#endif
}
......
......@@ -490,7 +490,7 @@ static void MSCDEX_Handler(CONTEXT86* context)
TRACE("Get drive letters\n");
break;
case 0x10: /* direct driver acces */
case 0x10: /* direct driver access */
{
static WINE_CDAUDIO wcda;
BYTE* driver_request;
......@@ -511,12 +511,12 @@ static void MSCDEX_Handler(CONTEXT86* context)
driver_request[3] = 5; /* bad request length */
return;
}
/* FIXME - would be better to open the device at the begining of the wine session...
/* FIXME - would be better to open the device at the beginning of the wine session...
* - the device is also never closed...
* - the current implementation only supports a single CD ROM
*/
if (wcda.unixdev <= 0)
CDAUDIO_Open(&wcda);
CDAUDIO_Open(&wcda, -1);
TRACE("CDROM device driver -> command <%d>\n", (unsigned char)driver_request[2]);
for (drive = 0;
......
......@@ -34,6 +34,8 @@ Path=/cdrom
Type=cdrom
Label=CD-Rom
Filesystem=win95
; make sure that device is correct and has proper permissions !
Device=/dev/cdrom
[Drive E]
Path=/tmp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment