2012-01-16 00:06:13 +01:00
|
|
|
/* Unit test suite for various shell Association objects
|
|
|
|
*
|
|
|
|
* Copyright 2012 Detlef Riekenberg
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "shlwapi.h"
|
|
|
|
#include "shlguid.h"
|
2012-01-16 00:06:16 +01:00
|
|
|
#include "shobjidl.h"
|
2012-01-16 00:06:13 +01:00
|
|
|
|
2018-02-20 07:38:00 +01:00
|
|
|
#include "wine/heap.h"
|
2012-01-16 00:06:13 +01:00
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
|
|
|
|
static void test_IQueryAssociations_QueryInterface(void)
|
|
|
|
{
|
|
|
|
IQueryAssociations *qa;
|
|
|
|
IQueryAssociations *qa2;
|
|
|
|
IUnknown *unk;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&qa);
|
2013-09-09 09:21:03 +02:00
|
|
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
2012-01-16 00:06:13 +01:00
|
|
|
|
2012-08-24 11:17:20 +02:00
|
|
|
hr = IQueryAssociations_QueryInterface(qa, &IID_IQueryAssociations, (void**)&qa2);
|
2012-01-16 00:06:13 +01:00
|
|
|
ok(hr == S_OK, "QueryInterface (IQueryAssociations) returned 0x%x\n", hr);
|
|
|
|
if (SUCCEEDED(hr)) {
|
2012-08-24 11:17:20 +02:00
|
|
|
IQueryAssociations_Release(qa2);
|
2012-01-16 00:06:13 +01:00
|
|
|
}
|
|
|
|
|
2012-08-24 11:17:20 +02:00
|
|
|
hr = IQueryAssociations_QueryInterface(qa, &IID_IUnknown, (void**)&unk);
|
2012-01-16 00:06:13 +01:00
|
|
|
ok(hr == S_OK, "QueryInterface (IUnknown) returned 0x%x\n", hr);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
IUnknown_Release(unk);
|
|
|
|
}
|
|
|
|
|
2012-08-24 11:17:20 +02:00
|
|
|
hr = IQueryAssociations_QueryInterface(qa, &IID_IUnknown, NULL);
|
2012-01-16 00:06:14 +01:00
|
|
|
ok(hr == E_POINTER, "got 0x%x (expected E_POINTER)\n", hr);
|
|
|
|
|
2012-01-16 00:06:13 +01:00
|
|
|
IQueryAssociations_Release(qa);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-25 01:36:06 +01:00
|
|
|
static void test_IApplicationAssociationRegistration_QueryInterface(IApplicationAssociationRegistration *appreg)
|
2012-01-16 00:06:16 +01:00
|
|
|
{
|
|
|
|
IApplicationAssociationRegistration *appreg2;
|
|
|
|
IUnknown *unk;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2012-08-24 11:17:20 +02:00
|
|
|
hr = IApplicationAssociationRegistration_QueryInterface(appreg, &IID_IApplicationAssociationRegistration,
|
|
|
|
(void**)&appreg2);
|
2012-01-16 00:06:16 +01:00
|
|
|
ok(hr == S_OK, "QueryInterface (IApplicationAssociationRegistration) returned 0x%x\n", hr);
|
|
|
|
if (SUCCEEDED(hr)) {
|
2012-08-24 11:17:20 +02:00
|
|
|
IApplicationAssociationRegistration_Release(appreg2);
|
2012-01-16 00:06:16 +01:00
|
|
|
}
|
|
|
|
|
2012-08-24 11:17:20 +02:00
|
|
|
hr = IApplicationAssociationRegistration_QueryInterface(appreg, &IID_IUnknown, (void**)&unk);
|
2012-01-16 00:06:16 +01:00
|
|
|
ok(hr == S_OK, "QueryInterface (IUnknown) returned 0x%x\n", hr);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
IUnknown_Release(unk);
|
|
|
|
}
|
|
|
|
|
2012-08-24 11:17:20 +02:00
|
|
|
hr = IApplicationAssociationRegistration_QueryInterface(appreg, &IID_IUnknown, NULL);
|
2012-01-16 00:06:16 +01:00
|
|
|
ok(hr == E_POINTER, "got 0x%x (expected E_POINTER)\n", hr);
|
|
|
|
}
|
|
|
|
|
2013-09-09 09:21:03 +02:00
|
|
|
struct assoc_getstring_test
|
|
|
|
{
|
|
|
|
const WCHAR *key;
|
|
|
|
ASSOCF flags;
|
|
|
|
ASSOCSTR str;
|
|
|
|
DWORD len;
|
|
|
|
HRESULT hr;
|
|
|
|
HRESULT brokenhr;
|
|
|
|
};
|
|
|
|
|
|
|
|
static const WCHAR httpW[] = {'h','t','t','p',0};
|
2013-09-09 09:35:37 +02:00
|
|
|
static const WCHAR badW[] = {'b','a','d','b','a','d',0};
|
2013-09-09 09:21:03 +02:00
|
|
|
|
|
|
|
static struct assoc_getstring_test getstring_tests[] =
|
|
|
|
{
|
|
|
|
{ httpW, 0, ASSOCSTR_EXECUTABLE, 2, 0x8007007a /* E_NOT_SUFFICIENT_BUFFER */, S_OK },
|
|
|
|
{ httpW, ASSOCF_NOTRUNCATE, ASSOCSTR_EXECUTABLE, 2, E_POINTER },
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
2016-04-21 20:17:38 +02:00
|
|
|
static void getstring_test(LPCWSTR assocName, HKEY progIdKey, ASSOCSTR str, LPCWSTR expected_string, int line)
|
2016-03-16 21:19:51 +01:00
|
|
|
{
|
|
|
|
IQueryAssociations *assoc;
|
|
|
|
HRESULT hr;
|
2016-06-05 18:35:39 +02:00
|
|
|
WCHAR *buffer = NULL;
|
2016-03-16 21:19:51 +01:00
|
|
|
DWORD len;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc);
|
2016-04-21 20:17:38 +02:00
|
|
|
ok_(__FILE__, line)(hr == S_OK, "failed to create IQueryAssociations, 0x%x\n", hr);
|
2016-05-31 20:06:24 +02:00
|
|
|
hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, assocName, progIdKey, NULL);
|
2016-04-21 20:17:38 +02:00
|
|
|
ok_(__FILE__, line)(hr == S_OK, "IQueryAssociations::Init failed, 0x%x\n", hr);
|
2016-03-16 21:19:51 +01:00
|
|
|
|
2016-05-31 20:06:24 +02:00
|
|
|
hr = IQueryAssociations_GetString(assoc, ASSOCF_NONE, str, NULL, NULL, &len);
|
2016-06-05 18:35:38 +02:00
|
|
|
if (expected_string) {
|
|
|
|
ok_(__FILE__, line)(hr == S_FALSE, "GetString returned 0x%x, expected S_FALSE\n", hr);
|
2016-06-05 18:35:39 +02:00
|
|
|
if (hr != S_FALSE) {
|
2016-06-11 13:53:39 +02:00
|
|
|
/* don't try to allocate memory using uninitialized len */
|
2016-06-05 18:35:39 +02:00
|
|
|
IQueryAssociations_Release(assoc);
|
|
|
|
return;
|
|
|
|
}
|
2016-03-16 21:19:51 +01:00
|
|
|
|
2018-02-20 07:38:00 +01:00
|
|
|
buffer = heap_alloc(len * sizeof(WCHAR));
|
2016-06-05 18:35:38 +02:00
|
|
|
ok_(__FILE__, line)(buffer != NULL, "out of memory\n");
|
|
|
|
hr = IQueryAssociations_GetString(assoc, 0, str, NULL, buffer, &len);
|
|
|
|
ok_(__FILE__, line)(hr == S_OK, "GetString returned 0x%x, expected S_OK\n", hr);
|
2016-03-16 21:19:51 +01:00
|
|
|
|
2016-04-21 20:17:38 +02:00
|
|
|
ok_(__FILE__, line)(lstrcmpW(buffer, expected_string) == 0, "GetString returned %s, expected %s\n",
|
2016-03-16 21:19:51 +01:00
|
|
|
wine_dbgstr_w(buffer), wine_dbgstr_w(expected_string));
|
2016-06-05 18:35:38 +02:00
|
|
|
} else {
|
|
|
|
ok_(__FILE__, line)(FAILED(hr), "GetString returned 0x%x, expected failure\n", hr);
|
2016-03-16 21:19:51 +01:00
|
|
|
}
|
2016-06-05 18:35:39 +02:00
|
|
|
|
|
|
|
IQueryAssociations_Release(assoc);
|
2018-02-20 07:38:00 +01:00
|
|
|
heap_free(buffer);
|
2016-03-16 21:19:51 +01:00
|
|
|
}
|
|
|
|
|
2013-09-09 09:21:03 +02:00
|
|
|
static void test_IQueryAssociations_GetString(void)
|
|
|
|
{
|
2016-03-16 21:19:51 +01:00
|
|
|
static WCHAR test_extensionW[] = {'.','t','e','s','t',0};
|
|
|
|
static WCHAR test_progidW[] = {'t','e','s','t','f','i','l','e',0};
|
|
|
|
static WCHAR DefaultIconW[] = {'D','e','f','a','u','l','t','I','c','o','n',0};
|
|
|
|
/* folder.ico, why not */
|
|
|
|
static WCHAR test_iconW[] = {'s','h','e','l','l','3','2','.','d','l','l',',','1',0};
|
|
|
|
HKEY test_extension_key;
|
|
|
|
HKEY test_progid_key;
|
|
|
|
HKEY test_defaulticon_key;
|
|
|
|
LRESULT r;
|
|
|
|
|
2013-09-09 09:21:03 +02:00
|
|
|
struct assoc_getstring_test *ptr = getstring_tests;
|
|
|
|
IQueryAssociations *assoc;
|
|
|
|
HRESULT hr;
|
|
|
|
DWORD len;
|
|
|
|
int i = 0;
|
|
|
|
|
2016-03-16 21:19:51 +01:00
|
|
|
r = RegCreateKeyExW(HKEY_CLASSES_ROOT, test_extensionW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &test_extension_key, NULL);
|
2016-04-21 20:17:37 +02:00
|
|
|
if (r == ERROR_ACCESS_DENIED)
|
|
|
|
{
|
|
|
|
win_skip("Not enough permissions to create a test key.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-03-16 21:19:51 +01:00
|
|
|
ok(r == ERROR_SUCCESS, "RegCreateKeyExW(HKCR, \".test\") failed: 0x%lx\n", r);
|
|
|
|
r = RegSetValueExW(test_extension_key, NULL, 0, REG_SZ, (PBYTE)test_progidW, sizeof(test_progidW));
|
|
|
|
ok(r == ERROR_SUCCESS, "RegSetValueExW(HKCR\\.test, NULL, \"testfile\") failed: 0x%lx\n", r);
|
|
|
|
|
2016-05-01 10:24:36 +02:00
|
|
|
/* adding progid key with no information should fail to return information */
|
2016-03-16 21:19:51 +01:00
|
|
|
r = RegCreateKeyExW(HKEY_CLASSES_ROOT, test_progidW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &test_progid_key, NULL);
|
|
|
|
ok(r == ERROR_SUCCESS, "RegCreateKeyExW(HKCR, \"testfile\") failed: 0x%lx\n", r);
|
|
|
|
getstring_test(test_extensionW, NULL, ASSOCSTR_DEFAULTICON, NULL, __LINE__);
|
|
|
|
getstring_test(test_progidW, NULL, ASSOCSTR_DEFAULTICON, NULL, __LINE__);
|
|
|
|
getstring_test(NULL, test_progid_key, ASSOCSTR_DEFAULTICON, NULL, __LINE__);
|
|
|
|
|
|
|
|
/* adding information to the progid should return that information */
|
|
|
|
r = RegCreateKeyExW(test_progid_key, DefaultIconW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &test_defaulticon_key, NULL);
|
|
|
|
ok(r == ERROR_SUCCESS, "RegCreateKeyExW(HKCR\\testfile\\DefaultIcon) failed: 0x%lx\n", r);
|
|
|
|
r = RegSetValueExW(test_defaulticon_key, NULL, 0, REG_SZ, (PBYTE)test_iconW, sizeof(test_iconW));
|
|
|
|
ok(r == ERROR_SUCCESS, "RegSetValueExW(HKCR\\testfile\\DefaultIcon, NULL, \"folder.ico\") failed: 0x%lx\n", r);
|
|
|
|
getstring_test(test_extensionW, NULL, ASSOCSTR_DEFAULTICON, test_iconW, __LINE__);
|
|
|
|
getstring_test(test_progidW, NULL, ASSOCSTR_DEFAULTICON, test_iconW, __LINE__);
|
|
|
|
getstring_test(NULL, test_progid_key, ASSOCSTR_DEFAULTICON, test_iconW, __LINE__);
|
|
|
|
|
2016-06-05 18:35:38 +02:00
|
|
|
RegDeleteKeyW(test_progid_key, DefaultIconW);
|
2016-03-16 21:19:51 +01:00
|
|
|
RegDeleteKeyW(HKEY_CLASSES_ROOT, test_progidW);
|
2016-06-05 18:35:38 +02:00
|
|
|
RegDeleteKeyW(HKEY_CLASSES_ROOT, test_extensionW);
|
2016-03-16 21:19:51 +01:00
|
|
|
|
2013-09-09 09:21:03 +02:00
|
|
|
hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc);
|
|
|
|
ok(hr == S_OK, "failed to create object, 0x%x\n", hr);
|
|
|
|
|
2016-05-31 20:06:24 +02:00
|
|
|
hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, httpW, NULL, NULL);
|
2013-09-09 09:21:03 +02:00
|
|
|
ok(hr == S_OK, "Init failed, 0x%x\n", hr);
|
|
|
|
|
|
|
|
len = 0;
|
2016-05-31 20:06:24 +02:00
|
|
|
hr = IQueryAssociations_GetString(assoc, ASSOCF_NONE, ASSOCSTR_EXECUTABLE, NULL, NULL, &len);
|
2013-09-09 09:21:03 +02:00
|
|
|
ok(hr == S_FALSE, "got 0x%08x\n", hr);
|
|
|
|
ok(len > 0, "got wrong needed length, %d\n", len);
|
|
|
|
|
|
|
|
while (ptr->key)
|
|
|
|
{
|
|
|
|
WCHAR buffW[MAX_PATH];
|
|
|
|
DWORD len;
|
|
|
|
|
2016-05-31 20:06:24 +02:00
|
|
|
hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, ptr->key, NULL, NULL);
|
2013-09-09 09:21:03 +02:00
|
|
|
ok(hr == S_OK, "%d: Init failed, 0x%x\n", i, hr);
|
|
|
|
|
|
|
|
len = ptr->len;
|
|
|
|
buffW[0] = ptr->flags & ASSOCF_NOTRUNCATE ? 0x1 : 0;
|
|
|
|
hr = IQueryAssociations_GetString(assoc, ptr->flags, ptr->str, NULL, buffW, &len);
|
|
|
|
if (hr != ptr->hr)
|
|
|
|
ok(broken(hr == ptr->brokenhr), "%d: GetString failed, 0x%08x\n", i, hr);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ok(hr == ptr->hr, "%d: GetString failed, 0x%08x\n", i, hr);
|
|
|
|
ok(len > ptr->len, "%d: got needed length %d\n", i, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* even with ASSOCF_NOTRUNCATE it's null terminated */
|
|
|
|
if ((ptr->flags & ASSOCF_NOTRUNCATE) && (ptr->len > 0))
|
|
|
|
ok(buffW[0] == 0 || broken(buffW[0] == 0x1) /* pre win7 */, "%d: got %x\n", i, buffW[0]);
|
|
|
|
|
|
|
|
if (!(ptr->flags & ASSOCF_NOTRUNCATE) && ptr->len && FAILED(ptr->hr))
|
|
|
|
ok(buffW[0] != 0, "%d: got %x\n", i, buffW[0]);
|
|
|
|
|
|
|
|
i++;
|
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
IQueryAssociations_Release(assoc);
|
|
|
|
}
|
2012-01-16 00:06:16 +01:00
|
|
|
|
2013-09-09 09:35:37 +02:00
|
|
|
static void test_IQueryAssociations_Init(void)
|
|
|
|
{
|
|
|
|
IQueryAssociations *assoc;
|
|
|
|
HRESULT hr;
|
|
|
|
DWORD len;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc);
|
|
|
|
ok(hr == S_OK, "failed to create object, 0x%x\n", hr);
|
|
|
|
|
2016-05-31 20:06:24 +02:00
|
|
|
hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, NULL, NULL, NULL);
|
2013-09-09 09:35:37 +02:00
|
|
|
ok(hr == E_INVALIDARG, "Init failed, 0x%08x\n", hr);
|
|
|
|
|
2016-05-31 20:06:24 +02:00
|
|
|
hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, httpW, NULL, NULL);
|
2013-09-09 09:35:37 +02:00
|
|
|
ok(hr == S_OK, "Init failed, 0x%08x\n", hr);
|
|
|
|
|
2016-05-31 20:06:24 +02:00
|
|
|
hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, badW, NULL, NULL);
|
2013-09-09 09:35:37 +02:00
|
|
|
ok(hr == S_OK || broken(hr == S_FALSE) /* pre-vista */, "Init failed, 0x%08x\n", hr);
|
|
|
|
|
|
|
|
len = 0;
|
2016-05-31 20:06:24 +02:00
|
|
|
hr = IQueryAssociations_GetString(assoc, ASSOCF_NONE, ASSOCSTR_EXECUTABLE, NULL, NULL, &len);
|
2013-09-09 09:35:37 +02:00
|
|
|
ok(hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) || broken(hr == E_FAIL) /* pre-vista */, "got 0x%08x\n", hr);
|
|
|
|
|
|
|
|
IQueryAssociations_Release(assoc);
|
|
|
|
}
|
|
|
|
|
2014-03-25 01:36:06 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2012-01-16 00:06:13 +01:00
|
|
|
START_TEST(assoc)
|
|
|
|
{
|
2013-09-09 09:21:03 +02:00
|
|
|
IQueryAssociations *qa;
|
2014-03-25 01:36:06 +01:00
|
|
|
IApplicationAssociationRegistration *appreg = NULL;
|
2013-09-09 09:21:03 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2012-01-16 00:06:13 +01:00
|
|
|
CoInitialize(NULL);
|
|
|
|
|
2013-09-09 09:21:03 +02:00
|
|
|
/* this works since XP */
|
|
|
|
hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&qa);
|
|
|
|
if (hr == S_OK)
|
|
|
|
{
|
|
|
|
test_IQueryAssociations_QueryInterface();
|
|
|
|
test_IQueryAssociations_GetString();
|
2013-09-09 09:35:37 +02:00
|
|
|
test_IQueryAssociations_Init();
|
2013-09-09 09:21:03 +02:00
|
|
|
|
|
|
|
IQueryAssociations_Release(qa);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
win_skip("IQueryAssociations not supported, 0x%x\n", hr);
|
|
|
|
|
2014-03-25 01:36:06 +01:00
|
|
|
/* 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);
|
2012-01-16 00:06:13 +01:00
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
}
|