mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-16 06:58:15 +00:00
oleaut32/tests: Fix the usrmarshal tests on 64-bit.
This commit is contained in:
parent
3d6bb38952
commit
a0b8ec0e1b
|
@ -118,7 +118,7 @@ static void check_safearray(void *buffer, LPSAFEARRAY lpsa)
|
|||
|
||||
if(!lpsa)
|
||||
{
|
||||
ok(*(void **)wiresa == NULL, "wiresa + 0x0 should be NULL instead of 0x%08x\n", *(DWORD *)wiresa);
|
||||
ok(*(DWORD *)wiresa == 0, "wiresa + 0x0 should be NULL instead of 0x%08x\n", *(DWORD *)wiresa);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -134,19 +134,19 @@ static void check_safearray(void *buffer, LPSAFEARRAY lpsa)
|
|||
wiresa += sizeof(DWORD);
|
||||
ok(*(WORD *)wiresa == lpsa->cDims, "wiresa + 0x8 should be lpsa->cDims instead of 0x%04x\n", *(WORD *)wiresa);
|
||||
wiresa += sizeof(WORD);
|
||||
ok(*(WORD *)wiresa == lpsa->fFeatures, "wiresa + 0xc should be lpsa->fFeatures instead of 0x%08x\n", *(WORD *)wiresa);
|
||||
ok(*(WORD *)wiresa == lpsa->fFeatures, "wiresa + 0xa should be lpsa->fFeatures instead of 0x%08x\n", *(WORD *)wiresa);
|
||||
wiresa += sizeof(WORD);
|
||||
ok(*(DWORD *)wiresa == lpsa->cbElements, "wiresa + 0x10 should be lpsa->cbElements instead of 0x%08x\n", *(DWORD *)wiresa);
|
||||
ok(*(DWORD *)wiresa == lpsa->cbElements, "wiresa + 0xc should be lpsa->cbElements instead of 0x%08x\n", *(DWORD *)wiresa);
|
||||
wiresa += sizeof(DWORD);
|
||||
ok(*(WORD *)wiresa == lpsa->cLocks, "wiresa + 0x16 should be lpsa->cLocks instead of 0x%04x\n", *(WORD *)wiresa);
|
||||
ok(*(WORD *)wiresa == lpsa->cLocks, "wiresa + 0x10 should be lpsa->cLocks instead of 0x%04x\n", *(WORD *)wiresa);
|
||||
wiresa += sizeof(WORD);
|
||||
ok(*(WORD *)wiresa == vt, "wiresa + 0x14 should be %04x instead of 0x%04x\n", vt, *(WORD *)wiresa);
|
||||
ok(*(WORD *)wiresa == vt, "wiresa + 0x12 should be %04x instead of 0x%04x\n", vt, *(WORD *)wiresa);
|
||||
wiresa += sizeof(WORD);
|
||||
ok(*(DWORD *)wiresa == sftype, "wiresa + 0x18 should be %08x instead of 0x%08x\n", (DWORD)sftype, *(DWORD *)wiresa);
|
||||
ok(*(DWORD *)wiresa == sftype, "wiresa + 0x14 should be %08x instead of 0x%08x\n", (DWORD)sftype, *(DWORD *)wiresa);
|
||||
wiresa += sizeof(DWORD);
|
||||
ok(*(DWORD *)wiresa == cell_count, "wiresa + 0x1c should be %u instead of %u\n", cell_count, *(DWORD *)wiresa);
|
||||
ok(*(DWORD *)wiresa == cell_count, "wiresa + 0x18 should be %u instead of %u\n", cell_count, *(DWORD *)wiresa);
|
||||
wiresa += sizeof(DWORD);
|
||||
ok(*(DWORD *)wiresa, "wiresa + 0x20 should be non-zero instead of 0x%08x\n", *(DWORD *)wiresa);
|
||||
ok(*(DWORD *)wiresa, "wiresa + 0x1c should be non-zero instead of 0x%08x\n", *(DWORD *)wiresa);
|
||||
wiresa += sizeof(DWORD);
|
||||
if(sftype == SF_HAVEIID)
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ static void check_safearray(void *buffer, LPSAFEARRAY lpsa)
|
|||
ok(!memcmp(wiresa, lpsa->rgsabound, sizeof(lpsa->rgsabound[0]) * lpsa->cDims), "bounds mismatch\n");
|
||||
wiresa += sizeof(lpsa->rgsabound[0]) * lpsa->cDims;
|
||||
|
||||
ok(*(DWORD *)wiresa == cell_count, "wiresa + 0x2c should be %u instead of %u\n", cell_count, *(DWORD*)wiresa);
|
||||
ok(*(DWORD *)wiresa == cell_count, "wiresa + 0x28 should be %u instead of %u\n", cell_count, *(DWORD*)wiresa);
|
||||
wiresa += sizeof(DWORD);
|
||||
/* elements are now pointed to by wiresa */
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ static void init_user_marshal_cb(USER_MARSHAL_CB *umcb,
|
|||
static void test_marshal_LPSAFEARRAY(void)
|
||||
{
|
||||
unsigned char *buffer;
|
||||
ULONG size;
|
||||
ULONG size, expected;
|
||||
LPSAFEARRAY lpsa;
|
||||
LPSAFEARRAY lpsa2 = NULL;
|
||||
SAFEARRAYBOUND sab;
|
||||
|
@ -217,10 +217,15 @@ static void test_marshal_LPSAFEARRAY(void)
|
|||
lpsa->cLocks = 7;
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = LPSAFEARRAY_UserSize(&umcb.Flags, 1, &lpsa);
|
||||
ok(size == 68, "size should be 68 bytes, not %d\n", size);
|
||||
expected = (44 + 1 + sizeof(ULONG) - 1) & ~(sizeof(ULONG) - 1);
|
||||
expected += sab.cElements * sizeof(USHORT);
|
||||
ok(size == expected || size == expected + 12, /* win64 */
|
||||
"size should be %u bytes, not %u\n", expected, size);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa);
|
||||
ok(size == 64, "size should be 64 bytes, not %d\n", size);
|
||||
expected = 44 + sab.cElements * sizeof(USHORT);
|
||||
ok(size == expected || size == expected + 12, /* win64 */
|
||||
"size should be %u bytes, not %u\n", expected, size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa);
|
||||
|
@ -273,10 +278,16 @@ static void test_marshal_LPSAFEARRAY(void)
|
|||
lpsa->cLocks = 7;
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = LPSAFEARRAY_UserSize(&umcb.Flags, 1, &lpsa);
|
||||
ok(size == 128, "size should be 128 bytes, not %d\n", size);
|
||||
expected = (44 + 1 + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
|
||||
expected += sab.cElements * sizeof(double);
|
||||
ok(size == expected || size == expected + 16, /* win64 */
|
||||
"size should be %u bytes, not %u\n", expected, size);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
expected = (44 + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
|
||||
expected += sab.cElements * sizeof(double);
|
||||
size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa);
|
||||
ok(size == 128, "size should be 128 bytes, not %d\n", size);
|
||||
ok(size == expected || size == expected + 8, /* win64 */
|
||||
"size should be %u bytes, not %u\n", expected, size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa);
|
||||
|
@ -301,7 +312,10 @@ static void test_marshal_LPSAFEARRAY(void)
|
|||
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa);
|
||||
ok(size == 432, "size %d\n", size);
|
||||
expected = (44 + lpsa->cbElements - 1) & ~(lpsa->cbElements - 1);
|
||||
expected += lpsa->cbElements * lpsa->rgsabound[0].cElements;
|
||||
ok(size == expected || size == expected + 8, /* win64 */
|
||||
"size should be %u bytes, not %u\n", expected, size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa);
|
||||
|
@ -313,7 +327,7 @@ static void test_marshal_LPSAFEARRAY(void)
|
|||
/* VARTYPE-less arrays with FADF_VARIANT */
|
||||
hr = SafeArrayAllocDescriptor(1, &lpsa);
|
||||
ok(hr == S_OK, "saad failed %08x\n", hr);
|
||||
lpsa->cbElements = 16;
|
||||
lpsa->cbElements = sizeof(VARIANT);
|
||||
lpsa->fFeatures = FADF_VARIANT;
|
||||
lpsa->rgsabound[0].lLbound = 2;
|
||||
lpsa->rgsabound[0].cElements = 48;
|
||||
|
@ -325,11 +339,14 @@ static void test_marshal_LPSAFEARRAY(void)
|
|||
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
|
||||
size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa);
|
||||
expected = 44 + 28 * lpsa->rgsabound[0].cElements;
|
||||
todo_wine
|
||||
ok(size == 1388, "size %d\n", size);
|
||||
ok(size == expected || size == expected + 8, /* win64 */
|
||||
"size should be %u bytes, not %u\n", expected, size);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
|
||||
LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa);
|
||||
lpsa->cbElements = 16; /* VARIANT wire size */
|
||||
check_safearray(buffer, lpsa);
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
SafeArrayDestroyData(lpsa);
|
||||
|
@ -582,6 +599,7 @@ static void test_marshal_VARIANT(void)
|
|||
LPSAFEARRAY lpsa;
|
||||
DECIMAL dec, dec2;
|
||||
HeapUnknown *heap_unknown;
|
||||
DWORD expected;
|
||||
|
||||
stubMsg.RpcMsg = &rpcMsg;
|
||||
|
||||
|
@ -1130,14 +1148,16 @@ static void test_marshal_VARIANT(void)
|
|||
V_ARRAY(&v) = lpsa;
|
||||
|
||||
rpcMsg.BufferLength = stubMsg.BufferLength = VARIANT_UserSize(&umcb.Flags, 0, &v);
|
||||
ok(stubMsg.BufferLength == 152, "size %d\n", stubMsg.BufferLength);
|
||||
expected = 152;
|
||||
ok(stubMsg.BufferLength == expected || stubMsg.BufferLength == expected + 8, /* win64 */
|
||||
"size %u instead of %u\n", stubMsg.BufferLength, expected);
|
||||
buffer = rpcMsg.Buffer = stubMsg.Buffer = stubMsg.BufferStart = alloc_aligned(stubMsg.BufferLength, &oldbuffer);
|
||||
stubMsg.BufferEnd = stubMsg.Buffer + stubMsg.BufferLength;
|
||||
next = VARIANT_UserMarshal(&umcb.Flags, buffer, &v);
|
||||
ok(next == buffer + stubMsg.BufferLength, "got %p expect %p\n", next, buffer + stubMsg.BufferLength);
|
||||
ok(next == buffer + expected, "got %p expect %p\n", next, buffer + expected);
|
||||
wirev = (DWORD*)buffer;
|
||||
|
||||
check_variant_header(wirev, &v, stubMsg.BufferLength);
|
||||
check_variant_header(wirev, &v, expected);
|
||||
wirev += 5;
|
||||
ok(*wirev, "wv[5] %08x\n", *wirev); /* win2k: this is lpsa. winxp: this is (char*)lpsa + 1 */
|
||||
wirev++;
|
||||
|
@ -1149,7 +1169,7 @@ static void test_marshal_VARIANT(void)
|
|||
VariantInit(&v2);
|
||||
stubMsg.Buffer = buffer;
|
||||
next = VARIANT_UserUnmarshal(&umcb.Flags, buffer, &v2);
|
||||
ok(next == buffer + stubMsg.BufferLength, "got %p expect %p\n", next, buffer + stubMsg.BufferLength);
|
||||
ok(next == buffer + expected, "got %p expect %p\n", next, buffer + expected);
|
||||
ok(V_VT(&v) == V_VT(&v2), "got vt %d expect %d\n", V_VT(&v), V_VT(&v2));
|
||||
ok(SafeArrayGetDim(V_ARRAY(&v)) == SafeArrayGetDim(V_ARRAY(&v)), "array dims differ\n");
|
||||
SafeArrayGetLBound(V_ARRAY(&v), 1, &bound);
|
||||
|
@ -1171,14 +1191,16 @@ static void test_marshal_VARIANT(void)
|
|||
V_ARRAYREF(&v) = &lpsa;
|
||||
|
||||
rpcMsg.BufferLength = stubMsg.BufferLength = VARIANT_UserSize(&umcb.Flags, 0, &v);
|
||||
ok(stubMsg.BufferLength == 152, "size %d\n", stubMsg.BufferLength);
|
||||
expected = 152;
|
||||
ok(stubMsg.BufferLength == expected || stubMsg.BufferLength == expected + 16, /* win64 */
|
||||
"size %u instead of %u\n", stubMsg.BufferLength, expected);
|
||||
buffer = rpcMsg.Buffer = stubMsg.Buffer = stubMsg.BufferStart = alloc_aligned(stubMsg.BufferLength, &oldbuffer);
|
||||
stubMsg.BufferEnd = stubMsg.Buffer + stubMsg.BufferLength;
|
||||
next = VARIANT_UserMarshal(&umcb.Flags, buffer, &v);
|
||||
ok(next == buffer + stubMsg.BufferLength, "got %p expect %p\n", next, buffer + stubMsg.BufferLength);
|
||||
ok(next == buffer + expected, "got %p expect %p\n", next, buffer + expected);
|
||||
wirev = (DWORD*)buffer;
|
||||
|
||||
check_variant_header(wirev, &v, stubMsg.BufferLength);
|
||||
check_variant_header(wirev, &v, expected);
|
||||
wirev += 5;
|
||||
ok(*wirev == 4, "wv[5] %08x\n", *wirev);
|
||||
wirev++;
|
||||
|
@ -1192,7 +1214,7 @@ static void test_marshal_VARIANT(void)
|
|||
VariantInit(&v2);
|
||||
stubMsg.Buffer = buffer;
|
||||
next = VARIANT_UserUnmarshal(&umcb.Flags, buffer, &v2);
|
||||
ok(next == buffer + stubMsg.BufferLength, "got %p expect %p\n", next, buffer + stubMsg.BufferLength);
|
||||
ok(next == buffer + expected, "got %p expect %p\n", next, buffer + expected);
|
||||
ok(V_VT(&v) == V_VT(&v2), "got vt %d expect %d\n", V_VT(&v), V_VT(&v2));
|
||||
ok(SafeArrayGetDim(*V_ARRAYREF(&v)) == SafeArrayGetDim(*V_ARRAYREF(&v)), "array dims differ\n");
|
||||
SafeArrayGetLBound(*V_ARRAYREF(&v), 1, &bound);
|
||||
|
@ -1228,7 +1250,7 @@ static void test_marshal_VARIANT(void)
|
|||
check_variant_header(wirev, &v, stubMsg.BufferLength);
|
||||
wirev += 5;
|
||||
|
||||
ok(*wirev == 16, "wv[5] %08x\n", *wirev);
|
||||
ok(*wirev == sizeof(VARIANT), "wv[5] %08x\n", *wirev);
|
||||
wirev++;
|
||||
ok(*wirev == ('U' | 's' << 8 | 'e' << 16 | 'r' << 24), "wv[6] %08x\n", *wirev); /* 'User' */
|
||||
wirev++;
|
||||
|
|
Loading…
Reference in a new issue