From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed for Minecraft Windows 10. --- dlls/windows.applicationmodel/package.c | 93 +++++++++++++++++++++ dlls/windows.applicationmodel/tests/model.c | 7 ++ 2 files changed, 100 insertions(+)
diff --git a/dlls/windows.applicationmodel/package.c b/dlls/windows.applicationmodel/package.c index 8e2c162548c..7a8ff890ae3 100644 --- a/dlls/windows.applicationmodel/package.c +++ b/dlls/windows.applicationmodel/package.c @@ -118,6 +118,7 @@ static const struct IActivationFactoryVtbl factory_vtbl = struct storage_folder { IStorageFolder IStorageFolder_iface; + IStorageItem IStorageItem_iface; LONG ref; };
@@ -142,6 +143,13 @@ static HRESULT WINAPI storage_folder_QueryInterface( IStorageFolder *iface, REFI return S_OK; }
+ if (IsEqualGUID( iid, &IID_IStorageItem )) + { + *out = &impl->IStorageItem_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -273,6 +281,90 @@ static const struct IStorageFolderVtbl storage_folder_vtbl = storage_folder_GetItemsAsyncOverloadDefaultStartAndCount, };
+DEFINE_IINSPECTABLE( storage_item, IStorageItem, struct storage_folder, IStorageFolder_iface ) + +static HRESULT WINAPI storage_item_RenameAsyncOverloadDefaultOptions( IStorageItem *iface, HSTRING name, IAsyncAction **operation ) +{ + FIXME( "iface %p, name %s, operation %p stub!\n", iface, debugstr_hstring(name), operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI storage_item_RenameAsync( IStorageItem *iface, HSTRING name, NameCollisionOption option, IAsyncAction **operation ) +{ + FIXME( "iface %p, name %s, option %d, operation %p stub!\n", iface, debugstr_hstring(name), option, operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI storage_item_DeleteAsyncOverloadDefaultOptions( IStorageItem *iface, IAsyncAction **operation ) +{ + FIXME( "iface %p, operation %p stub!\n", iface, operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI storage_item_DeleteAsync( IStorageItem *iface, StorageDeleteOption option, IAsyncAction **operation ) +{ + FIXME( "iface %p, option %d, operation %p stub!\n", iface, option, operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI storage_item_GetBasicPropertiesAsync( IStorageItem *iface, IAsyncOperation_BasicProperties **operation ) +{ + FIXME( "iface %p, operation %p stub!\n", iface, operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI storage_item_get_Name( IStorageItem *iface, HSTRING *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI storage_item_get_Path( IStorageItem *iface, HSTRING *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI storage_item_get_Attributes( IStorageItem *iface, FileAttributes *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI storage_item_get_DateCreated( IStorageItem *iface, DateTime *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI storage_item_IsOfType( IStorageItem *iface, StorageItemTypes type, boolean *value ) +{ + FIXME( "iface %p, type %d, value %p stub!\n", iface, type, value ); + return E_NOTIMPL; +} + +static const struct IStorageItemVtbl storage_item_vtbl = +{ + storage_item_QueryInterface, + storage_item_AddRef, + storage_item_Release, + /* IInspectable methods */ + storage_item_GetIids, + storage_item_GetRuntimeClassName, + storage_item_GetTrustLevel, + /* IStorageItem methods */ + storage_item_RenameAsyncOverloadDefaultOptions, + storage_item_RenameAsync, + storage_item_DeleteAsyncOverloadDefaultOptions, + storage_item_DeleteAsync, + storage_item_GetBasicPropertiesAsync, + storage_item_get_Name, + storage_item_get_Path, + storage_item_get_Attributes, + storage_item_get_DateCreated, + storage_item_IsOfType, +}; + struct package { IPackage IPackage_iface; @@ -358,6 +450,7 @@ static HRESULT WINAPI package_get_InstalledLocation( IPackage *iface, IStorageFo if (!(impl = calloc( 1, sizeof(*impl) ))) return E_OUTOFMEMORY;
impl->IStorageFolder_iface.lpVtbl = &storage_folder_vtbl; + impl->IStorageItem_iface.lpVtbl = &storage_item_vtbl; impl->ref = 1;
*value = &impl->IStorageFolder_iface; diff --git a/dlls/windows.applicationmodel/tests/model.c b/dlls/windows.applicationmodel/tests/model.c index 849c205ded0..d543cf37c8e 100644 --- a/dlls/windows.applicationmodel/tests/model.c +++ b/dlls/windows.applicationmodel/tests/model.c @@ -54,6 +54,7 @@ static void test_PackageStatics(void) IPackageStatics *package_statics; IStorageFolder *storage_folder; IActivationFactory *factory; + IStorageItem *storage_item; IPackage *package; HSTRING str; HRESULT hr; @@ -106,6 +107,12 @@ static void test_PackageStatics(void) check_interface( storage_folder, &IID_IAgileObject ); check_interface( storage_folder, &IID_IStorageFolder );
+ hr = IStorageFolder_QueryInterface( storage_folder, &IID_IStorageItem, (void **)&storage_item ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = IStorageItem_Release( storage_item ); + ok( ref == 1, "got ref %ld.\n", ref ); + ref = IStorageFolder_Release( storage_folder ); ok( !ref, "got ref %ld.\n", ref ); ref = IPackage_Release( package );