2 * Virtual Printers folder
4 * Copyright 2010 Nikolay Sivov for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
31 #include "shell32_main.h"
32 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL (shell
);
38 const IShellFolder2Vtbl
*lpVtbl
;
39 const IPersistFolder2Vtbl
*lpvtblPersistFolder2
;
41 } IPrintersFolderImpl
;
43 static inline IPrintersFolderImpl
*impl_from_IPersistFolder2(IPersistFolder2
*iface
)
45 return (IPrintersFolderImpl
*)((char*)iface
- FIELD_OFFSET(IPrintersFolderImpl
, lpvtblPersistFolder2
));
48 static HRESULT WINAPI
IShellFolder_Printers_fnQueryInterface(IShellFolder2
*iface
,
49 REFIID riid
, LPVOID
*ppvObj
)
51 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
53 TRACE ("(%p)->(%s,%p)\n", This
, shdebugstr_guid (riid
), ppvObj
);
57 if (IsEqualIID (riid
, &IID_IUnknown
) ||
58 IsEqualIID (riid
, &IID_IShellFolder
) ||
59 IsEqualIID (riid
, &IID_IShellFolder2
))
63 else if (IsEqualIID (riid
, &IID_IPersist
) ||
64 IsEqualIID (riid
, &IID_IPersistFolder
) ||
65 IsEqualIID (riid
, &IID_IPersistFolder2
))
67 *ppvObj
= &This
->lpvtblPersistFolder2
;
72 IUnknown_AddRef ((IUnknown
*) (*ppvObj
));
73 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj
, *ppvObj
);
77 ERR ("-- interface %s not supported\n", shdebugstr_guid (riid
));
81 static ULONG WINAPI
IShellFolder_Printers_fnAddRef (IShellFolder2
* iface
)
83 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
84 ULONG refCount
= InterlockedIncrement(&This
->ref
);
85 TRACE ("(%p)->(count=%u)\n", This
, refCount
- 1);
89 static ULONG WINAPI
IShellFolder_Printers_fnRelease (IShellFolder2
* iface
)
91 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
92 ULONG refCount
= InterlockedDecrement(&This
->ref
);
94 TRACE ("(%p)->(count=%u)\n", This
, refCount
+ 1);
98 TRACE ("-- destroying IShellFolder(%p)\n", This
);
104 static HRESULT WINAPI
IShellFolder_Printers_fnParseDisplayName (IShellFolder2
*iface
,
105 HWND hwndOwner
, LPBC pbc
, LPOLESTR lpszDisplayName
,
106 DWORD
* pchEaten
, LPITEMIDLIST
* ppidl
, DWORD
* pdwAttributes
)
108 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
110 FIXME("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p) stub\n", This
,
111 hwndOwner
, pbc
, lpszDisplayName
, debugstr_w (lpszDisplayName
),
112 pchEaten
, ppidl
, pdwAttributes
);
117 static HRESULT WINAPI
IShellFolder_Printers_fnEnumObjects (IShellFolder2
*iface
,
118 HWND hwndOwner
, DWORD dwFlags
, LPENUMIDLIST
*ppEnumIDList
)
120 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
121 FIXME("(%p)->(HWND=%p flags=0x%08x pplist=%p) stub\n", This
,
122 hwndOwner
, dwFlags
, ppEnumIDList
);
126 static HRESULT WINAPI
IShellFolder_Printers_fnBindToObject (IShellFolder2
*iface
,
127 LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
129 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
130 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", This
,
131 pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
135 static HRESULT WINAPI
IShellFolder_Printers_fnBindToStorage (IShellFolder2
* iface
,
136 LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
138 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
140 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", This
,
141 pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
147 static HRESULT WINAPI
IShellFolder_Printers_fnCompareIDs(IShellFolder2
*iface
,
148 LPARAM lParam
, LPCITEMIDLIST pidl1
, LPCITEMIDLIST pidl2
)
150 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
151 FIXME("(%p)->(0x%08lx,pidl1=%p,pidl2=%p) stub\n", This
, lParam
, pidl1
, pidl2
);
155 static HRESULT WINAPI
IShellFolder_Printers_fnCreateViewObject(IShellFolder2
*iface
,
156 HWND hwndOwner
, REFIID riid
, LPVOID
*ppvOut
)
158 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
159 HRESULT hr
= E_NOTIMPL
;
161 TRACE("(%p)->(hwnd=%p,%s,%p)\n", This
,
162 hwndOwner
, shdebugstr_guid (riid
), ppvOut
);
169 if (IsEqualIID (riid
, &IID_IShellView
))
171 IShellView
*pShellView
= IShellView_Constructor ((IShellFolder
*) iface
);
174 hr
= IShellView_QueryInterface (pShellView
, riid
, ppvOut
);
175 IShellView_Release (pShellView
);
179 WARN("unsupported interface %s\n", shdebugstr_guid (riid
));
184 static HRESULT WINAPI
IShellFolder_Printers_fnGetAttributesOf (IShellFolder2
* iface
,
185 UINT cidl
, LPCITEMIDLIST
* apidl
, DWORD
* rgfInOut
)
187 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
188 FIXME("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x)) stub\n",
189 This
, cidl
, apidl
, rgfInOut
, rgfInOut
? *rgfInOut
: 0);
193 static HRESULT WINAPI
IShellFolder_Printers_fnGetUIObjectOf (IShellFolder2
* iface
,
194 HWND hwndOwner
, UINT cidl
, LPCITEMIDLIST
* apidl
, REFIID riid
,
195 UINT
* prgfInOut
, LPVOID
* ppvOut
)
197 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
199 FIXME("(%p)->(%p,%u,apidl=%p,%s,%p,%p) stub\n", This
,
200 hwndOwner
, cidl
, apidl
, shdebugstr_guid (riid
), prgfInOut
, ppvOut
);
210 static HRESULT WINAPI
IShellFolder_Printers_fnGetDisplayNameOf (IShellFolder2
*iface
,
211 LPCITEMIDLIST pidl
, DWORD dwFlags
, LPSTRRET strRet
)
213 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
215 FIXME("(%p)->(pidl=%p,0x%08x,%p) stub\n", This
, pidl
, dwFlags
, strRet
);
223 static HRESULT WINAPI
IShellFolder_Printers_fnSetNameOf (
224 IShellFolder2
* iface
, HWND hwndOwner
, LPCITEMIDLIST pidl
,
225 LPCOLESTR lpName
, DWORD dwFlags
, LPITEMIDLIST
* pPidlOut
)
227 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
228 FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p) stub\n", This
,
229 hwndOwner
, pidl
, debugstr_w (lpName
), dwFlags
, pPidlOut
);
233 static HRESULT WINAPI
IShellFolder_Printers_fnGetDefaultSearchGUID (
234 IShellFolder2
* iface
, GUID
* pguid
)
236 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
237 FIXME ("(%p) stub\n", This
);
241 static HRESULT WINAPI
IShellFolder_Printers_fnEnumSearches (
242 IShellFolder2
* iface
, IEnumExtraSearch
** ppenum
)
244 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
245 FIXME ("(%p) stub\n", This
);
249 static HRESULT WINAPI
IShellFolder_Printers_fnGetDefaultColumn (
250 IShellFolder2
*iface
, DWORD dwRes
, ULONG
*pSort
, ULONG
*pDisplay
)
252 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
253 FIXME("(%p) stub\n", This
);
257 static HRESULT WINAPI
IShellFolder_Printers_fnGetDefaultColumnState (
258 IShellFolder2
* iface
, UINT iColumn
, DWORD
* pcsFlags
)
260 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
261 FIXME("(%p) stub\n", This
);
265 static HRESULT WINAPI
IShellFolder_Printers_fnGetDetailsEx (IShellFolder2
* iface
,
266 LPCITEMIDLIST pidl
, const SHCOLUMNID
* pscid
, VARIANT
* pv
)
268 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
269 FIXME ("(%p) stub\n", This
);
273 static HRESULT WINAPI
IShellFolder_Printers_fnGetDetailsOf (IShellFolder2
* iface
,
274 LPCITEMIDLIST pidl
, UINT iColumn
, SHELLDETAILS
* psd
)
276 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
277 FIXME("(%p)->(%p %i %p) stub\n", This
, pidl
, iColumn
, psd
);
281 static HRESULT WINAPI
IShellFolder_Printers_fnMapColumnToSCID (
282 IShellFolder2
* iface
, UINT column
, SHCOLUMNID
* pscid
)
284 IPrintersFolderImpl
*This
= (IPrintersFolderImpl
*)iface
;
285 FIXME ("(%p)->(%u %p) stub\n", This
, column
, pscid
);
289 static const IShellFolder2Vtbl vtbl_ShellFolder2
=
292 IShellFolder_Printers_fnQueryInterface
,
293 IShellFolder_Printers_fnAddRef
,
294 IShellFolder_Printers_fnRelease
,
296 IShellFolder_Printers_fnParseDisplayName
,
297 IShellFolder_Printers_fnEnumObjects
,
298 IShellFolder_Printers_fnBindToObject
,
299 IShellFolder_Printers_fnBindToStorage
,
300 IShellFolder_Printers_fnCompareIDs
,
301 IShellFolder_Printers_fnCreateViewObject
,
302 IShellFolder_Printers_fnGetAttributesOf
,
303 IShellFolder_Printers_fnGetUIObjectOf
,
304 IShellFolder_Printers_fnGetDisplayNameOf
,
305 IShellFolder_Printers_fnSetNameOf
,
307 IShellFolder_Printers_fnGetDefaultSearchGUID
,
308 IShellFolder_Printers_fnEnumSearches
,
309 IShellFolder_Printers_fnGetDefaultColumn
,
310 IShellFolder_Printers_fnGetDefaultColumnState
,
311 IShellFolder_Printers_fnGetDetailsEx
,
312 IShellFolder_Printers_fnGetDetailsOf
,
313 IShellFolder_Printers_fnMapColumnToSCID
316 /*** IPersistFolder2 ***/
317 static HRESULT WINAPI
IPersistFolder2_Printers_fnQueryInterface(IPersistFolder2
* iface
,
318 REFIID iid
, LPVOID
* ppvObj
)
320 IPrintersFolderImpl
*This
= impl_from_IPersistFolder2(iface
);
321 return IUnknown_QueryInterface( (IUnknown
*) This
, iid
, ppvObj
);
324 static ULONG WINAPI
IPersistFolder2_Printers_fnAddRef(IPersistFolder2
*iface
)
326 IPrintersFolderImpl
*This
= impl_from_IPersistFolder2(iface
);
327 return IUnknown_AddRef( (IUnknown
*) This
);
330 static ULONG WINAPI
IPersistFolder2_Printers_fnRelease(IPersistFolder2
*iface
)
332 IPrintersFolderImpl
*This
= impl_from_IPersistFolder2(iface
);
333 return IUnknown_Release( (IUnknown
*) This
);
336 static HRESULT WINAPI
IPersistFolder2_Printers_fnGetClassID(IPersistFolder2
*iface
, CLSID
*classId
)
338 IPrintersFolderImpl
*This
= impl_from_IPersistFolder2(iface
);
340 FIXME("(%p) stub\n", This
);
348 static HRESULT WINAPI
IPersistFolder2_Printers_fnInitialize(IPersistFolder2
*iface
, LPCITEMIDLIST pidl
)
350 IPrintersFolderImpl
*This
= impl_from_IPersistFolder2(iface
);
351 FIXME("(%p) stub\n", This
);
355 static HRESULT WINAPI
IPersistFolder2_Printers_fnGetCurFolder(IPersistFolder2
*iface
, LPITEMIDLIST
*pidl
)
357 IPrintersFolderImpl
*This
= impl_from_IPersistFolder2(iface
);
358 FIXME("(%p) stub\n", This
);
362 static const IPersistFolder2Vtbl vtbl_PersistFolder2
=
364 IPersistFolder2_Printers_fnQueryInterface
,
365 IPersistFolder2_Printers_fnAddRef
,
366 IPersistFolder2_Printers_fnRelease
,
367 IPersistFolder2_Printers_fnGetClassID
,
368 IPersistFolder2_Printers_fnInitialize
,
369 IPersistFolder2_Printers_fnGetCurFolder
372 HRESULT WINAPI
Printers_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
)
374 IPrintersFolderImpl
*sf
;
376 TRACE("unkOut=%p %s\n", pUnkOuter
, shdebugstr_guid (riid
));
381 return CLASS_E_NOAGGREGATION
;
383 sf
= LocalAlloc(LMEM_FIXED
, sizeof(IPrintersFolderImpl
));
385 return E_OUTOFMEMORY
;
388 sf
->lpVtbl
= &vtbl_ShellFolder2
;
389 sf
->lpvtblPersistFolder2
= &vtbl_PersistFolder2
;
391 if (IUnknown_QueryInterface((IShellFolder2
*)sf
, riid
, ppv
) != S_OK
)
393 IUnknown_Release((IShellFolder2
*) sf
);
394 return E_NOINTERFACE
;
397 TRACE("--(%p)\n", sf
);