mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-04 19:48:03 +00:00
windows.devices.geolocation.geolocator: Implement IWeakReferenceSource.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55126
This commit is contained in:
parent
fc2814623e
commit
f40c3f6323
|
@ -33,6 +33,7 @@ struct geolocator_statics
|
|||
struct geolocator
|
||||
{
|
||||
IGeolocator IGeolocator_iface;
|
||||
IWeakReferenceSource IWeakReferenceSource_iface;
|
||||
LONG ref;
|
||||
};
|
||||
|
||||
|
@ -57,6 +58,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;
|
||||
|
@ -199,6 +207,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);
|
||||
|
@ -274,6 +320,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;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "winstring.h"
|
||||
|
||||
#include "activation.h"
|
||||
#include "weakreference.h"
|
||||
|
||||
#define WIDL_using_Windows_Foundation
|
||||
#define WIDL_using_Windows_Foundation_Collections
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue