[PATCH] Add stub shell folder for CLSID_Printers

Nikolay Sivov nsivov at codeweavers.com
Mon Apr 5 16:00:36 CDT 2010


---
 dlls/shell32/Makefile.in       |    1 +
 dlls/shell32/shell32_main.h    |    1 +
 dlls/shell32/shellole.c        |   24 ++--
 dlls/shell32/shfldr_printers.c |  337 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 351 insertions(+), 12 deletions(-)
 create mode 100644 dlls/shell32/shfldr_printers.c

diff --git a/dlls/shell32/Makefile.in b/dlls/shell32/Makefile.in
index e52d970..dbe312e 100644
--- a/dlls/shell32/Makefile.in
+++ b/dlls/shell32/Makefile.in
@@ -41,6 +41,7 @@ C_SRCS = \
 	shfldr_fs.c \
 	shfldr_mycomp.c \
 	shfldr_netplaces.c \
+	shfldr_printers.c \
 	shfldr_unixfs.c \
 	shlexec.c \
 	shlfileop.c \
diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h
index 16fb4a5..8f51850 100644
--- a/dlls/shell32/shell32_main.h
+++ b/dlls/shell32/shell32_main.h
@@ -89,6 +89,7 @@ HRESULT WINAPI IShellLink_ConstructFromFile(IUnknown * pUnkOuter, REFIID riid, L
 HRESULT WINAPI ISF_Desktop_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
 HRESULT WINAPI ISF_MyComputer_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
 HRESULT WINAPI ISF_NetworkPlaces_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
+HRESULT WINAPI Printers_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
 HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
 HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC *ppV);
 HRESULT WINAPI IControlPanel_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c
index dc4a3b3..10244fd 100644
--- a/dlls/shell32/shellole.c
+++ b/dlls/shell32/shellole.c
@@ -60,26 +60,26 @@ static const struct {
 	REFIID			riid;
 	LPFNCREATEINSTANCE	lpfnCI;
 } InterfaceTable[] = {
-	{&CLSID_ShellFSFolder,	IFSFolder_Constructor},
+
+	{&CLSID_AutoComplete,   IAutoComplete_Constructor},
+	{&CLSID_ControlPanel,	IControlPanel_Constructor},
+	{&CLSID_DragDropHelper, IDropTargetHelper_Constructor},
+	{&CLSID_FolderShortcut, FolderShortcut_Constructor},
 	{&CLSID_MyComputer,	ISF_MyComputer_Constructor},
+	{&CLSID_MyDocuments,    MyDocuments_Constructor},
 	{&CLSID_NetworkPlaces,  ISF_NetworkPlaces_Constructor},
+	{&CLSID_Printers,       Printers_Constructor},
+	{&CLSID_QueryAssociations, QueryAssociations_Constructor},
+	{&CLSID_RecycleBin,     RecycleBin_Constructor},
 	{&CLSID_ShellDesktop,	ISF_Desktop_Constructor},
+	{&CLSID_ShellFSFolder,	IFSFolder_Constructor},
 	{&CLSID_ShellItem,	IShellItem_Constructor},
 	{&CLSID_ShellLink,	IShellLink_Constructor},
-	{&CLSID_DragDropHelper, IDropTargetHelper_Constructor},
-	{&CLSID_ControlPanel,	IControlPanel_Constructor},
-	{&CLSID_AutoComplete,   IAutoComplete_Constructor},
-	{&CLSID_UnixFolder,     UnixFolder_Constructor},
 	{&CLSID_UnixDosFolder,  UnixDosFolder_Constructor},
-	{&CLSID_FolderShortcut, FolderShortcut_Constructor},
-	{&CLSID_MyDocuments,    MyDocuments_Constructor},
-	{&CLSID_RecycleBin,     RecycleBin_Constructor},
-	{&CLSID_QueryAssociations, QueryAssociations_Constructor},
-	{NULL,NULL}
+	{&CLSID_UnixFolder,     UnixFolder_Constructor},
+	{NULL, NULL}
 };
 
