winstd::eap_attr tested and stabilized

This commit is contained in:
Simon Rozman 2016-08-14 21:04:10 +02:00
parent 25c886754d
commit 028979524a
2 changed files with 12 additions and 10 deletions

View File

@ -63,7 +63,7 @@ namespace winstd
/// ///
/// EAP_ATTRIBUTE wrapper class /// EAP_ATTRIBUTE wrapper class
/// ///
class WINSTD_API eap_attr : public EAP_ATTRIBUTE class WINSTD_API __declspec(novtable) eap_attr : public EAP_ATTRIBUTE
{ {
public: public:
/// ///
@ -94,13 +94,14 @@ namespace winstd
/// ///
/// Moves an existing EAP attribute. /// Moves an existing EAP attribute.
/// ///
inline eap_attr(_Inout_ EAP_ATTRIBUTE &&a) inline eap_attr(_Inout_ eap_attr &&a)
{ {
eaType = a.eaType; eaType = a.eaType;
dwLength = a.dwLength; dwLength = a.dwLength;
if (a.dwLength) { if (a.dwLength) {
pValue = a.pValue; pValue = a.pValue;
a.pValue = NULL; a.dwLength = 0;
a.pValue = NULL;
} else } else
pValue = NULL; pValue = NULL;
} }
@ -108,7 +109,7 @@ namespace winstd
/// ///
/// Destroys the EAP attribute. /// Destroys the EAP attribute.
/// ///
virtual ~eap_attr(); ~eap_attr();
/// ///
/// Copies an existing EAP attribute. /// Copies an existing EAP attribute.
@ -136,7 +137,7 @@ namespace winstd
/// ///
/// Moves an existing EAP attribute. /// Moves an existing EAP attribute.
/// ///
inline eap_attr& operator=(_Inout_ EAP_ATTRIBUTE &&a) inline eap_attr& operator=(_Inout_ eap_attr &&a)
{ {
if (this != &a) { if (this != &a) {
eaType = a.eaType; eaType = a.eaType;
@ -144,8 +145,9 @@ namespace winstd
if (pValue) if (pValue)
delete [] pValue; delete [] pValue;
if (a.dwLength) { if (a.dwLength) {
pValue = a.pValue; pValue = a.pValue;
a.pValue = NULL; a.dwLength = 0;
a.pValue = NULL;
} else } else
pValue = NULL; pValue = NULL;
} }
@ -169,7 +171,7 @@ namespace winstd
/// ///
/// EAP_METHOD_PROPERTY wrapper class /// EAP_METHOD_PROPERTY wrapper class
/// ///
class WINSTD_API eap_method_prop : public EAP_METHOD_PROPERTY class WINSTD_API __declspec(novtable) eap_method_prop : public EAP_METHOD_PROPERTY
{ {
public: public:
/// ///

View File

@ -34,7 +34,7 @@ winstd::eap_attr::~eap_attr()
void winstd::eap_attr::create_ms_mppe_key(_In_ BYTE bVendorType, _In_count_(nKeySize) LPCBYTE pbKey, _In_ BYTE nKeySize) void winstd::eap_attr::create_ms_mppe_key(_In_ BYTE bVendorType, _In_count_(nKeySize) LPCBYTE pbKey, _In_ BYTE nKeySize)
{ {
BYTE nPaddingLength = (BYTE)((16 - (1 + nKeySize)) % 16); BYTE nPaddingLength = (BYTE)((16 - (1 + (DWORD)nKeySize)) % 16);
DWORD dwLengthNew = DWORD dwLengthNew =
4 + // Vendor-Id 4 + // Vendor-Id
1 + // Vendor type 1 + // Vendor type