From 93cc820db48cdb304797c7d8e6ea7ea352fcf7c1 Mon Sep 17 00:00:00 2001 From: dahall Date: Tue, 26 Jul 2022 07:23:27 -0600 Subject: [PATCH] Fixed entrypoint #308 --- PInvoke/Kernel32/AppModel.cs | 4360 +++++++++++++++++++++--------------------- 1 file changed, 2180 insertions(+), 2180 deletions(-) diff --git a/PInvoke/Kernel32/AppModel.cs b/PInvoke/Kernel32/AppModel.cs index 675c6374..a4c948ca 100644 --- a/PInvoke/Kernel32/AppModel.cs +++ b/PInvoke/Kernel32/AppModel.cs @@ -4,523 +4,523 @@ using System.Text; namespace Vanara.PInvoke { - public static partial class Kernel32 - { - /// - /// Defines options that can be applied when adding a run-time reference to a framework package by using the AddPackageDependency function. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ne-appmodel-addpackagedependencyoptions typedef enum - // AddPackageDependencyOptions { AddPackageDependencyOptions_None, AddPackageDependencyOptions_PrependIfRankCollision } ; - [PInvokeData("appmodel.h", MSDNShortId = "NE:appmodel.AddPackageDependencyOptions")] - public enum AddPackageDependencyOptions - { - /// No options are applied. - AddPackageDependencyOptions_None, + public static partial class Kernel32 + { + /// + /// Defines options that can be applied when adding a run-time reference to a framework package by using the AddPackageDependency function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ne-appmodel-addpackagedependencyoptions typedef enum + // AddPackageDependencyOptions { AddPackageDependencyOptions_None, AddPackageDependencyOptions_PrependIfRankCollision } ; + [PInvokeData("appmodel.h", MSDNShortId = "NE:appmodel.AddPackageDependencyOptions")] + public enum AddPackageDependencyOptions + { + /// No options are applied. + AddPackageDependencyOptions_None, - /// - /// If multiple packages are present in the package graph with the same rank as the call to AddPackageDependency, the - /// resolved package is added before others of the same rank. - /// - AddPackageDependencyOptions_PrependIfRankCollision, - } + /// + /// If multiple packages are present in the package graph with the same rank as the call to AddPackageDependency, the + /// resolved package is added before others of the same rank. + /// + AddPackageDependencyOptions_PrependIfRankCollision, + } - /// - /// The AppPolicyCreateFileAccess enumeration indicates whether a process has full or restricted access to the IO devices (file, - /// file stream, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, and pipe). - /// - // typedef enum AppPolicyCreateFileAccess { AppPolicyCreateFileAccess_Full = 0, AppPolicyCreateFileAccess_Limited = 1} - // AppPolicyCreateFileAccess; https://msdn.microsoft.com/en-us/library/windows/desktop/mt829654(v=vs.85).aspx - [PInvokeData("AppModel.h", MSDNShortId = "mt829654")] - public enum AppPolicyCreateFileAccess - { - /// - /// Indicates that the process has full access to the IO devices. This value is expected for a desktop application, or for a - /// Desktop Bridge application. - /// - AppPolicyCreateFileAccess_Full, + /// + /// The AppPolicyCreateFileAccess enumeration indicates whether a process has full or restricted access to the IO devices (file, + /// file stream, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, and pipe). + /// + // typedef enum AppPolicyCreateFileAccess { AppPolicyCreateFileAccess_Full = 0, AppPolicyCreateFileAccess_Limited = 1} + // AppPolicyCreateFileAccess; https://msdn.microsoft.com/en-us/library/windows/desktop/mt829654(v=vs.85).aspx + [PInvokeData("AppModel.h", MSDNShortId = "mt829654")] + public enum AppPolicyCreateFileAccess + { + /// + /// Indicates that the process has full access to the IO devices. This value is expected for a desktop application, or for a + /// Desktop Bridge application. + /// + AppPolicyCreateFileAccess_Full, - /// Indicates that the process has limited access to the IO devices. This value is expected for a UWP app. - AppPolicyCreateFileAccess_Limited, - } + /// Indicates that the process has limited access to the IO devices. This value is expected for a UWP app. + AppPolicyCreateFileAccess_Limited, + } - /// The AppPolicyProcessTerminationMethod enumeration indicates the method used to end a process. - // typedef enum AppPolicyProcessTerminationMethod { AppPolicyProcessTerminationMethod_ExitProcess = 0, - // AppPolicyProcessTerminationMethod_TerminateProcess = 1} AppPolicyProcessTerminationMethod; https://msdn.microsoft.com/en-us/library/windows/desktop/mt829659(v=vs.85).aspx - [PInvokeData("AppModel.h", MSDNShortId = "mt829659")] - public enum AppPolicyProcessTerminationMethod - { - /// - /// Allows DLLs to execute code at shutdown. This value is expected for a desktop application, or for a Desktop Bridge application. - /// - AppPolicyProcessTerminationMethod_ExitProcess, + /// The AppPolicyProcessTerminationMethod enumeration indicates the method used to end a process. + // typedef enum AppPolicyProcessTerminationMethod { AppPolicyProcessTerminationMethod_ExitProcess = 0, + // AppPolicyProcessTerminationMethod_TerminateProcess = 1} AppPolicyProcessTerminationMethod; https://msdn.microsoft.com/en-us/library/windows/desktop/mt829659(v=vs.85).aspx + [PInvokeData("AppModel.h", MSDNShortId = "mt829659")] + public enum AppPolicyProcessTerminationMethod + { + /// + /// Allows DLLs to execute code at shutdown. This value is expected for a desktop application, or for a Desktop Bridge application. + /// + AppPolicyProcessTerminationMethod_ExitProcess, - /// Immediately ends the process. This value is expected for a UWP app. - AppPolicyProcessTerminationMethod_TerminateProcess, - } + /// Immediately ends the process. This value is expected for a UWP app. + AppPolicyProcessTerminationMethod_TerminateProcess, + } - /// - /// The AppPolicyShowDeveloperDiagnostic enumeration indicates the method used for a process to surface developer information, such - /// as asserts, to the user. - /// - // typedef enum AppPolicyShowDeveloperDiagnostic { AppPolicyShowDeveloperDiagnostic_None = 0, AppPolicyShowDeveloperDiagnostic_ShowUI - // = 1} AppPolicyShowDeveloperDiagnostic; https://msdn.microsoft.com/en-us/library/windows/desktop/mt829660(v=vs.85).aspx - [PInvokeData("AppModel.h", MSDNShortId = "mt829660")] - public enum AppPolicyShowDeveloperDiagnostic - { - /// Indicates that the process does not show developer diagnostics. This value is expected for a UWP app. - AppPolicyShowDeveloperDiagnostic_None, + /// + /// The AppPolicyShowDeveloperDiagnostic enumeration indicates the method used for a process to surface developer information, such + /// as asserts, to the user. + /// + // typedef enum AppPolicyShowDeveloperDiagnostic { AppPolicyShowDeveloperDiagnostic_None = 0, AppPolicyShowDeveloperDiagnostic_ShowUI + // = 1} AppPolicyShowDeveloperDiagnostic; https://msdn.microsoft.com/en-us/library/windows/desktop/mt829660(v=vs.85).aspx + [PInvokeData("AppModel.h", MSDNShortId = "mt829660")] + public enum AppPolicyShowDeveloperDiagnostic + { + /// Indicates that the process does not show developer diagnostics. This value is expected for a UWP app. + AppPolicyShowDeveloperDiagnostic_None, - /// - /// Indicates that the process shows developer diagnostics UI. This value is expected for a desktop application, or for a - /// Desktop Bridge application. - /// - AppPolicyShowDeveloperDiagnostic_ShowUI, - } + /// + /// Indicates that the process shows developer diagnostics UI. This value is expected for a desktop application, or for a + /// Desktop Bridge application. + /// + AppPolicyShowDeveloperDiagnostic_ShowUI, + } - /// - /// The AppPolicyThreadInitializationType enumeration indicates the kind of initialization that should be automatically performed - /// for a process when beginthread[ex] creates a thread. - /// - // typedef enum AppPolicyThreadInitializationType { AppPolicyThreadInitializationType_None = 0, - // AppPolicyThreadInitializationType_InitializeWinRT = 1} AppPolicyThreadInitializationType; https://msdn.microsoft.com/en-us/library/windows/desktop/mt829661(v=vs.85).aspx - [PInvokeData("AppModel.h", MSDNShortId = "mt829661")] - public enum AppPolicyThreadInitializationType - { - /// Indicates that no initialization should be performed. - AppPolicyThreadInitializationType_None, + /// + /// The AppPolicyThreadInitializationType enumeration indicates the kind of initialization that should be automatically performed + /// for a process when beginthread[ex] creates a thread. + /// + // typedef enum AppPolicyThreadInitializationType { AppPolicyThreadInitializationType_None = 0, + // AppPolicyThreadInitializationType_InitializeWinRT = 1} AppPolicyThreadInitializationType; https://msdn.microsoft.com/en-us/library/windows/desktop/mt829661(v=vs.85).aspx + [PInvokeData("AppModel.h", MSDNShortId = "mt829661")] + public enum AppPolicyThreadInitializationType + { + /// Indicates that no initialization should be performed. + AppPolicyThreadInitializationType_None, - /// Indicates that Windows Runtime initialization should be performed. - AppPolicyThreadInitializationType_InitializeWinRT, - } + /// Indicates that Windows Runtime initialization should be performed. + AppPolicyThreadInitializationType_InitializeWinRT, + } - /// - /// Specifies the processor architectures supported by a package. - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appxpackaging/ne-appxpackaging-appx_package_architecture typedef enum - // APPX_PACKAGE_ARCHITECTURE { APPX_PACKAGE_ARCHITECTURE_X86 , APPX_PACKAGE_ARCHITECTURE_ARM , APPX_PACKAGE_ARCHITECTURE_X64 , - // APPX_PACKAGE_ARCHITECTURE_NEUTRAL , APPX_PACKAGE_ARCHITECTURE_ARM64 } ; - [PInvokeData("appxpackaging.h", MSDNShortId = "8BC7ABF0-448F-4405-AA82-49C6DB3F230C")] - public enum APPX_PACKAGE_ARCHITECTURE - { - /// The x86 processor architecture. - APPX_PACKAGE_ARCHITECTURE_X86 = 0, + /// + /// Specifies the processor architectures supported by a package. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appxpackaging/ne-appxpackaging-appx_package_architecture typedef enum + // APPX_PACKAGE_ARCHITECTURE { APPX_PACKAGE_ARCHITECTURE_X86 , APPX_PACKAGE_ARCHITECTURE_ARM , APPX_PACKAGE_ARCHITECTURE_X64 , + // APPX_PACKAGE_ARCHITECTURE_NEUTRAL , APPX_PACKAGE_ARCHITECTURE_ARM64 } ; + [PInvokeData("appxpackaging.h", MSDNShortId = "8BC7ABF0-448F-4405-AA82-49C6DB3F230C")] + public enum APPX_PACKAGE_ARCHITECTURE + { + /// The x86 processor architecture. + APPX_PACKAGE_ARCHITECTURE_X86 = 0, - /// The ARM processor architecture. - APPX_PACKAGE_ARCHITECTURE_ARM = 5, + /// The ARM processor architecture. + APPX_PACKAGE_ARCHITECTURE_ARM = 5, - /// The x64 processor architecture. - APPX_PACKAGE_ARCHITECTURE_X64 = 9, + /// The x64 processor architecture. + APPX_PACKAGE_ARCHITECTURE_X64 = 9, - /// Any processor architecture. - APPX_PACKAGE_ARCHITECTURE_NEUTRAL = 11, + /// Any processor architecture. + APPX_PACKAGE_ARCHITECTURE_NEUTRAL = 11, - /// The 64-bit ARM processor architecture. - APPX_PACKAGE_ARCHITECTURE_ARM64 = 12, - } + /// The 64-bit ARM processor architecture. + APPX_PACKAGE_ARCHITECTURE_ARM64 = 12, + } - /// Defines options that can be applied when creating a package dependency by using the TryCreatePackageDependency function. - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ne-appmodel-createpackagedependencyoptions typedef enum - // CreatePackageDependencyOptions { CreatePackageDependencyOptions_None, - // CreatePackageDependencyOptions_DoNotVerifyDependencyResolution, CreatePackageDependencyOptions_ScopeIsSystem } ; - [PInvokeData("appmodel.h", MSDNShortId = "NE:appmodel.CreatePackageDependencyOptions")] - [Flags] - public enum CreatePackageDependencyOptions - { - /// No options are applied. - CreatePackageDependencyOptions_None = 0, + /// Defines options that can be applied when creating a package dependency by using the TryCreatePackageDependency function. + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ne-appmodel-createpackagedependencyoptions typedef enum + // CreatePackageDependencyOptions { CreatePackageDependencyOptions_None, + // CreatePackageDependencyOptions_DoNotVerifyDependencyResolution, CreatePackageDependencyOptions_ScopeIsSystem } ; + [PInvokeData("appmodel.h", MSDNShortId = "NE:appmodel.CreatePackageDependencyOptions")] + [Flags] + public enum CreatePackageDependencyOptions + { + /// No options are applied. + CreatePackageDependencyOptions_None = 0, - /// - /// Disables dependency resolution when pinning a package dependency. This is useful for installers running as user contexts - /// other than the target user (for example, installers running as LocalSystem). - /// - CreatePackageDependencyOptions_DoNotVerifyDependencyResolution = 1, + /// + /// Disables dependency resolution when pinning a package dependency. This is useful for installers running as user contexts + /// other than the target user (for example, installers running as LocalSystem). + /// + CreatePackageDependencyOptions_DoNotVerifyDependencyResolution = 1, - /// - /// Defines the package dependency for the system, accessible to all users (by default, the package dependency is defined for a - /// specific user). This option requires the caller has administrative privileges. - /// - CreatePackageDependencyOptions_ScopeIsSystem = 2, - } + /// + /// Defines the package dependency for the system, accessible to all users (by default, the package dependency is defined for a + /// specific user). This option requires the caller has administrative privileges. + /// + CreatePackageDependencyOptions_ScopeIsSystem = 2, + } - /// Specifies how packages are to be processed. - // https://docs.microsoft.com/en-us/windows/desktop/appxpkg/package-constants - [PInvokeData("", MSDNShortId = "72E565C3-6CFD-47E3-8BAC-17D6E86B99DA")] - [Flags] - public enum PACKAGE_FLAGS : uint - { - /// The maximum number of apps in a package. - PACKAGE_APPLICATIONS_MAX_COUNT = 100, + /// Specifies how packages are to be processed. + // https://docs.microsoft.com/en-us/windows/desktop/appxpkg/package-constants + [PInvokeData("", MSDNShortId = "72E565C3-6CFD-47E3-8BAC-17D6E86B99DA")] + [Flags] + public enum PACKAGE_FLAGS : uint + { + /// The maximum number of apps in a package. + PACKAGE_APPLICATIONS_MAX_COUNT = 100, - /// The minimum number of apps in a package. - PACKAGE_APPLICATIONS_MIN_COUNT = 0, + /// The minimum number of apps in a package. + PACKAGE_APPLICATIONS_MIN_COUNT = 0, - /// The maximum number of resource packages a package can have. - PACKAGE_FAMILY_MAX_RESOURCE_PACKAGES = 512, + /// The maximum number of resource packages a package can have. + PACKAGE_FAMILY_MAX_RESOURCE_PACKAGES = 512, - /// The minimum number of resource packages a package can have. - PACKAGE_FAMILY_MIN_RESOURCE_PACKAGES = 0, + /// The minimum number of resource packages a package can have. + PACKAGE_FAMILY_MIN_RESOURCE_PACKAGES = 0, - /// - /// Process all packages in the dependency graph. This is equivalent to PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT. Note: - /// PACKAGE_FILTER_ALL_LOADED may be altered or unavailable for releases after Windows 8.1. Instead, use PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT. - /// - PACKAGE_FILTER_ALL_LOADED = 0x00000000, + /// + /// Process all packages in the dependency graph. This is equivalent to PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT. Note: + /// PACKAGE_FILTER_ALL_LOADED may be altered or unavailable for releases after Windows 8.1. Instead, use PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT. + /// + PACKAGE_FILTER_ALL_LOADED = 0x00000000, - /// Process bundle packages in the package graph. - PACKAGE_FILTER_BUNDLE = 0x00000080, + /// Process bundle packages in the package graph. + PACKAGE_FILTER_BUNDLE = 0x00000080, - /// Process the directly dependent packages of the head (first) package in the dependency graph. - PACKAGE_FILTER_DIRECT = 0x00000020, + /// Process the directly dependent packages of the head (first) package in the dependency graph. + PACKAGE_FILTER_DIRECT = 0x00000020, - /// Process the first package in the dependency graph. - PACKAGE_FILTER_HEAD = 0x00000010, + /// Process the first package in the dependency graph. + PACKAGE_FILTER_HEAD = 0x00000010, - /// Process bundle packages in the package graph. - PACKAGE_FILTER_OPTIONAL = 0x00020000, + /// Process bundle packages in the package graph. + PACKAGE_FILTER_OPTIONAL = 0x00020000, - /// Process resource packages in the package graph. - PACKAGE_FILTER_RESOURCE = 0x00000040, + /// Process resource packages in the package graph. + PACKAGE_FILTER_RESOURCE = 0x00000040, - /// The maximum size of a package graph. - PACKAGE_GRAPH_MAX_SIZE = (1 + PACKAGE_MAX_DEPENDENCIES + PACKAGE_FAMILY_MAX_RESOURCE_PACKAGES), + /// The maximum size of a package graph. + PACKAGE_GRAPH_MAX_SIZE = (1 + PACKAGE_MAX_DEPENDENCIES + PACKAGE_FAMILY_MAX_RESOURCE_PACKAGES), - /// The minimum size of a package graph. - PACKAGE_GRAPH_MIN_SIZE = 1, + /// The minimum size of a package graph. + PACKAGE_GRAPH_MIN_SIZE = 1, - /// Retrieve basic information. - PACKAGE_INFORMATION_BASIC = 0x00000000, + /// Retrieve basic information. + PACKAGE_INFORMATION_BASIC = 0x00000000, - /// Retrieve full information. - PACKAGE_INFORMATION_FULL = 0x00000100, + /// Retrieve full information. + PACKAGE_INFORMATION_FULL = 0x00000100, - /// The maximum number of packages a package depends on. - PACKAGE_MAX_DEPENDENCIES = 128, + /// The maximum number of packages a package depends on. + PACKAGE_MAX_DEPENDENCIES = 128, - /// The minimum number of packages a package depends on. - PACKAGE_MIN_DEPENDENCIES = 0, + /// The minimum number of packages a package depends on. + PACKAGE_MIN_DEPENDENCIES = 0, - /// The package is a bundle package. - PACKAGE_PROPERTY_BUNDLE = 0x00000004, + /// The package is a bundle package. + PACKAGE_PROPERTY_BUNDLE = 0x00000004, - /// The package was registered with the DeploymentOptions enumeration. - PACKAGE_PROPERTY_DEVELOPMENT_MODE = 0x00010000, + /// The package was registered with the DeploymentOptions enumeration. + PACKAGE_PROPERTY_DEVELOPMENT_MODE = 0x00010000, - /// The package is a framework. - PACKAGE_PROPERTY_FRAMEWORK = 0x00000001, + /// The package is a framework. + PACKAGE_PROPERTY_FRAMEWORK = 0x00000001, - /// The package is an optional package. - PACKAGE_PROPERTY_OPTIONAL = 0x00000008, + /// The package is an optional package. + PACKAGE_PROPERTY_OPTIONAL = 0x00000008, - /// The package is a resource package. - PACKAGE_PROPERTY_RESOURCE = 0x00000002, - } + /// The package is a resource package. + PACKAGE_PROPERTY_RESOURCE = 0x00000002, + } - /// Specifies values that indicate the type of artifact that is used to define the lifetime of a package dependency. - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ne-appmodel-packagedependencylifetimekind typedef enum - // PackageDependencyLifetimeKind { PackageDependencyLifetimeKind_Process, PackageDependencyLifetimeKind_FilePath, - // PackageDependencyLifetimeKind_RegistryKey } ; - [PInvokeData("appmodel.h", MSDNShortId = "NE:appmodel.PackageDependencyLifetimeKind")] - public enum PackageDependencyLifetimeKind - { - /// - /// The current process is the lifetime artifact. The package dependency is implicitly deleted when the process terminates. - /// - PackageDependencyLifetimeKind_Process, + /// Specifies values that indicate the type of artifact that is used to define the lifetime of a package dependency. + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ne-appmodel-packagedependencylifetimekind typedef enum + // PackageDependencyLifetimeKind { PackageDependencyLifetimeKind_Process, PackageDependencyLifetimeKind_FilePath, + // PackageDependencyLifetimeKind_RegistryKey } ; + [PInvokeData("appmodel.h", MSDNShortId = "NE:appmodel.PackageDependencyLifetimeKind")] + public enum PackageDependencyLifetimeKind + { + /// + /// The current process is the lifetime artifact. The package dependency is implicitly deleted when the process terminates. + /// + PackageDependencyLifetimeKind_Process, - /// - /// The lifetime artifact is an absolute filename or path. The package dependency is implicitly deleted when this is deleted. - /// - PackageDependencyLifetimeKind_FilePath, + /// + /// The lifetime artifact is an absolute filename or path. The package dependency is implicitly deleted when this is deleted. + /// + PackageDependencyLifetimeKind_FilePath, - /// - /// The lifetime artifact is a registry key in the format - /// root - /// \ - /// subkey - /// , where - /// root - /// - /// is one of the following: HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER, HKEY_CLASSES_ROOT, or HKEY_USERS. The package dependency is - /// implicitly deleted when this is deleted. - /// - /// - PackageDependencyLifetimeKind_RegistryKey, - } + /// + /// The lifetime artifact is a registry key in the format + /// root + /// \ + /// subkey + /// , where + /// root + /// + /// is one of the following: HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER, HKEY_CLASSES_ROOT, or HKEY_USERS. The package dependency is + /// implicitly deleted when this is deleted. + /// + /// + PackageDependencyLifetimeKind_RegistryKey, + } - /// - /// Defines the processor architectures for a framework package dependency that you create by using the TryCreatePackageDependency function. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ne-appmodel-packagedependencyprocessorarchitectures typedef enum - // PackageDependencyProcessorArchitectures { PackageDependencyProcessorArchitectures_None, - // PackageDependencyProcessorArchitectures_Neutral, PackageDependencyProcessorArchitectures_X86, - // PackageDependencyProcessorArchitectures_X64, PackageDependencyProcessorArchitectures_Arm, - // PackageDependencyProcessorArchitectures_Arm64, PackageDependencyProcessorArchitectures_X86A64 } ; - [PInvokeData("appmodel.h", MSDNShortId = "NE:appmodel.PackageDependencyProcessorArchitectures")] - [Flags] - public enum PackageDependencyProcessorArchitectures - { - /// No processor architecture is specified. - PackageDependencyProcessorArchitectures_None = 0x0000, + /// + /// Defines the processor architectures for a framework package dependency that you create by using the TryCreatePackageDependency function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ne-appmodel-packagedependencyprocessorarchitectures typedef enum + // PackageDependencyProcessorArchitectures { PackageDependencyProcessorArchitectures_None, + // PackageDependencyProcessorArchitectures_Neutral, PackageDependencyProcessorArchitectures_X86, + // PackageDependencyProcessorArchitectures_X64, PackageDependencyProcessorArchitectures_Arm, + // PackageDependencyProcessorArchitectures_Arm64, PackageDependencyProcessorArchitectures_X86A64 } ; + [PInvokeData("appmodel.h", MSDNShortId = "NE:appmodel.PackageDependencyProcessorArchitectures")] + [Flags] + public enum PackageDependencyProcessorArchitectures + { + /// No processor architecture is specified. + PackageDependencyProcessorArchitectures_None = 0x0000, - /// Specifies the neutral architecture. - PackageDependencyProcessorArchitectures_Neutral = 0x0001, + /// Specifies the neutral architecture. + PackageDependencyProcessorArchitectures_Neutral = 0x0001, - /// Specifies the x86 architecture. - PackageDependencyProcessorArchitectures_X86 = 0x0002, + /// Specifies the x86 architecture. + PackageDependencyProcessorArchitectures_X86 = 0x0002, - /// Specifies the x64 architecture. - PackageDependencyProcessorArchitectures_X64 = 0x0004, + /// Specifies the x64 architecture. + PackageDependencyProcessorArchitectures_X64 = 0x0004, - /// Specifies the ARM architecture. - PackageDependencyProcessorArchitectures_Arm = 0x0008, + /// Specifies the ARM architecture. + PackageDependencyProcessorArchitectures_Arm = 0x0008, - /// Specifies the ARM64 architecture. - PackageDependencyProcessorArchitectures_Arm64 = 0x0010, + /// Specifies the ARM64 architecture. + PackageDependencyProcessorArchitectures_Arm64 = 0x0010, - /// Specifies the x86/A64 architecture. - PackageDependencyProcessorArchitectures_X86A64 = 0x0020, - } + /// Specifies the x86/A64 architecture. + PackageDependencyProcessorArchitectures_X86A64 = 0x0020, + } - /// - /// Specifies the origin of a package. - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/ne-appmodel-packageorigin typedef enum PackageOrigin { - // PackageOrigin_Unknown , PackageOrigin_Unsigned , PackageOrigin_Inbox , PackageOrigin_Store , PackageOrigin_DeveloperUnsigned , - // PackageOrigin_DeveloperSigned , PackageOrigin_LineOfBusiness } ; - [PInvokeData("appmodel.h", MSDNShortId = "0CB9CE97-8A54-4BE7-B054-00F29D36CAB2")] - public enum PackageOrigin - { - /// The package's origin is unknown. - PackageOrigin_Unknown, + /// + /// Specifies the origin of a package. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/ne-appmodel-packageorigin typedef enum PackageOrigin { + // PackageOrigin_Unknown , PackageOrigin_Unsigned , PackageOrigin_Inbox , PackageOrigin_Store , PackageOrigin_DeveloperUnsigned , + // PackageOrigin_DeveloperSigned , PackageOrigin_LineOfBusiness } ; + [PInvokeData("appmodel.h", MSDNShortId = "0CB9CE97-8A54-4BE7-B054-00F29D36CAB2")] + public enum PackageOrigin + { + /// The package's origin is unknown. + PackageOrigin_Unknown, - /// The package originated as unsigned. - PackageOrigin_Unsigned, + /// The package originated as unsigned. + PackageOrigin_Unsigned, - /// The package was included inbox. - PackageOrigin_Inbox, + /// The package was included inbox. + PackageOrigin_Inbox, - /// The package originated from the Windows Store. - PackageOrigin_Store, + /// The package originated from the Windows Store. + PackageOrigin_Store, - /// The package originated as developer unsigned. - PackageOrigin_DeveloperUnsigned, + /// The package originated as developer unsigned. + PackageOrigin_DeveloperUnsigned, - /// The package originated as developer signed. - PackageOrigin_DeveloperSigned, + /// The package originated as developer signed. + PackageOrigin_DeveloperSigned, - /// The package originated as a line-of-business app. - PackageOrigin_LineOfBusiness, - } + /// The package originated as a line-of-business app. + PackageOrigin_LineOfBusiness, + } - /// Indicates the type of folder path to retrieve in a query for the path or other info about a package. - /// - /// An application has a mutable install folder if it uses the windows.mutablePackageDirectories extension in its package manifest. - /// This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of the application's - /// install folder are projected so that users can modify the installation files. This feature is currently available only for - /// certain types of desktop PC games that are published by Microsoft and our partners, and it enables these types of games to - /// support mods. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ne-appmodel-packagepathtype typedef enum PackagePathType { - // PackagePathType_Install, PackagePathType_Mutable, PackagePathType_Effective } ; - [PInvokeData("appmodel.h")] - public enum PackagePathType - { - /// Retrieve the package path in the original install folder for the application. - PackagePathType_Install, + /// Indicates the type of folder path to retrieve in a query for the path or other info about a package. + /// + /// An application has a mutable install folder if it uses the windows.mutablePackageDirectories extension in its package manifest. + /// This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of the application's + /// install folder are projected so that users can modify the installation files. This feature is currently available only for + /// certain types of desktop PC games that are published by Microsoft and our partners, and it enables these types of games to + /// support mods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ne-appmodel-packagepathtype typedef enum PackagePathType { + // PackagePathType_Install, PackagePathType_Mutable, PackagePathType_Effective } ; + [PInvokeData("appmodel.h")] + public enum PackagePathType + { + /// Retrieve the package path in the original install folder for the application. + PackagePathType_Install, - /// - /// Retrieve the package path in the mutable install folder for the application, if the application is declared as mutable in - /// the package manifest. - /// - PackagePathType_Mutable, + /// + /// Retrieve the package path in the mutable install folder for the application, if the application is declared as mutable in + /// the package manifest. + /// + PackagePathType_Mutable, - /// - /// Retrieve the package path in the mutable folder if the application is declared as mutable in the package manifest, or in the - /// original install folder if the application is not mutable. - /// - PackagePathType_Effective - } + /// + /// Retrieve the package path in the mutable folder if the application is declared as mutable in the package manifest, or in the + /// original install folder if the application is not mutable. + /// + PackagePathType_Effective + } - /// - /// Adds a run-time reference for the framework package dependency you created earlier by using the TryCreatePackageDependency - /// method, with the specified options. After this method successfully returns, your app can activate types and use content from the - /// framework package. - /// - /// - /// Type: PCWSTR - /// - /// The ID of the package dependency to be resolved and added to the invoking process' package graph. This parameter must match a - /// package dependency defined by using the TryCreatePackageDependency function for the calling user or the system (via the - /// CreatePackageDependencyOptions_ScopeIsSystem option), or else an error is returned. - /// - /// - /// - /// Type: INT32 - /// The rank to use to add the resolved package to the caller's package graph. For more information, see the remarks. - /// - /// - /// Type: AddPackageDependencyOptions - /// The options to apply when adding the package dependency. - /// - /// - /// Type: PACKAGEDEPENDENCY_CONTEXT* - /// The handle of the added package dependency. This handle is valid until it is passed to RemovePackageDependency. - /// - /// - /// Type: PCWSTR* - /// - /// The full name of the package to which the dependency has been resolved. Use the HeapAlloc function to allocate memory for this - /// parameter, and use HeapFree to deallocate the memory. - /// - /// - /// - /// Type: HRESULT - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// E_INVALIDARG - /// The packageDependencyId or packageDependencyContext parameter is NULL on input. - /// - /// - /// - /// - /// - /// Calling this method resolves the framework package dependency to a specific package on the system. It also informs the OS that - /// the framework package is in active use and to handle any version updates in a side-by-side manner (effectively delay - /// uninstalling or otherwise servicing the older version until after your app is done using it). Package resolution is specific to - /// a user and can return different values for different users on a system. - /// - /// - /// Each successful AddPackageDependency call adds the resolved package to the calling process' package graph, even if - /// already present. There is no duplicate detection or filtering applied by the API (that is, multiple references from a package is - /// not harmful). After resolution is complete, the package dependency stays resolved for that user until the last reference across - /// all processes for that user is removed via RemovePackageDependency or the process is terminated. - /// - /// - /// After this method successfully returns, your app can activate types and use content from the framework package until - /// RemovePackageDependency is called. - /// - /// - /// If multiple packages are present in the package graph with the same rank as the call to AddPackageDependency, the - /// resolved package is (by default) added after others of the same rank. To add a package before others of the same rank, specify - /// AddPackageDependencyOptions_PrependIfRankCollision for the options parameter. - /// - /// For more information, see Use the dynamic dependency API to reference framework packages at run time. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-addpackagedependency HRESULT AddPackageDependency( PCWSTR - // packageDependencyId, INT32 rank, AddPackageDependencyOptions options, PACKAGEDEPENDENCY_CONTEXT *packageDependencyContext, PWSTR - // *packageFullName ); - [DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "NF:appmodel.AddPackageDependency")] - public static extern HRESULT AddPackageDependency([MarshalAs(UnmanagedType.LPWStr)] string packageDependencyId, int rank, - AddPackageDependencyOptions options, out PACKAGEDEPENDENCY_CONTEXT packageDependencyContext, out SafeHeapBlock packageFullName); + /// + /// Adds a run-time reference for the framework package dependency you created earlier by using the TryCreatePackageDependency + /// method, with the specified options. After this method successfully returns, your app can activate types and use content from the + /// framework package. + /// + /// + /// Type: PCWSTR + /// + /// The ID of the package dependency to be resolved and added to the invoking process' package graph. This parameter must match a + /// package dependency defined by using the TryCreatePackageDependency function for the calling user or the system (via the + /// CreatePackageDependencyOptions_ScopeIsSystem option), or else an error is returned. + /// + /// + /// + /// Type: INT32 + /// The rank to use to add the resolved package to the caller's package graph. For more information, see the remarks. + /// + /// + /// Type: AddPackageDependencyOptions + /// The options to apply when adding the package dependency. + /// + /// + /// Type: PACKAGEDEPENDENCY_CONTEXT* + /// The handle of the added package dependency. This handle is valid until it is passed to RemovePackageDependency. + /// + /// + /// Type: PCWSTR* + /// + /// The full name of the package to which the dependency has been resolved. Use the HeapAlloc function to allocate memory for this + /// parameter, and use HeapFree to deallocate the memory. + /// + /// + /// + /// Type: HRESULT + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// E_INVALIDARG + /// The packageDependencyId or packageDependencyContext parameter is NULL on input. + /// + /// + /// + /// + /// + /// Calling this method resolves the framework package dependency to a specific package on the system. It also informs the OS that + /// the framework package is in active use and to handle any version updates in a side-by-side manner (effectively delay + /// uninstalling or otherwise servicing the older version until after your app is done using it). Package resolution is specific to + /// a user and can return different values for different users on a system. + /// + /// + /// Each successful AddPackageDependency call adds the resolved package to the calling process' package graph, even if + /// already present. There is no duplicate detection or filtering applied by the API (that is, multiple references from a package is + /// not harmful). After resolution is complete, the package dependency stays resolved for that user until the last reference across + /// all processes for that user is removed via RemovePackageDependency or the process is terminated. + /// + /// + /// After this method successfully returns, your app can activate types and use content from the framework package until + /// RemovePackageDependency is called. + /// + /// + /// If multiple packages are present in the package graph with the same rank as the call to AddPackageDependency, the + /// resolved package is (by default) added after others of the same rank. To add a package before others of the same rank, specify + /// AddPackageDependencyOptions_PrependIfRankCollision for the options parameter. + /// + /// For more information, see Use the dynamic dependency API to reference framework packages at run time. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-addpackagedependency HRESULT AddPackageDependency( PCWSTR + // packageDependencyId, INT32 rank, AddPackageDependencyOptions options, PACKAGEDEPENDENCY_CONTEXT *packageDependencyContext, PWSTR + // *packageFullName ); + [DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "NF:appmodel.AddPackageDependency")] + public static extern HRESULT AddPackageDependency([MarshalAs(UnmanagedType.LPWStr)] string packageDependencyId, int rank, + AddPackageDependencyOptions options, out PACKAGEDEPENDENCY_CONTEXT packageDependencyContext, out SafeHeapBlock packageFullName); - /// - /// Retrieves a value indicating whether a process has full or restricted access to the IO devices (file, file stream, directory, - /// physical disk, volume, console buffer, tape drive, communications resource, mailslot, and pipe). - /// - /// A handle that identifies the access token for a process. - /// - /// A pointer to a variable of the AppPolicyCreateFileAccess enumerated type. When the function returns successfully, the - /// variable contains an enumerated constant value indicating whether the process has full or restricted access to the IO devices. - /// - /// - /// If the function succeeds, the function returns ERROR_SUCCESS. - /// - /// If no known create file access policy was found for the process token, the function raises a STATUS_ASSERTION_FAILURE exception - /// and returns ERROR_NOT_FOUND. - /// - /// If either processToken or policy are null, the function returns ERROR_INVALID_PARAMETER. - /// - // LONG WINAPI AppPolicyGetCreateFileAccess( _In_ HANDLE processToken, _Out_ AppPolicyCreateFileAccess *policy); https://msdn.microsoft.com/en-us/library/windows/desktop/mt829655(v=vs.85).aspx - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("AppModel.h", MSDNShortId = "mt829655")] - public static extern Win32Error AppPolicyGetCreateFileAccess(HTOKEN processToken, out AppPolicyCreateFileAccess policy); + /// + /// Retrieves a value indicating whether a process has full or restricted access to the IO devices (file, file stream, directory, + /// physical disk, volume, console buffer, tape drive, communications resource, mailslot, and pipe). + /// + /// A handle that identifies the access token for a process. + /// + /// A pointer to a variable of the AppPolicyCreateFileAccess enumerated type. When the function returns successfully, the + /// variable contains an enumerated constant value indicating whether the process has full or restricted access to the IO devices. + /// + /// + /// If the function succeeds, the function returns ERROR_SUCCESS. + /// + /// If no known create file access policy was found for the process token, the function raises a STATUS_ASSERTION_FAILURE exception + /// and returns ERROR_NOT_FOUND. + /// + /// If either processToken or policy are null, the function returns ERROR_INVALID_PARAMETER. + /// + // LONG WINAPI AppPolicyGetCreateFileAccess( _In_ HANDLE processToken, _Out_ AppPolicyCreateFileAccess *policy); https://msdn.microsoft.com/en-us/library/windows/desktop/mt829655(v=vs.85).aspx + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("AppModel.h", MSDNShortId = "mt829655")] + public static extern Win32Error AppPolicyGetCreateFileAccess(HTOKEN processToken, out AppPolicyCreateFileAccess policy); - /// Retrieves the method used to end a process. - /// A handle that identifies the access token for a process. - /// - /// A pointer to a variable of the AppPolicyProcessTerminationMethod enumerated type. When the function returns successfully, - /// the variable contains a value indicating the method used to end the process. - /// - /// - /// If the function succeeds, the function returns ERROR_SUCCESS. - /// - /// If no known create file access policy was found for the process token, the function raises a STATUS_ASSERTION_FAILURE exception - /// and returns ERROR_NOT_FOUND. - /// - /// If either processToken or policy are null, the function returns ERROR_INVALID_PARAMETER. - /// - // LONG WINAPI AppPolicyGetProcessTerminationMethod( _In_ HANDLE processToken, _Out_ AppPolicyProcessTerminationMethod *policy); https://msdn.microsoft.com/en-us/library/windows/desktop/mt829656(v=vs.85).aspx - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("AppModel.h", MSDNShortId = "mt829656")] - public static extern Win32Error AppPolicyGetProcessTerminationMethod(HTOKEN processToken, out AppPolicyProcessTerminationMethod policy); + /// Retrieves the method used to end a process. + /// A handle that identifies the access token for a process. + /// + /// A pointer to a variable of the AppPolicyProcessTerminationMethod enumerated type. When the function returns successfully, + /// the variable contains a value indicating the method used to end the process. + /// + /// + /// If the function succeeds, the function returns ERROR_SUCCESS. + /// + /// If no known create file access policy was found for the process token, the function raises a STATUS_ASSERTION_FAILURE exception + /// and returns ERROR_NOT_FOUND. + /// + /// If either processToken or policy are null, the function returns ERROR_INVALID_PARAMETER. + /// + // LONG WINAPI AppPolicyGetProcessTerminationMethod( _In_ HANDLE processToken, _Out_ AppPolicyProcessTerminationMethod *policy); https://msdn.microsoft.com/en-us/library/windows/desktop/mt829656(v=vs.85).aspx + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("AppModel.h", MSDNShortId = "mt829656")] + public static extern Win32Error AppPolicyGetProcessTerminationMethod(HTOKEN processToken, out AppPolicyProcessTerminationMethod policy); - /// Retrieves the method used for a process to surface developer information, such as asserts, to the user. - /// A handle that identifies the access token for a process. - /// - /// A pointer to a variable of the AppPolicyShowDeveloperDiagnostic enumerated type. When the function returns successfully, - /// the variable contains a value indicating the method used for the process to surface developer information, such as asserts, to - /// the user. - /// - /// - /// If the function succeeds, the function returns ERROR_SUCCESS. - /// - /// If no known create file access policy was found for the process token, the function raises a STATUS_ASSERTION_FAILURE exception - /// and returns ERROR_NOT_FOUND. - /// - /// If either processToken or policy are null, the function returns ERROR_INVALID_PARAMETER. - /// - // LONG WINAPI AppPolicyGetShowDeveloperDiagnostic( _In_ HANDLE processToken, _Out_ AppPolicyShowDeveloperDiagnostic *policy); https://msdn.microsoft.com/en-us/library/windows/desktop/mt829657(v=vs.85).aspx - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("AppModel.h", MSDNShortId = "mt829657")] - public static extern Win32Error AppPolicyGetShowDeveloperDiagnostic(HTOKEN processToken, out AppPolicyShowDeveloperDiagnostic policy); + /// Retrieves the method used for a process to surface developer information, such as asserts, to the user. + /// A handle that identifies the access token for a process. + /// + /// A pointer to a variable of the AppPolicyShowDeveloperDiagnostic enumerated type. When the function returns successfully, + /// the variable contains a value indicating the method used for the process to surface developer information, such as asserts, to + /// the user. + /// + /// + /// If the function succeeds, the function returns ERROR_SUCCESS. + /// + /// If no known create file access policy was found for the process token, the function raises a STATUS_ASSERTION_FAILURE exception + /// and returns ERROR_NOT_FOUND. + /// + /// If either processToken or policy are null, the function returns ERROR_INVALID_PARAMETER. + /// + // LONG WINAPI AppPolicyGetShowDeveloperDiagnostic( _In_ HANDLE processToken, _Out_ AppPolicyShowDeveloperDiagnostic *policy); https://msdn.microsoft.com/en-us/library/windows/desktop/mt829657(v=vs.85).aspx + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("AppModel.h", MSDNShortId = "mt829657")] + public static extern Win32Error AppPolicyGetShowDeveloperDiagnostic(HTOKEN processToken, out AppPolicyShowDeveloperDiagnostic policy); - /// - /// Retrieves the kind of initialization that should be automatically performed for a process when beginthread[ex] creates a thread. - /// - /// A handle that identifies the access token for a process. - /// - /// A pointer to a variable of the AppPolicyThreadInitializationType enumerated type. When the function returns successfully, - /// the variable contains a value indicating the kind of initialization that should be automatically performed for the process when - /// beginthread[ex] creates a thread. - /// - /// - /// If the function succeeds, the function returns ERROR_SUCCESS. - /// - /// If no known create file access policy was found for the process token, the function raises a STATUS_ASSERTION_FAILURE exception - /// and returns ERROR_NOT_FOUND. - /// - /// If either processToken or policy are null, the function returns ERROR_INVALID_PARAMETER. - /// - // LONG WINAPI AppPolicyGetThreadInitializationType( _In_ HANDLE processToken, _Out_ AppPolicyThreadInitializationType *policy); https://msdn.microsoft.com/en-us/library/windows/desktop/mt829658(v=vs.85).aspx - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("AppModel.h", MSDNShortId = "mt829658")] - public static extern Win32Error AppPolicyGetThreadInitializationType(HTOKEN processToken, out AppPolicyThreadInitializationType policy); + /// + /// Retrieves the kind of initialization that should be automatically performed for a process when beginthread[ex] creates a thread. + /// + /// A handle that identifies the access token for a process. + /// + /// A pointer to a variable of the AppPolicyThreadInitializationType enumerated type. When the function returns successfully, + /// the variable contains a value indicating the kind of initialization that should be automatically performed for the process when + /// beginthread[ex] creates a thread. + /// + /// + /// If the function succeeds, the function returns ERROR_SUCCESS. + /// + /// If no known create file access policy was found for the process token, the function raises a STATUS_ASSERTION_FAILURE exception + /// and returns ERROR_NOT_FOUND. + /// + /// If either processToken or policy are null, the function returns ERROR_INVALID_PARAMETER. + /// + // LONG WINAPI AppPolicyGetThreadInitializationType( _In_ HANDLE processToken, _Out_ AppPolicyThreadInitializationType *policy); https://msdn.microsoft.com/en-us/library/windows/desktop/mt829658(v=vs.85).aspx + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("AppModel.h", MSDNShortId = "mt829658")] + public static extern Win32Error AppPolicyGetThreadInitializationType(HTOKEN processToken, out AppPolicyThreadInitializationType policy); - /// - /// Closes a reference to the specified package information. - /// - /// - /// Type: PACKAGE_INFO_REFERENCE - /// A reference to package information. - /// - /// - /// Type: LONG - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-closepackageinfo LONG ClosePackageInfo( - // PACKAGE_INFO_REFERENCE packageInfoReference ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "BA84FB47-F241-4120-9441-7E1149F68738")] - public static extern Win32Error ClosePackageInfo(PACKAGE_INFO_REFERENCE packageInfoReference); + /// + /// Closes a reference to the specified package information. + /// + /// + /// Type: PACKAGE_INFO_REFERENCE + /// A reference to package information. + /// + /// + /// Type: LONG + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-closepackageinfo LONG ClosePackageInfo( + // PACKAGE_INFO_REFERENCE packageInfoReference ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "BA84FB47-F241-4120-9441-7E1149F68738")] + public static extern Win32Error ClosePackageInfo(PACKAGE_INFO_REFERENCE packageInfoReference); /// /// Deletes the install-time reference for the framework package dependency you created earlier by using the @@ -620,531 +620,531 @@ namespace Vanara.PInvoke // FindPackagesByPackageFamily( PCWSTR packageFamilyName, UINT32 packageFilters, UINT32 *count, PWSTR *packageFullNames, UINT32 // *bufferLength, WCHAR *buffer, UINT32 *packageProperties ); [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "D52E98BD-726F-4AC0-A034-02896B1D1687")] - public static extern Win32Error FindPackagesByPackageFamily(string packageFamilyName, PACKAGE_FLAGS packageFilters, ref uint count, IntPtr packageFullNames, ref uint bufferLength, IntPtr buffer, IntPtr packageProperties); + [PInvokeData("appmodel.h", MSDNShortId = "D52E98BD-726F-4AC0-A034-02896B1D1687")] + public static extern Win32Error FindPackagesByPackageFamily(string packageFamilyName, PACKAGE_FLAGS packageFilters, ref uint count, IntPtr packageFullNames, ref uint bufferLength, IntPtr buffer, IntPtr packageProperties); - /// - /// Constructs an application user model ID from the package family name and the package relative application ID (PRAID). - /// - /// - /// Type: PCWSTR - /// The package family name. - /// - /// - /// Type: PCWSTR - /// The package-relative app ID (PRAID). - /// - /// - /// Type: UINT32* - /// - /// A pointer to a variable that holds the number of characters ( WCHAR s) in the app user model ID string, which includes - /// the null-terminator. - /// - /// - /// First you pass NULL to applicationUserModelId to get the number of characters. You use this number to allocate memory - /// space for applicationUserModelId. Then you pass the address of this memory space to fill applicationUserModelId. - /// - /// - /// - /// Type: PWSTR - /// A pointer to memory space that receives the app user model ID string, which includes the null-terminator. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INVALID_PARAMETER - /// The packageFamilyName or packageRelativeApplicationId parameter isn't valid. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// - /// The buffer specified by applicationUserModelId is not large enough to hold the data; the required buffer size, in WCHARs, is - /// stored in the variable pointed to by applicationUserModelIdLength. - /// - /// - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-formatapplicationusermodelid LONG - // FormatApplicationUserModelId( PCWSTR packageFamilyName, PCWSTR packageRelativeApplicationId, UINT32 - // *applicationUserModelIdLength, PWSTR applicationUserModelId ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "F48D19C2-6373-41FC-A99D-E3CCB68D6C6C")] - public static extern Win32Error FormatApplicationUserModelId(string packageFamilyName, string packageRelativeApplicationId, - ref uint applicationUserModelIdLength, [Optional] StringBuilder applicationUserModelId); + /// + /// Constructs an application user model ID from the package family name and the package relative application ID (PRAID). + /// + /// + /// Type: PCWSTR + /// The package family name. + /// + /// + /// Type: PCWSTR + /// The package-relative app ID (PRAID). + /// + /// + /// Type: UINT32* + /// + /// A pointer to a variable that holds the number of characters ( WCHAR s) in the app user model ID string, which includes + /// the null-terminator. + /// + /// + /// First you pass NULL to applicationUserModelId to get the number of characters. You use this number to allocate memory + /// space for applicationUserModelId. Then you pass the address of this memory space to fill applicationUserModelId. + /// + /// + /// + /// Type: PWSTR + /// A pointer to memory space that receives the app user model ID string, which includes the null-terminator. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INVALID_PARAMETER + /// The packageFamilyName or packageRelativeApplicationId parameter isn't valid. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// + /// The buffer specified by applicationUserModelId is not large enough to hold the data; the required buffer size, in WCHARs, is + /// stored in the variable pointed to by applicationUserModelIdLength. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-formatapplicationusermodelid LONG + // FormatApplicationUserModelId( PCWSTR packageFamilyName, PCWSTR packageRelativeApplicationId, UINT32 + // *applicationUserModelIdLength, PWSTR applicationUserModelId ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "F48D19C2-6373-41FC-A99D-E3CCB68D6C6C")] + public static extern Win32Error FormatApplicationUserModelId(string packageFamilyName, string packageRelativeApplicationId, + ref uint applicationUserModelIdLength, [Optional] StringBuilder applicationUserModelId); - /// - /// Gets the application user model ID for the specified process. - /// - /// - /// - /// A handle to the process. This handle must have the PROCESS_QUERY_LIMITED_INFORMATION access right. For more info, see - /// Process Security and Access Rights. - /// - /// - /// - /// - /// On input, the size of the applicationUserModelId buffer, in wide characters. On success, the size of the buffer used, including - /// the null terminator. - /// - /// - /// - /// A pointer to a buffer that receives the application user model ID. - /// - /// - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_APPLICATION - /// The process has no application identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by applicationUserModelIdLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getapplicationusermodelid LONG - // GetApplicationUserModelId( HANDLE hProcess, UINT32 *applicationUserModelIdLength, PWSTR applicationUserModelId ); - [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "FE4E0818-F548-494B-B3BD-FB51DC748451")] - public static extern Win32Error GetApplicationUserModelId(HPROCESS hProcess, ref uint applicationUserModelIdLength, - [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder applicationUserModelId); + /// + /// Gets the application user model ID for the specified process. + /// + /// + /// + /// A handle to the process. This handle must have the PROCESS_QUERY_LIMITED_INFORMATION access right. For more info, see + /// Process Security and Access Rights. + /// + /// + /// + /// + /// On input, the size of the applicationUserModelId buffer, in wide characters. On success, the size of the buffer used, including + /// the null terminator. + /// + /// + /// + /// A pointer to a buffer that receives the application user model ID. + /// + /// + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_APPLICATION + /// The process has no application identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by applicationUserModelIdLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getapplicationusermodelid LONG + // GetApplicationUserModelId( HANDLE hProcess, UINT32 *applicationUserModelIdLength, PWSTR applicationUserModelId ); + [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "FE4E0818-F548-494B-B3BD-FB51DC748451")] + public static extern Win32Error GetApplicationUserModelId(HPROCESS hProcess, ref uint applicationUserModelIdLength, + [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder applicationUserModelId); - /// - /// Gets the application user model ID for the specified token. - /// - /// - /// - /// A token that contains the application identity. This handle must have the PROCESS_QUERY_LIMITED_INFORMATION access right. - /// For more info, see Process Security and Access Rights. - /// - /// - /// - /// - /// On input, the size of the applicationUserModelId buffer, in wide characters. On success, the size of the buffer used, including - /// the null terminator. - /// - /// - /// - /// A pointer to a buffer that receives the application user model ID. - /// - /// - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_APPLICATION - /// The token has no application identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by applicationUserModelIdLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getapplicationusermodelidfromtoken LONG - // GetApplicationUserModelIdFromToken( HANDLE token, UINT32 *applicationUserModelIdLength, PWSTR applicationUserModelId ); - [DllImport(Lib.KernelBase, SetLastError = true, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "80036518-927E-4CD0-B499-8EA472AB7E5A")] - public static extern Win32Error GetApplicationUserModelIdFromToken(HTOKEN token, ref uint applicationUserModelIdLength, - [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder applicationUserModelId); + /// + /// Gets the application user model ID for the specified token. + /// + /// + /// + /// A token that contains the application identity. This handle must have the PROCESS_QUERY_LIMITED_INFORMATION access right. + /// For more info, see Process Security and Access Rights. + /// + /// + /// + /// + /// On input, the size of the applicationUserModelId buffer, in wide characters. On success, the size of the buffer used, including + /// the null terminator. + /// + /// + /// + /// A pointer to a buffer that receives the application user model ID. + /// + /// + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_APPLICATION + /// The token has no application identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by applicationUserModelIdLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getapplicationusermodelidfromtoken LONG + // GetApplicationUserModelIdFromToken( HANDLE token, UINT32 *applicationUserModelIdLength, PWSTR applicationUserModelId ); + [DllImport(Lib.KernelBase, SetLastError = true, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "80036518-927E-4CD0-B499-8EA472AB7E5A")] + public static extern Win32Error GetApplicationUserModelIdFromToken(HTOKEN token, ref uint applicationUserModelIdLength, + [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder applicationUserModelId); - /// - /// Gets the application user model ID for the current process. - /// - /// - /// - /// On input, the size of the applicationUserModelId buffer, in wide characters. On success, the size of the buffer used, including - /// the null terminator. - /// - /// - /// - /// A pointer to a buffer that receives the application user model ID. - /// - /// - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_APPLICATION - /// The process has no application identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by applicationUserModelIdLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentapplicationusermodelid LONG - // GetCurrentApplicationUserModelId( UINT32 *applicationUserModelIdLength, PWSTR applicationUserModelId ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "562BB225-0922-4FE7-92C0-573A2CCE3195")] - public static extern Win32Error GetCurrentApplicationUserModelId(ref uint applicationUserModelIdLength, [Optional] StringBuilder applicationUserModelId); + /// + /// Gets the application user model ID for the current process. + /// + /// + /// + /// On input, the size of the applicationUserModelId buffer, in wide characters. On success, the size of the buffer used, including + /// the null terminator. + /// + /// + /// + /// A pointer to a buffer that receives the application user model ID. + /// + /// + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_APPLICATION + /// The process has no application identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by applicationUserModelIdLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentapplicationusermodelid LONG + // GetCurrentApplicationUserModelId( UINT32 *applicationUserModelIdLength, PWSTR applicationUserModelId ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "562BB225-0922-4FE7-92C0-573A2CCE3195")] + public static extern Win32Error GetCurrentApplicationUserModelId(ref uint applicationUserModelIdLength, [Optional] StringBuilder applicationUserModelId); - /// - /// Gets the package family name for the calling process. - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the packageFamilyName buffer, in characters, including the null terminator. On output, the size of the - /// package family name returned, in characters, including the null terminator. - /// - /// - /// - /// Type: PWSTR - /// The package family name. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_PACKAGE - /// The process has no package identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by packageFamilyNameLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentpackagefamilyname LONG - // GetCurrentPackageFamilyName( UINT32 *packageFamilyNameLength, PWSTR packageFamilyName ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "39DBFBDD-A1CC-45C3-A5DD-5ED9697F9AFE")] - public static extern Win32Error GetCurrentPackageFamilyName(ref uint packageFamilyNameLength, [Optional] StringBuilder packageFamilyName); + /// + /// Gets the package family name for the calling process. + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the packageFamilyName buffer, in characters, including the null terminator. On output, the size of the + /// package family name returned, in characters, including the null terminator. + /// + /// + /// + /// Type: PWSTR + /// The package family name. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_PACKAGE + /// The process has no package identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by packageFamilyNameLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentpackagefamilyname LONG + // GetCurrentPackageFamilyName( UINT32 *packageFamilyNameLength, PWSTR packageFamilyName ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "39DBFBDD-A1CC-45C3-A5DD-5ED9697F9AFE")] + public static extern Win32Error GetCurrentPackageFamilyName(ref uint packageFamilyNameLength, [Optional] StringBuilder packageFamilyName); - /// - /// Gets the package full name for the calling process. - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the packageFullName buffer, in characters. On output, the size of the package full name returned, in - /// characters, including the null terminator. - /// - /// - /// - /// Type: PWSTR - /// The package full name. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_PACKAGE - /// The process has no package identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by packageFullNameLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentpackagefullname LONG - // GetCurrentPackageFullName( UINT32 *packageFullNameLength, PWSTR packageFullName ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "D5B00C53-1FBF-4245-92D1-FA39713A9EE7")] - public static extern Win32Error GetCurrentPackageFullName(ref uint packageFullNameLength, [Optional] StringBuilder packageFullName); + /// + /// Gets the package full name for the calling process. + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the packageFullName buffer, in characters. On output, the size of the package full name returned, in + /// characters, including the null terminator. + /// + /// + /// + /// Type: PWSTR + /// The package full name. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_PACKAGE + /// The process has no package identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by packageFullNameLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentpackagefullname LONG + // GetCurrentPackageFullName( UINT32 *packageFullNameLength, PWSTR packageFullName ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "D5B00C53-1FBF-4245-92D1-FA39713A9EE7")] + public static extern Win32Error GetCurrentPackageFullName(ref uint packageFullNameLength, [Optional] StringBuilder packageFullName); - /// - /// Gets the package identifier (ID) for the calling process. - /// - /// - /// Type: UINT32* - /// On input, the size of buffer, in bytes. On output, the size of the structure returned, in bytes. - /// - /// - /// Type: BYTE* - /// The package ID, represented as a PACKAGE_ID structure. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_PACKAGE - /// The process has no package identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. - /// - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentpackageid LONG GetCurrentPackageId( UINT32 - // *bufferLength, BYTE *buffer ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "4CFC707A-2A5A-41FE-BB5F-6FECACC99271")] - public static extern Win32Error GetCurrentPackageId(ref uint bufferLength, IntPtr buffer); + /// + /// Gets the package identifier (ID) for the calling process. + /// + /// + /// Type: UINT32* + /// On input, the size of buffer, in bytes. On output, the size of the structure returned, in bytes. + /// + /// + /// Type: BYTE* + /// The package ID, represented as a PACKAGE_ID structure. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_PACKAGE + /// The process has no package identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentpackageid LONG GetCurrentPackageId( UINT32 + // *bufferLength, BYTE *buffer ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "4CFC707A-2A5A-41FE-BB5F-6FECACC99271")] + public static extern Win32Error GetCurrentPackageId(ref uint bufferLength, IntPtr buffer); - /// - /// Gets the package information for the calling process. - /// - /// - /// Type: const UINT32 - /// The package constants that specify how package information is retrieved. The PACKAGE_FILTER_* flags are supported. - /// - /// - /// Type: UINT32* - /// On input, the size of buffer, in bytes. On output, the size of the array of structures returned, in bytes. - /// - /// - /// Type: BYTE* - /// The package information, represented as an array of PACKAGE_INFO structures. - /// - /// - /// Type: UINT32* - /// The number of structures in the buffer. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_PACKAGE - /// The process has no package identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. - /// - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentpackageinfo LONG GetCurrentPackageInfo( const - // UINT32 flags, UINT32 *bufferLength, BYTE *buffer, UINT32 *count ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "A1887D61-0FAD-4BE8-850F-F104CC074798")] - public static extern Win32Error GetCurrentPackageInfo(PACKAGE_FLAGS flags, ref uint bufferLength, IntPtr buffer, out uint count); + /// + /// Gets the package information for the calling process. + /// + /// + /// Type: const UINT32 + /// The package constants that specify how package information is retrieved. The PACKAGE_FILTER_* flags are supported. + /// + /// + /// Type: UINT32* + /// On input, the size of buffer, in bytes. On output, the size of the array of structures returned, in bytes. + /// + /// + /// Type: BYTE* + /// The package information, represented as an array of PACKAGE_INFO structures. + /// + /// + /// Type: UINT32* + /// The number of structures in the buffer. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_PACKAGE + /// The process has no package identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentpackageinfo LONG GetCurrentPackageInfo( const + // UINT32 flags, UINT32 *bufferLength, BYTE *buffer, UINT32 *count ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "A1887D61-0FAD-4BE8-850F-F104CC074798")] + public static extern Win32Error GetCurrentPackageInfo(PACKAGE_FLAGS flags, ref uint bufferLength, IntPtr buffer, out uint count); - /// - /// Gets the package information for the calling process, with the option to specify the type of folder path to retrieve for the package. - /// - /// - /// Type: const UINT32 - /// The package constants that specify how package information is retrieved. The PACKAGE_FILTER_* flags are supported. - /// - /// - /// Type: PackagePathType - /// Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder). - /// - /// - /// Type: UINT32* - /// On input, the size of buffer, in bytes. On output, the size of the array of structures returned, in bytes. - /// - /// - /// Type: BYTE* - /// The package information, represented as an array of PACKAGE_INFO structures. - /// - /// - /// Type: UINT32* - /// The number of structures in the buffer. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_PACKAGE - /// The process has no package identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. - /// - /// - /// - /// - /// The packagePathType parameter is useful for applications that use the windows.mutablePackageDirectories extension in their - /// package manifest. This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of - /// the application's install folder are projected so that users can modify the installation files. This feature is currently - /// available only for certain types of desktop PC games that are published by Microsoft and our partners, and it enables these - /// types of games to support mods. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getcurrentpackageinfo2 LONG GetCurrentPackageInfo2( const - // UINT32 flags, PackagePathType packagePathType, UINT32 *bufferLength, BYTE *buffer, UINT32 *count ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h")] - public static extern Win32Error GetCurrentPackageInfo2(PACKAGE_FLAGS flags, PackagePathType packagePathType, ref uint bufferLength, IntPtr buffer, out uint count); + /// + /// Gets the package information for the calling process, with the option to specify the type of folder path to retrieve for the package. + /// + /// + /// Type: const UINT32 + /// The package constants that specify how package information is retrieved. The PACKAGE_FILTER_* flags are supported. + /// + /// + /// Type: PackagePathType + /// Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder). + /// + /// + /// Type: UINT32* + /// On input, the size of buffer, in bytes. On output, the size of the array of structures returned, in bytes. + /// + /// + /// Type: BYTE* + /// The package information, represented as an array of PACKAGE_INFO structures. + /// + /// + /// Type: UINT32* + /// The number of structures in the buffer. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_PACKAGE + /// The process has no package identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. + /// + /// + /// + /// + /// The packagePathType parameter is useful for applications that use the windows.mutablePackageDirectories extension in their + /// package manifest. This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of + /// the application's install folder are projected so that users can modify the installation files. This feature is currently + /// available only for certain types of desktop PC games that are published by Microsoft and our partners, and it enables these + /// types of games to support mods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getcurrentpackageinfo2 LONG GetCurrentPackageInfo2( const + // UINT32 flags, PackagePathType packagePathType, UINT32 *bufferLength, BYTE *buffer, UINT32 *count ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h")] + public static extern Win32Error GetCurrentPackageInfo2(PACKAGE_FLAGS flags, PackagePathType packagePathType, ref uint bufferLength, IntPtr buffer, out uint count); - /// - /// Gets the package path for the calling process. - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the path buffer, in characters. On output, the size of the package path returned, in characters, including - /// the null terminator. - /// - /// - /// - /// Type: PWSTR - /// The package path. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_PACKAGE - /// The process has no package identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by pathLength. - /// - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentpackagepath LONG GetCurrentPackagePath( UINT32 - // *pathLength, PWSTR path ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "46CE81DF-A9D5-492E-AB5E-4F043DC326E2")] - public static extern Win32Error GetCurrentPackagePath(ref uint pathLength, [Optional] StringBuilder path); + /// + /// Gets the package path for the calling process. + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the path buffer, in characters. On output, the size of the package path returned, in characters, including + /// the null terminator. + /// + /// + /// + /// Type: PWSTR + /// The package path. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_PACKAGE + /// The process has no package identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by pathLength. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getcurrentpackagepath LONG GetCurrentPackagePath( UINT32 + // *pathLength, PWSTR path ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "46CE81DF-A9D5-492E-AB5E-4F043DC326E2")] + public static extern Win32Error GetCurrentPackagePath(ref uint pathLength, [Optional] StringBuilder path); - /// - /// Gets the package path for the calling process, with the option to specify the type of folder path to retrieve for the package. - /// - /// - /// Type: PackagePathType - /// Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder). - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the path buffer, in characters. On output, the size of the package path returned, in characters, including - /// the null terminator. - /// - /// - /// - /// Type: PWSTR - /// The package path. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_PACKAGE - /// The process has no package identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by pathLength. - /// - /// - /// - /// - /// The packagePathType parameter is useful for applications that use the windows.mutablePackageDirectories extension in their - /// package manifest. This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of - /// the application's install folder are projected so that users can modify the installation files. This feature is currently - /// available only for certain types of desktop PC games that are published by Microsoft and our partners, and it enables these - /// types of games to support mods. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getcurrentpackagepath2 LONG GetCurrentPackagePath2( - // PackagePathType packagePathType, UINT32 *pathLength, PWSTR path ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h")] - public static extern Win32Error GetCurrentPackagePath2(PackagePathType packagePathType, ref uint pathLength, - [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path); + /// + /// Gets the package path for the calling process, with the option to specify the type of folder path to retrieve for the package. + /// + /// + /// Type: PackagePathType + /// Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder). + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the path buffer, in characters. On output, the size of the package path returned, in characters, including + /// the null terminator. + /// + /// + /// + /// Type: PWSTR + /// The package path. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_PACKAGE + /// The process has no package identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by pathLength. + /// + /// + /// + /// + /// The packagePathType parameter is useful for applications that use the windows.mutablePackageDirectories extension in their + /// package manifest. This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of + /// the application's install folder are projected so that users can modify the installation files. This feature is currently + /// available only for certain types of desktop PC games that are published by Microsoft and our partners, and it enables these + /// types of games to support mods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getcurrentpackagepath2 LONG GetCurrentPackagePath2( + // PackagePathType packagePathType, UINT32 *pathLength, PWSTR path ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h")] + public static extern Win32Error GetCurrentPackagePath2(PackagePathType packagePathType, ref uint pathLength, + [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path); /// Returns the package dependency for the specified context handle. /// @@ -1176,7 +1176,7 @@ namespace Vanara.PInvoke [DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)] [PInvokeData("appmodel.h", MSDNShortId = "NF:appmodel.GetIdForPackageDependencyContext")] public static extern HRESULT GetIdForPackageDependencyContext(PACKAGEDEPENDENCY_CONTEXT packageDependencyContext, - out SafeHeapBlock packageDependencyId); + out SafeHeapBlock packageDependencyId); /// /// Gets the IDs of apps in the specified package. @@ -1221,1084 +1221,1084 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackageapplicationids LONG GetPackageApplicationIds( // PACKAGE_INFO_REFERENCE packageInfoReference, UINT32 *bufferLength, BYTE *buffer, UINT32 *count ); [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "F08135F9-FF45-4309-84B5-77F4AFD7FC0C")] - public static extern Win32Error GetPackageApplicationIds(PACKAGE_INFO_REFERENCE packageInfoReference, ref uint bufferLength, IntPtr buffer, out uint count); + [PInvokeData("appmodel.h", MSDNShortId = "F08135F9-FF45-4309-84B5-77F4AFD7FC0C")] + public static extern Win32Error GetPackageApplicationIds(PACKAGE_INFO_REFERENCE packageInfoReference, ref uint bufferLength, IntPtr buffer, out uint count); - /// - /// Gets the package family name for the specified process. - /// - /// - /// Type: HANDLE - /// - /// A handle to the process that has the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. - /// For more information, see Process Security and Access Rights. - /// - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the packageFamilyName buffer, in characters. On output, the size of the package family name returned, in - /// characters, including the null-terminator. - /// - /// - /// - /// Type: PWSTR - /// The package family name. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_PACKAGE - /// The process has no package identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by packageFamilyNameLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagefamilyname LONG GetPackageFamilyName( HANDLE - // hProcess, UINT32 *packageFamilyNameLength, PWSTR packageFamilyName ); - [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "AC239898-9924-4193-9072-7A7EEC2D03E9")] - public static extern Win32Error GetPackageFamilyName(HPROCESS hProcess, ref uint packageFamilyNameLength, [Optional] StringBuilder packageFamilyName); + /// + /// Gets the package family name for the specified process. + /// + /// + /// Type: HANDLE + /// + /// A handle to the process that has the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. + /// For more information, see Process Security and Access Rights. + /// + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the packageFamilyName buffer, in characters. On output, the size of the package family name returned, in + /// characters, including the null-terminator. + /// + /// + /// + /// Type: PWSTR + /// The package family name. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_PACKAGE + /// The process has no package identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by packageFamilyNameLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagefamilyname LONG GetPackageFamilyName( HANDLE + // hProcess, UINT32 *packageFamilyNameLength, PWSTR packageFamilyName ); + [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "AC239898-9924-4193-9072-7A7EEC2D03E9")] + public static extern Win32Error GetPackageFamilyName(HPROCESS hProcess, ref uint packageFamilyNameLength, [Optional] StringBuilder packageFamilyName); - /// - /// Gets the package family name for the specified token. - /// - /// - /// Type: HANDLE - /// A token that contains the package identity. - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the packageFamilyName buffer, in characters. On output, the size of the package family name returned, in - /// characters, including the null-terminator. - /// - /// - /// - /// Type: PWSTR - /// The package family name. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_PACKAGE - /// The token has no package identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by packageFamilyNameLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagefamilynamefromtoken LONG - // GetPackageFamilyNameFromToken( HANDLE token, UINT32 *packageFamilyNameLength, PWSTR packageFamilyName ); - [DllImport(Lib.KernelBase, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "C4FAF5DE-DF1F-4AFA-813B-5D80C786031B")] - public static extern Win32Error GetPackageFamilyNameFromToken(HTOKEN token, ref uint packageFamilyNameLength, [Optional] StringBuilder packageFamilyName); + /// + /// Gets the package family name for the specified token. + /// + /// + /// Type: HANDLE + /// A token that contains the package identity. + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the packageFamilyName buffer, in characters. On output, the size of the package family name returned, in + /// characters, including the null-terminator. + /// + /// + /// + /// Type: PWSTR + /// The package family name. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_PACKAGE + /// The token has no package identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by packageFamilyNameLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagefamilynamefromtoken LONG + // GetPackageFamilyNameFromToken( HANDLE token, UINT32 *packageFamilyNameLength, PWSTR packageFamilyName ); + [DllImport(Lib.KernelBase, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "C4FAF5DE-DF1F-4AFA-813B-5D80C786031B")] + public static extern Win32Error GetPackageFamilyNameFromToken(HTOKEN token, ref uint packageFamilyNameLength, [Optional] StringBuilder packageFamilyName); - /// Gets the package full name for the specified process. - /// - /// Type: HANDLE - /// - /// A handle to the process that has the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. - /// For more information, see Process Security and Access Rights. - /// - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the packageFullName buffer, in characters. On output, the size of the package full name returned, in - /// characters, including the null terminator. - /// - /// - /// - /// Type: PWSTR - /// The package full name. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_PACKAGE - /// The process has no package identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by packageFullNameLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - /// #define _UNICODE 1 #define UNICODE 1 #include <Windows.h> #include <appmodel.h> #include <malloc.h> #include <stdlib.h> #include <stdio.h> int ShowUsage(); void ShowProcessPackageFullName(__in const UINT32 pid, __in HANDLE process); int ShowUsage() { wprintf(L"Usage: GetPackageFullName <pid> [<pid>...]\n"); return 1; } int __cdecl wmain(__in int argc, __in_ecount(argc) WCHAR * argv[]) { if (argc <= 1) return ShowUsage(); for (int i=1; i<argc; ++i) { UINT32 pid = wcstoul(argv[i], NULL, 10); if (pid > 0) { HANDLE process = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid); if (process == NULL) wprintf(L"Error %d in OpenProcess (pid=%u)\n", GetLastError(), pid); else { ShowProcessPackageFullName(pid, process); CloseHandle(process); } } } return 0; } void ShowProcessPackageFullName(__in const UINT32 pid, __in HANDLE process) { wprintf(L"Process %u (handle=%p)\n", pid, process); UINT32 length = 0; LONG rc = GetPackageFullName(process, &length, NULL); if (rc != ERROR_INSUFFICIENT_BUFFER) { if (rc == APPMODEL_ERROR_NO_PACKAGE) wprintf(L"Process has no package identity\n"); else wprintf(L"Error %d in GetPackageFullName\n", rc); return; } PWSTR fullName = (PWSTR) malloc(length * sizeof(*fullName)); if (fullName == NULL) { wprintf(L"Error allocating memory\n"); return; } rc = GetPackageFullName(process, &length, fullName); if (rc != ERROR_SUCCESS) wprintf(L"Error %d retrieving PackageFullName\n", rc); else wprintf(L"%s\n", fullName); free(fullName); } - /// - /// - // https://webcache.googleusercontent.com/search?q=cache:IqzT6kD4rycJ:https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getpackagefullname+&cd=2&hl=en&ct=clnk&gl=us - // LONG GetPackageFullName( HANDLE hProcess, UINT32 *packageFullNameLength, PWSTR packageFullName ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "NF:appmodel.GetPackageFullName")] - public static extern Win32Error GetPackageFullName(HPROCESS hProcess, ref uint packageFullNameLength, - [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder packageFullName); + /// Gets the package full name for the specified process. + /// + /// Type: HANDLE + /// + /// A handle to the process that has the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. + /// For more information, see Process Security and Access Rights. + /// + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the packageFullName buffer, in characters. On output, the size of the package full name returned, in + /// characters, including the null terminator. + /// + /// + /// + /// Type: PWSTR + /// The package full name. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_PACKAGE + /// The process has no package identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by packageFullNameLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + /// #define _UNICODE 1 #define UNICODE 1 #include <Windows.h> #include <appmodel.h> #include <malloc.h> #include <stdlib.h> #include <stdio.h> int ShowUsage(); void ShowProcessPackageFullName(__in const UINT32 pid, __in HANDLE process); int ShowUsage() { wprintf(L"Usage: GetPackageFullName <pid> [<pid>...]\n"); return 1; } int __cdecl wmain(__in int argc, __in_ecount(argc) WCHAR * argv[]) { if (argc <= 1) return ShowUsage(); for (int i=1; i<argc; ++i) { UINT32 pid = wcstoul(argv[i], NULL, 10); if (pid > 0) { HANDLE process = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid); if (process == NULL) wprintf(L"Error %d in OpenProcess (pid=%u)\n", GetLastError(), pid); else { ShowProcessPackageFullName(pid, process); CloseHandle(process); } } } return 0; } void ShowProcessPackageFullName(__in const UINT32 pid, __in HANDLE process) { wprintf(L"Process %u (handle=%p)\n", pid, process); UINT32 length = 0; LONG rc = GetPackageFullName(process, &length, NULL); if (rc != ERROR_INSUFFICIENT_BUFFER) { if (rc == APPMODEL_ERROR_NO_PACKAGE) wprintf(L"Process has no package identity\n"); else wprintf(L"Error %d in GetPackageFullName\n", rc); return; } PWSTR fullName = (PWSTR) malloc(length * sizeof(*fullName)); if (fullName == NULL) { wprintf(L"Error allocating memory\n"); return; } rc = GetPackageFullName(process, &length, fullName); if (rc != ERROR_SUCCESS) wprintf(L"Error %d retrieving PackageFullName\n", rc); else wprintf(L"%s\n", fullName); free(fullName); } + /// + /// + // https://webcache.googleusercontent.com/search?q=cache:IqzT6kD4rycJ:https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getpackagefullname+&cd=2&hl=en&ct=clnk&gl=us + // LONG GetPackageFullName( HANDLE hProcess, UINT32 *packageFullNameLength, PWSTR packageFullName ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "NF:appmodel.GetPackageFullName")] + public static extern Win32Error GetPackageFullName(HPROCESS hProcess, ref uint packageFullNameLength, + [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder packageFullName); - /// - /// Gets the package full name for the specified token. - /// - /// - /// A token that contains the package identity. - /// - /// - /// - /// On input, the size of the packageFullName buffer, in characters. On output, the size of the package full name returned, in - /// characters, including the null terminator. - /// - /// - /// - /// The package full name. - /// - /// - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// APPMODEL_ERROR_NO_PACKAGE - /// The token has no package identity. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by packageFullNameLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagefullnamefromtoken LONG - // GetPackageFullNameFromToken( HANDLE token, UINT32 *packageFullNameLength, PWSTR packageFullName ); - [DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "7B0D574E-A2F5-4D08-AEFB-9E040BBC729F")] - public static extern Win32Error GetPackageFullNameFromToken(HTOKEN token, ref uint packageFullNameLength, [Optional] StringBuilder packageFullName); + /// + /// Gets the package full name for the specified token. + /// + /// + /// A token that contains the package identity. + /// + /// + /// + /// On input, the size of the packageFullName buffer, in characters. On output, the size of the package full name returned, in + /// characters, including the null terminator. + /// + /// + /// + /// The package full name. + /// + /// + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// APPMODEL_ERROR_NO_PACKAGE + /// The token has no package identity. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by packageFullNameLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagefullnamefromtoken LONG + // GetPackageFullNameFromToken( HANDLE token, UINT32 *packageFullNameLength, PWSTR packageFullName ); + [DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "7B0D574E-A2F5-4D08-AEFB-9E040BBC729F")] + public static extern Win32Error GetPackageFullNameFromToken(HTOKEN token, ref uint packageFullNameLength, [Optional] StringBuilder packageFullName); - /// - /// Gets the package information for the specified package. - /// - /// - /// Type: PACKAGE_INFO_REFERENCE - /// A reference to package information. - /// - /// - /// Type: const UINT32 - /// The package constants that specify how package information is retrieved. - /// - /// - /// Type: UINT32* - /// On input, the size of buffer, in bytes. On output, the size of the package information returned, in bytes. - /// - /// - /// Type: BYTE* - /// The package information, represented as an array of PACKAGE_INFO structures. - /// - /// - /// Type: UINT32* - /// The number of packages in the buffer. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. - /// - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackageinfo LONG GetPackageInfo( - // PACKAGE_INFO_REFERENCE packageInfoReference, const UINT32 flags, UINT32 *bufferLength, BYTE *buffer, UINT32 *count ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "28F45B3B-A61F-44D3-B606-6966AD5866FA")] - public static extern Win32Error GetPackageInfo(PACKAGE_INFO_REFERENCE packageInfoReference, uint flags, ref uint bufferLength, IntPtr buffer, out uint count); + /// + /// Gets the package information for the specified package. + /// + /// + /// Type: PACKAGE_INFO_REFERENCE + /// A reference to package information. + /// + /// + /// Type: const UINT32 + /// The package constants that specify how package information is retrieved. + /// + /// + /// Type: UINT32* + /// On input, the size of buffer, in bytes. On output, the size of the package information returned, in bytes. + /// + /// + /// Type: BYTE* + /// The package information, represented as an array of PACKAGE_INFO structures. + /// + /// + /// Type: UINT32* + /// The number of packages in the buffer. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackageinfo LONG GetPackageInfo( + // PACKAGE_INFO_REFERENCE packageInfoReference, const UINT32 flags, UINT32 *bufferLength, BYTE *buffer, UINT32 *count ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "28F45B3B-A61F-44D3-B606-6966AD5866FA")] + public static extern Win32Error GetPackageInfo(PACKAGE_INFO_REFERENCE packageInfoReference, uint flags, ref uint bufferLength, IntPtr buffer, out uint count); - /// - /// Gets the package information for the specified package, with the option to specify the type of folder path to retrieve for the package. - /// - /// - /// Type: PACKAGE_INFO_REFERENCE - /// A reference to package information. - /// - /// - /// Type: const UINT32 - /// The package constants that specify how package information is retrieved. - /// - /// - /// Type: PackagePathType - /// Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder). - /// - /// - /// Type: UINT32* - /// On input, the size of buffer, in bytes. On output, the size of the package information returned, in bytes. - /// - /// - /// Type: BYTE* - /// The package information, represented as an array of PACKAGE_INFO structures. - /// - /// - /// Type: UINT32* - /// The number of packages in the buffer. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. - /// - /// - /// - /// - /// The packagePathType parameter is useful for applications that use the windows.mutablePackageDirectories extension in their - /// package manifest. This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of - /// the application's install folder are projected so that users can modify the installation files. This feature is currently - /// available only for certain types of desktop PC games that are published by Microsoft and our partners, and it enables these - /// types of games to support mods. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getpackageinfo2 LONG GetPackageInfo2( - // PACKAGE_INFO_REFERENCE packageInfoReference, const UINT32 flags, PackagePathType packagePathType, UINT32 *bufferLength, BYTE - // *buffer, UINT32 *count ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h")] - public static extern Win32Error GetPackageInfo2(PACKAGE_INFO_REFERENCE packageInfoReference, uint flags, PackagePathType packagePathType, ref uint bufferLength, IntPtr buffer, out uint count); + /// + /// Gets the package information for the specified package, with the option to specify the type of folder path to retrieve for the package. + /// + /// + /// Type: PACKAGE_INFO_REFERENCE + /// A reference to package information. + /// + /// + /// Type: const UINT32 + /// The package constants that specify how package information is retrieved. + /// + /// + /// Type: PackagePathType + /// Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder). + /// + /// + /// Type: UINT32* + /// On input, the size of buffer, in bytes. On output, the size of the package information returned, in bytes. + /// + /// + /// Type: BYTE* + /// The package information, represented as an array of PACKAGE_INFO structures. + /// + /// + /// Type: UINT32* + /// The number of packages in the buffer. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. + /// + /// + /// + /// + /// The packagePathType parameter is useful for applications that use the windows.mutablePackageDirectories extension in their + /// package manifest. This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of + /// the application's install folder are projected so that users can modify the installation files. This feature is currently + /// available only for certain types of desktop PC games that are published by Microsoft and our partners, and it enables these + /// types of games to support mods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getpackageinfo2 LONG GetPackageInfo2( + // PACKAGE_INFO_REFERENCE packageInfoReference, const UINT32 flags, PackagePathType packagePathType, UINT32 *bufferLength, BYTE + // *buffer, UINT32 *count ); + [DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h")] + public static extern Win32Error GetPackageInfo2(PACKAGE_INFO_REFERENCE packageInfoReference, uint flags, PackagePathType packagePathType, ref uint bufferLength, IntPtr buffer, out uint count); - /// - /// Gets the path for the specified package. - /// - /// - /// Type: const PACKAGE_ID* - /// The package identifier. - /// - /// - /// Type: const UINT32 - /// Reserved, do not use. - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the path buffer, in characters. On output, the size of the package path returned, in characters, including - /// the null-terminator. - /// - /// - /// - /// Type: PWSTR - /// The package path. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength. - /// - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagepath LONG GetPackagePath( const PACKAGE_ID - // *packageId, const UINT32 reserved, UINT32 *pathLength, PWSTR path ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "BDA0DD87-A36D-486B-BF89-EA5CC105C742")] - public static extern Win32Error GetPackagePath(in PACKAGE_ID packageId, uint reserved, ref uint pathLength, [Optional] StringBuilder path); + /// + /// Gets the path for the specified package. + /// + /// + /// Type: const PACKAGE_ID* + /// The package identifier. + /// + /// + /// Type: const UINT32 + /// Reserved, do not use. + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the path buffer, in characters. On output, the size of the package path returned, in characters, including + /// the null-terminator. + /// + /// + /// + /// Type: PWSTR + /// The package path. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagepath LONG GetPackagePath( const PACKAGE_ID + // *packageId, const UINT32 reserved, UINT32 *pathLength, PWSTR path ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "BDA0DD87-A36D-486B-BF89-EA5CC105C742")] + public static extern Win32Error GetPackagePath(in PACKAGE_ID packageId, uint reserved, ref uint pathLength, [Optional] StringBuilder path); - /// - /// Gets the path of the specified package. - /// - /// - /// Type: PCWSTR - /// The full name of the package. - /// - /// - /// Type: UINT32* - /// - /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package path string, which includes the null-terminator. - /// - /// - /// First you pass NULL to path to get the number of characters. You use this number to allocate memory space for path. Then - /// you pass the address of this memory space to fill path. - /// - /// - /// - /// Type: PWSTR - /// A pointer to memory space that receives the package path string, which includes the null-terminator. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength. - /// - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagepathbyfullname LONG GetPackagePathByFullName( - // PCWSTR packageFullName, UINT32 *pathLength, PWSTR path ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "9C25708C-1464-4C59-9740-E9F105116385")] - public static extern Win32Error GetPackagePathByFullName(string packageFullName, ref uint pathLength, [Optional] StringBuilder path); + /// + /// Gets the path of the specified package. + /// + /// + /// Type: PCWSTR + /// The full name of the package. + /// + /// + /// Type: UINT32* + /// + /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package path string, which includes the null-terminator. + /// + /// + /// First you pass NULL to path to get the number of characters. You use this number to allocate memory space for path. Then + /// you pass the address of this memory space to fill path. + /// + /// + /// + /// Type: PWSTR + /// A pointer to memory space that receives the package path string, which includes the null-terminator. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagepathbyfullname LONG GetPackagePathByFullName( + // PCWSTR packageFullName, UINT32 *pathLength, PWSTR path ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "9C25708C-1464-4C59-9740-E9F105116385")] + public static extern Win32Error GetPackagePathByFullName(string packageFullName, ref uint pathLength, [Optional] StringBuilder path); - /// Gets the path of the specified package, with the option to specify the type of folder path to retrieve for the package. - /// - /// Type: PCWSTR - /// The full name of the package. - /// - /// - /// Type: PackagePathType - /// Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder). - /// - /// - /// Type: UINT32* - /// - /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package path string, which includes the null-terminator. - /// - /// - /// First you pass NULL to path to get the number of characters. You use this number to allocate memory space for path. Then - /// you pass the address of this memory space to fill path. - /// - /// - /// - /// Type: PWSTR - /// A pointer to memory space that receives the package path string, which includes the null-terminator. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength. - /// - /// - /// - /// - /// The packagePathType parameter is useful for applications that use the windows.mutablePackageDirectories extension in their - /// package manifest. This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of - /// the application's install folder are projected so that users can modify the installation files. This feature is currently - /// available only for certain types of desktop PC games that are published by Microsoft and our partners, and it enables these - /// types of games to support mods. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getpackagepathbyfullname2 LONG GetPackagePathByFullName2( - // PCWSTR packageFullName, PackagePathType packagePathType, UINT32 *pathLength, PWSTR path ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h")] - public static extern Win32Error GetPackagePathByFullName2([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, PackagePathType packagePathType, - ref uint pathLength, [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path); + /// Gets the path of the specified package, with the option to specify the type of folder path to retrieve for the package. + /// + /// Type: PCWSTR + /// The full name of the package. + /// + /// + /// Type: PackagePathType + /// Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder). + /// + /// + /// Type: UINT32* + /// + /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package path string, which includes the null-terminator. + /// + /// + /// First you pass NULL to path to get the number of characters. You use this number to allocate memory space for path. Then + /// you pass the address of this memory space to fill path. + /// + /// + /// + /// Type: PWSTR + /// A pointer to memory space that receives the package path string, which includes the null-terminator. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength. + /// + /// + /// + /// + /// The packagePathType parameter is useful for applications that use the windows.mutablePackageDirectories extension in their + /// package manifest. This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of + /// the application's install folder are projected so that users can modify the installation files. This feature is currently + /// available only for certain types of desktop PC games that are published by Microsoft and our partners, and it enables these + /// types of games to support mods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getpackagepathbyfullname2 LONG GetPackagePathByFullName2( + // PCWSTR packageFullName, PackagePathType packagePathType, UINT32 *pathLength, PWSTR path ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h")] + public static extern Win32Error GetPackagePathByFullName2([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, PackagePathType packagePathType, + ref uint pathLength, [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path); - /// - /// Gets the packages with the specified family name for the current user. - /// - /// - /// Type: PCWSTR - /// The package family name. - /// - /// - /// Type: UINT32* - /// A pointer to a variable that holds the number of package full names. - /// - /// First you pass NULL to packageFullNames to get the number of package full names. You use this number to allocate memory - /// space for packageFullNames. Then you pass the address of this number to fill packageFullNames. - /// - /// - /// - /// Type: PWSTR* - /// A pointer to the strings of package full names. - /// - /// - /// Type: UINT32* - /// A pointer to a variable that holds the number of characters in the string of package full names. - /// - /// First you pass NULL to buffer to get the number of characters. You use this number to allocate memory space for buffer. - /// Then you pass the address of this number to fill buffer. - /// - /// - /// - /// Type: WCHAR* - /// The string of characters for all of the package full names. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// One or more buffer is not large enough to hold the data. The required size is specified by either count or buffer. - /// - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagesbypackagefamily LONG - // GetPackagesByPackageFamily( PCWSTR packageFamilyName, UINT32 *count, PWSTR *packageFullNames, UINT32 *bufferLength, WCHAR *buffer ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "C2163203-D654-4491-9090-0CC43F42EC35")] - public static extern Win32Error GetPackagesByPackageFamily(string packageFamilyName, ref uint count, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1)] string[] packageFullNames, ref uint bufferLength, IntPtr buffer); + /// + /// Gets the packages with the specified family name for the current user. + /// + /// + /// Type: PCWSTR + /// The package family name. + /// + /// + /// Type: UINT32* + /// A pointer to a variable that holds the number of package full names. + /// + /// First you pass NULL to packageFullNames to get the number of package full names. You use this number to allocate memory + /// space for packageFullNames. Then you pass the address of this number to fill packageFullNames. + /// + /// + /// + /// Type: PWSTR* + /// A pointer to the strings of package full names. + /// + /// + /// Type: UINT32* + /// A pointer to a variable that holds the number of characters in the string of package full names. + /// + /// First you pass NULL to buffer to get the number of characters. You use this number to allocate memory space for buffer. + /// Then you pass the address of this number to fill buffer. + /// + /// + /// + /// Type: WCHAR* + /// The string of characters for all of the package full names. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// One or more buffer is not large enough to hold the data. The required size is specified by either count or buffer. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getpackagesbypackagefamily LONG + // GetPackagesByPackageFamily( PCWSTR packageFamilyName, UINT32 *count, PWSTR *packageFullNames, UINT32 *bufferLength, WCHAR *buffer ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "C2163203-D654-4491-9090-0CC43F42EC35")] + public static extern Win32Error GetPackagesByPackageFamily(string packageFamilyName, ref uint count, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1)] string[] packageFullNames, ref uint bufferLength, IntPtr buffer); - /// - /// Gets the origin of the specified package. - /// - /// - /// Type: PCWSTR - /// The full name of the package. - /// - /// - /// Type: PackageOrigin* - /// - /// A pointer to a variable that receives a PackageOrigin-typed value that indicates the origin of the package specified by packageFullName. - /// - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INVALID_PARAMETER - /// The packageFullName parameter isn't valid. - /// - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getstagedpackageorigin LONG GetStagedPackageOrigin( - // PCWSTR packageFullName, PackageOrigin *origin ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "7A1EE2CA-83CE-4E03-85A5-0061E29EB49B")] - public static extern Win32Error GetStagedPackageOrigin(string packageFullName, out PackageOrigin origin); + /// + /// Gets the origin of the specified package. + /// + /// + /// Type: PCWSTR + /// The full name of the package. + /// + /// + /// Type: PackageOrigin* + /// + /// A pointer to a variable that receives a PackageOrigin-typed value that indicates the origin of the package specified by packageFullName. + /// + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INVALID_PARAMETER + /// The packageFullName parameter isn't valid. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getstagedpackageorigin LONG GetStagedPackageOrigin( + // PCWSTR packageFullName, PackageOrigin *origin ); + [DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "7A1EE2CA-83CE-4E03-85A5-0061E29EB49B")] + public static extern Win32Error GetStagedPackageOrigin(string packageFullName, out PackageOrigin origin); - /// - /// Gets the path of the specified staged package. - /// - /// - /// Type: PCWSTR - /// The full name of the staged package. - /// - /// - /// Type: UINT32* - /// - /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package path string, which includes the null-terminator. - /// - /// - /// First you pass NULL to path to get the number of characters. You use this number to allocate memory space for path. Then - /// you pass the address of this memory space to fill path. - /// - /// - /// - /// Type: PWSTR - /// A pointer to memory space that receives the package path string, which includes the null-terminator. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength. - /// - /// - /// - /// - /// - /// This function succeeds if the package is staged, regardless of the user context or if the package is registered for the current user. - /// - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getstagedpackagepathbyfullname LONG - // GetStagedPackagePathByFullName( PCWSTR packageFullName, UINT32 *pathLength, PWSTR path ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "F0A37D77-6262-44B1-BEC5-083E41BDE139")] - public static extern Win32Error GetStagedPackagePathByFullName([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, ref uint pathLength, - [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path); + /// + /// Gets the path of the specified staged package. + /// + /// + /// Type: PCWSTR + /// The full name of the staged package. + /// + /// + /// Type: UINT32* + /// + /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package path string, which includes the null-terminator. + /// + /// + /// First you pass NULL to path to get the number of characters. You use this number to allocate memory space for path. Then + /// you pass the address of this memory space to fill path. + /// + /// + /// + /// Type: PWSTR + /// A pointer to memory space that receives the package path string, which includes the null-terminator. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength. + /// + /// + /// + /// + /// + /// This function succeeds if the package is staged, regardless of the user context or if the package is registered for the current user. + /// + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-getstagedpackagepathbyfullname LONG + // GetStagedPackagePathByFullName( PCWSTR packageFullName, UINT32 *pathLength, PWSTR path ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "F0A37D77-6262-44B1-BEC5-083E41BDE139")] + public static extern Win32Error GetStagedPackagePathByFullName([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, ref uint pathLength, + [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path); - /// - /// Gets the path of the specified staged package, with the option to specify the type of folder path to retrieve for the package. - /// - /// - /// Type: PCWSTR - /// The full name of the staged package. - /// - /// - /// Type: PackagePathType - /// Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder). - /// - /// - /// Type: UINT32* - /// - /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package path string, which includes the null-terminator. - /// - /// - /// First you pass NULL to path to get the number of characters. You use this number to allocate memory space for path. Then - /// you pass the address of this memory space to fill path. - /// - /// - /// - /// Type: PWSTR - /// A pointer to memory space that receives the package path string, which includes the null-terminator. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength. - /// - /// - /// - /// - /// The packagePathType parameter is useful for applications that use the windows.mutablePackageDirectories extension in their - /// package manifest. This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of - /// the application's install folder are projected so that users can modify the installation files. This feature is currently - /// available only for certain types of desktop PC games that are published by Microsoft and our partners, and it enables these - /// types of games to support mods. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getstagedpackagepathbyfullname2 LONG - // GetStagedPackagePathByFullName2( PCWSTR packageFullName, PackagePathType packagePathType, UINT32 *pathLength, PWSTR path ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h")] - public static extern Win32Error GetStagedPackagePathByFullName2([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, PackagePathType packagePathType, - ref uint pathLength, [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path); + /// + /// Gets the path of the specified staged package, with the option to specify the type of folder path to retrieve for the package. + /// + /// + /// Type: PCWSTR + /// The full name of the staged package. + /// + /// + /// Type: PackagePathType + /// Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder). + /// + /// + /// Type: UINT32* + /// + /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package path string, which includes the null-terminator. + /// + /// + /// First you pass NULL to path to get the number of characters. You use this number to allocate memory space for path. Then + /// you pass the address of this memory space to fill path. + /// + /// + /// + /// Type: PWSTR + /// A pointer to memory space that receives the package path string, which includes the null-terminator. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength. + /// + /// + /// + /// + /// The packagePathType parameter is useful for applications that use the windows.mutablePackageDirectories extension in their + /// package manifest. This extension specifies a folder under the %ProgramFiles%\ModifiableWindowsApps path where the contents of + /// the application's install folder are projected so that users can modify the installation files. This feature is currently + /// available only for certain types of desktop PC games that are published by Microsoft and our partners, and it enables these + /// types of games to support mods. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getstagedpackagepathbyfullname2 LONG + // GetStagedPackagePathByFullName2( PCWSTR packageFullName, PackagePathType packagePathType, UINT32 *pathLength, PWSTR path ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h")] + public static extern Win32Error GetStagedPackagePathByFullName2([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, PackagePathType packagePathType, + ref uint pathLength, [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path); - /// - /// Opens the package information of the specified package. - /// - /// - /// Type: PCWSTR - /// The full name of the package. - /// - /// - /// Type: const UINT32 - /// Reserved; must be 0. - /// - /// - /// Type: PACKAGE_INFO_REFERENCE* - /// A reference to package information. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_NOT_FOUND - /// The package is not installed for the current user. - /// - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-openpackageinfobyfullname LONG - // OpenPackageInfoByFullName( PCWSTR packageFullName, const UINT32 reserved, PACKAGE_INFO_REFERENCE *packageInfoReference ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "9ECFC757-1CB3-43A1-BA45-9AF72CAB240E")] - public static extern Win32Error OpenPackageInfoByFullName([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, uint reserved, ref PACKAGE_INFO_REFERENCE packageInfoReference); + /// + /// Opens the package information of the specified package. + /// + /// + /// Type: PCWSTR + /// The full name of the package. + /// + /// + /// Type: const UINT32 + /// Reserved; must be 0. + /// + /// + /// Type: PACKAGE_INFO_REFERENCE* + /// A reference to package information. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_NOT_FOUND + /// The package is not installed for the current user. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-openpackageinfobyfullname LONG + // OpenPackageInfoByFullName( PCWSTR packageFullName, const UINT32 reserved, PACKAGE_INFO_REFERENCE *packageInfoReference ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "9ECFC757-1CB3-43A1-BA45-9AF72CAB240E")] + public static extern Win32Error OpenPackageInfoByFullName([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, uint reserved, ref PACKAGE_INFO_REFERENCE packageInfoReference); - /// - /// Gets the package family name for the specified package full name. - /// - /// - /// Type: PCWSTR - /// The full name of a package. - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the packageFamilyName buffer, in characters. On output, the size of the package family name returned, in - /// characters, including the null terminator. - /// - /// - /// - /// Type: PWSTR - /// The package family name. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by packageFamilyNameLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-packagefamilynamefromfullname LONG - // PackageFamilyNameFromFullName( PCWSTR packageFullName, UINT32 *packageFamilyNameLength, PWSTR packageFamilyName ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "98E95CE5-E970-4A19-BAD3-994DAEC4BEA0")] - public static extern Win32Error PackageFamilyNameFromFullName(string packageFullName, ref uint packageFamilyNameLength, - [Optional] StringBuilder packageFamilyName); + /// + /// Gets the package family name for the specified package full name. + /// + /// + /// Type: PCWSTR + /// The full name of a package. + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the packageFamilyName buffer, in characters. On output, the size of the package family name returned, in + /// characters, including the null terminator. + /// + /// + /// + /// Type: PWSTR + /// The package family name. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by packageFamilyNameLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-packagefamilynamefromfullname LONG + // PackageFamilyNameFromFullName( PCWSTR packageFullName, UINT32 *packageFamilyNameLength, PWSTR packageFamilyName ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "98E95CE5-E970-4A19-BAD3-994DAEC4BEA0")] + public static extern Win32Error PackageFamilyNameFromFullName(string packageFullName, ref uint packageFamilyNameLength, + [Optional] StringBuilder packageFamilyName); - /// - /// Gets the package family name for the specified package identifier. - /// - /// - /// Type: const PACKAGE_ID* - /// The package identifier. - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the packageFamilyName buffer, in characters. On output, the size of the package family name returned, in - /// characters, including the null terminator. - /// - /// - /// - /// Type: PWSTR - /// The package family name. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by packageFamilyNameLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-packagefamilynamefromid LONG PackageFamilyNameFromId( - // const PACKAGE_ID *packageId, UINT32 *packageFamilyNameLength, PWSTR packageFamilyName ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "198DAB6B-21D2-4ACB-87DF-B3F4EFBEE323")] - public static extern Win32Error PackageFamilyNameFromId(in PACKAGE_ID packageId, ref uint packageFamilyNameLength, - [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder packageFamilyName); + /// + /// Gets the package family name for the specified package identifier. + /// + /// + /// Type: const PACKAGE_ID* + /// The package identifier. + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the packageFamilyName buffer, in characters. On output, the size of the package family name returned, in + /// characters, including the null terminator. + /// + /// + /// + /// Type: PWSTR + /// The package family name. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by packageFamilyNameLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-packagefamilynamefromid LONG PackageFamilyNameFromId( + // const PACKAGE_ID *packageId, UINT32 *packageFamilyNameLength, PWSTR packageFamilyName ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "198DAB6B-21D2-4ACB-87DF-B3F4EFBEE323")] + public static extern Win32Error PackageFamilyNameFromId(in PACKAGE_ID packageId, ref uint packageFamilyNameLength, + [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder packageFamilyName); - /// - /// Gets the package full name for the specified package identifier (ID). - /// - /// - /// Type: const PACKAGE_ID* - /// The package ID. - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the packageFullName buffer, in characters. On output, the size of the package full name returned, in - /// characters, including the null terminator. - /// - /// - /// - /// Type: PWSTR - /// The package full name. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by packageFullNameLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-packagefullnamefromid LONG PackageFullNameFromId( const - // PACKAGE_ID *packageId, UINT32 *packageFullNameLength, PWSTR packageFullName ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "0024AF55-295E-49B1-90C2-9144D336529B")] - public static extern Win32Error PackageFullNameFromId(in PACKAGE_ID packageId, ref uint packageFullNameLength, - [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder packageFullName); + /// + /// Gets the package full name for the specified package identifier (ID). + /// + /// + /// Type: const PACKAGE_ID* + /// The package ID. + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the packageFullName buffer, in characters. On output, the size of the package full name returned, in + /// characters, including the null terminator. + /// + /// + /// + /// Type: PWSTR + /// The package full name. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by packageFullNameLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-packagefullnamefromid LONG PackageFullNameFromId( const + // PACKAGE_ID *packageId, UINT32 *packageFullNameLength, PWSTR packageFullName ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "0024AF55-295E-49B1-90C2-9144D336529B")] + public static extern Win32Error PackageFullNameFromId(in PACKAGE_ID packageId, ref uint packageFullNameLength, + [Optional, MarshalAs(UnmanagedType.LPWStr)] StringBuilder packageFullName); - /// - /// Gets the package identifier (ID) for the specified package full name. - /// - /// - /// Type: PCWSTR - /// The full name of a package. - /// - /// - /// Type: const UINT32 - /// The package constants that specify how package information is retrieved. The PACKAGE_INFORMATION_* flags are supported. - /// - /// - /// Type: UINT32* - /// On input, the size of buffer, in bytes. On output, the size of the data returned, in bytes. - /// - /// - /// Type: BYTE* - /// The package ID, represented as a PACKAGE_ID structure. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. - /// - /// - /// ERROR_NOT_FOUND - /// The package is not installed for the user. - /// - /// - /// - /// - /// If flags specifies PACKAGE_INFORMATION_BASIC, the following fields are retrieved: - /// - /// - /// name - /// - /// - /// processorArchitecture - /// - /// - /// publisherId - /// - /// - /// resourceId - /// - /// - /// version - /// - /// - /// If flags specifies PACKAGE_INFORMATION_FULL, the following fields are retrieved: - /// - /// - /// name - /// - /// - /// processorArchitecture - /// - /// - /// publisher - /// - /// - /// publisherId - /// - /// - /// resourceId - /// - /// - /// version - /// - /// - /// - /// A request for PACKAGE_INFORMATION_FULL succeeds only if the package corresponding to packageFullName is installed for and - /// accessible to the current user. If the package full name is syntactically correct but does not correspond to a package that is - /// installed for and accessible to the current user, the function returns ERROR_NOT_FOUND. - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-packageidfromfullname LONG PackageIdFromFullName( - // PCWSTR packageFullName, const UINT32 flags, UINT32 *bufferLength, BYTE *buffer ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "EED832F8-E4F7-4A0F-93E2-451F78F67767")] - public static extern Win32Error PackageIdFromFullName([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, PACKAGE_FLAGS flags, ref uint bufferLength, IntPtr buffer); + /// + /// Gets the package identifier (ID) for the specified package full name. + /// + /// + /// Type: PCWSTR + /// The full name of a package. + /// + /// + /// Type: const UINT32 + /// The package constants that specify how package information is retrieved. The PACKAGE_INFORMATION_* flags are supported. + /// + /// + /// Type: UINT32* + /// On input, the size of buffer, in bytes. On output, the size of the data returned, in bytes. + /// + /// + /// Type: BYTE* + /// The package ID, represented as a PACKAGE_ID structure. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// The buffer is not large enough to hold the data. The required size is specified by bufferLength. + /// + /// + /// ERROR_NOT_FOUND + /// The package is not installed for the user. + /// + /// + /// + /// + /// If flags specifies PACKAGE_INFORMATION_BASIC, the following fields are retrieved: + /// + /// + /// name + /// + /// + /// processorArchitecture + /// + /// + /// publisherId + /// + /// + /// resourceId + /// + /// + /// version + /// + /// + /// If flags specifies PACKAGE_INFORMATION_FULL, the following fields are retrieved: + /// + /// + /// name + /// + /// + /// processorArchitecture + /// + /// + /// publisher + /// + /// + /// publisherId + /// + /// + /// resourceId + /// + /// + /// version + /// + /// + /// + /// A request for PACKAGE_INFORMATION_FULL succeeds only if the package corresponding to packageFullName is installed for and + /// accessible to the current user. If the package full name is syntactically correct but does not correspond to a package that is + /// installed for and accessible to the current user, the function returns ERROR_NOT_FOUND. + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-packageidfromfullname LONG PackageIdFromFullName( + // PCWSTR packageFullName, const UINT32 flags, UINT32 *bufferLength, BYTE *buffer ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "EED832F8-E4F7-4A0F-93E2-451F78F67767")] + public static extern Win32Error PackageIdFromFullName([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, PACKAGE_FLAGS flags, ref uint bufferLength, IntPtr buffer); - /// - /// Gets the package name and publisher identifier (ID) for the specified package family name. - /// - /// - /// Type: PCWSTR - /// The family name of a package. - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the packageName buffer, in characters. On output, the size of the package name returned, in characters, - /// including the null-terminator. - /// - /// - /// - /// Type: PWSTR - /// The package name. - /// - /// - /// Type: UINT32* - /// - /// On input, the size of the packagePublishId buffer, in characters. On output, the size of the publisher ID returned, in - /// characters, including the null-terminator. - /// - /// - /// - /// Type: PWSTR - /// The package publisher ID. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// One of the buffers is not large enough to hold the data. The required sizes are specified by packageNameLength and packagePublisherIdLength. - /// - /// - /// - /// - /// For info about string size limits, see Identity constants. - /// Examples - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-packagenameandpublisheridfromfamilyname LONG - // PackageNameAndPublisherIdFromFamilyName( PCWSTR packageFamilyName, UINT32 *packageNameLength, PWSTR packageName, UINT32 - // *packagePublisherIdLength, PWSTR packagePublisherId ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "4AA5BD75-F865-40D6-9C10-E54C197D47C4")] - public static extern Win32Error PackageNameAndPublisherIdFromFamilyName(string packageFamilyName, ref uint packageNameLength, - [Optional] StringBuilder packageName, ref uint packagePublisherIdLength, [Optional] StringBuilder packagePublisherId); + /// + /// Gets the package name and publisher identifier (ID) for the specified package family name. + /// + /// + /// Type: PCWSTR + /// The family name of a package. + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the packageName buffer, in characters. On output, the size of the package name returned, in characters, + /// including the null-terminator. + /// + /// + /// + /// Type: PWSTR + /// The package name. + /// + /// + /// Type: UINT32* + /// + /// On input, the size of the packagePublishId buffer, in characters. On output, the size of the publisher ID returned, in + /// characters, including the null-terminator. + /// + /// + /// + /// Type: PWSTR + /// The package publisher ID. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// One of the buffers is not large enough to hold the data. The required sizes are specified by packageNameLength and packagePublisherIdLength. + /// + /// + /// + /// + /// For info about string size limits, see Identity constants. + /// Examples + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-packagenameandpublisheridfromfamilyname LONG + // PackageNameAndPublisherIdFromFamilyName( PCWSTR packageFamilyName, UINT32 *packageNameLength, PWSTR packageName, UINT32 + // *packagePublisherIdLength, PWSTR packagePublisherId ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "4AA5BD75-F865-40D6-9C10-E54C197D47C4")] + public static extern Win32Error PackageNameAndPublisherIdFromFamilyName(string packageFamilyName, ref uint packageNameLength, + [Optional] StringBuilder packageName, ref uint packagePublisherIdLength, [Optional] StringBuilder packagePublisherId); - /// - /// Deconstructs an application user model ID to its package family name and package relative application ID (PRAID). - /// - /// - /// Type: PCWSTR - /// The app user model ID. - /// - /// - /// Type: UINT32* - /// - /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package family name string, which includes - /// the null-terminator. - /// - /// - /// First you pass NULL to packageFamilyName to get the number of characters. You use this number to allocate memory space - /// for packageFamilyName. Then you pass the address of this memory space to fill packageFamilyName. - /// - /// - /// - /// Type: PWSTR - /// A pointer to memory space that receives the package family name string, which includes the null-terminator. - /// - /// - /// Type: UINT32* - /// - /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package-relative app ID string, which - /// includes the null-terminator. - /// - /// - /// First you pass NULL to packageRelativeApplicationId to get the number of characters. You use this number to allocate - /// memory space for packageRelativeApplicationId. Then you pass the address of this memory space to fill packageRelativeApplicationId. - /// - /// - /// - /// Type: PWSTR - /// A pointer to memory space that receives the package-relative app ID (PRAID) string, which includes the null-terminator. - /// - /// - /// Type: LONG - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// ERROR_INVALID_PARAMETER - /// The applicationUserModelId parameter isn't valid. - /// - /// - /// ERROR_INSUFFICIENT_BUFFER - /// - /// The buffer specified by packageFamilyName or packageRelativeApplicationId is not large enough to hold the data; the required - /// buffer size, in WCHARs, is stored in the variable pointed to by packageFamilyNameLength or packageRelativeApplicationIdLength. - /// - /// - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-parseapplicationusermodelid LONG - // ParseApplicationUserModelId( PCWSTR applicationUserModelId, UINT32 *packageFamilyNameLength, PWSTR packageFamilyName, UINT32 - // *packageRelativeApplicationIdLength, PWSTR packageRelativeApplicationId ); - [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] - [PInvokeData("appmodel.h", MSDNShortId = "03B29E82-611F-47D1-8CB6-047B9BEB4D9E")] - public static extern Win32Error ParseApplicationUserModelId(string applicationUserModelId, ref uint packageFamilyNameLength, - [Optional] StringBuilder packageFamilyName, ref uint packageRelativeApplicationIdLength, [Optional] StringBuilder packageRelativeApplicationId); + /// + /// Deconstructs an application user model ID to its package family name and package relative application ID (PRAID). + /// + /// + /// Type: PCWSTR + /// The app user model ID. + /// + /// + /// Type: UINT32* + /// + /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package family name string, which includes + /// the null-terminator. + /// + /// + /// First you pass NULL to packageFamilyName to get the number of characters. You use this number to allocate memory space + /// for packageFamilyName. Then you pass the address of this memory space to fill packageFamilyName. + /// + /// + /// + /// Type: PWSTR + /// A pointer to memory space that receives the package family name string, which includes the null-terminator. + /// + /// + /// Type: UINT32* + /// + /// A pointer to a variable that holds the number of characters ( WCHAR s) in the package-relative app ID string, which + /// includes the null-terminator. + /// + /// + /// First you pass NULL to packageRelativeApplicationId to get the number of characters. You use this number to allocate + /// memory space for packageRelativeApplicationId. Then you pass the address of this memory space to fill packageRelativeApplicationId. + /// + /// + /// + /// Type: PWSTR + /// A pointer to memory space that receives the package-relative app ID (PRAID) string, which includes the null-terminator. + /// + /// + /// Type: LONG + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// ERROR_INVALID_PARAMETER + /// The applicationUserModelId parameter isn't valid. + /// + /// + /// ERROR_INSUFFICIENT_BUFFER + /// + /// The buffer specified by packageFamilyName or packageRelativeApplicationId is not large enough to hold the data; the required + /// buffer size, in WCHARs, is stored in the variable pointed to by packageFamilyNameLength or packageRelativeApplicationIdLength. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/nf-appmodel-parseapplicationusermodelid LONG + // ParseApplicationUserModelId( PCWSTR applicationUserModelId, UINT32 *packageFamilyNameLength, PWSTR packageFamilyName, UINT32 + // *packageRelativeApplicationIdLength, PWSTR packageRelativeApplicationId ); + [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] + [PInvokeData("appmodel.h", MSDNShortId = "03B29E82-611F-47D1-8CB6-047B9BEB4D9E")] + public static extern Win32Error ParseApplicationUserModelId(string applicationUserModelId, ref uint packageFamilyNameLength, + [Optional] StringBuilder packageFamilyName, ref uint packageRelativeApplicationIdLength, [Optional] StringBuilder packageRelativeApplicationId); - /// - /// Removes a resolved package dependency from the current process' package graph (that is, a run-time reference for a framework - /// package dependency that was added by using the AddPackageDependency method). - /// - /// - /// Type: PACKAGEDEPENDENCY_CONTEXT - /// The handle of the package dependency to remove. - /// - /// - /// Type: HRESULT - /// - /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error - /// codes include the following. - /// - /// - /// - /// Return code - /// Description - /// - /// - /// E_INVALIDARG - /// The packageDependencyContext parameter is NULL on input. - /// - /// - /// - /// - /// This function does not unload loaded resources such as DLLs. After removing a package dependency, any files loaded from the - /// package can continue to be used. Future file resolution will fail to see the removed package dependency. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-removepackagedependency HRESULT RemovePackageDependency( - // PACKAGEDEPENDENCY_CONTEXT packageDependencyContext ); - [DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)] - [PInvokeData("appmodel.h", MSDNShortId = "NF:appmodel.RemovePackageDependency")] - public static extern HRESULT RemovePackageDependency([In] PACKAGEDEPENDENCY_CONTEXT packageDependencyContext); + /// + /// Removes a resolved package dependency from the current process' package graph (that is, a run-time reference for a framework + /// package dependency that was added by using the AddPackageDependency method). + /// + /// + /// Type: PACKAGEDEPENDENCY_CONTEXT + /// The handle of the package dependency to remove. + /// + /// + /// Type: HRESULT + /// + /// If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error + /// codes include the following. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// E_INVALIDARG + /// The packageDependencyContext parameter is NULL on input. + /// + /// + /// + /// + /// This function does not unload loaded resources such as DLLs. After removing a package dependency, any files loaded from the + /// package can continue to be used. Future file resolution will fail to see the removed package dependency. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-removepackagedependency HRESULT RemovePackageDependency( + // PACKAGEDEPENDENCY_CONTEXT packageDependencyContext ); + [DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)] + [PInvokeData("appmodel.h", MSDNShortId = "NF:appmodel.RemovePackageDependency")] + public static extern HRESULT RemovePackageDependency([In] PACKAGEDEPENDENCY_CONTEXT packageDependencyContext); /// Creates an install-time reference for a framework package dependency for the current app, using the specified package family name, minimum version, and additional criteria. /// @@ -2356,9 +2356,9 @@ namespace Vanara.PInvoke [DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)] [PInvokeData("appmodel.h", MSDNShortId = "NF:appmodel.TryCreatePackageDependency")] public static extern HRESULT TryCreatePackageDependency([In, Optional] PSID user, [MarshalAs(UnmanagedType.LPWStr)] string packageFamilyName, - PACKAGE_VERSION minVersion, PackageDependencyProcessorArchitectures packageDependencyProcessorArchitectures, - PackageDependencyLifetimeKind lifetimeKind, [MarshalAs(UnmanagedType.LPWStr)] string lifetimeArtifact, - CreatePackageDependencyOptions options, out SafeHeapBlock packageDependencyId); + PACKAGE_VERSION minVersion, PackageDependencyProcessorArchitectures packageDependencyProcessorArchitectures, + PackageDependencyLifetimeKind lifetimeKind, [MarshalAs(UnmanagedType.LPWStr)] string lifetimeArtifact, + CreatePackageDependencyOptions options, out SafeHeapBlock packageDependencyId); /// /// Represents package identification information, such as name, version, and publisher. @@ -2369,186 +2369,186 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/ns-appmodel-package_id typedef struct PACKAGE_ID { UINT32 reserved; // UINT32 processorArchitecture; PACKAGE_VERSION version; PWSTR name; PWSTR publisher; PWSTR resourceId; PWSTR publisherId; }; [PInvokeData("appmodel.h", MSDNShortId = "4B15281A-2227-47B7-A750-0A01DB8543FC")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct PACKAGE_ID - { - /// - /// Type: UINT32 - /// Reserved; do not use. - /// - public uint reserved; + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct PACKAGE_ID + { + /// + /// Type: UINT32 + /// Reserved; do not use. + /// + public uint reserved; - /// - /// Type: UINT32 - /// - /// The processor architecture of the package. This member must be one of the values of the APPX_PACKAGE_ARCHITECTURE enumeration. - /// - /// - public APPX_PACKAGE_ARCHITECTURE processorArchitecture; + /// + /// Type: UINT32 + /// + /// The processor architecture of the package. This member must be one of the values of the APPX_PACKAGE_ARCHITECTURE enumeration. + /// + /// + public APPX_PACKAGE_ARCHITECTURE processorArchitecture; - /// - /// Type: PACKAGE_VERSION - /// The version of the package. - /// - public PACKAGE_VERSION version; + /// + /// Type: PACKAGE_VERSION + /// The version of the package. + /// + public PACKAGE_VERSION version; - /// - /// Type: PWSTR - /// The name of the package. - /// - public string name; + /// + /// Type: PWSTR + /// The name of the package. + /// + public string name; - /// - /// Type: PWSTR - /// The publisher of the package. If there is no publisher for the package, this member is NULL. - /// - public string publisher; + /// + /// Type: PWSTR + /// The publisher of the package. If there is no publisher for the package, this member is NULL. + /// + public string publisher; - /// - /// Type: PWSTR - /// The resource identifier (ID) of the package. If there is no resource ID for the package, this member is NULL. - /// - public string resourceId; + /// + /// Type: PWSTR + /// The resource identifier (ID) of the package. If there is no resource ID for the package, this member is NULL. + /// + public string resourceId; - /// - /// Type: PWSTR - /// The publisher identifier (ID) of the package. If there is no publisher ID for the package, this member is NULL. - /// - public string publisherId; - } + /// + /// Type: PWSTR + /// The publisher identifier (ID) of the package. If there is no publisher ID for the package, this member is NULL. + /// + public string publisherId; + } - /// Represents package identification information that includes the package identifier, full name, and install location. - /// For info about string size limits, see Identity constants. - // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ns-appmodel-package_info typedef struct PACKAGE_INFO { UINT32 - // reserved; UINT32 flags; PWSTR path; PWSTR packageFullName; PWSTR packageFamilyName; PACKAGE_ID packageId; } PACKAGE_INFO; - [PInvokeData("appmodel.h", MSDNShortId = "0DDE00D1-9C5F-4F2B-8110-A92B1FFA1B64")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct PACKAGE_INFO - { - /// Reserved; do not use. - public uint reserved; + /// Represents package identification information that includes the package identifier, full name, and install location. + /// For info about string size limits, see Identity constants. + // https://docs.microsoft.com/en-us/windows/win32/api/appmodel/ns-appmodel-package_info typedef struct PACKAGE_INFO { UINT32 + // reserved; UINT32 flags; PWSTR path; PWSTR packageFullName; PWSTR packageFamilyName; PACKAGE_ID packageId; } PACKAGE_INFO; + [PInvokeData("appmodel.h", MSDNShortId = "0DDE00D1-9C5F-4F2B-8110-A92B1FFA1B64")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct PACKAGE_INFO + { + /// Reserved; do not use. + public uint reserved; - /// Properties of the package. - public uint flags; + /// Properties of the package. + public uint flags; - /// The location of the package. - [MarshalAs(UnmanagedType.LPWStr)] public string path; + /// The location of the package. + [MarshalAs(UnmanagedType.LPWStr)] public string path; - /// The package full name/ - [MarshalAs(UnmanagedType.LPWStr)] public string packageFullName; + /// The package full name/ + [MarshalAs(UnmanagedType.LPWStr)] public string packageFullName; - /// The package family name. - [MarshalAs(UnmanagedType.LPWStr)] public string packageFamilyName; + /// The package family name. + [MarshalAs(UnmanagedType.LPWStr)] public string packageFamilyName; - /// The package identifier (ID). - public PACKAGE_ID packageId; - } + /// The package identifier (ID). + public PACKAGE_ID packageId; + } - /// A reference to package information. - [PInvokeData("appmodel.h")] - [StructLayout(LayoutKind.Sequential)] - public struct PACKAGE_INFO_REFERENCE - { - /// Reserved. - public IntPtr reserved; - } + /// A reference to package information. + [PInvokeData("appmodel.h")] + [StructLayout(LayoutKind.Sequential)] + public struct PACKAGE_INFO_REFERENCE + { + /// Reserved. + public IntPtr reserved; + } - /// - /// Represents the package version information. - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/ns-appmodel-package_version typedef struct PACKAGE_VERSION { union - // { UINT64 Version; struct { USHORT Revision; USHORT Build; USHORT Minor; USHORT Major; } DUMMYSTRUCTNAME; } DUMMYUNIONNAME; }; - [PInvokeData("appmodel.h", MSDNShortId = "8543DF84-A908-4DF5-AEE6-169FECB2AA97")] - [StructLayout(LayoutKind.Explicit)] - public struct PACKAGE_VERSION - { - /// - /// Type: UINT64 - /// The full version number of the package represented as a single integral value. - /// - [FieldOffset(0)] - public ulong Version; + /// + /// Represents the package version information. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/appmodel/ns-appmodel-package_version typedef struct PACKAGE_VERSION { union + // { UINT64 Version; struct { USHORT Revision; USHORT Build; USHORT Minor; USHORT Major; } DUMMYSTRUCTNAME; } DUMMYUNIONNAME; }; + [PInvokeData("appmodel.h", MSDNShortId = "8543DF84-A908-4DF5-AEE6-169FECB2AA97")] + [StructLayout(LayoutKind.Explicit)] + public struct PACKAGE_VERSION + { + /// + /// Type: UINT64 + /// The full version number of the package represented as a single integral value. + /// + [FieldOffset(0)] + public ulong Version; - /// Parts of the Version. - [FieldOffset(0)] - public DUMMYSTRUCTNAME Parts; + /// Parts of the Version. + [FieldOffset(0)] + public DUMMYSTRUCTNAME Parts; - /// Parts of the Version. - public struct DUMMYSTRUCTNAME - { - /// - /// Type: USHORT - /// The revision version number of the package. - /// - public ushort Revision; + /// Parts of the Version. + public struct DUMMYSTRUCTNAME + { + /// + /// Type: USHORT + /// The revision version number of the package. + /// + public ushort Revision; - /// - /// Type: USHORT - /// The build version number of the package. - /// - public ushort Build; + /// + /// Type: USHORT + /// The build version number of the package. + /// + public ushort Build; - /// - /// Type: USHORT - /// The minor version number of the package. - /// - public ushort Minor; + /// + /// Type: USHORT + /// The minor version number of the package. + /// + public ushort Minor; - /// - /// Type: USHORT - /// The major version number of the package. - /// - public ushort Major; - } - } + /// + /// Type: USHORT + /// The major version number of the package. + /// + public ushort Major; + } + } - /// Provides a handle to a package dependency context. - [PInvokeData("appmodel.h")] - [StructLayout(LayoutKind.Sequential)] - public struct PACKAGEDEPENDENCY_CONTEXT : IHandle - { - private readonly IntPtr handle; + /// Provides a handle to a package dependency context. + [PInvokeData("appmodel.h")] + [StructLayout(LayoutKind.Sequential)] + public struct PACKAGEDEPENDENCY_CONTEXT : IHandle + { + private readonly IntPtr handle; - /// Initializes a new instance of the struct. - /// An object that represents the pre-existing handle to use. - public PACKAGEDEPENDENCY_CONTEXT(IntPtr preexistingHandle) => handle = preexistingHandle; + /// Initializes a new instance of the struct. + /// An object that represents the pre-existing handle to use. + public PACKAGEDEPENDENCY_CONTEXT(IntPtr preexistingHandle) => handle = preexistingHandle; - /// Returns an invalid handle by instantiating a object with . - public static PACKAGEDEPENDENCY_CONTEXT NULL => new(IntPtr.Zero); + /// Returns an invalid handle by instantiating a object with . + public static PACKAGEDEPENDENCY_CONTEXT NULL => new(IntPtr.Zero); - /// Gets a value indicating whether this instance is a null handle. - public bool IsNull => handle == IntPtr.Zero; + /// Gets a value indicating whether this instance is a null handle. + public bool IsNull => handle == IntPtr.Zero; - /// Performs an explicit conversion from to . - /// The handle. - /// The result of the conversion. - public static explicit operator IntPtr(PACKAGEDEPENDENCY_CONTEXT h) => h.handle; + /// Performs an explicit conversion from to . + /// The handle. + /// The result of the conversion. + public static explicit operator IntPtr(PACKAGEDEPENDENCY_CONTEXT h) => h.handle; - /// Performs an implicit conversion from to . - /// The pointer to a handle. - /// The result of the conversion. - public static implicit operator PACKAGEDEPENDENCY_CONTEXT(IntPtr h) => new(h); + /// Performs an implicit conversion from to . + /// The pointer to a handle. + /// The result of the conversion. + public static implicit operator PACKAGEDEPENDENCY_CONTEXT(IntPtr h) => new(h); - /// Implements the operator !=. - /// The first handle. - /// The second handle. - /// The result of the operator. - public static bool operator !=(PACKAGEDEPENDENCY_CONTEXT h1, PACKAGEDEPENDENCY_CONTEXT h2) => !(h1 == h2); + /// Implements the operator !=. + /// The first handle. + /// The second handle. + /// The result of the operator. + public static bool operator !=(PACKAGEDEPENDENCY_CONTEXT h1, PACKAGEDEPENDENCY_CONTEXT h2) => !(h1 == h2); - /// Implements the operator ==. - /// The first handle. - /// The second handle. - /// The result of the operator. - public static bool operator ==(PACKAGEDEPENDENCY_CONTEXT h1, PACKAGEDEPENDENCY_CONTEXT h2) => h1.Equals(h2); + /// Implements the operator ==. + /// The first handle. + /// The second handle. + /// The result of the operator. + public static bool operator ==(PACKAGEDEPENDENCY_CONTEXT h1, PACKAGEDEPENDENCY_CONTEXT h2) => h1.Equals(h2); - /// - public override bool Equals(object obj) => obj is PACKAGEDEPENDENCY_CONTEXT h && handle == h.handle; + /// + public override bool Equals(object obj) => obj is PACKAGEDEPENDENCY_CONTEXT h && handle == h.handle; - /// - public override int GetHashCode() => handle.GetHashCode(); + /// + public override int GetHashCode() => handle.GetHashCode(); - /// - public IntPtr DangerousGetHandle() => handle; - } - } + /// + public IntPtr DangerousGetHandle() => handle; + } + } } \ No newline at end of file