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
0b306421
Commit
0b306421
authored
Feb 07, 2009
by
David Hedberg
Committed by
Alexandre Julliard
Feb 09, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecfg: Fix for paths containing utf-8.
parent
c861e038
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
34 deletions
+54
-34
driveui.c
programs/winecfg/driveui.c
+41
-21
theme.c
programs/winecfg/theme.c
+0
-13
winecfg.h
programs/winecfg/winecfg.h
+13
-0
No files found.
programs/winecfg/driveui.c
View file @
0b306421
...
...
@@ -86,34 +86,34 @@ static int lv_get_curr_select(HWND dialog)
}
/* sets the item in the listview at item->iIndex */
static
void
lv_set_item
(
HWND
dialog
,
LVITEM
*
item
)
static
void
lv_set_item
(
HWND
dialog
,
LVITEM
W
*
item
)
{
SendDlgItemMessage
(
dialog
,
IDC_LIST_DRIVES
,
LVM_SETITEM
,
0
,
(
LPARAM
)
item
);
SendDlgItemMessage
W
(
dialog
,
IDC_LIST_DRIVES
,
LVM_SETITEMW
,
0
,
(
LPARAM
)
item
);
}
/* sets specified item's text */
static
void
lv_set_item_text
(
HWND
dialog
,
int
item
,
int
subItem
,
char
*
text
)
static
void
lv_set_item_text
(
HWND
dialog
,
int
item
,
int
subItem
,
WCHAR
*
text
)
{
LVITEM
lvItem
;
LVITEM
W
lvItem
;
if
(
item
<
0
||
subItem
<
0
)
return
;
lvItem
.
mask
=
LVIF_TEXT
;
lvItem
.
iItem
=
item
;
lvItem
.
iSubItem
=
subItem
;
lvItem
.
pszText
=
text
;
lvItem
.
cchTextMax
=
lstrlen
(
lvItem
.
pszText
);
lvItem
.
cchTextMax
=
lstrlen
W
(
lvItem
.
pszText
);
lv_set_item
(
dialog
,
&
lvItem
);
}
/* inserts an item into the listview */
static
void
lv_insert_item
(
HWND
dialog
,
LVITEM
*
item
)
static
void
lv_insert_item
(
HWND
dialog
,
LVITEM
W
*
item
)
{
SendDlgItemMessage
(
dialog
,
IDC_LIST_DRIVES
,
LVM_INSERTITEM
,
0
,
(
LPARAM
)
item
);
SendDlgItemMessage
W
(
dialog
,
IDC_LIST_DRIVES
,
LVM_INSERTITEMW
,
0
,
(
LPARAM
)
item
);
}
/* retrieve the item at index item->iIndex */
static
void
lv_get_item
(
HWND
dialog
,
LVITEM
*
item
)
static
void
lv_get_item
(
HWND
dialog
,
LVITEM
W
*
item
)
{
SendDlgItemMessage
(
dialog
,
IDC_LIST_DRIVES
,
LVM_GETITEM
,
0
,
(
LPARAM
)
item
);
SendDlgItemMessage
W
(
dialog
,
IDC_LIST_DRIVES
,
LVM_GETITEMW
,
0
,
(
LPARAM
)
item
);
}
static
void
set_advanced
(
HWND
dialog
)
...
...
@@ -235,7 +235,8 @@ static int fill_drives_list(HWND dialog)
for
(
i
=
0
;
i
<
26
;
i
++
)
{
LVITEM
item
;
LVITEMW
item
;
WCHAR
*
path
;
char
letter
[
4
];
/* skip over any unused drives */
...
...
@@ -252,12 +253,16 @@ static int fill_drives_list(HWND dialog)
item
.
mask
=
LVIF_TEXT
|
LVIF_PARAM
;
item
.
iItem
=
count
;
item
.
iSubItem
=
0
;
item
.
pszText
=
letter
;
item
.
cchTextMax
=
lstrlen
(
item
.
pszText
);
item
.
pszText
=
strdupU2W
(
letter
)
;
item
.
cchTextMax
=
lstrlen
W
(
item
.
pszText
);
item
.
lParam
=
(
LPARAM
)
&
drives
[
i
];
lv_insert_item
(
dialog
,
&
item
);
lv_set_item_text
(
dialog
,
count
,
1
,
drives
[
i
].
unixpath
);
HeapFree
(
GetProcessHeap
(),
0
,
item
.
pszText
);
path
=
strdupU2W
(
drives
[
i
].
unixpath
);
lv_set_item_text
(
dialog
,
count
,
1
,
path
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
count
++
;
}
...
...
@@ -341,7 +346,7 @@ static void on_remove_click(HWND dialog)
{
int
itemIndex
;
struct
drive
*
drive
;
LVITEM
item
;
LVITEM
W
item
;
itemIndex
=
lv_get_curr_select
(
dialog
);
if
(
itemIndex
==
-
1
)
return
;
/* no selection */
...
...
@@ -379,12 +384,12 @@ static void on_remove_click(HWND dialog)
static
void
update_controls
(
HWND
dialog
)
{
static
const
WCHAR
emptyW
[
1
];
char
*
path
;
WCHAR
*
path
;
unsigned
int
type
;
char
serial
[
16
];
const
char
*
device
;
int
i
,
selection
=
-
1
;
LVITEM
item
;
LVITEM
W
item
;
updating_ui
=
TRUE
;
...
...
@@ -406,9 +411,10 @@ static void update_controls(HWND dialog)
WINE_TRACE
(
"Updating sheet for drive %c
\n
"
,
current_drive
->
letter
);
/* path */
path
=
current_drive
->
unixpath
;
WINE_TRACE
(
"set path control text to '%s'
\n
"
,
path
);
set_text
(
dialog
,
IDC_EDIT_PATH
,
path
);
WINE_TRACE
(
"set path control text to '%s'
\n
"
,
current_drive
->
unixpath
);
path
=
strdupU2W
(
current_drive
->
unixpath
);
set_textW
(
dialog
,
IDC_EDIT_PATH
,
path
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
/* drive type */
type
=
current_drive
->
type
;
...
...
@@ -498,9 +504,22 @@ static void on_edit_changed(HWND dialog, WORD id)
case
IDC_EDIT_PATH
:
{
WCHAR
*
wpath
;
char
*
path
;
int
lenW
;
wpath
=
get_textW
(
dialog
,
id
);
if
(
(
lenW
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
wpath
,
-
1
,
NULL
,
0
,
NULL
,
NULL
))
)
{
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lenW
);
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
wpath
,
-
1
,
path
,
lenW
,
NULL
,
NULL
);
}
else
{
path
=
NULL
;
wpath
=
strdupU2W
(
"drive_c"
);
}
path
=
get_text
(
dialog
,
id
);
HeapFree
(
GetProcessHeap
(),
0
,
current_drive
->
unixpath
);
current_drive
->
unixpath
=
path
?
path
:
strdupA
(
"drive_c"
);
current_drive
->
modified
=
TRUE
;
...
...
@@ -508,7 +527,8 @@ static void on_edit_changed(HWND dialog, WORD id)
WINE_TRACE
(
"set path to %s
\n
"
,
current_drive
->
unixpath
);
lv_set_item_text
(
dialog
,
lv_get_curr_select
(
dialog
),
1
,
current_drive
->
unixpath
);
wpath
);
HeapFree
(
GetProcessHeap
(),
0
,
wpath
);
/* enable the apply button */
SendMessage
(
GetParent
(
dialog
),
PSM_CHANGED
,
(
WPARAM
)
dialog
,
0
);
...
...
programs/winecfg/theme.c
View file @
0b306421
...
...
@@ -732,19 +732,6 @@ static struct ShellFolderInfo *psfiSelected = NULL;
#define NUM_ELEMS(x) (sizeof(x)/sizeof(*(x)))
/* create a unicode string from a string in Unix locale */
static
WCHAR
*
strdupU2W
(
const
char
*
unix_str
)
{
WCHAR
*
unicode_str
;
int
lenW
;
lenW
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
unix_str
,
-
1
,
NULL
,
0
);
unicode_str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lenW
*
sizeof
(
WCHAR
));
if
(
unicode_str
)
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
unix_str
,
-
1
,
unicode_str
,
lenW
);
return
unicode_str
;
}
static
void
init_shell_folder_listview_headers
(
HWND
dialog
)
{
LVCOLUMN
listColumn
;
RECT
viewRect
;
...
...
programs/winecfg/winecfg.h
View file @
0b306421
...
...
@@ -135,6 +135,19 @@ static inline WCHAR *strdupW(const WCHAR *s)
return
lstrcpyW
(
r
,
s
);
}
/* create a unicode string from a string in Unix locale */
static
inline
WCHAR
*
strdupU2W
(
const
char
*
unix_str
)
{
WCHAR
*
unicode_str
;
int
lenW
;
lenW
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
unix_str
,
-
1
,
NULL
,
0
);
unicode_str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lenW
*
sizeof
(
WCHAR
));
if
(
unicode_str
)
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
unix_str
,
-
1
,
unicode_str
,
lenW
);
return
unicode_str
;
}
static
inline
char
*
get_text
(
HWND
dialog
,
WORD
id
)
{
HWND
item
=
GetDlgItem
(
dialog
,
id
);
...
...
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