Sebastian Lackner : shlwapi: SHMapHandle should not set error when NULL is passed as hShared.

Alexandre Julliard julliard at winehq.org
Tue Apr 2 16:10:00 CDT 2019


Module: wine
Branch: master
Commit: 7f6e1090817d0897b3ce4c63f6cdae347e9c4f0b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7f6e1090817d0897b3ce4c63f6cdae347e9c4f0b

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Mon Apr  1 13:29:13 2019 +0200

shlwapi: SHMapHandle should not set error when NULL is passed as hShared.

Signed-off-by: Vijay Kiran Kamuju <infyquest at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 4118d4b..657c33f 100644
--- a/dlls/shlwapi/ordinal.c
+++ b/dlls/shlwapi/ordinal.c
@@ -97,6 +97,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 97e4606..6781b09 100644
--- a/dlls/shlwapi/tests/ordinal.c
+++ b/dlls/shlwapi/tests/ordinal.c
@@ -556,7 +556,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);




More information about the wine-cvs mailing list