Added patch to implement IApplicationAssociationRegistration::QueryCurrentDefault.

This commit is contained in:
Sebastian Lackner 2015-02-14 04:42:05 +01:00
parent 6a98a1f8aa
commit c3d4426edd
5 changed files with 262 additions and 1 deletions

View File

@ -38,7 +38,7 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
===================================
**Bugfixes and features included in the next upcoming release [8]:**
**Bugfixes and features included in the next upcoming release [9]:**
* Add stub for ntoskrnl.ExAcquireResourceExclusiveLite
* Add stub for ntoskrnl.ExDeleteResourceLite
@ -48,6 +48,7 @@ Included bug fixes and improvements
* Basic handling of write watches triggered while we're on the signal stack.
* Do not access stack below ESP when restoring thread context.
* Implement D3DXGetShaderOutputSemantics
* Implement IApplicationAssociationRegistration::QueryCurrentDefault. ([Wine Bug #34654](https://bugs.winehq.org/show_bug.cgi?id=34654))
**Bugs fixed in Wine Staging 1.7.36 [167]:**

1
debian/changelog vendored
View File

@ -10,6 +10,7 @@ wine-staging (1.7.37) UNRELEASED; urgency=low
* Added patch to add stub for ntoskrnl.ExReleaseResourceForThread.
* Added patch to add stub for ntoskrnl.ExDeleteResourceLite.
* Added patch to avoid accessing stack below ESP when restoring thread context.
* Added patch to implement IApplicationAssociationRegistration::QueryCurrentDefault.
* Removed patches for UTF7 support (accepted upstream).
* Removed patches for SIO_ADDRESS_LIST_CHANGE ioctl (accepted upstream).
-- Sebastian Lackner <sebastian@fds-team.de> Sun, 08 Feb 2015 20:29:38 +0100

View File

@ -159,6 +159,7 @@ patch_enable_all ()
enable_server_Unexpected_Wakeup="$1"
enable_setupapi_SetupPromptForDisk="$1"
enable_shdocvw_ParseURLFromOutsideSource_Tests="$1"
enable_shell32_ApplicationAssociationRegistration="$1"
enable_shell32_Default_Folder_ACLs="$1"
enable_shell32_Default_Path="$1"
enable_shell32_Icons="$1"
@ -505,6 +506,9 @@ patch_enable ()
shdocvw-ParseURLFromOutsideSource_Tests)
enable_shdocvw_ParseURLFromOutsideSource_Tests="$2"
;;
shell32-ApplicationAssociationRegistration)
enable_shell32_ApplicationAssociationRegistration="$2"
;;
shell32-Default_Folder_ACLs)
enable_shell32_Default_Folder_ACLs="$2"
;;
@ -2790,6 +2794,21 @@ if test "$enable_shdocvw_ParseURLFromOutsideSource_Tests" -eq 1; then
) >> "$patchlist"
fi
# Patchset shell32-ApplicationAssociationRegistration
# |
# | This patchset fixes the following Wine bugs:
# | * [#34654] Implement IApplicationAssociationRegistration::QueryCurrentDefault.
# |
# | Modified files:
# | * dlls/shell32/assoc.c, dlls/shell32/tests/assoc.c
# |
if test "$enable_shell32_ApplicationAssociationRegistration" -eq 1; then
patch_apply shell32-ApplicationAssociationRegistration/0001-shell32-Implement-IApplicationAssociationRegistratio.patch
(
echo '+ { "Alistair Leslie-Hughes", "shell32: Implement IApplicationAssociationRegistration QueryCurrentDefault.", 7 },';
) >> "$patchlist"
fi
# Patchset shell32-Default_Folder_ACLs
# |
# | Modified files:

View File

@ -0,0 +1,239 @@
From 417742abf41feab095fc2e642e535a16755237f4 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 13 Feb 2015 18:53:25 +1100
Subject: shell32: Implement IApplicationAssociationRegistration
QueryCurrentDefault (try 7)
Fixes: https://bugs.winehq.org/show_bug.cgi?id=34654
Changes by Sebastian Lackner <sebastian@fds-team.de>:
* Some coding style fixes
* Avoid using strlenW when we only check if a string is non-empty
* Fix leak when RegGetValueW fails
---
dlls/shell32/assoc.c | 100 +++++++++++++++++++++++++++++++++++++++++++--
dlls/shell32/tests/assoc.c | 66 +++++++++++++++++++++++-------
2 files changed, 149 insertions(+), 17 deletions(-)
diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c
index f3c8e65..e79eeae 100644
--- a/dlls/shell32/assoc.c
+++ b/dlls/shell32/assoc.c
@@ -873,11 +873,105 @@ static ULONG WINAPI ApplicationAssociationRegistration_Release(IApplicationAssoc
return ref;
}
-static HRESULT WINAPI ApplicationAssociationRegistration_QueryCurrentDefault(IApplicationAssociationRegistration* This, LPCWSTR query,
+static HRESULT WINAPI ApplicationAssociationRegistration_QueryCurrentDefault(IApplicationAssociationRegistration *iface, LPCWSTR query,
ASSOCIATIONTYPE type, ASSOCIATIONLEVEL level, LPWSTR *association)
{
- FIXME("(%p)->(%s, %d, %d, %p)\n", This, debugstr_w(query), type, level, association);
- return E_NOTIMPL;
+ IApplicationAssociationRegistrationImpl *This = impl_from_IApplicationAssociationRegistration(iface);
+ static WCHAR urlassoc[] = {'U','r','l','A','s','s','o','c','i','a','t','i','o','n','s',0};
+ static WCHAR mimeassoc[] = {'M','I','M','E','A','s','s','o','c','i','a','t','i','o','n','s',0};
+ static WCHAR assocations[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
+ 'W','i','n','d','o','w','s','\\','S','h','e','l','l','\\',
+ 'A','s','s','o','c','i','a','t','i','o','n','s',0};
+ static WCHAR slash[] = {'\\',0};
+ static WCHAR choice[] = {'U','s','e','r','C','h','o','i','c','e',0};
+ static WCHAR propid[] = {'P','r','o','g','i','d',0};
+ WCHAR path[MAX_PATH] = {0};
+ DWORD ret, keytype, size;
+ HKEY hkey = NULL;
+ HRESULT hr = HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION);
+
+ TRACE("(%p)->(%s, %d, %d, %p)\n", This, debugstr_w(query), type, level, association);
+
+ if (!query || !association)
+ return E_INVALIDARG;
+
+ *association = NULL;
+
+ if (type == AT_FILEEXTENSION)
+ {
+ if (query[0] != '.')
+ return E_INVALIDARG;
+
+ ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, query, 0, KEY_READ, &hkey);
+ if (ret == ERROR_SUCCESS)
+ {
+ ret = RegGetValueW(hkey, NULL, NULL, RRF_RT_REG_SZ, &keytype, NULL, &size);
+ if (ret == ERROR_SUCCESS)
+ {
+ *association = CoTaskMemAlloc(size);
+ if (*association)
+ {
+ ret = RegGetValueW(hkey, NULL, NULL, RRF_RT_REG_SZ, &keytype, *association, &size);
+ if (ret == ERROR_SUCCESS)
+ hr = S_OK;
+ else
+ {
+ CoTaskMemFree(*association);
+ *association = NULL;
+ }
+ }
+ else
+ hr = E_OUTOFMEMORY;
+ }
+ }
+ }
+ else
+ {
+ if (type == AT_URLPROTOCOL && !query[0])
+ return E_INVALIDARG;
+
+ ret = RegOpenKeyExW(HKEY_CURRENT_USER, assocations, 0, KEY_READ, &hkey);
+ if (ret == ERROR_SUCCESS)
+ {
+ if (type == AT_URLPROTOCOL)
+ lstrcpyW(path, urlassoc);
+ else if (type == AT_MIMETYPE)
+ lstrcpyW(path, mimeassoc);
+ else
+ {
+ WARN("Unsupported type (%d).\n", type);
+ RegCloseKey(hkey);
+ return hr;
+ }
+
+ lstrcatW(path, slash);
+ lstrcatW(path, query);
+ lstrcatW(path, slash);
+ lstrcatW(path, choice);
+
+ ret = RegGetValueW(hkey, path, propid, RRF_RT_REG_SZ, &keytype, NULL, &size);
+ if (ret == ERROR_SUCCESS)
+ {
+ *association = CoTaskMemAlloc(size);
+ if (*association)
+ {
+ ret = RegGetValueW(hkey, path, propid, RRF_RT_REG_SZ, &keytype, *association, &size);
+ if (ret == ERROR_SUCCESS)
+ hr = S_OK;
+ else
+ {
+ CoTaskMemFree(*association);
+ *association = NULL;
+ }
+ }
+ else
+ hr = E_OUTOFMEMORY;
+ }
+ }
+ }
+
+ RegCloseKey(hkey);
+ return hr;
}
static HRESULT WINAPI ApplicationAssociationRegistration_QueryAppIsDefault(IApplicationAssociationRegistration* This, LPCWSTR query,
diff --git a/dlls/shell32/tests/assoc.c b/dlls/shell32/tests/assoc.c
index f35938b..0092081 100644
--- a/dlls/shell32/tests/assoc.c
+++ b/dlls/shell32/tests/assoc.c
@@ -57,22 +57,12 @@ static void test_IQueryAssociations_QueryInterface(void)
}
-static void test_IApplicationAssociationRegistration_QueryInterface(void)
+static void test_IApplicationAssociationRegistration_QueryInterface(IApplicationAssociationRegistration *appreg)
{
- IApplicationAssociationRegistration *appreg;
IApplicationAssociationRegistration *appreg2;
IUnknown *unk;
HRESULT hr;
- /* this works since Vista */
- hr = CoCreateInstance(&CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC_SERVER,
- &IID_IApplicationAssociationRegistration, (LPVOID*)&appreg);
-
- if (FAILED(hr)) {
- skip("IApplicationAssociationRegistration not created: 0x%x\n", hr);
- return;
- }
-
hr = IApplicationAssociationRegistration_QueryInterface(appreg, &IID_IApplicationAssociationRegistration,
(void**)&appreg2);
ok(hr == S_OK, "QueryInterface (IApplicationAssociationRegistration) returned 0x%x\n", hr);
@@ -88,8 +78,6 @@ static void test_IApplicationAssociationRegistration_QueryInterface(void)
hr = IApplicationAssociationRegistration_QueryInterface(appreg, &IID_IUnknown, NULL);
ok(hr == E_POINTER, "got 0x%x (expected E_POINTER)\n", hr);
-
- IApplicationAssociationRegistration_Release(appreg);
}
struct assoc_getstring_test
@@ -189,9 +177,48 @@ static void test_IQueryAssociations_Init(void)
IQueryAssociations_Release(assoc);
}
+static void test_IApplicationAssociationRegistration_QueryCurrentDefault(IApplicationAssociationRegistration *appreg)
+{
+ static const WCHAR emptyW[] = {0};
+ static const WCHAR txtW[] = {'.','t','x','t',0};
+ static const WCHAR spacetxtW[] = {' ','.','t','x','t',0};
+ HRESULT hr;
+ LPWSTR assocprog = NULL;
+
+ hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, emptyW, AT_URLPROTOCOL, AL_EFFECTIVE, &assocprog);
+ ok(hr == E_INVALIDARG, "got 0x%x\n", hr);
+
+ hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, emptyW, AT_FILEEXTENSION, AL_EFFECTIVE, &assocprog);
+ ok(hr == E_INVALIDARG, "got 0x%x\n", hr);
+
+ hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, spacetxtW, AT_FILEEXTENSION, AL_EFFECTIVE, &assocprog);
+ ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win8 */, "got 0x%x\n", hr);
+
+ hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, httpW, AT_URLPROTOCOL, AL_EFFECTIVE, NULL);
+ ok(hr == E_INVALIDARG, "got 0x%x\n", hr);
+
+ /* AT_FILEEXTENSION must start with a period */
+ hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, txtW, AT_FILEEXTENSION, AL_EFFECTIVE, &assocprog);
+ ok(hr == S_OK, "got 0x%x\n", hr);
+ trace("%s\n", wine_dbgstr_w(assocprog));
+ CoTaskMemFree(assocprog);
+
+ hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, emptyW, AT_STARTMENUCLIENT, AL_EFFECTIVE, &assocprog);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), "got 0x%x\n", hr);
+
+ hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, emptyW, AT_MIMETYPE, AL_EFFECTIVE, &assocprog);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), "got 0x%x\n", hr);
+
+ hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, httpW, AT_URLPROTOCOL, AL_EFFECTIVE, &assocprog);
+ todo_wine ok(hr == S_OK, "got 0x%x\n", hr);
+ trace("%s\n", wine_dbgstr_w(assocprog));
+ CoTaskMemFree(assocprog);
+}
+
START_TEST(assoc)
{
IQueryAssociations *qa;
+ IApplicationAssociationRegistration *appreg;
HRESULT hr;
CoInitialize(NULL);
@@ -209,7 +236,18 @@ START_TEST(assoc)
else
win_skip("IQueryAssociations not supported, 0x%x\n", hr);
- test_IApplicationAssociationRegistration_QueryInterface();
+ /* this works since Vista */
+ hr = CoCreateInstance(&CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IApplicationAssociationRegistration, (LPVOID *)&appreg);
+ if (hr == S_OK)
+ {
+ test_IApplicationAssociationRegistration_QueryInterface(appreg);
+ test_IApplicationAssociationRegistration_QueryCurrentDefault(appreg);
+
+ IApplicationAssociationRegistration_Release(appreg);
+ }
+ else
+ win_skip("IApplicationAssociationRegistration not supported: 0x%x\n", hr);
CoUninitialize();
}
--
2.3.0

View File

@ -0,0 +1 @@
Fixes: [34654] Implement IApplicationAssociationRegistration::QueryCurrentDefault.