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.
diff --git a/controls/combo.c b/controls/combo.c
index b8860fe..e0594b1 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -18,7 +18,6 @@
#include "user.h"
#include "heap.h"
#include "controls.h"
-#include "drive.h"
#include "debugtools.h"
#include "tweak.h"
diff --git a/controls/listbox.c b/controls/listbox.c
index e4e69c9..18bebd5 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -13,7 +13,6 @@
#include "wine/winbase16.h"
#include "winuser.h"
#include "winerror.h"
-#include "drive.h"
#include "heap.h"
#include "spy.h"
#include "selectors.h"
@@ -1736,10 +1735,11 @@
if ((ret >= 0) && (attrib & DDL_DRIVES))
{
char buffer[] = "[-a-]";
+ char root[] = "A:\\";
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)
break;
}
diff --git a/dlls/commdlg/filedlg.c b/dlls/commdlg/filedlg.c
index 88abbd1..52ab0e2 100644
--- a/dlls/commdlg/filedlg.c
+++ b/dlls/commdlg/filedlg.c
@@ -610,7 +610,7 @@
for(i = 0, n = -1; i < 26; 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;
}
}
diff --git a/dlls/shell32/shell.c b/dlls/shell32/shell.c
index d17ca47..5ccc869 100644
--- a/dlls/shell32/shell.c
+++ b/dlls/shell32/shell.c
@@ -843,8 +843,8 @@
case DRIVE_CDROM:
ret = DRIVE_REMOTE;
break;
- case DRIVE_DOESNOTEXIST:
- ret = DRIVE_CANNOTDETERMINE;
+ case DRIVE_NO_ROOT_DIR:
+ ret = DRIVE_UNKNOWN;
break;
}
return ret;
diff --git a/dlls/user/network.c b/dlls/user/network.c
index 762ecbf..06fc9eb 100644
--- a/dlls/user/network.c
+++ b/dlls/user/network.c
@@ -11,7 +11,6 @@
#include "winbase.h"
#include "wine/winnet16.h"
#include "winnetwk.h"
-#include "drive.h"
#include "debugtools.h"
#include "heap.h"
@@ -167,34 +166,29 @@
WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
LPSTR lpRemoteName, UINT16 *cbRemoteName )
{
- const char *path;
+ char label[32];
TRACE( "local %s\n", lpLocalName );
- if (lpLocalName[1] == ':')
+ switch(GetDriveTypeA(lpLocalName))
{
- int drive = toupper(lpLocalName[0]) - 'A';
- switch(GetDriveTypeA(lpLocalName))
+ case DRIVE_REMOTE:
+ GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
+ if (strlen(label) + 1 > *cbRemoteName)
{
- case DRIVE_REMOTE:
- path = DRIVE_GetLabel(drive);
- if (strlen(path) + 1 > *cbRemoteName)
- {
- *cbRemoteName = strlen(path) + 1;
- return WN16_MORE_DATA;
- }
- strcpy( lpRemoteName, path );
- *cbRemoteName = strlen(lpRemoteName) + 1;
- return WN16_SUCCESS;
- case DRIVE_REMOVABLE:
- case DRIVE_FIXED:
- case DRIVE_CDROM:
- TRACE("file is local\n");
- return WN16_NOT_CONNECTED;
- default:
- return WN16_BAD_LOCALNAME;
+ *cbRemoteName = strlen(label) + 1;
+ return WN16_MORE_DATA;
}
+ strcpy( lpRemoteName, label );
+ *cbRemoteName = strlen(lpRemoteName) + 1;
+ return WN16_SUCCESS;
+ case DRIVE_REMOVABLE:
+ case DRIVE_FIXED:
+ case DRIVE_CDROM:
+ TRACE("file is local\n");
+ return WN16_NOT_CONNECTED;
+ default:
+ return WN16_BAD_LOCALNAME;
}
- return WN16_BAD_LOCALNAME;
}
/**************************************************************************
@@ -396,7 +390,7 @@
WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
{
UINT type = GetDriveTypeA(lpName);
- if ( type == DRIVE_DOESNOTEXIST )
+ if ( type == DRIVE_NO_ROOT_DIR )
type = GetDriveTypeA(NULL);
*lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
diff --git a/files/drive.c b/files/drive.c
index 6ab76ae..9981ed6 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -64,7 +64,7 @@
char label_conf[12]; /* drive label as cfg'd in wine.conf */
char label_read[12]; /* drive label as read from device */
DWORD serial_conf; /* drive serial number as cfg'd in wine.conf */
- DRIVETYPE type; /* drive type */
+ UINT type; /* drive type */
UINT flags; /* drive flags */
dev_t dev; /* unix device number */
ino_t ino; /* unix inode number */
@@ -73,10 +73,13 @@
static const char * const DRIVE_Types[] =
{
- "floppy", /* TYPE_FLOPPY */
- "hd", /* TYPE_HD */
- "cdrom", /* TYPE_CDROM */
- "network" /* TYPE_NETWORK */
+ "", /* DRIVE_UNKNOWN */
+ "", /* DRIVE_NO_ROOT_DIR */
+ "floppy", /* DRIVE_REMOVABLE */
+ "hd", /* DRIVE_FIXED */
+ "network", /* DRIVE_REMOTE */
+ "cdrom", /* DRIVE_CDROM */
+ "ramdisk" /* DRIVE_RAMDISK */
};
@@ -109,7 +112,7 @@
/***********************************************************************
* DRIVE_GetDriveType
*/
-static DRIVETYPE DRIVE_GetDriveType( const char *name )
+static UINT DRIVE_GetDriveType( const char *name )
{
char buffer[20];
int i;
@@ -117,11 +120,11 @@
PROFILE_GetWineIniString( name, "Type", "hd", buffer, sizeof(buffer) );
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",
name, buffer );
- return TYPE_HD;
+ return DRIVE_FIXED;
}
@@ -218,7 +221,7 @@
drive->flags |= DRIVE_FAIL_READ_ONLY;
/* 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;
count++;
@@ -240,7 +243,7 @@
DOSDrives[2].unix_cwd = HEAP_strdupA( GetProcessHeap(), 0, "" );
strcpy( DOSDrives[2].label_conf, "Drive C " );
DOSDrives[2].serial_conf = 12345678;
- DOSDrives[2].type = TYPE_HD;
+ DOSDrives[2].type = DRIVE_FIXED;
DOSDrives[2].device = NULL;
DOSDrives[2].flags = 0;
DRIVE_CurDrive = 2;
@@ -463,16 +466,16 @@
switch(DOSDrives[drive].type)
{
- case TYPE_FLOPPY:
- case TYPE_HD:
+ case DRIVE_REMOVABLE:
+ case DRIVE_FIXED:
offs = 0;
break;
- case TYPE_CDROM:
+ case DRIVE_CDROM:
offs = CDROM_Data_FindBestVoldesc(fd);
break;
- default:
- offs = 0;
- break;
+ default:
+ offs = 0;
+ break;
}
if ((offs) && (lseek(fd,offs,SEEK_SET)!=offs)) return -4;
@@ -480,8 +483,8 @@
switch(DOSDrives[drive].type)
{
- case TYPE_FLOPPY:
- case TYPE_HD:
+ case DRIVE_REMOVABLE:
+ case DRIVE_FIXED:
if ((buff[0x26]!=0x29) || /* Check for FAT present */
/* FIXME: do really all FAT have their name beginning with
"FAT" ? (At least FAT12, FAT16 and FAT32 have :) */
@@ -492,7 +495,7 @@
return -3;
}
break;
- case TYPE_CDROM:
+ case DRIVE_CDROM:
if (strncmp(&buff[1],"CD001",5)) /* Check for iso9660 present */
return -3;
/* FIXME: do we need to check for "CDROM", too ? (high sierra) */
@@ -552,7 +555,7 @@
int offs = -1;
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);
}
@@ -563,8 +566,8 @@
ERR("Invalid or unreadable superblock on %s (%c:).\n",
DOSDrives[drive].device, (char)(drive+'A'));
else {
- if (DOSDrives[drive].type == TYPE_FLOPPY ||
- DOSDrives[drive].type == TYPE_HD)
+ if (DOSDrives[drive].type == DRIVE_REMOVABLE ||
+ DOSDrives[drive].type == DRIVE_FIXED)
offs = 0x2b;
/* FIXME: ISO9660 uses a 32 bytes long label. Should we do also? */
@@ -593,20 +596,20 @@
{
switch(DOSDrives[drive].type)
{
- case TYPE_FLOPPY:
- case TYPE_HD:
- if (DRIVE_ReadSuperblock(drive,(char *) buff))
- MESSAGE("Invalid or unreadable superblock on %s (%c:)."
- " Maybe not FAT?\n" ,
- DOSDrives[drive].device, 'A'+drive);
- else
- serial = *((DWORD*)(buff+0x27));
- break;
- case TYPE_CDROM:
- serial = CDROM_GetSerial(drive);
- break;
- default:
- FIXME("Serial number reading from file system on drive %c: not supported yet.\n", drive+'A');
+ case DRIVE_REMOVABLE:
+ case DRIVE_FIXED:
+ if (DRIVE_ReadSuperblock(drive,(char *) buff))
+ MESSAGE("Invalid or unreadable superblock on %s (%c:)."
+ " Maybe not FAT?\n" ,
+ DOSDrives[drive].device, 'A'+drive);
+ else
+ serial = *((DWORD*)(buff+0x27));
+ break;
+ case DRIVE_CDROM:
+ serial = CDROM_GetSerial(drive);
+ break;
+ default:
+ FIXME("Serial number reading from file system on drive %c: not supported yet.\n", drive+'A');
}
}
@@ -625,15 +628,15 @@
if (DOSDrives[drive].flags & DRIVE_READ_VOL_INFO)
{
- if ((DOSDrives[drive].type != TYPE_FLOPPY) &&
- (DOSDrives[drive].type != TYPE_HD)) return 0;
+ if ((DOSDrives[drive].type != DRIVE_REMOVABLE) &&
+ (DOSDrives[drive].type != DRIVE_FIXED)) return 0;
/* check, if the drive has a FAT filesystem */
if (DRIVE_ReadSuperblock(drive, buff)) return 0;
if (DRIVE_WriteSuperblockEntry(drive, 0x27, 4, (char *) &serial)) return 0;
return 1;
}
- if (DOSDrives[drive].type == TYPE_CDROM) return 0;
+ if (DOSDrives[drive].type == DRIVE_CDROM) return 0;
DOSDrives[drive].serial_conf = serial;
return 1;
}
@@ -642,9 +645,9 @@
/***********************************************************************
* 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;
}
@@ -889,7 +892,7 @@
# error "statfs has no bfree/bavail member!"
# endif
#endif
- if (DRIVE_GetType(drive) == TYPE_CDROM)
+ if (DOSDrives[drive].type == DRIVE_CDROM)
{ /* ALWAYS 0, even if no real CD-ROM mounted there !! */
available->QuadPart = 0;
}
@@ -1025,7 +1028,7 @@
available.s.HighPart =0;
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;
available.s.LowPart /= sec_size;
/* fixme: probably have to adjust those variables too for CDFS */
@@ -1165,19 +1168,12 @@
* RETURNS
* drivetype DRIVE_xxx
*/
-UINT16 WINAPI GetDriveType16(
- UINT16 drive /* [in] number (NOT letter) of drive */
-) {
+UINT16 WINAPI GetDriveType16( UINT16 drive ) /* [in] number (NOT letter) of drive */
+{
+ UINT type = DRIVE_GetType(drive);
TRACE("(%c:)\n", 'A' + drive );
- switch(DRIVE_GetType(drive))
- {
- 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;
- }
+ if (type == DRIVE_CDROM) type = DRIVE_REMOTE;
+ return type;
}
@@ -1198,17 +1194,6 @@
* DRIVE_REMOTE network disk
* DRIVE_CDROM CDROM drive
* 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 */
{
@@ -1221,19 +1206,11 @@
if ((root[1]) && (root[1] != ':'))
{
WARN("invalid root '%s'\n", debugstr_a(root));
- return DRIVE_DOESNOTEXIST;
+ return DRIVE_NO_ROOT_DIR;
}
drive = toupper(root[0]) - 'A';
}
- switch(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;
- }
+ return DRIVE_GetType(drive);
}
@@ -1410,7 +1387,7 @@
for (drive = 0; drive < MAX_DOS_DRIVES; 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);
}
return ret;
@@ -1469,7 +1446,7 @@
}
if (fsname) {
/* Diablo checks that return code ... */
- if (DRIVE_GetType(drive)==TYPE_CDROM)
+ if (DOSDrives[drive].type == DRIVE_CDROM)
lstrcpynA( fsname, "CDFS", fsname_len );
else
lstrcpynA( fsname, "FAT", fsname_len );
@@ -1525,7 +1502,7 @@
if (!DRIVE_IsValid( drive )) return FALSE;
/* 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);
return TRUE;
diff --git a/include/drive.h b/include/drive.h
index a26d639..4673d75 100644
--- a/include/drive.h
+++ b/include/drive.h
@@ -11,15 +11,6 @@
#define MAX_DOS_DRIVES 26
-typedef enum
-{
- TYPE_FLOPPY,
- TYPE_HD,
- TYPE_CDROM,
- TYPE_NETWORK,
- TYPE_INVALID
-} DRIVETYPE;
-
/* Drive flags */
#define DRIVE_DISABLED 0x0001 /* Drive is disabled */
@@ -41,7 +32,6 @@
extern const char * DRIVE_GetLabel( int drive );
extern DWORD DRIVE_GetSerialNumber( int drive );
extern int DRIVE_SetSerialNumber( int drive, DWORD serial );
-extern DRIVETYPE DRIVE_GetType( int drive );
extern UINT DRIVE_GetFlags( int drive );
extern int DRIVE_Chdir( int drive, const char *path );
extern int DRIVE_Disable( int drive );
diff --git a/include/winbase.h b/include/winbase.h
index 3a1e658..fc58e60 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -164,8 +164,8 @@
/* GetTempFileName() Flags */
#define TF_FORCEDRIVE 0x80
-#define DRIVE_CANNOTDETERMINE 0
-#define DRIVE_DOESNOTEXIST 1
+#define DRIVE_UNKNOWN 0
+#define DRIVE_NO_ROOT_DIR 1
#define DRIVE_REMOVABLE 2
#define DRIVE_FIXED 3
#define DRIVE_REMOTE 4
diff --git a/misc/cdrom.c b/misc/cdrom.c
index 695eb18..c15736d 100644
--- a/misc/cdrom.c
+++ b/misc/cdrom.c
@@ -42,8 +42,9 @@
if (drive == -1)
{
- for (i=0; i < MAX_DOS_DRIVES; i++)
- if (DRIVE_GetType(i) == TYPE_CDROM)
+ char root[] = "A:\\";
+ for (i=0; i < MAX_DOS_DRIVES; i++, root[0]++)
+ if (GetDriveTypeA(root) == DRIVE_CDROM)
{
drive = i;
avail = TRUE;
diff --git a/msdos/int11.c b/msdos/int11.c
index 58d7b63..3aabe29 100644
--- a/msdos/int11.c
+++ b/msdos/int11.c
@@ -9,7 +9,6 @@
#include "windef.h"
#include "miscemu.h"
#include "msdos.h"
-#include "drive.h"
#include "debugtools.h"
#include "options.h"
@@ -51,8 +50,8 @@
bit 2 (always set)
*/
- if (DRIVE_IsValid(0)) diskdrives++;
- if (DRIVE_IsValid(1)) diskdrives++;
+ if (GetDriveTypeA("A:\\") == DRIVE_REMOVABLE) diskdrives++;
+ if (GetDriveTypeA("B:\\") == DRIVE_REMOVABLE) diskdrives++;
if (diskdrives) diskdrives--;
for (x=0; x < 9; x++)
diff --git a/msdos/int13.c b/msdos/int13.c
index f2b1538..91d6568 100644
--- a/msdos/int13.c
+++ b/msdos/int13.c
@@ -63,11 +63,12 @@
BYTE drive_nr = DL_reg(context);
int floppy_fd;
struct floppy_drive_params floppy_parm;
+ char root[] = "A:\\";
AH_reg(context) = 0x00; /* success */
- for (i = 0; i < MAX_DOS_DRIVES; i++)
- if (DRIVE_GetType(i) == TYPE_FLOPPY) nr_of_drives++;
+ for (i = 0; i < MAX_DOS_DRIVES; i++, root[0]++)
+ if (GetDriveTypeA(root) == DRIVE_REMOVABLE) nr_of_drives++;
DL_reg(context) = nr_of_drives;
if (drive_nr > 1) { /* invalid drive ? */
diff --git a/msdos/int17.c b/msdos/int17.c
index 11f4d81..48c0212 100644
--- a/msdos/int17.c
+++ b/msdos/int17.c
@@ -7,7 +7,6 @@
#include "miscemu.h"
#include "debugtools.h"
#include "msdos.h"
-#include "drive.h"
#include "winnt.h"
DEFAULT_DEBUG_CHANNEL(int17);
diff --git a/msdos/int21.c b/msdos/int21.c
index 654056d..40be812 100644
--- a/msdos/int21.c
+++ b/msdos/int21.c
@@ -383,7 +383,7 @@
case 0x72:
/* 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 */
break;
@@ -1651,7 +1651,7 @@
INT21_DriveName( BL_reg(context)));
switch(GetDriveType16( DOS_GET_DRIVE( BL_reg(context) )))
{
- case DRIVE_CANNOTDETERMINE:
+ case DRIVE_UNKNOWN:
SetLastError( ERROR_INVALID_DRIVE );
AX_reg(context) = ERROR_INVALID_DRIVE;
SET_CFLAG(context);
@@ -1670,7 +1670,7 @@
INT21_DriveName( BL_reg(context)));
switch(GetDriveType16( DOS_GET_DRIVE( BL_reg(context) )))
{
- case DRIVE_CANNOTDETERMINE:
+ case DRIVE_UNKNOWN:
SetLastError( ERROR_INVALID_DRIVE );
AX_reg(context) = ERROR_INVALID_DRIVE;
SET_CFLAG(context);
@@ -2241,37 +2241,20 @@
{
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);
- int drive;
- UINT flags;
+ DWORD filename_len, flags;
TRACE("LONG FILENAME - GET VOLUME INFORMATION for drive having root dir '%s'.\n", driveroot);
AX_reg(context) = 0;
- if (!driveroot)
- {
- INT_BARF( context, 0x21 );
- SET_CFLAG(context);
- break;
- }
- drive = toupper(driveroot[0]) - 'A';
- flags = DRIVE_GetFlags(toupper(driveroot[0]) - 'A');
- 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 ? */
+ if (!GetVolumeInformationA( driveroot, NULL, 0, NULL, &filename_len,
+ &flags, buffer, 8 ))
+ {
+ INT_BARF( context, 0x21 );
+ SET_CFLAG(context);
+ break;
+ }
+ BX_reg(context) = flags | 0x4000; /* support for LFN functions */
+ CX_reg(context) = filename_len;
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;
case 0xa1: /* Find close */
diff --git a/msdos/int2f.c b/msdos/int2f.c
index 70fc4b7..3ab033e 100644
--- a/msdos/int2f.c
+++ b/msdos/int2f.c
@@ -11,7 +11,6 @@
#include "wine/winbase16.h"
#include "dosexe.h"
-#include "drive.h"
#include "miscemu.h"
#include "module.h"
#include "task.h"
@@ -424,6 +423,13 @@
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)
{
int drive, count;
@@ -433,19 +439,19 @@
case 0x00: /* Installation check */
/* Count the number of contiguous CDROM drives
*/
- for (drive = count = 0; drive < MAX_DOS_DRIVES; drive++) {
- if (DRIVE_GetType(drive) == TYPE_CDROM) {
- while (DRIVE_GetType(drive + count) == TYPE_CDROM) count++;
+ for (drive = count = 0; drive < 26; drive++) {
+ if (is_cdrom(drive)) {
+ while (is_cdrom(drive + count)) count++;
break;
}
}
TRACE("Installation check: %d cdroms, starting at %d\n", count, drive);
BX_reg(context) = count;
- CX_reg(context) = (drive < MAX_DOS_DRIVES) ? drive : 0;
+ CX_reg(context) = (drive < 26) ? drive : 0;
break;
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;
break;
@@ -456,9 +462,9 @@
case 0x0D: /* get drive letters */
p = CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Ebx);
- memset(p, 0, MAX_DOS_DRIVES);
- for (drive = 0; drive < MAX_DOS_DRIVES; drive++) {
- if (DRIVE_GetType(drive) == TYPE_CDROM) *p++ = drive;
+ memset(p, 0, 26);
+ for (drive = 0; drive < 26; drive++) {
+ if (is_cdrom(drive)) *p++ = drive;
}
TRACE("Get drive letters\n");
break;
@@ -490,9 +496,7 @@
dev = CDROM_OpenDev(&wcda);
TRACE("CDROM device driver -> command <%d>\n", (unsigned char)driver_request[2]);
- for (drive = 0;
- drive < MAX_DOS_DRIVES && DRIVE_GetType(drive) != TYPE_CDROM;
- drive++);
+ for (drive = 0; drive < 26; drive++) if (is_cdrom(drive)) break;
/* drive contains the first CD ROM */
if (CX_reg(context) != drive) {
WARN("Request made doesn't match a CD ROM drive (%d/%d)\n", CX_reg(context), drive);