ole32: Initialise more of the context passed into user marshaling functions in the tests for these functions.
This commit is contained in:
parent
d3085abc08
commit
712e33e669
|
@ -44,6 +44,37 @@ unsigned char * __RPC_USER HMETAFILEPICT_UserMarshal (ULONG *, unsigned char *,
|
|||
unsigned char * __RPC_USER HMETAFILEPICT_UserUnmarshal(ULONG *, unsigned char *, HMETAFILEPICT *);
|
||||
void __RPC_USER HMETAFILEPICT_UserFree(ULONG *, HMETAFILEPICT *);
|
||||
|
||||
static void * WINAPI user_allocate(SIZE_T size)
|
||||
{
|
||||
return CoTaskMemAlloc(size);
|
||||
}
|
||||
|
||||
static void WINAPI user_free(void *p)
|
||||
{
|
||||
CoTaskMemFree(p);
|
||||
}
|
||||
|
||||
static void init_user_marshal_cb(USER_MARSHAL_CB *umcb,
|
||||
PMIDL_STUB_MESSAGE stub_msg,
|
||||
PRPC_MESSAGE rpc_msg, unsigned char *buffer,
|
||||
unsigned int size, MSHCTX context)
|
||||
{
|
||||
memset(rpc_msg, 0, sizeof(*rpc_msg));
|
||||
rpc_msg->Buffer = buffer;
|
||||
rpc_msg->BufferLength = size;
|
||||
|
||||
memset(stub_msg, 0, sizeof(*stub_msg));
|
||||
stub_msg->RpcMsg = rpc_msg;
|
||||
stub_msg->Buffer = buffer;
|
||||
stub_msg->pfnAllocate = user_allocate;
|
||||
stub_msg->pfnFree = user_free;
|
||||
|
||||
memset(umcb, 0, sizeof(*umcb));
|
||||
umcb->Flags = MAKELONG(context, NDR_LOCAL_DATA_REPRESENTATION);
|
||||
umcb->pStubMsg = stub_msg;
|
||||
umcb->Signature = USER_MARSHAL_CB_SIGNATURE;
|
||||
umcb->CBType = buffer ? USER_MARSHAL_CB_UNMARSHALL : USER_MARSHAL_CB_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
static const char cf_marshaled[] =
|
||||
{
|
||||
|
@ -59,94 +90,112 @@ static const char cf_marshaled[] =
|
|||
|
||||
static void test_marshal_CLIPFORMAT(void)
|
||||
{
|
||||
USER_MARSHAL_CB umcb;
|
||||
MIDL_STUB_MESSAGE stub_msg;
|
||||
RPC_MESSAGE rpc_msg;
|
||||
unsigned char *buffer;
|
||||
ULONG size;
|
||||
ULONG flags = MAKELONG(MSHCTX_DIFFERENTMACHINE, NDR_LOCAL_DATA_REPRESENTATION);
|
||||
wireCLIPFORMAT wirecf;
|
||||
CLIPFORMAT cf = RegisterClipboardFormatA("MyFormat");
|
||||
CLIPFORMAT cf2;
|
||||
|
||||
size = CLIPFORMAT_UserSize(&flags, 0, &cf);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = CLIPFORMAT_UserSize(&umcb.Flags, 0, &cf);
|
||||
ok(size == sizeof(*wirecf) + sizeof(cf_marshaled), "Wrong size %d\n", size);
|
||||
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
CLIPFORMAT_UserMarshal(&flags, buffer, &cf);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
CLIPFORMAT_UserMarshal(&umcb.Flags, buffer, &cf);
|
||||
wirecf = (wireCLIPFORMAT)buffer;
|
||||
ok(wirecf->fContext == WDT_REMOTE_CALL, "Context should be WDT_REMOTE_CALL instead of 0x%08lx\n", wirecf->fContext);
|
||||
ok(wirecf->u.dwValue == cf, "Marshaled value should be 0x%04x instead of 0x%04x\n", cf, wirecf->u.dwValue);
|
||||
ok(!memcmp(wirecf+1, cf_marshaled, sizeof(cf_marshaled)), "Marshaled data differs\n");
|
||||
|
||||
CLIPFORMAT_UserUnmarshal(&flags, buffer, &cf2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
CLIPFORMAT_UserUnmarshal(&umcb.Flags, buffer, &cf2);
|
||||
ok(cf == cf2, "Didn't unmarshal properly\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
|
||||
CLIPFORMAT_UserFree(&flags, &cf2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
CLIPFORMAT_UserFree(&umcb.Flags, &cf2);
|
||||
}
|
||||
|
||||
static void test_marshal_HWND(void)
|
||||
{
|
||||
USER_MARSHAL_CB umcb;
|
||||
MIDL_STUB_MESSAGE stub_msg;
|
||||
RPC_MESSAGE rpc_msg;
|
||||
unsigned char *buffer;
|
||||
ULONG size;
|
||||
ULONG flags = MAKELONG(MSHCTX_LOCAL, NDR_LOCAL_DATA_REPRESENTATION);
|
||||
HWND hwnd = GetDesktopWindow();
|
||||
HWND hwnd2;
|
||||
wireHWND wirehwnd;
|
||||
|
||||
size = HWND_UserSize(&flags, 0, &hwnd);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
|
||||
size = HWND_UserSize(&umcb.Flags, 0, &hwnd);
|
||||
ok(size == sizeof(*wirehwnd), "Wrong size %d\n", size);
|
||||
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
HWND_UserMarshal(&flags, buffer, &hwnd);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
|
||||
HWND_UserMarshal(&umcb.Flags, buffer, &hwnd);
|
||||
wirehwnd = (wireHWND)buffer;
|
||||
ok(wirehwnd->fContext == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08lx\n", wirehwnd->fContext);
|
||||
ok(wirehwnd->u.hInproc == (LONG_PTR)hwnd, "Marshaled value should be %p instead of %p\n", hwnd, (HANDLE)wirehwnd->u.hRemote);
|
||||
|
||||
HWND_UserUnmarshal(&flags, buffer, &hwnd2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
|
||||
HWND_UserUnmarshal(&umcb.Flags, buffer, &hwnd2);
|
||||
ok(hwnd == hwnd2, "Didn't unmarshal properly\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
|
||||
HWND_UserFree(&flags, &hwnd2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
|
||||
HWND_UserFree(&umcb.Flags, &hwnd2);
|
||||
}
|
||||
|
||||
static void test_marshal_HGLOBAL(void)
|
||||
{
|
||||
USER_MARSHAL_CB umcb;
|
||||
MIDL_STUB_MESSAGE stub_msg;
|
||||
RPC_MESSAGE rpc_msg;
|
||||
unsigned char *buffer;
|
||||
ULONG size;
|
||||
ULONG flags = MAKELONG(MSHCTX_LOCAL, NDR_LOCAL_DATA_REPRESENTATION);
|
||||
HGLOBAL hglobal;
|
||||
HGLOBAL hglobal2;
|
||||
unsigned char *wirehglobal;
|
||||
int i;
|
||||
|
||||
hglobal = NULL;
|
||||
flags = MAKELONG(MSHCTX_LOCAL, NDR_LOCAL_DATA_REPRESENTATION);
|
||||
size = HGLOBAL_UserSize(&flags, 0, &hglobal);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
|
||||
size = HGLOBAL_UserSize(&umcb.Flags, 0, &hglobal);
|
||||
/* native is poorly programmed and allocates 4 bytes more than it needs to
|
||||
* here - Wine doesn't have to emulate that */
|
||||
ok((size == 8) || (size == 12), "Size should be 12, instead of %d\n", size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
HGLOBAL_UserMarshal(&flags, buffer, &hglobal);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
|
||||
HGLOBAL_UserMarshal(&umcb.Flags, buffer, &hglobal);
|
||||
wirehglobal = buffer;
|
||||
ok(*(ULONG *)wirehglobal == WDT_REMOTE_CALL, "Context should be WDT_REMOTE_CALL instead of 0x%08x\n", *(ULONG *)wirehglobal);
|
||||
wirehglobal += sizeof(ULONG);
|
||||
ok(*(ULONG *)wirehglobal == (ULONG)hglobal, "buffer+4 should be HGLOBAL\n");
|
||||
HGLOBAL_UserUnmarshal(&flags, buffer, &hglobal2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
|
||||
HGLOBAL_UserUnmarshal(&umcb.Flags, buffer, &hglobal2);
|
||||
ok(hglobal2 == hglobal, "Didn't unmarshal properly\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
HGLOBAL_UserFree(&flags, &hglobal2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
|
||||
HGLOBAL_UserFree(&umcb.Flags, &hglobal2);
|
||||
|
||||
hglobal = GlobalAlloc(0, 4);
|
||||
buffer = GlobalLock(hglobal);
|
||||
for (i = 0; i < 4; i++)
|
||||
buffer[i] = i;
|
||||
GlobalUnlock(hglobal);
|
||||
flags = MAKELONG(MSHCTX_LOCAL, NDR_LOCAL_DATA_REPRESENTATION);
|
||||
size = HGLOBAL_UserSize(&flags, 0, &hglobal);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
|
||||
size = HGLOBAL_UserSize(&umcb.Flags, 0, &hglobal);
|
||||
/* native is poorly programmed and allocates 4 bytes more than it needs to
|
||||
* here - Wine doesn't have to emulate that */
|
||||
ok((size == 24) || (size == 28), "Size should be 24 or 28, instead of %d\n", size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
HGLOBAL_UserMarshal(&flags, buffer, &hglobal);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
|
||||
HGLOBAL_UserMarshal(&umcb.Flags, buffer, &hglobal);
|
||||
wirehglobal = buffer;
|
||||
ok(*(ULONG *)wirehglobal == WDT_REMOTE_CALL, "Context should be WDT_REMOTE_CALL instead of 0x%08x\n", *(ULONG *)wirehglobal);
|
||||
wirehglobal += sizeof(ULONG);
|
||||
|
@ -160,10 +209,12 @@ static void test_marshal_HGLOBAL(void)
|
|||
wirehglobal += sizeof(ULONG);
|
||||
for (i = 0; i < 4; i++)
|
||||
ok(wirehglobal[i] == i, "buffer+0x%x should be %d\n", 0x10 + i, i);
|
||||
HGLOBAL_UserUnmarshal(&flags, buffer, &hglobal2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
|
||||
HGLOBAL_UserUnmarshal(&umcb.Flags, buffer, &hglobal2);
|
||||
ok(hglobal2 != NULL, "Didn't unmarshal properly\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
HGLOBAL_UserFree(&flags, &hglobal2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
|
||||
HGLOBAL_UserFree(&umcb.Flags, &hglobal2);
|
||||
GlobalFree(hglobal);
|
||||
}
|
||||
|
||||
|
@ -177,19 +228,23 @@ static HENHMETAFILE create_emf(void)
|
|||
|
||||
static void test_marshal_HENHMETAFILE(void)
|
||||
{
|
||||
USER_MARSHAL_CB umcb;
|
||||
MIDL_STUB_MESSAGE stub_msg;
|
||||
RPC_MESSAGE rpc_msg;
|
||||
unsigned char *buffer;
|
||||
ULONG size;
|
||||
ULONG flags = MAKELONG(MSHCTX_DIFFERENTMACHINE, NDR_LOCAL_DATA_REPRESENTATION);
|
||||
HENHMETAFILE hemf;
|
||||
HENHMETAFILE hemf2 = NULL;
|
||||
unsigned char *wirehemf;
|
||||
|
||||
hemf = create_emf();
|
||||
|
||||
size = HENHMETAFILE_UserSize(&flags, 0, &hemf);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = HENHMETAFILE_UserSize(&umcb.Flags, 0, &hemf);
|
||||
ok(size > 20, "size should be at least 20 bytes, not %d\n", size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
HENHMETAFILE_UserMarshal(&flags, buffer, &hemf);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
HENHMETAFILE_UserMarshal(&umcb.Flags, buffer, &hemf);
|
||||
wirehemf = buffer;
|
||||
ok(*(DWORD *)wirehemf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehemf);
|
||||
wirehemf += sizeof(DWORD);
|
||||
|
@ -204,29 +259,35 @@ static void test_marshal_HENHMETAFILE(void)
|
|||
/* ... rest of data not tested - refer to tests for GetEnhMetaFileBits
|
||||
* at this point */
|
||||
|
||||
HENHMETAFILE_UserUnmarshal(&flags, buffer, &hemf2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
HENHMETAFILE_UserUnmarshal(&umcb.Flags, buffer, &hemf2);
|
||||
ok(hemf2 != NULL, "HENHMETAFILE didn't unmarshal\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
HENHMETAFILE_UserFree(&flags, &hemf2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
HENHMETAFILE_UserFree(&umcb.Flags, &hemf2);
|
||||
DeleteEnhMetaFile(hemf);
|
||||
|
||||
/* test NULL emf */
|
||||
hemf = NULL;
|
||||
|
||||
size = HENHMETAFILE_UserSize(&flags, 0, &hemf);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = HENHMETAFILE_UserSize(&umcb.Flags, 0, &hemf);
|
||||
ok(size == 8, "size should be 8 bytes, not %d\n", size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
HENHMETAFILE_UserMarshal(&flags, buffer, &hemf);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
HENHMETAFILE_UserMarshal(&umcb.Flags, buffer, &hemf);
|
||||
wirehemf = buffer;
|
||||
ok(*(DWORD *)wirehemf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehemf);
|
||||
wirehemf += sizeof(DWORD);
|
||||
ok(*(DWORD *)wirehemf == (DWORD)(DWORD_PTR)hemf, "wirestgm + 0x4 should be hemf instead of 0x%08x\n", *(DWORD *)wirehemf);
|
||||
wirehemf += sizeof(DWORD);
|
||||
|
||||
HENHMETAFILE_UserUnmarshal(&flags, buffer, &hemf2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
HENHMETAFILE_UserUnmarshal(&umcb.Flags, buffer, &hemf2);
|
||||
ok(hemf2 == NULL, "NULL HENHMETAFILE didn't unmarshal\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
HENHMETAFILE_UserFree(&flags, &hemf2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
HENHMETAFILE_UserFree(&umcb.Flags, &hemf2);
|
||||
}
|
||||
|
||||
static HMETAFILE create_mf(void)
|
||||
|
@ -239,19 +300,23 @@ static HMETAFILE create_mf(void)
|
|||
|
||||
static void test_marshal_HMETAFILE(void)
|
||||
{
|
||||
USER_MARSHAL_CB umcb;
|
||||
MIDL_STUB_MESSAGE stub_msg;
|
||||
RPC_MESSAGE rpc_msg;
|
||||
unsigned char *buffer;
|
||||
ULONG size;
|
||||
ULONG flags = MAKELONG(MSHCTX_DIFFERENTMACHINE, NDR_LOCAL_DATA_REPRESENTATION);
|
||||
HMETAFILE hmf;
|
||||
HMETAFILE hmf2 = NULL;
|
||||
unsigned char *wirehmf;
|
||||
|
||||
hmf = create_mf();
|
||||
|
||||
size = HMETAFILE_UserSize(&flags, 0, &hmf);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = HMETAFILE_UserSize(&umcb.Flags, 0, &hmf);
|
||||
ok(size > 20, "size should be at least 20 bytes, not %d\n", size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
HMETAFILE_UserMarshal(&flags, buffer, &hmf);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
HMETAFILE_UserMarshal(&umcb.Flags, buffer, &hmf);
|
||||
wirehmf = buffer;
|
||||
ok(*(DWORD *)wirehmf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehmf);
|
||||
wirehmf += sizeof(DWORD);
|
||||
|
@ -266,29 +331,32 @@ static void test_marshal_HMETAFILE(void)
|
|||
/* ... rest of data not tested - refer to tests for GetMetaFileBits
|
||||
* at this point */
|
||||
|
||||
HMETAFILE_UserUnmarshal(&flags, buffer, &hmf2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
HMETAFILE_UserUnmarshal(&umcb.Flags, buffer, &hmf2);
|
||||
ok(hmf2 != NULL, "HMETAFILE didn't unmarshal\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
HMETAFILE_UserFree(&flags, &hmf2);
|
||||
HMETAFILE_UserFree(&umcb.Flags, &hmf2);
|
||||
DeleteMetaFile(hmf);
|
||||
|
||||
/* test NULL emf */
|
||||
hmf = NULL;
|
||||
|
||||
size = HMETAFILE_UserSize(&flags, 0, &hmf);
|
||||
size = HMETAFILE_UserSize(&umcb.Flags, 0, &hmf);
|
||||
ok(size == 8, "size should be 8 bytes, not %d\n", size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
HMETAFILE_UserMarshal(&flags, buffer, &hmf);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
HMETAFILE_UserMarshal(&umcb.Flags, buffer, &hmf);
|
||||
wirehmf = buffer;
|
||||
ok(*(DWORD *)wirehmf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehmf);
|
||||
wirehmf += sizeof(DWORD);
|
||||
ok(*(DWORD *)wirehmf == (DWORD)(DWORD_PTR)hmf, "wirestgm + 0x4 should be hmf instead of 0x%08x\n", *(DWORD *)wirehmf);
|
||||
wirehmf += sizeof(DWORD);
|
||||
|
||||
HMETAFILE_UserUnmarshal(&flags, buffer, &hmf2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
HMETAFILE_UserUnmarshal(&umcb.Flags, buffer, &hmf2);
|
||||
ok(hmf2 == NULL, "NULL HMETAFILE didn't unmarshal\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
HMETAFILE_UserFree(&flags, &hmf2);
|
||||
HMETAFILE_UserFree(&umcb.Flags, &hmf2);
|
||||
}
|
||||
|
||||
#define USER_MARSHAL_PTR_PREFIX \
|
||||
|
@ -297,9 +365,11 @@ static void test_marshal_HMETAFILE(void)
|
|||
|
||||
static void test_marshal_HMETAFILEPICT(void)
|
||||
{
|
||||
USER_MARSHAL_CB umcb;
|
||||
MIDL_STUB_MESSAGE stub_msg;
|
||||
RPC_MESSAGE rpc_msg;
|
||||
unsigned char *buffer, *buffer_end;
|
||||
ULONG size;
|
||||
ULONG flags = MAKELONG(MSHCTX_DIFFERENTMACHINE, NDR_LOCAL_DATA_REPRESENTATION);
|
||||
HMETAFILEPICT hmfp;
|
||||
HMETAFILEPICT hmfp2 = NULL;
|
||||
METAFILEPICT *pmfp;
|
||||
|
@ -313,11 +383,13 @@ static void test_marshal_HMETAFILEPICT(void)
|
|||
pmfp->hMF = create_mf();
|
||||
GlobalUnlock(hmfp);
|
||||
|
||||
size = HMETAFILEPICT_UserSize(&flags, 0, &hmfp);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = HMETAFILEPICT_UserSize(&umcb.Flags, 0, &hmfp);
|
||||
ok(size > 20, "size should be at least 20 bytes, not %d\n", size);
|
||||
trace("size is %d\n", size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
buffer_end = HMETAFILEPICT_UserMarshal(&flags, buffer, &hmfp);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
buffer_end = HMETAFILEPICT_UserMarshal(&umcb.Flags, buffer, &hmfp);
|
||||
wirehmfp = buffer;
|
||||
ok(*(DWORD *)wirehmfp == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehmfp);
|
||||
wirehmfp += sizeof(DWORD);
|
||||
|
@ -348,10 +420,12 @@ static void test_marshal_HMETAFILEPICT(void)
|
|||
/* ... rest of data not tested - refer to tests for GetMetaFileBits
|
||||
* at this point */
|
||||
|
||||
HMETAFILEPICT_UserUnmarshal(&flags, buffer, &hmfp2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
HMETAFILEPICT_UserUnmarshal(&umcb.Flags, buffer, &hmfp2);
|
||||
ok(hmfp2 != NULL, "HMETAFILEPICT didn't unmarshal\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
HMETAFILEPICT_UserFree(&flags, &hmfp2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
HMETAFILEPICT_UserFree(&umcb.Flags, &hmfp2);
|
||||
pmfp = GlobalLock(hmfp);
|
||||
DeleteMetaFile(pmfp->hMF);
|
||||
GlobalUnlock(hmfp);
|
||||
|
@ -360,10 +434,12 @@ static void test_marshal_HMETAFILEPICT(void)
|
|||
/* test NULL emf */
|
||||
hmfp = NULL;
|
||||
|
||||
size = HMETAFILEPICT_UserSize(&flags, 0, &hmfp);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = HMETAFILEPICT_UserSize(&umcb.Flags, 0, &hmfp);
|
||||
ok(size == 8, "size should be 8 bytes, not %d\n", size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
HMETAFILEPICT_UserMarshal(&flags, buffer, &hmfp);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
HMETAFILEPICT_UserMarshal(&umcb.Flags, buffer, &hmfp);
|
||||
wirehmfp = buffer;
|
||||
ok(*(DWORD *)wirehmfp == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehmfp);
|
||||
wirehmfp += sizeof(DWORD);
|
||||
|
@ -371,10 +447,12 @@ static void test_marshal_HMETAFILEPICT(void)
|
|||
wirehmfp += sizeof(DWORD);
|
||||
|
||||
hmfp2 = NULL;
|
||||
HMETAFILEPICT_UserUnmarshal(&flags, buffer, &hmfp2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
HMETAFILEPICT_UserUnmarshal(&umcb.Flags, buffer, &hmfp2);
|
||||
ok(hmfp2 == NULL, "NULL HMETAFILE didn't unmarshal\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
HMETAFILEPICT_UserFree(&flags, &hmfp2);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
HMETAFILEPICT_UserFree(&umcb.Flags, &hmfp2);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI Test_IUnknown_QueryInterface(
|
||||
|
@ -421,27 +499,21 @@ void __RPC_USER WdtpInterfacePointer_UserFree(IUnknown *);
|
|||
|
||||
static void test_marshal_WdtpInterfacePointer(void)
|
||||
{
|
||||
USER_MARSHAL_CB umcb;
|
||||
MIDL_STUB_MESSAGE stub_msg;
|
||||
RPC_MESSAGE rpc_msg;
|
||||
unsigned char *buffer, *buffer_end;
|
||||
ULONG size;
|
||||
MIDL_STUB_MESSAGE stubmsg;
|
||||
USER_MARSHAL_CB umcb;
|
||||
IUnknown *unk;
|
||||
IUnknown *unk2;
|
||||
unsigned char *wireip;
|
||||
const IID *iid;
|
||||
|
||||
memset(&stubmsg, 0xcc, sizeof(stubmsg));
|
||||
stubmsg.dwDestContext = MSHCTX_INPROC;
|
||||
stubmsg.pvDestContext = NULL;
|
||||
|
||||
memset(&umcb, 0xcc, sizeof(umcb));
|
||||
umcb.Flags = MAKELONG(MSHCTX_INPROC, NDR_LOCAL_DATA_REPRESENTATION);
|
||||
umcb.pStubMsg = &stubmsg;
|
||||
|
||||
/* shows that the WdtpInterfacePointer functions don't marshal anything for
|
||||
* NULL pointers, so code using these functions must handle that case
|
||||
* itself */
|
||||
unk = NULL;
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_INPROC);
|
||||
size = WdtpInterfacePointer_UserSize(&umcb.Flags, umcb.Flags, 0, unk, &IID_IUnknown);
|
||||
ok(size == 0, "size should be 0 bytes, not %d\n", size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
|
@ -450,11 +522,13 @@ static void test_marshal_WdtpInterfacePointer(void)
|
|||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
|
||||
unk = &Test_Unknown;
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_INPROC);
|
||||
size = WdtpInterfacePointer_UserSize(&umcb.Flags, umcb.Flags, 0, unk, &IID_IUnknown);
|
||||
todo_wine
|
||||
ok(size > 28, "size should be > 28 bytes, not %d\n", size);
|
||||
trace("WdtpInterfacePointer_UserSize returned %d\n", size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_INPROC);
|
||||
buffer_end = WdtpInterfacePointer_UserMarshal(&umcb.Flags, umcb.Flags, buffer, unk, &IID_IUnknown);
|
||||
wireip = buffer;
|
||||
if (size >= 28)
|
||||
|
@ -482,10 +556,12 @@ static void test_marshal_WdtpInterfacePointer(void)
|
|||
}
|
||||
|
||||
unk2 = NULL;
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_INPROC);
|
||||
WdtpInterfacePointer_UserUnmarshal(&umcb.Flags, buffer, &unk2, &IID_IUnknown);
|
||||
todo_wine
|
||||
ok(unk2 != NULL, "IUnknown object didn't unmarshal properly\n");
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_INPROC);
|
||||
WdtpInterfacePointer_UserFree(unk2);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue