Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8375c8e0
Commit
8375c8e0
authored
Jan 09, 2012
by
Francois Gouget
Committed by
Alexandre Julliard
Jan 09, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32/tests: Dynamically load some functions that are missing on early NT4 releases.
parent
af3114a5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
161 additions
and
93 deletions
+161
-93
tmarshal.c
dlls/oleaut32/tests/tmarshal.c
+26
-15
usrmarshal.c
dlls/oleaut32/tests/usrmarshal.c
+56
-20
varformat.c
dlls/oleaut32/tests/varformat.c
+21
-18
vartest.c
dlls/oleaut32/tests/vartest.c
+58
-40
No files found.
dlls/oleaut32/tests/tmarshal.c
View file @
8375c8e0
...
...
@@ -29,6 +29,9 @@
#include "tmarshal.h"
#include "tmarshal_dispids.h"
static
HRESULT
(
WINAPI
*
pVarAdd
)(
LPVARIANT
,
LPVARIANT
,
LPVARIANT
);
#define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08lx\n", (unsigned long int)hr)
/* ULL suffix is not portable */
...
...
@@ -481,8 +484,6 @@ static HRESULT WINAPI Widget_VariantCArray(
VARIANT
values
[])
{
ULONG
i
;
VARIANT
inc
,
res
;
HRESULT
hr
;
trace
(
"VariantCArray(%u,%p)
\n
"
,
count
,
values
);
...
...
@@ -490,21 +491,29 @@ static HRESULT WINAPI Widget_VariantCArray(
for
(
i
=
0
;
i
<
count
;
i
++
)
ok
(
V_VT
(
&
values
[
i
])
==
VT_I4
,
"values[%d] is not VT_I4
\n
"
,
i
);
V_VT
(
&
inc
)
=
VT_I4
;
V_I4
(
&
inc
)
=
1
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
VariantInit
(
&
res
);
hr
=
VarAdd
(
&
values
[
i
],
&
inc
,
&
res
);
if
(
FAILED
(
hr
))
{
ok
(
0
,
"VarAdd failed at %u with error 0x%x
\n
"
,
i
,
hr
);
return
hr
;
}
hr
=
VariantCopy
(
&
values
[
i
],
&
res
);
if
(
FAILED
(
hr
))
{
ok
(
0
,
"VariantCopy failed at %u with error 0x%x
\n
"
,
i
,
hr
);
return
hr
;
if
(
pVarAdd
)
{
VARIANT
inc
,
res
;
HRESULT
hr
;
V_VT
(
&
inc
)
=
VT_I4
;
V_I4
(
&
inc
)
=
1
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
VariantInit
(
&
res
);
hr
=
pVarAdd
(
&
values
[
i
],
&
inc
,
&
res
);
if
(
FAILED
(
hr
))
{
ok
(
0
,
"VarAdd failed at %u with error 0x%x
\n
"
,
i
,
hr
);
return
hr
;
}
hr
=
VariantCopy
(
&
values
[
i
],
&
res
);
if
(
FAILED
(
hr
))
{
ok
(
0
,
"VariantCopy failed at %u with error 0x%x
\n
"
,
i
,
hr
);
return
hr
;
}
}
}
else
win_skip
(
"VarAdd is not available
\n
"
);
return
S_OK
;
}
...
...
@@ -1593,6 +1602,8 @@ static void test_libattr(void)
START_TEST
(
tmarshal
)
{
HRESULT
hr
;
HANDLE
hOleaut32
=
GetModuleHandleA
(
"oleaut32.dll"
);
pVarAdd
=
(
void
*
)
GetProcAddress
(
hOleaut32
,
"VarAdd"
);
CoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
);
...
...
dlls/oleaut32/tests/usrmarshal.c
View file @
8375c8e0
...
...
@@ -36,12 +36,16 @@
# define V_U2(A) (*(A))
#endif
static
HRESULT
(
WINAPI
*
pSafeArrayGetIID
)(
SAFEARRAY
*
,
GUID
*
);
static
HRESULT
(
WINAPI
*
pSafeArrayGetVartype
)(
SAFEARRAY
*
,
VARTYPE
*
);
static
HRESULT
(
WINAPI
*
pVarBstrCmp
)(
BSTR
,
BSTR
,
LCID
,
ULONG
);
static
inline
SF_TYPE
get_union_type
(
SAFEARRAY
*
psa
)
{
VARTYPE
vt
;
HRESULT
hr
;
hr
=
SafeArrayGetVartype
(
psa
,
&
vt
);
hr
=
p
SafeArrayGetVartype
(
psa
,
&
vt
);
if
(
FAILED
(
hr
))
{
if
(
psa
->
fFeatures
&
FADF_VARIANT
)
return
SF_VARIANT
;
...
...
@@ -129,7 +133,10 @@ static void check_safearray(void *buffer, LPSAFEARRAY lpsa)
return
;
}
if
(
FAILED
(
SafeArrayGetVartype
(
lpsa
,
&
vt
)))
if
(
!
pSafeArrayGetVartype
||
!
pSafeArrayGetIID
)
return
;
if
(
FAILED
(
pSafeArrayGetVartype
(
lpsa
,
&
vt
)))
vt
=
0
;
sftype
=
get_union_type
(
lpsa
);
...
...
@@ -158,7 +165,7 @@ static void check_safearray(void *buffer, LPSAFEARRAY lpsa)
if
(
sftype
==
SF_HAVEIID
)
{
GUID
guid
;
SafeArrayGetIID
(
lpsa
,
&
guid
);
p
SafeArrayGetIID
(
lpsa
,
&
guid
);
ok
(
IsEqualGUID
(
&
guid
,
wiresa
),
"guid mismatch
\n
"
);
wiresa
+=
sizeof
(
GUID
);
}
...
...
@@ -259,9 +266,12 @@ static void test_marshal_LPSAFEARRAY(void)
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
buffer
,
size
,
MSHCTX_DIFFERENTMACHINE
);
LPSAFEARRAY_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
,
&
lpsa2
);
ok
(
lpsa2
!=
NULL
,
"LPSAFEARRAY didn't unmarshal
\n
"
);
SafeArrayGetVartype
(
lpsa
,
&
vt
);
SafeArrayGetVartype
(
lpsa2
,
&
vt2
);
ok
(
vt
==
vt2
,
"vts differ %x %x
\n
"
,
vt
,
vt2
);
if
(
pSafeArrayGetVartype
)
{
pSafeArrayGetVartype
(
lpsa
,
&
vt
);
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
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
LPSAFEARRAY_UserFree
(
&
umcb
.
Flags
,
&
lpsa2
);
...
...
@@ -302,9 +312,12 @@ static void test_marshal_LPSAFEARRAY(void)
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
buffer
,
size
,
MSHCTX_DIFFERENTMACHINE
);
LPSAFEARRAY_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
,
&
lpsa2
);
ok
(
lpsa2
!=
NULL
,
"LPSAFEARRAY didn't unmarshal
\n
"
);
SafeArrayGetVartype
(
lpsa
,
&
vt
);
SafeArrayGetVartype
(
lpsa2
,
&
vt2
);
ok
(
vt
==
vt2
,
"vts differ %x %x
\n
"
,
vt
,
vt2
);
if
(
pSafeArrayGetVartype
)
{
pSafeArrayGetVartype
(
lpsa
,
&
vt
);
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
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
LPSAFEARRAY_UserFree
(
&
umcb
.
Flags
,
&
lpsa2
);
...
...
@@ -374,8 +387,11 @@ static void test_marshal_LPSAFEARRAY(void)
hr
=
SafeArrayAllocData
(
lpsa
);
ok
(
hr
==
S_OK
,
"saad failed %08x
\n
"
,
hr
);
hr
=
SafeArrayGetVartype
(
lpsa
,
&
vt
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
if
(
pSafeArrayGetVartype
)
{
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
);
size
=
LPSAFEARRAY_UserSize
(
&
umcb
.
Flags
,
0
,
&
lpsa
);
...
...
@@ -455,7 +471,8 @@ static void test_marshal_LPSAFEARRAY(void)
ok
(
hr
==
S_OK
,
"Failed to get bstr element at hres 0x%x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
ok
(
VarBstrCmp
(
values
[
i
],
gotvalue
,
0
,
0
)
==
VARCMP_EQ
,
"String %d does not match
\n
"
,
i
);
if
(
pVarBstrCmp
)
ok
(
pVarBstrCmp
(
values
[
i
],
gotvalue
,
0
,
0
)
==
VARCMP_EQ
,
"String %d does not match
\n
"
,
i
);
SysFreeString
(
gotvalue
);
}
}
...
...
@@ -480,8 +497,11 @@ static void test_marshal_LPSAFEARRAY(void)
hr
=
SafeArrayAllocData
(
lpsa
);
ok
(
hr
==
S_OK
,
"saad failed %08x
\n
"
,
hr
);
hr
=
SafeArrayGetVartype
(
lpsa
,
&
vt
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
if
(
pSafeArrayGetVartype
)
{
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
);
size
=
LPSAFEARRAY_UserSize
(
&
umcb
.
Flags
,
0
,
&
lpsa
);
...
...
@@ -1273,9 +1293,12 @@ static void test_marshal_VARIANT(void)
SafeArrayGetUBound
(
V_ARRAY
(
&
v
),
1
,
&
bound
);
SafeArrayGetUBound
(
V_ARRAY
(
&
v2
),
1
,
&
bound2
);
ok
(
bound
==
bound2
,
"array ubounds differ
\n
"
);
SafeArrayGetVartype
(
V_ARRAY
(
&
v
),
&
vt
);
SafeArrayGetVartype
(
V_ARRAY
(
&
v2
),
&
vt2
);
ok
(
vt
==
vt2
,
"array vts differ %x %x
\n
"
,
vt
,
vt2
);
if
(
pSafeArrayGetVartype
)
{
pSafeArrayGetVartype
(
V_ARRAY
(
&
v
),
&
vt
);
pSafeArrayGetVartype
(
V_ARRAY
(
&
v2
),
&
vt2
);
ok
(
vt
==
vt2
,
"array vts differ %x %x
\n
"
,
vt
,
vt2
);
}
VARIANT_UserFree
(
&
umcb
.
Flags
,
&
v2
);
HeapFree
(
GetProcessHeap
(),
0
,
oldbuffer
);
...
...
@@ -1313,9 +1336,12 @@ static void test_marshal_VARIANT(void)
SafeArrayGetUBound
(
*
V_ARRAYREF
(
&
v
),
1
,
&
bound
);
SafeArrayGetUBound
(
*
V_ARRAYREF
(
&
v2
),
1
,
&
bound2
);
ok
(
bound
==
bound2
,
"array ubounds differ
\n
"
);
SafeArrayGetVartype
(
*
V_ARRAYREF
(
&
v
),
&
vt
);
SafeArrayGetVartype
(
*
V_ARRAYREF
(
&
v2
),
&
vt2
);
ok
(
vt
==
vt2
,
"array vts differ %x %x
\n
"
,
vt
,
vt2
);
if
(
pSafeArrayGetVartype
)
{
pSafeArrayGetVartype
(
*
V_ARRAYREF
(
&
v
),
&
vt
);
pSafeArrayGetVartype
(
*
V_ARRAYREF
(
&
v2
),
&
vt2
);
ok
(
vt
==
vt2
,
"array vts differ %x %x
\n
"
,
vt
,
vt2
);
}
VARIANT_UserFree
(
&
umcb
.
Flags
,
&
v2
);
HeapFree
(
GetProcessHeap
(),
0
,
oldbuffer
);
hr
=
SafeArrayDestroy
(
lpsa
);
...
...
@@ -1481,6 +1507,16 @@ static void test_marshal_VARIANT(void)
START_TEST
(
usrmarshal
)
{
HANDLE
hOleaut32
=
GetModuleHandleA
(
"oleaut32.dll"
);
#define GETPTR(func) p##func = (void*)GetProcAddress(hOleaut32, #func)
GETPTR
(
SafeArrayGetIID
);
GETPTR
(
SafeArrayGetVartype
);
GETPTR
(
VarBstrCmp
);
#undef GETPTR
if
(
!
pSafeArrayGetIID
||
!
pSafeArrayGetVartype
)
win_skip
(
"SafeArrayGetIID and/or SafeArrayGetVartype is not available, some tests will be skipped
\n
"
);
CoInitialize
(
NULL
);
test_marshal_LPSAFEARRAY
();
...
...
dlls/oleaut32/tests/varformat.c
View file @
8375c8e0
...
...
@@ -39,6 +39,7 @@
static
HMODULE
hOleaut32
;
static
HRESULT
(
WINAPI
*
pVarBstrCmp
)(
BSTR
,
BSTR
,
LCID
,
ULONG
);
static
HRESULT
(
WINAPI
*
pVarFormatNumber
)(
LPVARIANT
,
int
,
int
,
int
,
int
,
ULONG
,
BSTR
*
);
static
HRESULT
(
WINAPI
*
pVarFormat
)(
LPVARIANT
,
LPOLESTR
,
int
,
int
,
ULONG
,
BSTR
*
);
static
HRESULT
(
WINAPI
*
pVarWeekdayName
)(
int
,
int
,
int
,
ULONG
,
BSTR
*
);
...
...
@@ -525,28 +526,30 @@ static void test_VarWeekdayName(void)
"Null pointer: expected E_INVALIDARG, got 0x%08x
\n
"
,
hres
);
/* Check all combinations */
for
(
iWeekday
=
1
;
iWeekday
<=
7
;
++
iWeekday
)
{
for
(
fAbbrev
=
0
;
fAbbrev
<=
1
;
++
fAbbrev
)
pVarBstrCmp
=
(
void
*
)
GetProcAddress
(
hOleaut32
,
"VarBstrCmp"
);
if
(
pVarBstrCmp
)
for
(
iWeekday
=
1
;
iWeekday
<=
7
;
++
iWeekday
)
{
/* 0 = Default, 1 = Sunday, 2 = Monday, .. */
for
(
iFirstDay
=
0
;
iFirstDay
<=
7
;
++
iFirstDay
)
for
(
fAbbrev
=
0
;
fAbbrev
<=
1
;
++
fAbbrev
)
{
VARWDN_O
(
iWeekday
,
fAbbrev
,
iFirstDay
,
0
);
if
(
iFirstDay
==
0
)
firstDay
=
defaultFirstDay
;
else
/* Translate from 0=Sunday to 0=Monday in the modulo 7 space */
firstDay
=
iFirstDay
-
2
;
day
=
(
7
+
iWeekday
-
1
+
firstDay
)
%
7
;
ok
(
VARCMP_EQ
==
VarBstrCmp
(
out
,
dayNames
[
day
][
fAbbrev
],
LOCALE_USER_DEFAULT
,
0
),
"VarWeekdayName(%d,%d,%d): got wrong dayname: '%s'
\n
"
,
iWeekday
,
fAbbrev
,
iFirstDay
,
buff
);
SysFreeString
(
out
);
/* 0 = Default, 1 = Sunday, 2 = Monday, .. */
for
(
iFirstDay
=
0
;
iFirstDay
<=
7
;
++
iFirstDay
)
{
VARWDN_O
(
iWeekday
,
fAbbrev
,
iFirstDay
,
0
);
if
(
iFirstDay
==
0
)
firstDay
=
defaultFirstDay
;
else
/* Translate from 0=Sunday to 0=Monday in the modulo 7 space */
firstDay
=
iFirstDay
-
2
;
day
=
(
7
+
iWeekday
-
1
+
firstDay
)
%
7
;
ok
(
VARCMP_EQ
==
pVarBstrCmp
(
out
,
dayNames
[
day
][
fAbbrev
],
LOCALE_USER_DEFAULT
,
0
),
"VarWeekdayName(%d,%d,%d): got wrong dayname: '%s'
\n
"
,
iWeekday
,
fAbbrev
,
iFirstDay
,
buff
);
SysFreeString
(
out
);
}
}
}
}
/* Cleanup */
for
(
day
=
0
;
day
<=
6
;
++
day
)
...
...
dlls/oleaut32/tests/vartest.c
View file @
8375c8e0
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment