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
1c8bad80
Commit
1c8bad80
authored
Apr 28, 2011
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Apr 28, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shdocvw: COM cleanup in shlinstobj.c.
parent
417534fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
28 deletions
+38
-28
shlinstobj.c
dlls/shdocvw/shlinstobj.c
+38
-28
No files found.
dlls/shdocvw/shlinstobj.c
View file @
1c8bad80
...
...
@@ -40,8 +40,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
shdocvw
);
#define ADJUST_THIS(c,m,p) ((c*)(((long)p)-(long)&(((c*)0)->lp##m##Vtbl)))
#define STATIC_CAST(i,p) ((i*)&p->lp##i##Vtbl)
#define CHARS_IN_GUID 39
/******************************************************************************
...
...
@@ -50,11 +48,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
* Gives access to a registry key's values via the IPropertyBag interface.
*/
typedef
struct
_RegistryPropertyBag
{
const
IPropertyBagVtbl
*
lpIPropertyBagVtbl
;
IPropertyBag
IPropertyBag_iface
;
LONG
m_cRef
;
HKEY
m_hInitPropertyBagKey
;
}
RegistryPropertyBag
;
static
inline
RegistryPropertyBag
*
impl_from_IPropertyBag
(
IPropertyBag
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
RegistryPropertyBag
,
IPropertyBag_iface
);
}
static
void
RegistryPropertyBag_Destroy
(
RegistryPropertyBag
*
This
)
{
TRACE
(
"This=%p)
\n
"
,
This
);
...
...
@@ -65,7 +68,7 @@ static void RegistryPropertyBag_Destroy(RegistryPropertyBag *This) {
static
HRESULT
WINAPI
RegistryPropertyBag_IPropertyBag_QueryInterface
(
IPropertyBag
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
RegistryPropertyBag
*
This
=
ADJUST_THIS
(
RegistryPropertyBag
,
IPropertyBag
,
iface
);
RegistryPropertyBag
*
This
=
impl_from_IPropertyBag
(
iface
);
TRACE
(
"(iface=%p, riid=%s, ppv=%p)
\n
"
,
iface
,
debugstr_guid
(
riid
),
ppv
);
...
...
@@ -73,7 +76,7 @@ static HRESULT WINAPI RegistryPropertyBag_IPropertyBag_QueryInterface(IPropertyB
return
E_INVALIDARG
;
if
(
IsEqualIID
(
&
IID_IUnknown
,
riid
)
||
IsEqualIID
(
&
IID_IPropertyBag
,
riid
))
{
*
ppv
=
STATIC_CAST
(
IPropertyBag
,
This
)
;
*
ppv
=
&
This
->
IPropertyBag_iface
;
}
else
{
*
ppv
=
NULL
;
return
E_NOINTERFACE
;
...
...
@@ -83,8 +86,9 @@ static HRESULT WINAPI RegistryPropertyBag_IPropertyBag_QueryInterface(IPropertyB
return
S_OK
;
}
static
ULONG
WINAPI
RegistryPropertyBag_IPropertyBag_AddRef
(
IPropertyBag
*
iface
)
{
RegistryPropertyBag
*
This
=
ADJUST_THIS
(
RegistryPropertyBag
,
IPropertyBag
,
iface
);
static
ULONG
WINAPI
RegistryPropertyBag_IPropertyBag_AddRef
(
IPropertyBag
*
iface
)
{
RegistryPropertyBag
*
This
=
impl_from_IPropertyBag
(
iface
);
ULONG
cRef
;
TRACE
(
"(iface=%p)
\n
"
,
iface
);
...
...
@@ -97,8 +101,9 @@ static ULONG WINAPI RegistryPropertyBag_IPropertyBag_AddRef(IPropertyBag *iface)
return
cRef
;
}
static
ULONG
WINAPI
RegistryPropertyBag_IPropertyBag_Release
(
IPropertyBag
*
iface
)
{
RegistryPropertyBag
*
This
=
ADJUST_THIS
(
RegistryPropertyBag
,
IPropertyBag
,
iface
);
static
ULONG
WINAPI
RegistryPropertyBag_IPropertyBag_Release
(
IPropertyBag
*
iface
)
{
RegistryPropertyBag
*
This
=
impl_from_IPropertyBag
(
iface
);
ULONG
cRef
;
TRACE
(
"(iface=%p)
\n
"
,
iface
);
...
...
@@ -116,7 +121,7 @@ static ULONG WINAPI RegistryPropertyBag_IPropertyBag_Release(IPropertyBag *iface
static
HRESULT
WINAPI
RegistryPropertyBag_IPropertyBag_Read
(
IPropertyBag
*
iface
,
LPCOLESTR
pwszPropName
,
VARIANT
*
pVar
,
IErrorLog
*
pErrorLog
)
{
RegistryPropertyBag
*
This
=
ADJUST_THIS
(
RegistryPropertyBag
,
IPropertyBag
,
iface
);
RegistryPropertyBag
*
This
=
impl_from_IPropertyBag
(
iface
);
WCHAR
*
pwszValue
;
DWORD
dwType
,
cbData
;
LONG
res
;
...
...
@@ -178,15 +183,15 @@ static HRESULT RegistryPropertyBag_Constructor(HKEY hInitPropertyBagKey, REFIID
pRegistryPropertyBag
=
heap_alloc
(
sizeof
(
RegistryPropertyBag
));
if
(
pRegistryPropertyBag
)
{
pRegistryPropertyBag
->
lpIPropertyBag
Vtbl
=
&
RegistryPropertyBag_IPropertyBagVtbl
;
pRegistryPropertyBag
->
IPropertyBag_iface
.
lp
Vtbl
=
&
RegistryPropertyBag_IPropertyBagVtbl
;
pRegistryPropertyBag
->
m_cRef
=
0
;
pRegistryPropertyBag
->
m_hInitPropertyBagKey
=
hInitPropertyBagKey
;
/* The clasping AddRef/Release is for the case that QueryInterface fails, which will result
* in a reference count of 0 in the Release call, which will result in object destruction.*/
IPropertyBag_AddRef
(
STATIC_CAST
(
IPropertyBag
,
pRegistryPropertyBag
)
);
hr
=
IPropertyBag_QueryInterface
(
STATIC_CAST
(
IPropertyBag
,
pRegistryPropertyBag
)
,
riid
,
ppvObject
);
IPropertyBag_Release
(
STATIC_CAST
(
IPropertyBag
,
pRegistryPropertyBag
)
);
IPropertyBag_AddRef
(
&
pRegistryPropertyBag
->
IPropertyBag_iface
);
hr
=
IPropertyBag_QueryInterface
(
&
pRegistryPropertyBag
->
IPropertyBag_iface
,
riid
,
ppvObject
);
IPropertyBag_Release
(
&
pRegistryPropertyBag
->
IPropertyBag_iface
);
}
return
hr
;
...
...
@@ -198,21 +203,26 @@ static HRESULT RegistryPropertyBag_Constructor(HKEY hInitPropertyBagKey, REFIID
* values of a PropertyBag.
*/
typedef
struct
_InstanceObjectFactory
{
const
IClassFactoryVtbl
*
lpIClassFactoryVtbl
;
IClassFactory
IClassFactory_iface
;
LONG
m_cRef
;
CLSID
m_clsidInstance
;
/* CLSID of the objects to create. */
IPropertyBag
*
m_pPropertyBag
;
/* PropertyBag to initialize those objects. */
}
InstanceObjectFactory
;
static
inline
InstanceObjectFactory
*
impl_from_IClassFactory
(
IClassFactory
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
InstanceObjectFactory
,
IClassFactory_iface
);
}
static
void
InstanceObjectFactory_Destroy
(
InstanceObjectFactory
*
This
)
{
IPropertyBag_Release
(
This
->
m_pPropertyBag
);
heap_free
(
This
);
}
static
HRESULT
WINAPI
InstanceObjectFactory_IClassFactory_QueryInterface
(
IClassFactory
*
iface
,
REFIID
riid
,
LPVOID
*
ppv
)
static
HRESULT
WINAPI
InstanceObjectFactory_IClassFactory_QueryInterface
(
IClassFactory
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
InstanceObjectFactory
*
This
=
ADJUST_THIS
(
InstanceObjectFactory
,
IClassFactory
,
iface
);
InstanceObjectFactory
*
This
=
impl_from_IClassFactory
(
iface
);
TRACE
(
"iface=%p, riid=%s, ppv=%p)
\n
"
,
iface
,
debugstr_guid
(
riid
),
ppv
);
...
...
@@ -220,7 +230,7 @@ static HRESULT WINAPI InstanceObjectFactory_IClassFactory_QueryInterface(IClassF
return
E_INVALIDARG
;
if
(
IsEqualIID
(
&
IID_IUnknown
,
riid
)
||
IsEqualIID
(
&
IID_IClassFactory
,
riid
))
{
*
ppv
=
STATIC_CAST
(
IClassFactory
,
This
)
;
*
ppv
=
&
This
->
IClassFactory_iface
;
}
else
{
*
ppv
=
NULL
;
return
E_NOINTERFACE
;
...
...
@@ -232,7 +242,7 @@ static HRESULT WINAPI InstanceObjectFactory_IClassFactory_QueryInterface(IClassF
static
ULONG
WINAPI
InstanceObjectFactory_IClassFactory_AddRef
(
IClassFactory
*
iface
)
{
InstanceObjectFactory
*
This
=
ADJUST_THIS
(
InstanceObjectFactory
,
IClassFactory
,
iface
);
InstanceObjectFactory
*
This
=
impl_from_IClassFactory
(
iface
);
ULONG
cRef
;
TRACE
(
"(iface=%p)
\n
"
,
iface
);
...
...
@@ -247,7 +257,7 @@ static ULONG WINAPI InstanceObjectFactory_IClassFactory_AddRef(IClassFactory *if
static
ULONG
WINAPI
InstanceObjectFactory_IClassFactory_Release
(
IClassFactory
*
iface
)
{
InstanceObjectFactory
*
This
=
ADJUST_THIS
(
InstanceObjectFactory
,
IClassFactory
,
iface
);
InstanceObjectFactory
*
This
=
impl_from_IClassFactory
(
iface
);
ULONG
cRef
;
TRACE
(
"(iface=%p)
\n
"
,
iface
);
...
...
@@ -265,12 +275,12 @@ static ULONG WINAPI InstanceObjectFactory_IClassFactory_Release(IClassFactory *i
static
HRESULT
WINAPI
InstanceObjectFactory_IClassFactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
pUnkOuter
,
REFIID
riid
,
LPVOID
*
ppvObj
)
{
InstanceObjectFactory
*
This
=
ADJUST_THIS
(
InstanceObjectFactory
,
IClassFactory
,
iface
);
InstanceObjectFactory
*
This
=
impl_from_IClassFactory
(
iface
);
IPersistPropertyBag
*
pPersistPropertyBag
;
HRESULT
hr
;
TRACE
(
"(pUnkOuter=%p, riid=%s, ppvObj=%p)
\n
"
,
pUnkOuter
,
debugstr_guid
(
riid
),
ppvObj
);
hr
=
CoCreateInstance
(
&
This
->
m_clsidInstance
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IPersistPropertyBag
,
(
LPVOID
*
)
&
pPersistPropertyBag
);
if
(
FAILED
(
hr
))
{
...
...
@@ -324,16 +334,16 @@ static HRESULT InstanceObjectFactory_Constructor(REFCLSID rclsid, IPropertyBag *
pInstanceObjectFactory
=
heap_alloc
(
sizeof
(
InstanceObjectFactory
));
if
(
pInstanceObjectFactory
)
{
pInstanceObjectFactory
->
lpIClassFactory
Vtbl
=
&
InstanceObjectFactory_IClassFactoryVtbl
;
pInstanceObjectFactory
->
IClassFactory_iface
.
lp
Vtbl
=
&
InstanceObjectFactory_IClassFactoryVtbl
;
pInstanceObjectFactory
->
m_cRef
=
0
;
pInstanceObjectFactory
->
m_clsidInstance
=
*
rclsid
;
pInstanceObjectFactory
->
m_pPropertyBag
=
pPropertyBag
;
IPropertyBag_AddRef
(
pPropertyBag
);
IClassFactory_AddRef
(
STATIC_CAST
(
IClassFactory
,
pInstanceObjectFactory
)
);
hr
=
IClassFactory_QueryInterface
(
STATIC_CAST
(
IClassFactory
,
pInstanceObjectFactory
)
,
IClassFactory_AddRef
(
&
pInstanceObjectFactory
->
IClassFactory_iface
);
hr
=
IClassFactory_QueryInterface
(
&
pInstanceObjectFactory
->
IClassFactory_iface
,
riid
,
ppvObject
);
IClassFactory_Release
(
STATIC_CAST
(
IClassFactory
,
pInstanceObjectFactory
)
);
IClassFactory_Release
(
&
pInstanceObjectFactory
->
IClassFactory_iface
);
}
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