Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56106
I'm not sure why there's a IRandomAccessStreamReferenceStatics interface in WinTypes. Perhaps it was supposed to be queried from one of the classes there? I've seen something similar with other classes.
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- configure.ac | 2 + dlls/windows.storage/Makefile.in | 7 + dlls/windows.storage/classes.idl | 23 ++ dlls/windows.storage/main.c | 44 +++ dlls/windows.storage/private.h | 42 +++ dlls/windows.storage/streams.c | 115 ++++++++ dlls/windows.storage/tests/Makefile.in | 5 + dlls/windows.storage/tests/storage.c | 86 ++++++ dlls/windows.storage/windows.storage.spec | 321 ++++++++++++++++++++++ 9 files changed, 645 insertions(+) create mode 100644 dlls/windows.storage/Makefile.in create mode 100644 dlls/windows.storage/classes.idl create mode 100644 dlls/windows.storage/main.c create mode 100644 dlls/windows.storage/private.h create mode 100644 dlls/windows.storage/streams.c create mode 100644 dlls/windows.storage/tests/Makefile.in create mode 100644 dlls/windows.storage/tests/storage.c create mode 100644 dlls/windows.storage/windows.storage.spec
diff --git a/configure.ac b/configure.ac index 5f9e63b6f9f..f6cd24bc758 100644 --- a/configure.ac +++ b/configure.ac @@ -3246,6 +3246,8 @@ WINE_CONFIG_MAKEFILE(dlls/windows.security.credentials.ui.userconsentverifier) WINE_CONFIG_MAKEFILE(dlls/windows.security.credentials.ui.userconsentverifier/tests) WINE_CONFIG_MAKEFILE(dlls/windows.storage.applicationdata) WINE_CONFIG_MAKEFILE(dlls/windows.storage.applicationdata/tests) +WINE_CONFIG_MAKEFILE(dlls/windows.storage) +WINE_CONFIG_MAKEFILE(dlls/windows.storage/tests) WINE_CONFIG_MAKEFILE(dlls/windows.system.profile.systemmanufacturers) WINE_CONFIG_MAKEFILE(dlls/windows.system.profile.systemmanufacturers/tests) WINE_CONFIG_MAKEFILE(dlls/windows.ui.xaml) diff --git a/dlls/windows.storage/Makefile.in b/dlls/windows.storage/Makefile.in new file mode 100644 index 00000000000..050b31cac25 --- /dev/null +++ b/dlls/windows.storage/Makefile.in @@ -0,0 +1,7 @@ +MODULE = windows.storage.dll +IMPORTS = combase + +SOURCES = \ + classes.idl \ + main.c \ + streams.c diff --git a/dlls/windows.storage/classes.idl b/dlls/windows.storage/classes.idl new file mode 100644 index 00000000000..0fca4cd1269 --- /dev/null +++ b/dlls/windows.storage/classes.idl @@ -0,0 +1,23 @@ +/* + * Runtime Classes for windows.storage.dll + * + * Copyright (C) 2025 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma makedep register + +#include "windows.storage.streams.idl" diff --git a/dlls/windows.storage/main.c b/dlls/windows.storage/main.c new file mode 100644 index 00000000000..390f2dec742 --- /dev/null +++ b/dlls/windows.storage/main.c @@ -0,0 +1,44 @@ +/* WinRT Windows.Storage Implementation + * + * Copyright (C) 2025 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "initguid.h" +#include "private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(storage); + +HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID riid, void **out ) +{ + FIXME( "clsid %s, riid %s, out %p stub!\n", debugstr_guid( clsid ), debugstr_guid( riid ), out ); + return CLASS_E_CLASSNOTAVAILABLE; +} + +HRESULT WINAPI DllGetActivationFactory( HSTRING classid, IActivationFactory **factory ) +{ + const WCHAR *buffer = WindowsGetStringRawBuffer( classid, NULL ); + + TRACE( "class %s, factory %p.\n", debugstr_hstring( classid ), factory ); + + *factory = NULL; + + if (!wcscmp( buffer, RuntimeClass_Windows_Storage_Streams_RandomAccessStreamReference )) + IActivationFactory_QueryInterface( random_access_stream_reference_factory, &IID_IActivationFactory, (void **)factory ); + + if (*factory) return S_OK; + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dlls/windows.storage/private.h b/dlls/windows.storage/private.h new file mode 100644 index 00000000000..cf8307d8980 --- /dev/null +++ b/dlls/windows.storage/private.h @@ -0,0 +1,42 @@ +/* WinRT Windows.Storage Implementation + * + * Copyright (C) 2025 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_WINDOWS_STORAGE_PRIVATE_H +#define __WINE_WINDOWS_STORAGE_PRIVATE_H + +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winstring.h" + +#include "activation.h" + +#include "wine/debug.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections +#include "windows.foundation.h" +#define WIDL_using_Windows_Storage_Streams +#include "windows.storage.streams.h" + +extern IActivationFactory *random_access_stream_reference_factory; + +#endif diff --git a/dlls/windows.storage/streams.c b/dlls/windows.storage/streams.c new file mode 100644 index 00000000000..b82b760e5e7 --- /dev/null +++ b/dlls/windows.storage/streams.c @@ -0,0 +1,115 @@ +/* WinRT Windows.Storage.Streams Implementation + * + * Copyright (C) 2025 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(storage); + +struct random_access_stream_reference_statics +{ + IActivationFactory IActivationFactory_iface; + LONG ref; +}; + +static inline struct random_access_stream_reference_statics *impl_from_IActivationFactory( IActivationFactory *iface ) +{ + return CONTAINING_RECORD( iface, struct random_access_stream_reference_statics, IActivationFactory_iface ); +} + +static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out ) +{ + struct random_access_stream_reference_statics *impl = impl_from_IActivationFactory( 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_IActivationFactory )) + { + *out = &impl->IActivationFactory_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 factory_AddRef( IActivationFactory *iface ) +{ + struct random_access_stream_reference_statics *impl = impl_from_IActivationFactory( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p increasing refcount to %lu.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI factory_Release( IActivationFactory *iface ) +{ + struct random_access_stream_reference_statics *impl = impl_from_IActivationFactory( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref ); + return ref; +} + +static HRESULT WINAPI factory_GetIids( IActivationFactory *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 factory_GetRuntimeClassName( IActivationFactory *iface, HSTRING *class_name ) +{ + FIXME( "iface %p, class_name %p stub!\n", iface, class_name ); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_GetTrustLevel( IActivationFactory *iface, TrustLevel *trust_level ) +{ + FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level ); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInspectable **instance ) +{ + FIXME( "iface %p, instance %p stub!\n", iface, instance ); + return E_NOTIMPL; +} + +static const struct IActivationFactoryVtbl factory_vtbl = +{ + factory_QueryInterface, + factory_AddRef, + factory_Release, + /* IInspectable methods */ + factory_GetIids, + factory_GetRuntimeClassName, + factory_GetTrustLevel, + /* IActivationFactory methods */ + factory_ActivateInstance, +}; + +static struct random_access_stream_reference_statics random_access_stream_reference_statics = +{ + {&factory_vtbl}, + 0, +}; + +IActivationFactory *random_access_stream_reference_factory = &random_access_stream_reference_statics.IActivationFactory_iface; diff --git a/dlls/windows.storage/tests/Makefile.in b/dlls/windows.storage/tests/Makefile.in new file mode 100644 index 00000000000..467fd0765a7 --- /dev/null +++ b/dlls/windows.storage/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = windows.storage.dll +IMPORTS = combase + +SOURCES = \ + storage.c diff --git a/dlls/windows.storage/tests/storage.c b/dlls/windows.storage/tests/storage.c new file mode 100644 index 00000000000..769b9ddf74e --- /dev/null +++ b/dlls/windows.storage/tests/storage.c @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2025 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ +#define COBJMACROS +#include "initguid.h" +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winstring.h" + +#include "roapi.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections +#include "windows.foundation.h" +#define WIDL_using_Windows_Storage_Streams +#include "windows.storage.streams.h" + +#include "wine/test.h" + +#define check_interface( obj, iid, is_broken ) check_interface_( __LINE__, obj, iid, is_broken ) +static void check_interface_( unsigned int line, void *obj, const IID *iid, BOOL is_broken ) +{ + IUnknown *iface = obj; + IUnknown *unk; + HRESULT hr; + + hr = IUnknown_QueryInterface( iface, iid, (void **)&unk ); + ok_(__FILE__, line)( hr == S_OK || broken( is_broken && hr == E_NOINTERFACE ), "got hr %#lx.\n", hr ); + if (SUCCEEDED(hr)) + IUnknown_Release( unk ); +} + +static void test_RandomAccessStreamReference(void) +{ + static const WCHAR *random_access_stream_reference_statics_name = L"Windows.Storage.Streams.RandomAccessStreamReference"; + IActivationFactory *factory = (void *)0xdeadbeef; + HSTRING str = NULL; + HRESULT hr; + LONG ref; + + hr = WindowsCreateString( random_access_stream_reference_statics_name, wcslen( random_access_stream_reference_statics_name ), &str ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + hr = RoGetActivationFactory( str, &IID_IActivationFactory, (void **)&factory ); + WindowsDeleteString( str ); + ok( hr == S_OK || broken( hr == REGDB_E_CLASSNOTREG ), "got hr %#lx.\n", hr ); + if (hr == REGDB_E_CLASSNOTREG) + { + win_skip( "%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w( random_access_stream_reference_statics_name ) ); + return; + } + + check_interface( factory, &IID_IUnknown, FALSE ); + check_interface( factory, &IID_IInspectable, FALSE ); + check_interface( factory, &IID_IAgileObject, TRUE /* Supported after Windows 10 1607 */ ); + + ref = IActivationFactory_Release( factory ); + ok( ref == 0, "got ref %ld.\n", ref ); +} + +START_TEST(storage) +{ + HRESULT hr; + + hr = RoInitialize( RO_INIT_MULTITHREADED ); + ok( hr == S_OK, "RoInitialize failed, hr %#lx\n", hr ); + + test_RandomAccessStreamReference(); + + RoUninitialize(); +} diff --git a/dlls/windows.storage/windows.storage.spec b/dlls/windows.storage/windows.storage.spec new file mode 100644 index 00000000000..0a024d97145 --- /dev/null +++ b/dlls/windows.storage/windows.storage.spec @@ -0,0 +1,321 @@ +@ stub SHChangeNotifyRegister +@ stub ApplyProviderSettings +@ stub SHChangeNotifyDeregister +@ stub CreateStorageItemFromPath_FullTrustCaller +@ stub CreateStorageItemFromPath_FullTrustCaller_ForPackage +@ stub GatherProviderSettings +@ stub GetUserChoiceForUrl +@ stub PathContainedByManifestedKnownFolder_FullTrustCaller_ForPackage +@ stub RegisterChangeNotifications +@ stub UnregisterChangeNotifications +@ stub AssocCreateForClasses +@ stub AssocGetDetailsOfPropKey +@ stub AssocShouldProcessUseAppToAppLaunching +@ stub CCachedShellItem_CreateInstance +@ stub CCollectionFactory_CreateInstance +@ stub CDesktopFolder_CreateInstanceWithBindContext +@ stub CFSFolder_AdjustForSlowColumn +@ stub CFSFolder_CreateFolder +@ stub CFSFolder_IsCommonItem +@ stub CFileOperationRecorder_CreateInstance +@ stub CFreeThreadedItemContainer_CreateInstance +@ stub CMruLongList_CreateInstance +@ stub CPrivateProfileCache_Save +@ stub CRegFolder_CreateAndInit +@ stub CRegFolder_CreateInstance +@ stub ILSaveToStream +@ stub SHILCreateFromPath +@ stub CShellItemArrayAsCollection_CreateInstance +@ stub CShellItemArrayAsVirtualizedObjectArray_CreateInstance +@ stub CShellItemArrayWithCommonParent_CreateInstance +@ stub CShellItemArray_CreateInstance +@ stub CShellItem_CreateInstance +@ stub CStorageItem_GetValidatedStorageItemObject +@ stub CTaskAddDoc_Create +@ stub CViewSettings_CreateInstance +@ stub CheckSmartScreenWithAltFile +@ stub CopyDefaultLibrariesFromGroupPolicy +@ stub CreateItemArrayFromItemStore +@ stub CreateItemArrayFromObjectArray +@ stub CreateLocalizationDesktopIni +@ stub IsLFNDriveW +@ stub CreateSortColumnArray +@ stub CreateStorageItemFromPath_PartialTrustCaller +@ stub CreateVolatilePropertyStore +@ stub CustomStatePropertyDescription_CreateWithItemPropertyStore +@ stub CustomStatePropertyDescription_CreateWithStateIdentifier +@ stub DataAccessCaches_InvalidateForLibrary +@ stub DeserializeTextToLink +@ stub DetermineFolderDestinationParentAppID +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetActivationFactory(ptr ptr) +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllMain(long long ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() +@ stub DragQueryFileW +@ stub EnumShellItemsFromEnumFullIdList +@ stub GetCommandProviderForFolderType +@ stub GetFileUndoText +@ stub GetFindDataForPath +@ stub GetFindDataFromFileInformationByHandle +@ stub GetRegDataDrivenCommand +@ stub GetRegDataDrivenCommandWithAssociation +@ stub GetSelectionStateFromItemArray +@ stub GetSystemPersistedStorageItemList +@ stub GetSystemPersistedStorageItemListForUser +@ stub SHGetSetSettings +@ stub GetThreadFlags +@ stub Global_WindowsStorage_MaxIcons +@ stub Global_WindowsStorage_Untyped_FileClassSRWLock +@ stub Global_WindowsStorage_Untyped_MountPoint +@ stub Global_WindowsStorage_Untyped_pFileClassCacheTable +@ stub SHCreateStdEnumFmtEtc +@ stub PathYetAnotherMakeUniqueName +@ stub Global_WindowsStorage_Untyped_pFileHanderMap +77 stub @ +@ stub Global_WindowsStorage_Untyped_rgshil +@ stub Global_WindowsStorage_afNotRedirected +@ stub Global_WindowsStorage_ccIcon +@ stub Global_WindowsStorage_csIconCache +@ stub Global_WindowsStorage_csSCN +@ stub Global_WindowsStorage_dwThreadBindCtx +@ stub Global_WindowsStorage_dwThreadInitializing +@ stub Global_WindowsStorage_esServerMode +@ stub Global_WindowsStorage_fEndInitialized +@ stub Global_WindowsStorage_fIconCacheHasBeenSuccessfullyCreated +@ stub Global_WindowsStorage_fIconCacheIsValid +@ stub Global_WindowsStorage_fNeedsInitBroadcast +@ stub SHFindFiles +@ stub Global_WindowsStorage_hwndSCN +@ stub Global_WindowsStorage_iLastSysIcon +@ stub Global_WindowsStorage_iLastSystemColorDepth +@ stub Global_WindowsStorage_iUseLinkPrefix +95 stub @ +@ stub Global_WindowsStorage_lProcessClassCount +@ stub Global_WindowsStorage_lrFlags +@ stub Global_WindowsStorage_nImageManagerVersion +@ stub Global_WindowsStorage_tlsChangeClientProxy +@ stub SHRestricted +@ stub Global_WindowsStorage_tlsIconCache +@ stub Global_WindowsStorage_tlsThreadFlags +@ stub Global_WindowsStorage_ulNextID +@ stub GrantPathAccess_FullTrustCaller_ForPackage +@ stub GrantWorkingDirectoryAccess_FullTrustCaller_ForPackage +@ stub HideExtension +@ stub ILAppendID +@ stub ILClone +@ stub ILCloneFirst +@ stub ILCombine +@ stub ILFindChild +@ stub ILFindLastID +@ stub ILFree +@ stub ILGetNext +@ stub ILGetSize +@ stub ILIsEqual +@ stub ILIsParent +@ stub ILRemoveLastID +@ stub IsLibraryCreatedByPolicy +@ stub IsLibraryPolicyEnabled +@ stub IsNameListedUnderKey +@ stub NeverProvidedByJunction +@ stub PathCleanupSpec +@ stub PathIsExe +@ stub PathMakeUniqueName +@ stub QueryStorageAccess_FullTrustCaller_ForPackage +@ stub QueryStorageAccess_FullTrustCaller_ForToken +@ stub RebaseOnDriveLetter +@ stub RebaseOnVolumeID +@ stub RegistryVerbs_GetHandlerMultiSelectModel +@ stub SHAssocEnumHandlers +@ stub SHAssocEnumHandlersForProtocolByApplication +@ stub SHBindToFolderIDListParent +@ stub SHBindToFolderIDListParentEx +@ stub SHBindToObject +@ stub SHBindToParent +@ stub SHChangeNotify +@ stub SHChangeNotifyRegisterThread +@ stub SHCoCreateInstanceWorker +@ stub SHCreateAssocHandler +@ stub SHCreateAssociationRegistration +@ stub SHCreateDataObject +@ stub SHCreateDefaultExtractIcon +@ stub SHCreateDirectory +@ stub SHCreateDirectoryExA +@ stub SHCreateDirectoryExW +@ stub SHCLSIDFromString +@ stub SHCreateItemFromIDList +@ stub SHCreateItemFromParsingName +@ stub SHCreateItemFromRelativeName +@ stub SHCreateItemInKnownFolder +@ stub SHCreateItemWithParent +@ stub SHCreateItemWithParentAndChildId +@ stub SHCreateShellItemArray +@ stub SHCreateShellItemArrayFromDataObject +@ stub SHCreateShellItemArrayFromIDLists +@ stub SHCreateShellItemArrayFromShellItem +@ stub SHCreateShellItemArrayWithFolderParent +@ stub SHFileOperationWithAdditionalFlags +@ stub SHFlushSFCache +@ stub SHGetDesktopFolder +@ stub SHGetFileInfoW +@ stub SHGetFolderLocation +@ stub SHGetFolderPathA +@ stub SHGetFolderPathAndSubDirA +@ stub SHGetFolderPathAndSubDirW +@ stub SHGetFolderPathEx +@ stub SHGetFolderPathW +@ stub SHGetIDListFromObject +@ stub SHGetInstanceExplorer +@ stub SHGetItemFromObject +172 stub @ +@ stub SHGetKnownFolderIDList +@ stub SHGetKnownFolderIDList_Internal +@ stub SHGetKnownFolderItem +@ stub SHGetKnownFolderPath +@ stub SHGetNameFromIDList +@ stub SHGetPathFromIDListEx +@ stub SHGetPathFromIDListW +@ stub SHGetSpecialFolderLocation +@ stub SHGetSpecialFolderPathA +@ stub SHGetSpecialFolderPathW +@ stub SHGetStockIconInfo +@ stub SHGetTemporaryPropertyForItem +@ stub SHHandleUpdateImage +@ stub SHKnownFolderFromCSIDL +@ stub SHKnownFolderToCSIDL +@ stub SHOpenFolderAndSelectItems +@ stub SHParseDisplayName +@ stub SHPrepareKnownFoldersCommon +@ stub SHPrepareKnownFoldersUser +@ stub SHResolveLibrary +@ stub SHSetFolderPathA +@ stub SHSetFolderPathW +@ stub SHSetKnownFolderPath +@ stub SHSetLocalizedName +@ stub SHSetTemporaryPropertyForItem +@ stub SHSysErrorMessageBox +@ stub SHUpdateImageA +@ stub SHUpdateImageW +@ stub STORAGE_AddItemToRecentDocs +@ stub STORAGE_AddNewFolderToFrequentPlaces +@ stub STORAGE_CEnumFiles_CreateInstance +@ stub STORAGE_CStatusProvider_CreateInstance +@ stub STORAGE_CStorageItem_GetValidatedStorageItem +@ stub STORAGE_CStorageItem_GetValidatedStorageItemObject +@ stub STORAGE_ClearDestinationsForAllApps +@ stub STORAGE_CreateSortColumnArrayFromListDesc +@ stub STORAGE_CreateStorageItemFromPath_FullTrustCaller +@ stub STORAGE_CreateStorageItemFromPath_FullTrustCaller_ForPackage +@ stub STORAGE_CreateStorageItemFromPath_PartialTrustCaller +@ stub STORAGE_CreateStorageItemFromShellItem_FullTrustCaller +@ stub STORAGE_CreateStorageItemFromShellItem_FullTrustCaller_ForPackage +@ stub STORAGE_CreateStorageItemFromShellItem_FullTrustCaller_ForPackage_WithProcessHandle +@ stub STORAGE_CreateStorageItemFromShellItem_FullTrustCaller_ForPackage_WithProcessHandleAndSecondaryStreamName +@ stub STORAGE_CreateStorageItemFromShellItem_FullTrustCaller_UseImplicitFlagsAndPackage +@ stub STORAGE_FillResultWithNullForKeys +@ stub STORAGE_GetShellItemFromStorageItem +@ stub STORAGE_GetSystemPersistedStorageItemList +@ stub STORAGE_MakeDestinationItem +@ stub STORAGE_PathIsEqualOrSubFolderOfKnownFolders +@ stub STORAGE_SHAddToRecentDocs +@ stub STORAGE_SHAddToRecentDocsEx +@ stub STORAGE_SHConfirmOperation +@ stub STORAGE_SHCreateDirectory +@ stub STORAGE_SHCreateDirectoryExA +@ stub STORAGE_SHCreateDirectoryExWWorker +@ stub STORAGE_SHCreateShellItemArray +@ stub STORAGE_SHCreateShellItemArrayFromDataObject +@ stub STORAGE_SHCreateShellItemArrayFromIDLists +@ stub STORAGE_SHCreateShellItemArrayFromShellItem +@ stub STORAGE_SHFileOperation +@ stub STORAGE_SHFileOperationA +@ stub STORAGE_SHFreeNameMappings +@ stub STORAGE_SHGetDesktopFolderWorker +@ stub STORAGE_SHGetPathFromMsUri +@ stub STORAGE_SHOpenFolderAndSelectItems +@ stub STORAGE_SHPathPrepareForWriteA +@ stub STORAGE_SHPathPrepareForWriteW +@ stub STORAGE_SHValidateMSUri +@ stub SendNotificationsForLibraryItem +@ stub SerializeLinkToText +243 stub @ +244 stub @ +@ stub SHTestTokenMembership +@ stub SetThreadFlags +@ stub ShellExecuteA +@ stub ShellExecuteExW +@ stub ShellExecuteW +@ stub StateRepoVerbsCache_Destroy +@ stub StateRepoVerbsCache_GetContextMenuVerbs +@ stub StateRepoVerbsCache_RebuildCacheAsync +@ stub StorageItemHelpers_IsSupportedRemovablePath +@ stub Storage_Internal_GetAccessListForPackage +@ stub _CleanRecentDocs +@ stub _PredictReasonableImpact +264 stub @ +@ stub SHChangeNotification_Lock +@ stub SHChangeNotification_Unlock +660 stub @ +@ stub IsUserAnAdmin +740 stub @ +750 stub @ +761 stub @ +764 stub @ +765 stub @ +781 stub @ +788 stub @ +789 stub @ +791 stub @ +814 stub @ +815 stub @ +816 stub @ +817 stub @ +818 stub @ +819 stub @ +823 stub @ +824 stub @ +825 stub @ +830 stub @ +844 stub @ +845 stub @ +@ stub ILLoadFromStreamEx +847 stub @ +849 stub @ +850 stub @ +851 stub @ +862 stub @ +866 stub @ +873 stub @ +880 stub @ +887 stub @ +897 stub @ +898 stub @ +910 stub @ +911 stub @ +913 stub @ +914 stub @ +915 stub @ +916 stub @ +923 stub @ +@ stub CreateStorageItemFromShellItem_FullTrustCaller_ForPackage +928 stub @ +@ stub GetCachedFileUpdateInformation +@ stub CreateStorageItemFromShellItem +@ stub CreateExtrinsicPropertyStore +@ stub GetInfoForFileInUse +@ stub SHChangeNotifySuspendResume +@ stub CreateStorageProviderPropertyStore +1001 stub @ +1002 stub @ +1003 stub @ +2000 stub @ +2001 stub @ +2002 stub @ +2003 stub @ +2004 stub @ +2005 stub @ +2006 stub @ +2007 stub @ +2008 stub @ +2009 stub @
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56106 --- dlls/windows.storage/classes.idl | 1 + dlls/windows.storage/private.h | 40 ++++++++++++++++++ dlls/windows.storage/streams.c | 47 +++++++++++++++++++++ dlls/windows.storage/tests/storage.c | 6 +++ include/windows.storage.streams.idl | 61 ++++++++++++++++------------ 5 files changed, 130 insertions(+), 25 deletions(-)
diff --git a/dlls/windows.storage/classes.idl b/dlls/windows.storage/classes.idl index 0fca4cd1269..8a7be135572 100644 --- a/dlls/windows.storage/classes.idl +++ b/dlls/windows.storage/classes.idl @@ -20,4 +20,5 @@
#pragma makedep register
+#define _WINDOWS_STORAGE #include "windows.storage.streams.idl" diff --git a/dlls/windows.storage/private.h b/dlls/windows.storage/private.h index cf8307d8980..62c9d226d07 100644 --- a/dlls/windows.storage/private.h +++ b/dlls/windows.storage/private.h @@ -34,9 +34,49 @@ #define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Foundation_Collections #include "windows.foundation.h" +#define WIDL_using_Windows_Storage #define WIDL_using_Windows_Storage_Streams +#include "windows.storage.h" #include "windows.storage.streams.h"
extern IActivationFactory *random_access_stream_reference_factory;
+#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ + static inline impl_type *impl_from( iface_type *iface ) \ + { \ + return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ + } \ + static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ + } \ + static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_AddRef( (IInspectable *)(expr) ); \ + } \ + static ULONG WINAPI pfx##_Release( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_Release( (IInspectable *)(expr) ); \ + } \ + static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ + } \ + static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ + } \ + static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ + } +#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ + DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) + #endif diff --git a/dlls/windows.storage/streams.c b/dlls/windows.storage/streams.c index b82b760e5e7..d8fddedd34d 100644 --- a/dlls/windows.storage/streams.c +++ b/dlls/windows.storage/streams.c @@ -24,6 +24,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(storage); struct random_access_stream_reference_statics { IActivationFactory IActivationFactory_iface; + IRandomAccessStreamReferenceStatics IRandomAccessStreamReferenceStatics_iface; LONG ref; };
@@ -48,6 +49,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_IRandomAccessStreamReferenceStatics )) + { + *out = &impl->IRandomAccessStreamReferenceStatics_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -106,9 +114,48 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( random_access_stream_reference_statics, IRandomAccessStreamReferenceStatics, struct random_access_stream_reference_statics, IActivationFactory_iface ) + +static HRESULT WINAPI random_access_stream_reference_statics_CreateFromFile( IRandomAccessStreamReferenceStatics *iface, IStorageFile *file, + IRandomAccessStreamReference **stream_reference ) +{ + FIXME( "iface %p, file %p, stream_reference %p stub!\n", iface, file, stream_reference ); + return E_NOTIMPL; +} + +static HRESULT WINAPI random_access_stream_reference_statics_CreateFromUri( IRandomAccessStreamReferenceStatics *iface, IUriRuntimeClass *uri, + IRandomAccessStreamReference **stream_reference ) +{ + FIXME( "iface %p, uri %p, stream_reference %p stub!\n", iface, uri, stream_reference ); + return E_NOTIMPL; +} + +static HRESULT WINAPI random_access_stream_reference_statics_CreateFromStream( IRandomAccessStreamReferenceStatics *iface, IRandomAccessStream *stream, + IRandomAccessStreamReference **stream_reference ) +{ + FIXME( "iface %p, stream %p, stream_reference %p stub!\n", iface, stream, stream_reference ); + return E_NOTIMPL; +} + +static const struct IRandomAccessStreamReferenceStaticsVtbl random_access_stream_reference_statics_vtbl = +{ + random_access_stream_reference_statics_QueryInterface, + random_access_stream_reference_statics_AddRef, + random_access_stream_reference_statics_Release, + /* IInspectable methods */ + random_access_stream_reference_statics_GetIids, + random_access_stream_reference_statics_GetRuntimeClassName, + random_access_stream_reference_statics_GetTrustLevel, + /* IRandomAccessStreamReferenceStatics methods */ + random_access_stream_reference_statics_CreateFromFile, + random_access_stream_reference_statics_CreateFromUri, + random_access_stream_reference_statics_CreateFromStream, +}; + static struct random_access_stream_reference_statics random_access_stream_reference_statics = { {&factory_vtbl}, + {&random_access_stream_reference_statics_vtbl}, 0, };
diff --git a/dlls/windows.storage/tests/storage.c b/dlls/windows.storage/tests/storage.c index 769b9ddf74e..be928411d81 100644 --- a/dlls/windows.storage/tests/storage.c +++ b/dlls/windows.storage/tests/storage.c @@ -49,6 +49,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid, BOOL static void test_RandomAccessStreamReference(void) { static const WCHAR *random_access_stream_reference_statics_name = L"Windows.Storage.Streams.RandomAccessStreamReference"; + IRandomAccessStreamReferenceStatics *random_access_stream_reference_statics = (void *)0xdeadbeef; IActivationFactory *factory = (void *)0xdeadbeef; HSTRING str = NULL; HRESULT hr; @@ -69,6 +70,11 @@ static void test_RandomAccessStreamReference(void) check_interface( factory, &IID_IInspectable, FALSE ); check_interface( factory, &IID_IAgileObject, TRUE /* Supported after Windows 10 1607 */ );
+ hr = IActivationFactory_QueryInterface( factory, &IID_IRandomAccessStreamReferenceStatics, (void **)&random_access_stream_reference_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = IRandomAccessStreamReferenceStatics_Release( random_access_stream_reference_statics ); + ok( ref == 1, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory ); ok( ref == 0, "got ref %ld.\n", ref ); } diff --git a/include/windows.storage.streams.idl b/include/windows.storage.streams.idl index 22e4c63c9b9..6c0dde02f5c 100644 --- a/include/windows.storage.streams.idl +++ b/include/windows.storage.streams.idl @@ -50,11 +50,18 @@ namespace Windows.Storage.Streams { runtimeclass Buffer; runtimeclass DataWriter; runtimeclass DataWriterStoreOperation; +#ifndef _WINTYPES runtimeclass InMemoryRandomAccessStream; runtimeclass RandomAccessStream; runtimeclass RandomAccessStreamReference; +#endif
declare { + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.Streams.IBuffer *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.Streams.IOutputStream *>; + interface Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.IBuffer *>; + interface Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.IOutputStream *>; +#ifndef _WINTYPES interface Windows.Foundation.Collections.IIterable<Windows.Storage.Streams.IRandomAccessStream *>; interface Windows.Foundation.Collections.IIterator<Windows.Storage.Streams.IRandomAccessStream *>; interface Windows.Foundation.Collections.IMapView<HSTRING, Windows.Storage.Streams.RandomAccessStreamReference *>; @@ -62,19 +69,16 @@ namespace Windows.Storage.Streams { interface Windows.Foundation.Collections.IVectorView<Windows.Storage.Streams.IRandomAccessStream *>; interface Windows.Foundation.Collections.IVector<Windows.Storage.Streams.IRandomAccessStream *>; interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Foundation.Collections.IMapView<HSTRING, Windows.Storage.Streams.RandomAccessStreamReference *> *>; - interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.Streams.IBuffer *>; - interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.Streams.IOutputStream *>; interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.Streams.IRandomAccessStream *>; interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.Streams.IRandomAccessStreamReference *>; interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.Streams.IRandomAccessStreamWithContentType *>; interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.Streams.RandomAccessStreamReference *>; interface Windows.Foundation.IAsyncOperation<Windows.Foundation.Collections.IMapView<HSTRING, Windows.Storage.Streams.RandomAccessStreamReference *> *>; - interface Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.IBuffer *>; - interface Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.IOutputStream *>; interface Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.IRandomAccessStream *>; interface Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.IRandomAccessStreamReference *>; interface Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.IRandomAccessStreamWithContentType *>; interface Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.RandomAccessStreamReference *>; +#endif }
[ @@ -191,6 +195,7 @@ namespace Windows.Storage.Streams { HRESULT FlushAsync([out, retval] Windows.Foundation.IAsyncOperation<boolean> **operation); }
+#ifndef _WINTYPES [ contract(Windows.Foundation.UniversalApiContract, 1.0), uuid(905a0fe1-bc53-11df-8c49-001e4fc686da), @@ -250,61 +255,65 @@ namespace Windows.Storage.Streams { Windows.Storage.Streams.IContentTypeProvider { } +#endif
+#ifndef _WINDOWS_STORAGE [ + activatable(Windows.Storage.Streams.IBufferFactory, Windows.Foundation.UniversalApiContract, 1.0), contract(Windows.Foundation.UniversalApiContract, 1.0), marshaling_behavior(agile), - static(Windows.Storage.Streams.IRandomAccessStreamStatics, Windows.Foundation.UniversalApiContract, 1.0) + static(Windows.Storage.Streams.IBufferStatics, Windows.Foundation.UniversalApiContract, 1.0), + threading(both) ] - runtimeclass RandomAccessStream + runtimeclass Buffer { + [default] interface Windows.Storage.Streams.IBuffer; }
[ activatable(Windows.Foundation.UniversalApiContract, 1.0), + activatable(Windows.Storage.Streams.IDataWriterFactory, Windows.Foundation.UniversalApiContract, 1.0), contract(Windows.Foundation.UniversalApiContract, 1.0), - marshaling_behavior(agile) + marshaling_behavior(agile), + threading(both) ] - runtimeclass InMemoryRandomAccessStream + runtimeclass DataWriter { - [default] interface Windows.Storage.Streams.IRandomAccessStream; - interface Windows.Storage.Streams.IOutputStream; + [default] interface Windows.Storage.Streams.IDataWriter; interface Windows.Foundation.IClosable; - interface Windows.Storage.Streams.IInputStream; }
[ - activatable(Windows.Storage.Streams.IBufferFactory, Windows.Foundation.UniversalApiContract, 1.0), contract(Windows.Foundation.UniversalApiContract, 1.0), - marshaling_behavior(agile), - static(Windows.Storage.Streams.IBufferStatics, Windows.Foundation.UniversalApiContract, 1.0), - threading(both) + marshaling_behavior(agile) ] - runtimeclass Buffer + runtimeclass DataWriterStoreOperation { - [default] interface Windows.Storage.Streams.IBuffer; + [default] interface Windows.Foundation.IAsyncOperation<UINT32>; } +#endif
+#ifndef _WINTYPES [ activatable(Windows.Foundation.UniversalApiContract, 1.0), - activatable(Windows.Storage.Streams.IDataWriterFactory, Windows.Foundation.UniversalApiContract, 1.0), contract(Windows.Foundation.UniversalApiContract, 1.0), - marshaling_behavior(agile), - threading(both) + marshaling_behavior(agile) ] - runtimeclass DataWriter + runtimeclass InMemoryRandomAccessStream { - [default] interface Windows.Storage.Streams.IDataWriter; + [default] interface Windows.Storage.Streams.IRandomAccessStream; + interface Windows.Storage.Streams.IOutputStream; interface Windows.Foundation.IClosable; + interface Windows.Storage.Streams.IInputStream; }
[ contract(Windows.Foundation.UniversalApiContract, 1.0), - marshaling_behavior(agile) + marshaling_behavior(agile), + static(Windows.Storage.Streams.IRandomAccessStreamStatics, Windows.Foundation.UniversalApiContract, 1.0) ] - runtimeclass DataWriterStoreOperation + runtimeclass RandomAccessStream { - [default] interface Windows.Foundation.IAsyncOperation<UINT32>; }
[ @@ -316,4 +325,6 @@ namespace Windows.Storage.Streams { { [default] interface Windows.Storage.Streams.IRandomAccessStreamReference; } +#endif + }
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56106 --- dlls/windows.storage/streams.c | 4 ++++ dlls/windows.storage/tests/storage.c | 5 +++++ 2 files changed, 9 insertions(+)
diff --git a/dlls/windows.storage/streams.c b/dlls/windows.storage/streams.c index d8fddedd34d..9fad3d30ecb 100644 --- a/dlls/windows.storage/streams.c +++ b/dlls/windows.storage/streams.c @@ -134,6 +134,10 @@ static HRESULT WINAPI random_access_stream_reference_statics_CreateFromStream( I IRandomAccessStreamReference **stream_reference ) { FIXME( "iface %p, stream %p, stream_reference %p stub!\n", iface, stream, stream_reference ); + + *stream_reference = NULL; + + if (!stream) return E_POINTER; return E_NOTIMPL; }
diff --git a/dlls/windows.storage/tests/storage.c b/dlls/windows.storage/tests/storage.c index be928411d81..85bda00e044 100644 --- a/dlls/windows.storage/tests/storage.c +++ b/dlls/windows.storage/tests/storage.c @@ -50,6 +50,7 @@ static void test_RandomAccessStreamReference(void) { static const WCHAR *random_access_stream_reference_statics_name = L"Windows.Storage.Streams.RandomAccessStreamReference"; IRandomAccessStreamReferenceStatics *random_access_stream_reference_statics = (void *)0xdeadbeef; + IRandomAccessStreamReference *random_access_stream_reference = (void *)0xdeadbeef; IActivationFactory *factory = (void *)0xdeadbeef; HSTRING str = NULL; HRESULT hr; @@ -73,6 +74,10 @@ static void test_RandomAccessStreamReference(void) hr = IActivationFactory_QueryInterface( factory, &IID_IRandomAccessStreamReferenceStatics, (void **)&random_access_stream_reference_statics ); ok( hr == S_OK, "got hr %#lx.\n", hr );
+ hr = IRandomAccessStreamReferenceStatics_CreateFromStream( random_access_stream_reference_statics, NULL, &random_access_stream_reference ); + ok( hr == E_POINTER, "got hr %#lx.\n", hr ); + ok( random_access_stream_reference == NULL, "IRandomAccessStreamReferenceStatics_CreateFromStream returned %p.\n", random_access_stream_reference ); + ref = IRandomAccessStreamReferenceStatics_Release( random_access_stream_reference_statics ); ok( ref == 1, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory );
Hi,
On 2/11/25 19:10, Mohamad Al-Jaf (@maljaf) wrote:
I'm not sure why there's a IRandomAccessStreamReferenceStatics interface in WinTypes. Perhaps it was supposed to be queried from one of the classes there? I've seen something similar with other classes.
Probably just because I implemented them in a wrong place, I will write some tests about it.
Thanks
I'm not sure why there's a IRandomAccessStreamReferenceStatics interface in WinTypes. Perhaps it was supposed to be queried from one of the classes there? I've seen something similar with other classes.
It's not supposed to be in wintypes and should be dropped in favor of this new DLL. The wintypes stubs return S_OK from factory_ActivateInstance so you should just change this in your stubs.