Added patch to allow dinput EnumDevices callback with broken calling convention.

This commit is contained in:
Sebastian Lackner 2015-11-15 07:28:23 +01:00
parent 4a6afc96cb
commit 3aa9934386
5 changed files with 86 additions and 1 deletions

View File

@ -34,11 +34,12 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [11]:**
**Bug fixes and features included in the next upcoming release [12]:**
* Add partial implementation of ITfThreadMgrEx_ActivateEx ([Wine Bug #39564](https://bugs.winehq.org/show_bug.cgi?id=39564))
* Add stub kernel32.FreeUserPhysicalPages ([Wine Bug #39543](https://bugs.winehq.org/show_bug.cgi?id=39543))
* Add stubs for advapi32.RegCreateKeyTransacted[A/W]
* Allow dinput EnumDevices callback with broken calling convention ([Wine Bug #27664](https://bugs.winehq.org/show_bug.cgi?id=27664))
* CompareString should abort on first non-matching character ([Wine Bug #37556](https://bugs.winehq.org/show_bug.cgi?id=37556))
* Do not require SeBackupPrivilege in load_registry and unload_registry ([Wine Bug #28729](https://bugs.winehq.org/show_bug.cgi?id=28729))
* Implement marshalling for TKIND_COCLASS ([Wine Bug #19016](https://bugs.winehq.org/show_bug.cgi?id=19016))

2
debian/changelog vendored
View File

@ -13,6 +13,8 @@ wine-staging (1.7.55) UNRELEASED; urgency=low
matching character.
* Added patch to implement marshalling for TKIND_COCLASS.
* Added patch to implement stubless proxies on x86_64.
* Added patch to allow dinput EnumDevices callback with broken calling
convention.
* Remove disabled shell32-Quoted_ShellExecute patchset (bug already fixed and
all tests pass).
* Remove disabled reg-Cleanup patchset (only cleanup and not actively

View File

@ -0,0 +1,62 @@
From 0904e4dd80d07f725dc31c78ffbfaa32b351ad94 Mon Sep 17 00:00:00 2001
From: Andrew Nguyen <arethusa26@gmail.com>
Date: Sun, 15 Nov 2015 07:18:13 +0100
Subject: dinput: Allow EnumDevices callback functions with broken calling
conventions.
---
dlls/dinput/dinput_main.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index aef9d10..1ed1034 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -339,6 +339,26 @@ static DWORD diactionformat_priorityW(LPDIACTIONFORMATW lpdiaf, DWORD genre)
return priorityFlags;
}
+#ifdef __i386__
+extern BOOL CDECL enum_callback_wrapper(void *callback, const void *instance, void *ref);
+__ASM_GLOBAL_FUNC( enum_callback_wrapper,
+ "pushl %ebp\n\t"
+ __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+ __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
+ "movl %esp,%ebp\n\t"
+ __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
+ "pushl 16(%ebp)\n\t"
+ "pushl 12(%ebp)\n\t"
+ "movl 8(%ebp),%eax\n\t"
+ "call *%eax\n\t"
+ "leave\n\t"
+ __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
+ __ASM_CFI(".cfi_same_value %ebp\n\t")
+ "ret" )
+#else
+#define enum_callback_wrapper(callback, instance, ref) (callback)((instance), (ref))
+#endif
+
/******************************************************************************
* IDirectInputA_EnumDevices
*/
@@ -371,7 +391,7 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices(
TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
r = dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->dwVersion, j);
if (r == S_OK)
- if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
+ if (enum_callback_wrapper(lpCallback, &devInstance, pvRef) == DIENUM_STOP)
return S_OK;
}
}
@@ -411,7 +431,7 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
r = dinput_devices[i]->enum_deviceW(dwDevType, dwFlags, &devInstance, This->dwVersion, j);
if (r == S_OK)
- if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
+ if (enum_callback_wrapper(lpCallback, &devInstance, pvRef) == DIENUM_STOP)
return S_OK;
}
}
--
2.6.2

View File

@ -0,0 +1 @@
Fixes: [27664] Allow dinput EnumDevices callback with broken calling convention

View File

@ -126,6 +126,7 @@ patch_enable_all ()
enable_ddraw_Write_Vtable="$1"
enable_ddraw_ZBufferBitDepths="$1"
enable_ddraw_d3d_execute_buffer="$1"
enable_dinput_EnumDevice_Callback="$1"
enable_dinput_Initialize="$1"
enable_dsound_EAX="$1"
enable_dsound_Fast_Mixer="$1"
@ -485,6 +486,9 @@ patch_enable ()
ddraw-d3d_execute_buffer)
enable_ddraw_d3d_execute_buffer="$2"
;;
dinput-EnumDevice_Callback)
enable_dinput_EnumDevice_Callback="$2"
;;
dinput-Initialize)
enable_dinput_Initialize="$2"
;;
@ -2872,6 +2876,21 @@ if test "$enable_ddraw_d3d_execute_buffer" -eq 1; then
) >> "$patchlist"
fi
# Patchset dinput-EnumDevice_Callback
# |
# | This patchset fixes the following Wine bugs:
# | * [#27664] Allow dinput EnumDevices callback with broken calling convention
# |
# | Modified files:
# | * dlls/dinput/dinput_main.c
# |
if test "$enable_dinput_EnumDevice_Callback" -eq 1; then
patch_apply dinput-EnumDevice_Callback/0001-dinput-Allow-EnumDevices-callback-functions-with-bro.patch
(
echo '+ { "Andrew Nguyen", "dinput: Allow EnumDevices callback functions with broken calling conventions.", 1 },';
) >> "$patchlist"
fi
# Patchset dinput-Initialize
# |
# | This patchset fixes the following Wine bugs: