shlwapi: Forward IUnknown_* helpers to shcore.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-11-30 13:50:11 +03:00 committed by Alexandre Julliard
parent 29a15a35f5
commit 24d5e853b2
3 changed files with 15 additions and 143 deletions

View File

@ -5,7 +5,7 @@
@ stdcall IStream_Size(ptr ptr) shlwapi.IStream_Size @ stdcall IStream_Size(ptr ptr) shlwapi.IStream_Size
@ stdcall IStream_Write(ptr ptr long) shlwapi.IStream_Write @ stdcall IStream_Write(ptr ptr long) shlwapi.IStream_Write
@ stub IStream_WriteStr @ stub IStream_WriteStr
@ stdcall IUnknown_AtomicRelease(long) shlwapi.IUnknown_AtomicRelease @ stdcall IUnknown_AtomicRelease(ptr) shlwapi.IUnknown_AtomicRelease
@ stdcall IUnknown_GetSite(ptr ptr ptr) shlwapi.IUnknown_GetSite @ stdcall IUnknown_GetSite(ptr ptr ptr) shlwapi.IUnknown_GetSite
@ stdcall IUnknown_QueryService(ptr ptr ptr ptr) shlwapi.IUnknown_QueryService @ stdcall IUnknown_QueryService(ptr ptr ptr ptr) shlwapi.IUnknown_QueryService
@ stdcall IUnknown_Set(ptr ptr) shlwapi.IUnknown_Set @ stdcall IUnknown_Set(ptr ptr) shlwapi.IUnknown_Set

View File

