shell32(3/6): Implement IQueryAssociations::GetString for ASSOCF_COMMAND

Juan Lang juan.lang at gmail.com
Wed Aug 26 17:01:20 CDT 2009


--Juan
-------------- next part --------------
From 7ca1fa1cde6330de32bf97d07ff1cd3b970f43ce Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Wed, 26 Aug 2009 14:29:06 -0700
Subject: [PATCH 5/8] Implement IQueryAssociations::GetString for ASSOCF_COMMAND

---
 dlls/shell32/assoc.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c
index 66cac55..630d7da 100644
--- a/dlls/shell32/assoc.c
+++ b/dlls/shell32/assoc.c
@@ -193,13 +193,65 @@ static HRESULT WINAPI IQueryAssociations_fnInit(IQueryAssociations *iface,
     return hr;
 }
 
+static HRESULT QueryAssociations_GetCommand(QueryAssociationsImpl *This,
+        ASSOCF flags, LPCWSTR cmd, LPWSTR pszOut, DWORD *pcchOut)
+{
+    static const WCHAR cmdFmt[] = { 'S','h','e','l','l','\\','%','s','\\',
+        'C','o','m','m','a','n','d',0 };
+    WCHAR temp[MAX_PATH];
+    LONG l;
+    HRESULT hr;
+    DWORD size = *pcchOut * sizeof(WCHAR);
+
+    sprintfW(temp, cmdFmt, cmd);
+    l = RegGetValueW(This->key, temp, NULL, RRF_RT_REG_SZ, NULL, NULL, &size);
+    if (!l)
+    {
+        if (!pszOut)
+        {
+            *pcchOut = size / sizeof(WCHAR);
+            hr = S_FALSE;
+        }
+        else if (flags & ASSOCF_NOTRUNCATE)
+        {
+            *pcchOut = size / sizeof(WCHAR);
+            hr = E_POINTER;
+        }
+        else
+        {
+            l = RegGetValueW(This->key, temp, NULL, RRF_RT_REG_SZ, NULL,
+                    pszOut, pcchOut);
+            hr = HRESULT_FROM_WIN32(l);
+        }
+    }
+    else
+        hr = HRESULT_FROM_WIN32(l);
+    return hr;
+}
+
 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,
+    QueryAssociationsImpl *This = (QueryAssociationsImpl *)iface;
+    HRESULT hr;
+
+    TRACE("(%p, %08x, %d, %s, %p, %p)\n", iface, flags, str,
             debugstr_w(pszExtra), pszOut, pcchOut);
-    return E_NOTIMPL;
+
+    if (flags)
+        WARN("unimplemented flags %08x\n", flags);
+    switch (str)
+    {
+    case ASSOCSTR_COMMAND:
+        hr = QueryAssociations_GetCommand(This, flags, pszExtra, pszOut,
+                pcchOut);
+        break;
+    default:
+        FIXME("unimplemented for %d, %s\n", str, debugstr_w(pszExtra));
+        hr = E_NOTIMPL;
+    }
+    return hr;
 }
 
 static HRESULT WINAPI IQueryAssociations_fnGetKey(IQueryAssociations *iface,
-- 
1.6.3.2


More information about the wine-patches mailing list