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;
43 sSize = SIZETAdd(sSize, 1024);
44 if (sSize > DWORD_MAX)
45 throw std::runtime_error(
"Data too big");
46 sValue.resize(sSize - 1);
49 DWORD dwResult = ::pfnWlanReasonCodeToString(dwReasonCode,
static_cast<DWORD
>(sSize), &sValue[0], pReserved);
50 if (dwResult == ERROR_SUCCESS) {
51 SIZE_T sLength = wcsnlen(&sValue[0], sSize);
52 if (sLength < sSize - 1) {
54 sValue.resize(sLength);
34static DWORD
WlanReasonCodeToString(_In_ DWORD dwReasonCode, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, __reserved PVOID pReserved) {
…}
114 WlanFreeMemory(_Ptr);
120 template<
class _Other>
123 WlanFreeMemory(_Ptr);
156 WlanCloseHandle(
m_h, NULL);
171#pragma warning(suppress: 4505)
173 _In_ DWORD dwClientVersion,
174 _Reserved_ PVOID pReserved,
175 _Out_ PDWORD pdwNegotiatedVersion,
179 DWORD dwResult =
WlanOpenHandle(dwClientVersion, pReserved, pdwNegotiatedVersion, &h);
180 if (dwResult == ERROR_SUCCESS)
Base abstract template class to support generic object handle keeping.
Definition Common.h:874
handle_type m_h
Definition Common.h:1126
WLAN handle wrapper.
Definition WLAN.h:133
virtual ~wlan_handle()
Closes a connection to the server.
Definition WLAN.h:142
void free_internal() noexcept override
Closes a connection to the server.
Definition WLAN.h:154
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
static const HANDLE invalid
Definition Common.h:884
static DWORD WlanOpenHandle(DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, winstd::wlan_handle &handle)
Opens a connection to the server.
Definition WLAN.h:172
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< _Ty > _Myt
This type.
Definition WLAN.h:102
WlanFreeMemory_delete()
Default construct.
Definition WLAN.h:107
void operator()(_Other *) const
Delete a pointer of another type.
Definition WLAN.h:121
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition WLAN.h:112
Deleter for unique_ptr using WlanFreeMemory.
Definition WLAN.h:75
WlanFreeMemory_delete()
Default construct.
Definition WLAN.h:81
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition WLAN.h:91
WlanFreeMemory_delete(const WlanFreeMemory_delete< _Ty2 > &)
Construct from another WlanFreeMemory_delete.
Definition WLAN.h:86
WlanFreeMemory_delete< _Ty > _Myt
This type.
Definition WLAN.h:76