2011-05-15 15:55:49 +00:00
|
|
|
/*
|
|
|
|
* Virtual Printers Folder
|
|
|
|
*
|
|
|
|
* Copyright 1997 Marcus Meissner
|
|
|
|
* Copyright 1998, 1999, 2002 Juergen Schmied
|
|
|
|
* Copyright 2005 Huw Davies
|
|
|
|
* Copyright 2009 Andrew Hill
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <precomp.h>
|
|
|
|
|
2014-01-25 17:24:24 +00:00
|
|
|
#include <winspool.h>
|
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL (shell);
|
|
|
|
|
|
|
|
static shvheader PrinterSFHeader[] = {
|
2017-06-12 10:01:28 +00:00
|
|
|
{IDS_SHV_COLUMN_NAME, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 15},
|
2015-10-26 15:07:44 +00:00
|
|
|
{IDS_SHV_COLUMN_DOCUMENTS , SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 15},
|
|
|
|
{IDS_SHV_COLUMN_STATUS, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 15},
|
|
|
|
{IDS_SHV_COLUMN_COMMENTS, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 15},
|
|
|
|
{IDS_SHV_COLUMN_LOCATION, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 15},
|
|
|
|
{IDS_SHV_COLUMN_MODEL, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 15}
|
2011-05-15 15:55:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define COLUMN_NAME 0
|
|
|
|
#define COLUMN_DOCUMENTS 1
|
|
|
|
#define COLUMN_STATUS 2
|
|
|
|
#define COLUMN_COMMENTS 3
|
|
|
|
#define COLUMN_LOCATION 4
|
|
|
|
#define COLUMN_MODEL 5
|
|
|
|
|
|
|
|
#define PrinterSHELLVIEWCOLUMNS (6)
|
|
|
|
|
|
|
|
/**************************************************************************
|
2016-04-30 15:30:59 +00:00
|
|
|
* CPrintersExtractIconW_CreateInstane
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
2016-04-30 15:30:59 +00:00
|
|
|
* There is no CPrintersExtractIconW. We just initialize CExtractIcon properly to do our job.
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
2016-04-30 15:30:59 +00:00
|
|
|
HRESULT WINAPI CPrintersExtractIconW_CreateInstane(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2016-04-30 15:30:59 +00:00
|
|
|
CComPtr<IDefaultExtractIconInit> initIcon;
|
|
|
|
HRESULT hr = SHCreateDefaultExtractIcon(IID_PPV_ARG(IDefaultExtractIconInit,&initIcon));
|
2016-11-10 08:05:13 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2016-04-30 15:30:59 +00:00
|
|
|
/* FIXME: other icons for default, network, print to file */
|
2016-09-23 15:51:53 +00:00
|
|
|
initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_PRINTER);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2016-04-30 15:30:59 +00:00
|
|
|
return initIcon->QueryInterface(riid,ppv);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* Printers folder implementation
|
|
|
|
*/
|
|
|
|
|
2014-11-04 12:49:36 +00:00
|
|
|
class CPrintersEnum: public CEnumIDListBase
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-17 22:53:44 +00:00
|
|
|
public:
|
|
|
|
CPrintersEnum();
|
|
|
|
~CPrintersEnum();
|
|
|
|
HRESULT WINAPI Initialize(HWND hwndOwner, DWORD dwFlags);
|
|
|
|
BOOL CreatePrintersEnumList(DWORD dwFlags);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
BEGIN_COM_MAP(CPrintersEnum)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
|
|
|
|
END_COM_MAP()
|
2011-05-15 15:55:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
CPrintersEnum::CPrintersEnum()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CPrintersEnum::~CPrintersEnum()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CPrintersEnum::Initialize(HWND hwndOwner, DWORD dwFlags)
|
|
|
|
{
|
2011-09-07 23:21:02 +00:00
|
|
|
if (CreatePrintersEnumList(dwFlags) == FALSE)
|
|
|
|
return E_FAIL;
|
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static LPITEMIDLIST _ILCreatePrinterItem(PRINTER_INFO_4W *pi)
|
|
|
|
{
|
|
|
|
PIDLDATA tmp;
|
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
PIDLPrinterStruct * p;
|
2011-12-17 22:53:44 +00:00
|
|
|
int size0 = (char*)&tmp.u.cprinter.szName - (char*)&tmp.u.cprinter;
|
2011-05-15 15:55:49 +00:00
|
|
|
int size = size0;
|
|
|
|
|
|
|
|
tmp.type = 0x00;
|
|
|
|
tmp.u.cprinter.dummy = 0xFF;
|
|
|
|
if (pi->pPrinterName)
|
|
|
|
tmp.u.cprinter.offsServer = wcslen(pi->pPrinterName) + 1;
|
|
|
|
else
|
|
|
|
tmp.u.cprinter.offsServer = 1;
|
|
|
|
|
|
|
|
size += tmp.u.cprinter.offsServer * sizeof(WCHAR);
|
|
|
|
if (pi->pServerName)
|
2011-12-18 21:54:04 +00:00
|
|
|
size += (wcslen(pi->pServerName) + 1) * sizeof(WCHAR);
|
2011-05-15 15:55:49 +00:00
|
|
|
else
|
|
|
|
size += sizeof(WCHAR);
|
|
|
|
|
|
|
|
pidl = (LPITEMIDLIST)SHAlloc(size + 4);
|
|
|
|
if (!pidl)
|
|
|
|
return pidl;
|
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
pidl->mkid.cb = size + 2;
|
|
|
|
memcpy(pidl->mkid.abID, &tmp, 2 + size0);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
p = &((PIDLDATA*)pidl->mkid.abID)->u.cprinter;
|
|
|
|
|
|
|
|
p->Attributes = pi->Attributes;
|
|
|
|
if (pi->pPrinterName)
|
|
|
|
wcscpy(p->szName, pi->pPrinterName);
|
|
|
|
else
|
|
|
|
p->szName[0] = L'\0';
|
|
|
|
|
|
|
|
if (pi->pServerName)
|
|
|
|
wcscpy(p->szName + p->offsServer, pi->pServerName);
|
|
|
|
else
|
|
|
|
p->szName[p->offsServer] = L'\0';
|
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
*(WORD*)((char*)pidl + (size + 2)) = 0;
|
2011-05-15 15:55:49 +00:00
|
|
|
return pidl;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrintersEnum::CreatePrintersEnumList()
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
BOOL CPrintersEnum::CreatePrintersEnumList(DWORD dwFlags)
|
|
|
|
{
|
|
|
|
BOOL ret = TRUE;
|
|
|
|
|
|
|
|
TRACE("(%p)->(flags=0x%08lx) \n", this, dwFlags);
|
|
|
|
|
|
|
|
/* enumerate the folders */
|
|
|
|
if (dwFlags & SHCONTF_NONFOLDERS)
|
|
|
|
{
|
|
|
|
DWORD needed = 0, num = 0, i;
|
|
|
|
PRINTER_INFO_4W *pi;
|
|
|
|
|
|
|
|
EnumPrintersW(PRINTER_ENUM_LOCAL, NULL, 4, NULL, 0, &needed, &num);
|
|
|
|
if (!needed)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
pi = (PRINTER_INFO_4W *)HeapAlloc(GetProcessHeap(), 0, needed);
|
|
|
|
if(!EnumPrintersW(PRINTER_ENUM_LOCAL, NULL, 4, (LPBYTE)pi, needed, &needed, &num)) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, pi);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i = 0; i < num; i++) {
|
|
|
|
LPITEMIDLIST pidl = _ILCreatePrinterItem(&pi[i]);
|
|
|
|
if (pidl)
|
|
|
|
{
|
|
|
|
if (!AddToEnumList(pidl))
|
|
|
|
SHFree(pidl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(), 0, pi);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
CPrinterFolder::CPrinterFolder()
|
|
|
|
{
|
2011-09-07 01:33:31 +00:00
|
|
|
pidlRoot = NULL;
|
|
|
|
dwAttributes = 0;
|
2011-09-07 23:21:02 +00:00
|
|
|
pclsid = NULL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CPrinterFolder::~CPrinterFolder()
|
|
|
|
{
|
|
|
|
TRACE("-- destroying IShellFolder(%p)\n", this);
|
|
|
|
if (pidlRoot)
|
|
|
|
SHFree(pidlRoot);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::ParseDisplayName
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
* This is E_NOTIMPL in Windows too.
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CPrinterFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName,
|
2014-08-15 10:38:11 +00:00
|
|
|
DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
|
2011-12-17 22:53:44 +00:00
|
|
|
this, hwndOwner, pbc, lpszDisplayName, debugstr_w(lpszDisplayName),
|
|
|
|
pchEaten, ppidl, pdwAttributes);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
*ppidl = 0;
|
|
|
|
if (pchEaten)
|
|
|
|
*pchEaten = 0;
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PIDLPrinterStruct * _ILGetPrinterStruct(LPCITEMIDLIST pidl)
|
|
|
|
{
|
|
|
|
LPPIDLDATA pdata = _ILGetDataPointer(pidl);
|
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
if (pdata && pdata->type == 0x00)
|
|
|
|
return (PIDLPrinterStruct*) & (pdata->u.cfont);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::EnumObjects
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CPrinterFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
|
|
|
|
{
|
2017-04-14 20:03:46 +00:00
|
|
|
return ShellObjectCreatorInit<CPrintersEnum>(hwndOwner, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::BindToObject
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2015-08-17 11:28:20 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_Printers_fnBindToStorage
|
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n",
|
|
|
|
this, pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
|
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::CompareIDs
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2015-10-26 15:07:44 +00:00
|
|
|
return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::CreateViewObject
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CPrinterFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
|
|
|
|
{
|
2014-08-20 00:39:40 +00:00
|
|
|
CComPtr<IShellView> pShellView;
|
2011-05-15 15:55:49 +00:00
|
|
|
HRESULT hr = E_INVALIDARG;
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)->(hwnd=%p,%s,%p)\n", this,
|
|
|
|
hwndOwner, shdebugstr_guid (&riid), ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (!ppvOut)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
if (IsEqualIID(riid, IID_IDropTarget))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
WARN("IDropTarget not implemented\n");
|
2011-05-15 15:55:49 +00:00
|
|
|
hr = E_NOTIMPL;
|
|
|
|
}
|
2011-12-18 21:54:04 +00:00
|
|
|
else if(IsEqualIID(riid, IID_IContextMenu))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
WARN("IContextMenu not implemented\n");
|
2011-05-15 15:55:49 +00:00
|
|
|
hr = E_NOTIMPL;
|
|
|
|
}
|
2011-12-18 21:54:04 +00:00
|
|
|
else if(IsEqualIID(riid, IID_IShellView))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2017-07-05 21:36:20 +00:00
|
|
|
SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
|
|
|
|
hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::GetAttributesOf
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
static const DWORD dwPrintersAttributes =
|
|
|
|
SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_CANRENAME | SFGAO_CANDELETE;
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
|
|
|
|
FIXME ("(%p)->(cidl=%d apidl=%p mask=0x%08lx): stub\n",
|
|
|
|
this, cidl, apidl, *rgfInOut);
|
|
|
|
|
|
|
|
*rgfInOut &= dwPrintersAttributes;
|
|
|
|
|
|
|
|
*rgfInOut &= ~SFGAO_VALIDATE;
|
|
|
|
|
|
|
|
TRACE ("-- result=0x%08x\n", *rgfInOut);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::GetUIObjectOf
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
* PARAMETERS
|
|
|
|
* HWND hwndOwner, //[in ] Parent window for any output
|
|
|
|
* UINT cidl, //[in ] array size
|
|
|
|
* LPCITEMIDLIST* apidl, //[in ] simple pidl array
|
|
|
|
* REFIID riid, //[in ] Requested Interface
|
|
|
|
* UINT* prgfInOut, //[ ] reserved
|
|
|
|
* LPVOID* ppvObject) //[out] Resulting Interface
|
|
|
|
*
|
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl,
|
2011-12-17 22:53:44 +00:00
|
|
|
REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2016-04-30 15:30:59 +00:00
|
|
|
LPVOID pObj = NULL;
|
2011-05-15 15:55:49 +00:00
|
|
|
HRESULT hr = E_INVALIDARG;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
|
2011-12-17 22:53:44 +00:00
|
|
|
this, hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (!ppvOut)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID(riid, IID_IExtractIconW)) && cidl == 1)
|
2016-04-30 15:30:59 +00:00
|
|
|
hr = CPrintersExtractIconW_CreateInstane(apidl[0], riid, &pObj);
|
2011-05-15 15:55:49 +00:00
|
|
|
else
|
|
|
|
hr = E_NOINTERFACE;
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr) && !pObj)
|
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
*ppvOut = pObj;
|
|
|
|
TRACE ("(%p)->hr=0x%08lx\n", this, hr);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::GetDisplayNameOf
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
PIDLPrinterStruct * p;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", this, pidl, dwFlags, strRet);
|
|
|
|
pdump (pidl);
|
|
|
|
|
|
|
|
if (!strRet)
|
|
|
|
{
|
|
|
|
WARN("no strRet\n");
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
p = _ILGetPrinterStruct(pidl);
|
|
|
|
if (!p)
|
|
|
|
{
|
2016-11-05 19:55:29 +00:00
|
|
|
ERR("no printer struct\n");
|
2011-05-15 15:55:49 +00:00
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
2016-04-30 14:05:10 +00:00
|
|
|
return SHSetStrRet(strRet, p->szName);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::SetNameOf
|
2011-05-15 15:55:49 +00:00
|
|
|
* Changes the name of a file object or subfolder, possibly changing its item
|
|
|
|
* identifier in the process.
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
|
|
|
* HWND hwndOwner, //[in ] Owner window for output
|
|
|
|
* LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
|
|
|
|
* LPCOLESTR lpszName, //[in ] the items new display name
|
|
|
|
* DWORD dwFlags, //[in ] SHGNO formatting flags
|
|
|
|
* LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
|
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, /* simple pidl */
|
|
|
|
LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
FIXME("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", this, hwndOwner, pidl,
|
|
|
|
debugstr_w (lpName), dwFlags, pPidlOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CPrinterFolder::GetDefaultSearchGUID(GUID *pguid)
|
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
FIXME("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::EnumSearches(IEnumExtraSearch **ppenum)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
FIXME("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
if (pSort)
|
|
|
|
*pSort = 0;
|
|
|
|
if (pDisplay)
|
|
|
|
*pDisplay = 0;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
if (!pcsFlags || iColumn >= PrinterSHELLVIEWCOLUMNS)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
*pcsFlags = PrinterSFHeader[iColumn].pcsFlags;
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
FIXME("(%p): stub\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
TRACE("(%p)->(%p %i %p): stub\n", this, pidl, iColumn, psd);
|
|
|
|
|
|
|
|
if (iColumn >= PrinterSHELLVIEWCOLUMNS)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
psd->fmt = PrinterSFHeader[iColumn].fmt;
|
|
|
|
psd->cxChar = PrinterSFHeader[iColumn].cxChar;
|
|
|
|
if (pidl == NULL)
|
2016-04-30 14:05:10 +00:00
|
|
|
return SHSetStrRet(&psd->str, PrinterSFHeader[iColumn].colnameid);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (iColumn == COLUMN_NAME)
|
|
|
|
return GetDisplayNameOf(pidl, SHGDN_NORMAL, &psd->str);
|
|
|
|
|
|
|
|
psd->str.uType = STRRET_CSTR;
|
|
|
|
psd->str.cStr[0] = '\0';
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CPrinterFolder::MapColumnToSCID(UINT column, SHCOLUMNID *pscid)
|
|
|
|
{
|
|
|
|
FIXME ("(%p): stub\n", this);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::GetClassID
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
2011-12-18 21:54:04 +00:00
|
|
|
HRESULT WINAPI CPrinterFolder::GetClassID(CLSID *lpClassId)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
TRACE ("(%p)\n", this);
|
|
|
|
|
|
|
|
*lpClassId = CLSID_Printers;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::Initialize
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CPrinterFolder::Initialize(LPCITEMIDLIST pidl)
|
|
|
|
{
|
|
|
|
if (pidlRoot)
|
|
|
|
SHFree((LPVOID)pidlRoot);
|
|
|
|
|
|
|
|
pidlRoot = ILClone(pidl);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CPrinterFolder::GetCurFolder
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CPrinterFolder::GetCurFolder(LPITEMIDLIST * pidl)
|
|
|
|
{
|
|
|
|
TRACE ("(%p)->(%p)\n", this, pidl);
|
|
|
|
|
|
|
|
*pidl = ILClone (pidlRoot);
|
|
|
|
return S_OK;
|
|
|
|
}
|