2 * Copyright (c) 2018 Alistair Leslie-Hughes
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "winstring.h"
30 #include "wine/test.h"
32 static HRESULT (WINAPI
*pRoActivateInstance
)(HSTRING
, IInspectable
**);
33 static HRESULT (WINAPI
*pRoInitialize
)(RO_INIT_TYPE
);
34 static void (WINAPI
*pRoUninitialize
)(void);
35 static HRESULT (WINAPI
*pRoGetActivationFactory
)(HSTRING
, REFIID
, void **);
37 static HRESULT (WINAPI
*pWindowsCreateString
)(LPCWSTR
, UINT32
, HSTRING
*);
38 static HRESULT (WINAPI
*pWindowsDeleteString
)(HSTRING
);
40 #define SET(x) p##x = (void*)GetProcAddress(hmod, #x)
42 static BOOL
init_functions(void)
44 HMODULE hmod
= LoadLibraryA("combase.dll");
47 win_skip("Failed to load combase.dll, skipping tests\n");
50 SET(RoActivateInstance
);
53 SET(RoGetActivationFactory
);
55 SET(WindowsCreateString
);
56 SET(WindowsDeleteString
);
61 static void test_ActivationFactories(void)
65 IActivationFactory
*factory
= NULL
;
66 IInspectable
*inspect
= NULL
;
68 if(!pRoGetActivationFactory
|| !pRoActivateInstance
)
70 win_skip("RoGetActivationFactory not available\n");
74 hr
= pWindowsCreateString(L
"Windows.Data.Xml.Dom.XmlDocument",
75 ARRAY_SIZE(L
"Windows.Data.Xml.Dom.XmlDocument") - 1, &str
);
76 ok(hr
== S_OK
, "got %08x\n", hr
);
78 hr
= pWindowsCreateString(L
"Does.Not.Exist", ARRAY_SIZE(L
"Does.Not.Exist") - 1, &str2
);
79 ok(hr
== S_OK
, "got %08x\n", hr
);
81 hr
= pRoInitialize(RO_INIT_MULTITHREADED
);
82 ok(hr
== S_OK
, "got %08x\n", hr
);
84 hr
= pRoGetActivationFactory(str2
, &IID_IActivationFactory
, (void **)&factory
);
85 ok(hr
== REGDB_E_CLASSNOTREG
, "got %08x\n", hr
);
87 hr
= pRoGetActivationFactory(str
, &IID_IActivationFactory
, (void **)&factory
);
88 todo_wine
ok(hr
== S_OK
, "got %08x\n", hr
);
90 IActivationFactory_Release(factory
);
92 hr
= pRoActivateInstance(str2
, &inspect
);
93 ok(hr
== REGDB_E_CLASSNOTREG
, "got %08x\n", hr
);
95 hr
= pRoActivateInstance(str
, &inspect
);
96 todo_wine
ok(hr
== S_OK
, "got %08x\n", hr
);
98 IInspectable_Release(inspect
);
100 pWindowsDeleteString(str2
);
101 pWindowsDeleteString(str
);
107 if (!init_functions())
110 test_ActivationFactories();