From: Fabian Maurer dark.shadow4@web.de
--- dlls/geolocation/tests/geolocator.c | 31 +++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/dlls/geolocation/tests/geolocator.c b/dlls/geolocation/tests/geolocator.c index ca12f0d3a9d..cb3b4a53f20 100644 --- a/dlls/geolocation/tests/geolocator.c +++ b/dlls/geolocation/tests/geolocator.c @@ -48,10 +48,12 @@ static void check_interface_(unsigned int line, void *obj, const IID *iid) IUnknown_Release(unk); }
+HRESULT (WINAPI *pDllGetActivationFactory)(HSTRING, IActivationFactory **); + void test_basic(void) { static const WCHAR *geolocator_name = L"Windows.Devices.Geolocation.Geolocator"; - IActivationFactory *factory; + IActivationFactory *factory, *factory2; IInspectable *inspectable; IGeolocator *geolocator; IGeolocator *geolocator2; @@ -61,19 +63,40 @@ void test_basic(void) void *dummy; HSTRING str; HRESULT hr; + HMODULE hdll;
hr = WindowsCreateString(geolocator_name, wcslen(geolocator_name), &str); ok(hr == S_OK, "got hr %#lx.\n", hr);
hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); - WindowsDeleteString(str); + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "got hr %#lx.\n", hr); if (hr == REGDB_E_CLASSNOTREG) { - win_skip("%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w(geolocator_name)); - return; + WindowsDeleteString(str); + win_skip("%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w(geolocator_name)); + return; + } + + /* Check what dll the class comes from */ + hdll = LoadLibraryW(L"geolocation.dll"); + ok (!!hdll || broken(!hdll), "Failed to load library, err %lu.\n", GetLastError()); + if (!hdll) /* Win8 has windows.devices.geolocation.dll */ + { + hdll = LoadLibraryW(L"windows.devices.geolocation.dll"); + ok (!!hdll, "Failed to load library, err %lu.\n", GetLastError()); }
+ pDllGetActivationFactory = (void *)GetProcAddress(hdll, "DllGetActivationFactory"); + ok(!!pDllGetActivationFactory, "DllGetActivationFactory not found.\n"); + if (pDllGetActivationFactory) + { + hr = pDllGetActivationFactory(str, &factory2); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + IActivationFactory_Release(factory2); + } + WindowsDeleteString(str); + /* Don't check IID_IAgileObject since it's ignored on win 8 */ check_interface(factory, &IID_IUnknown); check_interface(factory, &IID_IInspectable);