You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-04-13 14:42:51 -07:00
Rebase against 35180d368a94156cb77b09560b24d3af428b988b.
This commit is contained in:
@@ -1,17 +1,60 @@
|
||||
From ed590782f6149f56c0e4c6747cea5a297543047b Mon Sep 17 00:00:00 2001
|
||||
From c9ecf258a9186bb31a18f8a4728e20bb25b4e9cf Mon Sep 17 00:00:00 2001
|
||||
From: Jetro Jormalainen <jje-wine@jv.jetro.fi>
|
||||
Date: Tue, 30 Apr 2019 09:21:24 +1000
|
||||
Subject: [PATCH] dinput: Support username in Config dialog.
|
||||
|
||||
---
|
||||
dlls/dinput/ansi.c | 26 +++++
|
||||
dlls/dinput/config.c | 187 ++++++++++++++++++++++++-----------
|
||||
dlls/dinput/device.c | 2 +-
|
||||
dlls/dinput/device_private.h | 1 +
|
||||
dlls/dinput/dinput_main.c | 28 ++++++
|
||||
4 files changed, 161 insertions(+), 57 deletions(-)
|
||||
dlls/dinput/dinput_main.c | 1 +
|
||||
5 files changed, 160 insertions(+), 57 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c
|
||||
index 431b812aeb2..270fe6f1498 100644
|
||||
--- a/dlls/dinput/ansi.c
|
||||
+++ b/dlls/dinput/ansi.c
|
||||
@@ -840,11 +840,37 @@ static HRESULT WINAPI dinput8_a_ConfigureDevices( IDirectInput8A *iface_a, LPDIC
|
||||
{
|
||||
hr = diactionformat_atow( format_a, &format_w, TRUE );
|
||||
params_w.lprgFormats = &format_w;
|
||||
+ params_w.dwcUsers = params_a->dwcUsers;
|
||||
+
|
||||
+ if (params_a->lptszUserNames) {
|
||||
+ char *start = params_a->lptszUserNames;
|
||||
+ WCHAR *to = NULL;
|
||||
+ int total_len = 0;
|
||||
+ for (i = 0; i < params_a->dwcUsers; i++)
|
||||
+ {
|
||||
+ char *end = start + 1;
|
||||
+ int len;
|
||||
+ while (*(end++));
|
||||
+ len = MultiByteToWideChar(CP_ACP, 0, start, end - start, NULL, 0);
|
||||
+ total_len += len + 2; /* length of string and two null char */
|
||||
+ if (to)
|
||||
+ to = HeapReAlloc(GetProcessHeap(), 0, to, sizeof(WCHAR) * total_len);
|
||||
+ else
|
||||
+ to = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * total_len);
|
||||
+
|
||||
+ MultiByteToWideChar(CP_ACP, 0, start, end - start, to + (total_len - len - 2), len);
|
||||
+ to[total_len] = 0;
|
||||
+ to[total_len - 1] = 0;
|
||||
+ }
|
||||
+ params_w.lptszUserNames = to;
|
||||
+ }
|
||||
|
||||
if (SUCCEEDED(hr)) hr = IDirectInput8_ConfigureDevices( iface_w, callback, ¶ms_w, flags, ref );
|
||||
|
||||
if (!format_w.hInstString) for (i = 0; i < format_w.dwNumActions; ++i) HeapFree( GetProcessHeap(), 0, (void *)format_w.rgoAction[i].lptszActionName );
|
||||
HeapFree( GetProcessHeap(), 0, format_w.rgoAction );
|
||||
+ HeapFree( GetProcessHeap(), 0, params_w.lptszUserNames);
|
||||
+
|
||||
}
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, params_w.lptszUserNames );
|
||||
diff --git a/dlls/dinput/config.c b/dlls/dinput/config.c
|
||||
index bf44898589..c7a33d2da0 100644
|
||||
index bf448985893..c7a33d2da02 100644
|
||||
--- a/dlls/dinput/config.c
|
||||
+++ b/dlls/dinput/config.c
|
||||
@@ -18,17 +18,23 @@
|
||||
@@ -366,10 +409,10 @@ index bf44898589..c7a33d2da0 100644
|
||||
return DI_OK;
|
||||
}
|
||||
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
|
||||
index 6107ab2653..30483fe691 100644
|
||||
index 05a1dbbb2a1..daaaebdc0d0 100644
|
||||
--- a/dlls/dinput/device.c
|
||||
+++ b/dlls/dinput/device.c
|
||||
@@ -692,7 +692,7 @@ static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WC
|
||||
@@ -704,7 +704,7 @@ static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WC
|
||||
return hkey;
|
||||
}
|
||||
|
||||
@@ -379,10 +422,10 @@ index 6107ab2653..30483fe691 100644
|
||||
WCHAR *guid_str = NULL;
|
||||
DIDEVICEINSTANCEW didev;
|
||||
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
|
||||
index ea794d7396..114e3971ed 100644
|
||||
index 8d3425483c2..a6f22b28bf3 100644
|
||||
--- a/dlls/dinput/device_private.h
|
||||
+++ b/dlls/dinput/device_private.h
|
||||
@@ -125,6 +125,7 @@ extern const char *_dump_dinput_GUID(const GUID *guid) DECLSPEC_HIDDEN;
|
||||
@@ -132,6 +132,7 @@ extern const char *_dump_dinput_GUID(const GUID *guid) DECLSPEC_HIDDEN;
|
||||
|
||||
extern LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD type) DECLSPEC_HIDDEN;
|
||||
|
||||
@@ -391,7 +434,7 @@ index ea794d7396..114e3971ed 100644
|
||||
|
||||
extern HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
|
||||
index 0855cb41cd..7af377026c 100644
|
||||
index 85de9f79b81..2f40bfbca96 100644
|
||||
--- a/dlls/dinput/dinput_main.c
|
||||
+++ b/dlls/dinput/dinput_main.c
|
||||
@@ -39,6 +39,7 @@
|
||||
@@ -402,50 +445,6 @@ index 0855cb41cd..7af377026c 100644
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/asm.h"
|
||||
#include "windef.h"
|
||||
@@ -1253,9 +1254,34 @@ static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(
|
||||
|
||||
/* Copy parameters */
|
||||
diCDParamsW.dwSize = sizeof(DICONFIGUREDEVICESPARAMSW);
|
||||
+ diCDParamsW.dwcUsers = lpdiCDParams->dwcUsers;
|
||||
diCDParamsW.dwcFormats = lpdiCDParams->dwcFormats;
|
||||
diCDParamsW.lprgFormats = &diafW;
|
||||
diCDParamsW.hwnd = lpdiCDParams->hwnd;
|
||||
+ diCDParamsW.lptszUserNames = NULL;
|
||||
+
|
||||
+ if (lpdiCDParams->lptszUserNames) {
|
||||
+ char *start = lpdiCDParams->lptszUserNames;
|
||||
+ WCHAR *to = NULL;
|
||||
+ int total_len = 0;
|
||||
+ for (i = 0; i < lpdiCDParams->dwcUsers; i++)
|
||||
+ {
|
||||
+ char *end = start + 1;
|
||||
+ int len;
|
||||
+ while (*(end++));
|
||||
+ len = MultiByteToWideChar(CP_ACP, 0, start, end - start, NULL, 0);
|
||||
+ total_len += len + 2; /* length of string and two null char */
|
||||
+ if (to)
|
||||
+ to = HeapReAlloc(GetProcessHeap(), 0, to, sizeof(WCHAR) * total_len);
|
||||
+ else
|
||||
+ to = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * total_len);
|
||||
+
|
||||
+ MultiByteToWideChar(CP_ACP, 0, start, end - start, to + (total_len - len - 2), len);
|
||||
+ to[total_len] = 0;
|
||||
+ to[total_len - 1] = 0;
|
||||
+ }
|
||||
+ diCDParamsW.lptszUserNames = to;
|
||||
+ }
|
||||
|
||||
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiCDParams->lprgFormats->dwNumActions);
|
||||
_copy_diactionformatAtoW(&diafW, lpdiCDParams->lprgFormats);
|
||||
@@ -1283,6 +1309,8 @@ static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||
|
||||
+ heap_free((void*) diCDParamsW.lptszUserNames);
|
||||
+
|
||||
return hr;
|
||||
}
|
||||
|
||||
--
|
||||
2.17.1
|
||||
2.30.2
|
||||
|
||||
|
Reference in New Issue
Block a user