Commit ab9e29b0 authored by Mohamad Al-Jaf's avatar Mohamad Al-Jaf Committed by Alexandre Julliard

windows.storage.applicationdata: Implement IApplicationDataStatics::get_Current().

Needed for Minecraft Windows 10.
parent c4d5e8de
...@@ -85,12 +85,13 @@ static void test_ApplicationDataStatics(void) ...@@ -85,12 +85,13 @@ static void test_ApplicationDataStatics(void)
ok( hr == S_OK, "got hr %#lx.\n", hr ); ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = IApplicationDataStatics_get_Current( application_data_statics, NULL ); hr = IApplicationDataStatics_get_Current( application_data_statics, NULL );
todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr );
hr = IApplicationDataStatics_get_Current( application_data_statics, &application_data ); hr = IApplicationDataStatics_get_Current( application_data_statics, &application_data );
todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); ok( hr == S_OK, "got hr %#lx.\n", hr );
todo_wine ok( application_data != NULL, "got NULL application_data %p.\n", application_data ); ok( application_data != NULL, "got NULL application_data %p.\n", application_data );
if (application_data) IApplicationData_Release( application_data );
ref = IApplicationData_Release( application_data );
ok( ref == 1, "got ref %ld.\n", ref );
ref = IApplicationDataStatics_Release( application_data_statics ); ref = IApplicationDataStatics_Release( application_data_statics );
ok( ref == 2, "got ref %ld.\n", ref ); ok( ref == 2, "got ref %ld.\n", ref );
ref = IActivationFactory_Release( factory ); ref = IActivationFactory_Release( factory );
......
...@@ -115,14 +115,199 @@ static const struct IActivationFactoryVtbl factory_vtbl = ...@@ -115,14 +115,199 @@ static const struct IActivationFactoryVtbl factory_vtbl =
factory_ActivateInstance, factory_ActivateInstance,
}; };
DEFINE_IINSPECTABLE( application_data_statics, IApplicationDataStatics, struct application_data_statics, IActivationFactory_iface ) struct application_data
{
IApplicationData IApplicationData_iface;
LONG ref;
};
static HRESULT WINAPI application_data_statics_get_Current( IApplicationDataStatics *iface, IApplicationData **value ) static inline struct application_data *impl_from_IApplicationData( IApplicationData *iface )
{
return CONTAINING_RECORD( iface, struct application_data, IApplicationData_iface );
}
static HRESULT WINAPI application_data_QueryInterface( IApplicationData *iface, REFIID iid, void **out )
{
struct application_data *impl = impl_from_IApplicationData( 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_IApplicationData ))
{
*out = &impl->IApplicationData_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 application_data_AddRef( IApplicationData *iface )
{
struct application_data *impl = impl_from_IApplicationData( iface );
ULONG ref = InterlockedIncrement( &impl->ref );
TRACE( "iface %p increasing refcount to %lu.\n", iface, ref );
return ref;
}
static ULONG WINAPI application_data_Release( IApplicationData *iface )
{
struct application_data *impl = impl_from_IApplicationData( iface );
ULONG ref = InterlockedDecrement( &impl->ref );
TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref );
if (!ref) free( impl );
return ref;
}
static HRESULT WINAPI application_data_GetIids( IApplicationData *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 application_data_GetRuntimeClassName( IApplicationData *iface, HSTRING *class_name )
{
FIXME( "iface %p, class_name %p stub!\n", iface, class_name );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_GetTrustLevel( IApplicationData *iface, TrustLevel *trust_level )
{
FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_get_Version( IApplicationData *iface, UINT32 *value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_SetVersionAsync( IApplicationData *iface, UINT32 version, IApplicationDataSetVersionHandler *handler,
IAsyncAction **operation )
{
FIXME( "iface %p, version %d, handler %p, operation %p stub!\n", iface, version, handler, operation );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_ClearAllAsync( IApplicationData *iface, IAsyncAction **operation )
{
FIXME( "iface %p, operation %p stub!\n", iface, operation );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_ClearAsync( IApplicationData *iface, ApplicationDataLocality locality, IAsyncAction **operation )
{
FIXME( "iface %p, %d locality, operation %p stub!\n", iface, locality, operation );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_get_LocalSettings( IApplicationData *iface, IApplicationDataContainer **value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_get_RoamingSettings( IApplicationData *iface, IApplicationDataContainer **value )
{ {
FIXME( "iface %p, value %p stub!\n", iface, value ); FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI application_data_get_LocalFolder( IApplicationData *iface, IStorageFolder **value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_get_RoamingFolder( IApplicationData *iface, IStorageFolder **value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_get_TemporaryFolder( IApplicationData *iface, IStorageFolder **value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_add_DataChanged( IApplicationData *iface, ITypedEventHandler_ApplicationData_IInspectable *handler,
EventRegistrationToken *token )
{
FIXME( "iface %p, handler %p, token %p stub!\n", iface, handler, token );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_remove_DataChanged( IApplicationData *iface, EventRegistrationToken token )
{
FIXME( "iface %p, token %#I64x stub!\n", iface, token.value );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_SignalDataChanged( IApplicationData *iface )
{
FIXME( "iface %p stub!\n", iface );
return E_NOTIMPL;
}
static HRESULT WINAPI application_data_get_RoamingStorageQuota( IApplicationData *iface, UINT64 *value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
}
static const struct IApplicationDataVtbl application_data_vtbl =
{
application_data_QueryInterface,
application_data_AddRef,
application_data_Release,
/* IInspectable methods */
application_data_GetIids,
application_data_GetRuntimeClassName,
application_data_GetTrustLevel,
/* IApplicationData methods */
application_data_get_Version,
application_data_SetVersionAsync,
application_data_ClearAllAsync,
application_data_ClearAsync,
application_data_get_LocalSettings,
application_data_get_RoamingSettings,
application_data_get_LocalFolder,
application_data_get_RoamingFolder,
application_data_get_TemporaryFolder,
application_data_add_DataChanged,
application_data_remove_DataChanged,
application_data_SignalDataChanged,
application_data_get_RoamingStorageQuota,
};
DEFINE_IINSPECTABLE( application_data_statics, IApplicationDataStatics, struct application_data_statics, IActivationFactory_iface )
static HRESULT WINAPI application_data_statics_get_Current( IApplicationDataStatics *iface, IApplicationData **value )
{
struct application_data *impl;
TRACE( "iface %p, value %p\n", iface, value );
if (!value) return E_INVALIDARG;
if (!(impl = calloc( 1, sizeof(*impl) ))) return E_OUTOFMEMORY;
impl->IApplicationData_iface.lpVtbl = &application_data_vtbl;
impl->ref = 1;
*value = &impl->IApplicationData_iface;
TRACE( "created IApplicationData %p.\n", *value );
return S_OK;
}
static const struct IApplicationDataStaticsVtbl application_data_statics_vtbl = static const struct IApplicationDataStaticsVtbl application_data_statics_vtbl =
{ {
application_data_statics_QueryInterface, application_data_statics_QueryInterface,
......
...@@ -75,7 +75,7 @@ static void test_ApplicationDataStatics(void) ...@@ -75,7 +75,7 @@ static void test_ApplicationDataStatics(void)
ok( hr == S_OK, "got hr %#lx.\n", hr ); ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = IApplicationDataStatics_get_Current( application_data_statics, NULL ); hr = IApplicationDataStatics_get_Current( application_data_statics, NULL );
todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr );
hr = IApplicationDataStatics_get_Current( application_data_statics, &application_data ); hr = IApplicationDataStatics_get_Current( application_data_statics, &application_data );
todo_wine ok( hr == 0x80073d54, "got hr %#lx.\n", hr ); todo_wine ok( hr == 0x80073d54, "got hr %#lx.\n", hr );
todo_wine ok( !application_data, "got application_data %p.\n", application_data ); todo_wine ok( !application_data, "got application_data %p.\n", application_data );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment