The WlanHostedNetworkQueryProperty function queries the current static properties of the wireless Hosted Network.
DWORD WlanHostedNetworkQueryProperty( HANDLE hClientHandle, WLAN_HOSTED_NETWORK_OPCODE OpCode, PDWORD pdwDataSize, PVOID *ppvData, PWLAN_OPCODE_VALUE_TYPE pWlanOpcodeValueType, PVOID pvReserved );
The client's session handle, returned by a previous call to the WlanOpenHandle function.
The identifier for property to be queried. This identifier can be any of the values in the WLAN_HOSTED_NETWORK_OPCODE enumeration defined in the Wlanapi.h header file.
A pointer to a value that specifies the size, in bytes, of the buffer returned in the ppvData parameter, if the call to the WlanHostedNetworkQueryProperty function succeeds.
On input, this parameter must be NULL.
On output, this parameter receives a pointer to a buffer returned with the static property requested, if the call to the WlanHostedNetworkQueryProperty function succeeds. The data type associated with this buffer depends upon the value of OpCode parameter.
A pointer to a value that receives the value type of the wireless Hosted Network property, if the call to the WlanHostedNetworkQueryProperty function succeeds. The returned value is an enumerated type in the WLAN_OPCODE_VALUE_TYPE enumeration defined in the Wlanapi.h header file.
Reserved for future use. This parameter must be NULL.
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value may be one of the following return codes.
||The configuration data for the wireless Hosted Network is unconfigured. This error is returned if the application calls the WlanHostedNetworkQueryProperty function with the OpCode parameter set to wlan_hosted_network_opcode_station_profile or wlan_hosted_network_opcode_connection_settings before a SSID is configured in the wireless Hosted Network.|
||A handle is invalid. This error is returned if the handle specified in the hClientHandle parameter was not found in the handle table.|
A parameter is incorrect. This error is returned if any of the following conditions occur:
||The resource is not in the correct state to perform the requested operation. This can occur if the wireless Hosted Network was in the process of shutting down.|
||Not enough storage is available to complete this operation.|
||The service has not been started. This error is returned if the WLAN AutoConfig Service is not running.|
||Various RPC and other error codes. Use FormatMessage to obtain the message string for the returned error.|
The WlanHostedNetworkQueryProperty function is an extension to native wireless APIs added to support the wireless Hosted Network on Windows 7 and on Windows Server 2008 R2 with the Wireless LAN Service installed.
A client application calls the WlanHostedNetworkQueryProperty function to query the current static properties of the wireless Hosted Network. This function does not change the state or properties of the wireless Hosted Network.
If the function succeeds, the ppvData parameter points to a buffer that contains the requested property. The size of this buffer is returned in a pointer returned in the pwdDataSizeparameter. The WLAN_OPCODE_VALUE_TYPE is returned in a pointer returned in the pWlanOpcodeValueType parameter. The memory used for the buffer in the ppvData parameter that is returned should be released by calling the WlanFreeMemory function after the buffer is no longer needed.
The data type associated with the buffer pointed to by the ppvData parameter depends upon the value of OpCode parameter as follows:
|wlan_hosted_network_opcode_connection_settings||A pointer to a WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS structure is returned.|
|wlan_hosted_network_opcode_security_settings||A pointer to a WLAN_HOSTED_NETWORK_SECURITY_SETTINGS structure is returned.|
|wlan_hosted_network_opcode_station_profile||A PWSTR to contains an XML WLAN profile for connecting to the wireless Hosted Network is returned.|
|wlan_hosted_network_opcode_enable||A PBOOL that indicates if wireless Hosted Network is enabled is returned.|
If the WlanHostedNetworkQueryProperty function is passed any of the following values in the OpCode parameter before a SSID is configured in the wireless Hosted Network, the function will fail with ERROR_BAD_CONFIGURATION:
Any user can call the WlanHostedNetworkQueryProperty function to query the Hosted Network properties.
On Windows 7 and later, the operating system installs a virtual device if a Hosted Network capable wireless adapter is present on the machine. This virtual device normally shows up in the “Network Connections Folder” as ‘Wireless Network Connection 2’ with a Device Name of ‘Microsoft Virtual WiFi Miniport adapter’ if the computer has a single wireless network adapter. This virtual device is used exclusively for performing software access point (SoftAP) connections and is not present in the list returned by the WlanEnumInterfaces function. The lifetime of this virtual device is tied to the physical wireless adapter. If the physical wireless adapter is disabled, this virtual device will be removed as well. This feature is also available on Windows Server 2008 R2 with the Wireless LAN Service installed.
|Minimum supported client||Windows 7 [desktop apps only]|
|Minimum supported server||Windows Server 2008 R2 [desktop apps only]|
|Header||wlanapi.h (include Wlanapi.h)|