Author: tfaber
Date: Fri Oct 3 18:42:20 2014
New Revision: 64509
URL:
http://svn.reactos.org/svn/reactos?rev=64509&view=rev
Log:
[SHLWAPI]
- Merge Sebastian Lackner's SH*Shared/SHMapHandle fixes (Wine commits 5e4f15db,
c95b182d, 403ff373)
CORE-8563 #resolve
Modified:
trunk/reactos/dll/win32/shlwapi/ordinal.c
Modified: trunk/reactos/dll/win32/shlwapi/ordinal.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/ordinal.…
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/ordinal.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/ordinal.c [iso-8859-1] Fri Oct 3 18:42:20 2014
@@ -52,13 +52,24 @@
*/
/*************************************************************************
- * SHLWAPI_DupSharedHandle
- *
- * Internal implementation of SHLWAPI_11.
- */
-static HANDLE SHLWAPI_DupSharedHandle(HANDLE hShared, DWORD dwDstProcId,
- DWORD dwSrcProcId, DWORD dwAccess,
- DWORD dwOptions)
+ * @ [SHLWAPI.11]
+ *
+ * Copy a sharable memory handle from one process to another.
+ *
+ * PARAMS
+ * hShared [I] Shared memory handle to duplicate
+ * dwSrcProcId [I] ID of the process owning hShared
+ * dwDstProcId [I] ID of the process wanting the duplicated handle
+ * dwAccess [I] Desired DuplicateHandle() access
+ * dwOptions [I] Desired DuplicateHandle() options
+ *
+ * RETURNS
+ * Success: A handle suitable for use by the dwDstProcId process.
+ * Failure: A NULL handle.
+ *
+ */
+HANDLE WINAPI SHMapHandle(HANDLE hShared, DWORD dwSrcProcId, DWORD dwDstProcId,
+ DWORD dwAccess, DWORD dwOptions)
{
HANDLE hDst, hSrc;
DWORD dwMyProcId = GetCurrentProcessId();
@@ -84,7 +95,7 @@
if (hSrc)
{
/* Make handle available to dest process */
- if (!DuplicateHandle(hDst, hShared, hSrc, &hRet,
+ if (!DuplicateHandle(hSrc, hShared, hDst, &hRet,
dwAccess, 0, dwOptions | DUPLICATE_SAME_ACCESS))
hRet = NULL;
@@ -148,9 +159,8 @@
/* Release view. All further views mapped will be opaque */
UnmapViewOfFile(pMapped);
- hRet = SHLWAPI_DupSharedHandle(hMap, dwProcId,
- GetCurrentProcessId(), FILE_MAP_ALL_ACCESS,
- DUPLICATE_SAME_ACCESS);
+ hRet = SHMapHandle(hMap, GetCurrentProcessId(), dwProcId,
+ FILE_MAP_ALL_ACCESS, DUPLICATE_SAME_ACCESS);
}
CloseHandle(hMap);
@@ -179,8 +189,8 @@
TRACE("(%p %d)\n", hShared, dwProcId);
/* Get handle to shared memory for current process */
- hDup = SHLWAPI_DupSharedHandle(hShared, dwProcId, GetCurrentProcessId(),
- FILE_MAP_ALL_ACCESS, 0);
+ hDup = SHMapHandle(hShared, dwProcId, GetCurrentProcessId(), FILE_MAP_ALL_ACCESS, 0);
+
/* Get View */
pMapped = MapViewOfFile(hDup, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
CloseHandle(hDup);
@@ -230,37 +240,10 @@
TRACE("(%p %d)\n", hShared, dwProcId);
/* Get a copy of the handle for our process, closing the source handle */
- hClose = SHLWAPI_DupSharedHandle(hShared, dwProcId, GetCurrentProcessId(),
- FILE_MAP_ALL_ACCESS,DUPLICATE_CLOSE_SOURCE);
+ hClose = SHMapHandle(hShared, dwProcId, GetCurrentProcessId(),
+ FILE_MAP_ALL_ACCESS,DUPLICATE_CLOSE_SOURCE);
/* Close local copy */
return CloseHandle(hClose);
-}
-
-/*************************************************************************
- * @ [SHLWAPI.11]
- *
- * Copy a sharable memory handle from one process to another.
- *
- * PARAMS
- * hShared [I] Shared memory handle to duplicate
- * dwDstProcId [I] ID of the process wanting the duplicated handle
- * dwSrcProcId [I] ID of the process owning hShared
- * dwAccess [I] Desired DuplicateHandle() access
- * dwOptions [I] Desired DuplicateHandle() options
- *
- * RETURNS
- * Success: A handle suitable for use by the dwDstProcId process.
- * Failure: A NULL handle.
- *
- */
-HANDLE WINAPI SHMapHandle(HANDLE hShared, DWORD dwDstProcId, DWORD dwSrcProcId,
- DWORD dwAccess, DWORD dwOptions)
-{
- HANDLE hRet;
-
- hRet = SHLWAPI_DupSharedHandle(hShared, dwDstProcId, dwSrcProcId,
- dwAccess, dwOptions);
- return hRet;
}
/*************************************************************************