12#include <eaphostpeerconfigapis.h>
14#include <EapHostPeerTypes.h>
15#include <eapmethodtypes.h>
21#pragma warning(disable: 26812)
24#pragma warning(disable: 4505)
39static bool operator==(_In_
const EAP_METHOD_TYPE &a, _In_
const EAP_METHOD_TYPE &b)
noexcept
42 a.eapType.type == b.eapType.type &&
43 a.eapType.dwVendorId == b.eapType.dwVendorId &&
44 a.eapType.dwVendorType == b.eapType.dwVendorType &&
45 a.dwAuthorId == a.dwAuthorId;
58static bool operator!=(_In_
const EAP_METHOD_TYPE &a, _In_
const EAP_METHOD_TYPE &b)
noexcept
77 #pragma warning(suppress: 4480)
121 EapHostPeerFreeMemory((BYTE*)_Ptr);
128 typedef std::unique_ptr<BYTE[], EapHostPeerFreeMemory_delete>
eap_blob;
146 EapHostPeerFreeRuntimeMemory((BYTE*)_Ptr);
172 EapHostPeerFreeErrorMemory(_Ptr);
179 typedef std::unique_ptr<EAP_ERROR, EapHostPeerFreeErrorMemory_delete>
eap_error;
198 EapHostPeerFreeEapError(_Ptr);
210 #pragma warning(push)
211 #pragma warning(disable: 26432)
220 eaType = eatReserved;
231 dwLength = a.dwLength;
233 pValue =
new BYTE[a.dwLength];
234 memcpy(pValue, a.pValue, a.dwLength);
245 dwLength = a.dwLength;
270 dwLength = a.dwLength;
272 BYTE *pValueNew =
new BYTE[a.dwLength];
275 memcpy(pValueNew, a.pValue, a.dwLength);
290 dwLength = a.dwLength;
310 void create_ms_mppe_key(_In_ BYTE bVendorType, _In_count_(nKeySize) LPCBYTE pbKey, _In_ BYTE nKeySize)
312 const BYTE nPaddingLength =
static_cast<BYTE
>((16 - (1 +
static_cast<DWORD
>(nKeySize))) % 16);
313 const DWORD dwLengthNew =
322 #pragma warning(push)
323 #pragma warning(disable: 6386)
324 LPBYTE p =
new BYTE[dwLengthNew];
330 p[5] =
static_cast<BYTE
>(dwLengthNew - 4);
335 memcpy(p + 9, pbKey, nKeySize);
336 memset(p + 9 + nKeySize, 0, nPaddingLength);
341 #pragma warning(suppress: 26812)
342 eaType = eatVendorSpecific;
343 dwLength = dwLengthNew;
368 eapMethodPropertyType = type;
369 eapMethodPropertyValueType = empvtBool;
370 eapMethodPropertyValue.empvBool.length =
sizeof(BOOL);
371 eapMethodPropertyValue.empvBool.value = value;
382 eapMethodPropertyType = type;
383 eapMethodPropertyValueType = empvtDword;
384 eapMethodPropertyValue.empvDword.length =
sizeof(DWORD);
385 eapMethodPropertyValue.empvDword.value = value;
396 eapMethodPropertyType = type;
397 eapMethodPropertyValueType = empvtString;
398 eapMethodPropertyValue.empvString.length =
static_cast<DWORD
>(
sizeof(WCHAR)*(wcslen(value) + 1));
399 eapMethodPropertyValue.empvString.value =
const_cast<BYTE*
>(
reinterpret_cast<const BYTE*
>(value));
433 bool create(_In_ EapCode code, _In_ BYTE
id, _In_ WORD
size)
noexcept
439 h->Code =
static_cast<BYTE
>(code);
441 *
reinterpret_cast<WORD*
>(h->Length) = htons(
size);
446 SetLastError(ERROR_OUTOFMEMORY);
456 return m_h != NULL ? ntohs(*(WORD*)
m_h->Length) : 0;
465 HeapFree(GetProcessHeap(), 0,
m_h);
474 const WORD n = ntohs(*
reinterpret_cast<WORD*
>(h->Length));
477 _Analysis_assume_(h2 != NULL);
481 throw std::bad_alloc();
498 dwNumberOfMethods = 0;
509 dwNumberOfMethods = other.dwNumberOfMethods;
510 pEapMethods = other.pEapMethods;
511 other.dwNumberOfMethods = 0;
512 other.pEapMethods = NULL;
531 if (
this != std::addressof(other)) {
534 dwNumberOfMethods = other.dwNumberOfMethods;
535 pEapMethods = other.pEapMethods;
536 other.dwNumberOfMethods = 0;
537 other.pEapMethods = NULL;
545 void free_internal() noexcept
547 for (DWORD i = 0; i < dwNumberOfMethods; i++)
548 free_internal(pEapMethods + i);
550 EapHostPeerFreeMemory(
reinterpret_cast<BYTE*
>(pEapMethods));
553 static void free_internal(_In_ EAP_METHOD_INFO *pMethodInfo)
noexcept
555 if (pMethodInfo->pInnerMethodInfo)
556 free_internal(pMethodInfo->pInnerMethodInfo);
558 EapHostPeerFreeMemory(
reinterpret_cast<BYTE*
>(pMethodInfo->pwszAuthorName));
559 EapHostPeerFreeMemory(
reinterpret_cast<BYTE*
>(pMethodInfo->pwszFriendlyName));
631 const EAP_METHOD_TYPE&
type() const noexcept
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition Common.h:1137
EAP_ATTRIBUTE wrapper class.
Definition EAP.h:213
eap_attr() noexcept
Initializes a new EAP attribute set to eatReserved.
Definition EAP.h:218
eap_attr(eap_attr &&a) noexcept
Moves an existing EAP attribute.
Definition EAP.h:242
~eap_attr()
Destroys the EAP attribute.
Definition EAP.h:257
eap_attr & operator=(eap_attr &&a) noexcept
Moves an existing EAP attribute.
Definition EAP.h:286
eap_attr(const EAP_ATTRIBUTE &a)
Copies an existing EAP attribute.
Definition EAP.h:228
void create_ms_mppe_key(BYTE bVendorType, LPCBYTE pbKey, BYTE nKeySize)
Creates MS-MPPE-Send-Key or MS-MPPE-Recv-Key.
Definition EAP.h:310
eap_attr & operator=(const EAP_ATTRIBUTE &a)
Copies an existing EAP attribute.
Definition EAP.h:266
EAP_METHOD_INFO_ARRAY wrapper class.
Definition EAP.h:489
eap_method_info_array(eap_method_info_array &&other) noexcept
Move constructor.
Definition EAP.h:507
eap_method_info_array() noexcept
Constructs an empty array.
Definition EAP.h:496
~eap_method_info_array()
Destructor.
Definition EAP.h:518
eap_method_info_array & operator=(eap_method_info_array &&other) noexcept
Move assignment.
Definition EAP.h:529
EAP_METHOD_PROPERTY wrapper class.
Definition EAP.h:358
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, BOOL value) noexcept
Constructs a BOOL method property.
Definition EAP.h:366
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, DWORD value) noexcept
Constructs a DWORD method property.
Definition EAP.h:380
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, LPCWSTR value) noexcept
Constructs a Unicode string method property.
Definition EAP.h:394
EapPacket wrapper class.
Definition EAP.h:407
WORD size() const noexcept
Returns total EAP packet size in bytes.
Definition EAP.h:454
virtual ~eap_packet()
Destroys the EAP packet.
Definition EAP.h:414
void free_internal() noexcept override
Destroys the EAP packet.
Definition EAP.h:463
bool create(EapCode code, BYTE id, WORD size) noexcept
Create new EAP packet.
Definition EAP.h:433
handle_type duplicate_internal(handle_type h) const override
Duplicates the EAP packet.
Definition EAP.h:471
EapHost runtime error.
Definition EAP.h:576
const EAP_METHOD_TYPE & type() const noexcept
Returns EAP method type.
Definition EAP.h:631
GUID m_root_cause_id
A unique ID that identifies cause of error in EAPHost.
Definition EAP.h:689
const wchar_t * root_cause() const noexcept
Returns root cause ID.
Definition EAP.h:655
const GUID & repair_id() const noexcept
Returns repair ID.
Definition EAP.h:663
eap_runtime_error(const EAP_ERROR &err)
Constructs an exception.
Definition EAP.h:600
std::wstring m_repair_desc
A localized and readable string that describes the possible repair action.
Definition EAP.h:693
DWORD reason() const noexcept
Returns the reason code for error.
Definition EAP.h:639
EAP_METHOD_TYPE m_type
Structure that identifies the EAP method that raised the error.
Definition EAP.h:685
GUID m_repair_id
A unique ID that maps to a localizable string that identifies the repair action that can be taken to ...
Definition EAP.h:692
eap_runtime_error(const EAP_ERROR &err, const std::string &msg)
Constructs an exception.
Definition EAP.h:584
const wchar_t * repair() const noexcept
Returns root cause ID.
Definition EAP.h:671
GUID m_help_link_id
A unique ID that maps to a localizable string that specifies an URL for a page that contains addition...
Definition EAP.h:695
eap_runtime_error(const EAP_ERROR &err, const char *msg)
Constructs an exception.
Definition EAP.h:617
const GUID & root_cause_id() const noexcept
Returns root cause ID.
Definition EAP.h:647
std::wstring m_root_cause_desc
A localized and readable string that describes the root cause of the error.
Definition EAP.h:690
const GUID & help_link_id() const noexcept
Returns help_link ID.
Definition EAP.h:679
DWORD m_reason
The reason code for the error.
Definition EAP.h:687
handle_type m_h
Definition Common.h:1126
void attach(handle_type h) noexcept
Definition Common.h:1089
EapPacket * handle_type
Definition Common.h:879
Windows runtime error.
Definition Common.h:1403
std::unique_ptr< EAP_ERROR, EapHostPeerFreeEapError_delete > eap_error_runtime
EAP_ERROR wrapper class.
Definition EAP.h:205
std::unique_ptr< BYTE[], EapHostPeerFreeMemory_delete > eap_blob
EapHost BLOB wrapper class.
Definition EAP.h:128
static bool operator==(const EAP_METHOD_TYPE &a, const EAP_METHOD_TYPE &b) noexcept
Are EAP method types equal?
Definition EAP.h:39
eap_type_t
EAP method numbers.
Definition EAP.h:78
std::unique_ptr< EAP_ERROR, EapHostPeerFreeErrorMemory_delete > eap_error
EAP_ERROR wrapper class.
Definition EAP.h:179
std::unique_ptr< BYTE[], EapHostPeerFreeRuntimeMemory_delete > eap_blob_runtime
EapHost BLOB wrapper class.
Definition EAP.h:153
static bool operator!=(const EAP_METHOD_TYPE &a, const EAP_METHOD_TYPE &b) noexcept
Are EAP method types non-equal?
Definition EAP.h:58
static const EAP_ATTRIBUTE blank_eap_attr
Blank EAP attribute.
Definition EAP.h:352
@ notification
Notification.
@ md5_challenge
MD5-Challenge.
@ legacy_pap
PAP (Not actually an EAP method; Moved to the Unassigned area)
@ gtc
Generic Token Card (GTC)
@ undefined
Undefined EAP type.
@ end
End of EAP methods (non-inclusive)
@ gtcp
EAP-GTC using a password.
@ noneap_start
Start of non-EAP methods.
@ noneap_end
End of non-EAP methods (non-inclusive)
@ otp
One-Time Password (OTP)
@ legacy_mschapv2
MSCHAPv2 (Not actually an EAP method; Moved to the Unassigned area)
@ ms_auth_tlv
MS-Authentication-TLV.
@ start
Start of EAP methods.
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition Common.h:67
#define WINSTD_DPLHANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:176
static const EapPacket * invalid
Definition Common.h:884
Deleter for unique_ptr to EAP_ERROR using EapHostPeerFreeEapError.
Definition EAP.h:185
EapHostPeerFreeEapError_delete() noexcept
Default constructor.
Definition EAP.h:189
void operator()(EAP_ERROR *_Ptr) const noexcept
Delete a pointer.
Definition EAP.h:196
Deleter for unique_ptr to EAP_ERROR using EapHostPeerFreeErrorMemory.
Definition EAP.h:159
EapHostPeerFreeErrorMemory_delete() noexcept
Default constructor.
Definition EAP.h:163
void operator()(EAP_ERROR *_Ptr) const noexcept
Delete a pointer.
Definition EAP.h:170
Deleter for unique_ptr using EapHostPeerFreeMemory.
Definition EAP.h:107
void operator()(_T *_Ptr) const
Delete a pointer.
Definition EAP.h:119
EapHostPeerFreeMemory_delete() noexcept
Default constructor.
Definition EAP.h:111
Deleter for unique_ptr using EapHostPeerFreeRuntimeMemory.
Definition EAP.h:134
void operator()(_T *_Ptr) const
Delete a pointer.
Definition EAP.h:144
EapHostPeerFreeRuntimeMemory_delete() noexcept
Default constructor.
Definition EAP.h:138