-
-
 /*************************************************************************
  * SHCoCreateInstance [SHELL32.102]
  *
diff --git a/dlls/shell32/shfldr_printers.c b/dlls/shell32/shfldr_printers.c
new file mode 100644
index 0000000..f5220f9
--- /dev/null
+++ b/dlls/shell32/shfldr_printers.c
@@ -0,0 +1,337 @@
+/*
+ *    Virtual Printers folder
+ *
+ *    Copyright 2010 Nikolay Sivov for CodeWeavers
+ *
+ * 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 St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
+#include "winerror.h"
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+
+#include "wingdi.h"
+#include "pidl.h"
+#include "shlguid.h"
+#include "enumidlist.h"
+#include "undocshell.h"
+#include "shell32_main.h"
+#include "shresdef.h"
+#include "shlwapi.h"
+#include "wine/debug.h"
+#include "debughlp.h"
+#include "shfldr.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL (shell);
+
+/***********************************************************************
+*   IShellFolder implementation
+*/
+
+typedef struct {
+    const IShellFolder2Vtbl   *lpVtbl;
+    LONG                ref;
+} IPrintersFolderImpl;
+
+static HRESULT WINAPI IShellFolder_Printers_fnQueryInterface(IShellFolder2 *iface,
+               REFIID riid, LPVOID *ppvObj)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+
+    TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
+
+    *ppvObj = NULL;
+
+    if (IsEqualIID (riid, &IID_IUnknown) ||
+        IsEqualIID (riid, &IID_IShellFolder) ||
+        IsEqualIID (riid, &IID_IShellFolder2))
+    {
+        *ppvObj = This;
+    }
+
+    if (*ppvObj)
+    {
+        IUnknown_AddRef ((IUnknown *) (*ppvObj));
+        TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
+        return S_OK;
+    }
+
+    ERR ("-- interface %s not supported\n", shdebugstr_guid (riid));
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI IShellFolder_Printers_fnAddRef (IShellFolder2 * iface)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    ULONG refCount = InterlockedIncrement(&This->ref);
+    TRACE ("(%p)->(count=%u)\n", This, refCount - 1);
+    return refCount;
+}
+
+static ULONG WINAPI IShellFolder_Printers_fnRelease (IShellFolder2 * iface)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    ULONG refCount = InterlockedDecrement(&This->ref);
+
+    TRACE ("(%p)->(count=%u)\n", This, refCount + 1);
+
+    if (!refCount)
+    {
+        TRACE ("-- destroying IShellFolder(%p)\n", This);
+        LocalFree (This);
+    }
+    return refCount;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnParseDisplayName (IShellFolder2 *iface,
+               HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName,
+               DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+
+    FIXME("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p) stub\n", This,
+          hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
+          pchEaten, ppidl, pdwAttributes);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnEnumObjects (IShellFolder2 *iface,
+               HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME("(%p)->(HWND=%p flags=0x%08x pplist=%p) stub\n", This,
+          hwndOwner, dwFlags, ppEnumIDList);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnBindToObject (IShellFolder2 *iface,
+               LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", This,
+          pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnBindToStorage (IShellFolder2 * iface,
+               LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+
+    FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", This,
+          pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
+
+    *ppvOut = NULL;
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnCompareIDs(IShellFolder2 *iface,
+               LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME("(%p)->(0x%08lx,pidl1=%p,pidl2=%p) stub\n", This, lParam, pidl1, pidl2);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnCreateViewObject(IShellFolder2 *iface,
+               HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+
+    FIXME("(%p)->(hwnd=%p,%s,%p) stub\n", This,
+          hwndOwner, shdebugstr_guid (riid), ppvOut);
+
+    if (!ppvOut)
+        return E_INVALIDARG;
+
+    *ppvOut = NULL;
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnGetAttributesOf (IShellFolder2 * iface,
+                UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x)) stub\n",
+           This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnGetUIObjectOf (IShellFolder2 * iface,
+                HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, REFIID riid,
+                UINT * prgfInOut, LPVOID * ppvOut)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+
+    FIXME("(%p)->(%p,%u,apidl=%p,%s,%p,%p) stub\n", This,
+          hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
+
+    if (!ppvOut)
+        return E_INVALIDARG;
+
+    *ppvOut = NULL;
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnGetDisplayNameOf (IShellFolder2 *iface,
+               LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+
+    FIXME("(%p)->(pidl=%p,0x%08x,%p) stub\n", This, pidl, dwFlags, strRet);
+
+    if (!strRet)
+        return E_INVALIDARG;
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnSetNameOf (
+               IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl,
+               LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p) stub\n", This,
+           hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
+    return E_FAIL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnGetDefaultSearchGUID (
+               IShellFolder2 * iface, GUID * pguid)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME ("(%p) stub\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnEnumSearches (
+               IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME ("(%p) stub\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnGetDefaultColumn (
+               IShellFolder2 *iface, DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME("(%p) stub\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnGetDefaultColumnState (
+               IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME("(%p) stub\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnGetDetailsEx (IShellFolder2 * iface,
+               LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME ("(%p) stub\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnGetDetailsOf (IShellFolder2 * iface,
+               LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME("(%p)->(%p %i %p) stub\n", This, pidl, iColumn, psd);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IShellFolder_Printers_fnMapColumnToSCID (
+               IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
+{
+    IPrintersFolderImpl *This = (IPrintersFolderImpl *)iface;
+    FIXME ("(%p)->(%u %p) stub\n", This, column, pscid);
+    return E_NOTIMPL;
+}
+
+static const IShellFolder2Vtbl vtbl_ShellFolder2 =
+{
+    /* IUnknown */
+    IShellFolder_Printers_fnQueryInterface,
+    IShellFolder_Printers_fnAddRef,
+    IShellFolder_Printers_fnRelease,
+    /* IShellFolder */
+    IShellFolder_Printers_fnParseDisplayName,
+    IShellFolder_Printers_fnEnumObjects,
+    IShellFolder_Printers_fnBindToObject,
+    IShellFolder_Printers_fnBindToStorage,
+    IShellFolder_Printers_fnCompareIDs,
+    IShellFolder_Printers_fnCreateViewObject,
+    IShellFolder_Printers_fnGetAttributesOf,
+    IShellFolder_Printers_fnGetUIObjectOf,
+    IShellFolder_Printers_fnGetDisplayNameOf,
+    IShellFolder_Printers_fnSetNameOf,
+    /* IShellFolder2 */
+    IShellFolder_Printers_fnGetDefaultSearchGUID,
+    IShellFolder_Printers_fnEnumSearches,
+    IShellFolder_Printers_fnGetDefaultColumn,
+    IShellFolder_Printers_fnGetDefaultColumnState,
+    IShellFolder_Printers_fnGetDetailsEx,
+    IShellFolder_Printers_fnGetDetailsOf,
+    IShellFolder_Printers_fnMapColumnToSCID
+};
+
+HRESULT WINAPI Printers_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
+{
+    IPrintersFolderImpl *sf;
+
+    TRACE("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
+
+    if (!ppv)
+        return E_POINTER;
+    if (pUnkOuter)
+        return CLASS_E_NOAGGREGATION;
+
+    sf = LocalAlloc(LMEM_FIXED, sizeof(IPrintersFolderImpl));
+    if (!sf)
+        return E_OUTOFMEMORY;
+
+    sf->ref = 0;
+    sf->lpVtbl = &vtbl_ShellFolder2;
+
+    if (IUnknown_QueryInterface((IShellFolder2 *)sf, riid, ppv) != S_OK)
+    {
+        IUnknown_Release((IShellFolder2 *) sf);
+        return E_NOINTERFACE;
+    }
+
+    TRACE("--(%p)\n", sf);
+    return S_OK;
+}
+
-- 
1.5.6.5


--=-osWkvCsVD4WsOIE8u5zZ--




More information about the wine-patches mailing list