using System; using System.Linq; using System.Runtime.InteropServices; using Vanara.Extensions; using Vanara.InteropServices; #pragma warning disable IDE1006 // Naming Styles namespace Vanara.PInvoke { /// Functions, structures and constants from wlanapi.h. public static partial class WlanApi { private const int DOT11_RATE_SET_MAX_LENGTH = 126; private const int DOT11_SSID_MAX_LENGTH = 32; private const int WLAN_MAX_NAME_LENGTH = 256; private const int WLAN_MAX_PHY_INDEX = 64; private const int WLAN_MAX_PHY_TYPE_NUMBER = 8; /// /// The DOT11_AUTH_CIPHER_PAIR structure defines a pair of 802.11 authentication and cipher algorithms that can be enabled at /// the same time on the 802.11 station. /// /// /// The DOT11_AUTH_CIPHER_PAIR structure defines an authentication and cipher algorithm that can be enabled together for basic /// service set (BSS) network connections. /// // https://docs.microsoft.com/en-us/windows/win32/nativewifi/dot11-auth-cipher-pair typedef struct _DOT11_AUTH_CIPHER_PAIR { // DOT11_AUTH_ALGORITHM AuthAlgoId; DOT11_CIPHER_ALGORITHM CipherAlgoId; } DOT11_AUTH_CIPHER_PAIR, *PDOT11_AUTH_CIPHER_PAIR; [PInvokeData("windot11.h", MSDNShortId = "5fbe23f6-7902-46d4-a1f0-57f045d78662")] [StructLayout(LayoutKind.Sequential)] public struct DOT11_AUTH_CIPHER_PAIR { /// An authentication algorithm that uses a DOT11_AUTH_ALGORITHM enumerated type. public DOT11_AUTH_ALGORITHM AuthAlgoId; /// A cipher algorithm that uses a DOT11_CIPHER_ALGORITHM enumerated type. public DOT11_CIPHER_ALGORITHM CipherAlgoId; } /// The DOT11_BSSID_LIST structure contains a list of basic service set (BSS) identifiers. // https://docs.microsoft.com/en-us/windows/win32/nativewifi/dot11-bssid-list typedef struct _DOT11_BSSID_LIST { NDIS_OBJECT_HEADER // Header; ULONG uNumOfEntries; ULONG uTotalNumOfEntries; DOT11_MAC_ADDRESS BSSIDs[1]; } DOT11_BSSID_LIST, *PDOT11_BSSID_LIST; [PInvokeData("windot11.h", MSDNShortId = "22907f94-1ae8-4938-a816-b406656256c0")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(uTotalNumOfEntries))] [StructLayout(LayoutKind.Sequential)] public struct DOT11_BSSID_LIST { /// /// An NDIS_OBJECT_HEADER structure that contains the type, version, and, size information of an NDIS structure. For most /// DOT11_BSSID_LIST structures, set the Type member to NDIS_OBJECT_TYPE_DEFAULT, set the Revision /// member to DOT11_BSSID_LIST_REVISION_1, and set the Size member to sizeof(DOT11_BSSID_LIST). /// public NDIS_OBJECT_HEADER Header; /// The number of entries in this structure. public uint uNumOfEntries; /// The total number of entries supported. public uint uTotalNumOfEntries; /// A list of BSS identifiers. A BSS identifier is stored as a DOT11_MAC_ADDRESS type. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DOT11_MAC_ADDRESS[] BSSIDs; } /// Supported country or region strings. [PInvokeData("wlanapi.h", MSDNShortId = "64343c1f-3543-406f-a64c-94196b8aa17e")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct DOT11_COUNTRY_OR_REGION_STRING { /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 3)] public string Value; } /// The DOT11_MAC_ADDRESS types are used to define an IEEE media access control (MAC) address. // https://docs.microsoft.com/en-us/windows/win32/nativewifi/dot11-mac-address-type [PInvokeData("Windot11.h", MSDNShortId = "c1335127-a2d2-4f44-a895-1abbc5eaf98d")] public struct DOT11_MAC_ADDRESS { /// A MAC address in unicast, multicast, or broadcast format. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] ucDot11MacAddress; /// public override string ToString() => string.Join(":", Array.ConvertAll(ucDot11MacAddress, b => b.ToString("X2"))); } /// The DOT11_NETWORK structure contains information about an available wireless network. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-dot11_network typedef struct _DOT11_NETWORK { DOT11_SSID // dot11Ssid; DOT11_BSS_TYPE dot11BssType; } DOT11_NETWORK, *PDOT11_NETWORK; [PInvokeData("wlanapi.h", MSDNShortId = "95f58433-deef-4c47-8f6c-a9e7b0d52dad")] [StructLayout(LayoutKind.Sequential)] public struct DOT11_NETWORK { /// A DOT11_SSID structure that contains the SSID of a visible wireless network. public DOT11_SSID dot11Ssid; /// A DOT11_BSS_TYPE value that indicates the BSS type of the network. public DOT11_BSS_TYPE dot11BssType; } /// A DOT11_SSID structure contains the SSID of an interface. /// /// /// The SSID that is specified by the ucSSID member is not a null-terminated ASCII string. The length of the SSID is /// determined by the uSSIDLength member. /// /// /// A wildcard SSID is an SSID whose uSSIDLength member is set to zero. When the desired SSID is set to the wildcard SSID, /// the 802.11 station can connect to any basic service set (BSS) network. /// /// // https://docs.microsoft.com/en-us/windows/win32/nativewifi/dot11-ssid typedef struct _DOT11_SSID { ULONG uSSIDLength; UCHAR // ucSSID[DOT11_SSID_MAX_LENGTH]; } DOT11_SSID, *PDOT11_SSID; [PInvokeData("wlantypes.h", MSDNShortId = "f2b15ef9-99ee-4505-8575-224112024d7a")] [StructLayout(LayoutKind.Sequential)] public struct DOT11_SSID { /// The length, in bytes, of the ucSSID array. public uint uSSIDLength; /// The SSID. DOT11_SSID_MAX_LENGTH is set to 32. [MarshalAs(UnmanagedType.ByValArray, SizeConst = DOT11_SSID_MAX_LENGTH)] public byte[] ucSSID; } /// The EAP_METHOD_TYPE structure contains type, identification, and author information about an EAP method. // https://docs.microsoft.com/en-us/windows/win32/api/eaptypes/ns-eaptypes-eap_method_type typedef struct _EAP_METHOD_TYPE { // EAP_TYPE eapType; DWORD dwAuthorId; } EAP_METHOD_TYPE; [PInvokeData("eaptypes.h", MSDNShortId = "47702dd9-d9c2-4dd5-a12d-23a55b031d27")] [StructLayout(LayoutKind.Sequential)] public struct EAP_METHOD_TYPE { /// EAP_TYPE structure that contains the ID for the EAP method as well as specific vendor information. public EAP_TYPE eapType; /// The numeric ID for the author of the EAP method. public uint dwAuthorId; } /// The EAP_TYPE structure contains type and vendor identification information for an EAP method. // https://docs.microsoft.com/en-us/windows/win32/api/eaptypes/ns-eaptypes-eap_type typedef struct _EAP_TYPE { BYTE type; DWORD // dwVendorId; DWORD dwVendorType; } EAP_TYPE; [PInvokeData("eaptypes.h", MSDNShortId = "383f1e11-2e40-45e6-8c55-a23d1b8eb71f")] [StructLayout(LayoutKind.Sequential)] public struct EAP_TYPE { /// /// The numeric type code for this EAP method. /// Note For more information on the allocation of EAP method types, see section 6.2 of RFC 3748. /// public byte type; /// The vendor ID for the EAP method. public uint dwVendorId; /// The numeric type code for the vendor of this EAP method. public uint dwVendorType; } /// /// The NDIS_OBJECT_HEADER structure packages the object type, version, and size information that is required in many NDIS /// 6.0 structures. /// // https://docs.microsoft.com/en-us/windows/win32/nativewifi/ndis-object-header typedef struct _NDIS_OBJECT_HEADER { UCHAR Type; // UCHAR Revision; USHORT Size; } NDIS_OBJECT_HEADER, *PNDIS_OBJECT_HEADER; [PInvokeData("Ntddndis.h", MSDNShortId = "0dfb6022-1d8d-4bd9-bde3-2ee6d683f223")] [StructLayout(LayoutKind.Sequential)] public struct NDIS_OBJECT_HEADER { /// Specifies the type of NDIS object that a structure describes. public byte Type; /// Specifies the revision number of this structure. public byte Revision; /// /// Specifies the total size, in bytes, of the NDIS structure that contains the NDIS_OBJECT_HEADER. This size includes /// the size of the NDIS_OBJECT_HEADER member and all other members of the structure. /// public ushort Size; } /// The ONEX_AUTH_PARAMS structure contains 802.1X authentication parameters used for 802.1X authentication. /// /// /// The ONEX_AUTH_PARAMS structure is used by the 802.1X module, a new wireless configuration component supported on Windows /// Vista and later. /// /// /// The ONEX_RESULT_UPDATE_DATA contains information on a status change to 802.1X authentication. The ONEX_RESULT_UPDATE_DATA /// structure is returned when the NotificationSource member of the WLAN_NOTIFICATION_DATA structure is /// WLAN_NOTIFICATION_SOURCE_ONEX and the NotificationCode member of the WLAN_NOTIFICATION_DATA structure for /// received notification is OneXNotificationTypeResultUpdate. For this notification, the pData member of the /// WLAN_NOTIFICATION_DATA structure points to an ONEX_RESULT_UPDATE_DATA structure that contains information on the /// 802.1X authentication status change. /// /// /// If the fOneXAuthParams member in the ONEX_RESULT_UPDATE_DATA structure is set, then the authParams member of the /// ONEX_RESULT_UPDATE_DATA structure contains an ONEX_VARIABLE_BLOB structure with an ONEX_AUTH_PARAMS structure /// embedded starting at the dwOffset member of the ONEX_VARIABLE_BLOB. /// /// /// For security reasons, the hUserToken and OneXUserProfile members of the ONEX_AUTH_PARAMS structure returned /// in the authParams member are always set to NULL. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/dot1x/ns-dot1x-onex_auth_params typedef struct _ONEX_AUTH_PARAMS { BOOL // fUpdatePending; ONEX_VARIABLE_BLOB oneXConnProfile; ONEX_AUTH_IDENTITY authIdentity; DWORD dwQuarantineState; DWORD fSessionId : // 1; DWORD fhUserToken : 1; DWORD fOnexUserProfile : 1; DWORD fIdentity : 1; DWORD fUserName : 1; DWORD fDomain : 1; DWORD // dwSessionId; HANDLE hUserToken; ONEX_VARIABLE_BLOB OneXUserProfile; ONEX_VARIABLE_BLOB Identity; ONEX_VARIABLE_BLOB UserName; // ONEX_VARIABLE_BLOB Domain; } ONEX_AUTH_PARAMS, *PONEX_AUTH_PARAMS; [PInvokeData("dot1x.h", MSDNShortId = "a5dcd546-abe5-4553-baa8-656d37b263a3")] [StructLayout(LayoutKind.Sequential)] public struct ONEX_AUTH_PARAMS { /// Indicates if a status update is pending for 802.X authentication. [MarshalAs(UnmanagedType.Bool)] public bool fUpdatePending; /// /// The 802.1X authentication connection profile. This member contains an embedded ONEX_CONNECTION_PROFILE structure starting at /// the dwOffset member of the ONEX_VARIABLE_BLOB. /// public ONEX_VARIABLE_BLOB oneXConnProfile; /// The identity used for 802.1X authentication status. This member is a value from the ONEX_AUTH_IDENTITY enumeration. public ONEX_AUTH_IDENTITY authIdentity; /// /// The quarantine isolation state value of the local computer. The isolation state determines its network connectivity. This /// member corresponds to a value from the EAPHost ISOLATION_STATE enumeration. /// public uint dwQuarantineState; private uint flags; /// Indicates if the ONEX_AUTH_PARAMS structure contains a session ID in the dwSessionId member. public bool fSessionId { get => BitHelper.GetBit(flags, 0); set => BitHelper.SetBit(ref flags, 0, value); } /// /// Indicates if the ONEX_AUTH_PARAMS structure contains a user token handle in the hUserToken member. /// /// For security reasons, the hUserToken member of the ONEX_AUTH_PARAMS structure returned in the /// authParams member of the ONEX_RESULT_UPDATE_DATA structure is always set to NULL. /// /// public bool fhUserToken { get => BitHelper.GetBit(flags, 1); set => BitHelper.SetBit(ref flags, 1, value); } /// /// Indicates if the ONEX_AUTH_PARAMS structure contains an 802.1X user profile in the OneXUserProfile member. /// /// For security reasons, the OneXUserProfile member of the ONEX_AUTH_PARAMS structure returned in the /// authParams member of the ONEX_RESULT_UPDATE_DATA structure is always set to NULL. /// /// public bool fOnexUserProfile { get => BitHelper.GetBit(flags, 2); set => BitHelper.SetBit(ref flags, 2, value); } /// Indicates if the ONEX_AUTH_PARAMS structure contains an 802.1X identity in the Identity member. public bool fIdentity { get => BitHelper.GetBit(flags, 3); set => BitHelper.SetBit(ref flags, 3, value); } /// /// Indicates if the ONEX_AUTH_PARAMS structure contains a user name used for 802.1X authentication in the /// UserName member. /// public bool fUserName { get => BitHelper.GetBit(flags, 4); set => BitHelper.SetBit(ref flags, 4, value); } /// /// Indicates if the ONEX_AUTH_PARAMS structure contains a domain used for 802.1X authentication in the Domain member. /// public bool fDomain { get => BitHelper.GetBit(flags, 5); set => BitHelper.SetBit(ref flags, 5, value); } /// /// The session ID of the user currently logged on to the console. This member corresponds to the value returned by the /// WTSGetActiveConsoleSessionId function. This member contains a session ID if the fSessionId bitfield member is set. /// public uint dwSessionId; /// /// /// The user token handle used for 802.1X authentication. This member contains a user token handle if the fhUserToken /// bitfield member is set. /// /// /// For security reasons, the hUserToken member of the ONEX_AUTH_PARAMS structure returned in the /// authParams member of the ONEX_RESULT_UPDATE_DATA structure is always set to NULL. /// /// public IntPtr hUserToken; /// /// /// The 802.1X user profile used for 802.1X authentication. This member contains an embedded user profile starting at the /// dwOffset member of the ONEX_VARIABLE_BLOB if the fOneXUserProfile bitfield member is set. /// /// /// For security reasons, the OneXUserProfile member of the ONEX_AUTH_PARAMS structure returned in the /// authParams member of the ONEX_RESULT_UPDATE_DATA structure is always set to NULL. /// /// public ONEX_VARIABLE_BLOB OneXUserProfile; /// /// The 802.1X identity used for 802.1X authentication. This member contains a NULL-terminated Unicode string with the identity /// starting at the dwOffset member of the ONEX_VARIABLE_BLOB if the fIdentity bitfield member is set. /// public ONEX_VARIABLE_BLOB Identity; /// /// The user name used for 802.1X authentication. This member contains a NULL-terminated Unicode string with the user name /// starting at the dwOffset member of the ONEX_VARIABLE_BLOB if the fUserName bitfield member is set. /// public ONEX_VARIABLE_BLOB UserName; /// /// The domain used for 802.1X authentication. This member contains a NULL-terminated Unicode string with the domain starting at /// the dwOffset member of the ONEX_VARIABLE_BLOB if the fDomain bitfield member is set. /// public ONEX_VARIABLE_BLOB Domain; } /// /// The ONEX_CONNECTION_PROFILE structure contains information on the 802.1X connection profile currently used for 802.1X authentication. /// /// /// /// The ONEX_CONNECTION_PROFILE structure is used by the 802.1X module, a new wireless configuration component supported on /// Windows Vista and later. /// /// /// The ONEX_RESULT_UPDATE_DATA contains information on a status change to 802.1X authentication. The /// ONEX_RESULT_UPDATE_DATA structure is returned when the NotificationSource member of the /// WLAN_NOTIFICATION_DATA structure is WLAN_NOTIFICATION_SOURCE_ONEX and the NotificationCode member of the /// WLAN_NOTIFICATION_DATA structure for received notification is OneXNotificationTypeResultUpdate. For this /// notification, the pData member of the WLAN_NOTIFICATION_DATA structure points to an ONEX_RESULT_UPDATE_DATA /// structure that contains information on the 802.1X authentication status change. /// /// /// If the fOneXAuthParams member in the ONEX_RESULT_UPDATE_DATA structure is set, then the authParams member /// of the ONEX_RESULT_UPDATE_DATA structure contains an ONEX_VARIABLE_BLOB structure with an ONEX_AUTH_PARAMS /// structure embedded starting at the dwOffset member of the ONEX_VARIABLE_BLOB. The oneXConnProfile member of /// the ONEX_AUTH_PARAMS structure contains an ONEX_VARIABLE_BLOB structure with an ONEX_CONNECTION_PROFILE /// structure embedded starting at the dwOffset member of the ONEX_VARIABLE_BLOB. /// /// The ONEX_CONNECTION_PROFILE structure is not defined in a public header file. /// // https://docs.microsoft.com/en-us/windows/win32/nativewifi/onex-connection-profile typedef struct _ONEX_CONNECTION_PROFILE { DWORD // dwVersion; DWORD dwTotalLen; DWORD fOneXSupplicantFlags :1; DWORD fsupplicantMode :1; DWORD fauthMode :1; DWORD fHeldPeriod :1; // DWORD fAuthPeriod :1; DWORD fStartPeriod :1; DWORD fMaxStart :1; DWORD fMaxAuthFailures :1; DWORD fNetworkAuthTimeout :1; DWORD // fAllowLogonDialogs :1; DWORD fNetworkAuthWithUITimeout :1; DWORD fUserBasedVLan :1; DWORD dwOneXSupplicantFlags; // ONEX_SUPPLICANT_MODE supplicantMode; ONEX_AUTH_MODE authMode; DWORD dwHeldPeriod; DWORD dwAuthPeriod; DWORD dwStartPeriod; DWORD // dwMaxStart; DWORD dwMaxAuthFailures; DWORD dwNetworkAuthTimeout; DWORD dwNetworkAuthWithUITimeout; BOOL bAllowLogonDialogs; BOOL // bUserBasedVLan; } ONEX_CONNECTION_PROFILE, *PONEX_CONNECTION_PROFILE; [PInvokeData("", MSDNShortId = "ec494c74-bc79-445a-8889-a6f441e95ac5")] [StructLayout(LayoutKind.Sequential)] public struct ONEX_CONNECTION_PROFILE { /// The version of this ONEX_CONNECTION_PROFILE structure. public uint dwVersion; /// The length, in bytes, of this ONEX_CONNECTION_PROFILE structure. public uint dwTotalLen; private uint flags; /// /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the dwOneXSupplicantFlags member. /// public bool fOneXSupplicantFlags { get => BitHelper.GetBit(flags, 0); set => BitHelper.SetBit(ref flags, 0, value); } /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the supplicantMode member. public bool fsupplicantMode { get => BitHelper.GetBit(flags, 1); set => BitHelper.SetBit(ref flags, 1, value); } /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the authMode member. public bool fauthMode { get => BitHelper.GetBit(flags, 2); set => BitHelper.SetBit(ref flags, 2, value); } /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the dwHeldPeriod member. public bool fHeldPeriod { get => BitHelper.GetBit(flags, 3); set => BitHelper.SetBit(ref flags, 3, value); } /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the dwAuthPeriod member. public bool fAuthPeriod { get => BitHelper.GetBit(flags, 4); set => BitHelper.SetBit(ref flags, 4, value); } /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the dwStartPeriod member. public bool fStartPeriod { get => BitHelper.GetBit(flags, 5); set => BitHelper.SetBit(ref flags, 5, value); } /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the dwMaxStart member. public bool fMaxStart { get => BitHelper.GetBit(flags, 6); set => BitHelper.SetBit(ref flags, 6, value); } /// /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the dwMaxAuthFailures member. /// public bool fMaxAuthFailures { get => BitHelper.GetBit(flags, 7); set => BitHelper.SetBit(ref flags, 7, value); } /// /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the dwNetworkAuthTimeout member. /// public bool fNetworkAuthTimeout { get => BitHelper.GetBit(flags, 8); set => BitHelper.SetBit(ref flags, 8, value); } /// /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the bAllowLogonDialogs member. /// public bool fAllowLogonDialogs { get => BitHelper.GetBit(flags, 9); set => BitHelper.SetBit(ref flags, 9, value); } /// /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the dwNetworkAuthWithUITimeout member. /// public bool fNetworkAuthWithUITimeout { get => BitHelper.GetBit(flags, 10); set => BitHelper.SetBit(ref flags, 10, value); } /// Indicates if the ONEX_CONNECTION_PROFILE structure contains valid data in the bUserBasedVLan member. public bool fUserBasedVLan { get => BitHelper.GetBit(flags, 11); set => BitHelper.SetBit(ref flags, 11, value); } /// /// A set of 802.1X flags that can be present in the profile. These flags are reserved for internal use by the 802.1X /// authentication module. /// public uint dwOneXSupplicantFlags; /// /// /// The supplicantMode element in the 802.1X schema that specifies the method of transmission used for EAPOL-Start messages. For /// more information, see the supplicantMode (OneX) Element in the 802.1X scheme. /// /// /// /// Value /// Meaning /// /// /// OneXSupplicantModeInhibitTransmission 0 /// EAPOL-Start messages are not transmitted. Valid for wired LAN profiles only. /// /// /// OneXSupplicantModeLearn 1 /// /// The client determines when to send EAPOL-Start packets based on network capability. EAPOL-Start messages are only sent when /// required. Valid for wired LAN profiles only. /// /// /// /// OneXSupplicantModeCompliant 2 /// EAPOL-Start messages are transmitted as specified by 802.1X. Valid for both wired and wireless LAN profiles. /// /// /// public ONEX_SUPPLICANT_MODE supplicantMode; /// /// /// The authMode element in the 802.1X schema that specifies the type of credentials used for 802.1X authentication. For more /// information, see the authMode (OneX) Element in the 802.1X scheme. /// /// /// /// Value /// Meaning /// /// /// OneXAuthModeMachineOrUser 0 /// /// Use machine or user credentials. When a user is logged on, the user's credentials are used for authentication. When no user /// is logged on, machine credentials are used. /// /// /// /// OneXAuthModeMachineOnly 1 /// Use machine credentials only. /// /// /// OneXAuthModeUserOnly 2 /// Use user credentials only. /// /// /// OneXAuthModeGuest 3 /// Use guest (empty) credentials only. /// /// /// OneXAuthModeUnspecified 4 /// Credentials to use are not specified. /// /// /// public ONEX_AUTH_MODE authMode; /// /// The heldPeriod element in the 802.1X schema that specifies the length of time, in seconds, in which a client will not /// re-attempt authentication after a failed authentication attempt. For more information, see the heldPeriod (OneX) /// Element in the 802.1X scheme. /// public uint dwHeldPeriod; /// /// The authPeriod element in the 802.1X schema that specifies the maximum length of time, in seconds, in which a client waits /// for a response from the authenticator. If a response is not received within the specified period, the client assumes that /// there is no authenticator present on the network. For more information, see the authPeriod (OneX) Element in the /// 802.1X scheme. /// public uint dwAuthPeriod; /// /// The startPeriod element in the 802.1X schema that specifies the length of time, in seconds, to wait before an EAPOL-Start is /// sent. An EAPOL-Start message is sent to start the 802.1X authentication process. For more information, see the /// startPeriod (OneX) Element in the 802.1X scheme. /// public uint dwStartPeriod; /// /// The maxStart element in the 802.1X schema that specifies the maximum number of EAPOL-Start messages sent. After the maximum /// number of EAPOL-Start messages has been sent, the client assumes that there is no authenticator present on the network. For /// more information, see the maxStart (OneX) Element in the 802.1X scheme. /// public uint dwMaxStart; /// /// The maxAuthFailures element in the 802.1X schema that specifies the maximum number of authentication failures allowed for a /// set of credentials. For more information, see the maxAuthFailures (OneX) element in the 802.1X schema. /// public uint dwMaxAuthFailures; /// /// The time, in seconds, to wait for 802.1X authentication completion before normal logon proceeds. This value is used in /// single signon (SSO) scenarios. This value defaults to 10 seconds in an 802.1X profile. For more information, see the /// maxDelay (singleSignOn) Element in the 802.1X schema. /// public uint dwNetworkAuthTimeout; /// /// /// The maximum duration time, in seconds, to wait for a connection in case a user interface dialog box that requires user input /// is displayed during the per-logon SSO. /// /// /// On Windows Vista with SP1 and later, this value is hardcoded to 10 minutes and is not configurable. On Windows Vista Release /// to Manufacturing, this value defaults to 60 seconds in an 802.1X profile and was controlled by the /// maxDelayWithAdditionalDialogs element in the schema. /// /// /// On Windows Vista with SP1 and later, the maxDelayWithAdditionalDialogs element in the 802.1X schema is ignored and deprecated. /// /// public uint dwNetworkAuthWithUITimeout; /// /// A value that specifies whether to allow EAP dialogs to be displayed when using pre-logon SSO. For more information, see the /// allowAdditionalDialogs element in the 802.1X schema. /// [MarshalAs(UnmanagedType.Bool)] public bool bAllowLogonDialogs; /// /// The userBasedVirtualLan element in the 802.1X schema that specifies if the virtual LAN (VLAN) used by the device changes /// based on the user's credentials. Some network access server (NAS) devices change the VLAN after a user authenticates. When /// userBasedVirtualLan is TRUE, the NAS may change a device's VLAN after a user authenticates. For more information, see the /// userBasedVirtualLan (singleSignOn) Element in the 802.1X scheme. /// [MarshalAs(UnmanagedType.Bool)] public bool bUserBasedVLan; } /// The ONEX_EAP_ERROR structure contains 802.1X EAP error when an error occurs with 802.1X authentication. /// /// /// The ONEX_EAP_ERROR structure is used by the 802.1X module, a new wireless configuration component supported on Windows /// Vista and later. /// /// Many members of the ONEX_EAP_ERROR structure correspond with similar members in the EAP_ERROR structure /// /// The ONEX_RESULT_UPDATE_DATA contains information on a status change to 802.1X authentication. The ONEX_RESULT_UPDATE_DATA /// structure is returned when the NotificationSource member of the WLAN_NOTIFICATION_DATA structure is /// WLAN_NOTIFICATION_SOURCE_ONEX and the NotificationCode member of the WLAN_NOTIFICATION_DATA structure for /// received notification is OneXNotificationTypeResultUpdate. For this notification, the pData member of the /// WLAN_NOTIFICATION_DATA structure points to an ONEX_RESULT_UPDATE_DATA structure that contains information on the /// 802.1X authentication status change. /// /// /// If the fEapError member in the ONEX_RESULT_UPDATE_DATA structure is set, then the eapError member of the /// ONEX_RESULT_UPDATE_DATA structure contains an ONEX_VARIABLE_BLOB structure with an ONEX_EAP_ERROR structure /// embedded starting at the dwOffset member of the ONEX_VARIABLE_BLOB. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/dot1x/ns-dot1x-onex_eap_error typedef struct _ONEX_EAP_ERROR { DWORD // dwWinError; EAP_METHOD_TYPE type; DWORD dwReasonCode; GUID rootCauseGuid; GUID repairGuid; GUID helpLinkGuid; DWORD // fRootCauseString : 1; DWORD fRepairString : 1; ONEX_VARIABLE_BLOB RootCauseString; ONEX_VARIABLE_BLOB RepairString; } // ONEX_EAP_ERROR, *PONEX_EAP_ERROR; [PInvokeData("dot1x.h", MSDNShortId = "20126b9a-732e-460d-bb10-4d7485b25eb9")] [StructLayout(LayoutKind.Sequential)] public struct ONEX_EAP_ERROR { /// /// /// The error value defined in the Winerror.h header file. This member also sometimes contains the reason the EAP method failed. /// The existing values for this member for the reason the EAP method failed are defined in the Eaphosterror.h header file. /// /// Some possible values are listed below. /// /// /// Value /// Meaning /// /// /// ERROR_PATH_NOT_FOUND 3L /// The system cannot find the path specified. /// /// /// ERROR_INVALID_DATA 13L /// The data is not valid. /// /// /// ERROR_INVALID_PARAMETER 87L /// A parameter is incorrect. /// /// /// ERROR_BAD_ARGUMENTS 160L /// One or more arguments are not correct. /// /// /// ERROR_CANTOPEN 1011L /// The configuration registry key could not be opened. /// /// /// ERROR_DATATYPE_MISMATCH 1629L /// The data supplied is of the wrong type. /// /// /// EAP_I_USER_ACCOUNT_OTHER_ERROR 0x40420110 /// /// The EAPHost received EAP failure after the identity exchange. There is likely a problem with the authenticating user's account. /// /// /// /// E_UNEXPECTED 0x8000FFFFL /// A catastrophic failure occurred. /// /// /// EAP_E_CERT_STORE_INACCESSIBLE 0x80420010 /// The certificate store can't be accessed on either the authenticator or the peer. /// /// /// EAP_E_EAPHOST_METHOD_NOT_INSTALLED 0x80420011 /// The requested EAP method is not installed. /// /// /// EAP_E_EAPHOST_EAPQEC_INACCESSIBLE 0x80420013 /// /// The EAPHost is not able to communicate with the EAP quarantine enforcement client (QEC) on a client with Network Access /// Protection (NAP) enabled. /// /// /// /// EAP_E_EAPHOST_IDENTITY_UNKNOWN 0x80420014 /// The EAPHost returns this error if the authenticator fails the authentication after the peer sent its identity. /// /// /// EAP_E_AUTHENTICATION_FAILED 0x80420015 /// The EAPHost returns this error on authentication failure. /// /// /// EAP_I_EAPHOST_EAP_NEGOTIATION_FAILED 0x80420016 /// The EAPHost returns this error when the client and the server aren't configured with compatible EAP types. /// /// /// EAP_E_EAPHOST_METHOD_INVALID_PACKET 0x80420017 /// The EAPMethod received an EAP packet that cannot be processed. /// /// /// EAP_E_EAPHOST_REMOTE_INVALID_PACKET 0x80420018 /// The EAPHost received a packet that cannot be processed. /// /// /// EAP_E_EAPHOST_XML_MALFORMED 0x80420019 /// The EAPHost configuration schema validation failed. /// /// /// EAP_E_METHOD_CONFIG_DOES_NOT_SUPPORT_SSO 0x8042001A /// The EAP method does not support single signon for the provided configuration. /// /// /// EAP_E_EAPHOST_METHOD_OPERATION_NOT_SUPPORTED 0x80420020 /// The EAPHost returns this error when a configured EAP method does not support a requested operation (procedure call). /// /// /// EAP_E_USER_CERT_NOT_FOUND 0x80420100 /// The EAPHost could not find the user certificate for authentication. /// /// /// EAP_E_USER_CERT_INVALID 0x80420101 /// The user certificate being used for authentication does not have a proper extended key usage (EKU) set. /// /// /// EAP_E_USER_CERT_EXPIRED 0x80420102 /// The EAPhost found a user certificate which has expired. /// /// /// EAP_E_USER_CERT_REVOKED 0x80420103 /// The user certificate being used for authentication has been revoked. /// /// /// EAP_E_USER_CERT_OTHER_ERROR 0x80420104 /// An unknown error occurred with the user certificate being used for authentication. /// /// /// EAP_E_USER_CERT_REJECTED 0x80420105 /// The authenticator rejected the user certificate being used for authentication. /// /// /// EAP_E_USER_CREDENTIALS_REJECTED 0x80420111 /// The authenticator rejected the user credentials for authentication. /// /// /// EAP_E_USER_NAME_PASSWORD_REJECTED 0x80420112 /// The authenticator rejected the user credentials for authentication. /// /// /// EAP_E_NO_SMART_CARD_READER 0x80420113 /// No smart card reader was present. /// /// /// EAP_E_SERVER_CERT_INVALID 0x80420201 /// The server certificate being user for authentication does not have a proper EKU set . /// /// /// EAP_E_SERVER_CERT_EXPIRED 0x80420202 /// The EAPhost found a server certificate which has expired. /// /// /// EAP_E_SERVER_CERT_REVOKED 0x80420203 /// The server certificate being used for authentication has been revoked. /// /// /// EAP_E_SERVER_CERT_OTHER_ERROR 0x80420204 /// An unknown error occurred with the server certificate being used for authentication. /// /// /// EAP_E_USER_ROOT_CERT_NOT_FOUND 0x80420300 /// The EAPHost could not find a certificate in trusted root certificate store for user certificate validation. /// /// /// EAP_E_USER_ROOT_CERT_INVALID 0x80420301 /// The authentication failed because the root certificate used for this network is not valid. /// /// /// EAP_E_USER_ROOT_CERT_EXPIRED 0x80420302 /// The trusted root certificate needed for user certificate validation has expired. /// /// /// EAP_E_SERVER_ROOT_CERT_NOT_FOUND 0x80420400 /// The EAPHost could not find a root certificate in the trusted root certificate store for server certificate velidation. /// /// /// public Win32Error dwWinError; /// /// The EAP method type that raised the error during 802.1X authentication. The EAP_METHOD_TYPE structure is defined in the /// Eaptypes.h header file. /// public EAP_METHOD_TYPE type; /// /// /// The reason the EAP method failed. Some of the values for this member are defined in the Eaphosterror.h header file and some /// are defined in in the Winerror.h header file, although other values are possible. /// /// Possible values are listed below. /// /// /// Value /// Meaning /// /// /// ERROR_BAD_ARGUMENTS /// One or more arguments are not correct. /// /// /// ERROR_INVALID_DATA /// The data is not valid. /// /// /// ERROR_INVALID_PARAMETER /// A parameter is incorrect. /// /// /// EAP_I_USER_ACCOUNT_OTHER_ERROR /// /// The EAPHost received EAP failure after the identity exchange. There is likely a problem with the authenticating user's account. /// /// /// /// Other /// Use FormatMessage to obtain the message string for the returned error. /// /// /// public uint dwReasonCode; /// /// /// A unique ID that identifies cause of error in EAPHost. An EAP method can define a new GUID and associate the GUID with a /// specific root cause. The existing values for this member are defined in the Eaphosterror.h header file. /// /// /// /// Value /// Meaning /// /// /// GUID_EapHost_Default {0x00000000, 0x0000, 0x0000, 0, 0, 0, 0, 0, 0, 0, 0} /// /// The default error cause. This is not a fixed GUID when it reaches supplicant, but the first portion will be filled by a /// generic Win32/RAS error. This helps create a unique GUID for every unique error. /// /// /// /// GUID_EapHost_Cause_MethodDLLNotFound {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 1}} /// EAPHost cannot locate the DLL for the EAP method. /// /// /// GUID_EapHost_Cause_CertStoreInaccessible {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 4}} /// Both the authenticator and the peer are unable to access the certificate store. /// /// /// GUID_EapHost_Cause_Server_CertExpired {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 5}} /// EAPHost found an expired server certificate. /// /// /// GUID_EapHost_Cause_Server_CertInvalid {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 6}} /// The server certificate being user for authentication does not have a proper extended key usage (EKU) set. /// /// /// GUID_EapHost_Cause_Server_CertNotFound {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 7}} /// EAPHost could not find the server certificate for authentication. /// /// /// GUID_EapHost_Cause_Server_CertRevoked {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 8}} /// The server certificate being used for authentication has been revoked. /// /// /// GUID_EapHost_Cause_User_CertExpired {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 9}} /// EAPHost found an expired user certificate. /// /// /// GUID_EapHost_Cause_User_CertInvalid {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0xA}} /// The user certificate being user for authentication does not have proper extended key usage (EKU) set. /// /// /// GUID_EapHost_Cause_User_CertNotFound {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0xB}} /// EAPHost could not find a user certificate for authentication. /// /// /// GUID_EapHost_Cause_User_CertOtherError {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0xC}} /// An unknown error occurred with the user certification being used for authentication. /// /// /// GUID_EapHost_Cause_User_CertRejected {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0xD}} /// The authenticator rejected the user certification. /// /// /// GUID_EapHost_Cause_User_CertRevoked {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0xE}} /// The user certificate being used for authentication has been revoked. /// /// /// GUID_EapHost_Cause_User_Root_CertExpired {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0xF}} /// The trusted root certificate needed for user certificate validation has expired. /// /// /// GUID_EapHost_Cause_User_Root_CertInvalid {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x10}} /// The authentication failed because the root certificate used for this network is not valid. /// /// /// GUID_EapHost_Cause_User_Root_CertNotFound {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x11}} /// EAPHost could not find a certificate in a trusted root certificate store for user certification validation. /// /// /// GUID_EapHost_Cause_Server_Root_CertNameRequired {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x12}} /// The authentication failed because the certificate on the server computer does not have a server name specified. /// /// /// GUID_EapHost_Cause_EapNegotiationFailed {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x1C}} /// The authentication failed because Windows does not have the authentication method required for this network. /// /// /// GUID_EapHost_Cause_XmlMalformed {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x1D}} /// The EAPHost configuration schema validation failed. /// /// /// GUID_EapHost_Cause_MethodDoesNotSupportOperation {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x1E}} /// EAPHost returns this error when a configured EAP method does not support a requested operation (procedure call). /// /// /// GUID_EapHost_Cause_No_SmartCardReader_Found {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x2B}} /// /// A valid smart card needs to be present for authentication to be proceed. This GUID is supported on Windows Server 2008 R2 /// with the Wireless LAN Service installed and on Windows 7 . /// /// /// /// GUID_EapHost_Cause_Generic_AuthFailure {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 1, 4}} /// EAPHost returns this error on a generic, unspecified authentication failure. /// /// /// GUID_EapHost_Cause_Server_CertOtherError {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 1, 8}} /// An unknown error occurred with the server certificate. /// /// /// GUID_EapHost_Cause_User_Account_OtherProblem {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 1, 0xE}} /// /// An EAP failure was received after an identity exchange, indicating the likelihood of a problem with the authenticating /// user's account. /// /// /// /// GUID_EapHost_Cause_Server_Root_CertNotFound {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 1, 0x12}} /// EAPHost could not find a root certificate in a trusted root certificate store for the server certification validation. /// /// /// GUID_EapHost_Cause_IdentityUnknown {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 2, 4}} /// EAPHost returns this error if the authenticator fails the authentication after the peer identity was submitted. /// /// /// GUID_EapHost_Cause_User_CredsRejected {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 2, 0xE}} /// The authenticator rejected user credentials for authentication. /// /// /// GUID_EapHost_Cause_ThirdPartyMethod_Host_Reset {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 2, 0x12}} /// The host of the third party method is not responding and was automatically restarted. /// /// /// GUID_EapHost_Cause_EapQecInaccessible {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 3, 0x12}} /// /// EAPHost was not able to communicate with the EAP quarantine enforcement client (QEC) on a client with Network Access /// Protection (NAP) enabled. This error may occur when the NAP service is not responding. /// /// /// /// /// GUID_EapHost_Cause_Method_Config_Does_Not_Support_Sso {0xda18bd32, 0x004f, 0x41fa, {0xae, 0x08, 0x0b, 0xc8, 0x5e, 0x58, /// 0x45, 0xac}} /// /// /// The EAP method does not support single signon for the provided configuration data. This GUID is supported on Windows Server /// 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// public Guid rootCauseGuid; /// /// /// A unique ID that maps to a localizable string that identifies the repair action that can be taken to fix the reported error. /// The existing values for this member are defined in the Eaphosterror.h header file. /// /// /// /// Value /// Meaning /// /// /// GUID_EapHost_Repair_ContactSysadmin {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 2}} /// The user should contact the network administrator. /// /// /// GUID_EapHost_Repair_Server_ClientSelectServerCert {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x18}} /// The user should choose a different and valid certificate for authentication with this network. /// /// /// GUID_EapHost_Repair_User_AuthFailure {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x19}} /// /// The user should contact your network administrator. Your administrator can verify your user name and password for network authentication. /// /// /// /// GUID_EapHost_Repair_User_GetNewCert {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x1A}} /// /// The user should obtain an updated certificate from the network administrator. The certificate required to connect to this /// network can't be found on your computer. /// /// /// /// GUID_EapHost_Repair_User_SelectValidCert {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x1B}} /// The user should use a different and valid user certificate for authentication with the network. /// /// /// GUID_EapHost_Repair_ContactAdmin_AuthFailure {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x1F}} /// /// The user should contact your network administrator. Windows can't verify your identity for connection to this network. This /// GUID is supported on Windows Server 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// GUID_EapHost_Repair_ContactAdmin_IdentityUnknown {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x20}} /// /// The user should contact your network administrator. Windows can't verify your identity for connection to this network. This /// GUID is supported on Windows Windows Server 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// /// GUID_EapHost_Repair_ContactAdmin_NegotiationFailed {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x21}} /// /// /// The user should contact your network administrator. Windows needs to be configured to use the authentication method required /// for this network. This GUID is supported on Windows Server 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// GUID_EapHost_Repair_ContactAdmin_MethodNotFound {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x22}} /// /// The user should contact your network administrator. Windows needs to be configured to use the authentication method required /// for this network. This GUID is supported on Windows Windows Server 2008 R2 with the Wireless LAN Service installed and on /// Windows 7. /// /// /// /// GUID_EapHost_Repair_RestartNap {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x23}} /// /// The user should start the Network Access Protection service. The Network Access Protection service is not responding. Start /// or restart the Network Access Protection service, and then try connecting again. This GUID is supported on Windows Server /// 2008 R2 with the Wireless LAN Service installed and on Windows 7 . /// /// /// /// /// GUID_EapHost_Repair_ContactAdmin_CertStoreInaccessible {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x24}} /// /// /// The user should contact your network administrator. The certificate store on this computer needs to be repaired. This GUID /// is supported on Windows Windows Server 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// /// GUID_EapHost_Repair_ContactAdmin_InvalidUserAccount {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x25}} /// /// /// The user should contact your network administrator. A problem with your user account needs to be resolved. This GUID is /// supported on Windows Server 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// GUID_EapHost_Repair_ContactAdmin_RootCertInvalid {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x26}} /// /// The user should contact your network administrator. The root certificate used for this network needs to be repaired. This /// GUID is supported on Windows Server 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// GUID_EapHost_Repair_ContactAdmin_RootCertNotFound {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x27}} /// /// The user should contact your network administrator. The certificate used by the server for this network needs to be properly /// installed on your computer. This GUID is supported on Windows Server 2008 R2 with the Wireless LAN Service installed and on /// Windows 7. /// /// /// /// GUID_EapHost_Repair_ContactAdmin_RootExpired {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x28}} /// /// The user should contact your network administrator. The root certificate used for this network needs to be renewed. This /// GUID is supported on Windows Server 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// GUID_EapHost_Repair_ContactAdmin_CertNameAbsent {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x29}} /// /// The user should contact your network administrator. A problem with the server certificate used for this network needs to be /// resolved. This GUID is supported on Windows Server 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// /// GUID_EapHost_Repair_ContactAdmin_NoSmartCardReader {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x2A}} /// /// /// The user should connect a smart card reader to your computer, insert a smart card, and attempt to connect again. This GUID /// is supported on Windows Server 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// GUID_EapHost_Repair_ContactAdmin_InvalidUserCert {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x2C}} /// /// The user should contact your network administrator. The user certificate on this computer needs to be repaired. This GUID is /// supported on Windows Server 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// GUID_EapHost_Repair_Method_Not_Support_Sso {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x2D}} /// /// The user should contact your network administrator. Windows needs to be configured to use the authentication method required /// for this network. This GUID is supported on Windows Server 2008 R2 with the Wireless LAN Service installed and on Windows 7. /// /// /// /// GUID_EapHost_Repair_Retry_Authentication {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 1, 0x1B}} /// The user should try to connect to the network again. /// /// /// public Guid repairGuid; /// /// /// A unique ID that maps to a localizable string that specifies an URL for a page that contains additional information about an /// error or repair message. An EAP method can potentially define a new GUID and associate with one specific help link. Some of /// the existing values for this member are defined in the Eaphosterror.h header file. /// /// /// /// Value /// Meaning /// /// /// GUID_EapHost_Help_Troubleshooting {0x33307acf, 0x0698, 0x41ba, {0xb0, 0x14, 0xea, 0x0a, 0x2e, 0xb8, 0xd0, 0xa8}} /// /// The URL for the page with more information about troubleshooting. This currently is a generic networking troubleshooting /// help page, not EAP specific. /// /// /// /// GUID_EapHost_Help_EapConfigureTypes {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x03}} /// The URL for the page with more information about configuring EAP types. /// /// /// GUID_EapHost_Help_FailedAuth {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x13}} /// The URL for the page with more information about authentication failures. This GUID is supported on Windows Vista /// /// /// GUID_EapHost_Help_SelectingCerts {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x15}} /// The URL for the page with more information about selecting the appropriate certificate to use for authentication. /// /// /// GUID_EapHost_Help_SetupEapServer {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x16}} /// The URL for the page with more information about setting up an EAP server. This GUID is supported on Windows Vista /// /// /// GUID_EapHost_Help_Troubleshooting {0x9612fc67, 0x6150, 0x4209, {0xa8, 0x5e, 0xa8, 0xd8, 0, 0, 0, 0x17}} /// The URL for the page with more information about troubleshooting. This GUID is supported on Windows Vista /// /// /// GUID_EapHost_Help_ObtainingCerts {0xf535eea3, 0x1bdd, 0x46ca, {0xa2, 0xfc, 0xa6, 0x65, 0x59, 0x39, 0xb7, 0xe8}} /// The URL for the page with more information about getting EAP certificates. /// /// /// public Guid helpLinkGuid; private uint flags; /// /// Indicates if the ONEX_EAP_ERROR structure contains a root cause string in the RootCauseString member. /// public bool fRootCauseString { get => BitHelper.GetBit(flags, 0); set => BitHelper.SetBit(ref flags, 0, value); } /// Indicates if the ONEX_EAP_ERROR structure contains a repair string in the RepairString member. public bool fRepairString { get => BitHelper.GetBit(flags, 1); set => BitHelper.SetBit(ref flags, 1, value); } /// /// A localized and readable string that describes the root cause of the error. This member contains a NULL-terminated Unicode /// string starting at the dwOffset member of the ONEX_VARIABLE_BLOB if the fRootCauseString bitfield member is set. /// public ONEX_VARIABLE_BLOB RootCauseString; /// /// A localized and readable string that describes the possible repair action. This member contains a NULL-terminated Unicode /// string starting at the dwOffset member of the ONEX_VARIABLE_BLOB if the fRepairString bitfield member is set. /// public ONEX_VARIABLE_BLOB RepairString; } /// The ONEX_RESULT_UPDATE_DATA structure contains information on a status change to 802.1X authentication. /// /// /// The ONEX_RESULT_UPDATE_DATA structure is used by the 802.1X module, a new wireless configuration component supported on /// Windows Vista and later. /// /// /// The ONEX_RESULT_UPDATE_DATA contains information on a status change to 802.1X authentication.This structure is returned /// when the NotificationSource member of the WLAN_NOTIFICATION_DATA structure is WLAN_NOTIFICATION_SOURCE_ONEX and /// the NotificationCode member of the WLAN_NOTIFICATION_DATA structure for received notification is /// OneXNotificationTypeResultUpdate. For this notification, the pData member of the WLAN_NOTIFICATION_DATA /// structure points to an ONEX_RESULT_UPDATE_DATA structure that contains information on the 802.1X authentication status change. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/dot1x/ns-dot1x-onex_result_update_data typedef struct _ONEX_RESULT_UPDATE_DATA // { ONEX_STATUS oneXStatus; ONEX_EAP_METHOD_BACKEND_SUPPORT BackendSupport; BOOL fBackendEngaged; DWORD fOneXAuthParams : 1; DWORD // fEapError : 1; ONEX_VARIABLE_BLOB authParams; ONEX_VARIABLE_BLOB eapError; } ONEX_RESULT_UPDATE_DATA, *PONEX_RESULT_UPDATE_DATA; [PInvokeData("dot1x.h", MSDNShortId = "140386c8-2e35-4e83-812f-119bf8828d0b")] [StructLayout(LayoutKind.Sequential)] public struct ONEX_RESULT_UPDATE_DATA { /// Specifies the current 802.1X authentication status. For more information, see the ONEX_STATUS structure. public ONEX_STATUS oneXStatus; /// /// Indicates if the configured EAP method on the supplicant is supported on the 802.1X authentication server. /// /// EAP permits the use of a backend authentication server, which may implement some or all authentication methods, with the /// authenticator acting as a pass-through for some or all methods and peers. For more information, see RFC 3748 published by /// the IETF and the ONEX_EAP_METHOD_BACKEND_SUPPORT enumeration. /// /// public ONEX_EAP_METHOD_BACKEND_SUPPORT BackendSupport; /// Indicates if a response was received from the 802.1X authentication server. [MarshalAs(UnmanagedType.Bool)] public bool fBackendEngaged; private uint flags; /// /// Indicates if the ONEX_RESULT_UPDATE_DATA structure contains 802.1X authentication parameters in the authParams member. /// public bool fOneXAuthParams { get => BitHelper.GetBit(flags, 0); set => BitHelper.SetBit(ref flags, 0, value); } /// Indicates if the ONEX_RESULT_UPDATE_DATA structure contains an EAP error in the eapError member. public bool fEapError { get => BitHelper.GetBit(flags, 1); set => BitHelper.SetBit(ref flags, 1, value); } /// /// The 802.1X authentication parameters. This member contains an embedded ONEX_AUTH_PARAMS structure starting at the /// dwOffset member of the ONEX_VARIABLE_BLOB if the fOneXAuthParams bitfield member is set. /// public ONEX_VARIABLE_BLOB authParams; /// /// An EAP error value. This member contains an embedded ONEX_EAP_ERROR structure starting at the dwOffset member of the /// ONEX_VARIABLE_BLOB if the fEapError bitfield member is set. /// public ONEX_VARIABLE_BLOB eapError; } /// The ONEX_STATUS structure contains the current 802.1X authentication status. /// /// /// The ONEX_STATUS structure is used by the 802.1X module, a new wireless configuration component supported on Windows Vista /// and later. /// /// /// The ONEX_RESULT_UPDATE_DATA contains information on a status change to 802.1X authentication. The ONEX_RESULT_UPDATE_DATA /// structure is returned when the NotificationSource member of the WLAN_NOTIFICATION_DATA structure is /// WLAN_NOTIFICATION_SOURCE_ONEX and the NotificationCode member of the WLAN_NOTIFICATION_DATA structure for /// received notification is OneXNotificationTypeResultUpdate. For this notification, the pData member of the /// WLAN_NOTIFICATION_DATA structure points to an ONEX_RESULT_UPDATE_DATA structure that contains information on the /// 802.1X authentication status change. /// /// The oneXStatus member of the ONEX_RESULT_UPDATE_DATA structure contains an ONEX_STATUS structure. /// // https://docs.microsoft.com/en-us/windows/win32/api/dot1x/ns-dot1x-onex_status typedef struct _ONEX_STATUS { ONEX_AUTH_STATUS // authStatus; DWORD dwReason; DWORD dwError; } ONEX_STATUS, *PONEX_STATUS; [PInvokeData("dot1x.h", MSDNShortId = "2c19c65b-0943-4561-a28f-0104e1cbd229")] [StructLayout(LayoutKind.Sequential)] public struct ONEX_STATUS { /// /// The current status of the 802.1X authentication process. Any error that may have occurred during authentication is indicated /// below by the value of the dwReason and dwError members of the ONEX_STATUS structure. For more /// information, see the ONEX_AUTH_STATUS enumeration. /// public ONEX_AUTH_STATUS authStatus; /// /// If an error occurred during 802.1X authentication, this member contains the reason for the error specified as a value from /// the ONEX_REASON_CODE enumeration. This member is normally ONEX_REASON_CODE_SUCCESS when 802.1X authentication is /// successful and no error occurs. /// public uint dwReason; /// /// If an error occurred during 802.1X authentication, this member contains the error. This member is normally NO_ERROR, except /// when an EAPHost error occurs. /// public uint dwError; } /// /// The ONEX_VARIABLE_BLOB structure is used as a member of other 802.1X authentication stuctures to contain variable-sized members.. /// /// /// /// The ONEX_VARIABLE_BLOB structure is used by the 802.1X module, a new wireless configuration component supported on /// Windows Vista and later. /// /// /// The ONEX_RESULT_UPDATE_DATA contains information on a status change to 802.1X authentication. The ONEX_RESULT_UPDATE_DATA /// structure is returned when the NotificationSource member of the WLAN_NOTIFICATION_DATA structure is /// WLAN_NOTIFICATION_SOURCE_ONEX and the NotificationCode member of the WLAN_NOTIFICATION_DATA structure for /// received notification is OneXNotificationTypeResultUpdate. For this notification, the pData member of the /// WLAN_NOTIFICATION_DATA structure points to an ONEX_RESULT_UPDATE_DATA structure that contains information on the /// 802.1X authentication status change. /// /// /// A number of the nested structure members in the ONEX_RESULT_UPDATE_DATA structure contains members of the /// ONEX_VARIABLE_BLOB type. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/dot1x/ns-dot1x-onex_variable_blob typedef struct _ONEX_VARIABLE_BLOB { DWORD // dwSize; DWORD dwOffset; } ONEX_VARIABLE_BLOB, *PONEX_VARIABLE_BLOB; [PInvokeData("dot1x.h", MSDNShortId = "3a410bde-bcff-4a86-aadc-650862dbf38b")] [StructLayout(LayoutKind.Sequential)] public struct ONEX_VARIABLE_BLOB { /// The size, in bytes, of this ONEX_VARIABLE_BLOB structure. public uint dwSize; /// /// The offset, in bytes, from the beginning of the containing outer structure (where the ONEX_VARIABLE_BLOB structure is /// a member) to the data contained in the ONEX_VARIABLE_BLOB structure. /// public uint dwOffset; } /// The WLAN_ASSOCIATION_ATTRIBUTES structure contains association attributes for a connection. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_association_attributes typedef struct // _WLAN_ASSOCIATION_ATTRIBUTES { DOT11_SSID dot11Ssid; DOT11_BSS_TYPE dot11BssType; DOT11_MAC_ADDRESS dot11Bssid; DOT11_PHY_TYPE // dot11PhyType; ULONG uDot11PhyIndex; WLAN_SIGNAL_QUALITY wlanSignalQuality; ULONG ulRxRate; ULONG ulTxRate; } // WLAN_ASSOCIATION_ATTRIBUTES, *PWLAN_ASSOCIATION_ATTRIBUTES; [PInvokeData("wlanapi.h", MSDNShortId = "f7d3d106-54a9-4bdf-bccf-216cac938995")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_ASSOCIATION_ATTRIBUTES { /// A DOT11_SSID structure that contains the SSID of the association. public DOT11_SSID dot11Ssid; /// A DOT11_BSS_TYPE value that specifies whether the network is infrastructure or ad hoc. public DOT11_BSS_TYPE dot11BssType; /// A DOT11_MAC_ADDRESS that contains the BSSID of the association. public DOT11_MAC_ADDRESS dot11Bssid; /// A DOT11_PHY_TYPE value that indicates the physical type of the association. public DOT11_PHY_TYPE dot11PhyType; /// The position of the DOT11_PHY_TYPE value in the structure containing the list of PHY types. public uint uDot11PhyIndex; /// /// A percentage value that represents the signal quality of the network. WLAN_SIGNAL_QUALITY is of type ULONG. /// This member contains a value between 0 and 100. A value of 0 implies an actual RSSI signal strength of -100 dbm. A value of /// 100 implies an actual RSSI signal strength of -50 dbm. You can calculate the RSSI signal strength value for /// wlanSignalQuality values between 1 and 99 using linear interpolation. /// public uint wlanSignalQuality; /// Contains the receiving rate of the association. public uint ulRxRate; /// Contains the transmission rate of the association. public uint ulTxRate; } /// The WLAN_AUTH_CIPHER_PAIR_LIST structure contains a list of authentication and cipher algorithm pairs. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_auth_cipher_pair_list typedef struct // _WLAN_AUTH_CIPHER_PAIR_LIST { DWORD dwNumberOfItems; #if ... DOT11_AUTH_CIPHER_PAIR *pAuthCipherPairList[]; #else // DOT11_AUTH_CIPHER_PAIR pAuthCipherPairList[1]; #endif } WLAN_AUTH_CIPHER_PAIR_LIST, *PWLAN_AUTH_CIPHER_PAIR_LIST; [PInvokeData("wlanapi.h", MSDNShortId = "747ee8e6-aafa-42ec-9183-a5a4a2603fc0")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwNumberOfItems))] [StructLayout(LayoutKind.Sequential)] public struct WLAN_AUTH_CIPHER_PAIR_LIST { /// Contains the number of supported auth-cipher pairs. public uint dwNumberOfItems; /// A DOT11_AUTH_CIPHER_PAIR structure containing a list of auth-cipher pairs. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DOT11_AUTH_CIPHER_PAIR[] pAuthCipherPairList; } /// The WLAN_AVAILABLE_NETWORK structure contains information about an available wireless network. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_available_network typedef struct // _WLAN_AVAILABLE_NETWORK { WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; DOT11_SSID dot11Ssid; DOT11_BSS_TYPE dot11BssType; ULONG // uNumberOfBssids; BOOL bNetworkConnectable; WLAN_REASON_CODE wlanNotConnectableReason; ULONG uNumberOfPhyTypes; DOT11_PHY_TYPE // dot11PhyTypes[WLAN_MAX_PHY_TYPE_NUMBER]; BOOL bMorePhyTypes; WLAN_SIGNAL_QUALITY wlanSignalQuality; BOOL bSecurityEnabled; // DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm; DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm; DWORD dwFlags; DWORD // dwReserved; } WLAN_AVAILABLE_NETWORK, *PWLAN_AVAILABLE_NETWORK; [PInvokeData("wlanapi.h", MSDNShortId = "82883cea-515b-426d-9961-c144ce99b3db")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct WLAN_AVAILABLE_NETWORK { /// /// Contains the profile name associated with the network. If the network does not have a profile, this member will be empty. If /// multiple profiles are associated with the network, there will be multiple entries with the same SSID in the visible network /// list. Profile names are case-sensitive. This string must be NULL-terminated. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = WLAN_MAX_NAME_LENGTH)] public string strProfileName; /// A DOT11_SSID structure that contains the SSID of the visible wireless network. public DOT11_SSID dot11Ssid; /// A DOT11_BSS_TYPE value that specifies whether the network is infrastructure or ad hoc. public DOT11_BSS_TYPE dot11BssType; /// /// Indicates the number of BSSIDs in the network. /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2:uNumberofBssids is at most 1, regardless of /// the number of access points broadcasting the SSID. /// /// public uint uNumberOfBssids; /// /// Indicates whether the network is connectable or not. If set to TRUE, the network is connectable, otherwise the /// network cannot be connected to. /// [MarshalAs(UnmanagedType.Bool)] public bool bNetworkConnectable; /// /// A WLAN_REASON_CODE value that indicates why a network cannot be connected to. This member is only valid when /// bNetworkConnectable is FALSE. /// public WLAN_REASON_CODE wlanNotConnectableReason; /// /// The number of PHY types supported on available networks. The maximum value of uNumberOfPhyTypes is /// WLAN_MAX_PHY_TYPE_NUMBER, which has a value of 8. If more than WLAN_MAX_PHY_TYPE_NUMBER PHY types are /// supported, bMorePhyTypes must be set to TRUE. /// public uint uNumberOfPhyTypes; /// /// /// Contains an array of DOT11_PHY_TYPE values that represent the PHY types supported by the available networks. When /// uNumberOfPhyTypes is greater than WLAN_MAX_PHY_TYPE_NUMBER, this array contains only the first /// WLAN_MAX_PHY_TYPE_NUMBER PHY types. /// /// /// /// Value /// Meaning /// /// /// dot11_phy_type_unknown /// Specifies an unknown or uninitialized PHY type. /// /// /// dot11_phy_type_any /// Specifies any PHY type. /// /// /// dot11_phy_type_fhss /// Specifies a frequency-hopping spread-spectrum (FHSS) PHY. Bluetooth devices can use FHSS or an adaptation of FHSS. /// /// /// dot11_phy_type_dsss /// Specifies a direct sequence spread spectrum (DSSS) PHY. /// /// /// dot11_phy_type_irbaseband /// Specifies an infrared (IR) baseband PHY. /// /// /// dot11_phy_type_ofdm /// Specifies an orthogonal frequency division multiplexing (OFDM) PHY. 802.11a devices can use OFDM. /// /// /// dot11_phy_type_hrdsss /// Specifies a high-rate DSSS (HRDSSS) PHY. /// /// /// dot11_phy_type_erp /// Specifies an extended rate PHY (ERP). 802.11g devices can use ERP. /// /// /// dot11_phy_type_ht /// Specifies an 802.11n PHY type. /// /// /// dot11_phy_type_vht /// /// Specifies the 802.11ac PHY type. This is the very high throughput PHY type specified in IEEE 802.11ac. This value is /// supported on Windows 8.1, Windows Server 2012 R2, and later. /// /// /// /// dot11_phy_type_IHV_start /// /// Specifies the start of the range that is used to define PHY types that are developed by an independent hardware vendor (IHV). /// /// /// /// dot11_phy_type_IHV_end /// /// Specifies the end of the range that is used to define PHY types that are developed by an independent hardware vendor (IHV). /// /// /// /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = WLAN_MAX_PHY_TYPE_NUMBER)] public DOT11_PHY_TYPE[] dot11PhyTypes; /// /// Specifies if there are more than WLAN_MAX_PHY_TYPE_NUMBER PHY types supported. /// /// When this member is set to TRUE, an application must call WlanGetNetworkBssList to get the complete list of PHY /// types. The returned WLAN_BSS_LIST structure has an array of WLAN_BSS_ENTRY structures. The uPhyId member of the /// WLAN_BSS_ENTRY structure contains the PHY type for an entry. /// /// [MarshalAs(UnmanagedType.Bool)] public bool bMorePhyTypes; /// /// A percentage value that represents the signal quality of the network. WLAN_SIGNAL_QUALITY is of type ULONG. /// This member contains a value between 0 and 100. A value of 0 implies an actual RSSI signal strength of -100 dbm. A value of /// 100 implies an actual RSSI signal strength of -50 dbm. You can calculate the RSSI signal strength value for /// wlanSignalQuality values between 1 and 99 using linear interpolation. /// public uint wlanSignalQuality; /// /// Indicates whether security is enabled on the network. A value of TRUE indicates that security is enabled, otherwise /// it is not. /// [MarshalAs(UnmanagedType.Bool)] public bool bSecurityEnabled; /// /// A DOT11_AUTH_ALGORITHM value that indicates the default authentication algorithm used to join this network for the first time. /// public DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm; /// A DOT11_CIPHER_ALGORITHM value that indicates the default cipher algorithm to be used when joining this network. public DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm; /// /// Contains various flags for the network. /// /// /// Value /// Meaning /// /// /// WLAN_AVAILABLE_NETWORK_CONNECTED /// This network is currently connected. /// /// /// WLAN_AVAILABLE_NETWORK_HAS_PROFILE /// There is a profile for this network. /// /// /// public WLAN_AVAILABLE_NETWORK_FLAGS dwFlags; /// Reserved for future use. Must be set to NULL. public uint dwReserved; } /// The WLAN_BSS_ENTRY structure contains information about a basic service set (BSS). /// /// /// The WlanGetNetworkBssList function retrieves the BSS list of the wireless network or networks on a given interface and returns /// this information in a WLAN_BSS_LIST structure that contains an array of . WLAN_BSS_ENTRY structures. /// /// /// When the wireless LAN interface is also operating as a Wireless Hosted Network , the BSS list will contain an entry for the BSS /// created for the Wireless Hosted Network. /// /// /// Since the information is returned by the access point for an infrastructure BSS network or by the network peer for an /// independent BSS network (ad hoc network), the information returned should not be trusted. The ulIeOffset and /// ulIeSize members in the WLAN_BSS_ENTRY structure should be used to determine the maximum size of the information /// element data blob in the WLAN_BSS_ENTRY structure, not the data in the information element data blob. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_bss_entry typedef struct _WLAN_BSS_ENTRY { DOT11_SSID // dot11Ssid; ULONG uPhyId; DOT11_MAC_ADDRESS dot11Bssid; DOT11_BSS_TYPE dot11BssType; DOT11_PHY_TYPE dot11BssPhyType; LONG lRssi; // ULONG uLinkQuality; BOOLEAN bInRegDomain; USHORT usBeaconPeriod; ULONGLONG ullTimestamp; ULONGLONG ullHostTimestamp; USHORT // usCapabilityInformation; ULONG ulChCenterFrequency; WLAN_RATE_SET wlanRateSet; ULONG ulIeOffset; ULONG ulIeSize; } // WLAN_BSS_ENTRY, *PWLAN_BSS_ENTRY; [PInvokeData("wlanapi.h", MSDNShortId = "25a76128-13d9-47dd-9c73-1fbf06a908be")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_BSS_ENTRY { /// /// The SSID of the access point (AP) or peer station associated with the BSS. The data type for this member is a DOT11_SSID structure. /// public DOT11_SSID dot11Ssid; /// The identifier (ID) of the PHY that the wireless LAN interface used to detect the BSS network. public uint uPhyId; /// /// The media access control (MAC) address of the access point for infrastructure BSS networks or the peer station for /// independent BSS networks (ad hoc networks) that sent the 802.11 Beacon or Probe Response frame received by the wireless LAN /// interface while scanning. The data type for this member is a DOT11_MAC_ADDRESS structure. /// public DOT11_MAC_ADDRESS dot11Bssid; /// /// The BSS network type. The data type for this member is a DOT11_BSS_TYPE enumeration value. /// This member can be one of the following values. /// /// /// Value /// Meaning /// /// /// dot11_BSS_type_infrastructure 1 /// Specifies an infrastructure BSS network. /// /// /// dot11_BSS_type_independent 2 /// Specifies an independent BSS (IBSS) network (an ad hoc network). /// /// /// public DOT11_BSS_TYPE dot11BssType; /// The PHY type for this network. The data type for this member is a DOT11_PHY_TYPE enumeration value. public DOT11_PHY_TYPE dot11BssPhyType; /// /// The received signal strength indicator (RSSI) value, in units of decibels referenced to 1.0 milliwatts (dBm), as detected by /// the wireless LAN interface driver for the AP or peer station. /// public int lRssi; /// /// The link quality reported by the wireless LAN interface driver. The link quality value ranges from 0 through 100. A value of /// 100 specifies the highest link quality. /// public uint uLinkQuality; /// /// /// A value that specifies whether the AP or peer station is operating within the regulatory domain as identified by the country/region. /// /// If the wireless LAN interface driver does not support multiple regulatory domains, this member is set to TRUE. /// /// If the 802.11 Beacon or Probe Response frame received from the AP or peer station does not include a Country information /// element (IE), this member is set to TRUE. /// /// /// If the 802.11 Beacon or Probe Response frame received from the AP or peer station does include a Country IE, this member is /// set to FALSE if the value of the Country String subfield does not equal the input country string. /// /// [MarshalAs(UnmanagedType.U1)] public bool bInRegDomain; /// /// /// The value of the Beacon Interval field from the 802.11 Beacon or Probe Response frame received by the wireless LAN interface. /// /// /// The interval is in 1,024 microsecond time units between target beacon transmission times. This information is retrieved from /// the beacon packet sent by an access point in an infrastructure BSS network or a probe response from an access point or peer /// station in response to a wireless LAN client sending a Probe Request. /// /// /// The IEEE 802.11 standard defines a unit of time as equal to 1,024 microseconds. This unit was defined so that it could be /// easily implemented in hardware. /// /// public ushort usBeaconPeriod; /// /// The value of the Timestamp field from the 802.11 Beacon or Probe Response frame received by the wireless LAN interface. /// public ulong ullTimestamp; /// /// /// The host timestamp value that records when wireless LAN interface received the Beacon or Probe Response frame. This member /// is a count of 100-nanosecond intervals since January 1, 1601. /// /// For more information, see the NdisGetCurrentSystemTime function documented in the WDK. /// public ulong ullHostTimestamp; /// /// /// The value of the Capability Information field from the 802.11 Beacon or Probe Response frame received by the wireless LAN /// interface. This value is a set of bit flags defining the capability. /// /// This member can be one or more of the following values. /// /// /// Value /// Meaning /// /// /// ESS bit 0 /// /// An extended service set. A set of one or more interconnected basic service sets (BSSs) and integrated local area networks /// (LANs) that appears as a single BSS to the logical link control layer at any station associated with one of those BSSs. An /// AP set the ESS subfield to 1 and the IBSS subfield to 0 within transmitted Beacon or Probe Response frames. A peer station /// within an IBSS (ad hoc network) sets the ESS subfield to 0 and the IBSS subfield to 1 in transmitted Beacon or Probe /// Response frames. /// /// /// /// IBSS bit 1 /// /// An independent basic service set. A BSS that forms a self-contained network, and in which no access to a distribution system /// (DS) is available (an ad hoc network). An AP sets the ESS subfield to 1 and the IBSS subfield to 0 within transmitted Beacon /// or Probe Response frames. A peer station within an IBSS (ad hoc network) sets the ESS subfield to 0 and the IBSS subfield to /// 1 in transmitted Beacon or Probe Response frames. /// /// /// /// CF-Pollable bit 2 /// A value that indicates if the AP or peer station is pollable. /// /// /// CF Poll Request bit 3 /// A value that indicates how the AP or peer station handles poll requests. /// /// /// Privacy bit 4 /// /// A value that indicates if encryption is required for all data frames. An AP sets the Privacy subfield to 1 within /// transmitted Beacon and Probe Response frames if WEP, WPA, or WPA2 encryption is required for all data type frames exchanged /// within the BSS. If WEP, WPA, or WPA2 encryption is not required, the Privacy subfield is set to 0. A peer station within and /// IBSS sets the Privacy subfield to 1 within transmitted Beacon and Probe Response frames if WEP, WPA, or WPA2 encryption is /// required for all data type frames exchanged within the IBSS. If WEP, WPA, or WPA2 encryption is not required, the Privacy /// subfield is set to 0. /// /// /// /// public ushort usCapabilityInformation; /// /// /// The channel center frequency of the band on which the 802.11 Beacon or Probe Response frame was received. The value of /// ulChCenterFrequency is in units of kilohertz (kHz). /// /// Note This member is only valid for PHY types that are not frequency-hopping spread spectrum (FHSS). /// public uint ulChCenterFrequency; /// A set of data transfer rates supported by the BSS. The data type for this member is a WLAN_RATE_SET structure. public WLAN_RATE_SET wlanRateSet; /// /// The offset, in bytes, of the information element (IE) data blob from the beginning of the WLAN_BSS_ENTRY structure. /// /// This member points to a buffer that contains variable-length information elements (IEs) from the 802.11 Beacon or Probe /// Response frames. For each BSS, the IEs are from the last Beacon or Probe Response frame received from that BSS network. If /// an IE is available in only one frame, the wireless LAN interface driver merges the IE with the other IEs from the last /// received Beacon or Probe Response frame. /// /// /// Information elements are defined in the IEEE 802.11 specifications to have a common general format consisting of a 1-byte /// Element ID field, a 1-byte Length field, and a variable-length element-specific information field. Each information element /// is assigned a unique Element ID value as defined in this IEEE 802.11 standards. The Length field specifies the number of /// bytes in the information field. /// /// public uint ulIeOffset; /// /// The size, in bytes, of the IE data blob in the WLAN_BSS_ENTRY structure. /// /// This is the exact length of the data in the buffer pointed to by ulIeOffset member and does not contain any padding /// for alignment. The maximum value for the size of the IE data blob is 2,324 bytes. /// /// public uint ulIeSize; } /// The WLAN_CONNECTION_ATTRIBUTES structure defines the attributes of a wireless connection. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_connection_attributes typedef struct // _WLAN_CONNECTION_ATTRIBUTES { WLAN_INTERFACE_STATE isState; WLAN_CONNECTION_MODE wlanConnectionMode; WCHAR // strProfileName[WLAN_MAX_NAME_LENGTH]; WLAN_ASSOCIATION_ATTRIBUTES wlanAssociationAttributes; WLAN_SECURITY_ATTRIBUTES // wlanSecurityAttributes; } WLAN_CONNECTION_ATTRIBUTES, *PWLAN_CONNECTION_ATTRIBUTES; [PInvokeData("wlanapi.h", MSDNShortId = "91b8058d-faf6-46ee-a03b-f762e9cdae4d")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct WLAN_CONNECTION_ATTRIBUTES { /// /// A WLAN_INTERFACE_STATE value that indicates the state of the interface. /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: Only the wlan_interface_state_connected, /// wlan_interface_state_disconnected, and wlan_interface_state_authenticating values are supported. /// /// public WLAN_INTERFACE_STATE isState; /// /// A WLAN_CONNECTION_MODE value that indicates the mode of the connection. /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: Only the wlan_connection_mode_profile value /// is supported. /// /// public WLAN_CONNECTION_MODE wlanConnectionMode; /// The name of the profile used for the connection. Profile names are case-sensitive. This string must be NULL-terminated. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = WLAN_MAX_NAME_LENGTH)] public string strProfileName; /// A WLAN_ASSOCIATION_ATTRIBUTES structure that contains the attributes of the association. public WLAN_ASSOCIATION_ATTRIBUTES wlanAssociationAttributes; /// A WLAN_SECURITY_ATTRIBUTES structure that contains the security attributes of the connection. public WLAN_SECURITY_ATTRIBUTES wlanSecurityAttributes; } /// The WLAN_CONNECTION_NOTIFICATION_DATA structure contains information about connection related notifications. /// /// /// The WlanRegisterNotification function is used by an application to register and unregister notifications on all wireless /// interfaces. When registering for notifications, an application must provide a callback function pointed to by the funcCallback /// parameter passed to the WlanRegisterNotification function. The prototype for this callback function is the /// WLAN_NOTIFICATION_CALLBACK. This callback function will receive notifications that have been registered in the dwNotifSource /// parameter passed to the WlanRegisterNotification function. /// /// /// The callback function is called with a pointer to a WLAN_NOTIFICATION_DATA structure as the first parameter that contains /// detailed information on the notification. /// /// /// If the NotificationSource member of the WLAN_NOTIFICATION_DATA structure received by the callback function is /// WLAN_NOTIFICATION_SOURCE_ACM, then the received notification is an auto configuration module notification. The /// NotificationCode member of the WLAN_NOTIFICATION_DATA structure passed to the WLAN_NOTIFICATION_CALLBACK function /// determines the interpretation of the pData member of WLAN_NOTIFICATION_DATA structure. For some of these notifications, a /// WLAN_CONNECTION_NOTIFICATION_DATA structure is returned in the pData member of WLAN_NOTIFICATION_DATA structure. /// /// For more information on these notifications, see the WLAN_NOTIFICATION_ACM enumeration reference. /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_connection_notification_data typedef struct // _WLAN_CONNECTION_NOTIFICATION_DATA { WLAN_CONNECTION_MODE wlanConnectionMode; WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; // DOT11_SSID dot11Ssid; DOT11_BSS_TYPE dot11BssType; BOOL bSecurityEnabled; WLAN_REASON_CODE wlanReasonCode; DWORD dwFlags; WCHAR // strProfileXml[1]; } WLAN_CONNECTION_NOTIFICATION_DATA, *PWLAN_CONNECTION_NOTIFICATION_DATA; [PInvokeData("wlanapi.h", MSDNShortId = "005af5ef-994d-425a-be4b-54567a733fb3")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct WLAN_CONNECTION_NOTIFICATION_DATA { /// /// A WLAN_CONNECTION_MODE value that specifies the mode of the connection. /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: Only the wlan_connection_mode_profile value /// is supported. /// /// public WLAN_CONNECTION_MODE wlanConnectionMode; /// /// The name of the profile used for the connection. WLAN_MAX_NAME_LENGTH is 256. Profile names are case-sensitive. This string /// must be NULL-terminated. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = WLAN_MAX_NAME_LENGTH)] public string strProfileName; /// A DOT11_SSID structure that contains the SSID of the association. public DOT11_SSID dot11Ssid; /// A DOT11_BSS_TYPE value that indicates the BSS network type. public DOT11_BSS_TYPE dot11BssType; /// Indicates whether security is enabled for this connection. If TRUE, security is enabled. [MarshalAs(UnmanagedType.Bool)] public bool bSecurityEnabled; /// /// A WLAN_REASON_CODE that indicates the reason for an operation failure. This field has a value of /// WLAN_REASON_CODE_SUCCESS for all connection-related notifications except /// wlan_notification_acm_connection_complete. If the connection fails, this field indicates the reason for the failure. /// public WLAN_REASON_CODE wlanReasonCode; /// /// A set of flags that provide additional information for the network connection. /// This member can be one of the following values defined in the Wlanapi.h header file. /// /// /// Value /// Meaning /// /// /// WLAN_CONNECTION_NOTIFICATION_ADHOC_NETWORK_FORMED /// Indicates that an adhoc network is formed. /// /// /// WLAN_CONNECTION_NOTIFICATION_CONSOLE_USER_PROFILE /// /// Indicates that the connection uses a per-user profile owned by the console user. Non-console users will not be able to see /// the profile in their profile list. /// /// /// /// public WLAN_CONNECTION_NOTIFICATION dwFlags; /// This field contains the XML presentation of the profile used for discovery, if the connection succeeds. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public string strProfileXml; } /// The WLAN_CONNECTION_PARAMETERS structure specifies the parameters used when using the WlanConnect function. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_connection_parameters typedef struct // _WLAN_CONNECTION_PARAMETERS { WLAN_CONNECTION_MODE wlanConnectionMode; #if ... LPCWSTR strProfile; #else LPCWSTR strProfile; // #endif PDOT11_SSID pDot11Ssid; PDOT11_BSSID_LIST pDesiredBssidList; DOT11_BSS_TYPE dot11BssType; DWORD dwFlags; } // WLAN_CONNECTION_PARAMETERS, *PWLAN_CONNECTION_PARAMETERS; [PInvokeData("wlanapi.h", MSDNShortId = "e0321447-b89a-4f4e-929e-eb6db76f7283")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_CONNECTION_PARAMETERS { /// /// A WLAN_CONNECTION_MODE value that specifies the mode of connection. /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: Only the wlan_connection_mode_profile value /// is supported. /// /// public WLAN_CONNECTION_MODE wlanConnectionMode; /// /// Specifies the profile being used for the connection. /// /// If wlanConnectionMode is set to wlan_connection_mode_profile, then strProfile specifies the name of the /// profile used for the connection. If wlanConnectionMode is set to wlan_connection_mode_temporary_profile, then /// strProfile specifies the XML representation of the profile used for the connection. If wlanConnectionMode is /// set to wlan_connection_mode_discovery_secure or wlan_connection_mode_discovery_unsecure, then /// strProfile should be set to NULL. /// /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: The profile must meet the compatibility criteria /// described in Wireless Profile Compatibility. /// /// [MarshalAs(UnmanagedType.LPWStr)] public string strProfile; /// /// Pointer to a DOT11_SSID structure that specifies the SSID of the network to connect to. This parameter is optional. When set /// to NULL, all SSIDs in the profile will be tried. This parameter must not be NULL if WLAN_CONNECTION_MODE is /// set to wlan_connection_mode_discovery_secure or wlan_connection_mode_discovery_unsecure. /// public IntPtr pDot11Ssid; /// /// /// Pointer to a DOT11_BSSID_LIST structure that contains the list of basic service set (BSS) identifiers desired for the connection. /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: This member must be NULL. /// public IntPtr pDesiredBssidList; /// /// A DOT11_BSS_TYPE value that indicates the BSS type of the network. If a profile is provided, this BSS type must be the same /// as the one in the profile. /// public DOT11_BSS_TYPE dot11BssType; /// /// The following table shows flags used to specify the connection parameters. /// /// /// Constant /// Value /// Description /// /// /// WLAN_CONNECTION_HIDDEN_NETWORK /// 0x00000001 /// /// Connect to the destination network even if the destination is a hidden network. A hidden network does not broadcast its /// SSID. Do not use this flag if the destination network is an ad-hoc network.If the profile specified by strProfile is not /// NULL, then this flag is ignored and the nonBroadcast profile element determines whether to connect to a hidden network. /// /// /// /// WLAN_CONNECTION_ADHOC_JOIN_ONLY /// 0x00000002 /// /// Do not form an ad-hoc network. Only join an ad-hoc network if the network already exists. Do not use this flag if the /// destination network is an infrastructure network. /// /// /// /// WLAN_CONNECTION_IGNORE_PRIVACY_BIT /// 0x00000004 /// /// Ignore the privacy bit when connecting to the network. Ignoring the privacy bit has the effect of ignoring whether packets /// are encrypted and ignoring the method of encryption used. Only use this flag when connecting to an infrastructure network /// using a temporary profile. /// /// /// /// WLAN_CONNECTION_EAPOL_PASSTHROUGH /// 0x00000008 /// /// Exempt EAPOL traffic from encryption and decryption. This flag is used when an application must send EAPOL traffic over an /// infrastructure network that uses Open authentication and WEP encryption. This flag must not be used to connect to networks /// that require 802.1X authentication. This flag is only valid when wlanConnectionMode is set to /// wlan_connection_mode_temporary_profile. Avoid using this flag whenever possible. /// /// /// /// WLAN_CONNECTION_PERSIST_DISCOVERY_PROFILE /// 0x00000010 /// /// Automatically persist discovery profile on successful connection completion. This flag is only valid for /// wlan_connection_mode_discovery_secure or wlan_connection_mode_discovery_unsecure. The profile will be saved as an all user /// profile, with the name generated from the SSID using WlanUtf8SsidToDisplayName. If there is already a profile with the same /// name, a number will be appended to the end of the profile name. The profile will be saved with manual connection mode, /// unless WLAN_CONNECTION_PERSIST_DISCOVERY_PROFILE_CONNECTION_MODE_AUTO is also specified. /// /// /// /// WLAN_CONNECTION_PERSIST_DISCOVERY_PROFILE_CONNECTION_MODE_AUTO /// 0x00000020 /// /// To be used in conjunction with WLAN_CONNECTION_PERSIST_DISCOVERY_PROFILE. The discovery profile will be persisted with /// automatic connection mode. /// /// /// /// WLAN_CONNECTION_PERSIST_DISCOVERY_PROFILE_OVERWRITE_EXISTING /// 0x00000040 /// /// To be used in conjunction with WLAN_CONNECTION_PERSIST_DISCOVERY_PROFILE. The discovery profile will be persisted and /// attempt to overwrite an existing profile with the same name. /// /// /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: This member must be set to 0. /// public WLAN_CONNECTION_FLAGS dwFlags; } /// A WLAN_COUNTRY_OR_REGION_STRING_LIST structure contains a list of supported country or region strings. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_country_or_region_string_list typedef struct // _WLAN_COUNTRY_OR_REGION_STRING_LIST { DWORD dwNumberOfItems; #if ... DOT11_COUNTRY_OR_REGION_STRING // *pCountryOrRegionStringList[]; #else DOT11_COUNTRY_OR_REGION_STRING pCountryOrRegionStringList[1]; #endif } // WLAN_COUNTRY_OR_REGION_STRING_LIST, *PWLAN_COUNTRY_OR_REGION_STRING_LIST; [PInvokeData("wlanapi.h", MSDNShortId = "64343c1f-3543-406f-a64c-94196b8aa17e")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwNumberOfItems))] [StructLayout(LayoutKind.Sequential)] public struct WLAN_COUNTRY_OR_REGION_STRING_LIST { /// Indicates the number of supported country or region strings. public uint dwNumberOfItems; /// /// A list of supported country or region strings. In Windows, a DOT11_COUNTRY_OR_REGION_STRING is of type char[3]. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DOT11_COUNTRY_OR_REGION_STRING[] pCountryOrRegionStringList; } /// A structure that represents a device service notification. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_device_service_notification_data typedef struct // _WLAN_DEVICE_SERVICE_NOTIFICATION_DATA { GUID DeviceService; DWORD dwOpCode; DWORD dwDataSize; #if ... BYTE *DataBlob[]; #else // BYTE DataBlob[1]; #endif } WLAN_DEVICE_SERVICE_NOTIFICATION_DATA, *PWLAN_DEVICE_SERVICE_NOTIFICATION_DATA; [PInvokeData("wlanapi.h")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwDataSize))] [StructLayout(LayoutKind.Sequential)] public struct WLAN_DEVICE_SERVICE_NOTIFICATION_DATA { /// /// Type: GUID /// The GUID identifying the device service for this notification. /// public Guid DeviceService; /// /// Type: DWORD /// The opcode that identifies the operation under the device service for this notification. /// public uint dwOpCode; /// /// Type: DWORD /// /// The size, in bytes, of the DataBlob member. The maximum value of dwDataSize may be restricted by the type of data that is /// stored in the WLAN_DEVICE_SERVICE_NOTIFICATION_DATA structure. /// /// public uint dwDataSize; /// /// Type: BYTE[1] /// /// A pointer to an array containing BYTES s, representing the data blob. This is the data that is received from the /// independent hardware vendor (IHV) driver, and is passed on to the client as an unformatted byte array blob. /// /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] DataBlob; } /// /// The WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS structure contains information about the connection settings on the wireless /// Hosted Network. /// /// /// The WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS structure is an extension to native wireless APIs added to support the /// wireless Hosted Network on Windows 7 and later. /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_hosted_network_connection_settings typedef struct // _WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS { DOT11_SSID hostedNetworkSSID; DWORD dwMaxNumberOfPeers; } // WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS, *PWLAN_HOSTED_NETWORK_CONNECTION_SETTINGS; [PInvokeData("wlanapi.h", MSDNShortId = "845eaef2-7ce0-4d7a-8273-8b843b5c95fd")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS { /// The SSID associated with the wireless Hosted Network. public DOT11_SSID hostedNetworkSSID; /// The maximum number of concurrent peers allowed by the wireless Hosted Network. public uint dwMaxNumberOfPeers; } /// /// The WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE structure contains information about a network state change for a data /// peer on the wireless Hosted Network. /// /// /// The WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE structure is an extension to native wireless APIs added to support the /// wireless Hosted Network on Windows 7 and later. /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_hosted_network_data_peer_state_change typedef struct // _WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE { WLAN_HOSTED_NETWORK_PEER_STATE OldState; WLAN_HOSTED_NETWORK_PEER_STATE NewState; // WLAN_HOSTED_NETWORK_REASON PeerStateChangeReason; } WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE, *PWLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE; [PInvokeData("wlanapi.h", MSDNShortId = "476b903d-7c87-4734-8a42-c8b75d292fb5")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE { /// The previous network state for a data peer on the wireless Hosted Network. public WLAN_HOSTED_NETWORK_PEER_STATE OldState; /// /// The current network state for a data peer on the wireless Hosted Network. /// The reason for the network state change for the data peer. /// public WLAN_HOSTED_NETWORK_PEER_STATE NewState; /// public WLAN_HOSTED_NETWORK_REASON PeerStateChangeReason; } /// /// The WLAN_HOSTED_NETWORK_PEER_STATE structure contains information about the peer state for a peer on the wireless Hosted Network. /// /// /// The WLAN_HOSTED_NETWORK_PEER_STATE structure is an extension to native wireless APIs added to support the wireless Hosted /// Network on Windows 7 and later. /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_hosted_network_peer_state typedef struct // _WLAN_HOSTED_NETWORK_PEER_STATE { DOT11_MAC_ADDRESS PeerMacAddress; WLAN_HOSTED_NETWORK_PEER_AUTH_STATE PeerAuthState; } // WLAN_HOSTED_NETWORK_PEER_STATE, *PWLAN_HOSTED_NETWORK_PEER_STATE; [PInvokeData("wlanapi.h", MSDNShortId = "f42f7100-45c8-4dd3-ae01-07740cace871")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_HOSTED_NETWORK_PEER_STATE { /// The MAC address of the peer being described. public DOT11_MAC_ADDRESS PeerMacAddress; /// The current authentication state of this peer. public WLAN_HOSTED_NETWORK_PEER_AUTH_STATE PeerAuthState; } /// /// The WLAN_HOSTED_NETWORK_RADIO_STATE structure contains information about the radio state on the wireless Hosted Network. /// /// /// The WLAN_HOSTED_NETWORK_RADIO_STATE structure is an extension to native wireless APIs added to support the wireless /// Hosted Network on Windows 7 and later. /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_hosted_network_radio_state typedef struct // _WLAN_HOSTED_NETWORK_RADIO_STATE { DOT11_RADIO_STATE dot11SoftwareRadioState; DOT11_RADIO_STATE dot11HardwareRadioState; } // WLAN_HOSTED_NETWORK_RADIO_STATE, *PWLAN_HOSTED_NETWORK_RADIO_STATE; [PInvokeData("wlanapi.h", MSDNShortId = "a84db78d-f6fd-48c4-80e8-a0d16f4dc3ed")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_HOSTED_NETWORK_RADIO_STATE { /// The software radio state of the wireless Hosted Network. public DOT11_RADIO_STATE dot11SoftwareRadioState; /// The hardware radio state of the wireless Hosted Network. public DOT11_RADIO_STATE dot11HardwareRadioState; } /// /// The WLAN_HOSTED_NETWORK_SECURITY_SETTINGS structure contains information about the security settings on the wireless /// Hosted Network. /// /// /// The WLAN_HOSTED_NETWORK_SECURITY_SETTINGS structure is an extension to native wireless APIs added to support the wireless /// Hosted Network on Windows 7 and later. /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_hosted_network_security_settings typedef struct // _WLAN_HOSTED_NETWORK_SECURITY_SETTINGS { DOT11_AUTH_ALGORITHM dot11AuthAlgo; DOT11_CIPHER_ALGORITHM dot11CipherAlgo; } // WLAN_HOSTED_NETWORK_SECURITY_SETTINGS, *PWLAN_HOSTED_NETWORK_SECURITY_SETTINGS; [PInvokeData("wlanapi.h", MSDNShortId = "b86beb10-52e5-4bc0-95fe-08307f8d1ccd")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_HOSTED_NETWORK_SECURITY_SETTINGS { /// The authentication algorithm used by the wireless Hosted Network. public DOT11_AUTH_ALGORITHM dot11AuthAlgo; /// The cipher algorithm used by the wireless Hosted Network. public DOT11_CIPHER_ALGORITHM dot11CipherAlgo; } /// /// The WLAN_HOSTED_NETWORK_STATE_CHANGE structure contains information about a network state change on the wireless Hosted Network. /// /// /// The WLAN_HOSTED_NETWORK_STATE_CHANGE structure is an extension to native wireless APIs added to support the wireless /// Hosted Network on Windows 7 and later. /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_hosted_network_state_change typedef struct // _WLAN_HOSTED_NETWORK_STATE_CHANGE { WLAN_HOSTED_NETWORK_STATE OldState; WLAN_HOSTED_NETWORK_STATE NewState; // WLAN_HOSTED_NETWORK_REASON StateChangeReason; } WLAN_HOSTED_NETWORK_STATE_CHANGE, *PWLAN_HOSTED_NETWORK_STATE_CHANGE; [PInvokeData("wlanapi.h", MSDNShortId = "e05607fd-da1e-49ae-b2eb-3ac4758df84c")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_HOSTED_NETWORK_STATE_CHANGE { /// The previous network state on the wireless Hosted Network. public WLAN_HOSTED_NETWORK_STATE OldState; /// The current network state on the wireless Hosted Network. public WLAN_HOSTED_NETWORK_STATE NewState; /// The reason for the network state change. public WLAN_HOSTED_NETWORK_REASON StateChangeReason; } /// The WLAN_INTERFACE_INFO structure contains information about a wireless LAN interface. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_interface_info typedef struct _WLAN_INTERFACE_INFO { // GUID InterfaceGuid; WCHAR strInterfaceDescription[WLAN_MAX_NAME_LENGTH]; WLAN_INTERFACE_STATE isState; } WLAN_INTERFACE_INFO, *PWLAN_INTERFACE_INFO; [PInvokeData("wlanapi.h", MSDNShortId = "906e7d59-ebd0-47e7-985e-f5d313f19ecb")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct WLAN_INTERFACE_INFO { /// Contains the GUID of the interface. public Guid InterfaceGuid; /// Contains the description of the interface. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = WLAN_MAX_NAME_LENGTH)] public string strInterfaceDescription; /// /// Contains a WLAN_INTERFACE_STATE value that indicates the current state of the interface. /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: Only the wlan_interface_state_connected, /// wlan_interface_state_disconnected, and wlan_interface_state_authenticating values are supported. /// /// public WLAN_INTERFACE_STATE isState; } /// The WLAN_MAC_FRAME_STATISTICS structure contains information about sent and received MAC frames. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_mac_frame_statistics typedef struct // WLAN_MAC_FRAME_STATISTICS { ULONGLONG ullTransmittedFrameCount; ULONGLONG ullReceivedFrameCount; ULONGLONG ullWEPExcludedCount; // ULONGLONG ullTKIPLocalMICFailures; ULONGLONG ullTKIPReplays; ULONGLONG ullTKIPICVErrorCount; ULONGLONG ullCCMPReplays; ULONGLONG // ullCCMPDecryptErrors; ULONGLONG ullWEPUndecryptableCount; ULONGLONG ullWEPICVErrorCount; ULONGLONG ullDecryptSuccessCount; // ULONGLONG ullDecryptFailureCount; } WLAN_MAC_FRAME_STATISTICS, *PWLAN_MAC_FRAME_STATISTICS; [PInvokeData("wlanapi.h", MSDNShortId = "b5bb4ec9-aeec-4a64-977d-e875c3835196")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_MAC_FRAME_STATISTICS { /// Contains the number of successfully transmitted MSDU/MMPDUs. public ulong ullTransmittedFrameCount; /// Contains the number of successfully received MSDU/MMPDUs. public ulong ullReceivedFrameCount; /// Contains the number of frames discarded due to having a "Protected" status indicated in the frame control field. public ulong ullWEPExcludedCount; /// /// Contains the number of MIC failures encountered while checking the integrity of packets received from the AP or peer station. /// public ulong ullTKIPLocalMICFailures; /// Contains the number of TKIP replay errors detected. public ulong ullTKIPReplays; /// Contains the number of TKIP protected packets that the NIC failed to decrypt. public ulong ullTKIPICVErrorCount; /// Contains the number of received unicast fragments discarded by the replay mechanism. public ulong ullCCMPReplays; /// Contains the number of received fragments discarded by the CCMP decryption algorithm. public ulong ullCCMPDecryptErrors; /// Contains the number of WEP protected packets received for which a decryption key was not available on the NIC. public ulong ullWEPUndecryptableCount; /// Contains the number of WEP protected packets the NIC failed to decrypt. public ulong ullWEPICVErrorCount; /// Contains the number of encrypted packets that the NIC has successfully decrypted. public ulong ullDecryptSuccessCount; /// Contains the number of encrypted packets that the NIC has failed to decrypt. public ulong ullDecryptFailureCount; } /// /// The WLAN_MSM_NOTIFICATION_DATA structure contains information about media specific module (MSM) connection related notifications. /// /// /// /// The WlanRegisterNotification function is used by an application to register and unregister notifications on all wireless /// interfaces. When registering for notifications, an application must provide a callback function pointed to by the funcCallback /// parameter passed to the WlanRegisterNotification function. The prototype for this callback function is the /// WLAN_NOTIFICATION_CALLBACK. This callback function will receive notifications that have been registered in the dwNotifSource /// parameter passed to the WlanRegisterNotification function. /// /// /// The callback function is called with a pointer to a WLAN_NOTIFICATION_DATA structure as the first parameter that contains /// detailed information on the notification. /// /// /// If the NotificationSource member of the WLAN_NOTIFICATION_DATA structure received by the callback function is /// WLAN_NOTIFICATION_SOURCE_MSM, then the received notification is a media specific module (MSM) notification. The /// NotificationCode member of the WLAN_NOTIFICATION_DATA structure passed to the WLAN_NOTIFICATION_CALLBACK function /// determines the interpretation of the pData member of WLAN_NOTIFICATION_DATA structure. For some of these notifications, a /// WLAN_MSM_NOTIFICATION_DATA structure is returned in the pData member of WLAN_NOTIFICATION_DATA structure. /// /// For more information on these notifications, see the WLAN_NOTIFICATION_MSM enumeration reference. /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_msm_notification_data typedef struct // _WLAN_MSM_NOTIFICATION_DATA { WLAN_CONNECTION_MODE wlanConnectionMode; WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; DOT11_SSID // dot11Ssid; DOT11_BSS_TYPE dot11BssType; DOT11_MAC_ADDRESS dot11MacAddr; BOOL bSecurityEnabled; BOOL bFirstPeer; BOOL bLastPeer; // WLAN_REASON_CODE wlanReasonCode; } WLAN_MSM_NOTIFICATION_DATA, *PWLAN_MSM_NOTIFICATION_DATA; [PInvokeData("wlanapi.h", MSDNShortId = "76693a8e-7df8-45f0-a3c1-7960de27250c")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct WLAN_MSM_NOTIFICATION_DATA { /// A WLAN_CONNECTION_MODE value that specifies the mode of the connection. public WLAN_CONNECTION_MODE wlanConnectionMode; /// /// The name of the profile used for the connection. WLAN_MAX_NAME_LENGTH is 256. Profile names are case-sensitive. This string /// must be NULL-terminated. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = WLAN_MAX_NAME_LENGTH)] public string strProfileName; /// A DOT11_SSID structure that contains the SSID of the association. public DOT11_SSID dot11Ssid; /// A DOT11_BSS_TYPE value that indicates the BSS network type. public DOT11_BSS_TYPE dot11BssType; /// A DOT11_MAC_ADDRESS that specifies the MAC address of the peer or access point. public DOT11_MAC_ADDRESS dot11MacAddr; /// Indicates whether security is enabled for this connection. If TRUE, security is enabled. [MarshalAs(UnmanagedType.Bool)] public bool bSecurityEnabled; /// /// /// Indicates whether the peer is the first to join the ad hoc network created by the machine. If TRUE, the peer is the /// first to join. /// /// /// After the first peer joins the network, the interface state of the machine that created the ad hoc network changes from /// wlan_interface_state_ad_hoc_network_formed to wlan_interface_state_connected. /// /// [MarshalAs(UnmanagedType.Bool)] public bool bFirstPeer; /// /// Indicates whether the peer is the last to leave the ad hoc network created by the machine. If TRUE, the peer is the /// last to leave. After the last peer leaves the network, the interface state of the machine that created the ad hoc network /// changes from wlan_interface_state_connected to wlan_interface_state_ad_hoc_network_formed. /// [MarshalAs(UnmanagedType.Bool)] public bool bLastPeer; /// /// A WLAN_REASON_CODE that indicates the reason for an operation failure. If the operation succeeds, this field has a value of /// WLAN_REASON_CODE_SUCCESS. Otherwise, this field indicates the reason for the failure. /// public WLAN_REASON_CODE wlanReasonCode; } /// The WLAN_NOTIFICATION_DATA structure contains information provided when receiving notifications. /// /// /// The WlanRegisterNotification function is used by an application to register and unregister notifications on all wireless /// interfaces. When registering for notifications, an application must provide a callback function pointed to by the funcCallback /// parameter passed to the WlanRegisterNotification function. The prototype for this callback function is the /// WLAN_NOTIFICATION_CALLBACK. This callback function will receive notifications that have been registered in the dwNotifSource /// parameter passed to the WlanRegisterNotification function. /// /// /// The callback function is called with a pointer to a WLAN_NOTIFICATION_DATA structure as the first parameter that contains /// detailed information on the notification. The callback function also receives a second parameter that contains a pointer to the /// client context passed in the pCallbackContext parameter to the WlanRegisterNotification function. This client context can be a /// NULL pointer if that is what was passed to the WlanRegisterNotification function. /// /// /// Once registered, the callback function will be called whenever a notification is available until the client unregisters or /// closes the handle. /// /// /// Any registration to receive notifications is automatically undone if the calling application closes its calling handle (by /// calling WlanCloseHandle with the hClientHandle parameter) used to register for notifications with the WlanRegisterNotification /// function or if the process ends. /// /// An application can time out and query the current interface state instead of waiting for a notification. /// /// If the NotificationSource member of the WLAN_NOTIFICATION_DATA structure received by the callback function is /// WLAN_NOTIFICATION_SOURCE_ACM, then the received notification is an auto configuration module notification. The NotificationCode /// member of the WLAN_NOTIFICATION_DATA structure passed to the WLAN_NOTIFICATION_CALLBACK function determines the interpretation /// of the pData member of WLAN_NOTIFICATION_DATA structure. For more information on these notifications, see the /// WLAN_NOTIFICATION_ACM enumeration reference. /// /// /// The wlan_notification_acm_connection_attempt_fail notification is used only when an application tries and fails to initiate a /// connection using WlanConnect. This notification is sent for each failed SSID. The wlanReasonCode member of the /// WLAN_CONNECTION_NOTIFICATION_DATA structure included with the notification data specifies the reason the SSID failed. /// /// /// If all SSIDs fail when a connection is initiated using WlanConnect, the notification wlan_notification_acm_connection_complete /// is sent with wlanReasonCode set to WLAN_REASON_CODE_NETWORK_NOT_AVAILABLE. If at least one SSID succeeds, then the notification /// is sent with wlanReasonCode set to WLAN_REASON_CODE_SUCCESS. /// /// /// Unlike wlan_notification_acm_connection_attempt_fail, the wlan_notification_acm_connection_complete notification is sent for /// automatic connections and for connections initiated using WlanConnect. If the connection succeeds, wlanReasonCode set to /// WLAN_REASON_CODE_SUCCESS. Otherwise, wlanReasonCode specifies the reason for failure. /// /// /// The wlan_notification_acm_filter_list_change notification is sent when there is a change in the filter list, either through /// group policy or a call to the WlanSetFilterList function. An application can call the WlanGetFilterList function to retrieve the /// new filter list. /// /// /// The wlan_notification_acm_network_not_available notification is sent if the wireless service cannot find any connectable network /// after a scan. The interface on which no connectable network is found is identified by the InterfaceGuid member of the /// WLAN_NOTIFICATION_DATA structure. /// /// The wlan_notification_acm_network_available notification is sent when all of the following conditions occur: /// /// The wireless service finds connectable networks after a scan
The interface is in the disconnected state;
There is no /// compatible auto-connect profile that the wireless service can use to connect.
The interface on which connectable networks /// are found is identified by the InterfaceGuid member of the WLAN_NOTIFICATION_DATA structure. ///
/// /// The wlan_notification_acm_profile_change notification is sent when there is a change in a profile or the profile list, either /// through group policy or by calls to Native Wifi functions. An application can call WlanGetProfileList and WlanGetProfile /// functions to retrieve the updated profiles. The interface on which the profile list changes is identified by the InterfaceGuid /// member of the WLAN_NOTIFICATION_DATA structure. /// /// /// The wlan_notification_acm_profiles_exhausted notification is sent if the wireless service cannot connect to any network /// automatically after trying all auto-connect profiles. The notification won't be sent if there is no auto-connect profile or no /// connectable network. The interface is identified by identified by the InterfaceGuid member of the WLAN_NOTIFICATION_DATA structure. /// /// /// If the NotificationSource member of the WLAN_NOTIFICATION_DATA structure received by the callback function is /// WLAN_NOTIFICATION_SOURCE_HNWK, then the received notification is a wireless Hosted Network notification supported on Windows 7 /// and on Windows Server 2008 R2 with the Wireless LAN Service installed. The NotificationCode member of the WLAN_NOTIFICATION_DATA /// structure passed to the WLAN_NOTIFICATION_CALLBACK function determines the interpretation of the pData member of /// WLAN_NOTIFICATION_DATA structure. For more information on these notifications, see the WLAN_HOSTED_NETWORK_NOTIFICATION_CODE /// enumeration reference. /// /// /// If the NotificationSource member of the WLAN_NOTIFICATION_DATA structure received by the callback function is /// WLAN_NOTIFICATION_SOURCE_IHV, then the received notification is an indepent hardware vendor (IHV) notification. The /// NotificationCode member of the WLAN_NOTIFICATION_DATA structure passed to the WLAN_NOTIFICATION_CALLBACK function determines the /// interpretation of the pData member of WLAN_NOTIFICATION_DATA structure, which is specific to the IHV. /// /// /// If the NotificationSource member of the WLAN_NOTIFICATION_DATA structure received by the callback function is /// WLAN_NOTIFICATION_SOURCE_MSM, then the received notification is a media specific module (MSM) notification. The NotificationCode /// member of the WLAN_NOTIFICATION_DATA structure passed to the WLAN_NOTIFICATION_CALLBACK function determines the interpretation /// of the pData member of WLAN_NOTIFICATION_DATA structure. For more information on these notifications, see the /// WLAN_NOTIFICATION_MSM enumeration reference. /// /// /// The wlan_notification_msm_adapter_operation_mode_change notification is used when the operation mode changes. For more /// information about operation modes, see Native 802.11 Operation Modes. Two operation modes are supported: /// DOT11_OPERATION_MODE_EXTENSIBLE_STATION and DOT11_OPERATION_MODE_NETWORK_MONITOR. The operation mode constants are defined in /// the header file Windot11.h. When this notification is sent, pData points to the current operation mode. /// /// /// The wlan_notification_msm_peer_join and wlan_notification_msm_peer_leave notifications are used only when a machine creates an /// ad hoc network. These notifications are not used when a machine joins an existing ad hoc network. /// /// /// If the NotificationSource member of the WLAN_NOTIFICATION_DATA structure received by the callback function is /// WLAN_NOTIFICATION_SOURCE_ONEX, then the received notification is an 802.1X module notification. The NotificationCode member of /// the WLAN_NOTIFICATION_DATA structure passed to the WLAN_NOTIFICATION_CALLBACK function determines the interpretation of the /// pData member of WLAN_NOTIFICATION_DATA structure. For more information on these notifications, see the ONEX_NOTIFICATION_TYPE /// enumeration reference. /// /// /// If the NotificationSource member of the WLAN_NOTIFICATION_DATA structure received by the callback function is /// WLAN_NOTIFICATION_SOURCE_SECURITY, then the received notification is a security notification. No notifications are currently /// defined for WLAN_NOTIFICATION_SOURCE_SECURITY. /// /// /// The WLAN_NOTIFICATION_DATA structure is a typedef to the L2_WLAN_NOTIFICATION_DATA structure which is defined in the L2cmn.h /// header file which is automatically included by the Wlanapi.h header file. The L2cmn.h header file should never be used directly. /// ///
[PInvokeData("wlanapi.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct WLAN_NOTIFICATION_DATA { /// /// A value that indicates the source of the notification. /// /// The possible values for this member are defined in the Wlanapai.h header file to values defined in the L2cmn.h header file. /// /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: This parameter is set to WLAN_NOTIFICATION_SOURCE_NONE, /// WLAN_NOTIFICATION_SOURCE_ALL, or WLAN_NOTIFICATION_SOURCE_ACM. /// /// public WLAN_NOTIFICATION_SOURCE NotificationSource; /// /// The type of notification. The value of this member indicates what type of associated data will be present in the value /// pointed to by the pData member. /// /// This member can be a , , or enumeration value. /// /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: Only the wlan_notification_acm_connection_complete and /// wlan_notification_acm_disconnected notifications are available. /// /// public uint NotificationCode; /// The interface on which the notification is for. public Guid InterfaceGuid; /// The size, in bytes, of value pointed to by pData member. public uint dwDataSize; /// /// A pointer to additional data provided for the notification. The type of data pointed to by the pData member is determined by /// the value of the NotificationCode member. /// public IntPtr pData; } /// The WLAN_PHY_FRAME_STATISTICS structure contains information about sent and received PHY frames // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_phy_frame_statistics typedef struct // WLAN_PHY_FRAME_STATISTICS { ULONGLONG ullTransmittedFrameCount; ULONGLONG ullMulticastTransmittedFrameCount; ULONGLONG // ullFailedCount; ULONGLONG ullRetryCount; ULONGLONG ullMultipleRetryCount; ULONGLONG ullMaxTXLifetimeExceededCount; ULONGLONG // ullTransmittedFragmentCount; ULONGLONG ullRTSSuccessCount; ULONGLONG ullRTSFailureCount; ULONGLONG ullACKFailureCount; ULONGLONG // ullReceivedFrameCount; ULONGLONG ullMulticastReceivedFrameCount; ULONGLONG ullPromiscuousReceivedFrameCount; ULONGLONG // ullMaxRXLifetimeExceededCount; ULONGLONG ullFrameDuplicateCount; ULONGLONG ullReceivedFragmentCount; ULONGLONG // ullPromiscuousReceivedFragmentCount; ULONGLONG ullFCSErrorCount; } WLAN_PHY_FRAME_STATISTICS, *PWLAN_PHY_FRAME_STATISTICS; [PInvokeData("wlanapi.h", MSDNShortId = "c675a3cd-bbe5-473e-b734-12e74fd19a50")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_PHY_FRAME_STATISTICS { /// Contains the number of successfully transmitted MSDU/MMPDUs. public ulong ullTransmittedFrameCount; /// /// Contains the number of successfully transmitted MSDU/MMPDUs in which the multicast bit is set as the destination MAC address. /// public ulong ullMulticastTransmittedFrameCount; /// /// Contains the number of MSDU/MMPDUs transmission failures due to the number of transmit attempts exceeding the retry limit. /// public ulong ullFailedCount; /// Contains the number of MSDU/MMPDUs successfully transmitted after one or more retransmissions. public ulong ullRetryCount; /// Contains the number of MSDU/MMPDUs successfully transmitted after more than one retransmission. public ulong ullMultipleRetryCount; /// Contains the number of fragmented MSDU/MMPDUs that failed to send due to timeout. public ulong ullMaxTXLifetimeExceededCount; /// /// Contains the number of MPDUs with an individual address in the address 1 field and MPDUs that have a multicast address with /// types Data or Management. /// public ulong ullTransmittedFragmentCount; /// Contains the number of times a CTS has been received in response to an RTS. public ulong ullRTSSuccessCount; /// Contains the number of times a CTS has not been received in response to an RTS. public ulong ullRTSFailureCount; /// Contains the number of times an expected ACK has not been received. public ulong ullACKFailureCount; /// Contains the number of MSDU/MMPDUs successfully received. public ulong ullReceivedFrameCount; /// Contains the number of successfully received MSDU/MMPDUs with the multicast bit set in the MAC address. public ulong ullMulticastReceivedFrameCount; /// Contains the number of MSDU/MMPDUs successfully received only because promicscuous mode is enabled. public ulong ullPromiscuousReceivedFrameCount; /// Contains the number of fragmented MSDU/MMPDUs dropped due to timeout. public ulong ullMaxRXLifetimeExceededCount; /// Contains the number of frames received that the Sequence Control field indicates as a duplicate. public ulong ullFrameDuplicateCount; /// Contains the number of successfully received Data or Management MPDUs. public ulong ullReceivedFragmentCount; /// Contains the number of MPDUs successfully received only because promiscuous mode is enabled. public ulong ullPromiscuousReceivedFragmentCount; /// Contains the number of times an FCS error has been detected in a received MPDU. public ulong ullFCSErrorCount; } /// The WLAN_PHY_RADIO_STATE structure specifies the radio state on a specific physical layer (PHY) type. /// /// /// The WLAN_PHY_RADIO_STATE structure is used with the WlanSetInterface function when the OpCode parameter is set to wlan_intf_opcode_radio_state. /// /// /// The WLAN_PHY_RADIO_STATE structure is also used for notification by the media specific module (MSM) when the radio state /// changes. An application registers to receive MSM notifications by calling the WlanRegisterNotification function with the /// dwNotifSource parameter set to a value that includes WLAN_NOTIFICATION_SOURCE_MSM. For more information on these /// notifications, see the WLAN_NOTIFICATION_DATA structure and the WLAN_NOTIFICATION_MSM enumeration reference. /// /// /// The radio state of a PHY is off if either dot11SoftwareRadioState or dot11HardwareRadioState member of the /// WLAN_PHY_RADIO_STATE structure is dot11_radio_state_off. /// /// /// The hardware radio state cannot be changed by calling the WlanSetInterface function. The dot11HardwareRadioState member /// of the WLAN_PHY_RADIO_STATE structure is ignored when the WlanSetInterface function is called with the OpCode /// parameter set to wlan_intf_opcode_radio_state and the pData parameter points to a WLAN_PHY_RADIO_STATE structure. /// /// The software radio state can be changed by calling the WlanSetInterface function. /// /// Changing the software radio state of a physical network interface could cause related changes in the state of the wireless /// Hosted Network or virtual wireless adapter radio states. The PHYs of every virtual wireless adapter are linked. For more /// information, see the About the Wireless Hosted Network. /// /// /// The radio state of a PHY is off if either the software radio state ( dot11SoftwareRadioState member) or the hardware /// radio state ( dot11HardwareRadioState member) is off. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_phy_radio_state typedef struct _WLAN_PHY_RADIO_STATE { // DWORD dwPhyIndex; DOT11_RADIO_STATE dot11SoftwareRadioState; DOT11_RADIO_STATE dot11HardwareRadioState; } WLAN_PHY_RADIO_STATE, *PWLAN_PHY_RADIO_STATE; [PInvokeData("wlanapi.h", MSDNShortId = "20da1494-4264-4d0d-b789-25e2be6a8dd4")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_PHY_RADIO_STATE { /// /// The index of the PHY type on which the radio state is being set or queried. The WlanGetInterfaceCapability function returns /// a list of valid PHY types. /// public uint dwPhyIndex; /// A DOT11_RADIO_STATE value that indicates the software radio state. public DOT11_RADIO_STATE dot11SoftwareRadioState; /// A DOT11_RADIO_STATE value that indicates the hardware radio state. public DOT11_RADIO_STATE dot11HardwareRadioState; } /// The WLAN_PROFILE_INFO structure contains basic information about a profile. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_profile_info typedef struct _WLAN_PROFILE_INFO { WCHAR // strProfileName[WLAN_MAX_NAME_LENGTH]; DWORD dwFlags; } WLAN_PROFILE_INFO, *PWLAN_PROFILE_INFO; [PInvokeData("wlanapi.h", MSDNShortId = "ca45278c-2e1e-4080-825a-d6a05e463858")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct WLAN_PROFILE_INFO { /// /// /// The name of the profile. This value may be the name of a domain if the profile is for provisioning. Profile names are /// case-sensitive. This string must be NULL-terminated. /// /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: The name of the profile is derived automatically /// from the SSID of the wireless network. For infrastructure network profiles, the name of the profile is the SSID of the /// network. For ad hoc network profiles, the name of the profile is the SSID of the ad hoc network followed by . /// /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = WLAN_MAX_NAME_LENGTH)] public string strProfileName; /// /// A set of flags specifying settings for wireless profile. These values are defined in the Wlanapi.h header file. /// /// Windows XP with SP3 and Wireless LAN API for Windows XP with SP2: dwFlags must be 0. Per-user profiles are not supported. /// /// Combinations of these flag bits are possible /// /// /// Value /// Meaning /// /// /// WLAN_PROFILE_GROUP_POLICY /// /// This flag indicates that this profile was created by group policy. A group policy profile is read-only. Neither the content /// nor the preference order of the profile can be changed. /// /// /// /// WLAN_PROFILE_USER /// This flag indicates that the profile is a per-user profile. If not set, this profile is an all-user profile. /// /// /// public WLAN_PROFILE_FLAGS dwFlags; } /// The WLAN_RADIO_STATE structurespecifies the radio state on a list of physical layer (PHY) types. /// /// /// The WLAN_RADIO_STATE structure is used with the WlanQueryInterface function when the OpCode parameter is set to /// wlan_intf_opcode_radio_state. If the call is successful, the ppData parameter points to a WLAN_RADIO_STATE structure. /// /// /// The WLAN_PHY_RADIO_STATE structure members in the WLAN_RADIO_STATE structure can be used with the WlanSetInterface /// function when the OpCode parameter is set to wlan_intf_opcode_radio_state to change the radio state. /// /// /// The WLAN_PHY_RADIO_STATE structure is also used for notification by the media specific module (MSM) when the radio state /// changes. An application registers to receive MSM notifications by calling the WlanRegisterNotification function with the /// dwNotifSource parameter set to a value that includes WLAN_NOTIFICATION_SOURCE_MSM. For more information on these /// notifications, see the WLAN_NOTIFICATION_DATA structure and the WLAN_NOTIFICATION_MSM enumeration reference. /// /// Examples /// /// The following example enumerates the wireless LAN interfaces on the local computer, queries each interface for the /// WLAN_RADIO_STATE on the interface, and prints values from the retrieved WLAN_RADIO_STATE structure. /// /// /// Note This example will fail to load on Windows Server 2008 and Windows Server 2008 R2 if the Wireless LAN Service is not /// installed and started. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_radio_state typedef struct _WLAN_RADIO_STATE { DWORD // dwNumberOfPhys; WLAN_PHY_RADIO_STATE PhyRadioState[WLAN_MAX_PHY_INDEX]; } WLAN_RADIO_STATE, *PWLAN_RADIO_STATE; [PInvokeData("wlanapi.h", MSDNShortId = "61551b46-785e-4353-910c-8ce23172b176")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_RADIO_STATE { /// The number of valid PHY indices in the PhyRadioState member. public uint dwNumberOfPhys; /// /// An array of WLAN_PHY_RADIO_STATE structures that specify the radio states of a number of PHY indices. Only the first /// dwNumberOfPhys entries in this array are valid. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = WLAN_MAX_PHY_INDEX)] public WLAN_PHY_RADIO_STATE[] PhyRadioState; } /// The set of supported data rates. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_rate_set typedef struct _WLAN_RATE_SET { ULONG // uRateSetLength; USHORT usRateSet[DOT11_RATE_SET_MAX_LENGTH]; } WLAN_RATE_SET, *PWLAN_RATE_SET; [PInvokeData("wlanapi.h", MSDNShortId = "e07a9249-9571-4747-b913-05d319202f8f")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_RATE_SET { /// The length, in bytes, of usRateSet. public uint uRateSetLength; /// /// An array of supported data transfer rates. DOT11_RATE_SET_MAX_LENGTH is defined in windot11.h to have a value of 126. /// /// Each supported data transfer rate is stored as a USHORT. The first bit of the USHORT specifies whether the rate is a basic /// rate. A basic rate is the data transfer rate that all stations in a basic service set (BSS) can use to receive frames from /// the wireless medium. If the rate is a basic rate, the first bit of the USHORT is set to 1. /// /// To calculate the data transfer rate in Mbps for an arbitrary array entry rateSet[i], use the following equation: /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = DOT11_RATE_SET_MAX_LENGTH)] public ushort[] usRateSet; } /// The WLAN_RAW_DATA structure contains raw data in the form of a blob that is used by some Native Wifi functions. /// /// /// The WLAN_RAW_DATA structure is a raw data structure used to hold a data entry used by some Native Wifi functions. The /// data structure is in the form of a generalized blob that can contain any type of data. /// /// /// The WlanScan function uses the WLAN_RAW_DATA structure. The pIeData parameter passed to the WlanScan function /// points to a WLAN_RAW_DATA structure currently used to contain an information element to include in probe requests. This /// WLAN_RAW_DATA structure passed to the WlanScan function can contain a proximity service discovery (PSD) /// information element (IE) data entry. /// /// /// When the WLAN_RAW_DATA structure is used to store a PSD IE, the DOT11_PSD_IE_MAX_DATA_SIZE constant defined in the /// Wlanapi.h header file is the maximum value of the dwDataSize member. /// /// /// /// Constant /// Value /// Description /// /// /// DOT11_PSD_IE_MAX_DATA_SIZE /// 240 /// The maximum data size, in bytes, of a PSD IE data entry. /// /// /// For more information about PSD IEs, including a discussion of the format of an IE, see the WlanSetPsdIEDataList function. /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_raw_data typedef struct _WLAN_RAW_DATA { DWORD // dwDataSize; #if ... BYTE *DataBlob[]; #else BYTE DataBlob[1]; #endif } WLAN_RAW_DATA, *PWLAN_RAW_DATA; [PInvokeData("wlanapi.h", MSDNShortId = "5f5ddecb-f841-436c-bf31-c70c95a5d39c")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_RAW_DATA { /// /// The size, in bytes, of the DataBlob member. The maximum value of the dwDataSize may be restricted by type of /// data that is stored in the WLAN_RAW_DATA structure. /// public uint dwDataSize; /// The data blob. public IntPtr DataBlob; } /// /// The WLAN_RAW_DATA_LIST structure contains raw data in the form of an array of data blobs that are used by some Native /// Wifi functions. /// /// /// /// The WLAN_RAW_DATA_LIST structure is used to encapsulate a list of data blobs into a flat memory block. It should be /// interpreted as a list of headers followed by data blobs. /// /// /// To create a WLAN_RAW_DATA_LIST, an application needs to allocate a memory block that is large enough to hold the headers /// and the data blobs, and then cast the memory block to a pointer to a WLAN_RAW_DATA_LIST structure. /// /// The following is the memory layout of an example WLAN_RAW_DATA_LIST structure that contains two data blobs. /// /// /// Memory Offset /// Field /// Value /// Comments /// /// /// 0 /// dwTotalSize /// 84 /// /// /// /// 4 /// dwNumberOfItems /// 2 /// /// /// /// 8 /// dwDataOffset /// 16 /// Offset of the first blob: 16 = 24 - 8 /// /// /// 12 /// dwDataSize /// 20 /// Size of the first blob. /// /// /// 16 /// dwDataOffset /// 28 /// Offset of the second blob: 44 - 16. /// /// /// 20 /// dwDataSize /// 24 /// Size of the second blob. /// /// /// 24 /// /// 20 /// Start of the first blob. /// /// /// 44 /// /// 40 /// Start of the second blob. /// /// /// /// The WLAN_RAW_DATA_LIST structure is currently used by the WlanSetPsdIEDataList function to set the proximity service /// discovery (PSD) information element (IE) data list for an application. /// /// /// When used to store a PSD IE data list, the DOT11_PSD_IE_MAX_ENTRY_NUMBER constant defined in the Wlanapi.h header file is /// the maximum value of the dwNumberOfItems member for the number of blobs in the WLAN_RAW_DATA_LIST structure. The /// DOT11_PSD_IE_MAX_DATA_SIZE constant defined in the Wlanapi.h header file is the maximum value of the dwDataSize /// member for any blob. /// /// /// /// Constant /// Value /// Description /// /// /// DOT11_PSD_IE_MAX_DATA_SIZE /// 240 /// The maximum data size, in bytes, of a PSD IE data entry. /// /// /// DOT11_PSD_IE_MAX_ENTRY_NUMBER /// 5 /// The maximum number of PSD IE data entries. /// /// /// For more information about PSD IEs, including a discussion of the format of an IE, see WlanSetPsdIEDataList. /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_raw_data_list typedef struct _WLAN_RAW_DATA_LIST { // DWORD dwTotalSize; DWORD dwNumberOfItems; struct { DWORD dwDataOffset; DWORD dwDataSize; }; __unnamed_struct_088f_1 DataList[1]; // } WLAN_RAW_DATA_LIST, *PWLAN_RAW_DATA_LIST; [PInvokeData("wlanapi.h", MSDNShortId = "e0e59abf-1a78-4c7f-b044-2d4c75328329")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwNumberOfItems))] [StructLayout(LayoutKind.Sequential)] public struct WLAN_RAW_DATA_LIST { /// The total size, in bytes, of the WLAN_RAW_DATA_LIST structure. public uint dwTotalSize; /// /// The number of raw data entries or blobs in the WLAN_RAW_DATA_LIST structure. The maximum value of the /// dwNumberOfItems may be restricted by the type of data that is stored in the WLAN_RAW_DATA_LIST structure. /// public uint dwNumberOfItems; /// [StructLayout(LayoutKind.Sequential)] public struct WLAN_RAW_DATA_INFO { /// public uint dwDataOffset; /// public uint dwDataSize; } /// /// An array of raw data entries or blobs that make up the data list. /// dwDataOffset /// /// The offset, in bytes, of the data blob from the beginning of current blob descriptor. For details, see the example in the /// Remarks section below. /// /// dwDataSize /// The size, in bytes, of the data blob. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WLAN_RAW_DATA_INFO[] DataList; } /// The WLAN_SECURITY_ATTRIBUTES structure defines the security attributes for a wireless connection. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_security_attributes typedef struct // _WLAN_SECURITY_ATTRIBUTES { BOOL bSecurityEnabled; BOOL bOneXEnabled; DOT11_AUTH_ALGORITHM dot11AuthAlgorithm; // DOT11_CIPHER_ALGORITHM dot11CipherAlgorithm; } WLAN_SECURITY_ATTRIBUTES, *PWLAN_SECURITY_ATTRIBUTES; [PInvokeData("wlanapi.h", MSDNShortId = "37aa07a2-fe7f-46e3-9f17-545f48442f35")] [StructLayout(LayoutKind.Sequential)] public struct WLAN_SECURITY_ATTRIBUTES { /// Indicates whether security is enabled for this connection. [MarshalAs(UnmanagedType.Bool)] public bool bSecurityEnabled; /// Indicates whether 802.1X is enabled for this connection. [MarshalAs(UnmanagedType.Bool)] public bool bOneXEnabled; /// A DOT11_AUTH_ALGORITHM value that identifies the authentication algorithm. public DOT11_AUTH_ALGORITHM dot11AuthAlgorithm; /// A DOT11_CIPHER_ALGORITHM value that identifies the cipher algorithm. public DOT11_CIPHER_ALGORITHM dot11CipherAlgorithm; } /// The WLAN_STATISTICS structure contains assorted statistics about an interface. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_statistics typedef struct WLAN_STATISTICS { ULONGLONG // ullFourWayHandshakeFailures; ULONGLONG ullTKIPCounterMeasuresInvoked; ULONGLONG ullReserved; WLAN_MAC_FRAME_STATISTICS // MacUcastCounters; WLAN_MAC_FRAME_STATISTICS MacMcastCounters; DWORD dwNumberOfPhys; #if ... WLAN_PHY_FRAME_STATISTICS // *PhyCounters[]; #else WLAN_PHY_FRAME_STATISTICS PhyCounters[1]; #endif } WLAN_STATISTICS, *PWLAN_STATISTICS; [PInvokeData("wlanapi.h", MSDNShortId = "d66d89f1-bb12-4c2e-8c7a-a4eba008955d")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwNumberOfPhys))] [StructLayout(LayoutKind.Sequential)] public struct WLAN_STATISTICS { /// /// Indicates the number of 4-way handshake failures. This member is only valid if IHV Service is being used as the /// authentication service for the current network. /// public ulong ullFourWayHandshakeFailures; /// /// Indicates the number of TKIP countermeasures performed by an IHV Miniport driver. This count does not include TKIP /// countermeasures invoked by the operating system. /// public ulong ullTKIPCounterMeasuresInvoked; /// Reserved for use by Microsoft. public ulong ullReserved; /// /// A WLAN_MAC_FRAME_STATISTICS structure that contains MAC layer counters for unicast packets directed to the receiver of the NIC. /// public WLAN_MAC_FRAME_STATISTICS MacUcastCounters; /// /// A WLAN_MAC_FRAME_STATISTICS structure that contains MAC layer counters for multicast packets directed to the current /// multicast address. /// public WLAN_MAC_FRAME_STATISTICS MacMcastCounters; /// Contains the number of WLAN_PHY_FRAME_STATISTICS structures in the PhyCounters member. public uint dwNumberOfPhys; /// An array of WLAN_PHY_FRAME_STATISTICS structures that contain PHY layer counters. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WLAN_PHY_FRAME_STATISTICS[] PhyCounters; } /// The DOT11_NETWORK_LIST structure contains a list of 802.11 wireless networks. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-dot11_network_list typedef struct _DOT11_NETWORK_LIST { // DWORD dwNumberOfItems; DWORD dwIndex; #if ... DOT11_NETWORK *Network[]; #else DOT11_NETWORK Network[1]; #endif } // DOT11_NETWORK_LIST, *PDOT11_NETWORK_LIST; [PInvokeData("wlanapi.h", MSDNShortId = "607c5795-8168-4c6b-a2f3-65f31aea5cf5")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwNumberOfItems))] [StructLayout(LayoutKind.Sequential)] public class DOT11_NETWORK_LIST { /// Contains the number of items in the Network member. public uint dwNumberOfItems; /// /// The index of the current item. The index of the first item is 0. dwIndex must be less than dwNumberOfItems. /// /// This member is not used by the wireless service. Applications can use this member when processing individual networks in the /// DOT11_NETWORK_LIST structure. When an application passes this structure from one function to another, it can set the /// value of dwIndex to the index of the item currently being processed. This can help an application maintain state. /// /// dwIndex should always be initialized before use. /// public uint dwIndex; /// An array of DOT11_NETWORK structures that contain 802.11 wireless network information. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DOT11_NETWORK[] Network; } /// The WLAN_AVAILABLE_NETWORK_LIST structure contains an array of information about available networks. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_available_network_list typedef struct // _WLAN_AVAILABLE_NETWORK_LIST { DWORD dwNumberOfItems; DWORD dwIndex; #if ... WLAN_AVAILABLE_NETWORK *Network[]; #else // WLAN_AVAILABLE_NETWORK Network[1]; #endif } WLAN_AVAILABLE_NETWORK_LIST, *PWLAN_AVAILABLE_NETWORK_LIST; [PInvokeData("wlanapi.h", MSDNShortId = "0ac508b2-9117-423d-89d3-982f070c70e2")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwNumberOfItems))] [StructLayout(LayoutKind.Sequential)] public class WLAN_AVAILABLE_NETWORK_LIST { /// Contains the number of items in the Network member. public uint dwNumberOfItems; /// /// The index of the current item. The index of the first item is 0. dwIndex must be less than dwNumberOfItems. /// /// This member is not used by the wireless service. Applications can use this member when processing individual networks in the /// WLAN_AVAILABLE_NETWORK_LIST structure. When an application passes this structure from one function to another, it can /// set the value of dwIndex to the index of the item currently being processed. This can help an application maintain state. /// /// dwIndex should always be initialized before use. /// public uint dwIndex; /// An array of WLAN_AVAILABLE_NETWORK structures containing interface information. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WLAN_AVAILABLE_NETWORK[] Network; } /// The WLAN_BSS_LIST structure contains a list of basic service set (BSS) entries. /// /// /// The WlanGetNetworkBssList function retrieves the BSS list of the wireless network or networks on a given interface and returns /// this information in a WLAN_BSS_LIST structure. /// /// /// The WLAN_BSS_LIST structure may contain padding for alignment between the dwTotalSize member, the /// dwNumberOfItems member, and the first WLAN_BSS_ENTRY array entry in the wlanBssEntries member. Padding for /// alignment may also be present between the WLAN_BSS_ENTRY array entries in the wlanBssEntries member. Any access to /// a WLAN_BSS_ENTRY array entry should assume padding may exist. /// /// /// When the wireless LAN interface is also operating as a Wireless Hosted Network , the BSS list will contain an entry for the BSS /// created for the Wireless Hosted Network. /// /// /// Since the information is returned by the access point for an infrastructure BSS network or by the network peer for an /// independent BSS network (ad hoc network), the information returned should not be trusted. The ulIeOffset and /// ulIeSize members in the WLAN_BSS_ENTRY structure should be used to determine the maximum size of the information element /// data blob in the WLAN_BSS_ENTRY structure, not the data in the information element data blob. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_bss_list typedef struct _WLAN_BSS_LIST { DWORD // dwTotalSize; DWORD dwNumberOfItems; WLAN_BSS_ENTRY wlanBssEntries[1]; } WLAN_BSS_LIST, *PWLAN_BSS_LIST; [PInvokeData("wlanapi.h", MSDNShortId = "aeb68835-31ce-4fa7-980a-91a328fbcbc3")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwNumberOfItems))] [StructLayout(LayoutKind.Sequential)] public class WLAN_BSS_LIST { /// The total size of this structure, in bytes. public uint dwTotalSize; /// The number of items in the wlanBssEntries member. public uint dwNumberOfItems; /// An array of WLAN_BSS_ENTRY structures that contains information about a BSS. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WLAN_BSS_ENTRY[] wlanBssEntries; } /// Contains an array of device service GUIDs. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_device_service_guid_list typedef struct // _WLAN_DEVICE_SERVICE_GUID_LIST { DWORD dwNumberOfItems; DWORD dwIndex; #if ... GUID *DeviceService[]; #else GUID // DeviceService[1]; #endif } WLAN_DEVICE_SERVICE_GUID_LIST, *PWLAN_DEVICE_SERVICE_GUID_LIST; [PInvokeData("wlanapi.h")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwNumberOfItems))] [StructLayout(LayoutKind.Sequential)] public class WLAN_DEVICE_SERVICE_GUID_LIST { /// /// Type: DWORD /// The number of items in the DeviceService argument. /// public uint dwNumberOfItems; /// /// Type: DWORD /// /// The index of the current item. The index of the first item is 0. dwIndex must be less than dwNumberOfItems. This member is /// not used by the wireless service. You can use this member when processing individual GUID s in the /// WLAN_DEVICE_SERVICE_GUID_LIST structure. When your application passes this structure from one function to another, it /// can set the value of dwIndex to the index of the item currently being processed. This can help your application maintain /// state. You should always initialize dwIndex before use. /// /// public uint dwIndex; /// /// Type: GUID[1] /// A pointer to an array containing GUID s; each corresponds to a WLAN device service that the driver supports. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public Guid[] DeviceService; } /// The WLAN_HOSTED_NETWORK_STATUS structure contains information about the status of the wireless Hosted Network. /// /// /// The WLAN_HOSTED_NETWORK_STATUS structure is an extension to native wireless APIs added to support the wireless Hosted /// Network on Windows 7 and later. /// /// /// The WLAN_HOSTED_NETWORK_STATUS structure is returned in a pointer in the ppWlanHostedNetworkStatus parameter by the /// WlanHostedNetworkQueryStatus function. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_hosted_network_status typedef struct // _WLAN_HOSTED_NETWORK_STATUS { WLAN_HOSTED_NETWORK_STATE HostedNetworkState; GUID IPDeviceID; DOT11_MAC_ADDRESS // wlanHostedNetworkBSSID; DOT11_PHY_TYPE dot11PhyType; ULONG ulChannelFrequency; DWORD dwNumberOfPeers; #if ... // WLAN_HOSTED_NETWORK_PEER_STATE *PeerList[]; #else WLAN_HOSTED_NETWORK_PEER_STATE PeerList[1]; #endif } // WLAN_HOSTED_NETWORK_STATUS, *PWLAN_HOSTED_NETWORK_STATUS; [PInvokeData("wlanapi.h", MSDNShortId = "5fa00041-235f-4f48-a367-e1eaec8474ce")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwNumberOfPeers))] [StructLayout(LayoutKind.Sequential)] public class WLAN_HOSTED_NETWORK_STATUS { /// /// The current state of the wireless Hosted Network. /// /// If the value of this member is wlan_hosted_network_unavailable, then the values of the other fields in this structure /// should not be used. /// /// public WLAN_HOSTED_NETWORK_STATE HostedNetworkState; /// /// The actual network Device ID used for the wireless Hosted Network. /// /// This is member is the GUID of a virtual wireless device which would not be available through calls to the WlanEnumInterfaces /// function. This GUID can be used for calling other higher layer networking functions that use the device GUID (IP Helper /// functions, for example). /// /// public Guid IPDeviceID; /// The BSSID used by the wireless Hosted Network in packets, beacons, and probe responses. public DOT11_MAC_ADDRESS wlanHostedNetworkBSSID; /// /// The physical type of the network interface used by wireless Hosted Network. /// /// This is one of the types reported by the related physical interface. This value is correct only if the /// HostedNetworkState member is wlan_hosted_network_active. /// /// public DOT11_PHY_TYPE dot11PhyType; /// /// The channel frequency of the network interface used by wireless Hosted Network. /// This value is correct only if HostedNetworkState is wlan_hosted_network_active. /// public uint ulChannelFrequency; /// /// The current number of authenticated peers on the wireless Hosted Network. /// This value is correct only if HostedNetworkState is wlan_hosted_network_active. /// public uint dwNumberOfPeers; /// /// /// An array of WLAN_HOSTED_NETWORK_PEER_STATE structures describing each of the current peers on the wireless Hosted Network. /// The number of elements in the array is given by dwNumberOfPeers member. /// /// This value is correct only if HostedNetworkState is wlan_hosted_network_active. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WLAN_HOSTED_NETWORK_PEER_STATE[] PeerList; } /// The WLAN_INTERFACE_CAPABILITY structure contains information about the capabilities of an interface. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_interface_capability typedef struct // _WLAN_INTERFACE_CAPABILITY { WLAN_INTERFACE_TYPE interfaceType; BOOL bDot11DSupported; DWORD dwMaxDesiredSsidListSize; DWORD // dwMaxDesiredBssidListSize; DWORD dwNumberOfSupportedPhys; DOT11_PHY_TYPE dot11PhyTypes[WLAN_MAX_PHY_INDEX]; } // WLAN_INTERFACE_CAPABILITY, *PWLAN_INTERFACE_CAPABILITY; [PInvokeData("wlanapi.h", MSDNShortId = "db7a9066-d699-4860-90cd-dc3f4bf42549")] [StructLayout(LayoutKind.Sequential)] public class WLAN_INTERFACE_CAPABILITY { /// A WLAN_INTERFACE_TYPE value that indicates the type of the interface. public WLAN_INTERFACE_TYPE interfaceType; /// Indicates whether 802.11d is supported by the interface. If TRUE, 802.11d is supported. [MarshalAs(UnmanagedType.Bool)] public bool bDot11DSupported; /// The maximum size of the SSID list supported by this interface. public uint dwMaxDesiredSsidListSize; /// The maximum size of the basic service set (BSS) identifier list supported by this interface. public uint dwMaxDesiredBssidListSize; /// Contains the number of supported PHY types. public uint dwNumberOfSupportedPhys; /// An array of DOT11_PHY_TYPE values that specify the supported PHY types. WLAN_MAX_PHY_INDEX is set to 64. [MarshalAs(UnmanagedType.ByValArray, SizeConst = WLAN_MAX_PHY_INDEX)] public DOT11_PHY_TYPE[] dot11PhyTypes; } /// The WLAN_INTERFACE_INFO_LIST structure contains an array of NIC interface information. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_interface_info_list typedef struct // _WLAN_INTERFACE_INFO_LIST { DWORD dwNumberOfItems; DWORD dwIndex; #if ... WLAN_INTERFACE_INFO *InterfaceInfo[]; #else // WLAN_INTERFACE_INFO InterfaceInfo[1]; #endif } WLAN_INTERFACE_INFO_LIST, *PWLAN_INTERFACE_INFO_LIST; [PInvokeData("wlanapi.h", MSDNShortId = "c57f4658-9f1e-4b05-a298-38a064121bb3")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwNumberOfItems))] [StructLayout(LayoutKind.Sequential)] public class WLAN_INTERFACE_INFO_LIST { /// Contains the number of items in the InterfaceInfo member. public uint dwNumberOfItems; /// /// The index of the current item. The index of the first item is 0. dwIndex must be less than dwNumberOfItems. /// /// This member is not used by the wireless service. Applications can use this member when processing individual interfaces in /// the WLAN_INTERFACE_INFO_LIST structure. When an application passes this structure from one function to another, it /// can set the value of dwIndex to the index of the item currently being processed. This can help an application /// maintain state. /// /// dwIndex should always be initialized before use. /// public uint dwIndex; /// An array of WLAN_INTERFACE_INFO structures containing interface information. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WLAN_INTERFACE_INFO[] InterfaceInfo; } /// The WLAN_PROFILE_INFO_LIST structure contains a list of wireless profile information. // https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_profile_info_list typedef struct // _WLAN_PROFILE_INFO_LIST { DWORD dwNumberOfItems; DWORD dwIndex; #if ... WLAN_PROFILE_INFO *ProfileInfo[]; #else WLAN_PROFILE_INFO // ProfileInfo[1]; #endif } WLAN_PROFILE_INFO_LIST, *PWLAN_PROFILE_INFO_LIST; [PInvokeData("wlanapi.h", MSDNShortId = "d5a3d475-0ae0-4860-a433-dd916c586f50")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(dwNumberOfItems))] [StructLayout(LayoutKind.Sequential)] public class WLAN_PROFILE_INFO_LIST { /// The number of wireless profile entries in the ProfileInfo member. public uint dwNumberOfItems; /// /// /// The index of the current item. The index of the first item is 0. The dwIndex member must be less than the /// dwNumberOfItems member. /// /// /// This member is not used by the wireless service. Applications can use this member when processing individual profiles in the /// WLAN_PROFILE_INFO_LIST structure. When an application passes this structure from one function to another, it can set /// the value of dwIndex to the index of the item currently being processed. This can help an application maintain state. /// /// dwIndex should always be initialized before use. /// public uint dwIndex; /// /// An array of WLAN_PROFILE_INFO structures containing interface information. The number of items in the array is specified in /// the dwNumberOfItems member. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WLAN_PROFILE_INFO[] ProfileInfo; } } }