diff --git a/_c_o_m_8h_source.html b/_c_o_m_8h_source.html index da9928be..468e1da8 100644 --- a/_c_o_m_8h_source.html +++ b/_c_o_m_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -1108,11 +1108,11 @@ $(function() { codefold.init(0); });
COM runtime error.
Definition COM.h:26
com_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition COM.h:34
com_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition COM.h:43
-
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition Common.h:1283
-
T handle_type
Datatype of the object handle this template class handles.
Definition Common.h:1025
-
handle_type m_h
Object handle.
Definition Common.h:1272
-
Numerical runtime error.
Definition Common.h:1477
-
HRESULT error_type
Error number type.
Definition Common.h:1479
+
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition Common.h:1263
+
T handle_type
Datatype of the object handle this template class handles.
Definition Common.h:1005
+
handle_type m_h
Object handle.
Definition Common.h:1252
+
Numerical runtime error.
Definition Common.h:1457
+
HRESULT error_type
Error number type.
Definition Common.h:1459
Context scope automatic SAFEARRAY (un)access.
Definition COM.h:1091
safearray_accessor(SAFEARRAY *psa)
Increments the lock count of an array, and retrieves a pointer to the array data.
Definition COM.h:1101
T HUGEP * data() const noexcept
Return SAFEARRAY data pointer.
Definition COM.h:1121
@@ -1190,14 +1190,14 @@ $(function() { codefold.init(0); });
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition Common.h:67
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition Common.h:75
#define WINSTD_DPLHANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:176
-
static const T invalid
Invalid handle value.
Definition Common.h:1030
+
static const T invalid
Invalid handle value.
Definition Common.h:1010
Deleter for unique_ptr using CoTaskMemFree.
Definition COM.h:56
void operator()(_T *_Ptr) const
Delete a pointer.
Definition COM.h:68
CoTaskMemFree_delete() noexcept
Default constructor.
Definition COM.h:60
diff --git a/_common_8h_source.html b/_common_8h_source.html index ecdd41be..0e4fd08b 100644 --- a/_common_8h_source.html +++ b/_common_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -253,1429 +253,1417 @@ $(function() { codefold.init(0); });
241#endif
242
245
-
256#if _MSC_VER <= 1600
-
-
257static int vsnprintf(_Out_z_cap_(capacity) char *str, _In_ size_t capacity, _In_z_ _Printf_format_string_ const char *format, _In_ va_list arg)
-
258{
-
259 return _vsnprintf(str, capacity, format, arg);
-
260}
+
+
256static 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
+
257{
+
258 return _vsnwprintf(str, capacity, format, arg);
+
259}
-
261#endif
-
262
-
-
273static 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
-
274{
-
275 return _vsnwprintf(str, capacity, format, arg);
-
276}
+
260
+
270template<class _Elem, class _Traits, class _Ax>
+
+
271static int vsprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, _In_ va_list arg)
+
272{
+
273 _Elem buf[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
+
274
+
275 // Try with stack buffer first.
+
276 int count = vsnprintf(buf, _countof(buf), format, arg);
+
277 if (0 <= count && count < _countof(buf)) {
+
278 // Copy from stack.
+
279 str.append(buf, count);
+
280 return count;
+
281 }
+
282 if (count < 0) {
+
283 switch (errno) {
+
284 case 0:
+
285 count = vsnprintf(NULL, 0, format, arg);
+
286 assert(count >= 0);
+
287 break;
+
288 case EINVAL: throw std::invalid_argument("invalid vsnprintf arguments");
+
289 case EILSEQ: throw std::runtime_error("encoding error");
+
290 default: throw std::runtime_error("failed to format string");
+
291 }
+
292 }
+
293 size_t offset = str.size();
+
294 str.resize(offset + count);
+
295 if (vsnprintf(&str[offset], count + 1, format, arg) != count)
+
296 throw std::runtime_error("failed to format string");
+
297 return count;
+
298}
-
277
-
287template<class _Elem, class _Traits, class _Ax>
-
-
288static int vsprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, _In_ va_list arg)
-
289{
-
290 _Elem buf[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
-
291
-
292 // Try with stack buffer first.
-
293 int count = vsnprintf(buf, _countof(buf) - 1, format, arg);
-
294 if (count >= 0) {
-
295 // Copy from stack.
-
296 str.assign(buf, count);
-
297 } else {
-
298 for (size_t capacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem);; capacity *= 2) {
-
299 // Allocate on heap and retry.
-
300 auto buf_dyn = std::make_unique<_Elem[]>(capacity);
-
301 count = vsnprintf(buf_dyn.get(), capacity - 1, format, arg);
-
302 if (count >= 0) {
-
303 str.assign(buf_dyn.get(), count);
-
304 break;
-
305 }
-
306 }
-
307 }
-
308
-
309 return count;
-
310}
+
299
+
308template<class _Elem, class _Traits, class _Ax>
+
+
309static int sprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, ...)
+
310{
+
311 va_list arg;
+
312 va_start(arg, format);
+
313 const int res = vsprintf(str, format, arg);
+
314 va_end(arg);
+
315 return res;
+
316}
-
311
-
320template<class _Elem, class _Traits, class _Ax>
-
-
321static int sprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, ...)
-
322{
-
323 va_list arg;
-
324 va_start(arg, format);
-
325 const int res = vsprintf(str, format, arg);
-
326 va_end(arg);
-
327 return res;
-
328}
+
317
+
323template<class _Traits, class _Ax>
+
+
324static _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
+
325{
+
326 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
+
327
+
328 // Try to convert to stack buffer first.
+
329 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
330 if (cch) {
+
331 // Copy from stack. Be careful not to include zero terminator.
+
332 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
333 }
+
334 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
335 // Query the required output size. Allocate buffer. Then convert again.
+
336 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
337 sMultiByteStr.resize(cch);
+
338 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, &sMultiByteStr[0], cch, lpDefaultChar, lpUsedDefaultChar);
+
339 sMultiByteStr.resize(cchWideChar != -1 ? strnlen(&sMultiByteStr[0], cch) : (size_t)cch - 1);
+
340 }
+
341
+
342 return cch;
+
343}
-
329
-
335template<class _Traits, class _Ax>
-
-
336static _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
-
337{
-
338 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
-
339
-
340 // Try to convert to stack buffer first.
-
341 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
342 if (cch) {
-
343 // Copy from stack. Be careful not to include zero terminator.
-
344 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
345 }
-
346 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
347 // Query the required output size. Allocate buffer. Then convert again.
-
348 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
349 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
350 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
351 sMultiByteStr.assign(szBuffer.get(), cchWideChar != -1 ? strnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
352 }
-
353
-
354 return cch;
-
355}
+
344
+
350template<class _Ax>
+
+
351static _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
+
352{
+
353 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
+
354
+
355 // Try to convert to stack buffer first.
+
356 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
357 if (cch) {
+
358 // Copy from stack.
+
359 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
+
360 }
+
361 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
362 // Query the required output size. Allocate buffer. Then convert again.
+
363 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
364 sMultiByteStr.resize(cch);
+
365 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
+
366 }
+
367
+
368 return cch;
+
369}
-
356
-
362template<class _Ax>
-
-
363static _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
-
364{
-
365 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
-
366
-
367 // Try to convert to stack buffer first.
-
368 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
369 if (cch) {
-
370 // Copy from stack.
-
371 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
-
372 }
-
373 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
374 // Query the required output size. Allocate buffer. Then convert again.
-
375 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
376 sMultiByteStr.resize(cch);
-
377 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
-
378 }
-
379
-
380 return cch;
-
381}
+
370
+
376template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
+
377static _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
+
378{
+
379 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
+
380
+
381 // Try to convert to stack buffer first.
+
382 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
383 if (cch) {
+
384 // Copy from stack.
+
385 sMultiByteStr.assign(szStackBuffer, cch);
+
386 }
+
387 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
388 // Query the required output size. Allocate buffer. Then convert again.
+
389 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
390 sMultiByteStr.resize(cch);
+
391 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), &sMultiByteStr[0], cch, lpDefaultChar, lpUsedDefaultChar);
+
392 }
+
393
+
394 return cch;
+
395}
-
382
-
388template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
-
389static _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
-
390{
-
391 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
-
392
-
393 // Try to convert to stack buffer first.
-
394 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
395 if (cch) {
-
396 // Copy from stack.
-
397 sMultiByteStr.assign(szStackBuffer, cch);
-
398 }
-
399 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
400 // Query the required output size. Allocate buffer. Then convert again.
-
401 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
402 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
403 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
404 sMultiByteStr.assign(szBuffer.get(), cch);
-
405 }
-
406
-
407 return cch;
-
408}
+
396
+
404template<class _Traits, class _Ax>
+
+
405static _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
+
406{
+
407 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
+
408
+
409 // Try to convert to stack buffer first.
+
410 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
411 if (cch) {
+
412 // Copy from stack. Be careful not to include zero terminator.
+
413 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
414 }
+
415 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
416 // Query the required output size. Allocate buffer. Then convert again.
+
417 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
418 sMultiByteStr.resize(cch);
+
419 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, &sMultiByteStr[0], cch, lpDefaultChar, lpUsedDefaultChar);
+
420 sMultiByteStr.resize(cchWideChar != -1 ? strnlen(&sMultiByteStr[0], cch) : (size_t)cch - 1);
+
421 }
+
422
+
423 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
424
+
425 return cch;
+
426}
-
409
-
417template<class _Traits, class _Ax>
-
-
418static _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
-
419{
-
420 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
-
421
-
422 // Try to convert to stack buffer first.
-
423 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
424 if (cch) {
-
425 // Copy from stack. Be careful not to include zero terminator.
-
426 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
427 }
-
428 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
429 // Query the required output size. Allocate buffer. Then convert again.
-
430 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
431 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
432 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
433 sMultiByteStr.assign(szBuffer.get(), cchWideChar != -1 ? strnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
434 SecureZeroMemory(szBuffer.get(), sizeof(CHAR) * cch);
-
435 }
-
436
-
437 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
438
-
439 return cch;
-
440}
+
427
+
435template<class _Ax>
+
+
436static _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
+
437{
+
438 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
+
439
+
440 // Try to convert to stack buffer first.
+
441 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
442 if (cch) {
+
443 // Copy from stack.
+
444 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
+
445 }
+
446 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
447 // Query the required output size. Allocate buffer. Then convert again.
+
448 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
449 sMultiByteStr.resize(cch);
+
450 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
+
451 }
+
452
+
453 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
454
+
455 return cch;
+
456}
-
441
-
449template<class _Ax>
-
-
450static _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
-
451{
-
452 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
-
453
-
454 // Try to convert to stack buffer first.
-
455 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
456 if (cch) {
-
457 // Copy from stack.
-
458 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
-
459 }
-
460 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
461 // Query the required output size. Allocate buffer. Then convert again.
-
462 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
463 sMultiByteStr.resize(cch);
-
464 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
-
465 }
-
466
-
467 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
468
-
469 return cch;
-
470}
+
457
+
465template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
+
466static _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
+
467{
+
468 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
+
469
+
470 // Try to convert to stack buffer first.
+
471 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
472 if (cch) {
+
473 // Copy from stack.
+
474 sMultiByteStr.assign(szStackBuffer, cch);
+
475 }
+
476 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
477 // Query the required output size. Allocate buffer. Then convert again.
+
478 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
479 sMultiByteStr.resize(cch);
+
480 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), &sMultiByteStr[0], cch, lpDefaultChar, lpUsedDefaultChar);
+
481 }
+
482
+
483 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
484
+
485 return cch;
+
486}
-
471
-
479template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
-
480static _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
-
481{
-
482 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(CHAR)];
-
483
-
484 // Try to convert to stack buffer first.
-
485 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
486 if (cch) {
-
487 // Copy from stack.
-
488 sMultiByteStr.assign(szStackBuffer, cch);
-
489 }
-
490 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
491 // Query the required output size. Allocate buffer. Then convert again.
-
492 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
493 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
494 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
495 sMultiByteStr.assign(szBuffer.get(), cch);
-
496 SecureZeroMemory(szBuffer.get(), sizeof(CHAR) * cch);
-
497 }
-
498
-
499 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
500
-
501 return cch;
-
502}
+
487
+
493template<class _Traits, class _Ax>
+
+
494static _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
+
495{
+
496 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
+
497
+
498 // Try to convert to stack buffer first.
+
499 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
500 if (cch) {
+
501 // Copy from stack.
+
502 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
503 }
+
504 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
505 // Query the required output size. Allocate buffer. Then convert again.
+
506 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
507 sWideCharStr.resize(cch);
+
508 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, &sWideCharStr[0], cch);
+
509 sWideCharStr.resize(cbMultiByte != -1 ? wcsnlen(&sWideCharStr[0], cch) : (size_t)cch - 1);
+
510 }
+
511
+
512 return cch;
+
513}
-
503
-
509template<class _Traits, class _Ax>
-
-
510static _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
-
511{
-
512 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
-
513
-
514 // Try to convert to stack buffer first.
-
515 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
516 if (cch) {
-
517 // Copy from stack.
-
518 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
519 }
-
520 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
521 // Query the required output size. Allocate buffer. Then convert again.
-
522 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
523 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
524 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szBuffer.get(), cch);
-
525 sWideCharStr.assign(szBuffer.get(), cbMultiByte != -1 ? wcsnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
526 }
-
527
-
528 return cch;
-
529}
+
514
+
520template<class _Ax>
+
+
521static _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
+
522{
+
523 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
+
524
+
525 // Try to convert to stack buffer first.
+
526 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
527 if (cch) {
+
528 // Copy from stack.
+
529 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
+
530 }
+
531 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
532 // Query the required output size. Allocate buffer. Then convert again.
+
533 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
534 sWideCharStr.resize(cch);
+
535 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
+
536 }
+
537
+
538 return cch;
+
539}
-
530
-
536template<class _Ax>
-
-
537static _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
-
538{
-
539 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
540
-
541 // Try to convert to stack buffer first.
-
542 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
543 if (cch) {
-
544 // Copy from stack.
-
545 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
-
546 }
-
547 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
548 // Query the required output size. Allocate buffer. Then convert again.
-
549 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
550 sWideCharStr.resize(cch);
-
551 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
-
552 }
-
553
-
554 return cch;
-
555}
+
546template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
+
547static _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
+
548{
+
549 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
+
550
+
551 // Try to convert to stack buffer first.
+
552 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
+
553 if (cch) {
+
554 // Copy from stack.
+
555 sWideCharStr.assign(szStackBuffer, cch);
+
556 }
+
557 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
558 // Query the required output size. Allocate buffer. Then convert again.
+
559 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
+
560 sWideCharStr.resize(cch);
+
561 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), &sWideCharStr[0], cch);
+
562 }
+
563
+
564 return cch;
+
565}
-
556
-
562template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
-
563static _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
-
564{
-
565 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
566
-
567 // Try to convert to stack buffer first.
-
568 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
-
569 if (cch) {
-
570 // Copy from stack.
-
571 sWideCharStr.assign(szStackBuffer, cch);
-
572 }
-
573 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
574 // Query the required output size. Allocate buffer. Then convert again.
-
575 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
-
576 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
577 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szBuffer.get(), cch);
-
578 sWideCharStr.assign(szBuffer.get(), cch);
-
579 }
-
580
-
581 return cch;
-
582}
+
574template<class _Traits, class _Ax>
+
+
575static _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
+
576{
+
577 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
+
578
+
579 // Try to convert to stack buffer first.
+
580 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
581 if (cch) {
+
582 // Copy from stack.
+
583 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
584 }
+
585 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
586 // Query the required output size. Allocate buffer. Then convert again.
+
587 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
588 sWideCharStr.resize(cch);
+
589 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, &sWideCharStr[0], cch);
+
590 sWideCharStr.resize(cbMultiByte != -1 ? wcsnlen(&sWideCharStr[0], cch) : (size_t)cch - 1);
+
591 }
+
592
+
593 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
594
+
595 return cch;
+
596}
-
583
-
591template<class _Traits, class _Ax>
-
-
592static _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
-
593{
-
594 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
-
595
-
596 // Try to convert to stack buffer first.
-
597 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
598 if (cch) {
-
599 // Copy from stack.
-
600 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
601 }
-
602 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
603 // Query the required output size. Allocate buffer. Then convert again.
-
604 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
605 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
606 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szBuffer.get(), cch);
-
607 sWideCharStr.assign(szBuffer.get(), cbMultiByte != -1 ? wcsnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
608 SecureZeroMemory(szBuffer.get(), sizeof(WCHAR) * cch);
-
609 }
-
610
-
611 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
612
-
613 return cch;
-
614}
+
597
+
605template<class _Ax>
+
+
606static _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
+
607{
+
608 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
+
609
+
610 // Try to convert to stack buffer first.
+
611 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
612 if (cch) {
+
613 // Copy from stack.
+
614 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
+
615 }
+
616 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
617 // Query the required output size. Allocate buffer. Then convert again.
+
618 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
619 sWideCharStr.resize(cch);
+
620 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
+
621 }
+
622
+
623 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
624
+
625 return cch;
+
626}
-
615
-
623template<class _Ax>
-
-
624static _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
-
625{
-
626 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
627
-
628 // Try to convert to stack buffer first.
-
629 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
630 if (cch) {
-
631 // Copy from stack.
-
632 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
-
633 }
-
634 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
635 // Query the required output size. Allocate buffer. Then convert again.
-
636 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
637 sWideCharStr.resize(cch);
-
638 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
-
639 }
-
640
-
641 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
642
-
643 return cch;
-
644}
+
635template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
+
636static _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
+
637{
+
638 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
+
639
+
640 // Try to convert to stack buffer first.
+
641 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
+
642 if (cch) {
+
643 // Copy from stack.
+
644 sWideCharStr.assign(szStackBuffer, cch);
+
645 }
+
646 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
647 // Query the required output size. Allocate buffer. Then convert again.
+
648 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
+
649 sWideCharStr.resize(cch);
+
650 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), &sWideCharStr[0], cch);
+
651 }
+
652
+
653 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
654
+
655 return cch;
+
656}
-
645
-
653template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
-
654static _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
-
655{
-
656 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(WCHAR)];
657
-
658 // Try to convert to stack buffer first.
-
659 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
-
660 if (cch) {
-
661 // Copy from stack.
-
662 sWideCharStr.assign(szStackBuffer, cch);
-
663 }
-
664 else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
665 // Query the required output size. Allocate buffer. Then convert again.
-
666 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
-
667 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
668 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szBuffer.get(), cch);
-
669 sWideCharStr.assign(szBuffer.get(), cch);
-
670 SecureZeroMemory(szBuffer.get(), sizeof(WCHAR) * cch);
-
671 }
+
663template<class _Traits, class _Ax>
+
+
664static DWORD FormatMessageA(_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)
+
665{
+
666 std::unique_ptr<CHAR[], winstd::LocalFree_delete<CHAR[]> > lpBuffer;
+
667 DWORD dwResult = FormatMessageA(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPSTR>((LPSTR*)get_ptr(lpBuffer)), 0, Arguments);
+
668 if (dwResult)
+
669 str.assign(lpBuffer.get(), dwResult);
+
670 return dwResult;
+
671}
+
672
-
673 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
674
-
675 return cch;
-
676}
+
678template<class _Traits, class _Ax>
+
+
679static DWORD FormatMessageW(_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)
+
680{
+
681 std::unique_ptr<WCHAR[], winstd::LocalFree_delete<WCHAR[]> > lpBuffer;
+
682 DWORD dwResult = FormatMessageW(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPWSTR>((LPWSTR*)get_ptr(lpBuffer)), 0, Arguments);
+
683 if (dwResult)
+
684 str.assign(lpBuffer.get(), dwResult);
+
685 return dwResult;
+
686}
-
677
-
683template<class _Traits, class _Ax>
-
-
684static DWORD FormatMessageA(_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)
-
685{
-
686 std::unique_ptr<CHAR[], winstd::LocalFree_delete<CHAR[]> > lpBuffer;
-
687 DWORD dwResult = FormatMessageA(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPSTR>((LPSTR*)get_ptr(lpBuffer)), 0, Arguments);
-
688 if (dwResult)
-
689 str.assign(lpBuffer.get(), dwResult);
-
690 return dwResult;
-
691}
+
687
+
689
+
690#pragma warning(pop)
+
691
+
692namespace winstd
+
693{
+
696
+
700#ifdef _UNICODE
+
701 typedef std::wstring tstring;
+
702#else
+
703 typedef std::string tstring;
+
704#endif
+
705
+
709 template <class _Ty>
+
+ +
711 {
+ +
713
+ +
718
+
722 template <class _Ty2> LocalFree_delete(const LocalFree_delete<_Ty2>&) {}
+
723
+
+
729 void operator()(_Ty *_Ptr) const
+
730 {
+
731 LocalFree(_Ptr);
+
732 }
-
692
-
698template<class _Traits, class _Ax>
-
-
699static DWORD FormatMessageW(_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)
-
700{
-
701 std::unique_ptr<WCHAR[], winstd::LocalFree_delete<WCHAR[]> > lpBuffer;
-
702 DWORD dwResult = FormatMessageW(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPWSTR>((LPWSTR*)get_ptr(lpBuffer)), 0, Arguments);
-
703 if (dwResult)
-
704 str.assign(lpBuffer.get(), dwResult);
-
705 return dwResult;
-
706}
+
733 };
-
707
-
709
-
710#pragma warning(pop)
-
711
-
712namespace winstd
-
713{
-
716
-
720#ifdef _UNICODE
-
721 typedef std::wstring tstring;
-
722#else
-
723 typedef std::string tstring;
-
724#endif
-
725
-
729 template <class _Ty>
-
- -
731 {
- -
733
- -
738
-
742 template <class _Ty2> LocalFree_delete(const LocalFree_delete<_Ty2>&) {}
-
743
-
-
749 void operator()(_Ty *_Ptr) const
-
750 {
-
751 LocalFree(_Ptr);
-
752 }
+
734
+
738 template <class _Ty>
+
+
739 struct LocalFree_delete<_Ty[]>
+
740 {
+ +
742
+
746 LocalFree_delete() noexcept {}
+
747
+
+
751 void operator()(_Frees_ptr_opt_ _Ty *_Ptr) const noexcept
+
752 {
+
753 LocalFree(_Ptr);
+
754 }
-
753 };
+
755
+
761 template<class _Other>
+
+
762 void operator()(_Other *) const
+
763 {
+
764 LocalFree(_Ptr);
+
765 }
+
+
766 };
-
754
-
758 template <class _Ty>
-
-
759 struct LocalFree_delete<_Ty[]>
-
760 {
- -
762
-
766 LocalFree_delete() noexcept {}
767
-
-
771 void operator()(_Frees_ptr_opt_ _Ty *_Ptr) const noexcept
-
772 {
-
773 LocalFree(_Ptr);
-
774 }
+
+ +
772 {
+ +
777
+
+
783 void operator()(HGLOBAL _Ptr) const
+
784 {
+
785 GlobalFree(_Ptr);
+
786 }
-
775
-
781 template<class _Other>
-
-
782 void operator()(_Other *) const
-
783 {
-
784 LocalFree(_Ptr);
-
785 }
+
787 };
-
786 };
-
-
787
-
- -
792 {
- +
788
+
792 template <class T>
+
+ +
794 {
+ +
797
-
-
803 void operator()(HGLOBAL _Ptr) const
-
804 {
-
805 GlobalFree(_Ptr);
-
806 }
+
798 public:
+
+
804 globalmem_accessor(_In_ HGLOBAL hMem) : m_h(hMem)
+
805 {
+
806 m_data = reinterpret_cast<T*>(GlobalLock(hMem));
+
807 if (!m_data)
+
808 throw win_runtime_error("GlobalLock failed");
+
809 }
-
807 };
+
810
+
+ +
817 {
+
818 GlobalUnlock(m_h);
+
819 }
-
808
-
812 template <class T>
-
- -
814 {
- - -
817
-
818 public:
+
820
-
824 globalmem_accessor(_In_ HGLOBAL hMem) : m_h(hMem)
+
824 T* data() const noexcept
825 {
-
826 m_data = reinterpret_cast<T*>(GlobalLock(hMem));
-
827 if (!m_data)
-
828 throw win_runtime_error("GlobalLock failed");
-
829 }
+
826 return m_data;
+
827 }
-
830
-
- -
837 {
-
838 GlobalUnlock(m_h);
-
839 }
+
828
+
829 protected:
+
830 HGLOBAL m_h;
+ +
832 };
-
840
-
-
844 T* data() const noexcept
-
845 {
-
846 return m_data;
-
847 }
+
833
+
837 template<class _Ty, class _Dx>
+
+ +
839 {
+
840 public:
+
+
846 ref_unique_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) :
+
847 m_own(owner),
+
848 m_ptr(owner.release())
+
849 {}
-
848
-
849 protected:
-
850 HGLOBAL m_h;
- -
852 };
+
850
+
+ +
857 m_own(other.m_own),
+
858 m_ptr(other.m_ptr)
+
859 {
+
860 other.m_ptr = nullptr;
+
861 }
-
853
-
857 template<class _Ty, class _Dx>
-
- -
859 {
-
860 public:
+
862
-
866 ref_unique_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) :
-
867 m_own(owner),
-
868 m_ptr(owner.release())
-
869 {}
+ +
867 {
+
868 if (m_ptr != nullptr)
+
869 m_own.reset(m_ptr);
+
870 }
-
870
-
- -
877 m_own(other.m_own),
-
878 m_ptr(other.m_ptr)
-
879 {
-
880 other.m_ptr = nullptr;
-
881 }
+
871
+
+
877 operator typename _Ty**()
+
878 {
+
879 return &m_ptr;
+
880 }
-
882
-
- -
887 {
-
888 if (m_ptr != nullptr)
-
889 m_own.reset(m_ptr);
+
881
+
+
887 operator typename _Ty*&()
+
888 {
+
889 return m_ptr;
890 }
891
-
-
897 operator typename _Ty**()
-
898 {
-
899 return &m_ptr;
-
900 }
+
892 protected:
+
893 std::unique_ptr<_Ty, _Dx> &m_own;
+
894 _Ty *m_ptr;
+
895 };
-
901
-
-
907 operator typename _Ty*&()
-
908 {
-
909 return m_ptr;
-
910 }
+
896
+
904 template<class _Ty, class _Dx>
+
+
905 ref_unique_ptr<_Ty, _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) noexcept
+
906 {
+ +
908 }
-
911
-
912 protected:
-
913 std::unique_ptr<_Ty, _Dx> &m_own;
-
914 _Ty *m_ptr;
-
915 };
+
909
+
914 template<class _Ty, class _Dx>
+
+ +
916 {
+
917 public:
+
+
923 ref_unique_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept :
+
924 m_own(owner),
+
925 m_ptr(owner.release())
+
926 {}
-
916
-
924 template<class _Ty, class _Dx>
-
-
925 ref_unique_ptr<_Ty, _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) noexcept
-
926 {
- -
928 }
+
927
+
+ +
934 m_own(other.m_own),
+
935 m_ptr(other.m_ptr)
+
936 {
+
937 other.m_ptr = nullptr;
+
938 }
-
929
-
934 template<class _Ty, class _Dx>
-
- -
936 {
-
937 public:
+
939
-
943 ref_unique_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept :
-
944 m_own(owner),
-
945 m_ptr(owner.release())
-
946 {}
+ +
944 {
+
945 if (m_ptr != nullptr)
+
946 m_own.reset(m_ptr);
+
947 }
-
947
-
- -
954 m_own(other.m_own),
-
955 m_ptr(other.m_ptr)
-
956 {
-
957 other.m_ptr = nullptr;
-
958 }
+
948
+
+
954 operator typename _Ty**() noexcept
+
955 {
+
956 return &m_ptr;
+
957 }
-
959
-
- -
964 {
-
965 if (m_ptr != nullptr)
-
966 m_own.reset(m_ptr);
+
958
+
+
964 operator typename _Ty*&()
+
965 {
+
966 return m_ptr;
967 }
968
-
-
974 operator typename _Ty**() noexcept
-
975 {
-
976 return &m_ptr;
-
977 }
+
969 protected:
+
970 std::unique_ptr<_Ty[], _Dx> &m_own;
+ +
972 };
-
978
-
-
984 operator typename _Ty*&()
-
985 {
-
986 return m_ptr;
-
987 }
+
973
+
982 template<class _Ty, class _Dx>
+
+
983 ref_unique_ptr<_Ty[], _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx>& owner) noexcept
+
984 {
+ +
986 }
-
988
-
989 protected:
-
990 std::unique_ptr<_Ty[], _Dx> &m_own;
- -
992 };
+
987
+
989
+
992
+
998 template <class T, const T INVAL>
+
+
999 class handle
+
1000 {
+
1001 public:
+ +
1006
+
1010 static const T invalid;
+
1011
+
+ +
1016 {}
-
993
-
1002 template<class _Ty, class _Dx>
-
- -
1004 {
- -
1006 }
+
1017
+ -
1007
-
1009
-
1012
-
1018 template <class T, const T INVAL>
-
- -
1020 {
-
1021 public:
- -
1026
-
1030 static const T invalid;
-
1031
-
- -
1036 {}
+
1025
+
+ +
1032 {
+
1033 // Transfer handle.
+
1034 m_h = h.m_h;
+
1035 h.m_h = invalid;
+
1036 }
1037
-
- -
1044 {}
+
1038 private:
+
1039 // This class is noncopyable.
+
1040 handle(_In_ const handle<handle_type, INVAL> &h) noexcept {};
+
1041 handle<handle_type, INVAL>& operator=(_In_ const handle<handle_type, INVAL> &h) noexcept {};
+
1042
+
1043 public:
+
+ +
1050 {
+
1051 attach(h);
+
1052 return *this;
+
1053 }
-
1045
-
- -
1052 {
-
1053 // Transfer handle.
-
1054 m_h = h.m_h;
-
1055 h.m_h = invalid;
-
1056 }
+
1054
+
1060 #pragma warning(suppress: 26432) // Move constructor is also present, but not detected by code analysis somehow.
+
+ +
1062 {
+
1063 if (this != std::addressof(h)) {
+
1064 // Transfer handle.
+
1065 if (m_h != invalid)
+
1066 free_internal();
+
1067 m_h = h.m_h;
+
1068 h.m_h = invalid;
+
1069 }
+
1070 return *this;
+
1071 }
-
1057
-
1058 private:
-
1059 // This class is noncopyable.
-
1060 handle(_In_ const handle<handle_type, INVAL> &h) noexcept {};
-
1061 handle<handle_type, INVAL>& operator=(_In_ const handle<handle_type, INVAL> &h) noexcept {};
-
1062
-
1063 public:
-
- -
1070 {
-
1071 attach(h);
-
1072 return *this;
-
1073 }
+
1072
+
+
1078 operator handle_type() const
+
1079 {
+
1080 return m_h;
+
1081 }
-
1074
-
1080 #pragma warning(suppress: 26432) // Move constructor is also present, but not detected by code analysis somehow.
-
- -
1082 {
-
1083 if (this != std::addressof(h)) {
-
1084 // Transfer handle.
-
1085 if (m_h != invalid)
-
1086 free_internal();
-
1087 m_h = h.m_h;
-
1088 h.m_h = invalid;
-
1089 }
-
1090 return *this;
-
1091 }
+
1082
+
+ +
1089 {
+
1090 assert(m_h != invalid);
+
1091 return *m_h;
+
1092 }
-
1092
+
1093
-
1098 operator handle_type() const
-
1099 {
-
1100 return m_h;
-
1101 }
+ +
1099 {
+
1100 assert(m_h == invalid);
+
1101 return &m_h;
+
1102 }
-
1102
-
- -
1109 {
-
1110 assert(m_h != invalid);
-
1111 return *m_h;
-
1112 }
+
1103
+
+ +
1110 {
+
1111 assert(m_h != invalid);
+
1112 return m_h;
+
1113 }
-
1113
-
- -
1119 {
-
1120 assert(m_h == invalid);
-
1121 return &m_h;
-
1122 }
+
1114
+
+
1125 bool operator!() const
+
1126 {
+
1127 return m_h == invalid;
+
1128 }
-
1123
-
- -
1130 {
-
1131 assert(m_h != invalid);
-
1132 return m_h;
-
1133 }
+
1129
+
+ +
1139 {
+
1140 return m_h < h;
+
1141 }
-
1134
-
-
1145 bool operator!() const
-
1146 {
-
1147 return m_h == invalid;
-
1148 }
+
1142
+
+ +
1152 {
+
1153 return !operator>(h);
+
1154 }
-
1149
-
- -
1159 {
-
1160 return m_h < h;
-
1161 }
+
1155
+
+ +
1165 {
+
1166 return !operator<(h);
+
1167 }
-
1162
-
- -
1172 {
-
1173 return !operator>(h);
-
1174 }
+
1168
+
+ +
1178 {
+
1179 return h < m_h;
+
1180 }
-
1175
-
- -
1185 {
-
1186 return !operator<(h);
-
1187 }
+
1181
+
+ +
1191 {
+
1192 return !operator==(h);
+
1193 }
-
1188
-
- -
1198 {
-
1199 return h < m_h;
-
1200 }
+
1194
+
+ +
1204 {
+
1205 return m_h == h;
+
1206 }
-
1201
-
- -
1211 {
-
1212 return !operator==(h);
-
1213 }
+
1207
+
+ +
1216 {
+
1217 if (m_h != invalid)
+
1218 free_internal();
+
1219 m_h = h;
+
1220 }
-
1214
-
- -
1224 {
-
1225 return m_h == h;
-
1226 }
+
1221
+
+ +
1228 {
+
1229 handle_type h = m_h;
+
1230 m_h = invalid;
+
1231 return h;
+
1232 }
-
1227
-
- -
1236 {
-
1237 if (m_h != invalid)
-
1238 free_internal();
-
1239 m_h = h;
-
1240 }
+
1233
+
+
1237 void free()
+
1238 {
+
1239 if (m_h != invalid) {
+
1240 free_internal();
+
1241 m_h = invalid;
+
1242 }
+
1243 }
-
1241
-
- -
1248 {
-
1249 handle_type h = m_h;
-
1250 m_h = invalid;
-
1251 return h;
-
1252 }
+
1244
+
1245 protected:
+
1249 virtual void free_internal() noexcept = 0;
+
1250
+
1251 protected:
+ +
1253 };
-
1253
-
-
1257 void free()
-
1258 {
-
1259 if (m_h != invalid) {
-
1260 free_internal();
-
1261 m_h = invalid;
-
1262 }
-
1263 }
+
1254
+ + +
1257
+ +
+ +
1263 {
+
1264 public:
+
+ +
1269 {}
-
1264
-
1265 protected:
-
1269 virtual void free_internal() noexcept = 0;
1270
-
1271 protected:
- -
1273 };
+ -
1274
- - -
1277
- -
- -
1283 {
-
1284 public:
-
- -
1289 {}
+
1278
+ +
1285 {}
+
1286
+
1292 dplhandle<handle_type, INVAL>(_Inout_ dplhandle<handle_type, INVAL> &&h) noexcept : handle<handle_type, INVAL>(std::move(h))
+
1293 {}
+
1294
+
+ +
1301 {
+ +
1303 return *this;
+
1304 }
-
1290
-
- -
1297 {}
+
1305
+
+ +
1312 {
+
1313 if (this != std::addressof(h)) {
+
1314 if (h.m_h != invalid) {
+
1315 handle_type h_new = duplicate_internal(h.m_h);
+
1316
+
1317 if (m_h != invalid)
+
1318 free_internal();
+
1319
+
1320 m_h = h_new;
+
1321 } else {
+
1322 if (m_h != invalid)
+
1323 free_internal();
+
1324
+
1325 m_h = invalid;
+
1326 }
+
1327 }
+
1328 return *this;
+
1329 }
-
1298
- -
1305 {}
-
1306
-
1312 dplhandle<handle_type, INVAL>(_Inout_ dplhandle<handle_type, INVAL> &&h) noexcept : handle<handle_type, INVAL>(std::move(h))
-
1313 {}
-
1314
-
- -
1321 {
- -
1323 return *this;
-
1324 }
+
1330
+
1336 #pragma warning(disable: 26432) // Move constructor is also present, but not detected by code analysis somehow.
+
+ +
1338 {
+ +
1340 return *this;
+
1341 }
-
1325
-
- -
1332 {
-
1333 if (this != std::addressof(h)) {
-
1334 if (h.m_h != invalid) {
-
1335 handle_type h_new = duplicate_internal(h.m_h);
-
1336
-
1337 if (m_h != invalid)
-
1338 free_internal();
-
1339
-
1340 m_h = h_new;
-
1341 } else {
-
1342 if (m_h != invalid)
-
1343 free_internal();
-
1344
-
1345 m_h = invalid;
-
1346 }
-
1347 }
-
1348 return *this;
-
1349 }
-
-
1350
-
1356 #pragma warning(disable: 26432) // Move constructor is also present, but not detected by code analysis somehow.
-
- -
1358 {
- -
1360 return *this;
-
1361 }
+
1342
+
+ +
1349 {
+
1350 return m_h != invalid ? duplicate_internal(m_h) : invalid;
+
1351 }
+
1352
+
+ +
1359 {
+
1360 if (m_h != invalid)
+
1361 free_internal();
1362
-
- -
1369 {
-
1370 return m_h != invalid ? duplicate_internal(m_h) : invalid;
-
1371 }
+
1363 m_h = h != invalid ? duplicate_internal(h) : invalid;
+
1364 }
-
1372
-
- -
1379 {
-
1380 if (m_h != invalid)
-
1381 free_internal();
+
1365
+
1366 protected:
+ +
1376 };
+
+
1377
+
1379
1382
-
1383 m_h = h != invalid ? duplicate_internal(h) : invalid;
-
1384 }
+
+ +
1393 {
+
1394 std::string sResult;
+ +
1396 if (hFoundRes) {
+ +
1398 if (dwSize) {
+ +
1400 if (hLoadedRes) {
+
1401 LPCWSTR szMessage = reinterpret_cast<LPCWSTR>(LockResource(hLoadedRes));
+
1402 if (szMessage) {
+ +
1404 return sResult;
+
1405 } else
+ +
1407 }
+
1408 }
+
1409 }
+
1410 sprintf(sResult, "msg %u", nId);
+
1411 return sResult;
+
1412 }
-
1385
-
1386 protected:
- -
1396 };
+
1413
+
+ +
1424 {
+
1425 std::string sResult;
+ +
1427 if (hFoundRes) {
+ +
1429 if (dwSize) {
+ +
1431 if (hLoadedRes) {
+
1432 LPCWSTR szFormat = reinterpret_cast<LPCWSTR>(LockResource(hLoadedRes));
+
1433 if (szFormat) {
+
1434 dwSize /= sizeof(*szFormat);
+
1435 assert(wcsnlen(szFormat, dwSize) < dwSize); // Resource strings must be zero-terminated to make strings directly usable with sprintf.
+
1436 va_list arg;
+ +
1438 std::wstring sMessage;
+ +
1440 va_end(arg);
+ +
1442 return sResult;
+
1443 } else
+ +
1445 }
+
1446 }
+
1447 }
+
1448 sprintf(sResult, "msg %u", nId);
+
1449 return sResult;
+
1450 }
-
1397
-
1399
-
1402
-
- -
1413 {
-
1414 std::string sResult;
- -
1416 if (hFoundRes) {
- -
1418 if (dwSize) {
- -
1420 if (hLoadedRes) {
-
1421 LPCWSTR szMessage = reinterpret_cast<LPCWSTR>(LockResource(hLoadedRes));
-
1422 if (szMessage) {
- -
1424 return sResult;
-
1425 } else
- -
1427 }
-
1428 }
-
1429 }
-
1430 sprintf(sResult, "msg %u", nId);
-
1431 return sResult;
-
1432 }
+
1451
+
1455 template <typename _Tn>
+
+
1456 class num_runtime_error : public std::runtime_error
+
1457 {
+
1458 public:
+
1459 typedef _Tn error_type;
+
1460
+
1461 public:
+
+ +
1469 m_num(num),
+
1470 runtime_error(msg)
+
1471 {}
-
1433
-
- -
1444 {
-
1445 std::string sResult;
- -
1447 if (hFoundRes) {
- -
1449 if (dwSize) {
- -
1451 if (hLoadedRes) {
-
1452 LPCWSTR szFormat = reinterpret_cast<LPCWSTR>(LockResource(hLoadedRes));
-
1453 if (szFormat) {
-
1454 dwSize /= sizeof(*szFormat);
-
1455 assert(wcsnlen(szFormat, dwSize) < dwSize); // Resource strings must be zero-terminated to make strings directly usable with sprintf.
-
1456 va_list arg;
- -
1458 std::wstring sMessage;
- -
1460 va_end(arg);
- -
1462 return sResult;
-
1463 } else
- -
1465 }
-
1466 }
-
1467 }
-
1468 sprintf(sResult, "msg %u", nId);
-
1469 return sResult;
-
1470 }
+
1472
+
+ +
1480 m_num(num),
+
1481 runtime_error(msg)
+
1482 {}
-
1471
-
1475 template <typename _Tn>
-
-
1476 class num_runtime_error : public std::runtime_error
-
1477 {
-
1478 public:
-
1479 typedef _Tn error_type;
-
1480
-
1481 public:
-
- -
1489 m_num(num),
-
1490 runtime_error(msg)
-
1491 {}
+
1483
+
+ +
1488 {
+
1489 return m_num;
+
1490 }
-
1492
-
- -
1500 m_num(num),
-
1501 runtime_error(msg)
-
1502 {}
+
1491
+
1492 protected:
+ +
1494 };
-
1503
+
1495
+
+ +
1500 {
+
1501 public:
- -
1508 {
-
1509 return m_num;
-
1510 }
+ +
1508 {}
-
1511
-
1512 protected:
- -
1514 };
+
1509
+
+
1516 win_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<DWORD>(num, msg + ": " + message(num))
+
1517 {}
-
1515
-
- -
1520 {
-
1521 public:
-
- -
1528 {}
+
1518
+
+ +
1526 {}
-
1529
-
-
1536 win_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<DWORD>(num, msg + ": " + message(num))
-
1537 {}
+
1527
+ -
1538
-
- -
1546 {}
+
1533
+
+
1539 win_runtime_error(_In_ const std::string& msg) : num_runtime_error<DWORD>(GetLastError(), msg + ": " + message(GetLastError()))
+
1540 {}
-
1547
-
- -
1552 {}
+
1541
+
+ +
1548 {}
-
1553
-
-
1559 win_runtime_error(_In_ const std::string& msg) : num_runtime_error<DWORD>(GetLastError(), msg + ": " + message(GetLastError()))
-
1560 {}
+
1549
+
1550 protected:
+
+ +
1558 {
+ +
1560 std::wstring wstr;
+ +
1562 // Stock Windows error messages contain CRLF. Well... Trim all the trailing white space.
+
1563 wstr.erase(wstr.find_last_not_of(L" \t\n\r\f\v") + 1);
+
1564 } else
+
1565 sprintf(wstr, num >= 0x10000 ? L"Error 0x%X" : L"Error %u", num);
+
1566 std::string str;
+ + +
1569 return str;
+
1570 }
-
1561
-
- -
1568 {}
+
1571 };
-
1569
-
1570 protected:
-
- -
1578 {
- -
1580 std::wstring wstr;
- -
1582 // Stock Windows error messages contain CRLF. Well... Trim all the trailing white space.
-
1583 wstr.erase(wstr.find_last_not_of(L" \t\n\r\f\v") + 1);
-
1584 } else
-
1585 sprintf(wstr, num >= 0x10000 ? L"Error 0x%X" : L"Error %u", num);
-
1586 std::string str;
- - -
1589 return str;
-
1590 }
+
1572
+
1574
+
1577
+
1581 template<class _Elem, class _Traits, class _Ax>
+
+
1582 class basic_string_printf : public std::basic_string<_Elem, _Traits, _Ax>
+
1583 {
+
1584 public:
+
1587
+
+ +
1594 {
+
1595 va_list arg;
+ +
1597 vsprintf(*this, format, arg);
+
1598 va_end(arg);
+
1599 }
-
1591 };
+
1600
+
1602
+
1605
+
+ +
1613 {
+
1614 _Myt format;
+
1615 ATLENSURE(format.LoadString(hInstance, nFormatID));
+
1616
+
1617 va_list arg;
+ +
1619 vsprintf(*this, format, arg);
+
1620 va_end(arg);
+
1621 }
-
1592
-
1594
-
1597
-
1601 template<class _Elem, class _Traits, class _Ax>
-
-
1602 class basic_string_printf : public std::basic_string<_Elem, _Traits, _Ax>
-
1603 {
-
1604 public:
-
1607
-
- -
1614 {
-
1615 va_list arg;
- -
1617 vsprintf(*this, format, arg);
-
1618 va_end(arg);
-
1619 }
-
-
1620
1622
-
1625
-
- -
1633 {
-
1634 _Myt format;
-
1635 ATLENSURE(format.LoadString(hInstance, nFormatID));
-
1636
-
1637 va_list arg;
- -
1639 vsprintf(*this, format, arg);
-
1640 va_end(arg);
-
1641 }
+
+ +
1631 {
+
1632 _Myt format;
+ +
1634
+
1635 va_list arg;
+ +
1637 vsprintf(*this, format, arg);
+
1638 va_end(arg);
+
1639 }
-
1642
-
- -
1651 {
-
1652 _Myt format;
- -
1654
-
1655 va_list arg;
- -
1657 vsprintf(*this, format, arg);
-
1658 va_end(arg);
-
1659 }
+
1640
+
1642 };
-
1660
-
1662 };
+
1643
+ +
1648
+ +
1653
+
1657#ifdef _UNICODE
+ +
1659#else
+ +
1661#endif
+
1662
+
1666 template<class _Elem, class _Traits, class _Ax>
+
+
1667 class basic_string_msg : public std::basic_string<_Elem, _Traits, _Ax>
+
1668 {
+
1669 public:
+
1672
+
+ +
1679 {
+
1680 va_list arg;
+ + +
1683 va_end(arg);
+
1684 }
-
1663
- -
1668
- -
1673
-
1677#ifdef _UNICODE
- -
1679#else
- -
1681#endif
-
1682
-
1686 template<class _Elem, class _Traits, class _Ax>
-
-
1687 class basic_string_msg : public std::basic_string<_Elem, _Traits, _Ax>
-
1688 {
-
1689 public:
-
1692
-
- -
1699 {
-
1700 va_list arg;
- - -
1703 va_end(arg);
-
1704 }
+
1685
+
1687
+
1690
+
+ +
1698 {
+
1699 _Myt format(GetManager());
+
1700 ATLENSURE(format.LoadString(hInstance, nFormatID));
+
1701
+
1702 va_list arg;
+ + +
1705 va_end(arg);
+
1706 }
-
1705
1707
-
1710
-
- -
1718 {
-
1719 _Myt format(GetManager());
-
1720 ATLENSURE(format.LoadString(hInstance, nFormatID));
-
1721
-
1722 va_list arg;
- - -
1725 va_end(arg);
-
1726 }
+
+ +
1716 {
+
1717 _Myt format(GetManager());
+ +
1719
+
1720 va_list arg;
+ + +
1723 va_end(arg);
+
1724 }
+
1725
1727
-
- -
1736 {
-
1737 _Myt format(GetManager());
- -
1739
-
1740 va_list arg;
- - -
1743 va_end(arg);
-
1744 }
+ +
1737
+ -
1745
1747
1757
-
1767
- -
1777
-
- -
1784 {
- -
1786 }
+
1768
+ +
1773
+ +
1778
+
1782#ifdef _UNICODE
+
1783 typedef wstring_msg tstring_msg;
+
1784#else
+ +
1786#endif
+
1787
+
1791 template<class _Elem, class _Traits, class _Ax>
+
+
1792 class basic_string_guid : public std::basic_string<_Elem, _Traits, _Ax>
+
1793 {
+
1794 public:
+
1797
+
+ +
1805 {
+ +
1807 guid.Data1,
+
1808 guid.Data2,
+
1809 guid.Data3,
+
1810 guid.Data4[0], guid.Data4[1],
+
1811 guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
+
1812 }
-
1787 };
+
1813
+
1815 };
-
1788
- -
1793
- -
1798
-
1802#ifdef _UNICODE
-
1803 typedef wstring_msg tstring_msg;
-
1804#else
- -
1806#endif
-
1807
-
1811 template<class _Elem, class _Traits, class _Ax>
-
-
1812 class basic_string_guid : public std::basic_string<_Elem, _Traits, _Ax>
-
1813 {
-
1814 public:
-
1817
-
- -
1825 {
- -
1827 guid.Data1,
-
1828 guid.Data2,
-
1829 guid.Data3,
-
1830 guid.Data4[0], guid.Data4[1],
-
1831 guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
-
1832 }
+
1816
+
+
1820 class string_guid : public basic_string_guid<char, std::char_traits<char>, std::allocator<char> >
+
1821 {
+
1822 public:
+
1825
+
+ +
1832 basic_string_guid<char, std::char_traits<char>, std::allocator<char> >(guid, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}")
+
1833 {}
-
1833
-
1835 };
+
1834
+
1836 };
-
1836
-
-
1840 class string_guid : public basic_string_guid<char, std::char_traits<char>, std::allocator<char> >
-
1841 {
-
1842 public:
-
1845
-
- -
1852 basic_string_guid<char, std::char_traits<char>, std::allocator<char> >(guid, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}")
-
1853 {}
+
1837
+
+
1841 class wstring_guid : public basic_string_guid<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >
+
1842 {
+
1843 public:
+
1846
+
+ +
1853 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}")
+
1854 {}
-
1854
-
1856 };
+
1855
+
1857 };
-
1857
-
-
1861 class wstring_guid : public basic_string_guid<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >
-
1862 {
-
1863 public:
-
1866
-
- -
1873 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}")
-
1874 {}
-
-
1875
-
1877 };
-
-
1878
-
1882#ifdef _UNICODE
-
1883 typedef wstring_guid tstring_guid;
-
1884#else
- -
1886#endif
-
1887
+
1858
+
1862#ifdef _UNICODE
+
1863 typedef wstring_guid tstring_guid;
+
1864#else
+ +
1866#endif
+
1867
+
1869
+
1872
+
1873 // winstd::sanitizing_allocator::destroy() member generates _Ptr parameter not used warning for primitive datatypes _Ty.
+
1874 #pragma warning(push)
+
1875 #pragma warning(disable: 4100)
+
1876
+
1884 template<class _Ty>
+
+
1885 class sanitizing_allocator : public std::allocator<_Ty>
+
1886 {
+
1887 public:
+
1888 typedef std::allocator<_Ty> _Mybase;
1889
-
1892
-
1893 // winstd::sanitizing_allocator::destroy() member generates _Ptr parameter not used warning for primitive datatypes _Ty.
-
1894 #pragma warning(push)
-
1895 #pragma warning(disable: 4100)
-
1896
-
1904 template<class _Ty>
-
-
1905 class sanitizing_allocator : public std::allocator<_Ty>
-
1906 {
-
1907 public:
-
1908 typedef std::allocator<_Ty> _Mybase;
-
1909
-
1913 template<class _Other>
-
-
1914 struct rebind
-
1915 {
- -
1917 };
+
1893 template<class _Other>
+
+
1894 struct rebind
+
1895 {
+ +
1897 };
-
1918
-
- -
1923 {}
+
1898
+ -
1924
-
- -
1929 {}
+
1904
+ +
1910
+
1914 template<class _Other>
+ +
1917
+
+
1921 void deallocate(_In_ _Ty* const _Ptr, _In_ const std::size_t _Count)
+
1922 {
+
1923 // Sanitize then free.
+
1924 SecureZeroMemory(_Ptr, sizeof(_Ty) * _Count);
+
1925 _Mybase::deallocate(_Ptr, _Count);
+
1926 }
+
+
1927 };
+
+
1928
+
1929 #pragma warning(pop)
1930
-
1934 template<class _Other>
- -
1937
-
-
1941 void deallocate(_In_ _Ty* const _Ptr, _In_ const std::size_t _Count)
-
1942 {
-
1943 // Sanitize then free.
-
1944 SecureZeroMemory(_Ptr, sizeof(_Ty) * _Count);
-
1945 _Mybase::deallocate(_Ptr, _Count);
-
1946 }
-
-
1947 };
-
+
1938 typedef std::basic_string<char, std::char_traits<char>, sanitizing_allocator<char> > sanitizing_string;
+
1939
+
1947 typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, sanitizing_allocator<wchar_t> > sanitizing_wstring;
1948
-
1949 #pragma warning(pop)
-
1950
-
1958 typedef std::basic_string<char, std::char_traits<char>, sanitizing_allocator<char> > sanitizing_string;
-
1959
-
1967 typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, sanitizing_allocator<wchar_t> > sanitizing_wstring;
-
1968
-
1972#ifdef _UNICODE
- -
1974#else
- -
1976#endif
-
1977
-
1981 template<size_t N>
-
- -
1983 {
-
1984 public:
-
- -
1989 {
-
1990 ZeroMemory(m_data, N);
-
1991 }
+
1952#ifdef _UNICODE
+ +
1954#else
+ +
1956#endif
+
1957
+
1961 template<size_t N>
+
+ +
1963 {
+
1964 public:
+
+ +
1969 {
+
1970 ZeroMemory(m_data, N);
+
1971 }
-
1992
-
- -
1997 {
-
1998 SecureZeroMemory(m_data, N);
-
1999 }
+
1972
+
+ +
1977 {
+
1978 SecureZeroMemory(m_data, N);
+
1979 }
-
2000
-
2001 public:
-
2002 unsigned char m_data[N];
-
2003 };
+
1980
+
1981 public:
+
1982 unsigned char m_data[N];
+
1983 };
-
2004
-
2006}
-
Base template class to support converting GUID to string.
Definition Common.h:1813
-
basic_string_guid(const GUID &guid, const _Elem *format)
Initializes a new string and formats its contents to string representation of given GUID.
Definition Common.h:1824
-
Base template class to support string formatting using FormatMessage() style templates.
Definition Common.h:1688
-
basic_string_msg(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, DWORD_PTR *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition Common.h:1763
-
basic_string_msg(DWORD dwFlags, LPCTSTR pszFormat, va_list *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition Common.h:1773
-
basic_string_msg(HINSTANCE hInstance, WORD wLanguageID, UINT nFormatID,...)
Initializes a new string and formats its contents using FormatMessage() style template in resources.
Definition Common.h:1735
-
basic_string_msg(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, va_list *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition Common.h:1753
-
basic_string_msg(const _Elem *format,...)
Initializes a new string and formats its contents using FormatMessage() style template.
Definition Common.h:1698
-
basic_string_msg(HINSTANCE hInstance, UINT nFormatID,...)
Initializes a new string and formats its contents using FormatMessage() style template in resources.
Definition Common.h:1717
-
basic_string_msg(DWORD dwFlags, LPCTSTR pszFormat, DWORD_PTR *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition Common.h:1783
-
Base template class to support string formatting using printf() style templates.
Definition Common.h:1603
-
basic_string_printf(const _Elem *format,...)
Initializes a new string and formats its contents using printf() style template.
Definition Common.h:1613
-
basic_string_printf(HINSTANCE hInstance, WORD wLanguageID, UINT nFormatID,...)
Initializes a new string and formats its contents using printf() style template in resources.
Definition Common.h:1650
-
basic_string_printf(HINSTANCE hInstance, UINT nFormatID,...)
Initializes a new string and formats its contents using printf() style template in resources.
Definition Common.h:1632
-
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition Common.h:1283
+
1984
+
1986}
+
Base template class to support converting GUID to string.
Definition Common.h:1793
+
basic_string_guid(const GUID &guid, const _Elem *format)
Initializes a new string and formats its contents to string representation of given GUID.
Definition Common.h:1804
+
Base template class to support string formatting using FormatMessage() style templates.
Definition Common.h:1668
+
basic_string_msg(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, DWORD_PTR *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition Common.h:1743
+
basic_string_msg(DWORD dwFlags, LPCTSTR pszFormat, va_list *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition Common.h:1753
+
basic_string_msg(HINSTANCE hInstance, WORD wLanguageID, UINT nFormatID,...)
Initializes a new string and formats its contents using FormatMessage() style template in resources.
Definition Common.h:1715
+
basic_string_msg(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, va_list *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition Common.h:1733
+
basic_string_msg(const _Elem *format,...)
Initializes a new string and formats its contents using FormatMessage() style template.
Definition Common.h:1678
+
basic_string_msg(HINSTANCE hInstance, UINT nFormatID,...)
Initializes a new string and formats its contents using FormatMessage() style template in resources.
Definition Common.h:1697
+
basic_string_msg(DWORD dwFlags, LPCTSTR pszFormat, DWORD_PTR *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition Common.h:1763
+
Base template class to support string formatting using printf() style templates.
Definition Common.h:1583
+
basic_string_printf(const _Elem *format,...)
Initializes a new string and formats its contents using printf() style template.
Definition Common.h:1593
+
basic_string_printf(HINSTANCE hInstance, WORD wLanguageID, UINT nFormatID,...)
Initializes a new string and formats its contents using printf() style template in resources.
Definition Common.h:1630
+
basic_string_printf(HINSTANCE hInstance, UINT nFormatID,...)
Initializes a new string and formats its contents using printf() style template in resources.
Definition Common.h:1612
+
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition Common.h:1263
virtual handle_type duplicate_internal(handle_type h) const =0
Abstract member function that must be implemented by child classes to do the actual object handle dup...
-
dplhandle< handle_type, INVAL > & operator=(handle_type h) noexcept
Attaches already available object handle.
Definition Common.h:1320
-
handle_type duplicate() const
Duplicates and returns a new object handle.
Definition Common.h:1368
-
dplhandle< handle_type, INVAL > & operator=(dplhandle< handle_type, INVAL > &&h) noexcept
Moves the object.
Definition Common.h:1357
-
void attach_duplicated(handle_type h)
Duplicates an object handle and sets a new object handle.
Definition Common.h:1378
-
dplhandle(handle_type h) noexcept
Initializes a new class instance with an already available object handle.
Definition Common.h:1296
-
dplhandle< handle_type, INVAL > & operator=(const dplhandle< handle_type, INVAL > &h) noexcept
Duplicates the object.
Definition Common.h:1331
-
dplhandle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition Common.h:1288
-
Context scope automatic GlobalAlloc (un)access.
Definition Common.h:814
-
HGLOBAL m_h
memory handle
Definition Common.h:850
-
virtual ~globalmem_accessor()
Decrements the lock count associated with a memory object.
Definition Common.h:836
-
T * m_data
memory pointer
Definition Common.h:851
-
T * data() const noexcept
Return data pointer.
Definition Common.h:844
-
globalmem_accessor(HGLOBAL hMem)
Locks a global memory object and returns a pointer to the first byte of the object's memory block.
Definition Common.h:824
-
Base abstract template class to support generic object handle keeping.
Definition Common.h:1020
-
handle_type *& operator*() const
Returns the object handle value when the object handle is a pointer to a value (class,...
Definition Common.h:1108
+
dplhandle< handle_type, INVAL > & operator=(handle_type h) noexcept
Attaches already available object handle.
Definition Common.h:1300
+
handle_type duplicate() const
Duplicates and returns a new object handle.
Definition Common.h:1348
+
dplhandle< handle_type, INVAL > & operator=(dplhandle< handle_type, INVAL > &&h) noexcept
Moves the object.
Definition Common.h:1337
+
void attach_duplicated(handle_type h)
Duplicates an object handle and sets a new object handle.
Definition Common.h:1358
+
dplhandle(handle_type h) noexcept
Initializes a new class instance with an already available object handle.
Definition Common.h:1276
+
dplhandle< handle_type, INVAL > & operator=(const dplhandle< handle_type, INVAL > &h) noexcept
Duplicates the object.
Definition Common.h:1311
+
dplhandle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition Common.h:1268
+
Context scope automatic GlobalAlloc (un)access.
Definition Common.h:794
+
HGLOBAL m_h
memory handle
Definition Common.h:830
+
virtual ~globalmem_accessor()
Decrements the lock count associated with a memory object.
Definition Common.h:816
+
T * m_data
memory pointer
Definition Common.h:831
+
T * data() const noexcept
Return data pointer.
Definition Common.h:824
+
globalmem_accessor(HGLOBAL hMem)
Locks a global memory object and returns a pointer to the first byte of the object's memory block.
Definition Common.h:804
+
Base abstract template class to support generic object handle keeping.
Definition Common.h:1000
+
handle_type *& operator*() const
Returns the object handle value when the object handle is a pointer to a value (class,...
Definition Common.h:1088
virtual void free_internal() noexcept=0
Abstract member function that must be implemented by child classes to do the actual object destructio...
-
handle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition Common.h:1035
-
bool operator>=(handle_type h) const
Is handle greater than or equal to?
Definition Common.h:1184
-
handle_type operator->() const
Provides object handle member access when the object handle is a pointer to a class or struct.
Definition Common.h:1129
-
handle_type * operator&()
Returns the object handle reference.
Definition Common.h:1118
-
T handle_type
Datatype of the object handle this template class handles.
Definition Common.h:1025
-
handle(handle_type h) noexcept
Initializes a new class instance with an already available object handle.
Definition Common.h:1043
-
bool operator<(handle_type h) const
Is handle less than?
Definition Common.h:1158
-
handle< handle_type, INVAL > & operator=(handle_type h) noexcept
Attaches already available object handle.
Definition Common.h:1069
-
bool operator!() const
Tests if the object handle is invalid.
Definition Common.h:1145
-
handle< handle_type, INVAL > & operator=(handle< handle_type, INVAL > &&h) noexcept
Move assignment.
Definition Common.h:1081
-
bool operator!=(handle_type h) const
Is handle not equal to?
Definition Common.h:1210
-
void free()
Destroys the object.
Definition Common.h:1257
-
handle_type m_h
Object handle.
Definition Common.h:1272
-
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition Common.h:1235
-
bool operator==(handle_type h) const
Is handle equal to?
Definition Common.h:1223
-
handle(handle< handle_type, INVAL > &&h) noexcept
Move constructor.
Definition Common.h:1051
-
handle_type detach()
Dismisses the object handle from this class.
Definition Common.h:1247
-
bool operator>(handle_type h) const
Is handle greater than?
Definition Common.h:1197
-
bool operator<=(handle_type h) const
Is handle less than or equal to?
Definition Common.h:1171
-
Numerical runtime error.
Definition Common.h:1477
-
num_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition Common.h:1499
-
num_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition Common.h:1488
-
error_type number() const
Returns the error number.
Definition Common.h:1507
-
_Tn error_type
Error number type.
Definition Common.h:1479
-
error_type m_num
Numeric error code.
Definition Common.h:1513
-
std::unique_ptr< _Ty[], _Dx > & m_own
Original owner of the pointer.
Definition Common.h:990
-
ref_unique_ptr(ref_unique_ptr< _Ty[], _Dx > &&other)
Moves object.
Definition Common.h:953
-
virtual ~ref_unique_ptr()
Returns ownership of the pointer.
Definition Common.h:963
-
ref_unique_ptr(std::unique_ptr< _Ty[], _Dx > &owner) noexcept
Takes ownership of the pointer.
Definition Common.h:943
-
_Ty * m_ptr
Pointer.
Definition Common.h:991
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
-
std::unique_ptr< _Ty, _Dx > & m_own
Original owner of the pointer.
Definition Common.h:913
-
_Ty * m_ptr
Pointer.
Definition Common.h:914
-
ref_unique_ptr(ref_unique_ptr< _Ty, _Dx > &&other)
Moves object.
Definition Common.h:876
-
~ref_unique_ptr()
Returns ownership of the pointer.
Definition Common.h:886
-
ref_unique_ptr(std::unique_ptr< _Ty, _Dx > &owner)
Takes ownership of the pointer.
Definition Common.h:866
-
An allocator template that sanitizes each memory block before it is destroyed or reallocated.
Definition Common.h:1906
-
sanitizing_allocator(const sanitizing_allocator< _Ty > &_Othr)
Construct by copying.
Definition Common.h:1928
-
sanitizing_allocator(const sanitizing_allocator< _Other > &_Othr) noexcept
Construct from a related allocator.
Definition Common.h:1935
-
void deallocate(_Ty *const _Ptr, const std::size_t _Count)
Deallocate object at _Ptr sanitizing its content first.
Definition Common.h:1941
-
std::allocator< _Ty > _Mybase
Base type.
Definition Common.h:1908
-
sanitizing_allocator() noexcept
Construct default allocator.
Definition Common.h:1922
-
Sanitizing BLOB.
Definition Common.h:1983
-
sanitizing_blob()
Constructs uninitialized BLOB.
Definition Common.h:1988
-
~sanitizing_blob()
Sanitizes BLOB.
Definition Common.h:1996
-
Single-byte character implementation of a class to support converting GUID to string.
Definition Common.h:1841
-
string_guid(const GUID &guid)
Initializes a new string and formats its contents to string representation of given GUID.
Definition Common.h:1851
-
Windows runtime error.
Definition Common.h:1520
-
win_runtime_error(const char *msg)
Constructs an exception using GetLastError()
Definition Common.h:1567
-
win_runtime_error(error_type num, const char *msg)
Constructs an exception.
Definition Common.h:1545
-
win_runtime_error(error_type num)
Constructs an exception.
Definition Common.h:1527
-
win_runtime_error()
Constructs an exception using GetLastError()
Definition Common.h:1551
-
static std::string message(error_type num, DWORD dwLanguageId=0)
Returns a user-readable Windows error message. As std::exception messages may only be char*,...
Definition Common.h:1577
-
win_runtime_error(const std::string &msg)
Constructs an exception using GetLastError()
Definition Common.h:1559
-
win_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition Common.h:1536
-
Wide character implementation of a class to support converting GUID to string.
Definition Common.h:1862
-
wstring_guid(const GUID &guid)
Initializes a new string and formats its contents to string representation of given GUID.
Definition Common.h:1872
-
std::string load_msg_from_res(HMODULE hModule, UINT nId, WORD wLanguage)
Loads exception message string from resources and converts it to UTF-8.
Definition Common.h:1412
-
std::string fmt_msg_from_res(HMODULE hModule, UINT nId, WORD wLanguage,...)
Loads exception message sprintf template from resources, formats it and converts it to UTF-8.
Definition Common.h:1443
+
handle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition Common.h:1015
+
bool operator>=(handle_type h) const
Is handle greater than or equal to?
Definition Common.h:1164
+
handle_type operator->() const
Provides object handle member access when the object handle is a pointer to a class or struct.
Definition Common.h:1109
+
handle_type * operator&()
Returns the object handle reference.
Definition Common.h:1098
+
T handle_type
Datatype of the object handle this template class handles.
Definition Common.h:1005
+
handle(handle_type h) noexcept
Initializes a new class instance with an already available object handle.
Definition Common.h:1023
+
bool operator<(handle_type h) const
Is handle less than?
Definition Common.h:1138
+
handle< handle_type, INVAL > & operator=(handle_type h) noexcept
Attaches already available object handle.
Definition Common.h:1049
+
bool operator!() const
Tests if the object handle is invalid.
Definition Common.h:1125
+
handle< handle_type, INVAL > & operator=(handle< handle_type, INVAL > &&h) noexcept
Move assignment.
Definition Common.h:1061
+
bool operator!=(handle_type h) const
Is handle not equal to?
Definition Common.h:1190
+
void free()
Destroys the object.
Definition Common.h:1237
+
handle_type m_h
Object handle.
Definition Common.h:1252
+
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition Common.h:1215
+
bool operator==(handle_type h) const
Is handle equal to?
Definition Common.h:1203
+
handle(handle< handle_type, INVAL > &&h) noexcept
Move constructor.
Definition Common.h:1031
+
handle_type detach()
Dismisses the object handle from this class.
Definition Common.h:1227
+
bool operator>(handle_type h) const
Is handle greater than?
Definition Common.h:1177
+
bool operator<=(handle_type h) const
Is handle less than or equal to?
Definition Common.h:1151
+
Numerical runtime error.
Definition Common.h:1457
+
num_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition Common.h:1479
+
num_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition Common.h:1468
+
error_type number() const
Returns the error number.
Definition Common.h:1487
+
_Tn error_type
Error number type.
Definition Common.h:1459
+
error_type m_num
Numeric error code.
Definition Common.h:1493
+
std::unique_ptr< _Ty[], _Dx > & m_own
Original owner of the pointer.
Definition Common.h:970
+
ref_unique_ptr(ref_unique_ptr< _Ty[], _Dx > &&other)
Moves object.
Definition Common.h:933
+
virtual ~ref_unique_ptr()
Returns ownership of the pointer.
Definition Common.h:943
+
ref_unique_ptr(std::unique_ptr< _Ty[], _Dx > &owner) noexcept
Takes ownership of the pointer.
Definition Common.h:923
+
_Ty * m_ptr
Pointer.
Definition Common.h:971
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
+
std::unique_ptr< _Ty, _Dx > & m_own
Original owner of the pointer.
Definition Common.h:893
+
_Ty * m_ptr
Pointer.
Definition Common.h:894
+
ref_unique_ptr(ref_unique_ptr< _Ty, _Dx > &&other)
Moves object.
Definition Common.h:856
+
~ref_unique_ptr()
Returns ownership of the pointer.
Definition Common.h:866
+
ref_unique_ptr(std::unique_ptr< _Ty, _Dx > &owner)
Takes ownership of the pointer.
Definition Common.h:846
+
An allocator template that sanitizes each memory block before it is destroyed or reallocated.
Definition Common.h:1886
+
sanitizing_allocator(const sanitizing_allocator< _Ty > &_Othr)
Construct by copying.
Definition Common.h:1908
+
sanitizing_allocator(const sanitizing_allocator< _Other > &_Othr) noexcept
Construct from a related allocator.
Definition Common.h:1915
+
void deallocate(_Ty *const _Ptr, const std::size_t _Count)
Deallocate object at _Ptr sanitizing its content first.
Definition Common.h:1921
+
std::allocator< _Ty > _Mybase
Base type.
Definition Common.h:1888
+
sanitizing_allocator() noexcept
Construct default allocator.
Definition Common.h:1902
+
Sanitizing BLOB.
Definition Common.h:1963
+
sanitizing_blob()
Constructs uninitialized BLOB.
Definition Common.h:1968
+
~sanitizing_blob()
Sanitizes BLOB.
Definition Common.h:1976
+
Single-byte character implementation of a class to support converting GUID to string.
Definition Common.h:1821
+
string_guid(const GUID &guid)
Initializes a new string and formats its contents to string representation of given GUID.
Definition Common.h:1831
+
Windows runtime error.
Definition Common.h:1500
+
win_runtime_error(const char *msg)
Constructs an exception using GetLastError()
Definition Common.h:1547
+
win_runtime_error(error_type num, const char *msg)
Constructs an exception.
Definition Common.h:1525
+
win_runtime_error(error_type num)
Constructs an exception.
Definition Common.h:1507
+
win_runtime_error()
Constructs an exception using GetLastError()
Definition Common.h:1531
+
static std::string message(error_type num, DWORD dwLanguageId=0)
Returns a user-readable Windows error message. As std::exception messages may only be char*,...
Definition Common.h:1557
+
win_runtime_error(const std::string &msg)
Constructs an exception using GetLastError()
Definition Common.h:1539
+
win_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition Common.h:1516
+
Wide character implementation of a class to support converting GUID to string.
Definition Common.h:1842
+
wstring_guid(const GUID &guid)
Initializes a new string and formats its contents to string representation of given GUID.
Definition Common.h:1852
+
std::string load_msg_from_res(HMODULE hModule, UINT nId, WORD wLanguage)
Loads exception message string from resources and converts it to UTF-8.
Definition Common.h:1392
+
std::string fmt_msg_from_res(HMODULE hModule, UINT nId, WORD wLanguage,...)
Loads exception message sprintf template from resources, formats it and converts it to UTF-8.
Definition Common.h:1423
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition Common.h:67
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition Common.h:94
-
std::string tstring
Multi-byte / Wide-character string (according to _UNICODE)
Definition Common.h:723
-
ref_unique_ptr< _Ty, _Dx > get_ptr(std::unique_ptr< _Ty, _Dx > &owner) noexcept
Helper function template for returning pointers to std::unique_ptr.
Definition Common.h:925
+
std::string tstring
Multi-byte / Wide-character string (according to _UNICODE)
Definition Common.h:703
+
ref_unique_ptr< _Ty, _Dx > get_ptr(std::unique_ptr< _Ty, _Dx > &owner) noexcept
Helper function template for returning pointers to std::unique_ptr.
Definition Common.h:905
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition Common.h:75
-
std::basic_string< wchar_t, std::char_traits< wchar_t >, sanitizing_allocator< wchar_t > > sanitizing_wstring
A sanitizing variant of std::wstring.
Definition Common.h:1967
-
sanitizing_string sanitizing_tstring
Multi-byte / Wide-character sanitizing string (according to _UNICODE)
Definition Common.h:1975
-
std::basic_string< char, std::char_traits< char >, sanitizing_allocator< char > > sanitizing_string
A sanitizing variant of std::string.
Definition Common.h:1958
-
static int SecureWideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::basic_string< char, _Traits, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily f...
Definition Common.h:418
-
basic_string_printf< wchar_t, std::char_traits< wchar_t >, std::allocator< wchar_t > > wstring_printf
Wide character implementation of a class to support string formatting using printf() style templates.
Definition Common.h:1672
-
static int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::basic_string< wchar_t, _Traits, _Ax > &sWideCharStr) noexcept
Maps a character string to a UTF-16 (wide character) std::wstring. The character string is not necess...
Definition Common.h:510
-
static DWORD FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, std::basic_string< wchar_t, _Traits, _Ax > &str, va_list *Arguments)
Formats a message string.
Definition Common.h:699
-
static DWORD FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, std::basic_string< char, _Traits, _Ax > &str, va_list *Arguments)
Formats a message string.
Definition Common.h:684
-
string_guid tstring_guid
Multi-byte / Wide-character string GUID (according to _UNICODE)
Definition Common.h:1885
-
basic_string_msg< wchar_t, std::char_traits< wchar_t >, std::allocator< wchar_t > > wstring_msg
Wide character implementation of a class to support string formatting using FormatMessage() style tem...
Definition Common.h:1797
-
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition Common.h:288
-
basic_string_printf< char, std::char_traits< char >, std::allocator< char > > string_printf
Single-byte character implementation of a class to support string formatting using printf() style tem...
Definition Common.h:1667
-
static int vsnprintf(char *str, size_t capacity, const char *format, va_list arg)
Formats string using printf().
Definition Common.h:257
-
static int SecureMultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::basic_string< wchar_t, _Traits, _Ax > &sWideCharStr) noexcept
Maps a character string to a UTF-16 (wide character) std::wstring. The character string is not necess...
Definition Common.h:592
-
string_printf tstring_printf
Multi-byte / Wide-character formatted string (according to _UNICODE)
Definition Common.h:1680
-
static int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::basic_string< char, _Traits, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily f...
Definition Common.h:336
-
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition Common.h:321
-
basic_string_msg< char, std::char_traits< char >, std::allocator< char > > string_msg
Single-byte character implementation of a class to support string formatting using FormatMessage() st...
Definition Common.h:1792
-
string_msg tstring_msg
Multi-byte / Wide-character formatted string (according to _UNICODE)
Definition Common.h:1805
-
static const T invalid
Invalid handle value.
Definition Common.h:1030
-
Deleter for unique_ptr using GlobalFree.
Definition Common.h:792
-
GlobalFree_delete()
Default construct.
Definition Common.h:796
-
void operator()(HGLOBAL _Ptr) const
Delete a pointer.
Definition Common.h:803
-
LocalFree_delete() noexcept
Default construct.
Definition Common.h:766
-
LocalFree_delete< _Ty > _Myt
This type.
Definition Common.h:761
-
void operator()(_Other *) const
Delete a pointer of another type.
Definition Common.h:782
-
void operator()(_Ty *_Ptr) const noexcept
Delete a pointer.
Definition Common.h:771
-
Deleter for unique_ptr using LocalFree.
Definition Common.h:731
-
LocalFree_delete< _Ty > _Myt
This type.
Definition Common.h:732
-
LocalFree_delete(const LocalFree_delete< _Ty2 > &)
Construct from another LocalFree_delete.
Definition Common.h:742
-
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition Common.h:749
-
LocalFree_delete()
Default construct.
Definition Common.h:737
-
Convert this type to sanitizing_allocator<_Other>
Definition Common.h:1915
-
sanitizing_allocator< _Other > other
Other type.
Definition Common.h:1916
+
std::basic_string< wchar_t, std::char_traits< wchar_t >, sanitizing_allocator< wchar_t > > sanitizing_wstring
A sanitizing variant of std::wstring.
Definition Common.h:1947
+
sanitizing_string sanitizing_tstring
Multi-byte / Wide-character sanitizing string (according to _UNICODE)
Definition Common.h:1955
+
std::basic_string< char, std::char_traits< char >, sanitizing_allocator< char > > sanitizing_string
A sanitizing variant of std::string.
Definition Common.h:1938
+
static int SecureWideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::basic_string< char, _Traits, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily f...
Definition Common.h:405
+
basic_string_printf< wchar_t, std::char_traits< wchar_t >, std::allocator< wchar_t > > wstring_printf
Wide character implementation of a class to support string formatting using printf() style templates.
Definition Common.h:1652
+
static int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::basic_string< wchar_t, _Traits, _Ax > &sWideCharStr) noexcept
Maps a character string to a UTF-16 (wide character) std::wstring. The character string is not necess...
Definition Common.h:494
+
static DWORD FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, std::basic_string< wchar_t, _Traits, _Ax > &str, va_list *Arguments)
Formats a message string.
Definition Common.h:679
+
static DWORD FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, std::basic_string< char, _Traits, _Ax > &str, va_list *Arguments)
Formats a message string.
Definition Common.h:664
+
string_guid tstring_guid
Multi-byte / Wide-character string GUID (according to _UNICODE)
Definition Common.h:1865
+
basic_string_msg< wchar_t, std::char_traits< wchar_t >, std::allocator< wchar_t > > wstring_msg
Wide character implementation of a class to support string formatting using FormatMessage() style tem...
Definition Common.h:1777
+
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition Common.h:271
+
basic_string_printf< char, std::char_traits< char >, std::allocator< char > > string_printf
Single-byte character implementation of a class to support string formatting using printf() style tem...
Definition Common.h:1647
+
static int vsnprintf(wchar_t *str, size_t capacity, const wchar_t *format, va_list arg) noexcept
Formats string using printf().
Definition Common.h:256
+
static int SecureMultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::basic_string< wchar_t, _Traits, _Ax > &sWideCharStr) noexcept
Maps a character string to a UTF-16 (wide character) std::wstring. The character string is not necess...
Definition Common.h:575
+
string_printf tstring_printf
Multi-byte / Wide-character formatted string (according to _UNICODE)
Definition Common.h:1660
+
static int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::basic_string< char, _Traits, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily f...
Definition Common.h:324
+
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition Common.h:309
+
basic_string_msg< char, std::char_traits< char >, std::allocator< char > > string_msg
Single-byte character implementation of a class to support string formatting using FormatMessage() st...
Definition Common.h:1772
+
string_msg tstring_msg
Multi-byte / Wide-character formatted string (according to _UNICODE)
Definition Common.h:1785
+
static const T invalid
Invalid handle value.
Definition Common.h:1010
+
Deleter for unique_ptr using GlobalFree.
Definition Common.h:772
+
GlobalFree_delete()
Default construct.
Definition Common.h:776
+
void operator()(HGLOBAL _Ptr) const
Delete a pointer.
Definition Common.h:783
+
LocalFree_delete() noexcept
Default construct.
Definition Common.h:746
+
LocalFree_delete< _Ty > _Myt
This type.
Definition Common.h:741
+
void operator()(_Other *) const
Delete a pointer of another type.
Definition Common.h:762
+
void operator()(_Ty *_Ptr) const noexcept
Delete a pointer.
Definition Common.h:751
+
Deleter for unique_ptr using LocalFree.
Definition Common.h:711
+
LocalFree_delete< _Ty > _Myt
This type.
Definition Common.h:712
+
LocalFree_delete(const LocalFree_delete< _Ty2 > &)
Construct from another LocalFree_delete.
Definition Common.h:722
+
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition Common.h:729
+
LocalFree_delete()
Default construct.
Definition Common.h:717
+
Convert this type to sanitizing_allocator<_Other>
Definition Common.h:1895
+
sanitizing_allocator< _Other > other
Other type.
Definition Common.h:1896
diff --git a/_cred_8h_source.html b/_cred_8h_source.html index d5a6a56e..f3fe003c 100644 --- a/_cred_8h_source.html +++ b/_cred_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -112,193 +112,185 @@ $(function() { codefold.init(0); });
29 return TRUE;
30 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
31 // Allocate on heap and retry.
-
32 std::unique_ptr<char[]> buf(new char[dwSize]);
-
33 if (CredProtectA(fAsSelf, const_cast<LPSTR>(pszCredentials), cchCredentials, buf.get(), &dwSize, ProtectionType)) {
-
34 sProtectedCredentials.assign(buf.get(), dwSize - 1);
-
35 return TRUE;
-
36 }
-
37 }
-
38
-
39 return FALSE;
-
40}
+
32 sProtectedCredentials.resize(dwSize - 1);
+
33 if (CredProtectA(fAsSelf, const_cast<LPSTR>(pszCredentials), cchCredentials, &sProtectedCredentials[0], &dwSize, ProtectionType))
+
34 return TRUE;
+
35 }
+
36
+
37 return FALSE;
+
38}
-
41
-
47template<class _Traits, class _Ax>
-
-
48static BOOL CredProtectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType)
-
49{
-
50 wchar_t buf[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
51 DWORD dwSize = _countof(buf);
-
52
-
53 // Try with the stack buffer first.
-
54 if (CredProtectW(fAsSelf, const_cast<LPWSTR>(pszCredentials), cchCredentials, buf, &dwSize, ProtectionType)) {
-
55 // Copy from stack.
-
56 sProtectedCredentials.assign(buf, dwSize - 1);
-
57 return TRUE;
-
58 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
59 // Allocate on heap and retry.
-
60 std::unique_ptr<wchar_t[]> buf(new wchar_t[dwSize]);
-
61 if (CredProtectW(fAsSelf, const_cast<LPWSTR>(pszCredentials), cchCredentials, buf.get(), &dwSize, ProtectionType)) {
-
62 sProtectedCredentials.assign(buf.get(), dwSize - 1);
-
63 return TRUE;
-
64 }
-
65 }
-
66
-
67 return FALSE;
-
68}
+
39
+
45template<class _Traits, class _Ax>
+
+
46static BOOL CredProtectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType)
+
47{
+
48 wchar_t buf[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
49 DWORD dwSize = _countof(buf);
+
50
+
51 // Try with the stack buffer first.
+
52 if (CredProtectW(fAsSelf, const_cast<LPWSTR>(pszCredentials), cchCredentials, buf, &dwSize, ProtectionType)) {
+
53 // Copy from stack.
+
54 sProtectedCredentials.assign(buf, dwSize - 1);
+
55 return TRUE;
+
56 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
57 // Allocate on heap and retry.
+
58 sProtectedCredentials.resize(dwSize - 1);
+
59 if (CredProtectW(fAsSelf, const_cast<LPWSTR>(pszCredentials), cchCredentials, &sProtectedCredentials[0], &dwSize, ProtectionType))
+
60 return TRUE;
+
61 }
+
62
+
63 return FALSE;
+
64}
-
69
-
71template<class _Traits, class _Ax>
-
-
72static BOOL CredUnprotectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<char, _Traits, _Ax> &sCredentials)
-
73{
-
74 char buf[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
75 DWORD dwSize = _countof(buf);
-
76
-
77 // Try with the stack buffer first.
-
78 if (CredUnprotectA(fAsSelf, const_cast<LPSTR>(pszProtectedCredentials), cchCredentials, buf, &dwSize)) {
-
79 // Copy from stack.
-
80 sCredentials.assign(buf, dwSize);
-
81 return TRUE;
-
82 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
83 // Allocate on heap and retry.
-
84 std::unique_ptr<char[]> buf(new char[dwSize]);
-
85 if (CredUnprotectA(fAsSelf, const_cast<LPSTR>(pszProtectedCredentials), cchCredentials, buf.get(), &dwSize)) {
-
86 sCredentials.assign(buf.get(), dwSize);
-
87 return TRUE;
-
88 }
-
89 }
-
90
-
91 return FALSE;
-
92}
+
65
+
67template<class _Traits, class _Ax>
+
+
68static BOOL CredUnprotectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<char, _Traits, _Ax> &sCredentials)
+
69{
+
70 char buf[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
71 DWORD dwSize = _countof(buf);
+
72
+
73 // Try with the stack buffer first.
+
74 if (CredUnprotectA(fAsSelf, const_cast<LPSTR>(pszProtectedCredentials), cchCredentials, buf, &dwSize)) {
+
75 // Copy from stack.
+
76 sCredentials.assign(buf, dwSize);
+
77 return TRUE;
+
78 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
79 // Allocate on heap and retry.
+
80 sCredentials.resize(dwSize - 1);
+
81 if (CredUnprotectA(fAsSelf, const_cast<LPSTR>(pszProtectedCredentials), cchCredentials, &sCredentials[0], &dwSize))
+
82 return TRUE;
+
83 }
+
84
+
85 return FALSE;
+
86}
-
93
-
99template<class _Traits, class _Ax>
-
-
100static BOOL CredUnprotectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sCredentials)
-
101{
-
102 wchar_t buf[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
103 DWORD dwSize = _countof(buf);
-
104
-
105 // Try with the stack buffer first.
-
106 if (CredUnprotectW(fAsSelf, const_cast<LPWSTR>(pszProtectedCredentials), cchCredentials, buf, &dwSize)) {
-
107 // Copy from stack.
-
108 sCredentials.assign(buf, dwSize);
-
109 return TRUE;
-
110 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
111 // Allocate on heap and retry.
-
112 std::unique_ptr<wchar_t[]> buf(new wchar_t[dwSize]);
-
113 if (CredUnprotectW(fAsSelf, const_cast<LPWSTR>(pszProtectedCredentials), cchCredentials, buf.get(), &dwSize)) {
-
114 sCredentials.assign(buf.get(), dwSize);
-
115 return TRUE;
-
116 }
-
117 }
-
118
-
119 return FALSE;
-
120}
+
87
+
93template<class _Traits, class _Ax>
+
+
94static BOOL CredUnprotectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sCredentials)
+
95{
+
96 wchar_t buf[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
97 DWORD dwSize = _countof(buf);
+
98
+
99 // Try with the stack buffer first.
+
100 if (CredUnprotectW(fAsSelf, const_cast<LPWSTR>(pszProtectedCredentials), cchCredentials, buf, &dwSize)) {
+
101 // Copy from stack.
+
102 sCredentials.assign(buf, dwSize);
+
103 return TRUE;
+
104 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
105 // Allocate on heap and retry.
+
106 sCredentials.resize(dwSize - 1);
+
107 if (CredUnprotectW(fAsSelf, const_cast<LPWSTR>(pszProtectedCredentials), cchCredentials, &sCredentials[0], &dwSize))
+
108 return TRUE;
+
109 }
+
110
+
111 return FALSE;
+
112}
-
121
-
123
-
124namespace winstd
-
125{
-
128
-
-
132 template <class _Ty> struct CredFree_delete
-
133 {
- -
135
- -
140
-
144 template <class _Ty2> CredFree_delete(const CredFree_delete<_Ty2>&) {}
-
145
-
-
151 void operator()(_Ty *_Ptr) const
-
152 {
-
153 CredFree(_Ptr);
-
154 }
+
113
+
115
+
116namespace winstd
+
117{
+
120
+
+
124 template <class _Ty> struct CredFree_delete
+
125 {
+ +
127
+ +
132
+
136 template <class _Ty2> CredFree_delete(const CredFree_delete<_Ty2>&) {}
+
137
+
+
143 void operator()(_Ty *_Ptr) const
+
144 {
+
145 CredFree(_Ptr);
+
146 }
-
155 };
+
147 };
-
156
-
-
160 template <class _Ty> struct CredFree_delete<_Ty[]>
-
161 {
- -
163
- -
168
-
-
174 void operator()(_Ty *_Ptr) const noexcept
-
175 {
-
176 CredFree(_Ptr);
-
177 }
+
148
+
+
152 template <class _Ty> struct CredFree_delete<_Ty[]>
+
153 {
+ +
155
+ +
160
+
+
166 void operator()(_Ty *_Ptr) const noexcept
+
167 {
+
168 CredFree(_Ptr);
+
169 }
-
178
-
184 template<class _Other>
-
-
185 void operator()(_Other *) const
-
186 {
-
187 CredFree(_Ptr);
-
188 }
+
170
+
176 template<class _Other>
+
+
177 void operator()(_Other *) const
+
178 {
+
179 CredFree(_Ptr);
+
180 }
-
189 };
+
181 };
-
190
-
192}
-
193
-
196
-
197#pragma warning(push)
-
198#pragma warning(disable: 4505) // Don't warn on unused code
-
199
-
-
201static BOOL CredEnumerateA(_In_z_ LPCSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Inout_ std::unique_ptr<PCREDENTIALA[], winstd::CredFree_delete<PCREDENTIALA[]> > &cCredentials) noexcept
-
202{
-
203 PCREDENTIALA *pCredentials;
-
204 if (CredEnumerateA(Filter, Flags, Count, &pCredentials)) {
-
205 cCredentials.reset(pCredentials);
-
206 return TRUE;
-
207 }
-
208
-
209 return FALSE;
-
210}
+
182
+
184}
+
185
+
188
+
189#pragma warning(push)
+
190#pragma warning(disable: 4505) // Don't warn on unused code
+
191
+
+
193static BOOL CredEnumerateA(_In_z_ LPCSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Inout_ std::unique_ptr<PCREDENTIALA[], winstd::CredFree_delete<PCREDENTIALA[]> > &cCredentials) noexcept
+
194{
+
195 PCREDENTIALA *pCredentials;
+
196 if (CredEnumerateA(Filter, Flags, Count, &pCredentials)) {
+
197 cCredentials.reset(pCredentials);
+
198 return TRUE;
+
199 }
+
200
+
201 return FALSE;
+
202}
-
211
-
-
217static BOOL CredEnumerateW(_In_z_ LPCWSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Inout_ std::unique_ptr<PCREDENTIALW[], winstd::CredFree_delete<PCREDENTIALW[]> > &cCredentials) noexcept
-
218{
-
219 PCREDENTIALW *pCredentials;
-
220 if (CredEnumerateW(Filter, Flags, Count, &pCredentials)) {
-
221 cCredentials.reset(pCredentials);
-
222 return TRUE;
-
223 }
-
224
-
225 return FALSE;
-
226}
+
203
+
+
209static BOOL CredEnumerateW(_In_z_ LPCWSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Inout_ std::unique_ptr<PCREDENTIALW[], winstd::CredFree_delete<PCREDENTIALW[]> > &cCredentials) noexcept
+
210{
+
211 PCREDENTIALW *pCredentials;
+
212 if (CredEnumerateW(Filter, Flags, Count, &pCredentials)) {
+
213 cCredentials.reset(pCredentials);
+
214 return TRUE;
+
215 }
+
216
+
217 return FALSE;
+
218}
-
227
-
228#pragma warning(pop)
-
229
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
-
static BOOL CredUnprotectA(BOOL fAsSelf, LPCSTR pszProtectedCredentials, DWORD cchCredentials, std::basic_string< char, _Traits, _Ax > &sCredentials)
Decrypts credentials that were previously encrypted by using the CredProtect function.
Definition Cred.h:72
+
219
+
220#pragma warning(pop)
+
221
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
+
static BOOL CredUnprotectA(BOOL fAsSelf, LPCSTR pszProtectedCredentials, DWORD cchCredentials, std::basic_string< char, _Traits, _Ax > &sCredentials)
Decrypts credentials that were previously encrypted by using the CredProtect function.
Definition Cred.h:68
static BOOL CredProtectA(BOOL fAsSelf, LPCSTR pszCredentials, DWORD cchCredentials, std::basic_string< char, _Traits, _Ax > &sProtectedCredentials, CRED_PROTECTION_TYPE *ProtectionType)
Encrypts the specified credentials so that only the current security context can decrypt them.
Definition Cred.h:20
-
static BOOL CredEnumerateA(LPCSTR Filter, DWORD Flags, DWORD *Count, std::unique_ptr< PCREDENTIALA[], winstd::CredFree_delete< PCREDENTIALA[]> > &cCredentials) noexcept
Enumerates the credentials from the user's credential set. The credential set used is the one associa...
Definition Cred.h:201
-
static BOOL CredEnumerateW(LPCWSTR Filter, DWORD Flags, DWORD *Count, std::unique_ptr< PCREDENTIALW[], winstd::CredFree_delete< PCREDENTIALW[]> > &cCredentials) noexcept
Enumerates the credentials from the user's credential set. The credential set used is the one associa...
Definition Cred.h:217
-
static BOOL CredProtectW(BOOL fAsSelf, LPCWSTR pszCredentials, DWORD cchCredentials, std::basic_string< wchar_t, _Traits, _Ax > &sProtectedCredentials, CRED_PROTECTION_TYPE *ProtectionType)
Encrypts the specified credentials so that only the current security context can decrypt them.
Definition Cred.h:48
-
static BOOL CredUnprotectW(BOOL fAsSelf, LPCWSTR pszProtectedCredentials, DWORD cchCredentials, std::basic_string< wchar_t, _Traits, _Ax > &sCredentials)
Decrypts credentials that were previously encrypted by using the CredProtect function.
Definition Cred.h:100
+
static BOOL CredEnumerateA(LPCSTR Filter, DWORD Flags, DWORD *Count, std::unique_ptr< PCREDENTIALA[], winstd::CredFree_delete< PCREDENTIALA[]> > &cCredentials) noexcept
Enumerates the credentials from the user's credential set. The credential set used is the one associa...
Definition Cred.h:193
+
static BOOL CredEnumerateW(LPCWSTR Filter, DWORD Flags, DWORD *Count, std::unique_ptr< PCREDENTIALW[], winstd::CredFree_delete< PCREDENTIALW[]> > &cCredentials) noexcept
Enumerates the credentials from the user's credential set. The credential set used is the one associa...
Definition Cred.h:209
+
static BOOL CredProtectW(BOOL fAsSelf, LPCWSTR pszCredentials, DWORD cchCredentials, std::basic_string< wchar_t, _Traits, _Ax > &sProtectedCredentials, CRED_PROTECTION_TYPE *ProtectionType)
Encrypts the specified credentials so that only the current security context can decrypt them.
Definition Cred.h:46
+
static BOOL CredUnprotectW(BOOL fAsSelf, LPCWSTR pszProtectedCredentials, DWORD cchCredentials, std::basic_string< wchar_t, _Traits, _Ax > &sCredentials)
Decrypts credentials that were previously encrypted by using the CredProtect function.
Definition Cred.h:94
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition Common.h:94
-
CredFree_delete< _Ty > _Myt
This type.
Definition Cred.h:162
-
CredFree_delete()
Default construct.
Definition Cred.h:167
-
void operator()(_Other *) const
Delete a pointer of another type.
Definition Cred.h:185
-
void operator()(_Ty *_Ptr) const noexcept
Delete a pointer.
Definition Cred.h:174
-
Deleter for unique_ptr using CredFree.
Definition Cred.h:133
-
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition Cred.h:151
-
CredFree_delete()
Default construct.
Definition Cred.h:139
-
CredFree_delete< _Ty > _Myt
This type.
Definition Cred.h:134
-
CredFree_delete(const CredFree_delete< _Ty2 > &)
Construct from another CredFree_delete.
Definition Cred.h:144
+
CredFree_delete< _Ty > _Myt
This type.
Definition Cred.h:154
+
CredFree_delete()
Default construct.
Definition Cred.h:159
+
void operator()(_Other *) const
Delete a pointer of another type.
Definition Cred.h:177
+
void operator()(_Ty *_Ptr) const noexcept
Delete a pointer.
Definition Cred.h:166
+
Deleter for unique_ptr using CredFree.
Definition Cred.h:125
+
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition Cred.h:143
+
CredFree_delete()
Default construct.
Definition Cred.h:131
+
CredFree_delete< _Ty > _Myt
This type.
Definition Cred.h:126
+
CredFree_delete(const CredFree_delete< _Ty2 > &)
Construct from another CredFree_delete.
Definition Cred.h:136
diff --git a/_crypt_8h_source.html b/_crypt_8h_source.html index 18cf3613..8d565013 100644 --- a/_crypt_8h_source.html +++ b/_crypt_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -109,775 +109,771 @@ $(function() { codefold.init(0); });
26 DWORD dwSize = ::CertGetNameStringA(pCertContext, dwType, dwFlags, pvTypePara, NULL, 0);
27
28 // Allocate buffer on heap to format the string data into and read it.
-
29 std::unique_ptr<char[]> szBuffer(new char[dwSize]);
-
30 dwSize = ::CertGetNameStringA(pCertContext, dwType, dwFlags, pvTypePara, szBuffer.get(), dwSize);
-
31 sNameString.assign(szBuffer.get(), dwSize - 1);
-
32 return dwSize;
-
33}
+
29 sNameString.resize(dwSize - 1);
+
30 return ::CertGetNameStringA(pCertContext, dwType, dwFlags, pvTypePara, &sNameString[0], dwSize);
+
31}
-
34
-
40template<class _Traits, class _Ax>
-
-
41static DWORD CertGetNameStringW(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sNameString)
-
42{
-
43 // Query the final string length first.
-
44 DWORD dwSize = ::CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara, NULL, 0);
-
45
-
46 // Allocate buffer on heap to format the string data into and read it.
-
47 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwSize]);
-
48 dwSize = ::CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara, szBuffer.get(), dwSize);
-
49 sNameString.assign(szBuffer.get(), dwSize - 1);
-
50 return dwSize;
-
51}
+
32
+
38template<class _Traits, class _Ax>
+
+
39static DWORD CertGetNameStringW(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sNameString)
+
40{
+
41 // Query the final string length first.
+
42 DWORD dwSize = ::CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara, NULL, 0);
+
43
+
44 // Allocate buffer on heap to format the string data into and read it.
+
45 sNameString.resize(dwSize - 1);
+
46 return ::CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara, &sNameString[0], dwSize);
+
47}
-
52
-
58template<class _Ty, class _Ax>
-
-
59static _Success_(return != 0) BOOL WINAPI CertGetCertificateContextProperty(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwPropId, _Out_ std::vector<_Ty, _Ax> &aData)
-
60{
- -
62 DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
-
63
-
64 // Try with the stack buffer first.
-
65 if (CertGetCertificateContextProperty(pCertContext, dwPropId, buf, &dwSize)) {
-
66 // Copy from stack.
-
67 aData.assign((const _Ty*)buf, (const _Ty*)buf + (dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
68 return TRUE;
-
69 } else if (GetLastError() == ERROR_MORE_DATA) {
-
70 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
71 if (CertGetCertificateContextProperty(pCertContext, dwPropId, aData.data(), &dwSize))
-
72 return TRUE;
-
73 }
-
74
-
75 return FALSE;
-
76}
+
48
+
54template<class _Ty, class _Ax>
+
+
55static _Success_(return != 0) BOOL WINAPI CertGetCertificateContextProperty(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwPropId, _Out_ std::vector<_Ty, _Ax> &aData)
+
56{
+ +
58 DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
+
59
+
60 // Try with the stack buffer first.
+
61 if (CertGetCertificateContextProperty(pCertContext, dwPropId, buf, &dwSize)) {
+
62 // Copy from stack.
+
63 aData.assign((const _Ty*)buf, (const _Ty*)buf + (dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
64 return TRUE;
+
65 } else if (GetLastError() == ERROR_MORE_DATA) {
+
66 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
67 if (CertGetCertificateContextProperty(pCertContext, dwPropId, aData.data(), &dwSize))
+
68 return TRUE;
+
69 }
+
70
+
71 return FALSE;
+
72}
-
77
-
83template<class _Ty, class _Ax>
-
-
84static _Success_(return != 0) BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags)
-
85{
- -
87 DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
-
88
-
89 // Try with the stack buffer first.
-
90 if (CryptGetHashParam(hHash, dwParam, buf, &dwSize, dwFlags)) {
-
91 // Copy from stack.
-
92 aData.assign((const _Ty*)buf, (const _Ty*)buf + (dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
93 return TRUE;
-
94 } else if (GetLastError() == ERROR_MORE_DATA) {
-
95 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
96 if (CryptGetHashParam(hHash, dwParam, reinterpret_cast<BYTE*>(aData.data()), &dwSize, dwFlags))
-
97 return TRUE;
-
98 }
-
99
-
100 return FALSE;
-
101}
+
73
+
79template<class _Ty, class _Ax>
+
+
80static _Success_(return != 0) BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags)
+
81{
+ +
83 DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
+
84
+
85 // Try with the stack buffer first.
+
86 if (CryptGetHashParam(hHash, dwParam, buf, &dwSize, dwFlags)) {
+
87 // Copy from stack.
+
88 aData.assign((const _Ty*)buf, (const _Ty*)buf + (dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
89 return TRUE;
+
90 } else if (GetLastError() == ERROR_MORE_DATA) {
+
91 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
92 if (CryptGetHashParam(hHash, dwParam, reinterpret_cast<BYTE*>(aData.data()), &dwSize, dwFlags))
+
93 return TRUE;
+
94 }
+
95
+
96 return FALSE;
+
97}
-
102
-
108template<class T>
-
-
109static _Success_(return != 0) BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags)
-
110{
-
111 DWORD dwSize = sizeof(T);
-
112 return CryptGetHashParam(hHash, dwParam, (BYTE*)&data, &dwSize, dwFlags);
-
113}
+
98
+
104template<class T>
+
+
105static _Success_(return != 0) BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags)
+
106{
+
107 DWORD dwSize = sizeof(T);
+
108 return CryptGetHashParam(hHash, dwParam, (BYTE*)&data, &dwSize, dwFlags);
+
109}
-
114
-
120template<class _Ty, class _Ax>
-
-
121static _Success_(return != 0) BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags)
-
122{
- -
124 DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
-
125
-
126 // Try with the stack buffer first.
-
127 if (CryptGetKeyParam(hKey, dwParam, buf, &dwSize, dwFlags)) {
-
128 // Copy from stack.
-
129 aData.assign((const _Ty*)buf, (const _Ty*)buf + (dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
130 return TRUE;
-
131 } else if (GetLastError() == ERROR_MORE_DATA) {
-
132 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
133 if (CryptGetKeyParam(hKey, dwParam, reinterpret_cast<BYTE*>(aData.data()), &dwSize, dwFlags))
-
134 return TRUE;
-
135 }
-
136
-
137 return FALSE;
-
138}
+
110
+
116template<class _Ty, class _Ax>
+
+
117static _Success_(return != 0) BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags)
+
118{
+ +
120 DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
+
121
+
122 // Try with the stack buffer first.
+
123 if (CryptGetKeyParam(hKey, dwParam, buf, &dwSize, dwFlags)) {
+
124 // Copy from stack.
+
125 aData.assign((const _Ty*)buf, (const _Ty*)buf + (dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
126 return TRUE;
+
127 } else if (GetLastError() == ERROR_MORE_DATA) {
+
128 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
129 if (CryptGetKeyParam(hKey, dwParam, reinterpret_cast<BYTE*>(aData.data()), &dwSize, dwFlags))
+
130 return TRUE;
+
131 }
+
132
+
133 return FALSE;
+
134}
-
139
-
145template<class T>
-
-
146static BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags)
-
147{
-
148 DWORD dwSize = sizeof(T);
-
149 return CryptGetKeyParam(hKey, dwParam, (BYTE*)&data, &dwSize, dwFlags);
-
150}
+
135
+
141template<class T>
+
+
142static BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags)
+
143{
+
144 DWORD dwSize = sizeof(T);
+
145 return CryptGetKeyParam(hKey, dwParam, (BYTE*)&data, &dwSize, dwFlags);
+
146}
-
151
-
157template<class _Ty, class _Ax>
-
-
158static _Success_(return != 0) BOOL CryptExportKey(_In_ HCRYPTKEY hKey, _In_ HCRYPTKEY hExpKey, _In_ DWORD dwBlobType, _In_ DWORD dwFlags, _Out_ std::vector<_Ty, _Ax> &aData)
-
159{
-
160 DWORD dwKeyBLOBSize = 0;
-
161
-
162 if (CryptExportKey(hKey, hExpKey, dwBlobType, dwFlags, NULL, &dwKeyBLOBSize)) {
-
163 aData.resize((dwKeyBLOBSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
164 if (CryptExportKey(hKey, hExpKey, dwBlobType, dwFlags, reinterpret_cast<BYTE*>(aData.data()), &dwKeyBLOBSize))
-
165 return TRUE;
-
166 }
-
167
-
168 return FALSE;
-
169}
+
147
+
153template<class _Ty, class _Ax>
+
+
154static _Success_(return != 0) BOOL CryptExportKey(_In_ HCRYPTKEY hKey, _In_ HCRYPTKEY hExpKey, _In_ DWORD dwBlobType, _In_ DWORD dwFlags, _Out_ std::vector<_Ty, _Ax> &aData)
+
155{
+
156 DWORD dwKeyBLOBSize = 0;
+
157
+
158 if (CryptExportKey(hKey, hExpKey, dwBlobType, dwFlags, NULL, &dwKeyBLOBSize)) {
+
159 aData.resize((dwKeyBLOBSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
160 if (CryptExportKey(hKey, hExpKey, dwBlobType, dwFlags, reinterpret_cast<BYTE*>(aData.data()), &dwKeyBLOBSize))
+
161 return TRUE;
+
162 }
+
163
+
164 return FALSE;
+
165}
-
170
-
176template<class _Ty, class _Ax>
-
-
177static _Success_(return != 0) BOOL CryptEncrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData)
-
178{
-
179 SIZE_T
-
180 sDataLen = SIZETMult(aData.size(), sizeof(_Ty)),
-
181 sBufLen = SIZETMult(aData.capacity(), sizeof(_Ty));
-
182 if (sDataLen > DWORD_MAX || sBufLen > DWORD_MAX)
-
183 throw std::invalid_argument("Data too big");
-
184 DWORD
-
185 dwDataLen = static_cast<DWORD>(sDataLen),
-
186 dwBufLen = static_cast<DWORD>(sBufLen),
-
187 dwEncLen = dwDataLen,
-
188 dwResult;
-
189
-
190 if (dwBufLen) {
-
191 aData.resize(dwBufLen);
-
192 if (CryptEncrypt(hKey, hHash, Final, dwFlags, reinterpret_cast<BYTE*>(aData.data()), &dwEncLen, dwBufLen)) {
-
193 // Encryption succeeded.
-
194 assert(dwEncLen <= dwBufLen);
-
195 if (dwEncLen < dwBufLen)
-
196 aData.resize((dwEncLen + sizeof(_Ty) - 1) / sizeof(_Ty));
-
197 return TRUE;
-
198 } else
-
199 dwResult = GetLastError();
-
200 } else if (CryptEncrypt(hKey, NULL, Final, dwFlags, NULL, &dwEncLen, 0)) {
-
201 // CryptEncrypt() always succeeds for output data size queries.
-
202 // dwEncLen contains required output data size. Continue as if the buffer was to small. Actually, the output buffer _was_ too small!
-
203 dwResult = ERROR_MORE_DATA;
-
204 } else
-
205 dwResult = GetLastError();
-
206
-
207 if (dwResult == ERROR_MORE_DATA) {
-
208 // Encrypted data will be longer. Reserve more space and retry.
-
209 aData.resize(((dwBufLen = dwEncLen) + sizeof(_Ty) - 1) / sizeof(_Ty));
-
210 dwEncLen = dwDataLen;
-
211 if (CryptEncrypt(hKey, hHash, Final, dwFlags, reinterpret_cast<BYTE*>(aData.data()), &dwEncLen, dwBufLen)) {
-
212 // Encryption succeeded.
-
213 assert(dwEncLen <= dwBufLen);
-
214 if (dwEncLen < dwBufLen)
-
215 aData.resize((dwEncLen + sizeof(_Ty) - 1) / sizeof(_Ty));
-
216 return TRUE;
-
217 }
-
218 } else {
-
219 // Resize back to data length.
-
220 aData.resize((dwDataLen + sizeof(_Ty) - 1) / sizeof(_Ty));
-
221 }
-
222
-
223 return FALSE;
-
224}
+
166
+
172template<class _Ty, class _Ax>
+
+
173static _Success_(return != 0) BOOL CryptEncrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData)
+
174{
+
175 SIZE_T
+
176 sDataLen = SIZETMult(aData.size(), sizeof(_Ty)),
+
177 sBufLen = SIZETMult(aData.capacity(), sizeof(_Ty));
+
178 if (sDataLen > DWORD_MAX || sBufLen > DWORD_MAX)
+
179 throw std::invalid_argument("Data too big");
+
180 DWORD
+
181 dwDataLen = static_cast<DWORD>(sDataLen),
+
182 dwBufLen = static_cast<DWORD>(sBufLen),
+
183 dwEncLen = dwDataLen,
+
184 dwResult;
+
185
+
186 if (dwBufLen) {
+
187 aData.resize(dwBufLen);
+
188 if (CryptEncrypt(hKey, hHash, Final, dwFlags, reinterpret_cast<BYTE*>(aData.data()), &dwEncLen, dwBufLen)) {
+
189 // Encryption succeeded.
+
190 assert(dwEncLen <= dwBufLen);
+
191 if (dwEncLen < dwBufLen)
+
192 aData.resize((dwEncLen + sizeof(_Ty) - 1) / sizeof(_Ty));
+
193 return TRUE;
+
194 } else
+
195 dwResult = GetLastError();
+
196 } else if (CryptEncrypt(hKey, NULL, Final, dwFlags, NULL, &dwEncLen, 0)) {
+
197 // CryptEncrypt() always succeeds for output data size queries.
+
198 // dwEncLen contains required output data size. Continue as if the buffer was to small. Actually, the output buffer _was_ too small!
+
199 dwResult = ERROR_MORE_DATA;
+
200 } else
+
201 dwResult = GetLastError();
+
202
+
203 if (dwResult == ERROR_MORE_DATA) {
+
204 // Encrypted data will be longer. Reserve more space and retry.
+
205 aData.resize(((dwBufLen = dwEncLen) + sizeof(_Ty) - 1) / sizeof(_Ty));
+
206 dwEncLen = dwDataLen;
+
207 if (CryptEncrypt(hKey, hHash, Final, dwFlags, reinterpret_cast<BYTE*>(aData.data()), &dwEncLen, dwBufLen)) {
+
208 // Encryption succeeded.
+
209 assert(dwEncLen <= dwBufLen);
+
210 if (dwEncLen < dwBufLen)
+
211 aData.resize((dwEncLen + sizeof(_Ty) - 1) / sizeof(_Ty));
+
212 return TRUE;
+
213 }
+
214 } else {
+
215 // Resize back to data length.
+
216 aData.resize((dwDataLen + sizeof(_Ty) - 1) / sizeof(_Ty));
+
217 }
+
218
+
219 return FALSE;
+
220}
-
225
-
231template<class _Ty, class _Ax>
-
-
232static _Success_(return != 0) BOOL CryptDecrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData)
-
233{
-
234 SIZE_T sDataLen = SIZETMult(aData.size(), sizeof(_Ty));
-
235 if (sDataLen > DWORD_MAX)
-
236 throw std::invalid_argument("Data too big");
-
237 DWORD dwDataLen = static_cast<DWORD>(sDataLen);
-
238
-
239 if (CryptDecrypt(hKey, hHash, Final, dwFlags, reinterpret_cast<BYTE*>(aData.data()), &dwDataLen)) {
-
240 // Decryption succeeded.
-
241 aData.resize((dwDataLen + sizeof(_Ty) - 1) / sizeof(_Ty));
-
242 return TRUE;
-
243 }
-
244
-
245 return FALSE;
-
246}
+
221
+
227template<class _Ty, class _Ax>
+
+
228static _Success_(return != 0) BOOL CryptDecrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData)
+
229{
+
230 SIZE_T sDataLen = SIZETMult(aData.size(), sizeof(_Ty));
+
231 if (sDataLen > DWORD_MAX)
+
232 throw std::invalid_argument("Data too big");
+
233 DWORD dwDataLen = static_cast<DWORD>(sDataLen);
+
234
+
235 if (CryptDecrypt(hKey, hHash, Final, dwFlags, reinterpret_cast<BYTE*>(aData.data()), &dwDataLen)) {
+
236 // Decryption succeeded.
+
237 aData.resize((dwDataLen + sizeof(_Ty) - 1) / sizeof(_Ty));
+
238 return TRUE;
+
239 }
+
240
+
241 return FALSE;
+
242}
-
247
-
249
-
250namespace winstd
-
251{
-
254
-
-
260 class cert_context : public dplhandle<PCCERT_CONTEXT, NULL>
-
261 {
- -
263
-
264 public:
-
- -
271 {
-
272 if (m_h != invalid)
- -
274 }
+
243
+
245
+
246namespace winstd
+
247{
+
250
+
+
256 class cert_context : public dplhandle<PCCERT_CONTEXT, NULL>
+
257 {
+ +
259
+
260 public:
+
+ +
267 {
+
268 if (m_h != invalid)
+ +
270 }
-
275
-
-
284 bool operator==(_In_ const handle_type &other) const noexcept
-
285 {
-
286 // TODO: [Crypto] Make constant time.
-
287 return
-
288 m_h == other ||
-
289 m_h->cbCertEncoded == other->cbCertEncoded && memcmp(m_h->pbCertEncoded, other->pbCertEncoded, m_h->cbCertEncoded) == 0;
-
290 }
+
271
+
+
280 bool operator==(_In_ const handle_type &other) const noexcept
+
281 {
+
282 // TODO: [Crypto] Make constant time.
+
283 return
+
284 m_h == other ||
+
285 m_h->cbCertEncoded == other->cbCertEncoded && memcmp(m_h->pbCertEncoded, other->pbCertEncoded, m_h->cbCertEncoded) == 0;
+
286 }
-
291
-
-
300 bool operator!=(_In_ const handle_type &other) const noexcept
-
301 {
-
302 return !operator==(other);
-
303 }
+
287
+
+
296 bool operator!=(_In_ const handle_type &other) const noexcept
+
297 {
+
298 return !operator==(other);
+
299 }
-
304
-
-
313 bool operator<(_In_ const handle_type &other) const noexcept
-
314 {
-
315 // TODO: [Crypto] Make constant time.
-
316 const int r = memcmp(m_h->pbCertEncoded, other->pbCertEncoded, std::min<DWORD>(m_h->cbCertEncoded, other->cbCertEncoded));
-
317 return r < 0 || r == 0 && m_h->cbCertEncoded < other->cbCertEncoded;
-
318 }
+
300
+
+
309 bool operator<(_In_ const handle_type &other) const noexcept
+
310 {
+
311 // TODO: [Crypto] Make constant time.
+
312 const int r = memcmp(m_h->pbCertEncoded, other->pbCertEncoded, std::min<DWORD>(m_h->cbCertEncoded, other->cbCertEncoded));
+
313 return r < 0 || r == 0 && m_h->cbCertEncoded < other->cbCertEncoded;
+
314 }
-
319
-
-
328 bool operator>(_In_ const handle_type &other) const noexcept
-
329 {
-
330 // TODO: [Crypto] Make constant time.
-
331 const int r = memcmp(m_h->pbCertEncoded, other->pbCertEncoded, std::min<DWORD>(m_h->cbCertEncoded, other->cbCertEncoded));
-
332 return r > 0 || r == 0 && m_h->cbCertEncoded > other->cbCertEncoded;
-
333 }
+
315
+
+
324 bool operator>(_In_ const handle_type &other) const noexcept
+
325 {
+
326 // TODO: [Crypto] Make constant time.
+
327 const int r = memcmp(m_h->pbCertEncoded, other->pbCertEncoded, std::min<DWORD>(m_h->cbCertEncoded, other->cbCertEncoded));
+
328 return r > 0 || r == 0 && m_h->cbCertEncoded > other->cbCertEncoded;
+
329 }
-
334
-
-
343 bool operator<=(_In_ const handle_type &other) const noexcept
-
344 {
-
345 return !operator>(other);
-
346 }
+
330
+
+
339 bool operator<=(_In_ const handle_type &other) const noexcept
+
340 {
+
341 return !operator>(other);
+
342 }
-
347
-
-
356 bool operator>=(_In_ const handle_type &other) const noexcept
-
357 {
-
358 return !operator<(other);
-
359 }
+
343
+
+
352 bool operator>=(_In_ const handle_type &other) const noexcept
+
353 {
+
354 return !operator<(other);
+
355 }
-
360
-
361 protected:
-
-
367 void free_internal() noexcept override
-
368 {
- -
370 }
+
356
+
357 protected:
+
+
363 void free_internal() noexcept override
+
364 {
+ +
366 }
-
371
-
- -
382 {
-
383 // As per doc, this only increases refcounter. Should never fail.
- -
385 }
+
367
+
+ +
378 {
+
379 // As per doc, this only increases refcounter. Should never fail.
+ +
381 }
-
386 };
+
382 };
-
387
-
-
393 class cert_chain_context : public dplhandle<PCCERT_CHAIN_CONTEXT, NULL>
-
394 {
- -
396
-
397 public:
-
- -
404 {
-
405 if (m_h != invalid)
- -
407 }
+
383
+
+
389 class cert_chain_context : public dplhandle<PCCERT_CHAIN_CONTEXT, NULL>
+
390 {
+ +
392
+
393 public:
+
+ +
400 {
+
401 if (m_h != invalid)
+ +
403 }
-
408
-
409 protected:
-
-
415 void free_internal() noexcept override
-
416 {
- -
418 }
+
404
+
405 protected:
+
+
411 void free_internal() noexcept override
+
412 {
+ +
414 }
-
419
-
- -
430 {
-
431 // As per doc, this only increases refcounter. Should never fail.
- -
433 }
+
415
+
+ +
426 {
+
427 // As per doc, this only increases refcounter. Should never fail.
+ +
429 }
-
434 };
+
430 };
-
435
-
-
442 class cert_store : public handle<HCERTSTORE, NULL>
-
443 {
- -
445
-
446 public:
-
-
452 virtual ~cert_store()
-
453 {
-
454 if (m_h != invalid)
- -
456 }
+
431
+
+
438 class cert_store : public handle<HCERTSTORE, NULL>
+
439 {
+ +
441
+
442 public:
+
+
448 virtual ~cert_store()
+
449 {
+
450 if (m_h != invalid)
+ +
452 }
-
457
-
458 protected:
-
-
464 void free_internal() noexcept override
-
465 {
- -
467 }
+
453
+
454 protected:
+
+
460 void free_internal() noexcept override
+
461 {
+ +
463 }
-
468 };
+
464 };
-
469
-
-
475 class crypt_prov : public handle<HCRYPTPROV, NULL>
-
476 {
- -
478
-
479 public:
-
-
485 virtual ~crypt_prov()
-
486 {
-
487 if (m_h != invalid)
- -
489 }
+
465
+
+
471 class crypt_prov : public handle<HCRYPTPROV, NULL>
+
472 {
+ +
474
+
475 public:
+
+
481 virtual ~crypt_prov()
+
482 {
+
483 if (m_h != invalid)
+ +
485 }
-
490
-
491 protected:
-
-
497 void free_internal() noexcept override
-
498 {
- -
500 }
+
486
+
487 protected:
+
+
493 void free_internal() noexcept override
+
494 {
+ +
496 }
-
501 };
+
497 };
-
502
-
-
508 class crypt_hash : public dplhandle<HCRYPTHASH, NULL>
-
509 {
- -
511
-
512 public:
-
-
518 virtual ~crypt_hash()
-
519 {
-
520 if (m_h != invalid)
- -
522 }
+
498
+
+
504 class crypt_hash : public dplhandle<HCRYPTHASH, NULL>
+
505 {
+ +
507
+
508 public:
+
+
514 virtual ~crypt_hash()
+
515 {
+
516 if (m_h != invalid)
+ +
518 }
-
523
-
524 protected:
-
-
530 void free_internal() noexcept override
-
531 {
- -
533 }
+
519
+
520 protected:
+
+
526 void free_internal() noexcept override
+
527 {
+ +
529 }
-
534
-
- -
545 {
- -
547 if (CryptDuplicateHash(h, NULL, 0, &hNew))
-
548 return hNew;
-
549 throw win_runtime_error("CryptDuplicateHash failed");
-
550 }
+
530
+
+ +
541 {
+ +
543 if (CryptDuplicateHash(h, NULL, 0, &hNew))
+
544 return hNew;
+
545 throw win_runtime_error("CryptDuplicateHash failed");
+
546 }
-
551 };
+
547 };
-
552
-
-
561 class crypt_key : public dplhandle<HCRYPTKEY, NULL>
-
562 {
- -
564
-
565 public:
-
-
571 virtual ~crypt_key()
-
572 {
-
573 if (m_h != invalid)
- -
575 }
+
548
+
+
557 class crypt_key : public dplhandle<HCRYPTKEY, NULL>
+
558 {
+ +
560
+
561 public:
+
+
567 virtual ~crypt_key()
+
568 {
+
569 if (m_h != invalid)
+ +
571 }
-
576
-
- -
586 {
- - -
589 return false;
-
590 }
-
591
-
592 // Generate the private key.
- - -
595 // Export the private key, we'll convert it to a private exponent of one key.
-
596 std::vector<BYTE, sanitizing_allocator<BYTE>> key_blob;
- - -
599
-
600 // Get the byte length of the key.
-
601 size_t
-
602 size_key = *reinterpret_cast<DWORD*>(&key_blob[12])/8,
- -
604
-
605 // Modify the Exponent in Key BLOB format
-
606 // Key BLOB format is documented in SDK
-
607
-
608 // Convert pubexp in rsapubkey to 1
-
609 LPBYTE ptr = &key_blob[16];
-
610 *reinterpret_cast<DWORD*>(ptr) = 1;
-
611 ptr += sizeof(DWORD);
-
612
-
613 // Skip modulus, prime1, prime2
-
614 ptr += size_key;
-
615 ptr += size_prime;
-
616 ptr += size_prime;
-
617
-
618 // Convert exponent1 to 1
-
619 ptr[0] = 1;
-
620 memset(ptr + 1, 0, size_prime - 1);
-
621 ptr += size_prime;
-
622
-
623 // Convert exponent2 to 1
-
624 ptr[0] = 1;
-
625 memset(ptr + 1, 0, size_prime - 1);
-
626 ptr += size_prime;
-
627
-
628 // Skip coefficient
-
629 ptr += size_prime;
+
572
+
+ +
582 {
+ + +
585 return false;
+
586 }
+
587
+
588 // Generate the private key.
+ + +
591 // Export the private key, we'll convert it to a private exponent of one key.
+
592 std::vector<BYTE, sanitizing_allocator<BYTE>> key_blob;
+ + +
595
+
596 // Get the byte length of the key.
+
597 size_t
+
598 size_key = *reinterpret_cast<DWORD*>(&key_blob[12])/8,
+ +
600
+
601 // Modify the Exponent in Key BLOB format
+
602 // Key BLOB format is documented in SDK
+
603
+
604 // Convert pubexp in rsapubkey to 1
+
605 LPBYTE ptr = &key_blob[16];
+
606 *reinterpret_cast<DWORD*>(ptr) = 1;
+
607 ptr += sizeof(DWORD);
+
608
+
609 // Skip modulus, prime1, prime2
+
610 ptr += size_key;
+
611 ptr += size_prime;
+
612 ptr += size_prime;
+
613
+
614 // Convert exponent1 to 1
+
615 ptr[0] = 1;
+
616 memset(ptr + 1, 0, size_prime - 1);
+
617 ptr += size_prime;
+
618
+
619 // Convert exponent2 to 1
+
620 ptr[0] = 1;
+
621 memset(ptr + 1, 0, size_prime - 1);
+
622 ptr += size_prime;
+
623
+
624 // Skip coefficient
+
625 ptr += size_prime;
+
626
+
627 // Convert privateExponent to 1
+
628 ptr[0] = 1;
+
629 memset(ptr + 1, 0, size_key - 1);
630
-
631 // Convert privateExponent to 1
-
632 ptr[0] = 1;
-
633 memset(ptr + 1, 0, size_key - 1);
-
634
-
635 // Import the exponent-of-one private key.
-
636 if (CryptImportKey(hProv, key_blob.data(), static_cast<DWORD>(key_blob.size()), 0, 0, &h)) {
-
637 attach(h);
-
638 return true;
-
639 }
-
640 } else
- -
642 }
-
643
-
644 return false;
-
645 }
+
631 // Import the exponent-of-one private key.
+
632 if (CryptImportKey(hProv, key_blob.data(), static_cast<DWORD>(key_blob.size()), 0, 0, &h)) {
+
633 attach(h);
+
634 return true;
+
635 }
+
636 } else
+ +
638 }
+
639
+
640 return false;
+
641 }
-
646
-
647 protected:
-
-
653 void free_internal() noexcept override
-
654 {
- -
656 }
+
642
+
643 protected:
+
+
649 void free_internal() noexcept override
+
650 {
+ +
652 }
-
657
-
- -
668 {
- -
670 if (CryptDuplicateKey(h, NULL, 0, &hNew))
-
671 return hNew;
-
672 throw win_runtime_error("CryptDuplicateKey failed");
-
673 }
+
653
+
+ +
664 {
+ +
666 if (CryptDuplicateKey(h, NULL, 0, &hNew))
+
667 return hNew;
+
668 throw win_runtime_error("CryptDuplicateKey failed");
+
669 }
-
674 };
+
670 };
-
675
-
679 #pragma warning(push)
-
680 #pragma warning(disable: 26432) // Copy constructor and assignment operator are also present, but not detected by code analysis as they are using base type source object reference.
-
-
681 class data_blob : public DATA_BLOB
-
682 {
-
683 public:
-
- -
688 {
-
689 cbData = 0;
-
690 pbData = NULL;
-
691 }
+
671
+
675 #pragma warning(push)
+
676 #pragma warning(disable: 26432) // Copy constructor and assignment operator are also present, but not detected by code analysis as they are using base type source object reference.
+
+
677 class data_blob : public DATA_BLOB
+
678 {
+
679 public:
+
+ +
684 {
+
685 cbData = 0;
+
686 pbData = NULL;
+
687 }
-
692
-
- -
697 {
-
698 cbData = size;
-
699 pbData = data;
-
700 }
+
688
+
+ +
693 {
+
694 cbData = size;
+
695 pbData = data;
+
696 }
-
701
-
-
705 data_blob(_In_ const DATA_BLOB &other)
-
706 {
-
707 cbData = other.cbData;
-
708 if (cbData) {
-
709 pbData = static_cast<BYTE*>(LocalAlloc(LMEM_FIXED, other.cbData));
-
710 if (!pbData) throw win_runtime_error("LocalAlloc failed");
-
711 memcpy(pbData, other.pbData, other.cbData);
-
712 } else
-
713 pbData = NULL;
-
714 }
+
697
+
+
701 data_blob(_In_ const DATA_BLOB &other)
+
702 {
+
703 cbData = other.cbData;
+
704 if (cbData) {
+
705 pbData = static_cast<BYTE*>(LocalAlloc(LMEM_FIXED, other.cbData));
+
706 if (!pbData) throw win_runtime_error("LocalAlloc failed");
+
707 memcpy(pbData, other.pbData, other.cbData);
+
708 } else
+
709 pbData = NULL;
+
710 }
-
715
-
-
719 data_blob(_Inout_ data_blob &&other) noexcept
-
720 {
-
721 cbData = other.cbData;
-
722 pbData = other.pbData;
-
723 other.cbData = 0;
-
724 other.pbData = NULL;
-
725 }
+
711
+
+
715 data_blob(_Inout_ data_blob &&other) noexcept
+
716 {
+
717 cbData = other.cbData;
+
718 pbData = other.pbData;
+
719 other.cbData = 0;
+
720 other.pbData = NULL;
+
721 }
-
726
-
-
730 virtual ~data_blob()
-
731 {
-
732 if (pbData != NULL)
- -
734 }
+
722
+
+
726 virtual ~data_blob()
+
727 {
+
728 if (pbData != NULL)
+ +
730 }
-
735
-
-
739 data_blob& operator=(_In_ const DATA_BLOB &other)
-
740 {
-
741 if (this != &other) {
-
742 cbData = other.cbData;
-
743 if (pbData)
- -
745 if (cbData) {
-
746 pbData = static_cast<BYTE*>(LocalAlloc(LMEM_FIXED, other.cbData));
-
747 if (!pbData) throw win_runtime_error("LocalAlloc failed");
-
748 memcpy(pbData, other.pbData, other.cbData);
-
749 } else
-
750 pbData = NULL;
-
751 }
-
752
-
753 return *this;
-
754 }
+
731
+
+
735 data_blob& operator=(_In_ const DATA_BLOB &other)
+
736 {
+
737 if (this != &other) {
+
738 cbData = other.cbData;
+
739 if (pbData)
+ +
741 if (cbData) {
+
742 pbData = static_cast<BYTE*>(LocalAlloc(LMEM_FIXED, other.cbData));
+
743 if (!pbData) throw win_runtime_error("LocalAlloc failed");
+
744 memcpy(pbData, other.pbData, other.cbData);
+
745 } else
+
746 pbData = NULL;
+
747 }
+
748
+
749 return *this;
+
750 }
-
755
-
- -
760 {
-
761 if (this != &other) {
-
762 cbData = other.cbData;
-
763 if (pbData)
- -
765 pbData = other.pbData;
-
766 other.cbData = 0;
-
767 other.pbData = NULL;
-
768 }
-
769
-
770 return *this;
-
771 }
+
751
+
+ +
756 {
+
757 if (this != &other) {
+
758 cbData = other.cbData;
+
759 if (pbData)
+ +
761 pbData = other.pbData;
+
762 other.cbData = 0;
+
763 other.pbData = NULL;
+
764 }
+
765
+
766 return *this;
+
767 }
-
772
-
- -
777 {
-
778 return cbData;
-
779 }
+
768
+
+ +
773 {
+
774 return cbData;
+
775 }
-
780
-
- -
785 {
-
786 return pbData;
-
787 }
+
776
+
+ +
781 {
+
782 return pbData;
+
783 }
-
788
-
- -
793 {
-
794 return pbData;
-
795 }
+
784
+
+ +
789 {
+
790 return pbData;
+
791 }
-
796 };
+
792 };
-
797 #pragma warning(pop)
-
798
-
800}
-
801
-
804
-
805#pragma warning(push)
-
806#pragma warning(disable: 4505) // Don't warn on unused code
-
807
-
-
813static BOOL CertGetCertificateChain(_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, _Inout_ winstd::cert_chain_context &ctx)
-
814{
-
815 PCCERT_CHAIN_CONTEXT pChainContext;
-
816 BOOL bResult = CertGetCertificateChain(hChainEngine, pCertContext, pTime, hAdditionalStore, pChainPara, dwFlags, pvReserved, &pChainContext);
-
817 if (bResult)
-
818 ctx.attach(pChainContext);
-
819 return bResult;
-
820}
+
793 #pragma warning(pop)
+
794
+
796}
+
797
+
800
+
801#pragma warning(push)
+
802#pragma warning(disable: 4505) // Don't warn on unused code
+
803
+
+
809static BOOL CertGetCertificateChain(_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, _Inout_ winstd::cert_chain_context &ctx)
+
810{
+
811 PCCERT_CHAIN_CONTEXT pChainContext;
+
812 BOOL bResult = CertGetCertificateChain(hChainEngine, pCertContext, pTime, hAdditionalStore, pChainPara, dwFlags, pvReserved, &pChainContext);
+
813 if (bResult)
+
814 ctx.attach(pChainContext);
+
815 return bResult;
+
816}
-
821
-
-
823static BOOL CryptAcquireContextA(_Inout_ winstd::crypt_prov &prov, _In_opt_ LPCSTR szContainer, _In_opt_ LPCSTR szProvider, _In_ DWORD dwProvType, _In_ DWORD dwFlags)
-
824{
-
825 HCRYPTPROV h;
-
826 BOOL bResult = CryptAcquireContextA(&h, szContainer, szProvider, dwProvType, dwFlags);
-
827 if (bResult)
-
828 prov.attach(h);
-
829 return bResult;
-
830}
+
817
+
+
819static BOOL CryptAcquireContextA(_Inout_ winstd::crypt_prov &prov, _In_opt_ LPCSTR szContainer, _In_opt_ LPCSTR szProvider, _In_ DWORD dwProvType, _In_ DWORD dwFlags)
+
820{
+
821 HCRYPTPROV h;
+
822 BOOL bResult = CryptAcquireContextA(&h, szContainer, szProvider, dwProvType, dwFlags);
+
823 if (bResult)
+
824 prov.attach(h);
+
825 return bResult;
+
826}
-
831
-
-
837static BOOL CryptAcquireContextW(_Inout_ winstd::crypt_prov &prov, _In_opt_ LPCWSTR szContainer, _In_opt_ LPCWSTR szProvider, _In_ DWORD dwProvType, _In_ DWORD dwFlags)
-
838{
-
839 HCRYPTPROV h;
-
840 BOOL bResult = CryptAcquireContextW(&h, szContainer, szProvider, dwProvType, dwFlags);
-
841 if (bResult)
-
842 prov.attach(h);
-
843 return bResult;
-
844}
+
827
+
+
833static BOOL CryptAcquireContextW(_Inout_ winstd::crypt_prov &prov, _In_opt_ LPCWSTR szContainer, _In_opt_ LPCWSTR szProvider, _In_ DWORD dwProvType, _In_ DWORD dwFlags)
+
834{
+
835 HCRYPTPROV h;
+
836 BOOL bResult = CryptAcquireContextW(&h, szContainer, szProvider, dwProvType, dwFlags);
+
837 if (bResult)
+
838 prov.attach(h);
+
839 return bResult;
+
840}
-
845
-
-
851static BOOL CryptCreateHash(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ HCRYPTKEY hKey, _In_ DWORD dwFlags, _Inout_ winstd::crypt_hash &hash)
-
852{
-
853 HCRYPTHASH h;
-
854 BOOL bResult = CryptCreateHash(hProv, Algid, hKey, dwFlags, &h);
-
855 if (bResult)
-
856 hash.attach(h);
-
857 return bResult;
-
858}
+
841
+
+
847static BOOL CryptCreateHash(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ HCRYPTKEY hKey, _In_ DWORD dwFlags, _Inout_ winstd::crypt_hash &hash)
+
848{
+
849 HCRYPTHASH h;
+
850 BOOL bResult = CryptCreateHash(hProv, Algid, hKey, dwFlags, &h);
+
851 if (bResult)
+
852 hash.attach(h);
+
853 return bResult;
+
854}
-
859
-
-
865static BOOL CryptGenKey(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
-
866{
-
867 HCRYPTKEY h;
-
868 BOOL bResult = CryptGenKey(hProv, Algid, dwFlags, &h);
-
869 if (bResult)
-
870 key.attach(h);
-
871 return bResult;
-
872}
+
855
+
+
861static BOOL CryptGenKey(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
+
862{
+
863 HCRYPTKEY h;
+
864 BOOL bResult = CryptGenKey(hProv, Algid, dwFlags, &h);
+
865 if (bResult)
+
866 key.attach(h);
+
867 return bResult;
+
868}
-
873
-
-
879static bool CryptImportKey(_In_ HCRYPTPROV hProv, __in_bcount(dwDataLen) LPCBYTE pbData, _In_ DWORD dwDataLen, _In_ HCRYPTKEY hPubKey, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
-
880{
-
881 HCRYPTKEY h;
-
882 BOOL bResult = CryptImportKey(hProv, pbData, dwDataLen, hPubKey, dwFlags, &h);
-
883 if (bResult)
-
884 key.attach(h);
-
885 return bResult;
-
886}
+
869
+
+
875static bool CryptImportKey(_In_ HCRYPTPROV hProv, __in_bcount(dwDataLen) LPCBYTE pbData, _In_ DWORD dwDataLen, _In_ HCRYPTKEY hPubKey, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
+
876{
+
877 HCRYPTKEY h;
+
878 BOOL bResult = CryptImportKey(hProv, pbData, dwDataLen, hPubKey, dwFlags, &h);
+
879 if (bResult)
+
880 key.attach(h);
+
881 return bResult;
+
882}
-
887
-
-
893static bool CryptImportPublicKeyInfo(_In_ HCRYPTPROV hCryptProv, _In_ DWORD dwCertEncodingType, _In_ PCERT_PUBLIC_KEY_INFO pInfo, _Inout_ winstd::crypt_key &key)
-
894{
-
895 HCRYPTKEY h;
-
896 BOOL bResult = CryptImportPublicKeyInfo(hCryptProv, dwCertEncodingType, pInfo, &h);
-
897 if (bResult)
-
898 key.attach(h);
-
899 return bResult;
-
900}
+
883
+
+
889static bool CryptImportPublicKeyInfo(_In_ HCRYPTPROV hCryptProv, _In_ DWORD dwCertEncodingType, _In_ PCERT_PUBLIC_KEY_INFO pInfo, _Inout_ winstd::crypt_key &key)
+
890{
+
891 HCRYPTKEY h;
+
892 BOOL bResult = CryptImportPublicKeyInfo(hCryptProv, dwCertEncodingType, pInfo, &h);
+
893 if (bResult)
+
894 key.attach(h);
+
895 return bResult;
+
896}
-
901
-
-
907static bool CryptDeriveKey(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ HCRYPTHASH hBaseData, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
-
908{
-
909 HCRYPTKEY h;
-
910 BOOL bResult = CryptDeriveKey(hProv, Algid, hBaseData, dwFlags, &h);
-
911 if (bResult)
-
912 key.attach(h);
-
913 return bResult;
-
914}
+
897
+
+
903static bool CryptDeriveKey(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ HCRYPTHASH hBaseData, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
+
904{
+
905 HCRYPTKEY h;
+
906 BOOL bResult = CryptDeriveKey(hProv, Algid, hBaseData, dwFlags, &h);
+
907 if (bResult)
+
908 key.attach(h);
+
909 return bResult;
+
910}
-
915
-
916#pragma warning(pop)
-
917
-
PCCERT_CHAIN_CONTEXT wrapper class.
Definition Crypt.h:394
-
virtual ~cert_chain_context()
Destroys the certificate chain context.
Definition Crypt.h:403
-
void free_internal() noexcept override
Destroys the certificate chain context.
Definition Crypt.h:415
-
handle_type duplicate_internal(handle_type h) const override
Duplicates the certificate chain context.
Definition Crypt.h:429
-
PCCERT_CONTEXT wrapper class.
Definition Crypt.h:261
-
bool operator<=(const handle_type &other) const noexcept
Is certificate less than or equal?
Definition Crypt.h:343
-
void free_internal() noexcept override
Destroys the certificate context.
Definition Crypt.h:367
-
bool operator==(const handle_type &other) const noexcept
Is certificate equal to?
Definition Crypt.h:284
-
bool operator>=(const handle_type &other) const noexcept
Is certificate greater than or equal?
Definition Crypt.h:356
-
bool operator>(const handle_type &other) const noexcept
Is certificate greater than?
Definition Crypt.h:328
-
bool operator<(const handle_type &other) const noexcept
Is certificate less than?
Definition Crypt.h:313
-
bool operator!=(const handle_type &other) const noexcept
Is certificate not equal to?
Definition Crypt.h:300
-
handle_type duplicate_internal(handle_type h) const override
Duplicates the certificate context.
Definition Crypt.h:381
-
virtual ~cert_context()
Destroys the certificate context.
Definition Crypt.h:270
-
HCERTSTORE wrapper class.
Definition Crypt.h:443
-
virtual ~cert_store()
Closes the certificate store.
Definition Crypt.h:452
-
void free_internal() noexcept override
Closes the certificate store.
Definition Crypt.h:464
-
HCRYPTHASH wrapper class.
Definition Crypt.h:509
-
void free_internal() noexcept override
Destroys the hash context.
Definition Crypt.h:530
-
virtual ~crypt_hash()
Destroys the hash context.
Definition Crypt.h:518
-
handle_type duplicate_internal(handle_type h) const override
Duplicates the hash context.
Definition Crypt.h:544
-
HCRYPTKEY wrapper class.
Definition Crypt.h:562
-
handle_type duplicate_internal(handle_type h) const override
Duplicates the key.
Definition Crypt.h:667
-
virtual ~crypt_key()
Destroys the key.
Definition Crypt.h:571
-
bool create_exp1(HCRYPTPROV hProv, DWORD dwKeySpec)
Creates Exponent-of-one key.
Definition Crypt.h:585
-
void free_internal() noexcept override
Destroys the key.
Definition Crypt.h:653
-
HCRYPTPROV wrapper class.
Definition Crypt.h:476
-
virtual ~crypt_prov()
Releases the cryptographic context.
Definition Crypt.h:485
-
void free_internal() noexcept override
Releases the cryptographic context.
Definition Crypt.h:497
-
DATA_BLOB wrapper class.
Definition Crypt.h:682
-
data_blob(const DATA_BLOB &other)
Duplicate an existing BLOB.
Definition Crypt.h:705
-
virtual ~data_blob()
Destroys the BLOB.
Definition Crypt.h:730
-
BYTE * data() noexcept
Get BLOB buffer.
Definition Crypt.h:792
-
const BYTE * data() const noexcept
Get BLOB buffer.
Definition Crypt.h:784
-
data_blob() noexcept
Initializes an empty BLOB.
Definition Crypt.h:687
-
data_blob(data_blob &&other) noexcept
Move an existing BLOB.
Definition Crypt.h:719
-
data_blob & operator=(data_blob &&other) noexcept
Move an existing BLOB.
Definition Crypt.h:759
-
data_blob(BYTE *data, DWORD size) noexcept
Initializes a BLOB from existing data.
Definition Crypt.h:696
-
DWORD size() const noexcept
Get BLOB size.
Definition Crypt.h:776
-
data_blob & operator=(const DATA_BLOB &other)
Copy an existing BLOB.
Definition Crypt.h:739
-
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition Common.h:1283
-
Base abstract template class to support generic object handle keeping.
Definition Common.h:1020
-
T handle_type
Datatype of the object handle this template class handles.
Definition Common.h:1025
-
handle_type m_h
Object handle.
Definition Common.h:1272
-
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition Common.h:1235
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
-
Windows runtime error.
Definition Common.h:1520
-
static bool CryptImportPublicKeyInfo(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, winstd::crypt_key &key)
Imports the public key.
Definition Crypt.h:893
-
static BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, std::vector< _Ty, _Ax > &aData)
Retrieves the information contained in an extended property of a certificate context.
Definition Crypt.h:59
-
static BOOL CertGetCertificateChain(HCERTCHAINENGINE hChainEngine, PCCERT_CONTEXT pCertContext, LPFILETIME pTime, HCERTSTORE hAdditionalStore, PCERT_CHAIN_PARA pChainPara, DWORD dwFlags, LPVOID pvReserved, winstd::cert_chain_context &ctx)
The CertGetCertificateChain function builds a certificate chain context starting from an end certific...
Definition Crypt.h:813
-
static BOOL CryptGetHashParam(HCRYPTHASH hHash, DWORD dwParam, std::vector< _Ty, _Ax > &aData, DWORD dwFlags)
Retrieves data that governs the operations of a hash object. The actual hash value can be retrieved b...
Definition Crypt.h:84
-
static DWORD CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, std::basic_string< wchar_t, _Traits, _Ax > &sNameString)
Obtains the subject or issuer name from a certificate CERT_CONTEXT structure and stores it in a std::...
Definition Crypt.h:41
-
static BOOL CryptAcquireContextA(winstd::crypt_prov &prov, LPCSTR szContainer, LPCSTR szProvider, DWORD dwProvType, DWORD dwFlags)
Acquires the cryptographic context.
Definition Crypt.h:823
+
911
+
912#pragma warning(pop)
+
913
+
PCCERT_CHAIN_CONTEXT wrapper class.
Definition Crypt.h:390
+
virtual ~cert_chain_context()
Destroys the certificate chain context.
Definition Crypt.h:399
+
void free_internal() noexcept override
Destroys the certificate chain context.
Definition Crypt.h:411
+
handle_type duplicate_internal(handle_type h) const override
Duplicates the certificate chain context.
Definition Crypt.h:425
+
PCCERT_CONTEXT wrapper class.
Definition Crypt.h:257
+
bool operator<=(const handle_type &other) const noexcept
Is certificate less than or equal?
Definition Crypt.h:339
+
void free_internal() noexcept override
Destroys the certificate context.
Definition Crypt.h:363
+
bool operator==(const handle_type &other) const noexcept
Is certificate equal to?
Definition Crypt.h:280
+
bool operator>=(const handle_type &other) const noexcept
Is certificate greater than or equal?
Definition Crypt.h:352
+
bool operator>(const handle_type &other) const noexcept
Is certificate greater than?
Definition Crypt.h:324
+
bool operator<(const handle_type &other) const noexcept
Is certificate less than?
Definition Crypt.h:309
+
bool operator!=(const handle_type &other) const noexcept
Is certificate not equal to?
Definition Crypt.h:296
+
handle_type duplicate_internal(handle_type h) const override
Duplicates the certificate context.
Definition Crypt.h:377
+
virtual ~cert_context()
Destroys the certificate context.
Definition Crypt.h:266
+
HCERTSTORE wrapper class.
Definition Crypt.h:439
+
virtual ~cert_store()
Closes the certificate store.
Definition Crypt.h:448
+
void free_internal() noexcept override
Closes the certificate store.
Definition Crypt.h:460
+
HCRYPTHASH wrapper class.
Definition Crypt.h:505
+
void free_internal() noexcept override
Destroys the hash context.
Definition Crypt.h:526
+
virtual ~crypt_hash()
Destroys the hash context.
Definition Crypt.h:514
+
handle_type duplicate_internal(handle_type h) const override
Duplicates the hash context.
Definition Crypt.h:540
+
HCRYPTKEY wrapper class.
Definition Crypt.h:558
+
handle_type duplicate_internal(handle_type h) const override
Duplicates the key.
Definition Crypt.h:663
+
virtual ~crypt_key()
Destroys the key.
Definition Crypt.h:567
+
bool create_exp1(HCRYPTPROV hProv, DWORD dwKeySpec)
Creates Exponent-of-one key.
Definition Crypt.h:581
+
void free_internal() noexcept override
Destroys the key.
Definition Crypt.h:649
+
HCRYPTPROV wrapper class.
Definition Crypt.h:472
+
virtual ~crypt_prov()
Releases the cryptographic context.
Definition Crypt.h:481
+
void free_internal() noexcept override
Releases the cryptographic context.
Definition Crypt.h:493
+
DATA_BLOB wrapper class.
Definition Crypt.h:678
+
data_blob(const DATA_BLOB &other)
Duplicate an existing BLOB.
Definition Crypt.h:701
+
virtual ~data_blob()
Destroys the BLOB.
Definition Crypt.h:726
+
BYTE * data() noexcept
Get BLOB buffer.
Definition Crypt.h:788
+
const BYTE * data() const noexcept
Get BLOB buffer.
Definition Crypt.h:780
+
data_blob() noexcept
Initializes an empty BLOB.
Definition Crypt.h:683
+
data_blob(data_blob &&other) noexcept
Move an existing BLOB.
Definition Crypt.h:715
+
data_blob & operator=(data_blob &&other) noexcept
Move an existing BLOB.
Definition Crypt.h:755
+
data_blob(BYTE *data, DWORD size) noexcept
Initializes a BLOB from existing data.
Definition Crypt.h:692
+
DWORD size() const noexcept
Get BLOB size.
Definition Crypt.h:772
+
data_blob & operator=(const DATA_BLOB &other)
Copy an existing BLOB.
Definition Crypt.h:735
+
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition Common.h:1263
+
Base abstract template class to support generic object handle keeping.
Definition Common.h:1000
+
T handle_type
Datatype of the object handle this template class handles.
Definition Common.h:1005
+
handle_type m_h
Object handle.
Definition Common.h:1252
+
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition Common.h:1215
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
+
Windows runtime error.
Definition Common.h:1500
+
static bool CryptImportPublicKeyInfo(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, winstd::crypt_key &key)
Imports the public key.
Definition Crypt.h:889
+
static BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, std::vector< _Ty, _Ax > &aData)
Retrieves the information contained in an extended property of a certificate context.
Definition Crypt.h:55
+
static BOOL CertGetCertificateChain(HCERTCHAINENGINE hChainEngine, PCCERT_CONTEXT pCertContext, LPFILETIME pTime, HCERTSTORE hAdditionalStore, PCERT_CHAIN_PARA pChainPara, DWORD dwFlags, LPVOID pvReserved, winstd::cert_chain_context &ctx)
The CertGetCertificateChain function builds a certificate chain context starting from an end certific...
Definition Crypt.h:809
+
static BOOL CryptGetHashParam(HCRYPTHASH hHash, DWORD dwParam, std::vector< _Ty, _Ax > &aData, DWORD dwFlags)
Retrieves data that governs the operations of a hash object. The actual hash value can be retrieved b...
Definition Crypt.h:80
+
static DWORD CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, std::basic_string< wchar_t, _Traits, _Ax > &sNameString)
Obtains the subject or issuer name from a certificate CERT_CONTEXT structure and stores it in a std::...
Definition Crypt.h:39
+
static BOOL CryptAcquireContextA(winstd::crypt_prov &prov, LPCSTR szContainer, LPCSTR szProvider, DWORD dwProvType, DWORD dwFlags)
Acquires the cryptographic context.
Definition Crypt.h:819
static DWORD CertGetNameStringA(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, std::basic_string< char, _Traits, _Ax > &sNameString)
Obtains the subject or issuer name from a certificate CERT_CONTEXT structure and stores it in a std::...
Definition Crypt.h:23
-
static BOOL CryptGenKey(HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, winstd::crypt_key &key)
Generates the key.
Definition Crypt.h:865
-
static BOOL CryptExportKey(HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType, DWORD dwFlags, std::vector< _Ty, _Ax > &aData)
Exports a cryptographic key or a key pair from a cryptographic service provider (CSP) in a secure man...
Definition Crypt.h:158
-
static BOOL CryptGetKeyParam(HCRYPTKEY hKey, DWORD dwParam, std::vector< _Ty, _Ax > &aData, DWORD dwFlags)
Retrieves data that governs the operations of a key.
Definition Crypt.h:121
-
static BOOL CryptCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, winstd::crypt_hash &hash)
Creates the hash context.
Definition Crypt.h:851
-
static BOOL CryptAcquireContextW(winstd::crypt_prov &prov, LPCWSTR szContainer, LPCWSTR szProvider, DWORD dwProvType, DWORD dwFlags)
Acquires the cryptographic context.
Definition Crypt.h:837
-
static BOOL CryptEncrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, std::vector< _Ty, _Ax > &aData)
Encrypts data.
Definition Crypt.h:177
-
static bool CryptDeriveKey(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData, DWORD dwFlags, winstd::crypt_key &key)
Generates cryptographic session keys derived from a base data value.
Definition Crypt.h:907
-
static BOOL CryptDecrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, std::vector< _Ty, _Ax > &aData)
Decrypts data previously encrypted by using the CryptEncrypt function.
Definition Crypt.h:232
-
static bool CryptImportKey(HCRYPTPROV hProv, __in_bcount(dwDataLen) LPCBYTE pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, winstd::crypt_key &key)
Imports the key.
Definition Crypt.h:879
+
static BOOL CryptGenKey(HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, winstd::crypt_key &key)
Generates the key.
Definition Crypt.h:861
+
static BOOL CryptExportKey(HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType, DWORD dwFlags, std::vector< _Ty, _Ax > &aData)
Exports a cryptographic key or a key pair from a cryptographic service provider (CSP) in a secure man...
Definition Crypt.h:154
+
static BOOL CryptGetKeyParam(HCRYPTKEY hKey, DWORD dwParam, std::vector< _Ty, _Ax > &aData, DWORD dwFlags)
Retrieves data that governs the operations of a key.
Definition Crypt.h:117
+
static BOOL CryptCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, winstd::crypt_hash &hash)
Creates the hash context.
Definition Crypt.h:847
+
static BOOL CryptAcquireContextW(winstd::crypt_prov &prov, LPCWSTR szContainer, LPCWSTR szProvider, DWORD dwProvType, DWORD dwFlags)
Acquires the cryptographic context.
Definition Crypt.h:833
+
static BOOL CryptEncrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, std::vector< _Ty, _Ax > &aData)
Encrypts data.
Definition Crypt.h:173
+
static bool CryptDeriveKey(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData, DWORD dwFlags, winstd::crypt_key &key)
Generates cryptographic session keys derived from a base data value.
Definition Crypt.h:903
+
static BOOL CryptDecrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, std::vector< _Ty, _Ax > &aData)
Decrypts data previously encrypted by using the CryptEncrypt function.
Definition Crypt.h:228
+
static bool CryptImportKey(HCRYPTPROV hProv, __in_bcount(dwDataLen) LPCBYTE pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, winstd::crypt_key &key)
Imports the key.
Definition Crypt.h:875
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition Common.h:94
#define WINSTD_DPLHANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:176
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
-
static const T invalid
Invalid handle value.
Definition Common.h:1030
+
static const T invalid
Invalid handle value.
Definition Common.h:1010
diff --git a/_e_a_p_8h_source.html b/_e_a_p_8h_source.html index 60062aaa..7ee50b50 100644 --- a/_e_a_p_8h_source.html +++ b/_e_a_p_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -642,7 +642,7 @@ $(function() { codefold.init(0); });
699}
700
701#pragma warning(pop)
-
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition Common.h:1283
+
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition Common.h:1263
EAP_ATTRIBUTE wrapper class.
Definition EAP.h:213
eap_attr() noexcept
Initializes a new EAP attribute set to eatReserved.
Definition EAP.h:218
eap_attr(eap_attr &&a) noexcept
Moves an existing EAP attribute.
Definition EAP.h:242
@@ -684,11 +684,11 @@ $(function() { codefold.init(0); });
std::wstring m_root_cause_desc
A localized and readable string that describes the root cause of the error.
Definition EAP.h:690
const GUID & help_link_id() const noexcept
Returns help_link ID.
Definition EAP.h:679
DWORD m_reason
The reason code for the error.
Definition EAP.h:687
-
T handle_type
Datatype of the object handle this template class handles.
Definition Common.h:1025
-
handle_type m_h
Object handle.
Definition Common.h:1272
-
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition Common.h:1235
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
-
Windows runtime error.
Definition Common.h:1520
+
T handle_type
Datatype of the object handle this template class handles.
Definition Common.h:1005
+
handle_type m_h
Object handle.
Definition Common.h:1252
+
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition Common.h:1215
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
+
Windows runtime error.
Definition Common.h:1500
std::unique_ptr< EAP_ERROR, EapHostPeerFreeEapError_delete > eap_error_runtime
EAP_ERROR wrapper class.
Definition EAP.h:205
std::unique_ptr< BYTE[], EapHostPeerFreeMemory_delete > eap_blob
EapHost BLOB wrapper class.
Definition EAP.h:128
static bool operator==(const EAP_METHOD_TYPE &a, const EAP_METHOD_TYPE &b) noexcept
Are EAP method types equal?
Definition EAP.h:39
@@ -718,7 +718,7 @@ $(function() { codefold.init(0); });
@ identity
Identity.
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition Common.h:67
#define WINSTD_DPLHANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:176
-
static const T invalid
Invalid handle value.
Definition Common.h:1030
+
static const T invalid
Invalid handle value.
Definition Common.h:1010
Deleter for unique_ptr to EAP_ERROR using EapHostPeerFreeEapError.
Definition EAP.h:185
EapHostPeerFreeEapError_delete() noexcept
Default constructor.
Definition EAP.h:189
void operator()(EAP_ERROR *_Ptr) const noexcept
Delete a pointer.
Definition EAP.h:196
@@ -734,7 +734,7 @@ $(function() { codefold.init(0); });
diff --git a/_e_t_w_8h_source.html b/_e_t_w_8h_source.html index 711b4bbd..ae697636 100644 --- a/_e_t_w_8h_source.html +++ b/_e_t_w_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -1133,24 +1133,24 @@ $(function() { codefold.init(0); });
ETW trace.
Definition ETW.h:904
virtual ~event_trace()
Closes the trace.
Definition ETW.h:913
void free_internal() noexcept override
Closes the trace.
Definition ETW.h:925
-
Base abstract template class to support generic object handle keeping.
Definition Common.h:1020
-
handle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition Common.h:1035
-
handle_type m_h
Object handle.
Definition Common.h:1272
-
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition Common.h:1235
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
+
Base abstract template class to support generic object handle keeping.
Definition Common.h:1000
+
handle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition Common.h:1015
+
handle_type m_h
Object handle.
Definition Common.h:1252
+
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition Common.h:1215
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
static ULONG TdhGetEventInformation(PEVENT_RECORD pEvent, ULONG TdhContextCount, PTDH_CONTEXT pTdhContext, std::unique_ptr< TRACE_EVENT_INFO > &info)
Retrieves metadata about an event.
Definition ETW.h:58
static ULONG TdhGetProperty(PEVENT_RECORD pEvent, ULONG TdhContextCount, PTDH_CONTEXT pTdhContext, ULONG PropertyDataCount, PPROPERTY_DATA_DESCRIPTOR pPropertyData, std::vector< _Ty, _Ax > &aData)
Retrieves a property value from the event data.
Definition ETW.h:33
static ULONG TdhGetEventMapInformation(PEVENT_RECORD pEvent, LPWSTR pMapName, std::unique_ptr< EVENT_MAP_INFO > &info)
Retrieves information about the event map contained in the event.
Definition ETW.h:84
static const event_data blank_event_data
Blank event data used as terminator.
Definition ETW.h:291
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition Common.h:67
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition Common.h:94
-
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition Common.h:288
+
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition Common.h:271
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
-
static const REGHANDLE invalid
Invalid handle value.
Definition Common.h:1030
+
static const REGHANDLE invalid
Invalid handle value.
Definition Common.h:1010
diff --git a/_g_d_i_8h_source.html b/_g_d_i_8h_source.html index 6ec0657b..f09635ec 100644 --- a/_g_d_i_8h_source.html +++ b/_g_d_i_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 ​SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4*/
5
7
@@ -275,12 +275,12 @@ $(function() { codefold.init(0); });
Windows HGDIOBJ wrapper class.
Definition GDI.h:22
void free_internal() noexcept override
Closes an open object handle.
Definition GDI.h:43
virtual ~gdi_handle()
Closes an open object handle.
Definition GDI.h:31
-
Base abstract template class to support generic object handle keeping.
Definition Common.h:1020
-
handle_type m_h
Object handle.
Definition Common.h:1272
+
Base abstract template class to support generic object handle keeping.
Definition Common.h:1000
+
handle_type m_h
Object handle.
Definition Common.h:1252
Windows HICON wrapper class.
Definition GDI.h:53
void free_internal() noexcept override
Closes an open object handle.
Definition GDI.h:74
virtual ~icon()
Closes an open object handle.
Definition GDI.h:62
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
Device context wrapper class.
Definition GDI.h:115
HWND m_hwnd
Window handle.
Definition GDI.h:176
window_dc(handle_type h, HWND hwnd) noexcept
Initializes a device context from existing data.
Definition GDI.h:127
@@ -292,11 +292,11 @@ $(function() { codefold.init(0); });
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition Common.h:67
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition Common.h:75
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
-
static const T invalid
Invalid handle value.
Definition Common.h:1030
+
static const T invalid
Invalid handle value.
Definition Common.h:1010
diff --git a/_m_s_i_8h_source.html b/_m_s_i_8h_source.html index d9d56f51..462f44d0 100644 --- a/_m_s_i_8h_source.html +++ b/_m_s_i_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -117,303 +117,283 @@ $(function() { codefold.init(0); });
34 return ERROR_SUCCESS;
35 } else if (uiResult == ERROR_MORE_DATA) {
36 // Allocate buffer on heap to read the string data into and read it.
-
37 std::unique_ptr<char[]> szBuffer(new char[++dwSize]);
-
38 uiResult = ::MsiGetPropertyA(hInstall, szName, szBuffer.get(), &dwSize);
-
39 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
40 return uiResult;
-
41 } else {
-
42 // Return error code.
-
43 return uiResult;
-
44 }
-
45}
+
37 sValue.resize(dwSize++);
+
38 return ::MsiGetPropertyA(hInstall, szName, &sValue[0], &dwSize);
+
39 } else {
+
40 // Return error code.
+
41 return uiResult;
+
42 }
+
43}
-
46
-
52template<class _Traits, class _Ax>
-
-
53static UINT MsiGetPropertyW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szName, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
54{
-
55 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
56 DWORD dwSize = _countof(szStackBuffer);
-
57 UINT uiResult;
-
58
-
59 // Try with stack buffer first.
-
60 uiResult = ::MsiGetPropertyW(hInstall, szName, szStackBuffer, &dwSize);
-
61 if (uiResult == ERROR_SUCCESS) {
-
62 // Copy from stack.
-
63 sValue.assign(szStackBuffer, dwSize);
-
64 return ERROR_SUCCESS;
-
65 } else if (uiResult == ERROR_MORE_DATA) {
-
66 // Allocate buffer on heap to read the string data into and read it.
-
67 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++dwSize]);
-
68 uiResult = ::MsiGetPropertyW(hInstall, szName, szBuffer.get(), &dwSize);
-
69 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
70 return uiResult;
-
71 } else {
-
72 // Return error code.
-
73 return uiResult;
-
74 }
-
75}
+
44
+
50template<class _Traits, class _Ax>
+
+
51static UINT MsiGetPropertyW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szName, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
+
52{
+
53 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
54 DWORD dwSize = _countof(szStackBuffer);
+
55 UINT uiResult;
+
56
+
57 // Try with stack buffer first.
+
58 uiResult = ::MsiGetPropertyW(hInstall, szName, szStackBuffer, &dwSize);
+
59 if (uiResult == ERROR_SUCCESS) {
+
60 // Copy from stack.
+
61 sValue.assign(szStackBuffer, dwSize);
+
62 return ERROR_SUCCESS;
+
63 } else if (uiResult == ERROR_MORE_DATA) {
+
64 // Allocate buffer on heap to read the string data into and read it.
+
65 sValue.resize(dwSize++);
+
66 return ::MsiGetPropertyW(hInstall, szName, &sValue[0], &dwSize);
+
67 } else {
+
68 // Return error code.
+
69 return uiResult;
+
70 }
+
71}
-
76
-
78template<class _Traits, class _Ax>
-
-
79static UINT MsiRecordGetStringA(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
-
80{
-
81 assert(0); // TODO: Test this code.
+
72
+
74template<class _Traits, class _Ax>
+
+
75static UINT MsiRecordGetStringA(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
+
76{
+
77 assert(0); // TODO: Test this code.
+
78
+
79 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
80 DWORD dwSize = _countof(szStackBuffer);
+
81 UINT uiResult;
82
-
83 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
84 DWORD dwSize = _countof(szStackBuffer);
-
85 UINT uiResult;
-
86
-
87 // Try with stack buffer first.
-
88 uiResult = ::MsiRecordGetStringA(hRecord, iField, szStackBuffer, &dwSize);
-
89 if (uiResult == ERROR_SUCCESS) {
-
90 // Copy from stack.
-
91 sValue.assign(szStackBuffer, dwSize);
-
92 return ERROR_SUCCESS;
-
93 } else if (uiResult == ERROR_MORE_DATA) {
-
94 // Allocate buffer on heap to read the string data into and read it.
-
95 std::unique_ptr<char[]> szBuffer(new char[++dwSize]);
-
96 uiResult = ::MsiRecordGetStringA(hRecord, iField, szBuffer.get(), &dwSize);
-
97 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
98 return uiResult;
-
99 } else {
-
100 // Return error code.
-
101 return uiResult;
-
102 }
-
103}
+
83 // Try with stack buffer first.
+
84 uiResult = ::MsiRecordGetStringA(hRecord, iField, szStackBuffer, &dwSize);
+
85 if (uiResult == ERROR_SUCCESS) {
+
86 // Copy from stack.
+
87 sValue.assign(szStackBuffer, dwSize);
+
88 return ERROR_SUCCESS;
+
89 } else if (uiResult == ERROR_MORE_DATA) {
+
90 // Allocate buffer on heap to read the string data into and read it.
+
91 sValue.resize(dwSize++);
+
92 return ::MsiRecordGetStringA(hRecord, iField, &sValue[0], &dwSize);
+
93 } else {
+
94 // Return error code.
+
95 return uiResult;
+
96 }
+
97}
-
104
-
110template<class _Traits, class _Ax>
-
-
111static UINT MsiRecordGetStringW(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
112{
-
113 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
114 DWORD dwSize = _countof(szStackBuffer);
-
115 UINT uiResult;
-
116
-
117 // Try with stack buffer first.
-
118 uiResult = ::MsiRecordGetStringW(hRecord, iField, szStackBuffer, &dwSize);
-
119 if (uiResult == ERROR_SUCCESS) {
-
120 // Copy from stack.
-
121 sValue.assign(szStackBuffer, dwSize);
-
122 return ERROR_SUCCESS;
-
123 } else if (uiResult == ERROR_MORE_DATA) {
-
124 // Allocate buffer on heap to read the string data into and read it.
-
125 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++dwSize]);
-
126 uiResult = ::MsiRecordGetStringW(hRecord, iField, szBuffer.get(), &dwSize);
-
127 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
128 return uiResult;
-
129 } else {
-
130 // Return error code.
-
131 return uiResult;
-
132 }
-
133}
+
98
+
104template<class _Traits, class _Ax>
+
+
105static UINT MsiRecordGetStringW(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
+
106{
+
107 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
108 DWORD dwSize = _countof(szStackBuffer);
+
109 UINT uiResult;
+
110
+
111 // Try with stack buffer first.
+
112 uiResult = ::MsiRecordGetStringW(hRecord, iField, szStackBuffer, &dwSize);
+
113 if (uiResult == ERROR_SUCCESS) {
+
114 // Copy from stack.
+
115 sValue.assign(szStackBuffer, dwSize);
+
116 return ERROR_SUCCESS;
+
117 } else if (uiResult == ERROR_MORE_DATA) {
+
118 // Allocate buffer on heap to read the string data into and read it.
+
119 sValue.resize(dwSize++);
+
120 return ::MsiRecordGetStringW(hRecord, iField, &sValue[0], &dwSize);
+
121 } else {
+
122 // Return error code.
+
123 return uiResult;
+
124 }
+
125}
-
134
-
136template<class _Traits, class _Ax>
-
-
137static UINT MsiFormatRecordA(_In_opt_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
-
138{
-
139 assert(0); // TODO: Test this code.
-
140
-
141 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
142 DWORD dwSize = _countof(szStackBuffer);
-
143 UINT uiResult;
-
144
-
145 // Try with stack buffer first.
-
146 uiResult = ::MsiFormatRecordA(hInstall, hRecord, szStackBuffer, &dwSize);
-
147 if (uiResult == ERROR_SUCCESS) {
-
148 // Copy from stack.
-
149 sValue.assign(szStackBuffer, dwSize);
-
150 return ERROR_SUCCESS;
-
151 } else if (uiResult == ERROR_MORE_DATA) {
-
152 // Allocate buffer on heap to format the string data into and read it.
-
153 std::unique_ptr<char[]> szBuffer(new char[++dwSize]);
-
154 uiResult = ::MsiFormatRecordA(hInstall, hRecord, szBuffer.get(), &dwSize);
-
155 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
156 return uiResult;
-
157 } else {
-
158 // Return error code.
-
159 return uiResult;
-
160 }
-
161}
+
126
+
128template<class _Traits, class _Ax>
+
+
129static UINT MsiFormatRecordA(_In_opt_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
+
130{
+
131 assert(0); // TODO: Test this code.
+
132
+
133 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
134 DWORD dwSize = _countof(szStackBuffer);
+
135 UINT uiResult;
+
136
+
137 // Try with stack buffer first.
+
138 uiResult = ::MsiFormatRecordA(hInstall, hRecord, szStackBuffer, &dwSize);
+
139 if (uiResult == ERROR_SUCCESS) {
+
140 // Copy from stack.
+
141 sValue.assign(szStackBuffer, dwSize);
+
142 return ERROR_SUCCESS;
+
143 } else if (uiResult == ERROR_MORE_DATA) {
+
144 // Allocate buffer on heap to format the string data into and read it.
+
145 sValue.resize(dwSize++);
+
146 return ::MsiFormatRecordA(hInstall, hRecord, &sValue[0], &dwSize);
+
147 } else {
+
148 // Return error code.
+
149 return uiResult;
+
150 }
+
151}
-
162
-
168template<class _Traits, class _Ax>
-
-
169static UINT MsiFormatRecordW(_In_opt_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
170{
-
171 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
172 DWORD dwSize = _countof(szStackBuffer);
-
173 UINT uiResult;
-
174
-
175 // Try with stack buffer first.
-
176 uiResult = ::MsiFormatRecordW(hInstall, hRecord, szStackBuffer, &dwSize);
-
177 if (uiResult == ERROR_SUCCESS) {
-
178 // Copy from stack.
-
179 sValue.assign(szStackBuffer, dwSize);
-
180 return ERROR_SUCCESS;
-
181 } else if (uiResult == ERROR_MORE_DATA) {
-
182 // Allocate buffer on heap to format the string data into and read it.
-
183 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++dwSize]);
-
184 uiResult = ::MsiFormatRecordW(hInstall, hRecord, szBuffer.get(), &dwSize);
-
185 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
186 return uiResult;
-
187 } else {
-
188 // Return error code.
-
189 return uiResult;
-
190 }
-
191}
+
152
+
158template<class _Traits, class _Ax>
+
+
159static UINT MsiFormatRecordW(_In_opt_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
+
160{
+
161 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
162 DWORD dwSize = _countof(szStackBuffer);
+
163 UINT uiResult;
+
164
+
165 // Try with stack buffer first.
+
166 uiResult = ::MsiFormatRecordW(hInstall, hRecord, szStackBuffer, &dwSize);
+
167 if (uiResult == ERROR_SUCCESS) {
+
168 // Copy from stack.
+
169 sValue.assign(szStackBuffer, dwSize);
+
170 return ERROR_SUCCESS;
+
171 } else if (uiResult == ERROR_MORE_DATA) {
+
172 // Allocate buffer on heap to format the string data into and read it.
+
173 sValue.resize(dwSize++);
+
174 return ::MsiFormatRecordW(hInstall, hRecord, &sValue[0], &dwSize);
+
175 } else {
+
176 // Return error code.
+
177 return uiResult;
+
178 }
+
179}
-
192
-
198template<class _Ty, class _Ax>
-
-
199static UINT MsiRecordReadStream(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::vector<_Ty, _Ax> &binData)
-
200{
-
201 assert(0); // TODO: Test this code.
-
202
-
203 DWORD dwSize = 0;
-
204 UINT uiResult;
-
205
-
206 // Query the actual data length first.
-
207 uiResult = ::MsiRecordReadStream(hRecord, iField, NULL, &dwSize);
-
208 if (uiResult == ERROR_SUCCESS) {
-
209 binData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
210 return ::MsiRecordReadStream(hRecord, iField, reinterpret_cast<char*>(binData.data()), &dwSize);
-
211 } else {
-
212 // Return error code.
-
213 return uiResult;
-
214 }
-
215}
+
180
+
186template<class _Ty, class _Ax>
+
+
187static UINT MsiRecordReadStream(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::vector<_Ty, _Ax> &binData)
+
188{
+
189 assert(0); // TODO: Test this code.
+
190
+
191 DWORD dwSize = 0;
+
192 UINT uiResult;
+
193
+
194 // Query the actual data length first.
+
195 uiResult = ::MsiRecordReadStream(hRecord, iField, NULL, &dwSize);
+
196 if (uiResult == ERROR_SUCCESS) {
+
197 binData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
198 return ::MsiRecordReadStream(hRecord, iField, reinterpret_cast<char*>(binData.data()), &dwSize);
+
199 } else {
+
200 // Return error code.
+
201 return uiResult;
+
202 }
+
203}
-
216
-
218template<class _Traits, class _Ax>
-
-
219static UINT MsiGetTargetPathA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szFolder, _Out_ std::basic_string<char, _Traits, _Ax> &sValue)
-
220{
-
221 assert(0); // TODO: Test this code.
-
222
-
223 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
224 DWORD dwSize = _countof(szStackBuffer);
-
225 UINT uiResult;
-
226
-
227 // Try with stack buffer first.
-
228 uiResult = ::MsiGetTargetPathA(hInstall, szFolder, szStackBuffer, &dwSize);
-
229 if (uiResult == ERROR_SUCCESS) {
-
230 // Copy from stack.
-
231 sValue.assign(szStackBuffer, dwSize);
-
232 return ERROR_SUCCESS;
-
233 } else if (uiResult == ERROR_MORE_DATA) {
-
234 // Allocate buffer on heap to format the string data into and read it.
-
235 std::unique_ptr<char[]> szBuffer(new char[++dwSize]);
-
236 uiResult = ::MsiGetTargetPathA(hInstall, szFolder, szBuffer.get(), &dwSize);
-
237 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
238 return uiResult;
-
239 } else {
-
240 // Return error code.
-
241 return uiResult;
-
242 }
-
243}
+
204
+
206template<class _Traits, class _Ax>
+
+
207static UINT MsiGetTargetPathA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szFolder, _Out_ std::basic_string<char, _Traits, _Ax> &sValue)
+
208{
+
209 assert(0); // TODO: Test this code.
+
210
+
211 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
212 DWORD dwSize = _countof(szStackBuffer);
+
213 UINT uiResult;
+
214
+
215 // Try with stack buffer first.
+
216 uiResult = ::MsiGetTargetPathA(hInstall, szFolder, szStackBuffer, &dwSize);
+
217 if (uiResult == ERROR_SUCCESS) {
+
218 // Copy from stack.
+
219 sValue.assign(szStackBuffer, dwSize);
+
220 return ERROR_SUCCESS;
+
221 } else if (uiResult == ERROR_MORE_DATA) {
+
222 // Allocate buffer on heap to format the string data into and read it.
+
223 sValue.resize(dwSize++);
+
224 return ::MsiGetTargetPathA(hInstall, szFolder, &sValue[0], &dwSize);
+
225 } else {
+
226 // Return error code.
+
227 return uiResult;
+
228 }
+
229}
-
244
-
250template<class _Traits, class _Ax>
-
-
251static UINT MsiGetTargetPathW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szFolder, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
252{
-
253 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
254 DWORD dwSize = _countof(szStackBuffer);
-
255 UINT uiResult;
-
256
-
257 // Try with stack buffer first.
-
258 uiResult = ::MsiGetTargetPathW(hInstall, szFolder, szStackBuffer, &dwSize);
-
259 if (uiResult == ERROR_SUCCESS) {
-
260 // Copy from stack.
-
261 sValue.assign(szStackBuffer, dwSize);
-
262 return ERROR_SUCCESS;
-
263 } else if (uiResult == ERROR_MORE_DATA) {
-
264 // Allocate buffer on heap to format the string data into and read it.
-
265 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++dwSize]);
-
266 uiResult = ::MsiGetTargetPathW(hInstall, szFolder, szBuffer.get(), &dwSize);
-
267 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
268 return uiResult;
-
269 } else {
-
270 // Return error code.
-
271 return uiResult;
-
272 }
-
273}
+
230
+
236template<class _Traits, class _Ax>
+
+
237static UINT MsiGetTargetPathW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szFolder, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
+
238{
+
239 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
240 DWORD dwSize = _countof(szStackBuffer);
+
241 UINT uiResult;
+
242
+
243 // Try with stack buffer first.
+
244 uiResult = ::MsiGetTargetPathW(hInstall, szFolder, szStackBuffer, &dwSize);
+
245 if (uiResult == ERROR_SUCCESS) {
+
246 // Copy from stack.
+
247 sValue.assign(szStackBuffer, dwSize);
+
248 return ERROR_SUCCESS;
+
249 } else if (uiResult == ERROR_MORE_DATA) {
+
250 // Allocate buffer on heap to format the string data into and read it.
+
251 sValue.resize(dwSize++);
+
252 return ::MsiGetTargetPathW(hInstall, szFolder, &sValue[0], &dwSize);
+
253 } else {
+
254 // Return error code.
+
255 return uiResult;
+
256 }
+
257}
+
+
258
+
260template<class _Traits, class _Ax>
+
+
261static INSTALLSTATE MsiGetComponentPathA(_In_z_ LPCSTR szProduct, _In_z_ LPCSTR szComponent, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
+
262{
+
263 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
264 DWORD dwSize = _countof(szStackBuffer);
+
265 INSTALLSTATE state;
+
266
+
267 // Try with stack buffer first.
+
268 state = ::MsiGetComponentPathA(szProduct, szComponent, szStackBuffer, &dwSize);
+
269 if (state >= INSTALLSTATE_BROKEN) {
+
270 // Copy from stack.
+
271 sValue.assign(szStackBuffer, dwSize);
+
272 return state;
+
273 } else if (state == INSTALLSTATE_MOREDATA) {
+
274 // Allocate buffer on heap to format the string data into and read it.
+
275 sValue.resize(dwSize++);
+
276 return ::MsiGetComponentPathA(szProduct, szComponent, &sValue[0], &dwSize);
+
277 } else {
+
278 // Return error code.
+
279 return state;
+
280 }
+
281}
-
274
-
276template<class _Traits, class _Ax>
-
-
277static INSTALLSTATE MsiGetComponentPathA(_In_z_ LPCSTR szProduct, _In_z_ LPCSTR szComponent, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
-
278{
-
279 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
280 DWORD dwSize = _countof(szStackBuffer);
-
281 INSTALLSTATE state;
282
-
283 // Try with stack buffer first.
-
284 state = ::MsiGetComponentPathA(szProduct, szComponent, szStackBuffer, &dwSize);
-
285 if (state >= INSTALLSTATE_BROKEN) {
-
286 // Copy from stack.
-
287 sValue.assign(szStackBuffer, dwSize);
-
288 return state;
-
289 } else if (state == INSTALLSTATE_MOREDATA) {
-
290 // Allocate buffer on heap to format the string data into and read it.
-
291 std::unique_ptr<char[]> szBuffer(new char[++dwSize]);
-
292 state = ::MsiGetComponentPathA(szProduct, szComponent, szBuffer.get(), &dwSize);
-
293 sValue.assign(szBuffer.get(), state >= INSTALLSTATE_BROKEN ? dwSize : 0);
-
294 return state;
-
295 } else {
-
296 // Return error code.
-
297 return state;
-
298 }
-
299}
+
288template<class _Traits, class _Ax>
+
+
289static INSTALLSTATE MsiGetComponentPathW(_In_z_ LPCWSTR szProduct, _In_z_ LPCWSTR szComponent, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
+
290{
+
291 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
292 DWORD dwSize = _countof(szStackBuffer);
+
293 INSTALLSTATE state;
+
294
+
295 // Try with stack buffer first.
+
296 state = ::MsiGetComponentPathW(szProduct, szComponent, szStackBuffer, &dwSize);
+
297 if (state >= INSTALLSTATE_BROKEN) {
+
298 // Copy from stack.
+
299 sValue.assign(szStackBuffer, dwSize);
+
300 return state;
+
301 } else if (state == INSTALLSTATE_MOREDATA) {
+
302 // Allocate buffer on heap to format the string data into and read it.
+
303 sValue.resize(dwSize++);
+
304 return ::MsiGetComponentPathW(szProduct, szComponent, &sValue[0], &dwSize);
+
305 } else {
+
306 // Return error code.
+
307 return state;
+
308 }
+
309}
-
300
-
306template<class _Traits, class _Ax>
-
-
307static INSTALLSTATE MsiGetComponentPathW(_In_z_ LPCWSTR szProduct, _In_z_ LPCWSTR szComponent, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
308{
-
309 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
310 DWORD dwSize = _countof(szStackBuffer);
-
311 INSTALLSTATE state;
-
312
-
313 // Try with stack buffer first.
-
314 state = ::MsiGetComponentPathW(szProduct, szComponent, szStackBuffer, &dwSize);
-
315 if (state >= INSTALLSTATE_BROKEN) {
-
316 // Copy from stack.
-
317 sValue.assign(szStackBuffer, dwSize);
-
318 return state;
-
319 } else if (state == INSTALLSTATE_MOREDATA) {
-
320 // Allocate buffer on heap to format the string data into and read it.
-
321 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++dwSize]);
-
322 state = ::MsiGetComponentPathW(szProduct, szComponent, szBuffer.get(), &dwSize);
-
323 sValue.assign(szBuffer.get(), state >= INSTALLSTATE_BROKEN ? dwSize : 0);
-
324 return state;
-
325 } else {
-
326 // Return error code.
-
327 return state;
-
328 }
-
329}
-
-
330
+
310
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition Common.h:94
-
static UINT MsiFormatRecordW(MSIHANDLE hInstall, MSIHANDLE hRecord, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Formats record field data and properties using a format string and stores it in a std::wstring string...
Definition MSI.h:169
-
static UINT MsiGetPropertyW(MSIHANDLE hInstall, LPCWSTR szName, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Gets the value for an installer property and stores it in a std::wstring string.
Definition MSI.h:53
-
static UINT MsiGetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder, std::basic_string< char, _Traits, _Ax > &sValue)
Returns the full target path for a folder in the Directory table and stores it in a std::wstring stri...
Definition MSI.h:219
-
static INSTALLSTATE MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent, std::basic_string< char, _Traits, _Ax > &sValue)
Returns the full path to an installed component. If the key path for the component is a registry key ...
Definition MSI.h:277
-
static UINT MsiRecordGetStringW(MSIHANDLE hRecord, unsigned int iField, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Returns the string value of a record field and stores it in a std::wstring string.
Definition MSI.h:111
-
static UINT MsiGetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Returns the full target path for a folder in the Directory table and stores it in a std::wstring stri...
Definition MSI.h:251
+
static UINT MsiFormatRecordW(MSIHANDLE hInstall, MSIHANDLE hRecord, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Formats record field data and properties using a format string and stores it in a std::wstring string...
Definition MSI.h:159
+
static UINT MsiGetPropertyW(MSIHANDLE hInstall, LPCWSTR szName, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Gets the value for an installer property and stores it in a std::wstring string.
Definition MSI.h:51
+
static UINT MsiGetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder, std::basic_string< char, _Traits, _Ax > &sValue)
Returns the full target path for a folder in the Directory table and stores it in a std::wstring stri...
Definition MSI.h:207
+
static INSTALLSTATE MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent, std::basic_string< char, _Traits, _Ax > &sValue)
Returns the full path to an installed component. If the key path for the component is a registry key ...
Definition MSI.h:261
+
static UINT MsiRecordGetStringW(MSIHANDLE hRecord, unsigned int iField, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Returns the string value of a record field and stores it in a std::wstring string.
Definition MSI.h:105
+
static UINT MsiGetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Returns the full target path for a folder in the Directory table and stores it in a std::wstring stri...
Definition MSI.h:237
static UINT MsiGetPropertyA(MSIHANDLE hInstall, LPCSTR szName, std::basic_string< char, _Traits, _Ax > &sValue)
Gets the value for an installer property and stores it in a std::wstring string.
Definition MSI.h:21
-
static UINT MsiFormatRecordA(MSIHANDLE hInstall, MSIHANDLE hRecord, std::basic_string< char, _Traits, _Ax > &sValue)
Formats record field data and properties using a format string and stores it in a std::wstring string...
Definition MSI.h:137
-
static UINT MsiRecordReadStream(MSIHANDLE hRecord, unsigned int iField, std::vector< _Ty, _Ax > &binData)
Reads bytes from a record stream field into a std::vector buffer.
Definition MSI.h:199
-
static INSTALLSTATE MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Returns the full path to an installed component. If the key path for the component is a registry key ...
Definition MSI.h:307
-
static UINT MsiRecordGetStringA(MSIHANDLE hRecord, unsigned int iField, std::basic_string< char, _Traits, _Ax > &sValue)
Returns the string value of a record field and stores it in a std::wstring string.
Definition MSI.h:79
+
static UINT MsiFormatRecordA(MSIHANDLE hInstall, MSIHANDLE hRecord, std::basic_string< char, _Traits, _Ax > &sValue)
Formats record field data and properties using a format string and stores it in a std::wstring string...
Definition MSI.h:129
+
static UINT MsiRecordReadStream(MSIHANDLE hRecord, unsigned int iField, std::vector< _Ty, _Ax > &binData)
Reads bytes from a record stream field into a std::vector buffer.
Definition MSI.h:187
+
static INSTALLSTATE MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Returns the full path to an installed component. If the key path for the component is a registry key ...
Definition MSI.h:289
+
static UINT MsiRecordGetStringA(MSIHANDLE hRecord, unsigned int iField, std::basic_string< char, _Traits, _Ax > &sValue)
Returns the string value of a record field and stores it in a std::wstring string.
Definition MSI.h:75
diff --git a/_s_d_d_l_8h_source.html b/_s_d_d_l_8h_source.html index 9a963a29..5f9c0cbb 100644 --- a/_s_d_d_l_8h_source.html +++ b/_s_d_d_l_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 2022-2023 Amebis
+
3 Copyright © 2022-2024 Amebis
4*/
5
7
@@ -184,7 +184,7 @@ $(function() { codefold.init(0); });
108
109#pragma warning(pop)
110
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
Definition SDDL.h:19
security_attributes(security_attributes &&a) noexcept
Moves an existing SECURITY_ATTRIBUTES.
Definition SDDL.h:36
~security_attributes()
Destroys the SECURITY_ATTRIBUTES.
Definition SDDL.h:47
@@ -196,7 +196,7 @@ $(function() { codefold.init(0); });
diff --git a/_sec_8h_source.html b/_sec_8h_source.html index c5b1b8b9..7024477c 100644 --- a/_sec_8h_source.html +++ b/_sec_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -116,309 +116,305 @@ $(function() { codefold.init(0); });
34 }
35 if (::GetLastError() == ERROR_MORE_DATA) {
36 // Allocate buffer on heap and retry.
-
37 std::unique_ptr<char[]> szBuffer(new char[ulSize]);
-
38 if (::GetUserNameExA(NameFormat, szBuffer.get(), &ulSize)) {
-
39 sName.assign(szBuffer.get(), ulSize);
-
40 return TRUE;
-
41 }
-
42 }
-
43 return FALSE;
-
44}
-
45
-
51template<class _Traits, class _Ax>
-
52static BOOLEAN GetUserNameExW(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sName)
-
53{
-
54 assert(0); // TODO: Test this code.
-
55
-
56 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
57 ULONG ulSize = _countof(szStackBuffer);
-
58
-
59 // Try with stack buffer first.
-
60 if (::GetUserNameExW(NameFormat, szStackBuffer, &ulSize)) {
-
61 // Copy from stack.
-
62 sName.assign(szStackBuffer, ulSize);
-
63 return TRUE;
-
64 }
-
65 if (::GetLastError() == ERROR_MORE_DATA) {
-
66 // Allocate buffer on heap and retry.
-
67 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[ulSize]);
-
68 if (::GetUserNameExW(NameFormat, szBuffer.get(), &ulSize)) {
-
69 sName.assign(szBuffer.get(), ulSize);
-
70 return TRUE;
-
71 }
-
72 }
-
73 return FALSE;
-
74}
+
37 sName.resize(ulSize - 1);
+
38 if (::GetUserNameExA(NameFormat, &ulSize[0], &ulSize))
+
39 return TRUE;
+
40 }
+
41 return FALSE;
+
42}
+
43
+
49template<class _Traits, class _Ax>
+
50static BOOLEAN GetUserNameExW(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sName)
+
51{
+
52 assert(0); // TODO: Test this code.
+
53
+
54 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
55 ULONG ulSize = _countof(szStackBuffer);
+
56
+
57 // Try with stack buffer first.
+
58 if (::GetUserNameExW(NameFormat, szStackBuffer, &ulSize)) {
+
59 // Copy from stack.
+
60 sName.assign(szStackBuffer, ulSize);
+
61 return TRUE;
+
62 }
+
63 if (::GetLastError() == ERROR_MORE_DATA) {
+
64 // Allocate buffer on heap and retry.
+
65 sName.resize(ulSize - 1);
+
66 if (::GetUserNameExW(NameFormat, &sName[0], &ulSize))
+
67 return TRUE;
+
68 }
+
69 return FALSE;
+
70}
+
71
+
72#endif
+
73
75
-
76#endif
-
77
-
79
-
80namespace winstd
-
81{
-
84
-
-
88 class sec_credentials : public handle<PCredHandle, NULL>
-
89 {
- -
91
-
92 public:
-
- -
97 {
-
98 m_expires.QuadPart = -1;
-
99 }
+
76namespace winstd
+
77{
+
80
+
+
84 class sec_credentials : public handle<PCredHandle, NULL>
+
85 {
+ +
87
+
88 public:
+
+ +
93 {
+
94 m_expires.QuadPart = -1;
+
95 }
-
100
-
- - -
109 handle(h)
-
110 {}
+
96
+ -
111
-
- -
118 m_expires(std::move(h.m_expires)),
-
119 handle<PCredHandle, NULL>(std::move(h))
-
120 {}
+
107
+
+ +
114 m_expires(std::move(h.m_expires)),
+
115 handle<PCredHandle, NULL>(std::move(h))
+
116 {}
-
121
-
- -
128 {
-
129 if (m_h != invalid)
- -
131 }
+
117
+
+ +
124 {
+
125 if (m_h != invalid)
+ +
127 }
-
132
-
- -
139 {
-
140 if (this != std::addressof(h)) {
-
141 *(handle<handle_type, NULL>*)this = std::move(h);
-
142 m_expires = std::move(h.m_expires);
-
143 }
-
144 return *this;
-
145 }
+
128
+
+ +
135 {
+
136 if (this != std::addressof(h)) {
+
137 *(handle<handle_type, NULL>*)this = std::move(h);
+
138 m_expires = std::move(h.m_expires);
+
139 }
+
140 return *this;
+
141 }
-
146
-
- - - -
159 _In_ unsigned long fCredentialUse,
-
160 _In_opt_ void *pvLogonId,
-
161 _In_opt_ void *pAuthData,
- - -
164 {
- - - -
168 if (SUCCEEDED(res)) {
-
169 attach(h);
-
170 m_expires = exp;
-
171 } else
-
172 delete h;
-
173 return res;
-
174 }
+
142
+
+ + + +
155 _In_ unsigned long fCredentialUse,
+
156 _In_opt_ void *pvLogonId,
+
157 _In_opt_ void *pAuthData,
+ + +
160 {
+ + + +
164 if (SUCCEEDED(res)) {
+
165 attach(h);
+
166 m_expires = exp;
+
167 } else
+
168 delete h;
+
169 return res;
+
170 }
-
175
-
176 protected:
-
-
182 void free_internal() noexcept override
-
183 {
- -
185 delete m_h;
-
186 }
+
171
+
172 protected:
+
+
178 void free_internal() noexcept override
+
179 {
+ +
181 delete m_h;
+
182 }
+
+
183
+
184 public:
+ +
186 };
187
-
188 public:
- -
190 };
+
+
191 class sec_context : public handle<PCtxtHandle, NULL>
+
192 {
+
193 public:
+
+ +
198 m_attrib(0),
+ +
200 {
+
201 m_expires.QuadPart = -1;
+
202 }
-
191
-
-
195 class sec_context : public handle<PCtxtHandle, NULL>
-
196 {
-
197 public:
-
- -
202 m_attrib(0),
- -
204 {
-
205 m_expires.QuadPart = -1;
-
206 }
+
203
+
+ +
210 m_attrib (std::move(h.m_attrib )),
+
211 m_expires(std::move(h.m_expires)),
+
212 handle<PCtxtHandle, NULL>(std::move(h))
+
213 {}
-
207
-
- -
214 m_attrib (std::move(h.m_attrib )),
-
215 m_expires(std::move(h.m_expires)),
-
216 handle<PCtxtHandle, NULL>(std::move(h))
-
217 {}
+
214
+
+
220 virtual ~sec_context()
+
221 {
+
222 if (m_h != invalid)
+ +
224 }
-
218
-
-
224 virtual ~sec_context()
-
225 {
-
226 if (m_h != invalid)
- -
228 }
+
225
+
+ +
232 {
+
233 if (this != std::addressof(h)) {
+
234 *(handle<handle_type, NULL>*)this = std::move(h);
+
235 m_attrib = std::move(h.m_attrib);
+
236 m_expires = std::move(h.m_expires);
+
237 }
+
238 return *this;
+
239 }
-
229
-
- -
236 {
-
237 if (this != std::addressof(h)) {
-
238 *(handle<handle_type, NULL>*)this = std::move(h);
-
239 m_attrib = std::move(h.m_attrib);
-
240 m_expires = std::move(h.m_expires);
-
241 }
-
242 return *this;
-
243 }
+
240
+
+ + + + + + + +
257 {
+ +
259 h->dwUpper = 0;
+
260 h->dwLower = 0;
+
261 ULONG attr;
+ + +
264 if (SUCCEEDED(res)) {
+
265 attach(h);
+
266 m_attrib = attr;
+
267 m_expires = exp;
+
268 } else
+
269 delete h;
+
270 return res;
+
271 }
-
244
-
- - - - - - - -
261 {
- -
263 h->dwUpper = 0;
-
264 h->dwLower = 0;
-
265 ULONG attr;
- - -
268 if (SUCCEEDED(res)) {
-
269 attach(h);
-
270 m_attrib = attr;
-
271 m_expires = exp;
-
272 } else
-
273 delete h;
-
274 return res;
-
275 }
+
272
+ -
276
-
- - - - - - - -
293 {
- -
295 }
+
292
+
293 protected:
+
+
299 void free_internal() noexcept override
+
300 {
+ +
302 delete m_h;
+
303 }
-
296
-
297 protected:
-
-
303 void free_internal() noexcept override
-
304 {
- -
306 delete m_h;
-
307 }
+
304
+
305 public:
+ + +
308 };
-
308
-
309 public:
- - -
312 };
+
309
+
+
313 class sec_buffer_desc : public SecBufferDesc
+
314 {
+
315 public:
+ -
313
-
-
317 class sec_buffer_desc : public SecBufferDesc
-
318 {
-
319 public:
-
- -
324 {
- -
326 cBuffers = count;
-
327 pBuffers = buf;
-
328 }
+
325
+
+ +
332 {
+
333 for (ULONG i = 0; i < cBuffers; i++) {
+
334 if (pBuffers[i].pvBuffer)
+ +
336 }
+
337 }
-
329
-
- -
336 {
-
337 for (ULONG i = 0; i < cBuffers; i++) {
-
338 if (pBuffers[i].pvBuffer)
- -
340 }
-
341 }
+
338 };
-
342 };
+
339
+
341
+
344
+
+
350 class sec_runtime_error : public num_runtime_error<SECURITY_STATUS>
+
351 {
+
352 public:
+ -
343
-
345
-
348
-
-
354 class sec_runtime_error : public num_runtime_error<SECURITY_STATUS>
-
355 {
-
356 public:
-
- -
364 {}
+
361
+ -
365
-
- -
373 {}
+
370
+ -
374
-
- -
381 {}
+
378 };
-
382 };
-
-
383
-
385}
-
Base abstract template class to support generic object handle keeping.
Definition Common.h:1020
-
handle_type m_h
Object handle.
Definition Common.h:1272
-
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition Common.h:1235
-
Numerical runtime error.
Definition Common.h:1477
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
-
SecBufferDesc wrapper class.
Definition Sec.h:318
-
virtual ~sec_buffer_desc()
Frees the security buffer descriptor.
Definition Sec.h:335
-
sec_buffer_desc(PSecBuffer buf, ULONG count, ULONG version=SECBUFFER_VERSION)
Initializes security buffer descriptor.
Definition Sec.h:323
-
PCtxtHandle wrapper class.
Definition Sec.h:196
-
sec_context(sec_context &&h) noexcept
Move constructor.
Definition Sec.h:213
-
SECURITY_STATUS process(PCredHandle phCredential, LPCTSTR pszTargetName, ULONG fContextReq, ULONG TargetDataRep, PSecBufferDesc pInput, PSecBufferDesc pOutput)
Continue security context.
Definition Sec.h:286
-
virtual ~sec_context()
Frees the security context.
Definition Sec.h:224
-
sec_context()
Initializes a new class instance with the object handle set to NULL.
Definition Sec.h:201
-
SECURITY_STATUS initialize(PCredHandle phCredential, LPCTSTR pszTargetName, ULONG fContextReq, ULONG TargetDataRep, PSecBufferDesc pInput, PSecBufferDesc pOutput)
Initializes security context.
Definition Sec.h:254
-
ULONG m_attrib
Context attributes.
Definition Sec.h:310
-
TimeStamp m_expires
Context expiration time.
Definition Sec.h:311
-
sec_context & operator=(sec_context &&h) noexcept
Move assignment.
Definition Sec.h:235
-
void free_internal() noexcept override
Frees the security context.
Definition Sec.h:303
-
PCredHandle wrapper class.
Definition Sec.h:89
-
sec_credentials()
Initializes a new class instance with the object handle set to NULL.
Definition Sec.h:96
-
void free_internal() noexcept override
Frees the security credentials.
Definition Sec.h:182
-
TimeStamp m_expires
Credentials expiration time.
Definition Sec.h:189
-
sec_credentials(sec_credentials &&h) noexcept
Move constructor.
Definition Sec.h:117
-
virtual ~sec_credentials()
Frees the security credentials.
Definition Sec.h:127
-
sec_credentials(handle_type h, const TimeStamp expires)
Initializes a new class with an already available object handle.
Definition Sec.h:107
-
SECURITY_STATUS acquire(LPTSTR pszPrincipal, LPTSTR pszPackage, unsigned long fCredentialUse, void *pvLogonId, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn=NULL, void *pvGetKeyArgument=NULL)
Acquires the security credentials.
Definition Sec.h:156
-
sec_credentials & operator=(sec_credentials &&h) noexcept
Move assignment.
Definition Sec.h:138
-
Security runtime error.
Definition Sec.h:355
-
sec_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition Sec.h:372
-
sec_runtime_error(const sec_runtime_error &other)
Copies an exception.
Definition Sec.h:380
-
sec_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition Sec.h:363
+
379
+
381}
+
Base abstract template class to support generic object handle keeping.
Definition Common.h:1000
+
handle_type m_h
Object handle.
Definition Common.h:1252
+
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition Common.h:1215
+
Numerical runtime error.
Definition Common.h:1457
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
+
SecBufferDesc wrapper class.
Definition Sec.h:314
+
virtual ~sec_buffer_desc()
Frees the security buffer descriptor.
Definition Sec.h:331
+
sec_buffer_desc(PSecBuffer buf, ULONG count, ULONG version=SECBUFFER_VERSION)
Initializes security buffer descriptor.
Definition Sec.h:319
+
PCtxtHandle wrapper class.
Definition Sec.h:192
+
sec_context(sec_context &&h) noexcept
Move constructor.
Definition Sec.h:209
+
SECURITY_STATUS process(PCredHandle phCredential, LPCTSTR pszTargetName, ULONG fContextReq, ULONG TargetDataRep, PSecBufferDesc pInput, PSecBufferDesc pOutput)
Continue security context.
Definition Sec.h:282
+
virtual ~sec_context()
Frees the security context.
Definition Sec.h:220
+
sec_context()
Initializes a new class instance with the object handle set to NULL.
Definition Sec.h:197
+
SECURITY_STATUS initialize(PCredHandle phCredential, LPCTSTR pszTargetName, ULONG fContextReq, ULONG TargetDataRep, PSecBufferDesc pInput, PSecBufferDesc pOutput)
Initializes security context.
Definition Sec.h:250
+
ULONG m_attrib
Context attributes.
Definition Sec.h:306
+
TimeStamp m_expires
Context expiration time.
Definition Sec.h:307
+
sec_context & operator=(sec_context &&h) noexcept
Move assignment.
Definition Sec.h:231
+
void free_internal() noexcept override
Frees the security context.
Definition Sec.h:299
+
PCredHandle wrapper class.
Definition Sec.h:85
+
sec_credentials()
Initializes a new class instance with the object handle set to NULL.
Definition Sec.h:92
+
void free_internal() noexcept override
Frees the security credentials.
Definition Sec.h:178
+
TimeStamp m_expires
Credentials expiration time.
Definition Sec.h:185
+
sec_credentials(sec_credentials &&h) noexcept
Move constructor.
Definition Sec.h:113
+
virtual ~sec_credentials()
Frees the security credentials.
Definition Sec.h:123
+
sec_credentials(handle_type h, const TimeStamp expires)
Initializes a new class with an already available object handle.
Definition Sec.h:103
+
SECURITY_STATUS acquire(LPTSTR pszPrincipal, LPTSTR pszPackage, unsigned long fCredentialUse, void *pvLogonId, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn=NULL, void *pvGetKeyArgument=NULL)
Acquires the security credentials.
Definition Sec.h:152
+
sec_credentials & operator=(sec_credentials &&h) noexcept
Move assignment.
Definition Sec.h:134
+
Security runtime error.
Definition Sec.h:351
+
sec_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition Sec.h:368
+
sec_runtime_error(const sec_runtime_error &other)
Copies an exception.
Definition Sec.h:376
+
sec_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition Sec.h:359
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition Common.h:67
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition Common.h:94
-
static const PCredHandle invalid
Invalid handle value.
Definition Common.h:1030
+
static const PCredHandle invalid
Invalid handle value.
Definition Common.h:1010
diff --git a/_setup_a_p_i_8h_source.html b/_setup_a_p_i_8h_source.html index 281cb230..82edeff1 100644 --- a/_setup_a_p_i_8h_source.html +++ b/_setup_a_p_i_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -167,9 +167,9 @@ $(function() { codefold.init(0); });
107
109}
-
Base abstract template class to support generic object handle keeping.
Definition Common.h:1020
-
handle_type m_h
Object handle.
Definition Common.h:1272
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
+
Base abstract template class to support generic object handle keeping.
Definition Common.h:1000
+
handle_type m_h
Object handle.
Definition Common.h:1252
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
HDEVINFO wrapper class.
Definition SetupAPI.h:26
virtual ~setup_device_info_list()
Frees the device information set.
Definition SetupAPI.h:35
void free_internal() noexcept override
Frees the device information set.
Definition SetupAPI.h:47
@@ -180,11 +180,11 @@ $(function() { codefold.init(0); });
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition Common.h:67
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition Common.h:75
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
-
static const HDEVINFO invalid
Invalid handle value.
Definition Common.h:1030
+
static const HDEVINFO invalid
Invalid handle value.
Definition Common.h:1010
diff --git a/_shell_8h_source.html b/_shell_8h_source.html index b446ff1c..0b91f0d0 100644 --- a/_shell_8h_source.html +++ b/_shell_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -171,7 +171,7 @@ $(function() { codefold.init(0); });
diff --git a/_w_l_a_n_8h_source.html b/_w_l_a_n_8h_source.html index d58e8bd7..f3929576 100644 --- a/_w_l_a_n_8h_source.html +++ b/_w_l_a_n_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -116,15 +116,15 @@ $(function() { codefold.init(0); });
43 sSize = SIZETAdd(sSize, 1024);
44 if (sSize > DWORD_MAX)
45 throw std::runtime_exception("Data too big");
-
46 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[sSize]);
+
46 sValue.resize(sSize - 1);
47
48 // Try!
-
49 DWORD dwResult = ::pfnWlanReasonCodeToString(dwReasonCode, static_cast<DWORD>(sSize), szBuffer.get(), pReserved);
+
49 DWORD dwResult = ::pfnWlanReasonCodeToString(dwReasonCode, static_cast<DWORD>(sSize), &sValue[0], pReserved);
50 if (dwResult == ERROR_SUCCESS) {
-
51 SIZE_T sLength = wcsnlen(szBuffer.get(), sSize);
+
51 SIZE_T sLength = wcsnlen(&sValue[0], sSize);
52 if (sLength < sSize - 1) {
53 // Buffer was long enough.
-
54 sValue.assign(szBuffer.get(), sLength);
+
54 sValue.resize(sLength);
55 return ERROR_SUCCESS;
56 }
57 } else {
@@ -224,14 +224,14 @@ $(function() { codefold.init(0); });
183}
184
-
Base abstract template class to support generic object handle keeping.
Definition Common.h:1020
-
handle_type m_h
Object handle.
Definition Common.h:1272
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
+
Base abstract template class to support generic object handle keeping.
Definition Common.h:1000
+
handle_type m_h
Object handle.
Definition Common.h:1252
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
WLAN handle wrapper.
Definition WLAN.h:133
virtual ~wlan_handle()
Closes a connection to the server.
Definition WLAN.h:142
void free_internal() noexcept override
Closes a connection to the server.
Definition WLAN.h:154
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
-
static const HANDLE invalid
Invalid handle value.
Definition Common.h:1030
+
static const HANDLE invalid
Invalid handle value.
Definition Common.h:1010
static DWORD WlanOpenHandle(DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, winstd::wlan_handle &handle)
Opens a connection to the server.
Definition WLAN.h:172
static DWORD WlanReasonCodeToString(DWORD dwReasonCode, std::basic_string< wchar_t, _Traits, _Ax > &sValue, __reserved PVOID pReserved)
Retrieves a string that describes a specified reason code and stores it in a std::wstring string.
Definition WLAN.h:34
WlanFreeMemory_delete()
Default construct.
Definition WLAN.h:107
@@ -246,7 +246,7 @@ $(function() { codefold.init(0); });
diff --git a/_win_8h_source.html b/_win_8h_source.html index ccf3f239..d41a3026 100644 --- a/_win_8h_source.html +++ b/_win_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -121,10 +121,10 @@ $(function() { codefold.init(0); });
38 } else {
39 for (DWORD dwCapacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(char);; dwCapacity *= 2) {
40 // Allocate on heap and retry.
-
41 std::unique_ptr<char[]> szBuffer(new char[dwCapacity]);
-
42 dwResult = ::GetModuleFileNameA(hModule, szBuffer.get(), dwCapacity);
+
41 sValue.resize(dwCapacity - 1);
+
42 dwResult = ::GetModuleFileNameA(hModule, &sValue[0], dwCapacity);
43 if (dwResult < dwCapacity) {
-
44 sValue.assign(szBuffer.get(), dwResult);
+
44 sValue.resize(dwResult);
45 return dwResult;
46 }
47 }
@@ -147,10 +147,10 @@ $(function() { codefold.init(0); });
67 } else {
68 for (DWORD dwCapacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t);; dwCapacity *= 2) {
69 // Allocate on heap and retry.
-
70 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwCapacity]);
-
71 dwResult = ::GetModuleFileNameW(hModule, szBuffer.get(), dwCapacity);
+
70 sValue.resize(dwCapacity - 1);
+
71 dwResult = ::GetModuleFileNameW(hModule, &sValue[0], dwCapacity);
72 if (dwResult < dwCapacity) {
-
73 sValue.assign(szBuffer.get(), dwResult);
+
73 sValue.resize(dwResult);
74 return dwResult;
75 }
76 }
@@ -169,1871 +169,1849 @@ $(function() { codefold.init(0); });
88 // Query the final string length first.
89 iResult = ::GetWindowTextLengthA(hWnd);
90 if (iResult > 0) {
-
91 if (++iResult < WINSTD_STACK_BUFFER_BYTES/sizeof(char)) {
-
92 // Read string data to stack.
-
93 char szBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
94 iResult = ::GetWindowTextA(hWnd, szBuffer, _countof(szBuffer));
-
95 sValue.assign(szBuffer, iResult);
-
96 } else {
-
97 // Allocate buffer on heap and read the string data into it.
-
98 std::unique_ptr<char[]> szBuffer(new char[++iResult]);
-
99 iResult = ::GetWindowTextA(hWnd, szBuffer.get(), iResult);
-
100 sValue.assign(szBuffer.get(), iResult);
-
101 }
-
102 return iResult;
-
103 }
-
104
-
105 sValue.clear();
-
106 return 0;
-
107}
+
91 // Allocate buffer on heap and read the string data into it.
+
92 sValue.resize(iResult++);
+
93 return ::GetWindowTextA(hWnd, &sValue[0], iResult);
+
94 }
+
95
+
96 sValue.clear();
+
97 return 0;
+
98}
-
108
-
114template<class _Traits, class _Ax>
-
-
115static _Success_(return != 0) int GetWindowTextW(_In_ HWND hWnd, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
-
116{
-
117 assert(0); // TODO: Test this code.
-
118
-
119 int iResult;
-
120
-
121 // Query the final string length first.
-
122 iResult = ::GetWindowTextLengthW(hWnd);
-
123 if (iResult > 0) {
-
124 if (++iResult < WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)) {
-
125 // Read string data to stack.
-
126 wchar_t szBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
127 iResult = ::GetWindowTextW(hWnd, szBuffer, _countof(szBuffer));
-
128 sValue.assign(szBuffer, iResult);
-
129 } else {
-
130 // Allocate buffer on heap and read the string data into it.
-
131 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++iResult]);
-
132 iResult = ::GetWindowTextW(hWnd, szBuffer.get(), iResult);
-
133 sValue.assign(szBuffer.get(), iResult);
-
134 }
-
135 return iResult;
-
136 }
-
137
-
138 sValue.clear();
-
139 return 0;
-
140}
+
99
+
105template<class _Traits, class _Ax>
+
+
106static _Success_(return != 0) int GetWindowTextW(_In_ HWND hWnd, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
+
107{
+
108 assert(0); // TODO: Test this code.
+
109
+
110 int iResult;
+
111
+
112 // Query the final string length first.
+
113 iResult = ::GetWindowTextLengthW(hWnd);
+
114 if (iResult > 0) {
+
115 // Allocate buffer on heap and read the string data into it.
+
116 sValue.resize(iResult++);
+
117 return ::GetWindowTextW(hWnd, &sValue[0], iResult);
+
118 }
+
119
+
120 sValue.clear();
+
121 return 0;
+
122}
-
141
-
143template<class _Ty, class _Ax>
-
-
144static _Success_(return != 0) BOOL GetFileVersionInfoA(_In_z_ LPCSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
-
145{
-
146 assert(0); // TODO: Test this code.
-
147
-
148 // Get version info size.
-
149 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeA(lptstrFilename, &dwHandle);
-
150 if (dwVerInfoSize != 0) {
-
151 // Read version info.
-
152 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
153 return ::GetFileVersionInfoA(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
-
154 } else
-
155 return FALSE;
-
156}
+
123
+
125template<class _Ty, class _Ax>
+
+
126static _Success_(return != 0) BOOL GetFileVersionInfoA(_In_z_ LPCSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
+
127{
+
128 assert(0); // TODO: Test this code.
+
129
+
130 // Get version info size.
+
131 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeA(lptstrFilename, &dwHandle);
+
132 if (dwVerInfoSize != 0) {
+
133 // Read version info.
+
134 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
135 return ::GetFileVersionInfoA(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
+
136 } else
+
137 return FALSE;
+
138}
-
157
-
163template<class _Ty, class _Ax>
-
-
164static _Success_(return != 0) BOOL GetFileVersionInfoW(_In_z_ LPCWSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
-
165{
-
166 assert(0); // TODO: Test this code.
-
167
-
168 // Get version info size.
-
169 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeW(lptstrFilename, &dwHandle);
-
170 if (dwVerInfoSize != 0) {
-
171 // Read version info.
-
172 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
173 return ::GetFileVersionInfoW(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
-
174 } else
-
175 return FALSE;
-
176}
+
139
+
145template<class _Ty, class _Ax>
+
+
146static _Success_(return != 0) BOOL GetFileVersionInfoW(_In_z_ LPCWSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
+
147{
+
148 assert(0); // TODO: Test this code.
+
149
+
150 // Get version info size.
+
151 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeW(lptstrFilename, &dwHandle);
+
152 if (dwVerInfoSize != 0) {
+
153 // Read version info.
+
154 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
155 return ::GetFileVersionInfoW(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
+
156 } else
+
157 return FALSE;
+
158}
-
177
-
179template<class _Traits, class _Ax>
-
-
180static _Success_(return != 0) DWORD ExpandEnvironmentStringsA(_In_z_ LPCSTR lpSrc, _Out_ std::basic_string<char, _Traits, _Ax> &sValue)
-
181{
-
182 assert(0); // TODO: Test this code.
-
183
-
184 for (SIZE_T sSizeOut = SIZETAdd(strlen(lpSrc), 0x100);;) {
-
185 if (sSizeOut > DWORD_MAX)
-
186 throw std::invalid_argument("String too big");
-
187 DWORD dwSizeIn = static_cast<DWORD>(sSizeOut);
-
188 std::unique_ptr<char[]> szBuffer(new char[(size_t)dwSizeIn + 2]); // Note: ANSI version requires one extra char.
-
189 sSizeOut = ::ExpandEnvironmentStringsA(lpSrc, szBuffer.get(), dwSizeIn);
-
190 if (sSizeOut == 0) {
-
191 // Error or zero-length input.
-
192 break;
-
193 } else if (sSizeOut <= dwSizeIn) {
-
194 // The buffer was sufficient.
-
195 sValue.assign(szBuffer.get(), sSizeOut - 1);
-
196 return static_cast<DWORD>(sSizeOut);
-
197 }
-
198 }
-
199
-
200 sValue.clear();
-
201 return 0;
-
202}
+
159
+
161template<class _Traits, class _Ax>
+
+
162static _Success_(return != 0) DWORD ExpandEnvironmentStringsA(_In_z_ LPCSTR lpSrc, _Out_ std::basic_string<char, _Traits, _Ax> &sValue)
+
163{
+
164 assert(0); // TODO: Test this code.
+
165
+
166 for (SIZE_T sSizeOut = SIZETAdd(strlen(lpSrc), 0x100);;) {
+
167 if (sSizeOut > DWORD_MAX)
+
168 throw std::invalid_argument("String too big");
+
169 DWORD dwSizeIn = static_cast<DWORD>(sSizeOut);
+
170 sValue.resize((size_t)dwSizeIn + 1); // Note: ANSI version requires one extra char.
+
171 sSizeOut = ::ExpandEnvironmentStringsA(lpSrc, &sValue[0], dwSizeIn);
+
172 if (sSizeOut == 0) {
+
173 // Error or zero-length input.
+
174 break;
+
175 } else if (sSizeOut <= dwSizeIn) {
+
176 // The buffer was sufficient.
+
177 sValue.resize(sSizeOut - 1);
+
178 return static_cast<DWORD>(sSizeOut);
+
179 }
+
180 }
+
181
+
182 sValue.clear();
+
183 return 0;
+
184}
+
+
185
+
191template<class _Traits, class _Ax>
+
+
192static _Success_(return != 0) DWORD ExpandEnvironmentStringsW(_In_z_ LPCWSTR lpSrc, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
+
193{
+
194 for (SIZE_T sSizeOut = SIZETAdd(wcslen(lpSrc), 0x100);;) {
+
195 if (sSizeOut > DWORD_MAX)
+
196 throw std::invalid_argument("String too big");
+
197 DWORD dwSizeIn = static_cast<DWORD>(sSizeOut);
+
198 sValue.resize(dwSizeIn);
+
199 sSizeOut = ::ExpandEnvironmentStringsW(lpSrc, &sValue[0], dwSizeIn);
+
200 if (sSizeOut == 0) {
+
201 // Error or zero-length input.
+
202 break;
+
203 } else if (sSizeOut <= dwSizeIn) {
+
204 // The buffer was sufficient.
+
205 sValue.resize(sSizeOut - 1);
+
206 return static_cast<DWORD>(sSizeOut);
+
207 }
+
208 }
+
209
+
210 sValue.clear();
+
211 return 0;
+
212}
+
+
213
+
215template<class _Traits, class _Ax>
+
+
216static VOID GuidToStringA(_In_ LPCGUID lpGuid, _Out_ std::basic_string<char, _Traits, _Ax> &str) noexcept
+
217{
+
218 assert(0); // TODO: Test this code.
+
219
+
220 sprintf(str, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+
221 lpGuid->Data1,
+
222 lpGuid->Data2,
+
223 lpGuid->Data3,
+
224 lpGuid->Data4[0], lpGuid->Data4[1],
+
225 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
+
226}
-
203
-
209template<class _Traits, class _Ax>
-
-
210static _Success_(return != 0) DWORD ExpandEnvironmentStringsW(_In_z_ LPCWSTR lpSrc, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
211{
-
212 for (SIZE_T sSizeOut = SIZETAdd(wcslen(lpSrc), 0x100);;) {
-
213 if (sSizeOut > DWORD_MAX)
-
214 throw std::invalid_argument("String too big");
-
215 DWORD dwSizeIn = static_cast<DWORD>(sSizeOut);
-
216 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[(size_t)dwSizeIn + 1]);
-
217 sSizeOut = ::ExpandEnvironmentStringsW(lpSrc, szBuffer.get(), dwSizeIn);
-
218 if (sSizeOut == 0) {
-
219 // Error or zero-length input.
-
220 break;
-
221 } else if (sSizeOut <= dwSizeIn) {
-
222 // The buffer was sufficient.
-
223 sValue.assign(szBuffer.get(), sSizeOut - 1);
-
224 return static_cast<DWORD>(sSizeOut);
-
225 }
-
226 }
227
-
228 sValue.clear();
-
229 return 0;
-
230}
-
-
231
-
233template<class _Traits, class _Ax>
-
-
234static VOID GuidToStringA(_In_ LPCGUID lpGuid, _Out_ std::basic_string<char, _Traits, _Ax> &str) noexcept
-
235{
-
236 assert(0); // TODO: Test this code.
-
237
-
238 sprintf(str, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-
239 lpGuid->Data1,
-
240 lpGuid->Data2,
-
241 lpGuid->Data3,
-
242 lpGuid->Data4[0], lpGuid->Data4[1],
-
243 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
-
244}
-
-
245
-
252template<class _Traits, class _Ax>
-
-
253static VOID GuidToStringW(_In_ LPCGUID lpGuid, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &str) noexcept
-
254{
-
255 assert(0); // TODO: Test this code.
-
256
-
257 sprintf(str, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-
258 lpGuid->Data1,
-
259 lpGuid->Data2,
-
260 lpGuid->Data3,
-
261 lpGuid->Data4[0], lpGuid->Data4[1],
-
262 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
-
263}
+
234template<class _Traits, class _Ax>
+
+
235static VOID GuidToStringW(_In_ LPCGUID lpGuid, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &str) noexcept
+
236{
+
237 assert(0); // TODO: Test this code.
+
238
+
239 sprintf(str, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+
240 lpGuid->Data1,
+
241 lpGuid->Data2,
+
242 lpGuid->Data3,
+
243 lpGuid->Data4[0], lpGuid->Data4[1],
+
244 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
+
245}
+
246
+
248#ifdef _UNICODE
+
249#define GuidToString GuidToStringW
+
250#else
+
251#define GuidToString GuidToStringA
+
252#endif
+
253
+
+
255static _Success_(return) BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd = NULL) noexcept
+
256{
+
257 GUID g;
+
258 LPSTR lpszEnd;
+
259 unsigned long ulTmp;
+
260 unsigned long long ullTmp;
+
261
+
262 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
+
263 lpszGuid++;
264
-
266#ifdef _UNICODE
-
267#define GuidToString GuidToStringW
-
268#else
-
269#define GuidToString GuidToStringA
-
270#endif
+
265 g.Data1 = strtoul(lpszGuid, &lpszEnd, 16);
+
266 if (errno == ERANGE) return FALSE;
+
267 lpszGuid = lpszEnd;
+
268
+
269 if (*lpszGuid != '-') return FALSE;
+
270 lpszGuid++;
271
-
-
273static _Success_(return) BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd = NULL) noexcept
-
274{
-
275 GUID g;
-
276 LPSTR lpszEnd;
-
277 unsigned long ulTmp;
-
278 unsigned long long ullTmp;
+
272 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
+
273 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
274 g.Data2 = static_cast<unsigned short>(ulTmp);
+
275 lpszGuid = lpszEnd;
+
276
+
277 if (*lpszGuid != '-') return FALSE;
+
278 lpszGuid++;
279
-
280 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
-
281 lpszGuid++;
-
282
-
283 g.Data1 = strtoul(lpszGuid, &lpszEnd, 16);
-
284 if (errno == ERANGE) return FALSE;
-
285 lpszGuid = lpszEnd;
-
286
-
287 if (*lpszGuid != '-') return FALSE;
-
288 lpszGuid++;
-
289
-
290 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
-
291 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
292 g.Data2 = static_cast<unsigned short>(ulTmp);
-
293 lpszGuid = lpszEnd;
-
294
-
295 if (*lpszGuid != '-') return FALSE;
-
296 lpszGuid++;
-
297
-
298 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
-
299 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
300 g.Data3 = static_cast<unsigned short>(ulTmp);
-
301 lpszGuid = lpszEnd;
-
302
-
303 if (*lpszGuid != '-') return FALSE;
-
304 lpszGuid++;
-
305
-
306 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
-
307 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
308 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
-
309 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
-
310 lpszGuid = lpszEnd;
-
311
-
312 if (*lpszGuid != '-') return FALSE;
-
313 lpszGuid++;
-
314
-
315 ullTmp = _strtoui64(lpszGuid, &lpszEnd, 16);
-
316 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
-
317 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
-
318 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
-
319 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
-
320 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
-
321 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
-
322 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
-
323 lpszGuid = lpszEnd;
-
324
-
325 if (*lpszGuid != '}') return FALSE;
-
326 lpszGuid++;
-
327
-
328 if (lpszGuidEnd)
-
329 *lpszGuidEnd = lpszGuid;
-
330
-
331 *lpGuid = g;
-
332 return TRUE;
-
333}
+
280 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
+
281 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
282 g.Data3 = static_cast<unsigned short>(ulTmp);
+
283 lpszGuid = lpszEnd;
+
284
+
285 if (*lpszGuid != '-') return FALSE;
+
286 lpszGuid++;
+
287
+
288 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
+
289 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
290 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
+
291 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
+
292 lpszGuid = lpszEnd;
+
293
+
294 if (*lpszGuid != '-') return FALSE;
+
295 lpszGuid++;
+
296
+
297 ullTmp = _strtoui64(lpszGuid, &lpszEnd, 16);
+
298 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
+
299 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
+
300 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
+
301 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
+
302 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
+
303 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
+
304 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
+
305 lpszGuid = lpszEnd;
+
306
+
307 if (*lpszGuid != '}') return FALSE;
+
308 lpszGuid++;
+
309
+
310 if (lpszGuidEnd)
+
311 *lpszGuidEnd = lpszGuid;
+
312
+
313 *lpGuid = g;
+
314 return TRUE;
+
315}
+
316
+
+
328static _Success_(return) BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd = NULL) noexcept
+
329{
+
330 GUID g;
+
331 LPWSTR lpszEnd;
+
332 unsigned long ulTmp;
+
333 unsigned long long ullTmp;
334
-
-
346static _Success_(return) BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd = NULL) noexcept
-
347{
-
348 GUID g;
-
349 LPWSTR lpszEnd;
-
350 unsigned long ulTmp;
-
351 unsigned long long ullTmp;
+
335 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
+
336 lpszGuid++;
+
337
+
338 g.Data1 = wcstoul(lpszGuid, &lpszEnd, 16);
+
339 if (errno == ERANGE) return FALSE;
+
340 lpszGuid = lpszEnd;
+
341
+
342 if (*lpszGuid != '-') return FALSE;
+
343 lpszGuid++;
+
344
+
345 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
+
346 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
347 g.Data2 = static_cast<unsigned short>(ulTmp);
+
348 lpszGuid = lpszEnd;
+
349
+
350 if (*lpszGuid != '-') return FALSE;
+
351 lpszGuid++;
352
-
353 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
-
354 lpszGuid++;
-
355
-
356 g.Data1 = wcstoul(lpszGuid, &lpszEnd, 16);
-
357 if (errno == ERANGE) return FALSE;
-
358 lpszGuid = lpszEnd;
-
359
-
360 if (*lpszGuid != '-') return FALSE;
-
361 lpszGuid++;
-
362
-
363 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
-
364 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
365 g.Data2 = static_cast<unsigned short>(ulTmp);
-
366 lpszGuid = lpszEnd;
-
367
-
368 if (*lpszGuid != '-') return FALSE;
-
369 lpszGuid++;
-
370
-
371 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
-
372 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
373 g.Data3 = static_cast<unsigned short>(ulTmp);
-
374 lpszGuid = lpszEnd;
-
375
-
376 if (*lpszGuid != '-') return FALSE;
-
377 lpszGuid++;
-
378
-
379 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
-
380 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
381 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
-
382 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
-
383 lpszGuid = lpszEnd;
-
384
-
385 if (*lpszGuid != '-') return FALSE;
-
386 lpszGuid++;
-
387
-
388 ullTmp = _wcstoui64(lpszGuid, &lpszEnd, 16);
-
389 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
-
390 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
-
391 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
-
392 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
-
393 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
-
394 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
-
395 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
-
396 lpszGuid = lpszEnd;
-
397
-
398 if (*lpszGuid != '}') return FALSE;
-
399 lpszGuid++;
-
400
-
401 if (lpszGuidEnd)
-
402 *lpszGuidEnd = lpszGuid;
-
403
-
404 *lpGuid = g;
-
405 return TRUE;
-
406}
+
353 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
+
354 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
355 g.Data3 = static_cast<unsigned short>(ulTmp);
+
356 lpszGuid = lpszEnd;
+
357
+
358 if (*lpszGuid != '-') return FALSE;
+
359 lpszGuid++;
+
360
+
361 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
+
362 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
363 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
+
364 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
+
365 lpszGuid = lpszEnd;
+
366
+
367 if (*lpszGuid != '-') return FALSE;
+
368 lpszGuid++;
+
369
+
370 ullTmp = _wcstoui64(lpszGuid, &lpszEnd, 16);
+
371 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
+
372 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
+
373 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
+
374 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
+
375 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
+
376 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
+
377 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
+
378 lpszGuid = lpszEnd;
+
379
+
380 if (*lpszGuid != '}') return FALSE;
+
381 lpszGuid++;
+
382
+
383 if (lpszGuidEnd)
+
384 *lpszGuidEnd = lpszGuid;
+
385
+
386 *lpGuid = g;
+
387 return TRUE;
+
388}
-
407
-
409#ifdef _UNICODE
-
410#define StringToGuid StringToGuidW
-
411#else
-
412#define StringToGuid StringToGuidA
-
413#endif
-
414
-
433template<class _Traits, class _Ax>
-
-
434static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
-
435{
-
436 LSTATUS lResult;
-
437 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
438 DWORD dwSize = sizeof(aStackBuffer), dwType;
-
439
-
440 // Try with stack buffer first.
-
441 lResult = ::RegQueryValueExA(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
-
442 if (lResult == ERROR_SUCCESS) {
-
443 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
444 // The value is REG_SZ or REG_MULTI_SZ.
-
445 dwSize /= sizeof(CHAR);
-
446 sValue.assign(reinterpret_cast<LPCSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
-
447 } else if (dwType == REG_EXPAND_SZ) {
-
448 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
-
449 if (::ExpandEnvironmentStringsA(reinterpret_cast<LPCSTR>(aStackBuffer), sValue) == 0)
-
450 lResult = ::GetLastError();
-
451 } else {
-
452 // The value is not a string type.
-
453 lResult = ERROR_INVALID_DATA;
-
454 }
-
455 } else if (lResult == ERROR_MORE_DATA) {
-
456 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
457 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
-
458 std::unique_ptr<CHAR[]> szBuffer(new CHAR[dwSize / sizeof(CHAR)]);
-
459 if ((lResult = ::RegQueryValueExA(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
460 dwSize /= sizeof(CHAR);
-
461 sValue.assign(szBuffer.get(), dwSize && szBuffer[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
-
462 }
-
463 } else if (dwType == REG_EXPAND_SZ) {
-
464 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
-
465 std::unique_ptr<CHAR[]> szBuffer(new CHAR[dwSize / sizeof(CHAR)]);
-
466 if ((lResult = ::RegQueryValueExA(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
467 if (::ExpandEnvironmentStringsA(szBuffer.get(), sValue) == 0)
-
468 lResult = ::GetLastError();
-
469 }
-
470 } else {
-
471 // The value is not a string type.
-
472 lResult = ERROR_INVALID_DATA;
-
473 }
-
474 }
-
475
-
476 return lResult;
-
477}
+
389
+
391#ifdef _UNICODE
+
392#define StringToGuid StringToGuidW
+
393#else
+
394#define StringToGuid StringToGuidA
+
395#endif
+
396
+
415template<class _Traits, class _Ax>
+
+
416static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
+
417{
+
418 LSTATUS lResult;
+
419 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
420 DWORD dwSize = sizeof(aStackBuffer), dwType;
+
421
+
422 // Try with stack buffer first.
+
423 lResult = ::RegQueryValueExA(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
+
424 if (lResult == ERROR_SUCCESS) {
+
425 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
426 // The value is REG_SZ or REG_MULTI_SZ.
+
427 dwSize /= sizeof(CHAR);
+
428 sValue.assign(reinterpret_cast<LPCSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
429 } else if (dwType == REG_EXPAND_SZ) {
+
430 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
+
431 if (::ExpandEnvironmentStringsA(reinterpret_cast<LPCSTR>(aStackBuffer), sValue) == 0)
+
432 lResult = ::GetLastError();
+
433 } else {
+
434 // The value is not a string type.
+
435 lResult = ERROR_INVALID_DATA;
+
436 }
+
437 } else if (lResult == ERROR_MORE_DATA) {
+
438 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
439 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
+
440 sValue.resize(dwSize / sizeof(CHAR));
+
441 if ((lResult = ::RegQueryValueExA(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(&sValue[0]), &dwSize)) == ERROR_SUCCESS) {
+
442 dwSize /= sizeof(CHAR);
+
443 sValue.resize(dwSize && sValue[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
444 }
+
445 } else if (dwType == REG_EXPAND_SZ) {
+
446 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
+
447 std::unique_ptr<CHAR[]> szBuffer(new CHAR[dwSize / sizeof(CHAR) + 1]);
+
448 if ((lResult = ::RegQueryValueExA(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
+
449 dwSize /= sizeof(CHAR);
+
450 szBuffer[dwSize] = 0;
+
451 if (::ExpandEnvironmentStringsA(szBuffer.get(), sValue) == 0)
+
452 lResult = ::GetLastError();
+
453 }
+
454 } else {
+
455 // The value is not a string type.
+
456 lResult = ERROR_INVALID_DATA;
+
457 }
+
458 }
+
459
+
460 return lResult;
+
461}
-
478
-
497template<class _Traits, class _Ax>
-
-
498static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCWSTR pszName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
-
499{
-
500 LSTATUS lResult;
-
501 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
502 DWORD dwSize = sizeof(aStackBuffer), dwType;
-
503
-
504 // Try with stack buffer first.
-
505 lResult = ::RegQueryValueExW(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
-
506 if (lResult == ERROR_SUCCESS) {
-
507 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
508 // The value is REG_SZ or REG_MULTI_SZ.
-
509 dwSize /= sizeof(WCHAR);
-
510 sValue.assign(reinterpret_cast<LPCWSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCWSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
462
+
481template<class _Traits, class _Ax>
+
+
482static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCWSTR pszName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
+
483{
+
484 LSTATUS lResult;
+
485 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
486 DWORD dwSize = sizeof(aStackBuffer), dwType;
+
487
+
488 // Try with stack buffer first.
+
489 lResult = ::RegQueryValueExW(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
+
490 if (lResult == ERROR_SUCCESS) {
+
491 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
492 // The value is REG_SZ or REG_MULTI_SZ.
+
493 dwSize /= sizeof(WCHAR);
+
494 sValue.assign(reinterpret_cast<LPCWSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCWSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
495 } else if (dwType == REG_EXPAND_SZ) {
+
496 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
+
497 if (::ExpandEnvironmentStringsW(reinterpret_cast<LPCWSTR>(aStackBuffer), sValue) == 0)
+
498 lResult = ::GetLastError();
+
499 } else {
+
500 // The value is not a string type.
+
501 lResult = ERROR_INVALID_DATA;
+
502 }
+
503 } else if (lResult == ERROR_MORE_DATA) {
+
504 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
505 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
+
506 sValue.resize(dwSize / sizeof(WCHAR));
+
507 if ((lResult = ::RegQueryValueExW(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(&sValue[0]), &dwSize)) == ERROR_SUCCESS) {
+
508 dwSize /= sizeof(WCHAR);
+
509 sValue.resize(dwSize && sValue[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
510 }
511 } else if (dwType == REG_EXPAND_SZ) {
-
512 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
-
513 if (::ExpandEnvironmentStringsW(reinterpret_cast<LPCWSTR>(aStackBuffer), sValue) == 0)
-
514 lResult = ::GetLastError();
-
515 } else {
-
516 // The value is not a string type.
-
517 lResult = ERROR_INVALID_DATA;
-
518 }
-
519 } else if (lResult == ERROR_MORE_DATA) {
-
520 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
521 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
-
522 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[dwSize / sizeof(WCHAR)]);
-
523 if ((lResult = ::RegQueryValueExW(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
524 dwSize /= sizeof(WCHAR);
-
525 sValue.assign(szBuffer.get(), dwSize && szBuffer[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
-
526 }
-
527 } else if (dwType == REG_EXPAND_SZ) {
-
528 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
-
529 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[dwSize / sizeof(WCHAR)]);
-
530 if ((lResult = ::RegQueryValueExW(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
531 if (::ExpandEnvironmentStringsW(szBuffer.get(), sValue) == 0)
-
532 lResult = ::GetLastError();
-
533 }
-
534 } else {
-
535 // The value is not a string type.
-
536 lResult = ERROR_INVALID_DATA;
-
537 }
-
538 }
-
539
-
540 return lResult;
-
541}
+
512 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
+
513 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[dwSize / sizeof(WCHAR) + 1]);
+
514 if ((lResult = ::RegQueryValueExW(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
+
515 dwSize /= sizeof(WCHAR);
+
516 szBuffer[dwSize] = 0;
+
517 if (::ExpandEnvironmentStringsW(szBuffer.get(), sValue) == 0)
+
518 lResult = ::GetLastError();
+
519 }
+
520 } else {
+
521 // The value is not a string type.
+
522 lResult = ERROR_INVALID_DATA;
+
523 }
+
524 }
+
525
+
526 return lResult;
+
527}
-
542
-
544template<class _Ty, class _Ax>
-
-
545static LSTATUS RegQueryValueExA(_In_ HKEY hKey, _In_opt_z_ LPCSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
-
546{
-
547 LSTATUS lResult;
-
548 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
549 DWORD dwSize = sizeof(aStackBuffer);
-
550
-
551 // Try with stack buffer first.
-
552 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
-
553 if (lResult == ERROR_SUCCESS) {
-
554 // Copy from stack buffer.
-
555 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
556 memcpy(aData.data(), aStackBuffer, dwSize);
-
557 } else if (lResult == ERROR_MORE_DATA) {
-
558 // Allocate buffer on heap and retry.
-
559 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
560 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, NULL, reinterpret_cast<LPBYTE>(aData.data()), &dwSize);
-
561 }
-
562
-
563 return lResult;
-
564}
+
528
+
530template<class _Ty, class _Ax>
+
+
531static LSTATUS RegQueryValueExA(_In_ HKEY hKey, _In_opt_z_ LPCSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
+
532{
+
533 LSTATUS lResult;
+
534 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
535 DWORD dwSize = sizeof(aStackBuffer);
+
536
+
537 // Try with stack buffer first.
+
538 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
+
539 if (lResult == ERROR_SUCCESS) {
+
540 // Copy from stack buffer.
+
541 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
542 memcpy(aData.data(), aStackBuffer, dwSize);
+
543 } else if (lResult == ERROR_MORE_DATA) {
+
544 // Allocate buffer on heap and retry.
+
545 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
546 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, NULL, reinterpret_cast<LPBYTE>(aData.data()), &dwSize);
+
547 }
+
548
+
549 return lResult;
+
550}
-
565
-
571template<class _Ty, class _Ax>
-
-
572static LSTATUS RegQueryValueExW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
-
573{
-
574 LSTATUS lResult;
-
575 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
576 DWORD dwSize = sizeof(aStackBuffer);
-
577
-
578 // Try with stack buffer first.
-
579 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
-
580 if (lResult == ERROR_SUCCESS) {
-
581 // Copy from stack buffer.
-
582 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
583 memcpy(aData.data(), aStackBuffer, dwSize);
-
584 } else if (lResult == ERROR_MORE_DATA) {
-
585 // Allocate buffer on heap and retry.
-
586 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
587 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, NULL, reinterpret_cast<LPBYTE>(aData.data()), &dwSize);
-
588 }
-
589
-
590 return lResult;
-
591}
+
551
+
557template<class _Ty, class _Ax>
+
+
558static LSTATUS RegQueryValueExW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
+
559{
+
560 LSTATUS lResult;
+
561 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
562 DWORD dwSize = sizeof(aStackBuffer);
+
563
+
564 // Try with stack buffer first.
+
565 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
+
566 if (lResult == ERROR_SUCCESS) {
+
567 // Copy from stack buffer.
+
568 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
569 memcpy(aData.data(), aStackBuffer, dwSize);
+
570 } else if (lResult == ERROR_MORE_DATA) {
+
571 // Allocate buffer on heap and retry.
+
572 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
573 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, NULL, reinterpret_cast<LPBYTE>(aData.data()), &dwSize);
+
574 }
+
575
+
576 return lResult;
+
577}
-
592
-
593#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
-
594
+
578
+
579#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
+
580
+
582template<class _Traits, class _Ax>
+
+
583static LSTATUS RegLoadMUIStringA(_In_ HKEY hKey, _In_opt_z_ LPCSTR pszValue, _Out_ std::basic_string<char, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCSTR pszDirectory) noexcept
+
584{
+
585 // According to "Remarks" section in MSDN documentation of RegLoadMUIString(),
+
586 // this function is defined but not implemented as ANSI variation.
+
587 assert(0);
+
588 return ERROR_CALL_NOT_IMPLEMENTED;
+
589}
+
+
590
596template<class _Traits, class _Ax>
-
597static LSTATUS RegLoadMUIStringA(_In_ HKEY hKey, _In_opt_z_ LPCSTR pszValue, _Out_ std::basic_string<char, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCSTR pszDirectory) noexcept
+
597static LSTATUS RegLoadMUIStringW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR pszValue, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCWSTR pszDirectory) noexcept
598{
-
599 // According to "Remarks" section in MSDN documentation of RegLoadMUIString(),
-
600 // this function is defined but not implemented as ANSI variation.
-
601 assert(0);
-
602 return ERROR_CALL_NOT_IMPLEMENTED;
-
603}
-
+
599 LSTATUS lResult;
+
600 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
601 DWORD dwSize;
+
602
+
603 Flags &= ~REG_MUI_STRING_TRUNCATE;
604
-
610template<class _Traits, class _Ax>
-
-
611static LSTATUS RegLoadMUIStringW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR pszValue, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sOut, _In_ DWORD Flags, _In_opt_z_ LPCWSTR pszDirectory) noexcept
-
612{
-
613 LSTATUS lResult;
-
614 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
615 DWORD dwSize;
-
616
-
617 Flags &= ~REG_MUI_STRING_TRUNCATE;
+
605 // Try with stack buffer first.
+
606 lResult = RegLoadMUIStringW(hKey, pszValue, szStackBuffer, sizeof(szStackBuffer), &dwSize, Flags, pszDirectory);
+
607 if (lResult == ERROR_SUCCESS) {
+
608 // Copy from stack buffer.
+
609 sOut.assign(szStackBuffer, wcsnlen(szStackBuffer, dwSize/sizeof(wchar_t)));
+
610 } else if (lResult == ERROR_MORE_DATA) {
+
611 // Allocate buffer on heap and retry.
+
612 sOut.resize((dwSize + sizeof(wchar_t) - 1)/sizeof(wchar_t) - 1);
+
613 sOut.resize((lResult = RegLoadMUIStringW(hKey, pszValue, &sOut[0], dwSize, &dwSize, Flags, pszDirectory)) == ERROR_SUCCESS ? wcsnlen(&sOut[0], dwSize/sizeof(wchar_t)) : 0);
+
614 }
+
615
+
616 return lResult;
+
617}
+
618
-
619 // Try with stack buffer first.
-
620 lResult = RegLoadMUIStringW(hKey, pszValue, szStackBuffer, sizeof(szStackBuffer), &dwSize, Flags, pszDirectory);
-
621 if (lResult == ERROR_SUCCESS) {
-
622 // Copy from stack buffer.
-
623 sOut.assign(szStackBuffer, wcsnlen(szStackBuffer, dwSize/sizeof(wchar_t)));
-
624 } else if (lResult == ERROR_MORE_DATA) {
-
625 // Allocate buffer on heap and retry.
-
626 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[(dwSize + sizeof(wchar_t) - 1)/sizeof(wchar_t)]);
-
627 sOut.assign(szBuffer.get(), (lResult = RegLoadMUIStringW(hKey, pszValue, szBuffer.get(), dwSize, &dwSize, Flags, pszDirectory)) == ERROR_SUCCESS ? wcsnlen(szBuffer.get(), dwSize/sizeof(wchar_t)) : 0);
-
628 }
-
629
-
630 return lResult;
-
631}
+
619#endif
+
620
+
626template<class _Traits, class _Ax>
+
+
627static _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
+
628{
+
629 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
630
+
631 // Try to convert to stack buffer first.
+
632 int cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szStackBuffer, _countof(szStackBuffer));
+
633 if (cch > 0) {
+
634 // Copy from stack.
+
635 sDstString.assign(szStackBuffer, cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
636 } else {
+
637 switch (::GetLastError()) {
+
638 case ERROR_INSUFFICIENT_BUFFER:
+
639 for (int i = 10; i--;) {
+
640 // Allocate buffer. Then convert again.
+
641 cch = -cch;
+
642 sDstString.resize((size_t)cch - 1);
+
643 cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, &sDstString[0], cch);
+
644 if (cch > 0) {
+
645 sDstString.resize(cwSrcLength != -1 ? wcsnlen(&sDstString[0], cch) : (size_t)cch - 1);
+
646 break;
+
647 }
+
648 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+
649 sDstString.clear();
+
650 break;
+
651 }
+
652 }
+
653 break;
+
654
+
655 case ERROR_SUCCESS:
+
656 sDstString.clear();
+
657 break;
+
658 }
+
659 }
+
660
+
661 return cch;
+
662}
-
632
-
633#endif
-
634
-
640template<class _Traits, class _Ax>
-
-
641static _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
-
642{
-
643 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
644
-
645 // Try to convert to stack buffer first.
-
646 int cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szStackBuffer, _countof(szStackBuffer));
-
647 if (cch > 0) {
-
648 // Copy from stack.
-
649 sDstString.assign(szStackBuffer, cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
650 } else {
-
651 switch (::GetLastError()) {
-
652 case ERROR_INSUFFICIENT_BUFFER:
-
653 for (int i = 10; i--;) {
-
654 // Allocate buffer. Then convert again.
-
655 cch = -cch;
-
656 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
657 cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szBuffer.get(), cch);
-
658 if (cch > 0) {
-
659 sDstString.assign(szBuffer.get(), cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
660 break;
-
661 }
-
662 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-
663 sDstString.clear();
-
664 break;
-
665 }
-
666 }
-
667 break;
-
668
-
669 case ERROR_SUCCESS:
-
670 sDstString.clear();
-
671 break;
-
672 }
-
673 }
-
674
-
675 return cch;
-
676}
+
663
+
669template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
+
670static _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
+
671{
+
672 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
673
+
674 // Try to convert to stack buffer first.
+
675 int cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), szStackBuffer, _countof(szStackBuffer));
+
676 if (cch > 0) {
+
677 // Copy from stack.
+
678 sDstString.assign(szStackBuffer, cch);
+
679 } else {
+
680 switch (::GetLastError()) {
+
681 case ERROR_INSUFFICIENT_BUFFER:
+
682 for (int i = 10; i--;) {
+
683 // Allocate buffer. Then convert again.
+
684 cch = -cch;
+
685 sDstString.resize(cch);
+
686 cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), &sDstString[0], cch);
+
687 if (cch > 0)
+
688 break;
+
689 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+
690 sDstString.clear();
+
691 break;
+
692 }
+
693 }
+
694 break;
+
695
+
696 case ERROR_SUCCESS:
+
697 sDstString.clear();
+
698 break;
+
699 }
+
700 }
+
701
+
702 return cch;
+
703}
-
677
-
683template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
-
684static _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
-
685{
-
686 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
687
-
688 // Try to convert to stack buffer first.
-
689 int cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), szStackBuffer, _countof(szStackBuffer));
-
690 if (cch > 0) {
-
691 // Copy from stack.
-
692 sDstString.assign(szStackBuffer, cch);
-
693 } else {
-
694 switch (::GetLastError()) {
-
695 case ERROR_INSUFFICIENT_BUFFER:
-
696 for (int i = 10; i--;) {
-
697 // Allocate buffer. Then convert again.
-
698 cch = -cch;
-
699 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
700 cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), szBuffer.get(), cch);
-
701 if (cch > 0) {
-
702 sDstString.assign(szBuffer.get(), cch);
-
703 break;
-
704 }
-
705 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-
706 sDstString.clear();
-
707 break;
-
708 }
-
709 }
-
710 break;
-
711
-
712 case ERROR_SUCCESS:
-
713 sDstString.clear();
-
714 break;
-
715 }
-
716 }
-
717
-
718 return cch;
-
719}
+
704
+
706template<class _Traits, class _Ax>
+
+
707static _Success_(return != 0) int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<char, _Traits, _Ax> &sBuffer) noexcept
+
708{
+
709 // Get read-only pointer to string resource.
+
710 LPCSTR pszStr;
+
711 int i = LoadStringA(hInstance, uID, reinterpret_cast<LPSTR>(&pszStr), 0);
+
712 if (i) {
+
713 sBuffer.assign(pszStr, i);
+
714 return i;
+
715 } else
+
716 return 0;
+
717}
-
720
-
722template<class _Traits, class _Ax>
-
-
723static _Success_(return != 0) int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<char, _Traits, _Ax> &sBuffer) noexcept
-
724{
-
725 // Get read-only pointer to string resource.
-
726 LPCSTR pszStr;
-
727 int i = LoadStringA(hInstance, uID, reinterpret_cast<LPSTR>(&pszStr), 0);
-
728 if (i) {
-
729 sBuffer.assign(pszStr, i);
-
730 return i;
-
731 } else
-
732 return 0;
-
733}
+
718
+
724template<class _Traits, class _Ax>
+
+
725static _Success_(return != 0) int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sBuffer) noexcept
+
726{
+
727 // Get read-only pointer to string resource.
+
728 LPCWSTR pszStr;
+
729 int i = LoadStringW(hInstance, uID, reinterpret_cast<LPWSTR>(&pszStr), 0);
+
730 if (i) {
+
731 sBuffer.assign(pszStr, i);
+
732 return i;
+
733 } else
+
734 return 0;
+
735}
-
734
-
740template<class _Traits, class _Ax>
-
-
741static _Success_(return != 0) int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sBuffer) noexcept
-
742{
-
743 // Get read-only pointer to string resource.
-
744 LPCWSTR pszStr;
-
745 int i = LoadStringW(hInstance, uID, reinterpret_cast<LPWSTR>(&pszStr), 0);
-
746 if (i) {
-
747 sBuffer.assign(pszStr, i);
-
748 return i;
-
749 } else
-
750 return 0;
-
751}
+
736
+
+
742static VOID OutputDebugStrV(_In_z_ LPCSTR lpOutputString, _In_ va_list arg) noexcept
+
743{
+
744 std::string str;
+
745 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
+
746 OutputDebugStringA(str.c_str());
+
747}
-
752
-
-
758static VOID OutputDebugStrV(_In_z_ LPCSTR lpOutputString, _In_ va_list arg) noexcept
-
759{
-
760 std::string str;
-
761 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
-
762 OutputDebugStringA(str.c_str());
-
763}
+
748
+
+
754static VOID OutputDebugStrV(_In_z_ LPCWSTR lpOutputString, _In_ va_list arg) noexcept
+
755{
+
756 std::wstring str;
+
757 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
+
758 OutputDebugStringW(str.c_str());
+
759}
-
764
-
-
770static VOID OutputDebugStrV(_In_z_ LPCWSTR lpOutputString, _In_ va_list arg) noexcept
-
771{
-
772 std::wstring str;
-
773 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
-
774 OutputDebugStringW(str.c_str());
-
775}
+
760
+
+
766static VOID OutputDebugStr(_In_z_ LPCSTR lpOutputString, ...) noexcept
+
767{
+
768 va_list arg;
+
769 va_start(arg, lpOutputString);
+
770 OutputDebugStrV(lpOutputString, arg);
+
771 va_end(arg);
+
772}
-
776
-
-
782static VOID OutputDebugStr(_In_z_ LPCSTR lpOutputString, ...) noexcept
-
783{
-
784 va_list arg;
-
785 va_start(arg, lpOutputString);
-
786 OutputDebugStrV(lpOutputString, arg);
-
787 va_end(arg);
-
788}
+
773
+
+
779static VOID OutputDebugStr(_In_z_ LPCWSTR lpOutputString, ...) noexcept
+
780{
+
781 va_list arg;
+
782 va_start(arg, lpOutputString);
+
783 OutputDebugStrV(lpOutputString, arg);
+
784 va_end(arg);
+
785}
-
789
-
-
795static VOID OutputDebugStr(_In_z_ LPCWSTR lpOutputString, ...) noexcept
-
796{
-
797 va_list arg;
-
798 va_start(arg, lpOutputString);
-
799 OutputDebugStrV(lpOutputString, arg);
-
800 va_end(arg);
-
801}
+
786
+
788template<class _Traits, class _Ax>
+
+
789static _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<char, _Traits, _Ax> &sDate) noexcept
+
790{
+
791 int iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
+
792 if (iResult) {
+
793 // Allocate buffer on heap and retry.
+
794 sDate.resize(iResult - 1);
+
795 return GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, &sDate[0], iResult);
+
796 }
+
797
+
798 return iResult;
+
799}
-
802
-
804template<class _Traits, class _Ax>
-
-
805static _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<char, _Traits, _Ax> &sDate) noexcept
-
806{
-
807 int iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
-
808 if (iResult) {
-
809 // Allocate buffer on heap and retry.
-
810 std::unique_ptr<char[]> szBuffer(new char[iResult]);
-
811 iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, szBuffer.get(), iResult);
-
812 sDate.assign(szBuffer.get(), iResult ? iResult - 1 : 0);
-
813 return iResult;
+
800
+
806template<class _Traits, class _Ax>
+
+
807static _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<wchar_t, _Traits, _Ax> &sDate) noexcept
+
808{
+
809 int iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
+
810 if (iResult) {
+
811 // Allocate buffer on heap and retry.
+
812 sDate.resize(iResult - 1);
+
813 return GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, &sDate[0], iResult);
814 }
815
816 return iResult;
817}
818
-
824template<class _Traits, class _Ax>
-
-
825static _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<wchar_t, _Traits, _Ax> &sDate) noexcept
-
826{
-
827 int iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
-
828 if (iResult) {
-
829 // Allocate buffer on heap and retry.
-
830 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[iResult]);
-
831 iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, szBuffer.get(), iResult);
-
832 sDate.assign(szBuffer.get(), iResult ? iResult - 1 : 0);
-
833 return iResult;
-
834 }
-
835
-
836 return iResult;
-
837}
+
820template<class _Traits, class _Ax>
+
+
821static _Success_(return != 0) BOOL LookupAccountSidA(_In_opt_z_ LPCSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<char, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<char, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept
+
822{
+
823 assert(0); // TODO: Test this code.
+
824
+
825 DWORD dwNameLen = 0, dwRefDomainLen = 0;
+
826
+
827 if (LookupAccountSidA(lpSystemName, lpSid,
+
828 NULL, &dwNameLen ,
+
829 NULL, &dwRefDomainLen,
+
830 peUse))
+
831 {
+
832 // Name and domain is blank.
+
833 if (sName ) sName ->clear();
+
834 if (sReferencedDomainName) sReferencedDomainName->clear();
+
835 return TRUE;
+
836 } else if (GetLastError() == ERROR_MORE_DATA) {
+
837 // Allocate on heap and retry.
+
838 std::unique_ptr<char[]> bufName (new char[dwNameLen ]);
+
839 std::unique_ptr<char[]> bufRefDomain(new char[dwRefDomainLen]);
+
840 if (LookupAccountSidA(lpSystemName, lpSid,
+
841 bufName .get(), &dwNameLen ,
+
842 bufRefDomain.get(), &dwRefDomainLen,
+
843 peUse))
+
844 {
+
845 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
+
846 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
+
847 return TRUE;
+
848 }
+
849 }
+
850
+
851 return FALSE;
+
852}
-
838
-
840template<class _Traits, class _Ax>
-
-
841static _Success_(return != 0) BOOL LookupAccountSidA(_In_opt_z_ LPCSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<char, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<char, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept
-
842{
-
843 assert(0); // TODO: Test this code.
-
844
-
845 DWORD dwNameLen = 0, dwRefDomainLen = 0;
-
846
-
847 if (LookupAccountSidA(lpSystemName, lpSid,
-
848 NULL, &dwNameLen ,
-
849 NULL, &dwRefDomainLen,
-
850 peUse))
-
851 {
-
852 // Name and domain is blank.
-
853 if (sName ) sName ->clear();
-
854 if (sReferencedDomainName) sReferencedDomainName->clear();
-
855 return TRUE;
-
856 } else if (GetLastError() == ERROR_MORE_DATA) {
-
857 // Allocate on heap and retry.
-
858 std::unique_ptr<char[]> bufName (new char[dwNameLen ]);
-
859 std::unique_ptr<char[]> bufRefDomain(new char[dwRefDomainLen]);
-
860 if (LookupAccountSidA(lpSystemName, lpSid,
-
861 bufName .get(), &dwNameLen ,
-
862 bufRefDomain.get(), &dwRefDomainLen,
-
863 peUse))
-
864 {
-
865 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
-
866 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
-
867 return TRUE;
-
868 }
-
869 }
-
870
-
871 return FALSE;
-
872}
+
853
+
859template<class _Traits, class _Ax>
+
+
860static _Success_(return != 0) BOOL LookupAccountSidW(_In_opt_z_ LPCWSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<wchar_t, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<wchar_t, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept
+
861{
+
862 assert(0); // TODO: Test this code.
+
863
+
864 DWORD dwNameLen = 0, dwRefDomainLen = 0;
+
865
+
866 if (LookupAccountSidW(lpSystemName, lpSid,
+
867 NULL, &dwNameLen ,
+
868 NULL, &dwRefDomainLen,
+
869 peUse))
+
870 {
+
871 // Name and domain is blank.
+
872 if (sName ) sName ->clear();
+
873 if (sReferencedDomainName) sReferencedDomainName->clear();
+
874 return TRUE;
+
875 } else if (GetLastError() == ERROR_MORE_DATA) {
+
876 // Allocate on heap and retry.
+
877 std::unique_ptr<wchar_t[]> bufName (new wchar_t[dwNameLen ]);
+
878 std::unique_ptr<wchar_t[]> bufRefDomain(new wchar_t[dwRefDomainLen]);
+
879 if (LookupAccountSidW(lpSystemName, lpSid,
+
880 bufName .get(), &dwNameLen ,
+
881 bufRefDomain.get(), &dwRefDomainLen,
+
882 peUse))
+
883 {
+
884 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
+
885 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
+
886 return TRUE;
+
887 }
+
888 }
+
889
+
890 return FALSE;
+
891}
-
873
-
879template<class _Traits, class _Ax>
-
-
880static _Success_(return != 0) BOOL LookupAccountSidW(_In_opt_z_ LPCWSTR lpSystemName, _In_ PSID lpSid, _Out_opt_ std::basic_string<wchar_t, _Traits, _Ax> *sName, _Out_opt_ std::basic_string<wchar_t, _Traits, _Ax> *sReferencedDomainName, _Out_ PSID_NAME_USE peUse) noexcept
-
881{
-
882 assert(0); // TODO: Test this code.
-
883
-
884 DWORD dwNameLen = 0, dwRefDomainLen = 0;
-
885
-
886 if (LookupAccountSidW(lpSystemName, lpSid,
-
887 NULL, &dwNameLen ,
-
888 NULL, &dwRefDomainLen,
-
889 peUse))
-
890 {
-
891 // Name and domain is blank.
-
892 if (sName ) sName ->clear();
-
893 if (sReferencedDomainName) sReferencedDomainName->clear();
-
894 return TRUE;
-
895 } else if (GetLastError() == ERROR_MORE_DATA) {
-
896 // Allocate on heap and retry.
-
897 std::unique_ptr<wchar_t[]> bufName (new wchar_t[dwNameLen ]);
-
898 std::unique_ptr<wchar_t[]> bufRefDomain(new wchar_t[dwRefDomainLen]);
-
899 if (LookupAccountSidW(lpSystemName, lpSid,
-
900 bufName .get(), &dwNameLen ,
-
901 bufRefDomain.get(), &dwRefDomainLen,
-
902 peUse))
-
903 {
-
904 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
-
905 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
-
906 return TRUE;
-
907 }
-
908 }
-
909
-
910 return FALSE;
-
911}
+
892
+
+
898static _Success_(return != FALSE) BOOL CreateWellKnownSid(_In_ WELL_KNOWN_SID_TYPE WellKnownSidType, _In_opt_ PSID DomainSid, _Inout_ std::unique_ptr<SID> &Sid)
+
899{
+
900 BYTE szStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
901 DWORD dwSize = sizeof(szStackBuffer);
+
902
+
903 if (CreateWellKnownSid(WellKnownSidType, DomainSid, szStackBuffer, &dwSize)) {
+
904 // The stack buffer was big enough to retrieve complete data. Alloc and copy.
+
905 Sid.reset((SID*)new BYTE[dwSize]);
+
906 memcpy(Sid.get(), szStackBuffer, dwSize);
+
907 return TRUE;
+
908 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
909 // The stack buffer was too small to retrieve complete data. Alloc and retry.
+
910 Sid.reset((SID*)new BYTE[dwSize]);
+
911 return CreateWellKnownSid(WellKnownSidType, DomainSid, Sid.get(), &dwSize);
+
912 } else
+
913 return FALSE;
+
914}
-
912
-
-
918static _Success_(return != FALSE) BOOL CreateWellKnownSid(_In_ WELL_KNOWN_SID_TYPE WellKnownSidType, _In_opt_ PSID DomainSid, _Inout_ std::unique_ptr<SID> &Sid)
-
919{
-
920 BYTE szStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
921 DWORD dwSize = sizeof(szStackBuffer);
-
922
-
923 if (CreateWellKnownSid(WellKnownSidType, DomainSid, szStackBuffer, &dwSize)) {
-
924 // The stack buffer was big enough to retrieve complete data. Alloc and copy.
-
925 Sid.reset((SID*)new BYTE[dwSize]);
-
926 memcpy(Sid.get(), szStackBuffer, dwSize);
-
927 return TRUE;
-
928 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
929 // The stack buffer was too small to retrieve complete data. Alloc and retry.
-
930 Sid.reset((SID*)new BYTE[dwSize]);
-
931 return CreateWellKnownSid(WellKnownSidType, DomainSid, Sid.get(), &dwSize);
-
932 } else
-
933 return FALSE;
-
934}
+
915
+
921template<class _Ty>
+
+
922static _Success_(return != 0) BOOL GetTokenInformation(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_ std::unique_ptr<_Ty> &TokenInformation) noexcept
+
923{
+
924 BYTE szStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
925 DWORD dwSize;
+
926
+
927 if (GetTokenInformation(TokenHandle, TokenInformationClass, szStackBuffer, sizeof(szStackBuffer), &dwSize)) {
+
928 // The stack buffer was big enough to retrieve complete data. Alloc and copy.
+
929 TokenInformation.reset((_Ty*)(new BYTE[dwSize]));
+
930 memcpy(TokenInformation.get(), szStackBuffer, dwSize);
+
931 return TRUE;
+
932 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
933 // The stack buffer was too small to retrieve complete data. Alloc and retry.
+
934 TokenInformation.reset((_Ty*)(new BYTE[dwSize]));
+
935 return GetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation.get(), dwSize, &dwSize);
+
936 } else
+
937 return FALSE;
+
938}
-
935
-
941template<class _Ty>
-
-
942static _Success_(return != 0) BOOL GetTokenInformation(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_ std::unique_ptr<_Ty> &TokenInformation) noexcept
-
943{
-
944 BYTE szStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
945 DWORD dwSize;
-
946
-
947 if (GetTokenInformation(TokenHandle, TokenInformationClass, szStackBuffer, sizeof(szStackBuffer), &dwSize)) {
-
948 // The stack buffer was big enough to retrieve complete data. Alloc and copy.
-
949 TokenInformation.reset((_Ty*)(new BYTE[dwSize]));
-
950 memcpy(TokenInformation.get(), szStackBuffer, dwSize);
-
951 return TRUE;
-
952 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
953 // The stack buffer was too small to retrieve complete data. Alloc and retry.
-
954 TokenInformation.reset((_Ty*)(new BYTE[dwSize]));
-
955 return GetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation.get(), dwSize, &dwSize);
-
956 } else
-
957 return FALSE;
-
958}
+
939
+
945template<class _Traits, class _Ax>
+
+
946static _Success_(return != 0) BOOL QueryFullProcessImageNameA(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<char, _Traits, _Ax>& sExeName)
+
947{
+
948 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(char)];
+
949 DWORD dwSize = _countof(szStackBuffer);
+
950
+
951 // Try with stack buffer first.
+
952 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szStackBuffer, &dwSize)) {
+
953 // Copy from stack.
+
954 sExeName.assign(szStackBuffer, dwSize);
+
955 return TRUE;
+
956 }
+
957 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(char); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
+
958 // Allocate on heap and retry.
+
959 sExeName.resize(dwCapacity - 1);
+
960 dwSize = dwCapacity;
+
961 if (::QueryFullProcessImageNameA(hProcess, dwFlags, &sExeName[0], &dwSize)) {
+
962 sExeName.resize(dwSize);
+
963 return TRUE;
+
964 }
+
965 }
+
966 return FALSE;
+
967}
-
959
-
965template<class _Traits, class _Ax>
-
-
966static _Success_(return != 0) BOOL QueryFullProcessImageNameA(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<char, _Traits, _Ax>& sExeName)
-
967{
-
968 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(char)];
-
969 DWORD dwSize = _countof(szStackBuffer);
-
970
-
971 // Try with stack buffer first.
-
972 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szStackBuffer, &dwSize)) {
-
973 // Copy from stack.
-
974 sExeName.assign(szStackBuffer, dwSize);
-
975 return TRUE;
-
976 }
-
977 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(char); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
-
978 // Allocate on heap and retry.
-
979 std::unique_ptr<char[]> szBuffer(new char[dwCapacity]);
-
980 dwSize = dwCapacity;
-
981 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szBuffer.get(), &dwSize)) {
-
982 sExeName.assign(szBuffer.get(), dwSize);
-
983 return TRUE;
-
984 }
+
968
+
974template<class _Traits, class _Ax>
+
+
975static _Success_(return != 0) BOOL QueryFullProcessImageNameW(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<wchar_t, _Traits, _Ax>& sExeName)
+
976{
+
977 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t)];
+
978 DWORD dwSize = _countof(szStackBuffer);
+
979
+
980 // Try with stack buffer first.
+
981 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szStackBuffer, &dwSize)) {
+
982 // Copy from stack.
+
983 sExeName.assign(szStackBuffer, dwSize);
+
984 return TRUE;
985 }
-
986 return FALSE;
-
987}
+
986 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
+
987 // Allocate on heap and retry.
+
988 sExeName.resize(dwCapacity - 1);
+
989 dwSize = dwCapacity;
+
990 if (::QueryFullProcessImageNameW(hProcess, dwFlags, &sExeName[0], &dwSize)) {
+
991 sExeName.resize(dwSize);
+
992 return TRUE;
+
993 }
+
994 }
+
995 return FALSE;
+
996}
-
988
-
994template<class _Traits, class _Ax>
-
-
995static _Success_(return != 0) BOOL QueryFullProcessImageNameW(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<wchar_t, _Traits, _Ax>& sExeName)
-
996{
-
997 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t)];
-
998 DWORD dwSize = _countof(szStackBuffer);
+
997
999
-
1000 // Try with stack buffer first.
-
1001 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szStackBuffer, &dwSize)) {
-
1002 // Copy from stack.
-
1003 sExeName.assign(szStackBuffer, dwSize);
-
1004 return TRUE;
-
1005 }
-
1006 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
-
1007 // Allocate on heap and retry.
-
1008 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwCapacity]);
-
1009 dwSize = dwCapacity;
-
1010 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szBuffer.get(), &dwSize)) {
-
1011 sExeName.assign(szBuffer.get(), dwSize);
-
1012 return TRUE;
-
1013 }
-
1014 }
-
1015 return FALSE;
-
1016}
+
1000#pragma warning(pop)
+
1001
+
1002namespace winstd
+
1003{
+
1006
+
1010 template<HANDLE INVALID>
+
+
1011 class win_handle : public handle<HANDLE, INVALID>
+
1012 {
+ +
1014
+
1015 public:
+
+
1021 virtual ~win_handle()
+
1022 {
+
1023 if (m_h != invalid)
+
1024 free_internal();
+
1025 }
-
1017
-
1019
-
1020#pragma warning(pop)
-
1021
-
1022namespace winstd
-
1023{
1026
-
1030 template<HANDLE INVALID>
-
-
1031 class win_handle : public handle<HANDLE, INVALID>
-
1032 {
- -
1034
-
1035 public:
-
-
1041 virtual ~win_handle()
-
1042 {
-
1043 if (m_h != invalid)
-
1044 free_internal();
-
1045 }
+
1027 protected:
+
+
1033 void free_internal() noexcept override
+
1034 {
+ +
1036 }
-
1046
-
1047 protected:
-
-
1053 void free_internal() noexcept override
-
1054 {
- -
1056 }
+
1037 };
-
1057 };
+
1038
+
+
1044 class library : public handle<HMODULE, NULL>
+
1045 {
+ +
1047
+
1048 public:
+
+
1054 virtual ~library()
+
1055 {
+
1056 if (m_h != invalid)
+
1057 free_internal();
+
1058 }
-
1058
-
-
1064 class library : public handle<HMODULE, NULL>
-
1065 {
- -
1067
-
1068 public:
-
-
1074 virtual ~library()
-
1075 {
-
1076 if (m_h != invalid)
-
1077 free_internal();
-
1078 }
+
1059
+
1060 protected:
+
+
1066 void free_internal() noexcept override
+
1067 {
+ +
1069 }
-
1079
-
1080 protected:
-
-
1086 void free_internal() noexcept override
-
1087 {
- -
1089 }
+
1070 };
-
1090 };
+
1071
+ +
1078
+ +
1085
+ +
1092
+ +
1099
+ +
1107
+ +
1114
+
+ +
1119 {
+
+
1123 void operator()(void* _Ptr) const
+
1124 {
+
1125 if (!UnmapViewOfFile(_Ptr))
+
1126 throw win_runtime_error("UnmapViewOfFile failed");
+
1127 }
-
1091
- -
1098
- -
1105
- -
1112
- -
1119
- -
1127
- -
1134
-
- -
1139 {
-
-
1143 void operator()(void* _Ptr) const
-
1144 {
-
1145 if (!UnmapViewOfFile(_Ptr))
-
1146 throw win_runtime_error("UnmapViewOfFile failed");
-
1147 }
+
1128 };
-
1148 };
+
1129
+ +
1137
+
+ +
1142 {
+ + +
1145
+
1146 public:
+ -
1149
- -
1157
-
- -
1162 {
- - -
1165
-
1166 public:
+
1156
+
+ +
1163 {
+ +
1165 }
+
+
1166
- +
1173 {
- +
1174 return &m_data;
1175 }
1176
-
- -
1183 {
- -
1185 }
+
1177 protected:
+ +
1179 };
-
1186
-
- -
1193 {
-
1194 return &m_data;
-
1195 }
+
1180
+
+
1186 class find_file : public handle<HANDLE, INVALID_HANDLE_VALUE>
+
1187 {
+ +
1189
+
1190 public:
+
+
1196 virtual ~find_file()
+
1197 {
+
1198 if (m_h != invalid)
+
1199 free_internal();
+
1200 }
-
1196
-
1197 protected:
- -
1199 };
+
1201
+
1202 protected:
+
+
1208 void free_internal() noexcept override
+
1209 {
+
1210 FindClose(m_h);
+
1211 }
-
1200
-
-
1206 class find_file : public handle<HANDLE, INVALID_HANDLE_VALUE>
-
1207 {
- -
1209
-
1210 public:
-
-
1216 virtual ~find_file()
-
1217 {
-
1218 if (m_h != invalid)
-
1219 free_internal();
-
1220 }
+
1212 };
-
1221
-
1222 protected:
-
-
1228 void free_internal() noexcept override
-
1229 {
-
1230 FindClose(m_h);
-
1231 }
+
1213
+
+
1219 class heap : public handle<HANDLE, NULL>
+
1220 {
+ +
1222
+
1223 public:
+
+
1229 virtual ~heap()
+
1230 {
+
1231 if (m_h != invalid)
+
1232 free_internal();
+
1233 }
-
1232 };
-
-
1233
-
-
1239 class heap : public handle<HANDLE, NULL>
-
1240 {
- -
1242
-
1243 public:
-
-
1249 virtual ~heap()
-
1250 {
-
1251 if (m_h != invalid)
-
1252 free_internal();
-
1253 }
-
-
1254
-
- -
1263 {
-
1264 assert(m_h != invalid);
+
1234
+
+ +
1243 {
+
1244 assert(m_h != invalid);
+
1245
+
1246 bool found = false;
+
1247
+
1248 // Lock the heap for exclusive access.
+
1249 HeapLock(m_h);
+
1250
+ +
1252 e.lpData = NULL;
+
1253 while (HeapWalk(m_h, &e) != FALSE) {
+
1254 if ((e.wFlags & PROCESS_HEAP_ENTRY_BUSY) != 0) {
+ +
1256 _T("Allocated block%s%s\n")
+
1257 _T(" Data portion begins at: %#p\n Size: %d bytes\n")
+
1258 _T(" Overhead: %d bytes\n Region index: %d\n"),
+
1259 (e.wFlags & PROCESS_HEAP_ENTRY_MOVEABLE) != 0 ? tstring_printf(_T(", movable with HANDLE %#p"), e.Block.hMem).c_str() : _T(""),
+
1260 (e.wFlags & PROCESS_HEAP_ENTRY_DDESHARE) != 0 ? _T(", DDESHARE") : _T(""),
+
1261 e.lpData,
+
1262 e.cbData,
+
1263 e.cbOverhead,
+
1264 e.iRegionIndex);
1265
-
1266 bool found = false;
-
1267
-
1268 // Lock the heap for exclusive access.
-
1269 HeapLock(m_h);
-
1270
- -
1272 e.lpData = NULL;
-
1273 while (HeapWalk(m_h, &e) != FALSE) {
-
1274 if ((e.wFlags & PROCESS_HEAP_ENTRY_BUSY) != 0) {
- -
1276 _T("Allocated block%s%s\n")
-
1277 _T(" Data portion begins at: %#p\n Size: %d bytes\n")
-
1278 _T(" Overhead: %d bytes\n Region index: %d\n"),
-
1279 (e.wFlags & PROCESS_HEAP_ENTRY_MOVEABLE) != 0 ? tstring_printf(_T(", movable with HANDLE %#p"), e.Block.hMem).c_str() : _T(""),
-
1280 (e.wFlags & PROCESS_HEAP_ENTRY_DDESHARE) != 0 ? _T(", DDESHARE") : _T(""),
-
1281 e.lpData,
-
1282 e.cbData,
-
1283 e.cbOverhead,
-
1284 e.iRegionIndex);
-
1285
-
1286 found = true;
-
1287 }
-
1288 }
-
1289
-
1290 const DWORD dwResult = GetLastError();
- -
1292 OutputDebugStr(_T("HeapWalk failed (error %u).\n"), dwResult);
-
1293
-
1294 // Unlock the heap.
-
1295 HeapUnlock(m_h);
-
1296
-
1297 return found;
-
1298 }
+
1266 found = true;
+
1267 }
+
1268 }
+
1269
+
1270 const DWORD dwResult = GetLastError();
+ +
1272 OutputDebugStr(_T("HeapWalk failed (error %u).\n"), dwResult);
+
1273
+
1274 // Unlock the heap.
+
1275 HeapUnlock(m_h);
+
1276
+
1277 return found;
+
1278 }
-
1299
-
1300 protected:
-
-
1306 void free_internal() noexcept override
-
1307 {
-
1308 enumerate();
- -
1310 }
+
1279
+
1280 protected:
+
+
1286 void free_internal() noexcept override
+
1287 {
+
1288 enumerate();
+ +
1290 }
-
1311 };
+
1291 };
-
1312
-
1316 template <class _Ty>
-
- -
1318 {
+
1292
+
1296 template <class _Ty>
+
+ +
1298 {
+
1299 public:
+
1300 typedef typename _Ty value_type;
+
1301
+
1302 typedef _Ty *pointer;
+
1303 typedef _Ty& reference;
+
1304 typedef const _Ty *const_pointer;
+
1305 typedef const _Ty& const_reference;
+
1306
+ + +
1309
+
1313 template <class _Other>
+
+
1314 struct rebind
+
1315 {
+ +
1317 };
+
+
1318
1319 public:
-
1320 typedef typename _Ty value_type;
-
1321
-
1322 typedef _Ty *pointer;
-
1323 typedef _Ty& reference;
-
1324 typedef const _Ty *const_pointer;
-
1325 typedef const _Ty& const_reference;
-
1326
- - -
1329
+ +
1327
1333 template <class _Other>
-
-
1334 struct rebind
-
1335 {
- -
1337 };
+
+ +
1335 {}
-
1338
-
1339 public:
-
- -
1346 {}
+
1336
+
+ +
1345 {
+
1346 assert(m_heap);
+
1347 return (pointer)HeapAlloc(m_heap, 0, count * sizeof(_Ty));
+
1348 }
-
1347
-
1353 template <class _Other>
-
- -
1355 {}
+
1349
+
+ +
1357 {
+ +
1359 assert(m_heap);
+
1360 HeapFree(m_heap, 0, ptr);
+
1361 }
-
1356
-
- -
1365 {
-
1366 assert(m_heap);
-
1367 return (pointer)HeapAlloc(m_heap, 0, count * sizeof(_Ty));
-
1368 }
+
1362
+
+ +
1370 {
+
1371 ::new ((void*)ptr) _Ty(val);
+
1372 }
-
1369
-
- -
1377 {
- -
1379 assert(m_heap);
-
1380 HeapFree(m_heap, 0, ptr);
-
1381 }
+
1373
+
+ +
1381 {
+
1382 ::new ((void*)ptr) _Ty(std::forward<_Ty>(val));
+
1383 }
-
1382
-
- -
1390 {
-
1391 ::new ((void*)ptr) _Ty(val);
-
1392 }
+
1384
+
+ +
1391 {
+
1392 ptr->_Ty::~_Ty();
+
1393 }
-
1393
-
- -
1401 {
-
1402 ::new ((void*)ptr) _Ty(std::forward<_Ty>(val));
-
1403 }
+
1394
+
+ +
1399 {
+
1400 return (SIZE_T)-1;
+
1401 }
-
1404
-
- -
1411 {
-
1412 ptr->_Ty::~_Ty();
-
1413 }
+
1402
+
1403 public:
+ +
1405 };
+
1406
+
+ +
1411 {
+ +
1414
-
- -
1419 {
-
1420 return (SIZE_T)-1;
-
1421 }
+
1415 public:
+
+ +
1424 {
+ +
1426 m_cookie = 0;
+
1427 }
-
1422
-
1423 public:
- -
1425 };
+
1428
+
+ +
1435 {
+
1436 if (m_cookie)
+ +
1438 }
-
1426
-
- -
1431 {
- - -
1434
-
1435 public:
-
- -
1444 {
- -
1446 m_cookie = 0;
-
1447 }
+
1439
+
1440 protected:
+ +
1442 };
-
1448
-
- -
1455 {
-
1456 if (m_cookie)
- -
1458 }
+
1443
+
+ +
1448 {
+
1449 public:
+ +
1454
+
+ +
1461 {
+
1462 if (m_cookie)
+
1463 RevertToSelf();
+
1464 }
-
1459
-
1460 protected:
- -
1462 };
+
1465
+
1469 operator bool () const { return m_cookie; }
+
1470
+
1471 protected:
+ +
1473 };
-
1463
-
- -
1468 {
-
1469 public:
-
1474
-
- -
1481 {
-
1482 if (m_cookie)
-
1483 RevertToSelf();
-
1484 }
+
+ +
1479 {
+ + +
1482
+
1483 public:
+ -
1485
-
1489 operator bool () const { return m_cookie; }
-
1490
-
1491 protected:
- -
1493 };
+
1495 };
-
1494
-
- -
1499 {
- - -
1502
-
1503 public:
- -
1515 };
-
-
1516
-
- -
1521 {
- - -
1524
-
1525 public:
-
- -
1530 {
-
1531 TOKEN_PRIVILEGES privileges = { 1, {{{ 0, 0 }, SE_PRIVILEGE_ENABLED }} };
-
1532 if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &privileges.Privileges[0].Luid) ||
- -
1534 return;
-
1535
-
1536 {
-
1537 HANDLE h;
- +
1496
+
+ +
1501 {
+ + +
1504
+
1505 public:
+
+ +
1510 {
+
1511 TOKEN_PRIVILEGES privileges = { 1, {{{ 0, 0 }, SE_PRIVILEGE_ENABLED }} };
+
1512 if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &privileges.Privileges[0].Luid) ||
+ +
1514 return;
+
1515
+
1516 {
+
1517 HANDLE h;
+ +
1519 goto revert;
+ + +
1522 goto revert;
+ +
1524 if (!process_snapshot)
+
1525 goto revert;
+
1526 PROCESSENTRY32 entry = { sizeof(PROCESSENTRY32) };
+ +
1528 goto revert;
+
1529 while (_tcsicmp(entry.szExeFile, TEXT("winlogon.exe")) != 0)
+ +
1531 goto revert;
+ +
1533 if (!winlogon_process)
+
1534 goto revert;
+ +
1536 goto revert;
+ +
1539 goto revert;
- - + +
1542 goto revert;
- -
1544 if (!process_snapshot)
-
1545 goto revert;
-
1546 PROCESSENTRY32 entry = { sizeof(PROCESSENTRY32) };
- -
1548 goto revert;
-
1549 while (_tcsicmp(entry.szExeFile, TEXT("winlogon.exe")) != 0)
- -
1551 goto revert;
- -
1553 if (!winlogon_process)
-
1554 goto revert;
- -
1556 goto revert;
- - -
1559 goto revert;
- - -
1562 goto revert;
-
1563 }
-
1564
-
1565 m_cookie = TRUE;
-
1566 return;
-
1567
-
1568 revert:
- -
1570 RevertToSelf();
- -
1572 }
+
1543 }
+
1544
+
1545 m_cookie = TRUE;
+
1546 return;
+
1547
+
1548 revert:
+ +
1550 RevertToSelf();
+ +
1552 }
-
1573 };
+
1553 };
-
1574
-
- -
1579 {
-
1580 public:
-
- -
1587 {
- -
1589 throw win_runtime_error("OpenClipboard failed");
-
1590 }
+
1554
+
+ +
1559 {
+
1560 public:
+
+ +
1567 {
+ +
1569 throw win_runtime_error("OpenClipboard failed");
+
1570 }
-
1591
-
- -
1598 {
- -
1600 }
+
1571
+
+ +
1578 {
+ +
1580 }
-
1601 };
+
1581 };
-
1602
-
- -
1607 {
- - -
1610
-
1611 public:
-
- -
1620 {
- -
1622 }
+
1582
+
+ +
1587 {
+ + +
1590
+
1591 public:
+ -
1623
-
- -
1630 {
-
1631 if (m_cookie)
- -
1633 }
+
1603
+
+ +
1610 {
+
1611 if (m_cookie)
+ +
1613 }
-
1634
-
1635 protected:
- - -
1638 };
+
1614
+
1615 protected:
+ + +
1618 };
-
1639
-
-
1643 class vmemory : public handle<LPVOID, NULL>
-
1644 {
- -
1646
-
1647 public:
-
- -
1652 {}
+
1619
+
+
1623 class vmemory : public handle<LPVOID, NULL>
+
1624 {
+ +
1626
+
1627 public:
+
+ +
1632 {}
-
1653
+
1633
+ +
1644
+
+ +
1651 m_proc(std::move(h.m_proc)),
+
1652 handle<LPVOID, NULL>(std::move(h))
+
1653 {}
+
+
1654
- -
1661 m_proc(proc),
- -
1663 {}
+
1660 virtual ~vmemory()
+
1661 {
+
1662 if (m_h != invalid)
+ +
1664 }
-
1664
-
- -
1671 m_proc(std::move(h.m_proc)),
-
1672 handle<LPVOID, NULL>(std::move(h))
-
1673 {}
+
1665
+
+ +
1672 {
+
1673 if (this != std::addressof(other)) {
+
1674 (handle<handle_type, NULL>&&)*this = std::move(other);
+
1675 m_proc = std::move(other.m_proc);
+
1676 }
+
1677 return *this;
+
1678 }
-
1674
-
-
1680 virtual ~vmemory()
-
1681 {
-
1682 if (m_h != invalid)
- -
1684 }
+
1679
+
+ +
1689 {
+
1690 m_proc = proc;
+
1691 if (m_h != invalid)
+
1692 free_internal();
+
1693 m_h = h;
+
1694 }
-
1685
-
- -
1692 {
-
1693 if (this != std::addressof(other)) {
-
1694 (handle<handle_type, NULL>&&)*this = std::move(other);
-
1695 m_proc = std::move(other.m_proc);
-
1696 }
-
1697 return *this;
-
1698 }
+
1695
+
+
1705 bool alloc(
+ + + + +
1710 _In_ DWORD flProtect) noexcept
+
1711 {
+ +
1713 if (h != invalid) {
+
1714 attach(hProcess, h);
+
1715 return true;
+
1716 } else
+
1717 return false;
+
1718 }
-
1699
-
- -
1709 {
-
1710 m_proc = proc;
-
1711 if (m_h != invalid)
-
1712 free_internal();
-
1713 m_h = h;
-
1714 }
+
1719
+
1720 protected:
+
+
1726 void free_internal() noexcept override
+
1727 {
+ +
1729 }
-
1715
-
-
1725 bool alloc(
- - - - -
1730 _In_ DWORD flProtect) noexcept
-
1731 {
- -
1733 if (h != invalid) {
-
1734 attach(hProcess, h);
-
1735 return true;
-
1736 } else
-
1737 return false;
-
1738 }
+
1730
+
1731 protected:
+ +
1733 };
-
1739
-
1740 protected:
-
-
1746 void free_internal() noexcept override
-
1747 {
- -
1749 }
+
1734
+
+
1741 class reg_key : public handle<HKEY, NULL>
+
1742 {
+ +
1744
+
1745 public:
+
+
1751 virtual ~reg_key()
+
1752 {
+
1753 if (m_h != invalid)
+
1754 free_internal();
+
1755 }
-
1750
-
1751 protected:
- -
1753 };
+
1756
+
+ +
1767 {
+
1768 LSTATUS s;
+
1769
+ + +
1772 return true;
+
1773
+
1774 {
+
1775 reg_key k;
+
1776 handle_type h;
+ +
1778 if (s == ERROR_SUCCESS)
+
1779 k.attach(h);
+
1780 else {
+
1781 SetLastError(s);
+
1782 return false;
+
1783 }
+
1784 for (;;) {
+ + +
1787 s = RegEnumKeyEx(k, 0, szName, &dwSize, NULL, NULL, NULL, NULL);
+
1788 if (s == ERROR_SUCCESS)
+
1789 k.delete_subkey(szName);
+
1790 else if (s == ERROR_NO_MORE_ITEMS)
+
1791 break;
+
1792 else {
+
1793 SetLastError(s);
+
1794 return false;
+
1795 }
+
1796 }
+
1797 }
+
1798
+ +
1800 if (s == ERROR_SUCCESS)
+
1801 return true;
+
1802 else {
+
1803 SetLastError(s);
+
1804 return false;
+
1805 }
+
1806 }
-
1754
-
-
1761 class reg_key : public handle<HKEY, NULL>
-
1762 {
- -
1764
-
1765 public:
-
-
1771 virtual ~reg_key()
-
1772 {
-
1773 if (m_h != invalid)
-
1774 free_internal();
-
1775 }
+
1807
+
1808 protected:
+
+
1814 void free_internal() noexcept override
+
1815 {
+ +
1817 }
-
1776
-
- -
1787 {
-
1788 LSTATUS s;
-
1789
- - -
1792 return true;
-
1793
-
1794 {
-
1795 reg_key k;
-
1796 handle_type h;
- -
1798 if (s == ERROR_SUCCESS)
-
1799 k.attach(h);
-
1800 else {
-
1801 SetLastError(s);
-
1802 return false;
-
1803 }
-
1804 for (;;) {
- - -
1807 s = RegEnumKeyEx(k, 0, szName, &dwSize, NULL, NULL, NULL, NULL);
-
1808 if (s == ERROR_SUCCESS)
-
1809 k.delete_subkey(szName);
-
1810 else if (s == ERROR_NO_MORE_ITEMS)
-
1811 break;
-
1812 else {
-
1813 SetLastError(s);
-
1814 return false;
-
1815 }
-
1816 }
-
1817 }
-
1818
- -
1820 if (s == ERROR_SUCCESS)
-
1821 return true;
-
1822 else {
-
1823 SetLastError(s);
-
1824 return false;
-
1825 }
-
1826 }
+
1818 };
-
1827
-
1828 protected:
-
-
1834 void free_internal() noexcept override
-
1835 {
- +
1819
+
+
1823 class security_id : public handle<PSID, NULL>
+
1824 {
+ +
1826
+
1827 public:
+
+ +
1834 {
+
1835 if (m_h != invalid)
+
1836 free_internal();
1837 }
-
1838 };
+
1838
+
1839 protected:
+
+
1845 void free_internal() noexcept override
+
1846 {
+
1847 FreeSid(m_h);
+
1848 }
-
1839
-
-
1843 class security_id : public handle<PSID, NULL>
-
1844 {
- -
1846
-
1847 public:
-
- -
1854 {
-
1855 if (m_h != invalid)
-
1856 free_internal();
-
1857 }
+
1849 };
+
1850
+
+
1854 class process_information : public PROCESS_INFORMATION
+
1855 {
+ +
1858
-
1859 protected:
-
-
1865 void free_internal() noexcept override
-
1866 {
-
1867 FreeSid(m_h);
-
1868 }
-
-
1869 };
+
1859 public:
+
+ +
1864 {
+ + +
1867 dwProcessId = 0;
+
1868 dwThreadId = 0;
+
1869 }
1870
-
-
1874 class process_information : public PROCESS_INFORMATION
-
1875 {
- - +
+ +
1875 {
+
1876 #pragma warning(push)
+
1877 #pragma warning(disable: 6001) // Using uninitialized memory '*this'. << ???
1878
-
1879 public:
-
- -
1884 {
- - -
1887 dwProcessId = 0;
-
1888 dwThreadId = 0;
-
1889 }
+ + +
1881
+ + +
1884
+
1885 #pragma warning(pop)
+
1886 }
-
1890
-
- -
1895 {
-
1896 #pragma warning(push)
-
1897 #pragma warning(disable: 6001) // Using uninitialized memory '*this'. << ???
-
1898
- - -
1901
- - -
1904
-
1905 #pragma warning(pop)
-
1906 }
+
1887 };
-
1907 };
+
1888
+
+
1894 class event_log : public handle<HANDLE, NULL>
+
1895 {
+ +
1897
+
1898 public:
+
+
1904 virtual ~event_log()
+
1905 {
+
1906 if (m_h != invalid)
+
1907 free_internal();
+
1908 }
-
1908
-
-
1914 class event_log : public handle<HANDLE, NULL>
-
1915 {
- -
1917
-
1918 public:
-
-
1924 virtual ~event_log()
-
1925 {
-
1926 if (m_h != invalid)
-
1927 free_internal();
-
1928 }
+
1909
+
1910 protected:
+
+
1916 void free_internal() noexcept override
+
1917 {
+ +
1919 }
-
1929
-
1930 protected:
-
-
1936 void free_internal() noexcept override
-
1937 {
- +
1920 };
+
+
1921
+
+
1925 class sc_handle : public handle<SC_HANDLE, NULL>
+
1926 {
+ +
1928
+
1929 public:
+
+
1935 virtual ~sc_handle()
+
1936 {
+
1937 if (m_h != invalid)
+
1938 free_internal();
1939 }
-
1940 };
+
1940
+
1941 protected:
+
+
1947 void free_internal() noexcept override
+
1948 {
+ +
1950 }
-
1941
-
-
1945 class sc_handle : public handle<SC_HANDLE, NULL>
-
1946 {
- -
1948
-
1949 public:
-
-
1955 virtual ~sc_handle()
-
1956 {
-
1957 if (m_h != invalid)
-
1958 free_internal();
-
1959 }
+
1951 };
-
1960
-
1961 protected:
-
-
1967 void free_internal() noexcept override
-
1968 {
- -
1970 }
+
1952
+
1954}
+
1955
+
1958
+
1959#pragma warning(push)
+
1960#pragma warning(disable: 4505) // Don't warn on unused code
+
1961
+
+
1963static LSTATUS RegCreateKeyExA(
+
1964 _In_ HKEY hKey,
+
1965 _In_ LPCSTR lpSubKey,
+
1966 _Reserved_ DWORD Reserved,
+
1967 _In_opt_ LPSTR lpClass,
+
1968 _In_ DWORD dwOptions,
+
1969 _In_ REGSAM samDesired,
+
1970 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+
1971 _Inout_ winstd::reg_key &result,
+
1972 _Out_opt_ LPDWORD lpdwDisposition)
+
1973{
+
1974 HKEY h;
+
1975 LSTATUS s = RegCreateKeyExA(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
+
1976 if (s == ERROR_SUCCESS)
+
1977 result.attach(h);
+
1978 return s;
+
1979}
-
1971 };
+
1980
+
+
1986static LSTATUS RegCreateKeyExW(
+
1987 _In_ HKEY hKey,
+
1988 _In_ LPCWSTR lpSubKey,
+
1989 _Reserved_ DWORD Reserved,
+
1990 _In_opt_ LPWSTR lpClass,
+
1991 _In_ DWORD dwOptions,
+
1992 _In_ REGSAM samDesired,
+
1993 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+
1994 _Inout_ winstd::reg_key &result,
+
1995 _Out_opt_ LPDWORD lpdwDisposition)
+
1996{
+
1997 HKEY h;
+
1998 LSTATUS s = RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
+
1999 if (s == ERROR_SUCCESS)
+
2000 result.attach(h);
+
2001 return s;
+
2002}
-
1972
-
1974}
-
1975
-
1978
-
1979#pragma warning(push)
-
1980#pragma warning(disable: 4505) // Don't warn on unused code
-
1981
-
-
1983static LSTATUS RegCreateKeyExA(
-
1984 _In_ HKEY hKey,
-
1985 _In_ LPCSTR lpSubKey,
-
1986 _Reserved_ DWORD Reserved,
-
1987 _In_opt_ LPSTR lpClass,
-
1988 _In_ DWORD dwOptions,
-
1989 _In_ REGSAM samDesired,
-
1990 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
-
1991 _Inout_ winstd::reg_key &result,
-
1992 _Out_opt_ LPDWORD lpdwDisposition)
-
1993{
-
1994 HKEY h;
-
1995 LSTATUS s = RegCreateKeyExA(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
-
1996 if (s == ERROR_SUCCESS)
-
1997 result.attach(h);
-
1998 return s;
-
1999}
+
2003
+
+
2005static LSTATUS RegOpenKeyExA(
+
2006 _In_ HKEY hKey,
+
2007 _In_opt_ LPCSTR lpSubKey,
+
2008 _In_opt_ DWORD ulOptions,
+
2009 _In_ REGSAM samDesired,
+
2010 _Inout_ winstd::reg_key &result)
+
2011{
+
2012 HKEY h;
+
2013 LSTATUS s = RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, &h);
+
2014 if (s == ERROR_SUCCESS)
+
2015 result.attach(h);
+
2016 return s;
+
2017}
-
2000
-
-
2006static LSTATUS RegCreateKeyExW(
-
2007 _In_ HKEY hKey,
-
2008 _In_ LPCWSTR lpSubKey,
-
2009 _Reserved_ DWORD Reserved,
-
2010 _In_opt_ LPWSTR lpClass,
-
2011 _In_ DWORD dwOptions,
-
2012 _In_ REGSAM samDesired,
-
2013 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
-
2014 _Inout_ winstd::reg_key &result,
-
2015 _Out_opt_ LPDWORD lpdwDisposition)
-
2016{
-
2017 HKEY h;
-
2018 LSTATUS s = RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
-
2019 if (s == ERROR_SUCCESS)
-
2020 result.attach(h);
-
2021 return s;
-
2022}
+
2018
+
+
2024static LSTATUS RegOpenKeyExW(
+
2025 _In_ HKEY hKey,
+
2026 _In_opt_ LPCWSTR lpSubKey,
+
2027 _In_opt_ DWORD ulOptions,
+
2028 _In_ REGSAM samDesired,
+
2029 _Inout_ winstd::reg_key &result)
+
2030{
+
2031 HKEY h;
+
2032 LSTATUS s = RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, &h);
+
2033 if (s == ERROR_SUCCESS)
+
2034 result.attach(h);
+
2035 return s;
+
2036}
-
2023
-
-
2025static LSTATUS RegOpenKeyExA(
-
2026 _In_ HKEY hKey,
-
2027 _In_opt_ LPCSTR lpSubKey,
-
2028 _In_opt_ DWORD ulOptions,
-
2029 _In_ REGSAM samDesired,
-
2030 _Inout_ winstd::reg_key &result)
-
2031{
-
2032 HKEY h;
-
2033 LSTATUS s = RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, &h);
-
2034 if (s == ERROR_SUCCESS)
-
2035 result.attach(h);
-
2036 return s;
-
2037}
+
2037
+
+
2043static BOOL OpenProcessToken(_In_ HANDLE ProcessHandle, _In_ DWORD DesiredAccess, _Inout_ winstd::win_handle<NULL> &TokenHandle)
+
2044{
+
2045 HANDLE h;
+
2046 if (OpenProcessToken(ProcessHandle, DesiredAccess, &h)) {
+
2047 TokenHandle.attach(h);
+
2048 return TRUE;
+
2049 }
+
2050 return FALSE;
+
2051}
-
2038
-
-
2044static LSTATUS RegOpenKeyExW(
-
2045 _In_ HKEY hKey,
-
2046 _In_opt_ LPCWSTR lpSubKey,
-
2047 _In_opt_ DWORD ulOptions,
-
2048 _In_ REGSAM samDesired,
-
2049 _Inout_ winstd::reg_key &result)
-
2050{
-
2051 HKEY h;
-
2052 LSTATUS s = RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, &h);
-
2053 if (s == ERROR_SUCCESS)
-
2054 result.attach(h);
-
2055 return s;
-
2056}
+
2052
+
+
2058static BOOL DuplicateTokenEx(_In_ HANDLE hExistingToken, _In_ DWORD dwDesiredAccess, _In_opt_ LPSECURITY_ATTRIBUTES lpTokenAttributes, _In_ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, _In_ TOKEN_TYPE TokenType, _Inout_ winstd::win_handle<NULL> &NewToken)
+
2059{
+
2060 HANDLE h;
+
2061 if (DuplicateTokenEx(hExistingToken, dwDesiredAccess, lpTokenAttributes, ImpersonationLevel, TokenType, &h)) {
+
2062 NewToken.attach(h);
+
2063 return TRUE;
+
2064 }
+
2065 return FALSE;
+
2066}
-
2057
-
-
2063static BOOL OpenProcessToken(_In_ HANDLE ProcessHandle, _In_ DWORD DesiredAccess, _Inout_ winstd::win_handle<NULL> &TokenHandle)
-
2064{
-
2065 HANDLE h;
-
2066 if (OpenProcessToken(ProcessHandle, DesiredAccess, &h)) {
-
2067 TokenHandle.attach(h);
-
2068 return TRUE;
-
2069 }
-
2070 return FALSE;
-
2071}
+
2067
+
+
2073static BOOL AllocateAndInitializeSid(_In_ PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, _In_ BYTE nSubAuthorityCount, _In_ DWORD nSubAuthority0, _In_ DWORD nSubAuthority1, _In_ DWORD nSubAuthority2, _In_ DWORD nSubAuthority3, _In_ DWORD nSubAuthority4, _In_ DWORD nSubAuthority5, _In_ DWORD nSubAuthority6, _In_ DWORD nSubAuthority7, _Inout_ winstd::security_id& Sid)
+
2074{
+
2075 PSID h;
+
2076 if (AllocateAndInitializeSid(pIdentifierAuthority, nSubAuthorityCount, nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, &h)) {
+
2077 Sid.attach(h);
+
2078 return TRUE;
+
2079 }
+
2080 return FALSE;
+
2081}
-
2072
-
-
2078static BOOL DuplicateTokenEx(_In_ HANDLE hExistingToken, _In_ DWORD dwDesiredAccess, _In_opt_ LPSECURITY_ATTRIBUTES lpTokenAttributes, _In_ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, _In_ TOKEN_TYPE TokenType, _Inout_ winstd::win_handle<NULL> &NewToken)
-
2079{
-
2080 HANDLE h;
-
2081 if (DuplicateTokenEx(hExistingToken, dwDesiredAccess, lpTokenAttributes, ImpersonationLevel, TokenType, &h)) {
-
2082 NewToken.attach(h);
-
2083 return TRUE;
-
2084 }
-
2085 return FALSE;
-
2086}
+
2082
+
+
2084static DWORD SetEntriesInAclA(_In_ ULONG cCountOfExplicitEntries, _In_reads_opt_(cCountOfExplicitEntries) PEXPLICIT_ACCESS_A pListOfExplicitEntries, _In_opt_ PACL OldAcl, _Inout_ std::unique_ptr<ACL, winstd::LocalFree_delete<ACL>>& Acl)
+
2085{
+
2086 PACL h;
+
2087 DWORD dwResult = SetEntriesInAclA(cCountOfExplicitEntries, pListOfExplicitEntries, OldAcl, &h);
+
2088 if (dwResult == ERROR_SUCCESS)
+
2089 Acl.reset(h);
+
2090 return ERROR_SUCCESS;
+
2091}
-
2087
-
-
2093static BOOL AllocateAndInitializeSid(_In_ PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, _In_ BYTE nSubAuthorityCount, _In_ DWORD nSubAuthority0, _In_ DWORD nSubAuthority1, _In_ DWORD nSubAuthority2, _In_ DWORD nSubAuthority3, _In_ DWORD nSubAuthority4, _In_ DWORD nSubAuthority5, _In_ DWORD nSubAuthority6, _In_ DWORD nSubAuthority7, _Inout_ winstd::security_id& Sid)
-
2094{
-
2095 PSID h;
-
2096 if (AllocateAndInitializeSid(pIdentifierAuthority, nSubAuthorityCount, nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, &h)) {
-
2097 Sid.attach(h);
-
2098 return TRUE;
-
2099 }
-
2100 return FALSE;
-
2101}
+
2092
+
+
2098static DWORD SetEntriesInAclW(_In_ ULONG cCountOfExplicitEntries, _In_reads_opt_(cCountOfExplicitEntries) PEXPLICIT_ACCESS_W pListOfExplicitEntries, _In_opt_ PACL OldAcl, _Inout_ std::unique_ptr<ACL, winstd::LocalFree_delete<ACL>>& Acl)
+
2099{
+
2100 PACL h;
+
2101 DWORD dwResult = SetEntriesInAclW(cCountOfExplicitEntries, pListOfExplicitEntries, OldAcl, &h);
+
2102 if (dwResult == ERROR_SUCCESS)
+
2103 Acl.reset(h);
+
2104 return ERROR_SUCCESS;
+
2105}
-
2102
-
-
2104static DWORD SetEntriesInAclA(_In_ ULONG cCountOfExplicitEntries, _In_reads_opt_(cCountOfExplicitEntries) PEXPLICIT_ACCESS_A pListOfExplicitEntries, _In_opt_ PACL OldAcl, _Inout_ std::unique_ptr<ACL, winstd::LocalFree_delete<ACL>>& Acl)
-
2105{
-
2106 PACL h;
-
2107 DWORD dwResult = SetEntriesInAclA(cCountOfExplicitEntries, pListOfExplicitEntries, OldAcl, &h);
-
2108 if (dwResult == ERROR_SUCCESS)
-
2109 Acl.reset(h);
-
2110 return ERROR_SUCCESS;
-
2111}
+
2106
+
2112template<class _Traits, class _Ax>
+
+
2113_Success_(return != 0) BOOL GetThreadPreferredUILanguages(_In_ DWORD dwFlags, _Out_ PULONG pulNumLanguages, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
+
2114{
+
2115 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
2116 ULONG ulSize = _countof(szStackBuffer);
+
2117
+
2118 // Try with stack buffer first.
+
2119 if (GetThreadPreferredUILanguages(dwFlags, pulNumLanguages, szStackBuffer, &ulSize)) {
+
2120 // Copy from stack.
+
2121 sValue.assign(szStackBuffer, ulSize - 1);
+
2122 return TRUE;
+
2123 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
2124 // Query required size.
+
2125 ulSize = 0;
+
2126 GetThreadPreferredUILanguages(dwFlags, pulNumLanguages, NULL, &ulSize);
+
2127 // Allocate on heap and retry.
+
2128 sValue.resize(ulSize - 1);
+
2129 if (GetThreadPreferredUILanguages(dwFlags, pulNumLanguages, &sValue[0], &ulSize))
+
2130 return TRUE;
+
2131 }
+
2132 return FALSE;
+
2133}
-
2112
-
-
2118static DWORD SetEntriesInAclW(_In_ ULONG cCountOfExplicitEntries, _In_reads_opt_(cCountOfExplicitEntries) PEXPLICIT_ACCESS_W pListOfExplicitEntries, _In_opt_ PACL OldAcl, _Inout_ std::unique_ptr<ACL, winstd::LocalFree_delete<ACL>>& Acl)
-
2119{
-
2120 PACL h;
-
2121 DWORD dwResult = SetEntriesInAclW(cCountOfExplicitEntries, pListOfExplicitEntries, OldAcl, &h);
-
2122 if (dwResult == ERROR_SUCCESS)
-
2123 Acl.reset(h);
-
2124 return ERROR_SUCCESS;
-
2125}
-
-
2126
-
2132template<class _Traits, class _Ax>
-
-
2133_Success_(return != 0) BOOL GetThreadPreferredUILanguages(_In_ DWORD dwFlags, _Out_ PULONG pulNumLanguages, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
2134{
-
2135 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
2136 ULONG ulSize = _countof(szStackBuffer);
-
2137
-
2138 // Try with stack buffer first.
-
2139 if (GetThreadPreferredUILanguages(dwFlags, pulNumLanguages, szStackBuffer, &ulSize)) {
-
2140 // Copy from stack.
-
2141 sValue.assign(szStackBuffer, ulSize - 1);
-
2142 return TRUE;
-
2143 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
2144 // Query required size.
-
2145 ulSize = 0;
-
2146 GetThreadPreferredUILanguages(dwFlags, pulNumLanguages, NULL, &ulSize);
-
2147 // Allocate on heap and retry.
-
2148 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[ulSize]);
-
2149 if (GetThreadPreferredUILanguages(dwFlags, pulNumLanguages, szBuffer.get(), &ulSize)) {
-
2150 sValue.assign(szBuffer.get(), ulSize - 1);
-
2151 return TRUE;
-
2152 }
-
2153 }
-
2154 return FALSE;
-
2155}
-
-
2156
-
2157#pragma warning(pop)
-
2158
-
Activates given activation context in constructor and deactivates it in destructor.
Definition Win.h:1431
-
actctx_activator(HANDLE hActCtx) noexcept
Construct the activator and activates the given activation context.
Definition Win.h:1443
-
virtual ~actctx_activator()
Deactivates activation context and destructs the activator.
Definition Win.h:1454
-
ULONG_PTR m_cookie
Cookie for context deactivation.
Definition Win.h:1461
-
Clipboard management.
Definition Win.h:1579
-
virtual ~clipboard_opener()
Closes the clipboard.
Definition Win.h:1597
-
clipboard_opener(HWND hWndNewOwner=NULL)
Opens the clipboard for examination and prevents other applications from modifying the clipboard cont...
Definition Win.h:1586
-
Console control handler stack management.
Definition Win.h:1607
-
console_ctrl_handler(PHANDLER_ROUTINE HandlerRoutine) noexcept
Construct the console control handler object and pushes the given handler to the console control hand...
Definition Win.h:1619
-
virtual ~console_ctrl_handler()
Pops console control handler from the console control handler stack.
Definition Win.h:1629
-
PHANDLER_ROUTINE m_handler
Pointer to console control handler.
Definition Win.h:1637
-
BOOL m_cookie
Did pushing the console control handler succeed?
Definition Win.h:1636
-
Critical section wrapper.
Definition Win.h:1162
-
critical_section() noexcept
Construct the object and initializes a critical section object.
Definition Win.h:1172
-
CRITICAL_SECTION m_data
Critical section struct.
Definition Win.h:1198
-
virtual ~critical_section()
Releases all resources used by an unowned critical section object.
Definition Win.h:1182
-
Event log handle wrapper.
Definition Win.h:1915
-
void free_internal() noexcept override
Closes an event log handle.
Definition Win.h:1936
-
virtual ~event_log()
Closes an event log handle.
Definition Win.h:1924
-
Find-file handle wrapper.
Definition Win.h:1207
-
virtual ~find_file()
Closes a file search handle.
Definition Win.h:1216
-
void free_internal() noexcept override
Closes a file search handle.
Definition Win.h:1228
-
Base abstract template class to support generic object handle keeping.
Definition Common.h:1020
-
handle_type m_h
Object handle.
Definition Common.h:1272
-
HeapAlloc allocator.
Definition Win.h:1318
-
SIZE_T size_type
An unsigned integral type that can represent the length of any sequence that an object of template cl...
Definition Win.h:1327
-
_Ty value_type
A type that is managed by the allocator.
Definition Win.h:1320
-
heap_allocator(const heap_allocator< _Other > &other)
Constructs allocator from another type.
Definition Win.h:1354
-
HANDLE m_heap
Heap handle.
Definition Win.h:1424
-
pointer allocate(size_type count)
Allocates a new memory block.
Definition Win.h:1364
-
ptrdiff_t difference_type
A signed integral type that can represent the difference between values of pointers to the type of ob...
Definition Win.h:1328
-
heap_allocator(HANDLE heap)
Constructs allocator.
Definition Win.h:1345
-
_Ty & reference
A type that provides a reference to the type of object managed by the allocator.
Definition Win.h:1323
-
void construct(pointer ptr, _Ty &&val)
Calls moving constructor for the element.
Definition Win.h:1400
-
void deallocate(pointer ptr, size_type size)
Frees memory block.
Definition Win.h:1376
-
size_type max_size() const
Returns maximum memory block size.
Definition Win.h:1418
-
void construct(pointer ptr, const _Ty &val)
Calls copying constructor for the element.
Definition Win.h:1389
-
const _Ty & const_reference
A type that provides a constant reference to type of object managed by the allocator.
Definition Win.h:1325
-
const _Ty * const_pointer
A type that provides a constant pointer to the type of object managed by the allocator.
Definition Win.h:1324
-
_Ty * pointer
A type that provides a pointer to the type of object managed by the allocator.
Definition Win.h:1322
-
void destroy(pointer ptr)
Calls destructor for the element.
Definition Win.h:1410
-
Heap handle wrapper.
Definition Win.h:1240
-
bool enumerate() noexcept
Enumerates allocated heap blocks using OutputDebugString()
Definition Win.h:1262
-
void free_internal() noexcept override
Destroys the heap.
Definition Win.h:1306
-
virtual ~heap()
Destroys the heap.
Definition Win.h:1249
-
Base class for thread impersonation of another security context.
Definition Win.h:1468
-
virtual ~impersonator()
Reverts to current user and destructs the impersonator.
Definition Win.h:1480
-
impersonator() noexcept
Construct the impersonator.
Definition Win.h:1473
-
BOOL m_cookie
Did impersonation succeed?
Definition Win.h:1492
-
Module handle wrapper.
Definition Win.h:1065
-
void free_internal() noexcept override
Frees the module.
Definition Win.h:1086
-
virtual ~library()
Frees the module.
Definition Win.h:1074
-
PROCESS_INFORMATION struct wrapper.
Definition Win.h:1875
-
~process_information()
Closes process and thread handles.
Definition Win.h:1894
-
process_information() noexcept
Constructs blank PROCESS_INFORMATION.
Definition Win.h:1883
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
-
Registry key wrapper class.
Definition Win.h:1762
-
void free_internal() noexcept override
Closes a handle to the registry key.
Definition Win.h:1834
-
bool delete_subkey(LPCTSTR szSubkey)
Deletes the specified registry subkey.
Definition Win.h:1786
-
virtual ~reg_key()
Closes a handle to the registry key.
Definition Win.h:1771
-
SC_HANDLE wrapper class.
Definition Win.h:1946
-
void free_internal() noexcept override
Closes an open object handle.
Definition Win.h:1967
-
virtual ~sc_handle()
Closes an open object handle.
Definition Win.h:1955
-
SID wrapper class.
Definition Win.h:1844
-
void free_internal() noexcept override
Closes a handle to the SID.
Definition Win.h:1865
-
virtual ~security_id()
Closes a handle to the SID.
Definition Win.h:1853
-
Lets the calling thread impersonate the security context of the SYSTEM user.
Definition Win.h:1521
-
system_impersonator() noexcept
Construct the impersonator and impersonates the SYSTEM user.
Definition Win.h:1529
-
Lets the calling thread impersonate the security context of a logged-on user.
Definition Win.h:1499
-
user_impersonator(HANDLE hToken) noexcept
Construct the impersonator and impersonates the given user.
Definition Win.h:1511
-
Memory in virtual address space of a process handle wrapper.
Definition Win.h:1644
-
vmemory & operator=(vmemory &&other) noexcept
Move assignment.
Definition Win.h:1691
-
bool alloc(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) noexcept
Reserves, commits, or changes the state of a region of memory within the virtual address space of a s...
Definition Win.h:1725
-
void free_internal() noexcept override
Frees the memory.
Definition Win.h:1746
-
void attach(HANDLE proc, handle_type h) noexcept
Sets a new memory handle for the class.
Definition Win.h:1708
-
virtual ~vmemory()
Frees the memory.
Definition Win.h:1680
-
vmemory(handle_type h, HANDLE proc) noexcept
Initializes a new class instance with an already available object handle.
Definition Win.h:1660
-
vmemory() noexcept
Initializes a new class instance with the memory handle set to INVAL.
Definition Win.h:1651
-
vmemory(vmemory &&h) noexcept
Move constructor.
Definition Win.h:1670
-
HANDLE m_proc
Handle of memory's process.
Definition Win.h:1752
-
Windows HANDLE wrapper class.
Definition Win.h:1032
-
void free_internal() noexcept override
Closes an open object handle.
Definition Win.h:1053
-
virtual ~win_handle()
Closes an open object handle.
Definition Win.h:1041
-
Windows runtime error.
Definition Common.h:1520
+
2134
+
2135#pragma warning(pop)
+
2136
+
Activates given activation context in constructor and deactivates it in destructor.
Definition Win.h:1411
+
actctx_activator(HANDLE hActCtx) noexcept
Construct the activator and activates the given activation context.
Definition Win.h:1423
+
virtual ~actctx_activator()
Deactivates activation context and destructs the activator.
Definition Win.h:1434
+
ULONG_PTR m_cookie
Cookie for context deactivation.
Definition Win.h:1441
+
Clipboard management.
Definition Win.h:1559
+
virtual ~clipboard_opener()
Closes the clipboard.
Definition Win.h:1577
+
clipboard_opener(HWND hWndNewOwner=NULL)
Opens the clipboard for examination and prevents other applications from modifying the clipboard cont...
Definition Win.h:1566
+
Console control handler stack management.
Definition Win.h:1587
+
console_ctrl_handler(PHANDLER_ROUTINE HandlerRoutine) noexcept
Construct the console control handler object and pushes the given handler to the console control hand...
Definition Win.h:1599
+
virtual ~console_ctrl_handler()
Pops console control handler from the console control handler stack.
Definition Win.h:1609
+
PHANDLER_ROUTINE m_handler
Pointer to console control handler.
Definition Win.h:1617
+
BOOL m_cookie
Did pushing the console control handler succeed?
Definition Win.h:1616
+
Critical section wrapper.
Definition Win.h:1142
+
critical_section() noexcept
Construct the object and initializes a critical section object.
Definition Win.h:1152
+
CRITICAL_SECTION m_data
Critical section struct.
Definition Win.h:1178
+
virtual ~critical_section()
Releases all resources used by an unowned critical section object.
Definition Win.h:1162
+
Event log handle wrapper.
Definition Win.h:1895
+
void free_internal() noexcept override
Closes an event log handle.
Definition Win.h:1916
+
virtual ~event_log()
Closes an event log handle.
Definition Win.h:1904
+
Find-file handle wrapper.
Definition Win.h:1187
+
virtual ~find_file()
Closes a file search handle.
Definition Win.h:1196
+
void free_internal() noexcept override
Closes a file search handle.
Definition Win.h:1208
+
Base abstract template class to support generic object handle keeping.
Definition Common.h:1000
+
handle_type m_h
Object handle.
Definition Common.h:1252
+
HeapAlloc allocator.
Definition Win.h:1298
+
SIZE_T size_type
An unsigned integral type that can represent the length of any sequence that an object of template cl...
Definition Win.h:1307
+
_Ty value_type
A type that is managed by the allocator.
Definition Win.h:1300
+
heap_allocator(const heap_allocator< _Other > &other)
Constructs allocator from another type.
Definition Win.h:1334
+
HANDLE m_heap
Heap handle.
Definition Win.h:1404
+
pointer allocate(size_type count)
Allocates a new memory block.
Definition Win.h:1344
+
ptrdiff_t difference_type
A signed integral type that can represent the difference between values of pointers to the type of ob...
Definition Win.h:1308
+
heap_allocator(HANDLE heap)
Constructs allocator.
Definition Win.h:1325
+
_Ty & reference
A type that provides a reference to the type of object managed by the allocator.
Definition Win.h:1303
+
void construct(pointer ptr, _Ty &&val)
Calls moving constructor for the element.
Definition Win.h:1380
+
void deallocate(pointer ptr, size_type size)
Frees memory block.
Definition Win.h:1356
+
size_type max_size() const
Returns maximum memory block size.
Definition Win.h:1398
+
void construct(pointer ptr, const _Ty &val)
Calls copying constructor for the element.
Definition Win.h:1369
+
const _Ty & const_reference
A type that provides a constant reference to type of object managed by the allocator.
Definition Win.h:1305
+
const _Ty * const_pointer
A type that provides a constant pointer to the type of object managed by the allocator.
Definition Win.h:1304
+
_Ty * pointer
A type that provides a pointer to the type of object managed by the allocator.
Definition Win.h:1302
+
void destroy(pointer ptr)
Calls destructor for the element.
Definition Win.h:1390
+
Heap handle wrapper.
Definition Win.h:1220
+
bool enumerate() noexcept
Enumerates allocated heap blocks using OutputDebugString()
Definition Win.h:1242
+
void free_internal() noexcept override
Destroys the heap.
Definition Win.h:1286
+
virtual ~heap()
Destroys the heap.
Definition Win.h:1229
+
Base class for thread impersonation of another security context.
Definition Win.h:1448
+
virtual ~impersonator()
Reverts to current user and destructs the impersonator.
Definition Win.h:1460
+
impersonator() noexcept
Construct the impersonator.
Definition Win.h:1453
+
BOOL m_cookie
Did impersonation succeed?
Definition Win.h:1472
+
Module handle wrapper.
Definition Win.h:1045
+
void free_internal() noexcept override
Frees the module.
Definition Win.h:1066
+
virtual ~library()
Frees the module.
Definition Win.h:1054
+
PROCESS_INFORMATION struct wrapper.
Definition Win.h:1855
+
~process_information()
Closes process and thread handles.
Definition Win.h:1874
+
process_information() noexcept
Constructs blank PROCESS_INFORMATION.
Definition Win.h:1863
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
+
Registry key wrapper class.
Definition Win.h:1742
+
void free_internal() noexcept override
Closes a handle to the registry key.
Definition Win.h:1814
+
bool delete_subkey(LPCTSTR szSubkey)
Deletes the specified registry subkey.
Definition Win.h:1766
+
virtual ~reg_key()
Closes a handle to the registry key.
Definition Win.h:1751
+
SC_HANDLE wrapper class.
Definition Win.h:1926
+
void free_internal() noexcept override
Closes an open object handle.
Definition Win.h:1947
+
virtual ~sc_handle()
Closes an open object handle.
Definition Win.h:1935
+
SID wrapper class.
Definition Win.h:1824
+
void free_internal() noexcept override
Closes a handle to the SID.
Definition Win.h:1845
+
virtual ~security_id()
Closes a handle to the SID.
Definition Win.h:1833
+
Lets the calling thread impersonate the security context of the SYSTEM user.
Definition Win.h:1501
+
system_impersonator() noexcept
Construct the impersonator and impersonates the SYSTEM user.
Definition Win.h:1509
+
Lets the calling thread impersonate the security context of a logged-on user.
Definition Win.h:1479
+
user_impersonator(HANDLE hToken) noexcept
Construct the impersonator and impersonates the given user.
Definition Win.h:1491
+
Memory in virtual address space of a process handle wrapper.
Definition Win.h:1624
+
vmemory & operator=(vmemory &&other) noexcept
Move assignment.
Definition Win.h:1671
+
bool alloc(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) noexcept
Reserves, commits, or changes the state of a region of memory within the virtual address space of a s...
Definition Win.h:1705
+
void free_internal() noexcept override
Frees the memory.
Definition Win.h:1726
+
void attach(HANDLE proc, handle_type h) noexcept
Sets a new memory handle for the class.
Definition Win.h:1688
+
virtual ~vmemory()
Frees the memory.
Definition Win.h:1660
+
vmemory(handle_type h, HANDLE proc) noexcept
Initializes a new class instance with an already available object handle.
Definition Win.h:1640
+
vmemory() noexcept
Initializes a new class instance with the memory handle set to INVAL.
Definition Win.h:1631
+
vmemory(vmemory &&h) noexcept
Move constructor.
Definition Win.h:1650
+
HANDLE m_proc
Handle of memory's process.
Definition Win.h:1732
+
Windows HANDLE wrapper class.
Definition Win.h:1012
+
void free_internal() noexcept override
Closes an open object handle.
Definition Win.h:1033
+
virtual ~win_handle()
Closes an open object handle.
Definition Win.h:1021
+
Windows runtime error.
Definition Common.h:1500
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition Common.h:67
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition Common.h:94
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition Common.h:75
-
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition Common.h:288
-
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition Common.h:321
+
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition Common.h:271
+
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition Common.h:309
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
-
static const HANDLE invalid
Invalid handle value.
Definition Common.h:1030
-
static int NormalizeString(NORM_FORM NormForm, LPCWSTR lpSrcString, int cwSrcLength, std::basic_string< wchar_t, _Traits, _Ax > &sDstString) noexcept
Normalizes characters of a text string according to Unicode 4.0 TR#15.
Definition Win.h:641
-
static DWORD ExpandEnvironmentStringsW(LPCWSTR lpSrc, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Expands environment-variable strings, replaces them with the values defined for the current user,...
Definition Win.h:210
-
static BOOL StringToGuidA(LPCSTR lpszGuid, LPGUID lpGuid, LPCSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition Win.h:273
+
static const HANDLE invalid
Invalid handle value.
Definition Common.h:1010
+
static int NormalizeString(NORM_FORM NormForm, LPCWSTR lpSrcString, int cwSrcLength, std::basic_string< wchar_t, _Traits, _Ax > &sDstString) noexcept
Normalizes characters of a text string according to Unicode 4.0 TR#15.
Definition Win.h:627
+
static DWORD ExpandEnvironmentStringsW(LPCWSTR lpSrc, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Expands environment-variable strings, replaces them with the values defined for the current user,...
Definition Win.h:192
+
static BOOL StringToGuidA(LPCSTR lpszGuid, LPGUID lpGuid, LPCSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition Win.h:255
static int GetWindowTextA(HWND hWnd, std::basic_string< char, _Traits, _Ax > &sValue) noexcept
Copies the text of the specified window's title bar (if it has one) into a std::wstring string.
Definition Win.h:82
-
static LSTATUS RegCreateKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD Reserved, LPWSTR lpClass, DWORD dwOptions, REGSAM samDesired, CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes, winstd::reg_key &result, LPDWORD lpdwDisposition)
Creates the specified registry key. If the key already exists, the function opens it.
Definition Win.h:2006
-
static int WINAPI LoadStringA(HINSTANCE hInstance, UINT uID, std::basic_string< char, _Traits, _Ax > &sBuffer) noexcept
Loads a string resource from the executable file associated with a specified module.
Definition Win.h:723
-
win_handle< INVALID_HANDLE_VALUE > file
File handle wrapper.
Definition Win.h:1126
-
static BOOL GetFileVersionInfoA(LPCSTR lptstrFilename, __reserved DWORD dwHandle, std::vector< _Ty, _Ax > &aValue) noexcept
Retrieves version information for the specified file and stores it in a std::vector buffer.
Definition Win.h:144
-
static LSTATUS RegCreateKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD Reserved, LPSTR lpClass, DWORD dwOptions, REGSAM samDesired, CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes, winstd::reg_key &result, LPDWORD lpdwDisposition)
Creates the specified registry key. If the key already exists, the function opens it.
Definition Win.h:1983
-
static LSTATUS RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition Win.h:2025
-
static LSTATUS RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition Win.h:2044
-
static VOID GuidToStringA(LPCGUID lpGuid, std::basic_string< char, _Traits, _Ax > &str) noexcept
Formats GUID and stores it in a std::wstring string.
Definition Win.h:234
-
static BOOL StringToGuidW(LPCWSTR lpszGuid, LPGUID lpGuid, LPCWSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition Win.h:346
-
static LSTATUS RegLoadMUIStringW(HKEY hKey, LPCWSTR pszValue, std::basic_string< wchar_t, _Traits, _Ax > &sOut, DWORD Flags, LPCWSTR pszDirectory) noexcept
Loads the specified string from the specified key and subkey, and stores it in a std::wstring string.
Definition Win.h:611
-
static BOOL OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, winstd::win_handle< NULL > &TokenHandle)
Opens the access token associated with a process.
Definition Win.h:2063
-
static DWORD SetEntriesInAclW(ULONG cCountOfExplicitEntries, PEXPLICIT_ACCESS_W pListOfExplicitEntries, PACL OldAcl, std::unique_ptr< ACL, winstd::LocalFree_delete< ACL > > &Acl)
Creates a new access control list (ACL) by merging new access control or audit control information in...
Definition Win.h:2118
-
static BOOL LookupAccountSidA(LPCSTR lpSystemName, PSID lpSid, std::basic_string< char, _Traits, _Ax > *sName, std::basic_string< char, _Traits, _Ax > *sReferencedDomainName, 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 ...
Definition Win.h:841
+
static LSTATUS RegCreateKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD Reserved, LPWSTR lpClass, DWORD dwOptions, REGSAM samDesired, CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes, winstd::reg_key &result, LPDWORD lpdwDisposition)
Creates the specified registry key. If the key already exists, the function opens it.
Definition Win.h:1986
+
static int WINAPI LoadStringA(HINSTANCE hInstance, UINT uID, std::basic_string< char, _Traits, _Ax > &sBuffer) noexcept
Loads a string resource from the executable file associated with a specified module.
Definition Win.h:707
+
win_handle< INVALID_HANDLE_VALUE > file
File handle wrapper.
Definition Win.h:1106
+
static BOOL GetFileVersionInfoA(LPCSTR lptstrFilename, __reserved DWORD dwHandle, std::vector< _Ty, _Ax > &aValue) noexcept
Retrieves version information for the specified file and stores it in a std::vector buffer.
Definition Win.h:126
+
static LSTATUS RegCreateKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD Reserved, LPSTR lpClass, DWORD dwOptions, REGSAM samDesired, CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes, winstd::reg_key &result, LPDWORD lpdwDisposition)
Creates the specified registry key. If the key already exists, the function opens it.
Definition Win.h:1963
+
static LSTATUS RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition Win.h:2005
+
static LSTATUS RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition Win.h:2024
+
static VOID GuidToStringA(LPCGUID lpGuid, std::basic_string< char, _Traits, _Ax > &str) noexcept
Formats GUID and stores it in a std::wstring string.
Definition Win.h:216
+
static BOOL StringToGuidW(LPCWSTR lpszGuid, LPGUID lpGuid, LPCWSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition Win.h:328
+
static LSTATUS RegLoadMUIStringW(HKEY hKey, LPCWSTR pszValue, std::basic_string< wchar_t, _Traits, _Ax > &sOut, DWORD Flags, LPCWSTR pszDirectory) noexcept
Loads the specified string from the specified key and subkey, and stores it in a std::wstring string.
Definition Win.h:597
+
static BOOL OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, winstd::win_handle< NULL > &TokenHandle)
Opens the access token associated with a process.
Definition Win.h:2043
+
static DWORD SetEntriesInAclW(ULONG cCountOfExplicitEntries, PEXPLICIT_ACCESS_W pListOfExplicitEntries, PACL OldAcl, std::unique_ptr< ACL, winstd::LocalFree_delete< ACL > > &Acl)
Creates a new access control list (ACL) by merging new access control or audit control information in...
Definition Win.h:2098
+
static BOOL LookupAccountSidA(LPCSTR lpSystemName, PSID lpSid, std::basic_string< char, _Traits, _Ax > *sName, std::basic_string< char, _Traits, _Ax > *sReferencedDomainName, 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 ...
Definition Win.h:821
static DWORD GetModuleFileNameW(HMODULE hModule, std::basic_string< wchar_t, _Traits, _Ax > &sValue) noexcept
Retrieves the fully qualified path for the file that contains the specified module and stores it in a...
Definition Win.h:57
-
static BOOL LookupAccountSidW(LPCWSTR lpSystemName, PSID lpSid, std::basic_string< wchar_t, _Traits, _Ax > *sName, std::basic_string< wchar_t, _Traits, _Ax > *sReferencedDomainName, 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 ...
Definition Win.h:880
-
static BOOL AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, winstd::security_id &Sid)
Allocates and initializes a security identifier (SID) with up to eight subauthorities.
Definition Win.h:2093
-
win_handle< INVALID_HANDLE_VALUE > process_snapshot
Process snapshot handle wrapper.
Definition Win.h:1111
+
static BOOL LookupAccountSidW(LPCWSTR lpSystemName, PSID lpSid, std::basic_string< wchar_t, _Traits, _Ax > *sName, std::basic_string< wchar_t, _Traits, _Ax > *sReferencedDomainName, 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 ...
Definition Win.h:860
+
static BOOL AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, winstd::security_id &Sid)
Allocates and initializes a security identifier (SID) with up to eight subauthorities.
Definition Win.h:2073
+
win_handle< INVALID_HANDLE_VALUE > process_snapshot
Process snapshot handle wrapper.
Definition Win.h:1091
static DWORD GetModuleFileNameA(HMODULE hModule, std::basic_string< char, _Traits, _Ax > &sValue) noexcept
Retrieves the fully qualified path for the file that contains the specified module and stores it in a...
Definition Win.h:26
-
static int GetDateFormatW(LCID Locale, DWORD dwFlags, const SYSTEMTIME *lpDate, LPCWSTR lpFormat, std::basic_string< wchar_t, _Traits, _Ax > &sDate) noexcept
Formats a date as a date string for a locale specified by the locale identifier. The function formats...
Definition Win.h:825
-
static BOOL CreateWellKnownSid(WELL_KNOWN_SID_TYPE WellKnownSidType, PSID DomainSid, std::unique_ptr< SID > &Sid)
Creates a SID for predefined aliases.
Definition Win.h:918
-
static int WINAPI LoadStringW(HINSTANCE hInstance, UINT uID, std::basic_string< wchar_t, _Traits, _Ax > &sBuffer) noexcept
Loads a string resource from the executable file associated with a specified module.
Definition Win.h:741
-
static BOOL GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, std::unique_ptr< _Ty > &TokenInformation) noexcept
Retrieves a specified type of information about an access token. The calling process must have approp...
Definition Win.h:942
-
static BOOL DuplicateTokenEx(HANDLE hExistingToken, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, winstd::win_handle< NULL > &NewToken)
Creates a new access token that duplicates an existing token. This function can create either a prima...
Definition Win.h:2078
-
static DWORD SetEntriesInAclA(ULONG cCountOfExplicitEntries, PEXPLICIT_ACCESS_A pListOfExplicitEntries, PACL OldAcl, std::unique_ptr< ACL, winstd::LocalFree_delete< ACL > > &Acl)
Creates a new access control list (ACL) by merging new access control or audit control information in...
Definition Win.h:2104
-
static LSTATUS RegQueryValueExW(HKEY hKey, LPCWSTR lpValueName, __reserved LPDWORD lpReserved, LPDWORD lpType, std::vector< _Ty, _Ax > &aData) noexcept
Retrieves the type and data for the specified value name associated with an open registry key and sto...
Definition Win.h:572
-
static BOOL GetFileVersionInfoW(LPCWSTR lptstrFilename, __reserved DWORD dwHandle, std::vector< _Ty, _Ax > &aValue) noexcept
Retrieves version information for the specified file and stores it in a std::vector buffer.
Definition Win.h:164
-
win_handle< NULL > event
Event handle wrapper.
Definition Win.h:1156
-
static LSTATUS RegLoadMUIStringA(HKEY hKey, LPCSTR pszValue, std::basic_string< char, _Traits, _Ax > &sOut, DWORD Flags, LPCSTR pszDirectory) noexcept
Loads the specified string from the specified key and subkey, and stores it in a std::wstring string.
Definition Win.h:597
-
static VOID OutputDebugStr(LPCSTR lpOutputString,...) noexcept
Formats and sends a string to the debugger for display.
Definition Win.h:782
-
static BOOL QueryFullProcessImageNameA(HANDLE hProcess, DWORD dwFlags, std::basic_string< char, _Traits, _Ax > &sExeName)
Retrieves the full name of the executable image for the specified process.
Definition Win.h:966
-
win_handle< NULL > mutex
Mutex handle wrapper.
Definition Win.h:1118
-
static DWORD ExpandEnvironmentStringsA(LPCSTR lpSrc, std::basic_string< char, _Traits, _Ax > &sValue)
Expands environment-variable strings, replaces them with the values defined for the current user,...
Definition Win.h:180
-
win_handle< NULL > file_mapping
File mapping.
Definition Win.h:1133
-
static BOOL QueryFullProcessImageNameW(HANDLE hProcess, DWORD dwFlags, std::basic_string< wchar_t, _Traits, _Ax > &sExeName)
Retrieves the full name of the executable image for the specified process.
Definition Win.h:995
-
win_handle< NULL > process
Process handle wrapper.
Definition Win.h:1097
-
static LSTATUS RegQueryValueExA(HKEY hKey, LPCSTR lpValueName, __reserved LPDWORD lpReserved, LPDWORD lpType, std::vector< _Ty, _Ax > &aData) noexcept
Retrieves the type and data for the specified value name associated with an open registry key and sto...
Definition Win.h:545
-
BOOL GetThreadPreferredUILanguages(DWORD dwFlags, PULONG pulNumLanguages, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Retrieves the thread preferred UI languages for the current thread.
Definition Win.h:2133
-
static LSTATUS RegQueryStringValue(HKEY hReg, LPCSTR pszName, std::basic_string< char, _Traits, _Ax > &sValue) noexcept
Queries for a string value in the registry and stores it in a std::string string.
Definition Win.h:434
-
static int GetWindowTextW(HWND hWnd, std::basic_string< wchar_t, _Traits, _Ax > &sValue) noexcept
Copies the text of the specified window's title bar (if it has one) into a std::wstring string.
Definition Win.h:115
-
static int GetDateFormatA(LCID Locale, DWORD dwFlags, const SYSTEMTIME *lpDate, LPCSTR lpFormat, std::basic_string< char, _Traits, _Ax > &sDate) noexcept
Formats a date as a date string for a locale specified by the locale identifier. The function formats...
Definition Win.h:805
-
static VOID GuidToStringW(LPCGUID lpGuid, std::basic_string< wchar_t, _Traits, _Ax > &str) noexcept
Formats GUID and stores it in a std::wstring string.
Definition Win.h:253
-
static VOID OutputDebugStrV(LPCSTR lpOutputString, va_list arg) noexcept
Formats and sends a string to the debugger for display.
Definition Win.h:758
-
win_handle< NULL > thread
Thread handle wrapper.
Definition Win.h:1104
-
Deleter for unique_ptr using UnmapViewOfFile.
Definition Win.h:1139
-
void operator()(void *_Ptr) const
Delete a pointer.
Definition Win.h:1143
-
A structure that enables an allocator for objects of one type to allocate storage for objects of anot...
Definition Win.h:1335
-
heap_allocator< _Other > other
Other allocator type.
Definition Win.h:1336
+
static int GetDateFormatW(LCID Locale, DWORD dwFlags, const SYSTEMTIME *lpDate, LPCWSTR lpFormat, std::basic_string< wchar_t, _Traits, _Ax > &sDate) noexcept
Formats a date as a date string for a locale specified by the locale identifier. The function formats...
Definition Win.h:807
+
static BOOL CreateWellKnownSid(WELL_KNOWN_SID_TYPE WellKnownSidType, PSID DomainSid, std::unique_ptr< SID > &Sid)
Creates a SID for predefined aliases.
Definition Win.h:898
+
static int WINAPI LoadStringW(HINSTANCE hInstance, UINT uID, std::basic_string< wchar_t, _Traits, _Ax > &sBuffer) noexcept
Loads a string resource from the executable file associated with a specified module.
Definition Win.h:725
+
static BOOL GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, std::unique_ptr< _Ty > &TokenInformation) noexcept
Retrieves a specified type of information about an access token. The calling process must have approp...
Definition Win.h:922
+
static BOOL DuplicateTokenEx(HANDLE hExistingToken, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, winstd::win_handle< NULL > &NewToken)
Creates a new access token that duplicates an existing token. This function can create either a prima...
Definition Win.h:2058
+
static DWORD SetEntriesInAclA(ULONG cCountOfExplicitEntries, PEXPLICIT_ACCESS_A pListOfExplicitEntries, PACL OldAcl, std::unique_ptr< ACL, winstd::LocalFree_delete< ACL > > &Acl)
Creates a new access control list (ACL) by merging new access control or audit control information in...
Definition Win.h:2084
+
static LSTATUS RegQueryValueExW(HKEY hKey, LPCWSTR lpValueName, __reserved LPDWORD lpReserved, LPDWORD lpType, std::vector< _Ty, _Ax > &aData) noexcept
Retrieves the type and data for the specified value name associated with an open registry key and sto...
Definition Win.h:558
+
static BOOL GetFileVersionInfoW(LPCWSTR lptstrFilename, __reserved DWORD dwHandle, std::vector< _Ty, _Ax > &aValue) noexcept
Retrieves version information for the specified file and stores it in a std::vector buffer.
Definition Win.h:146
+
win_handle< NULL > event
Event handle wrapper.
Definition Win.h:1136
+
static LSTATUS RegLoadMUIStringA(HKEY hKey, LPCSTR pszValue, std::basic_string< char, _Traits, _Ax > &sOut, DWORD Flags, LPCSTR pszDirectory) noexcept
Loads the specified string from the specified key and subkey, and stores it in a std::wstring string.
Definition Win.h:583
+
static VOID OutputDebugStr(LPCSTR lpOutputString,...) noexcept
Formats and sends a string to the debugger for display.
Definition Win.h:766
+
static BOOL QueryFullProcessImageNameA(HANDLE hProcess, DWORD dwFlags, std::basic_string< char, _Traits, _Ax > &sExeName)
Retrieves the full name of the executable image for the specified process.
Definition Win.h:946
+
win_handle< NULL > mutex
Mutex handle wrapper.
Definition Win.h:1098
+
static DWORD ExpandEnvironmentStringsA(LPCSTR lpSrc, std::basic_string< char, _Traits, _Ax > &sValue)
Expands environment-variable strings, replaces them with the values defined for the current user,...
Definition Win.h:162
+
win_handle< NULL > file_mapping
File mapping.
Definition Win.h:1113
+
static BOOL QueryFullProcessImageNameW(HANDLE hProcess, DWORD dwFlags, std::basic_string< wchar_t, _Traits, _Ax > &sExeName)
Retrieves the full name of the executable image for the specified process.
Definition Win.h:975
+
win_handle< NULL > process
Process handle wrapper.
Definition Win.h:1077
+
static LSTATUS RegQueryValueExA(HKEY hKey, LPCSTR lpValueName, __reserved LPDWORD lpReserved, LPDWORD lpType, std::vector< _Ty, _Ax > &aData) noexcept
Retrieves the type and data for the specified value name associated with an open registry key and sto...
Definition Win.h:531
+
BOOL GetThreadPreferredUILanguages(DWORD dwFlags, PULONG pulNumLanguages, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Retrieves the thread preferred UI languages for the current thread.
Definition Win.h:2113
+
static LSTATUS RegQueryStringValue(HKEY hReg, LPCSTR pszName, std::basic_string< char, _Traits, _Ax > &sValue) noexcept
Queries for a string value in the registry and stores it in a std::string string.
Definition Win.h:416
+
static int GetWindowTextW(HWND hWnd, std::basic_string< wchar_t, _Traits, _Ax > &sValue) noexcept
Copies the text of the specified window's title bar (if it has one) into a std::wstring string.
Definition Win.h:106
+
static int GetDateFormatA(LCID Locale, DWORD dwFlags, const SYSTEMTIME *lpDate, LPCSTR lpFormat, std::basic_string< char, _Traits, _Ax > &sDate) noexcept
Formats a date as a date string for a locale specified by the locale identifier. The function formats...
Definition Win.h:789
+
static VOID GuidToStringW(LPCGUID lpGuid, std::basic_string< wchar_t, _Traits, _Ax > &str) noexcept
Formats GUID and stores it in a std::wstring string.
Definition Win.h:235
+
static VOID OutputDebugStrV(LPCSTR lpOutputString, va_list arg) noexcept
Formats and sends a string to the debugger for display.
Definition Win.h:742
+
win_handle< NULL > thread
Thread handle wrapper.
Definition Win.h:1084
+
Deleter for unique_ptr using UnmapViewOfFile.
Definition Win.h:1119
+
void operator()(void *_Ptr) const
Delete a pointer.
Definition Win.h:1123
+
A structure that enables an allocator for objects of one type to allocate storage for objects of anot...
Definition Win.h:1315
+
heap_allocator< _Other > other
Other allocator type.
Definition Win.h:1316
diff --git a/_win_h_t_t_p_8h_source.html b/_win_h_t_t_p_8h_source.html index 0a4afbdf..0f4f38cc 100644 --- a/_win_h_t_t_p_8h_source.html +++ b/_win_h_t_t_p_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -124,18 +124,18 @@ $(function() { codefold.init(0); });
51
53}
-
Base abstract template class to support generic object handle keeping.
Definition Common.h:1020
-
handle_type m_h
Object handle.
Definition Common.h:1272
+
Base abstract template class to support generic object handle keeping.
Definition Common.h:1000
+
handle_type m_h
Object handle.
Definition Common.h:1252
HTTP handle wrapper class.
Definition WinHTTP.h:25
virtual ~http()
Closes a handle to the HTTP.
Definition WinHTTP.h:34
void free_internal() noexcept override
Closes a handle to the HTTP.
Definition WinHTTP.h:46
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
-
static const HINTERNET invalid
Invalid handle value.
Definition Common.h:1030
+
static const HINTERNET invalid
Invalid handle value.
Definition Common.h:1010
diff --git a/_win_sock2_8h_source.html b/_win_sock2_8h_source.html index 688a9106..86581eb7 100644 --- a/_win_sock2_8h_source.html +++ b/_win_sock2_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -255,10 +255,10 @@ $(function() { codefold.init(0); });
ADDRINFOA wrapper class.
Definition WinSock2.h:109
void free_internal() noexcept override
Frees address information.
Definition WinSock2.h:130
virtual ~addrinfo()
Frees address information.
Definition WinSock2.h:118
-
Base abstract template class to support generic object handle keeping.
Definition Common.h:1020
-
handle_type m_h
Object handle.
Definition Common.h:1272
-
Numerical runtime error.
Definition Common.h:1477
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
+
Base abstract template class to support generic object handle keeping.
Definition Common.h:1000
+
handle_type m_h
Object handle.
Definition Common.h:1252
+
Numerical runtime error.
Definition Common.h:1457
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
ADDRINFOW wrapper class.
Definition WinSock2.h:142
virtual ~waddrinfo()
Frees address information.
Definition WinSock2.h:151
void free_internal() noexcept override
Frees address information.
Definition WinSock2.h:163
@@ -273,15 +273,15 @@ $(function() { codefold.init(0); });
addrinfo taddrinfo
Multi-byte / Wide-character ADDRINFO wrapper class (according to _UNICODE)
Definition WinSock2.h:175
static INT GetAddrInfoW(PCWSTR pNodeName, PCWSTR pServiceName, const ADDRINFOW *pHints, winstd::waddrinfo &result)
Provides protocol-independent translation from a host name to an address.
Definition WinSock2.h:208
static INT GetAddrInfoA(PCSTR pNodeName, PCSTR pServiceName, const ADDRINFOA *pHints, winstd::addrinfo &result)
Provides protocol-independent translation from a host name to an address.
Definition WinSock2.h:190
-
static DWORD FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, std::basic_string< wchar_t, _Traits, _Ax > &str, va_list *Arguments)
Formats a message string.
Definition Common.h:699
-
static int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::basic_string< char, _Traits, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily f...
Definition Common.h:336
-
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition Common.h:321
+
static DWORD FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, std::basic_string< wchar_t, _Traits, _Ax > &str, va_list *Arguments)
Formats a message string.
Definition Common.h:679
+
static int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::basic_string< char, _Traits, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily f...
Definition Common.h:324
+
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition Common.h:309
#define WINSTD_HANDLE_IMPL(C, T, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition Common.h:164
-
static const PADDRINFOA invalid
Invalid handle value.
Definition Common.h:1030
+
static const PADDRINFOA invalid
Invalid handle value.
Definition Common.h:1010
diff --git a/_win_trust_8h_source.html b/_win_trust_8h_source.html index 668dc060..c8acd780 100644 --- a/_win_trust_8h_source.html +++ b/_win_trust_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 1991-2023 Amebis
+
3 Copyright © 1991-2024 Amebis
4 Copyright © 2016 GÉANT
5*/
6
@@ -134,8 +134,8 @@ $(function() { codefold.init(0); });
57
59}
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
-
Windows runtime error.
Definition Common.h:1520
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839
+
Windows runtime error.
Definition Common.h:1500
WinTrust engine wrapper class.
Definition WinTrust.h:23
wintrust(HWND hwnd, const GUID &action, WINTRUST_DATA &wtd)
Initializes a new class instance.
Definition WinTrust.h:31
virtual ~wintrust()
Destroys the WinTrust context.
Definition WinTrust.h:44
@@ -144,7 +144,7 @@ $(function() { codefold.init(0); });
diff --git a/annotated.html b/annotated.html index 75de1b91..3648f187 100644 --- a/annotated.html +++ b/annotated.html @@ -175,7 +175,7 @@ $(function() {
diff --git a/classes.html b/classes.html index b4898aa1..5d1fa59a 100644 --- a/classes.html +++ b/classes.html @@ -132,7 +132,7 @@ $(function() {
diff --git a/classwinstd_1_1actctx__activator-members.html b/classwinstd_1_1actctx__activator-members.html index c6eaa30f..389bdf7d 100644 --- a/classwinstd_1_1actctx__activator-members.html +++ b/classwinstd_1_1actctx__activator-members.html @@ -88,7 +88,7 @@ $(function() {
diff --git a/classwinstd_1_1actctx__activator.html b/classwinstd_1_1actctx__activator.html index 36ded3b8..0643d2ce 100644 --- a/classwinstd_1_1actctx__activator.html +++ b/classwinstd_1_1actctx__activator.html @@ -176,7 +176,7 @@ Protected Attributes
diff --git a/classwinstd_1_1addrinfo-members.html b/classwinstd_1_1addrinfo-members.html index 55306f57..253e3bbc 100644 --- a/classwinstd_1_1addrinfo-members.html +++ b/classwinstd_1_1addrinfo-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1addrinfo.html b/classwinstd_1_1addrinfo.html index d897e745..2db63094 100644 --- a/classwinstd_1_1addrinfo.html +++ b/classwinstd_1_1addrinfo.html @@ -257,7 +257,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1basic__string__guid-members.html b/classwinstd_1_1basic__string__guid-members.html index ebc7de78..e197de4b 100644 --- a/classwinstd_1_1basic__string__guid-members.html +++ b/classwinstd_1_1basic__string__guid-members.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/classwinstd_1_1basic__string__guid.html b/classwinstd_1_1basic__string__guid.html index a36c6ff7..55c23a48 100644 --- a/classwinstd_1_1basic__string__guid.html +++ b/classwinstd_1_1basic__string__guid.html @@ -150,7 +150,7 @@ template<class
diff --git a/classwinstd_1_1basic__string__msg-members.html b/classwinstd_1_1basic__string__msg-members.html index dd913c31..21a2e492 100644 --- a/classwinstd_1_1basic__string__msg-members.html +++ b/classwinstd_1_1basic__string__msg-members.html @@ -92,7 +92,7 @@ $(function() {
diff --git a/classwinstd_1_1basic__string__msg.html b/classwinstd_1_1basic__string__msg.html index 42b5b29a..7eeefb2d 100644 --- a/classwinstd_1_1basic__string__msg.html +++ b/classwinstd_1_1basic__string__msg.html @@ -441,7 +441,7 @@ template<class
diff --git a/classwinstd_1_1basic__string__printf-members.html b/classwinstd_1_1basic__string__printf-members.html index cf10b7f1..3c822606 100644 --- a/classwinstd_1_1basic__string__printf-members.html +++ b/classwinstd_1_1basic__string__printf-members.html @@ -88,7 +88,7 @@ $(function() {
diff --git a/classwinstd_1_1basic__string__printf.html b/classwinstd_1_1basic__string__printf.html index 47c6121d..824c8986 100644 --- a/classwinstd_1_1basic__string__printf.html +++ b/classwinstd_1_1basic__string__printf.html @@ -252,7 +252,7 @@ template<class
diff --git a/classwinstd_1_1bstr-members.html b/classwinstd_1_1bstr-members.html index 0f824cd8..4565dda9 100644 --- a/classwinstd_1_1bstr-members.html +++ b/classwinstd_1_1bstr-members.html @@ -122,7 +122,7 @@ $(function() {
diff --git a/classwinstd_1_1bstr.html b/classwinstd_1_1bstr.html index 6457fea9..4bb8e7fe 100644 --- a/classwinstd_1_1bstr.html +++ b/classwinstd_1_1bstr.html @@ -370,7 +370,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1cert__chain__context-members.html b/classwinstd_1_1cert__chain__context-members.html index 9ae1b865..e3b3bc46 100644 --- a/classwinstd_1_1cert__chain__context-members.html +++ b/classwinstd_1_1cert__chain__context-members.html @@ -118,7 +118,7 @@ $(function() {
diff --git a/classwinstd_1_1cert__chain__context.html b/classwinstd_1_1cert__chain__context.html index 99700af5..4969768e 100644 --- a/classwinstd_1_1cert__chain__context.html +++ b/classwinstd_1_1cert__chain__context.html @@ -327,7 +327,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1cert__context-members.html b/classwinstd_1_1cert__context-members.html index fc78418e..9e7ee2b3 100644 --- a/classwinstd_1_1cert__context-members.html +++ b/classwinstd_1_1cert__context-members.html @@ -124,7 +124,7 @@ $(function() {
diff --git a/classwinstd_1_1cert__context.html b/classwinstd_1_1cert__context.html index 2bb33d50..788393ab 100644 --- a/classwinstd_1_1cert__context.html +++ b/classwinstd_1_1cert__context.html @@ -573,7 +573,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1cert__store-members.html b/classwinstd_1_1cert__store-members.html index ecab1333..26781733 100644 --- a/classwinstd_1_1cert__store-members.html +++ b/classwinstd_1_1cert__store-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1cert__store.html b/classwinstd_1_1cert__store.html index 4132b300..b0596a27 100644 --- a/classwinstd_1_1cert__store.html +++ b/classwinstd_1_1cert__store.html @@ -259,7 +259,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1clipboard__opener-members.html b/classwinstd_1_1clipboard__opener-members.html index 7c4668bb..89273b47 100644 --- a/classwinstd_1_1clipboard__opener-members.html +++ b/classwinstd_1_1clipboard__opener-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/classwinstd_1_1clipboard__opener.html b/classwinstd_1_1clipboard__opener.html index 8df355d4..42d8f019 100644 --- a/classwinstd_1_1clipboard__opener.html +++ b/classwinstd_1_1clipboard__opener.html @@ -162,7 +162,7 @@ Public Member Functions
diff --git a/classwinstd_1_1com__initializer-members.html b/classwinstd_1_1com__initializer-members.html index 690170ab..5a0d1075 100644 --- a/classwinstd_1_1com__initializer-members.html +++ b/classwinstd_1_1com__initializer-members.html @@ -88,7 +88,7 @@ $(function() {
diff --git a/classwinstd_1_1com__initializer.html b/classwinstd_1_1com__initializer.html index 74093c4a..db2b5b8b 100644 --- a/classwinstd_1_1com__initializer.html +++ b/classwinstd_1_1com__initializer.html @@ -197,7 +197,7 @@ Public Member Functions
diff --git a/classwinstd_1_1com__obj-members.html b/classwinstd_1_1com__obj-members.html index c34cbeb1..54c92fdd 100644 --- a/classwinstd_1_1com__obj-members.html +++ b/classwinstd_1_1com__obj-members.html @@ -124,7 +124,7 @@ $(function() {
diff --git a/classwinstd_1_1com__obj.html b/classwinstd_1_1com__obj.html index 6cd4f8d8..db92de9d 100644 --- a/classwinstd_1_1com__obj.html +++ b/classwinstd_1_1com__obj.html @@ -493,7 +493,7 @@ template<class
diff --git a/classwinstd_1_1com__runtime__error-members.html b/classwinstd_1_1com__runtime__error-members.html index 16fe5851..395c0867 100644 --- a/classwinstd_1_1com__runtime__error-members.html +++ b/classwinstd_1_1com__runtime__error-members.html @@ -92,7 +92,7 @@ $(function() {
diff --git a/classwinstd_1_1com__runtime__error.html b/classwinstd_1_1com__runtime__error.html index 43fdc848..e600eec4 100644 --- a/classwinstd_1_1com__runtime__error.html +++ b/classwinstd_1_1com__runtime__error.html @@ -216,7 +216,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1console__ctrl__handler-members.html b/classwinstd_1_1console__ctrl__handler-members.html index 41fc3ca1..18074fbd 100644 --- a/classwinstd_1_1console__ctrl__handler-members.html +++ b/classwinstd_1_1console__ctrl__handler-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/classwinstd_1_1console__ctrl__handler.html b/classwinstd_1_1console__ctrl__handler.html index f2cb94a8..df5617d1 100644 --- a/classwinstd_1_1console__ctrl__handler.html +++ b/classwinstd_1_1console__ctrl__handler.html @@ -180,7 +180,7 @@ Protected Attributes
diff --git a/classwinstd_1_1critical__section-members.html b/classwinstd_1_1critical__section-members.html index 02a129df..ed08052d 100644 --- a/classwinstd_1_1critical__section-members.html +++ b/classwinstd_1_1critical__section-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/classwinstd_1_1critical__section.html b/classwinstd_1_1critical__section.html index 23150837..1cc8491b 100644 --- a/classwinstd_1_1critical__section.html +++ b/classwinstd_1_1critical__section.html @@ -202,7 +202,7 @@ Protected Attributes
diff --git a/classwinstd_1_1crypt__hash-members.html b/classwinstd_1_1crypt__hash-members.html index 8d595247..6bc572e8 100644 --- a/classwinstd_1_1crypt__hash-members.html +++ b/classwinstd_1_1crypt__hash-members.html @@ -118,7 +118,7 @@ $(function() {
diff --git a/classwinstd_1_1crypt__hash.html b/classwinstd_1_1crypt__hash.html index 9fd20412..bd1c4a77 100644 --- a/classwinstd_1_1crypt__hash.html +++ b/classwinstd_1_1crypt__hash.html @@ -327,7 +327,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1crypt__key-members.html b/classwinstd_1_1crypt__key-members.html index 1a685379..ca9e33e1 100644 --- a/classwinstd_1_1crypt__key-members.html +++ b/classwinstd_1_1crypt__key-members.html @@ -119,7 +119,7 @@ $(function() {
diff --git a/classwinstd_1_1crypt__key.html b/classwinstd_1_1crypt__key.html index 943b840c..69ace5c9 100644 --- a/classwinstd_1_1crypt__key.html +++ b/classwinstd_1_1crypt__key.html @@ -375,7 +375,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1crypt__prov-members.html b/classwinstd_1_1crypt__prov-members.html index fb66e9af..4b8f8c47 100644 --- a/classwinstd_1_1crypt__prov-members.html +++ b/classwinstd_1_1crypt__prov-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1crypt__prov.html b/classwinstd_1_1crypt__prov.html index 7399fc80..7dec92c9 100644 --- a/classwinstd_1_1crypt__prov.html +++ b/classwinstd_1_1crypt__prov.html @@ -257,7 +257,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1data__blob-members.html b/classwinstd_1_1data__blob-members.html index fa8f17ce..feca0e2b 100644 --- a/classwinstd_1_1data__blob-members.html +++ b/classwinstd_1_1data__blob-members.html @@ -95,7 +95,7 @@ $(function() {
diff --git a/classwinstd_1_1data__blob.html b/classwinstd_1_1data__blob.html index f224e3f5..782da7bc 100644 --- a/classwinstd_1_1data__blob.html +++ b/classwinstd_1_1data__blob.html @@ -145,7 +145,7 @@ Public Member Functions
diff --git a/classwinstd_1_1dc-members.html b/classwinstd_1_1dc-members.html index b224fb55..1b9c67ed 100644 --- a/classwinstd_1_1dc-members.html +++ b/classwinstd_1_1dc-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1dc.html b/classwinstd_1_1dc.html index 54070f40..ae811b5b 100644 --- a/classwinstd_1_1dc.html +++ b/classwinstd_1_1dc.html @@ -256,7 +256,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1dc__selector-members.html b/classwinstd_1_1dc__selector-members.html index 5b22378d..52781f21 100644 --- a/classwinstd_1_1dc__selector-members.html +++ b/classwinstd_1_1dc__selector-members.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/classwinstd_1_1dc__selector.html b/classwinstd_1_1dc__selector.html index 588673ff..24d909d4 100644 --- a/classwinstd_1_1dc__selector.html +++ b/classwinstd_1_1dc__selector.html @@ -210,7 +210,7 @@ Protected Attributes
diff --git a/classwinstd_1_1dplhandle-members.html b/classwinstd_1_1dplhandle-members.html index 009f9211..373cbaeb 100644 --- a/classwinstd_1_1dplhandle-members.html +++ b/classwinstd_1_1dplhandle-members.html @@ -117,7 +117,7 @@ $(function() {
diff --git a/classwinstd_1_1dplhandle.html b/classwinstd_1_1dplhandle.html index 38eb61d8..53334d33 100644 --- a/classwinstd_1_1dplhandle.html +++ b/classwinstd_1_1dplhandle.html @@ -541,7 +541,7 @@ template<class
diff --git a/classwinstd_1_1eap__attr-members.html b/classwinstd_1_1eap__attr-members.html index 3c273447..b22e0c0a 100644 --- a/classwinstd_1_1eap__attr-members.html +++ b/classwinstd_1_1eap__attr-members.html @@ -92,7 +92,7 @@ $(function() {
diff --git a/classwinstd_1_1eap__attr.html b/classwinstd_1_1eap__attr.html index bf4b2ecb..30313e7f 100644 --- a/classwinstd_1_1eap__attr.html +++ b/classwinstd_1_1eap__attr.html @@ -174,7 +174,7 @@ Public Member Functions
diff --git a/classwinstd_1_1eap__method__info__array-members.html b/classwinstd_1_1eap__method__info__array-members.html index e3202e8c..badf5d6c 100644 --- a/classwinstd_1_1eap__method__info__array-members.html +++ b/classwinstd_1_1eap__method__info__array-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/classwinstd_1_1eap__method__info__array.html b/classwinstd_1_1eap__method__info__array.html index b0116206..5c32330b 100644 --- a/classwinstd_1_1eap__method__info__array.html +++ b/classwinstd_1_1eap__method__info__array.html @@ -187,7 +187,7 @@ Public Member Functions
diff --git a/classwinstd_1_1eap__method__prop-members.html b/classwinstd_1_1eap__method__prop-members.html index 7325d658..8b506c06 100644 --- a/classwinstd_1_1eap__method__prop-members.html +++ b/classwinstd_1_1eap__method__prop-members.html @@ -88,7 +88,7 @@ $(function() {
diff --git a/classwinstd_1_1eap__method__prop.html b/classwinstd_1_1eap__method__prop.html index 683d6c56..03038796 100644 --- a/classwinstd_1_1eap__method__prop.html +++ b/classwinstd_1_1eap__method__prop.html @@ -229,7 +229,7 @@ Public Member Functions
diff --git a/classwinstd_1_1eap__packet-members.html b/classwinstd_1_1eap__packet-members.html index a5a578b3..d759ccb2 100644 --- a/classwinstd_1_1eap__packet-members.html +++ b/classwinstd_1_1eap__packet-members.html @@ -120,7 +120,7 @@ $(function() {
diff --git a/classwinstd_1_1eap__packet.html b/classwinstd_1_1eap__packet.html index f4883770..48cf42e0 100644 --- a/classwinstd_1_1eap__packet.html +++ b/classwinstd_1_1eap__packet.html @@ -346,7 +346,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1eap__runtime__error-members.html b/classwinstd_1_1eap__runtime__error-members.html index 7164a811..fd52bc4c 100644 --- a/classwinstd_1_1eap__runtime__error-members.html +++ b/classwinstd_1_1eap__runtime__error-members.html @@ -114,7 +114,7 @@ $(function() {
diff --git a/classwinstd_1_1eap__runtime__error.html b/classwinstd_1_1eap__runtime__error.html index a1cab168..5e70bba6 100644 --- a/classwinstd_1_1eap__runtime__error.html +++ b/classwinstd_1_1eap__runtime__error.html @@ -337,7 +337,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1event__data-members.html b/classwinstd_1_1event__data-members.html index c3d29087..1311b074 100644 --- a/classwinstd_1_1event__data-members.html +++ b/classwinstd_1_1event__data-members.html @@ -97,7 +97,7 @@ $(function() {
diff --git a/classwinstd_1_1event__data.html b/classwinstd_1_1event__data.html index bf3ed07b..6e3d5edd 100644 --- a/classwinstd_1_1event__data.html +++ b/classwinstd_1_1event__data.html @@ -525,7 +525,7 @@ template<class
diff --git a/classwinstd_1_1event__fn__auto-members.html b/classwinstd_1_1event__fn__auto-members.html index f91db6b7..6bcd555e 100644 --- a/classwinstd_1_1event__fn__auto-members.html +++ b/classwinstd_1_1event__fn__auto-members.html @@ -94,7 +94,7 @@ $(function() {
diff --git a/classwinstd_1_1event__fn__auto.html b/classwinstd_1_1event__fn__auto.html index 967e0e77..00bbd7dd 100644 --- a/classwinstd_1_1event__fn__auto.html +++ b/classwinstd_1_1event__fn__auto.html @@ -140,7 +140,7 @@ EVENT_DATA_DESCRIPTOR m_fn
diff --git a/classwinstd_1_1event__fn__auto__ret-members.html b/classwinstd_1_1event__fn__auto__ret-members.html index e4b2c337..5569c991 100644 --- a/classwinstd_1_1event__fn__auto__ret-members.html +++ b/classwinstd_1_1event__fn__auto__ret-members.html @@ -95,7 +95,7 @@ $(function() {
diff --git a/classwinstd_1_1event__fn__auto__ret.html b/classwinstd_1_1event__fn__auto__ret.html index 2f5c1ee3..d58fd919 100644 --- a/classwinstd_1_1event__fn__auto__ret.html +++ b/classwinstd_1_1event__fn__auto__ret.html @@ -145,7 +145,7 @@ class winstd::event_fn_auto_ret< T >

Helper template to write an e

diff --git a/classwinstd_1_1event__log-members.html b/classwinstd_1_1event__log-members.html index 0aeeac2d..86f63463 100644 --- a/classwinstd_1_1event__log-members.html +++ b/classwinstd_1_1event__log-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1event__log.html b/classwinstd_1_1event__log.html index 466c72b4..4423e3d0 100644 --- a/classwinstd_1_1event__log.html +++ b/classwinstd_1_1event__log.html @@ -257,7 +257,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1event__provider-members.html b/classwinstd_1_1event__provider-members.html index 3bed80fc..5b4dfa1b 100644 --- a/classwinstd_1_1event__provider-members.html +++ b/classwinstd_1_1event__provider-members.html @@ -117,7 +117,7 @@ $(function() {
diff --git a/classwinstd_1_1event__provider.html b/classwinstd_1_1event__provider.html index 85035865..2d57ebac 100644 --- a/classwinstd_1_1event__provider.html +++ b/classwinstd_1_1event__provider.html @@ -629,7 +629,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1event__rec-members.html b/classwinstd_1_1event__rec-members.html index 5df3dd69..9a125957 100644 --- a/classwinstd_1_1event__rec-members.html +++ b/classwinstd_1_1event__rec-members.html @@ -97,7 +97,7 @@ $(function() {
diff --git a/classwinstd_1_1event__rec.html b/classwinstd_1_1event__rec.html index 03ddbdeb..3305a458 100644 --- a/classwinstd_1_1event__rec.html +++ b/classwinstd_1_1event__rec.html @@ -499,7 +499,7 @@ Protected Member Functions
diff --git a/classwinstd_1_1event__session-members.html b/classwinstd_1_1event__session-members.html index 7d527054..29b34a71 100644 --- a/classwinstd_1_1event__session-members.html +++ b/classwinstd_1_1event__session-members.html @@ -120,7 +120,7 @@ $(function() {
diff --git a/classwinstd_1_1event__session.html b/classwinstd_1_1event__session.html index 68305067..85e43eba 100644 --- a/classwinstd_1_1event__session.html +++ b/classwinstd_1_1event__session.html @@ -645,7 +645,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1event__trace-members.html b/classwinstd_1_1event__trace-members.html index 136a1e61..6f78e07e 100644 --- a/classwinstd_1_1event__trace-members.html +++ b/classwinstd_1_1event__trace-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1event__trace.html b/classwinstd_1_1event__trace.html index 13ed597a..f76c3990 100644 --- a/classwinstd_1_1event__trace.html +++ b/classwinstd_1_1event__trace.html @@ -257,7 +257,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1event__trace__enabler-members.html b/classwinstd_1_1event__trace__enabler-members.html index 2e67fafa..331b0d34 100644 --- a/classwinstd_1_1event__trace__enabler-members.html +++ b/classwinstd_1_1event__trace__enabler-members.html @@ -98,7 +98,7 @@ $(function() {
diff --git a/classwinstd_1_1event__trace__enabler.html b/classwinstd_1_1event__trace__enabler.html index 34395213..d44af514 100644 --- a/classwinstd_1_1event__trace__enabler.html +++ b/classwinstd_1_1event__trace__enabler.html @@ -328,7 +328,7 @@ Protected Attributes
diff --git a/classwinstd_1_1find__file-members.html b/classwinstd_1_1find__file-members.html index 68e86ea0..ff445e59 100644 --- a/classwinstd_1_1find__file-members.html +++ b/classwinstd_1_1find__file-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1find__file.html b/classwinstd_1_1find__file.html index c008d557..4be05c82 100644 --- a/classwinstd_1_1find__file.html +++ b/classwinstd_1_1find__file.html @@ -257,7 +257,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1gdi__handle-members.html b/classwinstd_1_1gdi__handle-members.html index 452d32b2..5c3dffcd 100644 --- a/classwinstd_1_1gdi__handle-members.html +++ b/classwinstd_1_1gdi__handle-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1gdi__handle.html b/classwinstd_1_1gdi__handle.html index dca46aa6..3ceac1bb 100644 --- a/classwinstd_1_1gdi__handle.html +++ b/classwinstd_1_1gdi__handle.html @@ -261,7 +261,7 @@ template<class
diff --git a/classwinstd_1_1globalmem__accessor-members.html b/classwinstd_1_1globalmem__accessor-members.html index 79ad1bc7..95b1e8f6 100644 --- a/classwinstd_1_1globalmem__accessor-members.html +++ b/classwinstd_1_1globalmem__accessor-members.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/classwinstd_1_1globalmem__accessor.html b/classwinstd_1_1globalmem__accessor.html index 4702d88a..7228adab 100644 --- a/classwinstd_1_1globalmem__accessor.html +++ b/classwinstd_1_1globalmem__accessor.html @@ -183,7 +183,7 @@ template<class
diff --git a/classwinstd_1_1handle-members.html b/classwinstd_1_1handle-members.html index 9db7467b..ac248fd6 100644 --- a/classwinstd_1_1handle-members.html +++ b/classwinstd_1_1handle-members.html @@ -108,7 +108,7 @@ $(function() {
diff --git a/classwinstd_1_1handle.html b/classwinstd_1_1handle.html index c861baf9..78459b52 100644 --- a/classwinstd_1_1handle.html +++ b/classwinstd_1_1handle.html @@ -842,7 +842,7 @@ template<class
diff --git a/classwinstd_1_1heap-members.html b/classwinstd_1_1heap-members.html index 6701b871..f32d9658 100644 --- a/classwinstd_1_1heap-members.html +++ b/classwinstd_1_1heap-members.html @@ -110,7 +110,7 @@ $(function() {
diff --git a/classwinstd_1_1heap.html b/classwinstd_1_1heap.html index 7f4bd15d..2122affc 100644 --- a/classwinstd_1_1heap.html +++ b/classwinstd_1_1heap.html @@ -292,7 +292,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1heap__allocator-members.html b/classwinstd_1_1heap__allocator-members.html index dfc7faa0..ecb2e918 100644 --- a/classwinstd_1_1heap__allocator-members.html +++ b/classwinstd_1_1heap__allocator-members.html @@ -101,7 +101,7 @@ $(function() {
diff --git a/classwinstd_1_1heap__allocator.html b/classwinstd_1_1heap__allocator.html index 6ab401b2..e241cc7b 100644 --- a/classwinstd_1_1heap__allocator.html +++ b/classwinstd_1_1heap__allocator.html @@ -438,7 +438,7 @@ template<class
diff --git a/classwinstd_1_1http-members.html b/classwinstd_1_1http-members.html index 59082984..6297bcf1 100644 --- a/classwinstd_1_1http-members.html +++ b/classwinstd_1_1http-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1http.html b/classwinstd_1_1http.html index 2374689b..a9f129ad 100644 --- a/classwinstd_1_1http.html +++ b/classwinstd_1_1http.html @@ -257,7 +257,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1icon-members.html b/classwinstd_1_1icon-members.html index 7112b250..3b2ccbac 100644 --- a/classwinstd_1_1icon-members.html +++ b/classwinstd_1_1icon-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1icon.html b/classwinstd_1_1icon.html index d0c52673..3647e7cd 100644 --- a/classwinstd_1_1icon.html +++ b/classwinstd_1_1icon.html @@ -256,7 +256,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1impersonator-members.html b/classwinstd_1_1impersonator-members.html index 546f3392..c8eaeaec 100644 --- a/classwinstd_1_1impersonator-members.html +++ b/classwinstd_1_1impersonator-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/classwinstd_1_1impersonator.html b/classwinstd_1_1impersonator.html index e6734ec1..db7bb347 100644 --- a/classwinstd_1_1impersonator.html +++ b/classwinstd_1_1impersonator.html @@ -157,7 +157,7 @@ Protected Attributes
diff --git a/classwinstd_1_1library-members.html b/classwinstd_1_1library-members.html index 59e7e57c..0801840f 100644 --- a/classwinstd_1_1library-members.html +++ b/classwinstd_1_1library-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1library.html b/classwinstd_1_1library.html index 4541082a..b91ddd87 100644 --- a/classwinstd_1_1library.html +++ b/classwinstd_1_1library.html @@ -257,7 +257,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1num__runtime__error-members.html b/classwinstd_1_1num__runtime__error-members.html index 857527cc..acb738f7 100644 --- a/classwinstd_1_1num__runtime__error-members.html +++ b/classwinstd_1_1num__runtime__error-members.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/classwinstd_1_1num__runtime__error.html b/classwinstd_1_1num__runtime__error.html index 41e327e8..d702998f 100644 --- a/classwinstd_1_1num__runtime__error.html +++ b/classwinstd_1_1num__runtime__error.html @@ -213,7 +213,7 @@ template<typename diff --git a/classwinstd_1_1process__information-members.html b/classwinstd_1_1process__information-members.html index 433e9750..da307d8c 100644 --- a/classwinstd_1_1process__information-members.html +++ b/classwinstd_1_1process__information-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/classwinstd_1_1process__information.html b/classwinstd_1_1process__information.html index e2a202f2..5df62e0d 100644 --- a/classwinstd_1_1process__information.html +++ b/classwinstd_1_1process__information.html @@ -113,7 +113,7 @@ Public Member Functions
diff --git a/classwinstd_1_1ref__unique__ptr-members.html b/classwinstd_1_1ref__unique__ptr-members.html index 3bc936ff..27f6c140 100644 --- a/classwinstd_1_1ref__unique__ptr-members.html +++ b/classwinstd_1_1ref__unique__ptr-members.html @@ -92,7 +92,7 @@ $(function() {
diff --git a/classwinstd_1_1ref__unique__ptr.html b/classwinstd_1_1ref__unique__ptr.html index a848742b..9406f277 100644 --- a/classwinstd_1_1ref__unique__ptr.html +++ b/classwinstd_1_1ref__unique__ptr.html @@ -260,7 +260,7 @@ template<class
diff --git a/classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4-members.html b/classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4-members.html index 1a038b12..688f824b 100644 --- a/classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4-members.html +++ b/classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4-members.html @@ -92,7 +92,7 @@ $(function() {
diff --git a/classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4.html b/classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4.html index 19278977..5df80efb 100644 --- a/classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4.html +++ b/classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4.html @@ -260,7 +260,7 @@ template<class
diff --git a/classwinstd_1_1reg__key-members.html b/classwinstd_1_1reg__key-members.html index ce3f8df5..20bd3f14 100644 --- a/classwinstd_1_1reg__key-members.html +++ b/classwinstd_1_1reg__key-members.html @@ -110,7 +110,7 @@ $(function() {
diff --git a/classwinstd_1_1reg__key.html b/classwinstd_1_1reg__key.html index 4dfad59b..48693fe8 100644 --- a/classwinstd_1_1reg__key.html +++ b/classwinstd_1_1reg__key.html @@ -300,7 +300,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1safearray-members.html b/classwinstd_1_1safearray-members.html index a03bddf0..5cca34ec 100644 --- a/classwinstd_1_1safearray-members.html +++ b/classwinstd_1_1safearray-members.html @@ -118,7 +118,7 @@ $(function() {
diff --git a/classwinstd_1_1safearray.html b/classwinstd_1_1safearray.html index 37239bd6..cb43aa8c 100644 --- a/classwinstd_1_1safearray.html +++ b/classwinstd_1_1safearray.html @@ -326,7 +326,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1safearray__accessor-members.html b/classwinstd_1_1safearray__accessor-members.html index 2381d016..bd42f7f8 100644 --- a/classwinstd_1_1safearray__accessor-members.html +++ b/classwinstd_1_1safearray__accessor-members.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/classwinstd_1_1safearray__accessor.html b/classwinstd_1_1safearray__accessor.html index a8c7d98c..a4c5a8c3 100644 --- a/classwinstd_1_1safearray__accessor.html +++ b/classwinstd_1_1safearray__accessor.html @@ -183,7 +183,7 @@ template<class
diff --git a/classwinstd_1_1sanitizing__allocator-members.html b/classwinstd_1_1sanitizing__allocator-members.html index 4fdc5322..c43e1eaf 100644 --- a/classwinstd_1_1sanitizing__allocator-members.html +++ b/classwinstd_1_1sanitizing__allocator-members.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/classwinstd_1_1sanitizing__allocator.html b/classwinstd_1_1sanitizing__allocator.html index 1b6a819b..550e6121 100644 --- a/classwinstd_1_1sanitizing__allocator.html +++ b/classwinstd_1_1sanitizing__allocator.html @@ -139,7 +139,7 @@ class winstd::sanitizing_allocator< _Ty >

An allocator template th

diff --git a/classwinstd_1_1sanitizing__blob-members.html b/classwinstd_1_1sanitizing__blob-members.html index e3e33b44..a57af135 100644 --- a/classwinstd_1_1sanitizing__blob-members.html +++ b/classwinstd_1_1sanitizing__blob-members.html @@ -88,7 +88,7 @@ $(function() {
diff --git a/classwinstd_1_1sanitizing__blob.html b/classwinstd_1_1sanitizing__blob.html index 2e37ef1a..1e13aa3f 100644 --- a/classwinstd_1_1sanitizing__blob.html +++ b/classwinstd_1_1sanitizing__blob.html @@ -116,7 +116,7 @@ class winstd::sanitizing_blob< N >

Sanitizing BLOB.

diff --git a/classwinstd_1_1sc__handle-members.html b/classwinstd_1_1sc__handle-members.html index 8717df17..72b26117 100644 --- a/classwinstd_1_1sc__handle-members.html +++ b/classwinstd_1_1sc__handle-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1sc__handle.html b/classwinstd_1_1sc__handle.html index 1bc91e87..1438ac15 100644 --- a/classwinstd_1_1sc__handle.html +++ b/classwinstd_1_1sc__handle.html @@ -256,7 +256,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1sec__buffer__desc-members.html b/classwinstd_1_1sec__buffer__desc-members.html index 1264698b..24fc99e7 100644 --- a/classwinstd_1_1sec__buffer__desc-members.html +++ b/classwinstd_1_1sec__buffer__desc-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/classwinstd_1_1sec__buffer__desc.html b/classwinstd_1_1sec__buffer__desc.html index 1d265c85..ef9162e2 100644 --- a/classwinstd_1_1sec__buffer__desc.html +++ b/classwinstd_1_1sec__buffer__desc.html @@ -141,7 +141,7 @@ Public Member Functions
diff --git a/classwinstd_1_1sec__context-members.html b/classwinstd_1_1sec__context-members.html index 92937026..c61f457e 100644 --- a/classwinstd_1_1sec__context-members.html +++ b/classwinstd_1_1sec__context-members.html @@ -116,7 +116,7 @@ $(function() {
diff --git a/classwinstd_1_1sec__context.html b/classwinstd_1_1sec__context.html index 7619c2b2..5e3a7b8c 100644 --- a/classwinstd_1_1sec__context.html +++ b/classwinstd_1_1sec__context.html @@ -464,7 +464,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1sec__credentials-members.html b/classwinstd_1_1sec__credentials-members.html index 2cb9e7e2..9341fbd2 100644 --- a/classwinstd_1_1sec__credentials-members.html +++ b/classwinstd_1_1sec__credentials-members.html @@ -115,7 +115,7 @@ $(function() {
diff --git a/classwinstd_1_1sec__credentials.html b/classwinstd_1_1sec__credentials.html index 1f9509ee..1cd8b4a5 100644 --- a/classwinstd_1_1sec__credentials.html +++ b/classwinstd_1_1sec__credentials.html @@ -446,7 +446,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1sec__runtime__error-members.html b/classwinstd_1_1sec__runtime__error-members.html index c082d128..71a4d4f3 100644 --- a/classwinstd_1_1sec__runtime__error-members.html +++ b/classwinstd_1_1sec__runtime__error-members.html @@ -93,7 +93,7 @@ $(function() {
diff --git a/classwinstd_1_1sec__runtime__error.html b/classwinstd_1_1sec__runtime__error.html index 9705330c..cb892081 100644 --- a/classwinstd_1_1sec__runtime__error.html +++ b/classwinstd_1_1sec__runtime__error.html @@ -252,7 +252,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1security__attributes-members.html b/classwinstd_1_1security__attributes-members.html index 86fe9ae6..e4bd7e08 100644 --- a/classwinstd_1_1security__attributes-members.html +++ b/classwinstd_1_1security__attributes-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/classwinstd_1_1security__attributes.html b/classwinstd_1_1security__attributes.html index 5946c812..f8019c29 100644 --- a/classwinstd_1_1security__attributes.html +++ b/classwinstd_1_1security__attributes.html @@ -114,7 +114,7 @@ Public Member Functions
diff --git a/classwinstd_1_1security__id-members.html b/classwinstd_1_1security__id-members.html index c7be4a8b..b4d9978d 100644 --- a/classwinstd_1_1security__id-members.html +++ b/classwinstd_1_1security__id-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1security__id.html b/classwinstd_1_1security__id.html index 96c84f5a..a8c43cac 100644 --- a/classwinstd_1_1security__id.html +++ b/classwinstd_1_1security__id.html @@ -256,7 +256,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1setup__device__info__list-members.html b/classwinstd_1_1setup__device__info__list-members.html index 13ad63d8..a88caebb 100644 --- a/classwinstd_1_1setup__device__info__list-members.html +++ b/classwinstd_1_1setup__device__info__list-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1setup__device__info__list.html b/classwinstd_1_1setup__device__info__list.html index 85a6758c..049cde44 100644 --- a/classwinstd_1_1setup__device__info__list.html +++ b/classwinstd_1_1setup__device__info__list.html @@ -259,7 +259,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1setup__driver__info__list__builder-members.html b/classwinstd_1_1setup__driver__info__list__builder-members.html index 4bbf88be..a25660d5 100644 --- a/classwinstd_1_1setup__driver__info__list__builder-members.html +++ b/classwinstd_1_1setup__driver__info__list__builder-members.html @@ -88,7 +88,7 @@ $(function() {
diff --git a/classwinstd_1_1setup__driver__info__list__builder.html b/classwinstd_1_1setup__driver__info__list__builder.html index 10c52765..833d4ed7 100644 --- a/classwinstd_1_1setup__driver__info__list__builder.html +++ b/classwinstd_1_1setup__driver__info__list__builder.html @@ -203,7 +203,7 @@ Public Member Functions
diff --git a/classwinstd_1_1string__guid-members.html b/classwinstd_1_1string__guid-members.html index 07968785..ff552759 100644 --- a/classwinstd_1_1string__guid-members.html +++ b/classwinstd_1_1string__guid-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/classwinstd_1_1string__guid.html b/classwinstd_1_1string__guid.html index 10ae44ea..87987511 100644 --- a/classwinstd_1_1string__guid.html +++ b/classwinstd_1_1string__guid.html @@ -149,7 +149,7 @@ Public Member Functions
diff --git a/classwinstd_1_1system__impersonator-members.html b/classwinstd_1_1system__impersonator-members.html index 1b04f250..e57994ba 100644 --- a/classwinstd_1_1system__impersonator-members.html +++ b/classwinstd_1_1system__impersonator-members.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/classwinstd_1_1system__impersonator.html b/classwinstd_1_1system__impersonator.html index 1a838528..07be2327 100644 --- a/classwinstd_1_1system__impersonator.html +++ b/classwinstd_1_1system__impersonator.html @@ -132,7 +132,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1user__impersonator-members.html b/classwinstd_1_1user__impersonator-members.html index e4a247b8..07bceab6 100644 --- a/classwinstd_1_1user__impersonator-members.html +++ b/classwinstd_1_1user__impersonator-members.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/classwinstd_1_1user__impersonator.html b/classwinstd_1_1user__impersonator.html index 2ca03c12..78004fbd 100644 --- a/classwinstd_1_1user__impersonator.html +++ b/classwinstd_1_1user__impersonator.html @@ -166,7 +166,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1variant-members.html b/classwinstd_1_1variant-members.html index ba753e70..9020216b 100644 --- a/classwinstd_1_1variant-members.html +++ b/classwinstd_1_1variant-members.html @@ -146,7 +146,7 @@ $(function() {
diff --git a/classwinstd_1_1variant.html b/classwinstd_1_1variant.html index 8b604958..8849c6ef 100644 --- a/classwinstd_1_1variant.html +++ b/classwinstd_1_1variant.html @@ -603,7 +603,7 @@ Public Member Functions
diff --git a/classwinstd_1_1vmemory-members.html b/classwinstd_1_1vmemory-members.html index 319ddbf0..a0f59ee7 100644 --- a/classwinstd_1_1vmemory-members.html +++ b/classwinstd_1_1vmemory-members.html @@ -116,7 +116,7 @@ $(function() {
diff --git a/classwinstd_1_1vmemory.html b/classwinstd_1_1vmemory.html index 65e29622..80872ae2 100644 --- a/classwinstd_1_1vmemory.html +++ b/classwinstd_1_1vmemory.html @@ -478,7 +478,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1waddrinfo-members.html b/classwinstd_1_1waddrinfo-members.html index d848a3ed..e3d593c0 100644 --- a/classwinstd_1_1waddrinfo-members.html +++ b/classwinstd_1_1waddrinfo-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1waddrinfo.html b/classwinstd_1_1waddrinfo.html index 3fbda188..3497e2b9 100644 --- a/classwinstd_1_1waddrinfo.html +++ b/classwinstd_1_1waddrinfo.html @@ -257,7 +257,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1win__handle-members.html b/classwinstd_1_1win__handle-members.html index 824bd8d1..bb4215d9 100644 --- a/classwinstd_1_1win__handle-members.html +++ b/classwinstd_1_1win__handle-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1win__handle.html b/classwinstd_1_1win__handle.html index 87459b61..77c2fa49 100644 --- a/classwinstd_1_1win__handle.html +++ b/classwinstd_1_1win__handle.html @@ -261,7 +261,7 @@ template<HANDLE
diff --git a/classwinstd_1_1win__runtime__error-members.html b/classwinstd_1_1win__runtime__error-members.html index aab8163e..7a3f89ce 100644 --- a/classwinstd_1_1win__runtime__error-members.html +++ b/classwinstd_1_1win__runtime__error-members.html @@ -97,7 +97,7 @@ $(function() {
diff --git a/classwinstd_1_1win__runtime__error.html b/classwinstd_1_1win__runtime__error.html index 8710ee4d..a6b6e92c 100644 --- a/classwinstd_1_1win__runtime__error.html +++ b/classwinstd_1_1win__runtime__error.html @@ -368,7 +368,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1window__dc-members.html b/classwinstd_1_1window__dc-members.html index 21fe7f5b..7555a629 100644 --- a/classwinstd_1_1window__dc-members.html +++ b/classwinstd_1_1window__dc-members.html @@ -114,7 +114,7 @@ $(function() {
diff --git a/classwinstd_1_1window__dc.html b/classwinstd_1_1window__dc.html index 71de06de..284712bf 100644 --- a/classwinstd_1_1window__dc.html +++ b/classwinstd_1_1window__dc.html @@ -280,7 +280,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1wintrust-members.html b/classwinstd_1_1wintrust-members.html index b3b7989f..0348da99 100644 --- a/classwinstd_1_1wintrust-members.html +++ b/classwinstd_1_1wintrust-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/classwinstd_1_1wintrust.html b/classwinstd_1_1wintrust.html index 3356430e..b5fee2b4 100644 --- a/classwinstd_1_1wintrust.html +++ b/classwinstd_1_1wintrust.html @@ -107,7 +107,7 @@ Public Member Functions
diff --git a/classwinstd_1_1wlan__handle-members.html b/classwinstd_1_1wlan__handle-members.html index fb0d2979..602aa4ab 100644 --- a/classwinstd_1_1wlan__handle-members.html +++ b/classwinstd_1_1wlan__handle-members.html @@ -109,7 +109,7 @@ $(function() {
diff --git a/classwinstd_1_1wlan__handle.html b/classwinstd_1_1wlan__handle.html index 59892df9..495399f3 100644 --- a/classwinstd_1_1wlan__handle.html +++ b/classwinstd_1_1wlan__handle.html @@ -257,7 +257,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1ws2__runtime__error-members.html b/classwinstd_1_1ws2__runtime__error-members.html index 2c432676..7b3f44f4 100644 --- a/classwinstd_1_1ws2__runtime__error-members.html +++ b/classwinstd_1_1ws2__runtime__error-members.html @@ -97,7 +97,7 @@ $(function() {
diff --git a/classwinstd_1_1ws2__runtime__error.html b/classwinstd_1_1ws2__runtime__error.html index 2835a44d..d6ca7616 100644 --- a/classwinstd_1_1ws2__runtime__error.html +++ b/classwinstd_1_1ws2__runtime__error.html @@ -367,7 +367,7 @@ Additional Inherited Members
diff --git a/classwinstd_1_1wstring__guid-members.html b/classwinstd_1_1wstring__guid-members.html index ddb74d92..f040c9ca 100644 --- a/classwinstd_1_1wstring__guid-members.html +++ b/classwinstd_1_1wstring__guid-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/classwinstd_1_1wstring__guid.html b/classwinstd_1_1wstring__guid.html index bad51864..8a77b341 100644 --- a/classwinstd_1_1wstring__guid.html +++ b/classwinstd_1_1wstring__guid.html @@ -149,7 +149,7 @@ Public Member Functions
diff --git a/dir_4be4f7b278e009bf0f1906cf31fb73bd.html b/dir_4be4f7b278e009bf0f1906cf31fb73bd.html index 7e707598..1e0cdbb2 100644 --- a/dir_4be4f7b278e009bf0f1906cf31fb73bd.html +++ b/dir_4be4f7b278e009bf0f1906cf31fb73bd.html @@ -88,7 +88,7 @@ Files
diff --git a/dir_6f50bb204833d887b928571856c82fbe.html b/dir_6f50bb204833d887b928571856c82fbe.html index 383433f8..35ef0b81 100644 --- a/dir_6f50bb204833d887b928571856c82fbe.html +++ b/dir_6f50bb204833d887b928571856c82fbe.html @@ -120,7 +120,7 @@ Files
diff --git a/dir_d44c64559bbebec7f509842c48db8b23.html b/dir_d44c64559bbebec7f509842c48db8b23.html index cca16d94..e8fa173b 100644 --- a/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/dir_d44c64559bbebec7f509842c48db8b23.html @@ -88,7 +88,7 @@ Directories
diff --git a/files.html b/files.html index 3e0a5c63..ad71bf82 100644 --- a/files.html +++ b/files.html @@ -103,7 +103,7 @@ $(function() {
diff --git a/functions.html b/functions.html index 43070457..65665a3a 100644 --- a/functions.html +++ b/functions.html @@ -81,7 +81,7 @@ $(function() {
diff --git a/functions_a.html b/functions_a.html index c8e4d8cb..9fb840e3 100644 --- a/functions_a.html +++ b/functions_a.html @@ -85,7 +85,7 @@ $(function() {
diff --git a/functions_b.html b/functions_b.html index ea5d44d6..45bd3664 100644 --- a/functions_b.html +++ b/functions_b.html @@ -83,7 +83,7 @@ $(function() {
diff --git a/functions_c.html b/functions_c.html index 3160bd46..c3116314 100644 --- a/functions_c.html +++ b/functions_c.html @@ -94,7 +94,7 @@ $(function() {
diff --git a/functions_d.html b/functions_d.html index 92eb7c94..9780ba7c 100644 --- a/functions_d.html +++ b/functions_d.html @@ -91,7 +91,7 @@ $(function() {
diff --git a/functions_e.html b/functions_e.html index f1de9f08..5476d0f6 100644 --- a/functions_e.html +++ b/functions_e.html @@ -97,7 +97,7 @@ $(function() {
diff --git a/functions_f.html b/functions_f.html index 2a8e3771..9284f5db 100644 --- a/functions_f.html +++ b/functions_f.html @@ -81,7 +81,7 @@ $(function() {
diff --git a/functions_func.html b/functions_func.html index e730891e..e5f61764 100644 --- a/functions_func.html +++ b/functions_func.html @@ -85,7 +85,7 @@ $(function() {
diff --git a/functions_func_b.html b/functions_func_b.html index 82bbd1ea..77e2f40a 100644 --- a/functions_func_b.html +++ b/functions_func_b.html @@ -83,7 +83,7 @@ $(function() {
diff --git a/functions_func_c.html b/functions_func_c.html index cef64cfa..9de48d69 100644 --- a/functions_func_c.html +++ b/functions_func_c.html @@ -92,7 +92,7 @@ $(function() {
diff --git a/functions_func_d.html b/functions_func_d.html index d0925eeb..07985ce2 100644 --- a/functions_func_d.html +++ b/functions_func_d.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/functions_func_e.html b/functions_func_e.html index 95950df8..4635dae1 100644 --- a/functions_func_e.html +++ b/functions_func_e.html @@ -96,7 +96,7 @@ $(function() {
diff --git a/functions_func_f.html b/functions_func_f.html index fb2b8c9a..29b9b9ee 100644 --- a/functions_func_f.html +++ b/functions_func_f.html @@ -81,7 +81,7 @@ $(function() {
diff --git a/functions_func_g.html b/functions_func_g.html index 75ba1f14..75f05122 100644 --- a/functions_func_g.html +++ b/functions_func_g.html @@ -81,7 +81,7 @@ $(function() {
diff --git a/functions_func_h.html b/functions_func_h.html index 0c2d19e4..9d95666f 100644 --- a/functions_func_h.html +++ b/functions_func_h.html @@ -82,7 +82,7 @@ $(function() {
diff --git a/functions_func_i.html b/functions_func_i.html index 03436a0e..b55c69a9 100644 --- a/functions_func_i.html +++ b/functions_func_i.html @@ -81,7 +81,7 @@ $(function() {
diff --git a/functions_func_l.html b/functions_func_l.html index ebae1c5b..b409076c 100644 --- a/functions_func_l.html +++ b/functions_func_l.html @@ -81,7 +81,7 @@ $(function() {
diff --git a/functions_func_m.html b/functions_func_m.html index 83868e0d..0267628f 100644 --- a/functions_func_m.html +++ b/functions_func_m.html @@ -81,7 +81,7 @@ $(function() {
diff --git a/functions_func_n.html b/functions_func_n.html index 73c75a58..885c8e09 100644 --- a/functions_func_n.html +++ b/functions_func_n.html @@ -82,7 +82,7 @@ $(function() {
diff --git a/functions_func_o.html b/functions_func_o.html index 30b2197b..b42fe289 100644 --- a/functions_func_o.html +++ b/functions_func_o.html @@ -97,7 +97,7 @@ $(function() {
diff --git a/functions_func_p.html b/functions_func_p.html index 203353ea..2e6b8b39 100644 --- a/functions_func_p.html +++ b/functions_func_p.html @@ -81,7 +81,7 @@ $(function() {
diff --git a/functions_func_q.html b/functions_func_q.html index 0d4bae74..03b0ca6a 100644 --- a/functions_func_q.html +++ b/functions_func_q.html @@ -80,7 +80,7 @@ $(function() {
diff --git a/functions_func_r.html b/functions_func_r.html index 62a61d94..5c6f1ce9 100644 --- a/functions_func_r.html +++ b/functions_func_r.html @@ -85,7 +85,7 @@ $(function() {
diff --git a/functions_func_s.html b/functions_func_s.html index ae3d8348..65349947 100644 --- a/functions_func_s.html +++ b/functions_func_s.html @@ -96,7 +96,7 @@ $(function() {
diff --git a/functions_func_t.html b/functions_func_t.html index 088934a5..36169cd7 100644 --- a/functions_func_t.html +++ b/functions_func_t.html @@ -80,7 +80,7 @@ $(function() {
diff --git a/functions_func_u.html b/functions_func_u.html index 4afade1c..6ec3b462 100644 --- a/functions_func_u.html +++ b/functions_func_u.html @@ -80,7 +80,7 @@ $(function() {
diff --git a/functions_func_v.html b/functions_func_v.html index 4c22b9dc..25654858 100644 --- a/functions_func_v.html +++ b/functions_func_v.html @@ -81,7 +81,7 @@ $(function() {
diff --git a/functions_func_w.html b/functions_func_w.html index 0d799e20..56e37d5b 100644 --- a/functions_func_w.html +++ b/functions_func_w.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/functions_func_~.html b/functions_func_~.html index ef31ccc6..6286161d 100644 --- a/functions_func_~.html +++ b/functions_func_~.html @@ -136,7 +136,7 @@ $(function() {
diff --git a/functions_g.html b/functions_g.html index 8c238dfe..50713223 100644 --- a/functions_g.html +++ b/functions_g.html @@ -81,7 +81,7 @@ $(function() {
diff --git a/functions_h.html b/functions_h.html index a17fb81a..0553510a 100644 --- a/functions_h.html +++ b/functions_h.html @@ -83,7 +83,7 @@ $(function() {
diff --git a/functions_i.html b/functions_i.html index 03fa61d1..4943e2d5 100644 --- a/functions_i.html +++ b/functions_i.html @@ -82,7 +82,7 @@ $(function() {
diff --git a/functions_l.html b/functions_l.html index 27e50e9c..bd5e4f4f 100644 --- a/functions_l.html +++ b/functions_l.html @@ -81,7 +81,7 @@ $(function() {
diff --git a/functions_m.html b/functions_m.html index 4dffe196..56adcbe1 100644 --- a/functions_m.html +++ b/functions_m.html @@ -118,7 +118,7 @@ $(function() {
diff --git a/functions_n.html b/functions_n.html index 991e7197..2083b0cb 100644 --- a/functions_n.html +++ b/functions_n.html @@ -82,7 +82,7 @@ $(function() {
diff --git a/functions_o.html b/functions_o.html index 2265cfb7..138144dc 100644 --- a/functions_o.html +++ b/functions_o.html @@ -98,7 +98,7 @@ $(function() {
diff --git a/functions_p.html b/functions_p.html index e2d7e10f..db6c21be 100644 --- a/functions_p.html +++ b/functions_p.html @@ -82,7 +82,7 @@ $(function() {
diff --git a/functions_q.html b/functions_q.html index 67ef7bf2..08d17d11 100644 --- a/functions_q.html +++ b/functions_q.html @@ -80,7 +80,7 @@ $(function() {
diff --git a/functions_r.html b/functions_r.html index 49021bfc..688c43e6 100644 --- a/functions_r.html +++ b/functions_r.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/functions_s.html b/functions_s.html index 6f44b71f..9072ed5a 100644 --- a/functions_s.html +++ b/functions_s.html @@ -97,7 +97,7 @@ $(function() {
diff --git a/functions_t.html b/functions_t.html index 6a9fa4a6..d0cfd4c6 100644 --- a/functions_t.html +++ b/functions_t.html @@ -80,7 +80,7 @@ $(function() {
diff --git a/functions_type.html b/functions_type.html index a31422fb..d04fe87e 100644 --- a/functions_type.html +++ b/functions_type.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/functions_u.html b/functions_u.html index 0ccb25a4..21c28275 100644 --- a/functions_u.html +++ b/functions_u.html @@ -80,7 +80,7 @@ $(function() {
diff --git a/functions_v.html b/functions_v.html index bc774882..db8a45f7 100644 --- a/functions_v.html +++ b/functions_v.html @@ -82,7 +82,7 @@ $(function() {
diff --git a/functions_vars.html b/functions_vars.html index 46509e36..4f67afa8 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -121,7 +121,7 @@ $(function() {
diff --git a/functions_w.html b/functions_w.html index 6fcdce9a..fae43a87 100644 --- a/functions_w.html +++ b/functions_w.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/functions_~.html b/functions_~.html index 1511507d..d1c603dc 100644 --- a/functions_~.html +++ b/functions_~.html @@ -136,7 +136,7 @@ $(function() {
diff --git a/group___setup_a_p_i.html b/group___setup_a_p_i.html index 8f31cea1..5e03b019 100644 --- a/group___setup_a_p_i.html +++ b/group___setup_a_p_i.html @@ -91,7 +91,7 @@ Classes
diff --git a/group___win_sock2_a_p_i.html b/group___win_sock2_a_p_i.html index 39c273b9..c44491f6 100644 --- a/group___win_sock2_a_p_i.html +++ b/group___win_sock2_a_p_i.html @@ -197,7 +197,7 @@ Functions
diff --git a/group___win_std_c_o_m.html b/group___win_std_c_o_m.html index 127e2d4e..cc462e15 100644 --- a/group___win_std_c_o_m.html +++ b/group___win_std_c_o_m.html @@ -207,7 +207,7 @@ template<class T >
diff --git a/group___win_std_cred_a_p_i.html b/group___win_std_cred_a_p_i.html index 7dbb7569..a3615c34 100644 --- a/group___win_std_cred_a_p_i.html +++ b/group___win_std_cred_a_p_i.html @@ -388,7 +388,7 @@ template<class _Traits , class _Ax >
diff --git a/group___win_std_crypto_a_p_i.html b/group___win_std_crypto_a_p_i.html index 99b6d87f..71c8396d 100644 --- a/group___win_std_crypto_a_p_i.html +++ b/group___win_std_crypto_a_p_i.html @@ -1021,7 +1021,7 @@ template<class T >
diff --git a/group___win_std_e_a_p_a_p_i.html b/group___win_std_e_a_p_a_p_i.html index fa2f9071..046fa798 100644 --- a/group___win_std_e_a_p_a_p_i.html +++ b/group___win_std_e_a_p_a_p_i.html @@ -332,7 +332,7 @@ Variables
diff --git a/group___win_std_e_t_w_a_p_i.html b/group___win_std_e_t_w_a_p_i.html index 8ef029f1..304ef64c 100644 --- a/group___win_std_e_t_w_a_p_i.html +++ b/group___win_std_e_t_w_a_p_i.html @@ -265,7 +265,7 @@ template<class _Ty , class _Ax >
diff --git a/group___win_std_exceptions.html b/group___win_std_exceptions.html index 74627d51..598994ad 100644 --- a/group___win_std_exceptions.html +++ b/group___win_std_exceptions.html @@ -206,7 +206,7 @@ Functions
diff --git a/group___win_std_gdi_a_p_i.html b/group___win_std_gdi_a_p_i.html index c23dbdad..c786f888 100644 --- a/group___win_std_gdi_a_p_i.html +++ b/group___win_std_gdi_a_p_i.html @@ -100,7 +100,7 @@ Classes
diff --git a/group___win_std_general.html b/group___win_std_general.html index 4cca789c..54abf92f 100644 --- a/group___win_std_general.html +++ b/group___win_std_general.html @@ -288,7 +288,7 @@ template<class
diff --git a/group___win_std_m_s_i_a_p_i.html b/group___win_std_m_s_i_a_p_i.html index 8c64ae68..77f0d4d7 100644 --- a/group___win_std_m_s_i_a_p_i.html +++ b/group___win_std_m_s_i_a_p_i.html @@ -559,7 +559,7 @@ template<class _Ty , class _Ax >
diff --git a/group___win_std_mem_sanitize.html b/group___win_std_mem_sanitize.html index 40a0582d..0f9d39b4 100644 --- a/group___win_std_mem_sanitize.html +++ b/group___win_std_mem_sanitize.html @@ -140,7 +140,7 @@ Typedefs
diff --git a/group___win_std_s_d_d_l.html b/group___win_std_s_d_d_l.html index b75941e5..93fee8df 100644 --- a/group___win_std_s_d_d_l.html +++ b/group___win_std_s_d_d_l.html @@ -182,7 +182,7 @@ Functions
diff --git a/group___win_std_security_a_p_i.html b/group___win_std_security_a_p_i.html index d46dc8c9..4cd9c7cb 100644 --- a/group___win_std_security_a_p_i.html +++ b/group___win_std_security_a_p_i.html @@ -94,7 +94,7 @@ Classes
diff --git a/group___win_std_shell_w_a_p_i.html b/group___win_std_shell_w_a_p_i.html index 2878d25a..ca7d574e 100644 --- a/group___win_std_shell_w_a_p_i.html +++ b/group___win_std_shell_w_a_p_i.html @@ -230,7 +230,7 @@ template<class _Traits , class _Ax >
diff --git a/group___win_std_str_format.html b/group___win_std_str_format.html index 7ecaf670..86b42b9f 100644 --- a/group___win_std_str_format.html +++ b/group___win_std_str_format.html @@ -158,9 +158,6 @@ Typedefs - - - @@ -233,7 +230,7 @@ Functions
Example
// Please note the PCSTR typecasting invokes an operator to return
// pointer to formatted buffer rather than class reference itself.
cout << (PCSTR)(winstd::string_printf("%i is less than %i.\n", 1, 5));
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839

Macro Definition Documentation

@@ -868,61 +865,10 @@ template<class _Elem , class _Traits , class _Ax >
Returns
Number of characters in result.
- - - -

◆ vsnprintf() [1/2]

- -
-
-

Functions

static int vsnprintf (char *str, size_t capacity, const char *format, va_list arg)
 Formats string using printf().
 
static int vsnprintf (wchar_t *str, size_t capacity, const wchar_t *format, va_list arg) noexcept
 Formats string using printf().
 
- - - - -
- - - - - - - - - - - - - - - - - - - - - -
static int vsnprintf (char * str,
size_t capacity,
const char * format,
va_list arg )
-
-static
-
- -

Formats string using printf().

-
Parameters
- - - - - -
[out]strBuffer to receive string
[in]capacitySize of str in characters
[in]formatString template using printf() style
[in]argArguments to format
-
-
-
Returns
Number of characters in result.
-
-

◆ vsnprintf() [2/2]

+

◆ vsnprintf()

@@ -1194,7 +1140,7 @@ template<class _Traits1 , class _Ax1 , class _Traits2 , class _Ax2 >
diff --git a/group___win_std_sys_handles.html b/group___win_std_sys_handles.html index 1910cf70..6a4d3661 100644 --- a/group___win_std_sys_handles.html +++ b/group___win_std_sys_handles.html @@ -182,7 +182,7 @@ Variables
diff --git a/group___win_std_w_l_a_n_a_p_i.html b/group___win_std_w_l_a_n_a_p_i.html index 6de16d34..43b98584 100644 --- a/group___win_std_w_l_a_n_a_p_i.html +++ b/group___win_std_w_l_a_n_a_p_i.html @@ -188,7 +188,7 @@ template<class _Traits , class _Ax >
diff --git a/group___win_std_win_a_p_i.html b/group___win_std_win_a_p_i.html index c89fb0af..a293144a 100644 --- a/group___win_std_win_a_p_i.html +++ b/group___win_std_win_a_p_i.html @@ -2437,7 +2437,7 @@ template<class _Ty , class _Ax >
diff --git a/group___win_std_win_h_t_t_p.html b/group___win_std_win_h_t_t_p.html index 619d216b..524d4a84 100644 --- a/group___win_std_win_h_t_t_p.html +++ b/group___win_std_win_h_t_t_p.html @@ -88,7 +88,7 @@ Classes
diff --git a/group___win_trust_a_p_i.html b/group___win_trust_a_p_i.html index 44d70f5e..0204acfa 100644 --- a/group___win_trust_a_p_i.html +++ b/group___win_trust_a_p_i.html @@ -88,7 +88,7 @@ Classes
diff --git a/hierarchy.html b/hierarchy.html index e9732d87..a480d053 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -230,7 +230,7 @@ $(function() {
diff --git a/index.html b/index.html index 670ec0d6..28ca168d 100644 --- a/index.html +++ b/index.html @@ -92,8 +92,8 @@ Example
if (!lib_shell32)
throw winstd::win_runtime_error("LoadLibraryEx failed");
m_note_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(48)));
-
Module handle wrapper.
Definition Win.h:1065
-
Windows runtime error.
Definition Common.h:1520
+
Module handle wrapper.
Definition Win.h:1045
+
Windows runtime error.
Definition Common.h:1500

Functions and Templates

Different Win32 API functions have different ways of returning variable-sized data. Getting tired of carefully studying MSDN for each particular Win32 API function how to preallocate the output memory correctly? We too...

@@ -105,7 +105,7 @@ Example
std::string response;
WideCharToMultiByte(CP_OEMCP, 0, L"Copyright \u00A9 2017", -1, response, NULL, NULL);
std::cout << response.c_str() << std::endl;
-
static int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::basic_string< char, _Traits, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily f...
Definition Common.h:336
+
static int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::basic_string< char, _Traits, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily f...
Definition Common.h:324

String Formatters

For those situations where one must quckly compose a temporary string using sprintf() or FormatMessage(). Or, convert a GUID to a string on the fly.

@@ -118,7 +118,7 @@ Example
"Maximum packet size too small (minimum: %zu, available: %u)",
sizeof(EapPacket) + 1,
dwMaxSendPacketSize));
-
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:859
+
Helper class for returning pointers to std::unique_ptr.
Definition Common.h:839

What WinStd Is Not

WinStd is not trying to be a full-fledged object-oriented framework on top of Win32 API. We have Microsoft to publish those once every few years - and obsolete it when they loose interest. WinStd aims at augmenting Win32 API with a little bit of help from C++.

@@ -151,7 +151,7 @@ Usage
diff --git a/md__s_e_c_u_r_i_t_y.html b/md__s_e_c_u_r_i_t_y.html index 6b238f3f..71806bb6 100644 --- a/md__s_e_c_u_r_i_t_y.html +++ b/md__s_e_c_u_r_i_t_y.html @@ -92,7 +92,7 @@ Reporting a Vulnerability
diff --git a/pages.html b/pages.html index 454d68b8..a4676278 100644 --- a/pages.html +++ b/pages.html @@ -83,7 +83,7 @@ $(function() {
diff --git a/pch_8h_source.html b/pch_8h_source.html index da5ba0bc..83b9acdd 100644 --- a/pch_8h_source.html +++ b/pch_8h_source.html @@ -86,7 +86,7 @@ $(function() { codefold.init(0); });
1/*
2 SPDX-License-Identifier: MIT
-
3 Copyright © 2022-2023 Amebis
+
3 Copyright © 2022-2024 Amebis
4*/
5
6#pragma once
@@ -114,7 +114,7 @@ $(function() { codefold.init(0); });
diff --git a/search/all_14.js b/search/all_14.js index d6fb9767..9bb69363 100644 --- a/search/all_14.js +++ b/search/all_14.js @@ -4,7 +4,7 @@ var searchData= ['variant_1',['variant',['../classwinstd_1_1variant.html',1,'winstd::variant'],['../classwinstd_1_1variant.html#ab5b8d68675d23082008f57e9439c3a19',1,'winstd::variant::variant() noexcept'],['../classwinstd_1_1variant.html#a6b13abee9e259102b5cfcadf799ac33d',1,'winstd::variant::variant(const VARIANT &varSrc)'],['../classwinstd_1_1variant.html#a170212d31acb2971ddf55b9247d6dc48',1,'winstd::variant::variant(VARIANT &&varSrc) noexcept'],['../classwinstd_1_1variant.html#a02c9aacfd9b4db09f83d470d9ee62207',1,'winstd::variant::variant(bool bSrc) noexcept'],['../classwinstd_1_1variant.html#ac3d480425647e2ce72aa291eee5259bb',1,'winstd::variant::variant(char cSrc) noexcept'],['../classwinstd_1_1variant.html#a6b7b7b21cd5e8293fc95957dec6ad1ac',1,'winstd::variant::variant(unsigned char nSrc) noexcept'],['../classwinstd_1_1variant.html#ae5f40c0c9ceb73d9a11f9eb5cf6e7acf',1,'winstd::variant::variant(short nSrc) noexcept'],['../classwinstd_1_1variant.html#aa38cc1a50cd08a3b81b8c87a968dd55a',1,'winstd::variant::variant(unsigned short nSrc) noexcept'],['../classwinstd_1_1variant.html#a26d5b7a108cc2ae8ea6b9a60e8cfe68d',1,'winstd::variant::variant(int nSrc, VARTYPE vtSrc=VT_I4) noexcept'],['../classwinstd_1_1variant.html#a89726aecadc0b6e14108daae894a477b',1,'winstd::variant::variant(unsigned int nSrc, VARTYPE vtSrc=VT_UI4) noexcept'],['../classwinstd_1_1variant.html#aa0b2188d63b23c1e7ade2d8c4871e172',1,'winstd::variant::variant(long nSrc, VARTYPE vtSrc=VT_I4) noexcept'],['../classwinstd_1_1variant.html#a76dee63188ebb8946d0c2152f553e0f5',1,'winstd::variant::variant(unsigned long nSrc) noexcept'],['../classwinstd_1_1variant.html#a1399659c252205487f2f85f2855567e2',1,'winstd::variant::variant(float fltSrc) noexcept'],['../classwinstd_1_1variant.html#add6d3bb11f3ba343d2286dde7a4ce90a',1,'winstd::variant::variant(double dblSrc, VARTYPE vtSrc=VT_R8) noexcept'],['../classwinstd_1_1variant.html#a9ebbc5928574b7008c1c317e3528b7cb',1,'winstd::variant::variant(long long nSrc) noexcept'],['../classwinstd_1_1variant.html#ac1bc843b25415fd843bc2420a48ff9ad',1,'winstd::variant::variant(unsigned long long nSrc) noexcept'],['../classwinstd_1_1variant.html#ae60f506468b32ba02fe499c8a93a9b56',1,'winstd::variant::variant(CY cySrc) noexcept'],['../classwinstd_1_1variant.html#a66bf6c6544769977e1032732142bb464',1,'winstd::variant::variant(LPCOLESTR lpszSrc) noexcept'],['../classwinstd_1_1variant.html#ad22ad4af4e10101790dc481dbe1630da',1,'winstd::variant::variant(BSTR bstr) noexcept'],['../classwinstd_1_1variant.html#a2040f3ea8b404ff6b2847c9c9146141a',1,'winstd::variant::variant(IDispatch *pSrc)'],['../classwinstd_1_1variant.html#a841c962b433fd374aa1dfafc844e4b64',1,'winstd::variant::variant(IUnknown *pSrc)'],['../classwinstd_1_1variant.html#a278e06d505cad1af830dd88c2c656cd3',1,'winstd::variant::variant(const SAFEARRAY *pSrc)']]], ['versions_2',['Supported Versions',['../md__s_e_c_u_r_i_t_y.html#autotoc_md12',1,'']]], ['vmemory_3',['vmemory',['../classwinstd_1_1vmemory.html',1,'winstd::vmemory'],['../classwinstd_1_1vmemory.html#ae49dd901cfb090ed736510e68a39be7d',1,'winstd::vmemory::vmemory() noexcept'],['../classwinstd_1_1vmemory.html#aa0f7cc6aaa5737fc3ea2deb1544fe0b2',1,'winstd::vmemory::vmemory(handle_type h, HANDLE proc) noexcept'],['../classwinstd_1_1vmemory.html#af3f982d2e1dd1309512aec2182a3b78b',1,'winstd::vmemory::vmemory(vmemory &&h) noexcept']]], - ['vsnprintf_4',['vsnprintf',['../group___win_std_str_format.html#gaad906b9a0f259f7c45470a7d548957ed',1,'vsnprintf(char *str, size_t capacity, const char *format, va_list arg): Common.h'],['../group___win_std_str_format.html#ga9f831951f2e74c57aea12da36fe136d4',1,'vsnprintf(wchar_t *str, size_t capacity, const wchar_t *format, va_list arg) noexcept: Common.h']]], + ['vsnprintf_4',['vsnprintf',['../group___win_std_str_format.html#ga9f831951f2e74c57aea12da36fe136d4',1,'Common.h']]], ['vsprintf_5',['vsprintf',['../group___win_std_str_format.html#ga583555761f3d01787d5e5f0226472f4e',1,'Common.h']]], ['vulnerability_6',['Reporting a Vulnerability',['../md__s_e_c_u_r_i_t_y.html#autotoc_md13',1,'']]] ]; diff --git a/search/functions_13.js b/search/functions_13.js index 294e8ecf..1b7bd71d 100644 --- a/search/functions_13.js +++ b/search/functions_13.js @@ -2,6 +2,6 @@ var searchData= [ ['variant_0',['variant',['../classwinstd_1_1variant.html#ab5b8d68675d23082008f57e9439c3a19',1,'winstd::variant::variant() noexcept'],['../classwinstd_1_1variant.html#a6b13abee9e259102b5cfcadf799ac33d',1,'winstd::variant::variant(const VARIANT &varSrc)'],['../classwinstd_1_1variant.html#a170212d31acb2971ddf55b9247d6dc48',1,'winstd::variant::variant(VARIANT &&varSrc) noexcept'],['../classwinstd_1_1variant.html#a02c9aacfd9b4db09f83d470d9ee62207',1,'winstd::variant::variant(bool bSrc) noexcept'],['../classwinstd_1_1variant.html#ac3d480425647e2ce72aa291eee5259bb',1,'winstd::variant::variant(char cSrc) noexcept'],['../classwinstd_1_1variant.html#a6b7b7b21cd5e8293fc95957dec6ad1ac',1,'winstd::variant::variant(unsigned char nSrc) noexcept'],['../classwinstd_1_1variant.html#ae5f40c0c9ceb73d9a11f9eb5cf6e7acf',1,'winstd::variant::variant(short nSrc) noexcept'],['../classwinstd_1_1variant.html#aa38cc1a50cd08a3b81b8c87a968dd55a',1,'winstd::variant::variant(unsigned short nSrc) noexcept'],['../classwinstd_1_1variant.html#a26d5b7a108cc2ae8ea6b9a60e8cfe68d',1,'winstd::variant::variant(int nSrc, VARTYPE vtSrc=VT_I4) noexcept'],['../classwinstd_1_1variant.html#a89726aecadc0b6e14108daae894a477b',1,'winstd::variant::variant(unsigned int nSrc, VARTYPE vtSrc=VT_UI4) noexcept'],['../classwinstd_1_1variant.html#aa0b2188d63b23c1e7ade2d8c4871e172',1,'winstd::variant::variant(long nSrc, VARTYPE vtSrc=VT_I4) noexcept'],['../classwinstd_1_1variant.html#a76dee63188ebb8946d0c2152f553e0f5',1,'winstd::variant::variant(unsigned long nSrc) noexcept'],['../classwinstd_1_1variant.html#a1399659c252205487f2f85f2855567e2',1,'winstd::variant::variant(float fltSrc) noexcept'],['../classwinstd_1_1variant.html#add6d3bb11f3ba343d2286dde7a4ce90a',1,'winstd::variant::variant(double dblSrc, VARTYPE vtSrc=VT_R8) noexcept'],['../classwinstd_1_1variant.html#a9ebbc5928574b7008c1c317e3528b7cb',1,'winstd::variant::variant(long long nSrc) noexcept'],['../classwinstd_1_1variant.html#ac1bc843b25415fd843bc2420a48ff9ad',1,'winstd::variant::variant(unsigned long long nSrc) noexcept'],['../classwinstd_1_1variant.html#ae60f506468b32ba02fe499c8a93a9b56',1,'winstd::variant::variant(CY cySrc) noexcept'],['../classwinstd_1_1variant.html#a66bf6c6544769977e1032732142bb464',1,'winstd::variant::variant(LPCOLESTR lpszSrc) noexcept'],['../classwinstd_1_1variant.html#ad22ad4af4e10101790dc481dbe1630da',1,'winstd::variant::variant(BSTR bstr) noexcept'],['../classwinstd_1_1variant.html#a2040f3ea8b404ff6b2847c9c9146141a',1,'winstd::variant::variant(IDispatch *pSrc)'],['../classwinstd_1_1variant.html#a841c962b433fd374aa1dfafc844e4b64',1,'winstd::variant::variant(IUnknown *pSrc)'],['../classwinstd_1_1variant.html#a278e06d505cad1af830dd88c2c656cd3',1,'winstd::variant::variant(const SAFEARRAY *pSrc)']]], ['vmemory_1',['vmemory',['../classwinstd_1_1vmemory.html#ae49dd901cfb090ed736510e68a39be7d',1,'winstd::vmemory::vmemory() noexcept'],['../classwinstd_1_1vmemory.html#aa0f7cc6aaa5737fc3ea2deb1544fe0b2',1,'winstd::vmemory::vmemory(handle_type h, HANDLE proc) noexcept'],['../classwinstd_1_1vmemory.html#af3f982d2e1dd1309512aec2182a3b78b',1,'winstd::vmemory::vmemory(vmemory &&h) noexcept']]], - ['vsnprintf_2',['vsnprintf',['../group___win_std_str_format.html#gaad906b9a0f259f7c45470a7d548957ed',1,'vsnprintf(char *str, size_t capacity, const char *format, va_list arg): Common.h'],['../group___win_std_str_format.html#ga9f831951f2e74c57aea12da36fe136d4',1,'vsnprintf(wchar_t *str, size_t capacity, const wchar_t *format, va_list arg) noexcept: Common.h']]], + ['vsnprintf_2',['vsnprintf',['../group___win_std_str_format.html#ga9f831951f2e74c57aea12da36fe136d4',1,'Common.h']]], ['vsprintf_3',['vsprintf',['../group___win_std_str_format.html#ga583555761f3d01787d5e5f0226472f4e',1,'Common.h']]] ]; diff --git a/structwinstd_1_1_co_task_mem_free__delete-members.html b/structwinstd_1_1_co_task_mem_free__delete-members.html index 2f8dd058..66cf2fba 100644 --- a/structwinstd_1_1_co_task_mem_free__delete-members.html +++ b/structwinstd_1_1_co_task_mem_free__delete-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/structwinstd_1_1_co_task_mem_free__delete.html b/structwinstd_1_1_co_task_mem_free__delete.html index f2127242..9ef28f01 100644 --- a/structwinstd_1_1_co_task_mem_free__delete.html +++ b/structwinstd_1_1_co_task_mem_free__delete.html @@ -138,7 +138,7 @@ template<class
diff --git a/structwinstd_1_1_cred_free__delete-members.html b/structwinstd_1_1_cred_free__delete-members.html index fa9d2a13..f353d513 100644 --- a/structwinstd_1_1_cred_free__delete-members.html +++ b/structwinstd_1_1_cred_free__delete-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/structwinstd_1_1_cred_free__delete.html b/structwinstd_1_1_cred_free__delete.html index 01b2c2aa..8fbcc8ae 100644 --- a/structwinstd_1_1_cred_free__delete.html +++ b/structwinstd_1_1_cred_free__delete.html @@ -151,7 +151,7 @@ template<class
diff --git a/structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4-members.html b/structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4-members.html index 2ff1c7f2..cf0cbd56 100644 --- a/structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4-members.html +++ b/structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4.html b/structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4.html index 90492abb..9efe53c0 100644 --- a/structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4.html +++ b/structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4.html @@ -182,7 +182,7 @@ template<class
diff --git a/structwinstd_1_1_eap_host_peer_free_eap_error__delete-members.html b/structwinstd_1_1_eap_host_peer_free_eap_error__delete-members.html index 5b0e8859..8423ebe6 100644 --- a/structwinstd_1_1_eap_host_peer_free_eap_error__delete-members.html +++ b/structwinstd_1_1_eap_host_peer_free_eap_error__delete-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/structwinstd_1_1_eap_host_peer_free_eap_error__delete.html b/structwinstd_1_1_eap_host_peer_free_eap_error__delete.html index f2034605..08ae1b16 100644 --- a/structwinstd_1_1_eap_host_peer_free_eap_error__delete.html +++ b/structwinstd_1_1_eap_host_peer_free_eap_error__delete.html @@ -135,7 +135,7 @@ Public Member Functions
diff --git a/structwinstd_1_1_eap_host_peer_free_error_memory__delete-members.html b/structwinstd_1_1_eap_host_peer_free_error_memory__delete-members.html index 778f1cd9..29d8ea65 100644 --- a/structwinstd_1_1_eap_host_peer_free_error_memory__delete-members.html +++ b/structwinstd_1_1_eap_host_peer_free_error_memory__delete-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/structwinstd_1_1_eap_host_peer_free_error_memory__delete.html b/structwinstd_1_1_eap_host_peer_free_error_memory__delete.html index 5f08015e..067314f8 100644 --- a/structwinstd_1_1_eap_host_peer_free_error_memory__delete.html +++ b/structwinstd_1_1_eap_host_peer_free_error_memory__delete.html @@ -135,7 +135,7 @@ Public Member Functions
diff --git a/structwinstd_1_1_eap_host_peer_free_memory__delete-members.html b/structwinstd_1_1_eap_host_peer_free_memory__delete-members.html index 80eda5cc..0b9a0b0a 100644 --- a/structwinstd_1_1_eap_host_peer_free_memory__delete-members.html +++ b/structwinstd_1_1_eap_host_peer_free_memory__delete-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/structwinstd_1_1_eap_host_peer_free_memory__delete.html b/structwinstd_1_1_eap_host_peer_free_memory__delete.html index b93d7933..c42b9138 100644 --- a/structwinstd_1_1_eap_host_peer_free_memory__delete.html +++ b/structwinstd_1_1_eap_host_peer_free_memory__delete.html @@ -138,7 +138,7 @@ template<class
diff --git a/structwinstd_1_1_eap_host_peer_free_runtime_memory__delete-members.html b/structwinstd_1_1_eap_host_peer_free_runtime_memory__delete-members.html index 5c99f429..329460d7 100644 --- a/structwinstd_1_1_eap_host_peer_free_runtime_memory__delete-members.html +++ b/structwinstd_1_1_eap_host_peer_free_runtime_memory__delete-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/structwinstd_1_1_eap_host_peer_free_runtime_memory__delete.html b/structwinstd_1_1_eap_host_peer_free_runtime_memory__delete.html index 4bb930fe..06b8e7a5 100644 --- a/structwinstd_1_1_eap_host_peer_free_runtime_memory__delete.html +++ b/structwinstd_1_1_eap_host_peer_free_runtime_memory__delete.html @@ -108,7 +108,7 @@ template<class
diff --git a/structwinstd_1_1_global_free__delete-members.html b/structwinstd_1_1_global_free__delete-members.html index 26834173..803509d7 100644 --- a/structwinstd_1_1_global_free__delete-members.html +++ b/structwinstd_1_1_global_free__delete-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/structwinstd_1_1_global_free__delete.html b/structwinstd_1_1_global_free__delete.html index f45f9020..d18a60fa 100644 --- a/structwinstd_1_1_global_free__delete.html +++ b/structwinstd_1_1_global_free__delete.html @@ -135,7 +135,7 @@ Public Member Functions
diff --git a/structwinstd_1_1_local_free__delete-members.html b/structwinstd_1_1_local_free__delete-members.html index 5447590c..e435bc01 100644 --- a/structwinstd_1_1_local_free__delete-members.html +++ b/structwinstd_1_1_local_free__delete-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/structwinstd_1_1_local_free__delete.html b/structwinstd_1_1_local_free__delete.html index 87d01e8c..fa55ab78 100644 --- a/structwinstd_1_1_local_free__delete.html +++ b/structwinstd_1_1_local_free__delete.html @@ -151,7 +151,7 @@ template<class
diff --git a/structwinstd_1_1_local_free__delete_3_01___ty_0f_0e_4-members.html b/structwinstd_1_1_local_free__delete_3_01___ty_0f_0e_4-members.html index dde8ee29..e8988ebf 100644 --- a/structwinstd_1_1_local_free__delete_3_01___ty_0f_0e_4-members.html +++ b/structwinstd_1_1_local_free__delete_3_01___ty_0f_0e_4-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/structwinstd_1_1_local_free__delete_3_01___ty_0f_0e_4.html b/structwinstd_1_1_local_free__delete_3_01___ty_0f_0e_4.html index 331574f1..764bee48 100644 --- a/structwinstd_1_1_local_free__delete_3_01___ty_0f_0e_4.html +++ b/structwinstd_1_1_local_free__delete_3_01___ty_0f_0e_4.html @@ -153,7 +153,7 @@ template<class
diff --git a/structwinstd_1_1_unmap_view_of_file__delete-members.html b/structwinstd_1_1_unmap_view_of_file__delete-members.html index 8153a357..49bc9f22 100644 --- a/structwinstd_1_1_unmap_view_of_file__delete-members.html +++ b/structwinstd_1_1_unmap_view_of_file__delete-members.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/structwinstd_1_1_unmap_view_of_file__delete.html b/structwinstd_1_1_unmap_view_of_file__delete.html index dfcba45f..2292b530 100644 --- a/structwinstd_1_1_unmap_view_of_file__delete.html +++ b/structwinstd_1_1_unmap_view_of_file__delete.html @@ -103,7 +103,7 @@ Public Member Functions
diff --git a/structwinstd_1_1_wlan_free_memory__delete-members.html b/structwinstd_1_1_wlan_free_memory__delete-members.html index 6e981638..ef8a34af 100644 --- a/structwinstd_1_1_wlan_free_memory__delete-members.html +++ b/structwinstd_1_1_wlan_free_memory__delete-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/structwinstd_1_1_wlan_free_memory__delete.html b/structwinstd_1_1_wlan_free_memory__delete.html index c46ee27f..b63f80bf 100644 --- a/structwinstd_1_1_wlan_free_memory__delete.html +++ b/structwinstd_1_1_wlan_free_memory__delete.html @@ -121,7 +121,7 @@ struct winstd::WlanFreeMemory_delete< _Ty >

Deleter for unique_ptr

diff --git a/structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4-members.html b/structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4-members.html index 53047b0c..f1f60193 100644 --- a/structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4-members.html +++ b/structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4.html b/structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4.html index 881d100d..e6b71366 100644 --- a/structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4.html +++ b/structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4.html @@ -121,7 +121,7 @@ struct winstd::WlanFreeMemory_delete< _Ty[]>

Deleter for unique_pt

diff --git a/structwinstd_1_1heap__allocator_1_1rebind-members.html b/structwinstd_1_1heap__allocator_1_1rebind-members.html index e612c9cf..e2579a62 100644 --- a/structwinstd_1_1heap__allocator_1_1rebind-members.html +++ b/structwinstd_1_1heap__allocator_1_1rebind-members.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/structwinstd_1_1heap__allocator_1_1rebind.html b/structwinstd_1_1heap__allocator_1_1rebind.html index 5b954577..9208c5bb 100644 --- a/structwinstd_1_1heap__allocator_1_1rebind.html +++ b/structwinstd_1_1heap__allocator_1_1rebind.html @@ -105,7 +105,7 @@ struct winstd::heap_allocator< _Ty >::rebind< _Other >

A str

diff --git a/structwinstd_1_1sanitizing__allocator_1_1rebind-members.html b/structwinstd_1_1sanitizing__allocator_1_1rebind-members.html index 968526ea..7203f8b1 100644 --- a/structwinstd_1_1sanitizing__allocator_1_1rebind-members.html +++ b/structwinstd_1_1sanitizing__allocator_1_1rebind-members.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/structwinstd_1_1sanitizing__allocator_1_1rebind.html b/structwinstd_1_1sanitizing__allocator_1_1rebind.html index 74492b15..c46e055c 100644 --- a/structwinstd_1_1sanitizing__allocator_1_1rebind.html +++ b/structwinstd_1_1sanitizing__allocator_1_1rebind.html @@ -105,7 +105,7 @@ struct winstd::sanitizing_allocator< _Ty >::rebind< _Other >

diff --git a/topics.html b/topics.html index 9e987489..19b41180 100644 --- a/topics.html +++ b/topics.html @@ -103,7 +103,7 @@ $(function() {