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];
235 memcpy(pValue, a.pValue, a.dwLength);
246 dwLength = a.dwLength;
271 dwLength = a.dwLength;
273 BYTE *pValueNew =
new BYTE[a.dwLength];
277 memcpy(pValueNew, a.pValue, a.dwLength);
294 dwLength = a.dwLength;
314 void create_ms_mppe_key(_In_ BYTE bVendorType, _In_count_(nKeySize) LPCBYTE pbKey, _In_ BYTE nKeySize)
316 const BYTE nPaddingLength =
static_cast<BYTE
>((16 - (1 +
static_cast<DWORD
>(nKeySize))) % 16);
317 const DWORD dwLengthNew =
326 #pragma warning(push)
327 #pragma warning(disable: 6386)
328 LPBYTE p =
new BYTE[dwLengthNew];
334 p[5] =
static_cast<BYTE
>(dwLengthNew - 4);
339 memcpy(p + 9, pbKey, nKeySize);
340 memset(p + 9 + nKeySize, 0, nPaddingLength);
345 #pragma warning(suppress: 26812)
346 eaType = eatVendorSpecific;
347 dwLength = dwLengthNew;
372 eapMethodPropertyType = type;
373 eapMethodPropertyValueType = empvtBool;
374 eapMethodPropertyValue.empvBool.length =
sizeof(BOOL);
375 eapMethodPropertyValue.empvBool.value = value;
386 eapMethodPropertyType = type;
387 eapMethodPropertyValueType = empvtDword;
388 eapMethodPropertyValue.empvDword.length =
sizeof(DWORD);
389 eapMethodPropertyValue.empvDword.value = value;
400 eapMethodPropertyType = type;
401 eapMethodPropertyValueType = empvtString;
402 eapMethodPropertyValue.empvString.length =
static_cast<DWORD
>(
sizeof(WCHAR)*(wcslen(value) + 1));
403 eapMethodPropertyValue.empvString.value =
const_cast<BYTE*
>(
reinterpret_cast<const BYTE*
>(value));
437 bool create(_In_ EapCode code, _In_ BYTE
id, _In_ WORD
size)
noexcept
443 h->Code =
static_cast<BYTE
>(code);
445 *
reinterpret_cast<WORD*
>(h->Length) = htons(
size);
450 SetLastError(ERROR_OUTOFMEMORY);
460 return m_h != NULL ? ntohs(*(WORD*)
m_h->Length) : 0;
469 HeapFree(GetProcessHeap(), 0,
m_h);
477 const WORD n = ntohs(*
reinterpret_cast<WORD*
>(h->Length));
480 SetLastError(ERROR_OUTOFMEMORY);
501 dwNumberOfMethods = 0;
512 dwNumberOfMethods = other.dwNumberOfMethods;
513 pEapMethods = other.pEapMethods;
514 other.dwNumberOfMethods = 0;
515 other.pEapMethods = NULL;
534 if (
this != std::addressof(other)) {
537 dwNumberOfMethods = other.dwNumberOfMethods;
538 pEapMethods = other.pEapMethods;
539 other.dwNumberOfMethods = 0;
540 other.pEapMethods = NULL;
548 void free_internal() noexcept
550 for (DWORD i = 0; i < dwNumberOfMethods; i++)
551 free_internal(pEapMethods + i);
553 EapHostPeerFreeMemory(
reinterpret_cast<BYTE*
>(pEapMethods));
556 static void free_internal(_In_ EAP_METHOD_INFO *pMethodInfo)
noexcept
558 if (pMethodInfo->pInnerMethodInfo)
559 free_internal(pMethodInfo->pInnerMethodInfo);
561 EapHostPeerFreeMemory(
reinterpret_cast<BYTE*
>(pMethodInfo->pwszAuthorName));
562 EapHostPeerFreeMemory(
reinterpret_cast<BYTE*
>(pMethodInfo->pwszFriendlyName));
620 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:831
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:243
~eap_attr()
Destroys the EAP attribute.
Definition: EAP.h:258
eap_attr & operator=(eap_attr &&a) noexcept
Moves an existing EAP attribute.
Definition: EAP.h:290
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:314
eap_attr & operator=(const EAP_ATTRIBUTE &a)
Copies an existing EAP attribute.
Definition: EAP.h:267
EAP_METHOD_INFO_ARRAY wrapper class.
Definition: EAP.h:492
eap_method_info_array(eap_method_info_array &&other) noexcept
Move constructor.
Definition: EAP.h:510
eap_method_info_array() noexcept
Constructs an empty array.
Definition: EAP.h:499
~eap_method_info_array()
Destructor.
Definition: EAP.h:521
eap_method_info_array & operator=(eap_method_info_array &&other) noexcept
Move assignment.
Definition: EAP.h:532
EAP_METHOD_PROPERTY wrapper class.
Definition: EAP.h:362
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, BOOL value) noexcept
Constructs a BOOL method property.
Definition: EAP.h:370
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, DWORD value) noexcept
Constructs a DWORD method property.
Definition: EAP.h:384
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, LPCWSTR value) noexcept
Constructs a Unicode string method property.
Definition: EAP.h:398
EapPacket wrapper class.
Definition: EAP.h:411
WORD size() const noexcept
Returns total EAP packet size in bytes.
Definition: EAP.h:458
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the EAP packet.
Definition: EAP.h:475
virtual ~eap_packet()
Destroys the EAP packet.
Definition: EAP.h:418
void free_internal() noexcept override
Destroys the EAP packet.
Definition: EAP.h:467
bool create(EapCode code, BYTE id, WORD size) noexcept
Create new EAP packet.
Definition: EAP.h:437
EapHost runtime error.
Definition: EAP.h:579
const EAP_METHOD_TYPE & type() const noexcept
Returns EAP method type.
Definition: EAP.h:620
GUID m_root_cause_id
A unique ID that identifies cause of error in EAPHost.
Definition: EAP.h:678
const wchar_t * root_cause() const noexcept
Returns root cause ID.
Definition: EAP.h:644
const GUID & repair_id() const noexcept
Returns repair ID.
Definition: EAP.h:652
std::wstring m_repair_desc
A localized and readable string that describes the possible repair action.
Definition: EAP.h:682
DWORD reason() const noexcept
Returns the reason code for error.
Definition: EAP.h:628
EAP_METHOD_TYPE m_type
Structure that identifies the EAP method that raised the error.
Definition: EAP.h:674
eap_runtime_error(const EAP_ERROR &err, const char *msg=nullptr)
Constructs an exception.
Definition: EAP.h:605
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:681
eap_runtime_error(const EAP_ERROR &err, const std::string &msg)
Constructs an exception.
Definition: EAP.h:587
const wchar_t * repair() const noexcept
Returns root cause ID.
Definition: EAP.h:660
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:684
const GUID & root_cause_id() const noexcept
Returns root cause ID.
Definition: EAP.h:636
std::wstring m_root_cause_desc
A localized and readable string that describes the root cause of the error.
Definition: EAP.h:679
const GUID & help_link_id() const noexcept
Returns help_link ID.
Definition: EAP.h:668
DWORD m_reason
The reason code for the error.
Definition: EAP.h:676
T handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:574
handle_type m_h
Object handle.
Definition: Common.h:820
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:783
Windows runtime error.
Definition: Common.h:1010
tstring msg(DWORD dwLanguageId=0) const
Returns a user-readable Windows error message.
Definition: Common.h:1055
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:356
@ 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:66
#define WINSTD_DPLHANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:175
static const T invalid
Invalid handle value.
Definition: Common.h:579
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