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
f410cf7c
Commit
f410cf7c
authored
Oct 23, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecfg: Update the drives only when they have changed, instead of trying to…
winecfg: Update the drives only when they have changed, instead of trying to compare with the current setup.
parent
92202fef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
75 deletions
+28
-75
drive.c
programs/winecfg/drive.c
+20
-75
driveui.c
programs/winecfg/driveui.c
+7
-0
winecfg.h
programs/winecfg/winecfg.h
+1
-0
No files found.
programs/winecfg/drive.c
View file @
f410cf7c
...
...
@@ -103,6 +103,7 @@ BOOL add_drive(char letter, const char *targetpath, const WCHAR *label, DWORD se
drives
[
driveIndex
].
serial
=
serial
;
drives
[
driveIndex
].
type
=
type
;
drives
[
driveIndex
].
in_use
=
TRUE
;
drives
[
driveIndex
].
modified
=
TRUE
;
return
TRUE
;
}
...
...
@@ -116,6 +117,7 @@ void delete_drive(struct drive *d)
d
->
label
=
NULL
;
d
->
serial
=
0
;
d
->
in_use
=
FALSE
;
d
->
modified
=
TRUE
;
}
static
void
set_drive_type
(
char
letter
,
DWORD
type
)
...
...
@@ -370,6 +372,9 @@ void load_drives(void)
drivecount
++
;
}
/* reset modified flags */
for
(
i
=
0
;
i
<
26
;
i
++
)
drives
[
i
].
modified
=
FALSE
;
WINE_TRACE
(
"found %d drives
\n
"
,
drivecount
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
...
...
@@ -383,66 +388,37 @@ void apply_drive_changes(void)
int
i
;
CHAR
devicename
[
4
];
CHAR
targetpath
[
256
];
BOOL
foundDrive
;
WCHAR
volumeNameBuffer
[
512
];
DWORD
serialNumber
;
int
retval
;
BOOL
defineDevice
;
WINE_TRACE
(
"
\n
"
);
/* add each drive and remove as we go */
for
(
i
=
0
;
i
<
26
;
i
++
)
{
defineDevice
=
FALSE
;
foundDrive
=
FALSE
;
volumeNameBuffer
[
0
]
=
0
;
serialNumber
=
0
;
snprintf
(
devicename
,
sizeof
(
devicename
),
"%c:"
,
'A'
+
i
);
if
(
!
drives
[
i
].
modified
)
continue
;
drives
[
i
].
modified
=
FALSE
;
/* get a drive */
if
(
QueryDosDevice
(
devicename
,
targetpath
,
sizeof
(
targetpath
)))
{
char
*
cursor
;
/* correct the slashes in the path to be UNIX style */
while
((
cursor
=
strchr
(
targetpath
,
'\\'
)))
*
cursor
=
'/'
;
foundDrive
=
TRUE
;
}
snprintf
(
devicename
,
sizeof
(
devicename
),
"%c:"
,
'A'
+
i
);
/* if we found a drive and have a drive then compare things */
if
(
foundDrive
&&
drives
[
i
].
in_use
)
if
(
drives
[
i
].
in_use
)
{
WCHAR
deviceW
[
4
]
=
{
'a'
,
':'
,
'\\'
,
0
};
WINE_TRACE
(
"drives[i].letter: '%c'
\n
"
,
drives
[
i
].
letter
);
deviceW
[
0
]
=
'A'
+
i
;
retval
=
GetVolumeInformationW
(
deviceW
,
volumeNameBuffer
,
sizeof
(
volumeNameBuffer
)
/
sizeof
(
WCHAR
),
&
serialNumber
,
NULL
,
NULL
,
NULL
,
0
);
if
(
!
retval
)
/* define this drive */
/* DefineDosDevice() requires that NO trailing slash be present */
if
(
!
DefineDosDevice
(
DDD_RAW_TARGET_PATH
,
devicename
,
drives
[
i
].
unixpath
))
{
WINE_TRACE
(
" GetVolumeInformation() for '%s' failed
\n
"
,
devicename
);
WINE_ERR
(
" unable to define devicename of '%s', targetpath of '%s'
\n
"
,
devicename
,
drives
[
i
].
unixpath
);
PRINTERROR
();
volumeNameBuffer
[
0
]
=
'\0'
;
}
WINE_TRACE
(
" current path: '%s', new path: '%s'
\n
"
,
targetpath
,
drives
[
i
].
unixpath
);
/* compare to what we have */
/* do we have the same targetpath? */
if
(
strcmp
(
drives
[
i
].
unixpath
,
targetpath
))
{
defineDevice
=
TRUE
;
WINE_TRACE
(
" making changes to drive '%s'
\n
"
,
devicename
);
}
else
{
WINE_TRACE
(
" no changes to drive '%s'
\n
"
,
devicename
);
WINE_TRACE
(
" added devicename of '%s', targetpath of '%s'
\n
"
,
devicename
,
drives
[
i
].
unixpath
);
}
set_drive_label
(
drives
[
i
].
letter
,
drives
[
i
].
label
);
set_drive_serial
(
drives
[
i
].
letter
,
drives
[
i
].
serial
);
set_drive_type
(
drives
[
i
].
letter
,
drives
[
i
].
type
);
}
else
if
(
foundDrive
&&
!
drives
[
i
].
in_use
)
else
if
(
QueryDosDevice
(
devicename
,
targetpath
,
sizeof
(
targetpath
))
)
{
/* remove this drive */
if
(
!
DefineDosDevice
(
DDD_REMOVE_DEFINITION
,
devicename
,
drives
[
i
].
unixpath
))
...
...
@@ -460,36 +436,5 @@ void apply_drive_changes(void)
set_drive_type
(
drives
[
i
].
letter
,
DRIVE_UNKNOWN
);
continue
;
}
else
if
(
drives
[
i
].
in_use
)
/* foundDrive must be false from the above check */
{
defineDevice
=
TRUE
;
}
/* adding and modifying are the same steps */
if
(
defineDevice
)
{
/* define this drive */
/* DefineDosDevice() requires that NO trailing slash be present */
snprintf
(
devicename
,
sizeof
(
devicename
),
"%c:"
,
'A'
+
i
);
if
(
!
DefineDosDevice
(
DDD_RAW_TARGET_PATH
,
devicename
,
drives
[
i
].
unixpath
))
{
WINE_ERR
(
" unable to define devicename of '%s', targetpath of '%s'
\n
"
,
devicename
,
drives
[
i
].
unixpath
);
PRINTERROR
();
}
else
{
WINE_TRACE
(
" added devicename of '%s', targetpath of '%s'
\n
"
,
devicename
,
drives
[
i
].
unixpath
);
}
}
if
(
!
drives
[
i
].
label
||
lstrcmpW
(
drives
[
i
].
label
,
volumeNameBuffer
))
set_drive_label
(
drives
[
i
].
letter
,
drives
[
i
].
label
);
if
(
drives
[
i
].
serial
!=
serialNumber
)
set_drive_serial
(
drives
[
i
].
letter
,
drives
[
i
].
serial
);
set_drive_type
(
drives
[
i
].
letter
,
drives
[
i
].
type
);
}
}
programs/winecfg/driveui.c
View file @
f410cf7c
...
...
@@ -334,6 +334,7 @@ static void on_add_click(HWND dialog)
SetFocus
(
GetDlgItem
(
dialog
,
IDC_LIST_DRIVES
));
update_controls
(
dialog
);
SendMessage
(
GetParent
(
dialog
),
PSM_CHANGED
,
(
WPARAM
)
dialog
,
0
);
}
static
void
on_remove_click
(
HWND
dialog
)
...
...
@@ -372,6 +373,7 @@ static void on_remove_click(HWND dialog)
SetFocus
(
GetDlgItem
(
dialog
,
IDC_LIST_DRIVES
));
update_controls
(
dialog
);
SendMessage
(
GetParent
(
dialog
),
PSM_CHANGED
,
(
WPARAM
)
dialog
,
0
);
}
static
void
update_controls
(
HWND
dialog
)
...
...
@@ -485,6 +487,7 @@ static void on_edit_changed(HWND dialog, WORD id)
WCHAR
*
label
=
get_textW
(
dialog
,
id
);
HeapFree
(
GetProcessHeap
(),
0
,
current_drive
->
label
);
current_drive
->
label
=
label
;
current_drive
->
modified
=
TRUE
;
WINE_TRACE
(
"set label to %s
\n
"
,
wine_dbgstr_w
(
current_drive
->
label
));
...
...
@@ -500,6 +503,7 @@ static void on_edit_changed(HWND dialog, WORD id)
path
=
get_text
(
dialog
,
id
);
HeapFree
(
GetProcessHeap
(),
0
,
current_drive
->
unixpath
);
current_drive
->
unixpath
=
path
?
path
:
strdupA
(
"drive_c"
);
current_drive
->
modified
=
TRUE
;
WINE_TRACE
(
"set path to %s
\n
"
,
current_drive
->
unixpath
);
...
...
@@ -517,6 +521,7 @@ static void on_edit_changed(HWND dialog, WORD id)
serial
=
get_text
(
dialog
,
id
);
current_drive
->
serial
=
strtoul
(
serial
,
NULL
,
16
);
current_drive
->
modified
=
TRUE
;
WINE_TRACE
(
"set serial to %08x
\n
"
,
current_drive
->
serial
);
...
...
@@ -756,6 +761,7 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam)
str
=
get_textW
(
dialog
,
IDC_EDIT_SERIAL
);
current_drive
->
serial
=
strtoulW
(
str
,
NULL
,
16
);
current_drive
->
modified
=
TRUE
;
/* TODO: we don't have a device at this point */
...
...
@@ -787,6 +793,7 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam)
enable_labelserial_box
(
dialog
,
mode
);
current_drive
->
type
=
type_pairs
[
selection
].
sCode
;
current_drive
->
modified
=
TRUE
;
break
;
}
...
...
programs/winecfg/winecfg.h
View file @
f410cf7c
...
...
@@ -102,6 +102,7 @@ struct drive
DWORD
type
;
/* one of the DRIVE_ constants from winbase.h */
BOOL
in_use
;
BOOL
modified
;
};
#define DRIVE_MASK_BIT(B) (1 << (toupper(B) - 'A'))
...
...
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