Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Mayr
wine
Commits
2ae3945d
Commit
2ae3945d
authored
17 years ago
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
17 years ago
Browse files
Options
Downloads
Patches
Plain Diff
winecfg: Don't mix the strings in unix and windows locales.
parent
7c1a7491
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
programs/winecfg/driveui.c
+10
-10
10 additions, 10 deletions
programs/winecfg/driveui.c
programs/winecfg/theme.c
+48
-19
48 additions, 19 deletions
programs/winecfg/theme.c
programs/winecfg/winecfg.h
+15
-1
15 additions, 1 deletion
programs/winecfg/winecfg.h
with
73 additions
and
30 deletions
programs/winecfg/driveui.c
+
10
−
10
View file @
2ae3945d
...
...
@@ -563,13 +563,13 @@ static void paint(HWND dialog)
EndPaint
(
dialog
,
&
ps
);
}
BOOL
browse_for_unix_folder
(
HWND
dialog
,
char
*
pszPath
)
BOOL
browse_for_unix_folder
(
HWND
dialog
,
WCHAR
*
pszPath
)
{
static
WCHAR
wszUnixRootDisplayName
[]
=
{
':'
,
':'
,
'{'
,
'C'
,
'C'
,
'7'
,
'0'
,
'2'
,
'E'
,
'B'
,
'2'
,
'-'
,
'7'
,
'D'
,
'C'
,
'5'
,
'-'
,
'1'
,
'1'
,
'D'
,
'9'
,
'-'
,
'C'
,
'6'
,
'8'
,
'7'
,
'-'
,
'0'
,
'0'
,
'0'
,
'4'
,
'2'
,
'3'
,
'8'
,
'A'
,
'0'
,
'1'
,
'C'
,
'D'
,
'}'
,
0
};
char
pszChoosePath
[
256
];
BROWSEINFO
A
bi
=
{
WCHAR
pszChoosePath
[
FILENAME_MAX
];
BROWSEINFO
W
bi
=
{
dialog
,
NULL
,
NULL
,
...
...
@@ -583,7 +583,7 @@ BOOL browse_for_unix_folder(HWND dialog, char *pszPath)
LPITEMIDLIST
pidlUnixRoot
,
pidlSelectedPath
;
HRESULT
hr
;
LoadString
(
GetModuleHandle
(
NULL
),
IDS_CHOOSE_PATH
,
pszChoosePath
,
256
);
LoadString
W
(
GetModuleHandle
(
NULL
),
IDS_CHOOSE_PATH
,
pszChoosePath
,
FILENAME_MAX
);
hr
=
SHGetDesktopFolder
(
&
pDesktop
);
if
(
!
SUCCEEDED
(
hr
))
return
FALSE
;
...
...
@@ -596,12 +596,12 @@ BOOL browse_for_unix_folder(HWND dialog, char *pszPath)
}
bi
.
pidlRoot
=
pidlUnixRoot
;
pidlSelectedPath
=
SHBrowseForFolder
A
(
&
bi
);
pidlSelectedPath
=
SHBrowseForFolder
W
(
&
bi
);
SHFree
(
pidlUnixRoot
);
if
(
pidlSelectedPath
)
{
STRRET
strSelectedPath
;
char
*
pszSelectedPath
;
WCHAR
*
pszSelectedPath
;
HRESULT
hr
;
hr
=
IShellFolder_GetDisplayNameOf
(
pDesktop
,
pidlSelectedPath
,
SHGDN_FORPARSING
,
...
...
@@ -612,11 +612,11 @@ BOOL browse_for_unix_folder(HWND dialog, char *pszPath)
return
FALSE
;
}
hr
=
StrRetToStr
(
&
strSelectedPath
,
pidlSelectedPath
,
&
pszSelectedPath
);
hr
=
StrRetToStr
W
(
&
strSelectedPath
,
pidlSelectedPath
,
&
pszSelectedPath
);
SHFree
(
pidlSelectedPath
);
if
(
!
SUCCEEDED
(
hr
))
return
FALSE
;
lstrcpy
(
pszPath
,
pszSelectedPath
);
lstrcpy
W
(
pszPath
,
pszSelectedPath
);
CoTaskMemFree
(
pszSelectedPath
);
return
TRUE
;
...
...
@@ -740,9 +740,9 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam)
case
IDC_BUTTON_BROWSE_PATH
:
{
char
szTargetPath
[
FILENAME_MAX
];
WCHAR
szTargetPath
[
FILENAME_MAX
];
if
(
browse_for_unix_folder
(
dialog
,
szTargetPath
))
set_text
(
dialog
,
IDC_EDIT_PATH
,
szTargetPath
);
set_text
W
(
dialog
,
IDC_EDIT_PATH
,
szTargetPath
);
break
;
}
...
...
This diff is collapsed.
Click to expand it.
programs/winecfg/theme.c
+
48
−
19
View file @
2ae3945d
...
...
@@ -705,7 +705,7 @@ static void on_theme_install(HWND dialog)
/* Information about symbolic link targets of certain User Shell Folders. */
struct
ShellFolderInfo
{
int
nFolder
;
char
szLinkTarget
[
FILENAME_MAX
];
char
szLinkTarget
[
FILENAME_MAX
];
/* in unix locale */
};
static
struct
ShellFolderInfo
asfiInfo
[]
=
{
...
...
@@ -720,6 +720,19 @@ 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
;
...
...
@@ -773,14 +786,14 @@ static void read_shell_folder_link_targets(void) {
static
void
update_shell_folder_listview
(
HWND
dialog
)
{
int
i
;
LVITEM
item
;
LVITEM
W
item
;
LONG
lSelected
=
SendDlgItemMessage
(
dialog
,
IDC_LIST_SFPATHS
,
LVM_GETNEXTITEM
,
(
WPARAM
)
-
1
,
MAKELPARAM
(
LVNI_SELECTED
,
0
));
SendDlgItemMessage
(
dialog
,
IDC_LIST_SFPATHS
,
LVM_DELETEALLITEMS
,
0
,
0
);
for
(
i
=
0
;
i
<
NUM_ELEMS
(
asfiInfo
);
i
++
)
{
char
buffer
[
MAX_PATH
];
WCHAR
buffer
[
MAX_PATH
];
HRESULT
hr
;
LPITEMIDLIST
pidlCurrent
;
...
...
@@ -794,7 +807,7 @@ static void update_shell_folder_listview(HWND dialog) {
STRRET
strRet
;
hr
=
IShellFolder_GetDisplayNameOf
(
psfParent
,
pidlLast
,
SHGDN_FORADDRESSBAR
,
&
strRet
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
StrRetToBuf
A
(
&
strRet
,
pidlLast
,
buffer
,
256
);
hr
=
StrRetToBuf
W
(
&
strRet
,
pidlLast
,
buffer
,
MAX_PATH
);
}
IShellFolder_Release
(
psfParent
);
}
...
...
@@ -804,7 +817,7 @@ static void update_shell_folder_listview(HWND dialog) {
/* If there's a dangling symlink for the current shell folder, SHGetFolderLocation
* will fail above. We fall back to the (non-verified) path of the shell folder. */
if
(
FAILED
(
hr
))
{
hr
=
SHGetFolderPath
(
dialog
,
asfiInfo
[
i
].
nFolder
|
CSIDL_FLAG_DONT_VERIFY
,
NULL
,
hr
=
SHGetFolderPath
W
(
dialog
,
asfiInfo
[
i
].
nFolder
|
CSIDL_FLAG_DONT_VERIFY
,
NULL
,
SHGFP_TYPE_CURRENT
,
buffer
);
}
...
...
@@ -813,13 +826,14 @@ static void update_shell_folder_listview(HWND dialog) {
item
.
iSubItem
=
0
;
item
.
pszText
=
buffer
;
item
.
lParam
=
(
LPARAM
)
&
asfiInfo
[
i
];
SendDlgItemMessage
(
dialog
,
IDC_LIST_SFPATHS
,
LVM_INSERTITEM
,
0
,
(
LPARAM
)
&
item
);
SendDlgItemMessage
(
dialog
,
IDC_LIST_SFPATHS
,
LVM_INSERTITEM
W
,
0
,
(
LPARAM
)
&
item
);
item
.
mask
=
LVIF_TEXT
;
item
.
iItem
=
i
;
item
.
iSubItem
=
1
;
item
.
pszText
=
asfiInfo
[
i
].
szLinkTarget
;
SendDlgItemMessage
(
dialog
,
IDC_LIST_SFPATHS
,
LVM_SETITEM
,
0
,
(
LPARAM
)
&
item
);
item
.
pszText
=
strdupU2W
(
asfiInfo
[
i
].
szLinkTarget
);
SendDlgItemMessage
(
dialog
,
IDC_LIST_SFPATHS
,
LVM_SETITEMW
,
0
,
(
LPARAM
)
&
item
);
HeapFree
(
GetProcessHeap
(),
0
,
item
.
pszText
);
}
/* Ensure that the previously selected item is selected again. */
...
...
@@ -837,20 +851,23 @@ static void on_shell_folder_selection_changed(HWND hDlg, LPNMLISTVIEW lpnm) {
psfiSelected
=
(
struct
ShellFolderInfo
*
)
lpnm
->
lParam
;
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_LINK_SFPATH
),
1
);
if
(
strlen
(
psfiSelected
->
szLinkTarget
))
{
WCHAR
*
link
;
CheckDlgButton
(
hDlg
,
IDC_LINK_SFPATH
,
BST_CHECKED
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_EDIT_SFPATH
),
1
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_BROWSE_SFPATH
),
1
);
SetWindowText
(
GetDlgItem
(
hDlg
,
IDC_EDIT_SFPATH
),
psfiSelected
->
szLinkTarget
);
link
=
strdupU2W
(
psfiSelected
->
szLinkTarget
);
set_textW
(
hDlg
,
IDC_EDIT_SFPATH
,
link
);
HeapFree
(
GetProcessHeap
(),
0
,
link
);
}
else
{
CheckDlgButton
(
hDlg
,
IDC_LINK_SFPATH
,
BST_UNCHECKED
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_EDIT_SFPATH
),
0
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_BROWSE_SFPATH
),
0
);
S
et
WindowText
(
GetDlgItem
(
hDlg
,
IDC_EDIT_SFPATH
)
,
""
);
s
et
_text
(
hDlg
,
IDC_EDIT_SFPATH
,
""
);
}
}
else
{
psfiSelected
=
NULL
;
CheckDlgButton
(
hDlg
,
IDC_LINK_SFPATH
,
BST_UNCHECKED
);
S
et
WindowText
(
GetDlgItem
(
hDlg
,
IDC_EDIT_SFPATH
)
,
""
);
s
et
_text
(
hDlg
,
IDC_EDIT_SFPATH
,
""
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_LINK_SFPATH
),
0
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_EDIT_SFPATH
),
0
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_BROWSE_SFPATH
),
0
);
...
...
@@ -860,8 +877,8 @@ static void on_shell_folder_selection_changed(HWND hDlg, LPNMLISTVIEW lpnm) {
/* Keep the contents of the edit control, the listview control and the symlink
* information in sync. */
static
void
on_shell_folder_edit_changed
(
HWND
hDlg
)
{
LVITEM
item
;
char
*
text
=
get_text
(
hDlg
,
IDC_EDIT_SFPATH
);
LVITEM
W
item
;
WCHAR
*
text
=
get_text
W
(
hDlg
,
IDC_EDIT_SFPATH
);
LONG
iSel
=
SendDlgItemMessage
(
hDlg
,
IDC_LIST_SFPATHS
,
LVM_GETNEXTITEM
,
-
1
,
MAKELPARAM
(
LVNI_SELECTED
,
0
));
...
...
@@ -870,14 +887,16 @@ static void on_shell_folder_edit_changed(HWND hDlg) {
return
;
}
strncpy
(
psfiSelected
->
szLinkTarget
,
text
,
FILENAME_MAX
);
HeapFree
(
GetProcessHeap
(),
0
,
text
);
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
text
,
-
1
,
psfiSelected
->
szLinkTarget
,
FILENAME_MAX
,
NULL
,
NULL
);
item
.
mask
=
LVIF_TEXT
;
item
.
iItem
=
iSel
;
item
.
iSubItem
=
1
;
item
.
pszText
=
psfiSelected
->
szLinkTarget
;
SendDlgItemMessage
(
hDlg
,
IDC_LIST_SFPATHS
,
LVM_SETITEM
,
0
,
(
LPARAM
)
&
item
);
item
.
pszText
=
text
;
SendDlgItemMessage
(
hDlg
,
IDC_LIST_SFPATHS
,
LVM_SETITEMW
,
0
,
(
LPARAM
)
&
item
);
HeapFree
(
GetProcessHeap
(),
0
,
text
);
SendMessage
(
GetParent
(
hDlg
),
PSM_CHANGED
,
0
,
0
);
}
...
...
@@ -1158,15 +1177,25 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
break
;
case
IDC_BROWSE_SFPATH
:
if
(
browse_for_unix_folder
(
hDlg
,
psfiSelected
->
szLinkTarget
))
{
{
WCHAR
link
[
FILENAME_MAX
];
if
(
browse_for_unix_folder
(
hDlg
,
link
))
{
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
link
,
-
1
,
psfiSelected
->
szLinkTarget
,
FILENAME_MAX
,
NULL
,
NULL
);
update_shell_folder_listview
(
hDlg
);
SendMessage
(
GetParent
(
hDlg
),
PSM_CHANGED
,
0
,
0
);
}
break
;
}
case
IDC_LINK_SFPATH
:
if
(
IsDlgButtonChecked
(
hDlg
,
IDC_LINK_SFPATH
))
{
if
(
browse_for_unix_folder
(
hDlg
,
psfiSelected
->
szLinkTarget
))
{
WCHAR
link
[
FILENAME_MAX
];
if
(
browse_for_unix_folder
(
hDlg
,
link
))
{
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
link
,
-
1
,
psfiSelected
->
szLinkTarget
,
FILENAME_MAX
,
NULL
,
NULL
);
update_shell_folder_listview
(
hDlg
);
SendMessage
(
GetParent
(
hDlg
),
PSM_CHANGED
,
0
,
0
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
programs/winecfg/winecfg.h
+
15
−
1
View file @
2ae3945d
...
...
@@ -109,7 +109,7 @@ long drive_available_mask(char letter);
BOOL
add_drive
(
const
char
letter
,
const
char
*
targetpath
,
const
char
*
label
,
const
char
*
serial
,
unsigned
int
type
);
void
delete_drive
(
struct
drive
*
pDrive
);
void
apply_drive_changes
(
void
);
BOOL
browse_for_unix_folder
(
HWND
dialog
,
char
*
pszPath
);
BOOL
browse_for_unix_folder
(
HWND
dialog
,
WCHAR
*
pszPath
);
extern
struct
drive
drives
[
26
];
/* one for each drive letter */
BOOL
gui_mode
;
...
...
@@ -141,11 +141,25 @@ static inline char *get_text(HWND dialog, WORD id)
return
result
;
}
static
inline
WCHAR
*
get_textW
(
HWND
dialog
,
WORD
id
)
{
HWND
item
=
GetDlgItem
(
dialog
,
id
);
int
len
=
GetWindowTextLengthW
(
item
)
+
1
;
WCHAR
*
result
=
len
?
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
))
:
NULL
;
if
(
!
result
||
GetWindowTextW
(
item
,
result
,
len
)
==
0
)
return
NULL
;
return
result
;
}
static
inline
void
set_text
(
HWND
dialog
,
WORD
id
,
const
char
*
text
)
{
SetWindowText
(
GetDlgItem
(
dialog
,
id
),
text
);
}
static
inline
void
set_textW
(
HWND
dialog
,
WORD
id
,
const
WCHAR
*
text
)
{
SetWindowTextW
(
GetDlgItem
(
dialog
,
id
),
text
);
}
#define WINE_KEY_ROOT "Software\\Wine"
#define MAXBUFLEN 256
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment