Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55403
-- v2: appxdeploymentclient: Add IPackageManager2 stub interface. include: Add Windows.Management.Deployment.IPackageManager2 interface definition. appxdeploymentclient: Implement IActivationFactory::ActivateInstance().
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- configure.ac | 2 + dlls/appxdeploymentclient/Makefile.in | 9 ++ .../appxdeploymentclient.spec | 82 +++++++++++++ dlls/appxdeploymentclient/classes.idl | 23 ++++ dlls/appxdeploymentclient/main.c | 46 +++++++ dlls/appxdeploymentclient/package.c | 115 ++++++++++++++++++ dlls/appxdeploymentclient/private.h | 40 ++++++ dlls/appxdeploymentclient/tests/Makefile.in | 5 + dlls/appxdeploymentclient/tests/appx.c | 89 ++++++++++++++ 9 files changed, 411 insertions(+) create mode 100644 dlls/appxdeploymentclient/Makefile.in create mode 100644 dlls/appxdeploymentclient/appxdeploymentclient.spec create mode 100644 dlls/appxdeploymentclient/classes.idl create mode 100644 dlls/appxdeploymentclient/main.c create mode 100644 dlls/appxdeploymentclient/package.c create mode 100644 dlls/appxdeploymentclient/private.h create mode 100644 dlls/appxdeploymentclient/tests/Makefile.in create mode 100644 dlls/appxdeploymentclient/tests/appx.c
diff --git a/configure.ac b/configure.ac index 078ee5bf201..62f0acd47bd 100644 --- a/configure.ac +++ b/configure.ac @@ -2362,6 +2362,8 @@ WINE_CONFIG_MAKEFILE(dlls/apisetschema) WINE_CONFIG_MAKEFILE(dlls/apphelp) WINE_CONFIG_MAKEFILE(dlls/apphelp/tests) WINE_CONFIG_MAKEFILE(dlls/appwiz.cpl) +WINE_CONFIG_MAKEFILE(dlls/appxdeploymentclient) +WINE_CONFIG_MAKEFILE(dlls/appxdeploymentclient/tests) WINE_CONFIG_MAKEFILE(dlls/atl) WINE_CONFIG_MAKEFILE(dlls/atl/tests) WINE_CONFIG_MAKEFILE(dlls/atl100) diff --git a/dlls/appxdeploymentclient/Makefile.in b/dlls/appxdeploymentclient/Makefile.in new file mode 100644 index 00000000000..75eeb6186ec --- /dev/null +++ b/dlls/appxdeploymentclient/Makefile.in @@ -0,0 +1,9 @@ +MODULE = appxdeploymentclient.dll +IMPORTS = combase + +C_SRCS = \ + main.c \ + package.c + +IDL_SRCS = \ + classes.idl diff --git a/dlls/appxdeploymentclient/appxdeploymentclient.spec b/dlls/appxdeploymentclient/appxdeploymentclient.spec new file mode 100644 index 00000000000..d1dd565d944 --- /dev/null +++ b/dlls/appxdeploymentclient/appxdeploymentclient.spec @@ -0,0 +1,82 @@ +@ stub APPXDEPLOYMENTCLIENT_1 +@ stub GetApplicability +@ stub AppxCreateSharedLocalFolder +@ stub AppxPackageRepositoryRecoverStagedPackages +@ stub AppxPackageRepositoryRecoverUserInstalls +@ stub AppxRecoverUserInstallsForUpgrade +@ stub AppxDeletePackageFiles +@ stub AppxRequestRemovePackageForUser +@ stub IsPackageInstalled +@ stub RDSRecoverRequests +@ stub AppxPreStageCleanupRunTask +@ stub AppxPreRegisterPackage +@ stub ReArmAppxPreStageCleanupTask +@ stub AppxAddPackageToAllUserStoreForPbr +@ stub GetPackageApplicabilityForUserLogon +@ stub APPXDEPLOYMENTCLIENT_16 +@ stub AppxStagePackage +@ stub AppxGetPackageInstalledLocation +@ stub AppxDestagePackage +@ stub GetApplicability2 +@ stub AppxGetStagedPackageFullNameFromFamilyName +@ stub AppxIsStagedPackageStoreSigned +@ stub RegisterNotification +@ stub UnregisterNotification +@ stub GetNotificationPayload +@ stub NotifyPackageStatusChanged +@ stub VerifyPackage +@ stub AppxPreRegisterAllInboxPackages +@ stub AppxValidatePackagesWithOptions +@ stub AppxRemovePackageForAllUsers +@ stub RequestContentGroups +@ stub GetApplicability4 +@ stub RequestContentGroupsForFullTrust +@ stub GeneratePreInstalledPriFiles +@ stub PopulateProtocolAndFTA +@ stub FixJunctionsForAppsIfNecessary +@ stub AppxRemovePackageForUserSid +@ stub CreateCanonicalPriFile +@ stub RegisterNotificationForUser +@ stub UnregisterNotificationForUser +@ stub GetNotificationPayloadForUser +@ stub AppxCleanupWCIReparsePoints +@ stub RepairPackageFileAcls +@ stub EnsurePackageFamilyIsRegisteredBeforeActivation +@ stub AppxCleanupSystemAppsMigratedToFOD +@ stub AppxCleanupOrphanPackages +@ stub CheckComCallerHasCapabilities +@ stub GetBundleApplicablePackages +@ stub GetApplicability5 +@ stub DeleteApplicabilityInfoArray +@ stub UpdateAgentCreateDownload +@ stub UpdateAgentGetDownloadRanges +@ stub UpdateAgentCancelAllDownloads +@ stub UpdateDataSourceRegister +@ stub UpdateDataSourceAddRange +@ stub UpdateDataSourceRun +@ stub UpdateDataSourceCancelRun +@ stub GetPackageRegistrationStatusForUser +@ stub IsSharedAppsEnabled +@ stub AppInstallerUpdateAllTask +@ stub CheckAppInstallerUpdateAvailability +@ stub UpdateAgentFreeDownloadRanges +@ stub AppxRegisterPackage +@ stub IsPackageMetadataUnderSystemMetadata +@ stub GetMetadataRootForPackage +@ stub ClientGetAllPackagesToBeInstalledForUser +@ stub ClientDeleteAllPackagesFromMainPackageArray +@ stub GetPackageRegistrationStatusForUserAndDefaultAccount +@ stub UpdateAgentGetDownloadingPackageCount +@ stub PreRegisterPackagesInContainer +@ stub EnsurePackageFamiliesAreRegisteredInContainer +@ stub RemovePackageFromContainer +@ stub HasPackageFamilyBeenRegisteredForUser +@ stub CleanupProfileForUser +@ stub AppxRemoveAllPackagesForUserSid +@ stub AppxCreateSharedLocalFolderForFamilyName +@ stub AppxDoesSharedLocalFolderExistForFamilyName +@ stub AppxValidatePackages +@ stub CheckForUpdatesAndWaitForInstallerIfNeeded +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetActivationFactory(ptr ptr) +@ stdcall -private DllGetClassObject(ptr ptr ptr) diff --git a/dlls/appxdeploymentclient/classes.idl b/dlls/appxdeploymentclient/classes.idl new file mode 100644 index 00000000000..edef0414d2d --- /dev/null +++ b/dlls/appxdeploymentclient/classes.idl @@ -0,0 +1,23 @@ +/* + * Runtime Classes for appxdeploymentclient.dll + * + * Copyright (C) 2023 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.management.deployment.idl" diff --git a/dlls/appxdeploymentclient/main.c b/dlls/appxdeploymentclient/main.c new file mode 100644 index 00000000000..7efbf96ea73 --- /dev/null +++ b/dlls/appxdeploymentclient/main.c @@ -0,0 +1,46 @@ +/* WinRT Windows.Management.Deployment Implementation + * + * Copyright (C) 2023 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" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(appx); + +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_Management_Deployment_PackageManager )) + IActivationFactory_QueryInterface( package_manager_factory, &IID_IActivationFactory, (void **)factory ); + + if (*factory) return S_OK; + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dlls/appxdeploymentclient/package.c b/dlls/appxdeploymentclient/package.c new file mode 100644 index 00000000000..84a5189bb92 --- /dev/null +++ b/dlls/appxdeploymentclient/package.c @@ -0,0 +1,115 @@ +/* WinRT Windows.Management.Deployment.PackageManager Implementation + * + * Copyright (C) 2023 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" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(appx); + +struct package_manager_statics +{ + IActivationFactory IActivationFactory_iface; + LONG ref; +}; + +static inline struct package_manager_statics *impl_from_IActivationFactory( IActivationFactory *iface ) +{ + return CONTAINING_RECORD( iface, struct package_manager_statics, IActivationFactory_iface ); +} + +static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out ) +{ + struct package_manager_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_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 package_manager_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 package_manager_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 package_manager_statics package_manager_statics = +{ + {&factory_vtbl}, + 1, +}; + +IActivationFactory *package_manager_factory = &package_manager_statics.IActivationFactory_iface; diff --git a/dlls/appxdeploymentclient/private.h b/dlls/appxdeploymentclient/private.h new file mode 100644 index 00000000000..fd2aaf449c8 --- /dev/null +++ b/dlls/appxdeploymentclient/private.h @@ -0,0 +1,40 @@ +/* WinRT Windows.Management.Deployment Implementation + * + * Copyright (C) 2023 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_MANAGEMENT_DEPLOYMENT_PRIVATE_H +#define __WINE_WINDOWS_MANAGEMENT_DEPLOYMENT_PRIVATE_H + +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winstring.h" + +#include "activation.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections +#include "windows.foundation.h" +#define WIDL_using_Windows_Management_Deployment +#include "windows.management.deployment.h" + +extern IActivationFactory *package_manager_factory; + +#endif diff --git a/dlls/appxdeploymentclient/tests/Makefile.in b/dlls/appxdeploymentclient/tests/Makefile.in new file mode 100644 index 00000000000..59e48cb5fec --- /dev/null +++ b/dlls/appxdeploymentclient/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = appxdeploymentclient.dll +IMPORTS = combase + +C_SRCS = \ + appx.c diff --git a/dlls/appxdeploymentclient/tests/appx.c b/dlls/appxdeploymentclient/tests/appx.c new file mode 100644 index 00000000000..551f239f5b4 --- /dev/null +++ b/dlls/appxdeploymentclient/tests/appx.c @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2023 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_Management_Deployment +#include "windows.management.deployment.h" + +#include "wine/test.h" + +#define check_interface( obj, iid, exp ) check_interface_( __LINE__, obj, iid, exp ) +static void check_interface_( unsigned int line, void *obj, const IID *iid, BOOL supported ) +{ + IUnknown *iface = obj; + IUnknown *unk; + HRESULT hr, expected_hr; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface( iface, iid, (void **)&unk ); + ok_( __FILE__, line )( hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr ); + if (SUCCEEDED(hr)) + IUnknown_Release( unk ); +} + +static void test_PackageManager(void) +{ + static const WCHAR *package_manager_name = L"Windows.Management.Deployment.PackageManager"; + IActivationFactory *factory; + HSTRING str; + HRESULT hr; + LONG ref; + + hr = WindowsCreateString( package_manager_name, wcslen( package_manager_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( package_manager_name ) ); + return; + } + + check_interface( factory, &IID_IUnknown, TRUE ); + check_interface( factory, &IID_IInspectable, TRUE ); + check_interface( factory, &IID_IAgileObject, FALSE ); + + ref = IActivationFactory_Release( factory ); + ok( ref == 1, "got ref %ld.\n", ref ); +} + +START_TEST(appx) +{ + HRESULT hr; + + hr = RoInitialize( RO_INIT_MULTITHREADED ); + ok( hr == S_OK, "RoInitialize failed, hr %#lx\n", hr ); + + test_PackageManager(); + + RoUninitialize(); +}
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/appxdeploymentclient/package.c | 221 ++++++++++++++++++++++++- dlls/appxdeploymentclient/private.h | 1 + dlls/appxdeploymentclient/tests/appx.c | 37 ++++- 3 files changed, 255 insertions(+), 4 deletions(-)
diff --git a/dlls/appxdeploymentclient/package.c b/dlls/appxdeploymentclient/package.c index 84a5189bb92..37af0fdaff4 100644 --- a/dlls/appxdeploymentclient/package.c +++ b/dlls/appxdeploymentclient/package.c @@ -22,6 +22,210 @@
WINE_DEFAULT_DEBUG_CHANNEL(appx);
+struct package_manager +{ + IPackageManager IPackageManager_iface; + LONG ref; +}; + +static inline struct package_manager *impl_from_IPackageManager( IPackageManager *iface ) +{ + return CONTAINING_RECORD( iface, struct package_manager, IPackageManager_iface ); +} + +static HRESULT WINAPI package_manager_QueryInterface( IPackageManager *iface, REFIID iid, void **out ) +{ + struct package_manager *impl = impl_from_IPackageManager( 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_IPackageManager )) + { + *out = &impl->IPackageManager_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 package_manager_AddRef( IPackageManager *iface ) +{ + struct package_manager *impl = impl_from_IPackageManager( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p increasing refcount to %lu.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI package_manager_Release( IPackageManager *iface ) +{ + struct package_manager *impl = impl_from_IPackageManager( 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 package_manager_GetIids( IPackageManager *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 package_manager_GetRuntimeClassName( IPackageManager *iface, HSTRING *class_name ) +{ + FIXME( "iface %p, class_name %p stub!\n", iface, class_name ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_GetTrustLevel( IPackageManager *iface, TrustLevel *trust_level ) +{ + FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_AddPackageAsync( IPackageManager *iface, IUriRuntimeClass *uri, + IIterable_Uri *dependencies, DeploymentOptions options, IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation ) +{ + FIXME( "iface %p, uri %p, dependencies %p, options %d, operation %p stub!\n", iface, uri, dependencies, options, operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_UpdatePackageAsync( IPackageManager *iface, IUriRuntimeClass *uri, IIterable_Uri *dependencies, + DeploymentOptions options, IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation ) +{ + FIXME( "iface %p, uri %p, dependencies %p, options %d, operation %p stub!\n", iface, uri, dependencies, options, operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_RemovePackageAsync( IPackageManager *iface, HSTRING name, + IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation ) +{ + FIXME( "iface %p, name %s, operation %p stub!\n", iface, debugstr_hstring(name), operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_StagePackageAsync( IPackageManager *iface, IUriRuntimeClass *uri, IIterable_Uri *dependencies, + IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation ) +{ + FIXME( "iface %p, uri %p, dependencies %p, operation %p stub!\n", iface, uri, dependencies, operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_RegisterPackageAsync( IPackageManager *iface, IUriRuntimeClass *uri, IIterable_Uri *dependencies, + DeploymentOptions options, IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation ) +{ + FIXME( "iface %p, uri %p, dependencies %p, options %d, operation %p stub!\n", iface, uri, dependencies, options, operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_FindPackages( IPackageManager *iface, IIterable_Package **packages ) +{ + FIXME( "iface %p, packages %p stub!\n", iface, packages ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_FindPackagesByUserSecurityId( IPackageManager *iface, HSTRING sid, IIterable_Package **packages ) +{ + FIXME( "iface %p, sid %s, packages %p stub!\n", iface, debugstr_hstring(sid), packages ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_FindPackagesByNamePublisher( IPackageManager *iface, HSTRING name, HSTRING publisher, IIterable_Package **packages ) +{ + FIXME( "iface %p, name %s, publisher %s, packages %p stub!\n", iface, debugstr_hstring(name), debugstr_hstring(publisher), packages ); + + if (!name || !publisher) return E_INVALIDARG; + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_FindPackagesByUserSecurityIdNamePublisher( IPackageManager *iface, HSTRING sid, + HSTRING name, HSTRING publisher, IIterable_Package **packages ) +{ + FIXME( "iface %p, sid %s, name %s, publisher %s, packages %p stub!\n", iface, debugstr_hstring(sid), debugstr_hstring(name), debugstr_hstring(publisher), packages ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_FindUsers( IPackageManager *iface, HSTRING name, IIterable_PackageUserInformation **users ) +{ + FIXME( "iface %p, name %s, users %p stub!\n", iface, debugstr_hstring(name), users ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_SetPackageState( IPackageManager *iface, HSTRING name, PackageState state ) +{ + FIXME("iface %p, name %s, state %d stub!\n", iface, debugstr_hstring(name), state); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_FindPackageByPackageFullName( IPackageManager *iface, HSTRING name, IPackage **package ) +{ + FIXME( "iface %p, name %s, package %p stub!\n", iface, debugstr_hstring(name), package ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_CleanupPackageForUserAsync( IPackageManager *iface, HSTRING name, HSTRING sid, + IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation ) +{ + FIXME( "iface %p, name %s, sid %s, operation %p stub!\n", iface, debugstr_hstring(name), debugstr_hstring(sid), operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_FindPackagesByPackageFamilyName( IPackageManager *iface, HSTRING family_name, + IIterable_Package **packages ) +{ + FIXME( "iface %p, family_name %s, packages %p stub!\n", iface, debugstr_hstring(family_name), packages ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_FindPackagesByUserSecurityIdPackageFamilyName( IPackageManager *iface, HSTRING sid, + HSTRING family_name, IIterable_Package **packages ) +{ + FIXME( "iface %p, sid %s, family_name %s, packages %p stub!\n", iface, debugstr_hstring(sid), debugstr_hstring(family_name), packages ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager_FindPackageByUserSecurityIdPackageFullName( IPackageManager *iface, HSTRING sid, HSTRING name, IPackage **package ) +{ + FIXME( "iface %p, sid %s, name %s, package %p stub!\n", iface, debugstr_hstring(sid), debugstr_hstring(name), package ); + return E_NOTIMPL; +} + +static const struct IPackageManagerVtbl package_manager_vtbl = +{ + package_manager_QueryInterface, + package_manager_AddRef, + package_manager_Release, + /* IInspectable methods */ + package_manager_GetIids, + package_manager_GetRuntimeClassName, + package_manager_GetTrustLevel, + /* IPackageManager methods */ + package_manager_AddPackageAsync, + package_manager_UpdatePackageAsync, + package_manager_RemovePackageAsync, + package_manager_StagePackageAsync, + package_manager_RegisterPackageAsync, + package_manager_FindPackages, + package_manager_FindPackagesByUserSecurityId, + package_manager_FindPackagesByNamePublisher, + package_manager_FindPackagesByUserSecurityIdNamePublisher, + package_manager_FindUsers, + package_manager_SetPackageState, + package_manager_FindPackageByPackageFullName, + package_manager_CleanupPackageForUserAsync, + package_manager_FindPackagesByPackageFamilyName, + package_manager_FindPackagesByUserSecurityIdPackageFamilyName, + package_manager_FindPackageByUserSecurityIdPackageFullName +}; + struct package_manager_statics { IActivationFactory IActivationFactory_iface; @@ -89,8 +293,21 @@ static HRESULT WINAPI factory_GetTrustLevel( IActivationFactory *iface, TrustLev
static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInspectable **instance ) { - FIXME( "iface %p, instance %p stub!\n", iface, instance ); - return E_NOTIMPL; + struct package_manager *impl; + + TRACE( "iface %p, instance %p.\n", iface, instance ); + + if (!(impl = calloc( 1, sizeof(*impl) ))) + { + *instance = NULL; + return E_OUTOFMEMORY; + } + + impl->IPackageManager_iface.lpVtbl = &package_manager_vtbl; + impl->ref = 1; + + *instance = (IInspectable *)&impl->IPackageManager_iface; + return S_OK; }
static const struct IActivationFactoryVtbl factory_vtbl = diff --git a/dlls/appxdeploymentclient/private.h b/dlls/appxdeploymentclient/private.h index fd2aaf449c8..aafbfed11a1 100644 --- a/dlls/appxdeploymentclient/private.h +++ b/dlls/appxdeploymentclient/private.h @@ -33,6 +33,7 @@ #define WIDL_using_Windows_Foundation_Collections #include "windows.foundation.h" #define WIDL_using_Windows_Management_Deployment +#define WIDL_using_Windows_ApplicationModel #include "windows.management.deployment.h"
extern IActivationFactory *package_manager_factory; diff --git a/dlls/appxdeploymentclient/tests/appx.c b/dlls/appxdeploymentclient/tests/appx.c index 551f239f5b4..7ca1b0d62d5 100644 --- a/dlls/appxdeploymentclient/tests/appx.c +++ b/dlls/appxdeploymentclient/tests/appx.c @@ -51,8 +51,11 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid, BOOL static void test_PackageManager(void) { static const WCHAR *package_manager_name = L"Windows.Management.Deployment.PackageManager"; + IPackageManager *package_manager; + IIterable_Package *packages; IActivationFactory *factory; - HSTRING str; + IInspectable *inspectable; + HSTRING str, str2; HRESULT hr; LONG ref;
@@ -60,7 +63,6 @@ static void test_PackageManager(void) 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) { @@ -71,7 +73,38 @@ static void test_PackageManager(void) check_interface( factory, &IID_IUnknown, TRUE ); check_interface( factory, &IID_IInspectable, TRUE ); check_interface( factory, &IID_IAgileObject, FALSE ); + check_interface( factory, &IID_IPackageManager, FALSE ); + + hr = RoActivateInstance( NULL, &inspectable ); + todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + hr = RoActivateInstance( str, &inspectable ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + WindowsDeleteString( str ); + + hr = IInspectable_QueryInterface( inspectable, &IID_IPackageManager, (void **)&package_manager ); + ok( hr == S_OK, "got hr %#lx.\n", hr );
+ check_interface( inspectable, &IID_IAgileObject, TRUE ); + + hr = IPackageManager_FindPackagesByNamePublisher( package_manager, NULL, NULL, &packages ); + ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + hr = WindowsCreateString( L"Wine", wcslen( L"Wine" ), &str ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + hr = IPackageManager_FindPackagesByNamePublisher( package_manager, str, NULL, &packages ); + ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + hr = WindowsCreateString( L"The Wine Project", wcslen( L"The Wine Project" ), &str2 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + hr = IPackageManager_FindPackagesByNamePublisher( package_manager, NULL, str2, &packages ); + ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + hr = IPackageManager_FindPackagesByNamePublisher( package_manager, str, str2, &packages ); + todo_wine ok( hr == S_OK || broken ( hr == E_ACCESSDENIED /* Requires admin privileges */ ) , "got hr %#lx.\n", hr ); + WindowsDeleteString( str ); + WindowsDeleteString( str2 ); + + ref = IPackageManager_Release( package_manager ); + ok( ref == 1, "got ref %ld.\n", ref ); + ref = IInspectable_Release( inspectable ); + ok( !ref, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); }
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- include/windows.management.deployment.idl | 70 +++++++++++++++++++++++ 1 file changed, 70 insertions(+)
diff --git a/include/windows.management.deployment.idl b/include/windows.management.deployment.idl index d78c64680f3..47906784c70 100644 --- a/include/windows.management.deployment.idl +++ b/include/windows.management.deployment.idl @@ -29,11 +29,14 @@ namespace Windows.Management.Deployment { typedef enum DeploymentProgressState DeploymentProgressState; typedef enum PackageInstallState PackageInstallState; typedef enum PackageState PackageState; + typedef enum PackageTypes PackageTypes; + typedef enum RemovalOptions RemovalOptions;
typedef struct DeploymentProgress DeploymentProgress;
interface IDeploymentResult; interface IPackageManager; + interface IPackageManager2; interface IPackageUserInformation;
runtimeclass DeploymentResult; @@ -99,6 +102,35 @@ namespace Windows.Management.Deployment { Tampered = 3, };
+ [contract(Windows.Foundation.UniversalApiContract, 1.0)] + [flags] + enum PackageTypes + { + None = 0x0, + Main = 0x1, + Framework = 0x2, + Resource = 0x4, + Bundle = 0x8, + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + Xap = 0x10, + [contract(Windows.Foundation.UniversalApiContract, 3.0)] + Optional = 0x20, + [contract(Windows.Foundation.UniversalApiContract, 10.0)] + All = 0xFFFFFFFF, + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + [flags] + enum RemovalOptions + { + None = 0x0, + PreserveApplicationData = 0x1000, + [contract(Windows.Foundation.UniversalApiContract, 10.0)] + PreserveRoamableApplicationData = 0x80, + [contract(Windows.Foundation.UniversalApiContract, 7.0)] + RemoveForAllUsers = 0x80000, + }; + [contract(Windows.Foundation.UniversalApiContract, 1.0)] struct DeploymentProgress { @@ -157,6 +189,44 @@ namespace Windows.Management.Deployment { HRESULT FindPackageByUserSecurityIdPackageFullName([in] HSTRING sid, [in] HSTRING name, [out, retval] Windows.ApplicationModel.Package **package); }
+ [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Management.Deployment.PackageManager), + uuid(f7aad08d-0840-46f2-b5d8-cad47693a095) + ] + interface IPackageManager2 : IInspectable + { + [overload("RemovePackageAsync")] + HRESULT RemovePackageWithOptionsAsync([in] HSTRING name, [in] Windows.Management.Deployment.RemovalOptions options, + [out, retval] Windows.Foundation.IAsyncOperationWithProgress<Windows.Management.Deployment.DeploymentResult *, Windows.Management.Deployment.DeploymentProgress> **operation); + [overload("StagePackageAsync")] + HRESULT StagePackageWithOptionsAsync([in] Windows.Foundation.Uri *uri, [in] Windows.Foundation.Collections.IIterable<Windows.Foundation.Uri *> *dependencies, + [in] Windows.Management.Deployment.DeploymentOptions options, + [out, retval] Windows.Foundation.IAsyncOperationWithProgress<Windows.Management.Deployment.DeploymentResult *, Windows.Management.Deployment.DeploymentProgress> **operation); + HRESULT RegisterPackageByFullNameAsync([in] HSTRING name, [in] Windows.Foundation.Collections.IIterable<HSTRING> *dependencies, + [in] Windows.Management.Deployment.DeploymentOptions options, + [out, retval] Windows.Foundation.IAsyncOperationWithProgress<Windows.Management.Deployment.DeploymentResult *, Windows.Management.Deployment.DeploymentProgress> **operation); + [overload("FindPackagesWithPackageTypes")] + HRESULT FindPackagesWithPackageTypes([in] Windows.Management.Deployment.PackageTypes types, [out, retval] Windows.Foundation.Collections.IIterable<Windows.ApplicationModel.Package *> **packages); + [overload("FindPackagesForUserWithPackageTypes")] + HRESULT FindPackagesByUserSecurityIdWithPackageTypes([in] HSTRING sid, [in] Windows.Management.Deployment.PackageTypes types, + [out, retval] Windows.Foundation.Collections.IIterable<Windows.ApplicationModel.Package *> **packages); + [overload("FindPackagesWithPackageTypes")] + HRESULT FindPackagesByNamePublisherWithPackageTypes([in] HSTRING name, [in] HSTRING publisher, [in] Windows.Management.Deployment.PackageTypes types, + [out, retval] Windows.Foundation.Collections.IIterable<Windows.ApplicationModel.Package *> **packages); + [overload("FindPackagesForUserWithPackageTypes")] + HRESULT FindPackagesByUserSecurityIdNamePublisherWithPackageTypes([in] HSTRING sid, [in] HSTRING name, [in] HSTRING publisher, [in] Windows.Management.Deployment.PackageTypes types, + [out, retval] Windows.Foundation.Collections.IIterable<Windows.ApplicationModel.Package *> **packages); + [overload("FindPackagesWithPackageTypes")] + HRESULT FindPackagesByPackageFamilyNameWithPackageTypes([in] HSTRING family_name, [in] Windows.Management.Deployment.PackageTypes types, + [out, retval] Windows.Foundation.Collections.IIterable<Windows.ApplicationModel.Package *> **packages); + [overload("FindPackagesForUserWithPackageTypes")] + HRESULT FindPackagesByUserSecurityIdPackageFamilyNameWithPackageTypes([in] HSTRING sid, [in] HSTRING family_name, [in] Windows.Management.Deployment.PackageTypes types, + [out, retval] Windows.Foundation.Collections.IIterable<Windows.ApplicationModel.Package *> **packages); + [overload("StageUserDataAsync")] + HRESULT StageUserDataAsync([in] HSTRING name, [out, retval] Windows.Foundation.IAsyncOperationWithProgress<Windows.Management.Deployment.DeploymentResult *, Windows.Management.Deployment.DeploymentProgress> **operation); + } + [ contract(Windows.Foundation.UniversalApiContract, 1.0), exclusiveto(Windows.Management.Deployment.PackageUserInformation),
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55403 --- dlls/appxdeploymentclient/package.c | 102 +++++++++++++++++++++++++ dlls/appxdeploymentclient/private.h | 38 +++++++++ dlls/appxdeploymentclient/tests/appx.c | 9 +++ 3 files changed, 149 insertions(+)
diff --git a/dlls/appxdeploymentclient/package.c b/dlls/appxdeploymentclient/package.c index 37af0fdaff4..50dcb0f928a 100644 --- a/dlls/appxdeploymentclient/package.c +++ b/dlls/appxdeploymentclient/package.c @@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(appx); struct package_manager { IPackageManager IPackageManager_iface; + IPackageManager2 IPackageManager2_iface; LONG ref; };
@@ -49,6 +50,13 @@ static HRESULT WINAPI package_manager_QueryInterface( IPackageManager *iface, RE return S_OK; }
+ if (IsEqualGUID( iid, &IID_IPackageManager2 )) + { + *out = &impl->IPackageManager2_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -226,6 +234,99 @@ static const struct IPackageManagerVtbl package_manager_vtbl = package_manager_FindPackageByUserSecurityIdPackageFullName };
+DEFINE_IINSPECTABLE( package_manager2, IPackageManager2, struct package_manager, IPackageManager_iface ); + +static HRESULT WINAPI package_manager2_RemovePackageWithOptionsAsync( IPackageManager2 *iface, HSTRING name, RemovalOptions options, + IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation ) +{ + FIXME( "iface %p, name %s, options %d, operation %p stub!\n", iface, debugstr_hstring(name), options, operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager2_StagePackageWithOptionsAsync( IPackageManager2 *iface, IUriRuntimeClass *uri, IIterable_Uri *dependencies, + DeploymentOptions options, IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation ) +{ + FIXME( "iface %p, uri %p, dependencies %p, options %d, operation %p stub!\n", iface, uri, dependencies, options, operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager2_RegisterPackageByFullNameAsync( IPackageManager2 *iface, HSTRING name, IIterable_HSTRING *dependencies, + DeploymentOptions options, IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation ) +{ + FIXME( "iface %p, name %s, dependencies %p, options %d, operation %p stub!\n", iface, debugstr_hstring(name), dependencies, options, operation ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager2_FindPackagesWithPackageTypes( IPackageManager2 *iface, PackageTypes types, IIterable_Package **packages ) +{ + FIXME( "iface %p, types %d, packages %p stub!\n", iface, types, packages ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager2_FindPackagesByUserSecurityIdWithPackageTypes( IPackageManager2 *iface, HSTRING sid, + PackageTypes types, IIterable_Package **packages ) +{ + FIXME( "iface %p, sid %s, types %d, packages %p stub!\n", iface, debugstr_hstring(sid), types, packages ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager2_FindPackagesByNamePublisherWithPackageTypes( IPackageManager2 *iface, HSTRING name, HSTRING publisher, + PackageTypes types, IIterable_Package **packages ) +{ + FIXME( "iface %p, name %s, publisher %s, types %d, packages %p stub!\n", iface, debugstr_hstring(name), debugstr_hstring(publisher), types, packages ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager2_FindPackagesByUserSecurityIdNamePublisherWithPackageTypes( IPackageManager2 *iface, HSTRING sid, HSTRING name, + HSTRING publisher, PackageTypes types, IIterable_Package **packages ) +{ + FIXME( "iface %p, sid %s, name %s, publisher %s, types %d, packages %p stub!\n", iface, debugstr_hstring(sid), debugstr_hstring(name), debugstr_hstring(publisher), types, packages ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager2_FindPackagesByPackageFamilyNameWithPackageTypes( IPackageManager2 *iface, HSTRING family_name, PackageTypes types, + IIterable_Package **packages ) +{ + FIXME( "iface %p, family_name %s, types %d, packages %p stub!\n", iface, debugstr_hstring(family_name), types, packages ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager2_FindPackagesByUserSecurityIdPackageFamilyNameWithPackageTypes( IPackageManager2 *iface, HSTRING sid, HSTRING family_name, + PackageTypes types, IIterable_Package **packages ) +{ + FIXME( "iface %p, sid %s, family_name %s, types %d, packages %p stub!\n", iface, debugstr_hstring(sid), debugstr_hstring(family_name), types, packages ); + return E_NOTIMPL; +} + +static HRESULT WINAPI package_manager2_StageUserDataAsync( IPackageManager2 *iface, HSTRING name, + IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation ) +{ + FIXME( "iface %p, name %s, operation %p stub!\n", iface, debugstr_hstring(name), operation ); + return E_NOTIMPL; +} + +static const struct IPackageManager2Vtbl package_manager2_vtbl = +{ + package_manager2_QueryInterface, + package_manager2_AddRef, + package_manager2_Release, + /* IInspectable methods */ + package_manager2_GetIids, + package_manager2_GetRuntimeClassName, + package_manager2_GetTrustLevel, + /* IPackageManager2 methods */ + package_manager2_RemovePackageWithOptionsAsync, + package_manager2_StagePackageWithOptionsAsync, + package_manager2_RegisterPackageByFullNameAsync, + package_manager2_FindPackagesWithPackageTypes, + package_manager2_FindPackagesByUserSecurityIdWithPackageTypes, + package_manager2_FindPackagesByNamePublisherWithPackageTypes, + package_manager2_FindPackagesByUserSecurityIdNamePublisherWithPackageTypes, + package_manager2_FindPackagesByPackageFamilyNameWithPackageTypes, + package_manager2_FindPackagesByUserSecurityIdPackageFamilyNameWithPackageTypes, + package_manager2_StageUserDataAsync, +}; + struct package_manager_statics { IActivationFactory IActivationFactory_iface; @@ -304,6 +405,7 @@ static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInsp }
impl->IPackageManager_iface.lpVtbl = &package_manager_vtbl; + impl->IPackageManager2_iface.lpVtbl = &package_manager2_vtbl; impl->ref = 1;
*instance = (IInspectable *)&impl->IPackageManager_iface; diff --git a/dlls/appxdeploymentclient/private.h b/dlls/appxdeploymentclient/private.h index aafbfed11a1..cc35ab9d7ec 100644 --- a/dlls/appxdeploymentclient/private.h +++ b/dlls/appxdeploymentclient/private.h @@ -38,4 +38,42 @@
extern IActivationFactory *package_manager_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/appxdeploymentclient/tests/appx.c b/dlls/appxdeploymentclient/tests/appx.c index 7ca1b0d62d5..39a714f873f 100644 --- a/dlls/appxdeploymentclient/tests/appx.c +++ b/dlls/appxdeploymentclient/tests/appx.c @@ -51,6 +51,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid, BOOL static void test_PackageManager(void) { static const WCHAR *package_manager_name = L"Windows.Management.Deployment.PackageManager"; + IPackageManager2 *package_manager2; IPackageManager *package_manager; IIterable_Package *packages; IActivationFactory *factory; @@ -101,6 +102,14 @@ static void test_PackageManager(void) WindowsDeleteString( str ); WindowsDeleteString( str2 );
+ hr = IPackageManager_QueryInterface( package_manager, &IID_IPackageManager2, (void **)&package_manager2 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + hr = IPackageManager2_FindPackagesWithPackageTypes( package_manager2, 1, &packages ); + todo_wine ok( hr == S_OK || broken ( hr == E_ACCESSDENIED /* Requires admin privileges */ ), "got hr %#lx.\n", hr ); + + ref = IPackageManager2_Release( package_manager2 ); + ok( ref == 2, "got ref %ld.\n", ref ); ref = IPackageManager_Release( package_manager ); ok( ref == 1, "got ref %ld.\n", ref ); ref = IInspectable_Release( inspectable );
Rémi Bernon (@rbernon) commented about dlls/appxdeploymentclient/tests/appx.c:
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( package_manager_name ) ); return;
```suggestion:-0+0 WindowsDeleteString( str ); return; ```
Rémi Bernon (@rbernon) commented about dlls/appxdeploymentclient/tests/appx.c:
ok( hr == S_OK, "got hr %#lx.\n", hr );
check_interface( inspectable, &IID_IAgileObject, TRUE );
hr = IPackageManager_FindPackagesByNamePublisher( package_manager, NULL, NULL, &packages );
ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr );
hr = WindowsCreateString( L"Wine", wcslen( L"Wine" ), &str );
ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = IPackageManager_FindPackagesByNamePublisher( package_manager, str, NULL, &packages );
ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr );
hr = WindowsCreateString( L"The Wine Project", wcslen( L"The Wine Project" ), &str2 );
ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = IPackageManager_FindPackagesByNamePublisher( package_manager, NULL, str2, &packages );
ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr );
hr = IPackageManager_FindPackagesByNamePublisher( package_manager, str, str2, &packages );
todo_wine ok( hr == S_OK || broken ( hr == E_ACCESSDENIED /* Requires admin privileges */ ) , "got hr %#lx.\n", hr );
```suggestion:-0+0 todo_wine ok( hr == S_OK || broken(hr == E_ACCESSDENIED) /* Requires admin privileges */, "got hr %#lx.\n", hr ); if (hr == S_OK) IIterable_Package_Release( packages ); ```
Rémi Bernon (@rbernon) commented about include/windows.management.deployment.idl:
- [contract(Windows.Foundation.UniversalApiContract, 1.0)]
- [flags]
- enum PackageTypes
- {
None = 0x0,
Main = 0x1,
Framework = 0x2,
Resource = 0x4,
Bundle = 0x8,
[contract(Windows.Foundation.UniversalApiContract, 1.0)]
Xap = 0x10,
[contract(Windows.Foundation.UniversalApiContract, 3.0)]
Optional = 0x20,
[contract(Windows.Foundation.UniversalApiContract, 10.0)]
All = 0xFFFFFFFF,
```suggestion:-0+0 All = 0xffffffff, ```
Rémi Bernon (@rbernon) commented about dlls/appxdeploymentclient/tests/appx.c:
WindowsDeleteString( str ); WindowsDeleteString( str2 );
- hr = IPackageManager_QueryInterface( package_manager, &IID_IPackageManager2, (void **)&package_manager2 );
- ok( hr == S_OK, "got hr %#lx.\n", hr );
- hr = IPackageManager2_FindPackagesWithPackageTypes( package_manager2, 1, &packages );
- todo_wine ok( hr == S_OK || broken ( hr == E_ACCESSDENIED /* Requires admin privileges */ ), "got hr %#lx.\n", hr );
```suggestion:-0+0 todo_wine ok( hr == S_OK || broken(hr == E_ACCESSDENIED) /* Requires admin privileges */, "got hr %#lx.\n", hr ); if (hr == S_OK) IIterable_Package_Release( packages ); ```
Made some comments on the tests but fwiw I think we'll have some package manager tests in applicationmodel after https://gitlab.winehq.org/wine/wine/-/merge_requests/3643, and I think it'd be better to have them in a single place (it doesn't matter too much if they aren't in the right module, WinRT has too many anyway). Plus you'll be able to test these lookup functions with actual registered package there.
On Thu Aug 31 05:45:32 2023 +0000, Rémi Bernon wrote:
Made some comments on the tests but fwiw I think we'll have some package manager tests in applicationmodel after https://gitlab.winehq.org/wine/wine/-/merge_requests/3643, and I think it'd be better to have them in a single place (it doesn't matter too much if they aren't in the right module, WinRT has too many anyway). Plus you'll be able to test these lookup functions with actual registered package there.
Sounds good, I'll wait until then to push the changes.