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
46ebaa9b
Commit
46ebaa9b
authored
Dec 04, 2010
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Dec 05, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32/tests: Use an iface instead of a vtbl pointer in HeapUnknown.
parent
b8ef455d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
17 deletions
+27
-17
marshal.c
dlls/ole32/tests/marshal.c
+11
-6
moniker.c
dlls/ole32/tests/moniker.c
+16
-11
No files found.
dlls/ole32/tests/marshal.c
View file @
46ebaa9b
...
...
@@ -1697,10 +1697,15 @@ static void test_proxy_interfaces(void)
typedef
struct
{
const
IUnknownVtbl
*
lpVtbl
;
IUnknown
IUnknown_iface
;
ULONG
refs
;
}
HeapUnknown
;
static
inline
HeapUnknown
*
impl_from_IUnknown
(
IUnknown
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
HeapUnknown
,
IUnknown_iface
);
}
static
HRESULT
WINAPI
HeapUnknown_QueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
...
...
@@ -1715,13 +1720,13 @@ static HRESULT WINAPI HeapUnknown_QueryInterface(IUnknown *iface, REFIID riid, v
static
ULONG
WINAPI
HeapUnknown_AddRef
(
IUnknown
*
iface
)
{
HeapUnknown
*
This
=
(
HeapUnknown
*
)
iface
;
HeapUnknown
*
This
=
impl_from_IUnknown
(
iface
)
;
return
InterlockedIncrement
((
LONG
*
)
&
This
->
refs
);
}
static
ULONG
WINAPI
HeapUnknown_Release
(
IUnknown
*
iface
)
{
HeapUnknown
*
This
=
(
HeapUnknown
*
)
iface
;
HeapUnknown
*
This
=
impl_from_IUnknown
(
iface
)
;
ULONG
refs
=
InterlockedDecrement
((
LONG
*
)
&
This
->
refs
);
if
(
!
refs
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
refs
;
...
...
@@ -1744,7 +1749,7 @@ static void test_proxybuffer(REFIID riid)
CLSID
clsid
;
HeapUnknown
*
pUnkOuter
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
pUnkOuter
));
pUnkOuter
->
lpVtbl
=
&
HeapUnknown_Vtbl
;
pUnkOuter
->
IUnknown_iface
.
lpVtbl
=
&
HeapUnknown_Vtbl
;
pUnkOuter
->
refs
=
1
;
hr
=
CoGetPSClsid
(
riid
,
&
clsid
);
...
...
@@ -1753,13 +1758,13 @@ static void test_proxybuffer(REFIID riid)
hr
=
CoGetClassObject
(
&
clsid
,
CLSCTX_INPROC_SERVER
,
NULL
,
&
IID_IPSFactoryBuffer
,
(
LPVOID
*
)
&
psfb
);
ok_ole_success
(
hr
,
CoGetClassObject
);
hr
=
IPSFactoryBuffer_CreateProxy
(
psfb
,
(
IUnknown
*
)
pUnkOuter
,
riid
,
&
proxy
,
&
lpvtbl
);
hr
=
IPSFactoryBuffer_CreateProxy
(
psfb
,
&
pUnkOuter
->
IUnknown_iface
,
riid
,
&
proxy
,
&
lpvtbl
);
ok_ole_success
(
hr
,
IPSFactoryBuffer_CreateProxy
);
ok
(
lpvtbl
!=
NULL
,
"IPSFactoryBuffer_CreateProxy succeeded, but returned a NULL vtable!
\n
"
);
/* release our reference to the outer unknown object - the PS factory
* buffer will have AddRef's it in the CreateProxy call */
refs
=
IUnknown_Release
(
(
IUnknown
*
)
pUnkOuter
);
refs
=
IUnknown_Release
(
&
pUnkOuter
->
IUnknown_iface
);
ok
(
refs
==
1
,
"Ref count of outer unknown should have been 1 instead of %d
\n
"
,
refs
);
refs
=
IPSFactoryBuffer_Release
(
psfb
);
...
...
dlls/ole32/tests/moniker.c
View file @
46ebaa9b
...
...
@@ -156,10 +156,15 @@ static IClassFactory Test_ClassFactory = { &TestClassFactory_Vtbl };
typedef
struct
{
const
IUnknownVtbl
*
lpVtbl
;
IUnknown
IUnknown_iface
;
ULONG
refs
;
}
HeapUnknown
;
static
inline
HeapUnknown
*
impl_from_IUnknown
(
IUnknown
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
HeapUnknown
,
IUnknown_iface
);
}
static
HRESULT
WINAPI
HeapUnknown_QueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
...
...
@@ -174,13 +179,13 @@ static HRESULT WINAPI HeapUnknown_QueryInterface(IUnknown *iface, REFIID riid, v
static
ULONG
WINAPI
HeapUnknown_AddRef
(
IUnknown
*
iface
)
{
HeapUnknown
*
This
=
(
HeapUnknown
*
)
iface
;
HeapUnknown
*
This
=
impl_from_IUnknown
(
iface
)
;
return
InterlockedIncrement
((
LONG
*
)
&
This
->
refs
);
}
static
ULONG
WINAPI
HeapUnknown_Release
(
IUnknown
*
iface
)
{
HeapUnknown
*
This
=
(
HeapUnknown
*
)
iface
;
HeapUnknown
*
This
=
impl_from_IUnknown
(
iface
)
;
ULONG
refs
=
InterlockedDecrement
((
LONG
*
)
&
This
->
refs
);
if
(
!
refs
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
refs
;
...
...
@@ -1880,9 +1885,9 @@ static void test_bind_context(void)
ok
(
hr
==
E_INVALIDARG
,
"IBindCtx_RegisterObjectParam should have returned E_INVALIDARG instead of 0x%08x
\n
"
,
hr
);
unknown
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
unknown
));
unknown
->
lpVtbl
=
&
HeapUnknown_Vtbl
;
unknown
->
IUnknown_iface
.
lpVtbl
=
&
HeapUnknown_Vtbl
;
unknown
->
refs
=
1
;
hr
=
IBindCtx_RegisterObjectParam
(
pBindCtx
,
(
WCHAR
*
)
wszParamName
,
(
IUnknown
*
)
&
unknown
->
lpVtbl
);
hr
=
IBindCtx_RegisterObjectParam
(
pBindCtx
,
(
WCHAR
*
)
wszParamName
,
&
unknown
->
IUnknown_iface
);
ok_ole_success
(
hr
,
"IBindCtx_RegisterObjectParam"
);
hr
=
IBindCtx_GetObjectParam
(
pBindCtx
,
(
WCHAR
*
)
wszParamName
,
&
param_obj
);
...
...
@@ -1907,23 +1912,23 @@ static void test_bind_context(void)
ok
(
hr
==
E_INVALIDARG
,
"IBindCtx_RevokeObjectBound(NULL) should have return E_INVALIDARG instead of 0x%08x
\n
"
,
hr
);
unknown2
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
unknown
));
unknown2
->
lpVtbl
=
&
HeapUnknown_Vtbl
;
unknown2
->
IUnknown_iface
.
lpVtbl
=
&
HeapUnknown_Vtbl
;
unknown2
->
refs
=
1
;
hr
=
IBindCtx_RegisterObjectBound
(
pBindCtx
,
(
IUnknown
*
)
&
unknown2
->
lpVtbl
);
hr
=
IBindCtx_RegisterObjectBound
(
pBindCtx
,
&
unknown2
->
IUnknown_iface
);
ok_ole_success
(
hr
,
"IBindCtx_RegisterObjectBound"
);
hr
=
IBindCtx_RevokeObjectBound
(
pBindCtx
,
(
IUnknown
*
)
&
unknown2
->
lpVtbl
);
hr
=
IBindCtx_RevokeObjectBound
(
pBindCtx
,
&
unknown2
->
IUnknown_iface
);
ok_ole_success
(
hr
,
"IBindCtx_RevokeObjectBound"
);
hr
=
IBindCtx_RevokeObjectBound
(
pBindCtx
,
(
IUnknown
*
)
&
unknown2
->
lpVtbl
);
hr
=
IBindCtx_RevokeObjectBound
(
pBindCtx
,
&
unknown2
->
IUnknown_iface
);
ok
(
hr
==
MK_E_NOTBOUND
,
"IBindCtx_RevokeObjectBound with not bound object should have returned MK_E_NOTBOUND instead of 0x%08x
\n
"
,
hr
);
IBindCtx_Release
(
pBindCtx
);
refs
=
IUnknown_Release
(
(
IUnknown
*
)
&
unknown
->
lpVtbl
);
refs
=
IUnknown_Release
(
&
unknown
->
IUnknown_iface
);
ok
(
!
refs
,
"object param should have been destroyed, instead of having %d refs
\n
"
,
refs
);
refs
=
IUnknown_Release
(
(
IUnknown
*
)
&
unknown2
->
lpVtbl
);
refs
=
IUnknown_Release
(
&
unknown2
->
IUnknown_iface
);
ok
(
!
refs
,
"bound object should have been destroyed, instead of having %d refs
\n
"
,
refs
);
}
...
...
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