21extern DWORD (WINAPI *pfnWlanReasonCodeToString)(__in DWORD dwReasonCode, __in DWORD dwBufferSize, __in_ecount(dwBufferSize) PWCHAR pStringBuffer, __reserved PVOID pReserved);
33template<
class _Traits,
class _Ax>
34static DWORD
WlanReasonCodeToString(_In_ DWORD dwReasonCode, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, __reserved PVOID pReserved)
38 if (!::pfnWlanReasonCodeToString)
39 return ERROR_CALL_NOT_IMPLEMENTED;
44 std::unique_ptr<wchar_t[]> szBuffer(
new wchar_t[dwSize]);
47 DWORD dwResult = ::pfnWlanReasonCodeToString(dwReasonCode, dwSize, szBuffer.get(), pReserved);
48 if (dwResult == ERROR_SUCCESS) {
49 DWORD dwLength = (DWORD)wcsnlen(szBuffer.get(), dwSize);
50 if (dwLength < dwSize - 1) {
52 sValue.assign(szBuffer.get(), dwLength);
112 WlanFreeMemory(_Ptr);
118 template<
class _Other>
121 WlanFreeMemory(_Ptr);
154 WlanCloseHandle(
m_h, NULL);
169#pragma warning(suppress: 4505)
171 _In_ DWORD dwClientVersion,
172 _Reserved_ PVOID pReserved,
173 _Out_ PDWORD pdwNegotiatedVersion,
177 DWORD dwResult =
WlanOpenHandle(dwClientVersion, pReserved, pdwNegotiatedVersion, &h);
178 if (dwResult == ERROR_SUCCESS)
Base abstract template class to support generic object handle keeping.
Definition: Common.h:569
handle_type m_h
Object handle.
Definition: Common.h:823
WLAN handle wrapper.
Definition: WLAN.h:131
virtual ~wlan_handle()
Closes a connection to the server.
Definition: WLAN.h:140
void free_internal() noexcept override
Closes a connection to the server.
Definition: WLAN.h:152
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:163
static const HANDLE invalid
Invalid handle value.
Definition: Common.h:579
static DWORD WlanOpenHandle(DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, winstd::wlan_handle &handle)
Opens a connection to the server.
Definition: WLAN.h:170
static DWORD WlanReasonCodeToString(DWORD dwReasonCode, std::basic_string< wchar_t, _Traits, _Ax > &sValue, __reserved PVOID pReserved)
Retrieves a string that describes a specified reason code and stores it in a std::wstring string.
Definition: WLAN.h:34
WlanFreeMemory_delete()
Default construct.
Definition: WLAN.h:105
void operator()(_Other *) const
Delete a pointer of another type.
Definition: WLAN.h:119
WlanFreeMemory_delete< _Ty > _Myt
This type.
Definition: WLAN.h:100
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: WLAN.h:110
Deleter for unique_ptr using WlanFreeMemory.
Definition: WLAN.h:73
WlanFreeMemory_delete()
Default construct.
Definition: WLAN.h:79
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: WLAN.h:89
WlanFreeMemory_delete< _Ty > _Myt
This type.
Definition: WLAN.h:74
WlanFreeMemory_delete(const WlanFreeMemory_delete< _Ty2 > &)
Construct from another WlanFreeMemory_delete.
Definition: WLAN.h:84