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
7de48a74
Commit
7de48a74
authored
Sep 30, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32/composite: Fix argument handling in component enumerator methods.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
441ef408
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
209 additions
and
43 deletions
+209
-43
compositemoniker.c
dlls/ole32/compositemoniker.c
+31
-29
moniker.c
dlls/ole32/tests/moniker.c
+178
-14
No files found.
dlls/ole32/compositemoniker.c
View file @
7de48a74
...
@@ -495,7 +495,7 @@ static HRESULT WINAPI CompositeMonikerImpl_Enum(IMoniker *iface, BOOL forward, I
...
@@ -495,7 +495,7 @@ static HRESULT WINAPI CompositeMonikerImpl_Enum(IMoniker *iface, BOOL forward, I
TRACE
(
"%p, %d, %p
\n
"
,
iface
,
forward
,
ppenumMoniker
);
TRACE
(
"%p, %d, %p
\n
"
,
iface
,
forward
,
ppenumMoniker
);
if
(
!
ppenumMoniker
)
if
(
!
ppenumMoniker
)
return
E_
POINTER
;
return
E_
INVALIDARG
;
if
(
FAILED
(
hr
=
composite_get_components_alloc
(
moniker
,
&
monikers
)))
if
(
FAILED
(
hr
=
composite_get_components_alloc
(
moniker
,
&
monikers
)))
return
hr
;
return
hr
;
...
@@ -1346,44 +1346,45 @@ EnumMonikerImpl_Release(IEnumMoniker* iface)
...
@@ -1346,44 +1346,45 @@ EnumMonikerImpl_Release(IEnumMoniker* iface)
return
ref
;
return
ref
;
}
}
/******************************************************************************
static
HRESULT
WINAPI
EnumMonikerImpl_Next
(
IEnumMoniker
*
iface
,
ULONG
count
,
* EnumMonikerImpl_Next
IMoniker
**
m
,
ULONG
*
fetched
)
******************************************************************************/
static
HRESULT
WINAPI
EnumMonikerImpl_Next
(
IEnumMoniker
*
iface
,
ULONG
celt
,
IMoniker
**
rgelt
,
ULONG
*
pceltFethed
)
{
{
EnumMonikerImpl
*
This
=
impl_from_IEnumMoniker
(
iface
);
EnumMonikerImpl
*
This
=
impl_from_IEnumMoniker
(
iface
);
ULONG
i
;
ULONG
i
;
TRACE
(
"%p, %u, %p, %p.
\n
"
,
iface
,
count
,
m
,
fetched
);
if
(
!
m
)
return
E_INVALIDARG
;
*
m
=
NULL
;
/* retrieve the requested number of moniker from the current position */
/* retrieve the requested number of moniker from the current position */
for
(
i
=
0
;((
This
->
currentPos
<
This
->
tabSize
)
&&
(
i
<
c
el
t
));
i
++
)
for
(
i
=
0
;((
This
->
currentPos
<
This
->
tabSize
)
&&
(
i
<
c
oun
t
));
i
++
)
{
{
rgelt
[
i
]
=
This
->
tabMoniker
[
This
->
currentPos
++
];
m
[
i
]
=
This
->
tabMoniker
[
This
->
currentPos
++
];
IMoniker_AddRef
(
rgelt
[
i
]);
IMoniker_AddRef
(
m
[
i
]);
}
}
if
(
pceltFethed
!=
NULL
)
if
(
fetched
)
*
pceltFethed
=
i
;
*
fetched
=
i
;
if
(
i
==
celt
)
return
i
==
count
?
S_OK
:
S_FALSE
;
return
S_OK
;
else
return
S_FALSE
;
}
}
/******************************************************************************
static
HRESULT
WINAPI
EnumMonikerImpl_Skip
(
IEnumMoniker
*
iface
,
ULONG
count
)
* EnumMonikerImpl_Skip
******************************************************************************/
static
HRESULT
WINAPI
EnumMonikerImpl_Skip
(
IEnumMoniker
*
iface
,
ULONG
celt
)
{
{
EnumMonikerImpl
*
This
=
impl_from_IEnumMoniker
(
iface
);
EnumMonikerImpl
*
This
=
impl_from_IEnumMoniker
(
iface
);
if
((
This
->
currentPos
+
celt
)
>=
This
->
tabSize
)
TRACE
(
"%p, %u.
\n
"
,
iface
,
count
);
if
(
!
count
)
return
S_OK
;
if
((
This
->
currentPos
+
count
)
>=
This
->
tabSize
)
return
S_FALSE
;
return
S_FALSE
;
This
->
currentPos
+=
cel
t
;
This
->
currentPos
+=
coun
t
;
return
S_OK
;
return
S_OK
;
}
}
...
@@ -1401,15 +1402,16 @@ EnumMonikerImpl_Reset(IEnumMoniker* iface)
...
@@ -1401,15 +1402,16 @@ EnumMonikerImpl_Reset(IEnumMoniker* iface)
return
S_OK
;
return
S_OK
;
}
}
/******************************************************************************
static
HRESULT
WINAPI
EnumMonikerImpl_Clone
(
IEnumMoniker
*
iface
,
IEnumMoniker
**
ret
)
* EnumMonikerImpl_Clone
******************************************************************************/
static
HRESULT
WINAPI
EnumMonikerImpl_Clone
(
IEnumMoniker
*
iface
,
IEnumMoniker
**
ppenum
)
{
{
EnumMonikerImpl
*
This
=
impl_from_IEnumMoniker
(
iface
);
EnumMonikerImpl
*
This
=
impl_from_IEnumMoniker
(
iface
);
return
EnumMonikerImpl_CreateEnumMoniker
(
This
->
tabMoniker
,
This
->
tabSize
,
This
->
currentPos
,
TRUE
,
ppenum
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
ret
);
if
(
!
ret
)
return
E_INVALIDARG
;
return
EnumMonikerImpl_CreateEnumMoniker
(
This
->
tabMoniker
,
This
->
tabSize
,
This
->
currentPos
,
TRUE
,
ret
);
}
}
static
const
IEnumMonikerVtbl
VT_EnumMonikerImpl
=
static
const
IEnumMonikerVtbl
VT_EnumMonikerImpl
=
...
...
dlls/ole32/tests/moniker.c
View file @
7de48a74
...
@@ -3163,8 +3163,8 @@ static void test_generic_composite_moniker(void)
...
@@ -3163,8 +3163,8 @@ static void test_generic_composite_moniker(void)
{
"CI1I3"
,
"CA1I2"
,
MKSYS_GENERICCOMPOSITE
,
L"!I1!I2"
},
{
"CI1I3"
,
"CA1I2"
,
MKSYS_GENERICCOMPOSITE
,
L"!I1!I2"
},
};
};
IMoniker
*
moniker
,
*
inverse
,
*
moniker1
,
*
moniker2
,
*
moniker3
,
*
moniker4
;
IMoniker
*
moniker
,
*
inverse
,
*
moniker1
,
*
moniker2
,
*
moniker3
,
*
moniker4
;
IEnumMoniker
*
enummoniker
,
*
enummoniker2
;
struct
test_moniker
*
m
,
*
m2
;
struct
test_moniker
*
m
,
*
m2
;
IEnumMoniker
*
enummoniker
;
IRunningObjectTable
*
rot
;
IRunningObjectTable
*
rot
;
DWORD
hash
,
cookie
;
DWORD
hash
,
cookie
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -3293,19 +3293,6 @@ todo_wine
...
@@ -3293,19 +3293,6 @@ todo_wine
TEST_MONIKER_TYPE
(
inverse
,
MKSYS_GENERICCOMPOSITE
);
TEST_MONIKER_TYPE
(
inverse
,
MKSYS_GENERICCOMPOSITE
);
IMoniker_Release
(
inverse
);
IMoniker_Release
(
inverse
);
/* Enum() */
hr
=
IMoniker_Enum
(
moniker
,
TRUE
,
&
enummoniker
);
ok
(
hr
==
S_OK
,
"Failed to get enumerator, hr %#x.
\n
"
,
hr
);
IEnumMoniker_Release
(
enummoniker
);
hr
=
IMoniker_Enum
(
moniker
,
FALSE
,
&
enummoniker
);
ok
(
hr
==
S_OK
,
"Failed to get enumerator, hr %#x.
\n
"
,
hr
);
IEnumMoniker_Release
(
enummoniker
);
hr
=
IMoniker_Enum
(
moniker
,
FALSE
,
NULL
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
/* BindToObject() */
/* BindToObject() */
hr
=
IMoniker_BindToObject
(
moniker
,
bindctx
,
NULL
,
&
IID_IUnknown
,
(
void
**
)
&
unknown
);
hr
=
IMoniker_BindToObject
(
moniker
,
bindctx
,
NULL
,
&
IID_IUnknown
,
(
void
**
)
&
unknown
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
...
@@ -3646,6 +3633,183 @@ todo_wine {
...
@@ -3646,6 +3633,183 @@ todo_wine {
IMoniker_Release
(
moniker
);
IMoniker_Release
(
moniker
);
/* Enum() */
hr
=
create_moniker_from_desc
(
"CI1CI2I3"
,
&
moniker
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMoniker_Enum
(
moniker
,
FALSE
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
/* Forward direction */
hr
=
IMoniker_Enum
(
moniker
,
TRUE
,
&
enummoniker
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IEnumMoniker_Next
(
enummoniker
,
0
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
moniker2
=
(
void
*
)
0xdeadbeef
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
0
,
&
moniker2
,
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
moniker2
,
"Unexpected pointer.
\n
"
);
len
=
1
;
moniker2
=
(
void
*
)
0xdeadbeef
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
0
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
len
,
"Unexpected count %u.
\n
"
,
len
);
ok
(
!
moniker2
,
"Unexpected pointer.
\n
"
);
hr
=
IEnumMoniker_Skip
(
enummoniker
,
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
len
=
0
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
1
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
len
==
1
,
"Unexpected count %u.
\n
"
,
len
);
TEST_DISPLAY_NAME
(
moniker2
,
L"!I1"
);
IMoniker_Release
(
moniker2
);
len
=
0
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
1
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
len
==
1
,
"Unexpected count %u.
\n
"
,
len
);
TEST_DISPLAY_NAME
(
moniker2
,
L"!I2"
);
IMoniker_Release
(
moniker2
);
len
=
0
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
1
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
len
==
1
,
"Unexpected count %u.
\n
"
,
len
);
TEST_DISPLAY_NAME
(
moniker2
,
L"!I3"
);
IMoniker_Release
(
moniker2
);
len
=
1
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
1
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
len
,
"Unexpected count %u.
\n
"
,
len
);
hr
=
IEnumMoniker_Skip
(
enummoniker
,
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IEnumMoniker_Skip
(
enummoniker
,
1
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IEnumMoniker_Clone
(
enummoniker
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
enummoniker2
=
(
void
*
)
0xdeadbeef
;
hr
=
IEnumMoniker_Clone
(
enummoniker
,
&
enummoniker2
);
todo_wine
{
ok
(
hr
==
E_NOTIMPL
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
enummoniker2
,
"Unexpected pointer.
\n
"
);
}
hr
=
IEnumMoniker_Reset
(
enummoniker
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IEnumMoniker_Skip
(
enummoniker
,
2
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
len
=
0
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
1
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
len
==
1
,
"Unexpected count %u.
\n
"
,
len
);
TEST_DISPLAY_NAME
(
moniker2
,
L"!I3"
);
IMoniker_Release
(
moniker2
);
enummoniker2
=
(
void
*
)
0xdeadbeef
;
hr
=
IEnumMoniker_Clone
(
enummoniker
,
&
enummoniker2
);
todo_wine
{
ok
(
hr
==
E_NOTIMPL
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
enummoniker2
,
"Unexpected pointer.
\n
"
);
}
IEnumMoniker_Release
(
enummoniker
);
/* Backward direction */
hr
=
IMoniker_Enum
(
moniker
,
FALSE
,
&
enummoniker
);
ok
(
hr
==
S_OK
,
"Failed to get enumerator, hr %#x.
\n
"
,
hr
);
hr
=
IEnumMoniker_Next
(
enummoniker
,
0
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
moniker2
=
(
void
*
)
0xdeadbeef
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
0
,
&
moniker2
,
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
moniker2
,
"Unexpected pointer.
\n
"
);
len
=
1
;
moniker2
=
(
void
*
)
0xdeadbeef
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
0
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
len
,
"Unexpected count %u.
\n
"
,
len
);
ok
(
!
moniker2
,
"Unexpected pointer.
\n
"
);
hr
=
IEnumMoniker_Skip
(
enummoniker
,
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
len
=
0
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
1
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
len
==
1
,
"Unexpected count %u.
\n
"
,
len
);
TEST_DISPLAY_NAME
(
moniker2
,
L"!I3"
);
IMoniker_Release
(
moniker2
);
len
=
0
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
1
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
len
==
1
,
"Unexpected count %u.
\n
"
,
len
);
TEST_DISPLAY_NAME
(
moniker2
,
L"!I2"
);
IMoniker_Release
(
moniker2
);
len
=
0
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
1
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
len
==
1
,
"Unexpected count %u.
\n
"
,
len
);
TEST_DISPLAY_NAME
(
moniker2
,
L"!I1"
);
IMoniker_Release
(
moniker2
);
len
=
1
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
1
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
len
,
"Unexpected count %u.
\n
"
,
len
);
hr
=
IEnumMoniker_Skip
(
enummoniker
,
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IEnumMoniker_Skip
(
enummoniker
,
1
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IEnumMoniker_Clone
(
enummoniker
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
enummoniker2
=
(
void
*
)
0xdeadbeef
;
hr
=
IEnumMoniker_Clone
(
enummoniker
,
&
enummoniker2
);
todo_wine
{
ok
(
hr
==
E_NOTIMPL
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
enummoniker2
,
"Unexpected pointer.
\n
"
);
}
hr
=
IEnumMoniker_Reset
(
enummoniker
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IEnumMoniker_Skip
(
enummoniker
,
2
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
len
=
0
;
hr
=
IEnumMoniker_Next
(
enummoniker
,
1
,
&
moniker2
,
&
len
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
len
==
1
,
"Unexpected count %u.
\n
"
,
len
);
TEST_DISPLAY_NAME
(
moniker2
,
L"!I1"
);
IMoniker_Release
(
moniker2
);
enummoniker2
=
(
void
*
)
0xdeadbeef
;
hr
=
IEnumMoniker_Clone
(
enummoniker
,
&
enummoniker2
);
todo_wine
{
ok
(
hr
==
E_NOTIMPL
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
enummoniker2
,
"Unexpected pointer.
\n
"
);
}
IEnumMoniker_Release
(
enummoniker
);
IMoniker_Release
(
moniker
);
IBindCtx_Release
(
bindctx
);
IBindCtx_Release
(
bindctx
);
}
}
...
...
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