WlanReasonCodeToString function (wlanapi.h)

The WlanReasonCodeToString function retrieves a string that describes a specified reason code.

Syntax

DWORD WlanReasonCodeToString(
  [in] DWORD  dwReasonCode,
  [in] DWORD  dwBufferSize,
  [in] PWCHAR pStringBuffer,
       PVOID  pReserved
);

Parameters

[in] dwReasonCode

A WLAN_REASON_CODE value of which the string description is requested.

[in] dwBufferSize

The size of the buffer used to store the string, in WCHAR. If the reason code string is longer than the buffer, it will be truncated and NULL-terminated. If dwBufferSize is larger than the actual amount of memory allocated to pStringBuffer, then an access violation will occur in the calling program.

[in] pStringBuffer

Pointer to a buffer that will receive the string. The caller must allocate memory to pStringBuffer before calling WlanReasonCodeToString.

pReserved

Reserved for future use. Must be set to NULL.

Return value

If the function succeeds, the return value is a pointer to a constant string.

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:
  • dwBufferSize is 0.
  • pStringBuffer is NULL.
  • pReserved is not NULL.
Other
Various RPC and other error codes. Use FormatMessage to obtain the message string for the returned error.

Requirements

Requirement Value
Minimum supported client Windows Vista, Windows XP with SP3 [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header wlanapi.h (include Wlanapi.h)
Library Wlanapi.lib
DLL Wlanapi.dll
Redistributable Wireless LAN API for Windows XP with SP2

See also

WLAN_REASON_CODE