WlanRegisterVirtualStationNotification function

The WlanRegisterVirtualStationNotification function is used to register and unregister notifications on a virtual station.

Syntax

DWORD WlanRegisterVirtualStationNotification(
  HANDLE hClientHandle,
  BOOL   bRegister,
  PVOID  pReserved
);

Parameters

hClientHandle

The client's session handle, obtained by a previous call to the WlanOpenHandle function.

bRegister

A value that specifies whether to receive notifications on a virtual station.

pReserved

Reserved for future use. This parameter must be NULL.

Return Value

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.

Return code Description
ERROR_INVALID_PARAMETER
A parameter is incorrect. This error is returned if any of the following conditions occur:
  • hClientHandle is NULL.
  • pvReserved is not NULL.
ERROR_INVALID_HANDLE
A handle is invalid. This error is returned if the handle specified in the hClientHandle parameter was not found in the handle table.
ERROR_INVALID_STATE
The resource is not in the correct state to perform the requested operation. This error is returned if the wireless Hosted Network is disabled by group policy on a domain.
ERROR_SERVICE_NOT_ACTIVE
The service has not been started. This error is returned if the WLAN AutoConfig Service is not running.
Other
Various RPC and other error codes. Use FormatMessage to obtain the message string for the returned error.

Remarks

The WlanRegisterVirtualStationNotification 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 WlanRegisterVirtualStationNotification function is used to register and unregister notifications on virtual station.

Any registration to receive notifications from a virtual station caused by this function would be automatically undone if the calling application closes its calling handle (by calling WlanCloseHandle with the hClientHandle parameter) or if the process ends.

By default, a application client will not receive notifications on a virtual station. In order to receive these notifications, a client needs to call the WlanRegisterVirtualStationNotification function with the bRegister parameter set to TRUE and must also call the WlanRegisterNotification function with the dwNotifSource parameter set to notification sources to be registered. The registration to receive notifications from a virtual station is in effect until the application closes the client handle (by calling WlanCloseHandle with the hClientHandle parameter), the process ends, or the WlanRegisterVirtualStationNotification function is called with the bRegister parameter set to FALSE.

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.

Requirements

   
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header wlanapi.h (include Wlanapi.h)
Library Wlanapi.lib
DLL Wlanapi.dll

See Also

About the Wireless Hosted Network

Using Wireless Hosted Network and Internet Connection Sharing

WlanCloseHandle

WlanRegisterNotification