From: Fabian Maurer dark.shadow4@web.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55126 --- .../main.c | 47 +++++++++++++++++++ .../private.h | 1 + .../tests/geolocator.c | 6 +++ 3 files changed, 54 insertions(+)
diff --git a/dlls/windows.devices.geolocation.geolocator/main.c b/dlls/windows.devices.geolocation.geolocator/main.c index 65a73ae9e2f..96af2713f93 100644 --- a/dlls/windows.devices.geolocation.geolocator/main.c +++ b/dlls/windows.devices.geolocation.geolocator/main.c @@ -42,6 +42,7 @@ struct geolocator_statics struct geolocator { IGeolocator IGeolocator_iface; + IWeakReferenceSource IWeakReferenceSource_iface; LONG ref; };
@@ -66,6 +67,13 @@ static HRESULT WINAPI geolocator_QueryInterface(IGeolocator *iface, REFIID iid, 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; @@ -208,6 +216,44 @@ static const struct IGeolocatorVtbl geolocator_vtbl = geolocator_remove_StatusChanged, };
+static inline struct geolocator *impl_from_IWeakReferenceSource(IWeakReferenceSource *iface) +{ + return CONTAINING_RECORD(iface, struct geolocator, IWeakReferenceSource_iface); +} + +static HRESULT WINAPI weak_reference_source_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 weak_reference_source_AddRef(IWeakReferenceSource *iface) +{ + struct geolocator *impl = impl_from_IWeakReferenceSource(iface); + return geolocator_AddRef(&impl->IGeolocator_iface); +} + +static ULONG WINAPI weak_reference_source_Release(IWeakReferenceSource *iface) +{ + struct geolocator *impl = impl_from_IWeakReferenceSource(iface); + return geolocator_Release(&impl->IGeolocator_iface); +} + +static HRESULT WINAPI weak_reference_source_GetWeakReference(IWeakReferenceSource *iface, IWeakReference **ref) +{ + FIXME("iface %p, ref %p stub.\n", iface, ref); + return E_NOTIMPL; +} + +static const struct IWeakReferenceSourceVtbl weak_reference_source_vtbl = +{ + weak_reference_source_QueryInterface, + weak_reference_source_AddRef, + weak_reference_source_Release, + /* IWeakReferenceSource methods */ + weak_reference_source_GetWeakReference, +}; + static inline struct geolocator_statics *impl_from_IActivationFactory(IActivationFactory *iface) { return CONTAINING_RECORD(iface, struct geolocator_statics, IActivationFactory_iface); @@ -283,6 +329,7 @@ static HRESULT WINAPI factory_ActivateInstance(IActivationFactory *iface, IInspe }
impl->IGeolocator_iface.lpVtbl = &geolocator_vtbl; + impl->IWeakReferenceSource_iface.lpVtbl = &weak_reference_source_vtbl; impl->ref = 1;
*instance = (IInspectable *)&impl->IGeolocator_iface; diff --git a/dlls/windows.devices.geolocation.geolocator/private.h b/dlls/windows.devices.geolocation.geolocator/private.h index b03c6cfc9d0..7250bc1fe36 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 diff --git a/dlls/windows.devices.geolocation.geolocator/tests/geolocator.c b/dlls/windows.devices.geolocation.geolocator/tests/geolocator.c index 4aa3cc35413..058098a5946 100644 --- a/dlls/windows.devices.geolocation.geolocator/tests/geolocator.c +++ b/dlls/windows.devices.geolocation.geolocator/tests/geolocator.c @@ -26,6 +26,7 @@ #include "initguid.h" #include "roapi.h"
+#include "weakreference.h" #define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Foundation_Collections #include "windows.foundation.h" @@ -53,6 +54,7 @@ void test_basic(void) IActivationFactory *factory; IInspectable *inspectable; IGeolocator *geolocator; + IWeakReferenceSource *weak_reference_source; HSTRING str; HRESULT hr;
@@ -87,6 +89,10 @@ void test_basic(void) IInspectable_Release(inspectable); inspectable = 0;
+ hr = IGeolocator_QueryInterface(geolocator, &IID_IWeakReferenceSource, (void **)&weak_reference_source); + ok(hr == S_OK && weak_reference_source, "got hr %#lx.\n", hr); + IWeakReferenceSource_Release(weak_reference_source); + IGeolocator_Release(geolocator); IActivationFactory_Release(factory); }