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.
This commit is contained in:
parent
c9b3b2e8f8
commit
bf67259a41
|
@ -18,7 +18,6 @@
|
|||
#include "user.h"
|
||||
#include "heap.h"
|
||||
#include "controls.h"
|
||||
#include "drive.h"
|
||||
#include "debugtools.h"
|
||||
#include "tweak.h"
|
||||
|
||||
|
|
|
@ -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 @@ static LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT attrib,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -610,7 +610,7 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -843,8 +843,8 @@ UINT16 WINAPI DriveType16( UINT16 drive )
|
|||
case DRIVE_CDROM:
|
||||
ret = DRIVE_REMOTE;
|
||||
break;
|
||||
case DRIVE_DOESNOTEXIST:
|
||||
ret = DRIVE_CANNOTDETERMINE;
|
||||
case DRIVE_NO_ROOT_DIR:
|
||||
ret = DRIVE_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "winbase.h"
|
||||
#include "wine/winnet16.h"
|
||||
#include "winnetwk.h"
|
||||
#include "drive.h"
|
||||
#include "debugtools.h"
|
||||
#include "heap.h"
|
||||
|
||||
|
@ -167,22 +166,19 @@ WORD WINAPI WNetCancelConnection16( LPSTR lpName, BOOL16 bForce )
|
|||
WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
|
||||
LPSTR lpRemoteName, UINT16 *cbRemoteName )
|
||||
{
|
||||
const char *path;
|
||||
char label[32];
|
||||
|
||||
TRACE( "local %s\n", lpLocalName );
|
||||
if (lpLocalName[1] == ':')
|
||||
{
|
||||
int drive = toupper(lpLocalName[0]) - 'A';
|
||||
switch(GetDriveTypeA(lpLocalName))
|
||||
{
|
||||
case DRIVE_REMOTE:
|
||||
path = DRIVE_GetLabel(drive);
|
||||
if (strlen(path) + 1 > *cbRemoteName)
|
||||
GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
|
||||
if (strlen(label) + 1 > *cbRemoteName)
|
||||
{
|
||||
*cbRemoteName = strlen(path) + 1;
|
||||
*cbRemoteName = strlen(label) + 1;
|
||||
return WN16_MORE_DATA;
|
||||
}
|
||||
strcpy( lpRemoteName, path );
|
||||
strcpy( lpRemoteName, label );
|
||||
*cbRemoteName = strlen(lpRemoteName) + 1;
|
||||
return WN16_SUCCESS;
|
||||
case DRIVE_REMOVABLE:
|
||||
|
@ -193,8 +189,6 @@ WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
|
|||
default:
|
||||
return WN16_BAD_LOCALNAME;
|
||||
}
|
||||
}
|
||||
return WN16_BAD_LOCALNAME;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -396,7 +390,7 @@ WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName,
|
|||
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;
|
||||
|
|
107
files/drive.c
107
files/drive.c
|
@ -64,7 +64,7 @@ typedef struct
|
|||
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 @@ typedef struct
|
|||
|
||||
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 @@ static HTASK16 DRIVE_LastTask = 0;
|
|||
/***********************************************************************
|
||||
* 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 @@ static DRIVETYPE DRIVE_GetDriveType( const char *name )
|
|||
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 @@ int DRIVE_Init(void)
|
|||
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 @@ int DRIVE_Init(void)
|
|||
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,11 +466,11 @@ int DRIVE_ReadSuperblock (int drive, char * buff)
|
|||
|
||||
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:
|
||||
|
@ -480,8 +483,8 @@ int DRIVE_ReadSuperblock (int drive, char * buff)
|
|||
|
||||
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 @@ int DRIVE_ReadSuperblock (int drive, char * buff)
|
|||
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 @@ const char * DRIVE_GetLabel( int drive )
|
|||
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 @@ const char * DRIVE_GetLabel( int drive )
|
|||
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,8 +596,8 @@ char buff[DRIVE_SUPER];
|
|||
{
|
||||
switch(DOSDrives[drive].type)
|
||||
{
|
||||
case TYPE_FLOPPY:
|
||||
case TYPE_HD:
|
||||
case DRIVE_REMOVABLE:
|
||||
case DRIVE_FIXED:
|
||||
if (DRIVE_ReadSuperblock(drive,(char *) buff))
|
||||
MESSAGE("Invalid or unreadable superblock on %s (%c:)."
|
||||
" Maybe not FAT?\n" ,
|
||||
|
@ -602,7 +605,7 @@ char buff[DRIVE_SUPER];
|
|||
else
|
||||
serial = *((DWORD*)(buff+0x27));
|
||||
break;
|
||||
case TYPE_CDROM:
|
||||
case DRIVE_CDROM:
|
||||
serial = CDROM_GetSerial(drive);
|
||||
break;
|
||||
default:
|
||||
|
@ -625,15 +628,15 @@ int DRIVE_SetSerialNumber( int drive, DWORD serial )
|
|||
|
||||
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 @@ int DRIVE_SetSerialNumber( int drive, DWORD serial )
|
|||
/***********************************************************************
|
||||
* 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 @@ static int DRIVE_GetFreeSpace( int drive, PULARGE_INTEGER size,
|
|||
# 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 @@ BOOL WINAPI GetDiskFreeSpaceA( LPCSTR root, LPDWORD cluster_sectors,
|
|||
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 @@ BOOL WINAPI GetDiskFreeSpaceExW( LPCWSTR root, PULARGE_INTEGER avail,
|
|||
* 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 @@ UINT16 WINAPI GetDriveType16(
|
|||
* 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 @@ UINT WINAPI GetDriveTypeA(LPCSTR root) /* [in] String describing drive */
|
|||
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 @@ DWORD WINAPI GetLogicalDrives(void)
|
|||
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 @@ BOOL WINAPI GetVolumeInformationA( LPCSTR root, LPSTR label,
|
|||
}
|
||||
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 @@ BOOL WINAPI SetVolumeLabelA( LPCSTR root, LPCSTR volname )
|
|||
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;
|
||||
|
|
|
@ -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_GetDevice( int drive );
|
|||
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 );
|
||||
|
|
|
@ -164,8 +164,8 @@ typedef struct
|
|||
/* 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
|
||||
|
|
|
@ -42,8 +42,9 @@ int CDROM_Open(WINE_CDAUDIO* wcda, int drive)
|
|||
|
||||
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;
|
||||
|
|
|
@ -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 @@ void WINAPI INT_Int11Handler( CONTEXT86 *context )
|
|||
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++)
|
||||
|
|
|
@ -63,11 +63,12 @@ void WINAPI INT_Int13Handler( CONTEXT86 *context )
|
|||
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 ? */
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "miscemu.h"
|
||||
#include "debugtools.h"
|
||||
#include "msdos.h"
|
||||
#include "drive.h"
|
||||
#include "winnt.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(int17);
|
||||
|
|
|
@ -383,7 +383,7 @@ static BOOL ioctlGenericBlkDevReq( CONTEXT86 *context )
|
|||
|
||||
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 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
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 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
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 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
{
|
||||
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)
|
||||
if (!GetVolumeInformationA( driveroot, NULL, 0, NULL, &filename_len,
|
||||
&flags, buffer, 8 ))
|
||||
{
|
||||
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 ? */
|
||||
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 */
|
||||
|
|
|
@ -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 @@ static void MSCDEX_StoreMSF(DWORD frame, BYTE* val)
|
|||
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 @@ static void MSCDEX_Handler(CONTEXT86* context)
|
|||
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 @@ static void MSCDEX_Handler(CONTEXT86* context)
|
|||
|
||||
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 @@ static void MSCDEX_Handler(CONTEXT86* context)
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue