Resolve code analysis reported warnings
This commit is contained in:
parent
51a82c242f
commit
aa7cd261f2
@ -53,6 +53,9 @@ namespace winstd
|
||||
///
|
||||
inline base64_enc() : num(0)
|
||||
{
|
||||
buf[0] = 0;
|
||||
buf[1] = 0;
|
||||
buf[2] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -181,6 +184,10 @@ namespace winstd
|
||||
///
|
||||
inline base64_dec() : num(0)
|
||||
{
|
||||
buf[0] = 0;
|
||||
buf[1] = 0;
|
||||
buf[2] = 0;
|
||||
buf[3] = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,11 +29,11 @@
|
||||
|
||||
namespace winstd
|
||||
{
|
||||
class WINSTD_API com_runtime_error;
|
||||
template <class T> class com_obj;
|
||||
class WINSTD_API bstr;
|
||||
class WINSTD_API variant;
|
||||
class WINSTD_API com_initializer;
|
||||
class WINSTD_API com_runtime_error;
|
||||
}
|
||||
|
||||
#pragma once
|
||||
@ -41,6 +41,54 @@ namespace winstd
|
||||
|
||||
namespace winstd
|
||||
{
|
||||
|
||||
///
|
||||
/// \defgroup WinStdExceptions Exceptions
|
||||
/// Additional exceptions
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// COM runtime error
|
||||
///
|
||||
/// \note Must be defined as derived class from num_runtime_error<> to allow correct type info for dynamic typecasting and prevent folding with other derivates of num_runtime_error<>.
|
||||
///
|
||||
class WINSTD_API com_runtime_error : public num_runtime_error<HRESULT>
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs an exception
|
||||
///
|
||||
/// \param[in] num COM error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline com_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<HRESULT>(num, msg.c_str())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructs an exception
|
||||
///
|
||||
/// \param[in] num COM error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline com_runtime_error(_In_ error_type num, _In_z_ const char *msg) : num_runtime_error<HRESULT>(num, msg)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Copies an exception
|
||||
///
|
||||
/// \param[in] other Exception to copy from
|
||||
///
|
||||
inline com_runtime_error(const com_runtime_error &other) : num_runtime_error<HRESULT>(other)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/// @}
|
||||
/// \addtogroup WinStdCOM
|
||||
/// @{
|
||||
|
||||
@ -265,7 +313,9 @@ namespace winstd
|
||||
inline variant(_In_ const VARIANT& varSrc)
|
||||
{
|
||||
vt = VT_EMPTY;
|
||||
VariantCopy(this, &varSrc);
|
||||
HRESULT hr = VariantCopy(this, &varSrc);
|
||||
if (FAILED(hr))
|
||||
throw winstd::com_runtime_error(hr, "VariantCopy failed.");
|
||||
}
|
||||
|
||||
///
|
||||
@ -477,8 +527,11 @@ namespace winstd
|
||||
///
|
||||
inline variant& operator=(_In_ const VARIANT& varSrc)
|
||||
{
|
||||
if (this != &varSrc)
|
||||
VariantCopy(this, &varSrc);
|
||||
if (this != &varSrc) {
|
||||
HRESULT hr = VariantCopy(this, &varSrc);
|
||||
if (FAILED(hr))
|
||||
throw winstd::com_runtime_error(hr, "VariantCopy failed.");
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1040,52 +1093,4 @@ namespace winstd
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
/// \defgroup WinStdExceptions Exceptions
|
||||
/// Additional exceptions
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// COM runtime error
|
||||
///
|
||||
/// \note Must be defined as derived class from num_runtime_error<> to allow correct type info for dynamic typecasting and prevent folding with other derivates of num_runtime_error<>.
|
||||
///
|
||||
class WINSTD_API com_runtime_error : public num_runtime_error<HRESULT>
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs an exception
|
||||
///
|
||||
/// \param[in] num COM error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline com_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<HRESULT>(num, msg.c_str())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Constructs an exception
|
||||
///
|
||||
/// \param[in] num COM error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline com_runtime_error(_In_ error_type num, _In_z_ const char *msg) : num_runtime_error<HRESULT>(num, msg)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Copies an exception
|
||||
///
|
||||
/// \param[in] other Exception to copy from
|
||||
///
|
||||
inline com_runtime_error(const com_runtime_error &other) : num_runtime_error<HRESULT>(other)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
@ -119,9 +119,9 @@ private: \
|
||||
public: \
|
||||
inline C ( ) { } \
|
||||
inline C (_In_ handle_type h) : handle<handle_type>( h ) { } \
|
||||
inline C (_Inout_ C &&h) : handle<handle_type>(std::move(h)) { } \
|
||||
inline C (_Inout_ C &&h) noexcept : handle<handle_type>(std::move(h)) { } \
|
||||
inline C& operator=(_In_ handle_type h) { handle<handle_type>::operator=( h ); return *this; } \
|
||||
inline C& operator=(_Inout_ C &&h) { handle<handle_type>::operator=(std::move(h)); return *this; } \
|
||||
inline C& operator=(_Inout_ C &&h) noexcept { handle<handle_type>::operator=(std::move(h)); return *this; } \
|
||||
WINSTD_NONCOPYABLE(C)
|
||||
|
||||
///
|
||||
@ -132,10 +132,10 @@ public: \
|
||||
inline C ( ) { } \
|
||||
inline C (_In_ handle_type h) : dplhandle<handle_type>( h ) { } \
|
||||
inline C (_In_ const C &h) : dplhandle<handle_type>(duplicate_internal(h.m_h)) { } \
|
||||
inline C (_Inout_ C &&h) : dplhandle<handle_type>(std::move (h )) { } \
|
||||
inline C (_Inout_ C &&h) noexcept : dplhandle<handle_type>(std::move (h )) { } \
|
||||
inline C& operator=(_In_ handle_type h) { dplhandle<handle_type>::operator=( h ); return *this; } \
|
||||
inline C& operator=(_In_ const C &h) { dplhandle<handle_type>::operator=( h ); return *this; } \
|
||||
inline C& operator=(_Inout_ C &&h) { dplhandle<handle_type>::operator=(std::move(h)); return *this; } \
|
||||
inline C& operator=(_Inout_ C &&h) noexcept { dplhandle<handle_type>::operator=(std::move(h)); return *this; } \
|
||||
private:
|
||||
|
||||
/// @}
|
||||
@ -640,7 +640,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
inline handle(_Inout_ handle<handle_type> &&h)
|
||||
inline handle(_Inout_ handle<handle_type> &&h) noexcept
|
||||
{
|
||||
// Transfer handle.
|
||||
m_h = h.m_h;
|
||||
@ -669,7 +669,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
inline handle<handle_type>& operator=(_Inout_ handle<handle_type> &&h)
|
||||
inline handle<handle_type>& operator=(_Inout_ handle<handle_type> &&h) noexcept
|
||||
{
|
||||
if (this != std::addressof(h)) {
|
||||
// Transfer handle.
|
||||
@ -900,7 +900,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
inline dplhandle<handle_type>(_Inout_ dplhandle<handle_type> &&h) : handle<handle_type>(std::move(h))
|
||||
inline dplhandle<handle_type>(_Inout_ dplhandle<handle_type> &&h) noexcept : handle<handle_type>(std::move(h))
|
||||
{
|
||||
}
|
||||
|
||||
@ -947,7 +947,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
inline dplhandle<handle_type>& operator=(_Inout_ dplhandle<handle_type> &&h)
|
||||
inline dplhandle<handle_type>& operator=(_Inout_ dplhandle<handle_type> &&h) noexcept
|
||||
{
|
||||
handle<handle_type>::operator=(std::move(h));
|
||||
return *this;
|
||||
@ -1739,7 +1739,7 @@ namespace winstd
|
||||
/// \param[in] guid GUID to convert
|
||||
/// \param[in] format A `printf()` syntax template to convert GUID to string (i.e. `"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"`)
|
||||
///
|
||||
inline basic_string_guid(_In_ const GUID &guid, _In_opt_z_ _Printf_format_string_ const _Elem *format)
|
||||
inline basic_string_guid(_In_ const GUID &guid, _In_z_ _Printf_format_string_ const _Elem *format)
|
||||
{
|
||||
sprintf<_Elem, _Traits, _Ax>(*this, format,
|
||||
guid.Data1,
|
||||
|
@ -44,7 +44,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CredEnumerate function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa374794.aspx)
|
||||
///
|
||||
inline BOOL CredEnumerate(_In_ LPCTSTR Filter, _In_ DWORD Flags, _Out_ DWORD *Count, _Out_ std::unique_ptr<PCREDENTIAL[], winstd::CredFree_delete<PCREDENTIAL[]> > &cCredentials);
|
||||
inline BOOL CredEnumerate(_In_ LPCTSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Out_ std::unique_ptr<PCREDENTIAL[], winstd::CredFree_delete<PCREDENTIAL[]> > &cCredentials);
|
||||
|
||||
/// @copydoc CredProtectW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline BOOL CredProtectA(_In_ BOOL fAsSelf, _In_ LPCSTR pszCredentials, _In_ DWORD cchCredentials, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType);
|
||||
@ -143,15 +143,12 @@ namespace winstd
|
||||
}
|
||||
|
||||
|
||||
inline BOOL CredEnumerate(_In_ LPCTSTR Filter, _In_ DWORD Flags, _Out_ DWORD *Count, _Out_ std::unique_ptr<PCREDENTIAL[], winstd::CredFree_delete<PCREDENTIAL[]> > &cCredentials)
|
||||
inline BOOL CredEnumerate(_In_ LPCTSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Out_ std::unique_ptr<PCREDENTIAL[], winstd::CredFree_delete<PCREDENTIAL[]> > &cCredentials)
|
||||
{
|
||||
PCREDENTIAL *pCredentials;
|
||||
if (CredEnumerate(Filter, Flags, Count, &pCredentials)) {
|
||||
std::unique_ptr<PCREDENTIAL[], winstd::CredFree_delete<PCREDENTIAL[]> > cred(pCredentials);
|
||||
cCredentials.swap(cred);
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
PCREDENTIAL *pCredentials = NULL;
|
||||
BOOL bResult = CredEnumerate(Filter, Flags, Count, &pCredentials);
|
||||
cCredentials.reset(pCredentials);
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
|
@ -810,7 +810,7 @@ inline BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ T &d
|
||||
template<class _Ty, class _Ax>
|
||||
inline BOOL CryptExportKey(_In_ HCRYPTKEY hKey, _In_ HCRYPTKEY hExpKey, _In_ DWORD dwBlobType, _In_ DWORD dwFlags, _Out_ std::vector<_Ty, _Ax> &aData)
|
||||
{
|
||||
DWORD dwKeyBLOBSize;
|
||||
DWORD dwKeyBLOBSize = 0;
|
||||
|
||||
if (CryptExportKey(hKey, hExpKey, dwBlobType, dwFlags, NULL, &dwKeyBLOBSize)) {
|
||||
aData.resize((dwKeyBLOBSize + sizeof(_Ty) - 1) / sizeof(_Ty));
|
||||
|
@ -265,7 +265,7 @@ namespace winstd
|
||||
///
|
||||
/// Moves an existing EAP attribute.
|
||||
///
|
||||
inline eap_attr(_Inout_ eap_attr &&a)
|
||||
inline eap_attr(_Inout_ eap_attr &&a) noexcept
|
||||
{
|
||||
eaType = a.eaType;
|
||||
dwLength = a.dwLength;
|
||||
@ -308,7 +308,7 @@ namespace winstd
|
||||
///
|
||||
/// Moves an existing EAP attribute.
|
||||
///
|
||||
inline eap_attr& operator=(_Inout_ eap_attr &&a)
|
||||
inline eap_attr& operator=(_Inout_ eap_attr &&a) noexcept
|
||||
{
|
||||
if (this != &a) {
|
||||
eaType = a.eaType;
|
||||
@ -481,7 +481,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another object
|
||||
///
|
||||
inline eap_method_info_array(_Inout_ eap_method_info_array &&other)
|
||||
inline eap_method_info_array(_Inout_ eap_method_info_array &&other) noexcept
|
||||
{
|
||||
dwNumberOfMethods = other.dwNumberOfMethods;
|
||||
pEapMethods = other.pEapMethods;
|
||||
@ -499,7 +499,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another object
|
||||
///
|
||||
inline eap_method_info_array& operator=(_Inout_ eap_method_info_array &&other)
|
||||
inline eap_method_info_array& operator=(_Inout_ eap_method_info_array &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
if (pEapMethods)
|
||||
|
@ -280,7 +280,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] other Event record to move
|
||||
///
|
||||
inline event_rec(_Inout_ event_rec&& other) : EVENT_RECORD(other)
|
||||
inline event_rec(_Inout_ event_rec&& other) noexcept : EVENT_RECORD(other)
|
||||
{
|
||||
memset((EVENT_RECORD*)&other, 0, sizeof(EVENT_RECORD));
|
||||
}
|
||||
@ -331,7 +331,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] other Event record to move
|
||||
///
|
||||
inline event_rec& operator=(_Inout_ event_rec&& other)
|
||||
inline event_rec& operator=(_Inout_ event_rec&& other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
(EVENT_RECORD&)*this = other;
|
||||
@ -473,7 +473,7 @@ namespace winstd
|
||||
ULONG param_count;
|
||||
|
||||
// Preallocate array.
|
||||
for (param_count = 1;; param_count++) {
|
||||
for (param_count = 1; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
|
||||
const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
|
||||
if (p.Ptr == winstd::event_data::blank.Ptr &&
|
||||
p.Size == winstd::event_data::blank.Size &&
|
||||
@ -493,7 +493,10 @@ namespace winstd
|
||||
}
|
||||
|
||||
va_end(arg);
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 28020)
|
||||
return EventWrite(m_h, EventDescriptor, param_count, params.data());
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
|
||||
@ -517,7 +520,7 @@ namespace winstd
|
||||
ULONG param_count;
|
||||
|
||||
// Preallocate array.
|
||||
for (param_count = 0;; param_count++) {
|
||||
for (param_count = 0; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
|
||||
const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
|
||||
if (p.Ptr == winstd::event_data::blank.Ptr &&
|
||||
p.Size == winstd::event_data::blank.Size &&
|
||||
@ -535,7 +538,10 @@ namespace winstd
|
||||
params.push_back(p);
|
||||
}
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 28020)
|
||||
return EventWrite(m_h, EventDescriptor, param_count, params.data());
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
|
||||
@ -548,7 +554,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [EventWriteString function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363750v=vs.85.aspx)
|
||||
///
|
||||
inline ULONG write(_In_ UCHAR Level, _In_ ULONGLONG Keyword, _In_ _Printf_format_string_ PCWSTR String, ...)
|
||||
inline ULONG write(_In_ UCHAR Level, _In_ ULONGLONG Keyword, _In_z_ _Printf_format_string_ PCWSTR String, ...)
|
||||
{
|
||||
assert(m_h);
|
||||
|
||||
@ -625,7 +631,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another session
|
||||
///
|
||||
inline event_session(_Inout_ event_session &&other) :
|
||||
inline event_session(_Inout_ event_session &&other) noexcept :
|
||||
m_prop(std::move(other.m_prop)),
|
||||
handle(std::move(other))
|
||||
{
|
||||
@ -645,7 +651,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another object
|
||||
///
|
||||
inline event_session& operator=(_Inout_ event_session &&other)
|
||||
inline event_session& operator=(_Inout_ event_session &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
(handle<handle_type>&&)*this = std::move(other);
|
||||
@ -964,7 +970,7 @@ namespace winstd
|
||||
///
|
||||
/// Moves the object
|
||||
///
|
||||
inline event_fn_auto(_Inout_ event_fn_auto &&other) :
|
||||
inline event_fn_auto(_Inout_ event_fn_auto &&other) noexcept :
|
||||
m_ep(other.m_ep),
|
||||
m_event_dest(other.m_event_dest),
|
||||
m_fn_name(std::move(other.m_fn_name))
|
||||
@ -1001,7 +1007,7 @@ namespace winstd
|
||||
///
|
||||
/// Moves the object
|
||||
///
|
||||
inline event_fn_auto& operator=(_Inout_ event_fn_auto &&other)
|
||||
inline event_fn_auto& operator=(_Inout_ event_fn_auto &&other) noexcept
|
||||
{
|
||||
if (this != &other) {
|
||||
assert(&m_ep == &other.m_ep);
|
||||
@ -1142,6 +1148,7 @@ inline ULONG TdhGetEventInformation(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhCon
|
||||
return TdhGetEventInformation(pEvent, TdhContextCount, pTdhContext, info.get(), &ulSize);
|
||||
}
|
||||
|
||||
info.reset(nullptr);
|
||||
return ulResult;
|
||||
}
|
||||
|
||||
@ -1164,6 +1171,7 @@ inline ULONG TdhGetEventMapInformation(_In_ PEVENT_RECORD pEvent, _In_ LPWSTR pM
|
||||
return TdhGetEventMapInformation(pEvent, pMapName, info.get(), &ulSize);
|
||||
}
|
||||
|
||||
info.reset(nullptr);
|
||||
return ulResult;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,9 @@ namespace winstd
|
||||
///
|
||||
/// Constructs blank decoding session
|
||||
///
|
||||
inline hex_dec() : num(0)
|
||||
inline hex_dec() :
|
||||
buf(0),
|
||||
num(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -115,13 +117,13 @@ namespace winstd
|
||||
///
|
||||
/// Decodes one block of information, and _appends_ it to the output
|
||||
///
|
||||
/// \param[out] out Output
|
||||
/// \param[inout] out Output
|
||||
/// \param[out ] is_last Was this the last block of data? Actually, is this block of data complete?
|
||||
/// \param[in ] data Data to decode
|
||||
/// \param[in ] size Length of `data` in bytes
|
||||
///
|
||||
template<class _Ty, class _Ax, class _Tchr>
|
||||
inline void decode(_Out_ std::vector<_Ty, _Ax> &out, _Out_ bool &is_last, _In_z_count_(size) const _Tchr *data, _In_ size_t size)
|
||||
inline void decode(_Inout_ std::vector<_Ty, _Ax> &out, _Out_ bool &is_last, _In_z_count_(size) const _Tchr *data, _In_ size_t size)
|
||||
{
|
||||
is_last = false;
|
||||
|
||||
|
@ -107,7 +107,7 @@ template<class _Elem, class _Traits, class _Ax> inline VOID GuidToStringW(_In_ L
|
||||
#endif
|
||||
|
||||
/// @copydoc StringToGuidW()
|
||||
BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd = NULL);
|
||||
_Success_(return) BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd = NULL);
|
||||
|
||||
///
|
||||
/// Parses string with GUID and stores it to GUID
|
||||
@ -120,7 +120,7 @@ BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_
|
||||
/// - `TRUE` if GUID successfuly parsed;
|
||||
/// - `FALSE` otherwise.
|
||||
///
|
||||
BOOL WINSTD_API StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd = NULL);
|
||||
_Success_(return) BOOL WINSTD_API StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd = NULL);
|
||||
/// @copydoc StringToGuidW()
|
||||
#ifdef _UNICODE
|
||||
#define StringToGuid StringToGuidW
|
||||
@ -663,7 +663,7 @@ namespace winstd
|
||||
/// \param[in] proc Handle of process the memory belongs to
|
||||
/// \param[in] h Initial object handle value
|
||||
///
|
||||
inline vmemory(_In_opt_ handle_type h, _In_ HANDLE proc) :
|
||||
inline vmemory(_In_ handle_type h, _In_ HANDLE proc) :
|
||||
m_proc(proc),
|
||||
handle<LPVOID>(h)
|
||||
{
|
||||
@ -674,7 +674,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
inline vmemory(_Inout_ vmemory &&h) :
|
||||
inline vmemory(_Inout_ vmemory &&h) noexcept :
|
||||
m_proc(std::move(h.m_proc)),
|
||||
handle<LPVOID>(std::move(h))
|
||||
{
|
||||
@ -692,7 +692,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another object
|
||||
///
|
||||
inline vmemory& operator=(_Inout_ vmemory &&other)
|
||||
inline vmemory& operator=(_Inout_ vmemory &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
(handle<handle_type>&&)*this = std::move(other);
|
||||
|
@ -46,6 +46,8 @@ void winstd::eap_attr::create_ms_mppe_key(_In_ BYTE bVendorType, _In_count_(nKey
|
||||
nKeySize + // Key
|
||||
nPaddingLength; // Padding
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 6386)
|
||||
LPBYTE p = new BYTE[dwLengthNew];
|
||||
p[0] = 0x00; // Vendor-Id (0x137 = 311 = Microsoft)
|
||||
p[1] = 0x00; // --|
|
||||
@ -56,6 +58,7 @@ void winstd::eap_attr::create_ms_mppe_key(_In_ BYTE bVendorType, _In_count_(nKey
|
||||
p[6] = 0x00; // Salt
|
||||
p[7] = 0x00; // --^
|
||||
p[8] = nKeySize; // Key-Length
|
||||
#pragma warning(pop)
|
||||
memcpy(p + 9, pbKey, nKeySize); // Key
|
||||
memset(p + 9 + nKeySize, 0, nPaddingLength); // Padding
|
||||
|
||||
|
@ -28,13 +28,15 @@
|
||||
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
#include "../include/WinStd/ETW.h"
|
||||
#endif
|
||||
#include "../include/WinStd/Common.h"
|
||||
#include "../include/WinStd/Hex.h"
|
||||
#include "../include/WinStd/MSI.h"
|
||||
#if defined(SECURITY_WIN32) || defined(SECURITY_KERNEL) || defined(SECURITY_MAC)
|
||||
#include "../include/WinStd/Sec.h"
|
||||
#endif
|
||||
#include "../include/WinStd/Shell.h"
|
||||
#include "../include/WinStd/Win.h"
|
||||
#include "../include/WinStd/WinTrust.h"
|
||||
#include "../include/WinStd/WLAN.h"
|
||||
#include "../include/WinStd/Common.h"
|
||||
|
||||
#include <tchar.h>
|
||||
|
@ -25,7 +25,7 @@
|
||||
// StringToGuidA
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd)
|
||||
_Success_(return) BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd)
|
||||
{
|
||||
GUID g;
|
||||
LPSTR lpszEnd;
|
||||
@ -88,7 +88,7 @@ BOOL WINSTD_API StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_
|
||||
}
|
||||
|
||||
|
||||
BOOL WINSTD_API StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd)
|
||||
_Success_(return) BOOL WINSTD_API StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd)
|
||||
{
|
||||
GUID g;
|
||||
LPWSTR lpszEnd;
|
||||
|
Loading…
x
Reference in New Issue
Block a user