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
b07ebe68
Commit
b07ebe68
authored
Nov 30, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 01, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32/tests: Some tests for SafeArrayDestroyData().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
395b9c32
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
8 deletions
+67
-8
safearray.c
dlls/oleaut32/tests/safearray.c
+67
-8
No files found.
dlls/oleaut32/tests/safearray.c
View file @
b07ebe68
...
@@ -1965,40 +1965,99 @@ static void test_SafeArrayChangeTypeEx(void)
...
@@ -1965,40 +1965,99 @@ static void test_SafeArrayChangeTypeEx(void)
static
void
test_SafeArrayDestroyData
(
void
)
static
void
test_SafeArrayDestroyData
(
void
)
{
{
SAFEARRAYBOUND
sab
;
SAFEARRAYBOUND
sab
[
2
]
;
SAFEARRAY
*
sa
;
SAFEARRAY
*
sa
;
HRESULT
hres
;
HRESULT
hres
;
int
value
=
0xdeadbeef
;
int
value
=
0xdeadbeef
;
LONG
index
[
1
];
LONG
index
[
1
];
void
*
temp_pvData
;
void
*
temp_pvData
;
USHORT
features
;
sab
.
lLbound
=
0
;
sab
[
0
]
.
lLbound
=
0
;
sab
.
cElements
=
10
;
sab
[
0
]
.
cElements
=
10
;
sa
=
SafeArrayCreate
(
VT_INT
,
1
,
&
sab
);
sa
=
SafeArrayCreate
(
VT_INT
,
1
,
sab
);
ok
(
sa
!=
NULL
,
"Create() failed.
\n
"
);
ok
(
sa
!=
NULL
,
"Create() failed.
\n
"
);
if
(
!
sa
)
ok
(
sa
->
fFeatures
==
FADF_HAVEVARTYPE
,
"got 0x%x
\n
"
,
sa
->
fFeatures
);
return
;
index
[
0
]
=
1
;
index
[
0
]
=
1
;
SafeArrayPutElement
(
sa
,
index
,
&
value
);
SafeArrayPutElement
(
sa
,
index
,
&
value
);
/* SafeArrayDestroyData shouldn't free pvData if FADF_STATIC is set. */
/* SafeArrayDestroyData shouldn't free pvData if FADF_STATIC is set. */
sa
->
fFeatures
|=
FADF_STATIC
;
features
=
(
sa
->
fFeatures
|=
FADF_STATIC
)
;
temp_pvData
=
sa
->
pvData
;
temp_pvData
=
sa
->
pvData
;
hres
=
SafeArrayDestroyData
(
sa
);
hres
=
SafeArrayDestroyData
(
sa
);
ok
(
hres
==
S_OK
,
"SADData FADF_STATIC failed, error code %x.
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"SADData FADF_STATIC failed, error code %x.
\n
"
,
hres
);
ok
(
features
==
sa
->
fFeatures
,
"got 0x%x
\n
"
,
sa
->
fFeatures
);
ok
(
sa
->
pvData
==
temp_pvData
,
"SADData FADF_STATIC: pvData=%p, expected %p (fFeatures = %d).
\n
"
,
ok
(
sa
->
pvData
==
temp_pvData
,
"SADData FADF_STATIC: pvData=%p, expected %p (fFeatures = %d).
\n
"
,
sa
->
pvData
,
temp_pvData
,
sa
->
fFeatures
);
sa
->
pvData
,
temp_pvData
,
sa
->
fFeatures
);
SafeArrayGetElement
(
sa
,
index
,
&
value
);
SafeArrayGetElement
(
sa
,
index
,
&
value
);
ok
(
value
==
0
,
"Data not cleared after SADData
\n
"
);
ok
(
value
==
0
,
"Data not cleared after SADData
\n
"
);
/* Clear FADF_STATIC, now really destroy the data. */
/* Clear FADF_STATIC, now really destroy the data. */
sa
->
fFeatures
^=
FADF_STATIC
;
features
=
(
sa
->
fFeatures
^=
FADF_STATIC
)
;
hres
=
SafeArrayDestroyData
(
sa
);
hres
=
SafeArrayDestroyData
(
sa
);
ok
(
hres
==
S_OK
,
"SADData !FADF_STATIC failed, error code %x.
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"SADData !FADF_STATIC failed, error code %x.
\n
"
,
hres
);
ok
(
features
==
sa
->
fFeatures
,
"got 0x%x
\n
"
,
sa
->
fFeatures
);
ok
(
sa
->
pvData
==
NULL
,
"SADData !FADF_STATIC: pvData=%p, expected NULL.
\n
"
,
sa
->
pvData
);
ok
(
sa
->
pvData
==
NULL
,
"SADData !FADF_STATIC: pvData=%p, expected NULL.
\n
"
,
sa
->
pvData
);
hres
=
SafeArrayDestroy
(
sa
);
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"SAD failed, error code %x.
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"SAD failed, error code %x.
\n
"
,
hres
);
/* two dimensions */
sab
[
0
].
lLbound
=
0
;
sab
[
0
].
cElements
=
10
;
sab
[
1
].
lLbound
=
0
;
sab
[
1
].
cElements
=
10
;
sa
=
SafeArrayCreate
(
VT_INT
,
2
,
sab
);
ok
(
sa
!=
NULL
,
"Create() failed.
\n
"
);
ok
(
sa
->
fFeatures
==
FADF_HAVEVARTYPE
,
"got 0x%x
\n
"
,
sa
->
fFeatures
);
features
=
sa
->
fFeatures
;
hres
=
SafeArrayDestroyData
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
ok
(
features
==
sa
->
fFeatures
,
"got 0x%x
\n
"
,
sa
->
fFeatures
);
SafeArrayDestroy
(
sa
);
/* try to destroy data from descriptor */
hres
=
SafeArrayAllocDescriptor
(
1
,
&
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
ok
(
sa
->
fFeatures
==
0
,
"got 0x%x
\n
"
,
sa
->
fFeatures
);
hres
=
SafeArrayDestroyData
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
ok
(
sa
->
fFeatures
==
0
,
"got 0x%x
\n
"
,
sa
->
fFeatures
);
hres
=
SafeArrayDestroyDescriptor
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
hres
=
SafeArrayAllocDescriptor
(
2
,
&
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
ok
(
sa
->
fFeatures
==
0
,
"got 0x%x
\n
"
,
sa
->
fFeatures
);
hres
=
SafeArrayDestroyData
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
ok
(
sa
->
fFeatures
==
0
,
"got 0x%x
\n
"
,
sa
->
fFeatures
);
hres
=
SafeArrayDestroyDescriptor
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
/* vector case */
sa
=
SafeArrayCreateVector
(
VT_I4
,
0
,
10
);
ok
(
sa
!=
NULL
,
"got %p
\n
"
,
sa
);
ok
(
sa
->
fFeatures
==
(
FADF_CREATEVECTOR
|
FADF_HAVEVARTYPE
),
"got 0x%x
\n
"
,
sa
->
fFeatures
);
ok
(
sa
->
pvData
!=
NULL
,
"got %p
\n
"
,
sa
->
pvData
);
hres
=
SafeArrayDestroyData
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
todo_wine
ok
(
sa
->
fFeatures
==
FADF_HAVEVARTYPE
,
"got 0x%x
\n
"
,
sa
->
fFeatures
);
ok
(
sa
->
pvData
!=
NULL
,
"got %p
\n
"
,
sa
->
pvData
);
/* There seems to be a bug on windows, especially visible on 64bit systems,
probably double-free of similar issue. */
sa
->
pvData
=
NULL
;
SafeArrayDestroy
(
sa
);
}
}
static
void
test_safearray_layout
(
void
)
static
void
test_safearray_layout
(
void
)
...
...
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