Module: wine
Branch: master
Commit: 6d53f071c6b83375a34c373c84d764c04289852b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6d53f071c6b83375a34c373c8…
Author: Nikolay Sivov <nsivov(a)codeweavers.com>
Date: Mon Jun 15 11:12:42 2015 +0300
ole32: Marshal HICON as remotable handle.
---
dlls/ole32/tests/usrmarshal.c | 36 +++++++++++++++
dlls/ole32/usrmarshal.c | 100 +-----------------------------------------
include/objidl.idl | 10 +++++
3 files changed, 47 insertions(+), 99 deletions(-)
diff --git a/dlls/ole32/tests/usrmarshal.c b/dlls/ole32/tests/usrmarshal.c
index 53cd9fe..6f90c53 100644
--- a/dlls/ole32/tests/usrmarshal.c
+++ b/dlls/ole32/tests/usrmarshal.c
@@ -897,6 +897,41 @@ static void test_marshal_HDC(void)
ReleaseDC(0, hdc);
}
+static void test_marshal_HICON(void)
+{
+ static const BYTE bmp_bits[1024];
+ MIDL_STUB_MESSAGE stub_msg;
+ HICON hIcon, hIcon2;
+ USER_MARSHAL_CB umcb;
+ RPC_MESSAGE rpc_msg;
+ unsigned char *buffer;
+ wireHICON wirehicon;
+ ULONG size;
+
+ hIcon = CreateIcon(0, 16, 16, 1, 1, bmp_bits, bmp_bits);
+ ok(hIcon != 0, "CreateIcon failed\n");
+
+ init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
+ size = HICON_UserSize(&umcb.Flags, 0, &hIcon);
+ ok(size == sizeof(*wirehicon), "Wrong size %d\n", size);
+
+ buffer = HeapAlloc(GetProcessHeap(), 0, size);
+ init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
+ HICON_UserMarshal(&umcb.Flags, buffer, &hIcon);
+ wirehicon = (wireHICON)buffer;
+ ok(wirehicon->fContext == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08x\n", wirehicon->fContext);
+ ok(wirehicon->u.hInproc == (LONG_PTR)hIcon, "Marshaled value should be %p instead of %x\n", hIcon, wirehicon->u.hRemote);
+
+ init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
+ HICON_UserUnmarshal(&umcb.Flags, buffer, &hIcon2);
+ ok(hIcon == hIcon2, "Didn't unmarshal properly\n");
+ HeapFree(GetProcessHeap(), 0, buffer);
+
+ init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
+ HICON_UserFree(&umcb.Flags, &hIcon2);
+ DestroyIcon(hIcon);
+}
+
START_TEST(usrmarshal)
{
CoInitialize(NULL);
@@ -911,6 +946,7 @@ START_TEST(usrmarshal)
test_marshal_STGMEDIUM();
test_marshal_SNB();
test_marshal_HDC();
+ test_marshal_HICON();
CoUninitialize();
}
diff --git a/dlls/ole32/usrmarshal.c b/dlls/ole32/usrmarshal.c
index 8f895f8..89f4f4a 100644
--- a/dlls/ole32/usrmarshal.c
+++ b/dlls/ole32/usrmarshal.c
@@ -342,6 +342,7 @@ IMPL_WIREM_HANDLE(HACCEL)
IMPL_WIREM_HANDLE(HMENU)
IMPL_WIREM_HANDLE(HWND)
IMPL_WIREM_HANDLE(HDC)
+IMPL_WIREM_HANDLE(HICON)
/******************************************************************************
* HGLOBAL_UserSize [OLE32.@]
@@ -662,105 +663,6 @@ void __RPC_USER HBITMAP_UserFree(ULONG *pFlags, HBITMAP *phBmp)
}
/******************************************************************************
- * HICON_UserSize [OLE32.@]
- *
- * Calculates the buffer size required to marshal an icon.
- *
- * PARAMS
- * pFlags [I] Flags. See notes.
- * StartingSize [I] Starting size of the buffer. This value is added on to
- * the buffer size required for the icon.
- * phIcon [I] Icon to size.
- *
- * RETURNS
- * The buffer size required to marshal an icon plus the starting size.
- *
- * NOTES
- * Even though the function is documented to take a pointer to a ULONG in
- * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
- * the first parameter is a ULONG.
- * This function is only intended to be called by the RPC runtime.
- */
-ULONG __RPC_USER HICON_UserSize(ULONG *pFlags, ULONG StartingSize, HICON *phIcon)
-{
- FIXME(":stub\n");
- return StartingSize;
-}
-
-/******************************************************************************
-* HICON_UserMarshal [OLE32.@]
-*
-* Marshals an icon into a buffer.
-*
-* PARAMS
-* pFlags [I] Flags. See notes.
-* pBuffer [I] Buffer to marshal the icon into.
-* phIcon [I] Icon to marshal.
-*
-* RETURNS
-* The end of the marshaled data in the buffer.
-*
-* NOTES
-* Even though the function is documented to take a pointer to a ULONG in
-* pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
-* the first parameter is a ULONG.
-* This function is only intended to be called by the RPC runtime.
-*/
-unsigned char * __RPC_USER HICON_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HICON *phIcon)
-{
- FIXME(":stub\n");
- return pBuffer;
-}
-
-/******************************************************************************
- * HICON_UserUnmarshal [OLE32.@]
- *
- * Unmarshals an icon from a buffer.
- *
- * PARAMS
- * pFlags [I] Flags. See notes.
- * pBuffer [I] Buffer to marshal the icon from.
- * phIcon [O] Address that receive the unmarshaled icon.
- *
- * RETURNS
- * The end of the marshaled data in the buffer.
- *
- * NOTES
- * Even though the function is documented to take a pointer to an ULONG in
- * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
- * the first parameter is an ULONG.
- * This function is only intended to be called by the RPC runtime.
- */
-unsigned char * __RPC_USER HICON_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HICON *phIcon)
-{
- FIXME(":stub\n");
- return pBuffer;
-}
-
-/******************************************************************************
- * HICON_UserFree [OLE32.@]
- *
- * Frees an unmarshaled icon.
- *
- * PARAMS
- * pFlags [I] Flags. See notes.
- * phIcon [I] Icon to free.
- *
- * RETURNS
- * The end of the marshaled data in the buffer.
- *
- * NOTES
- * Even though the function is documented to take a pointer to a ULONG in
- * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
- * which the first parameter is a ULONG.
- * This function is only intended to be called by the RPC runtime.
- */
-void __RPC_USER HICON_UserFree(ULONG *pFlags, HICON *phIcon)
-{
- FIXME(":stub\n");
-}
-
-/******************************************************************************
* HPALETTE_UserSize [OLE32.@]
*
* Calculates the buffer size required to marshal a palette.
diff --git a/include/objidl.idl b/include/objidl.idl
index ecae70e..c18442f 100644
--- a/include/objidl.idl
+++ b/include/objidl.idl
@@ -2441,6 +2441,16 @@ interface IGlobalOptions : IUnknown
HRESULT Query([in] GLOBALOPT_PROPERTIES property, [out ] ULONG_PTR *value);
}
+[
+ object,
+ pointer_default(unique),
+ uuid(947990de-cc28-11d2-a0f7-00805f858fb1)
+]
+interface IDummyHICONIncluder : IUnknown
+{
+ HRESULT Dummy([in] HICON hIcon, [in] HDC hdc);
+}
+
cpp_quote("#ifdef USE_COM_CONTEXT_DEF")
typedef DWORD CPFLAGS;
Module: wine
Branch: master
Commit: 815197f28caa9683838a97621680b1411122cb35
URL: http://source.winehq.org/git/wine.git/?a=commit;h=815197f28caa9683838a97621…
Author: Nikolay Sivov <nsivov(a)codeweavers.com>
Date: Mon Jun 15 11:10:33 2015 +0300
ole32: Marshal HDC as remotable handle.
---
dlls/ole32/tests/usrmarshal.c | 32 ++++++++++++++
dlls/ole32/usrmarshal.c | 100 +-----------------------------------------
2 files changed, 33 insertions(+), 99 deletions(-)
diff --git a/dlls/ole32/tests/usrmarshal.c b/dlls/ole32/tests/usrmarshal.c
index 83dedc7..53cd9fe 100644
--- a/dlls/ole32/tests/usrmarshal.c
+++ b/dlls/ole32/tests/usrmarshal.c
@@ -866,6 +866,37 @@ static void test_marshal_SNB(void)
g_expect_user_free = FALSE;
}
+static void test_marshal_HDC(void)
+{
+ MIDL_STUB_MESSAGE stub_msg;
+ HDC hdc = GetDC(0), hdc2;
+ USER_MARSHAL_CB umcb;
+ RPC_MESSAGE rpc_msg;
+ unsigned char *buffer;
+ wireHDC wirehdc;
+ ULONG size;
+
+ init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
+ size = HDC_UserSize(&umcb.Flags, 0, &hdc);
+ ok(size == sizeof(*wirehdc), "Wrong size %d\n", size);
+
+ buffer = HeapAlloc(GetProcessHeap(), 0, size);
+ init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
+ HDC_UserMarshal(&umcb.Flags, buffer, &hdc);
+ wirehdc = (wireHDC)buffer;
+ ok(wirehdc->fContext == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08x\n", wirehdc->fContext);
+ ok(wirehdc->u.hInproc == (LONG_PTR)hdc, "Marshaled value should be %p instead of %x\n", hdc, wirehdc->u.hRemote);
+
+ init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
+ HDC_UserUnmarshal(&umcb.Flags, buffer, &hdc2);
+ ok(hdc == hdc2, "Didn't unmarshal properly\n");
+ HeapFree(GetProcessHeap(), 0, buffer);
+
+ init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
+ HDC_UserFree(&umcb.Flags, &hdc2);
+ ReleaseDC(0, hdc);
+}
+
START_TEST(usrmarshal)
{
CoInitialize(NULL);
@@ -879,6 +910,7 @@ START_TEST(usrmarshal)
test_marshal_WdtpInterfacePointer();
test_marshal_STGMEDIUM();
test_marshal_SNB();
+ test_marshal_HDC();
CoUninitialize();
}
diff --git a/dlls/ole32/usrmarshal.c b/dlls/ole32/usrmarshal.c
index d22f9f7..8f895f8 100644
--- a/dlls/ole32/usrmarshal.c
+++ b/dlls/ole32/usrmarshal.c
@@ -341,6 +341,7 @@ static void handle_UserFree(ULONG *pFlags, HANDLE *phMenu)
IMPL_WIREM_HANDLE(HACCEL)
IMPL_WIREM_HANDLE(HMENU)
IMPL_WIREM_HANDLE(HWND)
+IMPL_WIREM_HANDLE(HDC)
/******************************************************************************
* HGLOBAL_UserSize [OLE32.@]
@@ -760,105 +761,6 @@ void __RPC_USER HICON_UserFree(ULONG *pFlags, HICON *phIcon)
}
/******************************************************************************
- * HDC_UserSize [OLE32.@]
- *
- * Calculates the buffer size required to marshal an HDC.
- *
- * PARAMS
- * pFlags [I] Flags. See notes.
- * StartingSize [I] Starting size of the buffer. This value is added on to
- * the buffer size required for the clip format.
- * phGlobal [I] HDC to size.
- *
- * RETURNS
- * The buffer size required to marshal an HDC plus the starting size.
- *
- * NOTES
- * Even though the function is documented to take a pointer to a ULONG in
- * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
- * the first parameter is a ULONG.
- * This function is only intended to be called by the RPC runtime.
- */
-ULONG __RPC_USER HDC_UserSize(ULONG *pFlags, ULONG StartingSize, HDC *phdc)
-{
- FIXME(":stub\n");
- return StartingSize;
-}
-
-/******************************************************************************
- * HDC_UserMarshal [OLE32.@]
- *
- * Marshals an HDC into a buffer.
- *
- * PARAMS
- * pFlags [I] Flags. See notes.
- * pBuffer [I] Buffer to marshal the clip format into.
- * phdc [I] HDC to marshal.
- *
- * RETURNS
- * The end of the marshaled data in the buffer.
- *
- * NOTES
- * Even though the function is documented to take a pointer to a ULONG in
- * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
- * the first parameter is a ULONG.
- * This function is only intended to be called by the RPC runtime.
- */
-unsigned char * __RPC_USER HDC_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HDC *phdc)
-{
- FIXME(":stub\n");
- return pBuffer;
-}
-
-/******************************************************************************
- * HDC_UserUnmarshal [OLE32.@]
- *
- * Unmarshals an HDC from a buffer.
- *
- * PARAMS
- * pFlags [I] Flags. See notes.
- * pBuffer [I] Buffer to marshal the clip format from.
- * phdc [O] Address that receive the unmarshaled HDC.
- *
- * RETURNS
- * The end of the marshaled data in the buffer.
- *
- * NOTES
- * Even though the function is documented to take a pointer to an ULONG in
- * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
- * the first parameter is an ULONG.
- * This function is only intended to be called by the RPC runtime.
- */
-unsigned char * __RPC_USER HDC_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HDC *phdc)
-{
- FIXME(":stub\n");
- return pBuffer;
-}
-
-/******************************************************************************
- * HDC_UserFree [OLE32.@]
- *
- * Frees an unmarshaled HDC.
- *
- * PARAMS
- * pFlags [I] Flags. See notes.
- * phdc [I] HDC to free.
- *
- * RETURNS
- * The end of the marshaled data in the buffer.
- *
- * NOTES
- * Even though the function is documented to take a pointer to a ULONG in
- * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
- * which the first parameter is a ULONG.
- * This function is only intended to be called by the RPC runtime.
- */
-void __RPC_USER HDC_UserFree(ULONG *pFlags, HDC *phdc)
-{
- FIXME(":stub\n");
-}
-
-/******************************************************************************
* HPALETTE_UserSize [OLE32.@]
*
* Calculates the buffer size required to marshal a palette.