Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b95c8205
Commit
b95c8205
authored
May 19, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
May 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Delete the action mapping registry key on SetActionMap.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54917
parent
bed1ecba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
device.c
dlls/dinput/device.c
+11
-14
No files found.
dlls/dinput/device.c
View file @
b95c8205
...
...
@@ -323,19 +323,20 @@ int dinput_device_object_index_from_id( IDirectInputDevice8W *iface, DWORD id )
* Retrieves an open registry key to save the mapping, parametrized for an username,
* specific device and specific action mapping guid.
*/
static
HKEY
get_mapping_key
(
const
WCHAR
*
device
,
const
WCHAR
*
username
,
const
WCHAR
*
guid
)
static
HKEY
get_mapping_key
(
const
WCHAR
*
device
,
const
WCHAR
*
username
,
const
WCHAR
*
guid
,
BOOL
delete
)
{
static
const
WCHAR
*
subkey
=
L"Software
\\
Wine
\\
DirectInput
\\
Mappings
\\
%s
\\
%s
\\
%s"
;
HKEY
hkey
;
static
const
WCHAR
format
[]
=
L"Software
\\
Wine
\\
DirectInput
\\
Mappings
\\
%s
\\
%s
\\
%s"
;
SIZE_T
len
=
wcslen
(
format
)
+
wcslen
(
username
)
+
wcslen
(
device
)
+
wcslen
(
guid
)
+
1
;
WCHAR
*
keyname
;
HKEY
hkey
;
SIZE_T
len
=
wcslen
(
subkey
)
+
wcslen
(
username
)
+
wcslen
(
device
)
+
wcslen
(
guid
)
+
1
;
keyname
=
malloc
(
sizeof
(
WCHAR
)
*
len
);
swprintf
(
keyname
,
len
,
subkey
,
username
,
device
,
guid
);
if
(
!
(
keyname
=
malloc
(
sizeof
(
WCHAR
)
*
len
)))
return
0
;
/* The key used is HKCU\Software\Wine\DirectInput\Mappings\[username]\[device]\[mapping_guid] */
if
(
RegCreateKeyW
(
HKEY_CURRENT_USER
,
keyname
,
&
hkey
))
hkey
=
0
;
swprintf
(
keyname
,
len
,
format
,
username
,
device
,
guid
);
if
(
delete
)
RegDeleteTreeW
(
HKEY_CURRENT_USER
,
keyname
);
if
(
RegCreateKeyW
(
HKEY_CURRENT_USER
,
keyname
,
&
hkey
))
hkey
=
0
;
free
(
keyname
);
...
...
@@ -355,9 +356,7 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM
if
(
StringFromCLSID
(
&
lpdiaf
->
guidActionMap
,
&
guid_str
)
!=
S_OK
)
return
DI_SETTINGSNOTSAVED
;
hkey
=
get_mapping_key
(
didev
.
tszInstanceName
,
lpszUsername
,
guid_str
);
if
(
!
hkey
)
if
(
!
(
hkey
=
get_mapping_key
(
didev
.
tszInstanceName
,
lpszUsername
,
guid_str
,
TRUE
)))
{
CoTaskMemFree
(
guid_str
);
return
DI_SETTINGSNOTSAVED
;
...
...
@@ -398,9 +397,7 @@ static BOOL load_mapping_settings( struct dinput_device *This, LPDIACTIONFORMATW
if
(
StringFromCLSID
(
&
lpdiaf
->
guidActionMap
,
&
guid_str
)
!=
S_OK
)
return
FALSE
;
hkey
=
get_mapping_key
(
didev
.
tszInstanceName
,
username
,
guid_str
);
if
(
!
hkey
)
if
(
!
(
hkey
=
get_mapping_key
(
didev
.
tszInstanceName
,
username
,
guid_str
,
FALSE
)))
{
CoTaskMemFree
(
guid_str
);
return
FALSE
;
...
...
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