winecfg: Store the Unix device if any in the drive configuration.
This commit is contained in:
parent
eb65f6a212
commit
18b66912b7
|
@ -93,19 +93,22 @@ long drive_available_mask(char letter)
|
|||
return result;
|
||||
}
|
||||
|
||||
BOOL add_drive(char letter, const char *targetpath, const WCHAR *label, DWORD serial, DWORD type)
|
||||
BOOL add_drive(char letter, const char *targetpath, const char *device, const WCHAR *label,
|
||||
DWORD serial, DWORD type)
|
||||
{
|
||||
int driveIndex = letter_to_index(letter);
|
||||
|
||||
if(drives[driveIndex].in_use)
|
||||
return FALSE;
|
||||
|
||||
WINE_TRACE("letter == '%c', unixpath == '%s', label == %s, serial == %08x, type == %d\n",
|
||||
letter, targetpath, wine_dbgstr_w(label), serial, type);
|
||||
WINE_TRACE("letter == '%c', unixpath == %s, device == %s, label == %s, serial == %08x, type == %d\n",
|
||||
letter, wine_dbgstr_a(targetpath), wine_dbgstr_a(device),
|
||||
wine_dbgstr_w(label), serial, type);
|
||||
|
||||
drives[driveIndex].letter = toupper(letter);
|
||||
drives[driveIndex].unixpath = strdupA(targetpath);
|
||||
drives[driveIndex].label = strdupW(label);
|
||||
drives[driveIndex].device = device ? strdupA(device) : NULL;
|
||||
drives[driveIndex].label = label ? strdupW(label) : NULL;
|
||||
drives[driveIndex].serial = serial;
|
||||
drives[driveIndex].type = type;
|
||||
drives[driveIndex].in_use = TRUE;
|
||||
|
@ -119,6 +122,8 @@ void delete_drive(struct drive *d)
|
|||
{
|
||||
HeapFree(GetProcessHeap(), 0, d->unixpath);
|
||||
d->unixpath = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, d->device);
|
||||
d->device = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, d->label);
|
||||
d->label = NULL;
|
||||
d->serial = 0;
|
||||
|
@ -316,7 +321,7 @@ void load_drives(void)
|
|||
c = targetpath;
|
||||
do if (*c == '\\') *c = '/'; while (*c++);
|
||||
|
||||
add_drive(*devices, targetpath, volname, serial, get_drive_type(devices[0]) );
|
||||
add_drive(*devices, targetpath, NULL, volname, serial, get_drive_type(devices[0]) );
|
||||
|
||||
len -= lstrlenW(devices);
|
||||
devices += lstrlenW(devices);
|
||||
|
@ -354,7 +359,7 @@ void load_drives(void)
|
|||
buff[cnt] = '\0';
|
||||
|
||||
WINE_TRACE("found broken symlink %s -> %s\n", path, buff);
|
||||
add_drive('A' + i, buff, NULL, 0, DRIVE_UNKNOWN);
|
||||
add_drive('A' + i, buff, NULL, NULL, 0, DRIVE_UNKNOWN);
|
||||
|
||||
drivecount++;
|
||||
}
|
||||
|
@ -388,16 +393,28 @@ void apply_drive_changes(void)
|
|||
drives[i].modified = FALSE;
|
||||
|
||||
len = sizeof(*ioctl);
|
||||
if (drives[i].in_use) len += strlen(drives[i].unixpath) + 1;
|
||||
if (drives[i].in_use)
|
||||
{
|
||||
len += strlen(drives[i].unixpath) + 1;
|
||||
if (drives[i].device) len += strlen(drives[i].device) + 1;
|
||||
}
|
||||
if (!(ioctl = HeapAlloc( GetProcessHeap(), 0, len ))) continue;
|
||||
ioctl->size = len;
|
||||
ioctl->letter = 'a' + i;
|
||||
ioctl->device_offset = 0;
|
||||
if (drives[i].in_use)
|
||||
{
|
||||
char *ptr = (char *)(ioctl + 1);
|
||||
|
||||
ioctl->type = drives[i].type;
|
||||
ioctl->mount_point_offset = sizeof(*ioctl);
|
||||
strcpy( (char *)(ioctl + 1), drives[i].unixpath );
|
||||
strcpy( ptr, drives[i].unixpath );
|
||||
ioctl->mount_point_offset = ptr - (char *)ioctl;
|
||||
if (drives[i].device)
|
||||
{
|
||||
ptr += strlen(ptr) + 1;
|
||||
strcpy( ptr, drives[i].device );
|
||||
ioctl->device_offset = ptr - (char *)ioctl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -235,7 +235,7 @@ static void ensure_root_is_mapped(void)
|
|||
{
|
||||
if (!drives[letter - 'A'].in_use)
|
||||
{
|
||||
add_drive(letter, "/", NULL, 0, DRIVE_FIXED);
|
||||
add_drive(letter, "/", NULL, NULL, 0, DRIVE_FIXED);
|
||||
WINE_TRACE("allocated drive %c as the root drive\n", letter);
|
||||
break;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ static void ensure_home_is_mapped(void)
|
|||
{
|
||||
if (!drives[letter - 'A'].in_use)
|
||||
{
|
||||
add_drive(letter, home, NULL, 0, DRIVE_FIXED);
|
||||
add_drive(letter, home, NULL, NULL, 0, DRIVE_FIXED);
|
||||
WINE_TRACE("allocated drive %c as the user's home directory\n", letter);
|
||||
break;
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ static void ensure_drive_c_is_mapped(void)
|
|||
WCHAR label[64];
|
||||
LoadStringW (GetModuleHandle (NULL), IDS_SYSTEM_DRIVE_LABEL, label,
|
||||
sizeof(label)/sizeof(label[0]));
|
||||
add_drive('C', "../drive_c", label, 0, DRIVE_FIXED);
|
||||
add_drive('C', "../drive_c", NULL, label, 0, DRIVE_FIXED);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -330,7 +330,8 @@ int autodetect_drives(void)
|
|||
{
|
||||
char letter;
|
||||
int type;
|
||||
|
||||
char *device = NULL;
|
||||
|
||||
WINE_TRACE("ent->mnt_dir=%s\n", ent->mnt_dir);
|
||||
|
||||
if (should_ignore_fstype(ent->mnt_type)) continue;
|
||||
|
@ -355,8 +356,11 @@ int autodetect_drives(void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
WINE_TRACE("adding drive %c for %s, type %s\n", letter, ent->mnt_dir, ent->mnt_type);
|
||||
add_drive(letter, ent->mnt_dir, NULL, 0, type);
|
||||
if (type == DRIVE_CDROM) device = ent->mnt_fsname;
|
||||
|
||||
WINE_TRACE("adding drive %c for %s, device %s, type %s\n",
|
||||
letter, ent->mnt_dir, device, ent->mnt_type);
|
||||
add_drive(letter, ent->mnt_dir, device, NULL, 0, type);
|
||||
|
||||
/* working_mask is a map of the drive letters still available. */
|
||||
working_mask &= ~DRIVE_MASK_BIT(letter);
|
||||
|
|
|
@ -315,9 +315,9 @@ static void on_add_click(HWND dialog)
|
|||
WCHAR label[64];
|
||||
LoadStringW (GetModuleHandle (NULL), IDS_SYSTEM_DRIVE_LABEL, label,
|
||||
sizeof(label)/sizeof(label[0]));
|
||||
add_drive(new, "../drive_c", label, 0, DRIVE_FIXED);
|
||||
add_drive(new, "../drive_c", NULL, label, 0, DRIVE_FIXED);
|
||||
}
|
||||
else add_drive(new, "/", NULL, 0, DRIVE_UNKNOWN);
|
||||
else add_drive(new, "/", NULL, NULL, 0, DRIVE_UNKNOWN);
|
||||
|
||||
fill_drives_list(dialog);
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ struct drive
|
|||
{
|
||||
char letter;
|
||||
char *unixpath;
|
||||
char *device;
|
||||
WCHAR *label;
|
||||
DWORD serial;
|
||||
DWORD type; /* one of the DRIVE_ constants from winbase.h */
|
||||
|
@ -108,7 +109,8 @@ struct drive
|
|||
#define DRIVE_MASK_BIT(B) (1 << (toupper(B) - 'A'))
|
||||
|
||||
long drive_available_mask(char letter);
|
||||
BOOL add_drive(char letter, const char *targetpath, const WCHAR *label, DWORD serial, DWORD type);
|
||||
BOOL add_drive(char letter, const char *targetpath, const char *device,
|
||||
const WCHAR *label, DWORD serial, DWORD type);
|
||||
void delete_drive(struct drive *pDrive);
|
||||
void apply_drive_changes(void);
|
||||
BOOL browse_for_unix_folder(HWND dialog, WCHAR *pszPath);
|
||||
|
|
Loading…
Reference in New Issue