Added patch to avoid setting error when NULL is passed to SHMapHandle.

This commit is contained in:
Sebastian Lackner 2015-12-27 18:46:56 +01:00
parent f291e6b294
commit b9c5736515
6 changed files with 100 additions and 1 deletions

View File

@ -34,9 +34,10 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [2]:**
**Bug fixes and features included in the next upcoming release [3]:**
* Avoid corruption of caret when SetCaretPos() is called
* SHMapHandle should not set error when NULL is passed as hShared
* SysAllocStringByteLen should align terminating null WCHAR

View File

@ -276,6 +276,7 @@ patch_enable_all ()
enable_shell32_SHFileOperation_Win9x="$1"
enable_shell32_UnixFS="$1"
enable_shlwapi_AssocGetPerceivedType="$1"
enable_shlwapi_SHMapHandle="$1"
enable_shlwapi_UrlCombine="$1"
enable_user32_DeferWindowPos="$1"
enable_user32_Dialog_Paint_Event="$1"
@ -939,6 +940,9 @@ patch_enable ()
shlwapi-AssocGetPerceivedType)
enable_shlwapi_AssocGetPerceivedType="$2"
;;
shlwapi-SHMapHandle)
enable_shlwapi_SHMapHandle="$2"
;;
shlwapi-UrlCombine)
enable_shlwapi_UrlCombine="$2"
;;
@ -5459,6 +5463,20 @@ if test "$enable_shlwapi_AssocGetPerceivedType" -eq 1; then
) >> "$patchlist"
fi
# Patchset shlwapi-SHMapHandle
# |
# | Modified files:
# | * dlls/shlwapi/ordinal.c, dlls/shlwapi/tests/ordinal.c
# |
if test "$enable_shlwapi_SHMapHandle" -eq 1; then
patch_apply shlwapi-SHMapHandle/0001-shlwapi-tests-Test-NULL-handle-duplication-in-SHMapH.patch
patch_apply shlwapi-SHMapHandle/0002-shlwapi-SHMapHandle-should-not-set-error-when-NULL-i.patch
(
echo '+ { "Bruno Jesus", "shlwapi/tests: Test NULL handle duplication in SHMapHandle().", 1 },';
echo '+ { "Sebastian Lackner", "shlwapi: SHMapHandle should not set error when NULL is passed as hShared.", 1 },';
) >> "$patchlist"
fi
# Patchset shlwapi-UrlCombine
# |
# | Modified files:

View File

@ -0,0 +1,35 @@
From 8a51e9551f4dcb89ec57a713f9ee153fc961a64d Mon Sep 17 00:00:00 2001
From: Bruno Jesus <00cpxxx@gmail.com>
Date: Tue, 1 Dec 2015 19:51:20 +0800
Subject: shlwapi/tests: Test NULL handle duplication in SHMapHandle()
Related to https://bugs.winehq.org/show_bug.cgi?id=36838
Not sure when Olivier Dierick will be back to this so I'm sending the
test I made.
Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
---
dlls/shlwapi/tests/ordinal.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/shlwapi/tests/ordinal.c b/dlls/shlwapi/tests/ordinal.c
index bd3d46a..df07df4 100644
--- a/dlls/shlwapi/tests/ordinal.c
+++ b/dlls/shlwapi/tests/ordinal.c
@@ -550,6 +550,12 @@ static void test_alloc_shared_remote(DWORD procid, HANDLE hmem)
ok(ret, "SHUnlockShared failed: %u\n", GetLastError());
/* test SHMapHandle */
+ SetLastError(0xdeadbeef);
+ hmem2 = pSHMapHandle(NULL, procid, GetCurrentProcessId(), 0, 0);
+ ok(hmem2 == NULL, "expected NULL, got new handle\n");
+todo_wine
+ ok(GetLastError() == 0xdeadbeef, "last error should not have changed, got %u\n", GetLastError());
+
hmem2 = pSHMapHandle(hmem, procid, GetCurrentProcessId(), 0, 0);
/* It seems like Windows Vista/2008 uses a different internal implementation
--
2.6.4

View File

@ -0,0 +1,43 @@
From b1f09e2b10f9a763e3683b561b211414af6f11fb Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 27 Dec 2015 18:45:11 +0100
Subject: shlwapi: SHMapHandle should not set error when NULL is passed as
hShared.
---
dlls/shlwapi/ordinal.c | 6 ++++++
dlls/shlwapi/tests/ordinal.c | 1 -
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c
index 699fcc6..7832036 100644
--- a/dlls/shlwapi/ordinal.c
+++ b/dlls/shlwapi/ordinal.c
@@ -98,6 +98,12 @@ HANDLE WINAPI SHMapHandle(HANDLE hShared, DWORD dwSrcProcId, DWORD dwDstProcId,
TRACE("(%p,%d,%d,%08x,%08x)\n", hShared, dwDstProcId, dwSrcProcId,
dwAccess, dwOptions);
+ if (!hShared)
+ {
+ TRACE("Returning handle NULL\n");
+ return NULL;
+ }
+
/* Get dest process handle */
if (dwDstProcId == dwMyProcId)
hDst = GetCurrentProcess();
diff --git a/dlls/shlwapi/tests/ordinal.c b/dlls/shlwapi/tests/ordinal.c
index df07df4..d0f7b56 100644
--- a/dlls/shlwapi/tests/ordinal.c
+++ b/dlls/shlwapi/tests/ordinal.c
@@ -553,7 +553,6 @@ static void test_alloc_shared_remote(DWORD procid, HANDLE hmem)
SetLastError(0xdeadbeef);
hmem2 = pSHMapHandle(NULL, procid, GetCurrentProcessId(), 0, 0);
ok(hmem2 == NULL, "expected NULL, got new handle\n");
-todo_wine
ok(GetLastError() == 0xdeadbeef, "last error should not have changed, got %u\n", GetLastError());
hmem2 = pSHMapHandle(hmem, procid, GetCurrentProcessId(), 0, 0);
--
2.6.4

View File

@ -0,0 +1 @@
Fixes: SHMapHandle should not set error when NULL is passed as hShared

View File

@ -1,6 +1,7 @@
wine-staging (1.9.0) UNRELEASED; urgency=low
* Added patch to align terminating null WCHAR in SysAllocStringByteLen.
* Added patch to avoid corruption of caret when SetCaretPos() is called.
* Added patch to avoid setting error when NULL is passed to SHMapHandle.
* Removed patch to add a stub driver for tdi.sys (accepted upstream).
* Removed patch to implement support for ws2_32.dll.WSAPoll (accepted
upstream).