Commit 66a515ae authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

devenum: Use an iface instead of an vtbl pointer in RegPropBagImpl.

parent d335af1e
...@@ -36,18 +36,23 @@ static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface); ...@@ -36,18 +36,23 @@ static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface);
typedef struct typedef struct
{ {
const IPropertyBagVtbl *lpVtbl; IPropertyBag IPropertyBag_iface;
LONG ref; LONG ref;
HKEY hkey; HKEY hkey;
} RegPropBagImpl; } RegPropBagImpl;
static inline RegPropBagImpl *impl_from_IPropertyBag(IPropertyBag *iface)
{
return CONTAINING_RECORD(iface, RegPropBagImpl, IPropertyBag_iface);
}
static HRESULT WINAPI DEVENUM_IPropertyBag_QueryInterface( static HRESULT WINAPI DEVENUM_IPropertyBag_QueryInterface(
LPPROPERTYBAG iface, LPPROPERTYBAG iface,
REFIID riid, REFIID riid,
LPVOID *ppvObj) LPVOID *ppvObj)
{ {
RegPropBagImpl *This = (RegPropBagImpl *)iface; RegPropBagImpl *This = impl_from_IPropertyBag(iface);
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppvObj); TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppvObj);
...@@ -70,7 +75,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_QueryInterface( ...@@ -70,7 +75,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_QueryInterface(
*/ */
static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface) static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface)
{ {
RegPropBagImpl *This = (RegPropBagImpl *)iface; RegPropBagImpl *This = impl_from_IPropertyBag(iface);
TRACE("(%p)->() AddRef from %d\n", iface, This->ref); TRACE("(%p)->() AddRef from %d\n", iface, This->ref);
...@@ -82,7 +87,7 @@ static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface) ...@@ -82,7 +87,7 @@ static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface)
*/ */
static ULONG WINAPI DEVENUM_IPropertyBag_Release(LPPROPERTYBAG iface) static ULONG WINAPI DEVENUM_IPropertyBag_Release(LPPROPERTYBAG iface)
{ {
RegPropBagImpl *This = (RegPropBagImpl *)iface; RegPropBagImpl *This = impl_from_IPropertyBag(iface);
ULONG ref; ULONG ref;
TRACE("(%p)->() ReleaseThis->ref from %d\n", iface, This->ref); TRACE("(%p)->() ReleaseThis->ref from %d\n", iface, This->ref);
...@@ -105,7 +110,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read( ...@@ -105,7 +110,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
LPVOID pData = NULL; LPVOID pData = NULL;
DWORD received; DWORD received;
DWORD type = 0; DWORD type = 0;
RegPropBagImpl *This = (RegPropBagImpl *)iface; RegPropBagImpl *This = impl_from_IPropertyBag(iface);
HRESULT res = S_OK; HRESULT res = S_OK;
LONG reswin32; LONG reswin32;
...@@ -212,7 +217,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Write( ...@@ -212,7 +217,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Write(
LPCOLESTR pszPropName, LPCOLESTR pszPropName,
VARIANT* pVar) VARIANT* pVar)
{ {
RegPropBagImpl *This = (RegPropBagImpl *)iface; RegPropBagImpl *This = impl_from_IPropertyBag(iface);
LPVOID lpData = NULL; LPVOID lpData = NULL;
DWORD cbData = 0; DWORD cbData = 0;
DWORD dwType = 0; DWORD dwType = 0;
...@@ -277,10 +282,10 @@ static HRESULT DEVENUM_IPropertyBag_Construct(HANDLE hkey, IPropertyBag **ppBag) ...@@ -277,10 +282,10 @@ static HRESULT DEVENUM_IPropertyBag_Construct(HANDLE hkey, IPropertyBag **ppBag)
RegPropBagImpl * rpb = CoTaskMemAlloc(sizeof(RegPropBagImpl)); RegPropBagImpl * rpb = CoTaskMemAlloc(sizeof(RegPropBagImpl));
if (!rpb) if (!rpb)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
rpb->lpVtbl = &IPropertyBag_Vtbl; rpb->IPropertyBag_iface.lpVtbl = &IPropertyBag_Vtbl;
rpb->ref = 1; rpb->ref = 1;
rpb->hkey = hkey; rpb->hkey = hkey;
*ppBag = (IPropertyBag*)rpb; *ppBag = &rpb->IPropertyBag_iface;
DEVENUM_LockModule(); DEVENUM_LockModule();
return S_OK; return S_OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment