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
7f01fdb6
Commit
7f01fdb6
authored
Nov 23, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32/safearray: Fix an error code when trying to redim fixed arrays.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
fadefecd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
32 deletions
+74
-32
safearray.c
dlls/oleaut32/safearray.c
+2
-2
safearray.c
dlls/oleaut32/tests/safearray.c
+72
-30
No files found.
dlls/oleaut32/safearray.c
View file @
7f01fdb6
...
@@ -1460,10 +1460,10 @@ HRESULT WINAPI SafeArrayRedim(SAFEARRAY *psa, SAFEARRAYBOUND *psabound)
...
@@ -1460,10 +1460,10 @@ HRESULT WINAPI SafeArrayRedim(SAFEARRAY *psa, SAFEARRAYBOUND *psabound)
TRACE
(
"(%p,%p)
\n
"
,
psa
,
psabound
);
TRACE
(
"(%p,%p)
\n
"
,
psa
,
psabound
);
if
(
!
psa
||
psa
->
fFeatures
&
FADF_FIXEDSIZE
||
!
psabound
)
if
(
!
psa
||
!
psabound
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
if
(
psa
->
cLocks
>
0
)
if
(
psa
->
fFeatures
&
FADF_FIXEDSIZE
||
psa
->
cLocks
)
return
DISP_E_ARRAYISLOCKED
;
return
DISP_E_ARRAYISLOCKED
;
hr
=
SafeArrayLock
(
psa
);
hr
=
SafeArrayLock
(
psa
);
...
...
dlls/oleaut32/tests/safearray.c
View file @
7f01fdb6
...
@@ -1291,35 +1291,6 @@ static void test_SafeArrayGetPutElement_IUnknown(void)
...
@@ -1291,35 +1291,6 @@ static void test_SafeArrayGetPutElement_IUnknown(void)
ok
(
xtunk
.
ref
==
2
,
"Failed to decrement refcount of iface.
\n
"
);
ok
(
xtunk
.
ref
==
2
,
"Failed to decrement refcount of iface.
\n
"
);
}
}
static
void
test_SafeArrayRedim_IUnknown
(
void
)
{
SAFEARRAYBOUND
sab
;
LONG
indices
[
1
];
SAFEARRAY
*
sa
;
HRESULT
hres
;
sab
.
lLbound
=
1
;
sab
.
cElements
=
2
;
sa
=
SafeArrayCreate
(
VT_UNKNOWN
,
1
,
&
sab
);
ok
(
sa
!=
NULL
,
"UNKNOWN test couldn't create array
\n
"
);
if
(
!
sa
)
return
;
ok
(
sa
->
cbElements
==
sizeof
(
LPUNKNOWN
),
"LPUNKNOWN size mismatch
\n
"
);
indices
[
0
]
=
2
;
xtunk
.
ref
=
1
;
hres
=
SafeArrayPutElement
(
sa
,
indices
,
&
xtunk
.
IUnknown_iface
);
ok
(
hres
==
S_OK
,
"Failed to put IUnknown element hres 0x%lx
\n
"
,
hres
);
ok
(
xtunk
.
ref
==
2
,
"Failed to increment refcount of iface.
\n
"
);
sab
.
cElements
=
1
;
hres
=
SafeArrayRedim
(
sa
,
&
sab
);
ok
(
hres
==
S_OK
,
"Failed to shrink array hres 0x%lx
\n
"
,
hres
);
ok
(
xtunk
.
ref
==
1
,
"Failed to decrement refcount
\n
"
);
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"got 0x%08lx
\n
"
,
hres
);
}
static
void
test_SafeArrayGetPutElement_VARIANT
(
void
)
static
void
test_SafeArrayGetPutElement_VARIANT
(
void
)
{
{
SAFEARRAYBOUND
sab
;
SAFEARRAYBOUND
sab
;
...
@@ -2063,6 +2034,77 @@ static void test_safearray_layout(void)
...
@@ -2063,6 +2034,77 @@ static void test_safearray_layout(void)
IRecordInfo_Release
(
&
irec
->
IRecordInfo_iface
);
IRecordInfo_Release
(
&
irec
->
IRecordInfo_iface
);
}
}
static
void
test_SafeArrayRedim
(
void
)
{
SAFEARRAYBOUND
sab
;
LONG
indices
[
1
];
SAFEARRAY
*
sa
;
HRESULT
hres
;
sab
.
lLbound
=
1
;
sab
.
cElements
=
2
;
hres
=
SafeArrayRedim
(
NULL
,
&
sab
);
ok
(
hres
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hres
);
sa
=
SafeArrayCreate
(
VT_UNKNOWN
,
1
,
&
sab
);
ok
(
!!
sa
,
"Failed to create an array.
\n
"
);
hres
=
SafeArrayRedim
(
sa
,
NULL
);
ok
(
hres
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hres
);
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hres
);
/* VT_UNKNOWN */
sab
.
lLbound
=
1
;
sab
.
cElements
=
2
;
sa
=
SafeArrayCreate
(
VT_UNKNOWN
,
1
,
&
sab
);
ok
(
!!
sa
,
"Failed to create an array.
\n
"
);
ok
(
sa
->
cbElements
==
sizeof
(
IUnknown
*
),
"Unexpected element size.
\n
"
);
indices
[
0
]
=
2
;
xtunk
.
ref
=
1
;
hres
=
SafeArrayPutElement
(
sa
,
indices
,
&
xtunk
.
IUnknown_iface
);
ok
(
hres
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hres
);
ok
(
xtunk
.
ref
==
2
,
"Failed to increment refcount of iface.
\n
"
);
sab
.
cElements
=
1
;
hres
=
SafeArrayRedim
(
sa
,
&
sab
);
ok
(
hres
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hres
);
ok
(
xtunk
.
ref
==
1
,
"Failed to decrement refcount
\n
"
);
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hres
);
/* FADF_FIXEDSIZE */
sab
.
lLbound
=
1
;
sab
.
cElements
=
2
;
sa
=
SafeArrayCreate
(
VT_I4
,
1
,
&
sab
);
ok
(
!!
sa
,
"Failed to create an array.
\n
"
);
sab
.
cElements
=
3
;
hres
=
SafeArrayRedim
(
sa
,
&
sab
);
ok
(
hres
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hres
);
sab
.
cElements
=
4
;
sa
->
fFeatures
|=
FADF_FIXEDSIZE
;
hres
=
SafeArrayRedim
(
sa
,
&
sab
);
ok
(
hres
==
DISP_E_ARRAYISLOCKED
,
"Unexpected hr %#lx.
\n
"
,
hres
);
sa
->
fFeatures
&=
~
FADF_FIXEDSIZE
;
hres
=
SafeArrayRedim
(
sa
,
&
sab
);
ok
(
hres
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hres
);
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hres
);
/* Locked array */
sab
.
lLbound
=
1
;
sab
.
cElements
=
2
;
sa
=
SafeArrayCreate
(
VT_I4
,
1
,
&
sab
);
ok
(
!!
sa
,
"Failed to create an array.
\n
"
);
hres
=
SafeArrayLock
(
sa
);
ok
(
hres
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hres
);
sab
.
cElements
=
3
;
hres
=
SafeArrayRedim
(
sa
,
&
sab
);
ok
(
hres
==
DISP_E_ARRAYISLOCKED
,
"Unexpected hr %#lx.
\n
"
,
hres
);
hres
=
SafeArrayUnlock
(
sa
);
ok
(
hres
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hres
);
hres
=
SafeArrayDestroy
(
sa
);
ok
(
hres
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hres
);
}
START_TEST
(
safearray
)
START_TEST
(
safearray
)
{
{
hOleaut32
=
GetModuleHandleA
(
"oleaut32.dll"
);
hOleaut32
=
GetModuleHandleA
(
"oleaut32.dll"
);
...
@@ -2089,7 +2131,7 @@ START_TEST(safearray)
...
@@ -2089,7 +2131,7 @@ START_TEST(safearray)
test_SafeArrayGetPutElement
();
test_SafeArrayGetPutElement
();
test_SafeArrayGetPutElement_BSTR
();
test_SafeArrayGetPutElement_BSTR
();
test_SafeArrayGetPutElement_IUnknown
();
test_SafeArrayGetPutElement_IUnknown
();
test_SafeArrayRedim
_IUnknown
();
test_SafeArrayRedim
();
test_SafeArrayGetPutElement_VARIANT
();
test_SafeArrayGetPutElement_VARIANT
();
test_safearray_layout
();
test_safearray_layout
();
}
}
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