25extern DWORD (WINAPI *pfnWlanReasonCodeToString)(__in DWORD dwReasonCode, __in DWORD dwBufferSize, __in_ecount(dwBufferSize) PWCHAR pStringBuffer, __reserved PVOID pReserved);
37template<
class _Traits,
class _Ax>
38static DWORD
WlanReasonCodeToString(_In_ DWORD dwReasonCode, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, __reserved PVOID pReserved)
42 if (!::pfnWlanReasonCodeToString)
43 return ERROR_CALL_NOT_IMPLEMENTED;
48 std::unique_ptr<wchar_t[]> szBuffer(
new wchar_t[dwSize]);
51 DWORD dwResult = ::pfnWlanReasonCodeToString(dwReasonCode, dwSize, szBuffer.get(), pReserved);
52 if (dwResult == ERROR_SUCCESS) {
53 DWORD dwLength = (DWORD)wcsnlen(szBuffer.get(), dwSize);
54 if (dwLength < dwSize - 1) {
56 sValue.assign(szBuffer.get(), dwLength);
116 WlanFreeMemory(_Ptr);
122 template<
class _Other>
125 WlanFreeMemory(_Ptr);
158 WlanCloseHandle(
m_h, NULL);
173#pragma warning(suppress: 4505)
175 _In_ DWORD dwClientVersion,
176 _Reserved_ PVOID pReserved,
177 _Out_ PDWORD pdwNegotiatedVersion,
181 DWORD dwResult =
WlanOpenHandle(dwClientVersion, pReserved, pdwNegotiatedVersion, &h);
182 if (dwResult == ERROR_SUCCESS)
Base abstract template class to support generic object handle keeping.
Definition: Common.h:615
handle_type m_h
Object handle.
Definition: Common.h:866
WLAN handle wrapper.
Definition: WLAN.h:135
virtual ~wlan_handle()
Closes a connection to the server.
Definition: WLAN.h:144
void free_internal() noexcept override
Closes a connection to the server.
Definition: WLAN.h:156
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:171
static const HANDLE invalid
Invalid handle value.
Definition: Common.h:625
static DWORD WlanOpenHandle(DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, winstd::wlan_handle &handle)
Opens a connection to the server.
Definition: WLAN.h:174
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:38
WlanFreeMemory_delete()
Default construct.
Definition: WLAN.h:109
void operator()(_Other *) const
Delete a pointer of another type.
Definition: WLAN.h:123
WlanFreeMemory_delete< _Ty > _Myt
This type.
Definition: WLAN.h:104
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: WLAN.h:114
Deleter for unique_ptr using WlanFreeMemory.
Definition: WLAN.h:77
WlanFreeMemory_delete()
Default construct.
Definition: WLAN.h:83
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: WLAN.h:93
WlanFreeMemory_delete< _Ty > _Myt
This type.
Definition: WLAN.h:78
WlanFreeMemory_delete(const WlanFreeMemory_delete< _Ty2 > &)
Construct from another WlanFreeMemory_delete.
Definition: WLAN.h:88