combase: Move HWND marshalling functions.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-07-28 13:42:23 +03:00 committed by Alexandre Julliard
parent 7d67c412ea
commit e14055ca84
4 changed files with 82 additions and 5 deletions

View File

@ -189,6 +189,10 @@
@ stub HSTRING_UserSize64
@ stub HSTRING_UserUnmarshal
@ stub HSTRING_UserUnmarshal64
@ stdcall HWND_UserFree(ptr ptr)
@ stdcall HWND_UserMarshal(ptr ptr ptr)
@ stdcall HWND_UserSize(ptr long ptr)
@ stdcall HWND_UserUnmarshal(ptr ptr ptr)
@ stub HkOleRegisterObject
@ stdcall IIDFromString(wstr ptr) ole32.IIDFromString
@ stub InternalAppInvokeExceptionFilter

View File

@ -62,6 +62,80 @@ static const char* debugstr_user_flags(ULONG *pFlags)
return wine_dbg_sprintf("MAKELONG(%s, 0x%04x)", loword, HIWORD(*pFlags));
}
static ULONG handle_UserSize(ULONG *pFlags, ULONG StartingSize, HANDLE *handle)
{
if (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE)
{
ERR("can't remote a local handle\n");
RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
return StartingSize;
}
ALIGN_LENGTH(StartingSize, 3);
return StartingSize + sizeof(RemotableHandle);
}
static unsigned char * handle_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
{
RemotableHandle *remhandle;
if (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE)
{
ERR("can't remote a local handle\n");
RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
return pBuffer;
}
ALIGN_POINTER(pBuffer, 3);
remhandle = (RemotableHandle *)pBuffer;
remhandle->fContext = WDT_INPROC_CALL;
remhandle->u.hInproc = (LONG_PTR)*handle;
return pBuffer + sizeof(RemotableHandle);
}
static unsigned char * handle_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
{
RemotableHandle *remhandle;
ALIGN_POINTER(pBuffer, 3);
remhandle = (RemotableHandle *)pBuffer;
if (remhandle->fContext != WDT_INPROC_CALL)
RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
*handle = (HANDLE)(LONG_PTR)remhandle->u.hInproc;
return pBuffer + sizeof(RemotableHandle);
}
static void handle_UserFree(ULONG *pFlags, HANDLE *handle)
{
/* nothing to do */
}
#define IMPL_WIREM_HANDLE(type) \
ULONG __RPC_USER type##_UserSize(ULONG *pFlags, ULONG StartingSize, type *handle) \
{ \
TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, handle); \
return handle_UserSize(pFlags, StartingSize, (HANDLE *)handle); \
} \
\
unsigned char * __RPC_USER type##_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
{ \
TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *handle); \
return handle_UserMarshal(pFlags, pBuffer, (HANDLE *)handle); \
} \
\
unsigned char * __RPC_USER type##_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
{ \
TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, handle); \
return handle_UserUnmarshal(pFlags, pBuffer, (HANDLE *)handle); \
} \
\
void __RPC_USER type##_UserFree(ULONG *pFlags, type *handle) \
{ \
TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *handle); \
handle_UserFree(pFlags, (HANDLE *)handle); \
}
IMPL_WIREM_HANDLE(HWND)
/******************************************************************************
* WdtpInterfacePointer_UserSize (combase.@)
*

View File

@ -167,10 +167,10 @@
@ stdcall HPALETTE_UserMarshal(ptr ptr ptr)
@ stdcall HPALETTE_UserSize(ptr long ptr)
@ stdcall HPALETTE_UserUnmarshal(ptr ptr ptr)
@ stdcall HWND_UserFree(ptr ptr)
@ stdcall HWND_UserMarshal(ptr ptr ptr)
@ stdcall HWND_UserSize(ptr long ptr)
@ stdcall HWND_UserUnmarshal(ptr ptr ptr)
@ stdcall HWND_UserFree(ptr ptr) combase.HWND_UserFree
@ stdcall HWND_UserMarshal(ptr ptr ptr) combase.HWND_UserMarshal
@ stdcall HWND_UserSize(ptr long ptr) combase.HWND_UserSize
@ stdcall HWND_UserUnmarshal(ptr ptr ptr) combase.HWND_UserUnmarshal
@ stdcall IIDFromString(wstr ptr)
@ stub I_RemoteMain
@ stdcall IsAccelerator(long long ptr ptr)

View File

@ -356,7 +356,6 @@ static void handle_UserFree(ULONG *pFlags, HANDLE *handle)
IMPL_WIREM_HANDLE(HACCEL)
IMPL_WIREM_HANDLE(HMENU)
IMPL_WIREM_HANDLE(HWND)
IMPL_WIREM_HANDLE(HDC)
IMPL_WIREM_HANDLE(HICON)
IMPL_WIREM_HANDLE(HBRUSH)