mirror of https://github.com/dahall/Vanara.git
Added EnhancedStorge and PortableDeviceAPI (WPD) assemblies (untested)
parent
ab711014fa
commit
d2069e2712
|
@ -0,0 +1,573 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Vanara.InteropServices;
|
||||
using static Vanara.PInvoke.PortableDeviceApi;
|
||||
|
||||
namespace Vanara.PInvoke
|
||||
{
|
||||
/// <summary>Elements from the Enhanced Storage API.</summary>
|
||||
public static partial class EnhancedStorage
|
||||
{
|
||||
private delegate void GetArrayDelegate(out SafeCoTaskMemHandle h, out uint c);
|
||||
|
||||
/// <summary>Integer value that indicates the possible authorization state of the ACT.</summary>
|
||||
[PInvokeData("ehstorapi.h")]
|
||||
public enum ACT_AUTHORIZATION_STATE_VALUE
|
||||
{
|
||||
/// <summary>The ACT is unauthorized</summary>
|
||||
ACT_UNAUTHORIZED = 0x0000,
|
||||
|
||||
/// <summary>The ACT is authorized</summary>
|
||||
ACT_AUTHORIZED = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>Undocumented.</summary>
|
||||
[PInvokeData("ehstorapi.h")]
|
||||
[Flags]
|
||||
public enum ACT_AUTHORIZE
|
||||
{
|
||||
/// <summary>Undocumented.</summary>
|
||||
ACT_AUTHORIZE_ON_RESUME = 0x00000001,
|
||||
|
||||
/// <summary>Undocumented.</summary>
|
||||
ACT_AUTHORIZE_ON_SESSION_UNLOCK = 0x00000002,
|
||||
}
|
||||
|
||||
/// <summary>Undocumented.</summary>
|
||||
[PInvokeData("ehstorapi.h")]
|
||||
[Flags]
|
||||
public enum ACT_UNAUTHORIZE
|
||||
{
|
||||
/// <summary>Undocumented.</summary>
|
||||
ACT_UNAUTHORIZE_ON_SUSPEND = 0x00000001,
|
||||
|
||||
/// <summary>Undocumented.</summary>
|
||||
ACT_UNAUTHORIZE_ON_SESSION_LOCK = 0x00000002,
|
||||
}
|
||||
|
||||
/// <summary>Use this interface to obtain information and perform operations for a 1667 Addressable Contact Target (ACT).</summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nn-ehstorapi-ienhancedstorageact
|
||||
[PInvokeData("ehstorapi.h", MSDNShortId = "NN:ehstorapi.IEnhancedStorageACT")]
|
||||
[ComImport, Guid("6e7781f4-e0f2-4239-b976-a01abab52930"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(EnhancedStorageACT))]
|
||||
public interface IEnhancedStorageACT
|
||||
{
|
||||
/// <summary>
|
||||
/// /// Associates the Addressable Command Target (ACT) with the <c>Authorized</c> state defined by ACT_AUTHORIZATION_STATE, and
|
||||
/// ensures the authentication of each individual silo according to the required sequence and logical combination necessary to
|
||||
/// authorize access to the ACT.
|
||||
/// </summary>
|
||||
/// <param name="hwndParent">Not used.</param>
|
||||
/// <param name="dwFlags">Not used.</param>
|
||||
/// <remarks>This interface method can be used when an application wants to change the ACT to the 'Authorized' state.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-authorize HRESULT Authorize(
|
||||
// [in] DWORD hwndParent, [in] DWORD dwFlags );
|
||||
void Authorize([In, Optional] uint hwndParent, [In, Optional] ACT_AUTHORIZE dwFlags);
|
||||
|
||||
/// <summary>
|
||||
/// Associates the Addressable Command Target (ACT) with the <c>Unauthorized</c> state defined by ACT_AUTHORIZATION_STATE, and
|
||||
/// ensures the deauthentication of each individual silo according to the required sequence and logical combination necessary to
|
||||
/// restrict access to the ACT.
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-unauthorize HRESULT Unauthorize();
|
||||
void Unauthorize();
|
||||
|
||||
/// <summary>Returns the current authorization state of the ACT.</summary>
|
||||
/// <returns>An ACT_AUTHORIZATION_STATE that specifies the current authorization state of the ACT.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getauthorizationstate HRESULT
|
||||
// GetAuthorizationState( [out] ACT_AUTHORIZATION_STATE *pState );
|
||||
ACT_AUTHORIZATION_STATE GetAuthorizationState();
|
||||
|
||||
/// <summary>Returns the volume associated with the Addressable Command Target (ACT).</summary>
|
||||
/// <returns>The volume associated with the ACT.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getmatchingvolume HRESULT
|
||||
// GetMatchingVolume( [out] LPWSTR *ppwszVolume );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetMatchingVolume();
|
||||
|
||||
/// <summary>Retrieves the unique identity of the Addressable Command Target (ACT).</summary>
|
||||
/// <returns>The unique identity of the ACT.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getuniqueidentity HRESULT
|
||||
// GetUniqueIdentity( [out] LPWSTR *ppwszIdentity );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetUniqueIdentity();
|
||||
|
||||
/// <summary>Returns an enumeration of all silos associated with the Addressable Command Target (ACT).</summary>
|
||||
/// <param name="pppIEnhancedStorageSilos">
|
||||
/// Returns an array of one or more IEnhancedStorageSilo interface pointers associated with the ACT.
|
||||
/// </param>
|
||||
/// <param name="pcEnhancedStorageSilos">
|
||||
/// Count of IEnhancedStorageSilo pointers returned. This value indicates the dimension of the array represented by pppIEnhancedStorageSilos.
|
||||
/// </param>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getsilos HRESULT GetSilos(
|
||||
// [out] IEnhancedStorageSilo ***pppIEnhancedStorageSilos, [out] ULONG *pcEnhancedStorageSilos );
|
||||
void GetSilos(out SafeCoTaskMemHandle pppIEnhancedStorageSilos, out uint pcEnhancedStorageSilos);
|
||||
}
|
||||
|
||||
/// <summary>The <c>IEnhancedStorageACT2</c> interface is used to obtain information for a 1667 Addressable Contact Target (ACT).</summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nn-ehstorapi-ienhancedstorageact2
|
||||
[PInvokeData("ehstorapi.h", MSDNShortId = "NN:ehstorapi.IEnhancedStorageACT2")]
|
||||
[ComImport, Guid("4DA57D2E-8EB3-41f6-A07E-98B52B88242B"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(EnhancedStorageACT))]
|
||||
public interface IEnhancedStorageACT2 : IEnhancedStorageACT
|
||||
{
|
||||
/// <summary>
|
||||
/// /// Associates the Addressable Command Target (ACT) with the <c>Authorized</c> state defined by ACT_AUTHORIZATION_STATE, and
|
||||
/// ensures the authentication of each individual silo according to the required sequence and logical combination necessary to
|
||||
/// authorize access to the ACT.
|
||||
/// </summary>
|
||||
/// <param name="hwndParent">Not used.</param>
|
||||
/// <param name="dwFlags">Not used.</param>
|
||||
/// <remarks>This interface method can be used when an application wants to change the ACT to the 'Authorized' state.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-authorize HRESULT Authorize(
|
||||
// [in] DWORD hwndParent, [in] DWORD dwFlags );
|
||||
new void Authorize([In, Optional] uint hwndParent, [In, Optional] ACT_AUTHORIZE dwFlags);
|
||||
|
||||
/// <summary>
|
||||
/// Associates the Addressable Command Target (ACT) with the <c>Unauthorized</c> state defined by ACT_AUTHORIZATION_STATE, and
|
||||
/// ensures the deauthentication of each individual silo according to the required sequence and logical combination necessary to
|
||||
/// restrict access to the ACT.
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-unauthorize HRESULT Unauthorize();
|
||||
new void Unauthorize();
|
||||
|
||||
/// <summary>Returns the current authorization state of the ACT.</summary>
|
||||
/// <returns>An ACT_AUTHORIZATION_STATE that specifies the current authorization state of the ACT.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getauthorizationstate HRESULT
|
||||
// GetAuthorizationState( [out] ACT_AUTHORIZATION_STATE *pState );
|
||||
new ACT_AUTHORIZATION_STATE GetAuthorizationState();
|
||||
|
||||
/// <summary>Returns the volume associated with the Addressable Command Target (ACT).</summary>
|
||||
/// <returns>The volume associated with the ACT.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getmatchingvolume HRESULT
|
||||
// GetMatchingVolume( [out] LPWSTR *ppwszVolume );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
new string GetMatchingVolume();
|
||||
|
||||
/// <summary>Retrieves the unique identity of the Addressable Command Target (ACT).</summary>
|
||||
/// <returns>The unique identity of the ACT.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getuniqueidentity HRESULT
|
||||
// GetUniqueIdentity( [out] LPWSTR *ppwszIdentity );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
new string GetUniqueIdentity();
|
||||
|
||||
/// <summary>Returns an enumeration of all silos associated with the Addressable Command Target (ACT).</summary>
|
||||
/// <param name="pppIEnhancedStorageSilos">
|
||||
/// Returns an array of one or more IEnhancedStorageSilo interface pointers associated with the ACT.
|
||||
/// </param>
|
||||
/// <param name="pcEnhancedStorageSilos">
|
||||
/// Count of IEnhancedStorageSilo pointers returned. This value indicates the dimension of the array represented by pppIEnhancedStorageSilos.
|
||||
/// </param>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getsilos HRESULT GetSilos(
|
||||
// [out] IEnhancedStorageSilo ***pppIEnhancedStorageSilos, [out] ULONG *pcEnhancedStorageSilos );
|
||||
new void GetSilos(out SafeCoTaskMemHandle pppIEnhancedStorageSilos, out uint pcEnhancedStorageSilos);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>IEnhancedStorageACT2::GetDeviceName</c> method returns the device name associated with the Addressable Command Target (ACT).
|
||||
/// </summary>
|
||||
/// <returns>The device name associated with the ACT.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact2-getdevicename HRESULT
|
||||
// GetDeviceName( [out] LPWSTR *ppwszDeviceName );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetDeviceName();
|
||||
|
||||
/// <summary>
|
||||
/// The <c>IEnhancedStorageACT2::IsDeviceRemovable</c> method returns information that indicates if the device associated with
|
||||
/// the ACT is removable.
|
||||
/// </summary>
|
||||
/// <returns>Indicates if the device associated with the ACT is removable.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact2-isdeviceremovable HRESULT
|
||||
// IsDeviceRemovable( BOOL *pIsDeviceRemovable );
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
bool IsDeviceRemovable();
|
||||
}
|
||||
|
||||
/// <summary>Undocumented.</summary>
|
||||
/// <seealso cref="Vanara.PInvoke.EnhancedStorage.IEnhancedStorageACT2"/>
|
||||
[PInvokeData("ehstorapi.h")]
|
||||
[ComImport, Guid("022150A1-113D-11DF-BB61-001AA01BBC58"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(EnhancedStorageACT))]
|
||||
public interface IEnhancedStorageACT3 : IEnhancedStorageACT2
|
||||
{
|
||||
/// <summary>
|
||||
/// /// Associates the Addressable Command Target (ACT) with the <c>Authorized</c> state defined by ACT_AUTHORIZATION_STATE, and
|
||||
/// ensures the authentication of each individual silo according to the required sequence and logical combination necessary to
|
||||
/// authorize access to the ACT.
|
||||
/// </summary>
|
||||
/// <param name="hwndParent">Not used.</param>
|
||||
/// <param name="dwFlags">Not used.</param>
|
||||
/// <remarks>This interface method can be used when an application wants to change the ACT to the 'Authorized' state.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-authorize HRESULT Authorize(
|
||||
// [in] DWORD hwndParent, [in] DWORD dwFlags );
|
||||
new void Authorize([In, Optional] uint hwndParent, [In, Optional] ACT_AUTHORIZE dwFlags);
|
||||
|
||||
/// <summary>
|
||||
/// Associates the Addressable Command Target (ACT) with the <c>Unauthorized</c> state defined by ACT_AUTHORIZATION_STATE, and
|
||||
/// ensures the deauthentication of each individual silo according to the required sequence and logical combination necessary to
|
||||
/// restrict access to the ACT.
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-unauthorize HRESULT Unauthorize();
|
||||
new void Unauthorize();
|
||||
|
||||
/// <summary>Returns the current authorization state of the ACT.</summary>
|
||||
/// <returns>An ACT_AUTHORIZATION_STATE that specifies the current authorization state of the ACT.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getauthorizationstate HRESULT
|
||||
// GetAuthorizationState( [out] ACT_AUTHORIZATION_STATE *pState );
|
||||
new ACT_AUTHORIZATION_STATE GetAuthorizationState();
|
||||
|
||||
/// <summary>Returns the volume associated with the Addressable Command Target (ACT).</summary>
|
||||
/// <returns>The volume associated with the ACT.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getmatchingvolume HRESULT
|
||||
// GetMatchingVolume( [out] LPWSTR *ppwszVolume );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
new string GetMatchingVolume();
|
||||
|
||||
/// <summary>Retrieves the unique identity of the Addressable Command Target (ACT).</summary>
|
||||
/// <returns>The unique identity of the ACT.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getuniqueidentity HRESULT
|
||||
// GetUniqueIdentity( [out] LPWSTR *ppwszIdentity );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
new string GetUniqueIdentity();
|
||||
|
||||
/// <summary>Returns an enumeration of all silos associated with the Addressable Command Target (ACT).</summary>
|
||||
/// <param name="pppIEnhancedStorageSilos">
|
||||
/// Returns an array of one or more IEnhancedStorageSilo interface pointers associated with the ACT.
|
||||
/// </param>
|
||||
/// <param name="pcEnhancedStorageSilos">
|
||||
/// Count of IEnhancedStorageSilo pointers returned. This value indicates the dimension of the array represented by pppIEnhancedStorageSilos.
|
||||
/// </param>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact-getsilos HRESULT GetSilos(
|
||||
// [out] IEnhancedStorageSilo ***pppIEnhancedStorageSilos, [out] ULONG *pcEnhancedStorageSilos );
|
||||
new void GetSilos(out SafeCoTaskMemHandle pppIEnhancedStorageSilos, out uint pcEnhancedStorageSilos);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>IEnhancedStorageACT2::GetDeviceName</c> method returns the device name associated with the Addressable Command Target (ACT).
|
||||
/// </summary>
|
||||
/// <returns>The device name associated with the ACT.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact2-getdevicename HRESULT
|
||||
// GetDeviceName( [out] LPWSTR *ppwszDeviceName );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
new string GetDeviceName();
|
||||
|
||||
/// <summary>
|
||||
/// The <c>IEnhancedStorageACT2::IsDeviceRemovable</c> method returns information that indicates if the device associated with
|
||||
/// the ACT is removable.
|
||||
/// </summary>
|
||||
/// <returns>Indicates if the device associated with the ACT is removable.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstorageact2-isdeviceremovable HRESULT
|
||||
// IsDeviceRemovable( BOOL *pIsDeviceRemovable );
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
new bool IsDeviceRemovable();
|
||||
|
||||
/// <summary>Undocumented.</summary>
|
||||
/// <param name="dwFlags"/>
|
||||
void UnauthorizeEx(ACT_UNAUTHORIZE dwFlags);
|
||||
|
||||
/// <summary>Undocumented.</summary>
|
||||
/// <returns/>
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
bool IsQueueFrozen();
|
||||
|
||||
/// <summary>Undocumented.</summary>
|
||||
/// <returns/>
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
bool GetShellExtSupport();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <c>IEnhancedStorageSilo</c> interface is the point of access for an IEEE 1667 silo and is used to obtain information and
|
||||
/// perform operations at the silo level.
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nn-ehstorapi-ienhancedstoragesilo
|
||||
[PInvokeData("ehstorapi.h", MSDNShortId = "NN:ehstorapi.IEnhancedStorageSilo")]
|
||||
[ComImport, Guid("5aef78c6-2242-4703-bf49-44b29357a359"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(EnhancedStorageSilo))]
|
||||
public interface IEnhancedStorageSilo
|
||||
{
|
||||
/// <summary>Returns the descriptive information associated with the silo object.</summary>
|
||||
/// <returns>A SILO_INFO object containing descriptive information associated with the silo.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstoragesilo-getinfo HRESULT GetInfo( [out]
|
||||
// SILO_INFO *pSiloInfo );
|
||||
SILO_INFO GetInfo();
|
||||
|
||||
/// <summary>Returns an enumeration of all actions available to the silo object.</summary>
|
||||
/// <param name="pppIEnhancedStorageSiloActions">
|
||||
/// Array of pointers to IEnhancedStorageAction interface objects that represent the actions available for the silo object. This
|
||||
/// array is allocated within the API when at least one action is available to the silo.
|
||||
/// </param>
|
||||
/// <param name="pcEnhancedStorageSiloActions">
|
||||
/// Count of IEnhancedStorageAction pointers returned. This value indicates the dimension of the array represented by pppIEnhancedStorageSilos.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// The memory containing the IEnhancedStorageAction interface pointers is allocated by the Enhanced Storage API and must be
|
||||
/// freed by passing the returned pointer to CoTaskMemFree.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstoragesilo-getactions HRESULT GetActions(
|
||||
// [out] IEnhancedStorageSiloAction ***pppIEnhancedStorageSiloActions, [out] ULONG *pcEnhancedStorageSiloActions );
|
||||
void GetActions(out SafeCoTaskMemHandle pppIEnhancedStorageSiloActions, out uint pcEnhancedStorageSiloActions);
|
||||
|
||||
/// <summary>
|
||||
/// Sends a raw silo command to the silo object. This method is utilized to communicate with a silo which is not represented by
|
||||
/// a driver.
|
||||
/// </summary>
|
||||
/// <param name="Command">
|
||||
/// The silo command to be issued. 8 bits of this value are placed in the byte at position 3 of the CDB sent to the device; i.e.
|
||||
/// the second byte of the <c>SecurityProtocolSpecific</c> field.
|
||||
/// </param>
|
||||
/// <param name="pbCommandBuffer">The command payload sent to the device in the send data phase of the command.</param>
|
||||
/// <param name="cbCommandBuffer">The count of bytes contained in the pbCommandBuffer buffer.</param>
|
||||
/// <param name="pbResponseBuffer">
|
||||
/// The response payload that is returned to the host from the device in the receive data phase of the command.
|
||||
/// </param>
|
||||
/// <param name="pcbResponseBuffer">
|
||||
/// On method entry, contains the size of pbResponseBuffer in bytes. On method exit, it contains the count of bytes contained in
|
||||
/// the returned pbResponse buffer.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method is currently not supported by the IEEE 1667 certificate and password silos. It is recommended that the Enhanced
|
||||
/// Storage Portable Device Commands are used instead.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The caller is responsible for sending correct parameters to the command, as well as allocating the necessary buffer for the
|
||||
/// returned results.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstoragesilo-sendcommand HRESULT
|
||||
// SendCommand( [in] UCHAR Command, [in] BYTE *pbCommandBuffer, [in] ULONG cbCommandBuffer, [out] BYTE *pbResponseBuffer, [out]
|
||||
// ULONG *pcbResponseBuffer );
|
||||
void SendCommand([In] byte Command, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] pbCommandBuffer,
|
||||
[In] uint cbCommandBuffer,
|
||||
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] pbResponseBuffer,
|
||||
[In, Out] ref uint pcbResponseBuffer);
|
||||
|
||||
/// <summary>Obtains an IPortableDevice pointer used to issue commands to the corresponding Enhanced Storage silo driver.</summary>
|
||||
/// <returns>An IPortableDevice object.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstoragesilo-getportabledevice HRESULT
|
||||
// GetPortableDevice( [out] IPortableDevice **ppIPortableDevice );
|
||||
IPortableDevice GetPortableDevice();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the path to the silo device node. The returned string is suitable for passing to <c>Windows System</c> APIs such
|
||||
/// as CreateFile or SetupDiOpenDeviceInterface.
|
||||
/// </summary>
|
||||
/// <returns>The path to the Silo device node.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstoragesilo-getdevicepath HRESULT
|
||||
// GetDevicePath( [out] LPWSTR *ppwszSiloDevicePath );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetDevicePath();
|
||||
}
|
||||
|
||||
/// <summary>Use this interface as a point of access for actions involving IEEE 1667 silos.</summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nn-ehstorapi-ienhancedstoragesiloaction
|
||||
[PInvokeData("ehstorapi.h", MSDNShortId = "NN:ehstorapi.IEnhancedStorageSiloAction")]
|
||||
[ComImport, Guid("b6f7f311-206f-4ff8-9c4b-27efee77a86f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(EnhancedStorageSiloAction))]
|
||||
public interface IEnhancedStorageSiloAction
|
||||
{
|
||||
/// <summary>Returns a string for the name of the action specified by the IEnhancedStorageSiloAction object.</summary>
|
||||
/// <returns>The silo action by name.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// A name string is short, consisting of one or two words, and is suitable for display in a UI element such as a menu item or
|
||||
/// button label.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstoragesiloaction-getname HRESULT GetName(
|
||||
// [out] LPWSTR *ppwszActionName );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetName();
|
||||
|
||||
/// <summary>Returns a descriptive string for the action specified by the IEnhancedStorageSiloAction object.</summary>
|
||||
/// <returns>A string that describes the silo action.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The description string is brief, consisting of one or two short sentences, and is suitable for display in a UI element such
|
||||
/// as tooltip or small static text box.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstoragesiloaction-getdescription HRESULT
|
||||
// GetDescription( [out] LPWSTR *ppwszActionDescription );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetDescription();
|
||||
|
||||
/// <summary>Performs the action specified by an IEnhancedStorageSiloAction object.</summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstoragesiloaction-invoke HRESULT Invoke();
|
||||
void Invoke();
|
||||
}
|
||||
|
||||
/// <summary>Use this interface as the top level enumerator for all IEEE 1667 Addressable Contact Targets (ACT).</summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nn-ehstorapi-ienumenhancedstorageact
|
||||
[PInvokeData("ehstorapi.h", MSDNShortId = "NN:ehstorapi.IEnumEnhancedStorageACT")]
|
||||
[ComImport, Guid("09b224bd-1335-4631-a7ff-cfd3a92646d7"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(EnumEnhancedStorageACT))]
|
||||
public interface IEnumEnhancedStorageACT
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns an enumeration of all the Addressable Command Targets (ACT) currently connected to the system. If at least one ACT
|
||||
/// is present, the Enhanced Storage API allocates an array of 1 or more IEnumEnhancedStorageACT pointers.
|
||||
/// </summary>
|
||||
/// <param name="pppIEnhancedStorageACTs">
|
||||
/// Array of IEnhancedStorageACT interface pointers that represent the ACTs for all devices connected to the system. This array
|
||||
/// is allocated within the API.
|
||||
/// </param>
|
||||
/// <param name="pcEnhancedStorageACTs">
|
||||
/// Count of IEnhancedStorageACT pointers returned. This is the dimension of the array represented by pppIEnhancedStorageACTs.
|
||||
/// </param>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienumenhancedstorageact-getacts HRESULT GetACTs(
|
||||
// [out] IEnhancedStorageACT ***pppIEnhancedStorageACTs, ULONG *pcEnhancedStorageACTs );
|
||||
void GetACTs(out SafeCoTaskMemHandle pppIEnhancedStorageACTs, out uint pcEnhancedStorageACTs);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Addressable Command Target (ACT) associated with the volume specified via the string supplied by the client.
|
||||
/// </summary>
|
||||
/// <param name="szVolume">A string that specifies the volume for which a matching ACT is searched for.</param>
|
||||
/// <returns>
|
||||
/// An <c>IEnhancedStorageACT</c> interface pointer that represents the matching ACT. If no matching ACT is found the error
|
||||
/// <c>HRESULT_FROM_WIN32(ERROR_NOT_FOUND)</c> is returned.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// This method can also be utilized by the client to determine if the specified volume resides on, and is represented by an
|
||||
/// IEEE 1667 ACT.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienumenhancedstorageact-getmatchingact HRESULT
|
||||
// GetMatchingACT( [in] LPCWSTR szVolume, [out] IEnhancedStorageACT **ppIEnhancedStorageACT );
|
||||
IEnhancedStorageACT GetMatchingACT([In, MarshalAs(UnmanagedType.LPWStr)] string szVolume);
|
||||
}
|
||||
|
||||
/// <summary>Returns an enumeration of all actions available to the silo object.</summary>
|
||||
/// <returns>Array of IEnhancedStorageAction interface objects that represent the actions available for the silo object.</returns>
|
||||
public static IEnhancedStorageSiloAction[] GetActions(this IEnhancedStorageSilo silo) => GetIntfArray<IEnhancedStorageSiloAction>(silo.GetActions);
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumeration of all the Addressable Command Targets (ACT) currently connected to the system. If at least one ACT is
|
||||
/// present, the Enhanced Storage API allocates an array of 1 or more IEnumEnhancedStorageACT pointers.
|
||||
/// </summary>
|
||||
/// <returns>Array of IEnhancedStorageACT interface pointers that represent the ACTs for all devices connected to the system.</returns>
|
||||
public static IEnhancedStorageACT[] GetACTs(this IEnumEnhancedStorageACT act) => GetIntfArray<IEnhancedStorageACT>(act.GetACTs);
|
||||
|
||||
/// <summary>Returns an enumeration of all silos associated with the Addressable Command Target (ACT).</summary>
|
||||
/// <returns>An array of one or more IEnhancedStorageSilo interface pointers associated with the ACT.</returns>
|
||||
public static IEnhancedStorageSilo[] GetSilos(this IEnhancedStorageACT act) => GetIntfArray<IEnhancedStorageSilo>(act.GetSilos);
|
||||
|
||||
/// <summary>
|
||||
/// Sends a raw silo command to the silo object. This method is utilized to communicate with a silo which is not represented by a driver.
|
||||
/// </summary>
|
||||
/// <param name="silo">The silo interface instance.</param>
|
||||
/// <param name="command">
|
||||
/// The silo command to be issued. 8 bits of this value are placed in the byte at position 3 of the CDB sent to the device; i.e. the
|
||||
/// second byte of the <c>SecurityProtocolSpecific</c> field.
|
||||
/// </param>
|
||||
/// <param name="commandBuffer">The command payload sent to the device in the send data phase of the command.</param>
|
||||
/// <param name="expectedResponseBufferSize">Contains the expected size of the response in bytes.</param>
|
||||
/// <returns>The response payload that is returned to the host from the device in the receive data phase of the command.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method is currently not supported by the IEEE 1667 certificate and password silos. It is recommended that the Enhanced
|
||||
/// Storage Portable Device Commands are used instead.
|
||||
/// </para>
|
||||
/// <para>The caller is responsible for sending correct parameters to the command.</para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/nf-ehstorapi-ienhancedstoragesilo-sendcommand HRESULT
|
||||
public static byte[] SendCommand(this IEnhancedStorageSilo silo, Byte command, Byte[] commandBuffer, UInt32 expectedResponseBufferSize)
|
||||
{
|
||||
// *** From SDK sample ***
|
||||
// 1. align command buffer to 512 bytes boundary
|
||||
UInt32 commandBufferLength = (UInt32)Macros.ALIGN_TO_MULTIPLE(commandBuffer.Length, 512);
|
||||
Byte[] commandBufferAlign = new Byte[commandBufferLength];
|
||||
commandBuffer.CopyTo(commandBufferAlign, 0);
|
||||
// 2. create response buffer
|
||||
var responseBuffer = new Byte[expectedResponseBufferSize];
|
||||
UInt32 responseBufferSize = (UInt32)responseBuffer.Length;
|
||||
// 3. send command to silo
|
||||
silo.SendCommand(command, commandBufferAlign, commandBufferLength, responseBuffer, ref responseBufferSize);
|
||||
return responseBuffer;
|
||||
}
|
||||
|
||||
private static T[] GetIntfArray<T>(GetArrayDelegate f) where T : class
|
||||
{
|
||||
f(out var h, out var cnt);
|
||||
return cnt == 0 ? new T[0] : h.ToEnumerable<IntPtr>((int)cnt).Select(p => (T)Marshal.GetObjectForIUnknown(p)).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <c>ACT_AUTHORIZATION_STATE</c> structure contains data that describes the current authorization state of a Addressable
|
||||
/// Command Target (ACT).
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/ns-ehstorapi-act_authorization_state typedef struct
|
||||
// _ACT_AUTHORIZATION_STATE { ULONG ulState; } ACT_AUTHORIZATION_STATE;
|
||||
[PInvokeData("ehstorapi.h", MSDNShortId = "NS:ehstorapi._ACT_AUTHORIZATION_STATE")]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct ACT_AUTHORIZATION_STATE
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>Integer value that indicates the possible authorization state of the ACT.</para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Value</term>
|
||||
/// <term>Meaning</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>0</term>
|
||||
/// <term>The ACT is unauthorized</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>1</term>
|
||||
/// <term>The ACT is authorized</term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
public ACT_AUTHORIZATION_STATE_VALUE ulState;
|
||||
}
|
||||
|
||||
/// <summary>The <c>SILO_INFO</c> structure contains information that identifies and describes the silo.</summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ehstorapi/ns-ehstorapi-silo_info typedef struct _SILO_INFO { ULONG ulSTID;
|
||||
// UCHAR SpecificationMajor; UCHAR SpecificationMinor; UCHAR ImplementationMajor; UCHAR ImplementationMinor; UCHAR type; UCHAR
|
||||
// capabilities; } SILO_INFO;
|
||||
[PInvokeData("ehstorapi.h", MSDNShortId = "NS:ehstorapi._SILO_INFO")]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 2)]
|
||||
public struct SILO_INFO
|
||||
{
|
||||
/// <summary>Silo Type Identifier for the silo assigned by IEEE 1667 Working Group.</summary>
|
||||
public uint ulSTID;
|
||||
|
||||
/// <summary>Major version of the specification implemented in the silo.</summary>
|
||||
public byte SpecificationMajor;
|
||||
|
||||
/// <summary>Minor version of the specification implemented in the silo.</summary>
|
||||
public byte SpecificationMinor;
|
||||
|
||||
/// <summary>Major version of the firmware implemented in the silo.</summary>
|
||||
public byte ImplementationMajor;
|
||||
|
||||
/// <summary>Minor version of the firmware implemented in the silo.</summary>
|
||||
public byte ImplementationMinor;
|
||||
|
||||
/// <summary>Type of the silo.</summary>
|
||||
public byte type;
|
||||
|
||||
/// <summary>Capabilities of the silo.</summary>
|
||||
public byte capabilities;
|
||||
}
|
||||
|
||||
/// <summary>EnhancedStorageACT Class</summary>
|
||||
[ComImport, Guid("af076a15-2ece-4ad4-bb21-29f040e176d8"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class EnhancedStorageACT
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>EnhancedStorageSilo Class</summary>
|
||||
[ComImport, Guid("cb25220c-76c7-4fee-842b-f3383cd022bc"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class EnhancedStorageSilo
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>EnhancedStorageSiloAction Class</summary>
|
||||
[ComImport, Guid("886D29DD-B506-466B-9FBF-B44FF383FB3F"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class EnhancedStorageSiloAction
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>EnumEnhancedStorageACT Class</summary>
|
||||
[ComImport, Guid("fe841493-835c-4fa3-b6cc-b4b2d4719848"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class EnumEnhancedStorageACT
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<ProjectExtensions>
|
||||
<SupportedDlls>ehstorapi.dll</SupportedDlls>
|
||||
</ProjectExtensions>
|
||||
<PropertyGroup>
|
||||
<Description>PInvoke API (methods, structures and constants) imported from Windows EnhancedStorage.dll.</Description>
|
||||
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
|
||||
<TargetFrameworks>net20;net35;net40;net45;net5.0-windows;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
|
||||
<AssemblyName>Vanara.PInvoke.EnhancedStorage</AssemblyName>
|
||||
<PackageId>$(AssemblyName)</PackageId>
|
||||
<PackageTags>pinvoke;vanara;net-extensions;interop;EnhancedStorage</PackageTags>
|
||||
<PackageReleaseNotes/>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Core\Vanara.Core.csproj" />
|
||||
<ProjectReference Include="..\Shared\Vanara.PInvoke.Shared.csproj" />
|
||||
<ProjectReference Include="..\Ole\Vanara.PInvoke.Ole.csproj" />
|
||||
<ProjectReference Include="..\PortableDeviceApi\Vanara.PInvoke.PortableDeviceApi.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,271 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Vanara.InteropServices;
|
||||
using static Vanara.PInvoke.SetupAPI;
|
||||
|
||||
namespace Vanara.PInvoke
|
||||
{
|
||||
public static partial class PortableDeviceApi
|
||||
{
|
||||
/// <summary>
|
||||
/// The <c>IConnectionRequestCallback</c> interface defines a single callback method. A Windows Portable Devices (WPD) application
|
||||
/// implements this optional Component Object Model (COM) interface to receive notifications about completed requests and to cancel
|
||||
/// pending requests. The requests are sent using the <c>IPortableDeviceConnector::Connect</c> and
|
||||
/// <c>IPortableDeviceConnector::Disconnect</c> methods.
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iconnectionrequestcallback
|
||||
[PInvokeData("portabledeviceconnectapi.h")]
|
||||
[ComImport, Guid("272C9AE0-7161-4AE0-91BD-9F448EE9C427"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
public interface IConnectionRequestCallback
|
||||
{
|
||||
/// <summary>
|
||||
/// The <c>OnComplete</c> method notifies an application that a previously scheduled Connect or Disconnect request to the
|
||||
/// MTP/Bluetooth device has completed
|
||||
/// </summary>
|
||||
/// <param name="hrStatus">The status of the request to connect or disconnect a given device.</param>
|
||||
/// <returns>
|
||||
/// <para>The method returns an <c>HRESULT</c>. Possible values include, but are not limited to, those in the following table.</para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Return code</term>
|
||||
/// <term>Description</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>S_OK</term>
|
||||
/// <term>The method succeeded.</term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// An application implements the <c>IConnectionRequestCallback</c> interface to receive notifications about completed requests
|
||||
/// and to cancel pending requests.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Windows Portable Devices (WPD) calls this method to notify an application that a previously scheduled request has completed.
|
||||
/// Each request can be tracked and canceled by its application-supplied callback. Therefore, if the application needs to send
|
||||
/// multiple requests at the same time using the same <c>IPortableDeviceConnector</c> object, each request should be passed a
|
||||
/// unique <c>IConnectionRequestCallback</c> object as the input parameter to the <c>IPortableDeviceConnector::Connect</c> and
|
||||
/// <c>IPortableDeviceConnector::Disconnect</c> methods.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iconnectionrequestcallback-oncomplete HRESULT OnComplete( [in] HRESULT
|
||||
// hrStatus );
|
||||
[PreserveSig]
|
||||
HRESULT OnComplete(HRESULT hrStatus);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <c>IEnumPortableDeviceConnectors</c> interface supports the enumeration of <c>IPortableDeviceConnector</c> interfaces,
|
||||
/// representing MTP/Bluetooth devices that were paired with the PC. Note that this will retrieve all previously-paired devices,
|
||||
/// including devices that are paired but disconnected. To determine if a device is still connected, query the
|
||||
/// <c>DEVPKEY_MTPBTH_IsConnected</c> property for that device.
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/ienumportabledeviceconnectors
|
||||
[PInvokeData("portabledeviceconnectapi.h")]
|
||||
[ComImport, Guid("BFDEF549-9247-454F-BD82-06FE80853FAA"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(EnumBthMtpConnectors))]
|
||||
public interface IEnumPortableDeviceConnectors : Vanara.Collections.ICOMEnum<IPortableDeviceConnector>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <c>Next</c> method retrieves the next one or more <c>IPortableDeviceConnector</c> objects in the enumeration sequence.
|
||||
/// </summary>
|
||||
/// <param name="cRequested">
|
||||
/// The number of requested devices. This value also indicates the number of elements in the caller-allocated array specified by
|
||||
/// the pConnectors parameter.
|
||||
/// </param>
|
||||
/// <param name="pConnectors">
|
||||
/// An array of <c>IPortableDeviceConnector</c> pointers, each specifying a paired MTP Bluetooth device. The caller must
|
||||
/// allocate an array of <c>IPortableDeviceConnector</c> pointers, with the array length specified by the cRequested parameter.
|
||||
/// On successful return, the caller must free both the array and the returned pointers. The <c>IPortableDeviceConnector</c>
|
||||
/// interfaces are freed by calling the <c>IUnknown::Release</c> method.
|
||||
/// </param>
|
||||
/// <param name="pcFetched">
|
||||
/// The number of <c>IPortableDeviceConnector</c> interfaces that are actually retrieved. If no <c>IPortableDeviceConnector</c>
|
||||
/// interfaces are retrieved and the return value is <c>S_FALSE</c>, there are no more <c>IPortableDeviceConnector</c>
|
||||
/// interfaces to enumerate.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// <para>The method returns an <c>HRESULT</c>. Possible values include, but are not limited to, those in the following table.</para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Return code</term>
|
||||
/// <term>Description</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>S_OK</term>
|
||||
/// <term>The method succeeded.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>S_FALSE</term>
|
||||
/// <term>There are no more MTP Bluetooth devices to enumerate.</term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/ienumportabledeviceconnectors-next HRESULT Next( [in] UINT32
|
||||
// cRequested, [out] IPortableDeviceConnector **pConnectors, [in, out] UINT32 *pcFetched );
|
||||
[PreserveSig]
|
||||
HRESULT Next(uint cRequested, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface)] IPortableDeviceConnector[] pConnectors,
|
||||
[In, Out] ref uint pcFetched);
|
||||
|
||||
/// <summary>The <c>Skip</c> method skips the specified number of devices in the enumeration sequence.</summary>
|
||||
/// <param name="cConnectors">The number of devices to skip.</param>
|
||||
/// <returns>
|
||||
/// <para>The method returns an <c>HRESULT</c>. Possible values include, but are not limited to, those in the following table.</para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Return code</term>
|
||||
/// <term>Description</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>S_OK</term>
|
||||
/// <term>The method succeeded.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>S_FALSE</term>
|
||||
/// <term>
|
||||
/// The specified number of devices could not be skipped. One possible cause: The cConnectors parameter specifies more devices
|
||||
/// than actually remain in the enumeration sequence.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/ienumportabledeviceconnectors-skip HRESULT Skip( [in] UINT32
|
||||
// cConnectors );
|
||||
[PreserveSig]
|
||||
HRESULT Skip(uint cConnectors);
|
||||
|
||||
/// <summary>The <c>Reset</c> method resets the enumeration sequence to the beginning.</summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/ienumportabledeviceconnectors-reset HRESULT Reset();
|
||||
void Reset();
|
||||
|
||||
/// <summary>The <c>Clone</c> method creates a copy of the current <c>IEnumPortableDeviceConnectors</c> interface.</summary>
|
||||
/// <returns>
|
||||
/// The address of a pointer to an <c>IEnumPortableDeviceConnectors</c> interface. The calling application must release this
|
||||
/// interface when it is done with it.
|
||||
/// </returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/ienumportabledeviceconnectors-clone HRESULT Clone( [out]
|
||||
// IEnumPortableDeviceConnectors **ppEnum );
|
||||
IEnumPortableDeviceConnectors Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <c>IPortableDeviceConnector</c> interface defines methods used for connection-management and property-retrieval for a paired
|
||||
/// MTP/Bluetooth device.
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/portabledeviceconnectapi/nn-portabledeviceconnectapi-iportabledeviceconnector
|
||||
[PInvokeData("portabledeviceconnectapi.h", MSDNShortId = "NN:portabledeviceconnectapi.IPortableDeviceConnector")]
|
||||
[ComImport, Guid("625E2DF8-6392-4CF0-9AD1-3CFA5F17775C"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
public interface IPortableDeviceConnector
|
||||
{
|
||||
/// <summary>The <c>Connect</c> method sends an asynchronous connection request to the MTP/Bluetooth device.</summary>
|
||||
/// <param name="pCallback">
|
||||
/// A pointer to a IConnectionRequestCallback interface if the application wishes to be notified when the request is complete;
|
||||
/// otherwise, <c>NULL</c>. If multiple requests are being sent simultaneously using the same IPortableDeviceConnector object, a
|
||||
/// different instance of the callback object must be used.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method will queue a connect request and then return immediately. The connection request will result in a no-op if a
|
||||
/// device is already connected.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// To be notified when the request is complete, applications should provide a pointer to the IConnectionRequestCallback interface.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If a previously paired MTP/Bluetooth device is within range, applications can call this method to instantiate the Windows
|
||||
/// Portable Devices (WPD) class driver stack for that device, so that the device can be communicated to using the WPD API.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/portabledeviceconnectapi/nf-portabledeviceconnectapi-iportabledeviceconnector-connect
|
||||
// HRESULT Connect( [in, optional] IConnectionRequestCallback *pCallback );
|
||||
void Connect([Optional] IConnectionRequestCallback pCallback);
|
||||
|
||||
/// <summary>The <c>Disconnect</c> method sends an asynchronous disconnect request to the MTP/Bluetooth device.</summary>
|
||||
/// <param name="pCallback">A pointer to an IConnectionRequestCallback interface.</param>
|
||||
/// <remarks>
|
||||
/// <para>This method will queue a disconnect request and then return immediately.</para>
|
||||
/// <para>
|
||||
/// To be notified when the request is complete, applications should provide a pointer to the IConnectionRequestCallback
|
||||
/// interface. This will disconnect the MTP/Bluetooth link and remove the Windows Portable Devices (WPD) class driver stack for
|
||||
/// that device.
|
||||
/// </para>
|
||||
/// <para>Once the disconnection completes, the WPD API will no longer enumerate this device.</para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/portabledeviceconnectapi/nf-portabledeviceconnectapi-iportabledeviceconnector-disconnect
|
||||
// HRESULT Disconnect( [in] IConnectionRequestCallback *pCallback );
|
||||
void Disconnect(IConnectionRequestCallback pCallback);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>Cancel</c> method cancels a pending request to connect or disconnect an MTP/Bluetooth device. The callback object is
|
||||
/// used to identify the request. This method returns immediately, and the request will be cancelled asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="pCallback">A pointer to an IConnectionRequestCallback interface. This value cannot be <c>NULL</c>.</param>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/portabledeviceconnectapi/nf-portabledeviceconnectapi-iportabledeviceconnector-cancel
|
||||
// HRESULT Cancel( [in] IConnectionRequestCallback *pCallback );
|
||||
void Cancel(IConnectionRequestCallback pCallback);
|
||||
|
||||
/// <summary>The <c>GetProperty</c> method retrieves a property for the given MTP/Bluetooth Bus Enumerator device.</summary>
|
||||
/// <param name="pPropertyKey">A pointer to a property key for the requested property.</param>
|
||||
/// <param name="pPropertyType">A pointer to a property type.</param>
|
||||
/// <param name="ppData">The address of a pointer to the property data.</param>
|
||||
/// <param name="pcbData">A pointer to the size (in bytes) of the property data.</param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The properties retrieved by this method are set on the device node. An example property key is
|
||||
/// <c>DEVPKEY_MTPBTH_IsConnected</c>, which indicates whether the device is currently connected.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Valid values for the pPropertyType parameter are system-defined base data types of the unified device property model. The
|
||||
/// data-type names start with the prefix <c>DEVPROP_TYPE_</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Once the application no longer needs the property data specified by the ppData parameter, it must call <c>CoTaskMemAlloc</c>
|
||||
/// to free this data.
|
||||
/// </para>
|
||||
/// <para>Examples</para>
|
||||
/// <para>The following example shows how to read the DEVPKEY_MTPBTH_IsConnected property for a paired MTP/Bluetooth device.</para>
|
||||
/// <para>
|
||||
/// <code>#include <devpkey.h> #include <PortableDeviceConnectAPI.h> HRESULT IsDeviceConnected( __in IPortableDeviceConnector* pDevice, __out BOOL* pIsConnected) { DEVPROPTYPE typeGet; BYTE* pDataGet; UINT32 cbDataGet; *pbIsConnected = FALSE; HRESULT hr = pDevice ->GetProperty(&DEVPKEY_MTPBTH_IsConnected, &typeGet, &pDataGet, &cbDataGet); if (SUCCEEDED(hr)) { DEVPROP_BOOLEAN bIsConnected = *((DEVPROP_BOOLEAN*)pDataGet); if (bIsConnected == DEVPROP_TRUE) { * pIsConnected = TRUE; } // Release memory allocated by GetProperty CoTaskMemFree(pDataGet); } return hr; }</code>
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/portabledeviceconnectapi/nf-portabledeviceconnectapi-iportabledeviceconnector-getproperty
|
||||
// HRESULT GetProperty( [in] const DEVPROPKEY *pPropertyKey, [out] DEVPROPTYPE *pPropertyType, [out] BYTE **ppData, [out] UINT32
|
||||
// *pcbData );
|
||||
void GetProperty(in DEVPROPKEY pPropertyKey, out DEVPROPTYPE pPropertyType, out SafeCoTaskMemHandle ppData, out uint pcbData);
|
||||
|
||||
/// <summary>The <c>SetProperty</c> method sets the given property on the MTP/Bluetooth Bus Enumerator device.</summary>
|
||||
/// <param name="pPropertyKey">A pointer to a property key for the given property.</param>
|
||||
/// <param name="PropertyType">The property type.</param>
|
||||
/// <param name="pData">A pointer to the property data.</param>
|
||||
/// <param name="cbData">The size (in bytes) of the property data.</param>
|
||||
/// <remarks>Before calling this method, an application must verify that it has Administrator user rights.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/portabledeviceconnectapi/nf-portabledeviceconnectapi-iportabledeviceconnector-setproperty
|
||||
// HRESULT SetProperty( [in] const DEVPROPKEY *pPropertyKey, [in] DEVPROPTYPE PropertyType, [in] const BYTE *pData, [in] UINT32
|
||||
// cbData );
|
||||
void SetProperty(in DEVPROPKEY pPropertyKey, DEVPROPTYPE PropertyType, [In] IntPtr pData, [In] uint cbData);
|
||||
|
||||
/// <summary>The <c>GetPnPID</c> method retrieves the connector's Plug and Play (PnP) device identifier.</summary>
|
||||
/// <returns>The PnP device identifier.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The identifier retrieved by this method corresponds to a handle to the MTP/Bluetooth Bus Enumerator device node that
|
||||
/// receives connect and disconnect IOCTL requests for a paired MTP/Bluetooth device. Applications can use this identifier with
|
||||
/// the SetupAPI functions to access the device node.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Once the application no longer needs the identifier specified by the ppwszPnPID parameter, it must call the
|
||||
/// <c>CoTaskMemAlloc</c> function to free the identifier.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/portabledeviceconnectapi/nf-portabledeviceconnectapi-iportabledeviceconnector-getpnpid
|
||||
// HRESULT GetPnPID( [out] LPWSTR *ppwszPnPID );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetPnPID();
|
||||
}
|
||||
|
||||
/// <summary>EnumBthMtpConnectors Class</summary>
|
||||
[PInvokeData("portabledeviceconnectapi.h")]
|
||||
[ComImport, Guid("a1570149-e645-4f43-8b0d-409b061db2fc"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class EnumBthMtpConnectors { }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,847 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using Vanara.InteropServices;
|
||||
using static Vanara.PInvoke.Ole32;
|
||||
using static Vanara.PInvoke.PropSys;
|
||||
|
||||
namespace Vanara.PInvoke
|
||||
{
|
||||
public static partial class PortableDeviceApi
|
||||
{
|
||||
/// <summary>
|
||||
/// The <c>IPortableDeviceKeyCollection</c> interface holds a collection of <c>PROPERTYKEY</c> values. This interface can be
|
||||
/// retrieved from a method or, if a new object is required, call <c>CoCreate</c> with <c>CLSID_PortableDeviceKeyCollection</c>.
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicekeycollection
|
||||
[PInvokeData("portabldevicetypes.h")]
|
||||
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("DADA2357-E0AD-492E-98DB-DD61C53BA353"), CoClass(typeof(PortableDeviceKeyCollection))]
|
||||
public interface IPortableDeviceKeyCollection
|
||||
{
|
||||
/// <summary>The <c>GetCount</c> method retrieves the number of keys in this collection.</summary>
|
||||
/// <returns>Pointer to a <c>DWORD</c> that contains the number of keys in the collection.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicekeycollection-getcount HRESULT GetCount( [in] DWORD
|
||||
// *pcElems );
|
||||
uint GetCount();
|
||||
|
||||
/// <summary>The <c>GetAt</c> method retrieves a <c>PROPERTYKEY</c> from the collection by index.</summary>
|
||||
/// <param name="dwIndex"><c>DWORD</c> that contains the index of the key to be retrieved.</param>
|
||||
/// <returns>Pointer to a <c>PROPERTYKEY</c> object.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicekeycollection-getat HRESULT GetAt( [in] const DWORD
|
||||
// dwIndex, [out] PROPERTYKEY *pKey );
|
||||
PROPERTYKEY GetAt([In] uint dwIndex);
|
||||
|
||||
/// <summary>The <c>Add</c> method adds a property key to the collection.</summary>
|
||||
/// <param name="Key">
|
||||
/// A <c>REFPROPERTYKEY</c> to add to the collection. This method copies the key to the collection, so you can release the local
|
||||
/// variable after calling this method.
|
||||
/// </param>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicekeycollection-add HRESULT Add( [in] REFPROPERTYKEY Key );
|
||||
void Add(in PROPERTYKEY Key);
|
||||
|
||||
/// <summary>Deletes all items from the collection.</summary>
|
||||
/// <remarks>None.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/portabledevicetypes/nf-portabledevicetypes-iportabledevicekeycollection-clear
|
||||
// HRESULT Clear();
|
||||
void Clear();
|
||||
|
||||
/// <summary>The <c>RemoveAt</c> method removes the element stored at the location specified by the given index.</summary>
|
||||
/// <param name="dwIndex">Specifies the index of the element to be removed.</param>
|
||||
/// <remarks>You must specify a zero-based index.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicekeycollection-removeat HRESULT RemoveAt( [in] const
|
||||
// DWORD dwIndex );
|
||||
void RemoveAt([In] uint dwIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// The <c>IPortableDevicePropVariantCollection</c> interface holds a collection of indexed <c>PROPVARIANT</c> values of the same
|
||||
/// VARTYPE. The VARTYPE of the first item that is added to the collection determines the VARTYPE of the collection. An attempt to
|
||||
/// add an item of a different VARTYPE may fail if the <c>PROPVARIANT</c> value cannot be changed to the collection's current
|
||||
/// VARTYPE. To change the VARTYPE of the collection, call <c>ChangeType</c>.
|
||||
/// </para>
|
||||
/// <para>This interface can be retrieved from a method or, if a new object is required, call <c>CoCreate</c> with <c>CLSID_PortableDevicePropVariantCollection</c>.</para>
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicepropvariantcollection
|
||||
[PInvokeData("portabldevicetypes.h")]
|
||||
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("89B2E422-4F1B-4316-BCEF-A44AFEA83EB3"), CoClass(typeof(PortableDevicePropVariantCollection))]
|
||||
public interface IPortableDevicePropVariantCollection
|
||||
{
|
||||
/// <summary>The <c>GetCount</c> method retrieves the number of items in this collection.</summary>
|
||||
/// <returns>The number of items in the collection.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicepropvariantcollection-getcount HRESULT GetCount( [in]
|
||||
// DWORD *pcElems );
|
||||
uint GetCount();
|
||||
|
||||
/// <summary>The <c>GetAt</c> method retrieves an item from the collection by a zero-based index.</summary>
|
||||
/// <param name="dwIndex"><c>DWORD</c> that contains the zero-based index of the item to retrieve.</param>
|
||||
/// <param name="pValue">
|
||||
/// Pointer to a <c>PROPVARIANT</c> structure. The caller is responsible for freeing this memory by calling <c>PropVariantClear</c>.
|
||||
/// </param>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicepropvariantcollection-getat HRESULT GetAt( [in] const
|
||||
// DWORD dwIndex, [out] PROPVARIANT *pValue );
|
||||
void GetAt([In] uint dwIndex, [In, Out] PROPVARIANT pValue);
|
||||
|
||||
/// <summary>The <c>Add</c> method adds an item to the collection.</summary>
|
||||
/// <param name="pValue">
|
||||
/// Pointer to a new <c>PROPVARIANT</c> object to add to the collection. This method copies the <c>PROPVARIANT</c> to the
|
||||
/// collection, so you should release your local copy of the variable by calling <c>PropVariantClear</c> after calling this method.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// When the VARTYPE for pValue is VT_VECTOR or VT_UI1, setting and retrieving a <c>NULL</c> or zero-sized buffer is not
|
||||
/// supported. For example, neither pValue.caub.pElems = <c>NULL</c> nor pValue.caub.cElems = 0 are allowed.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If a caller tries to add an item of a different VARTYPE contained in the collection and the PROPVARIANT value cannot be
|
||||
/// changed by this interface automatically, this method will fail. To change the collection type manually, call <c>IPortableDevicePropVariantCollection::ChangeType</c>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicepropvariantcollection-add HRESULT Add( [in] const
|
||||
// PROPVARIANT *pValue );
|
||||
void Add([In] PROPVARIANT pValue);
|
||||
|
||||
/// <summary>The <c>GetType</c> method retrieves the data type of the items in the collection.</summary>
|
||||
/// <returns>A Platform SDK <c>VARTYPE</c> enumeration value that indicates the data type of all the items in the collection.</returns>
|
||||
/// <remarks>All items that are stored in an <c>IPortableDevicePropVariantCollection</c> are the same type.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicepropvariantcollection-gettype HRESULT GetType( [out]
|
||||
// VARTYPE *pvt );
|
||||
VARTYPE GetType();
|
||||
|
||||
/// <summary>The <c>ChangeType</c> method converts all items in the collection to the specified VARTYPE.</summary>
|
||||
/// <param name="vt">
|
||||
/// Specifies the <c>VARTYPE</c> to which you want to convert all items in the collection. Example types include VT_UI4 and VT_UI8.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// If this method fails, the collection may be left in an intermediate state, with some members converted and some not converted.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicepropvariantcollection-changetype HRESULT ChangeType(
|
||||
// [in] const VARTYPE vt );
|
||||
void ChangeType([In] VARTYPE vt);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>Clear</c> method frees, and then removes, all items from the collection. The collection is considered empty after
|
||||
/// calling this method.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// After calling <c>Clear</c>, the collection is considered type-less, meaning that the VARTYPE it was previously set to is no
|
||||
/// longer restricting <c>Add</c> operations. A call to <c>Add</c> after calling <c>Clear</c> is considered the "first"
|
||||
/// <c>Add</c> for this collection.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicepropvariantcollection-clear HRESULT Clear();
|
||||
void Clear();
|
||||
|
||||
/// <summary>The <c>RemoveAt</c> method removes the element stored at the location specified by the given index.</summary>
|
||||
/// <param name="dwIndex">Specifies the index of the element to be removed.</param>
|
||||
/// <remarks>You must specify a zero-based index.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicepropvariantcollection-removeat HRESULT RemoveAt( [in]
|
||||
// const DWORD dwIndex );
|
||||
void RemoveAt([In] uint dwIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// The <c>IPortableDeviceValues</c> interface holds a collection of <c>PROPERTYKEY</c>/ <c>PROPVARIANT</c> pairs. Values in the
|
||||
/// collection do not need to be the same VARTYPE.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Values are stored as key-value pairs; each key must be unique in the collection. Clients can search for items by
|
||||
/// <c>PROPERTYKEY</c> or zero-based index. Data values are stored as <c>PROPVARIANT</c> structures. You can add or retrieve values
|
||||
/// of any type by using the generic methods <c>SetValue</c> and <c>GetValue</c>, or you add items by using the method specific to
|
||||
/// the type of data added.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The <c>Get...</c> methods require the caller to release any retrieved values appropriately. The <c>Set...</c> methods copy the
|
||||
/// value into the collection.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// When an <c>IPortableDeviceValues</c> interface is released, it calls <c>Clear</c>, which frees the memory that was allocated for
|
||||
/// all its members appropriately.
|
||||
/// </para>
|
||||
/// <para>This interface can be retrieved from a method or, if a new object is required, call <c>CoCreate</c> with <c>CLSID_PortableDeviceValues</c>.</para>
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues
|
||||
[PInvokeData("portabldevicetypes.h")]
|
||||
[ComImport, Guid("6848f6f2-3155-4f86-b6f5-263eeeab3143"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(PortableDeviceValues))]
|
||||
public interface IPortableDeviceValues
|
||||
{
|
||||
/// <summary>The <c>GetCount</c> method retrieves the number of items in the collection.</summary>
|
||||
/// <returns>Pointer to a <c>DWORD</c> that contains the number of items in the collection.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getcount HRESULT GetCount( [in] DWORD *pcelt );
|
||||
uint GetCount();
|
||||
|
||||
/// <summary>The <c>GetAt</c> method retrieves a value from the collection using the supplied zero-based index.</summary>
|
||||
/// <param name="index">A <c>DWORD</c> that specifies a zero-based index in the collection.</param>
|
||||
/// <param name="pKey">An optional <c>PROPERTYKEY</c> pointer that retrieves the key of the specified item.</param>
|
||||
/// <param name="pValue">
|
||||
/// An optional <c>PROPVARIANT</c> that retrieves the value of the specified item. The caller must free the memory by calling
|
||||
/// <c>PropVariantClear</c> when done with it.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// If a property indicates a value of type VT_UNKNOWN, the property will be one of the Windows Portable Devices (
|
||||
/// <c>IPortableDeviceKeyCollection</c>, <c>IPortableDeviceValuesCollection</c>, <c>IPortableDeviceValues</c> or
|
||||
/// <c>IPortableDevicePropVariantCollection</c>). No other interfaces can be returned by Windows Portable Devices.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getat HRESULT GetAt( [in] const DWORD index,
|
||||
// [in, out] PROPERTYKEY *pKey, [in, out] PROPVARIANT *pValue );
|
||||
void GetAt([In] uint index, out PROPERTYKEY pKey, PROPVARIANT pValue);
|
||||
|
||||
/// <summary>The <c>SetValue</c> method adds a new <c>PROPVARIANT</c> value or overwrites an existing one.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="pValue">
|
||||
/// A <c>PROPVARIANT</c> that specifies the new value. The SDK copies the value, so the caller can release the local variable by
|
||||
/// calling <c>PropVariantClear</c> after calling this method.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// When the VARTYPE for pValue is VT_VECTOR or VT_UI1, setting a <c>NULL</c> or zero-sized buffer is not supported. For
|
||||
/// example, neither pValue.caub.pElems = <c>NULL</c> nor pValue.caub.cElems = 0 are allowed.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This method can be used to retrieve a value of any type from the collection. However, if you know the value type in advance,
|
||||
/// use one of the specialized <c>Set...</c> methods of this interface to avoid the overhead of working with PROPVARIANT values directly.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any
|
||||
/// warning. The existing key memory is released appropriately.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setvalue HRESULT SetValue( [in] REFPROPERTYKEY
|
||||
// key, [in] const PROPVARIANT *pValue );
|
||||
void SetValue(in PROPERTYKEY key, [In] PROPVARIANT pValue);
|
||||
|
||||
/// <summary>The <c>GetValue</c> method retrieves a <c>PROPVARIANT</c> value specified by a key.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>
|
||||
/// Pointer to the retrieved <c>PROPVARIANT</c> value. The caller must release the memory by calling <c>PropVariantClear</c>
|
||||
/// when done with it.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// When the VARTYPE for pValue is VT_VECTOR or VT_UI1, retrieving a <c>NULL</c> or zero-sized buffer is not supported. For
|
||||
/// example, neither pValue.caub.pElems = <c>NULL</c> nor pValue.caub.cElems = 0 are allowed.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This method can be used to retrieve a value of any type from the collection. However, if you know the value type in advance,
|
||||
/// use one of the specialized retrieval methods of this interface to avoid the overhead of working with PROPVARIANT values directly.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getvalue HRESULT GetValue( [in] REFPROPERTYKEY
|
||||
// key, [out] PROPVARIANT *pValue );
|
||||
PROPVARIANT GetValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>The <c>SetStringValue</c> method adds a new string value (type VT_LPWSTR) or overwrites an existing one.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="Value">
|
||||
/// A <c>LPCWSTR</c> that specifies the new value. The string is copied, so the caller can release the memory allocated for this
|
||||
/// value after calling this method.
|
||||
/// </param>
|
||||
/// <remarks>Any existing key memory will be released appropriately.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setstringvalue HRESULT SetStringValue( [in]
|
||||
// REFPROPERTYKEY key, [in] LPCWSTR Value );
|
||||
void SetStringValue(in PROPERTYKEY key, [In, MarshalAs(UnmanagedType.LPWStr)] string Value);
|
||||
|
||||
/// <summary>The <c>GetStringValue</c> method retrieves a string value (type VT_LPWSTR) specified by a key.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>
|
||||
/// Pointer to the retrieved <c>LPWSTR</c> value. The caller is responsible for calling <c>CoTaskMemFree</c> to release the memory.
|
||||
/// </returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getstringvalue HRESULT GetStringValue( [in]
|
||||
// REFPROPERTYKEY key, [out] LPWSTR *pValue );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
string GetStringValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>SetUnsignedIntegerValue</c> method adds a new <c>ULONG</c> value (type VT_UI4) or overwrites an existing one.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="Value">A <c>ULONG</c> that specifies the new value.</param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any warning.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setunsignedintegervalue HRESULT
|
||||
// SetUnsignedIntegerValue( [in] REFPROPERTYKEY key, [in] const ULONG Value );
|
||||
void SetUnsignedIntegerValue(in PROPERTYKEY key, [In] uint Value);
|
||||
|
||||
/// <summary>The <c>GetUnsignedIntegerValue</c> method retrieves a <c>ULONG</c> value (type VT_UI4) specified by a key.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>Pointer to the retrieved <c>ULONG</c> value.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getunsignedintegervalue HRESULT
|
||||
// GetUnsignedIntegerValue( [in] REFPROPERTYKEY key, [out] ULONG *pValue );
|
||||
uint GetUnsignedIntegerValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>SetSignedIntegerValue</c> method adds a new <c>LONG</c> value (type VT_I4) or overwrites an existing one.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="Value">A <c>LONG</c> that specifies the new value.</param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any warning.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setsignedintegervalue HRESULT
|
||||
// SetSignedIntegerValue( [in] REFPROPERTYKEY key, [in] const LONG Value );
|
||||
void SetSignedIntegerValue(in PROPERTYKEY key, [In] int Value);
|
||||
|
||||
/// <summary>The <c>GetSignedIntegerValue</c> method retrieves a <c>LONG</c> value (type VT_I4) specified by a key.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>Pointer to the retrieved <c>LONG</c> value.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getsignedintegervalue HRESULT
|
||||
// GetSignedIntegerValue( [in] REFPROPERTYKEY key, [out] LONG *pValue );
|
||||
int GetSignedIntegerValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>SetUnsignedLargeIntegerValue</c> method adds a new <c>ULONGLONG</c> value (type VT_UI8) or overwrites an existing one.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="Value">A <c>ULONGLONG</c> that specifies the new value.</param>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setunsignedlargeintegervalue HRESULT
|
||||
// SetUnsignedLargeIntegerValue( [in] REFPROPERTYKEY key, [in] const ULONGLONG Value );
|
||||
void SetUnsignedLargeIntegerValue(in PROPERTYKEY key, [In] ulong Value);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>GetUnsignedLargeIntegerValue</c> method retrieves a <c>ULONGLONG</c> value (type VT_UI8) specified by a key.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>Pointer to the retrieved <c>ULONGLONG</c> value.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getunsignedlargeintegervalue HRESULT
|
||||
// GetUnsignedLargeIntegerValue( [in] REFPROPERTYKEY key, [out] ULONGLONG *pValue );
|
||||
ulong GetUnsignedLargeIntegerValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>SetSignedLargeIntegerValue</c> method adds a new <c>LONGLONG</c> value (type VT_I8) or overwrites an existing one.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="Value">A <c>LONGLONG</c> that specifies the new value.</param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any warning.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setsignedlargeintegervalue HRESULT
|
||||
// SetSignedLargeIntegerValue( [in] REFPROPERTYKEY key, [in] const LONGLONG Value );
|
||||
void SetSignedLargeIntegerValue(in PROPERTYKEY key, [In] long Value);
|
||||
|
||||
/// <summary>The <c>GetSignedLargeIntegerValue</c> method retrieves a <c>LONGLONG</c> value (type VT_I8) specified by a key.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>Pointer to the retrieved <c>ULONG</c> value.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getsignedlargeintegervalue HRESULT
|
||||
// GetSignedLargeIntegerValue( [in] REFPROPERTYKEY key, [out] LONGLONG *pValue );
|
||||
long GetSignedLargeIntegerValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>The <c>SetFloatValue</c> method adds a new <c>FLOAT</c> value (type VT_R4) or overwrites an existing one.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="Value">A <c>FLOAT</c> that contains the new value.</param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any warning.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setfloatvalue HRESULT SetFloatValue( [in]
|
||||
// REFPROPERTYKEY key, [in] const FLOAT Value );
|
||||
void SetFloatValue(in PROPERTYKEY key, [In] float Value);
|
||||
|
||||
/// <summary>The <c>GetFloatValue</c> method retrieves a <c>FLOAT</c> value (type VT_R4) specified by a key.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>Pointer to the retrieved <c>FLOAT</c> value.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getfloatvalue HRESULT GetFloatValue( [in]
|
||||
// REFPROPERTYKEY key, [out] FLOAT *pValue );
|
||||
float GetFloatValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>The <c>SetErrorValue</c> method adds a new <c>HRESULT</c> value (type VT_ERROR) or overwrites an existing one.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="Value">An <c>HRESULT</c> that contains the new value.</param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key specified by the key parameter, it overwrites the existing value without any warning.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-seterrorvalue HRESULT SetErrorValue( [in]
|
||||
// REFPROPERTYKEY key, [in] const HRESULT Value );
|
||||
void SetErrorValue(in PROPERTYKEY key, HRESULT Value);
|
||||
|
||||
/// <summary>The <c>GetErrorValue</c> method retrieves an <c>HRESULT</c> value (type VT_ERROR) specified by a key.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>Pointer to the retrieved <c>HRESULT</c> value.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-geterrorvalue HRESULT GetErrorValue( [in]
|
||||
// REFPROPERTYKEY key, [out] HRESULT *pValue );
|
||||
HRESULT GetErrorValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>SetKeyValue</c> method adds a new <c>REFPROPERTYKEY</c> value (type VT_UNKNOWN) or overwrites an existing one.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="Value">A <c>REFPROPERTYKEY</c> that specifies the new value.</param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any
|
||||
/// warning. The existing key memory is released appropriately.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setkeyvalue HRESULT SetKeyValue( [in]
|
||||
// REFPROPERTYKEY key, [in] REFPROPERTYKEY Value );
|
||||
void SetKeyValue(in PROPERTYKEY key, in PROPERTYKEY Value);
|
||||
|
||||
/// <summary>The <c>GetKeyValue</c> method retrieves a <c>PROPERTYKEY</c> value specified by a key.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>Pointer to the retrieved <c>PROPERTYKEY</c> value.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getkeyvalue HRESULT GetKeyValue( [in]
|
||||
// REFPROPERTYKEY key, [out] PROPERTYKEY *pValue );
|
||||
PROPERTYKEY GetKeyValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>The <c>SetBoolValue</c> method adds a new <c>Boolean</c> value (type VT_BOOL) or overwrites an existing one.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="Value">A <c>BOOL</c> that specifies the new value.</param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key specified by the key parameter, it overwrites the existing value without any warning.
|
||||
/// The existing key memory is released appropriately.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setboolvalue HRESULT SetBoolValue( [in]
|
||||
// REFPROPERTYKEY key, [in] const BOOL Value );
|
||||
void SetBoolValue(in PROPERTYKEY key, [In, MarshalAs(UnmanagedType.Bool)] bool Value);
|
||||
|
||||
/// <summary>The <c>GetBoolValue</c> method retrieves a <c>Boolean</c> value (type VT_BOOL) specified by a key.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>Pointer to the retrieved <c>BOOL</c> value.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getboolvalue HRESULT GetBoolValue( [in]
|
||||
// REFPROPERTYKEY key, [out] BOOL *pValue );
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
bool GetBoolValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>SetIUnknownValue</c> method adds a new <c>IUnknown</c> value (type VT_UNKNOWN) or overwrites an existing one.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="pValue">
|
||||
/// A pointer to an <c>IUnknown</c> interface that specifies the new value. The SDK copies a reference to the submitted
|
||||
/// interface and calls <c>AddRef</c> on it.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any
|
||||
/// warning. The existing key memory is released appropriately.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setiunknownvalue HRESULT SetIUnknownValue( [in]
|
||||
// REFPROPERTYKEY key, [in] IUnknown *pValue );
|
||||
void SetIUnknownValue(in PROPERTYKEY key, [In, MarshalAs(UnmanagedType.IUnknown)] object pValue);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>GetIUnknownValue</c> method retrieves an <c>IUnknown</c> interface value (type VT_UNKNOWN) specified by a key.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>
|
||||
/// Address of a variable that receives a pointer to the retrieved <c>IUnknown</c> interface. The caller is responsible for
|
||||
/// calling <c>Release</c> on the retrieved interface.
|
||||
/// </returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getiunknownvalue HRESULT GetIUnknownValue( [in]
|
||||
// REFPROPERTYKEY key, [out] IUnknown **ppValue );
|
||||
[return: MarshalAs(UnmanagedType.IUnknown)]
|
||||
object GetIUnknownValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>The <c>SetGuidValue</c> method adds a new <c>GUID</c> value (type VT_CLSID) or overwrites an existing one.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="Value">A <c>REFGUID</c> that contains the new value.</param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any warning.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setguidvalue HRESULT SetGuidValue( [in]
|
||||
// REFPROPERTYKEY key, [in] REFGUID Value );
|
||||
void SetGuidValue(in PROPERTYKEY key, in Guid Value);
|
||||
|
||||
/// <summary>The <c>GetGuidValue</c> method retrieves a <c>GUID</c> value (type VT_CLSID) specified by a key.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>Pointer to the retrieved <c>GUID</c> value.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getguidvalue HRESULT GetGuidValue( [in]
|
||||
// REFPROPERTYKEY key, [out] GUID *pValue );
|
||||
Guid GetGuidValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>SetBufferValue</c> method adds a new <c>BYTE</c>* value (type VT_VECTOR | VT_UI1) or overwrites an existing one.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="pValue">
|
||||
/// A <c>BYTE*</c> that contains the data to write to the item. The submitted buffer data is copied to the interface, so the
|
||||
/// caller can free this buffer after making this call.
|
||||
/// </param>
|
||||
/// <param name="cbValue">The size of the value pointed to by pValue, in bytes.</param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any
|
||||
/// warning. The existing key memory is released appropriately.
|
||||
/// </para>
|
||||
/// <para>Setting a <c>NULL</c> or a zero-sized buffer is not supported.</para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setbuffervalue HRESULT SetBufferValue( [in]
|
||||
// REFPROPERTYKEY key, [in] BYTE *pValue, [in] DWORD cbValue );
|
||||
void SetBufferValue(in PROPERTYKEY key, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] pValue, [In] int cbValue);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>GetBufferValue</c> method retrieves a <c>byte array</c> value (type VT_VECTOR | VT_UI1) specified by a key.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <param name="ppValue">
|
||||
/// Pointer to the retrieved <c>BYTE*</c> value. The caller is responsible for freeing the memory by calling <c>CoTaskMemFree</c>.
|
||||
/// </param>
|
||||
/// <param name="pcbValue">Pointer to the size of ppValue, in bytes.</param>
|
||||
/// <remarks>Retrieving a <c>NULL</c> buffer or a zero-sized buffer is not supported.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getbuffervalue HRESULT GetBufferValue( [in]
|
||||
// REFPROPERTYKEY key, [out] BYTE **ppValue, [out] DWORD *pcbValue );
|
||||
void GetBufferValue(in PROPERTYKEY key, [Out] out SafeCoTaskMemHandle ppValue, [Out] out int pcbValue);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>SetIPortableDeviceValuesValue</c> method adds a new <c>IPortableDeviceValues</c> value (type VT_UNKNOWN) or
|
||||
/// overwrites an existing one.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="pValue">
|
||||
/// Pointer to an <c>IPortableDeviceValues</c> interface that specifies the new value. The SDK copies a reference to the
|
||||
/// submitted interface and calls <c>AddRef</c> on it.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any
|
||||
/// warning. The existing key memory is released appropriately.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setiportabledevicevaluesvalue HRESULT
|
||||
// SetIPortableDeviceValuesValue( [in] REFPROPERTYKEY key, [in] IPortableDeviceValues *pValue );
|
||||
void SetIPortableDeviceValuesValue(in PROPERTYKEY key, [In] IPortableDeviceValues pValue);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>GetIPortableDeviceValuesValue</c> method retrieves an <c>IPortableDeviceValues</c> value (type VT_UNKNOWN) specified
|
||||
/// by a key.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>
|
||||
/// Address of a variable that receives a pointer to the retrieved <c>IPortableDeviceValues</c> interface. The caller is
|
||||
/// responsible for calling <c>Release</c> on the retrieved interface.
|
||||
/// </returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getiportabledevicevaluesvalue HRESULT
|
||||
// GetIPortableDeviceValuesValue( [in] REFPROPERTYKEY key, [out] IPortableDeviceValues **ppValue );
|
||||
IPortableDeviceValues GetIPortableDeviceValuesValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>SetIPortableDevicePropVariantCollectionValue</c> method adds a new <c>IPortableDevicePropVariantCollection</c> value
|
||||
/// (type VT_UNKNOWN) or overwrites an existing one.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="pValue">
|
||||
/// Pointer to an <c>IPortableDevicePropVariantCollection</c> interface that specifies the new value. The SDK copies a reference
|
||||
/// to the submitted interface and calls <c>AddRef</c> on it.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any
|
||||
/// warning. The existing key memory is released appropriately.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-setiportabledevicepropvariantcollectionvalue
|
||||
// HRESULT SetIPortableDevicePropVariantCollectionValue( [in] REFPROPERTYKEY key, [in] IPortableDevicePropVariantCollection
|
||||
// *pValue );
|
||||
void SetIPortableDevicePropVariantCollectionValue(in PROPERTYKEY key, IPortableDevicePropVariantCollection pValue);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>GetIPortableDevicePropVariantCollectionValue</c> method retrieves an <c>IPortableDevicePropVariantCollection</c>
|
||||
/// value (type VT_UNKNOWN) specified by a key.
|
||||
/// </summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>
|
||||
/// Address of a variable that receives a pointer to the retrieved <c>IPortableDevicePropVariantCollection</c> interface. The
|
||||
/// caller is responsible for calling <c>Release</c> on the retrieved interface.
|
||||
/// </returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-getiportabledevicepropvariantcollectionvalue
|
||||
// HRESULT GetIPortableDevicePropVariantCollectionValue( [in] REFPROPERTYKEY key, [out] IPortableDevicePropVariantCollection
|
||||
// **ppValue );
|
||||
IPortableDevicePropVariantCollection GetIPortableDevicePropVariantCollectionValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>Adds a new <c>SetIPortableDeviceKeyCollectionValue</c> value (type VT_UNKNOWN) or overwrites an existing one.</summary>
|
||||
/// <param name="key">[in] A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="pValue">
|
||||
/// [in] Pointer to an <c>IPortableDeviceKeyCollection</c> interface that specifies the new value. The SDK copies a reference to
|
||||
/// the submitted interface and calls <c>AddRef</c> on it.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any
|
||||
/// warning. The existing key memory is released appropriately.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/portabledevicetypes/nf-portabledevicetypes-iportabledevicevalues-setiportabledevicekeycollectionvalue
|
||||
// HRESULT SetIPortableDeviceKeyCollectionValue( REFPROPERTYKEY key, IPortableDeviceKeyCollection *pValue );
|
||||
void SetIPortableDeviceKeyCollectionValue(in PROPERTYKEY key, IPortableDeviceKeyCollection pValue);
|
||||
|
||||
/// <summary>Retrieves an <c>IPortableDeviceKeyCollection</c> value (type VT_UNKNOWN) that is specified by a key.</summary>
|
||||
/// <param name="key">[in] A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>
|
||||
/// [out] Pointer to the retrieved IPortableDeviceKeyCollection interface pointer. The caller is responsible for calling
|
||||
/// <c>Release</c> on the retrieved interface.
|
||||
/// </returns>
|
||||
/// <remarks>None.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/portabledevicetypes/nf-portabledevicetypes-iportabledevicevalues-getiportabledevicekeycollectionvalue
|
||||
// HRESULT GetIPortableDeviceKeyCollectionValue( REFPROPERTYKEY key, IPortableDeviceKeyCollection **ppValue );
|
||||
IPortableDeviceKeyCollection GetIPortableDeviceKeyCollectionValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>Adds a new <c>IPortableDeviceValuesCollection</c> value (type VT_UNKNOWN) or overwrites an existing one.</summary>
|
||||
/// <param name="key">[in] A <c>REFPROPERTYKEY</c> that specifies the item to create or overwrite.</param>
|
||||
/// <param name="pValue">
|
||||
/// [in] Pointer to an <c>IPortableDeviceValuesCollection</c> interface that specifies the new value. The SDK copies a reference
|
||||
/// to the submitted interface and calls <c>AddRef</c> on it.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// If an existing value has the same key that is specified by the key parameter, it overwrites the existing value without any
|
||||
/// warning. The existing key memory is released appropriately.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/portabledevicetypes/nf-portabledevicetypes-iportabledevicevalues-setiportabledevicevaluescollectionvalue
|
||||
// HRESULT SetIPortableDeviceValuesCollectionValue( REFPROPERTYKEY key, IPortableDeviceValuesCollection *pValue );
|
||||
void SetIPortableDeviceValuesCollectionValue(in PROPERTYKEY key, IPortableDeviceValuesCollection pValue);
|
||||
|
||||
/// <summary>Retrieves an <c>IPortableDeviceValuesCollection</c> (type VT_UNKNOWN) value specified by a key.</summary>
|
||||
/// <param name="key">[in] A <c>REFPROPERTYKEY</c> key that specifies the item to retrieve.</param>
|
||||
/// <returns>
|
||||
/// [out] Address of a variable that receives a pointer to the retrieved IPortableDeviceValuesCollection interface. The caller
|
||||
/// is responsible for calling <c>Release</c> on the retrieved interface.
|
||||
/// </returns>
|
||||
/// <remarks>None.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/portabledevicetypes/nf-portabledevicetypes-iportabledevicevalues-getiportabledevicevaluescollectionvalue
|
||||
// HRESULT GetIPortableDeviceValuesCollectionValue( REFPROPERTYKEY key, IPortableDeviceValuesCollection **ppValue );
|
||||
IPortableDeviceValuesCollection GetIPortableDeviceValuesCollectionValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>The <c>RemoveValue</c> method removes an item from the collection.</summary>
|
||||
/// <param name="key">A <c>REFPROPERTYKEY</c> that specifies the item to remove.</param>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-removevalue HRESULT RemoveValue( [in]
|
||||
// REFPROPERTYKEY key );
|
||||
void RemoveValue(in PROPERTYKEY key);
|
||||
|
||||
/// <summary>The <c>CopyValuesFromPropertyStore</c> method copies the contents of an <c>IPropertyStore</c> into the collection.</summary>
|
||||
/// <param name="pStore">Pointer to an <c>IPropertyStore</c> to copy into the collection.</param>
|
||||
/// <remarks>
|
||||
/// <para>This method automatically converts all <c>VT_BSTR</c> values to <c>VT_LPWSTR</c> values.</para>
|
||||
/// <para>
|
||||
/// Many external applications or components that communicate with your application, such as some shell applications, use the
|
||||
/// <c>IPropertyStore</c> interface. This method provides a quick and easy way to exchange data with these programs.
|
||||
/// </para>
|
||||
/// <para>This method is supported in Windows Vista and later versions of Windows.</para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-copyvaluesfrompropertystore HRESULT
|
||||
// CopyValuesFromPropertyStore( [in] IPropertyStore *pStore );
|
||||
void CopyValuesFromPropertyStore(IPropertyStore pStore);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>CopyValuesToPropertyStore</c> method copies all the values from a collection into an <c>IPropertyStore</c> interface.
|
||||
/// </summary>
|
||||
/// <param name="pStore">Pointer to a store object.</param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method does not convert values of VT_LPWSTR into VT_BSTR. Many external applications or components that communicate
|
||||
/// with your application, such as some shell applications, use the <c>IPropertyStore</c> interface. This method provides a
|
||||
/// quick and easy way to exchange data with these programs.
|
||||
/// </para>
|
||||
/// <para>This method is supported in Windows Vista and later versions of Windows.</para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-copyvaluestopropertystore HRESULT
|
||||
// CopyValuesToPropertyStore( [in] IPropertyStore *pStore );
|
||||
void CopyValuesToPropertyStore(IPropertyStore pStore);
|
||||
|
||||
/// <summary>The <c>Clear</c> method deletes all items from the collection.</summary>
|
||||
/// <remarks>
|
||||
/// This method frees the memory for all dynamically allocated items in the collection. For interfaces, it calls <c>Release</c>.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevalues-clear HRESULT Clear();
|
||||
void Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <c>IPortableDeviceValuesCollection</c> interface holds a collection of zero-based indexed <c>IPortableDeviceValues</c>
|
||||
/// interfaces. This interface can be retrieved from a method, or if a new object is required, call <c>CoCreate</c> with <c>CLSID_PortableDeviceValuesCollection</c>.
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevaluescollection
|
||||
[PInvokeData("portabldevicetypes.h")]
|
||||
[ComImport, Guid("6E3F2D79-4E07-48C4-8208-D8C2E5AF4A99"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(PortableDeviceValuesCollection))]
|
||||
public interface IPortableDeviceValuesCollection
|
||||
{
|
||||
/// <summary>The <c>GetCount</c> method retrieves the number of items in the collection.</summary>
|
||||
/// <returns>The number of <c>IPortableDeviceValues</c> interfaces in the collection.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevaluescollection-getcount HRESULT GetCount( [in] DWORD
|
||||
// *pcElems );
|
||||
uint GetCount();
|
||||
|
||||
/// <summary>The <c>GetAt</c> method retrieves an item from the collection by a zero-based index.</summary>
|
||||
/// <param name="dwIndex"><c>DWORD</c> that specifies a zero-based index in the collection.</param>
|
||||
/// <returns>
|
||||
/// An <c>IPortableDeviceValues</c> interface from the collection. The caller is responsible for calling <c>Release</c> on this
|
||||
/// interface when done with it.
|
||||
/// </returns>
|
||||
/// <remarks>Any changes that are made to values in the retrieved interface will be made to the version stored in the collection.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevaluescollection-getat HRESULT GetAt( [in] const DWORD
|
||||
// dwIndex, [out] IPortableDeviceValues **ppValues );
|
||||
IPortableDeviceValues GetAt(uint dwIndex);
|
||||
|
||||
/// <summary>The <c>Add</c> method adds an item to the collection.</summary>
|
||||
/// <param name="pValues">
|
||||
/// Pointer to an <c>IPortableDeviceValues</c> interface to add to the collection. The interface is not actually copied, but
|
||||
/// <c>AddRef</c> is called on it.
|
||||
/// </param>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevaluescollection-add HRESULT Add( [in]
|
||||
// IPortableDeviceValues *pValues );
|
||||
void Add(IPortableDeviceValues pValues);
|
||||
|
||||
/// <summary>The <c>Clear</c> method releases all items from the collection.</summary>
|
||||
/// <remarks>The method releases all memory that is allocated for the items in the collection.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevaluescollection-clear HRESULT Clear();
|
||||
void Clear();
|
||||
|
||||
/// <summary>The <c>RemoveAt</c> method removes the element stored at the location specified by the given index.</summary>
|
||||
/// <param name="dwIndex">Specifies the index of the element to be removed.</param>
|
||||
/// <remarks>You must specify a zero-based index.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iportabledevicevaluescollection-removeat HRESULT RemoveAt( [in] const
|
||||
// DWORD dwIndex );
|
||||
void RemoveAt(uint dwIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// The <c>IWpdSerializer</c> interface is used by the device driver to serialize <c>IPortableDeviceValues</c> interfaces to and
|
||||
/// from the raw data buffers used to communicate with the application.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Applications do not need to use this interface, because the data is serialized and deserialized automatically when calling <c>IPortableDevice::SendCommand</c>.
|
||||
/// </para>
|
||||
/// <para>To get this interface, call <c>CoCreateInstance</c> and pass in <c>IID_IWpdSerializer</c>.</para>
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iwpdserializer
|
||||
[PInvokeData("portabldevicetypes.h")]
|
||||
[ComImport, Guid("b32f4002-bb27-45ff-af4f-06631c1e8dad"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(WpdSerializer))]
|
||||
public interface IWpdSerializer
|
||||
{
|
||||
/// <summary>
|
||||
/// The <c>GetIPortableDeviceValuesFromBuffer</c> method deserializes a byte array to an <c>IPortableDeviceValues</c> interface.
|
||||
/// </summary>
|
||||
/// <param name="pBuffer">Pointer to the buffer to deserialize.</param>
|
||||
/// <param name="dwInputBufferLength"><c>DWORD</c> that specifies the size of the buffer, in bytes.</param>
|
||||
/// <returns>
|
||||
/// An <c>IPortableDeviceValues</c> interface created from the buffer. The application is responsible for calling <c>Release</c>
|
||||
/// on the interface.
|
||||
/// </returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iwpdserializer-getiportabledevicevaluesfrombuffer HRESULT
|
||||
// GetIPortableDeviceValuesFromBuffer( [in] BYTE *pBuffer, [in] DWORD dwInputBufferLength, [out] IPortableDeviceValues
|
||||
// **ppParams );
|
||||
IPortableDeviceValues GetIPortableDeviceValuesFromBuffer(byte[] pBuffer, uint dwInputBufferLength);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>WriteIPortableDeviceValuesToBuffer</c> method serializes an <c>IPortableDeviceValues</c> interface to a
|
||||
/// caller-allocated byte array.
|
||||
/// </summary>
|
||||
/// <param name="dwOutputBufferLength"><c>DWORD</c> that specifies the size of pBuffer, in bytes.</param>
|
||||
/// <param name="pResults">Pointer to an <c>IPortableDeviceValues</c> interface to serialize.</param>
|
||||
/// <param name="pBuffer">Pointer to a caller-allocated buffer. To learn the size of the required buffer, call <c>GetSerializedSize</c>.</param>
|
||||
/// <param name="pdwBytesWritten">
|
||||
/// Pointer to a <c>DWORD</c> that indicates the number of bytes that was actually written to the caller-allocated buffer.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// This method copies an <c>IPortableDeviceValues</c> interface into an existing buffer. If you want to allocate a new buffer,
|
||||
/// use <c>GetBufferFromIPortableDeviceValues</c>.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iwpdserializer-writeiportabledevicevaluestobuffer HRESULT
|
||||
// WriteIPortableDeviceValuesToBuffer( [in] DWORD dwOutputBufferLength, [in] IPortableDeviceValues *pResults, [out] BYTE
|
||||
// *pBuffer, [out] DWORD *pdwBytesWritten );
|
||||
void WriteIPortableDeviceValuesToBuffer(uint dwOutputBufferLength, IPortableDeviceValues pResults, byte[] pBuffer, out uint pdwBytesWritten);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>GetBufferFromIPortableDeviceValues</c> method serializes a submitted <c>IPortableDeviceValues</c> interface to an
|
||||
/// allocated byte array. The byte array returned is allocated for the caller and should be freed by the caller using <c>CoTaskMemFree</c>.
|
||||
/// </summary>
|
||||
/// <param name="pSource">Pointer to an <c>IPortableDeviceValues</c> interface to serialize.</param>
|
||||
/// <param name="ppBuffer">
|
||||
/// Pointer to a <c>BYTE*</c> that contains the serialized data. Windows Portable Devices allocates this memory; the caller must
|
||||
/// free it by calling <c>CoTaskMemFree</c>.
|
||||
/// </param>
|
||||
/// <param name="pdwBufferSize">Pointer to a <c>DWORD</c> that specifies the size of allocated buffer, in bytes.</param>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iwpdserializer-getbufferfromiportabledevicevalues HRESULT
|
||||
// GetBufferFromIPortableDeviceValues( [in] IPortableDeviceValues *pSource, [out] BYTE **ppBuffer, [out] DWORD *pdwBufferSize );
|
||||
void GetBufferFromIPortableDeviceValues(IPortableDeviceValues pSource, out SafeCoTaskMemHandle ppBuffer, out uint pdwBufferSize);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>GetSerializedSize</c> method calculates the buffer size that is required to hold a serialized
|
||||
/// <c>IPortableDeviceValues</c> interface.
|
||||
/// </summary>
|
||||
/// <param name="pSource">Pointer to an <c>IPortableDeviceValues</c> interface whose size you want to request.</param>
|
||||
/// <returns>Pointer to a <c>DWORD</c> that indicates the buffer size that is required to serialize pSource, in bytes.</returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/iwpdserializer-getserializedsize HRESULT GetSerializedSize( [in]
|
||||
// IPortableDeviceValues *pSource, [out] DWORD *pdwSize );
|
||||
uint GetSerializedSize(IPortableDeviceValues pSource);
|
||||
}
|
||||
|
||||
/// <summary>Enumerates the items in the collection.</summary>
|
||||
/// <param name="intf">The <see cref="IPortableDeviceKeyCollection"/> instance.</param>
|
||||
/// <returns>A sequence of <see cref="PROPERTYKEY"/> values from the collection.</returns>
|
||||
public static IEnumerable<PROPERTYKEY> Enumerate(this IPortableDeviceKeyCollection intf) =>
|
||||
new Vanara.Collections.IEnumFromIndexer<PROPERTYKEY>(intf.GetCount, intf.GetAt);
|
||||
|
||||
/// <summary>Enumerates the items in the collection.</summary>
|
||||
/// <param name="intf">The <see cref="IPortableDevicePropVariantCollection"/> instance.</param>
|
||||
/// <returns>A sequence of <see cref="PROPVARIANT"/> values from the collection.</returns>
|
||||
public static IEnumerable<PROPVARIANT> Enumerate(this IPortableDevicePropVariantCollection intf) =>
|
||||
new Vanara.Collections.IEnumFromIndexer<PROPVARIANT>(intf.GetCount, i => { PROPVARIANT pv = new(); intf.GetAt(i, pv); return pv; });
|
||||
|
||||
/// <summary>Enumerates the items in the collection.</summary>
|
||||
/// <param name="intf">The <see cref="IPortableDeviceValues"/> instance.</param>
|
||||
/// <returns>A sequence of <see cref="Tuple{PROPERTYKEY, PROPVARIANT}"/> values from the collection.</returns>
|
||||
public static IEnumerable<(PROPERTYKEY, PROPVARIANT)> Enumerate(this IPortableDeviceValues intf) =>
|
||||
new Vanara.Collections.IEnumFromIndexer<(PROPERTYKEY, PROPVARIANT)>(intf.GetCount, i => { PROPVARIANT pv = new(); intf.GetAt(i, out PROPERTYKEY pk, pv); return (pk, pv); });
|
||||
|
||||
/// <summary>Enumerates the items in the collection.</summary>
|
||||
/// <param name="intf">The <see cref="IPortableDeviceValuesCollection"/> instance.</param>
|
||||
/// <returns>A sequence of <see cref="IPortableDeviceValues"/> values from the collection.</returns>
|
||||
public static IEnumerable<IPortableDeviceValues> Enumerate(this IPortableDeviceValuesCollection intf) =>
|
||||
new Vanara.Collections.IEnumFromIndexer<IPortableDeviceValues>(intf.GetCount, intf.GetAt);
|
||||
|
||||
/// <summary>Gets the property key value from WPD_PROPERTY_COMMON_COMMAND_CATEGORY and WPD_PROPERTY_COMMON_COMMAND_ID.</summary>
|
||||
/// <param name="iValues">The IPortableDeviceValues instance.</param>
|
||||
/// <returns>The PROPERTYKEY.</returns>
|
||||
public static PROPERTYKEY GetCommandPKey(this IPortableDeviceValues iValues) =>
|
||||
new PROPERTYKEY(iValues.GetGuidValue(WPD_PROPERTY_COMMON_COMMAND_CATEGORY), iValues.GetUnsignedIntegerValue(WPD_PROPERTY_COMMON_COMMAND_ID));
|
||||
|
||||
/// <summary>
|
||||
/// The <c>WPD_STREAM_UNITS</c> enumeration specifies the unit types to be used for <c>IPortableDeviceUnitsStream</c> operations.
|
||||
/// </summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wpd_sdk/wpd-stream-units typedef enum _WPD_STREAM_UNITS { WPD_STREAM_UNITS_BYTES =
|
||||
// 0, WPD_STREAM_UNITS_FRAMES = 1, WPD_STREAM_UNITS_ROWS = 2, WPD_STREAM_UNITS_MILLISECONDS = 3, WPD_STREAM_UNITS_MICROSECONDS = 4 } WPD_STREAM_UNITS;
|
||||
[PInvokeData("portabldevicetypes.h")]
|
||||
public enum WPD_STREAM_UNITS
|
||||
{
|
||||
/// <summary>The stream units are specified in bytes.</summary>
|
||||
WPD_STREAM_UNITS_BYTES = 0,
|
||||
|
||||
/// <summary>The stream units are specified in frames.</summary>
|
||||
WPD_STREAM_UNITS_FRAMES = 1,
|
||||
|
||||
/// <summary>The stream units are specified in rows.</summary>
|
||||
WPD_STREAM_UNITS_ROWS = 2,
|
||||
|
||||
/// <summary>The stream units are specified in milliseconds.</summary>
|
||||
WPD_STREAM_UNITS_MILLISECONDS = 4,
|
||||
|
||||
/// <summary>The stream units are specified in microseconds.</summary>
|
||||
WPD_STREAM_UNITS_MICROSECONDS = 8,
|
||||
}
|
||||
|
||||
/// <summary>PortableDeviceKeyCollection Class</summary>
|
||||
[PInvokeData("portabldevicetypes.h")]
|
||||
[ComImport, Guid("de2d022d-2480-43be-97f0-d1fa2cf98f4f"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class PortableDeviceKeyCollection
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>PortableDevicePropVariantCollection Class</summary>
|
||||
[PInvokeData("portabldevicetypes.h")]
|
||||
[ComImport, Guid("08a99e2f-6d6d-4b80-af5a-baf2bcbe4cb9"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class PortableDevicePropVariantCollection
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>PortableDeviceValues Class</summary>
|
||||
[PInvokeData("portabldevicetypes.h")]
|
||||
[ComImport, Guid("0c15d503-d017-47ce-9016-7b3f978721cc"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class PortableDeviceValues
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>PortableDeviceValuesCollection Class</summary>
|
||||
[PInvokeData("portabldevicetypes.h")]
|
||||
[ComImport, Guid("3882134d-14cf-4220-9cb4-435f86d83f60"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class PortableDeviceValuesCollection
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>WpdSerializer Class</summary>
|
||||
[PInvokeData("portabldevicetypes.h")]
|
||||
[ComImport, Guid("0b91a74b-ad7c-4a9d-b563-29eef9167172"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class WpdSerializer
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<ProjectExtensions>
|
||||
<SupportedDlls>portabledeviceapi.dll;portabledeviceconnectapi.dll;portabledevicetypes.dll</SupportedDlls>
|
||||
</ProjectExtensions>
|
||||
<PropertyGroup>
|
||||
<Description>PInvoke API (methods, structures and constants) imported from Windows Portable Device (WPD) Api.</Description>
|
||||
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
|
||||
<TargetFrameworks>net20;net35;net40;net45;net5.0-windows;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
|
||||
<AssemblyName>Vanara.PInvoke.PortableDeviceApi</AssemblyName>
|
||||
<PackageId>$(AssemblyName)</PackageId>
|
||||
<PackageTags>pinvoke;vanara;net-extensions;interop;WPD;PortableDeviceApi</PackageTags>
|
||||
<PackageReleaseNotes />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Core\Vanara.Core.csproj" />
|
||||
<ProjectReference Include="..\SetupAPI\Vanara.PInvoke.SetupAPI.csproj" />
|
||||
<ProjectReference Include="..\Shared\Vanara.PInvoke.Shared.csproj" />
|
||||
<ProjectReference Include="..\Ole\Vanara.PInvoke.Ole.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
18
Vanara.sln
18
Vanara.sln
|
@ -327,6 +327,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vanara.PInvoke.FhSvcCtl", "
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FhSvcCtl", "UnitTests\PInvoke\FhSvcCtl\FhSvcCtl.csproj", "{089EA815-567E-4430-BEB4-4E18FD0B1473}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vanara.PInvoke.EnhancedStorage", "PInvoke\EnhancedStorage\Vanara.PInvoke.EnhancedStorage.csproj", "{1D842CC7-BECA-4011-A7FB-98773CFF8CD0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vanara.PInvoke.PortableDeviceApi", "PInvoke\PortableDeviceApi\Vanara.PInvoke.PortableDeviceApi.csproj", "{7DA64CE7-F149-46CD-AC2A-AA8DBA1CDB39}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -1072,6 +1076,18 @@ Global
|
|||
{089EA815-567E-4430-BEB4-4E18FD0B1473}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{089EA815-567E-4430-BEB4-4E18FD0B1473}.DebugNoTests|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{089EA815-567E-4430-BEB4-4E18FD0B1473}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1D842CC7-BECA-4011-A7FB-98773CFF8CD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D842CC7-BECA-4011-A7FB-98773CFF8CD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D842CC7-BECA-4011-A7FB-98773CFF8CD0}.DebugNoTests|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D842CC7-BECA-4011-A7FB-98773CFF8CD0}.DebugNoTests|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D842CC7-BECA-4011-A7FB-98773CFF8CD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1D842CC7-BECA-4011-A7FB-98773CFF8CD0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7DA64CE7-F149-46CD-AC2A-AA8DBA1CDB39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7DA64CE7-F149-46CD-AC2A-AA8DBA1CDB39}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7DA64CE7-F149-46CD-AC2A-AA8DBA1CDB39}.DebugNoTests|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7DA64CE7-F149-46CD-AC2A-AA8DBA1CDB39}.DebugNoTests|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7DA64CE7-F149-46CD-AC2A-AA8DBA1CDB39}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7DA64CE7-F149-46CD-AC2A-AA8DBA1CDB39}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1217,6 +1233,8 @@ Global
|
|||
{5DBC32A2-1FF0-41F6-9D6B-CE701F599BE0} = {385CAD2D-0A5E-4F80-927B-D5499D126B90}
|
||||
{B419C1F3-AB66-40B9-9693-817CD061F7EF} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90}
|
||||
{089EA815-567E-4430-BEB4-4E18FD0B1473} = {385CAD2D-0A5E-4F80-927B-D5499D126B90}
|
||||
{1D842CC7-BECA-4011-A7FB-98773CFF8CD0} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90}
|
||||
{7DA64CE7-F149-46CD-AC2A-AA8DBA1CDB39} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {543FAC75-2AF1-4EF1-9609-B242B63FEED4}
|
||||
|
|
Loading…
Reference in New Issue