[SHELL32] Fix SHBindToObject

This should have 5 parameters and stdcall convention.
Get rid of SHBindToObjectEx.
This commit is contained in:
Timo Kreuzer
2026-06-23 18:10:39 +00:00
parent 4f329a03b7
commit a790beb22b
10 changed files with 16 additions and 33 deletions
+1 -1
View File
@@ -190,7 +190,7 @@ BrFolder_InitTreeView(BrFolder *info)
PCIDLIST_RELATIVE pidlChild = ILFindLastID(pidlRoot);
CComPtr<IShellFolder> lpsfParent;
hr = SHBindToObject(NULL, pidlParent, /*NULL, */ IID_PPV_ARG(IShellFolder, &lpsfParent));
hr = SHBindToObject(NULL, pidlParent, NULL, IID_PPV_ARG(IShellFolder, &lpsfParent));
if (FAILED_UNEXPECTEDLY(hr))
return;
+1 -1
View File
@@ -71,7 +71,7 @@ Shell_ParsePrinterName(
return hr;
CComPtr<IShellFolder> pFolder;
hr = SHBindToObject(NULL, pidlPrinters, IID_PPV_ARG(IShellFolder, &pFolder));
hr = SHBindToObject(NULL, pidlPrinters, NULL, IID_PPV_ARG(IShellFolder, &pFolder));
if (FAILED_UNEXPECTEDLY(hr))
return hr;
+2 -2
View File
@@ -119,7 +119,7 @@ CDesktopFolder::ShellUrlParseDisplayName(
if (pch && *pch)
{
CComPtr<IShellFolder> psfFolder;
hr = SHBindToObject(NULL, pidlLocation, IID_PPV_ARG(IShellFolder, &psfFolder));
hr = SHBindToObject(NULL, pidlLocation, NULL, IID_PPV_ARG(IShellFolder, &psfFolder));
if (SUCCEEDED(hr))
{
CComHeapPtr<ITEMIDLIST> pidlNew;
@@ -353,7 +353,7 @@ HRESULT CDesktopFolder::_ParseDisplayNameByParent(
return E_OUTOFMEMORY;
CComPtr<IShellFolder> pParentFolder;
SHBindToObject(NULL, pidlParent, IID_PPV_ARG(IShellFolder, &pParentFolder));
SHBindToObject(NULL, pidlParent, NULL, IID_PPV_ARG(IShellFolder, &pParentFolder));
CComHeapPtr<ITEMIDLIST> pidlChild;
HRESULT hr = pParentFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName,
+1 -1
View File
@@ -534,7 +534,7 @@ static HRESULT CALLBACK FileOpCallback(FILEOPCALLBACKEVENT Event, LPCWSTR Src, L
{
CComHeapPtr<ITEMIDLIST> pidlBB(SHCloneSpecialIDList(NULL, CSIDL_BITBUCKET, FALSE));
CComPtr<IShellFolder> pSF;
if (pidlBB && SUCCEEDED(SHBindToObject(NULL, pidlBB, IID_PPV_ARG(IShellFolder, &pSF))))
if (pidlBB && SUCCEEDED(SHBindToObject(NULL, pidlBB, NULL, IID_PPV_ARG(IShellFolder, &pSF))))
{
if (IsRecycleBinEmpty(pSF))
SHUpdateRecycleBinIcon();
+1 -1
View File
@@ -982,7 +982,7 @@ static HRESULT CRegItemContextMenu_CreateInstance(PCIDLIST_ABSOLUTE pidlFolder,
// It currently does not so we have to ask the outer folder ourself so
// that we get the correct attributes for My Computer etc.
CComPtr<IShellFolder> pOuterSF;
SHBindToObject(NULL, pidlFolder, IID_PPV_ARG(IShellFolder, &pOuterSF));
SHBindToObject(NULL, pidlFolder, NULL, IID_PPV_ARG(IShellFolder, &pOuterSF));
SFGAOF att = (psf && cidl) ? SHGetAttributes(pOuterSF ? pOuterSF.p : psf, apidl[0], SFGAO_FOLDER) : 0;
if ((att & SFGAO_FOLDER) && (!pGuid || !HasCLSIDShellFolderValue(*pGuid, L"HideFolderVerbs")))
+2 -9
View File
@@ -258,17 +258,10 @@ BOOL Shell_FailForceReturn(_In_ HRESULT hr);
EXTERN_C INT
Shell_ParseSpecialFolder(_In_ LPCWSTR pszStart, _Out_ LPWSTR *ppch, _Out_ INT *pcch);
EXTERN_C
HRESULT SHBindToObject(
SHSTDAPI
SHBindToObject(
_In_opt_ IShellFolder *psf,
_In_ LPCITEMIDLIST pidl,
_In_ REFIID riid,
_Out_ void **ppvObj);
HRESULT
SHBindToObjectEx(
_In_opt_ IShellFolder *pShellFolder,
_In_ LPCITEMIDLIST pidl,
_In_opt_ IBindCtx *pBindCtx,
_In_ REFIID riid,
_Out_ void **ppvObj);
+1 -1
View File
@@ -28,7 +28,7 @@ static_assert(sizeof(DataObjectAttributes) == 0xc, "Unexpected struct size!");
static
HRESULT _BindToObject(PCUIDLIST_ABSOLUTE pidl, CComPtr<IShellFolder>& spFolder)
{
return SHBindToObject(NULL, pidl, IID_PPV_ARG(IShellFolder, &spFolder));
return SHBindToObject(NULL, pidl, NULL, IID_PPV_ARG(IShellFolder, &spFolder));
}
EXTERN_C
+4 -14
View File
@@ -405,10 +405,10 @@ BOOL Shell_FailForceReturn(_In_ HRESULT hr)
}
}
HRESULT
SHBindToObjectEx(
SHSTDAPI
SHBindToObject(
_In_opt_ IShellFolder *pShellFolder,
_In_ LPCITEMIDLIST pidl,
_In_ PCUIDLIST_RELATIVE pidl,
_In_opt_ IBindCtx *pBindCtx,
_In_ REFIID riid,
_Out_ void **ppvObj)
@@ -438,16 +438,6 @@ SHBindToObjectEx(
return hr;
}
EXTERN_C
HRESULT SHBindToObject(
_In_opt_ IShellFolder *psf,
_In_ LPCITEMIDLIST pidl,
_In_ REFIID riid,
_Out_ void **ppvObj)
{
return SHBindToObjectEx(psf, pidl, NULL, riid, ppvObj);
}
EXTERN_C HRESULT
SHELL_GetUIObjectOfAbsoluteItem(
_In_opt_ HWND hWnd,
@@ -554,7 +544,7 @@ SHGetAttributes(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAt
HRESULT SHELL_GetIDListTarget(_In_ LPCITEMIDLIST pidl, _Out_ PIDLIST_ABSOLUTE *ppidl)
{
IShellLink *pSL;
HRESULT hr = SHBindToObject(NULL, pidl, IID_PPV_ARG(IShellLink, &pSL));
HRESULT hr = SHBindToObject(NULL, pidl, NULL, IID_PPV_ARG(IShellLink, &pSL));
if (SUCCEEDED(hr))
{
hr = pSL->GetIDList(ppidl); // Note: Returns S_FALSE if no target pidl
+2 -2
View File
@@ -3232,11 +3232,11 @@ HRESULT SHGetFolderLocationHelper(HWND hwnd, int nFolder, REFCLSID clsid, LPITEM
HRESULT hr;
IShellFolder *psf;
LPITEMIDLIST parent, child;
EXTERN_C HRESULT SHBindToObject(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, void **ppvObj);
SHSTDAPI SHBindToObject(IShellFolder *psf, LPCITEMIDLIST pidl, IBindCtx *pBindCtx, REFIID riid, void **ppvObj);
*ppidl = NULL;
if (FAILED(hr = SHGetFolderLocation(hwnd, nFolder, NULL, 0, &parent)))
return hr;
if (SUCCEEDED(hr = SHBindToObject(NULL, parent, &IID_IShellFolder, (void**)&psf)))
if (SUCCEEDED(hr = SHBindToObject(NULL, parent, NULL, &IID_IShellFolder, (void**)&psf)))
{
WCHAR clsidstr[2 + 38 + 1];
clsidstr[0] = clsidstr[1] = L':';
+1 -1
View File
@@ -15,7 +15,7 @@
#ifndef SHSTDAPI
#if defined(_SHELL32_) /* DECLSPEC_IMPORT disabled because of CORE-6504: */ || TRUE
#define SHSTDAPI_(type) type WINAPI
#define SHSTDAPI_(type) EXTERN_C type WINAPI
#else
#define SHSTDAPI_(type) EXTERN_C DECLSPEC_IMPORT type WINAPI
#endif