Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
97567c2d
Commit
97567c2d
authored
Oct 20, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always set the drive type even if nothing else changed.
parent
247ab64d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
60 deletions
+34
-60
drive.c
programs/winecfg/drive.c
+34
-60
No files found.
programs/winecfg/drive.c
View file @
97567c2d
...
...
@@ -116,6 +116,36 @@ void delete_drive(struct drive *d)
d
->
in_use
=
FALSE
;
}
static
void
set_drive_type
(
char
letter
,
DWORD
type
)
{
HKEY
hKey
;
char
driveValue
[
4
];
const
char
*
typeText
=
NULL
;
sprintf
(
driveValue
,
"%c:"
,
letter
);
/* Set the drive type in the registry */
if
(
type
==
DRIVE_FIXED
)
typeText
=
"hd"
;
else
if
(
type
==
DRIVE_REMOTE
)
typeText
=
"network"
;
else
if
(
type
==
DRIVE_REMOVABLE
)
typeText
=
"floppy"
;
else
if
(
type
==
DRIVE_CDROM
)
typeText
=
"cdrom"
;
if
(
RegCreateKey
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Wine
\\
Drives"
,
&
hKey
)
!=
ERROR_SUCCESS
)
WINE_TRACE
(
" Unable to open '%s'
\n
"
,
"Software
\\
Wine
\\
Drives"
);
else
{
if
(
typeText
)
RegSetValueEx
(
hKey
,
driveValue
,
0
,
REG_SZ
,
(
LPBYTE
)
typeText
,
strlen
(
typeText
)
+
1
);
else
RegDeleteValue
(
hKey
,
driveValue
);
RegCloseKey
(
hKey
);
}
}
#if 0
/* currently unused, but if users have this burning desire to be able to rename drives,
...
...
@@ -356,9 +386,6 @@ void apply_drive_changes(void)
}
else
if
(
foundDrive
&&
!
drives
[
i
].
in_use
)
{
HKEY
hKey
;
char
driveValue
[
256
];
/* remove this drive */
if
(
!
DefineDosDevice
(
DDD_REMOVE_DEFINITION
,
devicename
,
drives
[
i
].
unixpath
))
{
...
...
@@ -372,17 +399,8 @@ void apply_drive_changes(void)
devicename
,
drives
[
i
].
unixpath
);
}
retval
=
RegOpenKey
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Wine
\\
Drives"
,
&
hKey
);
if
(
retval
!=
ERROR_SUCCESS
)
{
WINE_TRACE
(
"Unable to open '%s'
\n
"
,
"Software
\\
Wine
\\
Drives"
);
}
else
{
snprintf
(
driveValue
,
sizeof
(
driveValue
),
"%c:"
,
toupper
(
drives
[
i
].
letter
));
retval
=
RegDeleteValue
(
hKey
,
driveValue
);
}
set_drive_type
(
drives
[
i
].
letter
,
DRIVE_UNKNOWN
);
continue
;
}
else
if
(
drives
[
i
].
in_use
)
/* foundDrive must be false from the above check */
{
...
...
@@ -395,10 +413,6 @@ void apply_drive_changes(void)
char
filename
[
256
];
HANDLE
hFile
;
HKEY
hKey
;
const
char
*
typeText
;
char
driveValue
[
256
];
/* define this drive */
/* DefineDosDevice() requires that NO trailing slash be present */
snprintf
(
devicename
,
sizeof
(
devicename
),
"%c:"
,
'A'
+
i
);
...
...
@@ -428,48 +442,6 @@ void apply_drive_changes(void)
}
}
/* Set the drive type in the registry */
if
(
drives
[
i
].
type
==
DRIVE_FIXED
)
typeText
=
"hd"
;
else
if
(
drives
[
i
].
type
==
DRIVE_REMOTE
)
typeText
=
"network"
;
else
if
(
drives
[
i
].
type
==
DRIVE_REMOVABLE
)
typeText
=
"floppy"
;
else
/* must be DRIVE_CDROM */
typeText
=
"cdrom"
;
snprintf
(
driveValue
,
sizeof
(
driveValue
),
"%c:"
,
toupper
(
drives
[
i
].
letter
));
retval
=
RegOpenKey
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Wine
\\
Drives"
,
&
hKey
);
if
(
retval
!=
ERROR_SUCCESS
)
{
WINE_TRACE
(
" Unable to open '%s'
\n
"
,
"Software
\\
Wine
\\
Drives"
);
}
else
{
retval
=
RegSetValueEx
(
hKey
,
driveValue
,
0
,
REG_SZ
,
(
LPBYTE
)
typeText
,
strlen
(
typeText
)
+
1
);
if
(
retval
!=
ERROR_SUCCESS
)
{
WINE_TRACE
(
" Unable to set value of '%s' to '%s'
\n
"
,
driveValue
,
typeText
);
}
else
{
WINE_TRACE
(
" Finished setting value of '%s' to '%s'
\n
"
,
driveValue
,
typeText
);
RegCloseKey
(
hKey
);
}
}
/* Set the drive serial number via a .windows-serial file in */
/* the targetpath directory */
...
...
@@ -504,5 +476,7 @@ void apply_drive_changes(void)
WINE_TRACE
(
" CreateFile() error with file '%s'
\n
"
,
filename
);
}
}
set_drive_type
(
drives
[
i
].
letter
,
drives
[
i
].
type
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment