[SHELL32] CPrinterFolder: Support IQueryAssociations (#9060)

ShellExecute implementation requires
a valid IQueryAssociations interface.
https://learn.microsoft.com/en-us/windows/win32/shell/nse-implement
JIRA issue: CORE-20467
Enhance CPrinterFolder::GetUIObjectOf
for IQueryAssociations.
This commit is contained in:
Katayama Hirofumi MZ
2026-05-25 15:49:44 +09:00
committed by GitHub
parent 2e13f97a62
commit b60f66cbbf
2 changed files with 20 additions and 2 deletions
@@ -323,6 +323,21 @@ HRESULT WINAPI CPrinterFolder::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY
return hr;
}
HRESULT CPrinterFolder::_AssocCreate(REFIID riid, PVOID *ppvObj)
{
IQueryAssociations *pAssoc;
HRESULT hr = ::AssocCreate(CLSID_QueryAssociations, IID_PPV_ARG(IQueryAssociations, &pAssoc));
if (FAILED_UNEXPECTEDLY(hr))
return hr;
hr = pAssoc->Init(ASSOCF_NONE, L"Printers", NULL, NULL);
if (SUCCEEDED(hr))
hr = pAssoc->QueryInterface(riid, ppvObj);
pAssoc->Release();
return hr;
}
/**************************************************************************
* CPrinterFolder::GetUIObjectOf
*
@@ -351,6 +366,8 @@ HRESULT WINAPI CPrinterFolder::GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMI
if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID(riid, IID_IExtractIconW)) && cidl == 1)
hr = CPrintersExtractIconW_CreateInstane(apidl[0], riid, &pObj);
else if (IsEqualIID(riid, IID_IQueryAssociations))
hr = _AssocCreate(riid, &pObj);
else
hr = E_NOINTERFACE;
+3 -2
View File
@@ -32,10 +32,11 @@ class CPrinterFolder :
{
private:
CLSID *pclsid;
LPITEMIDLIST pidlRoot; /* absolute pidl */
int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
HRESULT _AssocCreate(REFIID riid, PVOID *ppvObj);
public:
CPrinterFolder();
~CPrinterFolder();