oleaut32/tests: Link to SafeArrayGetVartype() directly.

It was already available on XP.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-09-17 14:12:50 +03:00 committed by Alexandre Julliard
parent 3c7b0e8d85
commit 5b04eacfa9
1 changed files with 21 additions and 57 deletions

View File

@ -36,14 +36,12 @@
# define V_U2(A) (*(A)) # define V_U2(A) (*(A))
#endif #endif
static HRESULT (WINAPI *pSafeArrayGetVartype)(SAFEARRAY*,VARTYPE*);
static inline SF_TYPE get_union_type(SAFEARRAY *psa) static inline SF_TYPE get_union_type(SAFEARRAY *psa)
{ {
VARTYPE vt; VARTYPE vt;
HRESULT hr; HRESULT hr;
hr = pSafeArrayGetVartype(psa, &vt); hr = SafeArrayGetVartype(psa, &vt);
if (FAILED(hr)) if (FAILED(hr))
{ {
if(psa->fFeatures & FADF_VARIANT) return SF_VARIANT; if(psa->fFeatures & FADF_VARIANT) return SF_VARIANT;
@ -131,10 +129,7 @@ static void check_safearray(void *buffer, LPSAFEARRAY lpsa)
return; return;
} }
if (!pSafeArrayGetVartype) if(FAILED(SafeArrayGetVartype(lpsa, &vt)))
return;
if(FAILED(pSafeArrayGetVartype(lpsa, &vt)))
vt = 0; vt = 0;
sftype = get_union_type(lpsa); sftype = get_union_type(lpsa);
@ -266,12 +261,9 @@ static void test_marshal_LPSAFEARRAY(void)
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
LPSAFEARRAY_UserUnmarshal(&umcb.Flags, buffer, &lpsa2); LPSAFEARRAY_UserUnmarshal(&umcb.Flags, buffer, &lpsa2);
ok(lpsa2 != NULL, "LPSAFEARRAY didn't unmarshal\n"); ok(lpsa2 != NULL, "LPSAFEARRAY didn't unmarshal\n");
if (pSafeArrayGetVartype) SafeArrayGetVartype(lpsa, &vt);
{ SafeArrayGetVartype(lpsa2, &vt2);
pSafeArrayGetVartype(lpsa, &vt); ok(vt == vt2, "vts differ %x %x\n", vt, vt2);
pSafeArrayGetVartype(lpsa2, &vt2);
ok(vt == vt2, "vts differ %x %x\n", vt, vt2);
}
ok(lpsa2->cLocks == 0, "got lock count %u, expected 0\n", lpsa2->cLocks); ok(lpsa2->cLocks == 0, "got lock count %u, expected 0\n", lpsa2->cLocks);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
LPSAFEARRAY_UserFree(&umcb.Flags, &lpsa2); LPSAFEARRAY_UserFree(&umcb.Flags, &lpsa2);
@ -313,12 +305,9 @@ static void test_marshal_LPSAFEARRAY(void)
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
LPSAFEARRAY_UserUnmarshal(&umcb.Flags, buffer, &lpsa2); LPSAFEARRAY_UserUnmarshal(&umcb.Flags, buffer, &lpsa2);
ok(lpsa2 != NULL, "LPSAFEARRAY didn't unmarshal\n"); ok(lpsa2 != NULL, "LPSAFEARRAY didn't unmarshal\n");
if (pSafeArrayGetVartype) SafeArrayGetVartype(lpsa, &vt);
{ SafeArrayGetVartype(lpsa2, &vt2);
pSafeArrayGetVartype(lpsa, &vt); ok(vt == vt2, "vts differ %x %x\n", vt, vt2);
pSafeArrayGetVartype(lpsa2, &vt2);
ok(vt == vt2, "vts differ %x %x\n", vt, vt2);
}
ok(lpsa2->cLocks == 0, "got lock count %u, expected 0\n", lpsa2->cLocks); ok(lpsa2->cLocks == 0, "got lock count %u, expected 0\n", lpsa2->cLocks);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
LPSAFEARRAY_UserFree(&umcb.Flags, &lpsa2); LPSAFEARRAY_UserFree(&umcb.Flags, &lpsa2);
@ -387,12 +376,8 @@ static void test_marshal_LPSAFEARRAY(void)
lpsa->rgsabound[0].cElements = 48; lpsa->rgsabound[0].cElements = 48;
hr = SafeArrayAllocData(lpsa); hr = SafeArrayAllocData(lpsa);
ok(hr == S_OK, "saad failed %08x\n", hr); ok(hr == S_OK, "saad failed %08x\n", hr);
hr = SafeArrayGetVartype(lpsa, &vt);
if (pSafeArrayGetVartype) ok(hr == E_INVALIDARG, "ret %08x\n", hr);
{
hr = pSafeArrayGetVartype(lpsa, &vt);
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
}
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa); size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa);
@ -496,12 +481,8 @@ static void test_marshal_LPSAFEARRAY(void)
lpsa->rgsabound[0].cElements = 48; lpsa->rgsabound[0].cElements = 48;
hr = SafeArrayAllocData(lpsa); hr = SafeArrayAllocData(lpsa);
ok(hr == S_OK, "saad failed %08x\n", hr); ok(hr == S_OK, "saad failed %08x\n", hr);
hr = SafeArrayGetVartype(lpsa, &vt);
if (pSafeArrayGetVartype) ok(hr == E_INVALIDARG, "ret %08x\n", hr);
{
hr = pSafeArrayGetVartype(lpsa, &vt);
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
}
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa); size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa);
@ -1321,12 +1302,9 @@ static void test_marshal_VARIANT(void)
SafeArrayGetUBound(V_ARRAY(&v), 1, &bound); SafeArrayGetUBound(V_ARRAY(&v), 1, &bound);
SafeArrayGetUBound(V_ARRAY(&v2), 1, &bound2); SafeArrayGetUBound(V_ARRAY(&v2), 1, &bound2);
ok(bound == bound2, "array ubounds differ\n"); ok(bound == bound2, "array ubounds differ\n");
if (pSafeArrayGetVartype) SafeArrayGetVartype(V_ARRAY(&v), &vt);
{ SafeArrayGetVartype(V_ARRAY(&v2), &vt2);
pSafeArrayGetVartype(V_ARRAY(&v), &vt); ok(vt == vt2, "array vts differ %x %x\n", vt, vt2);
pSafeArrayGetVartype(V_ARRAY(&v2), &vt2);
ok(vt == vt2, "array vts differ %x %x\n", vt, vt2);
}
VARIANT_UserFree(&umcb.Flags, &v2); VARIANT_UserFree(&umcb.Flags, &v2);
HeapFree(GetProcessHeap(), 0, oldbuffer); HeapFree(GetProcessHeap(), 0, oldbuffer);
@ -1363,12 +1341,9 @@ static void test_marshal_VARIANT(void)
SafeArrayGetUBound(*V_ARRAYREF(&v), 1, &bound); SafeArrayGetUBound(*V_ARRAYREF(&v), 1, &bound);
SafeArrayGetUBound(*V_ARRAYREF(&v2), 1, &bound2); SafeArrayGetUBound(*V_ARRAYREF(&v2), 1, &bound2);
ok(bound == bound2, "array ubounds differ\n"); ok(bound == bound2, "array ubounds differ\n");
if (pSafeArrayGetVartype) SafeArrayGetVartype(*V_ARRAYREF(&v), &vt);
{ SafeArrayGetVartype(*V_ARRAYREF(&v2), &vt2);
pSafeArrayGetVartype(*V_ARRAYREF(&v), &vt); ok(vt == vt2, "array vts differ %x %x\n", vt, vt2);
pSafeArrayGetVartype(*V_ARRAYREF(&v2), &vt2);
ok(vt == vt2, "array vts differ %x %x\n", vt, vt2);
}
VARIANT_UserFree(&umcb.Flags, &v2); VARIANT_UserFree(&umcb.Flags, &v2);
HeapFree(GetProcessHeap(), 0, oldbuffer); HeapFree(GetProcessHeap(), 0, oldbuffer);
@ -1413,12 +1388,9 @@ static void test_marshal_VARIANT(void)
SafeArrayGetUBound(*V_ARRAYREF(&v), 1, &bound); SafeArrayGetUBound(*V_ARRAYREF(&v), 1, &bound);
SafeArrayGetUBound(*V_ARRAYREF(&v2), 1, &bound2); SafeArrayGetUBound(*V_ARRAYREF(&v2), 1, &bound2);
ok(bound == bound2, "array ubounds differ\n"); ok(bound == bound2, "array ubounds differ\n");
if (pSafeArrayGetVartype) SafeArrayGetVartype(*V_ARRAYREF(&v), &vt);
{ SafeArrayGetVartype(*V_ARRAYREF(&v2), &vt2);
pSafeArrayGetVartype(*V_ARRAYREF(&v), &vt); ok(vt == vt2, "array vts differ %x %x\n", vt, vt2);
pSafeArrayGetVartype(*V_ARRAYREF(&v2), &vt2);
ok(vt == vt2, "array vts differ %x %x\n", vt, vt2);
}
lpsa2->fFeatures &= ~FADF_STATIC; lpsa2->fFeatures &= ~FADF_STATIC;
hr = SafeArrayDestroy(*V_ARRAYREF(&v2)); hr = SafeArrayDestroy(*V_ARRAYREF(&v2));
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
@ -1608,14 +1580,6 @@ todo_wine
START_TEST(usrmarshal) START_TEST(usrmarshal)
{ {
HANDLE hOleaut32 = GetModuleHandleA("oleaut32.dll");
#define GETPTR(func) p##func = (void*)GetProcAddress(hOleaut32, #func)
GETPTR(SafeArrayGetVartype);
#undef GETPTR
if (!pSafeArrayGetVartype)
win_skip("SafeArrayGetVartype is not available, some tests will be skipped\n");
CoInitialize(NULL); CoInitialize(NULL);
test_marshal_LPSAFEARRAY(); test_marshal_LPSAFEARRAY();