shell32(1/6): Add IQueryAssociations stub implementation

Juan Lang juan.lang at gmail.com
Wed Aug 26 17:00:44 CDT 2009


This little patch series partially implement IQueryAssociations.  I
notice a bunch of terminal spam like:
fixme:shell:DllGetClassObject failed for
CLSID={a07034fd-6caa-4954-ac3f-97a27216f98a} (Query file associations)
mainly when running native shlwapi.

This sometimes throws users off.  So, I decided to shut it up a little.
--Juan
-------------- next part --------------
From 63f516f79ca3b60dd060096ec880c16c0cc367bd Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Wed, 26 Aug 2009 10:30:37 -0700
Subject: [PATCH 3/8] Add IQueryAssociations stub implementation

---
 dlls/shell32/Makefile.in    |    1 +
 dlls/shell32/assoc.c        |  152 +++++++++++++++++++++++++++++++++++++++++++
 dlls/shell32/shell32_main.h |    1 +
 dlls/shell32/shellole.c     |    1 +
 4 files changed, 155 insertions(+), 0 deletions(-)
 create mode 100644 dlls/shell32/assoc.c

diff --git a/dlls/shell32/Makefile.in b/dlls/shell32/Makefile.in
index 744c8dd..628c48a 100644
--- a/dlls/shell32/Makefile.in
+++ b/dlls/shell32/Makefile.in
@@ -10,6 +10,7 @@ DELAYIMPORTS = ole32 oleaut32 shdocvw
 
 C_SRCS = \
 	appbar.c \
+	assoc.c \
 	autocomplete.c \
 	brsfolder.c \
 	changenotify.c \
diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c
new file mode 100644
index 0000000..5ebc78f
--- /dev/null
+++ b/dlls/shell32/assoc.c
@@ -0,0 +1,152 @@
+/*
+ *    IQueryAssociations implementation
+ *
+ *    Copyright 2009 Juan Lang
+ *
+ * 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 <stdarg.h>
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "shlguid.h"
+#include "shlobj.h"
+#include "shlwapi.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(shell);
+
+typedef struct {
+    const IQueryAssociationsVtbl *lpVtbl;
+    LONG                          ref;
+} QueryAssociationsImpl;
+
+static HRESULT WINAPI IQueryAssociations_fnQueryInterface(
+        IQueryAssociations *iface, REFIID riid, LPVOID *ppvObj)
+{
+    QueryAssociationsImpl *This = (QueryAssociationsImpl *)iface;
+
+    TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppvObj);
+
+    *ppvObj = NULL;
+
+    if (IsEqualIID (riid, &IID_IUnknown) ||
+        IsEqualIID (riid, &IID_IQueryAssociations))
+        *ppvObj = This;
+
+    if (*ppvObj)
+    {
+        IUnknown_AddRef ((IUnknown *) (*ppvObj));
+        TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
+        return S_OK;
+    }
+    TRACE ("-- Interface: E_NOINTERFACE\n");
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI IQueryAssociations_fnAddRef (IQueryAssociations *iface)
+{
+    QueryAssociationsImpl *This = (QueryAssociationsImpl *)iface;
+    ULONG refCount = InterlockedIncrement(&This->ref);
+
+    return refCount;
+}
+
+static ULONG WINAPI IQueryAssociations_fnRelease (IQueryAssociations *iface)
+{
+    QueryAssociationsImpl *This = (QueryAssociationsImpl *)iface;
+    ULONG refCount = InterlockedDecrement(&This->ref);
+
+    if (!refCount)
+        SHFree(This);
+    return refCount;
+}
+
+static HRESULT WINAPI IQueryAssociations_fnInit(IQueryAssociations *iface,
+        ASSOCF flags, LPCWSTR pszAssoc, HKEY hkProgid, HWND hwnd)
+{
+    FIXME("(%p, %08x, %s, %p, %p): stub\n", iface, flags,
+            debugstr_w(pszAssoc), hkProgid, hwnd);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IQueryAssociations_fnGetString(IQueryAssociations *iface,
+        ASSOCF flags, ASSOCSTR str, LPCWSTR pszExtra, LPWSTR pszOut,
+        DWORD *pcchOut)
+{
+    FIXME("(%p, %08x, %d, %s, %p, %p): stub\n", iface, flags, str,
+            debugstr_w(pszExtra), pszOut, pcchOut);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IQueryAssociations_fnGetKey(IQueryAssociations *iface,
+        ASSOCF flags, ASSOCKEY key, LPCWSTR pszExtra, HKEY *phkeyOut)
+{
+    FIXME("(%p, %08x, %d, %s, %p): stub\n", iface, flags, key,
+            debugstr_w(pszExtra), phkeyOut);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IQueryAssociations_fnGetData(IQueryAssociations *iface,
+        ASSOCF flags, ASSOCDATA data, LPCWSTR pszExtra, LPVOID pvOut,
+        DWORD *pcbOut)
+{
+    FIXME("(%p, %08x, %d, %s, %p, %p): stub\n", iface, flags, data,
+            debugstr_w(pszExtra), pvOut, pcbOut);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IQueryAssociations_fnGetEnum(IQueryAssociations *iface,
+        ASSOCF flags, ASSOCENUM assocenum, LPCWSTR pszExtra, REFIID riid,
+        LPVOID *ppvOut)
+{
+    /* According to MSDN, this isn't implemented */
+    FIXME("(%p, %08x, %d, %s, %s, %p): stub\n", iface, flags, assocenum,
+            debugstr_w(pszExtra), debugstr_guid(riid), ppvOut);
+    return E_NOTIMPL;
+}
+
+
+static const IQueryAssociationsVtbl queryAssociationsVtbl =
+{
+    IQueryAssociations_fnQueryInterface,
+    IQueryAssociations_fnAddRef,
+    IQueryAssociations_fnRelease,
+    IQueryAssociations_fnInit,
+    IQueryAssociations_fnGetString,
+    IQueryAssociations_fnGetKey,
+    IQueryAssociations_fnGetData,
+    IQueryAssociations_fnGetEnum,
+};
+
+HRESULT WINAPI QueryAssociations_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppOutput)
+{
+    QueryAssociationsImpl *obj;
+    HRESULT ret;
+    if (pUnkOuter)
+        return CLASS_E_NOAGGREGATION;
+
+    obj = SHAlloc(sizeof(QueryAssociationsImpl));
+    if (obj == NULL)
+        return E_OUTOFMEMORY;
+    obj->lpVtbl = &queryAssociationsVtbl;
+    obj->ref = 1;
+    if (FAILED(ret = IUnknown_QueryInterface((IUnknown *)obj, riid, ppOutput)))
+        return ret;
+    return S_OK;
+}
diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h
index 86652a1..12d50e2 100644
--- a/dlls/shell32/shell32_main.h
+++ b/dlls/shell32/shell32_main.h
@@ -97,6 +97,7 @@ HRESULT WINAPI UnixDosFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVO
 HRESULT WINAPI FolderShortcut_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
 HRESULT WINAPI MyDocuments_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
 HRESULT WINAPI RecycleBin_Constructor(IUnknown * pUnkOuter, REFIID riif, LPVOID *ppv);
+HRESULT WINAPI QueryAssociations_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppOutput);
 extern HRESULT CPanel_GetIconLocationW(LPCITEMIDLIST, LPWSTR, UINT, int*);
 HRESULT WINAPI CPanel_ExtractIconA(LPITEMIDLIST pidl, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
 HRESULT WINAPI CPanel_ExtractIconW(LPITEMIDLIST pidl, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c
index 9e63c1e..4bb7ee4 100644
--- a/dlls/shell32/shellole.c
+++ b/dlls/shell32/shellole.c
@@ -74,6 +74,7 @@ static const struct {
 	{&CLSID_FolderShortcut, FolderShortcut_Constructor},
 	{&CLSID_MyDocuments,    MyDocuments_Constructor},
 	{&CLSID_RecycleBin,     RecycleBin_Constructor},
+	{&CLSID_QueryAssociations, QueryAssociations_Constructor},
 	{NULL,NULL}
 };
 
-- 
1.6.3.2


More information about the wine-patches mailing list