Commit 0de2514f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shell32: Consistently return interface pointer instead of implementation pointer.

parent daa0acdb
......@@ -100,7 +100,7 @@ static HRESULT WINAPI IQueryAssociations_fnQueryInterface(
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IQueryAssociations))
{
*ppvObj = This;
*ppvObj = &This->IQueryAssociations_iface;
IQueryAssociations_AddRef((IQueryAssociations*)*ppvObj);
TRACE("Returning IQueryAssociations (%p)\n", *ppvObj);
......@@ -901,7 +901,7 @@ HRESULT WINAPI QueryAssociations_Constructor(IUnknown *pUnkOuter, REFIID riid, L
this->ref = 0;
this->hkeySource = 0;
this->hkeyProgID = 0;
if (FAILED(ret = IUnknown_QueryInterface((IUnknown *)this, riid, ppOutput))) SHFree( this );
if (FAILED(ret = IQueryAssociations_QueryInterface(&this->IQueryAssociations_iface, riid, ppOutput))) SHFree( this );
TRACE("returning %p\n", *ppOutput);
return ret;
}
......
......@@ -350,7 +350,7 @@ static HRESULT WINAPI IAutoComplete2_fnQueryInterface(
IsEqualIID(riid, &IID_IAutoComplete) ||
IsEqualIID(riid, &IID_IAutoComplete2))
{
*ppvObj = This;
*ppvObj = &This->IAutoComplete2_iface;
}
else if (IsEqualIID(riid, &IID_IAutoCompleteDropDown))
{
......@@ -561,19 +561,19 @@ static HRESULT WINAPI IAutoCompleteDropDown_fnQueryInterface(IAutoCompleteDropDo
REFIID riid, LPVOID *ppvObj)
{
IAutoCompleteImpl *This = impl_from_IAutoCompleteDropDown(iface);
return IAutoComplete2_fnQueryInterface(&This->IAutoComplete2_iface, riid, ppvObj);
return IAutoComplete2_QueryInterface(&This->IAutoComplete2_iface, riid, ppvObj);
}
static ULONG WINAPI IAutoCompleteDropDown_fnAddRef(IAutoCompleteDropDown *iface)
{
IAutoCompleteImpl *This = impl_from_IAutoCompleteDropDown(iface);
return IAutoComplete2_fnAddRef(&This->IAutoComplete2_iface);
return IAutoComplete2_AddRef(&This->IAutoComplete2_iface);
}
static ULONG WINAPI IAutoCompleteDropDown_fnRelease(IAutoCompleteDropDown *iface)
{
IAutoCompleteImpl *This = impl_from_IAutoCompleteDropDown(iface);
return IAutoComplete2_fnRelease(&This->IAutoComplete2_iface);
return IAutoComplete2_Release(&This->IAutoComplete2_iface);
}
/**************************************************************************
......
......@@ -126,7 +126,7 @@ HRESULT WINAPI IControlPanel_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOI
if (!sf)
return E_OUTOFMEMORY;
sf->ref = 0;
sf->ref = 1;
sf->IShellFolder2_iface.lpVtbl = &vt_ShellFolder2;
sf->IPersistFolder2_iface.lpVtbl = &vt_PersistFolder2;
sf->IShellExecuteHookW_iface.lpVtbl = &vt_ShellExecuteHookW;
......@@ -138,6 +138,7 @@ HRESULT WINAPI IControlPanel_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOI
IShellFolder2_Release(&sf->IShellFolder2_iface);
return E_NOINTERFACE;
}
IShellFolder2_Release(&sf->IShellFolder2_iface);
TRACE("--(%p)\n", sf);
return S_OK;
......@@ -159,7 +160,7 @@ static HRESULT WINAPI ISF_ControlPanel_fnQueryInterface(IShellFolder2 *iface, RE
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IShellFolder) || IsEqualIID(riid, &IID_IShellFolder2))
*ppvObject = This;
*ppvObject = &This->IShellFolder2_iface;
else if (IsEqualIID(riid, &IID_IPersist) ||
IsEqualIID(riid, &IID_IPersistFolder) || IsEqualIID(riid, &IID_IPersistFolder2))
*ppvObject = &This->IPersistFolder2_iface;
......
......@@ -63,13 +63,10 @@ static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface(
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown))
if(IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IEnumFORMATETC))
{
*ppvObj = This;
}
else if(IsEqualIID(riid, &IID_IEnumFORMATETC))
{
*ppvObj = This;
*ppvObj = &This->IEnumFORMATETC_iface;
}
if(*ppvObj)
......@@ -229,20 +226,17 @@ static inline IDataObjectImpl *impl_from_IDataObject(IDataObject *iface)
/***************************************************************************
* IDataObject_QueryInterface
*/
static HRESULT WINAPI IDataObject_fnQueryInterface(LPDATAOBJECT iface, REFIID riid, LPVOID * ppvObj)
static HRESULT WINAPI IDataObject_fnQueryInterface(IDataObject *iface, REFIID riid, LPVOID * ppvObj)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{
*ppvObj = This;
}
else if(IsEqualIID(riid, &IID_IDataObject)) /*IDataObject*/
if(IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IDataObject))
{
*ppvObj = This;
*ppvObj = &This->IDataObject_iface;
}
if(*ppvObj)
......@@ -258,7 +252,7 @@ static HRESULT WINAPI IDataObject_fnQueryInterface(LPDATAOBJECT iface, REFIID ri
/**************************************************************************
* IDataObject_AddRef
*/
static ULONG WINAPI IDataObject_fnAddRef(LPDATAOBJECT iface)
static ULONG WINAPI IDataObject_fnAddRef(IDataObject *iface)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
ULONG refCount = InterlockedIncrement(&This->ref);
......@@ -271,7 +265,7 @@ static ULONG WINAPI IDataObject_fnAddRef(LPDATAOBJECT iface)
/**************************************************************************
* IDataObject_Release
*/
static ULONG WINAPI IDataObject_fnRelease(LPDATAOBJECT iface)
static ULONG WINAPI IDataObject_fnRelease(IDataObject *iface)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
ULONG refCount = InterlockedDecrement(&This->ref);
......@@ -291,7 +285,7 @@ static ULONG WINAPI IDataObject_fnRelease(LPDATAOBJECT iface)
/**************************************************************************
* IDataObject_fnGetData
*/
static HRESULT WINAPI IDataObject_fnGetData(LPDATAOBJECT iface, LPFORMATETC pformatetcIn, STGMEDIUM *pmedium)
static HRESULT WINAPI IDataObject_fnGetData(IDataObject *iface, LPFORMATETC pformatetcIn, STGMEDIUM *pmedium)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
......@@ -335,14 +329,14 @@ static HRESULT WINAPI IDataObject_fnGetData(LPDATAOBJECT iface, LPFORMATETC pfor
return E_OUTOFMEMORY;
}
static HRESULT WINAPI IDataObject_fnGetDataHere(LPDATAOBJECT iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium)
static HRESULT WINAPI IDataObject_fnGetDataHere(IDataObject *iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI IDataObject_fnQueryGetData(LPDATAOBJECT iface, LPFORMATETC pformatetc)
static HRESULT WINAPI IDataObject_fnQueryGetData(IDataObject *iface, LPFORMATETC pformatetc)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
UINT i;
......@@ -365,21 +359,21 @@ static HRESULT WINAPI IDataObject_fnQueryGetData(LPDATAOBJECT iface, LPFORMATETC
return DV_E_TYMED;
}
static HRESULT WINAPI IDataObject_fnGetCanonicalFormatEtc(LPDATAOBJECT iface, LPFORMATETC pformatectIn, LPFORMATETC pformatetcOut)
static HRESULT WINAPI IDataObject_fnGetCanonicalFormatEtc(IDataObject *iface, LPFORMATETC pformatectIn, LPFORMATETC pformatetcOut)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI IDataObject_fnSetData(LPDATAOBJECT iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
static HRESULT WINAPI IDataObject_fnSetData(IDataObject *iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI IDataObject_fnEnumFormatEtc(LPDATAOBJECT iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
static HRESULT WINAPI IDataObject_fnEnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
......@@ -396,19 +390,19 @@ static HRESULT WINAPI IDataObject_fnEnumFormatEtc(LPDATAOBJECT iface, DWORD dwDi
return E_NOTIMPL;
}
static HRESULT WINAPI IDataObject_fnDAdvise(LPDATAOBJECT iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
static HRESULT WINAPI IDataObject_fnDAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI IDataObject_fnDUnadvise(LPDATAOBJECT iface, DWORD dwConnection)
static HRESULT WINAPI IDataObject_fnDUnadvise(IDataObject *iface, DWORD dwConnection)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI IDataObject_fnEnumDAdvise(LPDATAOBJECT iface, IEnumSTATDATA **ppenumAdvise)
static HRESULT WINAPI IDataObject_fnEnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
{
IDataObjectImpl *This = impl_from_IDataObject(iface);
FIXME("(%p)->()\n", This);
......@@ -434,7 +428,7 @@ static const IDataObjectVtbl dtovt =
/**************************************************************************
* IDataObject_Constructor
*/
LPDATAOBJECT IDataObject_Constructor(HWND hwndOwner,
IDataObject* IDataObject_Constructor(HWND hwndOwner,
LPCITEMIDLIST pMyPidl, LPCITEMIDLIST * apidl, UINT cidl)
{
IDataObjectImpl* dto;
......@@ -459,5 +453,5 @@ LPDATAOBJECT IDataObject_Constructor(HWND hwndOwner,
}
TRACE("(%p)->(apidl=%p cidl=%u)\n",dto, apidl, cidl);
return (LPDATAOBJECT)dto;
return &dto->IDataObject_iface;
}
......@@ -80,7 +80,7 @@ HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid,
dth->IDropTargetHelper_iface.lpVtbl = &vt_IDropTargetHelper;
if (FAILED (IDropTargetHelper_QueryInterface (&dth->IDropTargetHelper_iface, riid, ppv))) {
IDropTargetHelper_Release (&dth->IDropTargetHelper_iface);
LocalFree(dth);
return E_NOINTERFACE;
}
......@@ -100,7 +100,7 @@ static HRESULT WINAPI IDropTargetHelper_fnQueryInterface (IDropTargetHelper * if
*ppvObj = NULL;
if (IsEqualIID (riid, &IID_IUnknown) || IsEqualIID (riid, &IID_IDropTargetHelper)) {
*ppvObj = This;
*ppvObj = &This->IDropTargetHelper_iface;
}
if (*ppvObj) {
......
......@@ -782,7 +782,7 @@ static HRESULT WINAPI IExplorerBrowser_fnQueryInterface(IExplorerBrowser *iface,
if(IsEqualIID(riid, &IID_IExplorerBrowser) ||
IsEqualIID(riid, &IID_IUnknown))
{
*ppvObject = This;
*ppvObject = &This->IExplorerBrowser_iface;
}
else if(IsEqualIID(riid, &IID_IShellBrowser))
{
......
......@@ -170,11 +170,10 @@ static HRESULT WINAPI IEnumIDList_fnQueryInterface(IEnumIDList *iface, REFIID ri
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = This;
}
else if(IsEqualIID(riid, &IID_IEnumIDList)) /*IEnumIDList*/
{ *ppvObj = This;
if(IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IEnumIDList))
{
*ppvObj = &This->IEnumIDList_iface;
}
if(*ppvObj)
......
......@@ -358,7 +358,7 @@ static HRESULT WINAPI RecycleBin_QueryInterface(IShellFolder2 *iface, REFIID rii
*ppvObject = NULL;
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IShellFolder)
|| IsEqualGUID(riid, &IID_IShellFolder2))
*ppvObject = This;
*ppvObject = &This->IShellFolder2_iface;
if (IsEqualGUID(riid, &IID_IPersist) || IsEqualGUID(riid, &IID_IPersistFolder)
|| IsEqualGUID(riid, &IID_IPersistFolder2))
......@@ -703,21 +703,21 @@ static HRESULT WINAPI RecycleBin_IPersistFolder2_QueryInterface(IPersistFolder2
{
RecycleBin *This = impl_from_IPersistFolder2(iface);
return RecycleBin_QueryInterface(&This->IShellFolder2_iface, riid, ppvObject);
return IShellFolder2_QueryInterface(&This->IShellFolder2_iface, riid, ppvObject);
}
static ULONG WINAPI RecycleBin_IPersistFolder2_AddRef(IPersistFolder2 *iface)
{
RecycleBin *This = impl_from_IPersistFolder2(iface);
return RecycleBin_AddRef(&This->IShellFolder2_iface);
return IShellFolder2_AddRef(&This->IShellFolder2_iface);
}
static ULONG WINAPI RecycleBin_IPersistFolder2_Release(IPersistFolder2 *iface)
{
RecycleBin *This = impl_from_IPersistFolder2(iface);
return RecycleBin_Release(&This->IShellFolder2_iface);
return IShellFolder2_Release(&This->IShellFolder2_iface);
}
static const IPersistFolder2Vtbl recycleBinPersistVtbl =
......@@ -740,21 +740,21 @@ static HRESULT WINAPI RecycleBin_ISFHelper_QueryInterface(ISFHelper *iface, REFI
{
RecycleBin *This = impl_from_ISFHelper(iface);
return RecycleBin_QueryInterface(&This->IShellFolder2_iface, riid, ppvObject);
return IShellFolder2_QueryInterface(&This->IShellFolder2_iface, riid, ppvObject);
}
static ULONG WINAPI RecycleBin_ISFHelper_AddRef(ISFHelper *iface)
{
RecycleBin *This = impl_from_ISFHelper(iface);
return RecycleBin_AddRef(&This->IShellFolder2_iface);
return IShellFolder2_AddRef(&This->IShellFolder2_iface);
}
static ULONG WINAPI RecycleBin_ISFHelper_Release(ISFHelper *iface)
{
RecycleBin *This = impl_from_ISFHelper(iface);
return RecycleBin_Release(&This->IShellFolder2_iface);
return IShellFolder2_Release(&This->IShellFolder2_iface);
}
static HRESULT WINAPI RecycleBin_GetUniqueName(ISFHelper *iface,LPWSTR lpName,
......
......@@ -47,7 +47,7 @@ typedef struct {
} ShellDispatch;
typedef struct {
Folder3 Folder_iface;
Folder3 Folder3_iface;
LONG ref;
ITypeInfo *iTypeInfo;
VARIANT dir;
......@@ -67,7 +67,7 @@ static inline ShellDispatch *impl_from_IShellDispatch2(IShellDispatch2 *iface)
static inline FolderImpl *impl_from_Folder(Folder3 *iface)
{
return CONTAINING_RECORD(iface, FolderImpl, Folder_iface);
return CONTAINING_RECORD(iface, FolderImpl, Folder3_iface);
}
static inline FolderItemImpl *impl_from_FolderItem(FolderItem *iface)
......@@ -107,7 +107,7 @@ static HRESULT WINAPI FolderItemImpl_QueryInterface(FolderItem *iface,
if (IsEqualIID(&IID_IUnknown, riid) ||
IsEqualIID(&IID_IDispatch, riid) ||
IsEqualIID(&IID_FolderItem, riid))
*ppv = This;
*ppv = &This->FolderItem_iface;
else
{
FIXME("not implemented for %s\n", shdebugstr_guid(riid));
......@@ -430,7 +430,7 @@ static HRESULT WINAPI FolderImpl_QueryInterface(Folder3 *iface, REFIID riid,
IsEqualIID(&IID_Folder, riid) ||
IsEqualIID(&IID_Folder2, riid) ||
IsEqualIID(&IID_Folder3, riid))
*ppv = This;
*ppv = &This->Folder3_iface;
else
{
FIXME("not implemented for %s\n", shdebugstr_guid(riid));
......@@ -712,7 +712,7 @@ static HRESULT Folder_Constructor(VARIANT *dir, Folder **ppsdf)
This = HeapAlloc(GetProcessHeap(), 0, sizeof(FolderImpl));
if (!This) return E_OUTOFMEMORY;
This->Folder_iface.lpVtbl = &FolderImpl_Vtbl;
This->Folder3_iface.lpVtbl = &FolderImpl_Vtbl;
This->ref = 1;
ret = load_type_info(&IID_Folder3, &This->iTypeInfo);
......@@ -748,7 +748,7 @@ static HRESULT WINAPI ShellDispatch_QueryInterface(IShellDispatch2 *iface,
IsEqualIID(&IID_IDispatch, riid) ||
IsEqualIID(&IID_IShellDispatch, riid) ||
IsEqualIID(&IID_IShellDispatch2, riid))
*ppv = This;
*ppv = &This->IShellDispatch2_iface;
else
{
FIXME("not implemented for %s\n", shdebugstr_guid(riid));
......
......@@ -69,7 +69,7 @@ static HRESULT WINAPI ShellItem_QueryInterface(IShellItem2 *iface, REFIID riid,
if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IShellItem, riid) ||
IsEqualIID(&IID_IShellItem2, riid))
{
*ppv = This;
*ppv = &This->IShellItem2_iface;
}
else if (IsEqualIID(&IID_IPersist, riid) || IsEqualIID(&IID_IPersistIDList, riid))
{
......@@ -447,41 +447,30 @@ static const IShellItem2Vtbl ShellItem2_Vtbl = {
ShellItem2_GetBool
};
static HRESULT ShellItem_GetClassID(ShellItem* This, CLSID *pClassID)
{
TRACE("(%p,%p)\n", This, pClassID);
*pClassID = CLSID_ShellItem;
return S_OK;
}
static HRESULT WINAPI ShellItem_IPersistIDList_QueryInterface(IPersistIDList *iface,
REFIID riid, void **ppv)
{
ShellItem *This = impl_from_IPersistIDList(iface);
return ShellItem_QueryInterface(&This->IShellItem2_iface, riid, ppv);
return IShellItem2_QueryInterface(&This->IShellItem2_iface, riid, ppv);
}
static ULONG WINAPI ShellItem_IPersistIDList_AddRef(IPersistIDList *iface)
{
ShellItem *This = impl_from_IPersistIDList(iface);
return ShellItem_AddRef(&This->IShellItem2_iface);
return IShellItem2_AddRef(&This->IShellItem2_iface);
}
static ULONG WINAPI ShellItem_IPersistIDList_Release(IPersistIDList *iface)
{
ShellItem *This = impl_from_IPersistIDList(iface);
return ShellItem_Release(&This->IShellItem2_iface);
return IShellItem2_Release(&This->IShellItem2_iface);
}
static HRESULT WINAPI ShellItem_IPersistIDList_GetClassID(IPersistIDList* iface,
CLSID *pClassID)
{
ShellItem *This = impl_from_IPersistIDList(iface);
return ShellItem_GetClassID(This, pClassID);
*pClassID = CLSID_ShellItem;
return S_OK;
}
static HRESULT WINAPI ShellItem_IPersistIDList_SetIDList(IPersistIDList* iface,
......@@ -545,8 +534,8 @@ HRESULT WINAPI IShellItem_Constructor(IUnknown *pUnkOuter, REFIID riid, void **p
This->pidl = NULL;
This->IPersistIDList_iface.lpVtbl = &ShellItem_IPersistIDList_Vtbl;
ret = ShellItem_QueryInterface(&This->IShellItem2_iface, riid, ppv);
ShellItem_Release(&This->IShellItem2_iface);
ret = IShellItem2_QueryInterface(&This->IShellItem2_iface, riid, ppv);
IShellItem2_Release(&This->IShellItem2_iface);
return ret;
}
......@@ -800,7 +789,7 @@ static HRESULT WINAPI IShellItemArray_fnQueryInterface(IShellItemArray *iface,
if(IsEqualIID(riid, &IID_IShellItemArray) ||
IsEqualIID(riid, &IID_IUnknown))
{
*ppvObject = This;
*ppvObject = &This->IShellItemArray_iface;
}
if(*ppvObject)
......
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