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
2a93a8ad
Commit
2a93a8ad
authored
Jan 29, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Add a helper to create antimoniker of specific order.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
292774d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
48 deletions
+29
-48
antimoniker.c
dlls/ole32/antimoniker.c
+29
-48
No files found.
dlls/ole32/antimoniker.c
View file @
2a93a8ad
...
...
@@ -30,6 +30,7 @@
#include "winerror.h"
#include "objbase.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "moniker.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
ole
);
...
...
@@ -38,7 +39,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
typedef
struct
AntiMonikerImpl
{
IMoniker
IMoniker_iface
;
IROTData
IROTData_iface
;
LONG
ref
;
LONG
ref
count
;
IUnknown
*
pMarshal
;
/* custom marshaler */
DWORD
count
;
}
AntiMonikerImpl
;
...
...
@@ -103,37 +104,33 @@ AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
/******************************************************************************
* AntiMoniker_AddRef
******************************************************************************/
static
ULONG
WINAPI
AntiMonikerImpl_AddRef
(
IMoniker
*
iface
)
static
ULONG
WINAPI
AntiMonikerImpl_AddRef
(
IMoniker
*
iface
)
{
AntiMonikerImpl
*
This
=
impl_from_IMoniker
(
iface
);
AntiMonikerImpl
*
moniker
=
impl_from_IMoniker
(
iface
);
ULONG
refcount
=
InterlockedIncrement
(
&
moniker
->
refcount
);
TRACE
(
"
(%p)
\n
"
,
This
);
TRACE
(
"
%p, refcount %u.
\n
"
,
iface
,
refcount
);
return
InterlockedIncrement
(
&
This
->
ref
)
;
return
refcount
;
}
/******************************************************************************
* AntiMoniker_Release
******************************************************************************/
static
ULONG
WINAPI
AntiMonikerImpl_Release
(
IMoniker
*
iface
)
static
ULONG
WINAPI
AntiMonikerImpl_Release
(
IMoniker
*
iface
)
{
AntiMonikerImpl
*
This
=
impl_from_IMoniker
(
iface
);
ULONG
ref
;
TRACE
(
"(%p)
\n
"
,
This
);
AntiMonikerImpl
*
moniker
=
impl_from_IMoniker
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
moniker
->
refcount
);
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"%p, refcount %u.
\n
"
,
iface
,
refcount
);
/* destroy the object if there are no more references to it */
if
(
ref
==
0
)
if
(
!
refcount
)
{
if
(
This
->
pMarshal
)
IUnknown_Release
(
This
->
pMarshal
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
if
(
moniker
->
pMarshal
)
IUnknown_Release
(
moniker
->
pMarshal
);
heap_free
(
moniker
);
}
return
ref
;
return
ref
count
;
}
/******************************************************************************
...
...
@@ -610,20 +607,20 @@ static const IROTDataVtbl VT_ROTDataImpl =
AntiMonikerROTDataImpl_GetComparisonData
};
/******************************************************************************
* AntiMoniker_Construct (local function)
*******************************************************************************/
static
HRESULT
AntiMonikerImpl_Construct
(
AntiMonikerImpl
*
This
)
static
HRESULT
create_anti_moniker
(
DWORD
order
,
IMoniker
**
ret
)
{
AntiMonikerImpl
*
moniker
;
moniker
=
heap_alloc_zero
(
sizeof
(
*
moniker
));
if
(
!
moniker
)
return
E_OUTOFMEMORY
;
TRACE
(
"(%p)
\n
"
,
This
);
moniker
->
IMoniker_iface
.
lpVtbl
=
&
VT_AntiMonikerImpl
;
moniker
->
IROTData_iface
.
lpVtbl
=
&
VT_ROTDataImpl
;
moniker
->
refcount
=
1
;
moniker
->
count
=
order
;
/* Initialize the virtual function table. */
This
->
IMoniker_iface
.
lpVtbl
=
&
VT_AntiMonikerImpl
;
This
->
IROTData_iface
.
lpVtbl
=
&
VT_ROTDataImpl
;
This
->
ref
=
0
;
This
->
pMarshal
=
NULL
;
This
->
count
=
1
;
*
ret
=
&
moniker
->
IMoniker_iface
;
return
S_OK
;
}
...
...
@@ -631,27 +628,11 @@ static HRESULT AntiMonikerImpl_Construct(AntiMonikerImpl* This)
/******************************************************************************
* CreateAntiMoniker [OLE32.@]
******************************************************************************/
HRESULT
WINAPI
CreateAntiMoniker
(
IMoniker
**
ppmk
)
HRESULT
WINAPI
CreateAntiMoniker
(
IMoniker
**
moniker
)
{
AntiMonikerImpl
*
newAntiMoniker
;
HRESULT
hr
;
TRACE
(
"(%p)
\n
"
,
ppmk
);
newAntiMoniker
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
AntiMonikerImpl
));
if
(
newAntiMoniker
==
0
)
return
STG_E_INSUFFICIENTMEMORY
;
hr
=
AntiMonikerImpl_Construct
(
newAntiMoniker
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
newAntiMoniker
);
return
hr
;
}
TRACE
(
"%p.
\n
"
,
moniker
);
return
AntiMonikerImpl_QueryInterface
(
&
newAntiMoniker
->
IMoniker_iface
,
&
IID_IMoniker
,
(
void
**
)
ppmk
);
return
create_anti_moniker
(
1
,
moniker
);
}
HRESULT
WINAPI
AntiMoniker_CreateInstance
(
IClassFactory
*
iface
,
...
...
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