Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
d02d5029
Commit
d02d5029
authored
Sep 07, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecfg: Use Unicode functions throughout.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a243a7af
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
409 additions
and
634 deletions
+409
-634
Makefile.in
programs/winecfg/Makefile.in
+1
-1
about.c
programs/winecfg/about.c
+16
-16
appdefaults.c
programs/winecfg/appdefaults.c
+118
-122
audio.c
programs/winecfg/audio.c
+8
-8
drive.c
programs/winecfg/drive.c
+11
-54
driveui.c
programs/winecfg/driveui.c
+14
-14
libraries.c
programs/winecfg/libraries.c
+133
-137
main.c
programs/winecfg/main.c
+4
-4
theme.c
programs/winecfg/theme.c
+47
-63
winecfg.c
programs/winecfg/winecfg.c
+11
-152
winecfg.h
programs/winecfg/winecfg.h
+10
-27
x11drvdlg.c
programs/winecfg/x11drvdlg.c
+36
-36
No files found.
programs/winecfg/Makefile.in
View file @
d02d5029
...
...
@@ -2,7 +2,7 @@ MODULE = winecfg.exe
APPMODE
=
-mwindows
IMPORTS
=
uuid comdlg32 comctl32 shell32 ole32 winmm shlwapi uxtheme user32 gdi32 advapi32
EXTRADLLFLAGS
=
-mno-cygwin
EXTRADLLFLAGS
=
-mno-cygwin
-municode
C_SRCS
=
\
about.c
\
...
...
programs/winecfg/about.c
View file @
d02d5029
...
...
@@ -42,7 +42,7 @@ AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HWND
hWnd
;
HDC
hDC
;
RECT
rcClient
,
rcRect
;
char
*
owner
,
*
org
;
WCHAR
*
owner
,
*
org
;
switch
(
uMsg
)
{
...
...
@@ -54,14 +54,14 @@ AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
owner
=
get_text
(
hDlg
,
IDC_ABT_OWNER
);
org
=
get_text
(
hDlg
,
IDC_ABT_ORG
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion"
,
"RegisteredOwner"
,
owner
?
owner
:
""
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion"
,
"RegisteredOrganization"
,
org
?
org
:
""
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion"
,
"RegisteredOwner"
,
owner
?
owner
:
""
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion"
,
"RegisteredOrganization"
,
org
?
org
:
""
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
L
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion"
,
L"RegisteredOwner"
,
owner
?
owner
:
L
""
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
L
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion"
,
L"RegisteredOrganization"
,
org
?
org
:
L
""
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
L
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion"
,
L"RegisteredOwner"
,
owner
?
owner
:
L
""
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
L
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion"
,
L"RegisteredOrganization"
,
org
?
org
:
L
""
);
apply
();
HeapFree
(
GetProcessHeap
(),
0
,
owner
);
...
...
@@ -80,13 +80,13 @@ AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
hDC
=
GetDC
(
hDlg
);
/* read owner and organization info from registry, load it into text box */
owner
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion"
,
"RegisteredOwner"
,
""
);
org
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion"
,
"RegisteredOrganization"
,
""
);
owner
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
L
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion"
,
L"RegisteredOwner"
,
L
""
);
org
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
L
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion"
,
L"RegisteredOrganization"
,
L
""
);
SetDlgItemText
A
(
hDlg
,
IDC_ABT_OWNER
,
owner
);
SetDlgItemText
A
(
hDlg
,
IDC_ABT_ORG
,
org
);
SetDlgItemText
W
(
hDlg
,
IDC_ABT_OWNER
,
owner
);
SetDlgItemText
W
(
hDlg
,
IDC_ABT_ORG
,
org
);
SendMessageW
(
GetParent
(
hDlg
),
PSM_UNCHANGED
,
0
,
0
);
...
...
@@ -110,7 +110,7 @@ AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
0
,
0
,
0
,
0
,
FALSE
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
L"Tahoma"
);
SendDlgItemMessageW
(
hDlg
,
IDC_ABT_TITLE_TEXT
,
WM_SETFONT
,
(
WPARAM
)
titleFont
,
TRUE
);
wine_get_version
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
A
(
"ntdll.dll"
),
"wine_get_version"
);
wine_get_version
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
W
(
L
"ntdll.dll"
),
"wine_get_version"
);
if
(
wine_get_version
)
SetDlgItemTextA
(
hDlg
,
IDC_ABT_PANEL_TEXT
,
wine_get_version
());
ReleaseDC
(
hDlg
,
hDC
);
...
...
programs/winecfg/appdefaults.c
View file @
d02d5029
...
...
@@ -36,90 +36,90 @@ WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
struct
win_version
{
const
char
*
szVersion
;
const
char
*
szDescription
;
DWORD
dwMajorVersion
;
DWORD
dwMinorVersion
;
DWORD
dwBuildNumber
;
DWORD
dwPlatformId
;
const
char
*
szCSDVersion
;
WORD
wServicePackMajor
;
WORD
wServicePackMinor
;
const
char
*
szProductType
;
const
WCHAR
*
szVersion
;
const
WCHAR
*
szDescription
;
DWORD
dwMajorVersion
;
DWORD
dwMinorVersion
;
DWORD
dwBuildNumber
;
DWORD
dwPlatformId
;
const
WCHAR
*
szCSDVersion
;
WORD
wServicePackMajor
;
WORD
wServicePackMinor
;
const
WCHAR
*
szProductType
;
};
static
const
struct
win_version
win_versions
[]
=
{
{
"win10"
,
"Windows 10"
,
10
,
0
,
0x4563
,
VER_PLATFORM_WIN32_NT
,
""
,
0
,
0
,
"WinNT"
},
{
"win81"
,
"Windows 8.1"
,
6
,
3
,
0x2580
,
VER_PLATFORM_WIN32_NT
,
""
,
0
,
0
,
"WinNT"
},
{
"win8"
,
"Windows 8"
,
6
,
2
,
0x23F0
,
VER_PLATFORM_WIN32_NT
,
""
,
0
,
0
,
"WinNT"
},
{
"win2008r2"
,
"Windows 2008 R2"
,
6
,
1
,
0x1DB1
,
VER_PLATFORM_WIN32_NT
,
"Service Pack 1"
,
1
,
0
,
"ServerNT"
},
{
"win7"
,
"Windows 7"
,
6
,
1
,
0x1DB1
,
VER_PLATFORM_WIN32_NT
,
"Service Pack 1"
,
1
,
0
,
"WinNT"
},
{
"win2008"
,
"Windows 2008"
,
6
,
0
,
0x1772
,
VER_PLATFORM_WIN32_NT
,
"Service Pack 2"
,
2
,
0
,
"ServerNT"
},
{
"vista"
,
"Windows Vista"
,
6
,
0
,
0x1772
,
VER_PLATFORM_WIN32_NT
,
"Service Pack 2"
,
2
,
0
,
"WinNT"
},
{
"win2003"
,
"Windows 2003"
,
5
,
2
,
0xECE
,
VER_PLATFORM_WIN32_NT
,
"Service Pack 2"
,
2
,
0
,
"ServerNT"
},
{
L"win10"
,
L"Windows 10"
,
10
,
0
,
0x4563
,
VER_PLATFORM_WIN32_NT
,
L""
,
0
,
0
,
L
"WinNT"
},
{
L"win81"
,
L"Windows 8.1"
,
6
,
3
,
0x2580
,
VER_PLATFORM_WIN32_NT
,
L""
,
0
,
0
,
L
"WinNT"
},
{
L"win8"
,
L"Windows 8"
,
6
,
2
,
0x23F0
,
VER_PLATFORM_WIN32_NT
,
L""
,
0
,
0
,
L
"WinNT"
},
{
L"win2008r2"
,
L"Windows 2008 R2"
,
6
,
1
,
0x1DB1
,
VER_PLATFORM_WIN32_NT
,
L"Service Pack 1"
,
1
,
0
,
L
"ServerNT"
},
{
L"win7"
,
L"Windows 7"
,
6
,
1
,
0x1DB1
,
VER_PLATFORM_WIN32_NT
,
L"Service Pack 1"
,
1
,
0
,
L
"WinNT"
},
{
L"win2008"
,
L"Windows 2008"
,
6
,
0
,
0x1772
,
VER_PLATFORM_WIN32_NT
,
L"Service Pack 2"
,
2
,
0
,
L
"ServerNT"
},
{
L"vista"
,
L"Windows Vista"
,
6
,
0
,
0x1772
,
VER_PLATFORM_WIN32_NT
,
L"Service Pack 2"
,
2
,
0
,
L
"WinNT"
},
{
L"win2003"
,
L"Windows 2003"
,
5
,
2
,
0xECE
,
VER_PLATFORM_WIN32_NT
,
L"Service Pack 2"
,
2
,
0
,
L
"ServerNT"
},
#ifdef _WIN64
{
"winxp64"
,
"Windows XP"
,
5
,
2
,
0xECE
,
VER_PLATFORM_WIN32_NT
,
"Service Pack 2"
,
2
,
0
,
"WinNT"
},
{
L"winxp64"
,
L"Windows XP"
,
5
,
2
,
0xECE
,
VER_PLATFORM_WIN32_NT
,
L"Service Pack 2"
,
2
,
0
,
L
"WinNT"
},
#else
{
"winxp"
,
"Windows XP"
,
5
,
1
,
0xA28
,
VER_PLATFORM_WIN32_NT
,
"Service Pack 3"
,
3
,
0
,
"WinNT"
},
{
"win2k"
,
"Windows 2000"
,
5
,
0
,
0x893
,
VER_PLATFORM_WIN32_NT
,
"Service Pack 4"
,
4
,
0
,
"WinNT"
},
{
"winme"
,
"Windows ME"
,
4
,
90
,
0xBB8
,
VER_PLATFORM_WIN32_WINDOWS
,
" "
,
0
,
0
,
""
},
{
"win98"
,
"Windows 98"
,
4
,
10
,
0x8AE
,
VER_PLATFORM_WIN32_WINDOWS
,
" A "
,
0
,
0
,
""
},
{
"win95"
,
"Windows 95"
,
4
,
0
,
0x3B6
,
VER_PLATFORM_WIN32_WINDOWS
,
""
,
0
,
0
,
""
},
{
"nt40"
,
"Windows NT 4.0"
,
4
,
0
,
0x565
,
VER_PLATFORM_WIN32_NT
,
"Service Pack 6a"
,
6
,
0
,
"WinNT"
},
{
"nt351"
,
"Windows NT 3.51"
,
3
,
51
,
0x421
,
VER_PLATFORM_WIN32_NT
,
"Service Pack 5"
,
5
,
0
,
"WinNT"
},
{
"win31"
,
"Windows 3.1"
,
3
,
10
,
0
,
VER_PLATFORM_WIN32s
,
"Win32s 1.3"
,
0
,
0
,
""
},
{
"win30"
,
"Windows 3.0"
,
3
,
0
,
0
,
VER_PLATFORM_WIN32s
,
"Win32s 1.3"
,
0
,
0
,
""
},
{
"win20"
,
"Windows 2.0"
,
2
,
0
,
0
,
VER_PLATFORM_WIN32s
,
"Win32s 1.3"
,
0
,
0
,
""
}
{
L"winxp"
,
L"Windows XP"
,
5
,
1
,
0xA28
,
VER_PLATFORM_WIN32_NT
,
L"Service Pack 3"
,
3
,
0
,
L
"WinNT"
},
{
L"win2k"
,
L"Windows 2000"
,
5
,
0
,
0x893
,
VER_PLATFORM_WIN32_NT
,
L"Service Pack 4"
,
4
,
0
,
L
"WinNT"
},
{
L"winme"
,
L"Windows ME"
,
4
,
90
,
0xBB8
,
VER_PLATFORM_WIN32_WINDOWS
,
L" "
,
0
,
0
,
L
""
},
{
L"win98"
,
L"Windows 98"
,
4
,
10
,
0x8AE
,
VER_PLATFORM_WIN32_WINDOWS
,
L" A "
,
0
,
0
,
L
""
},
{
L"win95"
,
L"Windows 95"
,
4
,
0
,
0x3B6
,
VER_PLATFORM_WIN32_WINDOWS
,
L""
,
0
,
0
,
L
""
},
{
L"nt40"
,
L"Windows NT 4.0"
,
4
,
0
,
0x565
,
VER_PLATFORM_WIN32_NT
,
L"Service Pack 6a"
,
6
,
0
,
L
"WinNT"
},
{
L"nt351"
,
L"Windows NT 3.51"
,
3
,
51
,
0x421
,
VER_PLATFORM_WIN32_NT
,
L"Service Pack 5"
,
5
,
0
,
L
"WinNT"
},
{
L"win31"
,
L"Windows 3.1"
,
3
,
10
,
0
,
VER_PLATFORM_WIN32s
,
L"Win32s 1.3"
,
0
,
0
,
L
""
},
{
L"win30"
,
L"Windows 3.0"
,
3
,
0
,
0
,
VER_PLATFORM_WIN32s
,
L"Win32s 1.3"
,
0
,
0
,
L
""
},
{
L"win20"
,
L"Windows 2.0"
,
2
,
0
,
0
,
VER_PLATFORM_WIN32s
,
L"Win32s 1.3"
,
0
,
0
,
L
""
}
#endif
};
#define DEFAULT_WIN_VERSION "win7"
#define DEFAULT_WIN_VERSION
L
"win7"
static
const
char
szKey9x
[]
=
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion"
;
static
const
char
szKeyNT
[]
=
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion"
;
static
const
char
szKeyProdNT
[]
=
"System
\\
CurrentControlSet
\\
Control
\\
ProductOptions"
;
static
const
WCHAR
szKey9x
[]
=
L
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion"
;
static
const
WCHAR
szKeyNT
[]
=
L
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion"
;
static
const
WCHAR
szKeyProdNT
[]
=
L
"System
\\
CurrentControlSet
\\
Control
\\
ProductOptions"
;
static
int
get_registry_version
(
void
)
{
int
i
,
best
=
-
1
,
platform
,
major
,
minor
=
0
,
build
=
0
;
char
*
p
,
*
ver
,
*
type
=
NULL
;
WCHAR
*
p
,
*
ver
,
*
type
=
NULL
;
if
((
ver
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentVersion"
,
NULL
)))
if
((
ver
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentVersion"
,
NULL
)))
{
char
*
build_str
;
WCHAR
*
build_str
;
platform
=
VER_PLATFORM_WIN32_NT
;
build_str
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentBuildNumber"
,
NULL
);
build
=
atoi
(
build_str
);
build_str
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentBuildNumber"
,
NULL
);
build
=
wcstol
(
build_str
,
NULL
,
10
);
type
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyProdNT
,
"ProductType"
,
NULL
);
type
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyProdNT
,
L
"ProductType"
,
NULL
);
}
else
if
((
ver
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
"VersionNumber"
,
NULL
)))
else
if
((
ver
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
L
"VersionNumber"
,
NULL
)))
platform
=
VER_PLATFORM_WIN32_WINDOWS
;
else
return
-
1
;
if
((
p
=
str
chr
(
ver
,
'.'
)))
if
((
p
=
wcs
chr
(
ver
,
'.'
)))
{
char
*
minor_str
=
p
;
WCHAR
*
minor_str
=
p
;
*
minor_str
++
=
0
;
if
((
p
=
str
chr
(
minor_str
,
'.'
)))
if
((
p
=
wcs
chr
(
minor_str
,
'.'
)))
{
char
*
build_str
=
p
;
WCHAR
*
build_str
=
p
;
*
build_str
++
=
0
;
build
=
atoi
(
build_str
);
build
=
wcstol
(
build_str
,
NULL
,
10
);
}
minor
=
atoi
(
minor_str
);
minor
=
wcstol
(
minor_str
,
NULL
,
10
);
}
major
=
atoi
(
ver
);
major
=
wcstol
(
ver
,
NULL
,
10
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
win_versions
);
i
++
)
{
if
(
win_versions
[
i
].
dwPlatformId
!=
platform
)
continue
;
if
(
win_versions
[
i
].
dwMajorVersion
!=
major
)
continue
;
if
(
type
&&
strcase
cmp
(
win_versions
[
i
].
szProductType
,
type
))
continue
;
if
(
type
&&
wcsi
cmp
(
win_versions
[
i
].
szProductType
,
type
))
continue
;
best
=
i
;
if
((
win_versions
[
i
].
dwMinorVersion
==
minor
)
&&
(
win_versions
[
i
].
dwBuildNumber
==
build
))
...
...
@@ -131,10 +131,10 @@ static int get_registry_version(void)
static
void
update_comboboxes
(
HWND
dialog
)
{
int
i
,
ver
;
char
*
winver
;
WCHAR
*
winver
;
/* retrieve the registry values */
winver
=
get_reg_key
(
config_key
,
keypath
(
""
),
"Version"
,
""
);
winver
=
get_reg_key
(
config_key
,
keypath
(
L""
),
L"Version"
,
L
""
);
ver
=
get_registry_version
();
if
(
!
winver
||
!
winver
[
0
])
...
...
@@ -147,19 +147,19 @@ static void update_comboboxes(HWND dialog)
SendDlgItemMessageW
(
dialog
,
IDC_WINVER
,
CB_SETCURSEL
,
0
,
0
);
return
;
}
if
(
ver
!=
-
1
)
winver
=
strdup
A
(
win_versions
[
ver
].
szVersion
);
else
winver
=
strdup
A
(
DEFAULT_WIN_VERSION
);
if
(
ver
!=
-
1
)
winver
=
strdup
W
(
win_versions
[
ver
].
szVersion
);
else
winver
=
strdup
W
(
DEFAULT_WIN_VERSION
);
}
WINE_TRACE
(
"winver is %s
\n
"
,
winver
);
WINE_TRACE
(
"winver is %s
\n
"
,
debugstr_w
(
winver
)
);
/* normalize the version strings */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
win_versions
);
i
++
)
{
if
(
!
strcasecmp
(
win_versions
[
i
].
szVersion
,
winver
))
if
(
!
wcsicmp
(
win_versions
[
i
].
szVersion
,
winver
))
{
SendDlgItemMessageW
(
dialog
,
IDC_WINVER
,
CB_SETCURSEL
,
i
+
(
current_app
?
1
:
0
),
0
);
WINE_TRACE
(
"match with %s
\n
"
,
win_versions
[
i
].
szVersion
);
WINE_TRACE
(
"match with %s
\n
"
,
debugstr_w
(
win_versions
[
i
].
szVersion
)
);
break
;
}
}
...
...
@@ -184,7 +184,7 @@ init_comboboxes (HWND dialog)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
win_versions
);
i
++
)
{
SendDlgItemMessage
A
(
dialog
,
IDC_WINVER
,
CB_ADDSTRING
,
SendDlgItemMessage
W
(
dialog
,
IDC_WINVER
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
win_versions
[
i
].
szDescription
);
}
}
...
...
@@ -223,7 +223,7 @@ static void init_appsheet(HWND dialog)
add_listview_item
(
listview
,
appname
,
NULL
);
/* because this list is only populated once, it's safe to bypass the settings list here */
if
(
RegOpenKey
A
(
config_key
,
"AppDefaults"
,
&
key
)
==
ERROR_SUCCESS
)
if
(
RegOpenKey
W
(
config_key
,
L
"AppDefaults"
,
&
key
)
==
ERROR_SUCCESS
)
{
i
=
0
;
size
=
ARRAY_SIZE
(
appname
);
...
...
@@ -385,7 +385,7 @@ static void on_remove_app_click(HWND dialog)
assert
(
selection
!=
0
);
/* user cannot click this button when "default settings" is selected */
set_reg_key
(
config_key
,
keypath
(
""
),
NULL
,
NULL
);
/* delete the section */
set_reg_key
(
config_key
,
keypath
(
L
""
),
NULL
,
NULL
);
/* delete the section */
SendMessageW
(
listview
,
LVM_GETITEMW
,
0
,
(
LPARAM
)
&
item
);
HeapFree
(
GetProcessHeap
(),
0
,
(
void
*
)
item
.
lParam
);
SendMessageW
(
listview
,
LVM_DELETEITEM
,
selection
,
0
);
...
...
@@ -400,85 +400,85 @@ static void on_remove_app_click(HWND dialog)
static
void
set_winver
(
const
struct
win_version
*
version
)
{
static
const
char
szKeyWindNT
[]
=
"System
\\
CurrentControlSet
\\
Control
\\
Windows"
;
static
const
char
szKeyEnvNT
[]
=
"System
\\
CurrentControlSet
\\
Control
\\
Session Manager
\\
Environment"
;
char
B
uffer
[
40
];
static
const
WCHAR
szKeyWindNT
[]
=
L
"System
\\
CurrentControlSet
\\
Control
\\
Windows"
;
static
const
WCHAR
szKeyEnvNT
[]
=
L
"System
\\
CurrentControlSet
\\
Control
\\
Session Manager
\\
Environment"
;
WCHAR
b
uffer
[
40
];
switch
(
version
->
dwPlatformId
)
{
case
VER_PLATFORM_WIN32_WINDOWS
:
s
nprintf
(
Buffer
,
sizeof
(
Buffer
),
"%d.%d.%d"
,
version
->
dwMajorVersion
,
s
wprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
L
"%d.%d.%d"
,
version
->
dwMajorVersion
,
version
->
dwMinorVersion
,
version
->
dwBuildNumber
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
"VersionNumber"
,
B
uffer
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
"SubVersionNumber"
,
version
->
szCSDVersion
);
s
nprintf
(
Buffer
,
sizeof
(
Buffer
),
"Microsoft %s"
,
version
->
szDescription
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
"ProductName"
,
B
uffer
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CSDVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentMajorVersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentMinorVersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentBuild"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentBuildNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"ProductName"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyProdNT
,
"ProductType"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyWindNT
,
"CSDVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyEnvNT
,
"OS"
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
""
),
"Version"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
L"VersionNumber"
,
b
uffer
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
L
"SubVersionNumber"
,
version
->
szCSDVersion
);
s
wprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
L
"Microsoft %s"
,
version
->
szDescription
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
L"ProductName"
,
b
uffer
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CSDVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentMajorVersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentMinorVersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentBuild"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentBuildNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"ProductName"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyProdNT
,
L
"ProductType"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyWindNT
,
L
"CSDVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyEnvNT
,
L
"OS"
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
L""
),
L
"Version"
,
NULL
);
break
;
case
VER_PLATFORM_WIN32_NT
:
s
nprintf
(
Buffer
,
sizeof
(
Buffer
),
"%d.%d"
,
version
->
dwMajorVersion
,
s
wprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
L
"%d.%d"
,
version
->
dwMajorVersion
,
version
->
dwMinorVersion
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentVersion"
,
B
uffer
);
set_reg_key_dword
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentMajorVersionNumber"
,
version
->
dwMajorVersion
);
set_reg_key_dword
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentMinorVersionNumber"
,
version
->
dwMinorVersion
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CSDVersion"
,
version
->
szCSDVersion
);
s
nprintf
(
Buffer
,
sizeof
(
Buffer
),
"%d"
,
version
->
dwBuildNumber
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentBuild"
,
B
uffer
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentBuildNumber"
,
B
uffer
);
s
nprintf
(
Buffer
,
sizeof
(
Buffer
),
"Microsoft %s"
,
version
->
szDescription
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"ProductName"
,
B
uffer
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyProdNT
,
"ProductType"
,
version
->
szProductType
);
set_reg_key_dword
(
HKEY_LOCAL_MACHINE
,
szKeyWindNT
,
"CSDVersion"
,
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L"CurrentVersion"
,
b
uffer
);
set_reg_key_dword
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentMajorVersionNumber"
,
version
->
dwMajorVersion
);
set_reg_key_dword
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentMinorVersionNumber"
,
version
->
dwMinorVersion
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CSDVersion"
,
version
->
szCSDVersion
);
s
wprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
L
"%d"
,
version
->
dwBuildNumber
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L"CurrentBuild"
,
b
uffer
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L"CurrentBuildNumber"
,
b
uffer
);
s
wprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
L
"Microsoft %s"
,
version
->
szDescription
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L"ProductName"
,
b
uffer
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyProdNT
,
L
"ProductType"
,
version
->
szProductType
);
set_reg_key_dword
(
HKEY_LOCAL_MACHINE
,
szKeyWindNT
,
L
"CSDVersion"
,
MAKEWORD
(
version
->
wServicePackMinor
,
version
->
wServicePackMajor
));
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyEnvNT
,
"OS"
,
"Windows_NT"
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyEnvNT
,
L"OS"
,
L
"Windows_NT"
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
"VersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
"SubVersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
"ProductName"
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
""
),
"Version"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
L
"VersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
L
"SubVersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
L
"ProductName"
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
L""
),
L
"Version"
,
NULL
);
break
;
case
VER_PLATFORM_WIN32s
:
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CSDVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentBuild"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"CurrentBuildNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
"ProductName"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyProdNT
,
"ProductType"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyWindNT
,
"CSDVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyEnvNT
,
"OS"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
"VersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
"SubVersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
"ProductName"
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
""
),
"Version"
,
version
->
szVersion
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CSDVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentBuild"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"CurrentBuildNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyNT
,
L
"ProductName"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyProdNT
,
L
"ProductType"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyWindNT
,
L
"CSDVersion"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKeyEnvNT
,
L
"OS"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
L
"VersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
L
"SubVersionNumber"
,
NULL
);
set_reg_key
(
HKEY_LOCAL_MACHINE
,
szKey9x
,
L
"ProductName"
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
L""
),
L
"Version"
,
version
->
szVersion
);
break
;
}
}
BOOL
set_winver_from_string
(
const
char
*
version
)
BOOL
set_winver_from_string
(
const
WCHAR
*
version
)
{
int
i
;
WINE_TRACE
(
"desired winver:
'%s'
\n
"
,
version
);
WINE_TRACE
(
"desired winver:
%s
\n
"
,
debugstr_w
(
version
)
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
win_versions
);
i
++
)
{
if
(
!
lstrcmpiA
(
win_versions
[
i
].
szVersion
,
version
))
if
(
!
wcsicmp
(
win_versions
[
i
].
szVersion
,
version
))
{
WINE_TRACE
(
"match with %s
\n
"
,
win_versions
[
i
].
szVersion
);
WINE_TRACE
(
"match with %s
\n
"
,
debugstr_w
(
win_versions
[
i
].
szVersion
)
);
set_winver
(
&
win_versions
[
i
]);
apply
();
return
TRUE
;
...
...
@@ -494,25 +494,21 @@ void print_windows_versions(void)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
win_versions
);
i
++
)
{
printf
(
" %10s %s
\n
"
,
win_versions
[
i
].
szVersion
,
win_versions
[
i
].
szDescription
);
wprintf
(
L
" %10s %s
\n
"
,
win_versions
[
i
].
szVersion
,
win_versions
[
i
].
szDescription
);
}
}
void
print_current_winver
(
void
)
{
char
*
winver
=
get_reg_key
(
config_key
,
keypath
(
""
),
"Version"
,
""
);
WCHAR
*
winver
=
get_reg_key
(
config_key
,
keypath
(
L""
),
L"Version"
,
L
""
);
if
(
!
winver
||
!
winver
[
0
])
{
int
ver
=
get_registry_version
();
if
(
ver
==
-
1
)
printf
(
DEFAULT_WIN_VERSION
"
\n
"
);
else
printf
(
"%s
\n
"
,
win_versions
[
ver
].
szVersion
);
wprintf
(
L"%s
\n
"
,
ver
==
-
1
?
DEFAULT_WIN_VERSION
:
win_versions
[
ver
].
szVersion
);
}
else
printf
(
"%s
\n
"
,
winver
);
wprintf
(
L
"%s
\n
"
,
winver
);
heap_free
(
winver
);
}
...
...
@@ -526,12 +522,12 @@ static void on_winver_change(HWND dialog)
if
(
!
selection
)
{
WINE_TRACE
(
"default selected so removing current setting
\n
"
);
set_reg_key
(
config_key
,
keypath
(
""
),
"Version"
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
L""
),
L
"Version"
,
NULL
);
}
else
{
WINE_TRACE
(
"setting Version key to value
'%s'
\n
"
,
win_versions
[
selection
-
1
].
szVersion
);
set_reg_key
(
config_key
,
keypath
(
""
),
"Version"
,
win_versions
[
selection
-
1
].
szVersion
);
WINE_TRACE
(
"setting Version key to value
%s
\n
"
,
debugstr_w
(
win_versions
[
selection
-
1
].
szVersion
)
);
set_reg_key
(
config_key
,
keypath
(
L""
),
L
"Version"
,
win_versions
[
selection
-
1
].
szVersion
);
}
}
else
/* global version only */
...
...
programs/winecfg/audio.c
View file @
d02d5029
...
...
@@ -237,7 +237,7 @@ static void initAudioDlg (HWND hDlg)
PropVariantInit
(
&
pv
);
if
(
get_driver_name
(
devenum
,
&
pv
)
&&
pv
.
pwszVal
[
0
]
!=
'\0'
){
have_driver
=
TRUE
;
wnsprintfW
(
display_str
,
ARRAY_SIZE
(
display_str
),
format_str
,
pv
.
pwszVal
);
swprintf
(
display_str
,
ARRAY_SIZE
(
display_str
),
format_str
,
pv
.
pwszVal
);
lstrcatW
(
g_drv_keyW
,
pv
.
pwszVal
);
}
PropVariantClear
(
&
pv
);
...
...
@@ -291,10 +291,10 @@ static void initAudioDlg (HWND hDlg)
if
(
have_driver
){
WCHAR
*
reg_out_dev
,
*
reg_vout_dev
,
*
reg_in_dev
,
*
reg_vin_dev
;
reg_out_dev
=
get_reg_key
W
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
L"DefaultOutput"
,
NULL
);
reg_vout_dev
=
get_reg_key
W
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
L"DefaultVoiceOutput"
,
NULL
);
reg_in_dev
=
get_reg_key
W
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
L"DefaultInput"
,
NULL
);
reg_vin_dev
=
get_reg_key
W
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
L"DefaultVoiceInput"
,
NULL
);
reg_out_dev
=
get_reg_key
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
L"DefaultOutput"
,
NULL
);
reg_vout_dev
=
get_reg_key
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
L"DefaultVoiceOutput"
,
NULL
);
reg_in_dev
=
get_reg_key
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
L"DefaultInput"
,
NULL
);
reg_vin_dev
=
get_reg_key
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
L"DefaultVoiceInput"
,
NULL
);
for
(
i
=
0
;
i
<
num_render_devs
;
++
i
){
LVITEMW
lvitem
;
...
...
@@ -364,7 +364,7 @@ static void initAudioDlg (HWND hDlg)
HeapFree
(
GetProcessHeap
(),
0
,
reg_in_dev
);
HeapFree
(
GetProcessHeap
(),
0
,
reg_vin_dev
);
}
else
wnsprintfW
(
display_str
,
ARRAY_SIZE
(
display_str
),
format_str
,
disabled_str
);
swprintf
(
display_str
,
ARRAY_SIZE
(
display_str
),
format_str
,
disabled_str
);
SetDlgItemTextW
(
hDlg
,
IDC_AUDIO_DRIVER
,
display_str
);
}
...
...
@@ -380,9 +380,9 @@ static void set_reg_device(HWND hDlg, int dlgitem, const WCHAR *key_name)
CB_GETITEMDATA
,
idx
,
0
);
if
(
!
info
||
info
==
(
void
*
)
CB_ERR
)
set_reg_key
W
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
key_name
,
NULL
);
set_reg_key
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
key_name
,
NULL
);
else
set_reg_key
W
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
key_name
,
info
->
id
);
set_reg_key
(
HKEY_CURRENT_USER
,
g_drv_keyW
,
key_name
,
info
->
id
);
}
static
void
test_sound
(
void
)
...
...
programs/winecfg/drive.c
View file @
d02d5029
...
...
@@ -130,25 +130,25 @@ void delete_drive(struct drive *d)
static
DWORD
get_drive_type
(
char
letter
)
{
HKEY
hKey
;
char
driveValue
[
4
];
WCHAR
driveValue
[
4
];
DWORD
ret
=
DRIVE_UNKNOWN
;
s
printf
(
driveValue
,
"%c:"
,
letter
);
s
wprintf
(
driveValue
,
4
,
L
"%c:"
,
letter
);
if
(
RegOpenKey
A
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Wine
\\
Drives"
,
&
hKey
)
!=
ERROR_SUCCESS
)
if
(
RegOpenKey
W
(
HKEY_LOCAL_MACHINE
,
L
"Software
\\
Wine
\\
Drives"
,
&
hKey
)
!=
ERROR_SUCCESS
)
WINE_TRACE
(
" Unable to open Software
\\
Wine
\\
Drives
\n
"
);
else
{
char
buffer
[
80
];
DWORD
size
=
sizeof
(
buffer
);
WCHAR
buffer
[
80
];
DWORD
size
=
ARRAY_SIZE
(
buffer
);
if
(
!
RegQueryValueEx
A
(
hKey
,
driveValue
,
NULL
,
NULL
,
(
LPBYTE
)
buffer
,
&
size
))
if
(
!
RegQueryValueEx
W
(
hKey
,
driveValue
,
NULL
,
NULL
,
(
LPBYTE
)
buffer
,
&
size
))
{
WINE_TRACE
(
"Got type
'%s' for %s
\n
"
,
buffer
,
driveValue
);
if
(
!
lstrcmpiA
(
buffer
,
"hd"
))
ret
=
DRIVE_FIXED
;
else
if
(
!
lstrcmpiA
(
buffer
,
"network"
))
ret
=
DRIVE_REMOTE
;
else
if
(
!
lstrcmpiA
(
buffer
,
"floppy"
))
ret
=
DRIVE_REMOVABLE
;
else
if
(
!
lstrcmpiA
(
buffer
,
"cdrom"
))
ret
=
DRIVE_CDROM
;
WINE_TRACE
(
"Got type
%s for %s
\n
"
,
debugstr_w
(
buffer
),
debugstr_w
(
driveValue
)
);
if
(
!
wcsicmp
(
buffer
,
L
"hd"
))
ret
=
DRIVE_FIXED
;
else
if
(
!
wcsicmp
(
buffer
,
L
"network"
))
ret
=
DRIVE_REMOTE
;
else
if
(
!
wcsicmp
(
buffer
,
L
"floppy"
))
ret
=
DRIVE_REMOVABLE
;
else
if
(
!
wcsicmp
(
buffer
,
L
"cdrom"
))
ret
=
DRIVE_CDROM
;
}
RegCloseKey
(
hKey
);
}
...
...
@@ -197,49 +197,6 @@ static void set_drive_serial( WCHAR letter, DWORD serial )
}
}
#if 0
/* currently unused, but if users have this burning desire to be able to rename drives,
we can put it back in.
*/
BOOL copyDrive(struct drive *pSrc, struct drive *pDst)
{
if(pDst->in_use)
{
WINE_TRACE("pDst already in use\n");
return FALSE;
}
if(!pSrc->unixpath) WINE_TRACE("!pSrc->unixpath\n");
if(!pSrc->label) WINE_TRACE("!pSrc->label\n");
if(!pSrc->serial) WINE_TRACE("!pSrc->serial\n");
pDst->unixpath = strdupA(pSrc->unixpath);
pDst->label = strdupA(pSrc->label);
pDst->serial = strdupA(pSrc->serial);
pDst->type = pSrc->type;
pDst->in_use = TRUE;
return TRUE;
}
BOOL moveDrive(struct drive *pSrc, struct drive *pDst)
{
WINE_TRACE("pSrc->letter == %c, pDst->letter == %c\n", pSrc->letter, pDst->letter);
if(!copyDrive(pSrc, pDst))
{
WINE_TRACE("copyDrive failed\n");
return FALSE;
}
delete_drive(pSrc);
return TRUE;
}
#endif
static
HANDLE
open_mountmgr
(
void
)
{
HANDLE
ret
;
...
...
programs/winecfg/driveui.c
View file @
d02d5029
...
...
@@ -257,9 +257,9 @@ static int fill_drives_list(HWND dialog)
static
void
on_options_click
(
HWND
dialog
)
{
if
(
IsDlgButtonChecked
(
dialog
,
IDC_SHOW_DOT_FILES
)
==
BST_CHECKED
)
set_reg_key
(
config_key
,
""
,
"ShowDotFiles"
,
"Y"
);
set_reg_key
(
config_key
,
L""
,
L"ShowDotFiles"
,
L
"Y"
);
else
set_reg_key
(
config_key
,
""
,
"ShowDotFiles"
,
"N"
);
set_reg_key
(
config_key
,
L""
,
L"ShowDotFiles"
,
L
"N"
);
SendMessageW
(
GetParent
(
dialog
),
PSM_CHANGED
,
0
,
0
);
}
...
...
@@ -267,8 +267,8 @@ static void on_options_click(HWND dialog)
static
INT_PTR
CALLBACK
drivechoose_dlgproc
(
HWND
hwndDlg
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
static
int
i
,
sel
;
char
c
;
char
drive
[]
=
"X:"
;
WCHAR
c
;
WCHAR
drive
[]
=
L
"X:"
;
switch
(
uMsg
)
{
...
...
@@ -278,10 +278,10 @@ static INT_PTR CALLBACK drivechoose_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wPar
for
(
c
=
'A'
;
c
<=
'Z'
;
c
++
){
drive
[
0
]
=
c
;
if
(
!
(
mask
&
(
1
<<
(
c
-
'A'
))))
SendDlgItemMessage
A
(
hwndDlg
,
IDC_DRIVESA2Z
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
drive
);
SendDlgItemMessage
W
(
hwndDlg
,
IDC_DRIVESA2Z
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
drive
);
}
drive
[
0
]
=
lParam
;
SendDlgItemMessage
A
(
hwndDlg
,
IDC_DRIVESA2Z
,
CB_SELECTSTRING
,
0
,
(
LPARAM
)
drive
);
SendDlgItemMessage
W
(
hwndDlg
,
IDC_DRIVESA2Z
,
CB_SELECTSTRING
,
0
,
(
LPARAM
)
drive
);
return
TRUE
;
}
case
WM_COMMAND
:
...
...
@@ -289,9 +289,9 @@ static INT_PTR CALLBACK drivechoose_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wPar
switch
(
LOWORD
(
wParam
))
{
case
IDOK
:
i
=
SendDlgItemMessage
A
(
hwndDlg
,
IDC_DRIVESA2Z
,
CB_GETCURSEL
,
0
,
0
);
i
=
SendDlgItemMessage
W
(
hwndDlg
,
IDC_DRIVESA2Z
,
CB_GETCURSEL
,
0
,
0
);
if
(
i
!=
CB_ERR
){
SendDlgItemMessage
A
(
hwndDlg
,
IDC_DRIVESA2Z
,
CB_GETLBTEXT
,
i
,
(
LPARAM
)
drive
);
SendDlgItemMessage
W
(
hwndDlg
,
IDC_DRIVESA2Z
,
CB_GETLBTEXT
,
i
,
(
LPARAM
)
drive
);
sel
=
drive
[
0
];
}
else
sel
=
-
1
;
...
...
@@ -488,7 +488,7 @@ static void on_edit_changed(HWND dialog, WORD id)
{
case
IDC_EDIT_LABEL
:
{
WCHAR
*
label
=
get_text
W
(
dialog
,
id
);
WCHAR
*
label
=
get_text
(
dialog
,
id
);
HeapFree
(
GetProcessHeap
(),
0
,
current_drive
->
label
);
current_drive
->
label
=
label
;
current_drive
->
modified
=
TRUE
;
...
...
@@ -506,7 +506,7 @@ static void on_edit_changed(HWND dialog, WORD id)
char
*
path
;
int
lenW
;
wpath
=
get_text
W
(
dialog
,
id
);
wpath
=
get_text
(
dialog
,
id
);
if
(
(
lenW
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
wpath
,
-
1
,
NULL
,
0
,
NULL
,
NULL
))
)
{
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lenW
);
...
...
@@ -535,10 +535,10 @@ static void on_edit_changed(HWND dialog, WORD id)
case
IDC_EDIT_SERIAL
:
{
char
*
serial
;
WCHAR
*
serial
;
serial
=
get_text
(
dialog
,
id
);
current_drive
->
serial
=
serial
?
str
toul
(
serial
,
NULL
,
16
)
:
0
;
current_drive
->
serial
=
serial
?
wcs
toul
(
serial
,
NULL
,
16
)
:
0
;
HeapFree
(
GetProcessHeap
(),
0
,
serial
);
current_drive
->
modified
=
TRUE
;
...
...
@@ -551,7 +551,7 @@ static void on_edit_changed(HWND dialog, WORD id)
case
IDC_EDIT_DEVICE
:
{
char
*
device
=
get_text
(
dialog
,
id
);
WCHAR
*
device
=
get_text
(
dialog
,
id
);
/* TODO: handle device if/when it makes sense to do so.... */
HeapFree
(
GetProcessHeap
(),
0
,
device
);
break
;
...
...
@@ -646,7 +646,7 @@ static void init_listview_columns(HWND dialog)
static
void
load_drive_options
(
HWND
dialog
)
{
if
(
!
strcmp
(
get_reg_key
(
config_key
,
""
,
"ShowDotFiles"
,
"N"
),
"Y"
))
if
(
!
wcscmp
(
get_reg_key
(
config_key
,
L""
,
L"ShowDotFiles"
,
L"N"
),
L
"Y"
))
CheckDlgButton
(
dialog
,
IDC_SHOW_DOT_FILES
,
BST_CHECKED
);
}
...
...
programs/winecfg/libraries.c
View file @
d02d5029
...
...
@@ -34,48 +34,48 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
winecfg
);
#ifdef __i386__
static
const
char
pe_dir
[]
=
"
\\
i386-windows"
;
static
const
WCHAR
pe_dir
[]
=
L
"
\\
i386-windows"
;
#elif defined __x86_64__
static
const
char
pe_dir
[]
=
"
\\
x86_64-windows"
;
static
const
WCHAR
pe_dir
[]
=
L
"
\\
x86_64-windows"
;
#elif defined __arm__
static
const
char
pe_dir
[]
=
"
\\
arm-windows"
;
static
const
WCHAR
pe_dir
[]
=
L
"
\\
arm-windows"
;
#elif defined __aarch64__
static
const
char
pe_dir
[]
=
"
\\
aarch64-windows"
;
static
const
WCHAR
pe_dir
[]
=
L
"
\\
aarch64-windows"
;
#else
static
const
char
pe_dir
[]
=
""
;
static
const
WCHAR
pe_dir
[]
=
L
""
;
#endif
/* dlls that shouldn't be configured anything other than builtin; list must be sorted*/
static
const
char
*
const
builtin_only
[]
=
static
const
WCHAR
*
const
builtin_only
[]
=
{
"advapi32"
,
"capi2032"
,
"dbghelp"
,
"ddraw"
,
"gdi32"
,
"gphoto2.ds"
,
"icmp"
,
"iphlpapi"
,
"kernel32"
,
"l3codeca.acm"
,
"mountmgr.sys"
,
"mswsock"
,
"ntdll"
,
"ntoskrnl.exe"
,
"opengl32"
,
"sane.ds"
,
"secur32"
,
"twain_32"
,
"unicows"
,
"user32"
,
"vdmdbg"
,
"w32skrnl"
,
"winmm"
,
"wintab32"
,
"wnaspi32"
,
"wow32"
,
"ws2_32"
,
"wsock32"
,
L
"advapi32"
,
L
"capi2032"
,
L
"dbghelp"
,
L
"ddraw"
,
L
"gdi32"
,
L
"gphoto2.ds"
,
L
"icmp"
,
L
"iphlpapi"
,
L
"kernel32"
,
L
"l3codeca.acm"
,
L
"mountmgr.sys"
,
L
"mswsock"
,
L
"ntdll"
,
L
"ntoskrnl.exe"
,
L
"opengl32"
,
L
"sane.ds"
,
L
"secur32"
,
L
"twain_32"
,
L
"unicows"
,
L
"user32"
,
L
"vdmdbg"
,
L
"w32skrnl"
,
L
"winmm"
,
L
"wintab32"
,
L
"wnaspi32"
,
L
"wow32"
,
L
"ws2_32"
,
L
"wsock32"
,
};
enum
dllmode
...
...
@@ -90,21 +90,21 @@ enum dllmode
struct
dll
{
char
*
name
;
WCHAR
*
name
;
enum
dllmode
mode
;
};
static
const
WCHAR
emptyW
[
1
];
/* Convert a registry string to a dllmode */
static
enum
dllmode
string_to_mode
(
c
har
*
in
)
static
enum
dllmode
string_to_mode
(
c
onst
WCHAR
*
in
)
{
int
i
,
j
,
len
;
char
*
out
;
WCHAR
*
out
;
enum
dllmode
res
;
len
=
str
len
(
in
);
out
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
+
1
);
len
=
wcs
len
(
in
);
out
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
);
/* remove the spaces */
for
(
i
=
j
=
0
;
i
<=
len
;
++
i
)
{
...
...
@@ -115,34 +115,34 @@ static enum dllmode string_to_mode(char *in)
/* parse the string */
res
=
UNKNOWN
;
if
(
strcmp
(
out
,
"builtin,native"
)
==
0
)
res
=
BUILTIN_NATIVE
;
if
(
strcmp
(
out
,
"native,builtin"
)
==
0
)
res
=
NATIVE_BUILTIN
;
if
(
strcmp
(
out
,
"builtin"
)
==
0
)
res
=
BUILTIN
;
if
(
strcmp
(
out
,
"native"
)
==
0
)
res
=
NATIVE
;
if
(
strcmp
(
out
,
""
)
==
0
)
res
=
DISABLE
;
if
(
wcscmp
(
out
,
L
"builtin,native"
)
==
0
)
res
=
BUILTIN_NATIVE
;
if
(
wcscmp
(
out
,
L
"native,builtin"
)
==
0
)
res
=
NATIVE_BUILTIN
;
if
(
wcscmp
(
out
,
L
"builtin"
)
==
0
)
res
=
BUILTIN
;
if
(
wcscmp
(
out
,
L
"native"
)
==
0
)
res
=
NATIVE
;
if
(
wcscmp
(
out
,
L
""
)
==
0
)
res
=
DISABLE
;
HeapFree
(
GetProcessHeap
(),
0
,
out
);
return
res
;
}
/* Convert a dllmode to a registry string. */
static
const
char
*
mode_to_string
(
enum
dllmode
mode
)
static
const
WCHAR
*
mode_to_string
(
enum
dllmode
mode
)
{
switch
(
mode
)
{
case
NATIVE
:
return
"native"
;
case
BUILTIN
:
return
"builtin"
;
case
NATIVE_BUILTIN
:
return
"native,builtin"
;
case
BUILTIN_NATIVE
:
return
"builtin,native"
;
case
DISABLE
:
return
""
;
default:
return
""
;
case
NATIVE
:
return
L
"native"
;
case
BUILTIN
:
return
L
"builtin"
;
case
NATIVE_BUILTIN
:
return
L
"native,builtin"
;
case
BUILTIN_NATIVE
:
return
L
"builtin,native"
;
case
DISABLE
:
return
L
""
;
default:
return
L
""
;
}
}
/* Convert a dllmode to a pretty string for display. TODO: use translations. */
static
const
char
*
mode_to_label
(
enum
dllmode
mode
)
static
const
WCHAR
*
mode_to_label
(
enum
dllmode
mode
)
{
static
char
buffer
[
256
];
static
WCHAR
buffer
[
256
];
UINT
id
=
0
;
switch
(
mode
)
...
...
@@ -152,9 +152,9 @@ static const char* mode_to_label(enum dllmode mode)
case
NATIVE_BUILTIN
:
id
=
IDS_DLL_NATIVE_BUILTIN
;
break
;
case
BUILTIN_NATIVE
:
id
=
IDS_DLL_BUILTIN_NATIVE
;
break
;
case
DISABLE
:
id
=
IDS_DLL_DISABLED
;
break
;
default:
return
"??"
;
default:
return
L
"??"
;
}
if
(
!
LoadString
A
(
GetModuleHandleA
(
NULL
),
id
,
buffer
,
sizeof
(
buffer
)
))
buffer
[
0
]
=
0
;
if
(
!
LoadString
W
(
GetModuleHandleW
(
NULL
),
id
,
buffer
,
ARRAY_SIZE
(
buffer
)
))
buffer
[
0
]
=
0
;
return
buffer
;
}
...
...
@@ -189,42 +189,42 @@ static DWORD mode_to_id(enum dllmode mode)
/* helper for is_builtin_only */
static
int
__cdecl
compare_dll
(
const
void
*
ptr1
,
const
void
*
ptr2
)
{
const
char
*
const
*
name1
=
ptr1
;
const
char
*
const
*
name2
=
ptr2
;
return
str
cmp
(
*
name1
,
*
name2
);
const
WCHAR
*
const
*
name1
=
ptr1
;
const
WCHAR
*
const
*
name2
=
ptr2
;
return
wcs
cmp
(
*
name1
,
*
name2
);
}
/* check if dll is recommended as builtin only */
static
inline
BOOL
is_builtin_only
(
const
char
*
name
)
static
inline
BOOL
is_builtin_only
(
const
WCHAR
*
name
)
{
const
char
*
ext
=
str
rchr
(
name
,
'.'
);
const
WCHAR
*
ext
=
wcs
rchr
(
name
,
'.'
);
if
(
ext
)
{
if
(
!
strcmp
(
ext
,
".vxd"
)
||
!
strcmp
(
ext
,
".drv"
)
||
!
strcmp
(
ext
,
".tlb"
))
if
(
!
wcscmp
(
ext
,
L
".vxd"
)
||
!
wcscmp
(
ext
,
L
".drv"
)
||
!
wcscmp
(
ext
,
L
".tlb"
))
return
TRUE
;
}
if
(
!
strncmp
(
name
,
"wine"
,
4
))
return
TRUE
;
if
(
!
wcsncmp
(
name
,
L
"wine"
,
4
))
return
TRUE
;
return
bsearch
(
&
name
,
builtin_only
,
ARRAY_SIZE
(
builtin_only
),
sizeof
(
builtin_only
[
0
]),
compare_dll
)
!=
NULL
;
}
/* check if dll should be offered in the drop-down list */
static
BOOL
show_dll_in_list
(
const
char
*
name
)
static
BOOL
show_dll_in_list
(
const
WCHAR
*
name
)
{
const
char
*
ext
=
str
rchr
(
name
,
'.'
);
const
WCHAR
*
ext
=
wcs
rchr
(
name
,
'.'
);
if
(
ext
)
{
/* skip 16-bit dlls */
if
(
strlen
(
ext
)
>
2
&&
!
strcmp
(
ext
+
strlen
(
ext
)
-
2
,
"16"
))
return
FALSE
;
if
(
wcslen
(
ext
)
>
2
&&
!
wcscmp
(
ext
+
wcslen
(
ext
)
-
2
,
L
"16"
))
return
FALSE
;
/* skip exes */
if
(
!
strcmp
(
ext
,
".exe"
))
return
FALSE
;
if
(
!
wcscmp
(
ext
,
L
".exe"
))
return
FALSE
;
}
/* skip api set placeholders */
if
(
!
strncmp
(
name
,
"api-ms-"
,
7
)
||
!
strncmp
(
name
,
"ext-ms-"
,
7
))
return
FALSE
;
if
(
!
wcsncmp
(
name
,
L"api-ms-"
,
7
)
||
!
wcsncmp
(
name
,
L
"ext-ms-"
,
7
))
return
FALSE
;
/* skip dlls that should always be builtin */
return
!
is_builtin_only
(
name
);
}
...
...
@@ -252,22 +252,22 @@ static void clear_settings(HWND dialog)
}
/* load the list of available libraries from a given dir */
static
void
load_library_list_from_dir
(
HWND
dialog
,
const
char
*
dir_path
,
int
check_subdirs
)
static
void
load_library_list_from_dir
(
HWND
dialog
,
const
WCHAR
*
dir_path
,
int
check_subdirs
)
{
static
const
char
*
const
ext
[]
=
{
".dll"
,
".dll.so"
,
".so"
,
""
};
char
*
buffer
,
*
p
,
name
[
256
];
static
const
WCHAR
*
const
ext
[]
=
{
L".dll"
,
L".dll.so"
,
L".so"
,
L
""
};
WCHAR
*
buffer
,
*
p
,
name
[
256
];
unsigned
int
i
;
HANDLE
handle
;
WIN32_FIND_DATA
A
data
;
WIN32_FIND_DATA
W
data
;
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
dir_path
)
+
2
*
sizeof
(
name
)
+
10
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
wcslen
(
dir_path
)
+
10
)
*
sizeof
(
WCHAR
)
+
2
*
sizeof
(
name
)
);
str
cpy
(
buffer
,
dir_path
);
strcat
(
buffer
,
"
\\
*"
);
wcs
cpy
(
buffer
,
dir_path
);
wcscat
(
buffer
,
L
"
\\
*"
);
buffer
[
1
]
=
'\\'
;
/* change \??\ to \\?\ */
p
=
buffer
+
str
len
(
buffer
)
-
1
;
p
=
buffer
+
wcs
len
(
buffer
)
-
1
;
if
((
handle
=
FindFirstFile
A
(
buffer
,
&
data
))
==
INVALID_HANDLE_VALUE
)
if
((
handle
=
FindFirstFile
W
(
buffer
,
&
data
))
==
INVALID_HANDLE_VALUE
)
{
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
;
...
...
@@ -275,19 +275,19 @@ static void load_library_list_from_dir( HWND dialog, const char *dir_path, int c
do
{
size_t
len
=
str
len
(
data
.
cFileName
);
if
(
len
>
sizeof
(
name
))
continue
;
size_t
len
=
wcs
len
(
data
.
cFileName
);
if
(
len
>
ARRAY_SIZE
(
name
))
continue
;
if
(
check_subdirs
)
{
if
(
!
strcmp
(
data
.
cFileName
,
"."
))
continue
;
if
(
!
strcmp
(
data
.
cFileName
,
".."
))
continue
;
if
(
!
wcscmp
(
data
.
cFileName
,
L
"."
))
continue
;
if
(
!
wcscmp
(
data
.
cFileName
,
L
".."
))
continue
;
if
(
!
show_dll_in_list
(
data
.
cFileName
))
continue
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
ext
);
i
++
)
{
s
printf
(
p
,
"%s
\\
%s%s"
,
data
.
cFileName
,
data
.
cFileName
,
ext
[
i
]
);
if
(
GetFileAttributes
A
(
buffer
)
!=
INVALID_FILE_ATTRIBUTES
)
s
wprintf
(
p
,
2
*
ARRAY_SIZE
(
name
)
+
10
,
L
"%s
\\
%s%s"
,
data
.
cFileName
,
data
.
cFileName
,
ext
[
i
]
);
if
(
GetFileAttributes
W
(
buffer
)
!=
INVALID_FILE_ATTRIBUTES
)
{
SendDlgItemMessage
A
(
dialog
,
IDC_DLLCOMBO
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
data
.
cFileName
);
SendDlgItemMessage
W
(
dialog
,
IDC_DLLCOMBO
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
data
.
cFileName
);
break
;
}
}
...
...
@@ -297,17 +297,17 @@ static void load_library_list_from_dir( HWND dialog, const char *dir_path, int c
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
ext
);
i
++
)
{
if
(
!
ext
[
i
][
0
])
continue
;
if
(
len
>
strlen
(
ext
[
i
])
&&
!
strcmp
(
data
.
cFileName
+
len
-
str
len
(
ext
[
i
]),
ext
[
i
]))
if
(
len
>
wcslen
(
ext
[
i
])
&&
!
wcscmp
(
data
.
cFileName
+
len
-
wcs
len
(
ext
[
i
]),
ext
[
i
]))
{
len
-=
str
len
(
ext
[
i
]
);
memcpy
(
name
,
data
.
cFileName
,
len
);
len
-=
wcs
len
(
ext
[
i
]
);
memcpy
(
name
,
data
.
cFileName
,
len
*
sizeof
(
WCHAR
)
);
name
[
len
]
=
0
;
if
(
!
show_dll_in_list
(
name
))
continue
;
SendDlgItemMessage
A
(
dialog
,
IDC_DLLCOMBO
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
name
);
SendDlgItemMessage
W
(
dialog
,
IDC_DLLCOMBO
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
name
);
}
}
}
}
while
(
FindNextFile
A
(
handle
,
&
data
));
}
while
(
FindNextFile
W
(
handle
,
&
data
));
FindClose
(
handle
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
...
...
@@ -317,40 +317,40 @@ static void load_library_list_from_dir( HWND dialog, const char *dir_path, int c
static
void
load_library_list
(
HWND
dialog
)
{
unsigned
int
i
=
0
;
char
item1
[
256
],
item2
[
256
],
var
[
32
],
path
[
MAX_PATH
];
WCHAR
item1
[
256
],
item2
[
256
],
var
[
32
],
path
[
MAX_PATH
];
HCURSOR
old_cursor
=
SetCursor
(
LoadCursorW
(
0
,
(
LPWSTR
)
IDC_WAIT
)
);
if
(
GetEnvironmentVariable
A
(
"WINEBUILDDIR"
,
path
,
MAX_PATH
))
if
(
GetEnvironmentVariable
W
(
L
"WINEBUILDDIR"
,
path
,
MAX_PATH
))
{
char
*
dir
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
path
)
+
sizeof
(
"
\\
dlls"
)
);
str
cpy
(
dir
,
path
);
strcat
(
dir
,
"
\\
dlls"
);
WCHAR
*
dir
=
HeapAlloc
(
GetProcessHeap
(),
0
,
wcslen
(
path
)
*
sizeof
(
WCHAR
)
+
sizeof
(
L
"
\\
dlls"
)
);
wcs
cpy
(
dir
,
path
);
wcscat
(
dir
,
L
"
\\
dlls"
);
load_library_list_from_dir
(
dialog
,
dir
,
TRUE
);
HeapFree
(
GetProcessHeap
(),
0
,
dir
);
}
for
(;;)
{
s
printf
(
var
,
"WINEDLLDIR%u"
,
i
++
);
if
(
!
GetEnvironmentVariable
A
(
var
,
path
,
MAX_PATH
))
break
;
s
wprintf
(
var
,
ARRAY_SIZE
(
var
),
L
"WINEDLLDIR%u"
,
i
++
);
if
(
!
GetEnvironmentVariable
W
(
var
,
path
,
MAX_PATH
))
break
;
load_library_list_from_dir
(
dialog
,
path
,
FALSE
);
str
cat
(
path
,
pe_dir
);
wcs
cat
(
path
,
pe_dir
);
load_library_list_from_dir
(
dialog
,
path
,
FALSE
);
}
/* get rid of duplicate entries */
SendDlgItemMessage
A
(
dialog
,
IDC_DLLCOMBO
,
CB_GETLBTEXT
,
0
,
(
LPARAM
)
item1
);
SendDlgItemMessage
W
(
dialog
,
IDC_DLLCOMBO
,
CB_GETLBTEXT
,
0
,
(
LPARAM
)
item1
);
i
=
1
;
while
(
SendDlgItemMessage
A
(
dialog
,
IDC_DLLCOMBO
,
CB_GETLBTEXT
,
i
,
(
LPARAM
)
item2
)
>=
0
)
while
(
SendDlgItemMessage
W
(
dialog
,
IDC_DLLCOMBO
,
CB_GETLBTEXT
,
i
,
(
LPARAM
)
item2
)
>=
0
)
{
if
(
!
str
cmp
(
item1
,
item2
))
if
(
!
wcs
cmp
(
item1
,
item2
))
{
SendDlgItemMessage
A
(
dialog
,
IDC_DLLCOMBO
,
CB_DELETESTRING
,
i
,
0
);
SendDlgItemMessage
W
(
dialog
,
IDC_DLLCOMBO
,
CB_DELETESTRING
,
i
,
0
);
}
else
{
str
cpy
(
item1
,
item2
);
wcs
cpy
(
item1
,
item2
);
i
++
;
}
}
...
...
@@ -359,8 +359,8 @@ static void load_library_list( HWND dialog )
static
void
load_library_settings
(
HWND
dialog
)
{
char
**
overrides
=
enumerate_values
(
config_key
,
keypath
(
"DllOverrides"
));
char
**
p
;
WCHAR
**
overrides
=
enumerate_values
(
config_key
,
keypath
(
L
"DllOverrides"
));
WCHAR
**
p
;
int
sel
,
count
=
0
;
sel
=
SendDlgItemMessageW
(
dialog
,
IDC_DLLS_LIST
,
LB_GETCURSEL
,
0
,
0
);
...
...
@@ -383,26 +383,24 @@ static void load_library_settings(HWND dialog)
for
(
p
=
overrides
;
*
p
!=
NULL
;
p
++
)
{
int
index
;
char
*
str
,
*
value
;
const
char
*
label
;
int
index
,
len
;
WCHAR
*
str
,
*
value
;
const
WCHAR
*
label
;
struct
dll
*
dll
;
value
=
get_reg_key
(
config_key
,
keypath
(
"DllOverrides"
),
*
p
,
NULL
);
value
=
get_reg_key
(
config_key
,
keypath
(
L
"DllOverrides"
),
*
p
,
NULL
);
label
=
mode_to_label
(
string_to_mode
(
value
));
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
*
p
)
+
2
+
strlen
(
label
)
+
2
);
strcpy
(
str
,
*
p
);
strcat
(
str
,
" ("
);
strcat
(
str
,
label
);
strcat
(
str
,
")"
);
len
=
wcslen
(
*
p
)
+
2
+
wcslen
(
label
)
+
2
;
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
swprintf
(
str
,
len
,
L"%s (%s)"
,
*
p
,
label
);
dll
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
dll
));
dll
->
name
=
*
p
;
dll
->
mode
=
string_to_mode
(
value
);
index
=
SendDlgItemMessage
A
(
dialog
,
IDC_DLLS_LIST
,
LB_ADDSTRING
,
(
WPARAM
)
-
1
,
(
LPARAM
)
str
);
index
=
SendDlgItemMessage
W
(
dialog
,
IDC_DLLS_LIST
,
LB_ADDSTRING
,
(
WPARAM
)
-
1
,
(
LPARAM
)
str
);
SendDlgItemMessageW
(
dialog
,
IDC_DLLS_LIST
,
LB_SETITEMDATA
,
index
,
(
LPARAM
)
dll
);
HeapFree
(
GetProcessHeap
(),
0
,
str
);
...
...
@@ -457,7 +455,7 @@ static void set_dllmode(HWND dialog, DWORD id)
enum
dllmode
mode
;
struct
dll
*
dll
;
int
sel
;
const
char
*
str
;
const
WCHAR
*
str
;
mode
=
id_to_mode
(
id
);
...
...
@@ -467,26 +465,24 @@ static void set_dllmode(HWND dialog, DWORD id)
dll
=
(
struct
dll
*
)
SendDlgItemMessageW
(
dialog
,
IDC_DLLS_LIST
,
LB_GETITEMDATA
,
sel
,
0
);
str
=
mode_to_string
(
mode
);
WINE_TRACE
(
"Setting %s to %s
\n
"
,
d
ll
->
name
,
str
);
WINE_TRACE
(
"Setting %s to %s
\n
"
,
d
ebugstr_w
(
dll
->
name
),
debugstr_w
(
str
)
);
SendMessageW
(
GetParent
(
dialog
),
PSM_CHANGED
,
0
,
0
);
set_reg_key
(
config_key
,
keypath
(
"DllOverrides"
),
dll
->
name
,
str
);
set_reg_key
(
config_key
,
keypath
(
L
"DllOverrides"
),
dll
->
name
,
str
);
load_library_settings
(
dialog
);
/* ... and refresh */
}
static
void
on_add_click
(
HWND
dialog
)
{
static
const
char
dotDll
[]
=
".dll"
;
char
buffer
[
1024
],
*
ptr
;
ZeroMemory
(
buffer
,
sizeof
(
buffer
));
WCHAR
buffer
[
1024
],
*
ptr
;
SendDlgItemMessageA
(
dialog
,
IDC_DLLCOMBO
,
WM_GETTEXT
,
sizeof
(
buffer
),
(
LPARAM
)
buffer
);
if
(
lstrlenA
(
buffer
)
>=
sizeof
(
dotDll
))
buffer
[
0
]
=
0
;
SendDlgItemMessageW
(
dialog
,
IDC_DLLCOMBO
,
WM_GETTEXT
,
ARRAY_SIZE
(
buffer
),
(
LPARAM
)
buffer
);
if
(
wcslen
(
buffer
)
>
4
)
{
ptr
=
buffer
+
lstrlenA
(
buffer
)
-
sizeof
(
dotDll
)
+
1
;
if
(
!
lstrcmpiA
(
ptr
,
dotDll
))
ptr
=
buffer
+
wcslen
(
buffer
)
-
4
;
if
(
!
wcsicmp
(
ptr
,
L".dll"
))
{
WINE_TRACE
(
"Stripping dll extension
\n
"
);
*
ptr
=
'\0'
;
...
...
@@ -494,7 +490,7 @@ static void on_add_click(HWND dialog)
}
/* check if dll is in the builtin-only list */
if
(
!
(
ptr
=
str
rchr
(
buffer
,
'\\'
)))
if
(
!
(
ptr
=
wcs
rchr
(
buffer
,
'\\'
)))
{
ptr
=
buffer
;
if
(
*
ptr
==
'*'
)
ptr
++
;
...
...
@@ -502,32 +498,32 @@ static void on_add_click(HWND dialog)
else
ptr
++
;
if
(
is_builtin_only
(
ptr
))
{
MSGBOXPARAMS
A
params
;
MSGBOXPARAMS
W
params
;
params
.
cbSize
=
sizeof
(
params
);
params
.
hwndOwner
=
dialog
;
params
.
hInstance
=
GetModuleHandle
A
(
NULL
);
params
.
lpszText
=
MAKEINTRESOURCE
A
(
IDS_DLL_WARNING
);
params
.
lpszCaption
=
MAKEINTRESOURCE
A
(
IDS_DLL_WARNING_CAPTION
);
params
.
hInstance
=
GetModuleHandle
W
(
NULL
);
params
.
lpszText
=
MAKEINTRESOURCE
W
(
IDS_DLL_WARNING
);
params
.
lpszCaption
=
MAKEINTRESOURCE
W
(
IDS_DLL_WARNING_CAPTION
);
params
.
dwStyle
=
MB_ICONWARNING
|
MB_YESNO
;
params
.
lpszIcon
=
NULL
;
params
.
dwContextHelpId
=
0
;
params
.
lpfnMsgBoxCallback
=
NULL
;
params
.
dwLanguageId
=
0
;
if
(
MessageBoxIndirect
A
(
&
params
)
!=
IDYES
)
return
;
if
(
MessageBoxIndirect
W
(
&
params
)
!=
IDYES
)
return
;
}
SendDlgItemMessageW
(
dialog
,
IDC_DLLCOMBO
,
WM_SETTEXT
,
0
,
(
LPARAM
)
emptyW
);
disable
(
IDC_DLLS_ADDDLL
);
SendMessageW
(
GetParent
(
dialog
),
DM_SETDEFID
,
IDOK
,
0
);
WINE_TRACE
(
"Adding %s as native, builtin
\n
"
,
buffer
);
WINE_TRACE
(
"Adding %s as native, builtin
\n
"
,
debugstr_w
(
buffer
)
);
SendMessageW
(
GetParent
(
dialog
),
PSM_CHANGED
,
0
,
0
);
set_reg_key
(
config_key
,
keypath
(
"DllOverrides"
),
buffer
,
"native,builtin"
);
set_reg_key
(
config_key
,
keypath
(
L"DllOverrides"
),
buffer
,
L
"native,builtin"
);
load_library_settings
(
dialog
);
SendDlgItemMessage
A
(
dialog
,
IDC_DLLS_LIST
,
LB_SELECTSTRING
,
0
,
(
LPARAM
)
buffer
);
SendDlgItemMessage
W
(
dialog
,
IDC_DLLS_LIST
,
LB_SELECTSTRING
,
0
,
(
LPARAM
)
buffer
);
set_controls_from_selection
(
dialog
);
}
...
...
@@ -596,7 +592,7 @@ static void on_remove_click(HWND dialog)
SendDlgItemMessageW
(
dialog
,
IDC_DLLS_LIST
,
LB_DELETESTRING
,
sel
,
0
);
SendMessageW
(
GetParent
(
dialog
),
PSM_CHANGED
,
0
,
0
);
set_reg_key
(
config_key
,
keypath
(
"DllOverrides"
),
dll
->
name
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
L
"DllOverrides"
),
dll
->
name
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
dll
->
name
);
HeapFree
(
GetProcessHeap
(),
0
,
dll
);
...
...
programs/winecfg/main.c
View file @
d02d5029
...
...
@@ -181,7 +181,7 @@ doPropertySheet (HINSTANCE hInstance, HWND hOwner)
* program execution.
*/
static
int
ProcessCmdLine
(
LPSTR
lpCmdLine
)
ProcessCmdLine
(
LP
W
STR
lpCmdLine
)
{
if
(
!
(
lpCmdLine
[
0
]
==
'/'
||
lpCmdLine
[
0
]
==
'-'
))
{
...
...
@@ -189,7 +189,7 @@ ProcessCmdLine(LPSTR lpCmdLine)
}
if
(
lpCmdLine
[
1
]
==
'V'
||
lpCmdLine
[
1
]
==
'v'
)
{
if
(
lstrlenA
(
lpCmdLine
)
>
4
)
if
(
wcslen
(
lpCmdLine
)
>
4
)
return
set_winver_from_string
(
&
lpCmdLine
[
3
])
?
0
:
1
;
print_current_winver
();
...
...
@@ -223,7 +223,7 @@ ProcessCmdLine(LPSTR lpCmdLine)
* Returns : Program exit code
*/
int
WINAPI
WinMain
(
HINSTANCE
hInstance
,
HINSTANCE
hPrev
,
LPSTR
szCmdL
ine
,
int
nShow
)
wWinMain
(
HINSTANCE
hInstance
,
HINSTANCE
hPrev
,
LPWSTR
cmdl
ine
,
int
nShow
)
{
BOOL
is_wow64
;
int
cmd_ret
;
...
...
@@ -256,7 +256,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
ExitProcess
(
1
);
}
cmd_ret
=
ProcessCmdLine
(
szCmdL
ine
);
cmd_ret
=
ProcessCmdLine
(
cmdl
ine
);
if
(
cmd_ret
>=
0
)
return
cmd_ret
;
/*
...
...
programs/winecfg/theme.c
View file @
d02d5029
...
...
@@ -489,81 +489,73 @@ static void apply_theme(HWND dialog)
static
struct
{
int
sm_idx
,
color_idx
;
const
char
*
color_reg
;
const
WCHAR
*
color_reg
;
int
size
;
COLORREF
color
;
LOGFONTW
lf
;
}
metrics
[]
=
{
{
-
1
,
COLOR_BTNFACE
,
"ButtonFace"
},
/* IDC_SYSPARAMS_BUTTON */
{
-
1
,
COLOR_BTNTEXT
,
"ButtonText"
},
/* IDC_SYSPARAMS_BUTTON_TEXT */
{
-
1
,
COLOR_BACKGROUND
,
"Background"
},
/* IDC_SYSPARAMS_DESKTOP */
{
SM_CXMENUSIZE
,
COLOR_MENU
,
"Menu"
},
/* IDC_SYSPARAMS_MENU */
{
-
1
,
COLOR_MENUTEXT
,
"MenuText"
},
/* IDC_SYSPARAMS_MENU_TEXT */
{
SM_CXVSCROLL
,
COLOR_SCROLLBAR
,
"Scrollbar"
},
/* IDC_SYSPARAMS_SCROLLBAR */
{
-
1
,
COLOR_HIGHLIGHT
,
"Hilight"
},
/* IDC_SYSPARAMS_SELECTION */
{
-
1
,
COLOR_HIGHLIGHTTEXT
,
"HilightText"
},
/* IDC_SYSPARAMS_SELECTION_TEXT */
{
-
1
,
COLOR_INFOBK
,
"InfoWindow"
},
/* IDC_SYSPARAMS_TOOLTIP */
{
-
1
,
COLOR_INFOTEXT
,
"InfoText"
},
/* IDC_SYSPARAMS_TOOLTIP_TEXT */
{
-
1
,
COLOR_WINDOW
,
"Window"
},
/* IDC_SYSPARAMS_WINDOW */
{
-
1
,
COLOR_WINDOWTEXT
,
"WindowText"
},
/* IDC_SYSPARAMS_WINDOW_TEXT */
{
SM_CXSIZE
,
COLOR_ACTIVECAPTION
,
"ActiveTitle"
},
/* IDC_SYSPARAMS_ACTIVE_TITLE */
{
-
1
,
COLOR_CAPTIONTEXT
,
"TitleText"
},
/* IDC_SYSPARAMS_ACTIVE_TITLE_TEXT */
{
-
1
,
COLOR_INACTIVECAPTION
,
"InactiveTitle"
},
/* IDC_SYSPARAMS_INACTIVE_TITLE */
{
-
1
,
COLOR_INACTIVECAPTIONTEXT
,
"InactiveTitleText"
},
/* IDC_SYSPARAMS_INACTIVE_TITLE_TEXT */
{
-
1
,
-
1
,
"MsgBoxText"
},
/* IDC_SYSPARAMS_MSGBOX_TEXT */
{
-
1
,
COLOR_APPWORKSPACE
,
"AppWorkSpace"
},
/* IDC_SYSPARAMS_APPWORKSPACE */
{
-
1
,
COLOR_WINDOWFRAME
,
"WindowFrame"
},
/* IDC_SYSPARAMS_WINDOW_FRAME */
{
-
1
,
COLOR_ACTIVEBORDER
,
"ActiveBorder"
},
/* IDC_SYSPARAMS_ACTIVE_BORDER */
{
-
1
,
COLOR_INACTIVEBORDER
,
"InactiveBorder"
},
/* IDC_SYSPARAMS_INACTIVE_BORDER */
{
-
1
,
COLOR_BTNSHADOW
,
"ButtonShadow"
},
/* IDC_SYSPARAMS_BUTTON_SHADOW */
{
-
1
,
COLOR_GRAYTEXT
,
"GrayText"
},
/* IDC_SYSPARAMS_GRAY_TEXT */
{
-
1
,
COLOR_BTNHIGHLIGHT
,
"ButtonHilight"
},
/* IDC_SYSPARAMS_BUTTON_HIGHLIGHT */
{
-
1
,
COLOR_3DDKSHADOW
,
"ButtonDkShadow"
},
/* IDC_SYSPARAMS_BUTTON_DARK_SHADOW */
{
-
1
,
COLOR_3DLIGHT
,
"ButtonLight"
},
/* IDC_SYSPARAMS_BUTTON_LIGHT */
{
-
1
,
COLOR_ALTERNATEBTNFACE
,
"ButtonAlternateFace"
},
/* IDC_SYSPARAMS_BUTTON_ALTERNATE */
{
-
1
,
COLOR_HOTLIGHT
,
"HotTrackingColor"
},
/* IDC_SYSPARAMS_HOT_TRACKING */
{
-
1
,
COLOR_GRADIENTACTIVECAPTION
,
"GradientActiveTitle"
},
/* IDC_SYSPARAMS_ACTIVE_TITLE_GRADIENT */
{
-
1
,
COLOR_GRADIENTINACTIVECAPTION
,
"GradientInactiveTitle"
},
/* IDC_SYSPARAMS_INACTIVE_TITLE_GRADIENT */
{
-
1
,
COLOR_MENUHILIGHT
,
"MenuHilight"
},
/* IDC_SYSPARAMS_MENU_HIGHLIGHT */
{
-
1
,
COLOR_MENUBAR
,
"MenuBar"
},
/* IDC_SYSPARAMS_MENUBAR */
{
-
1
,
COLOR_BTNFACE
,
L
"ButtonFace"
},
/* IDC_SYSPARAMS_BUTTON */
{
-
1
,
COLOR_BTNTEXT
,
L
"ButtonText"
},
/* IDC_SYSPARAMS_BUTTON_TEXT */
{
-
1
,
COLOR_BACKGROUND
,
L
"Background"
},
/* IDC_SYSPARAMS_DESKTOP */
{
SM_CXMENUSIZE
,
COLOR_MENU
,
L
"Menu"
},
/* IDC_SYSPARAMS_MENU */
{
-
1
,
COLOR_MENUTEXT
,
L
"MenuText"
},
/* IDC_SYSPARAMS_MENU_TEXT */
{
SM_CXVSCROLL
,
COLOR_SCROLLBAR
,
L
"Scrollbar"
},
/* IDC_SYSPARAMS_SCROLLBAR */
{
-
1
,
COLOR_HIGHLIGHT
,
L
"Hilight"
},
/* IDC_SYSPARAMS_SELECTION */
{
-
1
,
COLOR_HIGHLIGHTTEXT
,
L
"HilightText"
},
/* IDC_SYSPARAMS_SELECTION_TEXT */
{
-
1
,
COLOR_INFOBK
,
L
"InfoWindow"
},
/* IDC_SYSPARAMS_TOOLTIP */
{
-
1
,
COLOR_INFOTEXT
,
L
"InfoText"
},
/* IDC_SYSPARAMS_TOOLTIP_TEXT */
{
-
1
,
COLOR_WINDOW
,
L
"Window"
},
/* IDC_SYSPARAMS_WINDOW */
{
-
1
,
COLOR_WINDOWTEXT
,
L
"WindowText"
},
/* IDC_SYSPARAMS_WINDOW_TEXT */
{
SM_CXSIZE
,
COLOR_ACTIVECAPTION
,
L
"ActiveTitle"
},
/* IDC_SYSPARAMS_ACTIVE_TITLE */
{
-
1
,
COLOR_CAPTIONTEXT
,
L
"TitleText"
},
/* IDC_SYSPARAMS_ACTIVE_TITLE_TEXT */
{
-
1
,
COLOR_INACTIVECAPTION
,
L
"InactiveTitle"
},
/* IDC_SYSPARAMS_INACTIVE_TITLE */
{
-
1
,
COLOR_INACTIVECAPTIONTEXT
,
L
"InactiveTitleText"
},
/* IDC_SYSPARAMS_INACTIVE_TITLE_TEXT */
{
-
1
,
-
1
,
L
"MsgBoxText"
},
/* IDC_SYSPARAMS_MSGBOX_TEXT */
{
-
1
,
COLOR_APPWORKSPACE
,
L
"AppWorkSpace"
},
/* IDC_SYSPARAMS_APPWORKSPACE */
{
-
1
,
COLOR_WINDOWFRAME
,
L
"WindowFrame"
},
/* IDC_SYSPARAMS_WINDOW_FRAME */
{
-
1
,
COLOR_ACTIVEBORDER
,
L
"ActiveBorder"
},
/* IDC_SYSPARAMS_ACTIVE_BORDER */
{
-
1
,
COLOR_INACTIVEBORDER
,
L
"InactiveBorder"
},
/* IDC_SYSPARAMS_INACTIVE_BORDER */
{
-
1
,
COLOR_BTNSHADOW
,
L
"ButtonShadow"
},
/* IDC_SYSPARAMS_BUTTON_SHADOW */
{
-
1
,
COLOR_GRAYTEXT
,
L
"GrayText"
},
/* IDC_SYSPARAMS_GRAY_TEXT */
{
-
1
,
COLOR_BTNHIGHLIGHT
,
L
"ButtonHilight"
},
/* IDC_SYSPARAMS_BUTTON_HIGHLIGHT */
{
-
1
,
COLOR_3DDKSHADOW
,
L
"ButtonDkShadow"
},
/* IDC_SYSPARAMS_BUTTON_DARK_SHADOW */
{
-
1
,
COLOR_3DLIGHT
,
L
"ButtonLight"
},
/* IDC_SYSPARAMS_BUTTON_LIGHT */
{
-
1
,
COLOR_ALTERNATEBTNFACE
,
L
"ButtonAlternateFace"
},
/* IDC_SYSPARAMS_BUTTON_ALTERNATE */
{
-
1
,
COLOR_HOTLIGHT
,
L
"HotTrackingColor"
},
/* IDC_SYSPARAMS_HOT_TRACKING */
{
-
1
,
COLOR_GRADIENTACTIVECAPTION
,
L
"GradientActiveTitle"
},
/* IDC_SYSPARAMS_ACTIVE_TITLE_GRADIENT */
{
-
1
,
COLOR_GRADIENTINACTIVECAPTION
,
L
"GradientInactiveTitle"
},
/* IDC_SYSPARAMS_INACTIVE_TITLE_GRADIENT */
{
-
1
,
COLOR_MENUHILIGHT
,
L
"MenuHilight"
},
/* IDC_SYSPARAMS_MENU_HIGHLIGHT */
{
-
1
,
COLOR_MENUBAR
,
L
"MenuBar"
},
/* IDC_SYSPARAMS_MENUBAR */
};
static
void
save_sys_color
(
int
idx
,
COLORREF
clr
)
{
char
buffer
[
13
];
WCHAR
buffer
[
13
];
s
printf
(
buffer
,
"%d %d %d"
,
GetRValue
(
clr
),
GetGValue
(
clr
),
GetBValue
(
clr
));
set_reg_key
(
HKEY_CURRENT_USER
,
"Control Panel
\\
Colors"
,
metrics
[
idx
].
color_reg
,
buffer
);
s
wprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
L
"%d %d %d"
,
GetRValue
(
clr
),
GetGValue
(
clr
),
GetBValue
(
clr
));
set_reg_key
(
HKEY_CURRENT_USER
,
L
"Control Panel
\\
Colors"
,
metrics
[
idx
].
color_reg
,
buffer
);
}
static
void
set_color_from_theme
(
WCHAR
*
keyName
,
COLORREF
color
)
static
void
set_color_from_theme
(
const
WCHAR
*
keyName
,
COLORREF
color
)
{
char
*
keyNameA
=
NULL
;
int
keyNameSize
=
0
,
i
=
0
;
keyNameSize
=
WideCharToMultiByte
(
CP_ACP
,
0
,
keyName
,
-
1
,
keyNameA
,
0
,
NULL
,
NULL
);
keyNameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
keyNameSize
);
WideCharToMultiByte
(
CP_ACP
,
0
,
keyName
,
-
1
,
keyNameA
,
keyNameSize
,
NULL
,
NULL
);
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
metrics
);
i
++
)
{
if
(
lstrcmpiA
(
metrics
[
i
].
color_reg
,
keyNameA
)
==
0
)
if
(
wcsicmp
(
metrics
[
i
].
color_reg
,
keyName
)
==
0
)
{
metrics
[
i
].
color
=
color
;
save_sys_color
(
i
,
color
);
break
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
keyNameA
);
}
static
void
do_parse_theme
(
WCHAR
*
file
)
{
WCHAR
keyName
[
MAX_PATH
],
keyNameValue
[
MAX_PATH
];
WCHAR
*
keyNamePtr
=
NULL
;
char
*
keyNameValueA
=
NULL
;
int
keyNameValueSize
=
0
;
int
red
=
0
,
green
=
0
,
blue
=
0
;
COLORREF
color
;
...
...
@@ -577,20 +569,12 @@ static void do_parse_theme(WCHAR *file)
GetPrivateProfileStringW
(
L"Control Panel
\\
Colors"
,
keyNamePtr
,
NULL
,
keyNameValue
,
MAX_PATH
,
file
);
keyNameValueSize
=
WideCharToMultiByte
(
CP_ACP
,
0
,
keyNameValue
,
-
1
,
keyNameValueA
,
0
,
NULL
,
NULL
);
keyNameValueA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
keyNameValueSize
);
WideCharToMultiByte
(
CP_ACP
,
0
,
keyNameValue
,
-
1
,
keyNameValueA
,
keyNameValueSize
,
NULL
,
NULL
);
WINE_TRACE
(
"parsing key: %s with value: %s
\n
"
,
wine_dbgstr_w
(
keyNamePtr
),
wine_dbgstr_w
(
keyNameValue
));
s
scanf
(
keyNameValueA
,
"%d %d %d"
,
&
red
,
&
green
,
&
blue
);
s
wscanf
(
keyNameValue
,
L
"%d %d %d"
,
&
red
,
&
green
,
&
blue
);
color
=
RGB
((
BYTE
)
red
,
(
BYTE
)
green
,
(
BYTE
)
blue
);
HeapFree
(
GetProcessHeap
(),
0
,
keyNameValueA
);
set_color_from_theme
(
keyNamePtr
,
color
);
keyNamePtr
+=
lstrlenW
(
keyNamePtr
);
...
...
@@ -848,7 +832,7 @@ static void on_shell_folder_selection_changed(HWND hDlg, LPNMLISTVIEW lpnm) {
* information in sync. */
static
void
on_shell_folder_edit_changed
(
HWND
hDlg
)
{
LVITEMW
item
;
WCHAR
*
text
=
get_text
W
(
hDlg
,
IDC_EDIT_SFPATH
);
WCHAR
*
text
=
get_text
(
hDlg
,
IDC_EDIT_SFPATH
);
LONG
iSel
=
SendDlgItemMessageW
(
hDlg
,
IDC_LIST_SFPATHS
,
LVM_GETNEXTITEM
,
-
1
,
MAKELPARAM
(
LVNI_SELECTED
,
0
));
...
...
@@ -1093,7 +1077,7 @@ static void on_select_font(HWND hDlg)
static
void
init_mime_types
(
HWND
hDlg
)
{
char
*
buf
=
get_reg_key
(
config_key
,
keypath
(
"FileOpenAssociations"
),
"Enable"
,
"Y"
);
WCHAR
*
buf
=
get_reg_key
(
config_key
,
keypath
(
L"FileOpenAssociations"
),
L"Enable"
,
L
"Y"
);
int
state
=
IS_OPTION_TRUE
(
*
buf
)
?
BST_CHECKED
:
BST_UNCHECKED
;
CheckDlgButton
(
hDlg
,
IDC_ENABLE_FILE_ASSOCIATIONS
,
state
);
...
...
@@ -1103,12 +1087,12 @@ static void init_mime_types(HWND hDlg)
static
void
update_mime_types
(
HWND
hDlg
)
{
const
char
*
state
=
"Y"
;
const
WCHAR
*
state
=
L
"Y"
;
if
(
IsDlgButtonChecked
(
hDlg
,
IDC_ENABLE_FILE_ASSOCIATIONS
)
!=
BST_CHECKED
)
state
=
"N"
;
state
=
L
"N"
;
set_reg_key
(
config_key
,
keypath
(
"FileOpenAssociations"
),
"Enable"
,
state
);
set_reg_key
(
config_key
,
keypath
(
L"FileOpenAssociations"
),
L
"Enable"
,
state
);
}
INT_PTR
CALLBACK
...
...
@@ -1153,14 +1137,14 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case
IDC_EDIT_SFPATH
:
on_shell_folder_edit_changed
(
hDlg
);
break
;
case
IDC_SYSPARAM_SIZE
:
{
char
*
text
=
get_text
(
hDlg
,
IDC_SYSPARAM_SIZE
);
WCHAR
*
text
=
get_text
(
hDlg
,
IDC_SYSPARAM_SIZE
);
int
index
=
SendDlgItemMessageW
(
hDlg
,
IDC_SYSPARAM_COMBO
,
CB_GETCURSEL
,
0
,
0
);
index
=
SendDlgItemMessageW
(
hDlg
,
IDC_SYSPARAM_COMBO
,
CB_GETITEMDATA
,
index
,
0
);
if
(
text
)
{
metrics
[
index
].
size
=
atoi
(
text
);
metrics
[
index
].
size
=
wcstol
(
text
,
NULL
,
10
);
HeapFree
(
GetProcessHeap
(),
0
,
text
);
}
else
...
...
programs/winecfg/winecfg.c
View file @
d02d5029
...
...
@@ -62,7 +62,7 @@ void set_window_title(HWND dialog)
{
WCHAR
apptitle
[
256
];
LoadStringW
(
GetModuleHandleW
(
NULL
),
IDS_WINECFG_TITLE_APP
,
apptitle
,
ARRAY_SIZE
(
apptitle
));
wsprintfW
(
newtitle
,
apptitle
,
current_app
);
swprintf
(
newtitle
,
ARRAY_SIZE
(
newtitle
)
,
apptitle
,
current_app
);
}
else
{
...
...
@@ -245,7 +245,7 @@ static void free_setting(struct setting *setting)
* If already in the list, the contents as given there will be
* returned. You are expected to HeapFree the result.
*/
WCHAR
*
get_reg_key
W
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
const
WCHAR
*
def
)
WCHAR
*
get_reg_key
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
const
WCHAR
*
def
)
{
struct
list
*
cursor
;
struct
setting
*
s
;
...
...
@@ -278,43 +278,6 @@ WCHAR *get_reg_keyW(HKEY root, const WCHAR *path, const WCHAR *name, const WCHAR
return
val
;
}
char
*
get_reg_key
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
,
const
char
*
def
)
{
WCHAR
*
wpath
,
*
wname
,
*
wdef
=
NULL
,
*
wRet
=
NULL
;
char
*
szRet
=
NULL
;
int
len
;
WINE_TRACE
(
"path=%s, name=%s, def=%s
\n
"
,
path
,
name
,
def
);
wpath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlen
(
path
)
+
1
)
*
sizeof
(
WCHAR
));
wname
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlen
(
name
)
+
1
)
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
path
,
-
1
,
wpath
,
strlen
(
path
)
+
1
);
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
wname
,
strlen
(
name
)
+
1
);
if
(
def
)
{
wdef
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlen
(
def
)
+
1
)
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
def
,
-
1
,
wdef
,
strlen
(
def
)
+
1
);
}
wRet
=
get_reg_keyW
(
root
,
wpath
,
wname
,
wdef
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
wRet
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
len
)
{
szRet
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
WideCharToMultiByte
(
CP_ACP
,
0
,
wRet
,
-
1
,
szRet
,
len
,
NULL
,
NULL
);
}
HeapFree
(
GetProcessHeap
(),
0
,
wpath
);
HeapFree
(
GetProcessHeap
(),
0
,
wname
);
HeapFree
(
GetProcessHeap
(),
0
,
wdef
);
HeapFree
(
GetProcessHeap
(),
0
,
wRet
);
return
szRet
;
}
/**
* Used to set a registry key.
*
...
...
@@ -402,54 +365,12 @@ static void set_reg_key_ex(HKEY root, const WCHAR *path, const WCHAR *name, cons
list_add_tail
(
&
settings
,
&
s
->
entry
);
}
void
set_reg_key
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
,
const
char
*
value
)
{
WCHAR
*
wpath
,
*
wname
=
NULL
,
*
wvalue
=
NULL
;
wpath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlen
(
path
)
+
1
)
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
path
,
-
1
,
wpath
,
strlen
(
path
)
+
1
);
if
(
name
)
{
wname
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlen
(
name
)
+
1
)
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
wname
,
strlen
(
name
)
+
1
);
}
if
(
value
)
{
wvalue
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlen
(
value
)
+
1
)
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
value
,
-
1
,
wvalue
,
strlen
(
value
)
+
1
);
}
set_reg_key_ex
(
root
,
wpath
,
wname
,
wvalue
,
REG_SZ
);
HeapFree
(
GetProcessHeap
(),
0
,
wpath
);
HeapFree
(
GetProcessHeap
(),
0
,
wname
);
HeapFree
(
GetProcessHeap
(),
0
,
wvalue
);
}
void
set_reg_key_dword
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
,
DWORD
value
)
{
WCHAR
*
wpath
,
*
wname
;
wpath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlen
(
path
)
+
1
)
*
sizeof
(
WCHAR
));
wname
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlen
(
name
)
+
1
)
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
path
,
-
1
,
wpath
,
strlen
(
path
)
+
1
);
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
wname
,
strlen
(
name
)
+
1
);
set_reg_key_ex
(
root
,
wpath
,
wname
,
&
value
,
REG_DWORD
);
HeapFree
(
GetProcessHeap
(),
0
,
wpath
);
HeapFree
(
GetProcessHeap
(),
0
,
wname
);
}
void
set_reg_keyW
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
const
WCHAR
*
value
)
void
set_reg_key
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
const
WCHAR
*
value
)
{
set_reg_key_ex
(
root
,
path
,
name
,
value
,
REG_SZ
);
}
void
set_reg_key_dword
W
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
DWORD
value
)
void
set_reg_key_dword
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
DWORD
value
)
{
set_reg_key_ex
(
root
,
path
,
name
,
&
value
,
REG_DWORD
);
}
...
...
@@ -461,7 +382,7 @@ void set_reg_key_dwordW(HKEY root, const WCHAR *path, const WCHAR *name, DWORD v
* you are expected to HeapFree each element of the array, which is null
* terminated, as well as the array itself.
*/
static
WCHAR
**
enumerate_valuesW
(
HKEY
root
,
WCHAR
*
path
)
WCHAR
**
enumerate_values
(
HKEY
root
,
const
WCHAR
*
path
)
{
HKEY
key
;
DWORD
res
,
i
=
0
,
valueslen
=
0
;
...
...
@@ -563,58 +484,16 @@ static WCHAR **enumerate_valuesW(HKEY root, WCHAR *path)
return
values
;
}
char
**
enumerate_values
(
HKEY
root
,
char
*
path
)
{
WCHAR
*
wpath
;
WCHAR
**
wret
;
char
**
ret
=
NULL
;
int
i
=
0
,
len
=
0
,
size
;
wpath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlen
(
path
)
+
1
)
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
path
,
-
1
,
wpath
,
strlen
(
path
)
+
1
);
wret
=
enumerate_valuesW
(
root
,
wpath
);
if
(
wret
)
{
for
(
len
=
0
;
wret
[
len
];
len
++
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
char
*
));
/* convert WCHAR ** to char ** and HeapFree each WCHAR * element on our way */
for
(
i
=
0
;
i
<
len
;
i
++
)
{
size
=
WideCharToMultiByte
(
CP_ACP
,
0
,
wret
[
i
],
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
size
)
{
ret
[
i
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
WideCharToMultiByte
(
CP_ACP
,
0
,
wret
[
i
],
-
1
,
ret
[
i
],
size
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
wret
[
i
]);
}
}
ret
[
len
]
=
NULL
;
}
HeapFree
(
GetProcessHeap
(),
0
,
wpath
);
HeapFree
(
GetProcessHeap
(),
0
,
wret
);
return
ret
;
}
/**
* returns true if the given key/value pair exists in the registry or
* has been written to.
*/
BOOL
reg_key_exists
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
)
BOOL
reg_key_exists
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
)
{
char
*
val
=
get_reg_key
(
root
,
path
,
name
,
NULL
);
if
(
val
)
{
HeapFree
(
GetProcessHeap
(),
0
,
val
);
return
TRUE
;
}
WCHAR
*
val
=
get_reg_key
(
root
,
path
,
name
,
NULL
);
return
FALSE
;
HeapFree
(
GetProcessHeap
(),
0
,
val
);
return
val
!=
NULL
;
}
static
void
process_setting
(
struct
setting
*
s
)
...
...
@@ -685,27 +564,7 @@ void apply(void)
WCHAR
*
current_app
=
NULL
;
/* the app we are currently editing, or NULL if editing global */
/* returns a registry key path suitable for passing to addTransaction */
char
*
keypath
(
const
char
*
section
)
{
static
char
*
result
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
result
);
if
(
current_app
)
{
result
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
"AppDefaults
\\
"
)
+
lstrlenW
(
current_app
)
*
2
+
2
/* \\ */
+
strlen
(
section
)
+
1
/* terminator */
);
wsprintfA
(
result
,
"AppDefaults
\\
%ls"
,
current_app
);
if
(
section
[
0
])
sprintf
(
result
+
strlen
(
result
),
"
\\
%s"
,
section
);
}
else
{
result
=
strdupA
(
section
);
}
return
result
;
}
WCHAR
*
keypathW
(
const
WCHAR
*
section
)
WCHAR
*
keypath
(
const
WCHAR
*
section
)
{
static
WCHAR
*
result
=
NULL
;
...
...
@@ -748,7 +607,7 @@ void PRINTERROR(void)
BOOL
initialize
(
HINSTANCE
hInstance
)
{
DWORD
res
=
RegCreateKey
A
(
HKEY_CURRENT_USER
,
WINE_KEY_ROOT
,
&
config_key
);
DWORD
res
=
RegCreateKey
W
(
HKEY_CURRENT_USER
,
WINE_KEY_ROOT
,
&
config_key
);
if
(
res
!=
ERROR_SUCCESS
)
{
WINE_ERR
(
"RegOpenKey failed on wine config key (%d)
\n
"
,
res
);
...
...
programs/winecfg/winecfg.h
View file @
d02d5029
...
...
@@ -51,16 +51,13 @@ extern WCHAR* current_app; /* NULL means editing global settings */
be copied, so free them too when necessary.
*/
void
set_reg_keyW
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
const
WCHAR
*
value
);
void
set_reg_key_dwordW
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
DWORD
value
);
WCHAR
*
get_reg_keyW
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
const
WCHAR
*
def
);
void
set_reg_key
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
,
const
char
*
value
);
void
set_reg_key_dword
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
,
DWORD
value
);
char
*
get_reg_key
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
,
const
char
*
def
);
BOOL
reg_key_exists
(
HKEY
root
,
const
char
*
path
,
const
char
*
name
);
void
set_reg_key
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
const
WCHAR
*
value
);
void
set_reg_key_dword
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
DWORD
value
);
WCHAR
*
get_reg_key
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
,
const
WCHAR
*
def
);
BOOL
reg_key_exists
(
HKEY
root
,
const
WCHAR
*
path
,
const
WCHAR
*
name
);
void
apply
(
void
);
char
**
enumerate_values
(
HKEY
root
,
char
*
path
);
WCHAR
**
enumerate_values
(
HKEY
root
,
const
WCHAR
*
path
);
/* Load a string from the resources. Allocated with HeapAlloc (GetProcessHeap()) */
WCHAR
*
load_string
(
UINT
id
);
...
...
@@ -70,8 +67,7 @@ WCHAR* load_string (UINT id);
no explicit free is needed of the string returned by this function
*/
char
*
keypath
(
const
char
*
section
);
WCHAR
*
keypathW
(
const
WCHAR
*
section
);
WCHAR
*
keypath
(
const
WCHAR
*
section
);
BOOL
initialize
(
HINSTANCE
hInstance
);
extern
HKEY
config_key
;
...
...
@@ -90,7 +86,7 @@ INT_PTR CALLBACK ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
INT_PTR
CALLBACK
AboutDlgProc
(
HWND
hDlg
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
);
/* Windows version management */
BOOL
set_winver_from_string
(
const
char
*
version
);
BOOL
set_winver_from_string
(
const
WCHAR
*
version
);
void
print_current_winver
(
void
);
void
print_windows_versions
(
void
);
...
...
@@ -153,20 +149,7 @@ static inline WCHAR *strdupU2W(const char *unix_str)
return
unicode_str
;
}
static
inline
char
*
get_text
(
HWND
dialog
,
WORD
id
)
{
HWND
item
=
GetDlgItem
(
dialog
,
id
);
int
len
=
GetWindowTextLengthA
(
item
)
+
1
;
char
*
result
=
len
?
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)
:
NULL
;
if
(
!
result
)
return
NULL
;
if
(
GetWindowTextA
(
item
,
result
,
len
)
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
result
);
return
NULL
;
}
return
result
;
}
static
inline
WCHAR
*
get_textW
(
HWND
dialog
,
WORD
id
)
static
inline
WCHAR
*
get_text
(
HWND
dialog
,
WORD
id
)
{
HWND
item
=
GetDlgItem
(
dialog
,
id
);
int
len
=
GetWindowTextLengthW
(
item
)
+
1
;
...
...
@@ -189,7 +172,7 @@ static inline void set_textW(HWND dialog, WORD id, const WCHAR *text)
SetWindowTextW
(
GetDlgItem
(
dialog
,
id
),
text
);
}
#define WINE_KEY_ROOT "Software\\Wine"
#define WINE_KEY_ROOT
L
"Software\\Wine"
#define MAXBUFLEN 256
extern
HMENU
hPopupMenus
;
...
...
programs/winecfg/x11drvdlg.c
View file @
d02d5029
...
...
@@ -49,12 +49,12 @@ static BOOL updating_ui;
/* convert the x11 desktop key to the new explorer config */
static
void
convert_x11_desktop_key
(
void
)
{
char
*
buf
;
WCHAR
*
buf
;
if
(
!
(
buf
=
get_reg_key
(
config_key
,
"X11 Driver"
,
"Desktop"
,
NULL
)))
return
;
set_reg_key
(
config_key
,
"Explorer
\\
Desktops"
,
"Default"
,
buf
);
set_reg_key
(
config_key
,
"Explorer"
,
"Desktop"
,
"Default"
);
set_reg_key
(
config_key
,
"X11 Driver"
,
"Desktop"
,
NULL
);
if
(
!
(
buf
=
get_reg_key
(
config_key
,
L"X11 Driver"
,
L
"Desktop"
,
NULL
)))
return
;
set_reg_key
(
config_key
,
L"Explorer
\\
Desktops"
,
L
"Default"
,
buf
);
set_reg_key
(
config_key
,
L"Explorer"
,
L"Desktop"
,
L
"Default"
);
set_reg_key
(
config_key
,
L"X11 Driver"
,
L
"Desktop"
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
...
...
@@ -66,7 +66,7 @@ static void update_gui_for_desktop_mode(HWND dialog)
WINE_TRACE
(
"
\n
"
);
updating_ui
=
TRUE
;
buf
=
get_reg_key
W
(
config_key
,
L"Explorer
\\
Desktops"
,
desktop_name
,
NULL
);
buf
=
get_reg_key
(
config_key
,
L"Explorer
\\
Desktops"
,
desktop_name
,
NULL
);
if
(
buf
&&
(
bufindex
=
wcschr
(
buf
,
'x'
)))
{
*
bufindex
++
=
0
;
...
...
@@ -74,13 +74,13 @@ static void update_gui_for_desktop_mode(HWND dialog)
SetDlgItemTextW
(
dialog
,
IDC_DESKTOP_WIDTH
,
buf
);
SetDlgItemTextW
(
dialog
,
IDC_DESKTOP_HEIGHT
,
bufindex
);
}
else
{
SetDlgItemText
A
(
dialog
,
IDC_DESKTOP_WIDTH
,
"800"
);
SetDlgItemText
A
(
dialog
,
IDC_DESKTOP_HEIGHT
,
"600"
);
SetDlgItemText
W
(
dialog
,
IDC_DESKTOP_WIDTH
,
L
"800"
);
SetDlgItemText
W
(
dialog
,
IDC_DESKTOP_HEIGHT
,
L
"600"
);
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
/* do we have desktop mode enabled? */
if
(
reg_key_exists
(
config_key
,
keypath
(
"Explorer"
),
"Desktop"
))
if
(
reg_key_exists
(
config_key
,
keypath
(
L"Explorer"
),
L
"Desktop"
))
{
CheckDlgButton
(
dialog
,
IDC_ENABLE_DESKTOP
,
BST_CHECKED
);
enable
(
IDC_DESKTOP_WIDTH
);
...
...
@@ -102,18 +102,18 @@ static void update_gui_for_desktop_mode(HWND dialog)
static
BOOL
can_enable_desktop
(
void
)
{
char
*
value
;
WCHAR
*
value
;
UINT
guid_atom
;
BOOL
ret
=
FALSE
;
char
key
[
sizeof
(
"System
\\
CurrentControlSet
\\
Control
\\
Video
\\
{}
\\
0000"
)
+
40
];
WCHAR
key
[
sizeof
(
"System
\\
CurrentControlSet
\\
Control
\\
Video
\\
{}
\\
0000"
)
+
40
];
guid_atom
=
HandleToULong
(
GetProp
A
(
GetDesktopWindow
(),
"__wine_display_device_guid"
));
strcpy
(
key
,
"System
\\
CurrentControlSet
\\
Control
\\
Video
\\
{"
);
if
(
!
GlobalGetAtomName
A
(
guid_atom
,
key
+
str
len
(
key
),
40
))
return
ret
;
strcat
(
key
,
"}
\\
0000"
);
if
((
value
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
key
,
"GraphicsDriver"
,
NULL
)))
guid_atom
=
HandleToULong
(
GetProp
W
(
GetDesktopWindow
(),
L
"__wine_display_device_guid"
));
wcscpy
(
key
,
L
"System
\\
CurrentControlSet
\\
Control
\\
Video
\\
{"
);
if
(
!
GlobalGetAtomName
W
(
guid_atom
,
key
+
wcs
len
(
key
),
40
))
return
ret
;
wcscat
(
key
,
L
"}
\\
0000"
);
if
((
value
=
get_reg_key
(
HKEY_LOCAL_MACHINE
,
key
,
L
"GraphicsDriver"
,
NULL
)))
{
if
(
strcmp
(
value
,
"winemac.drv"
))
if
(
wcscmp
(
value
,
L
"winemac.drv"
))
ret
=
TRUE
;
HeapFree
(
GetProcessHeap
(),
0
,
value
);
}
...
...
@@ -122,7 +122,7 @@ static BOOL can_enable_desktop(void)
static
void
init_dialog
(
HWND
dialog
)
{
char
*
buf
;
WCHAR
*
buf
;
BOOL
enable_desktop
;
convert_x11_desktop_key
();
...
...
@@ -139,21 +139,21 @@ static void init_dialog(HWND dialog)
SendDlgItemMessageW
(
dialog
,
IDC_DESKTOP_HEIGHT
,
EM_LIMITTEXT
,
RES_MAXLEN
,
0
);
}
buf
=
get_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"GrabFullscreen"
,
"N"
);
buf
=
get_reg_key
(
config_key
,
keypath
(
L"X11 Driver"
),
L"GrabFullscreen"
,
L
"N"
);
if
(
IS_OPTION_TRUE
(
*
buf
))
CheckDlgButton
(
dialog
,
IDC_FULLSCREEN_GRAB
,
BST_CHECKED
);
else
CheckDlgButton
(
dialog
,
IDC_FULLSCREEN_GRAB
,
BST_UNCHECKED
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
buf
=
get_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"Managed"
,
"Y"
);
buf
=
get_reg_key
(
config_key
,
keypath
(
L"X11 Driver"
),
L"Managed"
,
L
"Y"
);
if
(
IS_OPTION_TRUE
(
*
buf
))
CheckDlgButton
(
dialog
,
IDC_ENABLE_MANAGED
,
BST_CHECKED
);
else
CheckDlgButton
(
dialog
,
IDC_ENABLE_MANAGED
,
BST_UNCHECKED
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
buf
=
get_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"Decorated"
,
"Y"
);
buf
=
get_reg_key
(
config_key
,
keypath
(
L"X11 Driver"
),
L"Decorated"
,
L
"Y"
);
if
(
IS_OPTION_TRUE
(
*
buf
))
CheckDlgButton
(
dialog
,
IDC_ENABLE_DECORATED
,
BST_CHECKED
);
else
...
...
@@ -174,15 +174,15 @@ static void set_from_desktop_edits(HWND dialog)
WINE_TRACE
(
"
\n
"
);
width
=
get_text
W
(
dialog
,
IDC_DESKTOP_WIDTH
);
height
=
get_text
W
(
dialog
,
IDC_DESKTOP_HEIGHT
);
width
=
get_text
(
dialog
,
IDC_DESKTOP_WIDTH
);
height
=
get_text
(
dialog
,
IDC_DESKTOP_HEIGHT
);
if
(
width
&&
width
[
0
])
w
=
max
(
640
,
wcstol
(
width
,
NULL
,
10
)
);
if
(
height
&&
height
[
0
])
h
=
max
(
480
,
wcstol
(
height
,
NULL
,
10
)
);
swprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
L"%ux%u"
,
w
,
h
);
set_reg_key
W
(
config_key
,
L"Explorer
\\
Desktops"
,
desktop_name
,
buffer
);
set_reg_key
W
(
config_key
,
keypathW
(
L"Explorer"
),
L"Desktop"
,
desktop_name
);
set_reg_key
(
config_key
,
L"Explorer
\\
Desktops"
,
desktop_name
,
buffer
);
set_reg_key
(
config_key
,
keypath
(
L"Explorer"
),
L"Desktop"
,
desktop_name
);
HeapFree
(
GetProcessHeap
(),
0
,
width
);
HeapFree
(
GetProcessHeap
(),
0
,
height
);
...
...
@@ -194,7 +194,7 @@ static void on_enable_desktop_clicked(HWND dialog) {
if
(
IsDlgButtonChecked
(
dialog
,
IDC_ENABLE_DESKTOP
)
==
BST_CHECKED
)
{
set_from_desktop_edits
(
dialog
);
}
else
{
set_reg_key
(
config_key
,
keypath
(
"Explorer"
),
"Desktop"
,
NULL
);
set_reg_key
(
config_key
,
keypath
(
L"Explorer"
),
L
"Desktop"
,
NULL
);
}
update_gui_for_desktop_mode
(
dialog
);
...
...
@@ -204,9 +204,9 @@ static void on_enable_managed_clicked(HWND dialog) {
WINE_TRACE
(
"
\n
"
);
if
(
IsDlgButtonChecked
(
dialog
,
IDC_ENABLE_MANAGED
)
==
BST_CHECKED
)
{
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"Managed"
,
"Y"
);
set_reg_key
(
config_key
,
keypath
(
L"X11 Driver"
),
L"Managed"
,
L
"Y"
);
}
else
{
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"Managed"
,
"N"
);
set_reg_key
(
config_key
,
keypath
(
L"X11 Driver"
),
L"Managed"
,
L
"N"
);
}
}
...
...
@@ -214,25 +214,25 @@ static void on_enable_decorated_clicked(HWND dialog) {
WINE_TRACE
(
"
\n
"
);
if
(
IsDlgButtonChecked
(
dialog
,
IDC_ENABLE_DECORATED
)
==
BST_CHECKED
)
{
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"Decorated"
,
"Y"
);
set_reg_key
(
config_key
,
keypath
(
L"X11 Driver"
),
L"Decorated"
,
L
"Y"
);
}
else
{
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"Decorated"
,
"N"
);
set_reg_key
(
config_key
,
keypath
(
L"X11 Driver"
),
L"Decorated"
,
L
"N"
);
}
}
static
void
on_fullscreen_grab_clicked
(
HWND
dialog
)
{
if
(
IsDlgButtonChecked
(
dialog
,
IDC_FULLSCREEN_GRAB
)
==
BST_CHECKED
)
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"GrabFullscreen"
,
"Y"
);
set_reg_key
(
config_key
,
keypath
(
L"X11 Driver"
),
L"GrabFullscreen"
,
L
"Y"
);
else
set_reg_key
(
config_key
,
keypath
(
"X11 Driver"
),
"GrabFullscreen"
,
"N"
);
set_reg_key
(
config_key
,
keypath
(
L"X11 Driver"
),
L"GrabFullscreen"
,
L
"N"
);
}
static
INT
read_logpixels_reg
(
void
)
{
DWORD
dwLogPixels
;
WCHAR
*
buf
=
get_reg_key
W
(
HKEY_CURRENT_USER
,
L"Control Panel
\\
Desktop"
,
L"LogPixels"
,
NULL
);
if
(
!
buf
)
buf
=
get_reg_key
W
(
HKEY_CURRENT_CONFIG
,
L"Software
\\
Fonts"
,
L"LogPixels"
,
NULL
);
WCHAR
*
buf
=
get_reg_key
(
HKEY_CURRENT_USER
,
L"Control Panel
\\
Desktop"
,
L"LogPixels"
,
NULL
);
if
(
!
buf
)
buf
=
get_reg_key
(
HKEY_CURRENT_CONFIG
,
L"Software
\\
Fonts"
,
L"LogPixels"
,
NULL
);
dwLogPixels
=
buf
?
*
buf
:
DEFDPI
;
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
return
dwLogPixels
;
...
...
@@ -302,7 +302,7 @@ static void update_dpi_trackbar_from_edit(HWND hDlg, BOOL fix)
if
(
dpi
>=
MINDPI
&&
dpi
<=
MAXDPI
)
{
SendDlgItemMessageW
(
hDlg
,
IDC_RES_TRACKBAR
,
TBM_SETPOS
,
TRUE
,
get_trackbar_pos
(
dpi
));
set_reg_key_dword
W
(
HKEY_CURRENT_USER
,
L"Control Panel
\\
Desktop"
,
L"LogPixels"
,
dpi
);
set_reg_key_dword
(
HKEY_CURRENT_USER
,
L"Control Panel
\\
Desktop"
,
L"LogPixels"
,
dpi
);
}
updating_ui
=
FALSE
;
...
...
@@ -422,7 +422,7 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
int
i
=
SendMessageW
(
GetDlgItem
(
hDlg
,
IDC_RES_TRACKBAR
),
TBM_GETPOS
,
0
,
0
);
SetDlgItemInt
(
hDlg
,
IDC_RES_DPIEDIT
,
dpi_values
[
i
],
TRUE
);
update_font_preview
(
hDlg
);
set_reg_key_dword
W
(
HKEY_CURRENT_USER
,
L"Control Panel
\\
Desktop"
,
L"LogPixels"
,
dpi_values
[
i
]);
set_reg_key_dword
(
HKEY_CURRENT_USER
,
L"Control Panel
\\
Desktop"
,
L"LogPixels"
,
dpi_values
[
i
]);
break
;
}
}
...
...
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