Discontinue manual inline hinting
Compiler knows better than we do. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
880fd34e16
commit
465c52f0a0
@ -50,7 +50,7 @@ namespace winstd
|
||||
/// \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)
|
||||
com_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<HRESULT>(num, msg)
|
||||
{
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ namespace winstd
|
||||
/// \param[in] num COM error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline com_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<HRESULT>(num, msg)
|
||||
com_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<HRESULT>(num, msg)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -106,7 +106,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CoCreateInstance function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms686615.aspx)
|
||||
///
|
||||
inline com_obj(_In_ REFCLSID rclsid, _In_opt_ LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
|
||||
com_obj(_In_ REFCLSID rclsid, _In_opt_ LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
|
||||
{
|
||||
CoCreateInstance(rclsid, pUnkOuter, dwClsContext, __uuidof(T), (LPVOID*)&m_h);
|
||||
}
|
||||
@ -118,7 +118,7 @@ namespace winstd
|
||||
/// \sa [IUnknown::QueryInterface method](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682521.aspx)
|
||||
///
|
||||
template <class _Other>
|
||||
inline com_obj(_In_ _Other *other)
|
||||
com_obj(_In_ _Other *other)
|
||||
{
|
||||
assert(other);
|
||||
other->QueryInterface(__uuidof(T), (void**)&m_h);
|
||||
@ -131,7 +131,7 @@ namespace winstd
|
||||
/// \sa [IUnknown::QueryInterface method](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682521.aspx)
|
||||
///
|
||||
template <class _Other>
|
||||
inline com_obj(_In_ com_obj<_Other> &other)
|
||||
com_obj(_In_ com_obj<_Other> &other)
|
||||
{
|
||||
other->QueryInterface(__uuidof(T), (void**)&m_h);
|
||||
}
|
||||
@ -152,7 +152,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CoCreateInstance function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms686615.aspx)
|
||||
///
|
||||
inline HRESULT create(_In_ REFCLSID rclsid, _In_opt_ LPUNKNOWN pUnkOuter = NULL, _In_ DWORD dwClsContext = CLSCTX_ALL)
|
||||
HRESULT create(_In_ REFCLSID rclsid, _In_opt_ LPUNKNOWN pUnkOuter = NULL, _In_ DWORD dwClsContext = CLSCTX_ALL)
|
||||
{
|
||||
handle_type h;
|
||||
HRESULT hr = CoCreateInstance(rclsid, pUnkOuter, dwClsContext, __uuidof(T), (void**)&h);
|
||||
@ -232,7 +232,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs BSTR from OLE string
|
||||
///
|
||||
inline bstr(_In_ LPCOLESTR src) noexcept
|
||||
bstr(_In_ LPCOLESTR src) noexcept
|
||||
{
|
||||
m_h = SysAllocString(src);
|
||||
}
|
||||
@ -240,7 +240,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs BSTR from OLE string with length
|
||||
///
|
||||
inline bstr(_In_ LPCOLESTR src, _In_ UINT len) noexcept
|
||||
bstr(_In_ LPCOLESTR src, _In_ UINT len) noexcept
|
||||
{
|
||||
m_h = SysAllocStringLen(src, len);
|
||||
}
|
||||
@ -249,7 +249,7 @@ namespace winstd
|
||||
/// Constructs BSTR from std::basic_string
|
||||
///
|
||||
template<class _Traits, class _Ax>
|
||||
inline bstr(_In_ const std::basic_string<wchar_t, _Traits, _Ax> &src) noexcept
|
||||
bstr(_In_ const std::basic_string<wchar_t, _Traits, _Ax> &src) noexcept
|
||||
{
|
||||
m_h = SysAllocStringLen(src.c_str(), (UINT)src.length());
|
||||
}
|
||||
@ -270,7 +270,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [SysStringLen function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms221240.aspx)
|
||||
///
|
||||
inline UINT length() const noexcept
|
||||
UINT length() const noexcept
|
||||
{
|
||||
return SysStringLen(m_h);
|
||||
}
|
||||
@ -313,7 +313,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs blank VARIANT
|
||||
///
|
||||
inline variant() noexcept
|
||||
variant() noexcept
|
||||
{
|
||||
VariantInit(this);
|
||||
}
|
||||
@ -321,7 +321,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from another
|
||||
///
|
||||
inline variant(_In_ const VARIANT& varSrc)
|
||||
variant(_In_ const VARIANT& varSrc)
|
||||
{
|
||||
vt = VT_EMPTY;
|
||||
const HRESULT hr = VariantCopy(this, &varSrc);
|
||||
@ -333,7 +333,7 @@ namespace winstd
|
||||
/// Moves VARIANT from another
|
||||
///
|
||||
#pragma warning(suppress: 26495) // vt member is initialized as a result of memcpy()
|
||||
inline variant(_Inout_ VARIANT&& varSrc) noexcept
|
||||
variant(_Inout_ VARIANT&& varSrc) noexcept
|
||||
{
|
||||
memcpy(this, &varSrc, sizeof(VARIANT));
|
||||
varSrc.vt = VT_EMPTY;
|
||||
@ -342,7 +342,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from bool
|
||||
///
|
||||
inline variant(_In_ bool bSrc) noexcept
|
||||
variant(_In_ bool bSrc) noexcept
|
||||
{
|
||||
vt = VT_BOOL;
|
||||
boolVal = bSrc ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
@ -351,7 +351,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from character
|
||||
///
|
||||
inline variant(_In_ char cSrc) noexcept
|
||||
variant(_In_ char cSrc) noexcept
|
||||
{
|
||||
vt = VT_I1;
|
||||
cVal = cSrc;
|
||||
@ -360,7 +360,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from byte
|
||||
///
|
||||
inline variant(_In_ unsigned char nSrc) noexcept
|
||||
variant(_In_ unsigned char nSrc) noexcept
|
||||
{
|
||||
vt = VT_UI1;
|
||||
bVal = nSrc;
|
||||
@ -369,7 +369,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from short
|
||||
///
|
||||
inline variant(_In_ short nSrc) noexcept
|
||||
variant(_In_ short nSrc) noexcept
|
||||
{
|
||||
vt = VT_I2;
|
||||
iVal = nSrc;
|
||||
@ -378,7 +378,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from unsigned short
|
||||
///
|
||||
inline variant(_In_ unsigned short nSrc) noexcept
|
||||
variant(_In_ unsigned short nSrc) noexcept
|
||||
{
|
||||
vt = VT_UI2;
|
||||
uiVal = nSrc;
|
||||
@ -387,7 +387,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from integer
|
||||
///
|
||||
inline variant(_In_ int nSrc, _In_ VARTYPE vtSrc = VT_I4) noexcept
|
||||
variant(_In_ int nSrc, _In_ VARTYPE vtSrc = VT_I4) noexcept
|
||||
{
|
||||
assert(vtSrc == VT_I4 || vtSrc == VT_INT);
|
||||
vt = vtSrc;
|
||||
@ -397,7 +397,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from unsigned integer
|
||||
///
|
||||
inline variant(_In_ unsigned int nSrc, _In_ VARTYPE vtSrc = VT_UI4) noexcept
|
||||
variant(_In_ unsigned int nSrc, _In_ VARTYPE vtSrc = VT_UI4) noexcept
|
||||
{
|
||||
assert(vtSrc == VT_UI4 || vtSrc == VT_UINT);
|
||||
vt = vtSrc;
|
||||
@ -407,7 +407,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from long
|
||||
///
|
||||
inline variant(_In_ long nSrc, _In_ VARTYPE vtSrc = VT_I4) noexcept
|
||||
variant(_In_ long nSrc, _In_ VARTYPE vtSrc = VT_I4) noexcept
|
||||
{
|
||||
assert(vtSrc == VT_I4 || vtSrc == VT_ERROR);
|
||||
vt = vtSrc;
|
||||
@ -417,7 +417,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from unsigned long
|
||||
///
|
||||
inline variant(_In_ unsigned long nSrc) noexcept
|
||||
variant(_In_ unsigned long nSrc) noexcept
|
||||
{
|
||||
vt = VT_UI4;
|
||||
ulVal = nSrc;
|
||||
@ -426,7 +426,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from float
|
||||
///
|
||||
inline variant(_In_ float fltSrc) noexcept
|
||||
variant(_In_ float fltSrc) noexcept
|
||||
{
|
||||
vt = VT_R4;
|
||||
fltVal = fltSrc;
|
||||
@ -435,7 +435,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from double or variant date
|
||||
///
|
||||
inline variant(_In_ double dblSrc, _In_ VARTYPE vtSrc = VT_R8) noexcept
|
||||
variant(_In_ double dblSrc, _In_ VARTYPE vtSrc = VT_R8) noexcept
|
||||
{
|
||||
assert(vtSrc == VT_R8 || vtSrc == VT_DATE);
|
||||
vt = vtSrc;
|
||||
@ -445,7 +445,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from 64-bit integer
|
||||
///
|
||||
inline variant(_In_ long long nSrc) noexcept
|
||||
variant(_In_ long long nSrc) noexcept
|
||||
{
|
||||
vt = VT_I8;
|
||||
llVal = nSrc;
|
||||
@ -454,7 +454,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from unsigned integer
|
||||
///
|
||||
inline variant(_In_ unsigned long long nSrc) noexcept
|
||||
variant(_In_ unsigned long long nSrc) noexcept
|
||||
{
|
||||
vt = VT_UI8;
|
||||
ullVal = nSrc;
|
||||
@ -463,7 +463,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from CY (64-bit integer)
|
||||
///
|
||||
inline variant(_In_ CY cySrc) noexcept
|
||||
variant(_In_ CY cySrc) noexcept
|
||||
{
|
||||
vt = VT_CY;
|
||||
cyVal.Hi = cySrc.Hi;
|
||||
@ -473,7 +473,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from OLE string
|
||||
///
|
||||
inline variant(_In_z_ LPCOLESTR lpszSrc) noexcept
|
||||
variant(_In_z_ LPCOLESTR lpszSrc) noexcept
|
||||
{
|
||||
vt = VT_EMPTY;
|
||||
*this = lpszSrc;
|
||||
@ -482,7 +482,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from BSTR
|
||||
///
|
||||
inline variant(_In_z_ BSTR bstr) noexcept
|
||||
variant(_In_z_ BSTR bstr) noexcept
|
||||
{
|
||||
vt = VT_EMPTY;
|
||||
*this = bstr;
|
||||
@ -491,7 +491,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from IDispatch
|
||||
///
|
||||
inline variant(_In_opt_ IDispatch* pSrc)
|
||||
variant(_In_opt_ IDispatch* pSrc)
|
||||
{
|
||||
vt = VT_DISPATCH;
|
||||
pdispVal = pSrc;
|
||||
@ -503,7 +503,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from IUnknown
|
||||
///
|
||||
inline variant(_In_opt_ IUnknown* pSrc)
|
||||
variant(_In_opt_ IUnknown* pSrc)
|
||||
{
|
||||
vt = VT_UNKNOWN;
|
||||
punkVal = pSrc;
|
||||
@ -515,7 +515,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs VARIANT from SAFEARRAY
|
||||
///
|
||||
inline variant(_In_ const SAFEARRAY *pSrc)
|
||||
variant(_In_ const SAFEARRAY *pSrc)
|
||||
{
|
||||
assert(pSrc != NULL);
|
||||
|
||||
@ -540,7 +540,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from another VARIANT
|
||||
///
|
||||
inline variant& operator=(_In_ const VARIANT& varSrc)
|
||||
variant& operator=(_In_ const VARIANT& varSrc)
|
||||
{
|
||||
if (this != &varSrc) {
|
||||
const HRESULT hr = VariantCopy(this, &varSrc);
|
||||
@ -553,7 +553,7 @@ namespace winstd
|
||||
///
|
||||
/// Moves from another VARIANT
|
||||
///
|
||||
inline variant& operator=(_Inout_ VARIANT&& varSrc) noexcept
|
||||
variant& operator=(_Inout_ VARIANT&& varSrc) noexcept
|
||||
{
|
||||
if (this != &varSrc) {
|
||||
VariantClear(this);
|
||||
@ -566,7 +566,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from bool value
|
||||
///
|
||||
inline variant& operator=(_In_ bool bSrc) noexcept
|
||||
variant& operator=(_In_ bool bSrc) noexcept
|
||||
{
|
||||
if (vt != VT_BOOL) {
|
||||
VariantClear(this);
|
||||
@ -579,7 +579,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from char value
|
||||
///
|
||||
inline variant& operator=(_In_ char cSrc) noexcept
|
||||
variant& operator=(_In_ char cSrc) noexcept
|
||||
{
|
||||
if (vt != VT_I1) {
|
||||
VariantClear(this);
|
||||
@ -592,7 +592,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from unsigned char value
|
||||
///
|
||||
inline variant& operator=(_In_ unsigned char nSrc) noexcept
|
||||
variant& operator=(_In_ unsigned char nSrc) noexcept
|
||||
{
|
||||
if (vt != VT_UI1) {
|
||||
VariantClear(this);
|
||||
@ -605,7 +605,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from short value
|
||||
///
|
||||
inline variant& operator=(_In_ short nSrc) noexcept
|
||||
variant& operator=(_In_ short nSrc) noexcept
|
||||
{
|
||||
if (vt != VT_I2) {
|
||||
VariantClear(this);
|
||||
@ -618,7 +618,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from unsigned short value
|
||||
///
|
||||
inline variant& operator=(_In_ unsigned short nSrc) noexcept
|
||||
variant& operator=(_In_ unsigned short nSrc) noexcept
|
||||
{
|
||||
if (vt != VT_UI2) {
|
||||
VariantClear(this);
|
||||
@ -631,7 +631,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from int value
|
||||
///
|
||||
inline variant& operator=(_In_ int nSrc) noexcept
|
||||
variant& operator=(_In_ int nSrc) noexcept
|
||||
{
|
||||
if (vt != VT_I4) {
|
||||
VariantClear(this);
|
||||
@ -644,7 +644,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from unsigned int value
|
||||
///
|
||||
inline variant& operator=(_In_ unsigned int nSrc) noexcept
|
||||
variant& operator=(_In_ unsigned int nSrc) noexcept
|
||||
{
|
||||
if (vt != VT_UI4) {
|
||||
VariantClear(this);
|
||||
@ -657,7 +657,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from long value
|
||||
///
|
||||
inline variant& operator=(_In_ long nSrc) noexcept
|
||||
variant& operator=(_In_ long nSrc) noexcept
|
||||
{
|
||||
if (vt != VT_I4) {
|
||||
VariantClear(this);
|
||||
@ -670,7 +670,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from unsigned long value
|
||||
///
|
||||
inline variant& operator=(_In_ unsigned long nSrc) noexcept
|
||||
variant& operator=(_In_ unsigned long nSrc) noexcept
|
||||
{
|
||||
if (vt != VT_UI4) {
|
||||
VariantClear(this);
|
||||
@ -684,7 +684,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from long long value
|
||||
///
|
||||
inline variant& operator=(_In_ long long nSrc) noexcept
|
||||
variant& operator=(_In_ long long nSrc) noexcept
|
||||
{
|
||||
if (vt != VT_I8) {
|
||||
VariantClear(this);
|
||||
@ -697,7 +697,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from unsigned long long value
|
||||
///
|
||||
inline variant& operator=(_In_ unsigned long long nSrc) noexcept
|
||||
variant& operator=(_In_ unsigned long long nSrc) noexcept
|
||||
{
|
||||
if (vt != VT_UI8) {
|
||||
VariantClear(this);
|
||||
@ -711,7 +711,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from float value
|
||||
///
|
||||
inline variant& operator=(_In_ float fltSrc) noexcept
|
||||
variant& operator=(_In_ float fltSrc) noexcept
|
||||
{
|
||||
if (vt != VT_R4) {
|
||||
VariantClear(this);
|
||||
@ -724,7 +724,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from double value
|
||||
///
|
||||
inline variant& operator=(_In_ double dblSrc) noexcept
|
||||
variant& operator=(_In_ double dblSrc) noexcept
|
||||
{
|
||||
if (vt != VT_R8) {
|
||||
VariantClear(this);
|
||||
@ -737,7 +737,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from CY value
|
||||
///
|
||||
inline variant& operator=(_In_ CY cySrc) noexcept
|
||||
variant& operator=(_In_ CY cySrc) noexcept
|
||||
{
|
||||
if (vt != VT_CY) {
|
||||
VariantClear(this);
|
||||
@ -751,7 +751,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from OLE string value
|
||||
///
|
||||
inline variant& operator=(_In_z_ LPCOLESTR lpszSrc) noexcept
|
||||
variant& operator=(_In_z_ LPCOLESTR lpszSrc) noexcept
|
||||
{
|
||||
VariantClear(this);
|
||||
vt = VT_BSTR;
|
||||
@ -762,7 +762,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from IDispatch
|
||||
///
|
||||
inline variant& operator=(_Inout_opt_ IDispatch* pSrc)
|
||||
variant& operator=(_Inout_opt_ IDispatch* pSrc)
|
||||
{
|
||||
VariantClear(this);
|
||||
vt = VT_DISPATCH;
|
||||
@ -775,7 +775,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from IUnknown
|
||||
///
|
||||
inline variant& operator=(_Inout_opt_ IUnknown* pSrc)
|
||||
variant& operator=(_Inout_opt_ IUnknown* pSrc)
|
||||
{
|
||||
VariantClear(this);
|
||||
vt = VT_UNKNOWN;
|
||||
@ -788,7 +788,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from unsigned char reference
|
||||
///
|
||||
inline variant& operator=(_In_ unsigned char* pbSrc) noexcept
|
||||
variant& operator=(_In_ unsigned char* pbSrc) noexcept
|
||||
{
|
||||
if (vt != (VT_UI1|VT_BYREF)) {
|
||||
VariantClear(this);
|
||||
@ -801,7 +801,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from short reference
|
||||
///
|
||||
inline variant& operator=(_In_ short* pnSrc) noexcept
|
||||
variant& operator=(_In_ short* pnSrc) noexcept
|
||||
{
|
||||
if (vt != (VT_I2|VT_BYREF)) {
|
||||
VariantClear(this);
|
||||
@ -814,7 +814,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from unsigned short reference
|
||||
///
|
||||
inline variant& operator=(_In_ unsigned short* pnSrc) noexcept
|
||||
variant& operator=(_In_ unsigned short* pnSrc) noexcept
|
||||
{
|
||||
if (vt != (VT_UI2|VT_BYREF)) {
|
||||
VariantClear(this);
|
||||
@ -827,7 +827,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from int reference
|
||||
///
|
||||
inline variant& operator=(_In_ int* pnSrc) noexcept
|
||||
variant& operator=(_In_ int* pnSrc) noexcept
|
||||
{
|
||||
if (vt != (VT_I4|VT_BYREF)) {
|
||||
VariantClear(this);
|
||||
@ -840,7 +840,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from unsigned int reference
|
||||
///
|
||||
inline variant& operator=(_In_ unsigned int* pnSrc) noexcept
|
||||
variant& operator=(_In_ unsigned int* pnSrc) noexcept
|
||||
{
|
||||
if (vt != (VT_UI4|VT_BYREF)) {
|
||||
VariantClear(this);
|
||||
@ -853,7 +853,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from long reference
|
||||
///
|
||||
inline variant& operator=(_In_ long* pnSrc) noexcept
|
||||
variant& operator=(_In_ long* pnSrc) noexcept
|
||||
{
|
||||
if (vt != (VT_I4|VT_BYREF)) {
|
||||
VariantClear(this);
|
||||
@ -866,7 +866,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from unsigned long reference
|
||||
///
|
||||
inline variant& operator=(_In_ unsigned long* pnSrc) noexcept
|
||||
variant& operator=(_In_ unsigned long* pnSrc) noexcept
|
||||
{
|
||||
if (vt != (VT_UI4|VT_BYREF)) {
|
||||
VariantClear(this);
|
||||
@ -879,7 +879,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from long long reference
|
||||
///
|
||||
inline variant& operator=(_In_ long long* pnSrc) noexcept
|
||||
variant& operator=(_In_ long long* pnSrc) noexcept
|
||||
{
|
||||
if (vt != (VT_I8|VT_BYREF)) {
|
||||
VariantClear(this);
|
||||
@ -892,7 +892,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from unsigned long long reference
|
||||
///
|
||||
inline variant& operator=(_In_ unsigned long long* pnSrc) noexcept
|
||||
variant& operator=(_In_ unsigned long long* pnSrc) noexcept
|
||||
{
|
||||
if (vt != (VT_UI8|VT_BYREF)) {
|
||||
VariantClear(this);
|
||||
@ -905,7 +905,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from float reference
|
||||
///
|
||||
inline variant& operator=(_In_ float* pfSrc) noexcept
|
||||
variant& operator=(_In_ float* pfSrc) noexcept
|
||||
{
|
||||
if (vt != (VT_R4|VT_BYREF)) {
|
||||
VariantClear(this);
|
||||
@ -918,7 +918,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from double reference
|
||||
///
|
||||
inline variant& operator=(_In_ double* pfSrc) noexcept
|
||||
variant& operator=(_In_ double* pfSrc) noexcept
|
||||
{
|
||||
if (vt != (VT_R8|VT_BYREF)) {
|
||||
VariantClear(this);
|
||||
@ -931,7 +931,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy from SAFEARRAY
|
||||
///
|
||||
inline variant& operator=(_In_ const SAFEARRAY *pSrc) noexcept
|
||||
variant& operator=(_In_ const SAFEARRAY *pSrc) noexcept
|
||||
{
|
||||
assert(pSrc != NULL);
|
||||
VariantClear(this);
|
||||
@ -957,7 +957,7 @@ namespace winstd
|
||||
/// - Non zero when variant is equal to \p varSrc;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator==(_In_ const VARIANT& varSrc) const noexcept
|
||||
bool operator==(_In_ const VARIANT& varSrc) const noexcept
|
||||
{
|
||||
if (vt == VT_NULL && varSrc.vt == VT_NULL) return true;
|
||||
if (vt != varSrc.vt) return false;
|
||||
@ -972,7 +972,7 @@ namespace winstd
|
||||
/// - Non zero when variant is not equal to \p varSrc;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator!=(_In_ const VARIANT& varSrc) const noexcept
|
||||
bool operator!=(_In_ const VARIANT& varSrc) const noexcept
|
||||
{
|
||||
return !operator==(varSrc);
|
||||
}
|
||||
@ -985,7 +985,7 @@ namespace winstd
|
||||
/// - Non zero when variant is less than \p varSrc;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator<(_In_ const VARIANT& varSrc) const noexcept
|
||||
bool operator<(_In_ const VARIANT& varSrc) const noexcept
|
||||
{
|
||||
if (vt == VT_NULL && varSrc.vt == VT_NULL) return false;
|
||||
return compare(static_cast<const VARIANT&>(*this), varSrc, LOCALE_USER_DEFAULT, 0)== static_cast<HRESULT>(VARCMP_LT);
|
||||
@ -999,7 +999,7 @@ namespace winstd
|
||||
/// - Non zero when variant is greater than \p varSrc;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator>(_In_ const VARIANT& varSrc) const noexcept
|
||||
bool operator>(_In_ const VARIANT& varSrc) const noexcept
|
||||
{
|
||||
if (vt == VT_NULL && varSrc.vt == VT_NULL) return false;
|
||||
return compare(static_cast<const VARIANT&>(*this), varSrc, LOCALE_USER_DEFAULT, 0)== static_cast<HRESULT>(VARCMP_GT);
|
||||
@ -1013,7 +1013,7 @@ namespace winstd
|
||||
/// - Non zero when variant is less than or equal to \p varSrc;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator<=(_In_ const VARIANT& varSrc) const noexcept
|
||||
bool operator<=(_In_ const VARIANT& varSrc) const noexcept
|
||||
{
|
||||
return !operator>(varSrc);
|
||||
}
|
||||
@ -1026,7 +1026,7 @@ namespace winstd
|
||||
/// - Non zero when variant is greater than or equal to \p varSrc;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator>=(_In_ const VARIANT& varSrc) const noexcept
|
||||
bool operator>=(_In_ const VARIANT& varSrc) const noexcept
|
||||
{
|
||||
return !operator<(varSrc);
|
||||
}
|
||||
@ -1036,14 +1036,14 @@ namespace winstd
|
||||
///
|
||||
/// \sa [VariantChangeType function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms221258.aspx)
|
||||
///
|
||||
inline HRESULT change_type(_In_ VARTYPE _vt, _In_opt_ USHORT wFlags = 0) noexcept
|
||||
HRESULT change_type(_In_ VARTYPE _vt, _In_opt_ USHORT wFlags = 0) noexcept
|
||||
{
|
||||
return VariantChangeType(this, this, wFlags, _vt);
|
||||
}
|
||||
|
||||
private:
|
||||
/// \cond internal
|
||||
inline HRESULT compare(_In_ const VARIANT &varLeft, _In_ const VARIANT &varRight, _In_ LCID lcid, _In_ ULONG dwFlags) const noexcept
|
||||
HRESULT compare(_In_ const VARIANT &varLeft, _In_ const VARIANT &varRight, _In_ LCID lcid, _In_ ULONG dwFlags) const noexcept
|
||||
{
|
||||
switch(vt) {
|
||||
case VT_I1: return varLeft.cVal == varRight.cVal ? VARCMP_EQ : varLeft.cVal > varRight.cVal ? VARCMP_GT : VARCMP_LT;
|
||||
@ -1072,7 +1072,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CoInitialize function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms678543.aspx)
|
||||
///
|
||||
inline com_initializer(_In_opt_ LPVOID pvReserved) noexcept
|
||||
com_initializer(_In_opt_ LPVOID pvReserved) noexcept
|
||||
{
|
||||
m_result = CoInitialize(pvReserved);
|
||||
}
|
||||
@ -1083,7 +1083,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CoInitializeEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms695279.aspx)
|
||||
///
|
||||
inline com_initializer(_In_opt_ LPVOID pvReserved, _In_ DWORD dwCoInit) noexcept
|
||||
com_initializer(_In_opt_ LPVOID pvReserved, _In_ DWORD dwCoInit) noexcept
|
||||
{
|
||||
m_result = CoInitializeEx(pvReserved, dwCoInit);
|
||||
}
|
||||
@ -1106,7 +1106,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CoInitialize function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms678543.aspx)
|
||||
///
|
||||
inline HRESULT status() const noexcept
|
||||
HRESULT status() const noexcept
|
||||
{
|
||||
return m_result;
|
||||
}
|
||||
|
@ -70,16 +70,16 @@
|
||||
///
|
||||
#define WINSTD_NONCOPYABLE(C) \
|
||||
private: \
|
||||
inline C (_In_ const C &h) noexcept; \
|
||||
inline C& operator=(_In_ const C &h) noexcept;
|
||||
C (_In_ const C &h) noexcept; \
|
||||
C& operator=(_In_ const C &h) noexcept;
|
||||
|
||||
///
|
||||
/// Declares a class as non-movable
|
||||
///
|
||||
#define WINSTD_NONMOVABLE(C) \
|
||||
private: \
|
||||
inline C (_Inout_ C &&h) noexcept; \
|
||||
inline C& operator=(_Inout_ C &&h) noexcept;
|
||||
C (_Inout_ C &&h) noexcept; \
|
||||
C& operator=(_Inout_ C &&h) noexcept;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -128,11 +128,11 @@ private: \
|
||||
///
|
||||
#define WINSTD_HANDLE_IMPL(C, INVAL) \
|
||||
public: \
|
||||
inline C ( ) noexcept { } \
|
||||
inline C (_In_opt_ handle_type h) noexcept : handle<handle_type, INVAL>( h ) { } \
|
||||
inline C (_Inout_ C &&h) noexcept : handle<handle_type, INVAL>(std::move(h)) { } \
|
||||
inline C& operator=(_In_opt_ handle_type h) noexcept { handle<handle_type, INVAL>::operator=( h ); return *this; } \
|
||||
inline C& operator=(_Inout_ C &&h) noexcept { handle<handle_type, INVAL>::operator=(std::move(h)); return *this; } \
|
||||
C ( ) noexcept { } \
|
||||
C (_In_opt_ handle_type h) noexcept : handle<handle_type, INVAL>( h ) { } \
|
||||
C (_Inout_ C &&h) noexcept : handle<handle_type, INVAL>(std::move(h)) { } \
|
||||
C& operator=(_In_opt_ handle_type h) noexcept { handle<handle_type, INVAL>::operator=( h ); return *this; } \
|
||||
C& operator=(_Inout_ C &&h) noexcept { handle<handle_type, INVAL>::operator=(std::move(h)); return *this; } \
|
||||
WINSTD_NONCOPYABLE(C)
|
||||
|
||||
///
|
||||
@ -140,13 +140,13 @@ WINSTD_NONCOPYABLE(C)
|
||||
///
|
||||
#define WINSTD_DPLHANDLE_IMPL(C, INVAL) \
|
||||
public: \
|
||||
inline C ( ) noexcept { } \
|
||||
inline C (_In_opt_ handle_type h) noexcept : dplhandle<handle_type, INVAL>( h ) { } \
|
||||
inline C (_In_ const C &h) noexcept : dplhandle<handle_type, INVAL>(duplicate_internal(h.m_h)) { } \
|
||||
inline C (_Inout_ C &&h) noexcept : dplhandle<handle_type, INVAL>(std::move (h )) { } \
|
||||
inline C& operator=(_In_opt_ handle_type h) noexcept { dplhandle<handle_type, INVAL>::operator=( h ); return *this; } \
|
||||
inline C& operator=(_In_ const C &h) noexcept { dplhandle<handle_type, INVAL>::operator=( h ); return *this; } \
|
||||
inline C& operator=(_Inout_ C &&h) noexcept { dplhandle<handle_type, INVAL>::operator=(std::move(h)); return *this; } \
|
||||
C ( ) noexcept { } \
|
||||
C (_In_opt_ handle_type h) noexcept : dplhandle<handle_type, INVAL>( h ) { } \
|
||||
C (_In_ const C &h) noexcept : dplhandle<handle_type, INVAL>(duplicate_internal(h.m_h)) { } \
|
||||
C (_Inout_ C &&h) noexcept : dplhandle<handle_type, INVAL>(std::move (h )) { } \
|
||||
C& operator=(_In_opt_ handle_type h) noexcept { dplhandle<handle_type, INVAL>::operator=( h ); return *this; } \
|
||||
C& operator=(_In_ const C &h) noexcept { dplhandle<handle_type, INVAL>::operator=( h ); return *this; } \
|
||||
C& operator=(_Inout_ C &&h) noexcept { dplhandle<handle_type, INVAL>::operator=(std::move(h)); return *this; } \
|
||||
private:
|
||||
|
||||
/// @}
|
||||
@ -199,7 +199,7 @@ namespace winstd
|
||||
///
|
||||
/// \returns A helper wrapper class to handle returning a reference to the pointer
|
||||
///
|
||||
template<class _Ty, class _Dx> inline ref_unique_ptr<_Ty, _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) noexcept;
|
||||
template<class _Ty, class _Dx> ref_unique_ptr<_Ty, _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) noexcept;
|
||||
|
||||
///
|
||||
/// Helper function template for returning pointers to std::unique_ptr
|
||||
@ -209,7 +209,7 @@ namespace winstd
|
||||
///
|
||||
/// \returns A helper wrapper class to handle returning a reference to the pointer
|
||||
///
|
||||
template<class _Ty, class _Dx> inline ref_unique_ptr<_Ty[], _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept;
|
||||
template<class _Ty, class _Dx> ref_unique_ptr<_Ty[], _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -326,7 +326,7 @@ namespace winstd
|
||||
/// \returns Number of characters in result.
|
||||
///
|
||||
#if _MSC_VER <= 1600
|
||||
inline int vsnprintf(_Out_z_cap_(capacity) char *str, _In_ size_t capacity, _In_z_ _Printf_format_string_ const char *format, _In_ va_list arg);
|
||||
static int vsnprintf(_Out_z_cap_(capacity) char *str, _In_ size_t capacity, _In_z_ _Printf_format_string_ const char *format, _In_ va_list arg);
|
||||
#endif
|
||||
|
||||
///
|
||||
@ -339,7 +339,7 @@ inline int vsnprintf(_Out_z_cap_(capacity) char *str, _In_ size_t capacity, _In_
|
||||
///
|
||||
/// \returns Number of characters in result.
|
||||
///
|
||||
inline int vsnprintf(_Out_z_cap_(capacity) wchar_t *str, _In_ size_t capacity, _In_z_ _Printf_format_string_ const wchar_t *format, _In_ va_list arg) noexcept;
|
||||
static int vsnprintf(_Out_z_cap_(capacity) wchar_t *str, _In_ size_t capacity, _In_z_ _Printf_format_string_ const wchar_t *format, _In_ va_list arg) noexcept;
|
||||
|
||||
///
|
||||
/// Formats string using `printf()`.
|
||||
@ -350,7 +350,8 @@ inline int vsnprintf(_Out_z_cap_(capacity) wchar_t *str, _In_ size_t capacity, _
|
||||
///
|
||||
/// \returns Number of characters in result.
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline int vsprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, _In_ va_list arg);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static int vsprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, _In_ va_list arg);
|
||||
|
||||
///
|
||||
/// Formats string using `printf()`.
|
||||
@ -360,21 +361,24 @@ template<class _Elem, class _Traits, class _Ax> inline int vsprintf(_Inout_ std:
|
||||
///
|
||||
/// \returns Number of characters in result.
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline int sprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, ...);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static int sprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, ...);
|
||||
|
||||
///
|
||||
/// Formats a message string.
|
||||
///
|
||||
/// \sa [FormatMessage function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms679351.aspx)
|
||||
///
|
||||
template<class _Traits, class _Ax> inline DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<char, _Traits, _Ax> &str, _In_opt_ va_list *Arguments);
|
||||
template<class _Traits, class _Ax>
|
||||
static DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<char, _Traits, _Ax> &str, _In_opt_ va_list *Arguments);
|
||||
|
||||
///
|
||||
/// Formats a message string.
|
||||
///
|
||||
/// \sa [FormatMessage function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms679351.aspx)
|
||||
///
|
||||
template<class _Traits, class _Ax> inline DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &str, _In_opt_ va_list *Arguments);
|
||||
template<class _Traits, class _Ax>
|
||||
static DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &str, _In_opt_ va_list *Arguments);
|
||||
|
||||
/// @}
|
||||
|
||||
@ -491,7 +495,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] owner Object to attach helper to
|
||||
///
|
||||
inline ref_unique_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) :
|
||||
ref_unique_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) :
|
||||
m_own(owner),
|
||||
m_ptr(owner.release())
|
||||
{}
|
||||
@ -501,7 +505,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other Source object
|
||||
///
|
||||
inline ref_unique_ptr(_Inout_ ref_unique_ptr<_Ty, _Dx> &&other) :
|
||||
ref_unique_ptr(_Inout_ ref_unique_ptr<_Ty, _Dx> &&other) :
|
||||
m_own(other.m_own),
|
||||
m_ptr(other.m_ptr)
|
||||
{
|
||||
@ -511,7 +515,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns ownership of the pointer
|
||||
///
|
||||
inline ~ref_unique_ptr()
|
||||
~ref_unique_ptr()
|
||||
{
|
||||
if (m_ptr != nullptr)
|
||||
m_own.reset(m_ptr);
|
||||
@ -522,7 +526,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Pointer to the pointer
|
||||
///
|
||||
inline operator typename _Ty**()
|
||||
operator typename _Ty**()
|
||||
{
|
||||
return &m_ptr;
|
||||
}
|
||||
@ -532,7 +536,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Reference to the pointer
|
||||
///
|
||||
inline operator typename _Ty*&()
|
||||
operator typename _Ty*&()
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
@ -558,7 +562,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] owner Object to attach helper to
|
||||
///
|
||||
inline ref_unique_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept :
|
||||
ref_unique_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept :
|
||||
m_own(owner),
|
||||
m_ptr(owner.release())
|
||||
{}
|
||||
@ -570,7 +574,7 @@ namespace winstd
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
inline ref_unique_ptr& operator=(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept
|
||||
ref_unique_ptr& operator=(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept
|
||||
{
|
||||
if (this != &other) {
|
||||
m_own = owner;
|
||||
@ -585,7 +589,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other Source object
|
||||
///
|
||||
inline ref_unique_ptr(_Inout_ ref_unique_ptr<_Ty[], _Dx> &&other) :
|
||||
ref_unique_ptr(_Inout_ ref_unique_ptr<_Ty[], _Dx> &&other) :
|
||||
m_own(other.m_own),
|
||||
m_ptr(other.m_ptr)
|
||||
{
|
||||
@ -599,7 +603,7 @@ namespace winstd
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
inline ref_unique_ptr& operator=(_Inout_ ref_unique_ptr<_Ty[], _Dx> &&other)
|
||||
ref_unique_ptr& operator=(_Inout_ ref_unique_ptr<_Ty[], _Dx> &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
m_own = other.m_own;
|
||||
@ -624,7 +628,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Pointer to the pointer
|
||||
///
|
||||
inline operator typename _Ty**() noexcept
|
||||
operator typename _Ty**() noexcept
|
||||
{
|
||||
return &m_ptr;
|
||||
}
|
||||
@ -634,7 +638,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Reference to the pointer
|
||||
///
|
||||
inline operator typename _Ty*&()
|
||||
operator typename _Ty*&()
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
@ -646,13 +650,13 @@ namespace winstd
|
||||
#pragma warning(pop)
|
||||
|
||||
template<class _Ty, class _Dx>
|
||||
inline ref_unique_ptr<_Ty, _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) noexcept
|
||||
ref_unique_ptr<_Ty, _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) noexcept
|
||||
{
|
||||
return ref_unique_ptr<_Ty, _Dx>(owner);
|
||||
}
|
||||
|
||||
template<class _Ty, class _Dx>
|
||||
inline ref_unique_ptr<_Ty[], _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept
|
||||
ref_unique_ptr<_Ty[], _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept
|
||||
{
|
||||
return ref_unique_ptr<_Ty[], _Dx>(owner);
|
||||
}
|
||||
@ -685,7 +689,7 @@ namespace winstd
|
||||
///
|
||||
/// Initializes a new class instance with the object handle set to INVAL.
|
||||
///
|
||||
inline handle() noexcept : m_h(invalid)
|
||||
handle() noexcept : m_h(invalid)
|
||||
{
|
||||
}
|
||||
|
||||
@ -694,7 +698,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] h Initial object handle value
|
||||
///
|
||||
inline handle(_In_opt_ handle_type h) noexcept : m_h(h)
|
||||
handle(_In_opt_ handle_type h) noexcept : m_h(h)
|
||||
{
|
||||
}
|
||||
|
||||
@ -703,7 +707,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
inline handle(_Inout_ handle<handle_type, INVAL> &&h) noexcept
|
||||
handle(_Inout_ handle<handle_type, INVAL> &&h) noexcept
|
||||
{
|
||||
// Transfer handle.
|
||||
m_h = h.m_h;
|
||||
@ -712,8 +716,8 @@ namespace winstd
|
||||
|
||||
private:
|
||||
// This class is noncopyable.
|
||||
inline handle(_In_ const handle<handle_type, INVAL> &h) noexcept {};
|
||||
inline handle<handle_type, INVAL>& operator=(_In_ const handle<handle_type, INVAL> &h) noexcept {};
|
||||
handle(_In_ const handle<handle_type, INVAL> &h) noexcept {};
|
||||
handle<handle_type, INVAL>& operator=(_In_ const handle<handle_type, INVAL> &h) noexcept {};
|
||||
|
||||
public:
|
||||
///
|
||||
@ -721,7 +725,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] h Object handle value
|
||||
///
|
||||
inline handle<handle_type, INVAL>& operator=(_In_opt_ handle_type h) noexcept
|
||||
handle<handle_type, INVAL>& operator=(_In_opt_ handle_type h) noexcept
|
||||
{
|
||||
attach(h);
|
||||
return *this;
|
||||
@ -733,7 +737,7 @@ namespace winstd
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
#pragma warning(suppress: 26432) // Move constructor is also present, but not detected by code analysis somehow.
|
||||
inline handle<handle_type, INVAL>& operator=(_Inout_ handle<handle_type, INVAL> &&h) noexcept
|
||||
handle<handle_type, INVAL>& operator=(_Inout_ handle<handle_type, INVAL> &&h) noexcept
|
||||
{
|
||||
if (this != std::addressof(h)) {
|
||||
// Transfer handle.
|
||||
@ -750,7 +754,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Object handle
|
||||
///
|
||||
inline operator handle_type() const
|
||||
operator handle_type() const
|
||||
{
|
||||
return m_h;
|
||||
}
|
||||
@ -760,7 +764,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Object handle value
|
||||
///
|
||||
inline handle_type*& operator*() const
|
||||
handle_type*& operator*() const
|
||||
{
|
||||
assert(m_h != invalid);
|
||||
return *m_h;
|
||||
@ -770,7 +774,7 @@ namespace winstd
|
||||
/// Returns the object handle reference.
|
||||
/// \return Object handle reference
|
||||
///
|
||||
inline handle_type* operator&()
|
||||
handle_type* operator&()
|
||||
{
|
||||
assert(m_h == invalid);
|
||||
return &m_h;
|
||||
@ -781,7 +785,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Object handle
|
||||
///
|
||||
inline handle_type operator->() const
|
||||
handle_type operator->() const
|
||||
{
|
||||
assert(m_h != invalid);
|
||||
return m_h;
|
||||
@ -794,7 +798,7 @@ namespace winstd
|
||||
/// - Non zero when object handle is INVAL;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator!() const
|
||||
bool operator!() const
|
||||
{
|
||||
return m_h == invalid;
|
||||
}
|
||||
@ -807,7 +811,7 @@ namespace winstd
|
||||
/// - Non zero when object handle is less than h;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator<(_In_opt_ handle_type h) const
|
||||
bool operator<(_In_opt_ handle_type h) const
|
||||
{
|
||||
return m_h < h;
|
||||
}
|
||||
@ -820,7 +824,7 @@ namespace winstd
|
||||
/// - Non zero when object handle is less than or equal to h;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator<=(_In_opt_ handle_type h) const
|
||||
bool operator<=(_In_opt_ handle_type h) const
|
||||
{
|
||||
return !operator>(h);
|
||||
}
|
||||
@ -833,7 +837,7 @@ namespace winstd
|
||||
/// - Non zero when object handle is greater than or equal to h;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator>=(_In_opt_ handle_type h) const
|
||||
bool operator>=(_In_opt_ handle_type h) const
|
||||
{
|
||||
return !operator<(h);
|
||||
}
|
||||
@ -846,7 +850,7 @@ namespace winstd
|
||||
/// - Non zero when object handle is greater than h;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator>(_In_opt_ handle_type h) const
|
||||
bool operator>(_In_opt_ handle_type h) const
|
||||
{
|
||||
return h < m_h;
|
||||
}
|
||||
@ -859,7 +863,7 @@ namespace winstd
|
||||
/// - Non zero when object handle is not equal to h;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator!=(_In_opt_ handle_type h) const
|
||||
bool operator!=(_In_opt_ handle_type h) const
|
||||
{
|
||||
return !operator==(h);
|
||||
}
|
||||
@ -872,7 +876,7 @@ namespace winstd
|
||||
/// - Non zero when object handle is equal to h;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator==(_In_opt_ handle_type h) const
|
||||
bool operator==(_In_opt_ handle_type h) const
|
||||
{
|
||||
return m_h == h;
|
||||
}
|
||||
@ -884,7 +888,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] h New object handle
|
||||
///
|
||||
inline void attach(_In_opt_ handle_type h) noexcept
|
||||
void attach(_In_opt_ handle_type h) noexcept
|
||||
{
|
||||
if (m_h != invalid)
|
||||
free_internal();
|
||||
@ -896,7 +900,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Object handle
|
||||
///
|
||||
inline handle_type detach()
|
||||
handle_type detach()
|
||||
{
|
||||
handle_type h = m_h;
|
||||
m_h = invalid;
|
||||
@ -906,7 +910,7 @@ namespace winstd
|
||||
///
|
||||
/// Destroys the object
|
||||
///
|
||||
inline void free()
|
||||
void free()
|
||||
{
|
||||
if (m_h != invalid) {
|
||||
free_internal();
|
||||
@ -941,7 +945,7 @@ namespace winstd
|
||||
///
|
||||
/// Initializes a new class instance with the object handle set to INVAL.
|
||||
///
|
||||
inline dplhandle() noexcept
|
||||
dplhandle() noexcept
|
||||
{
|
||||
}
|
||||
|
||||
@ -950,7 +954,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] h Initial object handle value
|
||||
///
|
||||
inline dplhandle(_In_opt_ handle_type h) noexcept : handle<handle_type, INVAL>(h)
|
||||
dplhandle(_In_opt_ handle_type h) noexcept : handle<handle_type, INVAL>(h)
|
||||
{
|
||||
}
|
||||
|
||||
@ -959,7 +963,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] h A reference of another object
|
||||
///
|
||||
inline dplhandle<handle_type, INVAL>(_In_ const dplhandle<handle_type, INVAL> &h) noexcept : handle<handle_type, INVAL>(duplicate_internal(h.m_h))
|
||||
dplhandle<handle_type, INVAL>(_In_ const dplhandle<handle_type, INVAL> &h) noexcept : handle<handle_type, INVAL>(duplicate_internal(h.m_h))
|
||||
{
|
||||
}
|
||||
|
||||
@ -968,7 +972,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
inline dplhandle<handle_type, INVAL>(_Inout_ dplhandle<handle_type, INVAL> &&h) noexcept : handle<handle_type, INVAL>(std::move(h))
|
||||
dplhandle<handle_type, INVAL>(_Inout_ dplhandle<handle_type, INVAL> &&h) noexcept : handle<handle_type, INVAL>(std::move(h))
|
||||
{
|
||||
}
|
||||
|
||||
@ -977,7 +981,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] h Object handle value
|
||||
///
|
||||
inline dplhandle<handle_type, INVAL>& operator=(_In_opt_ handle_type h) noexcept
|
||||
dplhandle<handle_type, INVAL>& operator=(_In_opt_ handle_type h) noexcept
|
||||
{
|
||||
handle<handle_type, INVAL>::operator=(h);
|
||||
return *this;
|
||||
@ -988,7 +992,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] h Object
|
||||
///
|
||||
inline dplhandle<handle_type, INVAL>& operator=(_In_ const dplhandle<handle_type, INVAL> &h) noexcept
|
||||
dplhandle<handle_type, INVAL>& operator=(_In_ const dplhandle<handle_type, INVAL> &h) noexcept
|
||||
{
|
||||
if (this != std::addressof(h)) {
|
||||
if (h.m_h != invalid) {
|
||||
@ -1016,7 +1020,7 @@ namespace winstd
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
#pragma warning(disable: 26432) // Move constructor is also present, but not detected by code analysis somehow.
|
||||
inline dplhandle<handle_type, INVAL>& operator=(_Inout_ dplhandle<handle_type, INVAL> &&h) noexcept
|
||||
dplhandle<handle_type, INVAL>& operator=(_Inout_ dplhandle<handle_type, INVAL> &&h) noexcept
|
||||
{
|
||||
handle<handle_type, INVAL>::operator=(std::move(h));
|
||||
return *this;
|
||||
@ -1027,7 +1031,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Duplicated object handle
|
||||
///
|
||||
inline handle_type duplicate() const
|
||||
handle_type duplicate() const
|
||||
{
|
||||
return m_h != invalid ? duplicate_internal(m_h) : invalid;
|
||||
}
|
||||
@ -1041,7 +1045,7 @@ namespace winstd
|
||||
/// - true when duplication succeeds;
|
||||
/// - false when duplication fails. In case of failure obtaining the extended error information is object type specific (for example: `GetLastError()`).
|
||||
///
|
||||
inline bool attach_duplicated(_In_opt_ handle_type h)
|
||||
bool attach_duplicated(_In_opt_ handle_type h)
|
||||
{
|
||||
if (m_h != invalid)
|
||||
free_internal();
|
||||
@ -1108,7 +1112,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] size_max Maximum number of elements. Please note this cannot be changed later.
|
||||
///
|
||||
inline vector_queue(_In_ size_type size_max) :
|
||||
vector_queue(_In_ size_type size_max) :
|
||||
m_data(new value_type[size_max]),
|
||||
m_head(0),
|
||||
m_count(0),
|
||||
@ -1121,7 +1125,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] other Queue to copy from
|
||||
///
|
||||
inline vector_queue(_In_ const vector_queue<value_type> &other) :
|
||||
vector_queue(_In_ const vector_queue<value_type> &other) :
|
||||
m_data(new value_type[other.m_size_max]),
|
||||
m_head(other.m_head),
|
||||
m_count(other.m_count),
|
||||
@ -1147,7 +1151,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other Queue to move
|
||||
///
|
||||
inline vector_queue(_Inout_ vector_queue<value_type> &&other) :
|
||||
vector_queue(_Inout_ vector_queue<value_type> &&other) :
|
||||
m_data (std::move(other.m_data )),
|
||||
m_head (std::move(other.m_head )),
|
||||
m_count (std::move(other.m_count )),
|
||||
@ -1165,7 +1169,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] other Queue to copy from
|
||||
///
|
||||
inline vector_queue<value_type>& operator=(_In_ const vector_queue<value_type> &other)
|
||||
vector_queue<value_type>& operator=(_In_ const vector_queue<value_type> &other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
m_head = other.m_head;
|
||||
@ -1189,7 +1193,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other Queue to move
|
||||
///
|
||||
inline vector_queue<value_type>& operator=(_Inout_ vector_queue<value_type> &&other)
|
||||
vector_queue<value_type>& operator=(_Inout_ vector_queue<value_type> &&other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
m_data = std::move(other.m_data );
|
||||
@ -1210,7 +1214,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns the number of elements in the vector.
|
||||
///
|
||||
inline size_type size() const
|
||||
size_type size() const
|
||||
{
|
||||
return m_count;
|
||||
}
|
||||
@ -1218,7 +1222,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns the number of elements that the queue can contain before overwriting head ones.
|
||||
///
|
||||
inline size_type capacity() const
|
||||
size_type capacity() const
|
||||
{
|
||||
return m_size_max;
|
||||
}
|
||||
@ -1226,7 +1230,7 @@ namespace winstd
|
||||
///
|
||||
/// Erases the elements of the queue.
|
||||
///
|
||||
inline void clear()
|
||||
void clear()
|
||||
{
|
||||
m_count = 0;
|
||||
}
|
||||
@ -1234,7 +1238,7 @@ namespace winstd
|
||||
///
|
||||
/// Tests if the queue is empty.
|
||||
///
|
||||
inline bool empty() const
|
||||
bool empty() const
|
||||
{
|
||||
return m_count == 0;
|
||||
}
|
||||
@ -1244,7 +1248,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] pos The subscript or position number of the element to reference in the queue.
|
||||
///
|
||||
inline reference at(_In_ size_type pos)
|
||||
reference at(_In_ size_type pos)
|
||||
{
|
||||
if (pos >= m_count) throw std::invalid_argument("Invalid subscript");
|
||||
return m_data[abs(pos)];
|
||||
@ -1255,7 +1259,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] pos The subscript or position number of the element to reference in the queue.
|
||||
///
|
||||
inline reference operator[](_In_ size_type pos)
|
||||
reference operator[](_In_ size_type pos)
|
||||
{
|
||||
if (pos >= m_count) throw std::invalid_argument("Invalid subscript");
|
||||
return m_data[abs(pos)];
|
||||
@ -1266,7 +1270,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] pos The subscript or position number of the element to reference in the queue.
|
||||
///
|
||||
inline const_reference at(_In_ size_type pos) const
|
||||
const_reference at(_In_ size_type pos) const
|
||||
{
|
||||
if (pos >= m_count) throw std::invalid_argument("Invalid subscript");
|
||||
return m_data[abs(pos)];
|
||||
@ -1277,7 +1281,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] pos The subscript or position number of the element to reference in the queue.
|
||||
///
|
||||
inline const_reference operator[](_In_ size_type pos) const
|
||||
const_reference operator[](_In_ size_type pos) const
|
||||
{
|
||||
if (pos >= m_count) throw std::invalid_argument("Invalid subscript");
|
||||
return m_data[abs(pos)];
|
||||
@ -1290,7 +1294,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] pos The absolute subscript or position number of the element to reference in the queue.
|
||||
///
|
||||
inline reference at_abs(_In_ size_type pos)
|
||||
reference at_abs(_In_ size_type pos)
|
||||
{
|
||||
if (pos >= m_size_max) throw std::invalid_argument("Invalid subscript");
|
||||
return m_data[pos];
|
||||
@ -1303,7 +1307,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] pos The absolute subscript or position number of the element to reference in the queue.
|
||||
///
|
||||
inline const_reference at_abs(_In_ size_type pos) const
|
||||
const_reference at_abs(_In_ size_type pos) const
|
||||
{
|
||||
if (pos >= m_size_max) throw std::invalid_argument("Invalid subscript");
|
||||
return m_data[pos];
|
||||
@ -1316,7 +1320,7 @@ namespace winstd
|
||||
///
|
||||
/// \returns The absolute subscript or position number the element was copied to.
|
||||
///
|
||||
inline size_type push_back(_In_ const value_type &v)
|
||||
size_type push_back(_In_ const value_type &v)
|
||||
{
|
||||
if (m_count < m_size_max) {
|
||||
size_type pos = abs(m_count);
|
||||
@ -1338,7 +1342,7 @@ namespace winstd
|
||||
///
|
||||
/// \returns The absolute subscript or position number the element was moved to.
|
||||
///
|
||||
inline size_type push_back(_Inout_ value_type&&v)
|
||||
size_type push_back(_Inout_ value_type&&v)
|
||||
{
|
||||
if (m_count < m_size_max) {
|
||||
size_type pos = abs(m_count);
|
||||
@ -1356,7 +1360,7 @@ namespace winstd
|
||||
///
|
||||
/// Removes (dequeues) the last element of the queue.
|
||||
///
|
||||
inline void pop_back()
|
||||
void pop_back()
|
||||
{
|
||||
if (!m_count) throw std::invalid_argument("Empty storage");
|
||||
m_count--;
|
||||
@ -1369,7 +1373,7 @@ namespace winstd
|
||||
///
|
||||
/// \returns The absolute subscript or position number the element was copied to.
|
||||
///
|
||||
inline size_type push_front(_In_ const value_type &v)
|
||||
size_type push_front(_In_ const value_type &v)
|
||||
{
|
||||
m_head = abs(-1);
|
||||
if (m_count < m_size_max)
|
||||
@ -1385,7 +1389,7 @@ namespace winstd
|
||||
///
|
||||
/// \returns The absolute subscript or position number the element was moved to.
|
||||
///
|
||||
inline size_type push_front(_Inout_ value_type&&v)
|
||||
size_type push_front(_Inout_ value_type&&v)
|
||||
{
|
||||
m_head = abs(-1);
|
||||
if (m_count < m_size_max)
|
||||
@ -1397,7 +1401,7 @@ namespace winstd
|
||||
///
|
||||
/// Removes (dequeues) the head element of the queue.
|
||||
///
|
||||
inline void pop_front()
|
||||
void pop_front()
|
||||
{
|
||||
if (!m_count) throw std::invalid_argument("Empty storage");
|
||||
m_head = abs(1);
|
||||
@ -1407,7 +1411,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns a reference to the head element in the queue.
|
||||
///
|
||||
inline reference front()
|
||||
reference front()
|
||||
{
|
||||
if (!m_count) throw std::invalid_argument("Empty storage");
|
||||
return m_data[m_head];
|
||||
@ -1416,7 +1420,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns a constant reference to the head element in the queue.
|
||||
///
|
||||
inline const_reference front() const
|
||||
const_reference front() const
|
||||
{
|
||||
if (!m_count) throw std::invalid_argument("Empty storage");
|
||||
return m_data[m_head];
|
||||
@ -1425,7 +1429,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns a reference to the last element in the queue.
|
||||
///
|
||||
inline reference back()
|
||||
reference back()
|
||||
{
|
||||
return m_data[tail()];
|
||||
}
|
||||
@ -1433,7 +1437,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns a constant reference to the last element in the queue.
|
||||
///
|
||||
inline const_reference back() const
|
||||
const_reference back() const
|
||||
{
|
||||
return m_data[tail()];
|
||||
}
|
||||
@ -1441,7 +1445,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns absolute subscript or position number of the head element in the queue. The element does not need to exist.
|
||||
///
|
||||
inline size_type head() const
|
||||
size_type head() const
|
||||
{
|
||||
return m_head;
|
||||
}
|
||||
@ -1449,7 +1453,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns absolute subscript or position number of the last element in the queue. The element must exist.
|
||||
///
|
||||
inline size_type tail() const
|
||||
size_type tail() const
|
||||
{
|
||||
if (!m_count) throw std::invalid_argument("Empty storage");
|
||||
return abs(m_count - 1);
|
||||
@ -1457,7 +1461,7 @@ namespace winstd
|
||||
|
||||
///
|
||||
/// Returns absolute subscript or position number of the given element in the queue.
|
||||
inline size_type abs(_In_ size_type pos) const
|
||||
size_type abs(_In_ size_type pos) const
|
||||
{
|
||||
return (m_head + pos) % m_size_max;
|
||||
}
|
||||
@ -1490,7 +1494,7 @@ namespace winstd
|
||||
/// \param[in] num Numeric error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline num_runtime_error(_In_ error_type num, _In_ const std::string& msg) :
|
||||
num_runtime_error(_In_ error_type num, _In_ const std::string& msg) :
|
||||
m_num(num),
|
||||
runtime_error(msg)
|
||||
{
|
||||
@ -1503,7 +1507,7 @@ namespace winstd
|
||||
/// \param[in] num Numeric error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline num_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) :
|
||||
num_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) :
|
||||
m_num(num),
|
||||
runtime_error(msg)
|
||||
{
|
||||
@ -1513,7 +1517,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns the Windows error number
|
||||
///
|
||||
inline error_type number() const
|
||||
error_type number() const
|
||||
{
|
||||
return m_num;
|
||||
}
|
||||
@ -1535,7 +1539,7 @@ namespace winstd
|
||||
/// \param[in] num Windows error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline win_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<DWORD>(num, msg)
|
||||
win_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<DWORD>(num, msg)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1546,7 +1550,7 @@ namespace winstd
|
||||
/// \param[in] num Windows error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline win_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<DWORD>(num, msg)
|
||||
win_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<DWORD>(num, msg)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1556,7 +1560,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline win_runtime_error(_In_ const std::string& msg) : num_runtime_error<DWORD>(GetLastError(), msg)
|
||||
win_runtime_error(_In_ const std::string& msg) : num_runtime_error<DWORD>(GetLastError(), msg)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1566,7 +1570,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline win_runtime_error(_In_opt_z_ const char *msg = nullptr) : num_runtime_error<DWORD>(GetLastError(), msg)
|
||||
win_runtime_error(_In_opt_z_ const char *msg = nullptr) : num_runtime_error<DWORD>(GetLastError(), msg)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1576,7 +1580,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [FormatMessage function](https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-formatmessage)
|
||||
///
|
||||
inline tstring msg(_In_opt_ DWORD dwLanguageId = 0) const
|
||||
tstring msg(_In_opt_ DWORD dwLanguageId = 0) const
|
||||
{
|
||||
tstring str;
|
||||
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, m_num, dwLanguageId, str, NULL)) {
|
||||
@ -1608,7 +1612,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] format String template using `printf()` style
|
||||
///
|
||||
inline basic_string_printf(_In_z_ _Printf_format_string_ const _Elem *format, ...)
|
||||
basic_string_printf(_In_z_ _Printf_format_string_ const _Elem *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
@ -1627,7 +1631,7 @@ namespace winstd
|
||||
/// \param[in] hInstance Resource module handle
|
||||
/// \param[in] nFormatID Resource ID of the string template using `printf()` style
|
||||
///
|
||||
inline basic_string_printf(_In_ HINSTANCE hInstance, _In_ UINT nFormatID, ...)
|
||||
basic_string_printf(_In_ HINSTANCE hInstance, _In_ UINT nFormatID, ...)
|
||||
{
|
||||
_Myt format;
|
||||
ATLENSURE(format.LoadString(hInstance, nFormatID));
|
||||
@ -1645,7 +1649,7 @@ namespace winstd
|
||||
/// \param[in] wLanguageID Resource language
|
||||
/// \param[in] nFormatID Resource ID of the string template using `printf()` style
|
||||
///
|
||||
inline basic_string_printf(_In_ HINSTANCE hInstance, _In_ WORD wLanguageID, _In_ UINT nFormatID, ...)
|
||||
basic_string_printf(_In_ HINSTANCE hInstance, _In_ WORD wLanguageID, _In_ UINT nFormatID, ...)
|
||||
{
|
||||
_Myt format;
|
||||
ATLENSURE(format.LoadString(hInstance, nFormatID, wLanguageID));
|
||||
@ -1675,7 +1679,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] format String template using `FormatMessage()` style
|
||||
///
|
||||
inline basic_string_msg(_In_z_ _FormatMessage_format_string_ const _Elem *format, ...)
|
||||
basic_string_msg(_In_z_ _FormatMessage_format_string_ const _Elem *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
@ -1694,7 +1698,7 @@ namespace winstd
|
||||
/// \param[in] hInstance Resource module handle
|
||||
/// \param[in] nFormatID Resource ID of the string template using `FormatMessage()` style
|
||||
///
|
||||
inline basic_string_msg(_In_ HINSTANCE hInstance, _In_ UINT nFormatID, ...)
|
||||
basic_string_msg(_In_ HINSTANCE hInstance, _In_ UINT nFormatID, ...)
|
||||
{
|
||||
_Myt format(GetManager());
|
||||
ATLENSURE(format.LoadString(hInstance, nFormatID));
|
||||
@ -1712,7 +1716,7 @@ namespace winstd
|
||||
/// \param[in] wLanguageID Resource language
|
||||
/// \param[in] nFormatID Resource ID of the string template using `FormatMessage()` style
|
||||
///
|
||||
inline basic_string_msg(_In_ HINSTANCE hInstance, _In_ WORD wLanguageID, _In_ UINT nFormatID, ...)
|
||||
basic_string_msg(_In_ HINSTANCE hInstance, _In_ WORD wLanguageID, _In_ UINT nFormatID, ...)
|
||||
{
|
||||
_Myt format(GetManager());
|
||||
ATLENSURE(format.LoadString(hInstance, nFormatID, wLanguageID));
|
||||
@ -1731,7 +1735,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [FormatMessage function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms679351.aspx)
|
||||
///
|
||||
inline basic_string_msg(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _In_opt_ va_list *Arguments)
|
||||
basic_string_msg(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _In_opt_ va_list *Arguments)
|
||||
{
|
||||
FormatMessage(dwFlags & ~FORMAT_MESSAGE_ARGUMENT_ARRAY, lpSource, dwMessageId, dwLanguageId, *this, Arguments);
|
||||
}
|
||||
@ -1742,7 +1746,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [FormatMessage function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms679351.aspx)
|
||||
///
|
||||
inline basic_string_msg(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _In_opt_ DWORD_PTR *Arguments)
|
||||
basic_string_msg(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _In_opt_ DWORD_PTR *Arguments)
|
||||
{
|
||||
FormatMessage(dwFlags | FORMAT_MESSAGE_ARGUMENT_ARRAY, lpSource, dwMessageId, dwLanguageId, *this, (va_list*)Arguments);
|
||||
}
|
||||
@ -1753,7 +1757,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [FormatMessage function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms679351.aspx)
|
||||
///
|
||||
inline basic_string_msg(_In_ DWORD dwFlags, _In_z_ LPCTSTR pszFormat, _In_opt_ va_list *Arguments)
|
||||
basic_string_msg(_In_ DWORD dwFlags, _In_z_ LPCTSTR pszFormat, _In_opt_ va_list *Arguments)
|
||||
{
|
||||
FormatMessage(dwFlags & ~FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_FROM_STRING, pszFormat, 0, 0, *this, Arguments);
|
||||
}
|
||||
@ -1764,7 +1768,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [FormatMessage function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms679351.aspx)
|
||||
///
|
||||
inline basic_string_msg(_In_ DWORD dwFlags, _In_z_ LPCTSTR pszFormat, _In_opt_ DWORD_PTR *Arguments)
|
||||
basic_string_msg(_In_ DWORD dwFlags, _In_z_ LPCTSTR pszFormat, _In_opt_ DWORD_PTR *Arguments)
|
||||
{
|
||||
FormatMessage(dwFlags | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_FROM_STRING, pszFormat, 0, 0, *this, (va_list*)Arguments);
|
||||
}
|
||||
@ -1787,7 +1791,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_z_ _Printf_format_string_ const _Elem *format)
|
||||
basic_string_guid(_In_ const GUID &guid, _In_z_ _Printf_format_string_ const _Elem *format)
|
||||
{
|
||||
sprintf<_Elem, _Traits, _Ax>(*this, format,
|
||||
guid.Data1,
|
||||
@ -1815,7 +1819,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] guid GUID to convert
|
||||
///
|
||||
inline string_guid(_In_ const GUID &guid) :
|
||||
string_guid(_In_ const GUID &guid) :
|
||||
basic_string_guid<char, std::char_traits<char>, std::allocator<char> >(guid, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}")
|
||||
{
|
||||
}
|
||||
@ -1838,7 +1842,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] guid GUID to convert
|
||||
///
|
||||
inline wstring_guid(_In_ const GUID &guid) :
|
||||
wstring_guid(_In_ const GUID &guid) :
|
||||
basic_string_guid<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >(guid, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}")
|
||||
{
|
||||
}
|
||||
@ -1881,7 +1885,7 @@ namespace winstd
|
||||
///
|
||||
/// Construct default allocator
|
||||
///
|
||||
inline sanitizing_allocator() noexcept : _Mybase()
|
||||
sanitizing_allocator() noexcept : _Mybase()
|
||||
{
|
||||
}
|
||||
|
||||
@ -1889,7 +1893,7 @@ namespace winstd
|
||||
///
|
||||
/// Construct by copying
|
||||
///
|
||||
inline sanitizing_allocator(_In_ const sanitizing_allocator<_Ty> &_Othr) : _Mybase(_Othr)
|
||||
sanitizing_allocator(_In_ const sanitizing_allocator<_Ty> &_Othr) : _Mybase(_Othr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1898,7 +1902,7 @@ namespace winstd
|
||||
/// Construct from a related allocator
|
||||
///
|
||||
template<class _Other>
|
||||
inline sanitizing_allocator(_In_ const sanitizing_allocator<_Other> &_Othr) noexcept : _Mybase(_Othr)
|
||||
sanitizing_allocator(_In_ const sanitizing_allocator<_Other> &_Othr) noexcept : _Mybase(_Othr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1926,7 +1930,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs uninitialized BLOB
|
||||
///
|
||||
inline sanitizing_blob()
|
||||
sanitizing_blob()
|
||||
{
|
||||
ZeroMemory(m_data, N);
|
||||
}
|
||||
@ -1934,7 +1938,7 @@ namespace winstd
|
||||
///
|
||||
/// Sanitizes BLOB
|
||||
///
|
||||
inline ~sanitizing_blob()
|
||||
~sanitizing_blob()
|
||||
{
|
||||
SecureZeroMemory(m_data, N);
|
||||
}
|
||||
@ -1947,15 +1951,16 @@ namespace winstd
|
||||
}
|
||||
|
||||
|
||||
#pragma warning(push)
|
||||
// Do not use _vsnprintf_s/_vsnwprintf_s(), since it terminates string by force even when we explicitly want to write unterminated string.
|
||||
// Threfore turn off compiler warning instead. ;)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4995)
|
||||
#pragma warning(disable: 4996)
|
||||
#pragma warning(disable: 4505) // Don't warn on unused code
|
||||
|
||||
#if _MSC_VER <= 1600
|
||||
|
||||
inline int vsnprintf(_Out_z_cap_(capacity) char *str, _In_ size_t capacity, _In_z_ _Printf_format_string_ const char *format, _In_ va_list arg)
|
||||
static int vsnprintf(_Out_z_cap_(capacity) char *str, _In_ size_t capacity, _In_z_ _Printf_format_string_ const char *format, _In_ va_list arg)
|
||||
{
|
||||
return _vsnprintf(str, capacity, format, arg);
|
||||
}
|
||||
@ -1963,14 +1968,14 @@ inline int vsnprintf(_Out_z_cap_(capacity) char *str, _In_ size_t capacity, _In_
|
||||
#endif
|
||||
|
||||
|
||||
inline int vsnprintf(_Out_z_cap_(capacity) wchar_t *str, _In_ size_t capacity, _In_z_ _Printf_format_string_ const wchar_t *format, _In_ va_list arg) noexcept
|
||||
static int vsnprintf(_Out_z_cap_(capacity) wchar_t *str, _In_ size_t capacity, _In_z_ _Printf_format_string_ const wchar_t *format, _In_ va_list arg) noexcept
|
||||
{
|
||||
return _vsnwprintf(str, capacity, format, arg);
|
||||
}
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline int vsprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, _In_ va_list arg)
|
||||
static int vsprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, _In_ va_list arg)
|
||||
{
|
||||
_Elem buf[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
|
||||
@ -1994,11 +1999,9 @@ inline int vsprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_
|
||||
return count;
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline int sprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, ...)
|
||||
static int sprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
@ -2009,7 +2012,7 @@ inline int sprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<char, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
|
||||
static DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<char, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
|
||||
{
|
||||
std::unique_ptr<CHAR[], winstd::LocalFree_delete<CHAR[]> > lpBuffer;
|
||||
DWORD dwResult = FormatMessageA(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPSTR>((LPSTR*)get_ptr(lpBuffer)), 0, Arguments);
|
||||
@ -2020,7 +2023,7 @@ inline DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ D
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
|
||||
static DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
|
||||
{
|
||||
std::unique_ptr<WCHAR[], winstd::LocalFree_delete<WCHAR[]> > lpBuffer;
|
||||
DWORD dwResult = FormatMessageW(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPWSTR>((LPWSTR*)get_ptr(lpBuffer)), 0, Arguments);
|
||||
@ -2028,3 +2031,5 @@ inline DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ D
|
||||
str.assign(lpBuffer.get(), dwResult);
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
|
@ -30,27 +30,31 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CredEnumerate function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa374794.aspx)
|
||||
///
|
||||
inline BOOL CredEnumerate(_In_z_ LPCTSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Inout_ std::unique_ptr<PCREDENTIAL[], winstd::CredFree_delete<PCREDENTIAL[]> > &cCredentials) noexcept;
|
||||
static BOOL CredEnumerate(_In_z_ LPCTSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Inout_ std::unique_ptr<PCREDENTIAL[], winstd::CredFree_delete<PCREDENTIAL[]> > &cCredentials) noexcept;
|
||||
|
||||
/// @copydoc CredProtectW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline BOOL CredProtectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static BOOL CredProtectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType);
|
||||
|
||||
///
|
||||
/// Encrypts the specified credentials so that only the current security context can decrypt them.
|
||||
///
|
||||
/// \sa [CredProtect function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa374803.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline BOOL CredProtectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static BOOL CredProtectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType);
|
||||
|
||||
/// @copydoc CredUnprotectW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline BOOL CredUnprotectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sCredentials);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static BOOL CredUnprotectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sCredentials);
|
||||
|
||||
///
|
||||
/// Decrypts credentials that were previously encrypted by using the CredProtect function.
|
||||
///
|
||||
/// \sa [CredUnprotect function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa375186.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline BOOL CredUnprotectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sCredentials);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static BOOL CredUnprotectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sCredentials);
|
||||
|
||||
/// @}
|
||||
|
||||
@ -129,7 +133,11 @@ namespace winstd
|
||||
}
|
||||
|
||||
|
||||
inline BOOL CredEnumerate(_In_z_ LPCTSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Inout_ std::unique_ptr<PCREDENTIAL[], winstd::CredFree_delete<PCREDENTIAL[]> > &cCredentials) noexcept
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4505) // Don't warn on unused code
|
||||
|
||||
|
||||
static BOOL CredEnumerate(_In_z_ LPCTSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Inout_ std::unique_ptr<PCREDENTIAL[], winstd::CredFree_delete<PCREDENTIAL[]> > &cCredentials) noexcept
|
||||
{
|
||||
PCREDENTIAL *pCredentials;
|
||||
if (CredEnumerate(Filter, Flags, Count, &pCredentials)) {
|
||||
@ -142,7 +150,7 @@ inline BOOL CredEnumerate(_In_z_ LPCTSTR Filter, _Reserved_ DWORD Flags, _Out_ D
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline BOOL CredProtectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType)
|
||||
static BOOL CredProtectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType)
|
||||
{
|
||||
_Elem buf[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(buf);
|
||||
@ -166,7 +174,7 @@ inline BOOL CredProtectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR ps
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline BOOL CredProtectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType)
|
||||
static BOOL CredProtectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType)
|
||||
{
|
||||
_Elem buf[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(buf);
|
||||
@ -190,7 +198,7 @@ inline BOOL CredProtectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR p
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline BOOL CredUnprotectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sCredentials)
|
||||
static BOOL CredUnprotectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sCredentials)
|
||||
{
|
||||
_Elem buf[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(buf);
|
||||
@ -214,7 +222,7 @@ inline BOOL CredUnprotectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline BOOL CredUnprotectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sCredentials)
|
||||
static BOOL CredUnprotectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sCredentials)
|
||||
{
|
||||
_Elem buf[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(buf);
|
||||
@ -235,3 +243,5 @@ inline BOOL CredUnprotectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
|
@ -31,63 +31,72 @@ namespace winstd
|
||||
/// @{
|
||||
|
||||
/// @copydoc CertGetNameStringW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline DWORD CertGetNameStringA(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sNameString);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static DWORD CertGetNameStringA(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sNameString);
|
||||
|
||||
///
|
||||
/// Obtains the subject or issuer name from a certificate [CERT_CONTEXT](https://msdn.microsoft.com/en-us/library/windows/desktop/aa377189.aspx) structure and stores it in a std::wstring string.
|
||||
///
|
||||
/// \sa [CertGetNameString function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa376086.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline DWORD CertGetNameStringW(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sNameString);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static DWORD CertGetNameStringW(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sNameString);
|
||||
|
||||
///
|
||||
/// Retrieves the information contained in an extended property of a certificate context.
|
||||
///
|
||||
/// \sa [CertGetCertificateContextProperty function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa376079.aspx)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline _Success_(return != 0) BOOL WINAPI CertGetCertificateContextProperty(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwPropId, _Out_ std::vector<_Ty, _Ax> &aData);
|
||||
template<class _Ty, class _Ax>
|
||||
static _Success_(return != 0) BOOL WINAPI CertGetCertificateContextProperty(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwPropId, _Out_ std::vector<_Ty, _Ax> &aData);
|
||||
|
||||
///
|
||||
/// Retrieves data that governs the operations of a hash object. The actual hash value can be retrieved by using this function.
|
||||
///
|
||||
/// \sa [CryptGetHashParam function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379947.aspx)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline _Success_(return != 0) BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags);
|
||||
template<class _Ty, class _Ax>
|
||||
static _Success_(return != 0) BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags);
|
||||
|
||||
///
|
||||
/// Retrieves data that governs the operations of a key.
|
||||
///
|
||||
/// \sa [CryptGetKeyParam function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379949.aspx)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline _Success_(return != 0) BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags);
|
||||
template<class _Ty, class _Ax>
|
||||
static _Success_(return != 0) BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags);
|
||||
|
||||
///
|
||||
/// Retrieves data that governs the operations of a key.
|
||||
///
|
||||
/// \sa [CryptGetKeyParam function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379949.aspx)
|
||||
///
|
||||
template<class T> inline _Success_(return != 0) BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags);
|
||||
template<class T>
|
||||
static _Success_(return != 0) BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags);
|
||||
|
||||
///
|
||||
/// Exports a cryptographic key or a key pair from a cryptographic service provider (CSP) in a secure manner.
|
||||
///
|
||||
/// \sa [CryptExportKey function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379931.aspx)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline _Success_(return != 0) BOOL CryptExportKey(_In_ HCRYPTKEY hKey, _In_ HCRYPTKEY hExpKey, _In_ DWORD dwBlobType, _In_ DWORD dwFlags, _Out_ std::vector<_Ty, _Ax> &aData);
|
||||
template<class _Ty, class _Ax>
|
||||
static _Success_(return != 0) BOOL CryptExportKey(_In_ HCRYPTKEY hKey, _In_ HCRYPTKEY hExpKey, _In_ DWORD dwBlobType, _In_ DWORD dwFlags, _Out_ std::vector<_Ty, _Ax> &aData);
|
||||
|
||||
///
|
||||
/// Encrypts data.
|
||||
///
|
||||
/// \sa [CryptEncrypt function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379924.aspx)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline _Success_(return != 0) BOOL CryptEncrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData);
|
||||
template<class _Ty, class _Ax>
|
||||
static _Success_(return != 0) BOOL CryptEncrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData);
|
||||
|
||||
///
|
||||
/// Decrypts data previously encrypted by using the CryptEncrypt function.
|
||||
///
|
||||
/// \sa [CryptDecrypt function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379913.aspx)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline _Success_(return != 0) BOOL CryptDecrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData);
|
||||
template<class _Ty, class _Ax>
|
||||
static _Success_(return != 0) BOOL CryptDecrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData);
|
||||
|
||||
/// @}
|
||||
|
||||
@ -131,7 +140,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CertCreateCertificateContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa376033.aspx)
|
||||
///
|
||||
inline bool create(_In_ DWORD dwCertEncodingType, _In_ LPCBYTE pbCertEncoded, _In_ DWORD cbCertEncoded) noexcept
|
||||
bool create(_In_ DWORD dwCertEncodingType, _In_ LPCBYTE pbCertEncoded, _In_ DWORD cbCertEncoded) noexcept
|
||||
{
|
||||
handle_type h = CertCreateCertificateContext(dwCertEncodingType, pbCertEncoded, cbCertEncoded);
|
||||
if (h != invalid) {
|
||||
@ -149,7 +158,7 @@ namespace winstd
|
||||
/// - Non zero when certificate is equal to \p other;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator==(_In_ const handle_type &other) const noexcept
|
||||
bool operator==(_In_ const handle_type &other) const noexcept
|
||||
{
|
||||
// TODO: [Crypto] Make constant time.
|
||||
return
|
||||
@ -165,7 +174,7 @@ namespace winstd
|
||||
/// - Non zero when certificate is not equal to \p other;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator!=(_In_ const handle_type &other) const noexcept
|
||||
bool operator!=(_In_ const handle_type &other) const noexcept
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
@ -178,7 +187,7 @@ namespace winstd
|
||||
/// - Non zero when certificate is less than \p other;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator<(_In_ const handle_type &other) const noexcept
|
||||
bool operator<(_In_ const handle_type &other) const noexcept
|
||||
{
|
||||
// TODO: [Crypto] Make constant time.
|
||||
const int r = memcmp(m_h->pbCertEncoded, other->pbCertEncoded, std::min<DWORD>(m_h->cbCertEncoded, other->cbCertEncoded));
|
||||
@ -193,7 +202,7 @@ namespace winstd
|
||||
/// - Non zero when certificate is greater than \p other;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator>(_In_ const handle_type &other) const noexcept
|
||||
bool operator>(_In_ const handle_type &other) const noexcept
|
||||
{
|
||||
// TODO: [Crypto] Make constant time.
|
||||
const int r = memcmp(m_h->pbCertEncoded, other->pbCertEncoded, std::min<DWORD>(m_h->cbCertEncoded, other->cbCertEncoded));
|
||||
@ -208,7 +217,7 @@ namespace winstd
|
||||
/// - Non zero when certificate is less than \p other;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator<=(_In_ const handle_type &other) const noexcept
|
||||
bool operator<=(_In_ const handle_type &other) const noexcept
|
||||
{
|
||||
return !operator>(other);
|
||||
}
|
||||
@ -221,7 +230,7 @@ namespace winstd
|
||||
/// - Non zero when certificate is greater than \p other;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator>=(_In_ const handle_type &other) const noexcept
|
||||
bool operator>=(_In_ const handle_type &other) const noexcept
|
||||
{
|
||||
return !operator<(other);
|
||||
}
|
||||
@ -281,7 +290,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CertGetCertificateChain function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa376078.aspx)
|
||||
///
|
||||
inline bool create(_In_opt_ HCERTCHAINENGINE hChainEngine, _In_ PCCERT_CONTEXT pCertContext, _In_opt_ LPFILETIME pTime, _In_opt_ HCERTSTORE hAdditionalStore, _In_ PCERT_CHAIN_PARA pChainPara, _In_ DWORD dwFlags, __reserved LPVOID pvReserved = NULL) noexcept
|
||||
bool create(_In_opt_ HCERTCHAINENGINE hChainEngine, _In_ PCCERT_CONTEXT pCertContext, _In_opt_ LPFILETIME pTime, _In_opt_ HCERTSTORE hAdditionalStore, _In_ PCERT_CHAIN_PARA pChainPara, _In_ DWORD dwFlags, __reserved LPVOID pvReserved = NULL) noexcept
|
||||
{
|
||||
handle_type h;
|
||||
if (CertGetCertificateChain(hChainEngine, pCertContext, pTime, hAdditionalStore, pChainPara, dwFlags, pvReserved, &h)) {
|
||||
@ -346,7 +355,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CertOpenStore function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa376559.aspx)
|
||||
///
|
||||
inline bool create(_In_ LPCSTR lpszStoreProvider, _In_ DWORD dwEncodingType, _In_opt_ HCRYPTPROV_LEGACY hCryptProv, _In_ DWORD dwFlags, _In_opt_ const void *pvPara) noexcept
|
||||
bool create(_In_ LPCSTR lpszStoreProvider, _In_ DWORD dwEncodingType, _In_opt_ HCRYPTPROV_LEGACY hCryptProv, _In_ DWORD dwFlags, _In_opt_ const void *pvPara) noexcept
|
||||
{
|
||||
handle_type h = CertOpenStore(lpszStoreProvider, dwEncodingType, hCryptProv, dwFlags, pvPara);
|
||||
if (h != invalid) {
|
||||
@ -365,7 +374,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CertOpenSystemStore function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa376560.aspx)
|
||||
///
|
||||
inline bool create(_In_opt_ HCRYPTPROV_LEGACY hCryptProv, _In_z_ LPCTSTR szSubsystemProtocol) noexcept
|
||||
bool create(_In_opt_ HCRYPTPROV_LEGACY hCryptProv, _In_z_ LPCTSTR szSubsystemProtocol) noexcept
|
||||
{
|
||||
handle_type h = CertOpenSystemStore(hCryptProv, szSubsystemProtocol);
|
||||
if (h != invalid) {
|
||||
@ -416,7 +425,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CryptAcquireContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379886.aspx)
|
||||
///
|
||||
inline bool create(_In_opt_z_ LPCTSTR szContainer, _In_opt_z_ LPCTSTR szProvider, _In_ DWORD dwProvType, _In_ DWORD dwFlags = 0) noexcept
|
||||
bool create(_In_opt_z_ LPCTSTR szContainer, _In_opt_z_ LPCTSTR szProvider, _In_ DWORD dwProvType, _In_ DWORD dwFlags = 0) noexcept
|
||||
{
|
||||
handle_type h;
|
||||
if (CryptAcquireContext(&h, szContainer, szProvider, dwProvType, dwFlags)) {
|
||||
@ -467,7 +476,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CryptCreateHash function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379908.aspx)
|
||||
///
|
||||
inline bool create(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_opt_ HCRYPTKEY hKey = NULL, _In_opt_ DWORD dwFlags = 0) noexcept
|
||||
bool create(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_opt_ HCRYPTKEY hKey = NULL, _In_opt_ DWORD dwFlags = 0) noexcept
|
||||
{
|
||||
handle_type h;
|
||||
if (CryptCreateHash(hProv, Algid, hKey, dwFlags, &h)) {
|
||||
@ -529,7 +538,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CryptGenKey function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379941.aspx)
|
||||
///
|
||||
inline bool generate(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ DWORD dwFlags) noexcept
|
||||
bool generate(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ DWORD dwFlags) noexcept
|
||||
{
|
||||
handle_type h;
|
||||
if (CryptGenKey(hProv, Algid, dwFlags, &h)) {
|
||||
@ -544,7 +553,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CryptImportKey function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa380207.aspx)
|
||||
///
|
||||
inline bool import(_In_ HCRYPTPROV hProv, __in_bcount(dwDataLen) LPCBYTE pbData, _In_ DWORD dwDataLen, _In_ HCRYPTKEY hPubKey, _In_ DWORD dwFlags) noexcept
|
||||
bool import(_In_ HCRYPTPROV hProv, __in_bcount(dwDataLen) LPCBYTE pbData, _In_ DWORD dwDataLen, _In_ HCRYPTKEY hPubKey, _In_ DWORD dwFlags) noexcept
|
||||
{
|
||||
handle_type h;
|
||||
if (CryptImportKey(hProv, pbData, dwDataLen, hPubKey, dwFlags, &h)) {
|
||||
@ -559,7 +568,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CryptImportPublicKeyInfo function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa380209.aspx)
|
||||
///
|
||||
inline bool import_public(_In_ HCRYPTPROV hCryptProv, _In_ DWORD dwCertEncodingType, _In_ PCERT_PUBLIC_KEY_INFO pInfo) noexcept
|
||||
bool import_public(_In_ HCRYPTPROV hCryptProv, _In_ DWORD dwCertEncodingType, _In_ PCERT_PUBLIC_KEY_INFO pInfo) noexcept
|
||||
{
|
||||
handle_type h;
|
||||
if (CryptImportPublicKeyInfo(hCryptProv, dwCertEncodingType, pInfo, &h)) {
|
||||
@ -574,7 +583,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [CryptDeriveKey function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379916.aspx)
|
||||
///
|
||||
inline bool derive(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ HCRYPTHASH hBaseData, _In_ DWORD dwFlags) noexcept
|
||||
bool derive(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ HCRYPTHASH hBaseData, _In_ DWORD dwFlags) noexcept
|
||||
{
|
||||
handle_type h;
|
||||
if (CryptDeriveKey(hProv, Algid, hBaseData, dwFlags, &h)) {
|
||||
@ -692,7 +701,7 @@ namespace winstd
|
||||
///
|
||||
/// Initializes an empty BLOB.
|
||||
///
|
||||
inline data_blob() noexcept
|
||||
data_blob() noexcept
|
||||
{
|
||||
cbData = 0;
|
||||
pbData = NULL;
|
||||
@ -701,7 +710,7 @@ namespace winstd
|
||||
///
|
||||
/// Initializes a BLOB from existing data.
|
||||
///
|
||||
inline data_blob(_In_count_(size) BYTE *data, _In_ DWORD size) noexcept
|
||||
data_blob(_In_count_(size) BYTE *data, _In_ DWORD size) noexcept
|
||||
{
|
||||
cbData = size;
|
||||
pbData = data;
|
||||
@ -710,7 +719,7 @@ namespace winstd
|
||||
///
|
||||
/// Duplicate an existing BLOB.
|
||||
///
|
||||
inline data_blob(_In_ const DATA_BLOB &other)
|
||||
data_blob(_In_ const DATA_BLOB &other)
|
||||
{
|
||||
cbData = other.cbData;
|
||||
if (cbData) {
|
||||
@ -724,7 +733,7 @@ namespace winstd
|
||||
///
|
||||
/// Move an existing BLOB.
|
||||
///
|
||||
inline data_blob(_Inout_ data_blob &&other) noexcept
|
||||
data_blob(_Inout_ data_blob &&other) noexcept
|
||||
{
|
||||
cbData = other.cbData;
|
||||
pbData = other.pbData;
|
||||
@ -744,7 +753,7 @@ namespace winstd
|
||||
///
|
||||
/// Copy an existing BLOB.
|
||||
///
|
||||
inline data_blob& operator=(_In_ const DATA_BLOB &other)
|
||||
data_blob& operator=(_In_ const DATA_BLOB &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
cbData = other.cbData;
|
||||
@ -764,7 +773,7 @@ namespace winstd
|
||||
///
|
||||
/// Move an existing BLOB.
|
||||
///
|
||||
inline data_blob& operator=(_Inout_ data_blob &&other) noexcept
|
||||
data_blob& operator=(_Inout_ data_blob &&other) noexcept
|
||||
{
|
||||
if (this != &other) {
|
||||
cbData = other.cbData;
|
||||
@ -781,7 +790,7 @@ namespace winstd
|
||||
///
|
||||
/// Get BLOB size.
|
||||
///
|
||||
inline DWORD size() const noexcept
|
||||
DWORD size() const noexcept
|
||||
{
|
||||
return cbData;
|
||||
}
|
||||
@ -789,7 +798,7 @@ namespace winstd
|
||||
///
|
||||
/// Get BLOB buffer.
|
||||
///
|
||||
inline const BYTE* data() const noexcept
|
||||
const BYTE* data() const noexcept
|
||||
{
|
||||
return pbData;
|
||||
}
|
||||
@ -797,7 +806,7 @@ namespace winstd
|
||||
///
|
||||
/// Get BLOB buffer.
|
||||
///
|
||||
inline BYTE* data() noexcept
|
||||
BYTE* data() noexcept
|
||||
{
|
||||
return pbData;
|
||||
}
|
||||
@ -809,7 +818,7 @@ namespace winstd
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline DWORD CertGetNameStringA(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sNameString)
|
||||
static DWORD CertGetNameStringA(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sNameString)
|
||||
{
|
||||
// Query the final string length first.
|
||||
DWORD dwSize = ::CertGetNameStringA(pCertContext, dwType, dwFlags, pvTypePara, NULL, 0);
|
||||
@ -823,7 +832,7 @@ inline DWORD CertGetNameStringA(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwT
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline DWORD CertGetNameStringW(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sNameString)
|
||||
static DWORD CertGetNameStringW(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sNameString)
|
||||
{
|
||||
// Query the final string length first.
|
||||
DWORD dwSize = ::CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara, NULL, 0);
|
||||
@ -837,7 +846,7 @@ inline DWORD CertGetNameStringW(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwT
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline _Success_(return != 0) BOOL WINAPI CertGetCertificateContextProperty(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwPropId, _Out_ std::vector<_Ty, _Ax> &aData)
|
||||
static _Success_(return != 0) BOOL WINAPI CertGetCertificateContextProperty(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwPropId, _Out_ std::vector<_Ty, _Ax> &aData)
|
||||
{
|
||||
BYTE buf[WINSTD_STACK_BUFFER_BYTES];
|
||||
DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
|
||||
@ -858,7 +867,7 @@ inline _Success_(return != 0) BOOL WINAPI CertGetCertificateContextProperty(_In_
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline _Success_(return != 0) BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags)
|
||||
static _Success_(return != 0) BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags)
|
||||
{
|
||||
BYTE buf[WINSTD_STACK_BUFFER_BYTES];
|
||||
DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
|
||||
@ -879,7 +888,7 @@ inline _Success_(return != 0) BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_
|
||||
|
||||
|
||||
template<class T>
|
||||
inline BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags)
|
||||
static BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags)
|
||||
{
|
||||
DWORD dwSize = sizeof(T);
|
||||
return CryptGetHashParam(hHash, dwParam, (BYTE*)&data, &dwSize, dwFlags);
|
||||
@ -887,7 +896,7 @@ inline BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ T
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline _Success_(return != 0) BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags)
|
||||
static _Success_(return != 0) BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags)
|
||||
{
|
||||
BYTE buf[WINSTD_STACK_BUFFER_BYTES];
|
||||
DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
|
||||
@ -908,7 +917,7 @@ inline _Success_(return != 0) BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DW
|
||||
|
||||
|
||||
template<class T>
|
||||
inline BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags)
|
||||
static BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags)
|
||||
{
|
||||
DWORD dwSize = sizeof(T);
|
||||
return CryptGetKeyParam(hKey, dwParam, (BYTE*)&data, &dwSize, dwFlags);
|
||||
@ -916,7 +925,7 @@ inline BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ T &d
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline _Success_(return != 0) BOOL CryptExportKey(_In_ HCRYPTKEY hKey, _In_ HCRYPTKEY hExpKey, _In_ DWORD dwBlobType, _In_ DWORD dwFlags, _Out_ std::vector<_Ty, _Ax> &aData)
|
||||
static _Success_(return != 0) BOOL CryptExportKey(_In_ HCRYPTKEY hKey, _In_ HCRYPTKEY hExpKey, _In_ DWORD dwBlobType, _In_ DWORD dwFlags, _Out_ std::vector<_Ty, _Ax> &aData)
|
||||
{
|
||||
DWORD dwKeyBLOBSize = 0;
|
||||
|
||||
@ -931,7 +940,7 @@ inline _Success_(return != 0) BOOL CryptExportKey(_In_ HCRYPTKEY hKey, _In_ HCRY
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline _Success_(return != 0) BOOL CryptEncrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData)
|
||||
static _Success_(return != 0) BOOL CryptEncrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData)
|
||||
{
|
||||
DWORD
|
||||
dwDataLen = (DWORD)(aData.size() * sizeof(_Ty)),
|
||||
@ -977,7 +986,7 @@ inline _Success_(return != 0) BOOL CryptEncrypt(_In_ HCRYPTKEY hKey, _In_opt_ HC
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline _Success_(return != 0) BOOL CryptDecrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData)
|
||||
static _Success_(return != 0) BOOL CryptDecrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData)
|
||||
{
|
||||
DWORD dwDataLen = (DWORD)(aData.size() * sizeof(_Ty));
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace winstd
|
||||
/// - Non zero when \p a is equal to \p b;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator==(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept;
|
||||
static bool operator==(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept;
|
||||
|
||||
///
|
||||
/// Are EAP method types non-equal?
|
||||
@ -81,7 +81,7 @@ inline bool operator==(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE
|
||||
/// - Non zero when \p a is not equal to \p b;
|
||||
/// - Zero otherwise.
|
||||
///
|
||||
inline bool operator!=(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept;
|
||||
static bool operator!=(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -231,7 +231,7 @@ namespace winstd
|
||||
///
|
||||
/// Initializes a new EAP attribute set to eatReserved.
|
||||
///
|
||||
inline eap_attr() noexcept
|
||||
eap_attr() noexcept
|
||||
{
|
||||
eaType = eatReserved;
|
||||
dwLength = 0;
|
||||
@ -241,7 +241,7 @@ namespace winstd
|
||||
///
|
||||
/// Copies an existing EAP attribute.
|
||||
///
|
||||
inline eap_attr(_In_ const EAP_ATTRIBUTE &a)
|
||||
eap_attr(_In_ const EAP_ATTRIBUTE &a)
|
||||
{
|
||||
eaType = a.eaType;
|
||||
dwLength = a.dwLength;
|
||||
@ -256,7 +256,7 @@ namespace winstd
|
||||
///
|
||||
/// Moves an existing EAP attribute.
|
||||
///
|
||||
inline eap_attr(_Inout_ eap_attr &&a) noexcept
|
||||
eap_attr(_Inout_ eap_attr &&a) noexcept
|
||||
{
|
||||
eaType = a.eaType;
|
||||
dwLength = a.dwLength;
|
||||
@ -280,7 +280,7 @@ namespace winstd
|
||||
///
|
||||
/// Copies an existing EAP attribute.
|
||||
///
|
||||
inline eap_attr& operator=(_In_ const EAP_ATTRIBUTE &a)
|
||||
eap_attr& operator=(_In_ const EAP_ATTRIBUTE &a)
|
||||
{
|
||||
if (this != &a) {
|
||||
eaType = a.eaType;
|
||||
@ -303,7 +303,7 @@ namespace winstd
|
||||
///
|
||||
/// Moves an existing EAP attribute.
|
||||
///
|
||||
inline eap_attr& operator=(_Inout_ eap_attr &&a) noexcept
|
||||
eap_attr& operator=(_Inout_ eap_attr &&a) noexcept
|
||||
{
|
||||
if (this != &a) {
|
||||
eaType = a.eaType;
|
||||
@ -384,7 +384,7 @@ namespace winstd
|
||||
/// \param[in] type EAP method property type
|
||||
/// \param[in] value Property value
|
||||
///
|
||||
inline eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_ BOOL value) noexcept
|
||||
eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_ BOOL value) noexcept
|
||||
{
|
||||
eapMethodPropertyType = type;
|
||||
eapMethodPropertyValueType = empvtBool;
|
||||
@ -399,7 +399,7 @@ namespace winstd
|
||||
/// \param[in] type EAP method property type
|
||||
/// \param[in] value Property value
|
||||
///
|
||||
inline eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_ DWORD value) noexcept
|
||||
eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_ DWORD value) noexcept
|
||||
{
|
||||
eapMethodPropertyType = type;
|
||||
eapMethodPropertyValueType = empvtDword;
|
||||
@ -414,7 +414,7 @@ namespace winstd
|
||||
/// \param[in] type EAP method property type
|
||||
/// \param[in] value Property value
|
||||
///
|
||||
inline eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_z_ LPCWSTR value) noexcept
|
||||
eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_z_ LPCWSTR value) noexcept
|
||||
{
|
||||
eapMethodPropertyType = type;
|
||||
eapMethodPropertyValueType = empvtString;
|
||||
@ -455,7 +455,7 @@ namespace winstd
|
||||
/// - true when creation succeeds;
|
||||
/// - false when creation fails. For extended error information, call `GetLastError()`.
|
||||
///
|
||||
inline bool create(_In_ EapCode code, _In_ BYTE id, _In_ WORD size) noexcept
|
||||
bool create(_In_ EapCode code, _In_ BYTE id, _In_ WORD size) noexcept
|
||||
{
|
||||
assert(size >= 4); // EAP packets must contain at least Code, Id, and Length fields: 4B.
|
||||
|
||||
@ -477,7 +477,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns total EAP packet size in bytes.
|
||||
///
|
||||
inline WORD size() const noexcept
|
||||
WORD size() const noexcept
|
||||
{
|
||||
return m_h != NULL ? ntohs(*(WORD*)m_h->Length) : 0;
|
||||
}
|
||||
@ -520,7 +520,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs an empty array
|
||||
///
|
||||
inline eap_method_info_array() noexcept
|
||||
eap_method_info_array() noexcept
|
||||
{
|
||||
dwNumberOfMethods = 0;
|
||||
pEapMethods = NULL;
|
||||
@ -531,7 +531,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another object
|
||||
///
|
||||
inline eap_method_info_array(_Inout_ eap_method_info_array &&other) noexcept
|
||||
eap_method_info_array(_Inout_ eap_method_info_array &&other) noexcept
|
||||
{
|
||||
dwNumberOfMethods = other.dwNumberOfMethods;
|
||||
pEapMethods = other.pEapMethods;
|
||||
@ -553,7 +553,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another object
|
||||
///
|
||||
inline eap_method_info_array& operator=(_Inout_ eap_method_info_array &&other) noexcept
|
||||
eap_method_info_array& operator=(_Inout_ eap_method_info_array &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
if (pEapMethods)
|
||||
@ -611,7 +611,7 @@ namespace winstd
|
||||
/// \param[in] err EapHost error descriptor
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline eap_runtime_error(_In_ const EAP_ERROR &err, _In_ const std::string& msg) :
|
||||
eap_runtime_error(_In_ const EAP_ERROR &err, _In_ const std::string& msg) :
|
||||
m_type (err.type ),
|
||||
m_reason (err.dwReasonCode ),
|
||||
m_root_cause_id (err.rootCauseGuid ),
|
||||
@ -630,7 +630,7 @@ namespace winstd
|
||||
/// \param[in] err EapHost error descriptor
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline eap_runtime_error(_In_ const EAP_ERROR &err, _In_opt_z_ const char *msg = nullptr) :
|
||||
eap_runtime_error(_In_ const EAP_ERROR &err, _In_opt_z_ const char *msg = nullptr) :
|
||||
m_type (err.type ),
|
||||
m_reason (err.dwReasonCode ),
|
||||
m_root_cause_id (err.rootCauseGuid ),
|
||||
@ -646,7 +646,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns EAP method type
|
||||
///
|
||||
inline const EAP_METHOD_TYPE& type() const noexcept
|
||||
const EAP_METHOD_TYPE& type() const noexcept
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
@ -655,7 +655,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns the reason code for error
|
||||
///
|
||||
inline DWORD reason() const noexcept
|
||||
DWORD reason() const noexcept
|
||||
{
|
||||
return m_reason;
|
||||
}
|
||||
@ -664,7 +664,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns root cause ID
|
||||
///
|
||||
inline const GUID& root_cause_id() const noexcept
|
||||
const GUID& root_cause_id() const noexcept
|
||||
{
|
||||
return m_root_cause_id;
|
||||
}
|
||||
@ -673,7 +673,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns root cause ID
|
||||
///
|
||||
inline const wchar_t* root_cause() const noexcept
|
||||
const wchar_t* root_cause() const noexcept
|
||||
{
|
||||
return m_root_cause_desc.c_str();
|
||||
}
|
||||
@ -682,7 +682,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns repair ID
|
||||
///
|
||||
inline const GUID& repair_id() const noexcept
|
||||
const GUID& repair_id() const noexcept
|
||||
{
|
||||
return m_repair_id;
|
||||
}
|
||||
@ -691,7 +691,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns root cause ID
|
||||
///
|
||||
inline const wchar_t* repair() const noexcept
|
||||
const wchar_t* repair() const noexcept
|
||||
{
|
||||
return m_repair_desc.c_str();
|
||||
}
|
||||
@ -700,7 +700,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns help_link ID
|
||||
///
|
||||
inline const GUID& help_link_id() const noexcept
|
||||
const GUID& help_link_id() const noexcept
|
||||
{
|
||||
return m_help_link_id;
|
||||
}
|
||||
@ -723,7 +723,10 @@ namespace winstd
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4505) // Don't warn on unused code
|
||||
|
||||
static bool operator==(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept
|
||||
{
|
||||
return
|
||||
a.eapType.type == b.eapType.type &&
|
||||
@ -733,9 +736,10 @@ inline bool operator==(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE
|
||||
}
|
||||
|
||||
|
||||
inline bool operator!=(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept
|
||||
static bool operator!=(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept
|
||||
{
|
||||
return !operator==(a, b);
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
#pragma warning(pop)
|
||||
|
@ -41,21 +41,22 @@ namespace winstd
|
||||
///
|
||||
/// \sa [TdhGetEventInformation function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa964840.aspx)
|
||||
///
|
||||
inline _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventInformation(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _Out_ std::unique_ptr<TRACE_EVENT_INFO> &info);
|
||||
static _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventInformation(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _Out_ std::unique_ptr<TRACE_EVENT_INFO> &info);
|
||||
|
||||
///
|
||||
/// Retrieves information about the event map contained in the event.
|
||||
///
|
||||
/// \sa [TdhGetEventMapInformation function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa964841.aspx)
|
||||
///
|
||||
inline _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventMapInformation(_In_ PEVENT_RECORD pEvent, _In_ LPWSTR pMapName, _Inout_ std::unique_ptr<EVENT_MAP_INFO> &info);
|
||||
static _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventMapInformation(_In_ PEVENT_RECORD pEvent, _In_ LPWSTR pMapName, _Inout_ std::unique_ptr<EVENT_MAP_INFO> &info);
|
||||
|
||||
///
|
||||
/// Retrieves a property value from the event data.
|
||||
///
|
||||
/// \sa [TdhGetProperty function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa964843.aspx)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline _Success_(return == ERROR_SUCCESS) ULONG TdhGetProperty(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _In_ ULONG PropertyDataCount, _In_reads_(PropertyDataCount) PPROPERTY_DATA_DESCRIPTOR pPropertyData, _Inout_ std::vector<_Ty, _Ax> &aData);
|
||||
template<class _Ty, class _Ax>
|
||||
static _Success_(return == ERROR_SUCCESS) ULONG TdhGetProperty(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _In_ ULONG PropertyDataCount, _In_reads_(PropertyDataCount) PPROPERTY_DATA_DESCRIPTOR pPropertyData, _Inout_ std::vector<_Ty, _Ax> &aData);
|
||||
|
||||
/// @}
|
||||
|
||||
@ -76,7 +77,7 @@ namespace winstd
|
||||
///
|
||||
/// Construct empty class.
|
||||
///
|
||||
inline event_data()
|
||||
event_data()
|
||||
{
|
||||
Ptr = 0;
|
||||
Size = 0;
|
||||
@ -92,7 +93,7 @@ namespace winstd
|
||||
/// \note This class saves a reference to the data only. Therefore, data must be kept available.
|
||||
///
|
||||
#pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
|
||||
inline event_data(_In_ const char &data)
|
||||
event_data(_In_ const char &data)
|
||||
{
|
||||
EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
|
||||
}
|
||||
@ -106,7 +107,7 @@ namespace winstd
|
||||
/// \note This class saves a reference to the data only. Therefore, data must be kept available.
|
||||
///
|
||||
#pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
|
||||
inline event_data(_In_ const unsigned char &data)
|
||||
event_data(_In_ const unsigned char &data)
|
||||
{
|
||||
EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
|
||||
}
|
||||
@ -120,7 +121,7 @@ namespace winstd
|
||||
/// \note This class saves a reference to the data only. Therefore, data must be kept available.
|
||||
///
|
||||
#pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
|
||||
inline event_data(_In_ const int &data)
|
||||
event_data(_In_ const int &data)
|
||||
{
|
||||
EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
|
||||
}
|
||||
@ -134,7 +135,7 @@ namespace winstd
|
||||
/// \note This class saves a reference to the data only. Therefore, data must be kept available.
|
||||
///
|
||||
#pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
|
||||
inline event_data(_In_ const unsigned int &data)
|
||||
event_data(_In_ const unsigned int &data)
|
||||
{
|
||||
EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
|
||||
}
|
||||
@ -148,7 +149,7 @@ namespace winstd
|
||||
/// \note This class saves a reference to the data only. Therefore, data must be kept available.
|
||||
///
|
||||
#pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
|
||||
inline event_data(_In_ const long &data)
|
||||
event_data(_In_ const long &data)
|
||||
{
|
||||
EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
|
||||
}
|
||||
@ -162,7 +163,7 @@ namespace winstd
|
||||
/// \note This class saves a reference to the data only. Therefore, data must be kept available.
|
||||
///
|
||||
#pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
|
||||
inline event_data(_In_ const unsigned long &data)
|
||||
event_data(_In_ const unsigned long &data)
|
||||
{
|
||||
EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
|
||||
}
|
||||
@ -176,7 +177,7 @@ namespace winstd
|
||||
/// \note This class saves a reference to the data only. Therefore, data must be kept available.
|
||||
///
|
||||
#pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
|
||||
inline event_data(_In_ const GUID &data)
|
||||
event_data(_In_ const GUID &data)
|
||||
{
|
||||
EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
|
||||
}
|
||||
@ -190,7 +191,7 @@ namespace winstd
|
||||
/// \note This class saves a reference to the data only. Therefore, data must be kept available.
|
||||
///
|
||||
#pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
|
||||
inline event_data(_In_opt_z_ const char *data)
|
||||
event_data(_In_opt_z_ const char *data)
|
||||
{
|
||||
if (data)
|
||||
EventDataDescCreate(this, data, (ULONG)((strlen(data) + 1) * sizeof(*data)));
|
||||
@ -210,7 +211,7 @@ namespace winstd
|
||||
/// \note This class saves a reference to the data only. Therefore, data must be kept available.
|
||||
///
|
||||
#pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
|
||||
inline event_data(_In_opt_z_ const wchar_t *data)
|
||||
event_data(_In_opt_z_ const wchar_t *data)
|
||||
{
|
||||
if (data)
|
||||
EventDataDescCreate(this, data, (ULONG)((wcslen(data) + 1) * sizeof(*data)));
|
||||
@ -231,7 +232,7 @@ namespace winstd
|
||||
///
|
||||
#pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline event_data(_In_ const std::basic_string<_Elem, _Traits, _Ax> &data)
|
||||
event_data(_In_ const std::basic_string<_Elem, _Traits, _Ax> &data)
|
||||
{
|
||||
EventDataDescCreate(this, data.c_str(), (ULONG)((data.length() + 1) * sizeof(_Elem)));
|
||||
}
|
||||
@ -246,7 +247,7 @@ namespace winstd
|
||||
/// \note This class saves a reference to the data only. Therefore, data must be kept available.
|
||||
///
|
||||
#pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
|
||||
inline event_data(_In_bytecount_(size) const void *data, _In_ ULONG size)
|
||||
event_data(_In_bytecount_(size) const void *data, _In_ ULONG size)
|
||||
{
|
||||
EventDataDescCreate(this, data, size);
|
||||
}
|
||||
@ -267,7 +268,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs a blank event record.
|
||||
///
|
||||
inline event_rec()
|
||||
event_rec()
|
||||
{
|
||||
memset((EVENT_RECORD*)this, 0, sizeof(EVENT_RECORD));
|
||||
}
|
||||
@ -278,7 +279,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] other Event record to copy from
|
||||
///
|
||||
inline event_rec(_In_ const event_rec &other) : EVENT_RECORD(other)
|
||||
event_rec(_In_ const event_rec &other) : EVENT_RECORD(other)
|
||||
{
|
||||
set_extended_data_internal(other.ExtendedDataCount, other.ExtendedData);
|
||||
set_user_data_internal(other.UserDataLength, other.UserData);
|
||||
@ -290,7 +291,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] other Event record to copy from
|
||||
///
|
||||
inline event_rec(_In_ const EVENT_RECORD &other) : EVENT_RECORD(other)
|
||||
event_rec(_In_ const EVENT_RECORD &other) : EVENT_RECORD(other)
|
||||
{
|
||||
set_extended_data_internal(other.ExtendedDataCount, other.ExtendedData);
|
||||
set_user_data_internal(other.UserDataLength, other.UserData);
|
||||
@ -302,7 +303,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] other Event record to move
|
||||
///
|
||||
inline event_rec(_Inout_ event_rec&& other) noexcept : EVENT_RECORD(other)
|
||||
event_rec(_Inout_ event_rec&& other) noexcept : EVENT_RECORD(other)
|
||||
{
|
||||
memset((EVENT_RECORD*)&other, 0, sizeof(EVENT_RECORD));
|
||||
}
|
||||
@ -326,7 +327,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] other Event record to copy from
|
||||
///
|
||||
inline event_rec& operator=(_In_ const event_rec &other)
|
||||
event_rec& operator=(_In_ const event_rec &other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
(EVENT_RECORD&)*this = other;
|
||||
@ -343,7 +344,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] other Event record to copy from
|
||||
///
|
||||
inline event_rec& operator=(_In_ const EVENT_RECORD &other)
|
||||
event_rec& operator=(_In_ const EVENT_RECORD &other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
(EVENT_RECORD&)*this = other;
|
||||
@ -360,7 +361,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] other Event record to move
|
||||
///
|
||||
inline event_rec& operator=(_Inout_ event_rec&& other) noexcept
|
||||
event_rec& operator=(_Inout_ event_rec&& other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
(EVENT_RECORD&)*this = other;
|
||||
@ -492,7 +493,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [EventRegister function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363744.aspx)
|
||||
///
|
||||
inline ULONG create(_In_ LPCGUID ProviderId)
|
||||
ULONG create(_In_ LPCGUID ProviderId)
|
||||
{
|
||||
handle_type h;
|
||||
ULONG ulRes = EventRegister(ProviderId, enable_callback, this, &h);
|
||||
@ -511,7 +512,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [EventWrite function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363752.aspx)
|
||||
///
|
||||
inline ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
|
||||
ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
|
||||
{
|
||||
assert(m_h != invalid);
|
||||
return EventWrite(m_h, EventDescriptor, 0, NULL);
|
||||
@ -527,7 +528,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [EventWrite function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363752.aspx)
|
||||
///
|
||||
inline ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ ULONG UserDataCount = 0, _In_opt_count_(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData = NULL)
|
||||
ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ ULONG UserDataCount = 0, _In_opt_count_(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData = NULL)
|
||||
{
|
||||
assert(m_h != invalid);
|
||||
return EventWrite(m_h, EventDescriptor, UserDataCount, UserData);
|
||||
@ -545,7 +546,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [EventWrite function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363752.aspx)
|
||||
///
|
||||
inline ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ const EVENT_DATA_DESCRIPTOR param1, ...)
|
||||
ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ const EVENT_DATA_DESCRIPTOR param1, ...)
|
||||
{
|
||||
assert(m_h != invalid);
|
||||
|
||||
@ -600,7 +601,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [EventWrite function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363752.aspx)
|
||||
///
|
||||
inline ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ va_list arg)
|
||||
ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ va_list arg)
|
||||
{
|
||||
assert(m_h != invalid);
|
||||
|
||||
@ -643,7 +644,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_z_ _Printf_format_string_ PCWSTR String, ...)
|
||||
ULONG write(_In_ UCHAR Level, _In_ ULONGLONG Keyword, _In_z_ _Printf_format_string_ PCWSTR String, ...)
|
||||
{
|
||||
assert(m_h != invalid);
|
||||
|
||||
@ -713,7 +714,7 @@ namespace winstd
|
||||
///
|
||||
/// Initializes a new empty session.
|
||||
///
|
||||
inline event_session()
|
||||
event_session()
|
||||
{
|
||||
}
|
||||
|
||||
@ -724,7 +725,7 @@ namespace winstd
|
||||
/// \param[in] h Initial session handle value
|
||||
/// \param[in] prop Session properties
|
||||
///
|
||||
inline event_session(_In_opt_ handle_type h, _In_ const EVENT_TRACE_PROPERTIES *prop) :
|
||||
event_session(_In_opt_ handle_type h, _In_ const EVENT_TRACE_PROPERTIES *prop) :
|
||||
m_prop(reinterpret_cast<EVENT_TRACE_PROPERTIES*>(new char[prop->Wnode.BufferSize])),
|
||||
handle(h)
|
||||
{
|
||||
@ -737,7 +738,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another session
|
||||
///
|
||||
inline event_session(_Inout_ event_session &&other) noexcept :
|
||||
event_session(_Inout_ event_session &&other) noexcept :
|
||||
m_prop(std::move(other.m_prop)),
|
||||
handle(std::move(other))
|
||||
{
|
||||
@ -761,7 +762,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another object
|
||||
///
|
||||
inline event_session& operator=(_Inout_ event_session &&other) noexcept
|
||||
event_session& operator=(_Inout_ event_session &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
(handle<handle_type, 0>&&)*this = std::move(other);
|
||||
@ -776,7 +777,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Session properties
|
||||
///
|
||||
inline operator const EVENT_TRACE_PROPERTIES*() const
|
||||
operator const EVENT_TRACE_PROPERTIES*() const
|
||||
{
|
||||
return m_prop.get();
|
||||
}
|
||||
@ -787,7 +788,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Session properties
|
||||
///
|
||||
inline LPCTSTR name() const
|
||||
LPCTSTR name() const
|
||||
{
|
||||
const EVENT_TRACE_PROPERTIES *prop = m_prop.get();
|
||||
return reinterpret_cast<LPCTSTR>(reinterpret_cast<const char*>(prop) + prop->LoggerNameOffset);
|
||||
@ -802,7 +803,7 @@ namespace winstd
|
||||
/// \param[in] h New session handle
|
||||
/// \param[in] prop Session properties
|
||||
///
|
||||
inline void attach(_In_opt_ handle_type h, _In_ EVENT_TRACE_PROPERTIES *prop)
|
||||
void attach(_In_opt_ handle_type h, _In_ EVENT_TRACE_PROPERTIES *prop)
|
||||
{
|
||||
handle<handle_type, 0>::attach(h);
|
||||
m_prop.reset(prop);
|
||||
@ -818,7 +819,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [StartTrace function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa364117.aspx)
|
||||
///
|
||||
inline ULONG create(_In_z_ LPCTSTR SessionName, _In_ const EVENT_TRACE_PROPERTIES *Properties)
|
||||
ULONG create(_In_z_ LPCTSTR SessionName, _In_ const EVENT_TRACE_PROPERTIES *Properties)
|
||||
{
|
||||
handle_type h;
|
||||
std::unique_ptr<EVENT_TRACE_PROPERTIES> prop(reinterpret_cast<EVENT_TRACE_PROPERTIES*>(new char[Properties->Wnode.BufferSize]));
|
||||
@ -839,7 +840,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [EnableTraceEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363711.aspx)
|
||||
///
|
||||
inline ULONG enable_trace(_In_ LPCGUID ProviderId, _In_ UCHAR Level, _In_opt_ ULONGLONG MatchAnyKeyword = 0, _In_opt_ ULONGLONG MatchAllKeyword = 0, _In_opt_ ULONG EnableProperty = 0, _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL)
|
||||
ULONG enable_trace(_In_ LPCGUID ProviderId, _In_ UCHAR Level, _In_opt_ ULONGLONG MatchAnyKeyword = 0, _In_opt_ ULONGLONG MatchAllKeyword = 0, _In_opt_ ULONG EnableProperty = 0, _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL)
|
||||
{
|
||||
assert(m_h != invalid);
|
||||
return EnableTraceEx(
|
||||
@ -864,7 +865,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [EnableTraceEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363711.aspx)
|
||||
///
|
||||
inline ULONG disable_trace(_In_ LPCGUID ProviderId, _In_ UCHAR Level, _In_opt_ ULONGLONG MatchAnyKeyword = 0, _In_opt_ ULONGLONG MatchAllKeyword = 0, _In_opt_ ULONG EnableProperty = 0, _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL)
|
||||
ULONG disable_trace(_In_ LPCGUID ProviderId, _In_ UCHAR Level, _In_opt_ ULONGLONG MatchAnyKeyword = 0, _In_opt_ ULONGLONG MatchAllKeyword = 0, _In_opt_ ULONG EnableProperty = 0, _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL)
|
||||
{
|
||||
assert(m_h != invalid);
|
||||
return EnableTraceEx(
|
||||
@ -925,7 +926,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [OpenTrace function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa364089.aspx)
|
||||
///
|
||||
inline bool create(_Inout_ PEVENT_TRACE_LOGFILE Logfile)
|
||||
bool create(_Inout_ PEVENT_TRACE_LOGFILE Logfile)
|
||||
{
|
||||
handle_type h = OpenTrace(Logfile);
|
||||
if (h != invalid) {
|
||||
@ -959,7 +960,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [EnableTraceEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363711.aspx)
|
||||
///
|
||||
inline event_trace_enabler(
|
||||
event_trace_enabler(
|
||||
_In_opt_ LPCGUID SourceId,
|
||||
_In_ TRACEHANDLE TraceHandle,
|
||||
_In_ LPCGUID ProviderId,
|
||||
@ -995,7 +996,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [EnableTraceEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363711.aspx)
|
||||
///
|
||||
inline event_trace_enabler(
|
||||
event_trace_enabler(
|
||||
_In_ const event_session &session,
|
||||
_In_ LPCGUID ProviderId,
|
||||
_In_ UCHAR Level,
|
||||
@ -1030,7 +1031,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [EnableTraceEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363711.aspx)
|
||||
///
|
||||
inline ULONG status() const
|
||||
ULONG status() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
@ -1080,7 +1081,7 @@ namespace winstd
|
||||
///
|
||||
/// Writes the `event_cons` event
|
||||
///
|
||||
inline event_fn_auto(_In_ event_provider &ep, _In_ const EVENT_DESCRIPTOR *event_cons, _In_ const EVENT_DESCRIPTOR *event_dest, _In_z_ LPCSTR pszFnName) :
|
||||
event_fn_auto(_In_ event_provider &ep, _In_ const EVENT_DESCRIPTOR *event_cons, _In_ const EVENT_DESCRIPTOR *event_dest, _In_z_ LPCSTR pszFnName) :
|
||||
m_ep(ep),
|
||||
m_event_dest(event_dest)
|
||||
{
|
||||
@ -1092,7 +1093,7 @@ namespace winstd
|
||||
///
|
||||
/// Copies the object
|
||||
///
|
||||
inline event_fn_auto(_In_ const event_fn_auto &other) :
|
||||
event_fn_auto(_In_ const event_fn_auto &other) :
|
||||
m_ep(other.m_ep),
|
||||
m_event_dest(other.m_event_dest),
|
||||
m_fn_name(other.m_fn_name)
|
||||
@ -1103,7 +1104,7 @@ namespace winstd
|
||||
///
|
||||
/// Moves the object
|
||||
///
|
||||
inline event_fn_auto(_Inout_ event_fn_auto &&other) noexcept :
|
||||
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))
|
||||
@ -1115,7 +1116,7 @@ namespace winstd
|
||||
///
|
||||
/// Writes the `event_dest` event
|
||||
///
|
||||
inline ~event_fn_auto()
|
||||
~event_fn_auto()
|
||||
{
|
||||
if (m_event_dest)
|
||||
m_ep.write(m_event_dest, 1, &m_fn_name);
|
||||
@ -1125,7 +1126,7 @@ namespace winstd
|
||||
///
|
||||
/// Copies the object
|
||||
///
|
||||
inline event_fn_auto& operator=(_In_ const event_fn_auto &other)
|
||||
event_fn_auto& operator=(_In_ const event_fn_auto &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
assert(&m_ep == &other.m_ep);
|
||||
@ -1140,7 +1141,7 @@ namespace winstd
|
||||
///
|
||||
/// Moves the object
|
||||
///
|
||||
inline event_fn_auto& operator=(_Inout_ event_fn_auto &&other) noexcept
|
||||
event_fn_auto& operator=(_Inout_ event_fn_auto &&other) noexcept
|
||||
{
|
||||
if (this != &other) {
|
||||
assert(&m_ep == &other.m_ep);
|
||||
@ -1172,7 +1173,7 @@ namespace winstd
|
||||
///
|
||||
/// Writes the `event_cons` event
|
||||
///
|
||||
inline event_fn_auto_ret(_In_ event_provider &ep, _In_ const EVENT_DESCRIPTOR *event_cons, _In_ const EVENT_DESCRIPTOR *event_dest, _In_z_ LPCSTR pszFnName, T &result) :
|
||||
event_fn_auto_ret(_In_ event_provider &ep, _In_ const EVENT_DESCRIPTOR *event_cons, _In_ const EVENT_DESCRIPTOR *event_dest, _In_z_ LPCSTR pszFnName, T &result) :
|
||||
m_ep(ep),
|
||||
m_event_dest(event_dest),
|
||||
m_result(result)
|
||||
@ -1185,7 +1186,7 @@ namespace winstd
|
||||
///
|
||||
/// Copies the object
|
||||
///
|
||||
inline event_fn_auto_ret(_In_ const event_fn_auto_ret<T> &other) :
|
||||
event_fn_auto_ret(_In_ const event_fn_auto_ret<T> &other) :
|
||||
m_ep(other.m_ep),
|
||||
m_event_dest(other.m_event_dest),
|
||||
m_result(other.m_result)
|
||||
@ -1197,7 +1198,7 @@ namespace winstd
|
||||
///
|
||||
/// Moves the object
|
||||
///
|
||||
inline event_fn_auto_ret(_Inout_ event_fn_auto_ret<T> &&other) :
|
||||
event_fn_auto_ret(_Inout_ event_fn_auto_ret<T> &&other) :
|
||||
m_ep(other.m_ep),
|
||||
m_event_dest(other.m_event_dest),
|
||||
m_result(other.m_result)
|
||||
@ -1210,7 +1211,7 @@ namespace winstd
|
||||
///
|
||||
/// Writes the `event_dest` event
|
||||
///
|
||||
inline ~event_fn_auto_ret()
|
||||
~event_fn_auto_ret()
|
||||
{
|
||||
if (m_event_dest) {
|
||||
EventDataDescCreate(m_desc + 1, &m_result, sizeof(T));
|
||||
@ -1222,7 +1223,7 @@ namespace winstd
|
||||
///
|
||||
/// Copies the object
|
||||
///
|
||||
inline event_fn_auto_ret& operator=(_In_ const event_fn_auto_ret<T> &other)
|
||||
event_fn_auto_ret& operator=(_In_ const event_fn_auto_ret<T> &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
assert(&m_ep == &other.m_ep);
|
||||
@ -1238,7 +1239,7 @@ namespace winstd
|
||||
///
|
||||
/// Moves the object
|
||||
///
|
||||
inline event_fn_auto_ret& operator=(_Inout_ event_fn_auto_ret<T> &&other)
|
||||
event_fn_auto_ret& operator=(_Inout_ event_fn_auto_ret<T> &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
assert(&m_ep == &other.m_ep);
|
||||
@ -1263,7 +1264,10 @@ namespace winstd
|
||||
}
|
||||
|
||||
|
||||
inline _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventInformation(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _Out_ std::unique_ptr<TRACE_EVENT_INFO> &info)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4505) // Don't warn on unused code
|
||||
|
||||
static _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventInformation(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _Out_ std::unique_ptr<TRACE_EVENT_INFO> &info)
|
||||
{
|
||||
BYTE szBuffer[WINSTD_STACK_BUFFER_BYTES];
|
||||
ULONG ulSize = sizeof(szBuffer), ulResult;
|
||||
@ -1285,7 +1289,7 @@ inline _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventInformation(_In_ PEVE
|
||||
}
|
||||
|
||||
|
||||
inline _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventMapInformation(_In_ PEVENT_RECORD pEvent, _In_ LPWSTR pMapName, _Inout_ std::unique_ptr<EVENT_MAP_INFO> &info)
|
||||
static _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventMapInformation(_In_ PEVENT_RECORD pEvent, _In_ LPWSTR pMapName, _Inout_ std::unique_ptr<EVENT_MAP_INFO> &info)
|
||||
{
|
||||
BYTE szBuffer[WINSTD_STACK_BUFFER_BYTES];
|
||||
ULONG ulSize = sizeof(szBuffer), ulResult;
|
||||
@ -1308,7 +1312,7 @@ inline _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventMapInformation(_In_ P
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline _Success_(return == ERROR_SUCCESS) ULONG TdhGetProperty(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _In_ ULONG PropertyDataCount, _In_reads_(PropertyDataCount) PPROPERTY_DATA_DESCRIPTOR pPropertyData, _Inout_ std::vector<_Ty, _Ax> &aData)
|
||||
static _Success_(return == ERROR_SUCCESS) ULONG TdhGetProperty(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _In_ ULONG PropertyDataCount, _In_reads_(PropertyDataCount) PPROPERTY_DATA_DESCRIPTOR pPropertyData, _Inout_ std::vector<_Ty, _Ax> &aData)
|
||||
{
|
||||
ULONG ulSize, ulResult;
|
||||
|
||||
@ -1327,3 +1331,5 @@ inline _Success_(return == ERROR_SUCCESS) ULONG TdhGetProperty(_In_ PEVENT_RECOR
|
||||
|
||||
return ulResult;
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
|
@ -98,21 +98,21 @@ namespace winstd
|
||||
class window_dc : public handle<HDC, NULL>
|
||||
{
|
||||
public:
|
||||
inline window_dc() noexcept :
|
||||
window_dc() noexcept :
|
||||
m_hwnd(NULL)
|
||||
{}
|
||||
|
||||
inline window_dc(_In_opt_ handle_type h, _In_opt_ HWND hwnd) noexcept :
|
||||
window_dc(_In_opt_ handle_type h, _In_opt_ HWND hwnd) noexcept :
|
||||
handle<handle_type, NULL>(h),
|
||||
m_hwnd(hwnd)
|
||||
{}
|
||||
|
||||
inline window_dc(_Inout_ window_dc &&h) noexcept :
|
||||
window_dc(_Inout_ window_dc &&h) noexcept :
|
||||
handle<handle_type, NULL>(std::move(h)),
|
||||
m_hwnd(h.m_hwnd)
|
||||
{}
|
||||
|
||||
inline window_dc& operator=(_Inout_ window_dc &&h) noexcept
|
||||
window_dc& operator=(_Inout_ window_dc &&h) noexcept
|
||||
{
|
||||
handle<handle_type, NULL>::operator=(std::move(h));
|
||||
m_hwnd = h.m_hwnd;
|
||||
@ -163,7 +163,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [SelectObject function](https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-selectobject)
|
||||
///
|
||||
inline dc_selector(_In_ HDC hdc, _In_ HGDIOBJ h) noexcept :
|
||||
dc_selector(_In_ HDC hdc, _In_ HGDIOBJ h) noexcept :
|
||||
m_hdc(hdc),
|
||||
m_orig(SelectObject(hdc, h))
|
||||
{
|
||||
@ -187,7 +187,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [SelectObject function](https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-selectobject)
|
||||
///
|
||||
inline HGDIOBJ status() const noexcept
|
||||
HGDIOBJ status() const noexcept
|
||||
{
|
||||
return m_orig;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs blank encoding session
|
||||
///
|
||||
inline hex_enc() noexcept
|
||||
hex_enc() noexcept
|
||||
{
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ namespace winstd
|
||||
/// \param[in ] size Length of `data` in bytes
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out, _In_bytecount_(size) const void *data, _In_ size_t size)
|
||||
void encode(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &out, _In_bytecount_(size) const void *data, _In_ size_t size)
|
||||
{
|
||||
assert(data || !size);
|
||||
|
||||
@ -77,7 +77,7 @@ namespace winstd
|
||||
///
|
||||
/// \returns Maximum number of bytes for the encoded data of `size` length
|
||||
///
|
||||
inline size_t enc_size(size_t size) const noexcept
|
||||
size_t enc_size(size_t size) const noexcept
|
||||
{
|
||||
return size*2;
|
||||
}
|
||||
@ -93,7 +93,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs blank decoding session
|
||||
///
|
||||
inline hex_dec() noexcept :
|
||||
hex_dec() noexcept :
|
||||
buf(0),
|
||||
num(0)
|
||||
{
|
||||
@ -109,7 +109,7 @@ namespace winstd
|
||||
/// \param[in ] size Length of `data` in bytes
|
||||
///
|
||||
template<class _Ty, class _Ax, class _Tchr>
|
||||
inline void decode(_Inout_ std::vector<_Ty, _Ax> &out, _Out_ bool &is_last, _In_z_count_(size) const _Tchr *data, _In_ size_t size)
|
||||
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;
|
||||
|
||||
@ -150,7 +150,7 @@ namespace winstd
|
||||
///
|
||||
/// Resets decoding session
|
||||
///
|
||||
inline void clear() noexcept
|
||||
void clear() noexcept
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
@ -163,7 +163,7 @@ namespace winstd
|
||||
///
|
||||
/// \returns Maximum number of bytes for the decoded data of `size` length
|
||||
///
|
||||
inline size_t dec_size(size_t size) const noexcept
|
||||
size_t dec_size(size_t size) const noexcept
|
||||
{
|
||||
return (size + 1)/2;
|
||||
}
|
||||
|
@ -20,61 +20,71 @@
|
||||
/// @{
|
||||
|
||||
/// @copydoc MsiGetPropertyW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline UINT MsiGetPropertyA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szName, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static UINT MsiGetPropertyA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szName, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
|
||||
///
|
||||
/// Gets the value for an installer property and stores it in a std::wstring string.
|
||||
///
|
||||
/// \sa [MsiGetProperty function](https://msdn.microsoft.com/en-us/library/aa370134.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline UINT MsiGetPropertyW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szName, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static UINT MsiGetPropertyW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szName, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
|
||||
/// @copydoc MsiRecordGetStringW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline UINT MsiRecordGetStringA(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static UINT MsiRecordGetStringA(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
|
||||
///
|
||||
/// Returns the string value of a record field and stores it in a std::wstring string.
|
||||
///
|
||||
/// \sa [MsiRecordGetString function](https://msdn.microsoft.com/en-us/library/aa370368.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline UINT MsiRecordGetStringW(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static UINT MsiRecordGetStringW(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
|
||||
/// @copydoc MsiFormatRecordW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline UINT MsiFormatRecordA(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static UINT MsiFormatRecordA(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
|
||||
///
|
||||
/// Formats record field data and properties using a format string and stores it in a std::wstring string.
|
||||
///
|
||||
/// \sa [MsiFormatRecord function](https://msdn.microsoft.com/en-us/library/aa370109.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline UINT MsiFormatRecordW(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
template<class _Elem, class _Traits, class _Ax> UINT MsiFormatRecordW(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
|
||||
///
|
||||
/// Reads bytes from a record stream field into a std::vector buffer.
|
||||
///
|
||||
/// \sa [MsiRecordReadStream function](https://msdn.microsoft.com/en-us/library/aa370370.aspx)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline UINT MsiRecordReadStream(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::vector<_Ty, _Ax> &binData);
|
||||
template<class _Ty, class _Ax>
|
||||
static UINT MsiRecordReadStream(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::vector<_Ty, _Ax> &binData);
|
||||
|
||||
/// @copydoc MsiGetTargetPathW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline UINT MsiGetTargetPathA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szFolder, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static UINT MsiGetTargetPathA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szFolder, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
|
||||
///
|
||||
/// Returns the full target path for a folder in the Directory table and stores it in a std::wstring string.
|
||||
///
|
||||
/// \sa [MsiGetTargetPath function](https://msdn.microsoft.com/en-us/library/aa370303.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline UINT MsiGetTargetPathW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szFolder, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static UINT MsiGetTargetPathW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szFolder, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
|
||||
/// @copydoc MsiGetComponentPathW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline INSTALLSTATE MsiGetComponentPathA(_In_z_ LPCSTR szProduct, _In_z_ LPCSTR szComponent, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static INSTALLSTATE MsiGetComponentPathA(_In_z_ LPCSTR szProduct, _In_z_ LPCSTR szComponent, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
|
||||
///
|
||||
/// Returns the full path to an installed component. If the key path for the component is a registry key then the registry key is returned.
|
||||
///
|
||||
/// \sa [MsiGetComponentPath function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa370112.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline INSTALLSTATE MsiGetComponentPathW(_In_z_ LPCWSTR szProduct, _In_z_ LPCWSTR szComponent, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static INSTALLSTATE MsiGetComponentPathW(_In_z_ LPCWSTR szProduct, _In_z_ LPCWSTR szComponent, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue);
|
||||
|
||||
/// @}
|
||||
|
||||
@ -82,7 +92,7 @@ template<class _Elem, class _Traits, class _Ax> inline INSTALLSTATE MsiGetCompon
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline UINT MsiGetPropertyA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szName, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
static UINT MsiGetPropertyA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szName, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -110,7 +120,7 @@ inline UINT MsiGetPropertyA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szName, _Inou
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline UINT MsiGetPropertyW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szName, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
static UINT MsiGetPropertyW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szName, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
{
|
||||
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(szStackBuffer);
|
||||
@ -136,7 +146,7 @@ inline UINT MsiGetPropertyW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szName, _Ino
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline UINT MsiRecordGetStringA(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
static UINT MsiRecordGetStringA(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -164,7 +174,7 @@ inline UINT MsiRecordGetStringA(_In_ MSIHANDLE hRecord, _In_ unsigned int iField
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline UINT MsiRecordGetStringW(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
static UINT MsiRecordGetStringW(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
{
|
||||
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(szStackBuffer);
|
||||
@ -190,7 +200,7 @@ inline UINT MsiRecordGetStringW(_In_ MSIHANDLE hRecord, _In_ unsigned int iField
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline UINT MsiFormatRecordA(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
static UINT MsiFormatRecordA(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -218,7 +228,7 @@ inline UINT MsiFormatRecordA(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _I
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline UINT MsiFormatRecordW(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
static UINT MsiFormatRecordW(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
{
|
||||
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(szStackBuffer);
|
||||
@ -244,7 +254,7 @@ inline UINT MsiFormatRecordW(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _I
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline UINT MsiRecordReadStream(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::vector<_Ty, _Ax> &binData)
|
||||
static UINT MsiRecordReadStream(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::vector<_Ty, _Ax> &binData)
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -264,7 +274,7 @@ inline UINT MsiRecordReadStream(_In_ MSIHANDLE hRecord, _In_ unsigned int iField
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline UINT MsiGetTargetPathA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szFolder, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
static UINT MsiGetTargetPathA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szFolder, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -292,7 +302,7 @@ inline UINT MsiGetTargetPathA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szFolder, _
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline UINT MsiGetTargetPathW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szFolder, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
static UINT MsiGetTargetPathW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szFolder, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
{
|
||||
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(szStackBuffer);
|
||||
@ -318,7 +328,7 @@ inline UINT MsiGetTargetPathW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szFolder,
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline INSTALLSTATE MsiGetComponentPathA(_In_z_ LPCSTR szProduct, _In_z_ LPCSTR szComponent, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
static INSTALLSTATE MsiGetComponentPathA(_In_z_ LPCSTR szProduct, _In_z_ LPCSTR szComponent, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
{
|
||||
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(szStackBuffer);
|
||||
@ -344,7 +354,7 @@ inline INSTALLSTATE MsiGetComponentPathA(_In_z_ LPCSTR szProduct, _In_z_ LPCSTR
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline INSTALLSTATE MsiGetComponentPathW(_In_z_ LPCWSTR szProduct, _In_z_ LPCWSTR szComponent, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
static INSTALLSTATE MsiGetComponentPathW(_In_z_ LPCWSTR szProduct, _In_z_ LPCWSTR szComponent, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue)
|
||||
{
|
||||
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(szStackBuffer);
|
||||
|
@ -23,18 +23,24 @@ namespace winstd
|
||||
class sec_runtime_error;
|
||||
}
|
||||
|
||||
#if defined(SECURITY_WIN32) || defined(SECURITY_KERNEL)
|
||||
|
||||
/// \addtogroup WinStdSecurityAPI
|
||||
/// @{
|
||||
|
||||
/// @copydoc GetUserNameExW()
|
||||
template<class _Elem, class _Traits, class _Ax> BOOLEAN GetUserNameExA(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sName);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static BOOLEAN GetUserNameExA(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sName);
|
||||
|
||||
///
|
||||
/// Retrieves the name of the user or other security principal associated with the calling thread and stores it in a std::wstring string.
|
||||
///
|
||||
/// \sa [GetUserNameEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724435.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> BOOLEAN GetUserNameExW(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sName);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static BOOLEAN GetUserNameExW(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sName);
|
||||
|
||||
#endif
|
||||
|
||||
/// @}
|
||||
|
||||
@ -57,7 +63,7 @@ namespace winstd
|
||||
///
|
||||
/// Initializes a new class instance with the object handle set to NULL.
|
||||
///
|
||||
inline sec_credentials()
|
||||
sec_credentials()
|
||||
{
|
||||
m_expires.QuadPart = -1;
|
||||
}
|
||||
@ -68,7 +74,7 @@ namespace winstd
|
||||
/// \param[in] h Initial class handle value
|
||||
/// \param[in] expires Credentials expiration
|
||||
///
|
||||
inline sec_credentials(_In_opt_ handle_type h, _In_ const TimeStamp expires) :
|
||||
sec_credentials(_In_opt_ handle_type h, _In_ const TimeStamp expires) :
|
||||
m_expires(expires),
|
||||
handle(h)
|
||||
{
|
||||
@ -79,7 +85,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
inline sec_credentials(_Inout_ sec_credentials &&h) noexcept :
|
||||
sec_credentials(_Inout_ sec_credentials &&h) noexcept :
|
||||
m_expires(std::move(h.m_expires)),
|
||||
handle<PCredHandle, NULL>(std::move(h))
|
||||
{
|
||||
@ -121,7 +127,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [AcquireCredentialsHandle (General) function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa374712.aspx)
|
||||
///
|
||||
inline SECURITY_STATUS acquire(
|
||||
SECURITY_STATUS acquire(
|
||||
_In_opt_ LPTSTR pszPrincipal,
|
||||
_In_ LPTSTR pszPackage,
|
||||
_In_ unsigned long fCredentialUse,
|
||||
@ -167,7 +173,7 @@ namespace winstd
|
||||
///
|
||||
/// Initializes a new class instance with the object handle set to NULL.
|
||||
///
|
||||
inline sec_context() :
|
||||
sec_context() :
|
||||
m_attrib(0),
|
||||
handle<PCtxtHandle, NULL>()
|
||||
{
|
||||
@ -179,7 +185,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
inline sec_context(_Inout_ sec_context &&h) noexcept :
|
||||
sec_context(_Inout_ sec_context &&h) noexcept :
|
||||
m_attrib (std::move(h.m_attrib )),
|
||||
m_expires(std::move(h.m_expires)),
|
||||
handle<PCtxtHandle, NULL>(std::move(h))
|
||||
@ -223,7 +229,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [InitializeSecurityContext (General) function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa375506.aspx)
|
||||
///
|
||||
inline SECURITY_STATUS initialize(
|
||||
SECURITY_STATUS initialize(
|
||||
_In_opt_ PCredHandle phCredential,
|
||||
_In_opt_z_ LPCTSTR pszTargetName,
|
||||
_In_ ULONG fContextReq,
|
||||
@ -255,7 +261,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [InitializeSecurityContext (General) function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa375506.aspx)
|
||||
///
|
||||
inline SECURITY_STATUS process(
|
||||
SECURITY_STATUS process(
|
||||
_In_opt_ PCredHandle phCredential,
|
||||
_In_opt_z_ LPCTSTR pszTargetName,
|
||||
_In_ ULONG fContextReq,
|
||||
@ -293,7 +299,7 @@ namespace winstd
|
||||
///
|
||||
/// Initializes security buffer descriptor.
|
||||
///
|
||||
inline sec_buffer_desc(_Inout_count_(count) PSecBuffer buf, ULONG count, _In_ ULONG version = SECBUFFER_VERSION)
|
||||
sec_buffer_desc(_Inout_count_(count) PSecBuffer buf, ULONG count, _In_ ULONG version = SECBUFFER_VERSION)
|
||||
{
|
||||
ulVersion = version;
|
||||
cBuffers = count;
|
||||
@ -336,7 +342,7 @@ namespace winstd
|
||||
/// \param[in] num Security provider error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline sec_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<SECURITY_STATUS>(num, msg)
|
||||
sec_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<SECURITY_STATUS>(num, msg)
|
||||
{
|
||||
}
|
||||
|
||||
@ -347,7 +353,7 @@ namespace winstd
|
||||
/// \param[in] num Security provider error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline sec_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<SECURITY_STATUS>(num, msg)
|
||||
sec_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<SECURITY_STATUS>(num, msg)
|
||||
{
|
||||
}
|
||||
|
||||
@ -357,7 +363,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] other Exception to copy from
|
||||
///
|
||||
inline sec_runtime_error(const sec_runtime_error &other) : num_runtime_error<SECURITY_STATUS>(other)
|
||||
sec_runtime_error(const sec_runtime_error &other) : num_runtime_error<SECURITY_STATUS>(other)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -366,8 +372,10 @@ namespace winstd
|
||||
}
|
||||
|
||||
|
||||
#if defined(SECURITY_WIN32) || defined(SECURITY_KERNEL)
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
BOOLEAN GetUserNameExA(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sName)
|
||||
static BOOLEAN GetUserNameExA(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sName)
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -395,7 +403,7 @@ BOOLEAN GetUserNameExA(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
BOOLEAN GetUserNameExW(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sName)
|
||||
static BOOLEAN GetUserNameExW(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sName)
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -420,3 +428,5 @@ BOOLEAN GetUserNameExW(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -56,7 +56,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [SetupDiCreateDeviceInfoList function](https://docs.microsoft.com/en-us/windows/desktop/api/setupapi/nf-setupapi-setupdicreatedeviceinfolist)
|
||||
///
|
||||
inline bool create(
|
||||
bool create(
|
||||
_In_opt_ const GUID * ClassGuid,
|
||||
_In_opt_ HWND hwndParent) noexcept
|
||||
{
|
||||
@ -78,7 +78,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [SetupDiGetClassDevsExW function](https://docs.microsoft.com/en-us/windows/desktop/api/setupapi/nf-setupapi-setupdigetclassdevsexw)
|
||||
///
|
||||
inline bool create(
|
||||
bool create(
|
||||
_In_opt_ const GUID * ClassGuid,
|
||||
_In_opt_ PCTSTR Enumerator,
|
||||
_In_opt_ HWND hwndParent,
|
||||
@ -123,7 +123,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [SetupDiBuildDriverInfoList function](https://docs.microsoft.com/en-us/windows/desktop/api/setupapi/nf-setupapi-setupdibuilddriverinfolist)
|
||||
///
|
||||
inline setup_driver_info_list_builder(
|
||||
setup_driver_info_list_builder(
|
||||
_In_ HDEVINFO DeviceInfoSet,
|
||||
_Inout_opt_ PSP_DEVINFO_DATA DeviceInfoData,
|
||||
_In_ DWORD DriverType) noexcept :
|
||||
@ -151,7 +151,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [SetupDiBuildDriverInfoList function](https://docs.microsoft.com/en-us/windows/desktop/api/setupapi/nf-setupapi-setupdibuilddriverinfolist)
|
||||
///
|
||||
inline BOOL status() const noexcept
|
||||
BOOL status() const noexcept
|
||||
{
|
||||
return m_result;
|
||||
}
|
||||
|
@ -18,14 +18,16 @@
|
||||
/// @{
|
||||
|
||||
/// @copydoc PathCanonicalizeW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline BOOL PathCanonicalizeA(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, _In_ LPCSTR pszPath);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static BOOL PathCanonicalizeA(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, _In_ LPCSTR pszPath);
|
||||
|
||||
///
|
||||
/// Simplifies a path by removing navigation elements such as "." and ".." to produce a direct, well-formed path, and stores it in a std::wstring string.
|
||||
///
|
||||
/// \sa [PathCanonicalize function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb773569.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline BOOL PathCanonicalizeW(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, _In_ LPCWSTR pszPath);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static BOOL PathCanonicalizeW(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, _In_ LPCWSTR pszPath);
|
||||
|
||||
/// @}
|
||||
|
||||
@ -33,7 +35,7 @@ template<class _Elem, class _Traits, class _Ax> inline BOOL PathCanonicalizeW(_I
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline BOOL PathCanonicalizeA(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, _In_ LPCSTR pszPath)
|
||||
static BOOL PathCanonicalizeA(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, _In_ LPCSTR pszPath)
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -46,7 +48,7 @@ inline BOOL PathCanonicalizeA(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &sV
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline BOOL PathCanonicalizeW(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, _In_ LPCWSTR pszPath)
|
||||
static BOOL PathCanonicalizeW(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, _In_ LPCWSTR pszPath)
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
|
@ -37,7 +37,8 @@ namespace winstd {
|
||||
/// Since Wlanapi.dll is not always present, the `pfnWlanReasonCodeToString` pointer to `WlanReasonCodeToString()`
|
||||
/// function must be loaded dynamically.
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline DWORD WlanReasonCodeToString(_In_ DWORD dwReasonCode, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, __reserved PVOID pReserved);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static DWORD WlanReasonCodeToString(_In_ DWORD dwReasonCode, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, __reserved PVOID pReserved);
|
||||
|
||||
/// @}
|
||||
|
||||
@ -135,7 +136,7 @@ namespace winstd
|
||||
/// - \c true when succeeds;
|
||||
/// - \c false when fails. Use `GetLastError()` for failure reason.
|
||||
///
|
||||
inline bool open(_In_ DWORD dwClientVersion, _Out_ PDWORD pdwNegotiatedVersion) noexcept
|
||||
bool open(_In_ DWORD dwClientVersion, _Out_ PDWORD pdwNegotiatedVersion) noexcept
|
||||
{
|
||||
handle_type h;
|
||||
const DWORD dwResult = WlanOpenHandle(dwClientVersion, 0, pdwNegotiatedVersion, &h);
|
||||
@ -165,7 +166,7 @@ namespace winstd
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline DWORD WlanReasonCodeToString(_In_ DWORD dwReasonCode, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, __reserved PVOID pReserved)
|
||||
static DWORD WlanReasonCodeToString(_In_ DWORD dwReasonCode, _Inout_ std::basic_string<_Elem, _Traits, _Ax> &sValue, __reserved PVOID pReserved)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
|
||||
|
@ -38,47 +38,56 @@ namespace winstd
|
||||
/// @{
|
||||
|
||||
/// @copydoc GetModuleFileNameW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline DWORD GetModuleFileNameA(_In_opt_ HMODULE hModule, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static DWORD GetModuleFileNameA(_In_opt_ HMODULE hModule, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
|
||||
///
|
||||
/// Retrieves the fully qualified path for the file that contains the specified module and stores it in a std::wstring string.
|
||||
///
|
||||
/// \sa [GetModuleFileName function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms683197.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline DWORD GetModuleFileNameW(_In_opt_ HMODULE hModule, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static DWORD GetModuleFileNameW(_In_opt_ HMODULE hModule, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
|
||||
/// @copydoc GetWindowTextW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) int GetWindowTextA(_In_ HWND hWnd, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int GetWindowTextA(_In_ HWND hWnd, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
|
||||
///
|
||||
/// Copies the text of the specified window's title bar (if it has one) into a std::wstring string.
|
||||
///
|
||||
/// \sa [GetWindowText function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms633520.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) int GetWindowTextW(_In_ HWND hWnd, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int GetWindowTextW(_In_ HWND hWnd, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
|
||||
/// @copydoc GetFileVersionInfoW()
|
||||
template<class _Ty, class _Ax> inline _Success_(return != 0) BOOL GetFileVersionInfoA(_In_z_ LPCSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept;
|
||||
template<class _Ty, class _Ax>
|
||||
static _Success_(return != 0) BOOL GetFileVersionInfoA(_In_z_ LPCSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept;
|
||||
|
||||
///
|
||||
/// Retrieves version information for the specified file and stores it in a std::vector buffer.
|
||||
///
|
||||
/// \sa [GetFileVersionInfo function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms647003.aspx)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline _Success_(return != 0) BOOL GetFileVersionInfoW(_In_z_ LPCWSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept;
|
||||
template<class _Ty, class _Ax>
|
||||
static _Success_(return != 0) BOOL GetFileVersionInfoW(_In_z_ LPCWSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept;
|
||||
|
||||
/// @copydoc ExpandEnvironmentStringsW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) DWORD ExpandEnvironmentStringsA(_In_z_ LPCSTR lpSrc, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) DWORD ExpandEnvironmentStringsA(_In_z_ LPCSTR lpSrc, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
|
||||
///
|
||||
/// Expands environment-variable strings, replaces them with the values defined for the current user, and stores it in a std::wstring string.
|
||||
///
|
||||
/// \sa [ExpandEnvironmentStrings function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724265.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) DWORD ExpandEnvironmentStringsW(_In_z_ LPCWSTR lpSrc, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) DWORD ExpandEnvironmentStringsW(_In_z_ LPCWSTR lpSrc, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
|
||||
/// @copydoc GuidToStringW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline VOID GuidToStringA(_In_ LPCGUID lpGuid, _Out_ std::basic_string<_Elem, _Traits, _Ax> &str) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static VOID GuidToStringA(_In_ LPCGUID lpGuid, _Out_ std::basic_string<_Elem, _Traits, _Ax> &str) noexcept;
|
||||
|
||||
///
|
||||
/// Formats GUID and stores it in a std::wstring string.
|
||||
@ -86,7 +95,8 @@ template<class _Elem, class _Traits, class _Ax> inline VOID GuidToStringA(_In_ L
|
||||
/// \param[in ] lpGuid Pointer to GUID
|
||||
/// \param[out] str String to store the result to
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline VOID GuidToStringW(_In_ LPCGUID lpGuid, _Out_ std::basic_string<_Elem, _Traits, _Ax> &str) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static VOID GuidToStringW(_In_ LPCGUID lpGuid, _Out_ std::basic_string<_Elem, _Traits, _Ax> &str) noexcept;
|
||||
|
||||
/// @copydoc GuidToStringW()
|
||||
#ifdef _UNICODE
|
||||
@ -96,7 +106,7 @@ template<class _Elem, class _Traits, class _Ax> inline VOID GuidToStringW(_In_ L
|
||||
#endif
|
||||
|
||||
/// @copydoc StringToGuidW()
|
||||
_Success_(return) static BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd = NULL) noexcept;
|
||||
static _Success_(return) BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd = NULL) noexcept;
|
||||
|
||||
///
|
||||
/// Parses string with GUID and stores it to GUID
|
||||
@ -109,7 +119,7 @@ _Success_(return) static BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID
|
||||
/// - `TRUE` if GUID successfuly parsed;
|
||||
/// - `FALSE` otherwise.
|
||||
///
|
||||
_Success_(return) static BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd = NULL) noexcept;
|
||||
static _Success_(return) BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd = NULL) noexcept;
|
||||
|
||||
/// @copydoc StringToGuidW()
|
||||
#ifdef _UNICODE
|
||||
@ -136,7 +146,8 @@ _Success_(return) static BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUI
|
||||
/// \sa [RegQueryValueEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724911.aspx)
|
||||
/// \sa [ExpandEnvironmentStrings function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724265.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
|
||||
///
|
||||
/// Queries for a string value in the registry and stores it in a std::wstring string.
|
||||
@ -156,29 +167,34 @@ template<class _Elem, class _Traits, class _Ax> inline LSTATUS RegQueryStringVal
|
||||
/// \sa [RegQueryValueEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724911.aspx)
|
||||
/// \sa [ExpandEnvironmentStrings function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724265.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCWSTR pszName, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCWSTR pszName, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept;
|
||||
|
||||
/// @copydoc RegQueryValueExW()
|
||||
template<class _Ty, class _Ax> inline LSTATUS RegQueryValueExA(_In_ HKEY hKey, _In_opt_z_ LPCSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept;
|
||||
template<class _Ty, class _Ax>
|
||||
static LSTATUS RegQueryValueExA(_In_ HKEY hKey, _In_opt_z_ LPCSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept;
|
||||
|
||||
///
|
||||
/// Retrieves the type and data for the specified value name associated with an open registry key and stores the data in a std::vector buffer.
|
||||
///
|
||||
/// \sa [RegQueryValueEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724911.aspx)
|
||||
///
|
||||
template<class _Ty, class _Ax> inline LSTATUS RegQueryValueExW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept;
|
||||
template<class _Ty, class _Ax>
|
||||
static LSTATUS RegQueryValueExW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept;
|
||||
|
||||
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
|
||||
/// @copydoc RegLoadMUIStringW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline LSTATUS RegLoadMUIStringA(_In_ HKEY hKey, _In_opt_z_ LPCSTR pszValue, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCSTR pszDirectory) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static LSTATUS RegLoadMUIStringA(_In_ HKEY hKey, _In_opt_z_ LPCSTR pszValue, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCSTR pszDirectory) noexcept;
|
||||
|
||||
///
|
||||
/// Loads the specified string from the specified key and subkey, and stores it in a std::wstring string.
|
||||
///
|
||||
/// \sa [RegLoadMUIString function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724890.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline LSTATUS RegLoadMUIStringW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR pszValue, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCWSTR pszDirectory) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static LSTATUS RegLoadMUIStringW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR pszValue, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCWSTR pszDirectory) noexcept;
|
||||
|
||||
#endif
|
||||
|
||||
@ -187,21 +203,24 @@ template<class _Elem, class _Traits, class _Ax> inline LSTATUS RegLoadMUIStringW
|
||||
///
|
||||
/// \sa [WideCharToMultiByte function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd374130.aspx)
|
||||
///
|
||||
template<class _Traits, class _Ax> inline _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::basic_string<char, _Traits, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
template<class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::basic_string<char, _Traits, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
|
||||
///
|
||||
/// Maps a UTF-16 (wide character) string to a std::vector. The new character vector is not necessarily from a multibyte character set.
|
||||
///
|
||||
/// \sa [WideCharToMultiByte function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd374130.aspx)
|
||||
///
|
||||
template<class _Ax> inline _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::vector<char, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
template<class _Ax>
|
||||
static _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::vector<char, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
|
||||
///
|
||||
/// Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily from a multibyte character set.
|
||||
///
|
||||
/// \sa [WideCharToMultiByte function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd374130.aspx)
|
||||
///
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2> inline _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _Out_ std::basic_string<wchar_t, _Traits1, _Ax1> sWideCharStr, _Out_ std::basic_string<char, _Traits2, _Ax2> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
|
||||
static _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _Out_ std::basic_string<wchar_t, _Traits1, _Ax1> sWideCharStr, _Out_ std::basic_string<char, _Traits2, _Ax2> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
|
||||
///
|
||||
/// Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily from a multibyte character set.
|
||||
@ -210,7 +229,8 @@ template<class _Traits1, class _Ax1, class _Traits2, class _Ax2> inline _Success
|
||||
///
|
||||
/// \sa [WideCharToMultiByte function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd374130.aspx)
|
||||
///
|
||||
template<class _Traits, class _Ax> inline _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::basic_string<char, _Traits, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
template<class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::basic_string<char, _Traits, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
|
||||
///
|
||||
/// Maps a UTF-16 (wide character) string to a std::vector. The new character vector is not necessarily from a multibyte character set.
|
||||
@ -219,7 +239,8 @@ template<class _Traits, class _Ax> inline _Success_(return != 0) int SecureWideC
|
||||
///
|
||||
/// \sa [WideCharToMultiByte function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd374130.aspx)
|
||||
///
|
||||
template<class _Ax> inline _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::vector<char, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
template<class _Ax>
|
||||
static _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::vector<char, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
|
||||
///
|
||||
/// Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily from a multibyte character set.
|
||||
@ -228,28 +249,32 @@ template<class _Ax> inline _Success_(return != 0) int SecureWideCharToMultiByte(
|
||||
///
|
||||
/// \sa [WideCharToMultiByte function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd374130.aspx)
|
||||
///
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2> inline _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _Out_ std::basic_string<wchar_t, _Traits1, _Ax1> sWideCharStr, _Out_ std::basic_string<char, _Traits2, _Ax2> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
|
||||
static _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _Out_ std::basic_string<wchar_t, _Traits1, _Ax1> sWideCharStr, _Out_ std::basic_string<char, _Traits2, _Ax2> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept;
|
||||
|
||||
///
|
||||
/// Maps a character string to a UTF-16 (wide character) std::wstring. The character string is not necessarily from a multibyte character set.
|
||||
///
|
||||
/// \sa [MultiByteToWideChar function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd319072.aspx)
|
||||
///
|
||||
template<class _Traits, class _Ax> inline _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sWideCharStr) noexcept;
|
||||
template<class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sWideCharStr) noexcept;
|
||||
|
||||
///
|
||||
/// Maps a character string to a UTF-16 (wide character) std::vector. The character vector is not necessarily from a multibyte character set.
|
||||
///
|
||||
/// \sa [MultiByteToWideChar function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd319072.aspx)
|
||||
///
|
||||
template<class _Ax> inline _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::vector<wchar_t, _Ax> &sWideCharStr) noexcept;
|
||||
template<class _Ax>
|
||||
static _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::vector<wchar_t, _Ax> &sWideCharStr) noexcept;
|
||||
|
||||
///
|
||||
/// Maps a character string to a UTF-16 (wide character) std::wstring. The character string is not necessarily from a multibyte character set.
|
||||
///
|
||||
/// \sa [MultiByteToWideChar function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd319072.aspx)
|
||||
///
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2> inline _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ const std::basic_string<char, _Traits1, _Ax1> &sMultiByteStr, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sWideCharStr) noexcept;
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
|
||||
static _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ const std::basic_string<char, _Traits1, _Ax1> &sMultiByteStr, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sWideCharStr) noexcept;
|
||||
|
||||
///
|
||||
/// Maps a character string to a UTF-16 (wide character) std::wstring. The character string is not necessarily from a multibyte character set.
|
||||
@ -258,7 +283,8 @@ template<class _Traits1, class _Ax1, class _Traits2, class _Ax2> inline _Success
|
||||
///
|
||||
/// \sa [MultiByteToWideChar function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd319072.aspx)
|
||||
///
|
||||
template<class _Traits, class _Ax> inline _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sWideCharStr) noexcept;
|
||||
template<class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sWideCharStr) noexcept;
|
||||
|
||||
///
|
||||
/// Maps a character string to a UTF-16 (wide character) std::vector. The character vector is not necessarily from a multibyte character set.
|
||||
@ -267,7 +293,8 @@ template<class _Traits, class _Ax> inline _Success_(return != 0) int SecureMulti
|
||||
///
|
||||
/// \sa [MultiByteToWideChar function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd319072.aspx)
|
||||
///
|
||||
template<class _Ax> inline _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::vector<wchar_t, _Ax> &sWideCharStr) noexcept;
|
||||
template<class _Ax>
|
||||
static _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::vector<wchar_t, _Ax> &sWideCharStr) noexcept;
|
||||
|
||||
///
|
||||
/// Maps a character string to a UTF-16 (wide character) std::wstring. The character string is not necessarily from a multibyte character set.
|
||||
@ -276,7 +303,8 @@ template<class _Ax> inline _Success_(return != 0) int SecureMultiByteToWideChar(
|
||||
///
|
||||
/// \sa [MultiByteToWideChar function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd319072.aspx)
|
||||
///
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2> inline _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ const std::basic_string<char, _Traits1, _Ax1> &sMultiByteStr, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sWideCharStr) noexcept;
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
|
||||
static _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ const std::basic_string<char, _Traits1, _Ax1> &sMultiByteStr, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sWideCharStr) noexcept;
|
||||
|
||||
///
|
||||
/// Normalizes characters of a text string according to Unicode 4.0 TR#15.
|
||||
@ -284,7 +312,7 @@ template<class _Traits1, class _Ax1, class _Traits2, class _Ax2> inline _Success
|
||||
/// \sa [NormalizeString function](https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-normalizestring)
|
||||
///
|
||||
template<class _Traits, class _Ax>
|
||||
inline _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ LPCWSTR lpSrcString, _In_ int cwSrcLength, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sDstString) noexcept;
|
||||
static _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ LPCWSTR lpSrcString, _In_ int cwSrcLength, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sDstString) noexcept;
|
||||
|
||||
///
|
||||
/// Normalizes characters of a text string according to Unicode 4.0 TR#15.
|
||||
@ -292,86 +320,95 @@ inline _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ L
|
||||
/// \sa [NormalizeString function](https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-normalizestring)
|
||||
///
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
|
||||
inline _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ const std::basic_string<wchar_t, _Traits1, _Ax1> &sSrcString, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sDstString) noexcept;
|
||||
static _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ const std::basic_string<wchar_t, _Traits1, _Ax1> &sSrcString, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sDstString) noexcept;
|
||||
|
||||
/// @copydoc LoadStringW
|
||||
template<class _Traits, class _Ax> inline _Success_(return != 0) int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<char, _Traits, _Ax> &sBuffer) noexcept;
|
||||
template<class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<char, _Traits, _Ax> &sBuffer) noexcept;
|
||||
|
||||
///
|
||||
/// Loads a string resource from the executable file associated with a specified module.
|
||||
///
|
||||
/// \sa [LoadString function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms647486.aspx)
|
||||
///
|
||||
template<class _Traits, class _Ax> inline _Success_(return != 0) int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sBuffer) noexcept;
|
||||
template<class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sBuffer) noexcept;
|
||||
|
||||
///
|
||||
/// Formats and sends a string to the debugger for display.
|
||||
///
|
||||
/// \sa [OutputDebugString function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363362.aspx)
|
||||
///
|
||||
inline VOID OutputDebugStrV(_In_z_ LPCSTR lpOutputString, _In_ va_list arg) noexcept;
|
||||
static VOID OutputDebugStrV(_In_z_ LPCSTR lpOutputString, _In_ va_list arg) noexcept;
|
||||
|
||||
///
|
||||
/// Formats and sends a string to the debugger for display.
|
||||
///
|
||||
/// \sa [OutputDebugString function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363362.aspx)
|
||||
///
|
||||
inline VOID OutputDebugStrV(_In_z_ LPCWSTR lpOutputString, _In_ va_list arg) noexcept;
|
||||
static VOID OutputDebugStrV(_In_z_ LPCWSTR lpOutputString, _In_ va_list arg) noexcept;
|
||||
|
||||
///
|
||||
/// Formats and sends a string to the debugger for display.
|
||||
///
|
||||
/// \sa [OutputDebugString function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363362.aspx)
|
||||
///
|
||||
inline VOID OutputDebugStr(_In_z_ LPCSTR lpOutputString, ...) noexcept;
|
||||
static VOID OutputDebugStr(_In_z_ LPCSTR lpOutputString, ...) noexcept;
|
||||
|
||||
///
|
||||
/// Formats and sends a string to the debugger for display.
|
||||
///
|
||||
/// \sa [OutputDebugString function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363362.aspx)
|
||||
///
|
||||
inline VOID OutputDebugStr(_In_z_ LPCWSTR lpOutputString, ...) noexcept;
|
||||
static VOID OutputDebugStr(_In_z_ LPCWSTR lpOutputString, ...) noexcept;
|
||||
|
||||
/// @copydoc GetDateFormatW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) int GetDateFormatA(_In_ LCID Locale, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDate, _In_opt_z_ LPCSTR lpFormat, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sDate) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int GetDateFormatA(_In_ LCID Locale, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDate, _In_opt_z_ LPCSTR lpFormat, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sDate) noexcept;
|
||||
|
||||
///
|
||||
/// Formats a date as a date string for a locale specified by the locale identifier. The function formats either a specified date or the local system date.
|
||||
///
|
||||
/// \sa [GetDateFormat function](https://msdn.microsoft.com/en-us/library/windows/desktop/dd318086.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) int GetDateFormatW(_In_ LCID Locale, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDate, _In_opt_z_ LPCWSTR lpFormat, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sDate) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int GetDateFormatW(_In_ LCID Locale, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDate, _In_opt_z_ LPCWSTR lpFormat, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sDate) noexcept;
|
||||
|
||||
/// @copydoc LookupAccountSidW()
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) BOOL LookupAccountSidA(_In_opt_z_ LPCSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) BOOL LookupAccountSidA(_In_opt_z_ LPCSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept;
|
||||
|
||||
///
|
||||
/// Retrieves the name of the account for this SID and the name of the first domain on which this SID is found.
|
||||
///
|
||||
/// \sa [LookupAccountSid function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa379166.aspx)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) BOOL LookupAccountSidW(_In_opt_z_ LPCWSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept;
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) BOOL LookupAccountSidW(_In_opt_z_ LPCWSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept;
|
||||
|
||||
///
|
||||
/// Retrieves a specified type of information about an access token. The calling process must have appropriate access rights to obtain the information.
|
||||
///
|
||||
/// \sa [GetTokenInformation function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa446671.aspx)
|
||||
///
|
||||
template<class _Ty> inline _Success_(return != 0) BOOL GetTokenInformation(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_ std::unique_ptr<_Ty> &TokenInformation) noexcept;
|
||||
template<class _Ty>
|
||||
static _Success_(return != 0) BOOL GetTokenInformation(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_ std::unique_ptr<_Ty> &TokenInformation) noexcept;
|
||||
|
||||
///
|
||||
/// Retrieves the full name of the executable image for the specified process.
|
||||
///
|
||||
/// \sa [QueryFullProcessImageNameA function](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-queryfullprocessimagenamea)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) BOOL QueryFullProcessImageNameA(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<_Elem, _Traits, _Ax>& sExeName);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) BOOL QueryFullProcessImageNameA(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<_Elem, _Traits, _Ax>& sExeName);
|
||||
|
||||
///
|
||||
/// Retrieves the full name of the executable image for the specified process.
|
||||
///
|
||||
/// \sa [QueryFullProcessImageNameW function](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-queryfullprocessimagenamew)
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) BOOL QueryFullProcessImageNameW(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<_Elem, _Traits, _Ax>& sExeName);
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) BOOL QueryFullProcessImageNameW(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<_Elem, _Traits, _Ax>& sExeName);
|
||||
|
||||
/// @}
|
||||
|
||||
@ -444,7 +481,7 @@ namespace winstd
|
||||
/// - \c true when succeeds;
|
||||
/// - \c false when fails. Use `GetLastError()` for failure reason.
|
||||
///
|
||||
inline bool load(_In_z_ LPCTSTR lpFileName, __reserved handle_type hFile, _In_ DWORD dwFlags) noexcept
|
||||
bool load(_In_z_ LPCTSTR lpFileName, __reserved handle_type hFile, _In_ DWORD dwFlags) noexcept
|
||||
{
|
||||
handle_type h = LoadLibraryEx(lpFileName, hFile, dwFlags);
|
||||
if (h != invalid) {
|
||||
@ -482,7 +519,7 @@ namespace winstd
|
||||
/// - \c true when succeeds;
|
||||
/// - \c false when fails. Use `GetLastError()` for failure reason.
|
||||
///
|
||||
inline bool open(_In_ DWORD dwDesiredAccess, _In_ BOOL bInheritHandle, _In_ DWORD dwProcessId) noexcept
|
||||
bool open(_In_ DWORD dwDesiredAccess, _In_ BOOL bInheritHandle, _In_ DWORD dwProcessId) noexcept
|
||||
{
|
||||
handle_type h = OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId);
|
||||
if (h != invalid) {
|
||||
@ -509,7 +546,7 @@ namespace winstd
|
||||
/// - \c true when succeeds;
|
||||
/// - \c false when fails. Use `GetLastError()` for failure reason.
|
||||
///
|
||||
inline bool create(_In_z_ LPCTSTR lpFileName, _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, _In_ DWORD dwCreationDisposition, _In_opt_ DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes = NULL, _In_opt_ HANDLE hTemplateFile = NULL) noexcept
|
||||
bool create(_In_z_ LPCTSTR lpFileName, _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, _In_ DWORD dwCreationDisposition, _In_opt_ DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes = NULL, _In_opt_ HANDLE hTemplateFile = NULL) noexcept
|
||||
{
|
||||
handle_type h = CreateFile(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
|
||||
if (h != invalid) {
|
||||
@ -536,7 +573,7 @@ namespace winstd
|
||||
/// - \c true when succeeds;
|
||||
/// - \c false when fails. Use `GetLastError()` for failure reason.
|
||||
///
|
||||
inline bool create(_In_ BOOL bManualReset, _In_ BOOL bInitialState, _In_opt_ LPSECURITY_ATTRIBUTES lpEventAttributes = NULL, _In_opt_z_ LPCTSTR lpName = NULL) noexcept
|
||||
bool create(_In_ BOOL bManualReset, _In_ BOOL bInitialState, _In_opt_ LPSECURITY_ATTRIBUTES lpEventAttributes = NULL, _In_opt_z_ LPCTSTR lpName = NULL) noexcept
|
||||
{
|
||||
handle_type h = CreateEvent(lpEventAttributes, bManualReset, bInitialState, lpName);
|
||||
if (h != invalid) {
|
||||
@ -555,7 +592,7 @@ namespace winstd
|
||||
/// - \c true when succeeds;
|
||||
/// - \c false when fails. Use `GetLastError()` for failure reason.
|
||||
///
|
||||
inline bool open(_In_ DWORD dwDesiredAccess, _In_ BOOL bInheritHandle, _In_z_ LPCTSTR lpName) noexcept
|
||||
bool open(_In_ DWORD dwDesiredAccess, _In_ BOOL bInheritHandle, _In_z_ LPCTSTR lpName) noexcept
|
||||
{
|
||||
handle_type h = OpenEvent(dwDesiredAccess, bInheritHandle, lpName);
|
||||
if (h != invalid) {
|
||||
@ -605,7 +642,7 @@ namespace winstd
|
||||
///
|
||||
/// \return Pointer to critical section
|
||||
///
|
||||
inline operator LPCRITICAL_SECTION() noexcept
|
||||
operator LPCRITICAL_SECTION() noexcept
|
||||
{
|
||||
return &m_data;
|
||||
}
|
||||
@ -644,7 +681,7 @@ namespace winstd
|
||||
/// - \c true when succeeds;
|
||||
/// - \c false when fails. Use `GetLastError()` for failure reason.
|
||||
///
|
||||
inline bool find(_In_ LPCTSTR lpFileName, _Out_ LPWIN32_FIND_DATA lpFindFileData) noexcept
|
||||
bool find(_In_ LPCTSTR lpFileName, _Out_ LPWIN32_FIND_DATA lpFindFileData) noexcept
|
||||
{
|
||||
handle_type h = FindFirstFile(lpFileName, lpFindFileData);
|
||||
if (h != invalid) {
|
||||
@ -697,7 +734,7 @@ namespace winstd
|
||||
/// - \c true when succeeds;
|
||||
/// - \c false when fails. Use `GetLastError()` for failure reason.
|
||||
///
|
||||
inline bool create(_In_ DWORD flOptions, _In_ SIZE_T dwInitialSize, _In_ SIZE_T dwMaximumSize) noexcept
|
||||
bool create(_In_ DWORD flOptions, _In_ SIZE_T dwInitialSize, _In_ SIZE_T dwMaximumSize) noexcept
|
||||
{
|
||||
handle_type h = HeapCreate(flOptions, dwInitialSize, dwMaximumSize);
|
||||
if (h != invalid) {
|
||||
@ -798,7 +835,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] heap Handle to existing heap
|
||||
///
|
||||
inline heap_allocator(_In_ HANDLE heap) : m_heap(heap)
|
||||
heap_allocator(_In_ HANDLE heap) : m_heap(heap)
|
||||
{
|
||||
}
|
||||
|
||||
@ -808,7 +845,7 @@ namespace winstd
|
||||
/// \param[in] other Another allocator of the heap_allocator kind
|
||||
///
|
||||
template <class _Other>
|
||||
inline heap_allocator(_In_ const heap_allocator<_Other> &other) : m_heap(other.m_heap)
|
||||
heap_allocator(_In_ const heap_allocator<_Other> &other) : m_heap(other.m_heap)
|
||||
{
|
||||
}
|
||||
|
||||
@ -819,7 +856,7 @@ namespace winstd
|
||||
///
|
||||
/// \returns Pointer to new memory block
|
||||
///
|
||||
inline pointer allocate(_In_ size_type count)
|
||||
pointer allocate(_In_ size_type count)
|
||||
{
|
||||
assert(m_heap);
|
||||
return (pointer)HeapAlloc(m_heap, 0, count * sizeof(_Ty));
|
||||
@ -831,7 +868,7 @@ namespace winstd
|
||||
/// \param[in] ptr Pointer to memory block
|
||||
/// \param[in] size Size of memory block (in bytes)
|
||||
///
|
||||
inline void deallocate(_In_ pointer ptr, _In_ size_type size)
|
||||
void deallocate(_In_ pointer ptr, _In_ size_type size)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(size);
|
||||
assert(m_heap);
|
||||
@ -844,7 +881,7 @@ namespace winstd
|
||||
/// \param[in] ptr Pointer to memory block
|
||||
/// \param[in] val Source element
|
||||
///
|
||||
inline void construct(_Inout_ pointer ptr, _In_ const _Ty& val)
|
||||
void construct(_Inout_ pointer ptr, _In_ const _Ty& val)
|
||||
{
|
||||
::new ((void*)ptr) _Ty(val);
|
||||
}
|
||||
@ -855,7 +892,7 @@ namespace winstd
|
||||
/// \param[in] ptr Pointer to memory block
|
||||
/// \param[in] val Source element
|
||||
///
|
||||
inline void construct(_Inout_ pointer ptr, _Inout_ _Ty&& val)
|
||||
void construct(_Inout_ pointer ptr, _Inout_ _Ty&& val)
|
||||
{
|
||||
::new ((void*)ptr) _Ty(std::forward<_Ty>(val));
|
||||
}
|
||||
@ -865,7 +902,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] ptr Pointer to memory block
|
||||
///
|
||||
inline void destroy(_Inout_ pointer ptr)
|
||||
void destroy(_Inout_ pointer ptr)
|
||||
{
|
||||
ptr->_Ty::~_Ty();
|
||||
}
|
||||
@ -873,7 +910,7 @@ namespace winstd
|
||||
///
|
||||
/// Returns maximum memory block size
|
||||
///
|
||||
inline size_type max_size() const
|
||||
size_type max_size() const
|
||||
{
|
||||
return (SIZE_T)-1;
|
||||
}
|
||||
@ -1007,7 +1044,7 @@ namespace winstd
|
||||
///
|
||||
/// Initializes a new class instance with the memory handle set to INVAL.
|
||||
///
|
||||
inline vmemory() noexcept : m_proc(NULL)
|
||||
vmemory() noexcept : m_proc(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1017,7 +1054,7 @@ namespace winstd
|
||||
/// \param[in] proc Handle of process the memory belongs to
|
||||
/// \param[in] h Initial object handle value
|
||||
///
|
||||
inline vmemory(_In_ handle_type h, _In_ HANDLE proc) noexcept :
|
||||
vmemory(_In_ handle_type h, _In_ HANDLE proc) noexcept :
|
||||
m_proc(proc),
|
||||
handle<LPVOID, NULL>(h)
|
||||
{
|
||||
@ -1028,7 +1065,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] h A rvalue reference of another object
|
||||
///
|
||||
inline vmemory(_Inout_ vmemory &&h) noexcept :
|
||||
vmemory(_Inout_ vmemory &&h) noexcept :
|
||||
m_proc(std::move(h.m_proc)),
|
||||
handle<LPVOID, NULL>(std::move(h))
|
||||
{
|
||||
@ -1050,7 +1087,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[inout] other A rvalue reference of another object
|
||||
///
|
||||
inline vmemory& operator=(_Inout_ vmemory &&other) noexcept
|
||||
vmemory& operator=(_Inout_ vmemory &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
(handle<handle_type, NULL>&&)*this = std::move(other);
|
||||
@ -1067,7 +1104,7 @@ namespace winstd
|
||||
/// \param[in] proc Handle of process the memory belongs to
|
||||
/// \param[in] h Initial object handle value
|
||||
///
|
||||
inline void attach(_In_ HANDLE proc, _In_opt_ handle_type h) noexcept
|
||||
void attach(_In_ HANDLE proc, _In_opt_ handle_type h) noexcept
|
||||
{
|
||||
m_proc = proc;
|
||||
if (m_h != invalid)
|
||||
@ -1084,7 +1121,7 @@ namespace winstd
|
||||
/// - \c true when succeeds;
|
||||
/// - \c false when fails. Use `GetLastError()` for failure reason.
|
||||
///
|
||||
inline bool alloc(
|
||||
bool alloc(
|
||||
_In_ HANDLE hProcess,
|
||||
_In_opt_ LPVOID lpAddress,
|
||||
_In_ SIZE_T dwSize,
|
||||
@ -1143,7 +1180,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [RegCreateKeyEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724844.aspx)
|
||||
///
|
||||
inline bool create(
|
||||
bool create(
|
||||
_In_ HKEY hKey,
|
||||
_In_z_ LPCTSTR lpSubKey,
|
||||
_In_opt_ LPTSTR lpClass,
|
||||
@ -1172,7 +1209,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [RegOpenKeyEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724897.aspx)
|
||||
///
|
||||
inline bool open(
|
||||
bool open(
|
||||
_In_ HKEY hKey,
|
||||
_In_opt_z_ LPCTSTR lpSubKey,
|
||||
_In_ DWORD ulOptions,
|
||||
@ -1291,7 +1328,7 @@ namespace winstd
|
||||
///
|
||||
/// Constructs blank PROCESS_INFORMATION
|
||||
///
|
||||
inline process_information() noexcept
|
||||
process_information() noexcept
|
||||
{
|
||||
hProcess = INVALID_HANDLE_VALUE;
|
||||
hThread = INVALID_HANDLE_VALUE;
|
||||
@ -1302,7 +1339,7 @@ namespace winstd
|
||||
///
|
||||
/// Closes process and thread handles.
|
||||
///
|
||||
inline ~process_information()
|
||||
~process_information()
|
||||
{
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 6001) // Using uninitialized memory '*this'. << ???
|
||||
@ -1321,8 +1358,11 @@ namespace winstd
|
||||
}
|
||||
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4505) // Don't warn on unused code
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline DWORD GetModuleFileNameA(_In_opt_ HMODULE hModule, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
static DWORD GetModuleFileNameA(_In_opt_ HMODULE hModule, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -1349,7 +1389,7 @@ inline DWORD GetModuleFileNameA(_In_opt_ HMODULE hModule, _Out_ std::basic_strin
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline DWORD GetModuleFileNameW(_In_opt_ HMODULE hModule, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
static DWORD GetModuleFileNameW(_In_opt_ HMODULE hModule, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
{
|
||||
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
|
||||
@ -1374,7 +1414,7 @@ inline DWORD GetModuleFileNameW(_In_opt_ HMODULE hModule, _Out_ std::basic_strin
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) int GetWindowTextA(_In_ HWND hWnd, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
static _Success_(return != 0) int GetWindowTextA(_In_ HWND hWnd, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -1403,7 +1443,7 @@ inline _Success_(return != 0) int GetWindowTextA(_In_ HWND hWnd, _Out_ std::basi
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) int GetWindowTextW(_In_ HWND hWnd, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
static _Success_(return != 0) int GetWindowTextW(_In_ HWND hWnd, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -1432,7 +1472,7 @@ inline _Success_(return != 0) int GetWindowTextW(_In_ HWND hWnd, _Out_ std::basi
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline _Success_(return != 0) BOOL GetFileVersionInfoA(_In_z_ LPCSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
|
||||
static _Success_(return != 0) BOOL GetFileVersionInfoA(_In_z_ LPCSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -1448,7 +1488,7 @@ inline _Success_(return != 0) BOOL GetFileVersionInfoA(_In_z_ LPCSTR lptstrFilen
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline _Success_(return != 0) BOOL GetFileVersionInfoW(_In_z_ LPCWSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
|
||||
static _Success_(return != 0) BOOL GetFileVersionInfoW(_In_z_ LPCWSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -1464,7 +1504,7 @@ inline _Success_(return != 0) BOOL GetFileVersionInfoW(_In_z_ LPCWSTR lptstrFile
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) DWORD ExpandEnvironmentStringsA(_In_z_ LPCSTR lpSrc, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
static _Success_(return != 0) DWORD ExpandEnvironmentStringsA(_In_z_ LPCSTR lpSrc, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -1488,7 +1528,7 @@ inline _Success_(return != 0) DWORD ExpandEnvironmentStringsA(_In_z_ LPCSTR lpSr
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) DWORD ExpandEnvironmentStringsW(_In_z_ LPCWSTR lpSrc, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
static _Success_(return != 0) DWORD ExpandEnvironmentStringsW(_In_z_ LPCWSTR lpSrc, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
{
|
||||
for (DWORD dwSizeOut = (DWORD)wcslen(lpSrc) + 0x100;;) {
|
||||
DWORD dwSizeIn = dwSizeOut;
|
||||
@ -1510,7 +1550,7 @@ inline _Success_(return != 0) DWORD ExpandEnvironmentStringsW(_In_z_ LPCWSTR lpS
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline VOID GuidToStringA(_In_ LPCGUID lpGuid, _Out_ std::basic_string<_Elem, _Traits, _Ax> &str) noexcept
|
||||
static VOID GuidToStringA(_In_ LPCGUID lpGuid, _Out_ std::basic_string<_Elem, _Traits, _Ax> &str) noexcept
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -1524,7 +1564,7 @@ inline VOID GuidToStringA(_In_ LPCGUID lpGuid, _Out_ std::basic_string<_Elem, _T
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline VOID GuidToStringW(_In_ LPCGUID lpGuid, _Out_ std::basic_string<_Elem, _Traits, _Ax> &str) noexcept
|
||||
static VOID GuidToStringW(_In_ LPCGUID lpGuid, _Out_ std::basic_string<_Elem, _Traits, _Ax> &str) noexcept
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -1537,8 +1577,7 @@ inline VOID GuidToStringW(_In_ LPCGUID lpGuid, _Out_ std::basic_string<_Elem, _T
|
||||
}
|
||||
|
||||
|
||||
#pragma warning(suppress: 4505)
|
||||
_Success_(return) static BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd) noexcept
|
||||
static _Success_(return) BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd) noexcept
|
||||
{
|
||||
GUID g;
|
||||
LPSTR lpszEnd;
|
||||
@ -1601,8 +1640,7 @@ _Success_(return) static BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID
|
||||
}
|
||||
|
||||
|
||||
#pragma warning(suppress: 4505)
|
||||
_Success_(return) static BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd) noexcept
|
||||
static _Success_(return) BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd) noexcept
|
||||
{
|
||||
GUID g;
|
||||
LPWSTR lpszEnd;
|
||||
@ -1666,7 +1704,7 @@ _Success_(return) static BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUI
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
{
|
||||
LSTATUS lResult;
|
||||
BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
|
||||
@ -1713,7 +1751,7 @@ inline LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCWSTR pszName, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCWSTR pszName, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sValue) noexcept
|
||||
{
|
||||
LSTATUS lResult;
|
||||
BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
|
||||
@ -1760,7 +1798,7 @@ inline LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCWSTR pszName, _Out_
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline LSTATUS RegQueryValueExA(_In_ HKEY hKey, _In_opt_z_ LPCSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
|
||||
static LSTATUS RegQueryValueExA(_In_ HKEY hKey, _In_opt_z_ LPCSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
|
||||
{
|
||||
LSTATUS lResult;
|
||||
BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
|
||||
@ -1783,7 +1821,7 @@ inline LSTATUS RegQueryValueExA(_In_ HKEY hKey, _In_opt_z_ LPCSTR lpValueName, _
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline LSTATUS RegQueryValueExW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
|
||||
static LSTATUS RegQueryValueExW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
|
||||
{
|
||||
LSTATUS lResult;
|
||||
BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
|
||||
@ -1808,7 +1846,7 @@ inline LSTATUS RegQueryValueExW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR lpValueName,
|
||||
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline LSTATUS RegLoadMUIStringA(_In_ HKEY hKey, _In_opt_z_ LPCSTR pszValue, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCSTR pszDirectory) noexcept
|
||||
static LSTATUS RegLoadMUIStringA(_In_ HKEY hKey, _In_opt_z_ LPCSTR pszValue, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCSTR pszDirectory) noexcept
|
||||
{
|
||||
// According to "Remarks" section in MSDN documentation of RegLoadMUIString(),
|
||||
// this function is defined but not implemented as ANSI variation.
|
||||
@ -1818,7 +1856,7 @@ inline LSTATUS RegLoadMUIStringA(_In_ HKEY hKey, _In_opt_z_ LPCSTR pszValue, _Ou
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline LSTATUS RegLoadMUIStringW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR pszValue, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCWSTR pszDirectory) noexcept
|
||||
static LSTATUS RegLoadMUIStringW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR pszValue, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCWSTR pszDirectory) noexcept
|
||||
{
|
||||
LSTATUS lResult;
|
||||
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
|
||||
@ -1844,7 +1882,7 @@ inline LSTATUS RegLoadMUIStringW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR pszValue, _O
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::basic_string<char, _Traits, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
static _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::basic_string<char, _Traits, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
{
|
||||
CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
|
||||
|
||||
@ -1866,7 +1904,7 @@ inline _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ D
|
||||
|
||||
|
||||
template<class _Ax>
|
||||
inline _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::vector<char, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
static _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::vector<char, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
{
|
||||
CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
|
||||
|
||||
@ -1887,7 +1925,7 @@ inline _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ D
|
||||
|
||||
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
|
||||
inline _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ std::basic_string<wchar_t, _Traits1, _Ax1> sWideCharStr, _Out_ std::basic_string<char, _Traits2, _Ax2> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
static _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ std::basic_string<wchar_t, _Traits1, _Ax1> sWideCharStr, _Out_ std::basic_string<char, _Traits2, _Ax2> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
{
|
||||
CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
|
||||
|
||||
@ -1909,7 +1947,7 @@ inline _Success_(return != 0) int WideCharToMultiByte(_In_ UINT CodePage, _In_ D
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::basic_string<char, _Traits, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
static _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::basic_string<char, _Traits, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
{
|
||||
CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
|
||||
|
||||
@ -1934,7 +1972,7 @@ inline _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage,
|
||||
|
||||
|
||||
template<class _Ax>
|
||||
inline _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::vector<char, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
static _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cchWideChar) LPCWSTR lpWideCharStr, _In_ int cchWideChar, _Out_ std::vector<char, _Ax> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
{
|
||||
CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
|
||||
|
||||
@ -1957,7 +1995,7 @@ inline _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage,
|
||||
|
||||
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
|
||||
inline _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ std::basic_string<wchar_t, _Traits1, _Ax1> sWideCharStr, _Out_ std::basic_string<char, _Traits2, _Ax2> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
static _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ std::basic_string<wchar_t, _Traits1, _Ax1> sWideCharStr, _Out_ std::basic_string<char, _Traits2, _Ax2> &sMultiByteStr, _In_opt_z_ LPCSTR lpDefaultChar, _Out_opt_ LPBOOL lpUsedDefaultChar) noexcept
|
||||
{
|
||||
CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
|
||||
|
||||
@ -1982,7 +2020,7 @@ inline _Success_(return != 0) int SecureWideCharToMultiByte(_In_ UINT CodePage,
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sWideCharStr) noexcept
|
||||
static _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sWideCharStr) noexcept
|
||||
{
|
||||
WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
|
||||
|
||||
@ -2004,7 +2042,7 @@ inline _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ D
|
||||
|
||||
|
||||
template<class _Ax>
|
||||
inline _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::vector<wchar_t, _Ax> &sWideCharStr) noexcept
|
||||
static _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::vector<wchar_t, _Ax> &sWideCharStr) noexcept
|
||||
{
|
||||
WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
|
||||
|
||||
@ -2025,7 +2063,7 @@ inline _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ D
|
||||
|
||||
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
|
||||
inline _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ const std::basic_string<char, _Traits1, _Ax1> &sMultiByteStr, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sWideCharStr) noexcept
|
||||
static _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ const std::basic_string<char, _Traits1, _Ax1> &sMultiByteStr, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sWideCharStr) noexcept
|
||||
{
|
||||
WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
|
||||
|
||||
@ -2047,7 +2085,7 @@ inline _Success_(return != 0) int MultiByteToWideChar(_In_ UINT CodePage, _In_ D
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sWideCharStr) noexcept
|
||||
static _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sWideCharStr) noexcept
|
||||
{
|
||||
WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
|
||||
|
||||
@ -2072,7 +2110,7 @@ inline _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage,
|
||||
|
||||
|
||||
template<class _Ax>
|
||||
inline _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::vector<wchar_t, _Ax> &sWideCharStr) noexcept
|
||||
static _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_z_count_(cbMultiByte) LPCSTR lpMultiByteStr, _In_ int cbMultiByte, _Out_ std::vector<wchar_t, _Ax> &sWideCharStr) noexcept
|
||||
{
|
||||
WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
|
||||
|
||||
@ -2095,7 +2133,7 @@ inline _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage,
|
||||
|
||||
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
|
||||
inline _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ const std::basic_string<char, _Traits1, _Ax1> &sMultiByteStr, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sWideCharStr) noexcept
|
||||
static _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage, _In_ DWORD dwFlags, _In_ const std::basic_string<char, _Traits1, _Ax1> &sMultiByteStr, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sWideCharStr) noexcept
|
||||
{
|
||||
WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
|
||||
|
||||
@ -2120,7 +2158,7 @@ inline _Success_(return != 0) int SecureMultiByteToWideChar(_In_ UINT CodePage,
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ LPCWSTR lpSrcString, _In_ int cwSrcLength, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sDstString) noexcept
|
||||
static _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ LPCWSTR lpSrcString, _In_ int cwSrcLength, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sDstString) noexcept
|
||||
{
|
||||
WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
|
||||
|
||||
@ -2159,7 +2197,7 @@ inline _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ L
|
||||
|
||||
|
||||
template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
|
||||
inline _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ const std::basic_string<wchar_t, _Traits1, _Ax1> &sSrcString, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sDstString) noexcept
|
||||
static _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ const std::basic_string<wchar_t, _Traits1, _Ax1> &sSrcString, _Out_ std::basic_string<wchar_t, _Traits2, _Ax2> &sDstString) noexcept
|
||||
{
|
||||
WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
|
||||
|
||||
@ -2198,7 +2236,7 @@ inline _Success_(return > 0) int NormalizeString(_In_ NORM_FORM NormForm, _In_ c
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<char, _Traits, _Ax> &sBuffer) noexcept
|
||||
static _Success_(return != 0) int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<char, _Traits, _Ax> &sBuffer) noexcept
|
||||
{
|
||||
// Get read-only pointer to string resource.
|
||||
LPCSTR pszStr;
|
||||
@ -2212,7 +2250,7 @@ inline _Success_(return != 0) int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstanc
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sBuffer) noexcept
|
||||
static _Success_(return != 0) int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sBuffer) noexcept
|
||||
{
|
||||
// Get read-only pointer to string resource.
|
||||
LPCWSTR pszStr;
|
||||
@ -2225,7 +2263,7 @@ inline _Success_(return != 0) int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstanc
|
||||
}
|
||||
|
||||
|
||||
inline VOID OutputDebugStrV(_In_z_ LPCSTR lpOutputString, _In_ va_list arg) noexcept
|
||||
static VOID OutputDebugStrV(_In_z_ LPCSTR lpOutputString, _In_ va_list arg) noexcept
|
||||
{
|
||||
std::string str;
|
||||
try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
|
||||
@ -2233,7 +2271,7 @@ inline VOID OutputDebugStrV(_In_z_ LPCSTR lpOutputString, _In_ va_list arg) noex
|
||||
}
|
||||
|
||||
|
||||
inline VOID OutputDebugStrV(_In_z_ LPCWSTR lpOutputString, _In_ va_list arg) noexcept
|
||||
static VOID OutputDebugStrV(_In_z_ LPCWSTR lpOutputString, _In_ va_list arg) noexcept
|
||||
{
|
||||
std::wstring str;
|
||||
try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
|
||||
@ -2241,7 +2279,7 @@ inline VOID OutputDebugStrV(_In_z_ LPCWSTR lpOutputString, _In_ va_list arg) noe
|
||||
}
|
||||
|
||||
|
||||
inline VOID OutputDebugStr(_In_z_ LPCSTR lpOutputString, ...) noexcept
|
||||
static VOID OutputDebugStr(_In_z_ LPCSTR lpOutputString, ...) noexcept
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, lpOutputString);
|
||||
@ -2250,7 +2288,7 @@ inline VOID OutputDebugStr(_In_z_ LPCSTR lpOutputString, ...) noexcept
|
||||
}
|
||||
|
||||
|
||||
inline VOID OutputDebugStr(_In_z_ LPCWSTR lpOutputString, ...) noexcept
|
||||
static VOID OutputDebugStr(_In_z_ LPCWSTR lpOutputString, ...) noexcept
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, lpOutputString);
|
||||
@ -2259,7 +2297,8 @@ inline VOID OutputDebugStr(_In_z_ LPCWSTR lpOutputString, ...) noexcept
|
||||
}
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) int GetDateFormatA(_In_ LCID Locale, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDate, _In_opt_z_ LPCSTR lpFormat, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sDate) noexcept
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int GetDateFormatA(_In_ LCID Locale, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDate, _In_opt_z_ LPCSTR lpFormat, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sDate) noexcept
|
||||
{
|
||||
int iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
|
||||
if (iResult) {
|
||||
@ -2274,7 +2313,8 @@ template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) in
|
||||
}
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) int GetDateFormatW(_In_ LCID Locale, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDate, _In_opt_z_ LPCWSTR lpFormat, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sDate) noexcept
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
static _Success_(return != 0) int GetDateFormatW(_In_ LCID Locale, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDate, _In_opt_z_ LPCWSTR lpFormat, _Out_ std::basic_string<_Elem, _Traits, _Ax> &sDate) noexcept
|
||||
{
|
||||
int iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
|
||||
if (iResult) {
|
||||
@ -2290,7 +2330,7 @@ template<class _Elem, class _Traits, class _Ax> inline _Success_(return != 0) in
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) BOOL LookupAccountSidA(_In_opt_z_ LPCSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept
|
||||
static _Success_(return != 0) BOOL LookupAccountSidA(_In_opt_z_ LPCSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -2325,7 +2365,7 @@ inline _Success_(return != 0) BOOL LookupAccountSidA(_In_opt_z_ LPCSTR lpSystemN
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) BOOL LookupAccountSidW(_In_opt_z_ LPCWSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept
|
||||
static _Success_(return != 0) BOOL LookupAccountSidW(_In_opt_z_ LPCWSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<_Elem, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept
|
||||
{
|
||||
assert(0); // TODO: Test this code.
|
||||
|
||||
@ -2360,7 +2400,7 @@ inline _Success_(return != 0) BOOL LookupAccountSidW(_In_opt_z_ LPCWSTR lpSystem
|
||||
|
||||
|
||||
template<class _Ty>
|
||||
inline _Success_(return != 0) BOOL GetTokenInformation(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_ std::unique_ptr<_Ty> &TokenInformation) noexcept
|
||||
static _Success_(return != 0) BOOL GetTokenInformation(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_ std::unique_ptr<_Ty> &TokenInformation) noexcept
|
||||
{
|
||||
BYTE szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(BYTE)];
|
||||
DWORD dwSize;
|
||||
@ -2388,8 +2428,7 @@ inline _Success_(return != 0) BOOL GetTokenInformation(_In_ HANDLE TokenHandle,
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) BOOL
|
||||
QueryFullProcessImageNameA(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<_Elem, _Traits, _Ax>& sExeName)
|
||||
static _Success_(return != 0) BOOL QueryFullProcessImageNameA(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<_Elem, _Traits, _Ax>& sExeName)
|
||||
{
|
||||
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(szStackBuffer);
|
||||
@ -2414,8 +2453,7 @@ QueryFullProcessImageNameA(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline _Success_(return != 0) BOOL
|
||||
QueryFullProcessImageNameW(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<_Elem, _Traits, _Ax>& sExeName)
|
||||
static _Success_(return != 0) BOOL QueryFullProcessImageNameW(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<_Elem, _Traits, _Ax>& sExeName)
|
||||
{
|
||||
_Elem szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(_Elem)];
|
||||
DWORD dwSize = _countof(szStackBuffer);
|
||||
@ -2437,3 +2475,5 @@ QueryFullProcessImageNameW(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
|
@ -43,7 +43,7 @@ namespace winstd
|
||||
/// \param[in] num WinSock2 error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline ws2_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<int>(num, msg)
|
||||
ws2_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<int>(num, msg)
|
||||
{
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ namespace winstd
|
||||
/// \param[in] num WinSock2 error code
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline ws2_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<int>(num, msg)
|
||||
ws2_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<int>(num, msg)
|
||||
{
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline ws2_runtime_error(_In_ const std::string& msg) : num_runtime_error<int>(WSAGetLastError(), msg)
|
||||
ws2_runtime_error(_In_ const std::string& msg) : num_runtime_error<int>(WSAGetLastError(), msg)
|
||||
{
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ namespace winstd
|
||||
///
|
||||
/// \param[in] msg Error message
|
||||
///
|
||||
inline ws2_runtime_error(_In_opt_z_ const char *msg = nullptr) : num_runtime_error<int>(WSAGetLastError(), msg)
|
||||
ws2_runtime_error(_In_opt_z_ const char *msg = nullptr) : num_runtime_error<int>(WSAGetLastError(), msg)
|
||||
{
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [FormatMessage function](https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-formatmessage)
|
||||
///
|
||||
inline tstring msg(_In_opt_ DWORD dwLanguageId = 0) const
|
||||
tstring msg(_In_opt_ DWORD dwLanguageId = 0) const
|
||||
{
|
||||
tstring str;
|
||||
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, m_num, dwLanguageId, str, NULL)) {
|
||||
@ -117,7 +117,7 @@ namespace winstd
|
||||
///
|
||||
/// \sa [GetAddrInfoW function](https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfow)
|
||||
///
|
||||
inline bool get(
|
||||
bool get(
|
||||
_In_opt_ PCTSTR pNodeName,
|
||||
_In_opt_ PCTSTR pServiceName,
|
||||
_In_opt_ const ADDRINFOT *pHints)
|
||||
|
@ -40,7 +40,7 @@ namespace winstd
|
||||
///
|
||||
/// Initializes a new class instance.
|
||||
///
|
||||
inline wintrust(_In_opt_ HWND hwnd, _In_ const GUID &action, _Inout_ WINTRUST_DATA &wtd) :
|
||||
wintrust(_In_opt_ HWND hwnd, _In_ const GUID &action, _Inout_ WINTRUST_DATA &wtd) :
|
||||
m_hwnd(hwnd),
|
||||
m_action(action),
|
||||
m_wtd(wtd)
|
||||
|
Loading…
x
Reference in New Issue
Block a user