Commit c02356b8 authored by Alexandre Julliard's avatar Alexandre Julliard

Added "autodetect" drive type option.

parent 9c6a15ce
......@@ -146,6 +146,34 @@ static void set_drive_type( char letter, DWORD type )
}
}
static DWORD get_drive_type( char letter )
{
HKEY hKey;
char driveValue[4];
DWORD ret = DRIVE_UNKNOWN;
sprintf(driveValue, "%c:", letter);
if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Wine\\Drives", &hKey) != ERROR_SUCCESS)
WINE_TRACE(" Unable to open Software\\Wine\\Drives\n" );
else
{
char buffer[80];
DWORD size = sizeof(buffer);
if (!RegQueryValueExA( hKey, driveValue, NULL, NULL, (LPBYTE)buffer, &size ))
{
WINE_TRACE("Got type '%s' for %s\n", buffer, driveValue );
if (!strcasecmp( buffer, "hd" )) ret = DRIVE_FIXED;
else if (!strcasecmp( buffer, "network" )) ret = DRIVE_REMOTE;
else if (!strcasecmp( buffer, "floppy" )) ret = DRIVE_REMOVABLE;
else if (!strcasecmp( buffer, "cdrom" )) ret = DRIVE_CDROM;
}
RegCloseKey(hKey);
}
return ret;
}
#if 0
/* currently unused, but if users have this burning desire to be able to rename drives,
......@@ -279,7 +307,7 @@ void load_drives()
snprintf(serialstr, sizeof(serialstr), "%lX", serial);
WINE_TRACE("serialstr: '%s'\n", serialstr);
add_drive(*devices, targetpath, volname, serialstr, GetDriveType(rootpath));
add_drive(*devices, targetpath, volname, serialstr, get_drive_type(devices[0]) );
len -= strlen(devices);
devices += strlen(devices);
......
......@@ -139,13 +139,14 @@ struct drive_typemap {
};
static const struct drive_typemap type_pairs[] = {
{ DRIVE_UNKNOWN, "Autodetect" },
{ DRIVE_FIXED, "Local hard disk" },
{ DRIVE_REMOTE, "Network share" },
{ DRIVE_REMOVABLE, "Floppy disk" },
{ DRIVE_CDROM, "CD-ROM" }
};
#define DRIVE_TYPE_DEFAULT 1
#define DRIVE_TYPE_DEFAULT 0
static void fill_drive_droplist(long mask, char curletter, HWND dialog)
{
......@@ -447,8 +448,6 @@ static void update_controls(HWND dialog)
/* drive type */
type = current_drive->type;
if (type)
{
SendDlgItemMessage(dialog, IDC_COMBO_TYPE, CB_RESETCONTENT, 0, 0);
for (i = 0; i < sizeof(type_pairs) / sizeof(struct drive_typemap); i++)
......@@ -463,8 +462,6 @@ static void update_controls(HWND dialog)
if (selection == -1) selection = DRIVE_TYPE_DEFAULT;
SendDlgItemMessage(dialog, IDC_COMBO_TYPE, CB_SETCURSEL, selection, 0);
} else WINE_WARN("no Type field?\n");
/* removeable media properties */
label = current_drive->label;
......@@ -811,7 +808,9 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam)
selection = SendDlgItemMessage(dialog, IDC_COMBO_TYPE, CB_GETCURSEL, 0, 0);
if (selection == 2 || selection == 3) /* cdrom or floppy */
if (selection >= 0 &&
(type_pairs[selection].sCode == DRIVE_CDROM ||
type_pairs[selection].sCode == DRIVE_REMOVABLE))
{
if (IsDlgButtonChecked(dialog, IDC_RADIO_AUTODETECT))
mode = BOX_MODE_CD_AUTODETECT;
......
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