From: Paul Gofman pgofman@codeweavers.com
--- dlls/windows.perception.stub/anchor.c | 68 +++++++++++++++++++ .../tests/perception.c | 14 ++++ 2 files changed, 82 insertions(+)
diff --git a/dlls/windows.perception.stub/anchor.c b/dlls/windows.perception.stub/anchor.c index 3d3ff4a4268..e4c88358b73 100644 --- a/dlls/windows.perception.stub/anchor.c +++ b/dlls/windows.perception.stub/anchor.c @@ -120,9 +120,69 @@ static const struct IActivationFactoryVtbl factory_vtbl = struct async_access_status { IAsyncOperation_SpatialPerceptionAccessStatus IAsyncOperation_SpatialPerceptionAccessStatus_iface; + IAsyncInfo IAsyncInfo_iface; LONG ref; };
+DEFINE_IINSPECTABLE(async_info, IAsyncInfo, struct async_access_status, IAsyncOperation_SpatialPerceptionAccessStatus_iface) + +static HRESULT WINAPI async_info_get_Id( IAsyncInfo *iface, UINT32 *id ) +{ + TRACE( "iface %p, id %p.\n", iface, id ); + + *id = 1; + return S_OK; +} + +static HRESULT WINAPI async_info_get_Status( IAsyncInfo *iface, AsyncStatus *status ) +{ + TRACE( "iface %p, status %p.\n", iface, status ); + + *status = Completed; + return S_OK; +} + +static HRESULT WINAPI async_info_get_ErrorCode( IAsyncInfo *iface, HRESULT *error_code ) +{ + TRACE( "iface %p, error_code %p.\n", iface, error_code ); + + *error_code = S_OK; + return S_OK; +} + +static HRESULT WINAPI async_info_Cancel( IAsyncInfo *iface ) +{ + FIXME( "iface %p.\n", iface ); + + return S_OK; +} + +static HRESULT WINAPI async_info_Close( IAsyncInfo *iface ) +{ + FIXME( "iface %p.\n", iface ); + + return S_OK; +} + +static const struct IAsyncInfoVtbl async_info_vtbl = +{ + /* IUnknown methods */ + async_info_QueryInterface, + async_info_AddRef, + async_info_Release, + /* IInspectable methods */ + async_info_GetIids, + async_info_GetRuntimeClassName, + async_info_GetTrustLevel, + /* IAsyncInfo */ + async_info_get_Id, + async_info_get_Status, + async_info_get_ErrorCode, + async_info_Cancel, + async_info_Close, +}; + + static inline struct async_access_status *impl_from_IAsyncOperation_SpatialPerceptionAccessStatus( IAsyncOperation_SpatialPerceptionAccessStatus *iface ) { return CONTAINING_RECORD( iface, struct async_access_status, IAsyncOperation_SpatialPerceptionAccessStatus_iface ); @@ -143,6 +203,13 @@ static HRESULT WINAPI async_SpatialPerceptionAccessStatus_QueryInterface( IAsync return S_OK; }
+ if (IsEqualGUID( iid, &IID_IAsyncInfo )) + { + *out = &impl->IAsyncInfo_iface; + IAsyncInfo_AddRef( &impl->IAsyncInfo_iface ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -238,6 +305,7 @@ static HRESULT async_operation_SpatialPerceptionAccessStatus_create( IAsyncOpera *out = NULL; if (!(impl = calloc( 1, sizeof(*impl) ))) return E_OUTOFMEMORY; impl->IAsyncOperation_SpatialPerceptionAccessStatus_iface.lpVtbl = &async_SpatialPerceptionAccessStatus_vtbl; + impl->IAsyncInfo_iface.lpVtbl = &async_info_vtbl; impl->ref = 1;
*out = &impl->IAsyncOperation_SpatialPerceptionAccessStatus_iface; diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index baa7031b0cf..9ba9441b9e1 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -380,9 +380,12 @@ static void test_SpatialAnchorExporter(void) ISpatialAnchorExporterStatics *statics; SpatialPerceptionAccessStatus status; IActivationFactory *factory; + AsyncStatus astatus; + IAsyncInfo *info; HANDLE event; HSTRING str; HRESULT hr; + UINT32 id; LONG ref;
hr = WindowsCreateString( class_name, wcslen( class_name ), &str ); @@ -434,6 +437,17 @@ static void test_SpatialAnchorExporter(void) ok( hr == S_OK, "got hr %#lx.\n", hr ); ok( status == SpatialPerceptionAccessStatus_DeniedBySystem, "got %d.\n", status );
+ hr = IAsyncOperation_SpatialPerceptionAccessStatus_QueryInterface( access_status, &IID_IAsyncInfo, (void **)&info ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + hr = IAsyncInfo_get_Id( info, &id ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( id == 1, "got %u.\n", id ); + hr = IAsyncInfo_get_Status( info, &astatus ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( astatus == Completed, "got %u.\n", id ); + ref = IAsyncInfo_Release( info ); + ok( ref == 1, "got ref %ld.\n", ref ); + ref = IAsyncOperation_SpatialPerceptionAccessStatus_Release( access_status ); ok( !ref, "got %ld.\n", ref );