From f3fdc9880a22894604c5d8c614f9960d52fd3350 Mon Sep 17 00:00:00 2001 From: dahall Date: Thu, 18 Mar 2021 17:33:06 -0600 Subject: [PATCH] Added Windows Connect Now (wcnapi) assembly --- PInvoke/WcnApi/Vanara.PInvoke.WcnApi.csproj | 22 + PInvoke/WcnApi/WcnDevice.cs | 562 ++++++++ PInvoke/WcnApi/WcnFunctionDiscoveryKeys.cs | 25 + PInvoke/WcnApi/WcnTypes.cs | 1851 +++++++++++++++++++++++++++ Vanara.sln | 18 + 5 files changed, 2478 insertions(+) create mode 100644 PInvoke/WcnApi/Vanara.PInvoke.WcnApi.csproj create mode 100644 PInvoke/WcnApi/WcnDevice.cs create mode 100644 PInvoke/WcnApi/WcnFunctionDiscoveryKeys.cs create mode 100644 PInvoke/WcnApi/WcnTypes.cs diff --git a/PInvoke/WcnApi/Vanara.PInvoke.WcnApi.csproj b/PInvoke/WcnApi/Vanara.PInvoke.WcnApi.csproj new file mode 100644 index 00000000..bed19754 --- /dev/null +++ b/PInvoke/WcnApi/Vanara.PInvoke.WcnApi.csproj @@ -0,0 +1,22 @@ + + + + WcnApi.dll + + + PInvoke API (methods, structures and constants) imported from Windows Connect Now (WcnApi.dll). + $(AssemblyName) + net20;net35;net40;net45;net5.0-windows;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1 + Vanara.PInvoke.WcnApi + $(AssemblyName) + pinvoke;vanara;net-extensions;interop;WcnApi;Windows Connect Now + + + + + + + + + + \ No newline at end of file diff --git a/PInvoke/WcnApi/WcnDevice.cs b/PInvoke/WcnApi/WcnDevice.cs new file mode 100644 index 00000000..3f3d4778 --- /dev/null +++ b/PInvoke/WcnApi/WcnDevice.cs @@ -0,0 +1,562 @@ +using System; +using System.Runtime.InteropServices; +using System.Text; +using static Vanara.PInvoke.Ole32; + +namespace Vanara.PInvoke +{ + /// Interfaces and constants for Windows Connect Now. + public static partial class WcnApi + { + /// Flags for WCN_VENDOR_EXTENSION_SPEC + [Flags] + public enum WCN_FLAG : uint + { + /// The vendor extension was not available before the session started. The vendor extension is not secure. + WCN_FLAG_DISCOVERY_VE = 0x0001, + + /// + /// The vendor extension is authentic. Only devices that pass authentication can read or write authenticated vendor extensions. + /// + WCN_FLAG_AUTHENTICATED_VE = 0x0002, + + /// + /// The vendor extension is authentic and encrypted. In addition to the guarantee of authenticated vendor extensions, vendor + /// extensions are encrypted before transmission. + /// + WCN_FLAG_ENCRYPTED_VE = 0x0004, + } + + /// The WCN_PASSWORD_TYPE enumeration defines the authentication that will be used in a WPS session. + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/ne-wcndevice-wcn_password_type typedef enum tagWCN_PASSWORD_TYPE { + // WCN_PASSWORD_TYPE_PUSH_BUTTON, WCN_PASSWORD_TYPE_PIN, WCN_PASSWORD_TYPE_PIN_REGISTRAR_SPECIFIED, WCN_PASSWORD_TYPE_OOB_SPECIFIED, + // WCN_PASSWORD_TYPE_WFDS } WCN_PASSWORD_TYPE; + [PInvokeData("wcndevice.h", MSDNShortId = "NE:wcndevice.tagWCN_PASSWORD_TYPE")] + public enum WCN_PASSWORD_TYPE + { + /// + /// Indicates the device uses a WPS button interface to put the device into wireless provisioning mode. If this value is + /// specified when calling IWCNDevice::SetPassword, set dwPasswordLength to zero and pbPassword to NULL. + /// + WCN_PASSWORD_TYPE_PUSH_BUTTON = 0, + + /// + /// Indicates that authentication is secured via a PIN. The user must provide the PIN of the device. Usually, the PIN is a 4 or + /// 8-digit number printed on a label attached to the device, or displayed on the screen. If this value is specified when + /// calling IWCNDevice::SetPassword, set dwPasswordLength to the number of digits in the password, and pbPassword to point to a + /// buffer containing the ASCII representation of the pin. + /// + WCN_PASSWORD_TYPE_PIN, + + /// Indicates that authentication is secured via a PIN, as above, but that the PIN is specified by the registrar. + WCN_PASSWORD_TYPE_PIN_REGISTRAR_SPECIFIED, + + /// + WCN_PASSWORD_TYPE_OOB_SPECIFIED, + + /// + WCN_PASSWORD_TYPE_WFDS, + } + + /// The WCN_SESSION_STATUS enumeration defines the outcome status of a WPS session. + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/ne-wcndevice-wcn_session_status typedef enum tagWCN_SESSION_STATUS { + // WCN_SESSION_STATUS_SUCCESS, WCN_SESSION_STATUS_FAILURE_GENERIC, WCN_SESSION_STATUS_FAILURE_TIMEOUT } WCN_SESSION_STATUS; + [PInvokeData("wcndevice.h", MSDNShortId = "NE:wcndevice.tagWCN_SESSION_STATUS")] + public enum WCN_SESSION_STATUS + { + /// Indicates that the session is successful. + WCN_SESSION_STATUS_SUCCESS = 0, + + /// + WCN_SESSION_STATUS_FAILURE_GENERIC, + + /// + WCN_SESSION_STATUS_FAILURE_TIMEOUT, + } + + /// Use this interface to receive a success or failure notification when a Windows Connect Now connect session completes. + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nn-wcndevice-iwcnconnectnotify + [PInvokeData("wcndevice.h", MSDNShortId = "NN:wcndevice.IWCNConnectNotify")] + [ComImport, Guid("C100BE9F-D33A-4a4b-BF23-BBEF4663D017"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IWCNConnectNotify + { + /// + /// The IWCNConnectNotify::ConnectSucceeded callback method that indicates a successful IWCNDevice::Connect operation. + /// + /// ... + /// + /// + /// Notification of success does not implicitly indicate that the device is ready, as some devices reboot in order to apply + /// settings provided during the IWCNDevice::Connect operation. + /// + /// + /// If the IWCNDevice interface was used to obtain network settings from a device, then the network profile is immediately ready + /// for use. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcnconnectnotify-connectsucceeded HRESULT ConnectSucceeded(); + [PreserveSig] + HRESULT ConnectSucceeded(); + + /// The IWCNConnectNotify::ConnectFailed callback method indicates a IWCNDevice::Connect failure. + /// An HRESULT that specifies the reason for the connection failure. + /// This method does not return a value. + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcnconnectnotify-connectfailed HRESULT + // ConnectFailed( HRESULT hrFailure ); + [PreserveSig] + HRESULT ConnectFailed(HRESULT hrFailure); + } + + /// Use this interface to configure the device and initiate the session. + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nn-wcndevice-iwcndevice + [PInvokeData("wcndevice.h", MSDNShortId = "NN:wcndevice.IWCNDevice")] + [ComImport, Guid("C100BE9C-D33A-4a4b-BF23-BBEF4663D017"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(WCNDeviceObject))] + public interface IWCNDevice + { + /// + /// The IWCNDevice::SetPassword method configures the authentication method value, and if required, a password used for + /// the pending session. This method may only be called prior to IWCNDevice::Connect. + /// + /// + /// A WCN_PASSWORD_TYPE value that specifies the authentication method used for the session. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_PASSWORD_TYPE_PUSH_BUTTON + /// Use PushButton authentication. The value of dwPasswordLength must be NULL. + /// + /// + /// WCN_PASSWORD_TYPE_PIN + /// Use PIN-based authentication. + /// + /// + /// + /// Number of bytes in the buffer pbPassword. + /// A byte array of the password, encoded in ASCII. + /// + /// This method can return one of these values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The password will be used for the pending session. + /// + /// + /// E_INVALIDARG + /// + /// The password type is WCN_PASSWORD_TYPE_PUSH_BUTTON and the password length is not zero. The password type is not + /// WCN_PASSWORD_TYPE_PUSH_BUTTON or WCN_PASSWORD_TYPE_PIN. + /// + /// + /// + /// + /// + /// The byte array is not NULL-terminated. For example, if the password is a 4-digit PIN, you should pass + /// dwPasswordLength as 4 and pbPassword should point to a 4-byte array containing the PIN in ASCII. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcndevice-setpassword HRESULT SetPassword( + // WCN_PASSWORD_TYPE Type, DWORD dwPasswordLength, const BYTE [] pbPassword ); + [PreserveSig] + HRESULT SetPassword(WCN_PASSWORD_TYPE Type, uint dwPasswordLength, [MarshalAs(UnmanagedType.LPStr)] string pbPassword); + + /// The IWCNDevice::Connect method initiates the session. + /// + /// A pointer to the implemented IWCNConnectNotify callback interface which specifies if a connection has been successfully established. + /// + /// + /// This method can return one of these values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The operation has succeeded. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) + /// The device does not support the connection options queued via IWCNDevice::Set. + /// + /// + /// WCN_E_PEER_NOT_FOUND + /// The device could not be located on the network. + /// + /// + /// + /// + /// + /// After calling this method you may not call any other IWCNDevice 'Set' methods. There is no way to cancel or roll back device + /// settings once a connection has been established. + /// + /// + /// NULL can be passed via pNotify, in place of the IWCNConnectNotify callback interface to prevent notification from + /// being sent when the connect operation is complete. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcndevice-connect HRESULT Connect( + // IWCNConnectNotify *pNotify ); + [PreserveSig] + HRESULT Connect([In, Optional] IWCNConnectNotify pNotify); + + /// The IWCNDevice::GetAttribute method gets a cached attribute from the device. + /// + /// A WCN_ATTRIBUTE_TYPE value that represents a specific attribute value (for example, WCN_PASSWORD_TYPE). + /// + /// The allocated size, in bytes, of pbBuffer. + /// A user-allocated buffer that, on successful return, contains the contents of the attribute. + /// On return, contains the size of the attribute in bytes. + /// + /// This method can return one of these values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The attribute was retrieved successfully. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_NOT_FOUND) + /// The attribute specified is not available. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) + /// The buffer specified by pbBuffer is not large enough to contain the returned attribute value. + /// + /// + /// + /// + /// To only query the size of an attribute, a value of 0 (zero) can be passed via dwMaxBufferSize and pdwBufferUsed will be + /// filled appropriately. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcndevice-getattribute HRESULT GetAttribute( + // WCN_ATTRIBUTE_TYPE AttributeType, DWORD dwMaxBufferSize, BYTE [] pbBuffer, DWORD *pdwBufferUsed ); + [PreserveSig] + HRESULT GetAttribute(WCN_ATTRIBUTE_TYPE AttributeType, uint dwMaxBufferSize, [Out] IntPtr pbBuffer, out uint pdwBufferUsed); + + /// The GetIntegerAttribute method gets a cached attribute from the device as an integer. + /// + /// A WCN_ATTRIBUTE_TYPE value that represents a specific attribute value (for example, WCN_PASSWORD_TYPE). + /// + /// Pointer to an unsigned-integer that represents the retrieved attribute value. + /// + /// This method can return one of these values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The attribute was retrieved successfully. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_NOT_FOUND) + /// The attribute specified is not available. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) + /// The buffer specified by pbBuffer is not large enough to contain the returned attribute value. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_INVALID_DATATYPE) + /// This attribute cannot be expressed as an integer. For example, if it is a string. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcndevice-getintegerattribute HRESULT + // GetIntegerAttribute( WCN_ATTRIBUTE_TYPE AttributeType, UINT *puInteger ); + [PreserveSig] + HRESULT GetIntegerAttribute(WCN_ATTRIBUTE_TYPE AttributeType, out uint puInteger); + + /// The IWCNDevice::GetStringAttribute method gets a cached attribute from the device as a string. + /// + /// A WCN_ATTRIBUTE_TYPE value that represents a specific attribute value (for example, WCN_PASSWORD_TYPE). If the + /// attribute is not natively a string data type (for example, WCN_TYPE_VERSION is natively an integer, and + /// WNC_TYPE_SSID is natively a blob), this function will fail with HRESULT_FROM_WIN32(ERROR_INVALID_DATATYPE). + /// + /// The size of the buffer wszString, in characters. + /// + /// A user-allocated buffer that, on successful return, contains a NULL-terminated string value of the vendor extension. + /// + /// + /// ... + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The attribute was retrieved successfully. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_NOT_FOUND) + /// The attribute specified is not available. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) + /// The buffer specified by wszString is not large enough to contain the returned attribute value. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_INVALID_DATATYPE) + /// This attribute cannot be expressed as a string. For example, if it is an integer. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcndevice-getstringattribute HRESULT + // GetStringAttribute( WCN_ATTRIBUTE_TYPE AttributeType, DWORD cchMaxString, WCHAR [] wszString ); + [PreserveSig] + HRESULT GetStringAttribute(WCN_ATTRIBUTE_TYPE AttributeType, uint cchMaxString, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wszString); + + /// The IWCNDevice::GetNetworkProfile method gets a network profile from the device. + /// The allocated size, in characters, of wszProfile. + /// A string that specifies the XML WLAN network profile type. + /// + /// This method can return one of these values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The network profile was successfully retrieved. + /// + /// + /// + /// This function can only be called after IWCNDevice::Connect has been called, and the session has completed successfully. + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcndevice-getnetworkprofile HRESULT + // GetNetworkProfile( DWORD cchMaxStringLength, LPWSTR wszProfile ); + [PreserveSig] + HRESULT GetNetworkProfile(uint cchMaxStringLength, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder wszProfile); + + /// + /// The IWCNDevice::SetNetworkProfile method queues an XML WLAN profile to be provisioned to the device. This method may + /// only be called prior to IWCNDevice::Connect. + /// + /// The XML WLAN profile XML string. + /// + /// This method can return one of these values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The attribute was retrieved successfully. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) + /// The WLAN profile is not supported for WCN connections. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_BAD_PROFILE) + /// The provided XML profile cannot be read. + /// + /// + /// + /// + /// Currently, the Windows Connect Now API (WCNAPI) supports the following profile types: + /// + /// + /// None (Open or Shared) + /// + /// + /// WEP (Open or Shared) + /// + /// + /// WPA-PSK (TKIP or AES) + /// + /// + /// WPA2-PSK (TKIP or AES) + /// + /// + /// + /// If the specified WLAN profile has extraneous settings (like IHV settings), these settings will be ignored. In the event a + /// WLAN profile is not compatible with the WCNAPI, an HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) value is returned. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcndevice-setnetworkprofile HRESULT + // SetNetworkProfile( LPCWSTR pszProfileXml ); + [PreserveSig] + HRESULT SetNetworkProfile([MarshalAs(UnmanagedType.LPWStr)] string pszProfileXml); + + /// The GetVendorExtension method gets a cached vendor extension from the device. + /// + /// A pointer to a user-defined WCN_VENDOR_EXTENSION_SPEC structure that describes the vendor extension to query for. + /// + /// The size, in bytes, of pbBuffer. + /// An allocated buffer that, on return, contains the contents of the vendor extension. + /// On return, contains the size of the vendor extension in bytes. + /// + /// This method can return one of these values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The vendor extension was retrieved successfully. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_NOT_FOUND) + /// The vendor extension specified is not available. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) + /// The buffer specified by pbBuffer is not large enough to contain the returned vendor extension. + /// + /// + /// + /// + /// To query the size of a vendor extension, you can pass a value of 0 with the dwMaxBufferSize parameter, and pdwBufferUsed + /// will receive the size. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcndevice-getvendorextension HRESULT + // GetVendorExtension( const WCN_VENDOR_EXTENSION_SPEC *pVendorExtSpec, DWORD dwMaxBufferSize, BYTE [] pbBuffer, DWORD + // *pdwBufferUsed ); + [PreserveSig] + HRESULT GetVendorExtension(in WCN_VENDOR_EXTENSION_SPEC pVendorExtSpec, uint dwMaxBufferSize, [Out] IntPtr pbBuffer, out uint pdwBufferUsed); + + /// + /// The IWCNDevice::SetVendorExtension method queues a vendor extension for use in the pending session. This function may + /// only be called prior to IWCNDevice::Connect. + /// + /// + /// A pointer to a WCN_VENDOR_EXTENSION_SPEC structure that contains the vendor extension specification. + /// + /// The number of bytes contained in pbBuffer. + /// Pointer to a buffer that contains the data to set in the vendor extension. + /// + /// This method can return one of these values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The vendor extension will be sent in the pending session. + /// + /// + /// E_INVALIDARG + /// The specified WCN_VENDOR_EXTENSION_SPEC contains an illegal VendorID, sub-type, or flag. + /// + /// + /// HRESULT_FROM_WIN32(ERROR_IMPLEMENTATION_LIMIT) + /// + /// The number of vendor extensions has exceeded the current implementation limit, which is currently equal to 25 vendor + /// extensions per session. + /// + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcndevice-setvendorextension HRESULT + // SetVendorExtension( const WCN_VENDOR_EXTENSION_SPEC *pVendorExtSpec, DWORD cbBuffer, const BYTE [] pbBuffer ); + [PreserveSig] + HRESULT SetVendorExtension(in WCN_VENDOR_EXTENSION_SPEC pVendorExtSpec, uint cbBuffer, [In] IntPtr pbBuffer); + + /// The IWCNDevice::Unadvise method removes any callback previously set via IWCNDevice::Connect. + /// This method does not return a value. + /// + /// It is not necessary to call IWCNDevice::Unadvise unless the application is shutting down and must ensure that no more + /// callbacks are received on its IWCNConnectNotify callback. Do not call IWCNDevice::Unadvise from within an + /// IWCNConnectNotify callback, since that will cause a deadlock. Note that IWCNDevice::Unadvise does not cancel + /// the connect operation on the wire. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/nf-wcndevice-iwcndevice-unadvise HRESULT Unadvise(); + [PreserveSig] + HRESULT Unadvise(); + + /// Sets the NFC password parameters. + /// The password type. + /// The password identifier. + /// Length of the password. + /// The password. + /// Length of the remote public key hash. + /// The remote public key hash. + /// Length of the key BLOB. + /// The key BLOB. + /// + [PreserveSig] + HRESULT SetNFCPasswordParams(WCN_PASSWORD_TYPE Type, uint dwOOBPasswordID, uint dwPasswordLength, + [In] IntPtr pbPassword, uint dwRemotePublicKeyHashLength, [In] IntPtr pbRemotePublicKeyHash, + uint dwDHKeyBlobLength, [In] IntPtr pbDHKeyBlob); + } + + /// The GetIntegerAttribute method gets a cached attribute from the device as an integer. + /// The type to which the retrieved integer is converted. + /// The instance. + /// A WCN_ATTRIBUTE_TYPE value that represents a specific attribute value (for example, WCN_PASSWORD_TYPE). + /// The retrieved attribute value. + public static T GetIntegerAttribute(this IWCNDevice iDev, WCN_ATTRIBUTE_TYPE AttributeType) where T : struct, IConvertible + { + var hr = iDev.GetIntegerAttribute(AttributeType, out var u); + return hr.Succeeded ? (T)Convert.ChangeType(u, typeof(T)) : throw hr.GetException(); + } + + /// The WCN_VENDOR_EXTENSION_SPEC structure contains data that defines a vendor extension. + // https://docs.microsoft.com/en-us/windows/win32/api/wcndevice/ns-wcndevice-wcn_vendor_extension_spec typedef struct + // tagWCN_VENDOR_EXTENSION_SPEC { DWORD VendorId; DWORD SubType; DWORD Index; DWORD Flags; } WCN_VENDOR_EXTENSION_SPEC; + [PInvokeData("wcndevice.h", MSDNShortId = "NS:wcndevice.tagWCN_VENDOR_EXTENSION_SPEC")] + [StructLayout(LayoutKind.Sequential)] + public struct WCN_VENDOR_EXTENSION_SPEC + { + /// + /// Set this value to the SMI Enterprise ID Number of the vendor that defines the vendor extension. For example, the Microsoft + /// ID is '311' (WCN_MICROSOFT_VENDOR_ID). + /// + public uint VendorId; + + /// + /// The subtype, as defined by the first two bytes of the vendor extension. If the vendor has not provided the two-byte subtype + /// prefix, use WCN_NO_SUBTYPE. + /// + public uint SubType; + + /// Distinguishes between multiple vendor extensions with the same VendorID and SubType. The index begins at zero. + public uint Index; + + /// + /// Applications must specify one of the following flag values: + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_FLAG_DISCOVERY_VE 0x0001 + /// The vendor extension was not available before the session started. The vendor extension is not secure. + /// + /// + /// WCN_FLAG_AUTHENTICATED_VE 0x0002 + /// The vendor extension is authentic. Only devices that pass authentication can read or write authenticated vendor extensions. + /// + /// + /// WCN_FLAG_ENCRYPTED_VE 0x0004 + /// + /// The vendor extension is authentic and encrypted. In addition to the guarantee of authenticated vendor extensions, vendor + /// extensions are encrypted before transmission. + /// + /// + /// + /// + public WCN_FLAG Flags; + } + + /// Class object for . + [ComImport, Guid("C100BEA7-D33A-4a4b-BF23-BBEF4663D017"), ClassInterface(ClassInterfaceType.None)] + public class WCNDeviceObject { } + } +} \ No newline at end of file diff --git a/PInvoke/WcnApi/WcnFunctionDiscoveryKeys.cs b/PInvoke/WcnApi/WcnFunctionDiscoveryKeys.cs new file mode 100644 index 00000000..3e861c23 --- /dev/null +++ b/PInvoke/WcnApi/WcnFunctionDiscoveryKeys.cs @@ -0,0 +1,25 @@ +using System; +using System.Runtime.InteropServices; +using System.Text; +using static Vanara.PInvoke.Ole32; + +namespace Vanara.PInvoke +{ + public static partial class WcnApi + { + /// + public static readonly Guid SID_WcnProvider = new Guid(0xC100BECA, 0xD33A, 0x4A4B, 0xBF, 0x23, 0xBB, 0xEF, 0x46, 0x63, 0xD0, 0x17); + + /// The major device category of a WCN device. + public static readonly PROPERTYKEY PKEY_WCN_DeviceType_Category = new PROPERTYKEY(new Guid(0x88190b8b, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81), 0x00000010); + + /// The unique manufacturer OUI associated with the device. + public static readonly PROPERTYKEY PKEY_WCN_DeviceType_SubCategoryOUI = new PROPERTYKEY(new Guid(0x88190b8b, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81), 0x00000011); + + /// The device subcategory of a WCN device. The subcategory must be interpreted along with the OUI from PKEY_WCN_DeviceType_SubCategoryOUI. + public static readonly PROPERTYKEY PKEY_WCN_DeviceType_SubCategory = new PROPERTYKEY(new Guid(0x88190b8b, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81), 0x00000012); + + /// + public static readonly PROPERTYKEY PKEY_WCN_SSID = new PROPERTYKEY(new Guid(0x88190b8b, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81), 0x00000020); + } +} \ No newline at end of file diff --git a/PInvoke/WcnApi/WcnTypes.cs b/PInvoke/WcnApi/WcnTypes.cs new file mode 100644 index 00000000..b7c28729 --- /dev/null +++ b/PInvoke/WcnApi/WcnTypes.cs @@ -0,0 +1,1851 @@ +using System; +using System.Runtime.InteropServices; +using System.Text; +using static Vanara.PInvoke.Ole32; + +namespace Vanara.PInvoke +{ + public static partial class WcnApi + { + /// + public const string WCN_QUERY_CONSTRAINT_USE_SOFTAP = "WCN.Discovery.SoftAP"; + + /// + public const uint WCN_MICROSOFT_VENDOR_ID = 311; + + /// + public const int WCN_API_MAX_BUFFER_SIZE = 2096; + + /// + public const uint WCN_NO_SUBTYPE = 0xfffffffe; + + /// + /// The WCN_ATTRIBUTE_TYPE enumeration defines the attribute buffer types defined for Wi-Fi Protected Setup. The overall size + /// occupied by each attribute buffer includes an additional 4 bytes (2 bytes of ID, 2 bytes of Length). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_attribute_type typedef enum tagWCN_ATTRIBUTE_TYPE { + // WCN_TYPE_AP_CHANNEL, WCN_TYPE_ASSOCIATION_STATE, WCN_TYPE_AUTHENTICATION_TYPE, WCN_TYPE_AUTHENTICATION_TYPE_FLAGS, + // WCN_TYPE_AUTHENTICATOR, WCN_TYPE_CONFIG_METHODS, WCN_TYPE_CONFIGURATION_ERROR, WCN_TYPE_CONFIRMATION_URL4, + // WCN_TYPE_CONFIRMATION_URL6, WCN_TYPE_CONNECTION_TYPE, WCN_TYPE_CONNECTION_TYPE_FLAGS, WCN_TYPE_CREDENTIAL, WCN_TYPE_DEVICE_NAME, + // WCN_TYPE_DEVICE_PASSWORD_ID, WCN_TYPE_E_HASH1, WCN_TYPE_E_HASH2, WCN_TYPE_E_SNONCE1, WCN_TYPE_E_SNONCE2, + // WCN_TYPE_ENCRYPTED_SETTINGS, WCN_TYPE_ENCRYPTION_TYPE, WCN_TYPE_ENCRYPTION_TYPE_FLAGS, WCN_TYPE_ENROLLEE_NONCE, + // WCN_TYPE_FEATURE_ID, WCN_TYPE_IDENTITY, WCN_TYPE_IDENTITY_PROOF, WCN_TYPE_KEY_WRAP_AUTHENTICATOR, WCN_TYPE_KEY_IDENTIFIER, + // WCN_TYPE_MAC_ADDRESS, WCN_TYPE_MANUFACTURER, WCN_TYPE_MESSAGE_TYPE, WCN_TYPE_MODEL_NAME, WCN_TYPE_MODEL_NUMBER, + // WCN_TYPE_NETWORK_INDEX, WCN_TYPE_NETWORK_KEY, WCN_TYPE_NETWORK_KEY_INDEX, WCN_TYPE_NEW_DEVICE_NAME, WCN_TYPE_NEW_PASSWORD, + // WCN_TYPE_OOB_DEVICE_PASSWORD, WCN_TYPE_OS_VERSION, WCN_TYPE_POWER_LEVEL, WCN_TYPE_PSK_CURRENT, WCN_TYPE_PSK_MAX, + // WCN_TYPE_PUBLIC_KEY, WCN_TYPE_RADIO_ENABLED, WCN_TYPE_REBOOT, WCN_TYPE_REGISTRAR_CURRENT, WCN_TYPE_REGISTRAR_ESTABLISHED, + // WCN_TYPE_REGISTRAR_LIST, WCN_TYPE_REGISTRAR_MAX, WCN_TYPE_REGISTRAR_NONCE, WCN_TYPE_REQUEST_TYPE, WCN_TYPE_RESPONSE_TYPE, + // WCN_TYPE_RF_BANDS, WCN_TYPE_R_HASH1, WCN_TYPE_R_HASH2, WCN_TYPE_R_SNONCE1, WCN_TYPE_R_SNONCE2, WCN_TYPE_SELECTED_REGISTRAR, + // WCN_TYPE_SERIAL_NUMBER, WCN_TYPE_WI_FI_PROTECTED_SETUP_STATE, WCN_TYPE_SSID, WCN_TYPE_TOTAL_NETWORKS, WCN_TYPE_UUID_E, + // WCN_TYPE_UUID_R, WCN_TYPE_VENDOR_EXTENSION, WCN_TYPE_VERSION, WCN_TYPE_X_509_CERTIFICATE_REQUEST, WCN_TYPE_X_509_CERTIFICATE, + // WCN_TYPE_EAP_IDENTITY, WCN_TYPE_MESSAGE_COUNTER, WCN_TYPE_PUBLIC_KEY_HASH, WCN_TYPE_REKEY_KEY, WCN_TYPE_KEY_LIFETIME, + // WCN_TYPE_PERMITTED_CONFIG_METHODS, WCN_TYPE_SELECTED_REGISTRAR_CONFIG_METHODS, WCN_TYPE_PRIMARY_DEVICE_TYPE, + // WCN_TYPE_SECONDARY_DEVICE_TYPE_LIST, WCN_TYPE_PORTABLE_DEVICE, WCN_TYPE_AP_SETUP_LOCKED, WCN_TYPE_APPLICATION_EXTENSION, + // WCN_TYPE_EAP_TYPE, WCN_TYPE_INITIALIZATION_VECTOR, WCN_TYPE_KEY_PROVIDED_AUTOMATICALLY, WCN_TYPE_802_1X_ENABLED, + // WCN_TYPE_APPSESSIONKEY, WCN_TYPE_WEPTRANSMITKEY, WCN_TYPE_UUID, WCN_TYPE_PRIMARY_DEVICE_TYPE_CATEGORY, + // WCN_TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY_OUI, WCN_TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY, WCN_TYPE_CURRENT_SSID, WCN_TYPE_BSSID, + // WCN_TYPE_DOT11_MAC_ADDRESS, WCN_TYPE_AUTHORIZED_MACS, WCN_TYPE_NETWORK_KEY_SHAREABLE, WCN_TYPE_REQUEST_TO_ENROLL, + // WCN_TYPE_REQUESTED_DEVICE_TYPE, WCN_TYPE_SETTINGS_DELAY_TIME, WCN_TYPE_VERSION2, WCN_TYPE_VENDOR_EXTENSION_WFA, + // WCN_NUM_ATTRIBUTE_TYPES } WCN_ATTRIBUTE_TYPE; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_ATTRIBUTE_TYPE")] + public enum WCN_ATTRIBUTE_TYPE + { + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a value + /// containing data that specifies the 802.11 channel the access point is hosting. + /// + WCN_TYPE_AP_CHANNEL, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a value + /// containing the association state or configuration information defined by WCN_VALUE_TYPE_ASSOCIATION_STATE. + /// + WCN_TYPE_ASSOCIATION_STATE, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a value + /// containing an authentication type defined by WCN_VALUE_TYPE_AUTHENTICATION_TYPE. + /// + WCN_TYPE_AUTHENTICATION_TYPE, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a value + /// containing data that specifies the network authentication capabilities of the Enrollee (access point or station) by + /// providing a value defined by WCN_VALUE_TYPE_AUTHENTICATION_TYPE. + /// + WCN_TYPE_AUTHENTICATION_TYPE_FLAGS, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a buffer + /// containing a keyed hash of data. + /// + WCN_TYPE_AUTHENTICATOR, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method contains values, + /// defined by WCN_VALUE_TYPE_CONFIG_METHODS, that specify the configuration methods supported by the Enrollee or Registrar. + /// Additionally, access points and stationsthat support the UPnP Management Interface must also support this attribute, whichis + /// used to control the configuration methods that are enabled on the access point. + /// + WCN_TYPE_CONFIG_METHODS, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a value, + /// defined by WCN_VALUE_TYPE_CONFIGURATION_ERROR, that specifies the result of the device attempting to configure itself and + /// associate with the WLAN.If a configuration session fails with the error code WCN_E_CONNECTION_REJECTED, any error code + /// returned by the remote device can be obtained by querying this attribute. It is important to note that some devices will + /// return WCN_VALUE_CE_NO_ERROR even if an error has occurred. + /// + WCN_TYPE_CONFIGURATION_ERROR, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a buffer that + /// contains data representing the URL (IPv4 address based) provided by the Registrar to the Enrollee for use in posting + /// confirmationonce settings have been successfully applied and the network has been joined. This configurationparameter is + /// optional for a Registrar, and it is optional for the Enrollee to post to the URL if the Registrarincludes it. + /// + WCN_TYPE_CONFIRMATION_URL4, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a buffer that + /// contains data representing the URL (IPv6 address based) provided by the Registrar to the Enrollee for use in posting a + /// confirmationonce settings have been successfully applied and the network has been joined. This configurationparameter is + /// optional for a Registrar and it is optional for the Enrollee to post to the URL if the Registrarincludes it. + /// + WCN_TYPE_CONFIRMATION_URL6, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method contains a value, + /// defined by WCN_VALUE_TYPE_CONNECTION_TYPE, that specifies the connection capability of the Enrollee. + /// + WCN_TYPE_CONNECTION_TYPE, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method contains a value, + /// defined by WCN_VALUE_TYPE_CONNECTION_TYPE, that specifies the connection capability of the Enrollee. + /// + WCN_TYPE_CONNECTION_TYPE_FLAGS, + + /// + /// This compound attribute value indicates that the pbBuffer parameter of the IWCNDevice::GetAttribute method contains a single + /// WLAN Credential. There can be either multiple Credential attributes for each Network Key, or multipleNetwork Keys in a + /// single Credential attribute, which is accomplished by repeating the Network Key Index and attributes thatfollow it. + /// Generally, multiplekeys in a single Credential for a single SSID should be used, and multiple Credential attributes + /// forseparate SSIDs should be used. The following attributes are contained in each instance of Credential:If an application + /// intends to use the network credential with the WLAN API, it should use IWCNDevice::GetNetworkProfile to get a compatible XML + /// network profile directly. + /// + WCN_TYPE_CREDENTIAL, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a buffer that + /// contains a user-friendly description of the device encoded in UTF-8. Typically, the componentwould be a unique identifier + /// that describes the product in a way that is recognizable to the user. + /// + WCN_TYPE_DEVICE_NAME, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method contains a value, + /// defined by WCN VALUE TYPE DEVICE_PASSWORD_ID, that is used to identify a device password. + /// + WCN_TYPE_DEVICE_PASSWORD_ID, + + /// + /// This attribute value indicates that the pbBuffer parameter of the IWCNDevice::GetAttribute method contains the HMAC-SHA-256 + /// hash of the first half of the device password and the Enrollee’s first secretnonce. + /// + WCN_TYPE_E_HASH1, + + /// + /// This attribute value indicates that the pbBuffer parameter of the IWCNDevice::GetAttribute method contains the HMAC-SHA-256 + /// hash of the second half of the device password, and the Enrollee’s secondsecret nonce. + /// + WCN_TYPE_E_HASH2, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method contains the first + /// nonce used by the Enrollee with the first half of the device password. + /// + WCN_TYPE_E_SNONCE1, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method contains the + /// second nonce used by the Enrollee with the second half of the device password. + /// + WCN_TYPE_E_SNONCE2, + + /// + /// This attribute value indicates that the pbBuffer parameter of the IWCNDevice::GetAttribute method contains an initialization + /// vector (IV) followed by a setof encrypted Wi-Fi Protected Setup TLV attributes. The last attribute in the encrypted set is a + /// Key WrapAuthenticator computed according to the procedure described in section 6.5. + /// + WCN_TYPE_ENCRYPTED_SETTINGS, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method contains a value, + /// defined by WCN_VALUE_TYPE_ENCRYPTION_TYPE, for the Enrollee (AP orstation) to use. + /// + WCN_TYPE_ENCRYPTION_TYPE, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method contains a value, + /// defined by WCN_VALUE_TYPE_ENCRYPTION_TYPE, for the Enrollee (AP orstation) to use. + /// + WCN_TYPE_ENCRYPTION_TYPE_FLAGS, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method contains a + /// randomly generated binary value that is created by the Enrollee forsetup operations. + /// + WCN_TYPE_ENROLLEE_NONCE, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method contains data that + /// indicates a particular feature build for an operating system running on the device. The most significant bit of the 4 byte + /// integer is reserved, and always set to one. + /// + WCN_TYPE_FEATURE_ID, + + /// Reserved. Do not use. + WCN_TYPE_IDENTITY, + + /// Reserved. Do not use. + WCN_TYPE_IDENTITY_PROOF, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a 8 byte buffer + /// containing the first 64 bits of the HMAC-SHA-256 computed over the data to be encryptedwith the key wrap algorithm. It is + /// appended to the end of the ConfigData prior to encryption. + /// + WCN_TYPE_KEY_WRAP_AUTHENTICATOR, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetAttribute method is a 16 byte buffer + /// containing a 128-bit key identifier. If this attribute immediately precedes an Encrypted Dataor Authenticator attribute, + /// then the key corresponding to the 128-bit identifier should be used to decryptor verify the Data field. + /// + WCN_TYPE_KEY_IDENTIFIER, + + /// + /// This attribute value indicates that the pbBuffer parameter of the IWCNDevice::GetAttribute method is a 6 byte buffer + /// containing the 48 bit value of the MAC Address. For example: 0x00 0x07 0xE9 0x4C 0xA8 0x1C.This address is supplied by the + /// remote device. Some Access Points give the MAC address of their Ethernet interface, in which case, the address cannot be + /// used to locate the AP’s wireless radio. If an application needs to locate an AP’s radio, the application should query the + /// WCN_TYPE_BSSID attribute, which is populated by Windows and is generally more reliable. + /// + WCN_TYPE_MAC_ADDRESS, + + /// + /// This attribute value indicates that the pbBuffer parameter of the IWCNDevice::GetAttribute method is a buffer containing a + /// string that identifies the manufacturer of the device.Generally, this field should allow a user to make an association with + /// a device with the labeling on thedevice. + /// + WCN_TYPE_MANUFACTURER, + + /// Reserved. Do not use. + WCN_TYPE_MESSAGE_TYPE, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a buffer that + /// identifies the model of the device. Generally, this fieldshould allow a user to create an association of a device with the + /// labeling on the device. + /// + WCN_TYPE_MODEL_NAME, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a string + /// containing additional descriptive data associated with the device. + /// + WCN_TYPE_MODEL_NUMBER, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a 1 byte buffer + /// used to get and set network settings for devices that host more than one network. Thedefault value is '1' which refers to + /// the primary WLAN network on the device. + /// + WCN_TYPE_NETWORK_INDEX, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a buffer + /// containing the wireless encryption key to be used by the Enrollee. Note that it is recommended that applications implement + /// IWCNDevice::GetNetworkProfile to get network settings in a convenient format that is ready to be used with the WLAN + /// connection and profile management APIs. + /// + WCN_TYPE_NETWORK_KEY, + + /// Reserved. Do not use. + WCN_TYPE_NETWORK_KEY_INDEX, + + /// Reserved. Do not use. + WCN_TYPE_NEW_DEVICE_NAME, + + /// Reserved. Do not use. + WCN_TYPE_NEW_PASSWORD, + + /// Reserved. Do not use. + WCN_TYPE_OOB_DEVICE_PASSWORD, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a 4 byte buffer + /// that contains the operating system version running on the device. The most significant bit of this 4 byte field is reserved, + /// and always set to one. + /// + WCN_TYPE_OS_VERSION, + + /// Reserved. Do not use. + WCN_TYPE_POWER_LEVEL, + + /// Reserved. Do not use. + WCN_TYPE_PSK_CURRENT, + + /// Reserved. Do not use. + WCN_TYPE_PSK_MAX, + + /// + /// Reserved. Do not use. We recommend that a shared secret be sent by way of a vendor extension or that you find another way to + /// do cryptography. + /// + WCN_TYPE_PUBLIC_KEY, + + /// Reserved. Do not use. + WCN_TYPE_RADIO_ENABLED, + + /// Reserved. Do not use. + WCN_TYPE_REBOOT, + + /// Reserved. Do not use. + WCN_TYPE_REGISTRAR_CURRENT, + + /// Reserved. Do not use. + WCN_TYPE_REGISTRAR_ESTABLISHED, + + /// Reserved. Do not use. + WCN_TYPE_REGISTRAR_LIST, + + /// Reserved. Do not use. + WCN_TYPE_REGISTRAR_MAX, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a 16 byte + /// buffer containing a randomly generated binary value created by the Registrar forsetup. + /// + WCN_TYPE_REGISTRAR_NONCE, + + /// Reserved. Do not use. + WCN_TYPE_REQUEST_TYPE, + + /// Reserved. Do not use. + WCN_TYPE_RESPONSE_TYPE, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is an integer + /// value, defined by WCN_VALUE_TYPE_RF_BANDS, that indicates which RF band is utilized during message exchange, permitting + /// endpoints and proxies to communicate over a consistent radio interface. It may also be used as an optionalattribute in a + /// WCN_TYPE_CREDENTIAL or WCN_TYPE_ENCRYPTED_SETTINGS to indicate a specific (or group) of RF bands to which asetting applies. + /// + WCN_TYPE_RF_BANDS, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a 32 byte buffer + /// that containing the HMAC-SHA-256 hash of the first half of the device password and the Registrar’s first secretnonce. + /// + WCN_TYPE_R_HASH1, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a 32 byte buffer + /// containing the HMAC-SHA-256 hash of the second half of the device password and the Registrar’s secondsecret nonce. + /// + WCN_TYPE_R_HASH2, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a 16 byte + /// buffer containing the first nonce used by the Registrar with the first half of the device password. + /// + WCN_TYPE_R_SNONCE1, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a 16 byte + /// buffer containing the second nonce used by the Registrar with the second half of the device password. + /// + WCN_TYPE_R_SNONCE2, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is an integer + /// value, defined by WCN_VALUE_TYPE_BOOLEAN, that indicates if a Registrar has been selected by a user and that an Enrollee can + /// proceed withsetting up an 802.1X uncontrolled data port with the Registrar. + /// + WCN_TYPE_SELECTED_REGISTRAR, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a string + /// containing the serial number of the Enrollee. + /// + WCN_TYPE_SERIAL_NUMBER, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method an integer value, + /// defined by WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP, that indicates if a device is configured. + /// + WCN_TYPE_WI_FI_PROTECTED_SETUP_STATE, + + /// + /// This attribute value indicates that the pbData parameter of the IWCNDevice::GetAttribute method is a buffer, up to 32 bytes + /// in size, containing the Service Set Identifier (SSID) or network name.Instead of querying this attribute, it is recommended + /// that applications implement IWCNDevice::GetNetworkProfile to retrieve network settings in a convenient format that is ready + /// to be used with the WLAN connection and profile management APIs. + /// + WCN_TYPE_SSID, + + /// Reserved. Do not use. + WCN_TYPE_TOTAL_NETWORKS, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a 16 byte + /// buffer containing the Universally Unique Identifier (UUID) generated by the Enrollee. Ituniquely identifies an operational + /// device and should survive reboots and resets. The UUID is provided inbinary format. If the device also supports UPnP, then + /// the UUID corresponds to the UPnP UUID.Instead of querying this attribute, applications should instead query the + /// WCN_TYPE_UUID attribute, as it is available for both enrollees and registrars. WCN_TYPE_UUID_E_ is only available for + /// devices that act as an enrollee. + /// + WCN_TYPE_UUID_E, + + /// + /// This attribute value indicates that the pbBuffer parameter of the IWCNDevice::GetAttribute method is a 16 byte buffer + /// containing the Universally Unique Identifier (UUID) element generated by the Registrar. Ituniquely identifies an operational + /// device and should survive reboots and resets. The UUID is provided inbinary format. If the device also supports UPnP, then + /// the UUID corresponds to the UPnP UUID.Instead of querying this attribute, applications should instead query the + /// WCN_TYPE_UUID attribute, as it is available for both enrollees and registrars. + /// + WCN_TYPE_UUID_R, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetAttribute method is a buffer, up to 1024 + /// bytes in size, that permits the use of vendor extensions in the Wi-Fi Protected Setup TLV framework. The VendorExtension + /// figure illustrates the implementation of vendor extensions. Vendor ID is the SMI network management private enterprise code. + /// Instead of querying this value, implementation of the IWCNDevice::GetVendorExtension API is recommended for convenience and + /// flexibilty while accessing the raw vendor extension attribute directly. + /// + WCN_TYPE_VENDOR_EXTENSION, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is an integer + /// value that indicates the Wi-Fi Protected Setup version. The one-byte field is broken into a four-bit major part using thetop + /// MSBs and four-bit minor part using the LSBs. As an example, version 3.2 would be 0x32. + /// + WCN_TYPE_VERSION, + + /// + /// This attribute value indicates that the pbBuffer parameter of the IWCNDevice::GetAttribute method is a buffer containing an + /// X.509 certificate request payload as specified in RFC 2511. + /// + WCN_TYPE_X_509_CERTIFICATE_REQUEST, + + /// + /// This attribute value indicates that the pbBuffer parameter of the IWCNDevice::GetAttribute method is a buffer containing an + /// X.509 certificate. + /// + WCN_TYPE_X_509_CERTIFICATE, + + /// Reserved. Do not use. + WCN_TYPE_EAP_IDENTITY, + + /// Reserved. Do not use. + WCN_TYPE_MESSAGE_COUNTER, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is a 20 byte buffer + /// containing the first 160 bits of the SHA-256 hash of a public key. + /// + WCN_TYPE_PUBLIC_KEY_HASH, + + /// Reserved. Do not use. + WCN_TYPE_REKEY_KEY, + + /// Reserved. Do not use. + WCN_TYPE_KEY_LIFETIME, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is an integer + /// defined by WCN_VALUE_TYPE_CONFIG_METHODS, that indicates which of the configuration methods supported by the device are enabled. + /// + WCN_TYPE_PERMITTED_CONFIG_METHODS, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is an integer + /// defined by WCN_VALUE_TYPE_CONFIG_METHODS, that is used in Probe Response messages toconvey the current supported Config + /// Methods of a specific Registrar. + /// + WCN_TYPE_SELECTED_REGISTRAR_CONFIG_METHODS, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is an 8 byte + /// buffer containing values, contained in WCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE, that indicates the primary type of the device. It + /// is recommended that applications instead query the WCN_TYPE_PRIMARY_DEVICE_TYPE_CATEGORY, + /// WCN_TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY_OUI, and WCN_TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY attributes as they are more convenient. + /// + WCN_TYPE_PRIMARY_DEVICE_TYPE, + + /// Reserved. Do not use. + WCN_TYPE_SECONDARY_DEVICE_TYPE_LIST, + + /// Reserved. Do not use. + WCN_TYPE_PORTABLE_DEVICE, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a buffer + /// containing a value, defined by WCN_VALUE_TYPE_BOOLEAN, that indicates if the access point has entered a state in which it + /// will refuse to allow an external Registrarto attempt to run the Registration Protocol using the AP’s PIN (with the AP acting + /// as Enrollee). The APshould enter this state if it believes a brute force attack is underway against the AP’s PIN.When the AP + /// is in this state, it MUST continue to allow other Enrollees to connect and run theRegistration Protocol with any external + /// Registrars or the AP’s built-in Registrar (if any). It is only the useof the AP’s PIN for adding external Registrars that is + /// disabled in this state.The AP Setup Locked state can be reset to FALSE through an authenticated call to SetAPSettings. + /// APsmay provide other implementation-specific methods of resetting the AP Setup Locked state as well. + /// + WCN_TYPE_AP_SETUP_LOCKED, + + /// + /// This attribute value indicates that the pvBuffer parameter of the IWCNDevice::GetAttribute method is a buffer, up to 512 + /// bytes in size, used to pass parameters for enabling applications during the WSCexchange. It is similar to the Vendor + /// Extension attribute except that instead of a 3-byte Vendor ID prefixto the Vendor Data field, a 16-byte UUID (as defined in + /// RFC 4122) is used. This provides a virtuallyunlimited application ID space with a regular structure that can be easily + /// mapped onto a genericapplication extension API. Furthermore, the 16-byte UUID value can be used to derive + /// applicationspecificAMSKs as described in Section 6.3 or pass any necessary keying directly. + /// + WCN_TYPE_APPLICATION_EXTENSION, + + /// Reserved. Do not use. + WCN_TYPE_EAP_TYPE, + + /// Reserved. Do not use. + WCN_TYPE_INITIALIZATION_VECTOR, + + /// Reserved. Do not use. + WCN_TYPE_KEY_PROVIDED_AUTOMATICALLY, + + /// Reserved. Do not use. + WCN_TYPE_802_1X_ENABLED, + + /// + /// This attribute value represents the buffer, up to 128 bytes in size, containing data that indicates an exchange of + /// application specific session keys and, alternatively, may be usedto calculate AMSKs. + /// + WCN_TYPE_APPSESSIONKEY, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a 1 byte buffer + /// containing data that identifies the Key Index value used as the Access Point transmit key for WEP configurations. + /// + WCN_TYPE_WEPTRANSMITKEY, + + /// + /// This compound attribute indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a 16 byte + /// buffer that contains data that is always equal to the UUID of the device, regardless if the device is enrollee or registrar. + /// (Effectively, merges WCN_TYPE_UUID_E and WCN_TYPE_UUID_R). + /// + WCN_TYPE_UUID, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute is an integer that + /// represents the major device category of a WCN device. The major device category is one of the + /// WCN_VALUE_TYPE_DEVICE_TYPE_CATEGORY values. + /// + WCN_TYPE_PRIMARY_DEVICE_TYPE_CATEGORY, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute is an integer that + /// represents the OUI that defines the device subcategory of a WCN device. The most common OUI is WCN_VALUE_DT_SUBTYPE_WIFI_OUI + /// which indicates that the subcategory is defined by the Wi-Fi Alliance. + /// + WCN_TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY_OUI, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute is an integer that + /// represents the device subcategory of a WCN device. The subcategory must be interpreted along with the OUI from + /// WCN_TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY_OUI. For devices using the Wi-Fi Alliance OUI. The subcategory is one of the + /// WCN_VALUE_TYPE_DEVICE_TYPE_SUBCATEGORY values. + /// + WCN_TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY, + + /// + /// This attribute value indicates that the wszString parameter of the IWCNDevice::GetStringAttribute method is buffer, up to 32 + /// bytes in size, containing the current SSID of a wireless access point. + /// + WCN_TYPE_CURRENT_SSID, + + /// Reserved. Do not use. + WCN_TYPE_BSSID, + + /// Reserved. Do not use. + WCN_TYPE_DOT11_MAC_ADDRESS, + + /// + /// . This attribute value indicates that a registrar is providing a list of MAC addresses that are authorized to start WSC. The + /// pbBuffer parameter of the IWCNDevice::GetAttribute method is a 6-30 byte buffer containing the 48 bit value of each MAC + /// Address in the list of authorized MACs. For example: 0x00 0x07 0xE9 0x4C 0xA8 0x1C. + /// + WCN_TYPE_AUTHORIZED_MACS, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a 1 byte buffer + /// used to get and set network settings for devices that host more than one network. A value of '1' indicates that the Network + /// Key may be shared with other devices. + /// + WCN_TYPE_NETWORK_KEY_SHAREABLE, + + /// Reserved. Do not use. + WCN_TYPE_REQUEST_TO_ENROLL, + + /// Reserved. Do not use. + WCN_TYPE_REQUESTED_DEVICE_TYPE, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is a 1 byte buffer + /// indicating the estimated length of time (in seconds) that an access point will require to reconfigure itself and become + /// available, or that a device will require to apply settings and connect to a network. + /// + WCN_TYPE_SETTINGS_DELAY_TIME, + + /// + /// This attribute value indicates that the puInteger parameter of the IWCNDevice::GetIntegerAttribute method is an integer + /// value that indicates the Wi-Fi Protected Setup version. The one-byte field is broken into a four-bit major part using thetop + /// MSBs and four-bit minor part using the LSBs. As an example, version 3.2 would be 0x32. + /// + WCN_TYPE_VERSION2, + + /// Reserved. Do not use. + WCN_TYPE_VENDOR_EXTENSION_WFA, + + /// The number of assigned attributes. + WCN_NUM_ATTRIBUTE_TYPES, + } + + /// + /// The WCN_VALUE_TYPE_ASSOCIATION_STATE enumeration defines the possible association states of a wireless station during a + /// Discovery request. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_value_type_association_state typedef enum + // tagWCN_VALUE_TYPE_ASSOCIATION_STATE { WCN_VALUE_AS_NOT_ASSOCIATED, WCN_VALUE_AS_CONNECTION_SUCCESS, + // WCN_VALUE_AS_CONFIGURATION_FAILURE, WCN_VALUE_AS_ASSOCIATION_FAILURE, WCN_VALUE_AS_IP_FAILURE } WCN_VALUE_TYPE_ASSOCIATION_STATE; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_VALUE_TYPE_ASSOCIATION_STATE")] + public enum WCN_VALUE_TYPE_ASSOCIATION_STATE + { + /// The wireless station is not associated. + WCN_VALUE_AS_NOT_ASSOCIATED, + + /// The connection was successfully established. + WCN_VALUE_AS_CONNECTION_SUCCESS, + + /// The wireless station is not properly configured. + WCN_VALUE_AS_CONFIGURATION_FAILURE, + + /// Association has failed. + WCN_VALUE_AS_ASSOCIATION_FAILURE, + + /// The specified IP address could not be connected to, and may be invalid. + WCN_VALUE_AS_IP_FAILURE, + } + + /// + /// The WCN_VALUE_TYPE_AUTHENTICATION_TYPE enumeration defines the authentication types supported by the Enrollee (access + /// point or station). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_value_type_authentication_type typedef enum + // tagWCN_VALUE_TYPE_AUTHENTICATION_TYPE { WCN_VALUE_AT_OPEN, WCN_VALUE_AT_WPAPSK, WCN_VALUE_AT_SHARED, WCN_VALUE_AT_WPA, + // WCN_VALUE_AT_WPA2, WCN_VALUE_AT_WPA2PSK, WCN_VALUE_AT_WPAWPA2PSK_MIXED } WCN_VALUE_TYPE_AUTHENTICATION_TYPE; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_VALUE_TYPE_AUTHENTICATION_TYPE")] + [Flags] + public enum WCN_VALUE_TYPE_AUTHENTICATION_TYPE + { + /// Specifies IEEE 802.11 Open System authentication. + WCN_VALUE_AT_OPEN = 0x1, + + /// + /// Specifies WPA security. Authentication is performed between the supplicant and authenticator over IEEE 802.1X. Encryption + /// keys are dynamic and are derived through the preshared key used by the supplicant and authenticator. + /// + WCN_VALUE_AT_WPAPSK = 0x2, + + /// Specifies IEEE 802.11 Shared Key authentication that uses a preshared WEP key. + WCN_VALUE_AT_SHARED = 0x4, + + /// + /// Specifies WPA security. Authentication is performed between the supplicant, authenticator, and authentication server over + /// IEEE 802.1X. Encryption keys are dynamic and are derived through the authentication process. + /// + WCN_VALUE_AT_WPA = 0x8, + + /// + /// Specifies WPA2 security. Authentication is performed between the supplicant, authenticator, and authentication server over + /// IEEE 802.1X. Encryption keys are dynamic and are derived through the authentication process. + /// + WCN_VALUE_AT_WPA2 = 0x10, + + /// + /// Specifies WPA2 security. Authentication is performed between the supplicant and authenticator over IEEE 802 1X. Encryption + /// keys are dynamic and are derived through the preshared key used by the supplicant and authenticator. + /// + WCN_VALUE_AT_WPA2PSK = 0x20, + + /// Specifies WPAPSK/WPA2PSK mixed-mode encryption. + WCN_VALUE_AT_WPAWPA2PSK_MIXED = 0x22, + } + + /// + /// The WCN_VALUE_TYPE_BOOLEAN enumeration defines values used to represent true/false conditions encountered during device + /// setup and association. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_value_type_boolean typedef enum + // tagWCN_VALUE_TYPE_BOOLEAN { WCN_VALUE_FALSE, WCN_VALUE_TRUE } WCN_VALUE_TYPE_BOOLEAN; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_VALUE_TYPE_BOOLEAN")] + public enum WCN_VALUE_TYPE_BOOLEAN + { + /// The argument is false. + WCN_VALUE_FALSE, + + /// The argument is true. + WCN_VALUE_TRUE, + } + + /// + /// The WCN_VALUE_TYPE_CONFIG_METHODS enumeration defines the configuration methods supported by the Enrollee or Registrar. + /// One or more of the following configuration methods must be supported. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_value_type_config_methods typedef enum + // tagWCN_VALUE_TYPE_CONFIG_METHODS { WCN_VALUE_CM_USBA, WCN_VALUE_CM_ETHERNET, WCN_VALUE_CM_LABEL, WCN_VALUE_CM_DISPLAY, + // WCN_VALUE_CM_EXTERNAL_NFC, WCN_VALUE_CM_INTEGRATED_NFC, WCN_VALUE_CM_NFC_INTERFACE, WCN_VALUE_CM_PUSHBUTTON, WCN_VALUE_CM_KEYPAD, + // WCN_VALUE_CM_VIRT_PUSHBUTTON, WCN_VALUE_CM_PHYS_PUSHBUTTON, WCN_VALUE_CM_VIRT_DISPLAY, WCN_VALUE_CM_PHYS_DISPLAY } WCN_VALUE_TYPE_CONFIG_METHODS; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_VALUE_TYPE_CONFIG_METHODS")] + [Flags] + public enum WCN_VALUE_TYPE_CONFIG_METHODS + { + /// USB-A (flash drive) configuration is supported. + WCN_VALUE_CM_USBA = 0x1, + + /// Ethernet configuration is supported. + WCN_VALUE_CM_ETHERNET = 0x2, + + /// + /// Label configuration is supported. To authenticate with the default password ID, call IWCNDevice::SetPassword with the PIN + /// password type defined by WCN_PASSWORD_TYPE. + /// + WCN_VALUE_CM_LABEL = 0x4, + + /// + /// Display configuration is supported. To authenticate with the default password ID, call IWCNDevice::SetPassword with the PIN + /// password type defined by WCN_PASSWORD_TYPE. + /// + WCN_VALUE_CM_DISPLAY = 0x8, + + /// External near-field communication (NFC) token configuration is supported. + WCN_VALUE_CM_EXTERNAL_NFC = 0x10, + + /// Integrated NFC token configuration is supported. + WCN_VALUE_CM_INTEGRATED_NFC = 0x20, + + /// NFC interface configuration is supported. + WCN_VALUE_CM_NFC_INTERFACE = 0x40, + + /// + /// Push button configuration is supported. To authenticate with the default password ID, call IWCNDevice::SetPassword with the + /// push button password type defined by WCN_PASSWORD_TYPE. + /// + WCN_VALUE_CM_PUSHBUTTON = 0x80, + + /// Keypad configuration is supported. + WCN_VALUE_CM_KEYPAD = 0x100, + + /// + /// Virtual push button configuration is supported. To authenticate with the default password ID, call IWCNDevice::SetPassword + /// with the push button password type defined by WCN_PASSWORD_TYPE. + /// + WCN_VALUE_CM_VIRT_PUSHBUTTON = 0x280, + + /// + /// Physical push button configuration is supported. To authenticate with the default password ID, call IWCNDevice::SetPassword + /// with the push button password type defined by WCN_PASSWORD_TYPE. + /// + WCN_VALUE_CM_PHYS_PUSHBUTTON = 0x480, + + /// + /// Virtual display configuration is supported. To authenticate with the default password ID, call IWCNDevice::SetPassword with + /// the PIN password type defined by WCN_PASSWORD_TYPE. + /// + WCN_VALUE_CM_VIRT_DISPLAY = 0x2008, + + /// + /// Physical display configuration is supported. To authenticate with the default password ID, call IWCNDevice::SetPassword with + /// the PIN password type defined by WCN_PASSWORD_TYPE. + /// + WCN_VALUE_CM_PHYS_DISPLAY = 0x4008, + } + + /// + /// The WCN_VALUE_TYPE_CONFIGURATION_ERROR enumeration defines possible error values returned to a device while attempting to + /// configure to, and associate with, the WLAN. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_value_type_configuration_error typedef enum + // tagWCN_VALUE_TYPE_CONFIGURATION_ERROR { WCN_VALUE_CE_NO_ERROR, WCN_VALUE_CE_OOB_INTERFACE_READ_ERROR, + // WCN_VALUE_CE_DECRYPTION_CRC_FAILURE, WCN_VALUE_CE_2_4_CHANNEL_NOT_SUPPORTED, WCN_VALUE_CE_5_0_CHANNEL_NOT_SUPPORTED, + // WCN_VALUE_CE_SIGNAL_TOO_WEAK, WCN_VALUE_CE_NETWORK_AUTHENTICATION_FAILURE, WCN_VALUE_CE_NETWORK_ASSOCIATION_FAILURE, + // WCN_VALUE_CE_NO_DHCP_RESPONSE, WCN_VALUE_CE_FAILED_DHCP_CONFIG, WCN_VALUE_CE_IP_ADDRESS_CONFLICT, + // WCN_VALUE_CE_COULD_NOT_CONNECT_TO_REGISTRAR, WCN_VALUE_CE_MULTIPLE_PBC_SESSIONS_DETECTED, WCN_VALUE_CE_ROGUE_ACTIVITY_SUSPECTED, + // WCN_VALUE_CE_DEVICE_BUSY, WCN_VALUE_CE_SETUP_LOCKED, WCN_VALUE_CE_MESSAGE_TIMEOUT, WCN_VALUE_CE_REGISTRATION_SESSION_TIMEOUT, + // WCN_VALUE_CE_DEVICE_PASSWORD_AUTH_FAILURE } WCN_VALUE_TYPE_CONFIGURATION_ERROR; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_VALUE_TYPE_CONFIGURATION_ERROR")] + public enum WCN_VALUE_TYPE_CONFIGURATION_ERROR + { + /// + /// No error. An application must be prepared to handle devices that signal 'No Error' even if the device detected an error. + /// + WCN_VALUE_CE_NO_ERROR, + + /// Could not read the out-of-band (OOB) interface. + WCN_VALUE_CE_OOB_INTERFACE_READ_ERROR, + + /// Could not decrypt the Cyclic Redundancy Check (CRC) value. + WCN_VALUE_CE_DECRYPTION_CRC_FAILURE, + + /// The 2.4 GHz channel is not supported. + WCN_VALUE_CE_2_4_CHANNEL_NOT_SUPPORTED, + + /// The 5.0 GHz channel is not supported. + WCN_VALUE_CE_5_0_CHANNEL_NOT_SUPPORTED, + + /// The wireless signal is not strong enough to initiate a connection. + WCN_VALUE_CE_SIGNAL_TOO_WEAK, + + /// Network authentication failed. + WCN_VALUE_CE_NETWORK_AUTHENTICATION_FAILURE, + + /// Network association failed. + WCN_VALUE_CE_NETWORK_ASSOCIATION_FAILURE, + + /// The DHCP server did not respond. + WCN_VALUE_CE_NO_DHCP_RESPONSE, + + /// DHCP configuration failed. + WCN_VALUE_CE_FAILED_DHCP_CONFIG, + + /// There was an IP address conflict. + WCN_VALUE_CE_IP_ADDRESS_CONFLICT, + + /// Could not connect to the registrar. + WCN_VALUE_CE_COULD_NOT_CONNECT_TO_REGISTRAR, + + /// Multiple push button configuration (PBC) sessions were detected. + WCN_VALUE_CE_MULTIPLE_PBC_SESSIONS_DETECTED, + + /// Rogue activity is suspected. + WCN_VALUE_CE_ROGUE_ACTIVITY_SUSPECTED, + + /// The device is busy. + WCN_VALUE_CE_DEVICE_BUSY, + + /// Setup is locked. + WCN_VALUE_CE_SETUP_LOCKED, + + /// The message timed out. + WCN_VALUE_CE_MESSAGE_TIMEOUT, + + /// The registration session timed out. + WCN_VALUE_CE_REGISTRATION_SESSION_TIMEOUT, + + /// Device password authentication failed. + WCN_VALUE_CE_DEVICE_PASSWORD_AUTH_FAILURE, + } + + /// The WCN_VALUE_TYPE_CONNECTION_TYPE enumeration defines the connection capabilities of the Enrollee. + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_value_type_connection_type typedef enum + // tagWCN_VALUE_TYPE_CONNECTION_TYPE { WCN_VALUE_CT_ESS, WCN_VALUE_CT_IBSS } WCN_VALUE_TYPE_CONNECTION_TYPE; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_VALUE_TYPE_CONNECTION_TYPE")] + public enum WCN_VALUE_TYPE_CONNECTION_TYPE + { + /// Specifies an ESS (infrastructure network) connection. + WCN_VALUE_CT_ESS = 1, + + /// Specifies an IBSS (ad-hoc network) connection. + WCN_VALUE_CT_IBSS, + } + + /// The WCN_VALUE_TYPE_DEVICE_PASSWORD_ID enumeration defines values that specify the origin or 'type' of a password. + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_value_type_device_password_id typedef enum + // tagWCN_VALUE_TYPE_DEVICE_PASSWORD_ID { WCN_VALUE_DP_DEFAULT, WCN_VALUE_DP_USER_SPECIFIED, WCN_VALUE_DP_MACHINE_SPECIFIED, + // WCN_VALUE_DP_REKEY, WCN_VALUE_DP_PUSHBUTTON, WCN_VALUE_DP_REGISTRAR_SPECIFIED, WCN_VALUE_DP_NFC_CONNECTION_HANDOVER, + // WCN_VALUE_DP_WFD_SERVICES, WCN_VALUE_DP_OUTOFBAND_MIN, WCN_VALUE_DP_OUTOFBAND_MAX } WCN_VALUE_TYPE_DEVICE_PASSWORD_ID; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_VALUE_TYPE_DEVICE_PASSWORD_ID")] + public enum WCN_VALUE_TYPE_DEVICE_PASSWORD_ID + { + /// + /// The PIN password, obtained from the label, ordisplay will be used. This password may correspond to the label, display, or a + /// user-defined password that has beenconfigured to replace the original device password.To authenticate with the default + /// password ID, call IWCNDevice::SetPassword with the PIN password type defined by WCN_PASSWORD_TYPE. + /// + WCN_VALUE_DP_DEFAULT = 0, + + /// The user has overridden the default password with a manually selected value. + WCN_VALUE_DP_USER_SPECIFIED, + + /// The default PIN password has been overridden by a strong, machine-generateddevice password value. + WCN_VALUE_DP_MACHINE_SPECIFIED, + + /// The 256-bit rekeying passwordassociated with the device will be used. + WCN_VALUE_DP_REKEY, + + /// + /// A password entered via a push button interface will be used. To authenticate with the default password ID, call + /// IWCNDevice::SetPassword with the push button password type defined by WCN_PASSWORD_TYPE. + /// + WCN_VALUE_DP_PUSHBUTTON, + + /// A PIN has been obtained from the Registrar via a display orother out-of-band method. + WCN_VALUE_DP_REGISTRAR_SPECIFIED, + + /// + WCN_VALUE_DP_NFC_CONNECTION_HANDOVER = 7, + + /// + WCN_VALUE_DP_WFD_SERVICES, + + /// + WCN_VALUE_DP_OUTOFBAND_MIN = 0x10, + + /// + WCN_VALUE_DP_OUTOFBAND_MAX = 0xffff, + } + + /// + /// Specifies the primary device type category. This data is supplied in network byte order. + /// + [PInvokeData("wcntypes.h", MSDNShortId = "NS:wcntypes.tagWCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE")] + public enum WCN_VALUE_TYPE_DEVICE_TYPE_CATEGORY : ushort + { + /// Indicates a computer. + WCN_VALUE_DT_CATEGORY_COMPUTER = 0x1, + + /// Indicates an input device. + WCN_VALUE_DT_CATEGORY_INPUT_DEVICE = 0x2, + + /// Indicates a printer. + WCN_VALUE_DT_CATEGORY_PRINTER = 0x3, + + /// Indicates a camera. + WCN_VALUE_DT_CATEGORY_CAMERA = 0x4, + + /// Indicates a storage device. + WCN_VALUE_DT_CATEGORY_STORAGE = 0x5, + + /// Indicates a network. + WCN_VALUE_DT_CATEGORY_NETWORK_INFRASTRUCTURE = 0x6, + + /// Indicates a display. + WCN_VALUE_DT_CATEGORY_DISPLAY = 0x7, + + /// Indicates a multimedia device. + WCN_VALUE_DT_CATEGORY_MULTIMEDIA_DEVICE = 0x8, + + /// Indicates a gaming device. + WCN_VALUE_DT_CATEGORY_GAMING_DEVICE = 0x9, + + /// Indicates a telephone. + WCN_VALUE_DT_CATEGORY_TELEPHONE = 0xa, + + /// + /// Indicates an audio device. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_CATEGORY_AUDIO_DEVICE = 0xb, + + /// + /// Indicates an unspecified device. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_CATEGORY_OTHER = 0xff, + } + + /// + /// + /// Specifies the primary device type sub-category. This data is supplied in network byte order. If SubCategoryOUI is equal + /// to WCN_VALUE_DT_SUBTYPE_WIFI_OUI, then any of the values below are valid. Otherwise, the SubCategory has been defined by + /// the vendor. + /// + /// + [PInvokeData("wcntypes.h", MSDNShortId = "NS:wcntypes.tagWCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE")] + public enum WCN_VALUE_TYPE_DEVICE_TYPE_SUBCATEGORY : ushort + { + /// Indicates a personal computer. + WCN_VALUE_DT_SUBTYPE_COMPUTER_PC = 0x1, + + /// Indicates a server. + WCN_VALUE_DT_SUBTYPE_COMPUTER_SERVER = 0x2, + + /// + /// Indicates a media center. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_COMPUTER_MEDIACENTER = 0x3, + + /// + /// Indicates an Ultra-Mobile PC. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_COMPUTER_ULTRAMOBILEPC = 0x4, + + /// + /// Indicates a notebook computer. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_COMPUTER_NOTEBOOK = 0x5, + + /// + /// Indicates a desktop computer. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_COMPUTER_DESKTOP = 0x6, + + /// + /// Indicates a mobile Internet device. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_COMPUTER_MID = 0x7, + + /// + /// Indicates a netbook. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_COMPUTER_NETBOOK = 0x8, + + /// + /// Indicates a keyboard. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_KEYBOARD = 0x1, + + /// + /// Indicates a mouse. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_MOUSE = 0x2, + + /// + /// Indicates a joystick. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_JOYSTICK = 0x3, + + /// + /// Indicates a trackball. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_TRACKBALL = 0x4, + + /// + /// Indicates a game controller. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_GAMECONTROLLER = 0x5, + + /// + /// Indicates a remote control. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_REMOTE = 0x6, + + /// + /// Indicates a touch screen. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_TOUCHSCREEN = 0x7, + + /// + /// Indicates a biometric reader. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_BIOMETRICREADER = 0x8, + + /// + /// Indicates a barcode reader. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_BARCODEREADER = 0x9, + + /// Indicates a printer. + WCN_VALUE_DT_SUBTYPE_PRINTER_PRINTER = 0x1, + + /// Indicates a scanner. + WCN_VALUE_DT_SUBTYPE_PRINTER_SCANNER = 0x2, + + /// + /// Indicates a fax machine. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_PRINTER_FAX = 0x3, + + /// + /// Indicates a copier. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_PRINTER_COPIER = 0x4, + + /// + /// Indicates an all-in-one printer. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_PRINTER_ALLINONE = 0x4, + + /// Indicates a still-shot camera. + WCN_VALUE_DT_SUBTYPE_CAMERA_STILL_CAMERA = 0x1, + + /// + /// Indicates a video camera. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_CAMERA_VIDEO_CAMERA = 0x2, + + /// + /// Indicates a web camera. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_CAMERA_WEB_CAMERA = 0x3, + + /// + /// Indicates a security camera. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_CAMERA_SECURITY_CAMERA = 0x4, + + /// Indicates a network storage device. + WCN_VALUE_DT_SUBTYPE_STORAGE_NAS = 0x1, + + /// Indicates an access point. + WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE_AP = 0x1, + + /// Indicates a router. + WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE_ROUTER = 0x2, + + /// Indicates a switch. + WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE_SWITCH = 0x3, + + /// + /// Indicates a gateway. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE_GATEWAY = 0x4, + + /// + /// Indicates a bridge. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE_BRIDGE = 0x5, + + /// Indicates a television. + WCN_VALUE_DT_SUBTYPE_DISPLAY_TELEVISION = 0x1, + + /// Indicates an electronic picture frame. + WCN_VALUE_DT_SUBTYPE_DISPLAY_PICTURE_FRAME = 0x2, + + /// Indicates a digital projector. + WCN_VALUE_DT_SUBTYPE_DISPLAY_PROJECTOR = 0x3, + + /// + /// Indicates a monitor. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_DISPLAY_MONITOR = 0x4, + + /// Indicates a digital audio recorder. + WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_DAR = 0x1, + + /// Indicates a personal video recorder. + WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_PVR = 0x2, + + /// Indicates a Yamaha Digital Multimedia Receiver. + WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_MCX = 0x3, + + /// + /// Indicates a set-top box. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_SETTOPBOX = 0x4, + + /// + /// Indicates a media server, media adapter, or media extender. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_MEDIA_SERVER_ADAPT_EXT = 0x5, + + /// + /// Indicates a portable video player. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_PVP = 0x6, + + /// Indicates a Microsoft XBOX console. + WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE_XBOX = 0x1, + + /// Indicates a Microsoft XBOX 360 console. + WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE_XBOX360 = 0x2, + + /// Indicates a Sony Playstation 3. + WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE_PLAYSTATION = 0x3, + + /// + /// Indicates a game console adapter. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE_CONSOLE_ADAPT = 0x4, + + /// + /// Indicates a portable gaming device. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE_PORTABLE = 0x5, + + /// Indicates a Windows Mobile device. + WCN_VALUE_DT_SUBTYPE_TELEPHONE_WINDOWS_MOBILE = 0x1, + + /// + /// Indicates a single-mode phone. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_TELEPHONE_PHONE_SINGLEMODE = 0x2, + + /// + /// Indicates a dual-mode phone. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_TELEPHONE_PHONE_DUALMODE = 0x3, + + /// + /// Indicates a single-mode smartphone. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_TELEPHONE_PHONE_SMARTPHONE_SINGLEMODE = 0x4, + + /// + /// Indicates a dual-mode smartphone. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_TELEPHONE_PHONE_SMARTPHONE_DUALMODE = 0x2, + + /// + /// Indicates an audio tuner/receiver. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_TUNER_RECEIVER = 0x1, + + /// + /// Indicates speakers. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_SPEAKERS = 0x2, + + /// + /// Indicates a personal media player. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_PMP = 0x2, + + /// + /// Indicates a headset. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_HEADSET = 0x2, + + /// + /// Indicates headphones. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_HEADPHONES = 0x2, + + /// + /// Indicates a microphone. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_MICROPHONE = 0x2, + + /// + /// Indicates a home theater system. + /// Note Only available in Windows 8. + /// + WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_HOMETHEATER = 0x2, + } + + /// Specifies the unique manufacturer OUI associated with the device. + [PInvokeData("wcntypes.h", MSDNShortId = "NS:wcntypes.tagWCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE")] + public enum WCN_VALUE_TYPE_DEVICE_TYPE_SUBCATEGORY_OUI : uint + { + /// Indicates the specific manufacturer Organization ID (OUI) for a wireless device. + WCN_VALUE_DT_SUBTYPE_WIFI_OUI = 0x50f204 + } + + /// The WCN_VALUE_TYPE_ENCRYPTION_TYPE enumeration defines the supported WLAN encryption types. + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_value_type_encryption_type typedef enum + // tagWCN_VALUE_TYPE_ENCRYPTION_TYPE { WCN_VALUE_ET_NONE, WCN_VALUE_ET_WEP, WCN_VALUE_ET_TKIP, WCN_VALUE_ET_AES, + // WCN_VALUE_ET_TKIP_AES_MIXED } WCN_VALUE_TYPE_ENCRYPTION_TYPE; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_VALUE_TYPE_ENCRYPTION_TYPE")] + [Flags] + public enum WCN_VALUE_TYPE_ENCRYPTION_TYPE + { + /// Specifies support for unsecured wireless activity. + WCN_VALUE_ET_NONE = 0x1, + + /// Specifies support for the Wired Equivalent Privacy (WEP) encryption method. + WCN_VALUE_ET_WEP = 0x2, + + /// Specifies support for the Temporal Key Integrity Protocol (TKIP) encryption method. + WCN_VALUE_ET_TKIP = 0x4, + + /// Specifies support for the Advanced Encryption Standard (AES) encryption method. + WCN_VALUE_ET_AES = 0x8, + + /// Specifies support for WPAPSK/WPA2PSK mixed-mode encryption. + WCN_VALUE_ET_TKIP_AES_MIXED = 0xc, + } + + /// Values for WCN_TYPE_MESSAGE_TYPE + [PInvokeData("wcntypes.h")] + public enum WCN_VALUE_TYPE_MESSAGE_TYPE + { + /// + WCN_VALUE_MT_BEACON = 0x1, + + /// + WCN_VALUE_MT_PROBE_REQUEST = 0x2, + + /// + WCN_VALUE_MT_PROBE_RESPONSE = 0x3, + + /// + WCN_VALUE_MT_M1 = 0x4, + + /// + WCN_VALUE_MT_M2 = 0x5, + + /// + WCN_VALUE_MT_M2D = 0x6, + + /// + WCN_VALUE_MT_M3 = 0x7, + + /// + WCN_VALUE_MT_M4 = 0x8, + + /// + WCN_VALUE_MT_M5 = 0x9, + + /// + WCN_VALUE_MT_M6 = 0xa, + + /// + WCN_VALUE_MT_M7 = 0xb, + + /// + WCN_VALUE_MT_M8 = 0xc, + + /// + WCN_VALUE_MT_ACK = 0xd, + + /// + WCN_VALUE_MT_NACK = 0xe, + + /// + WCN_VALUE_MT_DONE = 0xf + } + + /// Values for WCN_TYPE_REQUEST_TYPE + [PInvokeData("wcntypes.h")] + public enum WCN_VALUE_TYPE_REQUEST_TYPE + { + /// + WCN_VALUE_ReqT_ENROLLEE_INFO = 0, + + /// + WCN_VALUE_ReqT_ENROLLEE_OPEN_1X = 0x1, + + /// + WCN_VALUE_ReqT_REGISTRAR = 0x2, + + /// + WCN_VALUE_ReqT_MANAGER_REGISTRAR = 0x3 + } + + /// Values for WCN_TYPE_RESPONSE_TYPE + [PInvokeData("wcntypes.h")] + public enum WCN_VALUE_TYPE_RESPONSE_TYPE + { + /// + WCN_VALUE_RspT_ENROLLEE_INFO, + + /// + WCN_VALUE_RspT_ENROLLEE_OPEN_1X = 0x1, + + /// + WCN_VALUE_RspT_REGISTRAR = 0x2, + + /// + WCN_VALUE_RspT_AP = 0x3 + } + + /// + /// The WCN_VALUE_TYPE_RF_BANDS enumeration defines the possible radio frequency bands on which an enrollee can send + /// Discovery requests. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_value_type_rf_bands typedef enum + // tagWCN_VALUE_TYPE_RF_BANDS { WCN_VALUE_RB_24GHZ, WCN_VALUE_RB_50GHZ } WCN_VALUE_TYPE_RF_BANDS; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_VALUE_TYPE_RF_BANDS")] + public enum WCN_VALUE_TYPE_RF_BANDS + { + /// The request is being sent on the 2.4 GHz frequency band. + WCN_VALUE_RB_24GHZ = 0x1, + + /// The request is being sent on the 5.0 Ghz frequency band. + WCN_VALUE_RB_50GHZ = 0x2 + } + + /// The WCN_VALUE_TYPE_VERSION enumeration defines the supported version of Wi-Fi Protected Setup (WPS). + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_value_type_version typedef enum + // tagWCN_VALUE_TYPE_VERSION { WCN_VALUE_VERSION_1_0, WCN_VALUE_VERSION_2_0 } WCN_VALUE_TYPE_VERSION; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_VALUE_TYPE_VERSION")] + public enum WCN_VALUE_TYPE_VERSION + { + /// + /// Specifies WPS 1.0. Indicates compliance with Wi-Fi Alliance protocol specification for Wi-Fi Protected Setup (WPS) 1.0h. + /// + WCN_VALUE_VERSION_1_0 = 0x10, + + /// + /// Specifies WPS 2.0. Indicates compliance with Wi-Fi Alliance protocol specification for Wi-Fi Simple Configuration (WSC) 2.0. + /// + WCN_VALUE_VERSION_2_0 = 0x20, + } + + /// The WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE enumeration defines values that indicate if a device is configured. + /// + /// A device is considered 'not configured' if it is using factory default wireless settings. If the wireless settings have been + /// customized by the user, the device is considered to be 'configured'. A factory reset will restore the device to a 'not + /// configured' state. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ne-wcntypes-wcn_value_type_wi_fi_protected_setup_state typedef enum + // tagWCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE { WCN_VALUE_SS_RESERVED00, WCN_VALUE_SS_NOT_CONFIGURED, WCN_VALUE_SS_CONFIGURED } WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE; + [PInvokeData("wcntypes.h", MSDNShortId = "NE:wcntypes.tagWCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE")] + public enum WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE + { + /// This value is reserved. + WCN_VALUE_SS_RESERVED00, + + /// The device is not configured. + WCN_VALUE_SS_NOT_CONFIGURED, + + /// The device is configured. + WCN_VALUE_SS_CONFIGURED, + } + + /// + /// The WCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE structure contains information that identifies the device type by category, + /// sub-category, and a manufacturer specific OUI (Organization ID). + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wcntypes/ns-wcntypes-wcn_value_type_primary_device_type typedef struct + // tagWCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE { WCN_VALUE_TYPE_DEVICE_TYPE_CATEGORY Category; WCN_VALUE_TYPE_DEVICE_TYPE_SUBCATEGORY_OUI + // SubCategoryOUI; WCN_VALUE_TYPE_DEVICE_TYPE_SUBCATEGORY SubCategory; } WCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE; + [PInvokeData("wcntypes.h", MSDNShortId = "NS:wcntypes.tagWCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE")] + [StructLayout(LayoutKind.Sequential)] + public struct WCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE + { + /// + /// Specifies the primary device type category. This data is supplied in network byte order. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_CATEGORY_COMPUTER 0x1 + /// Indicates a computer. + /// + /// + /// WCN_VALUE_DT_CATEGORY_INPUT_DEVICE 0x2 + /// Indicates an input device. + /// + /// + /// WCN_VALUE_DT_CATEGORY_PRINTER 0x3 + /// Indicates a printer. + /// + /// + /// WCN_VALUE_DT_CATEGORY_CAMERA 0x4 + /// Indicates a camera. + /// + /// + /// WCN_VALUE_DT_CATEGORY_STORAGE 0x5 + /// Indicates a storage device. + /// + /// + /// WCN_VALUE_DT_CATEGORY_NETWORK_INFRASTRUCTURE 0x6 + /// Indicates a network. + /// + /// + /// WCN_VALUE_DT_CATEGORY_DISPLAY 0x7 + /// Indicates a display. + /// + /// + /// WCN_VALUE_DT_CATEGORY_MULTIMEDIA_DEVICE 0x8 + /// Indicates a multimedia device. + /// + /// + /// WCN_VALUE_DT_CATEGORY_GAMING_DEVICE 0x9 + /// Indicates a gaming device. + /// + /// + /// WCN_VALUE_DT_CATEGORY_TELEPHONE 0xa + /// Indicates a telephone. + /// + /// + /// WCN_VALUE_DT_CATEGORY_AUDIO_DEVICE 0xb + /// Indicates an audio device. + /// + /// + /// WCN_VALUE_DT_CATEGORY_OTHER 0xff + /// Indicates an unspecified device. + /// + /// + /// + public WCN_VALUE_TYPE_DEVICE_TYPE_CATEGORY Category; + + /// + /// Specifies the unique manufacturer OUI associated with the device. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_WIFI_OUI 0x50f204 + /// Indicates the specific manufacturer Organization ID (OUI) for a wireless device. + /// + /// + /// + public WCN_VALUE_TYPE_DEVICE_TYPE_SUBCATEGORY_OUI SubCategoryOUI; + + /// + /// + /// Specifies the primary device type sub-category. This data is supplied in network byte order. If SubCategoryOUI is + /// equal to WCN_VALUE_DT_SUBTYPE_WIFI_OUI, then any of the values below are valid. Otherwise, the SubCategory has been + /// defined by the vendor. + /// + /// The following values are possible when the Category member is set to WCN_VALUE_DT_CATEGORY_COMPUTER. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_COMPUTER_PC 0x1 + /// Indicates a personal computer. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_COMPUTER_SERVER 0x2 + /// Indicates a server. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_COMPUTER_MEDIACENTER 0x3 + /// Indicates a media center. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_COMPUTER_ULTRAMOBILEPC 0x4 + /// Indicates an Ultra-Mobile PC. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_COMPUTER_NOTEBOOK 0x5 + /// Indicates a notebook computer. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_COMPUTER_DESKTOP 0x6 + /// Indicates a desktop computer. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_COMPUTER_MID 0x7 + /// Indicates a mobile Internet device. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_COMPUTER_NETBOOK 0x8 + /// Indicates a netbook. + /// + /// + /// The following values are possible when the Category member is set to WCN_VALUE_DT_CATEGORY_INPUT_DEVICE. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_KEYBOARD 0x1 + /// Indicates a keyboard. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_MOUSE 0x2 + /// Indicates a mouse. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_JOYSTICK 0x3 + /// Indicates a joystick. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_TRACKBALL 0x4 + /// Indicates a trackball. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_GAMECONTROLLER 0x5 + /// Indicates a game controller. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_REMOTE 0x6 + /// Indicates a remote control. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_TOUCHSCREEN 0x7 + /// Indicates a touch screen. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_BIOMETRICREADER 0x8 + /// Indicates a biometric reader. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE_BARCODEREADER 0x9 + /// Indicates a barcode reader. + /// + /// + /// The following values are possible when the Category member is set to WCN_VALUE_DT_CATEGORY_PRINTER. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_PRINTER_PRINTER 0x1 + /// Indicates a printer. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_PRINTER_SCANNER 0x2 + /// Indicates a scanner. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_PRINTER_FAX 0x3 + /// Indicates a fax machine. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_PRINTER_COPIER 0x4 + /// Indicates a copier. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_PRINTER_ALLINONE 0x4 + /// Indicates an all-in-one printer. + /// + /// + /// The following values are possible when the Category member is set to WCN_VALUE_DT_CATEGORY_CAMERA. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_CAMERA_STILL_CAMERA 0x1 + /// Indicates a still-shot camera. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_CAMERA_VIDEO_CAMERA 0x2 + /// Indicates a video camera. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_CAMERA_WEB_CAMERA 0x3 + /// Indicates a web camera. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_CAMERA_SECURITY_CAMERA 0x4 + /// Indicates a security camera. + /// + /// + /// The following values are possible when the Category member is set to WCN_VALUE_DT_CATEGORY_NETWORK_STORAGE. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_STORAGE_NAS 0x1 + /// Indicates a network storage device. + /// + /// + /// The following values are possible when the Category member is set to WCN_VALUE_DT_CATEGORY_NETWORK_INFRASTRUCTURE. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE_AP 0x1 + /// Indicates an access point. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE_ROUTER 0x2 + /// Indicates a router. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE_SWITCH 0x3 + /// Indicates a switch. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE_GATEWAY 0x4 + /// Indicates a gateway. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE_BRIDGE 0x5 + /// Indicates a bridge. + /// + /// + /// The following values are possible when the Category member is set to WCN_VALUE_DT_CATEGORY_DISPLAY. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_DISPLAY_TELEVISION 0x1 + /// Indicates a television. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_DISPLAY_PICTURE_FRAME 0x2 + /// Indicates an electronic picture frame. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_DISPLAY_PROJECTOR 0x3 + /// Indicates a digital projector. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_DISPLAY_MONITOR 0x4 + /// Indicates a monitor. + /// + /// + /// The following values are possible when the Category member is set to WCN_VALUE_DT_CATEGORY_MULTIMEDIA_DEVICE. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_DAR 0x1 + /// Indicates a digital audio recorder. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_PVR 0x2 + /// Indicates a personal video recorder. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_MCX 0x3 + /// Indicates a Yamaha Digital Multimedia Receiver. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_SETTOPBOX 0x4 + /// Indicates a set-top box. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_MEDIA_SERVER_ADAPT_EXT 0x5 + /// Indicates a media server, media adapter, or media extender. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE_PVP 0x6 + /// Indicates a portable video player. + /// + /// + /// The following values are possible when the Category member is set to WCN_VALUE_DT_CATEGORY_GAMING_DEVICE. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE_XBOX 0x1 + /// Indicates a Microsoft XBOX console. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE_XBOX360 0x2 + /// Indicates a Microsoft XBOX 360 console. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE_PLAYSTATION 0x3 + /// Indicates a Sony Playstation 3. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE_CONSOLE_ADAPT 0x4 + /// Indicates a game console adapter. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE_PORTABLE 0x5 + /// Indicates a portable gaming device. + /// + /// + /// The following values are possible when the Category member is set to WCN_VALUE_DT_CATEGORY_TELEPHONE. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_TELEPHONE_WINDOWS_MOBILE 0x1 + /// Indicates a Windows Mobile device. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_TELEPHONE_PHONE_SINGLEMODE 0x2 + /// Indicates a single-mode phone. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_TELEPHONE_PHONE_DUALMODE 0x3 + /// Indicates a dual-mode phone. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_TELEPHONE_PHONE_SMARTPHONE_SINGLEMODE 0x4 + /// Indicates a single-mode smartphone. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_TELEPHONE_PHONE_SMARTPHONE_DUALMODE 0x2 + /// Indicates a dual-mode smartphone. + /// + /// + /// The following values are possible when the Category member is set to WCN_VALUE_DT_CATEGORY_AUDIO_DEVICE. + /// + /// + /// Value + /// Meaning + /// + /// + /// WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_TUNER_RECEIVER 0x1 + /// Indicates an audio tuner/receiver. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_SPEAKERS 0x2 + /// Indicates speakers. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_PMP 0x2 + /// Indicates a personal media player. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_HEADSET 0x2 + /// Indicates a headset. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_HEADPHONES 0x2 + /// Indicates headphones. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_MICROPHONE 0x2 + /// Indicates a microphone. + /// + /// + /// WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE_HOMETHEATER 0x2 + /// Indicates a home theater system. + /// + /// + /// + public WCN_VALUE_TYPE_DEVICE_TYPE_SUBCATEGORY SubCategory; + } + } +} \ No newline at end of file diff --git a/Vanara.sln b/Vanara.sln index 2ce67365..32a28d96 100644 --- a/Vanara.sln +++ b/Vanara.sln @@ -299,6 +299,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Version", "UnitTests\PInvok EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vanara.PInvoke.RstrtMgr", "PInvoke\RstrtMgr\Vanara.PInvoke.RstrtMgr.csproj", "{6FFDB484-24E0-4338-B816-D9975AF35853}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vanara.PInvoke.FunDisc", "PInvoke\FunDisc\Vanara.PInvoke.FunDisc.csproj", "{D0CD8393-BE38-4B9D-911F-C372293EF62D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vanara.PInvoke.WcnApi", "PInvoke\WcnApi\Vanara.PInvoke.WcnApi.csproj", "{55952C51-B68B-432E-A168-4ADD569B9274}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -967,6 +971,18 @@ Global {6FFDB484-24E0-4338-B816-D9975AF35853}.DebugNoTests|Any CPU.Build.0 = Debug|Any CPU {6FFDB484-24E0-4338-B816-D9975AF35853}.Release|Any CPU.ActiveCfg = Release|Any CPU {6FFDB484-24E0-4338-B816-D9975AF35853}.Release|Any CPU.Build.0 = Release|Any CPU + {D0CD8393-BE38-4B9D-911F-C372293EF62D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0CD8393-BE38-4B9D-911F-C372293EF62D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0CD8393-BE38-4B9D-911F-C372293EF62D}.DebugNoTests|Any CPU.ActiveCfg = Debug|Any CPU + {D0CD8393-BE38-4B9D-911F-C372293EF62D}.DebugNoTests|Any CPU.Build.0 = Debug|Any CPU + {D0CD8393-BE38-4B9D-911F-C372293EF62D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0CD8393-BE38-4B9D-911F-C372293EF62D}.Release|Any CPU.Build.0 = Release|Any CPU + {55952C51-B68B-432E-A168-4ADD569B9274}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55952C51-B68B-432E-A168-4ADD569B9274}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55952C51-B68B-432E-A168-4ADD569B9274}.DebugNoTests|Any CPU.ActiveCfg = Debug|Any CPU + {55952C51-B68B-432E-A168-4ADD569B9274}.DebugNoTests|Any CPU.Build.0 = Debug|Any CPU + {55952C51-B68B-432E-A168-4ADD569B9274}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55952C51-B68B-432E-A168-4ADD569B9274}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1097,6 +1113,8 @@ Global {460964A8-894C-45A1-AFA5-EF2DA3FC436D} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} {6C2D8577-ECEF-4E07-B4D7-CBFFD7BB6F53} = {385CAD2D-0A5E-4F80-927B-D5499D126B90} {6FFDB484-24E0-4338-B816-D9975AF35853} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} + {D0CD8393-BE38-4B9D-911F-C372293EF62D} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} + {55952C51-B68B-432E-A168-4ADD569B9274} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {543FAC75-2AF1-4EF1-9609-B242B63FEED4}