1 #ifndef _WLANAPI_H 2 #define _WLANAPI_H 3 4 #include <l2cmn.h> 5 #include <windot11.h> 6 #include <eaptypes.h> 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 /* Defines */ 13 #define WLAN_API_VERSION_1_0 0x00000001 14 #define WLAN_API_VERSION_2_0 0x00000002 15 16 #define WLAN_MAX_PHY_INDEX 64 17 #define WLAN_MAX_NAME_LENGTH 256 18 19 #define WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_ADHOC_PROFILES 0x00000001 20 #define WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_MANUAL_HIDDEN_PROFILES 0x00000002 21 22 #define WLAN_AVAILABLE_NETWORK_CONNECTED 0x00000001 23 #define WLAN_AVAILABLE_NETWORK_HAS_PROFILE 0x00000002 24 #define WLAN_AVAILABLE_NETWORK_CONSOLE_USER_PROFILE 0x00000004 25 #define WLAN_AVAILABLE_NETWORK_INTERWORKING_SUPPORTED 0x00000008 26 #define WLAN_AVAILABLE_NETWORK_HOTSPOT2_ENABLED 0x00000010 27 #define WLAN_AVAILABLE_NETWORK_ANQP_SUPPORTED 0x00000020 28 #define WLAN_AVAILABLE_NETWORK_HOTSPOT2_DOMAIN 0x00000040 29 #define WLAN_AVAILABLE_NETWORK_HOTSPOT2_ROAMING 0x00000080 30 #define WLAN_AVAILABLE_NETWORK_AUTO_CONNECT_FAILED 0x00000100 31 32 #define WLAN_READ_ACCESS (STANDARD_RIGHTS_READ | FILE_READ_DATA) 33 #define WLAN_EXECUTE_ACCESS (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | WLAN_READ_ACCESS) 34 #define WLAN_WRITE_ACCESS (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | DELETE | WRITE_DAC | WLAN_READ_ACCESS | WLAN_EXECUTE_ACCESS) 35 36 /* Enumerations */ 37 38 #if defined(__midl) || defined(__WIDL__) 39 typedef [v1_enum] enum _DOT11_RADIO_STATE { 40 #else 41 typedef enum _DOT11_RADIO_STATE { 42 #endif 43 dot11_radio_state_unknown = 0, 44 dot11_radio_state_on, 45 dot11_radio_state_off 46 } DOT11_RADIO_STATE; /* HACK: WIDL is broken, *PDOT11_RADIO_STATE; */ 47 48 #if defined(__midl) || defined(__WIDL__) 49 typedef [v1_enum] enum _WLAN_OPCODE_VALUE_TYPE { 50 #else 51 typedef enum _WLAN_OPCODE_VALUE_TYPE { 52 #endif 53 wlan_opcode_value_type_query_only = 0, 54 wlan_opcode_value_type_set_by_group_policy, 55 wlan_opcode_value_type_set_by_user, 56 wlan_opcode_value_type_invalid 57 } WLAN_OPCODE_VALUE_TYPE; /* HACK: WIDL is broken , *PWLAN_OPCODE_VALUE_TYPE; */ 58 59 typedef enum _WLAN_SECURABLE_OBJECT { 60 wlan_secure_permit_list = 0, 61 wlan_secure_deny_list, 62 wlan_secure_ac_enabled, 63 wlan_secure_bc_scan_enabled, 64 wlan_secure_bss_type, 65 wlan_secure_show_denied, 66 wlan_secure_interface_properties, 67 wlan_secure_ihv_control, 68 wlan_secure_all_user_profiles_order, 69 wlan_secure_add_new_all_user_profiles, 70 wlan_secure_add_new_per_user_profiles, 71 wlan_secure_media_streaming_mode_enabled, 72 wlan_secure_current_operation_mode, 73 WLAN_SECURABLE_OBJECT_COUNT 74 } WLAN_SECURABLE_OBJECT, *PWLAN_SECURABLE_OBJECT; 75 76 typedef enum _WLAN_CONNECTION_MODE { 77 wlan_connection_mode_profile = 0, 78 wlan_connection_mode_temporary_profile, 79 wlan_connection_mode_discovery_secure, 80 wlan_connection_mode_discovery_unsecure, 81 wlan_connection_mode_auto, 82 wlan_connection_mode_invalid 83 } WLAN_CONNECTION_MODE, *PWLAN_CONNECTION_MODE; 84 85 #if defined(__midl) || defined(__WIDL__) 86 typedef [v1_enum] enum _WLAN_IHV_CONTROL_TYPE { 87 #else 88 typedef enum _WLAN_IHV_CONTROL_TYPE { 89 #endif 90 wlan_ihv_control_type_service, 91 wlan_ihv_control_type_driver 92 } WLAN_IHV_CONTROL_TYPE; /* HACK , *PWLAN_IHV_CONTROL_TYPE; */ 93 94 #if defined(__midl) || defined(__WIDL__) 95 typedef [v1_enum] enum _WLAN_INTF_OPCODE { 96 #else 97 typedef enum _WLAN_INTF_OPCODE { 98 #endif 99 wlan_intf_opcode_autoconf_start = 0x000000000, 100 wlan_intf_opcode_autoconf_enabled, 101 wlan_intf_opcode_background_scan_enabled, 102 wlan_intf_opcode_media_streaming_mode, 103 wlan_intf_opcode_radio_state, 104 wlan_intf_opcode_bss_type, 105 wlan_intf_opcode_interface_state, 106 wlan_intf_opcode_current_connection, 107 wlan_intf_opcode_channel_number, 108 wlan_intf_opcode_supported_infrastructure_auth_cipher_pairs, 109 wlan_intf_opcode_supported_adhoc_auth_cipher_pairs, 110 wlan_intf_opcode_supported_country_or_region_string_list, 111 wlan_intf_opcode_current_operation_mode, 112 wlan_intf_opcode_supported_safe_mode, 113 wlan_intf_opcode_certified_safe_mode, 114 wlan_intf_opcode_hosted_network_capable, 115 wlan_intf_opcode_management_frame_protection_capable, 116 wlan_intf_opcode_autoconf_end = 0x0fffffff, 117 wlan_intf_opcode_msm_start = 0x10000100, 118 wlan_intf_opcode_statistics, 119 wlan_intf_opcode_rssi, 120 wlan_intf_opcode_msm_end = 0x1fffffff, 121 wlan_intf_opcode_security_start = 0x20010000, 122 wlan_intf_opcode_security_end = 0x2fffffff, 123 wlan_intf_opcode_ihv_start = 0x30000000, 124 wlan_intf_opcode_ihv_end = 0x3fffffff 125 } WLAN_INTF_OPCODE; /* HACK: WIDL is broken , *PWLAN_INTF_OPCODE; */ 126 127 #if defined(__midl) || defined(__WIDL__) 128 typedef [v1_enum] enum _WLAN_INTERFACE_STATE { 129 #else 130 typedef enum _WLAN_INTERFACE_STATE { 131 #endif 132 wlan_interface_state_not_ready = 0, 133 wlan_interface_state_connected, 134 wlan_interface_state_ad_hoc_network_formed, 135 wlan_interface_state_disconnecting, 136 wlan_interface_state_disconnected, 137 wlan_interface_state_associating, 138 wlan_interface_state_discovering, 139 wlan_interface_state_authenticating 140 } WLAN_INTERFACE_STATE; 141 142 typedef enum _WLAN_INTERFACE_TYPE { 143 wlan_interface_type_emulated_802_11 = 0, 144 wlan_interface_type_native_802_11, 145 wlan_interface_type_invalid 146 } WLAN_INTERFACE_TYPE, *PWLAN_INTERFACE_TYPE; 147 148 /* Types */ 149 typedef DWORD WLAN_REASON_CODE, *PWLAN_REASON_CODE; 150 typedef ULONG WLAN_SIGNAL_QUALITY, *PWLAN_SIGNAL_QUALITY; 151 152 typedef struct _DOT11_NETWORK { 153 DOT11_SSID dot11Ssid; 154 DOT11_BSS_TYPE dot11BssType; 155 } DOT11_NETWORK, *PDOT11_NETWORK; 156 157 typedef struct _DOT11_NETWORK_LIST { 158 DWORD dwNumberOfItems; 159 DWORD dwIndex; 160 #if defined(__midl) || defined(__WIDL__) 161 [size_is(dwNumberOfItems)] DOT11_NETWORK Network[]; 162 #else 163 DOT11_NETWORK Network[1]; 164 #endif 165 } DOT11_NETWORK_LIST, *PDOT11_NETWORK_LIST; 166 167 typedef struct _WLAN_INTERFACE_INFO { 168 GUID InterfaceGuid; 169 WCHAR strInterfaceDescription[256]; 170 WLAN_INTERFACE_STATE isState; 171 } WLAN_INTERFACE_INFO, *PWLAN_INTERFACE_INFO; 172 173 typedef struct _WLAN_INTERFACE_INFO_LIST { 174 DWORD dwNumberOfItems; 175 DWORD dwIndex; 176 #if defined(__midl) || defined(__WIDL__) 177 [unique, size_is(dwNumberOfItems)] WLAN_INTERFACE_INFO InterfaceInfo[*]; 178 #else 179 WLAN_INTERFACE_INFO InterfaceInfo[1]; 180 #endif 181 } WLAN_INTERFACE_INFO_LIST, *PWLAN_INTERFACE_INFO_LIST; 182 183 typedef struct _WLAN_INTERFACE_CAPABILITY { 184 WLAN_INTERFACE_TYPE interfaceType; 185 BOOL bDot11DSupported; 186 DWORD dwMaxDesiredSsidListSize; 187 DWORD dwMaxDesiredBssidListSize; 188 DWORD dwNumberOfSupportedPhys; 189 /* enum32 */ long dot11PhyTypes[WLAN_MAX_PHY_INDEX]; 190 } WLAN_INTERFACE_CAPABILITY, *PWLAN_INTERFACE_CAPABILITY; 191 192 typedef struct _WLAN_PHY_RADIO_STATE { 193 DWORD dwPhyIndex; 194 DOT11_RADIO_STATE dot11SoftwareRadioState; 195 DOT11_RADIO_STATE dot11HardwareRadioState; 196 } WLAN_PHY_RADIO_STATE, *PWLAN_PHY_RADIO_STATE; 197 198 typedef struct _WLAN_RADIO_STATE { 199 DWORD dwNumberOfPhys; 200 WLAN_PHY_RADIO_STATE PhyRadioState[WLAN_MAX_PHY_INDEX]; 201 } WLAN_RADIO_STATE, *PWLAN_RADIO_STATE; 202 203 typedef struct _WLAN_RAW_DATA { 204 DWORD dwDataSize; 205 #if defined(__midl) || defined(__WIDL__) 206 [size_is(dwDataSize)] BYTE DataBlob[]; 207 #else 208 BYTE DataBlob[1]; 209 #endif 210 } WLAN_RAW_DATA, *PWLAN_RAW_DATA; 211 212 typedef struct _WLAN_PROFILE_INFO { 213 WCHAR strProfileName[256]; 214 DWORD dwFlags; 215 } WLAN_PROFILE_INFO, *PWLAN_PROFILE_INFO; 216 217 typedef struct _WLAN_PROFILE_INFO_LIST { 218 DWORD dwNumberOfItems; 219 DWORD dwIndex; 220 #if defined(__midl) || defined(__WIDL__) 221 [size_is(dwNumberOfItems)] WLAN_PROFILE_INFO ProfileInfo[]; 222 #else 223 WLAN_PROFILE_INFO ProfileInfo[1]; 224 #endif 225 } WLAN_PROFILE_INFO_LIST, *PWLAN_PROFILE_INFO_LIST; 226 227 typedef struct _WLAN_AVAILABLE_NETWORK { 228 WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; 229 DOT11_SSID dot11Ssid; 230 DOT11_BSS_TYPE dot11BssType; 231 ULONG uNumberOfBssids; 232 BOOL bNetworkConnectable; 233 WLAN_REASON_CODE wlanNotConnectableReason; 234 ULONG uNumberOfPhyTypes; 235 DOT11_PHY_TYPE dot11PhyTypes[8]; 236 BOOL bMorePhyTypes; 237 WLAN_SIGNAL_QUALITY wlanSignalQuality; 238 BOOL bSecurityEnabled; 239 DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm; 240 DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm; 241 DWORD dwFlags; 242 DWORD dwReserved; 243 } WLAN_AVAILABLE_NETWORK, *PWLAN_AVAILABLE_NETWORK; 244 245 typedef struct _WLAN_AVAILABLE_NETWORK_LIST { 246 DWORD dwNumberOfItems; 247 DWORD dwIndex; 248 #if defined(__midl) || defined(__WIDL__) 249 [size_is(dwNumberOfItems)] WLAN_AVAILABLE_NETWORK Network[*]; 250 #else 251 WLAN_AVAILABLE_NETWORK Network[1]; 252 #endif 253 } WLAN_AVAILABLE_NETWORK_LIST ,*PWLAN_AVAILABLE_NETWORK_LIST; 254 255 typedef struct _WLAN_CONNECTION_PARAMETERS { 256 WLAN_CONNECTION_MODE wlanConnectionMode; 257 #if defined(__midl) || defined(__WIDL__) 258 [string] LPCWSTR strProfile; 259 #else 260 LPCWSTR strProfile; 261 #endif 262 PDOT11_SSID pDot11Ssid; 263 PDOT11_BSSID_LIST pDesiredBssidList; 264 DOT11_BSS_TYPE dot11BssType; 265 DWORD dwFlags; 266 } WLAN_CONNECTION_PARAMETERS, *PWLAN_CONNECTION_PARAMETERS; 267 268 typedef L2_NOTIFICATION_DATA WLAN_NOTIFICATION_DATA, *PWLAN_NOTIFICATION_DATA; 269 270 typedef void (__stdcall *WLAN_NOTIFICATION_CALLBACK) (PWLAN_NOTIFICATION_DATA, PVOID); 271 272 /* Functions */ 273 #if !defined(__midl) && !defined(__WIDL__) 274 PVOID WINAPI WlanAllocateMemory(DWORD dwSize); 275 VOID WINAPI WlanFreeMemory(PVOID pMemory); 276 DWORD WINAPI WlanOpenHandle(IN DWORD dwClientVersion, PVOID pReserved, OUT DWORD *pdwNegotiatedVersion, OUT HANDLE *phClientHandle); 277 DWORD WINAPI WlanCloseHandle(IN HANDLE hClientHandle, PVOID pReserved); 278 DWORD WINAPI WlanConnect(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN const PWLAN_CONNECTION_PARAMETERS pConnectionParameters, PVOID pReserved); 279 DWORD WINAPI WlanDisconnect(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, PVOID pReserved); 280 DWORD WINAPI WlanEnumInterfaces(IN HANDLE hClientHandle, PVOID pReserved, OUT PWLAN_INTERFACE_INFO_LIST *ppInterfaceList); 281 DWORD WINAPI WlanGetAvailableNetworkList(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN DWORD dwFlags, PVOID pReserved, OUT PWLAN_AVAILABLE_NETWORK_LIST *ppAvailableNetworkList); 282 DWORD WINAPI WlanGetInterfaceCapability(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, PVOID pReserved, OUT PWLAN_INTERFACE_CAPABILITY *ppCapability); 283 DWORD WINAPI WlanDeleteProfile(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN LPCWSTR strProfileName, PVOID pReserved); 284 DWORD WINAPI WlanGetProfile(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN LPCWSTR strProfileName, PVOID pReserved, OUT LPWSTR *pstrProfileXml, DWORD *pdwFlags, PDWORD pdwGrantedAccess); 285 DWORD WINAPI WlanGetProfileCustomUserData(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN LPCWSTR strProfileName, PVOID pReserved, OUT DWORD *pdwDataSize, OUT PBYTE *ppData); 286 DWORD WINAPI WlanGetProfileList(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, PVOID pReserved, OUT PWLAN_PROFILE_INFO_LIST *ppProfileList); 287 DWORD WINAPI WlanIhvControl(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN WLAN_IHV_CONTROL_TYPE Type, IN DWORD dwInBufferSize, IN PVOID pInBuffer, IN DWORD dwOutBufferSize, PVOID pOutBuffer, OUT PDWORD pdwBytesReturned); 288 DWORD WINAPI WlanQueryInterface(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN WLAN_INTF_OPCODE OpCode, PVOID pReserved, OUT PDWORD pdwDataSize, OUT PVOID *ppData, WLAN_OPCODE_VALUE_TYPE *pWlanOpcodeValueType); 289 DWORD WINAPI WlanReasonCodeToString(IN DWORD dwReasonCode, IN DWORD dwBufferSize, IN PWCHAR pStringBuffer, PVOID pReserved); 290 DWORD WINAPI WlanRegisterNotification(IN HANDLE hClientHandle,IN DWORD dwNotifSource, IN BOOL bIgnoreDuplicate, WLAN_NOTIFICATION_CALLBACK funcCallback, PVOID pCallbackContext, PVOID pReserved, PDWORD pdwPrevNotifSource); 291 DWORD WINAPI WlanRenameProfile(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN LPCWSTR strOldProfileName, IN LPCWSTR strNewProfileName, PVOID pReserved); 292 DWORD WINAPI WlanSetProfile(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN DWORD dwFlags, IN LPCWSTR strProfileXml, LPCWSTR strAllUserProfileSecurity, IN BOOL bOverwrite, PVOID pReserved, OUT DWORD *pdwReasonCode); 293 DWORD WINAPI WlanSetProfileCustomUserData(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN LPCWSTR strProfileName, IN DWORD dwDataSize, IN const PBYTE pData, PVOID pReserved); 294 DWORD WINAPI WlanSetProfileEapUserData(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN LPCWSTR strProfileName, IN EAP_METHOD_TYPE eapType, IN DWORD dwFlags, IN DWORD dwEapUserDataSize, IN const LPBYTE pbEapUserData, PVOID pReserved); 295 DWORD WINAPI WlanSetProfileList(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, DWORD dwItems, IN LPCWSTR *strProfileNames, PVOID pReserved); 296 DWORD WINAPI WlanSetSecuritySettings(IN HANDLE hClientHandle, IN WLAN_SECURABLE_OBJECT SecurableObject, IN LPCWSTR strModifiedSDDL); 297 DWORD WINAPI WlanScan(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN PDOT11_SSID pDot11Ssid, IN PWLAN_RAW_DATA pIeData, PVOID pReserved); 298 #endif 299 300 #ifdef __cplusplus 301 } 302 #endif 303 304 305 #endif // _WLANAPI_H 306