WFD_OPEN_SESSION_COMPLETE_CALLBACK callback function (wlanapi.h)

The WFD_OPEN_SESSION_COMPLETE_CALLBACK function defines the callback function that is called by the WFDStartOpenSession function when the WFDStartOpenSession operation completes.



void WfdOpenSessionCompleteCallback(
  [in] HANDLE hSessionHandle,
  [in] PVOID pvContext,
  [in] GUID guidSessionInterface,
  [in] DWORD dwError,
  [in] DWORD dwReasonCode


[in] hSessionHandle

A session handle to a Wi-Fi Direct session. This is a session handle previously returned by the WFDStartOpenSession function.

[in] pvContext

An context pointer passed to the callback function from the WFDStartOpenSession function.

[in] guidSessionInterface

The interface GUID of the local network interface on which this Wi-Fi Direct device has an open session. This parameter is useful if higher-layer protocols need to determine which network interface a Wi-Fi Direct session is bound to. This value is only returned if the dwError parameter is ERROR_SUCCESS.

[in] dwError

A value that specifies whether there was an error encountered during the call to the WFDStartOpenSession function. If this value is ERROR_SUCCESS, then no error occurred and the operation to open the session completed successfully.

The following other values are possible:

Value Meaning
The parameter is incorrect. This error is returned if the hClientHandle parameter is NULL or not valid.
The group or resource is not in the correct state to perform the requested operation. This error is returned if the Wi-Fi Direct service is disabled by group policy on a domain.
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.

[in] dwReasonCode

A value that specifies the more detail if an error occurred during WFDStartOpenSession.

Return value



The WFD_OPEN_SESSION_COMPLETE_CALLBACK function is part of Wi-Fi Direct, a new feature in Windows 8 and Windows Server 2012. Wi-Fi Direct is based on the development of the Wi-Fi Peer-to-Peer Technical Specification v1.1 by the Wi-Fi Alliance (see Wi-Fi Alliance Published Specifications). The goal of the Wi-Fi Peer-to-Peer Technical Specification is to provide a solution for Wi-Fi device-to-device connectivity without the need for either a Wireless Access Point (wireless AP) to setup the connection or the use of the existing Wi-Fi adhoc (IBSS) mechanism.

The WFDStartOpenSession function starts an asynchronous operation to start an on-demand connection to a specific Wi-Fi Direct device. The target Wi-Fi device must previously have been paired through the Windows Pairing experience. When the asynchronous operation to make the Wi-FI Direct connection completes, the callback function specified in the pfnCallback parameter is called.


Requirement Value
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header wlanapi.h

See also