Michael Stefaniuc : shell32: Use an iface instead of a vtbl pointer in IQueryAssociationsImpl.

Alexandre Julliard julliard at winehq.org
Sun Dec 5 12:10:07 CST 2010


Module: wine
Branch: master
Commit: f948478f28b8a7c6beb364745b143361cef4edc1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f948478f28b8a7c6beb364745b143361cef4edc1

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Sat Dec  4 22:16:32 2010 +0100

shell32: Use an iface instead of a vtbl pointer in IQueryAssociationsImpl.

---

 dlls/shell32/assoc.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c
index 066e8ba..70056ba 100644
--- a/dlls/shell32/assoc.c
+++ b/dlls/shell32/assoc.c
@@ -59,12 +59,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
 
 typedef struct
 {
-  const IQueryAssociationsVtbl *lpVtbl;
+  IQueryAssociations IQueryAssociations_iface;
   LONG ref;
   HKEY hkeySource;
   HKEY hkeyProgID;
 } IQueryAssociationsImpl;
 
+static inline IQueryAssociationsImpl *impl_from_IQueryAssociations(IQueryAssociations *iface)
+{
+  return CONTAINING_RECORD(iface, IQueryAssociationsImpl, IQueryAssociations_iface);
+}
+
 /**************************************************************************
  *  IQueryAssociations_QueryInterface {SHLWAPI}
  *
@@ -75,7 +80,7 @@ static HRESULT WINAPI IQueryAssociations_fnQueryInterface(
   REFIID riid,
   LPVOID *ppvObj)
 {
-  IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
+  IQueryAssociationsImpl *This = impl_from_IQueryAssociations(iface);
 
   TRACE("(%p,%s,%p)\n",This, debugstr_guid(riid), ppvObj);
 
@@ -101,7 +106,7 @@ static HRESULT WINAPI IQueryAssociations_fnQueryInterface(
  */
 static ULONG WINAPI IQueryAssociations_fnAddRef(IQueryAssociations *iface)
 {
-  IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
+  IQueryAssociationsImpl *This = impl_from_IQueryAssociations(iface);
   ULONG refCount = InterlockedIncrement(&This->ref);
 
   TRACE("(%p)->(ref before=%u)\n",This, refCount - 1);
@@ -116,7 +121,7 @@ static ULONG WINAPI IQueryAssociations_fnAddRef(IQueryAssociations *iface)
  */
 static ULONG WINAPI IQueryAssociations_fnRelease(IQueryAssociations *iface)
 {
-  IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
+  IQueryAssociationsImpl *This = impl_from_IQueryAssociations(iface);
   ULONG refCount = InterlockedDecrement(&This->ref);
 
   TRACE("(%p)->(ref before=%u)\n",This, refCount + 1);
@@ -156,7 +161,7 @@ static HRESULT WINAPI IQueryAssociations_fnInit(
   HWND hWnd)
 {
     static const WCHAR szProgID[] = {'P','r','o','g','I','D',0};
-    IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
+    IQueryAssociationsImpl *This = impl_from_IQueryAssociations(iface);
     LONG ret;
 
     TRACE("(%p)->(%d,%s,%p,%p)\n", iface,
@@ -393,7 +398,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
   LPWSTR pszOut,
   DWORD *pcchOut)
 {
-  IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
+  IQueryAssociationsImpl *This = impl_from_IQueryAssociations(iface);
   const ASSOCF cfUnimplemented = ~(0);
   DWORD len = 0;
   HRESULT hr;
@@ -616,7 +621,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetKey(
   LPCWSTR pszExtra,
   HKEY *phkeyOut)
 {
-  IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
+  IQueryAssociationsImpl *This = impl_from_IQueryAssociations(iface);
 
   FIXME("(%p,0x%8x,0x%8x,%s,%p)-stub!\n", This, cfFlags, assockey,
         debugstr_w(pszExtra), phkeyOut);
@@ -648,7 +653,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetData(
   LPVOID pvOut,
   DWORD *pcbOut)
 {
-  IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
+  IQueryAssociationsImpl *This = impl_from_IQueryAssociations(iface);
 
   FIXME("(%p,0x%8x,0x%8x,%s,%p,%p)-stub!\n", This, cfFlags, assocdata,
         debugstr_w(pszExtra), pvOut, pcbOut);
@@ -683,7 +688,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetEnum(
   REFIID riid,
   LPVOID *ppvOut)
 {
-  IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
+  IQueryAssociationsImpl *This = impl_from_IQueryAssociations(iface);
 
   FIXME("(%p,0x%8x,0x%8x,%s,%s,%p)-stub!\n", This, cfFlags, assocenum,
         debugstr_w(pszExtra), debugstr_guid(riid), ppvOut);
@@ -715,7 +720,7 @@ HRESULT WINAPI QueryAssociations_Constructor(IUnknown *pUnkOuter, REFIID riid, L
     if (pUnkOuter) return CLASS_E_NOAGGREGATION;
 
     if (!(this = SHAlloc(sizeof(*this)))) return E_OUTOFMEMORY;
-    this->lpVtbl = &IQueryAssociations_vtbl;
+    this->IQueryAssociations_iface.lpVtbl = &IQueryAssociations_vtbl;
     this->ref = 0;
     this->hkeySource = 0;
     this->hkeyProgID = 0;




More information about the wine-cvs mailing list