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
e7ce88ab
Commit
e7ce88ab
authored
Jan 28, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Remove some internal helpers for item moniker.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7e5a764d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
83 deletions
+49
-83
itemmoniker.c
dlls/ole32/itemmoniker.c
+49
-83
No files found.
dlls/ole32/itemmoniker.c
View file @
e7ce88ab
...
...
@@ -137,8 +137,6 @@ static HRESULT set_container_lock(IOleItemContainer *container, IBindCtx *pbc)
return
hr
;
}
static
HRESULT
ItemMonikerImpl_Destroy
(
ItemMonikerImpl
*
iface
);
/*******************************************************************************
* ItemMoniker_QueryInterface
*******************************************************************************/
...
...
@@ -195,17 +193,20 @@ static ULONG WINAPI ItemMonikerImpl_AddRef(IMoniker* iface)
******************************************************************************/
static
ULONG
WINAPI
ItemMonikerImpl_Release
(
IMoniker
*
iface
)
{
ItemMonikerImpl
*
This
=
impl_from_IMoniker
(
iface
);
ULONG
ref
;
TRACE
(
"(%p)
\n
"
,
This
);
ItemMonikerImpl
*
moniker
=
impl_from_IMoniker
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
moniker
->
ref
);
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
)
ItemMonikerImpl_Destroy
(
This
);
if
(
!
refcount
)
{
if
(
moniker
->
pMarshal
)
IUnknown_Release
(
moniker
->
pMarshal
);
heap_free
(
moniker
->
itemName
);
heap_free
(
moniker
->
itemDelimiter
);
heap_free
(
moniker
);
}
return
ref
;
return
ref
count
;
}
/******************************************************************************
...
...
@@ -1008,107 +1009,72 @@ static const IROTDataVtbl VT_ROTDataImpl =
};
/******************************************************************************
*
ItemMoniker_Construct (local function)
******************************************************************************
*
/
static
HRESULT
ItemMonikerImpl_Construct
(
ItemMonikerImpl
*
This
,
const
WCHAR
*
delimiter
,
const
WCHAR
*
name
)
*
CreateItemMoniker [OLE32.@]
******************************************************************************/
HRESULT
WINAPI
CreateItemMoniker
(
const
WCHAR
*
delimiter
,
const
WCHAR
*
name
,
IMoniker
**
ret
)
{
ItemMonikerImpl
*
moniker
;
int
str_len
;
HRESULT
hr
;
TRACE
(
"%s, %s, %p.
\n
"
,
debugstr_w
(
delimiter
),
debugstr_w
(
name
),
ret
);
TRACE
(
"(%p, %s, %s)
\n
"
,
This
,
debugstr_w
(
delimiter
),
debugstr_w
(
name
));
if
(
!
(
moniker
=
heap_alloc_zero
(
sizeof
(
*
moniker
))))
return
E_OUTOFMEMORY
;
/* Initialize the virtual function table. */
This
->
IMoniker_iface
.
lpVtbl
=
&
VT_ItemMonikerImpl
;
This
->
IROTData_iface
.
lpVtbl
=
&
VT_ROTDataImpl
;
This
->
ref
=
0
;
This
->
pMarshal
=
NULL
;
This
->
itemDelimiter
=
NULL
;
moniker
->
IMoniker_iface
.
lpVtbl
=
&
VT_ItemMonikerImpl
;
moniker
->
IROTData_iface
.
lpVtbl
=
&
VT_ROTDataImpl
;
moniker
->
ref
=
1
;
str_len
=
(
lstrlenW
(
name
)
+
1
)
*
sizeof
(
WCHAR
);
This
->
itemName
=
heap_alloc
(
str_len
);
if
(
!
This
->
itemName
)
return
E_OUTOFMEMORY
;
memcpy
(
This
->
itemName
,
name
,
str_len
);
moniker
->
itemName
=
heap_alloc
(
str_len
);
if
(
!
moniker
->
itemName
)
{
hr
=
E_OUTOFMEMORY
;
goto
failed
;
}
memcpy
(
moniker
->
itemName
,
name
,
str_len
);
if
(
delimiter
)
{
str_len
=
(
lstrlenW
(
delimiter
)
+
1
)
*
sizeof
(
WCHAR
);
This
->
itemDelimiter
=
heap_alloc
(
str_len
);
if
(
!
This
->
itemDelimiter
)
moniker
->
itemDelimiter
=
heap_alloc
(
str_len
);
if
(
!
moniker
->
itemDelimiter
)
{
h
eap_free
(
This
->
itemName
)
;
return
E_OUTOFMEMORY
;
h
r
=
E_OUTOFMEMORY
;
goto
failed
;
}
memcpy
(
This
->
itemDelimiter
,
delimiter
,
str_len
);
memcpy
(
moniker
->
itemDelimiter
,
delimiter
,
str_len
);
}
return
S_OK
;
}
/******************************************************************************
* ItemMoniker_Destroy (local function)
*******************************************************************************/
static
HRESULT
ItemMonikerImpl_Destroy
(
ItemMonikerImpl
*
This
)
{
TRACE
(
"(%p)
\n
"
,
This
);
if
(
This
->
pMarshal
)
IUnknown_Release
(
This
->
pMarshal
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
itemName
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
itemDelimiter
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
*
ret
=
&
moniker
->
IMoniker_iface
;
return
S_OK
;
}
/******************************************************************************
* CreateItemMoniker [OLE32.@]
******************************************************************************/
HRESULT
WINAPI
CreateItemMoniker
(
LPCOLESTR
lpszDelim
,
LPCOLESTR
lpszItem
,
IMoniker
**
ppmk
)
{
ItemMonikerImpl
*
newItemMoniker
;
HRESULT
hr
;
TRACE
(
"(%s,%s,%p)
\n
"
,
debugstr_w
(
lpszDelim
),
debugstr_w
(
lpszItem
),
ppmk
);
newItemMoniker
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ItemMonikerImpl
));
if
(
!
newItemMoniker
)
return
STG_E_INSUFFICIENTMEMORY
;
failed:
IMoniker_Release
(
&
moniker
->
IMoniker_iface
)
;
hr
=
ItemMonikerImpl_Construct
(
newItemMoniker
,
lpszDelim
,
lpszItem
);
if
(
FAILED
(
hr
)){
HeapFree
(
GetProcessHeap
(),
0
,
newItemMoniker
);
return
hr
;
}
return
ItemMonikerImpl_QueryInterface
(
&
newItemMoniker
->
IMoniker_iface
,
&
IID_IMoniker
,
(
void
**
)
ppmk
);
return
hr
;
}
HRESULT
WINAPI
ItemMoniker_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
pUnk
,
REFIID
riid
,
void
**
ppv
)
HRESULT
WINAPI
ItemMoniker_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
outer
,
REFIID
riid
,
void
**
ppv
)
{
ItemMonikerImpl
*
newItemMoniker
;
HRESULT
h
r
;
static
const
WCHAR
wszEmpty
[]
=
{
0
}
;
static
const
WCHAR
emptyW
[]
=
{
0
}
;
IMoniker
*
monike
r
;
HRESULT
hr
;
TRACE
(
"(%p, %s, %p)
\n
"
,
pUnk
,
debugstr_guid
(
riid
),
ppv
);
TRACE
(
"(%p, %s, %p)
\n
"
,
outer
,
debugstr_guid
(
riid
),
ppv
);
*
ppv
=
NULL
;
if
(
pUnk
)
if
(
outer
)
return
CLASS_E_NOAGGREGATION
;
newItemMoniker
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ItemMonikerImpl
));
if
(
!
newItemMoniker
)
return
E_OUTOFMEMORY
;
hr
=
ItemMonikerImpl_Construct
(
newItemMoniker
,
wszEmpty
,
wszEmpty
);
if
(
FAILED
(
hr
=
CreateItemMoniker
(
emptyW
,
emptyW
,
&
moniker
)))
return
hr
;
if
(
SUCCEEDED
(
hr
))
hr
=
ItemMonikerImpl_QueryInterface
(
&
newItemMoniker
->
IMoniker_iface
,
riid
,
ppv
);
if
(
FAILED
(
hr
))
HeapFree
(
GetProcessHeap
(),
0
,
newItemMoniker
);
hr
=
IMoniker_QueryInterface
(
moniker
,
riid
,
ppv
);
IMoniker_Release
(
moniker
);
return
hr
;
}
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