From: Fabian Maurer dark.shadow4@web.de
--- include/windows.foundation.idl | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl index d89541740a7..281b51d0d6c 100644 --- a/include/windows.foundation.idl +++ b/include/windows.foundation.idl @@ -87,6 +87,7 @@ namespace Windows.Foundation { interface Windows.Foundation.IAsyncOperation<IInspectable *>; interface Windows.Foundation.IAsyncOperation<boolean>; interface Windows.Foundation.IReference<INT32>; + interface Windows.Foundation.IReference<DOUBLE>; interface Windows.Foundation.TypedEventHandler<IInspectable *, IInspectable *>; interface Windows.Foundation.TypedEventHandler<Windows.Foundation.IMemoryBufferReference *, IInspectable *>; }
From: Fabian Maurer dark.shadow4@web.de
--- include/Makefile.in | 1 + include/windows.devices.geolocation.idl | 222 ++++++++++++++++++++++++ 2 files changed, 223 insertions(+) create mode 100644 include/windows.devices.geolocation.idl
diff --git a/include/Makefile.in b/include/Makefile.in index e9f0aa8d5fb..94e733cc61c 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -808,6 +808,7 @@ SOURCES = \ windns.h \ windot11.h \ windows.devices.enumeration.idl \ + windows.devices.geolocation.idl \ windows.devices.haptics.idl \ windows.devices.power.idl \ windows.foundation.collections.idl \ diff --git a/include/windows.devices.geolocation.idl b/include/windows.devices.geolocation.idl new file mode 100644 index 00000000000..24a2f63294f --- /dev/null +++ b/include/windows.devices.geolocation.idl @@ -0,0 +1,222 @@ +/* + * Copyright 2023 Fabian Maurer + * + * 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 + */ + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +#ifndef DO_NO_IMPORTS +import "inspectable.idl"; +import "asyncinfo.idl"; +import "eventtoken.idl"; +import "windowscontracts.idl"; +import "windows.foundation.idl"; +#endif + +namespace Windows.Devices.Geolocation { + runtimeclass Geolocator; + runtimeclass Geoposition; + runtimeclass Geocoordinate; + runtimeclass PositionChangedEventArgs; + runtimeclass StatusChangedEventArgs; + runtimeclass CivicAddress; + + interface IGeolocator; + interface IGeoposition; + interface IGeocoordinate; + interface IPositionChangedEventArgs; + interface IStatusChangedEventArgs; + interface ICivicAddress; + + typedef enum PositionAccuracy PositionAccuracy; + typedef enum PositionStatus PositionStatus; + + declare { + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Devices.Geolocation.Geoposition*>; + interface Windows.Foundation.IAsyncOperation<Windows.Devices.Geolocation.Geoposition*>; + interface Windows.Foundation.TypedEventHandler<Windows.Devices.Geolocation.Geolocator*, Windows.Devices.Geolocation.PositionChangedEventArgs*>; + interface Windows.Foundation.TypedEventHandler<Windows.Devices.Geolocation.Geolocator*, Windows.Devices.Geolocation.StatusChangedEventArgs*>; + } + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + enum PositionAccuracy + { + Default = 0, + High = 1 + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + enum PositionStatus + { + Ready = 0, + Initializing = 1, + NoData = 2, + Disabled = 3, + NotInitialized = 4, + NotAvailable = 5 + }; + + /* Interfaces */ + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Geolocation.Geolocator), + uuid(a9c3bf62-4524-4989-8aa9-de019d2e551f) + ] + interface IGeolocator : IInspectable + { + [propget] HRESULT DesiredAccuracy([out, retval] Windows.Devices.Geolocation.PositionAccuracy *value); + [propput] HRESULT DesiredAccuracy([in] Windows.Devices.Geolocation.PositionAccuracy value); + [propget] HRESULT MovementThreshold([out, retval] DOUBLE *value); + [propput] HRESULT MovementThreshold([in] DOUBLE value); + [propget] HRESULT ReportInterval([out, retval] UINT32 *value); + [propput] HRESULT ReportInterval([in] UINT32 value); + [propget] HRESULT LocationStatus([out, retval] Windows.Devices.Geolocation.PositionStatus *value); + [overload("GetGeopositionAsync")] + HRESULT GetGeopositionAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Geolocation.Geoposition*> **value); + [overload("GetGeopositionAsync")] + HRESULT GetGeopositionAsyncWithAgeAndTimeout([in] Windows.Foundation.TimeSpan maximumAge, + [in] Windows.Foundation.TimeSpan timeout, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Devices.Geolocation.Geoposition*> **value); + [eventadd] HRESULT PositionChanged([in] Windows.Foundation.TypedEventHandler<Windows.Devices.Geolocation.Geolocator*, Windows.Devices.Geolocation.PositionChangedEventArgs*> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT PositionChanged([in] EventRegistrationToken token); + [eventadd] HRESULT StatusChanged([in] Windows.Foundation.TypedEventHandler<Windows.Devices.Geolocation.Geolocator*, Windows.Devices.Geolocation.StatusChangedEventArgs*> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT StatusChanged([in] EventRegistrationToken token); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Geolocation.Geoposition), + uuid(c18d0454-7d41-4ff7-a957-9dffb4ef7f5b) + ] + interface IGeoposition : IInspectable + { + [propget] HRESULT Coordinate([out, retval] Windows.Devices.Geolocation.Geocoordinate **value); + [propget] HRESULT CivicAddress([out, retval] Windows.Devices.Geolocation.CivicAddress **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Geolocation.Geocoordinate), + uuid(ee21a3aa-976a-ac70-803d-083ea55bcbc4) + ] + interface IGeocoordinate : IInspectable + { + [propget] HRESULT Latitude([out, retval] DOUBLE *value); + [propget] HRESULT Longitude([out, retval] DOUBLE *value); + [propget] HRESULT Altitude([out, retval] Windows.Foundation.IReference<DOUBLE> **value); + [propget] HRESULT Accuracy([out, retval] DOUBLE *value); + [propget] HRESULT AltitudeAccuracy([out, retval] Windows.Foundation.IReference<DOUBLE> **value); + [propget] HRESULT Heading([out, retval] Windows.Foundation.IReference<DOUBLE> **value); + [propget] HRESULT Speed([out, retval] Windows.Foundation.IReference<DOUBLE> **value); + [propget] HRESULT Timestamp([out, retval] Windows.Foundation.DateTime *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Geolocation.PositionChangedEventArgs), + uuid(37859ce5-9d1e-46c5-bf3b-6ad8cac1a093) + ] + interface IPositionChangedEventArgs : IInspectable + { + [propget] HRESULT Position([out, retval] Windows.Devices.Geolocation.Geoposition **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Geolocation.StatusChangedEventArgs), + uuid(3453d2da-8c93-4111-a205-9aecfc9be5c0) + ] + interface IStatusChangedEventArgs : IInspectable + { + [propget] HRESULT Status([out, retval] Windows.Devices.Geolocation.PositionStatus *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Devices.Geolocation.CivicAddress), + uuid(a8567a1a-64f4-4d48-bcea-f6b008eca34c) + ] + interface ICivicAddress : IInspectable + { + [propget] HRESULT Country([out, retval] HSTRING *value); + [propget] HRESULT State([out, retval] HSTRING *value); + [propget] HRESULT City([out, retval] HSTRING *value); + [propget] HRESULT PostalCode([out, retval] HSTRING *value); + [propget] HRESULT Timestamp([out, retval] Windows.Foundation.DateTime *value); + } + + /* Runtime Classes */ + + [ + activatable(Windows.Foundation.UniversalApiContract, 1.0), + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass Geolocator + { + [default] interface Windows.Devices.Geolocation.IGeolocator; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass Geoposition + { + [default] interface Windows.Devices.Geolocation.IGeoposition; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass Geocoordinate + { + [default] interface Windows.Devices.Geolocation.IGeocoordinate; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass PositionChangedEventArgs + { + [default] interface Windows.Devices.Geolocation.IPositionChangedEventArgs; + } + + [ + marshaling_behavior(agile) + ] + runtimeclass StatusChangedEventArgs + { + [default] interface Windows.Devices.Geolocation.IStatusChangedEventArgs; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass CivicAddress + { + [default] interface Windows.Devices.Geolocation.ICivicAddress; + } +}
From: Fabian Maurer dark.shadow4@web.de
--- .../Makefile.in | 7 + .../classes.idl | 26 +++ .../main.c | 148 ++++++++++++++++++ .../private.h | 38 +++++ .../tests/Makefile.in | 5 + .../tests/geolocator.c | 84 ++++++++++ ...indows.devices.geolocation.geolocator.spec | 3 + 7 files changed, 311 insertions(+) create mode 100644 dlls/windows.devices.geolocation.geolocator/Makefile.in create mode 100644 dlls/windows.devices.geolocation.geolocator/classes.idl create mode 100644 dlls/windows.devices.geolocation.geolocator/main.c create mode 100644 dlls/windows.devices.geolocation.geolocator/private.h create mode 100644 dlls/windows.devices.geolocation.geolocator/tests/Makefile.in create mode 100644 dlls/windows.devices.geolocation.geolocator/tests/geolocator.c create mode 100644 dlls/windows.devices.geolocation.geolocator/windows.devices.geolocation.geolocator.spec
diff --git a/dlls/windows.devices.geolocation.geolocator/Makefile.in b/dlls/windows.devices.geolocation.geolocator/Makefile.in new file mode 100644 index 00000000000..42b5e50442b --- /dev/null +++ b/dlls/windows.devices.geolocation.geolocator/Makefile.in @@ -0,0 +1,7 @@ +MODULE = windows.devices.geolocation.geolocator.dll +IMPORTS = combase uuid + +C_SRCS = \ + main.c + +IDL_SRCS = classes.idl diff --git a/dlls/windows.devices.geolocation.geolocator/classes.idl b/dlls/windows.devices.geolocation.geolocator/classes.idl new file mode 100644 index 00000000000..9c55cf20446 --- /dev/null +++ b/dlls/windows.devices.geolocation.geolocator/classes.idl @@ -0,0 +1,26 @@ +/* Runtime Classes for windows.devices.geolocation.geolocator.dll + * + * Copyright 2023 Fabian Maurer + * + * 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 + */ + +#pragma makedep register + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +#include "windows.devices.geolocation.idl" diff --git a/dlls/windows.devices.geolocation.geolocator/main.c b/dlls/windows.devices.geolocation.geolocator/main.c new file mode 100644 index 00000000000..4cc7faeec36 --- /dev/null +++ b/dlls/windows.devices.geolocation.geolocator/main.c @@ -0,0 +1,148 @@ +/* WinRT Windows.Devices.Geolocation.Geolocator Implementation + * + * Copyright 2023 Fabian Maurer + * + * 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 + */ + +#include "initguid.h" +#include "private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(geolocator); + +static const char *debugstr_hstring(HSTRING hstr) +{ + const WCHAR *str; + UINT32 len; + if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; + str = WindowsGetStringRawBuffer(hstr, &len); + return wine_dbgstr_wn(str, len); +} + +struct geolocator +{ + IActivationFactory IActivationFactory_iface; + LONG ref; +}; + +static inline struct geolocator *impl_from_IActivationFactory(IActivationFactory *iface) +{ + return CONTAINING_RECORD(iface, struct geolocator, IActivationFactory_iface); +} + +static HRESULT WINAPI factory_QueryInterface(IActivationFactory *iface, REFIID iid, void **out) +{ + struct geolocator *impl = impl_from_IActivationFactory(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_IActivationFactory)) + { + *out = &impl->IActivationFactory_iface; + IInspectable_AddRef(*out); + return S_OK; + } + + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI factory_AddRef(IActivationFactory *iface) +{ + struct geolocator *impl = impl_from_IActivationFactory(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p increasing refcount to %lu.\n", iface, ref); + return ref; +} + +static ULONG WINAPI factory_Release(IActivationFactory *iface) +{ + struct geolocator *impl = impl_from_IActivationFactory(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p decreasing refcount to %lu.\n", iface, ref); + return ref; +} + +static HRESULT WINAPI factory_GetIids(IActivationFactory *iface, ULONG *iid_count, IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_GetRuntimeClassName(IActivationFactory *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_GetTrustLevel(IActivationFactory *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_ActivateInstance(IActivationFactory *iface, IInspectable **instance) +{ + FIXME("iface %p, instance %p stub!\n", iface, instance); + return E_NOTIMPL; +} + +static const struct IActivationFactoryVtbl factory_vtbl = +{ + factory_QueryInterface, + factory_AddRef, + factory_Release, + /* IInspectable methods */ + factory_GetIids, + factory_GetRuntimeClassName, + factory_GetTrustLevel, + /* IActivationFactory methods */ + factory_ActivateInstance, +}; + +static struct geolocator geolocator = +{ + {&factory_vtbl}, + 1, +}; + +static IActivationFactory *geolocator_factory = &geolocator.IActivationFactory_iface; + +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out); + return CLASS_E_CLASSNOTAVAILABLE; +} + +HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **factory) +{ + const WCHAR *name = WindowsGetStringRawBuffer(classid, NULL); + + TRACE("classid %s, factory %p.\n", debugstr_hstring(classid), factory); + + *factory = NULL; + + if (!wcscmp(name, RuntimeClass_Windows_Devices_Geolocation_Geolocator)) + IActivationFactory_QueryInterface(geolocator_factory, &IID_IActivationFactory, (void **)factory); + + if (*factory) return S_OK; + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dlls/windows.devices.geolocation.geolocator/private.h b/dlls/windows.devices.geolocation.geolocator/private.h new file mode 100644 index 00000000000..b03c6cfc9d0 --- /dev/null +++ b/dlls/windows.devices.geolocation.geolocator/private.h @@ -0,0 +1,38 @@ +/* WinRT Windows.Devices.Geolocation.Geolocator Implementation + * + * Copyright 2023 Fabian Maurer + * + * 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 + */ + +#ifndef __WINE_WINDOWS_DEVICES_GEOLOCATION_GEOLOCATOR_PRIVATE_H +#define __WINE_WINDOWS_DEVICES_GEOLOCATION_GEOLOCATOR_PRIVATE_H + +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winstring.h" + +#include "activation.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections +#include "windows.foundation.h" +#define WIDL_using_Windows_Devices_Geolocation +#include "windows.devices.geolocation.h" + +#endif diff --git a/dlls/windows.devices.geolocation.geolocator/tests/Makefile.in b/dlls/windows.devices.geolocation.geolocator/tests/Makefile.in new file mode 100644 index 00000000000..1be5ca78258 --- /dev/null +++ b/dlls/windows.devices.geolocation.geolocator/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = windows.devices.geolocation.geolocator.dll +IMPORTS = combase uuid + +C_SRCS = \ + geolocator.c diff --git a/dlls/windows.devices.geolocation.geolocator/tests/geolocator.c b/dlls/windows.devices.geolocation.geolocator/tests/geolocator.c new file mode 100644 index 00000000000..08714442195 --- /dev/null +++ b/dlls/windows.devices.geolocation.geolocator/tests/geolocator.c @@ -0,0 +1,84 @@ +/* + * Copyright 2023 Fabian Maurer + * + * 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 "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winstring.h" + +#include "initguid.h" +#include "roapi.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections +#include "windows.foundation.h" +#define WIDL_using_Windows_Devices_Geolocation +#include "windows.devices.geolocation.h" + +#include "wine/test.h" + +#define check_interface( obj, iid ) check_interface_( __LINE__, obj, iid ) +static void check_interface_( unsigned int line, void *obj, const IID *iid ) +{ + IUnknown *iface = obj; + IUnknown *unk; + HRESULT hr; + + hr = IUnknown_QueryInterface( iface, iid, (void **)&unk ); + ok_(__FILE__, line)( hr == S_OK, "got hr %#lx.\n", hr ); + IUnknown_Release( unk ); +} + +void test_basic(void) +{ + static const WCHAR *geolocator_name = L"Windows.Devices.Geolocation.Geolocator"; + IActivationFactory *factory; + HSTRING str; + HRESULT hr; + + 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; + } + + check_interface( factory, &IID_IUnknown ); + check_interface( factory, &IID_IInspectable ); + check_interface( factory, &IID_IAgileObject ); +} + +START_TEST(geolocator) +{ + HRESULT hr; + + hr = RoInitialize( RO_INIT_MULTITHREADED ); + ok( hr == S_OK, "RoInitialize failed, hr %#lx\n", hr ); + + test_basic(); + + RoUninitialize(); + +} diff --git a/dlls/windows.devices.geolocation.geolocator/windows.devices.geolocation.geolocator.spec b/dlls/windows.devices.geolocation.geolocator/windows.devices.geolocation.geolocator.spec new file mode 100644 index 00000000000..721493229c2 --- /dev/null +++ b/dlls/windows.devices.geolocation.geolocator/windows.devices.geolocation.geolocator.spec @@ -0,0 +1,3 @@ +1 stdcall -private DllCanUnloadNow() +2 stdcall -private DllGetActivationFactory(ptr ptr) +3 stdcall -private DllGetClassObject(ptr ptr ptr)
From: Fabian Maurer dark.shadow4@web.de
--- .../main.c | 137 +++++++++++++++++- .../private.h | 40 +++++ 2 files changed, 175 insertions(+), 2 deletions(-)
diff --git a/dlls/windows.devices.geolocation.geolocator/main.c b/dlls/windows.devices.geolocation.geolocator/main.c index 4cc7faeec36..e364df0a0f3 100644 --- a/dlls/windows.devices.geolocation.geolocator/main.c +++ b/dlls/windows.devices.geolocation.geolocator/main.c @@ -36,9 +36,118 @@ static const char *debugstr_hstring(HSTRING hstr) struct geolocator { IActivationFactory IActivationFactory_iface; + IGeolocator IGeolocator_iface; LONG ref; };
+DEFINE_IINSPECTABLE(geolocator, IGeolocator, struct geolocator, IActivationFactory_iface) + +HRESULT WINAPI geolocator_DesiredAccuracy_get(IGeolocator *iface, PositionAccuracy *value) +{ + FIXME("iface %p, value %p stub.\n", iface, value); + *value = 0; + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_DesiredAccuracy_set(IGeolocator *iface, PositionAccuracy value) +{ + FIXME("iface %p, value %d stub.\n", iface, value); + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_MovementThreshold_get(IGeolocator *iface, DOUBLE *value) +{ + FIXME("iface %p, value %p stub.\n", iface, value); + *value = 0; + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_MovementThreshold_set(IGeolocator *iface, DOUBLE value) +{ + FIXME("iface %p, value %f stub.\n", iface, value); + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_ReportInterval_get(IGeolocator *iface, UINT32 *value) +{ + FIXME("iface %p, value %p stub.\n", iface, value); + *value = 0; + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_ReportInterval_set(IGeolocator *iface, UINT32 value) +{ + FIXME("iface %p, value %u stub.\n", iface, value); + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_LocationStatus(IGeolocator *iface, PositionStatus *value) +{ + FIXME("iface %p, value %p stub.\n", iface, value); + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_GetGeopositionAsync(IGeolocator *iface, IAsyncOperation_Geoposition **value) +{ + FIXME("iface %p, value %p stub.\n", iface, value); + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_GetGeopositionAsyncWithAgeAndTimeout(IGeolocator *iface, TimeSpan maximumAge, TimeSpan timeout, IAsyncOperation_Geoposition **value) +{ + FIXME("iface %p, maximumAge %#I64x, timeout %#I64x, value %p stub.\n", iface, maximumAge.Duration, timeout.Duration, value); + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_PositionChanged_add(IGeolocator *iface, ITypedEventHandler_Geolocator_PositionChangedEventArgs *handler, EventRegistrationToken *token) +{ + FIXME("iface %p, handler %p, token %p stub.\n", iface, handler, token); + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_PositionChanged_remove(IGeolocator *iface, EventRegistrationToken token) +{ + FIXME("iface %p, token %#I64x stub.\n", iface, token.value); + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_StatusChanged_add(IGeolocator *iface, ITypedEventHandler_Geolocator_StatusChangedEventArgs *handler, EventRegistrationToken *token) +{ + FIXME("iface %p, handler %p, token %p stub.\n", iface, handler, token); + return E_NOTIMPL; +} + +HRESULT WINAPI geolocator_StatusChanged_remove(IGeolocator *iface, EventRegistrationToken token) +{ + FIXME("iface %p, token %#I64x stub.\n", iface, token.value); + return E_NOTIMPL; +} + +static const struct IGeolocatorVtbl geolocator_vtbl = +{ + geolocator_QueryInterface, + geolocator_AddRef, + geolocator_Release, + /* IInspectable methods */ + geolocator_GetIids, + geolocator_GetRuntimeClassName, + geolocator_GetTrustLevel, + /* IGeolocator methods */ + geolocator_DesiredAccuracy_get, + geolocator_DesiredAccuracy_set, + geolocator_MovementThreshold_get, + geolocator_MovementThreshold_set, + geolocator_ReportInterval_get, + geolocator_ReportInterval_set, + geolocator_LocationStatus, + geolocator_GetGeopositionAsync, + geolocator_GetGeopositionAsyncWithAgeAndTimeout, + geolocator_PositionChanged_add, + geolocator_PositionChanged_remove, + geolocator_StatusChanged_add, + geolocator_StatusChanged_remove, +}; + static inline struct geolocator *impl_from_IActivationFactory(IActivationFactory *iface) { return CONTAINING_RECORD(iface, struct geolocator, IActivationFactory_iface); @@ -60,6 +169,13 @@ static HRESULT WINAPI factory_QueryInterface(IActivationFactory *iface, REFIID i return S_OK; }
+ if (IsEqualGUID(iid, &IID_IGeolocator)) + { + *out = &impl->IGeolocator_iface; + IInspectable_AddRef(*out); + return S_OK; + } + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE; @@ -99,10 +215,26 @@ static HRESULT WINAPI factory_GetTrustLevel(IActivationFactory *iface, TrustLeve return E_NOTIMPL; }
+static const struct IActivationFactoryVtbl factory_vtbl; + static HRESULT WINAPI factory_ActivateInstance(IActivationFactory *iface, IInspectable **instance) { - FIXME("iface %p, instance %p stub!\n", iface, instance); - return E_NOTIMPL; + struct geolocator *impl; + + TRACE("iface %p, instance %p.\n", iface, instance); + + if (!(impl = calloc(1, sizeof(*impl)))) + { + *instance = NULL; + return E_OUTOFMEMORY; + } + + impl->IActivationFactory_iface.lpVtbl = &factory_vtbl; + impl->IGeolocator_iface.lpVtbl = &geolocator_vtbl; + impl->ref = 1; + + *instance = (IInspectable *)&impl->IGeolocator_iface; + return S_OK; }
static const struct IActivationFactoryVtbl factory_vtbl = @@ -121,6 +253,7 @@ static const struct IActivationFactoryVtbl factory_vtbl = static struct geolocator geolocator = { {&factory_vtbl}, + {&geolocator_vtbl}, 1, };
diff --git a/dlls/windows.devices.geolocation.geolocator/private.h b/dlls/windows.devices.geolocation.geolocator/private.h index b03c6cfc9d0..15e6720f73c 100644 --- a/dlls/windows.devices.geolocation.geolocator/private.h +++ b/dlls/windows.devices.geolocation.geolocator/private.h @@ -35,4 +35,44 @@ #define WIDL_using_Windows_Devices_Geolocation #include "windows.devices.geolocation.h"
+#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ + static inline impl_type *impl_from( iface_type *iface ) \ + { \ + return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ + } \ + static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ + } \ + static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_AddRef( (IInspectable *)(expr) ); \ + } \ + static ULONG WINAPI pfx##_Release( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_Release( (IInspectable *)(expr) ); \ + } \ + static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ + } \ + static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ + } \ + static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ + } +#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ + DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) +#define DEFINE_IINSPECTABLE_OUTER( pfx, iface_type, impl_type, outer_iface ) \ + DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, impl->outer_iface ) + #endif
From: Fabian Maurer dark.shadow4@web.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55126 --- dlls/windows.devices.geolocation.geolocator/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/windows.devices.geolocation.geolocator/main.c b/dlls/windows.devices.geolocation.geolocator/main.c index e364df0a0f3..0f78990ae3b 100644 --- a/dlls/windows.devices.geolocation.geolocator/main.c +++ b/dlls/windows.devices.geolocation.geolocator/main.c @@ -102,7 +102,7 @@ HRESULT WINAPI geolocator_GetGeopositionAsyncWithAgeAndTimeout(IGeolocator *ifac HRESULT WINAPI geolocator_PositionChanged_add(IGeolocator *iface, ITypedEventHandler_Geolocator_PositionChangedEventArgs *handler, EventRegistrationToken *token) { FIXME("iface %p, handler %p, token %p stub.\n", iface, handler, token); - return E_NOTIMPL; + return S_OK; }
HRESULT WINAPI geolocator_PositionChanged_remove(IGeolocator *iface, EventRegistrationToken token)
From: Fabian Maurer dark.shadow4@web.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55126 --- .../main.c | 50 +++++++++++++++++++ .../private.h | 1 + 2 files changed, 51 insertions(+)
diff --git a/dlls/windows.devices.geolocation.geolocator/main.c b/dlls/windows.devices.geolocation.geolocator/main.c index 0f78990ae3b..0d51c70ebea 100644 --- a/dlls/windows.devices.geolocation.geolocator/main.c +++ b/dlls/windows.devices.geolocation.geolocator/main.c @@ -37,6 +37,7 @@ struct geolocator { IActivationFactory IActivationFactory_iface; IGeolocator IGeolocator_iface; + IWeakReferenceSource IWeakReferenceSource_iface; LONG ref; };
@@ -84,6 +85,7 @@ HRESULT WINAPI geolocator_ReportInterval_set(IGeolocator *iface, UINT32 value) HRESULT WINAPI geolocator_LocationStatus(IGeolocator *iface, PositionStatus *value) { FIXME("iface %p, value %p stub.\n", iface, value); + *value = 0; return E_NOTIMPL; }
@@ -148,6 +150,45 @@ static const struct IGeolocatorVtbl geolocator_vtbl = geolocator_StatusChanged_remove, };
+static inline struct geolocator *impl_from_IWeakReferenceSource(IWeakReferenceSource *iface) +{ + return CONTAINING_RECORD(iface, struct geolocator, IWeakReferenceSource_iface); +} + +static HRESULT WINAPI weakreferencesource_QueryInterface(IWeakReferenceSource *iface, REFIID iid, void **out) +{ + struct geolocator *impl = impl_from_IWeakReferenceSource(iface); + return geolocator_QueryInterface(&impl->IGeolocator_iface, iid, out); +} + +static ULONG WINAPI weakreferencesource_AddRef(IWeakReferenceSource *iface) +{ + struct geolocator *impl = impl_from_IWeakReferenceSource(iface); + return geolocator_AddRef(&impl->IGeolocator_iface); +} + +static ULONG WINAPI weakreferencesource_Release(IWeakReferenceSource *iface) +{ + struct geolocator *impl = impl_from_IWeakReferenceSource(iface); + return geolocator_Release(&impl->IGeolocator_iface); +} + +static HRESULT WINAPI weakreferencesource_GetWeakReference(IWeakReferenceSource *iface , IWeakReference **ref) +{ + FIXME("iface %p, ref %p stub.\n", iface, ref); + *ref = 0; + return E_NOTIMPL; +} + +static const struct IWeakReferenceSourceVtbl weakreferencesource_vtbl = +{ + weakreferencesource_QueryInterface, + weakreferencesource_AddRef, + weakreferencesource_Release, + /* IWeakReferenceSource methods */ + weakreferencesource_GetWeakReference, +}; + static inline struct geolocator *impl_from_IActivationFactory(IActivationFactory *iface) { return CONTAINING_RECORD(iface, struct geolocator, IActivationFactory_iface); @@ -176,6 +217,13 @@ static HRESULT WINAPI factory_QueryInterface(IActivationFactory *iface, REFIID i return S_OK; }
+ if (IsEqualGUID(iid, &IID_IWeakReferenceSource)) + { + *out = &impl->IWeakReferenceSource_iface; + IInspectable_AddRef(*out); + return S_OK; + } + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE; @@ -231,6 +279,7 @@ static HRESULT WINAPI factory_ActivateInstance(IActivationFactory *iface, IInspe
impl->IActivationFactory_iface.lpVtbl = &factory_vtbl; impl->IGeolocator_iface.lpVtbl = &geolocator_vtbl; + impl->IWeakReferenceSource_iface.lpVtbl = &weakreferencesource_vtbl; impl->ref = 1;
*instance = (IInspectable *)&impl->IGeolocator_iface; @@ -254,6 +303,7 @@ static struct geolocator geolocator = { {&factory_vtbl}, {&geolocator_vtbl}, + {&weakreferencesource_vtbl}, 1, };
diff --git a/dlls/windows.devices.geolocation.geolocator/private.h b/dlls/windows.devices.geolocation.geolocator/private.h index 15e6720f73c..74b09b877e2 100644 --- a/dlls/windows.devices.geolocation.geolocator/private.h +++ b/dlls/windows.devices.geolocation.geolocator/private.h @@ -28,6 +28,7 @@ #include "winstring.h"
#include "activation.h" +#include "weakreference.h"
#define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Foundation_Collections
From: Fabian Maurer dark.shadow4@web.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55126 --- .../main.c | 50 +++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-)
diff --git a/dlls/windows.devices.geolocation.geolocator/main.c b/dlls/windows.devices.geolocation.geolocator/main.c index 0d51c70ebea..acb7548d991 100644 --- a/dlls/windows.devices.geolocation.geolocator/main.c +++ b/dlls/windows.devices.geolocation.geolocator/main.c @@ -38,6 +38,7 @@ struct geolocator IActivationFactory IActivationFactory_iface; IGeolocator IGeolocator_iface; IWeakReferenceSource IWeakReferenceSource_iface; + IWeakReference IWeakReference_iface; LONG ref; };
@@ -150,6 +151,44 @@ static const struct IGeolocatorVtbl geolocator_vtbl = geolocator_StatusChanged_remove, };
+static inline struct geolocator *impl_from_IWeakReference(IWeakReference *iface) +{ + return CONTAINING_RECORD(iface, struct geolocator, IWeakReference_iface); +} + +static HRESULT WINAPI weakreference_QueryInterface(IWeakReference *iface, REFIID iid, void **out) +{ + struct geolocator *impl = impl_from_IWeakReference(iface); + return geolocator_QueryInterface(&impl->IGeolocator_iface, iid, out); +} + +static ULONG WINAPI weakreference_AddRef(IWeakReference *iface) +{ + struct geolocator *impl = impl_from_IWeakReference(iface); + return geolocator_AddRef(&impl->IGeolocator_iface); +} + +static ULONG WINAPI weakreference_Release(IWeakReference *iface) +{ + struct geolocator *impl = impl_from_IWeakReference(iface); + return geolocator_Release(&impl->IGeolocator_iface); +} + +static HRESULT WINAPI weakreference_Resolve(IWeakReference *iface, REFIID iid, IInspectable **ref) +{ + TRACE("iface %p, ref %p stub.\n", iface, ref); + return E_NOTIMPL; +} + +static const struct IWeakReferenceVtbl weakreference_vtbl = +{ + weakreference_QueryInterface, + weakreference_AddRef, + weakreference_Release, + /* IWeakReference methods */ + weakreference_Resolve, +}; + static inline struct geolocator *impl_from_IWeakReferenceSource(IWeakReferenceSource *iface) { return CONTAINING_RECORD(iface, struct geolocator, IWeakReferenceSource_iface); @@ -175,9 +214,12 @@ static ULONG WINAPI weakreferencesource_Release(IWeakReferenceSource *iface)
static HRESULT WINAPI weakreferencesource_GetWeakReference(IWeakReferenceSource *iface , IWeakReference **ref) { - FIXME("iface %p, ref %p stub.\n", iface, ref); - *ref = 0; - return E_NOTIMPL; + struct geolocator *impl = impl_from_IWeakReferenceSource(iface); + + TRACE("iface %p, ref %p stub.\n", iface, ref); + *ref = &impl->IWeakReference_iface; + IWeakReference_AddRef(*ref); + return S_OK; }
static const struct IWeakReferenceSourceVtbl weakreferencesource_vtbl = @@ -280,6 +322,7 @@ static HRESULT WINAPI factory_ActivateInstance(IActivationFactory *iface, IInspe impl->IActivationFactory_iface.lpVtbl = &factory_vtbl; impl->IGeolocator_iface.lpVtbl = &geolocator_vtbl; impl->IWeakReferenceSource_iface.lpVtbl = &weakreferencesource_vtbl; + impl->IWeakReference_iface.lpVtbl = &weakreference_vtbl; impl->ref = 1;
*instance = (IInspectable *)&impl->IGeolocator_iface; @@ -304,6 +347,7 @@ static struct geolocator geolocator = {&factory_vtbl}, {&geolocator_vtbl}, {&weakreferencesource_vtbl}, + {&weakreference_vtbl}, 1, };
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=134279
Your paranoid android.
=== w8 (32 bit report) ===
windows.devices.geolocation.geolocator: geolocator.c:70: Test failed: got hr 0x80004002. 0a74:geolocator: unhandled exception c0000005 at 0040104F
=== w8adm (32 bit report) ===
windows.devices.geolocation.geolocator: geolocator.c:70: Test failed: got hr 0x80004002. 09d4:geolocator: unhandled exception c0000005 at 0040104F
=== w864 (32 bit report) ===
windows.devices.geolocation.geolocator: geolocator.c:70: Test failed: got hr 0x80004002. 0ae0:geolocator: unhandled exception c0000005 at 0040104F
=== w864 (64 bit report) ===
windows.devices.geolocation.geolocator: geolocator.c:70: Test failed: got hr 0x80004002. 0af8:geolocator: unhandled exception c0000005 at 0000000000401046