@ -57,7 +57,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
extern HINSTANCE shlwapi_hInstance; extern HINSTANCE shlwapi_hInstance;
extern DWORD SHLWAPI_ThreadRef_index; extern DWORD SHLWAPI_ThreadRef_index;
HRESULT WINAPI IUnknown_QueryService(IUnknown*,REFGUID,REFIID,LPVOID*); static HRESULT iunknown_query_service(IUnknown*,REFGUID,REFIID,LPVOID*);
HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,DWORD); HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,DWORD);
BOOL WINAPI SHAboutInfoW(LPWSTR,DWORD); BOOL WINAPI SHAboutInfoW(LPWSTR,DWORD);
@ -299,7 +299,7 @@ HRESULT WINAPI RegisterDefaultAcceptHeaders(LPBC lpBC, IUnknown *lpUnknown)
TRACE("(%p, %p)\n", lpBC, lpUnknown); TRACE("(%p, %p)\n", lpBC, lpUnknown);
hr = IUnknown_QueryService(lpUnknown, &IID_IWebBrowserApp, &IID_IWebBrowserApp, (void**)&pBrowser); hr = iunknown_query_service(lpUnknown, &IID_IWebBrowserApp, &IID_IWebBrowserApp, (void**)&pBrowser);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
@ -1172,29 +1172,6 @@ HRESULT WINAPI ConnectToConnectionPoint(IUnknown* lpUnkSink, REFIID riid, BOOL f
return hRet; return hRet;
} }
/*************************************************************************
* @ [SHLWAPI.169]
*
* Release an interface and zero a supplied pointer.
*
* PARAMS
* lpUnknown [I] Object to release
*
* RETURNS
* Nothing.
*/
void WINAPI IUnknown_AtomicRelease(IUnknown ** lpUnknown)
{
TRACE("(%p)\n", lpUnknown);
if(!lpUnknown || !*lpUnknown) return;
TRACE("doing Release\n");
IUnknown_Release(*lpUnknown);
*lpUnknown = NULL;
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.170] * @ [SHLWAPI.170]
* *
@ -1342,44 +1319,6 @@ HRESULT WINAPI IUnknown_SetOwner(IUnknown *iface, IUnknown *pUnk)
return hr; return hr;
} }
/*************************************************************************
* @ [SHLWAPI.174]
*
* Call either IObjectWithSite_SetSite() or IInternetSecurityManager_SetSecuritySite() on
* an object.
*
*/
HRESULT WINAPI IUnknown_SetSite(
IUnknown *obj, /* [in] OLE object */
IUnknown *site) /* [in] Site interface */
{
HRESULT hr;
IObjectWithSite *iobjwithsite;
IInternetSecurityManager *isecmgr;
if (!obj) return E_FAIL;
hr = IUnknown_QueryInterface(obj, &IID_IObjectWithSite, (LPVOID *)&iobjwithsite);
TRACE("IID_IObjectWithSite QI ret=%08x, %p\n", hr, iobjwithsite);
if (SUCCEEDED(hr))
{
hr = IObjectWithSite_SetSite(iobjwithsite, site);
TRACE("done IObjectWithSite_SetSite ret=%08x\n", hr);
IObjectWithSite_Release(iobjwithsite);
}
else
{
hr = IUnknown_QueryInterface(obj, &IID_IInternetSecurityManager, (LPVOID *)&isecmgr);
TRACE("IID_IInternetSecurityManager QI ret=%08x, %p\n", hr, isecmgr);
if (FAILED(hr)) return hr;
hr = IInternetSecurityManager_SetSecuritySite(isecmgr, (IInternetSecurityMgrSite *)site);
TRACE("done IInternetSecurityManager_SetSecuritySite ret=%08x\n", hr);
IInternetSecurityManager_Release(isecmgr);
}
return hr;
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.175] * @ [SHLWAPI.175]
* *
@ -1421,26 +1360,7 @@ HRESULT WINAPI IUnknown_GetClassID(IUnknown *lpUnknown, CLSID *clsid)
return hr; return hr;
} }
/************************************************************************* static HRESULT iunknown_query_service(IUnknown* lpUnknown, REFGUID sid, REFIID riid, LPVOID *lppOut)
* @ [SHLWAPI.176]
*
* Retrieve a Service Interface from an object.
*
* PARAMS
* lpUnknown [I] Object to get an IServiceProvider interface from
* sid [I] Service ID for IServiceProvider_QueryService() call
* riid [I] Function requested for QueryService call
* lppOut [O] Destination for the service interface pointer
*
* RETURNS
* Success: S_OK. lppOut contains an object providing the requested service
* Failure: An HRESULT error code
*
* NOTES
* lpUnknown is expected to support the IServiceProvider interface.
*/
HRESULT WINAPI IUnknown_QueryService(IUnknown* lpUnknown, REFGUID sid, REFIID riid,
LPVOID *lppOut)
{ {
IServiceProvider* pService = NULL; IServiceProvider* pService = NULL;
HRESULT hRet; HRESULT hRet;
@ -1500,7 +1420,7 @@ HRESULT WINAPI IUnknown_QueryServiceExec(IUnknown *lpUnknown, REFIID service,
TRACE("%p %s %s %d %08x %p %p\n", lpUnknown, debugstr_guid(service), TRACE("%p %s %s %d %08x %p %p\n", lpUnknown, debugstr_guid(service),
debugstr_guid(group), cmdId, cmdOpt, pIn, pOut); debugstr_guid(group), cmdId, cmdOpt, pIn, pOut);
hr = IUnknown_QueryService(lpUnknown, service, &IID_IOleCommandTarget, (void**)&target); hr = iunknown_query_service(lpUnknown, service, &IID_IOleCommandTarget, (void**)&target);
if (hr == S_OK) if (hr == S_OK)
{ {
hr = IOleCommandTarget_Exec(target, group, cmdId, cmdOpt, pIn, pOut); hr = IOleCommandTarget_Exec(target, group, cmdId, cmdOpt, pIn, pOut);
@ -1537,7 +1457,7 @@ HRESULT WINAPI IUnknown_ProfferService(IUnknown *lpUnknown, REFGUID service, ISe
TRACE("%p %s %p %p\n", lpUnknown, debugstr_guid(service), pService, pCookie); TRACE("%p %s %p %p\n", lpUnknown, debugstr_guid(service), pService, pCookie);
hr = IUnknown_QueryService(lpUnknown, &IID_IProfferService, &IID_IProfferService, (void**)&proffer); hr = iunknown_query_service(lpUnknown, &IID_IProfferService, &IID_IProfferService, (void**)&proffer);
if (hr == S_OK) if (hr == S_OK)
{ {
if (pService) if (pService)
@ -1905,7 +1825,7 @@ HRESULT WINAPI IUnknown_HandleIRestrict(LPUNKNOWN lpUnknown, PVOID lpArg1,
if (lpUnknown && lpArg4) if (lpUnknown && lpArg4)
{ {
hRet = IUnknown_QueryService(lpUnknown, (REFGUID)service_id, hRet = iunknown_query_service(lpUnknown, (REFGUID)service_id,
(REFGUID)function_id, (void**)&lpUnkInner); (REFGUID)function_id, (void**)&lpUnkInner);
if (SUCCEEDED(hRet) && lpUnkInner) if (SUCCEEDED(hRet) && lpUnkInner)
@ -2115,32 +2035,6 @@ int WINAPI SHSearchMapInt(const int *lpKeys, const int *lpValues, int iLen, int
return -1; /* Not found */ return -1; /* Not found */
} }
/*************************************************************************
* @ [SHLWAPI.199]
*
* Copy an interface pointer
*
* PARAMS
* lppDest [O] Destination for copy
* lpUnknown [I] Source for copy
*
* RETURNS
* Nothing.
*/
VOID WINAPI IUnknown_Set(IUnknown **lppDest, IUnknown *lpUnknown)
{
TRACE("(%p,%p)\n", lppDest, lpUnknown);
IUnknown_AtomicRelease(lppDest);
if (lpUnknown)
{
IUnknown_AddRef(lpUnknown);
*lppDest = lpUnknown;
}
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.200] * @ [SHLWAPI.200]
* *
@ -2535,29 +2429,6 @@ LRESULT CALLBACK SHDefWindowProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM
return DefWindowProcA(hWnd, uMessage, wParam, lParam); return DefWindowProcA(hWnd, uMessage, wParam, lParam);
} }
/*************************************************************************
* @ [SHLWAPI.256]
*/
HRESULT WINAPI IUnknown_GetSite(LPUNKNOWN lpUnknown, REFIID iid, PVOID *lppSite)
{
HRESULT hRet = E_INVALIDARG;
LPOBJECTWITHSITE lpSite = NULL;
TRACE("(%p,%s,%p)\n", lpUnknown, debugstr_guid(iid), lppSite);
if (lpUnknown && iid && lppSite)
{
hRet = IUnknown_QueryInterface(lpUnknown, &IID_IObjectWithSite,
(void**)&lpSite);
if (SUCCEEDED(hRet) && lpSite)
{
hRet = IObjectWithSite_GetSite(lpSite, iid, lppSite);
IObjectWithSite_Release(lpSite);
}
}
return hRet;
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.257] * @ [SHLWAPI.257]
* *
@ -2758,7 +2629,8 @@ VOID WINAPI SHWeakReleaseInterface(IUnknown *lpDest, IUnknown **lppUnknown)
{ {
/* Copy Reference*/ /* Copy Reference*/
IUnknown_AddRef(lpDest); IUnknown_AddRef(lpDest);
IUnknown_AtomicRelease(lppUnknown); /* Release existing interface */ IUnknown_Release(*lppUnknown); /* Release existing interface */
*lppUnknown = NULL;
} }
} }
@ -5174,7 +5046,7 @@ HRESULT WINAPI IUnknown_QueryServiceForWebBrowserApp(IUnknown* lpUnknown,
REFGUID riid, LPVOID *lppOut) REFGUID riid, LPVOID *lppOut)
{ {
FIXME("%p %s %p semi-STUB\n", lpUnknown, debugstr_guid(riid), lppOut); FIXME("%p %s %p semi-STUB\n", lpUnknown, debugstr_guid(riid), lppOut);
return IUnknown_QueryService(lpUnknown,&IID_IWebBrowserApp,riid,lppOut); return iunknown_query_service(lpUnknown,&IID_IWebBrowserApp,riid,lppOut);
} }
/************************************************************************** /**************************************************************************

View File

@ -166,14 +166,14 @@
166 stdcall -noname SHIsEmptyStream(ptr) 166 stdcall -noname SHIsEmptyStream(ptr)
167 stdcall -noname SHSetParentHwnd(long ptr) 167 stdcall -noname SHSetParentHwnd(long ptr)
168 stdcall -ordinal ConnectToConnectionPoint(ptr ptr long ptr ptr ptr) 168 stdcall -ordinal ConnectToConnectionPoint(ptr ptr long ptr ptr ptr)
169 stdcall -ordinal IUnknown_AtomicRelease(long) 169 stdcall -ordinal IUnknown_AtomicRelease(ptr) shcore.IUnknown_AtomicRelease
170 stdcall -noname PathSkipLeadingSlashesA(str) 170 stdcall -noname PathSkipLeadingSlashesA(str)
171 stdcall -noname SHIsSameObject(ptr ptr) 171 stdcall -noname SHIsSameObject(ptr ptr)
172 stdcall -ordinal IUnknown_GetWindow(ptr ptr) 172 stdcall -ordinal IUnknown_GetWindow(ptr ptr)
173 stdcall -noname IUnknown_SetOwner(ptr ptr) 173 stdcall -noname IUnknown_SetOwner(ptr ptr)
174 stdcall -ordinal IUnknown_SetSite(ptr ptr) 174 stdcall -ordinal IUnknown_SetSite(ptr ptr) shcore.IUnknown_SetSite
175 stdcall -noname IUnknown_GetClassID(ptr ptr) 175 stdcall -noname IUnknown_GetClassID(ptr ptr)
176 stdcall -ordinal IUnknown_QueryService(ptr ptr ptr ptr) 176 stdcall -ordinal IUnknown_QueryService(ptr ptr ptr ptr) shcore.IUnknown_QueryService
177 stdcall -noname SHLoadMenuPopup(ptr wstr) 177 stdcall -noname SHLoadMenuPopup(ptr wstr)
178 stdcall -noname SHPropagateMessage(ptr long long long long) 178 stdcall -noname SHPropagateMessage(ptr long long long long)
179 stdcall -noname SHMenuIndexFromID(long long) 179 stdcall -noname SHMenuIndexFromID(long long)
@ -196,7 +196,7 @@
196 stdcall -noname SHVerbExistsNA(str ptr ptr long) 196 stdcall -noname SHVerbExistsNA(str ptr ptr long)
197 stdcall -noname SHFillRectClr(long ptr long) 197 stdcall -noname SHFillRectClr(long ptr long)
198 stdcall -noname SHSearchMapInt(ptr ptr long long) 198 stdcall -noname SHSearchMapInt(ptr ptr long long)
199 stdcall -ordinal IUnknown_Set(ptr ptr) 199 stdcall -ordinal IUnknown_Set(ptr ptr) shcore.IUnknown_Set
200 stdcall -noname MayQSForward(ptr ptr ptr long ptr ptr) 200 stdcall -noname MayQSForward(ptr ptr ptr long ptr ptr)
201 stdcall -noname MayExecForward(ptr long ptr long long ptr ptr) 201 stdcall -noname MayExecForward(ptr long ptr long long ptr ptr)
202 stdcall -noname IsQSForward(ptr long ptr) 202 stdcall -noname IsQSForward(ptr long ptr)
@ -253,7 +253,7 @@
253 stub -noname StopWatchExA 253 stub -noname StopWatchExA
254 stub -noname StopWatchExW 254 stub -noname StopWatchExW
255 stub -noname EventTraceHandler 255 stub -noname EventTraceHandler
256 stdcall -ordinal IUnknown_GetSite(ptr ptr ptr) 256 stdcall -ordinal IUnknown_GetSite(ptr ptr ptr) shcore.IUnknown_GetSite
257 stdcall -noname SHCreateWorkerWindowA(ptr ptr long long ptr long) 257 stdcall -noname SHCreateWorkerWindowA(ptr ptr long long ptr long)
258 stub -noname SHRegisterWaitForSingleObject 258 stub -noname SHRegisterWaitForSingleObject
259 stub -noname SHUnregisterWait 259 stub -noname SHUnregisterWait