Commit bf67259a authored by Alexandre Julliard's avatar Alexandre Julliard

Use the DRIVE_* API constants instead of the DRIVETYPE enum.

Changed DRIVE_CANNOTDETERMINE and DRIVE_DOESNOTEXIST to use the correct names. Cleaned up a few dependencies on internal drive.c functions.
parent c9b3b2e8
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "user.h" #include "user.h"
#include "heap.h" #include "heap.h"
#include "controls.h" #include "controls.h"
#include "drive.h"
#include "debugtools.h" #include "debugtools.h"
#include "tweak.h" #include "tweak.h"
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "winuser.h" #include "winuser.h"
#include "winerror.h" #include "winerror.h"
#include "drive.h"
#include "heap.h" #include "heap.h"
#include "spy.h" #include "spy.h"
#include "selectors.h" #include "selectors.h"
...@@ -1736,10 +1735,11 @@ static LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT attrib, ...@@ -1736,10 +1735,11 @@ static LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT attrib,
if ((ret >= 0) && (attrib & DDL_DRIVES)) if ((ret >= 0) && (attrib & DDL_DRIVES))
{ {
char buffer[] = "[-a-]"; char buffer[] = "[-a-]";
char root[] = "A:\\";
int drive; int drive;
for (drive = 0; drive < MAX_DOS_DRIVES; drive++, buffer[2]++) for (drive = 0; drive < 26; drive++, buffer[2]++, root[0]++)
{ {
if (!DRIVE_IsValid(drive)) continue; if (GetDriveTypeA(root) <= DRIVE_NO_ROOT_DIR) continue;
if ((ret = LISTBOX_InsertString( wnd, descr, -1, buffer )) < 0) if ((ret = LISTBOX_InsertString( wnd, descr, -1, buffer )) < 0)
break; break;
} }
......
...@@ -610,7 +610,7 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -610,7 +610,7 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
for(i = 0, n = -1; i < 26; i++) for(i = 0, n = -1; i < 26; i++)
{ {
str[0] = 'a' + i; str[0] = 'a' + i;
if (GetDriveTypeA(str) != DRIVE_DOESNOTEXIST) n++; if (GetDriveTypeA(str) <= DRIVE_NO_ROOT_DIR) n++;
if (toupper(str[0]) == toupper(dir[0])) break; if (toupper(str[0]) == toupper(dir[0])) break;
} }
} }
......
...@@ -843,8 +843,8 @@ UINT16 WINAPI DriveType16( UINT16 drive ) ...@@ -843,8 +843,8 @@ UINT16 WINAPI DriveType16( UINT16 drive )
case DRIVE_CDROM: case DRIVE_CDROM:
ret = DRIVE_REMOTE; ret = DRIVE_REMOTE;
break; break;
case DRIVE_DOESNOTEXIST: case DRIVE_NO_ROOT_DIR:
ret = DRIVE_CANNOTDETERMINE; ret = DRIVE_UNKNOWN;
break; break;
} }
return ret; return ret;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "winbase.h" #include "winbase.h"
#include "wine/winnet16.h" #include "wine/winnet16.h"
#include "winnetwk.h" #include "winnetwk.h"
#include "drive.h"
#include "debugtools.h" #include "debugtools.h"
#include "heap.h" #include "heap.h"
...@@ -167,22 +166,19 @@ WORD WINAPI WNetCancelConnection16( LPSTR lpName, BOOL16 bForce ) ...@@ -167,22 +166,19 @@ WORD WINAPI WNetCancelConnection16( LPSTR lpName, BOOL16 bForce )
WORD WINAPI WNetGetConnection16( LPSTR lpLocalName, WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
LPSTR lpRemoteName, UINT16 *cbRemoteName ) LPSTR lpRemoteName, UINT16 *cbRemoteName )
{ {
const char *path; char label[32];
TRACE( "local %s\n", lpLocalName ); TRACE( "local %s\n", lpLocalName );
if (lpLocalName[1] == ':')
{
int drive = toupper(lpLocalName[0]) - 'A';
switch(GetDriveTypeA(lpLocalName)) switch(GetDriveTypeA(lpLocalName))
{ {
case DRIVE_REMOTE: case DRIVE_REMOTE:
path = DRIVE_GetLabel(drive); GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
if (strlen(path) + 1 > *cbRemoteName) if (strlen(label) + 1 > *cbRemoteName)
{ {
*cbRemoteName = strlen(path) + 1; *cbRemoteName = strlen(label) + 1;
return WN16_MORE_DATA; return WN16_MORE_DATA;
} }
strcpy( lpRemoteName, path ); strcpy( lpRemoteName, label );
*cbRemoteName = strlen(lpRemoteName) + 1; *cbRemoteName = strlen(lpRemoteName) + 1;
return WN16_SUCCESS; return WN16_SUCCESS;
case DRIVE_REMOVABLE: case DRIVE_REMOVABLE:
...@@ -193,8 +189,6 @@ WORD WINAPI WNetGetConnection16( LPSTR lpLocalName, ...@@ -193,8 +189,6 @@ WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
default: default:
return WN16_BAD_LOCALNAME; return WN16_BAD_LOCALNAME;
} }
}
return WN16_BAD_LOCALNAME;
} }
/************************************************************************** /**************************************************************************
...@@ -396,7 +390,7 @@ WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName, ...@@ -396,7 +390,7 @@ WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName,
WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType ) WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
{ {
UINT type = GetDriveTypeA(lpName); UINT type = GetDriveTypeA(lpName);
if ( type == DRIVE_DOESNOTEXIST ) if ( type == DRIVE_NO_ROOT_DIR )
type = GetDriveTypeA(NULL); type = GetDriveTypeA(NULL);
*lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL; *lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
......
...@@ -64,7 +64,7 @@ typedef struct ...@@ -64,7 +64,7 @@ typedef struct
char label_conf[12]; /* drive label as cfg'd in wine.conf */ char label_conf[12]; /* drive label as cfg'd in wine.conf */
char label_read[12]; /* drive label as read from device */ char label_read[12]; /* drive label as read from device */
DWORD serial_conf; /* drive serial number as cfg'd in wine.conf */ DWORD serial_conf; /* drive serial number as cfg'd in wine.conf */
DRIVETYPE type; /* drive type */ UINT type; /* drive type */
UINT flags; /* drive flags */ UINT flags; /* drive flags */
dev_t dev; /* unix device number */ dev_t dev; /* unix device number */
ino_t ino; /* unix inode number */ ino_t ino; /* unix inode number */
...@@ -73,10 +73,13 @@ typedef struct ...@@ -73,10 +73,13 @@ typedef struct
static const char * const DRIVE_Types[] = static const char * const DRIVE_Types[] =
{ {
"floppy", /* TYPE_FLOPPY */ "", /* DRIVE_UNKNOWN */
"hd", /* TYPE_HD */ "", /* DRIVE_NO_ROOT_DIR */
"cdrom", /* TYPE_CDROM */ "floppy", /* DRIVE_REMOVABLE */
"network" /* TYPE_NETWORK */ "hd", /* DRIVE_FIXED */
"network", /* DRIVE_REMOTE */
"cdrom", /* DRIVE_CDROM */
"ramdisk" /* DRIVE_RAMDISK */
}; };
...@@ -109,7 +112,7 @@ static HTASK16 DRIVE_LastTask = 0; ...@@ -109,7 +112,7 @@ static HTASK16 DRIVE_LastTask = 0;
/*********************************************************************** /***********************************************************************
* DRIVE_GetDriveType * DRIVE_GetDriveType
*/ */
static DRIVETYPE DRIVE_GetDriveType( const char *name ) static UINT DRIVE_GetDriveType( const char *name )
{ {
char buffer[20]; char buffer[20];
int i; int i;
...@@ -117,11 +120,11 @@ static DRIVETYPE DRIVE_GetDriveType( const char *name ) ...@@ -117,11 +120,11 @@ static DRIVETYPE DRIVE_GetDriveType( const char *name )
PROFILE_GetWineIniString( name, "Type", "hd", buffer, sizeof(buffer) ); PROFILE_GetWineIniString( name, "Type", "hd", buffer, sizeof(buffer) );
for (i = 0; i < sizeof(DRIVE_Types)/sizeof(DRIVE_Types[0]); i++) for (i = 0; i < sizeof(DRIVE_Types)/sizeof(DRIVE_Types[0]); i++)
{ {
if (!strcasecmp( buffer, DRIVE_Types[i] )) return (DRIVETYPE)i; if (!strcasecmp( buffer, DRIVE_Types[i] )) return i;
} }
MESSAGE("%s: unknown drive type '%s', defaulting to 'hd'.\n", MESSAGE("%s: unknown drive type '%s', defaulting to 'hd'.\n",
name, buffer ); name, buffer );
return TYPE_HD; return DRIVE_FIXED;
} }
...@@ -218,7 +221,7 @@ int DRIVE_Init(void) ...@@ -218,7 +221,7 @@ int DRIVE_Init(void)
drive->flags |= DRIVE_FAIL_READ_ONLY; drive->flags |= DRIVE_FAIL_READ_ONLY;
/* Make the first hard disk the current drive */ /* Make the first hard disk the current drive */
if ((DRIVE_CurDrive == -1) && (drive->type == TYPE_HD)) if ((DRIVE_CurDrive == -1) && (drive->type == DRIVE_FIXED))
DRIVE_CurDrive = i; DRIVE_CurDrive = i;
count++; count++;
...@@ -240,7 +243,7 @@ int DRIVE_Init(void) ...@@ -240,7 +243,7 @@ int DRIVE_Init(void)
DOSDrives[2].unix_cwd = HEAP_strdupA( GetProcessHeap(), 0, "" ); DOSDrives[2].unix_cwd = HEAP_strdupA( GetProcessHeap(), 0, "" );
strcpy( DOSDrives[2].label_conf, "Drive C " ); strcpy( DOSDrives[2].label_conf, "Drive C " );
DOSDrives[2].serial_conf = 12345678; DOSDrives[2].serial_conf = 12345678;
DOSDrives[2].type = TYPE_HD; DOSDrives[2].type = DRIVE_FIXED;
DOSDrives[2].device = NULL; DOSDrives[2].device = NULL;
DOSDrives[2].flags = 0; DOSDrives[2].flags = 0;
DRIVE_CurDrive = 2; DRIVE_CurDrive = 2;
...@@ -463,11 +466,11 @@ int DRIVE_ReadSuperblock (int drive, char * buff) ...@@ -463,11 +466,11 @@ int DRIVE_ReadSuperblock (int drive, char * buff)
switch(DOSDrives[drive].type) switch(DOSDrives[drive].type)
{ {
case TYPE_FLOPPY: case DRIVE_REMOVABLE:
case TYPE_HD: case DRIVE_FIXED:
offs = 0; offs = 0;
break; break;
case TYPE_CDROM: case DRIVE_CDROM:
offs = CDROM_Data_FindBestVoldesc(fd); offs = CDROM_Data_FindBestVoldesc(fd);
break; break;
default: default:
...@@ -480,8 +483,8 @@ int DRIVE_ReadSuperblock (int drive, char * buff) ...@@ -480,8 +483,8 @@ int DRIVE_ReadSuperblock (int drive, char * buff)
switch(DOSDrives[drive].type) switch(DOSDrives[drive].type)
{ {
case TYPE_FLOPPY: case DRIVE_REMOVABLE:
case TYPE_HD: case DRIVE_FIXED:
if ((buff[0x26]!=0x29) || /* Check for FAT present */ if ((buff[0x26]!=0x29) || /* Check for FAT present */
/* FIXME: do really all FAT have their name beginning with /* FIXME: do really all FAT have their name beginning with
"FAT" ? (At least FAT12, FAT16 and FAT32 have :) */ "FAT" ? (At least FAT12, FAT16 and FAT32 have :) */
...@@ -492,7 +495,7 @@ int DRIVE_ReadSuperblock (int drive, char * buff) ...@@ -492,7 +495,7 @@ int DRIVE_ReadSuperblock (int drive, char * buff)
return -3; return -3;
} }
break; break;
case TYPE_CDROM: case DRIVE_CDROM:
if (strncmp(&buff[1],"CD001",5)) /* Check for iso9660 present */ if (strncmp(&buff[1],"CD001",5)) /* Check for iso9660 present */
return -3; return -3;
/* FIXME: do we need to check for "CDROM", too ? (high sierra) */ /* FIXME: do we need to check for "CDROM", too ? (high sierra) */
...@@ -552,7 +555,7 @@ const char * DRIVE_GetLabel( int drive ) ...@@ -552,7 +555,7 @@ const char * DRIVE_GetLabel( int drive )
int offs = -1; int offs = -1;
if (!DRIVE_IsValid( drive )) return NULL; if (!DRIVE_IsValid( drive )) return NULL;
if (DRIVE_GetType(drive) == TYPE_CDROM) if (DOSDrives[drive].type == DRIVE_CDROM)
{ {
read = CDROM_GetLabel(drive, DOSDrives[drive].label_read); read = CDROM_GetLabel(drive, DOSDrives[drive].label_read);
} }
...@@ -563,8 +566,8 @@ const char * DRIVE_GetLabel( int drive ) ...@@ -563,8 +566,8 @@ const char * DRIVE_GetLabel( int drive )
ERR("Invalid or unreadable superblock on %s (%c:).\n", ERR("Invalid or unreadable superblock on %s (%c:).\n",
DOSDrives[drive].device, (char)(drive+'A')); DOSDrives[drive].device, (char)(drive+'A'));
else { else {
if (DOSDrives[drive].type == TYPE_FLOPPY || if (DOSDrives[drive].type == DRIVE_REMOVABLE ||
DOSDrives[drive].type == TYPE_HD) DOSDrives[drive].type == DRIVE_FIXED)
offs = 0x2b; offs = 0x2b;
/* FIXME: ISO9660 uses a 32 bytes long label. Should we do also? */ /* FIXME: ISO9660 uses a 32 bytes long label. Should we do also? */
...@@ -593,8 +596,8 @@ char buff[DRIVE_SUPER]; ...@@ -593,8 +596,8 @@ char buff[DRIVE_SUPER];
{ {
switch(DOSDrives[drive].type) switch(DOSDrives[drive].type)
{ {
case TYPE_FLOPPY: case DRIVE_REMOVABLE:
case TYPE_HD: case DRIVE_FIXED:
if (DRIVE_ReadSuperblock(drive,(char *) buff)) if (DRIVE_ReadSuperblock(drive,(char *) buff))
MESSAGE("Invalid or unreadable superblock on %s (%c:)." MESSAGE("Invalid or unreadable superblock on %s (%c:)."
" Maybe not FAT?\n" , " Maybe not FAT?\n" ,
...@@ -602,7 +605,7 @@ char buff[DRIVE_SUPER]; ...@@ -602,7 +605,7 @@ char buff[DRIVE_SUPER];
else else
serial = *((DWORD*)(buff+0x27)); serial = *((DWORD*)(buff+0x27));
break; break;
case TYPE_CDROM: case DRIVE_CDROM:
serial = CDROM_GetSerial(drive); serial = CDROM_GetSerial(drive);
break; break;
default: default:
...@@ -625,15 +628,15 @@ int DRIVE_SetSerialNumber( int drive, DWORD serial ) ...@@ -625,15 +628,15 @@ int DRIVE_SetSerialNumber( int drive, DWORD serial )
if (DOSDrives[drive].flags & DRIVE_READ_VOL_INFO) if (DOSDrives[drive].flags & DRIVE_READ_VOL_INFO)
{ {
if ((DOSDrives[drive].type != TYPE_FLOPPY) && if ((DOSDrives[drive].type != DRIVE_REMOVABLE) &&
(DOSDrives[drive].type != TYPE_HD)) return 0; (DOSDrives[drive].type != DRIVE_FIXED)) return 0;
/* check, if the drive has a FAT filesystem */ /* check, if the drive has a FAT filesystem */
if (DRIVE_ReadSuperblock(drive, buff)) return 0; if (DRIVE_ReadSuperblock(drive, buff)) return 0;
if (DRIVE_WriteSuperblockEntry(drive, 0x27, 4, (char *) &serial)) return 0; if (DRIVE_WriteSuperblockEntry(drive, 0x27, 4, (char *) &serial)) return 0;
return 1; return 1;
} }
if (DOSDrives[drive].type == TYPE_CDROM) return 0; if (DOSDrives[drive].type == DRIVE_CDROM) return 0;
DOSDrives[drive].serial_conf = serial; DOSDrives[drive].serial_conf = serial;
return 1; return 1;
} }
...@@ -642,9 +645,9 @@ int DRIVE_SetSerialNumber( int drive, DWORD serial ) ...@@ -642,9 +645,9 @@ int DRIVE_SetSerialNumber( int drive, DWORD serial )
/*********************************************************************** /***********************************************************************
* DRIVE_GetType * DRIVE_GetType
*/ */
DRIVETYPE DRIVE_GetType( int drive ) static UINT DRIVE_GetType( int drive )
{ {
if (!DRIVE_IsValid( drive )) return TYPE_INVALID; if (!DRIVE_IsValid( drive )) return DRIVE_UNKNOWN;
return DOSDrives[drive].type; return DOSDrives[drive].type;
} }
...@@ -889,7 +892,7 @@ static int DRIVE_GetFreeSpace( int drive, PULARGE_INTEGER size, ...@@ -889,7 +892,7 @@ static int DRIVE_GetFreeSpace( int drive, PULARGE_INTEGER size,
# error "statfs has no bfree/bavail member!" # error "statfs has no bfree/bavail member!"
# endif # endif
#endif #endif
if (DRIVE_GetType(drive) == TYPE_CDROM) if (DOSDrives[drive].type == DRIVE_CDROM)
{ /* ALWAYS 0, even if no real CD-ROM mounted there !! */ { /* ALWAYS 0, even if no real CD-ROM mounted there !! */
available->QuadPart = 0; available->QuadPart = 0;
} }
...@@ -1025,7 +1028,7 @@ BOOL WINAPI GetDiskFreeSpaceA( LPCSTR root, LPDWORD cluster_sectors, ...@@ -1025,7 +1028,7 @@ BOOL WINAPI GetDiskFreeSpaceA( LPCSTR root, LPDWORD cluster_sectors,
available.s.HighPart =0; available.s.HighPart =0;
available.s.LowPart = 0x7fffffff; available.s.LowPart = 0x7fffffff;
} }
sec_size = (DRIVE_GetType(drive)==TYPE_CDROM) ? 2048 : 512; sec_size = (DRIVE_GetType(drive)==DRIVE_CDROM) ? 2048 : 512;
size.s.LowPart /= sec_size; size.s.LowPart /= sec_size;
available.s.LowPart /= sec_size; available.s.LowPart /= sec_size;
/* fixme: probably have to adjust those variables too for CDFS */ /* fixme: probably have to adjust those variables too for CDFS */
...@@ -1165,19 +1168,12 @@ BOOL WINAPI GetDiskFreeSpaceExW( LPCWSTR root, PULARGE_INTEGER avail, ...@@ -1165,19 +1168,12 @@ BOOL WINAPI GetDiskFreeSpaceExW( LPCWSTR root, PULARGE_INTEGER avail,
* RETURNS * RETURNS
* drivetype DRIVE_xxx * drivetype DRIVE_xxx
*/ */
UINT16 WINAPI GetDriveType16( UINT16 WINAPI GetDriveType16( UINT16 drive ) /* [in] number (NOT letter) of drive */
UINT16 drive /* [in] number (NOT letter) of drive */ {
) { UINT type = DRIVE_GetType(drive);
TRACE("(%c:)\n", 'A' + drive ); TRACE("(%c:)\n", 'A' + drive );
switch(DRIVE_GetType(drive)) if (type == DRIVE_CDROM) type = DRIVE_REMOTE;
{ return type;
case TYPE_FLOPPY: return DRIVE_REMOVABLE;
case TYPE_HD: return DRIVE_FIXED;
case TYPE_CDROM: return DRIVE_REMOTE;
case TYPE_NETWORK: return DRIVE_REMOTE;
case TYPE_INVALID:
default: return DRIVE_CANNOTDETERMINE;
}
} }
...@@ -1198,17 +1194,6 @@ UINT16 WINAPI GetDriveType16( ...@@ -1198,17 +1194,6 @@ UINT16 WINAPI GetDriveType16(
* DRIVE_REMOTE network disk * DRIVE_REMOTE network disk
* DRIVE_CDROM CDROM drive * DRIVE_CDROM CDROM drive
* DRIVE_RAMDISK virtual disk in RAM * DRIVE_RAMDISK virtual disk in RAM
*
* DRIVE_DOESNOTEXIST FIXME Not valid return value
* DRIVE_CANNOTDETERMINE FIXME Not valid return value
*
* BUGS
*
* Currently returns DRIVE_DOESNOTEXIST and DRIVE_CANNOTDETERMINE
* when it really should return DRIVE_NO_ROOT_DIR and DRIVE_UNKNOWN.
* Why were the former defines used?
*
* DRIVE_RAMDISK is unsupported.
*/ */
UINT WINAPI GetDriveTypeA(LPCSTR root) /* [in] String describing drive */ UINT WINAPI GetDriveTypeA(LPCSTR root) /* [in] String describing drive */
{ {
...@@ -1221,19 +1206,11 @@ UINT WINAPI GetDriveTypeA(LPCSTR root) /* [in] String describing drive */ ...@@ -1221,19 +1206,11 @@ UINT WINAPI GetDriveTypeA(LPCSTR root) /* [in] String describing drive */
if ((root[1]) && (root[1] != ':')) if ((root[1]) && (root[1] != ':'))
{ {
WARN("invalid root '%s'\n", debugstr_a(root)); WARN("invalid root '%s'\n", debugstr_a(root));
return DRIVE_DOESNOTEXIST; return DRIVE_NO_ROOT_DIR;
} }
drive = toupper(root[0]) - 'A'; drive = toupper(root[0]) - 'A';
} }
switch(DRIVE_GetType(drive)) return DRIVE_GetType(drive);
{
case TYPE_FLOPPY: return DRIVE_REMOVABLE;
case TYPE_HD: return DRIVE_FIXED;
case TYPE_CDROM: return DRIVE_CDROM;
case TYPE_NETWORK: return DRIVE_REMOTE;
case TYPE_INVALID: return DRIVE_DOESNOTEXIST;
default: return DRIVE_CANNOTDETERMINE;
}
} }
...@@ -1410,7 +1387,7 @@ DWORD WINAPI GetLogicalDrives(void) ...@@ -1410,7 +1387,7 @@ DWORD WINAPI GetLogicalDrives(void)
for (drive = 0; drive < MAX_DOS_DRIVES; drive++) for (drive = 0; drive < MAX_DOS_DRIVES; drive++)
{ {
if ( (DRIVE_IsValid(drive)) || if ( (DRIVE_IsValid(drive)) ||
(DOSDrives[drive].type == TYPE_CDROM)) /* audio CD is also valid */ (DOSDrives[drive].type == DRIVE_CDROM)) /* audio CD is also valid */
ret |= (1 << drive); ret |= (1 << drive);
} }
return ret; return ret;
...@@ -1469,7 +1446,7 @@ BOOL WINAPI GetVolumeInformationA( LPCSTR root, LPSTR label, ...@@ -1469,7 +1446,7 @@ BOOL WINAPI GetVolumeInformationA( LPCSTR root, LPSTR label,
} }
if (fsname) { if (fsname) {
/* Diablo checks that return code ... */ /* Diablo checks that return code ... */
if (DRIVE_GetType(drive)==TYPE_CDROM) if (DOSDrives[drive].type == DRIVE_CDROM)
lstrcpynA( fsname, "CDFS", fsname_len ); lstrcpynA( fsname, "CDFS", fsname_len );
else else
lstrcpynA( fsname, "FAT", fsname_len ); lstrcpynA( fsname, "FAT", fsname_len );
...@@ -1525,7 +1502,7 @@ BOOL WINAPI SetVolumeLabelA( LPCSTR root, LPCSTR volname ) ...@@ -1525,7 +1502,7 @@ BOOL WINAPI SetVolumeLabelA( LPCSTR root, LPCSTR volname )
if (!DRIVE_IsValid( drive )) return FALSE; if (!DRIVE_IsValid( drive )) return FALSE;
/* some copy protection stuff check this */ /* some copy protection stuff check this */
if (DRIVE_GetType( drive ) == TYPE_CDROM) return FALSE; if (DOSDrives[drive].type == DRIVE_CDROM) return FALSE;
FIXME("(%s,%s),stub!\n", root, volname); FIXME("(%s,%s),stub!\n", root, volname);
return TRUE; return TRUE;
......
...@@ -11,15 +11,6 @@ ...@@ -11,15 +11,6 @@
#define MAX_DOS_DRIVES 26 #define MAX_DOS_DRIVES 26
typedef enum
{
TYPE_FLOPPY,
TYPE_HD,
TYPE_CDROM,
TYPE_NETWORK,
TYPE_INVALID
} DRIVETYPE;
/* Drive flags */ /* Drive flags */
#define DRIVE_DISABLED 0x0001 /* Drive is disabled */ #define DRIVE_DISABLED 0x0001 /* Drive is disabled */
...@@ -41,7 +32,6 @@ extern const char * DRIVE_GetDevice( int drive ); ...@@ -41,7 +32,6 @@ extern const char * DRIVE_GetDevice( int drive );
extern const char * DRIVE_GetLabel( int drive ); extern const char * DRIVE_GetLabel( int drive );
extern DWORD DRIVE_GetSerialNumber( int drive ); extern DWORD DRIVE_GetSerialNumber( int drive );
extern int DRIVE_SetSerialNumber( int drive, DWORD serial ); extern int DRIVE_SetSerialNumber( int drive, DWORD serial );
extern DRIVETYPE DRIVE_GetType( int drive );
extern UINT DRIVE_GetFlags( int drive ); extern UINT DRIVE_GetFlags( int drive );
extern int DRIVE_Chdir( int drive, const char *path ); extern int DRIVE_Chdir( int drive, const char *path );
extern int DRIVE_Disable( int drive ); extern int DRIVE_Disable( int drive );
......
...@@ -164,8 +164,8 @@ typedef struct ...@@ -164,8 +164,8 @@ typedef struct
/* GetTempFileName() Flags */ /* GetTempFileName() Flags */
#define TF_FORCEDRIVE 0x80 #define TF_FORCEDRIVE 0x80
#define DRIVE_CANNOTDETERMINE 0 #define DRIVE_UNKNOWN 0
#define DRIVE_DOESNOTEXIST 1 #define DRIVE_NO_ROOT_DIR 1
#define DRIVE_REMOVABLE 2 #define DRIVE_REMOVABLE 2
#define DRIVE_FIXED 3 #define DRIVE_FIXED 3
#define DRIVE_REMOTE 4 #define DRIVE_REMOTE 4
......
...@@ -42,8 +42,9 @@ int CDROM_Open(WINE_CDAUDIO* wcda, int drive) ...@@ -42,8 +42,9 @@ int CDROM_Open(WINE_CDAUDIO* wcda, int drive)
if (drive == -1) if (drive == -1)
{ {
for (i=0; i < MAX_DOS_DRIVES; i++) char root[] = "A:\\";
if (DRIVE_GetType(i) == TYPE_CDROM) for (i=0; i < MAX_DOS_DRIVES; i++, root[0]++)
if (GetDriveTypeA(root) == DRIVE_CDROM)
{ {
drive = i; drive = i;
avail = TRUE; avail = TRUE;
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "windef.h" #include "windef.h"
#include "miscemu.h" #include "miscemu.h"
#include "msdos.h" #include "msdos.h"
#include "drive.h"
#include "debugtools.h" #include "debugtools.h"
#include "options.h" #include "options.h"
...@@ -51,8 +50,8 @@ void WINAPI INT_Int11Handler( CONTEXT86 *context ) ...@@ -51,8 +50,8 @@ void WINAPI INT_Int11Handler( CONTEXT86 *context )
bit 2 (always set) bit 2 (always set)
*/ */
if (DRIVE_IsValid(0)) diskdrives++; if (GetDriveTypeA("A:\\") == DRIVE_REMOVABLE) diskdrives++;
if (DRIVE_IsValid(1)) diskdrives++; if (GetDriveTypeA("B:\\") == DRIVE_REMOVABLE) diskdrives++;
if (diskdrives) diskdrives--; if (diskdrives) diskdrives--;
for (x=0; x < 9; x++) for (x=0; x < 9; x++)
......
...@@ -63,11 +63,12 @@ void WINAPI INT_Int13Handler( CONTEXT86 *context ) ...@@ -63,11 +63,12 @@ void WINAPI INT_Int13Handler( CONTEXT86 *context )
BYTE drive_nr = DL_reg(context); BYTE drive_nr = DL_reg(context);
int floppy_fd; int floppy_fd;
struct floppy_drive_params floppy_parm; struct floppy_drive_params floppy_parm;
char root[] = "A:\\";
AH_reg(context) = 0x00; /* success */ AH_reg(context) = 0x00; /* success */
for (i = 0; i < MAX_DOS_DRIVES; i++) for (i = 0; i < MAX_DOS_DRIVES; i++, root[0]++)
if (DRIVE_GetType(i) == TYPE_FLOPPY) nr_of_drives++; if (GetDriveTypeA(root) == DRIVE_REMOVABLE) nr_of_drives++;
DL_reg(context) = nr_of_drives; DL_reg(context) = nr_of_drives;
if (drive_nr > 1) { /* invalid drive ? */ if (drive_nr > 1) { /* invalid drive ? */
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "miscemu.h" #include "miscemu.h"
#include "debugtools.h" #include "debugtools.h"
#include "msdos.h" #include "msdos.h"
#include "drive.h"
#include "winnt.h" #include "winnt.h"
DEFAULT_DEBUG_CHANNEL(int17); DEFAULT_DEBUG_CHANNEL(int17);
......
...@@ -383,7 +383,7 @@ static BOOL ioctlGenericBlkDevReq( CONTEXT86 *context ) ...@@ -383,7 +383,7 @@ static BOOL ioctlGenericBlkDevReq( CONTEXT86 *context )
case 0x72: case 0x72:
/* Trail on error implementation */ /* Trail on error implementation */
AX_reg(context) = GetDriveType16(BL_reg(context)) == DRIVE_CANNOTDETERMINE ? 0x0f : 0x01; AX_reg(context) = GetDriveType16(BL_reg(context)) == DRIVE_UNKNOWN ? 0x0f : 0x01;
SET_CFLAG(context); /* Seems to be set all the time */ SET_CFLAG(context); /* Seems to be set all the time */
break; break;
...@@ -1651,7 +1651,7 @@ void WINAPI DOS3Call( CONTEXT86 *context ) ...@@ -1651,7 +1651,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
INT21_DriveName( BL_reg(context))); INT21_DriveName( BL_reg(context)));
switch(GetDriveType16( DOS_GET_DRIVE( BL_reg(context) ))) switch(GetDriveType16( DOS_GET_DRIVE( BL_reg(context) )))
{ {
case DRIVE_CANNOTDETERMINE: case DRIVE_UNKNOWN:
SetLastError( ERROR_INVALID_DRIVE ); SetLastError( ERROR_INVALID_DRIVE );
AX_reg(context) = ERROR_INVALID_DRIVE; AX_reg(context) = ERROR_INVALID_DRIVE;
SET_CFLAG(context); SET_CFLAG(context);
...@@ -1670,7 +1670,7 @@ void WINAPI DOS3Call( CONTEXT86 *context ) ...@@ -1670,7 +1670,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
INT21_DriveName( BL_reg(context))); INT21_DriveName( BL_reg(context)));
switch(GetDriveType16( DOS_GET_DRIVE( BL_reg(context) ))) switch(GetDriveType16( DOS_GET_DRIVE( BL_reg(context) )))
{ {
case DRIVE_CANNOTDETERMINE: case DRIVE_UNKNOWN:
SetLastError( ERROR_INVALID_DRIVE ); SetLastError( ERROR_INVALID_DRIVE );
AX_reg(context) = ERROR_INVALID_DRIVE; AX_reg(context) = ERROR_INVALID_DRIVE;
SET_CFLAG(context); SET_CFLAG(context);
...@@ -2241,37 +2241,20 @@ void WINAPI DOS3Call( CONTEXT86 *context ) ...@@ -2241,37 +2241,20 @@ void WINAPI DOS3Call( CONTEXT86 *context )
{ {
LPCSTR driveroot = (LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs,context->Edx); LPCSTR driveroot = (LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs,context->Edx);
LPSTR buffer = (LPSTR)CTX_SEG_OFF_TO_LIN(context, context->SegEs,context->Edi); LPSTR buffer = (LPSTR)CTX_SEG_OFF_TO_LIN(context, context->SegEs,context->Edi);
int drive; DWORD filename_len, flags;
UINT flags;
TRACE("LONG FILENAME - GET VOLUME INFORMATION for drive having root dir '%s'.\n", driveroot); TRACE("LONG FILENAME - GET VOLUME INFORMATION for drive having root dir '%s'.\n", driveroot);
AX_reg(context) = 0; AX_reg(context) = 0;
if (!driveroot) if (!GetVolumeInformationA( driveroot, NULL, 0, NULL, &filename_len,
&flags, buffer, 8 ))
{ {
INT_BARF( context, 0x21 ); INT_BARF( context, 0x21 );
SET_CFLAG(context); SET_CFLAG(context);
break; break;
} }
drive = toupper(driveroot[0]) - 'A'; BX_reg(context) = flags | 0x4000; /* support for LFN functions */
flags = DRIVE_GetFlags(toupper(driveroot[0]) - 'A'); CX_reg(context) = filename_len;
BX_reg(context) = 0x4000; /* support for LFN functions */
if (flags & DRIVE_CASE_SENSITIVE)
BX_reg(context) |= 1;
if (flags & DRIVE_CASE_PRESERVING)
BX_reg(context) |= 2;
/***** FIXME: not supported yet (needed ?)
if (flags & DRIVE_UNICODE)
BX_reg(context) |= 4;
if (flags & DRIVE_COMPRESSED)
BX_reg(context) |= 0x8000;
*****/
CX_reg(context) = (flags & DRIVE_SHORT_NAMES) ? 11 : 255; /* FIXME: 12 ? */
DX_reg(context) = MAX_PATH; /* FIXME: which len if DRIVE_SHORT_NAMES ? */ DX_reg(context) = MAX_PATH; /* FIXME: which len if DRIVE_SHORT_NAMES ? */
if (DRIVE_GetType(drive) == TYPE_CDROM)
/* valid for data _and_ audio */
strcpy(buffer, "CDFS"); /* FIXME: fail if no CD in drive */
else
strcpy(buffer, "FAT");
} }
break; break;
case 0xa1: /* Find close */ case 0xa1: /* Find close */
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "dosexe.h" #include "dosexe.h"
#include "drive.h"
#include "miscemu.h" #include "miscemu.h"
#include "module.h" #include "module.h"
#include "task.h" #include "task.h"
...@@ -424,6 +423,13 @@ static void MSCDEX_StoreMSF(DWORD frame, BYTE* val) ...@@ -424,6 +423,13 @@ static void MSCDEX_StoreMSF(DWORD frame, BYTE* val)
val[0] = frame - CDFRAMES_PERMIN * val[2] - CDFRAMES_PERSEC * val[1]; /* frames */ val[0] = frame - CDFRAMES_PERMIN * val[2] - CDFRAMES_PERSEC * val[1]; /* frames */
} }
static int is_cdrom( int drive)
{
char root[] = "A:\\";
root[0] += drive;
return (GetDriveTypeA(root) == DRIVE_CDROM);
}
static void MSCDEX_Handler(CONTEXT86* context) static void MSCDEX_Handler(CONTEXT86* context)
{ {
int drive, count; int drive, count;
...@@ -433,19 +439,19 @@ static void MSCDEX_Handler(CONTEXT86* context) ...@@ -433,19 +439,19 @@ static void MSCDEX_Handler(CONTEXT86* context)
case 0x00: /* Installation check */ case 0x00: /* Installation check */
/* Count the number of contiguous CDROM drives /* Count the number of contiguous CDROM drives
*/ */
for (drive = count = 0; drive < MAX_DOS_DRIVES; drive++) { for (drive = count = 0; drive < 26; drive++) {
if (DRIVE_GetType(drive) == TYPE_CDROM) { if (is_cdrom(drive)) {
while (DRIVE_GetType(drive + count) == TYPE_CDROM) count++; while (is_cdrom(drive + count)) count++;
break; break;
} }
} }
TRACE("Installation check: %d cdroms, starting at %d\n", count, drive); TRACE("Installation check: %d cdroms, starting at %d\n", count, drive);
BX_reg(context) = count; BX_reg(context) = count;
CX_reg(context) = (drive < MAX_DOS_DRIVES) ? drive : 0; CX_reg(context) = (drive < 26) ? drive : 0;
break; break;
case 0x0B: /* drive check */ case 0x0B: /* drive check */
AX_reg(context) = (DRIVE_GetType(CX_reg(context)) == TYPE_CDROM); AX_reg(context) = is_cdrom(CX_reg(context));
BX_reg(context) = 0xADAD; BX_reg(context) = 0xADAD;
break; break;
...@@ -456,9 +462,9 @@ static void MSCDEX_Handler(CONTEXT86* context) ...@@ -456,9 +462,9 @@ static void MSCDEX_Handler(CONTEXT86* context)
case 0x0D: /* get drive letters */ case 0x0D: /* get drive letters */
p = CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Ebx); p = CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Ebx);
memset(p, 0, MAX_DOS_DRIVES); memset(p, 0, 26);
for (drive = 0; drive < MAX_DOS_DRIVES; drive++) { for (drive = 0; drive < 26; drive++) {
if (DRIVE_GetType(drive) == TYPE_CDROM) *p++ = drive; if (is_cdrom(drive)) *p++ = drive;
} }
TRACE("Get drive letters\n"); TRACE("Get drive letters\n");
break; break;
...@@ -490,9 +496,7 @@ static void MSCDEX_Handler(CONTEXT86* context) ...@@ -490,9 +496,7 @@ static void MSCDEX_Handler(CONTEXT86* context)
dev = CDROM_OpenDev(&wcda); dev = CDROM_OpenDev(&wcda);
TRACE("CDROM device driver -> command <%d>\n", (unsigned char)driver_request[2]); TRACE("CDROM device driver -> command <%d>\n", (unsigned char)driver_request[2]);
for (drive = 0; for (drive = 0; drive < 26; drive++) if (is_cdrom(drive)) break;
drive < MAX_DOS_DRIVES && DRIVE_GetType(drive) != TYPE_CDROM;
drive++);
/* drive contains the first CD ROM */ /* drive contains the first CD ROM */
if (CX_reg(context) != drive) { if (CX_reg(context) != drive) {
WARN("Request made doesn't match a CD ROM drive (%d/%d)\n", CX_reg(context), drive); WARN("Request made doesn't match a CD ROM drive (%d/%d)\n", CX_reg(context), drive);
......
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