mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Rebase against 287dabd9b6887e94cabfa2a5f9bfe822522095e5
This commit is contained in:
parent
68bfc31be4
commit
695a835b0a
@ -1,187 +0,0 @@
|
||||
From 095e3e2646bc5ba024c166a2ac6829a894c0d1f7 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 10 Jan 2020 09:28:50 +1100
|
||||
Subject: [PATCH] dinput: Support default DIPROP_BUFFERSIZE buffer size
|
||||
|
||||
When a program calls SetProperty with DIPROP_BUFFERSIZE, dinput records
|
||||
this value for GetProperty but only uses it when the device can support
|
||||
that number of buffers otherwise a max value.
|
||||
|
||||
In the case of game "Far Cry 5", it passes through (DWORD)-1 which
|
||||
cause HeapAlloc to fail ((DWORD)-1 * sizeof(DIDEVICEOBJECTDATA)).
|
||||
|
||||
Since there is no real way of working out the max value, I've capped it at 100 as
|
||||
the default value is 20.
|
||||
|
||||
MSDN reference.
|
||||
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ee417908(v=vs.85)
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45732
|
||||
|
||||
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
---
|
||||
dlls/dinput/device.c | 14 ++++++++++----
|
||||
dlls/dinput/device_private.h | 3 ++-
|
||||
dlls/dinput/joystick_linux.c | 4 ++++
|
||||
dlls/dinput/joystick_linuxinput.c | 4 ++++
|
||||
dlls/dinput/joystick_osx.c | 4 ++++
|
||||
dlls/dinput/keyboard.c | 3 +++
|
||||
dlls/dinput/mouse.c | 3 +++
|
||||
dlls/dinput/tests/device.c | 14 ++++++++++++++
|
||||
8 files changed, 44 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
|
||||
index 28329d03b5..1604075f84 100644
|
||||
--- a/dlls/dinput/device.c
|
||||
+++ b/dlls/dinput/device.c
|
||||
@@ -1307,7 +1307,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface,
|
||||
|
||||
if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
|
||||
|
||||
- pd->dwData = This->queue_len;
|
||||
+ pd->dwData = This->buffersize;
|
||||
TRACE("buffersize = %d\n", pd->dwData);
|
||||
break;
|
||||
}
|
||||
@@ -1396,12 +1396,18 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(
|
||||
TRACE("buffersize = %d\n", pd->dwData);
|
||||
|
||||
EnterCriticalSection(&This->crit);
|
||||
+
|
||||
+ This->buffersize = pd->dwData;
|
||||
+
|
||||
+ This->queue_len = This->buffersize > 100 ? 100 : This->buffersize;
|
||||
+ if (This->buffersize > 100)
|
||||
+ WARN("Trying to set large buffer size %d\n", pd->dwData);
|
||||
+
|
||||
HeapFree(GetProcessHeap(), 0, This->data_queue);
|
||||
|
||||
- This->data_queue = !pd->dwData ? NULL : HeapAlloc(GetProcessHeap(), 0,
|
||||
- pd->dwData * sizeof(DIDEVICEOBJECTDATA));
|
||||
+ This->data_queue = !This->queue_len ? NULL : HeapAlloc(GetProcessHeap(), 0,
|
||||
+ This->queue_len * sizeof(DIDEVICEOBJECTDATA));
|
||||
This->queue_head = This->queue_tail = This->overflow = 0;
|
||||
- This->queue_len = pd->dwData;
|
||||
|
||||
LeaveCriticalSection(&This->crit);
|
||||
break;
|
||||
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
|
||||
index 27e9c26286..23d9e2eebc 100644
|
||||
--- a/dlls/dinput/device_private.h
|
||||
+++ b/dlls/dinput/device_private.h
|
||||
@@ -71,10 +71,11 @@ struct IDirectInputDeviceImpl
|
||||
DI_EVENT_PROC event_proc; /* function to receive mouse & keyboard events */
|
||||
|
||||
LPDIDEVICEOBJECTDATA data_queue; /* buffer for 'GetDeviceData'. */
|
||||
- int queue_len; /* size of the queue - set in 'SetProperty' */
|
||||
+ int queue_len; /* valid size of the queue */
|
||||
int queue_head; /* position to write new event into queue */
|
||||
int queue_tail; /* next event to read from queue */
|
||||
BOOL overflow; /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
|
||||
+ DWORD buffersize; /* size of the queue - set in 'SetProperty' */
|
||||
|
||||
DataFormat data_format; /* user data format and wine to user format converter */
|
||||
|
||||
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c
|
||||
index afdf659b4a..1e7bf72936 100644
|
||||
--- a/dlls/dinput/joystick_linux.c
|
||||
+++ b/dlls/dinput/joystick_linux.c
|
||||
@@ -501,6 +501,10 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput,
|
||||
newDevice->generic.base.ref = 1;
|
||||
newDevice->generic.base.dinput = dinput;
|
||||
newDevice->generic.base.guid = *rguid;
|
||||
+ newDevice->generic.base.buffersize = 20;
|
||||
+ newDevice->generic.base.queue_len = 20;
|
||||
+ newDevice->generic.base.data_queue = HeapAlloc(GetProcessHeap(), 0,
|
||||
+ newDevice->generic.base.queue_len * sizeof(DIDEVICEOBJECTDATA));
|
||||
InitializeCriticalSection(&newDevice->generic.base.crit);
|
||||
newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->generic.base.crit");
|
||||
|
||||
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
|
||||
index b5418d805c..98283a1eed 100644
|
||||
--- a/dlls/dinput/joystick_linuxinput.c
|
||||
+++ b/dlls/dinput/joystick_linuxinput.c
|
||||
@@ -471,6 +471,10 @@ static JoystickImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput, unsig
|
||||
newDevice->generic.base.ref = 1;
|
||||
newDevice->generic.base.guid = *rguid;
|
||||
newDevice->generic.base.dinput = dinput;
|
||||
+ newDevice->generic.base.buffersize = 20;
|
||||
+ newDevice->generic.base.queue_len = 20;
|
||||
+ newDevice->generic.base.data_queue = HeapAlloc(GetProcessHeap(), 0,
|
||||
+ newDevice->generic.base.queue_len * sizeof(DIDEVICEOBJECTDATA));
|
||||
newDevice->generic.joy_polldev = joy_polldev;
|
||||
newDevice->joyfd = -1;
|
||||
newDevice->joydev = &joydevs[index];
|
||||
diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c
|
||||
index 990f5d1f07..c48cad1f5a 100644
|
||||
--- a/dlls/dinput/joystick_osx.c
|
||||
+++ b/dlls/dinput/joystick_osx.c
|
||||
@@ -1168,6 +1168,10 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput,
|
||||
newDevice->generic.base.ref = 1;
|
||||
newDevice->generic.base.dinput = dinput;
|
||||
newDevice->generic.base.guid = *rguid;
|
||||
+ newDevice->generic.base.buffersize = 20;
|
||||
+ newDevice->generic.base.queue_len = 20;
|
||||
+ newDevice->generic.base.data_queue = HeapAlloc(GetProcessHeap(), 0,
|
||||
+ newDevice->generic.base.queue_len * sizeof(DIDEVICEOBJECTDATA));
|
||||
InitializeCriticalSection(&newDevice->generic.base.crit);
|
||||
newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->generic.base.crit");
|
||||
|
||||
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
|
||||
index 47f28cac52..15a6be4dee 100644
|
||||
--- a/dlls/dinput/keyboard.c
|
||||
+++ b/dlls/dinput/keyboard.c
|
||||
@@ -268,6 +268,9 @@ static SysKeyboardImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
|
||||
InitializeCriticalSection(&newDevice->base.crit);
|
||||
newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysKeyboardImpl*->base.crit");
|
||||
newDevice->subtype = get_keyboard_subtype();
|
||||
+ newDevice->base.buffersize = 20;
|
||||
+ newDevice->base.queue_len = 20;
|
||||
+ newDevice->base.data_queue = HeapAlloc(GetProcessHeap(), 0, newDevice->base.queue_len * sizeof(DIDEVICEOBJECTDATA));
|
||||
|
||||
/* Create copy of default data format */
|
||||
if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIKeyboard.dwSize))) goto failed;
|
||||
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
|
||||
index 08ace2f4e9..59c8c9dad8 100644
|
||||
--- a/dlls/dinput/mouse.c
|
||||
+++ b/dlls/dinput/mouse.c
|
||||
@@ -214,6 +214,9 @@ static SysMouseImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
|
||||
newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysMouseImpl*->base.crit");
|
||||
newDevice->base.dinput = dinput;
|
||||
newDevice->base.event_proc = dinput_mouse_hook;
|
||||
+ newDevice->base.buffersize = 20;
|
||||
+ newDevice->base.queue_len = 20;
|
||||
+ newDevice->base.data_queue = HeapAlloc(GetProcessHeap(), 0, newDevice->base.queue_len * sizeof(DIDEVICEOBJECTDATA));
|
||||
|
||||
get_app_key(&hkey, &appkey);
|
||||
if (!get_config_key(hkey, appkey, "MouseWarpOverride", buffer, sizeof(buffer)))
|
||||
diff --git a/dlls/dinput/tests/device.c b/dlls/dinput/tests/device.c
|
||||
index a2a5a65686..4dd16c70d2 100644
|
||||
--- a/dlls/dinput/tests/device.c
|
||||
+++ b/dlls/dinput/tests/device.c
|
||||
@@ -106,8 +106,22 @@ static void test_object_info(IDirectInputDeviceA *device, HWND hwnd)
|
||||
dp.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
dp.diph.dwHow = DIPH_DEVICE;
|
||||
dp.diph.dwObj = 0;
|
||||
+ dp.dwData = -1;
|
||||
+
|
||||
+ hr = IDirectInputDevice_GetProperty(device, DIPROP_BUFFERSIZE, &dp.diph);
|
||||
+ ok(hr == DI_OK, "Failed: %08x\n", hr);
|
||||
+ ok(dp.dwData == 20, "got %d\n", dp.dwData);
|
||||
+
|
||||
+ dp.dwData = -1;
|
||||
+ hr = IDirectInputDevice_SetProperty(device, DIPROP_BUFFERSIZE, (LPCDIPROPHEADER)&dp.diph);
|
||||
+ ok(hr == DI_OK, "SetProperty() failed: %08x\n", hr);
|
||||
+
|
||||
dp.dwData = 0;
|
||||
+ hr = IDirectInputDevice_GetProperty(device, DIPROP_BUFFERSIZE, &dp.diph);
|
||||
+ ok(hr == DI_OK, "Failed: %08x\n", hr);
|
||||
+ ok(dp.dwData == -1, "got %d\n", dp.dwData);
|
||||
|
||||
+ dp.dwData = 0;
|
||||
hr = IDirectInputDevice_SetProperty(device, DIPROP_BUFFERSIZE, (LPCDIPROPHEADER)&dp.diph);
|
||||
ok(hr == DI_OK, "SetProperty() failed: %08x\n", hr);
|
||||
cnt = 5;
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1 +0,0 @@
|
||||
Fixes: [45732] Far Cry 5 Cannot Steer Land Vehicles
|
@ -1,4 +1,4 @@
|
||||
From dd42a25720d9d711137e84a449319fc197b2639f Mon Sep 17 00:00:00 2001
|
||||
From e72af998f5382092726cfdb4d57c3b5f8b7d5401 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Church <achurch@achurch.org>
|
||||
Date: Mon, 25 Feb 2019 11:23:12 +1100
|
||||
Subject: [PATCH] dinput: Allow reconnecting to disconnected joysticks
|
||||
@ -9,7 +9,7 @@ Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=34297
|
||||
1 file changed, 113 insertions(+), 35 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
|
||||
index 98283a1eedd..439e7d84bd4 100644
|
||||
index b5418d805cc..2434af600ac 100644
|
||||
--- a/dlls/dinput/joystick_linuxinput.c
|
||||
+++ b/dlls/dinput/joystick_linuxinput.c
|
||||
@@ -84,6 +84,13 @@ struct wine_input_absinfo {
|
||||
@ -34,15 +34,15 @@ index 98283a1eedd..439e7d84bd4 100644
|
||||
|
||||
int dev_axes_to_di[ABS_MAX];
|
||||
POINTL povs[4];
|
||||
@@ -477,6 +485,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput, unsig
|
||||
newDevice->generic.base.queue_len * sizeof(DIDEVICEOBJECTDATA));
|
||||
@@ -473,6 +481,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput, unsig
|
||||
newDevice->generic.base.dinput = dinput;
|
||||
newDevice->generic.joy_polldev = joy_polldev;
|
||||
newDevice->joyfd = -1;
|
||||
+ newDevice->joyfd_state = WINE_FD_STATE_CLOSED;
|
||||
newDevice->joydev = &joydevs[index];
|
||||
newDevice->generic.name = newDevice->joydev->name;
|
||||
list_init(&newDevice->ff_effects);
|
||||
@@ -684,38 +693,15 @@ static HRESULT joydev_create_device(IDirectInputImpl *dinput, REFGUID rguid, REF
|
||||
@@ -680,38 +689,15 @@ static HRESULT joydev_create_device(IDirectInputImpl *dinput, REFGUID rguid, REF
|
||||
return DIERR_DEVICENOTREG;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ index 98283a1eedd..439e7d84bd4 100644
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -730,18 +716,53 @@ static HRESULT WINAPI JoystickWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
|
||||
@@ -726,18 +712,53 @@ static HRESULT WINAPI JoystickWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
|
||||
event.type = EV_FF;
|
||||
event.code = FF_GAIN;
|
||||
event.value = This->ff_gain;
|
||||
@ -141,7 +141,7 @@ index 98283a1eedd..439e7d84bd4 100644
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
@@ -779,6 +800,7 @@ static HRESULT WINAPI JoystickWImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
|
||||
@@ -775,6 +796,7 @@ static HRESULT WINAPI JoystickWImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
|
||||
|
||||
close(This->joyfd);
|
||||
This->joyfd = -1;
|
||||
@ -149,7 +149,7 @@ index 98283a1eedd..439e7d84bd4 100644
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -823,23 +845,79 @@ static void joy_polldev(LPDIRECTINPUTDEVICE8A iface)
|
||||
@@ -819,23 +841,79 @@ static void joy_polldev(LPDIRECTINPUTDEVICE8A iface)
|
||||
struct input_event ie;
|
||||
JoystickImpl *This = impl_from_IDirectInputDevice8A(iface);
|
||||
|
||||
@ -236,5 +236,5 @@ index 98283a1eedd..439e7d84bd4 100644
|
||||
TRACE("input_event: type %d, code %d, value %d\n",ie.type,ie.code,ie.value);
|
||||
switch (ie.type) {
|
||||
--
|
||||
2.24.1
|
||||
2.17.1
|
||||
|
||||
|
@ -1,2 +1 @@
|
||||
Fixes: [34297] dinput: Allow reconnecting to disconnected joysticks
|
||||
Depends: dinput-DIPROP_BUFFERSIZE
|
||||
|
@ -52,7 +52,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "c84fa0a2661f2235fac6f3427201fbb3fd8c8028"
|
||||
echo "287dabd9b6887e94cabfa2a5f9bfe822522095e5"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -128,7 +128,6 @@ patch_enable_all ()
|
||||
enable_ddraw_Texture_Wrong_Caps="$1"
|
||||
enable_ddraw_Write_Vtable="$1"
|
||||
enable_ddraw_version_check="$1"
|
||||
enable_dinput_DIPROP_BUFFERSIZE="$1"
|
||||
enable_dinput_SetActionMap_genre="$1"
|
||||
enable_dinput_axis_recalc="$1"
|
||||
enable_dinput_joy_mappings="$1"
|
||||
@ -271,7 +270,6 @@ patch_enable_all ()
|
||||
enable_setupapi_DiskSpaceList="$1"
|
||||
enable_setupapi_SPFILENOTIFY_FILEINCABINET="$1"
|
||||
enable_setupapi_SP_COPY_IN_USE_NEEDS_REBOOT="$1"
|
||||
enable_setupapi_SetupPromptForDisk="$1"
|
||||
enable_shdocvw_ParseURLFromOutsideSource_Tests="$1"
|
||||
enable_shell32_ACE_Viewer="$1"
|
||||
enable_shell32_Context_Menu="$1"
|
||||
@ -520,9 +518,6 @@ patch_enable ()
|
||||
ddraw-version-check)
|
||||
enable_ddraw_version_check="$2"
|
||||
;;
|
||||
dinput-DIPROP_BUFFERSIZE)
|
||||
enable_dinput_DIPROP_BUFFERSIZE="$2"
|
||||
;;
|
||||
dinput-SetActionMap-genre)
|
||||
enable_dinput_SetActionMap_genre="$2"
|
||||
;;
|
||||
@ -949,9 +944,6 @@ patch_enable ()
|
||||
setupapi-SP_COPY_IN_USE_NEEDS_REBOOT)
|
||||
enable_setupapi_SP_COPY_IN_USE_NEEDS_REBOOT="$2"
|
||||
;;
|
||||
setupapi-SetupPromptForDisk)
|
||||
enable_setupapi_SetupPromptForDisk="$2"
|
||||
;;
|
||||
shdocvw-ParseURLFromOutsideSource_Tests)
|
||||
enable_shdocvw_ParseURLFromOutsideSource_Tests="$2"
|
||||
;;
|
||||
@ -2057,13 +2049,6 @@ if test "$enable_dsound_EAX" -eq 1; then
|
||||
enable_dsound_Fast_Mixer=1
|
||||
fi
|
||||
|
||||
if test "$enable_dinput_reconnect_joystick" -eq 1; then
|
||||
if test "$enable_dinput_DIPROP_BUFFERSIZE" -gt 1; then
|
||||
abort "Patchset dinput-DIPROP_BUFFERSIZE disabled, but dinput-reconnect-joystick depends on that."
|
||||
fi
|
||||
enable_dinput_DIPROP_BUFFERSIZE=1
|
||||
fi
|
||||
|
||||
if test "$enable_dinput_SetActionMap_genre" -eq 1; then
|
||||
if test "$enable_dinput_joy_mappings" -gt 1; then
|
||||
abort "Patchset dinput-joy-mappings disabled, but dinput-SetActionMap-genre depends on that."
|
||||
@ -3104,22 +3089,6 @@ if test "$enable_ddraw_version_check" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset dinput-DIPROP_BUFFERSIZE
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#45732] Far Cry 5 Cannot Steer Land Vehicles
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/dinput/device.c, dlls/dinput/device_private.h, dlls/dinput/joystick_linux.c, dlls/dinput/joystick_linuxinput.c,
|
||||
# | dlls/dinput/joystick_osx.c, dlls/dinput/keyboard.c, dlls/dinput/mouse.c, dlls/dinput/tests/device.c
|
||||
# |
|
||||
if test "$enable_dinput_DIPROP_BUFFERSIZE" -eq 1; then
|
||||
patch_apply dinput-DIPROP_BUFFERSIZE/0001-dinput-Support-default-DIPROP_BUFFERSIZE-buffer-size.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Alistair Leslie-Hughes", "dinput: Support default DIPROP_BUFFERSIZE buffer size.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset dinput-joy-mappings
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
@ -3179,9 +3148,6 @@ fi
|
||||
|
||||
# Patchset dinput-reconnect-joystick
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * dinput-DIPROP_BUFFERSIZE
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#34297] dinput: Allow reconnecting to disconnected joysticks
|
||||
# |
|
||||
@ -5957,25 +5923,6 @@ if test "$enable_setupapi_SP_COPY_IN_USE_NEEDS_REBOOT" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset setupapi-SetupPromptForDisk
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#20465] Wine ignores IDF_CHECKFIRST flag in SetupPromptForDisk
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/setupapi/dialog.c, dlls/setupapi/tests/Makefile.in, dlls/setupapi/tests/dialog.c
|
||||
# |
|
||||
if test "$enable_setupapi_SetupPromptForDisk" -eq 1; then
|
||||
patch_apply setupapi-SetupPromptForDisk/0001-setupapi-Add-support-for-IDF_CHECKFIRST-flag-in-Setu.patch
|
||||
patch_apply setupapi-SetupPromptForDisk/0002-setupapi-tests-Add-test-for-IDF_CHECKFIRST-and-Setup.patch
|
||||
patch_apply setupapi-SetupPromptForDisk/0003-setupapi-tests-Determine-path-to-system32-directory-.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Michael Müller", "setupapi: Add support for IDF_CHECKFIRST flag in SetupPromptForDiskW.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "setupapi/tests: Add test for IDF_CHECKFIRST and SetupPromptForDiskA/W.", 1 },';
|
||||
printf '%s\n' '+ { "Hermes Belusca-Maito", "setupapi/tests: Determine path to system32 directory at runtime.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset shdocvw-ParseURLFromOutsideSource_Tests
|
||||
# |
|
||||
# | Modified files:
|
||||
|
@ -1,52 +0,0 @@
|
||||
From 627cb8f9cd6853de1f711fc8100b1e4deecbce99 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 5 Oct 2014 23:29:18 +0200
|
||||
Subject: setupapi: Add support for IDF_CHECKFIRST flag in SetupPromptForDiskW.
|
||||
|
||||
---
|
||||
dlls/setupapi/dialog.c | 29 +++++++++++++++++++++++++++++
|
||||
1 file changed, 29 insertions(+)
|
||||
|
||||
diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
|
||||
index 24a46e8..daacaf5 100644
|
||||
--- a/dlls/setupapi/dialog.c
|
||||
+++ b/dlls/setupapi/dialog.c
|
||||
@@ -248,6 +248,35 @@ UINT WINAPI SetupPromptForDiskW(HWND hwndParent, PCWSTR DialogTitle, PCWSTR Disk
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return DPROMPT_CANCEL;
|
||||
}
|
||||
+
|
||||
+ if (PathToSource && (DiskPromptStyle & IDF_CHECKFIRST))
|
||||
+ {
|
||||
+ static const WCHAR format[] = {'%', 's', '\\', '%', 's', '\0'};
|
||||
+ WCHAR filepath[MAX_PATH];
|
||||
+
|
||||
+ if (lstrlenW(PathToSource) + 1 + lstrlenW(FileSought) < sizeof(filepath))
|
||||
+ {
|
||||
+ _snwprintf(filepath, MAX_PATH, format, PathToSource, FileSought);
|
||||
+
|
||||
+ if (GetFileAttributesW(filepath) != INVALID_FILE_ATTRIBUTES)
|
||||
+ {
|
||||
+ if (PathRequiredSize)
|
||||
+ *PathRequiredSize = lstrlenW(PathToSource) + 1;
|
||||
+
|
||||
+ if (!PathBuffer)
|
||||
+ return DPROMPT_SUCCESS;
|
||||
+
|
||||
+ if (PathBufferSize >= lstrlenW(PathToSource) + 1)
|
||||
+ {
|
||||
+ lstrcpyW(PathBuffer, PathToSource);
|
||||
+ return DPROMPT_SUCCESS;
|
||||
+ }
|
||||
+ else
|
||||
+ return DPROMPT_BUFFERTOOSMALL;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
params.DialogTitle = DialogTitle;
|
||||
params.DiskName = DiskName;
|
||||
params.PathToSource = PathToSource;
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,141 +0,0 @@
|
||||
From e8a80102cb10ffd837a560fbaaf202f649152389 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 5 Oct 2014 23:53:39 +0200
|
||||
Subject: [PATCH] setupapi/tests: Add test for IDF_CHECKFIRST and
|
||||
SetupPromptForDiskA/W.
|
||||
|
||||
---
|
||||
dlls/setupapi/tests/Makefile.in | 1 +
|
||||
dlls/setupapi/tests/dialog.c | 107 ++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 108 insertions(+)
|
||||
create mode 100644 dlls/setupapi/tests/dialog.c
|
||||
|
||||
diff --git a/dlls/setupapi/tests/Makefile.in b/dlls/setupapi/tests/Makefile.in
|
||||
index bbfdf59..83f751c 100644
|
||||
--- a/dlls/setupapi/tests/Makefile.in
|
||||
+++ b/dlls/setupapi/tests/Makefile.in
|
||||
@@ -5,6 +5,7 @@ SOURCES = \
|
||||
coinst.c \
|
||||
coinst.spec \
|
||||
devinst.c \
|
||||
+ dialog.c \
|
||||
diskspace.c \
|
||||
install.c \
|
||||
misc.c \
|
||||
diff --git a/dlls/setupapi/tests/dialog.c b/dlls/setupapi/tests/dialog.c
|
||||
new file mode 100644
|
||||
index 0000000..973b1fc
|
||||
--- /dev/null
|
||||
+++ b/dlls/setupapi/tests/dialog.c
|
||||
@@ -0,0 +1,107 @@
|
||||
+/*
|
||||
+ * Unit tests for SetupPromptForDisk
|
||||
+ *
|
||||
+ * Copyright 2014 Michael Müller
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
+ */
|
||||
+
|
||||
+#include <stdarg.h>
|
||||
+
|
||||
+#include "windef.h"
|
||||
+#include "winbase.h"
|
||||
+#include "wingdi.h"
|
||||
+#include "winuser.h"
|
||||
+#include "winreg.h"
|
||||
+#include "guiddef.h"
|
||||
+#include "setupapi.h"
|
||||
+
|
||||
+#include "wine/test.h"
|
||||
+
|
||||
+static void test_SetupPromptForDiskA(void)
|
||||
+{
|
||||
+ char path[] = "C:\\windows\\system32";
|
||||
+ char file[] = "kernel32.dll";
|
||||
+ char buffer[MAX_PATH];
|
||||
+ UINT ret;
|
||||
+ DWORD length;
|
||||
+
|
||||
+ memset(buffer, 0, sizeof(buffer));
|
||||
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, sizeof(buffer) - 1, &length);
|
||||
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
|
||||
+ ok(length == strlen(path)+1, "Expect length %u, got %u\n", (DWORD)strlen(path) + 1, length);
|
||||
+ ok(strcmp(path, buffer) == 0, "Expected path %s, got %s\n", path, buffer);
|
||||
+
|
||||
+ memset(buffer, 0, sizeof(buffer));
|
||||
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, 0, 0, &length);
|
||||
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
|
||||
+ ok(length == strlen(path)+1, "Expect length %u, got %u\n", (DWORD)strlen(path) + 1, length);
|
||||
+
|
||||
+ memset(buffer, 0, sizeof(buffer));
|
||||
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, 1, &length);
|
||||
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %u\n", ret);
|
||||
+
|
||||
+ memset(buffer, 0, sizeof(buffer));
|
||||
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, strlen(path), &length);
|
||||
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %u\n", ret);
|
||||
+
|
||||
+ memset(buffer, 0, sizeof(buffer));
|
||||
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, strlen(path)+1, &length);
|
||||
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
|
||||
+ ok(length == strlen(path)+1, "Expect length %u, got %u\n", (DWORD)strlen(path) + 1, length);
|
||||
+ ok(strcmp(path, buffer) == 0, "Expected path %s, got %s\n", path, buffer);
|
||||
+}
|
||||
+
|
||||
+static void test_SetupPromptForDiskW(void)
|
||||
+{
|
||||
+ WCHAR path[] = {'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m','3','2','\0'};
|
||||
+ WCHAR file[] = {'k','e','r','n','e','l','3','2','.','d','l','l','\0'};
|
||||
+ WCHAR title[] = {'T','e','s','t','\0'};
|
||||
+ WCHAR disk[] = {'T','e','s','t','d','i','s','k','\0'};
|
||||
+ WCHAR buffer[MAX_PATH];
|
||||
+ UINT ret;
|
||||
+ DWORD length;
|
||||
+
|
||||
+ memset(buffer, 0, sizeof(buffer));
|
||||
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, MAX_PATH-1, &length);
|
||||
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
|
||||
+ ok(length == lstrlenW(path)+1, "Expect length %u, got %u\n", lstrlenW(path)+1, length);
|
||||
+ ok(lstrcmpW(path, buffer) == 0, "Expected path %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(buffer));
|
||||
+
|
||||
+ memset(buffer, 0, sizeof(buffer));
|
||||
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, 0, 0, &length);
|
||||
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
|
||||
+ ok(length == lstrlenW(path)+1, "Expect length %u, got %u\n", lstrlenW(path)+1, length);
|
||||
+
|
||||
+ memset(buffer, 0, sizeof(buffer));
|
||||
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, 1, &length);
|
||||
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %u\n", ret);
|
||||
+
|
||||
+ memset(buffer, 0, sizeof(buffer));
|
||||
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, lstrlenW(path), &length);
|
||||
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %u\n", ret);
|
||||
+
|
||||
+ memset(buffer, 0, sizeof(buffer));
|
||||
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, lstrlenW(path)+1, &length);
|
||||
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
|
||||
+ ok(length == lstrlenW(path)+1, "Expect length %u, got %u\n", lstrlenW(path)+1, length);
|
||||
+ ok(lstrcmpW(path, buffer) == 0, "Expected path %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(buffer));
|
||||
+}
|
||||
+
|
||||
+START_TEST(dialog)
|
||||
+{
|
||||
+ test_SetupPromptForDiskA();
|
||||
+ test_SetupPromptForDiskW();
|
||||
+}
|
||||
\ No newline at end of file
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,50 +0,0 @@
|
||||
From 6305ff73db48b24ce806ddc3f345bca987ea2933 Mon Sep 17 00:00:00 2001
|
||||
From: Hermes Belusca-Maito <hermes.belusca-maito@reactos.org>
|
||||
Date: Sun, 9 Oct 2016 19:09:09 +0200
|
||||
Subject: setupapi/tests: Determine path to system32 directory at runtime.
|
||||
|
||||
---
|
||||
dlls/setupapi/tests/dialog.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/setupapi/tests/dialog.c b/dlls/setupapi/tests/dialog.c
|
||||
index 973b1fc..8b47350 100644
|
||||
--- a/dlls/setupapi/tests/dialog.c
|
||||
+++ b/dlls/setupapi/tests/dialog.c
|
||||
@@ -32,12 +32,14 @@
|
||||
|
||||
static void test_SetupPromptForDiskA(void)
|
||||
{
|
||||
- char path[] = "C:\\windows\\system32";
|
||||
char file[] = "kernel32.dll";
|
||||
+ char path[MAX_PATH];
|
||||
char buffer[MAX_PATH];
|
||||
UINT ret;
|
||||
DWORD length;
|
||||
|
||||
+ GetSystemDirectoryA(path, MAX_PATH);
|
||||
+
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, sizeof(buffer) - 1, &length);
|
||||
ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
|
||||
@@ -66,14 +68,16 @@ static void test_SetupPromptForDiskA(void)
|
||||
|
||||
static void test_SetupPromptForDiskW(void)
|
||||
{
|
||||
- WCHAR path[] = {'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m','3','2','\0'};
|
||||
WCHAR file[] = {'k','e','r','n','e','l','3','2','.','d','l','l','\0'};
|
||||
WCHAR title[] = {'T','e','s','t','\0'};
|
||||
WCHAR disk[] = {'T','e','s','t','d','i','s','k','\0'};
|
||||
+ WCHAR path[MAX_PATH];
|
||||
WCHAR buffer[MAX_PATH];
|
||||
UINT ret;
|
||||
DWORD length;
|
||||
|
||||
+ GetSystemDirectoryW(path, MAX_PATH);
|
||||
+
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, MAX_PATH-1, &length);
|
||||
ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
|
||||
--
|
||||
2.9.0
|
||||
|
@ -1 +0,0 @@
|
||||
Fixes: [20465] Wine ignores IDF_CHECKFIRST flag in SetupPromptForDisk
|
Loading…
Reference in New Issue
Block a user