mirror of https://github.com/dahall/Vanara.git
Updated Kernel32 with Windows 10 1903 API
parent
4fa31ed4df
commit
1457225dd2
|
@ -0,0 +1,51 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Vanara.PInvoke
|
||||||
|
{
|
||||||
|
public static partial class Kernel32
|
||||||
|
{
|
||||||
|
/// <summary>The <c>IsApiSetImplemented</c> function tests if a specified API set is present on the computer.</summary>
|
||||||
|
/// <param name="Contract">Specifies the name of the API set to query. For more info, see the Remarks section.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>
|
||||||
|
/// <c>IsApiSetImplemented</c> returns <c>TRUE</c> if the specified API set is present. In this case, APIs in the target API set
|
||||||
|
/// have valid implementations on the current platform.
|
||||||
|
/// </para>
|
||||||
|
/// <para>Otherwise, this function returns <c>FALSE</c>.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>
|
||||||
|
/// On OneCore, APIs are organized into functional groups called API sets. Depending on applicability, a given API set may be
|
||||||
|
/// unavailable on the target platform.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// When writing code that targets OneCore and Desktop platforms, you may see ApiValidator errors during compilation if your code
|
||||||
|
/// calls APIs from API sets not present on the computer.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// To fix this problem, wrap the API call in <c>IsApiSetImplemented</c>. This function tests at runtime if the specified API set is
|
||||||
|
/// present on the target platform.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// To determine the API set for a given API, find the API name on the OneCoreUap umbrella library page and remove the suffix from
|
||||||
|
/// the requirements entry.
|
||||||
|
/// </para>
|
||||||
|
/// <para>By making use of <c>IsApiSetImplemented</c>, you can target OneCore and Desktop systems with a single binary.</para>
|
||||||
|
/// <para>
|
||||||
|
/// You don't need to call <c>IsApiSetImplemented</c> for universal APIs because they are by definition present on both OneCore and
|
||||||
|
/// Desktop versions of Windows.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// See the corresponding API reference documentation pages to determine if a given API is universally available. Look for the
|
||||||
|
/// <c>Target Platform</c> line in the requirements block of the documentation page.
|
||||||
|
/// </para>
|
||||||
|
/// <para>For more information and examples of usage, see Building for OneCore.</para>
|
||||||
|
/// </remarks>
|
||||||
|
// https://docs.microsoft.com/en-us/windows/win32/api/apiquery2/nf-apiquery2-isapisetimplemented APICONTRACT BOOL
|
||||||
|
// IsApiSetImplemented( PCSTR Contract );
|
||||||
|
[DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)]
|
||||||
|
[PInvokeData("apiquery2.h", MSDNShortId = "DF177716-9F33-4E39-BD63-D1B8E39CD67C")]
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
public static extern bool IsApiSetImplemented([MarshalAs(UnmanagedType.LPStr)] string Contract);
|
||||||
|
}
|
||||||
|
}
|
|
@ -204,6 +204,35 @@ namespace Vanara.PInvoke
|
||||||
PackageOrigin_LineOfBusiness,
|
PackageOrigin_LineOfBusiness,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Indicates the type of folder path to retrieve in a query for the path or other info about a package.</summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
// 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
|
||||||
|
{
|
||||||
|
/// <summary>Retrieve the package path in the original install folder for the application.</summary>
|
||||||
|
PackagePathType_Install,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the package path in the mutable install folder for the application, if the application is declared as mutable in
|
||||||
|
/// the package manifest.
|
||||||
|
/// </summary>
|
||||||
|
PackagePathType_Mutable,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
PackagePathType_Effective
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves a value indicating whether a process has full or restricted access to the IO devices (file, file stream, directory,
|
/// 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).
|
/// physical disk, volume, console buffer, tape drive, communications resource, mailslot, and pipe).
|
||||||
|
@ -738,6 +767,63 @@ namespace Vanara.PInvoke
|
||||||
[PInvokeData("appmodel.h", MSDNShortId = "A1887D61-0FAD-4BE8-850F-F104CC074798")]
|
[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);
|
public static extern Win32Error GetCurrentPackageInfo(PACKAGE_FLAGS flags, ref uint bufferLength, IntPtr buffer, out uint count);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the package information for the calling process, with the option to specify the type of folder path to retrieve for the package.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="flags">
|
||||||
|
/// <para>Type: <c>const UINT32</c></para>
|
||||||
|
/// <para>The package constants that specify how package information is retrieved. The <c>PACKAGE_FILTER_*</c> flags are supported.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="packagePathType">
|
||||||
|
/// <para>Type: <c>PackagePathType</c></para>
|
||||||
|
/// <para>Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder).</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="bufferLength">
|
||||||
|
/// <para>Type: <c>UINT32*</c></para>
|
||||||
|
/// <para>On input, the size of buffer, in bytes. On output, the size of the array of structures returned, in bytes.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="buffer">
|
||||||
|
/// <para>Type: <c>BYTE*</c></para>
|
||||||
|
/// <para>The package information, represented as an array of PACKAGE_INFO structures.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="count">
|
||||||
|
/// <para>Type: <c>UINT32*</c></para>
|
||||||
|
/// <para>The number of structures in the buffer.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>Type: <c>LONG</c></para>
|
||||||
|
/// <para>
|
||||||
|
/// If the function succeeds it returns <c>ERROR_SUCCESS</c>. Otherwise, the function returns an error code. The possible error
|
||||||
|
/// codes include the following.
|
||||||
|
/// </para>
|
||||||
|
/// <list type="table">
|
||||||
|
/// <listheader>
|
||||||
|
/// <term>Return code</term>
|
||||||
|
/// <term>Description</term>
|
||||||
|
/// </listheader>
|
||||||
|
/// <item>
|
||||||
|
/// <term>APPMODEL_ERROR_NO_PACKAGE</term>
|
||||||
|
/// <term>The process has no package identity.</term>
|
||||||
|
/// </item>
|
||||||
|
/// <item>
|
||||||
|
/// <term>ERROR_INSUFFICIENT_BUFFER</term>
|
||||||
|
/// <term>The buffer is not large enough to hold the data. The required size is specified by bufferLength.</term>
|
||||||
|
/// </item>
|
||||||
|
/// </list>
|
||||||
|
/// </returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
// 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);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Gets the package path for the calling process.</para>
|
/// <para>Gets the package path for the calling process.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -779,6 +865,58 @@ namespace Vanara.PInvoke
|
||||||
[PInvokeData("appmodel.h", MSDNShortId = "46CE81DF-A9D5-492E-AB5E-4F043DC326E2")]
|
[PInvokeData("appmodel.h", MSDNShortId = "46CE81DF-A9D5-492E-AB5E-4F043DC326E2")]
|
||||||
public static extern Win32Error GetCurrentPackagePath(ref uint pathLength, StringBuilder path);
|
public static extern Win32Error GetCurrentPackagePath(ref uint pathLength, StringBuilder path);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the package path for the calling process, with the option to specify the type of folder path to retrieve for the package.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packagePathType">
|
||||||
|
/// <para>Type: <c>PackagePathType</c></para>
|
||||||
|
/// <para>Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder).</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="pathLength">
|
||||||
|
/// <para>Type: <c>UINT32*</c></para>
|
||||||
|
/// <para>
|
||||||
|
/// 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.
|
||||||
|
/// </para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="path">
|
||||||
|
/// <para>Type: <c>PWSTR</c></para>
|
||||||
|
/// <para>The package path.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>Type: <c>LONG</c></para>
|
||||||
|
/// <para>
|
||||||
|
/// If the function succeeds it returns <c>ERROR_SUCCESS</c>. Otherwise, the function returns an error code. The possible error
|
||||||
|
/// codes include the following.
|
||||||
|
/// </para>
|
||||||
|
/// <list type="table">
|
||||||
|
/// <listheader>
|
||||||
|
/// <term>Return code</term>
|
||||||
|
/// <term>Description</term>
|
||||||
|
/// </listheader>
|
||||||
|
/// <item>
|
||||||
|
/// <term>APPMODEL_ERROR_NO_PACKAGE</term>
|
||||||
|
/// <term>The process has no package identity.</term>
|
||||||
|
/// </item>
|
||||||
|
/// <item>
|
||||||
|
/// <term>ERROR_INSUFFICIENT_BUFFER</term>
|
||||||
|
/// <term>The buffer is not large enough to hold the data. The required size is specified by pathLength.</term>
|
||||||
|
/// </item>
|
||||||
|
/// </list>
|
||||||
|
/// </returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
// 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, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder path);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Gets the IDs of apps in the specified package.</para>
|
/// <para>Gets the IDs of apps in the specified package.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1017,6 +1155,63 @@ namespace Vanara.PInvoke
|
||||||
[PInvokeData("appmodel.h", MSDNShortId = "28F45B3B-A61F-44D3-B606-6966AD5866FA")]
|
[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);
|
public static extern Win32Error GetPackageInfo(PACKAGE_INFO_REFERENCE packageInfoReference, uint flags, ref uint bufferLength, IntPtr buffer, out uint count);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the package information for the specified package, with the option to specify the type of folder path to retrieve for the package.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packageInfoReference">
|
||||||
|
/// <para>Type: <c>PACKAGE_INFO_REFERENCE</c></para>
|
||||||
|
/// <para>A reference to package information.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="flags">
|
||||||
|
/// <para>Type: <c>const UINT32</c></para>
|
||||||
|
/// <para>The package constants that specify how package information is retrieved.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="packagePathType">
|
||||||
|
/// <para>Type: <c>PackagePathType</c></para>
|
||||||
|
/// <para>Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder).</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="bufferLength">
|
||||||
|
/// <para>Type: <c>UINT32*</c></para>
|
||||||
|
/// <para>On input, the size of buffer, in bytes. On output, the size of the package information returned, in bytes.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="buffer">
|
||||||
|
/// <para>Type: <c>BYTE*</c></para>
|
||||||
|
/// <para>The package information, represented as an array of PACKAGE_INFO structures.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="count">
|
||||||
|
/// <para>Type: <c>UINT32*</c></para>
|
||||||
|
/// <para>The number of packages in the buffer.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>Type: <c>LONG</c></para>
|
||||||
|
/// <para>
|
||||||
|
/// If the function succeeds it returns <c>ERROR_SUCCESS</c>. Otherwise, the function returns an error code. The possible error
|
||||||
|
/// codes include the following.
|
||||||
|
/// </para>
|
||||||
|
/// <list type="table">
|
||||||
|
/// <listheader>
|
||||||
|
/// <term>Return code</term>
|
||||||
|
/// <term>Description</term>
|
||||||
|
/// </listheader>
|
||||||
|
/// <item>
|
||||||
|
/// <term>ERROR_INSUFFICIENT_BUFFER</term>
|
||||||
|
/// <term>The buffer is not large enough to hold the data. The required size is specified by bufferLength.</term>
|
||||||
|
/// </item>
|
||||||
|
/// </list>
|
||||||
|
/// </returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
// 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);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Gets the path for the specified package.</para>
|
/// <para>Gets the path for the specified package.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1060,7 +1255,7 @@ namespace Vanara.PInvoke
|
||||||
// *packageId, const UINT32 reserved, UINT32 *pathLength, PWSTR path );
|
// *packageId, const UINT32 reserved, UINT32 *pathLength, PWSTR path );
|
||||||
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)]
|
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)]
|
||||||
[PInvokeData("appmodel.h", MSDNShortId = "BDA0DD87-A36D-486B-BF89-EA5CC105C742")]
|
[PInvokeData("appmodel.h", MSDNShortId = "BDA0DD87-A36D-486B-BF89-EA5CC105C742")]
|
||||||
public static extern int GetPackagePath(ref PACKAGE_ID packageId, uint reserved, ref uint pathLength, StringBuilder path);
|
public static extern Win32Error GetPackagePath(ref PACKAGE_ID packageId, uint reserved, ref uint pathLength, StringBuilder path);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Gets the path of the specified package.</para>
|
/// <para>Gets the path of the specified package.</para>
|
||||||
|
@ -1106,6 +1301,59 @@ namespace Vanara.PInvoke
|
||||||
[PInvokeData("appmodel.h", MSDNShortId = "9C25708C-1464-4C59-9740-E9F105116385")]
|
[PInvokeData("appmodel.h", MSDNShortId = "9C25708C-1464-4C59-9740-E9F105116385")]
|
||||||
public static extern Win32Error GetPackagePathByFullName(string packageFullName, ref uint pathLength, StringBuilder path);
|
public static extern Win32Error GetPackagePathByFullName(string packageFullName, ref uint pathLength, StringBuilder path);
|
||||||
|
|
||||||
|
/// <summary>Gets the path of the specified package, with the option to specify the type of folder path to retrieve for the package.</summary>
|
||||||
|
/// <param name="packageFullName">
|
||||||
|
/// <para>Type: <c>PCWSTR</c></para>
|
||||||
|
/// <para>The full name of the package.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="packagePathType">
|
||||||
|
/// <para>Type: <c>PackagePathType</c></para>
|
||||||
|
/// <para>Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder).</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="pathLength">
|
||||||
|
/// <para>Type: <c>UINT32*</c></para>
|
||||||
|
/// <para>
|
||||||
|
/// A pointer to a variable that holds the number of characters ( <c>WCHAR</c> s) in the package path string, which includes the null-terminator.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// First you pass <c>NULL</c> 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.
|
||||||
|
/// </para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="path">
|
||||||
|
/// <para>Type: <c>PWSTR</c></para>
|
||||||
|
/// <para>A pointer to memory space that receives the package path string, which includes the null-terminator.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>Type: <c>LONG</c></para>
|
||||||
|
/// <para>
|
||||||
|
/// If the function succeeds it returns <c>ERROR_SUCCESS</c>. Otherwise, the function returns an error code. The possible error
|
||||||
|
/// codes include the following.
|
||||||
|
/// </para>
|
||||||
|
/// <list type="table">
|
||||||
|
/// <listheader>
|
||||||
|
/// <term>Return code</term>
|
||||||
|
/// <term>Description</term>
|
||||||
|
/// </listheader>
|
||||||
|
/// <item>
|
||||||
|
/// <term>ERROR_INSUFFICIENT_BUFFER</term>
|
||||||
|
/// <term>The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength.</term>
|
||||||
|
/// </item>
|
||||||
|
/// </list>
|
||||||
|
/// </returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
// 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, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder path);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Gets the packages with the specified family name for the current user.</para>
|
/// <para>Gets the packages with the specified family name for the current user.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1246,6 +1494,61 @@ namespace Vanara.PInvoke
|
||||||
[PInvokeData("appmodel.h", MSDNShortId = "F0A37D77-6262-44B1-BEC5-083E41BDE139")]
|
[PInvokeData("appmodel.h", MSDNShortId = "F0A37D77-6262-44B1-BEC5-083E41BDE139")]
|
||||||
public static extern Win32Error GetStagedPackagePathByFullName([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, ref uint pathLength, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder path);
|
public static extern Win32Error GetStagedPackagePathByFullName([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, ref uint pathLength, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder path);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the path of the specified staged package, with the option to specify the type of folder path to retrieve for the package.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packageFullName">
|
||||||
|
/// <para>Type: <c>PCWSTR</c></para>
|
||||||
|
/// <para>The full name of the staged package.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="packagePathType">
|
||||||
|
/// <para>Type: <c>PackagePathType</c></para>
|
||||||
|
/// <para>Indicates the type of folder path to retrieve for the package (the original install folder or the mutable folder).</para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="pathLength">
|
||||||
|
/// <para>Type: <c>UINT32*</c></para>
|
||||||
|
/// <para>
|
||||||
|
/// A pointer to a variable that holds the number of characters ( <c>WCHAR</c> s) in the package path string, which includes the null-terminator.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// First you pass <c>NULL</c> 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.
|
||||||
|
/// </para>
|
||||||
|
/// </param>
|
||||||
|
/// <param name="path">
|
||||||
|
/// <para>Type: <c>PWSTR</c></para>
|
||||||
|
/// <para>A pointer to memory space that receives the package path string, which includes the null-terminator.</para>
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>Type: <c>LONG</c></para>
|
||||||
|
/// <para>
|
||||||
|
/// If the function succeeds it returns <c>ERROR_SUCCESS</c>. Otherwise, the function returns an error code. The possible error
|
||||||
|
/// codes include the following.
|
||||||
|
/// </para>
|
||||||
|
/// <list type="table">
|
||||||
|
/// <listheader>
|
||||||
|
/// <term>Return code</term>
|
||||||
|
/// <term>Description</term>
|
||||||
|
/// </listheader>
|
||||||
|
/// <item>
|
||||||
|
/// <term>ERROR_INSUFFICIENT_BUFFER</term>
|
||||||
|
/// <term>The buffer specified by path is not large enough to hold the data. The required size is specified by pathLength.</term>
|
||||||
|
/// </item>
|
||||||
|
/// </list>
|
||||||
|
/// </returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
// 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, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder path);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Opens the package information of the specified package.</para>
|
/// <para>Opens the package information of the specified package.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1695,6 +1998,33 @@ namespace Vanara.PInvoke
|
||||||
public string publisherId;
|
public string publisherId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Represents package identification information that includes the package identifier, full name, and install location.</summary>
|
||||||
|
/// <remarks>For info about string size limits, see Identity constants.</remarks>
|
||||||
|
// 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
|
||||||
|
{
|
||||||
|
/// <summary>Reserved; do not use.</summary>
|
||||||
|
public uint reserved;
|
||||||
|
|
||||||
|
/// <summary>Properties of the package.</summary>
|
||||||
|
public uint flags;
|
||||||
|
|
||||||
|
/// <summary>The location of the package.</summary>
|
||||||
|
[MarshalAs(UnmanagedType.LPWStr)] public string path;
|
||||||
|
|
||||||
|
/// <summary>The package full name/</summary>
|
||||||
|
[MarshalAs(UnmanagedType.LPWStr)] public string packageFullName;
|
||||||
|
|
||||||
|
/// <summary>The package family name.</summary>
|
||||||
|
[MarshalAs(UnmanagedType.LPWStr)] public string packageFamilyName;
|
||||||
|
|
||||||
|
/// <summary>The package identifier (ID).</summary>
|
||||||
|
public PACKAGE_ID packageId;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>A reference to package information.</summary>
|
/// <summary>A reference to package information.</summary>
|
||||||
[PInvokeData("appmodel.h")]
|
[PInvokeData("appmodel.h")]
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
|
Loading…
Reference in New Issue