Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4cc41fc5
Commit
4cc41fc5
authored
Jan 19, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32/tests: Use SafeArraySetIID() directly.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5b6920bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
76 deletions
+41
-76
safearray.c
dlls/oleaut32/tests/safearray.c
+41
-76
No files found.
dlls/oleaut32/tests/safearray.c
View file @
4cc41fc5
...
@@ -47,8 +47,6 @@ static HMODULE hOleaut32;
...
@@ -47,8 +47,6 @@ static HMODULE hOleaut32;
static
HRESULT
(
WINAPI
*
pSafeArrayAllocDescriptorEx
)(
VARTYPE
,
UINT
,
SAFEARRAY
**
);
static
HRESULT
(
WINAPI
*
pSafeArrayAllocDescriptorEx
)(
VARTYPE
,
UINT
,
SAFEARRAY
**
);
static
HRESULT
(
WINAPI
*
pSafeArrayCopyData
)(
SAFEARRAY
*
,
SAFEARRAY
*
);
static
HRESULT
(
WINAPI
*
pSafeArrayCopyData
)(
SAFEARRAY
*
,
SAFEARRAY
*
);
static
HRESULT
(
WINAPI
*
pSafeArrayGetIID
)(
SAFEARRAY
*
,
GUID
*
);
static
HRESULT
(
WINAPI
*
pSafeArraySetIID
)(
SAFEARRAY
*
,
REFGUID
);
static
HRESULT
(
WINAPI
*
pSafeArrayGetVartype
)(
SAFEARRAY
*
,
VARTYPE
*
);
static
HRESULT
(
WINAPI
*
pSafeArrayGetVartype
)(
SAFEARRAY
*
,
VARTYPE
*
);
static
HRESULT
(
WINAPI
*
pSafeArrayGetRecordInfo
)(
SAFEARRAY
*
,
IRecordInfo
**
);
static
HRESULT
(
WINAPI
*
pSafeArrayGetRecordInfo
)(
SAFEARRAY
*
,
IRecordInfo
**
);
static
SAFEARRAY
*
(
WINAPI
*
pSafeArrayCreateEx
)(
VARTYPE
,
UINT
,
SAFEARRAYBOUND
*
,
LPVOID
);
static
SAFEARRAY
*
(
WINAPI
*
pSafeArrayCreateEx
)(
VARTYPE
,
UINT
,
SAFEARRAYBOUND
*
,
LPVOID
);
...
@@ -686,24 +684,22 @@ static void test_safearray(void)
...
@@ -686,24 +684,22 @@ static void test_safearray(void)
hres
=
SafeArrayDestroyDescriptor
(
a
);
hres
=
SafeArrayDestroyDescriptor
(
a
);
ok
(
hres
==
S_OK
,
"SADD with data in array failed with hres %x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"SADD with data in array failed with hres %x
\n
"
,
hres
);
/* IID functions */
/* IID functions */
/* init a small stack safearray */
/* init a small stack safearray */
if
(
pSafeArraySetIID
)
{
memset
(
&
b
,
0
,
sizeof
(
b
));
memset
(
&
b
,
0
,
sizeof
(
b
));
b
.
cDims
=
1
;
b
.
cDims
=
1
;
memset
(
&
iid
,
0x42
,
sizeof
(
IID
));
memset
(
&
iid
,
0x42
,
sizeof
(
IID
));
hres
=
SafeArraySetIID
(
&
b
,
&
iid
);
hres
=
pSafeArraySetIID
(
&
b
,
&
iid
);
ok
(
hres
==
E_INVALIDARG
,
"Unexpected ret value %#x.
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"SafeArraySetIID of non IID capable safearray did not return E_INVALIDARG, but %x
\n
"
,
hres
);
hres
=
SafeArrayAllocDescriptor
(
1
,
&
a
);
hres
=
SafeArrayAllocDescriptor
(
1
,
&
a
);
ok
(
hres
==
S_OK
,
"Failed to allocate array descriptor, hr %#x.
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"SafeArrayAllocDescriptor should return S_OK, but got %x
\n
"
,
hres
);
ok
((
a
->
fFeatures
&
FADF_HAVEIID
)
==
0
,
"Unexpected features mask %#x.
\n
"
,
a
->
fFeatures
);
ok
((
a
->
fFeatures
&
FADF_HAVEIID
)
==
0
,
"newly allocated descriptor with SAAD should not have FADF_HAVEIID
\n
"
);
hres
=
SafeArraySetIID
(
a
,
&
iid
);
hres
=
pSafeArraySetIID
(
a
,
&
iid
);
ok
(
hres
==
E_INVALIDARG
,
"Unexpected ret value %#x.
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"SafeArraySetIID of newly allocated descriptor with SAAD should return E_INVALIDARG, but got %x
\n
"
,
hres
);
hres
=
SafeArrayDestroyDescriptor
(
a
);
hres
=
SafeArrayDestroyDescriptor
(
a
);
ok
(
hres
==
S_OK
,
"SADD failed with hres %x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"SADD failed with hres %x
\n
"
,
hres
);
}
if
(
!
pSafeArrayAllocDescriptorEx
)
if
(
!
pSafeArrayAllocDescriptorEx
)
return
;
return
;
...
@@ -714,7 +710,7 @@ static void test_safearray(void)
...
@@ -714,7 +710,7 @@ static void test_safearray(void)
ok
(
hres
==
S_OK
,
"SafeArrayAllocDescriptorEx gave hres 0x%x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"SafeArrayAllocDescriptorEx gave hres 0x%x
\n
"
,
hres
);
ok
(
a
->
fFeatures
==
vttypes
[
i
].
expflags
,
"SAADE(%d) resulted with flags %x, expected %x
\n
"
,
vttypes
[
i
].
vt
,
a
->
fFeatures
,
vttypes
[
i
].
expflags
);
ok
(
a
->
fFeatures
==
vttypes
[
i
].
expflags
,
"SAADE(%d) resulted with flags %x, expected %x
\n
"
,
vttypes
[
i
].
vt
,
a
->
fFeatures
,
vttypes
[
i
].
expflags
);
if
(
a
->
fFeatures
&
FADF_HAVEIID
)
{
if
(
a
->
fFeatures
&
FADF_HAVEIID
)
{
hres
=
p
SafeArrayGetIID
(
a
,
&
iid
);
hres
=
SafeArrayGetIID
(
a
,
&
iid
);
ok
(
hres
==
S_OK
,
"SAGIID failed for vt %d with hres %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
ok
(
hres
==
S_OK
,
"SAGIID failed for vt %d with hres %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
switch
(
vttypes
[
i
].
vt
)
{
switch
(
vttypes
[
i
].
vt
)
{
case
VT_UNKNOWN
:
case
VT_UNKNOWN
:
...
@@ -730,7 +726,7 @@ static void test_safearray(void)
...
@@ -730,7 +726,7 @@ static void test_safearray(void)
break
;
break
;
}
}
}
else
{
}
else
{
hres
=
p
SafeArrayGetIID
(
a
,
&
iid
);
hres
=
SafeArrayGetIID
(
a
,
&
iid
);
ok
(
hres
==
E_INVALIDARG
,
"SAGIID did not fail for vt %d with hres %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"SAGIID did not fail for vt %d with hres %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
}
}
if
(
a
->
fFeatures
&
FADF_RECORD
)
{
if
(
a
->
fFeatures
&
FADF_RECORD
)
{
...
@@ -751,13 +747,13 @@ static void test_safearray(void)
...
@@ -751,13 +747,13 @@ static void test_safearray(void)
}
}
if
(
a
->
fFeatures
&
FADF_HAVEIID
)
{
if
(
a
->
fFeatures
&
FADF_HAVEIID
)
{
hres
=
p
SafeArraySetIID
(
a
,
&
IID_IStorage
);
/* random IID */
hres
=
SafeArraySetIID
(
a
,
&
IID_IStorage
);
/* random IID */
ok
(
hres
==
S_OK
,
"SASIID failed with FADF_HAVEIID set for vt %d with %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
ok
(
hres
==
S_OK
,
"SASIID failed with FADF_HAVEIID set for vt %d with %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
hres
=
p
SafeArrayGetIID
(
a
,
&
iid
);
hres
=
SafeArrayGetIID
(
a
,
&
iid
);
ok
(
hres
==
S_OK
,
"SAGIID failed with FADF_HAVEIID set for vt %d with %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
ok
(
hres
==
S_OK
,
"SAGIID failed with FADF_HAVEIID set for vt %d with %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
ok
(
IsEqualGUID
(
&
iid
,
&
IID_IStorage
),
"returned iid is not IID_IStorage
\n
"
);
ok
(
IsEqualGUID
(
&
iid
,
&
IID_IStorage
),
"returned iid is not IID_IStorage
\n
"
);
}
else
{
}
else
{
hres
=
p
SafeArraySetIID
(
a
,
&
IID_IStorage
);
/* random IID */
hres
=
SafeArraySetIID
(
a
,
&
IID_IStorage
);
/* random IID */
ok
(
hres
==
E_INVALIDARG
,
"SASIID did not failed with !FADF_HAVEIID set for vt %d with %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"SASIID did not failed with !FADF_HAVEIID set for vt %d with %x
\n
"
,
vttypes
[
i
].
vt
,
hres
);
}
}
hres
=
SafeArrayDestroyDescriptor
(
a
);
hres
=
SafeArrayDestroyDescriptor
(
a
);
...
@@ -885,12 +881,8 @@ static void test_SafeArrayCreateLockDestroy(void)
...
@@ -885,12 +881,8 @@ static void test_SafeArrayCreateLockDestroy(void)
{
{
ok
((
sa
->
fFeatures
&
FADF_HAVEIID
)
==
0
,
ok
((
sa
->
fFeatures
&
FADF_HAVEIID
)
==
0
,
"Non interface type should not have FADF_HAVEIID
\n
"
);
"Non interface type should not have FADF_HAVEIID
\n
"
);
if
(
pSafeArraySetIID
)
hres
=
SafeArraySetIID
(
sa
,
&
IID_IUnknown
);
{
ok
(
hres
==
E_INVALIDARG
,
"Unexpected ret value %#x.
\n
"
,
hres
);
hres
=
pSafeArraySetIID
(
sa
,
&
IID_IUnknown
);
ok
(
hres
==
E_INVALIDARG
,
"Non interface type allowed SetIID(), hres %x
\n
"
,
hres
);
}
if
(
vt
!=
VT_RECORD
)
if
(
vt
!=
VT_RECORD
)
{
{
VARTYPE
aVt
;
VARTYPE
aVt
;
...
@@ -908,12 +900,8 @@ static void test_SafeArrayCreateLockDestroy(void)
...
@@ -908,12 +900,8 @@ static void test_SafeArrayCreateLockDestroy(void)
else
else
{
{
ok
(
sa
->
fFeatures
&
FADF_HAVEIID
,
"Interface type should have FADF_HAVEIID
\n
"
);
ok
(
sa
->
fFeatures
&
FADF_HAVEIID
,
"Interface type should have FADF_HAVEIID
\n
"
);
if
(
pSafeArraySetIID
)
hres
=
SafeArraySetIID
(
sa
,
&
IID_IUnknown
);
{
ok
(
hres
==
S_OK
,
"Failed to set array IID, hres %#x.
\n
"
,
hres
);
hres
=
pSafeArraySetIID
(
sa
,
&
IID_IUnknown
);
ok
(
hres
==
S_OK
,
"Non interface type disallowed SetIID(), hres %x
\n
"
,
hres
);
}
ok
((
sa
->
fFeatures
&
FADF_HAVEVARTYPE
)
==
0
,
ok
((
sa
->
fFeatures
&
FADF_HAVEVARTYPE
)
==
0
,
"Interface type %d should not have FADF_HAVEVARTYPE
\n
"
,
vt
);
"Interface type %d should not have FADF_HAVEVARTYPE
\n
"
,
vt
);
}
}
...
@@ -1544,25 +1532,14 @@ static void test_SafeArrayCreateEx(void)
...
@@ -1544,25 +1532,14 @@ static void test_SafeArrayCreateEx(void)
if
(
sa
)
if
(
sa
)
{
{
GUID
guid
;
GUID
guid
;
if
(
pSafeArrayGetIID
)
{
hres
=
SafeArrayGetIID
(
sa
,
&
guid
);
hres
=
pSafeArrayGetIID
(
sa
,
&
guid
);
ok
(
hres
==
S_OK
,
"Failed to get array IID, hres %#x.
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"CreateEx (ITypeInfo) no IID hres 0x%x
\n
"
,
hres
);
ok
(
IsEqualGUID
(
&
guid
,
&
IID_ITypeInfo
),
"CreateEx (ITypeInfo) bad IID
\n
"
);
if
(
hres
==
S_OK
)
hres
=
SafeArraySetIID
(
sa
,
&
IID_IUnknown
);
{
ok
(
hres
==
S_OK
,
"Failed to set IID, hres = %8x
\n
"
,
hres
);
ok
(
IsEqualGUID
(
&
guid
,
&
IID_ITypeInfo
),
"CreateEx (ITypeInfo) bad IID
\n
"
);
hres
=
SafeArrayGetIID
(
sa
,
&
guid
);
}
ok
(
hres
==
S_OK
&&
IsEqualGUID
(
&
guid
,
&
IID_IUnknown
),
"Set bad IID
\n
"
);
}
if
(
pSafeArraySetIID
)
{
hres
=
pSafeArraySetIID
(
sa
,
&
IID_IUnknown
);
ok
(
hres
==
S_OK
,
"Failed to set IID, hres = %8x
\n
"
,
hres
);
if
(
hres
==
S_OK
&&
pSafeArrayGetIID
)
{
hres
=
pSafeArrayGetIID
(
sa
,
&
guid
);
ok
(
hres
==
S_OK
&&
IsEqualGUID
(
&
guid
,
&
IID_IUnknown
),
"Set bad IID
\n
"
);
}
}
hres
=
SafeArrayDestroy
(
sa
);
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
}
}
...
@@ -1573,15 +1550,10 @@ static void test_SafeArrayCreateEx(void)
...
@@ -1573,15 +1550,10 @@ static void test_SafeArrayCreateEx(void)
if
(
sa
)
if
(
sa
)
{
{
GUID
guid
;
GUID
guid
;
if
(
pSafeArrayGetIID
)
{
hres
=
SafeArrayGetIID
(
sa
,
&
guid
);
hres
=
pSafeArrayGetIID
(
sa
,
&
guid
);
ok
(
hres
==
S_OK
,
"Failed to get array IID, hres %#x.
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"CreateEx (NULL) no IID hres 0x%x
\n
"
,
hres
);
ok
(
IsEqualGUID
(
&
guid
,
&
IID_IDispatch
),
"CreateEx (NULL) bad IID
\n
"
);
if
(
hres
==
S_OK
)
{
ok
(
IsEqualGUID
(
&
guid
,
&
IID_IDispatch
),
"CreateEx (NULL) bad IID
\n
"
);
}
}
hres
=
SafeArrayDestroy
(
sa
);
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
}
}
...
@@ -1592,15 +1564,10 @@ static void test_SafeArrayCreateEx(void)
...
@@ -1592,15 +1564,10 @@ static void test_SafeArrayCreateEx(void)
if
(
sa
)
if
(
sa
)
{
{
GUID
guid
;
GUID
guid
;
if
(
pSafeArrayGetIID
)
{
hres
=
SafeArrayGetIID
(
sa
,
&
guid
);
hres
=
pSafeArrayGetIID
(
sa
,
&
guid
);
ok
(
hres
==
S_OK
,
"Failed to get array IID, hres %#x.
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"CreateEx (NULL-Unk) no IID hres 0x%x
\n
"
,
hres
);
ok
(
IsEqualGUID
(
&
guid
,
&
IID_IUnknown
),
"CreateEx (NULL-Unk) bad IID
\n
"
);
if
(
hres
==
S_OK
)
{
ok
(
IsEqualGUID
(
&
guid
,
&
IID_IUnknown
),
"CreateEx (NULL-Unk) bad IID
\n
"
);
}
}
hres
=
SafeArrayDestroy
(
sa
);
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
}
}
...
@@ -2125,8 +2092,6 @@ START_TEST(safearray)
...
@@ -2125,8 +2092,6 @@ START_TEST(safearray)
GETPTR
(
SafeArrayAllocDescriptorEx
);
GETPTR
(
SafeArrayAllocDescriptorEx
);
GETPTR
(
SafeArrayCopyData
);
GETPTR
(
SafeArrayCopyData
);
GETPTR
(
SafeArrayGetIID
);
GETPTR
(
SafeArraySetIID
);
GETPTR
(
SafeArrayGetVartype
);
GETPTR
(
SafeArrayGetVartype
);
GETPTR
(
SafeArrayCreateEx
);
GETPTR
(
SafeArrayCreateEx
);
GETPTR
(
SafeArrayCreateVector
);
GETPTR
(
SafeArrayCreateVector
);
...
...
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