Commit 65892b5b authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

comdlg32: Use ifaces instead of vtbl pointers in IShellBrowserImpl.

parent 8e999df0
...@@ -47,22 +47,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); ...@@ -47,22 +47,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
typedef struct typedef struct
{ {
const IShellBrowserVtbl *lpVtbl; IShellBrowser IShellBrowser_iface;
const ICommDlgBrowserVtbl *lpVtblCommDlgBrowser; ICommDlgBrowser ICommDlgBrowser_iface;
const IServiceProviderVtbl *lpVtblServiceProvider; IServiceProvider IServiceProvider_iface;
LONG ref; /* Reference counter */ LONG ref; /* Reference counter */
HWND hwndOwner; /* Owner dialog of the interface */ HWND hwndOwner; /* Owner dialog of the interface */
} IShellBrowserImpl; } IShellBrowserImpl;
static inline IShellBrowserImpl *impl_from_IShellBrowser(IShellBrowser *iface)
{
return CONTAINING_RECORD(iface, IShellBrowserImpl, IShellBrowser_iface);
}
static inline IShellBrowserImpl *impl_from_ICommDlgBrowser( ICommDlgBrowser *iface ) static inline IShellBrowserImpl *impl_from_ICommDlgBrowser( ICommDlgBrowser *iface )
{ {
return (IShellBrowserImpl *)((char*)iface - FIELD_OFFSET(IShellBrowserImpl, lpVtblCommDlgBrowser)); return CONTAINING_RECORD(iface, IShellBrowserImpl, ICommDlgBrowser_iface);
} }
static inline IShellBrowserImpl *impl_from_IServiceProvider( IServiceProvider *iface ) static inline IShellBrowserImpl *impl_from_IServiceProvider( IServiceProvider *iface )
{ {
return (IShellBrowserImpl *)((char*)iface - FIELD_OFFSET(IShellBrowserImpl, lpVtblServiceProvider)); return CONTAINING_RECORD(iface, IShellBrowserImpl, IServiceProvider_iface);
} }
/************************************************************************** /**************************************************************************
...@@ -197,15 +202,15 @@ IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner) ...@@ -197,15 +202,15 @@ IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner)
sb->hwndOwner = hwndOwner; sb->hwndOwner = hwndOwner;
/* Initialisation of the vTables */ /* Initialisation of the vTables */
sb->lpVtbl = &IShellBrowserImpl_Vtbl; sb->IShellBrowser_iface.lpVtbl = &IShellBrowserImpl_Vtbl;
sb->lpVtblCommDlgBrowser = &IShellBrowserImpl_ICommDlgBrowser_Vtbl; sb->ICommDlgBrowser_iface.lpVtbl = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
sb->lpVtblServiceProvider = &IShellBrowserImpl_IServiceProvider_Vtbl; sb->IServiceProvider_iface.lpVtbl = &IShellBrowserImpl_IServiceProvider_Vtbl;
SHGetSpecialFolderLocation(hwndOwner, CSIDL_DESKTOP, SHGetSpecialFolderLocation(hwndOwner, CSIDL_DESKTOP,
&fodInfos->ShellInfos.pidlAbsCurrent); &fodInfos->ShellInfos.pidlAbsCurrent);
TRACE("%p\n", sb); TRACE("%p\n", sb);
return (IShellBrowser *) sb; return &sb->IShellBrowser_iface;
} }
/*************************************************************************** /***************************************************************************
...@@ -215,7 +220,7 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, ...@@ -215,7 +220,7 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
REFIID riid, REFIID riid,
LPVOID *ppvObj) LPVOID *ppvObj)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n\t%s\n", This, debugstr_guid(riid)); TRACE("(%p)\n\t%s\n", This, debugstr_guid(riid));
...@@ -233,12 +238,9 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, ...@@ -233,12 +238,9 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
} }
else if(IsEqualIID(riid, &IID_ICommDlgBrowser)) /*ICommDlgBrowser*/ else if(IsEqualIID(riid, &IID_ICommDlgBrowser)) /*ICommDlgBrowser*/
{ *ppvObj = &(This->lpVtblCommDlgBrowser); *ppvObj = &This->ICommDlgBrowser_iface;
}
else if(IsEqualIID(riid, &IID_IServiceProvider)) /* IServiceProvider */ else if(IsEqualIID(riid, &IID_IServiceProvider)) /* IServiceProvider */
{ *ppvObj = &(This->lpVtblServiceProvider); *ppvObj = &This->IServiceProvider_iface;
}
if(*ppvObj) if(*ppvObj)
{ IUnknown_AddRef( (IShellBrowser*) *ppvObj); { IUnknown_AddRef( (IShellBrowser*) *ppvObj);
...@@ -253,7 +255,7 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, ...@@ -253,7 +255,7 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
*/ */
static ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface) static ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p,%u)\n", This, ref - 1); TRACE("(%p,%u)\n", This, ref - 1);
...@@ -266,7 +268,7 @@ static ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface) ...@@ -266,7 +268,7 @@ static ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface)
*/ */
static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface) static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p,%u)\n", This, ref + 1); TRACE("(%p,%u)\n", This, ref + 1);
...@@ -297,7 +299,7 @@ static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface) ...@@ -297,7 +299,7 @@ static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
static HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, static HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
HWND * phwnd) HWND * phwnd)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -316,7 +318,7 @@ static HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, ...@@ -316,7 +318,7 @@ static HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
static HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser * iface, static HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser * iface,
BOOL fEnterMode) BOOL fEnterMode)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -350,7 +352,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, ...@@ -350,7 +352,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
BOOL bViewHasFocus; BOOL bViewHasFocus;
RECT rectView; RECT rectView;
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)(pidl=%p,flags=0x%08x)\n", This, pidl, wFlags); TRACE("(%p)(pidl=%p,flags=0x%08x)\n", This, pidl, wFlags);
COMDLG32_DumpSBSPFlags(wFlags); COMDLG32_DumpSBSPFlags(wFlags);
...@@ -479,7 +481,7 @@ static HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface, ...@@ -479,7 +481,7 @@ static HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
BOOL fEnable) BOOL fEnable)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -495,7 +497,7 @@ static HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface, ...@@ -495,7 +497,7 @@ static HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
HWND *lphwnd) HWND *lphwnd)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -511,7 +513,7 @@ static HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface, ...@@ -511,7 +513,7 @@ static HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
LPSTREAM *ppStrm) LPSTREAM *ppStrm)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
FIXME("(%p 0x%08x %p)\n", This, grfMode, ppStrm); FIXME("(%p 0x%08x %p)\n", This, grfMode, ppStrm);
...@@ -527,7 +529,7 @@ static HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface, ...@@ -527,7 +529,7 @@ static HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
LPOLEMENUGROUPWIDTHS lpMenuWidths) LPOLEMENUGROUPWIDTHS lpMenuWidths)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -542,7 +544,7 @@ static HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface, ...@@ -542,7 +544,7 @@ static HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
IShellView *ppshv) IShellView *ppshv)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -557,7 +559,7 @@ static HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *ifac ...@@ -557,7 +559,7 @@ static HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *ifac
IShellView **ppshv) IShellView **ppshv)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
FileOpenDlgInfos *fodInfos; FileOpenDlgInfos *fodInfos;
...@@ -580,7 +582,7 @@ static HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface, ...@@ -580,7 +582,7 @@ static HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
HMENU hmenuShared) HMENU hmenuShared)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -599,7 +601,7 @@ static HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface, ...@@ -599,7 +601,7 @@ static HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
LRESULT *pret) LRESULT *pret)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
LRESULT lres; LRESULT lres;
TRACE("(%p)->(0x%08x 0x%08x 0x%08lx 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret); TRACE("(%p)->(0x%08x 0x%08x 0x%08lx 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
...@@ -626,7 +628,7 @@ static HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface, ...@@ -626,7 +628,7 @@ static HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
HWND hwndActiveObject) HWND hwndActiveObject)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -641,7 +643,7 @@ static HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface, ...@@ -641,7 +643,7 @@ static HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
LPCOLESTR lpszStatusText) LPCOLESTR lpszStatusText)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -658,7 +660,7 @@ static HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface, ...@@ -658,7 +660,7 @@ static HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
UINT uFlags) UINT uFlags)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -674,7 +676,7 @@ static HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *if ...@@ -674,7 +676,7 @@ static HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *if
WORD wID) WORD wID)
{ {
IShellBrowserImpl *This = (IShellBrowserImpl *)iface; IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -725,7 +727,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface( ...@@ -725,7 +727,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
return IShellBrowserImpl_QueryInterface((IShellBrowser *)This,riid,ppvObj); return IShellBrowserImpl_QueryInterface(&This->IShellBrowser_iface,riid,ppvObj);
} }
/************************************************************************** /**************************************************************************
...@@ -737,7 +739,7 @@ static ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser * i ...@@ -737,7 +739,7 @@ static ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser * i
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
return IShellBrowserImpl_AddRef((IShellBrowser *)This); return IShellBrowserImpl_AddRef(&This->IShellBrowser_iface);
} }
/************************************************************************** /**************************************************************************
...@@ -749,7 +751,7 @@ static ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser * ...@@ -749,7 +751,7 @@ static ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser *
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
return IShellBrowserImpl_Release((IShellBrowser *)This); return IShellBrowserImpl_Release(&This->IShellBrowser_iface);
} }
/************************************************************************** /**************************************************************************
...@@ -778,9 +780,9 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDl ...@@ -778,9 +780,9 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDl
IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, (LPCITEMIDLIST *)&pidl, &ulAttr); IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, (LPCITEMIDLIST *)&pidl, &ulAttr);
if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) ) if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )
{ {
hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE); hRes = IShellBrowser_BrowseObject(&This->IShellBrowser_iface,pidl,SBSP_RELATIVE);
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER) if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
SendCustomDlgNotificationMessage(This->hwndOwner, CDN_FOLDERCHANGE); SendCustomDlgNotificationMessage(This->hwndOwner, CDN_FOLDERCHANGE);
} }
else else
{ {
...@@ -989,7 +991,7 @@ static HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface( ...@@ -989,7 +991,7 @@ static HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface(
FIXME("(%p)\n", This); FIXME("(%p)\n", This);
return IShellBrowserImpl_QueryInterface((IShellBrowser *)This,riid,ppvObj); return IShellBrowserImpl_QueryInterface(&This->IShellBrowser_iface,riid,ppvObj);
} }
/************************************************************************** /**************************************************************************
...@@ -1001,7 +1003,7 @@ static ULONG WINAPI IShellBrowserImpl_IServiceProvider_AddRef(IServiceProvider * ...@@ -1001,7 +1003,7 @@ static ULONG WINAPI IShellBrowserImpl_IServiceProvider_AddRef(IServiceProvider *
FIXME("(%p)\n", This); FIXME("(%p)\n", This);
return IShellBrowserImpl_AddRef((IShellBrowser *)This); return IShellBrowserImpl_AddRef(&This->IShellBrowser_iface);
} }
/************************************************************************** /**************************************************************************
...@@ -1013,7 +1015,7 @@ static ULONG WINAPI IShellBrowserImpl_IServiceProvider_Release(IServiceProvider ...@@ -1013,7 +1015,7 @@ static ULONG WINAPI IShellBrowserImpl_IServiceProvider_Release(IServiceProvider
FIXME("(%p)\n", This); FIXME("(%p)\n", This);
return IShellBrowserImpl_Release((IShellBrowser *)This); return IShellBrowserImpl_Release(&This->IShellBrowser_iface);
} }
/************************************************************************** /**************************************************************************
...@@ -1039,9 +1041,8 @@ static HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryService( ...@@ -1039,9 +1041,8 @@ static HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryService(
*ppv = NULL; *ppv = NULL;
if(guidService && IsEqualIID(guidService, &SID_STopLevelBrowser)) if(guidService && IsEqualIID(guidService, &SID_STopLevelBrowser))
{ return IShellBrowserImpl_QueryInterface(&This->IShellBrowser_iface,riid,ppv);
return IShellBrowserImpl_QueryInterface((IShellBrowser *)This,riid,ppv);
}
FIXME("(%p) unknown interface requested\n", This); FIXME("(%p) unknown interface requested\n", This);
return E_NOINTERFACE; return E_NOINTERFACE;
......
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