WindowsPackageManager.h (2408B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include <hstring.h> 5 6 // Forward declaration 7 namespace wil { struct FailureInfo; } 8 9 extern "C" 10 { 11 #define WINDOWS_PACKAGE_MANAGER_API_CALLING_CONVENTION __stdcall 12 #define WINDOWS_PACKAGE_MANAGER_API HRESULT WINDOWS_PACKAGE_MANAGER_API_CALLING_CONVENTION 13 14 using WindowsPackageManagerServerModuleTerminationCallback = void (*)(); 15 16 // The core function to act against command line input. 17 int WINDOWS_PACKAGE_MANAGER_API_CALLING_CONVENTION WindowsPackageManagerCLIMain(int argc, wchar_t const** argv); 18 19 // Initializes the Windows Package Manager COM server. 20 WINDOWS_PACKAGE_MANAGER_API WindowsPackageManagerServerInitialize(); 21 22 // Creates the server module with the given termination callback. 23 WINDOWS_PACKAGE_MANAGER_API WindowsPackageManagerServerModuleCreate(WindowsPackageManagerServerModuleTerminationCallback callback); 24 25 // Registers the server module class factories. 26 WINDOWS_PACKAGE_MANAGER_API WindowsPackageManagerServerModuleRegister(); 27 28 // Unregisters the server module class factories. 29 WINDOWS_PACKAGE_MANAGER_API WindowsPackageManagerServerModuleUnregister(); 30 31 // Callback for logging the WIL result reported from the server. 32 void WINDOWS_PACKAGE_MANAGER_API_CALLING_CONVENTION WindowsPackageManagerServerWilResultLoggingCallback(const wil::FailureInfo& info) noexcept; 33 34 // Creates an out-of-proc instance for manual activation scenarios. 35 WINDOWS_PACKAGE_MANAGER_API WindowsPackageManagerServerCreateInstance(REFCLSID rclsid, REFIID riid, void** out); 36 37 // Creates module for in-proc COM invocation. 38 WINDOWS_PACKAGE_MANAGER_API WindowsPackageManagerInProcModuleInitialize(); 39 40 // Try to terminate the module for in-proc COM. Returns false if there's still active objects. 41 bool WINDOWS_PACKAGE_MANAGER_API_CALLING_CONVENTION WindowsPackageManagerInProcModuleTerminate(); 42 43 // DllGetClassObject for in-proc COM for cpp winrt runtime classes. 44 WINDOWS_PACKAGE_MANAGER_API WindowsPackageManagerInProcModuleGetClassObject( 45 REFCLSID rclsid, 46 REFIID riid, 47 LPVOID* ppv); 48 49 // DllGetActivationFactory for in-proc cpp winrt runtime classes. 50 WINDOWS_PACKAGE_MANAGER_API WindowsPackageManagerInProcModuleGetActivationFactory(HSTRING classId, void** factory); 51 }