From a4382e74e0c6008d29dbc5892a831e5760132363 Mon Sep 17 00:00:00 2001 From: rozmansi Date: Mon, 7 Mar 2022 12:00:46 +0000 Subject: [PATCH] deploy: 3b110f7dc5cda4e5a4d70a06408f4ac5945b3695 --- _c_o_m_8h.html | 121 - _c_o_m_8h_source.html | 1631 ++++---- _common_8h.html | 287 -- _common_8h_source.html | 1864 ++++----- _cred_8h.html | 124 - _cred_8h_source.html | 337 +- _crypt_8h.html | 187 - _crypt_8h_source.html | 1311 +++--- _e_a_p_8h.html | 197 - _e_a_p_8h_source.html | 1054 +++-- _e_t_w_8h.html | 147 - _e_t_w_8h_source.html | 1815 +++++---- _g_d_i_8h.html | 105 - _g_d_i_8h_source.html | 291 +- _m_s_i_8h.html | 140 - _m_s_i_8h_source.html | 595 ++- _sec_8h.html | 107 - _sec_8h_source.html | 581 ++- _setup_a_p_i_8h.html | 100 - _setup_a_p_i_8h_source.html | 160 +- _shell_8h.html | 103 - _shell_8h_source.html | 71 +- _w_l_a_n_8h.html | 115 - _w_l_a_n_8h_source.html | 265 +- _win_8h.html | 368 -- _win_8h_source.html | 3599 ++++++++--------- _win_sock2_8h.html | 123 - _win_sock2_8h_source.html | 306 +- _win_trust_8h.html | 97 - _win_trust_8h_source.html | 96 +- annotated.html | 4 +- classes.html | 4 +- classwinstd_1_1actctx__activator-members.html | 4 +- classwinstd_1_1actctx__activator.html | 4 +- classwinstd_1_1addrinfo-members.html | 4 +- classwinstd_1_1addrinfo.html | 4 +- ...winstd_1_1basic__string__guid-members.html | 4 +- classwinstd_1_1basic__string__guid.html | 4 +- ...swinstd_1_1basic__string__msg-members.html | 4 +- classwinstd_1_1basic__string__msg.html | 4 +- ...nstd_1_1basic__string__printf-members.html | 4 +- classwinstd_1_1basic__string__printf.html | 4 +- classwinstd_1_1bstr-members.html | 4 +- classwinstd_1_1bstr.html | 6 +- ...instd_1_1cert__chain__context-members.html | 4 +- classwinstd_1_1cert__chain__context.html | 4 +- classwinstd_1_1cert__context-members.html | 4 +- classwinstd_1_1cert__context.html | 4 +- classwinstd_1_1cert__store-members.html | 4 +- classwinstd_1_1cert__store.html | 4 +- classwinstd_1_1com__initializer-members.html | 4 +- classwinstd_1_1com__initializer.html | 6 +- classwinstd_1_1com__obj-members.html | 4 +- classwinstd_1_1com__obj.html | 6 +- ...winstd_1_1com__runtime__error-members.html | 4 +- classwinstd_1_1com__runtime__error.html | 4 +- ...std_1_1console__ctrl__handler-members.html | 4 +- classwinstd_1_1console__ctrl__handler.html | 4 +- classwinstd_1_1critical__section-members.html | 4 +- classwinstd_1_1critical__section.html | 4 +- classwinstd_1_1crypt__hash-members.html | 4 +- classwinstd_1_1crypt__hash.html | 4 +- classwinstd_1_1crypt__key-members.html | 4 +- classwinstd_1_1crypt__key.html | 4 +- classwinstd_1_1crypt__prov-members.html | 4 +- classwinstd_1_1crypt__prov.html | 4 +- classwinstd_1_1data__blob-members.html | 4 +- classwinstd_1_1data__blob.html | 4 +- classwinstd_1_1dc-members.html | 4 +- classwinstd_1_1dc.html | 4 +- classwinstd_1_1dc__selector-members.html | 4 +- classwinstd_1_1dc__selector.html | 4 +- classwinstd_1_1dplhandle-members.html | 4 +- classwinstd_1_1dplhandle.html | 4 +- classwinstd_1_1eap__attr-members.html | 4 +- classwinstd_1_1eap__attr.html | 4 +- ...d_1_1eap__method__info__array-members.html | 4 +- classwinstd_1_1eap__method__info__array.html | 4 +- classwinstd_1_1eap__method__prop-members.html | 4 +- classwinstd_1_1eap__method__prop.html | 4 +- classwinstd_1_1eap__packet-members.html | 4 +- classwinstd_1_1eap__packet.html | 4 +- ...winstd_1_1eap__runtime__error-members.html | 4 +- classwinstd_1_1eap__runtime__error.html | 4 +- classwinstd_1_1event__data-members.html | 4 +- classwinstd_1_1event__data.html | 4 +- classwinstd_1_1event__fn__auto-members.html | 4 +- classwinstd_1_1event__fn__auto.html | 4 +- ...instd_1_1event__fn__auto__ret-members.html | 4 +- classwinstd_1_1event__fn__auto__ret.html | 4 +- classwinstd_1_1event__log-members.html | 4 +- classwinstd_1_1event__log.html | 4 +- classwinstd_1_1event__provider-members.html | 4 +- classwinstd_1_1event__provider.html | 4 +- classwinstd_1_1event__rec-members.html | 4 +- classwinstd_1_1event__rec.html | 4 +- classwinstd_1_1event__session-members.html | 4 +- classwinstd_1_1event__session.html | 4 +- classwinstd_1_1event__trace-members.html | 4 +- classwinstd_1_1event__trace.html | 4 +- ...nstd_1_1event__trace__enabler-members.html | 4 +- classwinstd_1_1event__trace__enabler.html | 4 +- classwinstd_1_1find__file-members.html | 4 +- classwinstd_1_1find__file.html | 4 +- classwinstd_1_1gdi__handle-members.html | 4 +- classwinstd_1_1gdi__handle.html | 4 +- classwinstd_1_1handle-members.html | 4 +- classwinstd_1_1handle.html | 4 +- classwinstd_1_1heap-members.html | 4 +- classwinstd_1_1heap.html | 4 +- classwinstd_1_1heap__allocator-members.html | 4 +- classwinstd_1_1heap__allocator.html | 4 +- classwinstd_1_1library-members.html | 4 +- classwinstd_1_1library.html | 4 +- ...winstd_1_1num__runtime__error-members.html | 4 +- classwinstd_1_1num__runtime__error.html | 4 +- ...instd_1_1process__information-members.html | 4 +- classwinstd_1_1process__information.html | 4 +- classwinstd_1_1ref__unique__ptr-members.html | 4 +- classwinstd_1_1ref__unique__ptr.html | 4 +- ...01___ty_0f_0e_00_01___dx_01_4-members.html | 4 +- ...__ptr_3_01___ty_0f_0e_00_01___dx_01_4.html | 4 +- classwinstd_1_1reg__key-members.html | 4 +- classwinstd_1_1reg__key.html | 4 +- ...nstd_1_1sanitizing__allocator-members.html | 4 +- classwinstd_1_1sanitizing__allocator.html | 4 +- classwinstd_1_1sanitizing__blob-members.html | 4 +- classwinstd_1_1sanitizing__blob.html | 4 +- classwinstd_1_1sec__buffer__desc-members.html | 4 +- classwinstd_1_1sec__buffer__desc.html | 4 +- classwinstd_1_1sec__context-members.html | 4 +- classwinstd_1_1sec__context.html | 4 +- classwinstd_1_1sec__credentials-members.html | 4 +- classwinstd_1_1sec__credentials.html | 4 +- ...winstd_1_1sec__runtime__error-members.html | 4 +- classwinstd_1_1sec__runtime__error.html | 4 +- classwinstd_1_1security__id-members.html | 4 +- classwinstd_1_1security__id.html | 4 +- ..._1_1setup__device__info__list-members.html | 4 +- classwinstd_1_1setup__device__info__list.html | 4 +- ...__driver__info__list__builder-members.html | 4 +- ...1_1setup__driver__info__list__builder.html | 4 +- classwinstd_1_1string__guid-members.html | 4 +- classwinstd_1_1string__guid.html | 4 +- ...swinstd_1_1user__impersonator-members.html | 4 +- classwinstd_1_1user__impersonator.html | 4 +- classwinstd_1_1variant-members.html | 4 +- classwinstd_1_1variant.html | 6 +- classwinstd_1_1vmemory-members.html | 4 +- classwinstd_1_1vmemory.html | 4 +- classwinstd_1_1waddrinfo-members.html | 4 +- classwinstd_1_1waddrinfo.html | 4 +- classwinstd_1_1win__handle-members.html | 4 +- classwinstd_1_1win__handle.html | 4 +- ...winstd_1_1win__runtime__error-members.html | 4 +- classwinstd_1_1win__runtime__error.html | 4 +- classwinstd_1_1window__dc-members.html | 4 +- classwinstd_1_1window__dc.html | 4 +- classwinstd_1_1wintrust-members.html | 4 +- classwinstd_1_1wintrust.html | 4 +- classwinstd_1_1wlan__handle-members.html | 4 +- classwinstd_1_1wlan__handle.html | 4 +- ...winstd_1_1ws2__runtime__error-members.html | 4 +- classwinstd_1_1ws2__runtime__error.html | 4 +- classwinstd_1_1wstring__guid-members.html | 4 +- classwinstd_1_1wstring__guid.html | 4 +- dir_6f50bb204833d887b928571856c82fbe.html | 49 +- dir_d44c64559bbebec7f509842c48db8b23.html | 4 +- files.html | 34 +- functions.html | 4 +- functions_a.html | 4 +- functions_b.html | 4 +- functions_c.html | 4 +- functions_d.html | 4 +- functions_e.html | 4 +- functions_f.html | 4 +- functions_func.html | 4 +- functions_func_b.html | 4 +- functions_func_c.html | 4 +- functions_func_d.html | 4 +- functions_func_e.html | 4 +- functions_func_f.html | 4 +- functions_func_h.html | 4 +- functions_func_i.html | 4 +- functions_func_l.html | 4 +- functions_func_m.html | 4 +- functions_func_n.html | 4 +- functions_func_o.html | 4 +- functions_func_p.html | 4 +- functions_func_q.html | 4 +- functions_func_r.html | 4 +- functions_func_s.html | 4 +- functions_func_t.html | 4 +- functions_func_u.html | 4 +- functions_func_v.html | 4 +- functions_func_w.html | 4 +- functions_func_~.html | 4 +- functions_h.html | 4 +- functions_i.html | 4 +- functions_l.html | 4 +- functions_m.html | 4 +- functions_n.html | 4 +- functions_o.html | 4 +- functions_p.html | 4 +- functions_q.html | 4 +- functions_r.html | 4 +- functions_s.html | 4 +- functions_t.html | 4 +- functions_type.html | 4 +- functions_u.html | 4 +- functions_v.html | 4 +- functions_vars.html | 4 +- functions_w.html | 4 +- functions_~.html | 4 +- globals.html | 238 -- globals_defs.html | 91 - globals_func.html | 217 - group___setup_a_p_i.html | 8 +- group___win_sock2_a_p_i.html | 8 +- group___win_std_c_o_m.html | 12 +- group___win_std_cred_a_p_i.html | 8 +- group___win_std_crypto_a_p_i.html | 8 +- group___win_std_e_a_p_a_p_i.html | 8 +- group___win_std_e_t_w_a_p_i.html | 8 +- group___win_std_exceptions.html | 8 +- group___win_std_gdi_a_p_i.html | 8 +- group___win_std_general.html | 8 +- group___win_std_m_s_i_a_p_i.html | 8 +- group___win_std_mem_sanitize.html | 8 +- group___win_std_security_a_p_i.html | 8 +- group___win_std_shell_w_a_p_i.html | 8 +- group___win_std_str_format.html | 10 +- group___win_std_sys_handles.html | 8 +- group___win_std_w_l_a_n_a_p_i.html | 8 +- group___win_std_win_a_p_i.html | 8 +- group___win_trust_a_p_i.html | 8 +- hierarchy.html | 4 +- index.html | 20 +- menudata.js | 37 +- modules.html | 42 +- search/all_11.js | 61 +- search/all_15.js | 56 +- search/all_3.js | 78 +- search/all_5.js | 70 +- search/all_7.js | 39 +- search/all_b.js | 29 +- search/files_0.html | 37 - search/files_0.js | 7 - search/files_1.html | 37 - search/files_1.js | 5 - search/files_2.html | 37 - search/files_2.js | 4 - search/files_3.html | 37 - search/files_3.js | 4 - search/files_4.html | 37 - search/files_4.js | 6 - search/files_5.html | 37 - search/files_5.js | 7 - search/groups_1.js | 2 +- search/searchdata.js | 45 +- ..._1_1_co_task_mem_free__delete-members.html | 4 +- ...ctwinstd_1_1_co_task_mem_free__delete.html | 6 +- ...twinstd_1_1_cred_free__delete-members.html | 4 +- structwinstd_1_1_cred_free__delete.html | 4 +- ...ree__delete_3_01___ty_0f_0e_4-members.html | 4 +- ...1_cred_free__delete_3_01___ty_0f_0e_4.html | 4 +- ...t_peer_free_eap_error__delete-members.html | 4 +- ..._eap_host_peer_free_eap_error__delete.html | 4 +- ...eer_free_error_memory__delete-members.html | 4 +- ...p_host_peer_free_error_memory__delete.html | 4 +- ...host_peer_free_memory__delete-members.html | 4 +- ...1_1_eap_host_peer_free_memory__delete.html | 4 +- ...r_free_runtime_memory__delete-members.html | 4 +- ...host_peer_free_runtime_memory__delete.html | 4 +- ...winstd_1_1_local_free__delete-members.html | 4 +- structwinstd_1_1_local_free__delete.html | 4 +- ...ree__delete_3_01___ty_0f_0e_4-members.html | 4 +- ..._local_free__delete_3_01___ty_0f_0e_4.html | 4 +- ..._1_unmap_view_of_file__delete-members.html | 4 +- ...winstd_1_1_unmap_view_of_file__delete.html | 4 +- ...ile__delete_3_01___ty_0f_0e_4-members.html | 4 +- ...iew_of_file__delete_3_01___ty_0f_0e_4.html | 4 +- ..._1_1_wlan_free_memory__delete-members.html | 4 +- ...ctwinstd_1_1_wlan_free_memory__delete.html | 4 +- ...ory__delete_3_01___ty_0f_0e_4-members.html | 4 +- ...free_memory__delete_3_01___ty_0f_0e_4.html | 4 +- ..._1_1heap__allocator_1_1rebind-members.html | 4 +- ...ctwinstd_1_1heap__allocator_1_1rebind.html | 4 +- ...nitizing__allocator_1_1rebind-members.html | 4 +- ...td_1_1sanitizing__allocator_1_1rebind.html | 4 +- 290 files changed, 7699 insertions(+), 10981 deletions(-) delete mode 100644 _c_o_m_8h.html delete mode 100644 _common_8h.html delete mode 100644 _cred_8h.html delete mode 100644 _crypt_8h.html delete mode 100644 _e_a_p_8h.html delete mode 100644 _e_t_w_8h.html delete mode 100644 _g_d_i_8h.html delete mode 100644 _m_s_i_8h.html delete mode 100644 _sec_8h.html delete mode 100644 _setup_a_p_i_8h.html delete mode 100644 _shell_8h.html delete mode 100644 _w_l_a_n_8h.html delete mode 100644 _win_8h.html delete mode 100644 _win_sock2_8h.html delete mode 100644 _win_trust_8h.html delete mode 100644 globals.html delete mode 100644 globals_defs.html delete mode 100644 globals_func.html delete mode 100644 search/files_0.html delete mode 100644 search/files_0.js delete mode 100644 search/files_1.html delete mode 100644 search/files_1.js delete mode 100644 search/files_2.html delete mode 100644 search/files_2.js delete mode 100644 search/files_3.html delete mode 100644 search/files_3.js delete mode 100644 search/files_4.html delete mode 100644 search/files_4.js delete mode 100644 search/files_5.html delete mode 100644 search/files_5.js diff --git a/_c_o_m_8h.html b/_c_o_m_8h.html deleted file mode 100644 index 8c8e6701..00000000 --- a/_c_o_m_8h.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - -WinStd: include/WinStd/COM.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
COM.h File Reference
-
-
- -

Provides helper templates for Windows COM object manipulation. -More...

-
#include "Common.h"
-#include <unknwn.h>
-#include <string>
-
-

Go to the source code of this file.

- - - - - - - - - - - - - - - - - - - - -

-Classes

class  winstd::com_runtime_error
 COM runtime error. More...
 
struct  winstd::CoTaskMemFree_delete
 Deleter for unique_ptr using CoTaskMemFree. More...
 
class  winstd::com_obj< T >
 COM object wrapper template. More...
 
class  winstd::bstr
 BSTR string wrapper. More...
 
class  winstd::variant
 VARIANT struct wrapper. More...
 
class  winstd::com_initializer
 Context scope automatic COM (un)initialization. More...
 
- - - - - -

-Functions

template<class T >
static _Check_return_ HRESULT CoCreateInstance (REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, winstd::com_obj< T > &v)
 Creates and default-initializes a single object of the class associated with a specified CLSID. More...
 
-

Detailed Description

-

Provides helper templates for Windows COM object manipulation.

-
- - - - diff --git a/_c_o_m_8h_source.html b/_c_o_m_8h_source.html index e54c6e7b..f308848a 100644 --- a/_c_o_m_8h_source.html +++ b/_c_o_m_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,831 +70,830 @@ $(function() {
COM.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <unknwn.h>
+
13#include <string>
14
-
15#pragma once
-
16
-
17#include "Common.h"
-
18#include <unknwn.h>
-
19#include <string>
-
20
-
21namespace winstd
-
22{
-
25
-
31 class com_runtime_error : public num_runtime_error<HRESULT>
-
32 {
-
33 public:
-
40 com_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<HRESULT>(num, msg)
-
41 {
-
42 }
-
43
-
50 com_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<HRESULT>(num, msg)
-
51 {
-
52 }
-
53 };
-
54
-
56
-
59
- -
64 {
- -
69
-
75 template <class _T>
-
76 void operator()(_T *_Ptr) const
-
77 {
-
78 CoTaskMemFree(_Ptr);
-
79 }
-
80 };
-
81
-
87 template <class T>
-
88 class com_obj : public dplhandle<T*, NULL>
-
89 {
- -
91
-
92 public:
-
98 template <class _Other>
-
99 com_obj(_In_ _Other *other)
-
100 {
-
101 assert(other);
-
102 other->QueryInterface(__uuidof(T), (void**)&m_h);
-
103 }
-
104
-
110 template <class _Other>
- -
112 {
-
113 other->QueryInterface(__uuidof(T), (void**)&m_h);
-
114 }
-
115
-
119 virtual ~com_obj()
-
120 {
-
121 if (m_h != invalid)
- -
123 }
-
124
-
130 template <class _Other>
-
131 HRESULT query_interface(_Out_ _Other **h) const
-
132 {
-
133 assert(h);
-
134 assert(m_h);
-
135 return m_h->QueryInterface(__uuidof(_Other), (void**)h);
-
136 }
-
137
-
143 template <class _Other>
-
144 HRESULT query_interface(_Out_ com_obj<_Other> &h) const
-
145 {
-
146 assert(m_h);
-
147 _Other *_h;
-
148 HRESULT hr = m_h->QueryInterface(__uuidof(_Other), (void**)&_h);
-
149 if (SUCCEEDED(hr))
-
150 h.attach(_h);
-
151 return hr;
-
152 }
-
153
-
154 protected:
-
160 void free_internal() noexcept override
-
161 {
-
162 m_h->Release();
-
163 }
-
164
-
174 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
-
175 {
-
176 h->AddRef();
-
177 return h;
-
178 }
-
179 };
-
180
-
184 class bstr : public dplhandle<BSTR, NULL>
-
185 {
- -
187
-
188 public:
-
192 bstr(_In_ LPCOLESTR src) noexcept
-
193 {
-
194 m_h = SysAllocString(src);
-
195 }
-
196
-
200 bstr(_In_ LPCOLESTR src, _In_ UINT len) noexcept
-
201 {
-
202 m_h = SysAllocStringLen(src, len);
-
203 }
-
204
-
208 template<class _Traits, class _Ax>
-
209 bstr(_In_ const std::basic_string<wchar_t, _Traits, _Ax> &src) noexcept
-
210 {
-
211 m_h = SysAllocStringLen(src.c_str(), (UINT)src.length());
-
212 }
-
213
-
219 virtual ~bstr()
-
220 {
-
221 if (m_h != invalid)
- -
223 }
-
224
-
230 UINT length() const noexcept
-
231 {
-
232 return SysStringLen(m_h);
-
233 }
-
234
-
235 protected:
-
241 void free_internal() noexcept override
-
242 {
-
243 SysFreeString(m_h);
-
244 }
-
245
-
255 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
-
256 {
-
257 return SysAllocStringLen(h, SysStringLen(h));
-
258 }
-
259 };
-
260
-
264 #pragma warning(push)
-
265 #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.
-
266 class variant : public VARIANT
-
267 {
-
268 public:
-
272 variant() noexcept
-
273 {
-
274 VariantInit(this);
-
275 }
-
276
-
280 variant(_In_ const VARIANT& varSrc)
-
281 {
-
282 vt = VT_EMPTY;
-
283 const HRESULT hr = VariantCopy(this, &varSrc);
-
284 if (FAILED(hr))
-
285 throw winstd::com_runtime_error(hr, "VariantCopy failed.");
-
286 }
-
287
-
291 #pragma warning(suppress: 26495) // vt member is initialized as a result of memcpy()
-
292 variant(_Inout_ VARIANT&& varSrc) noexcept
-
293 {
-
294 memcpy(this, &varSrc, sizeof(VARIANT));
-
295 varSrc.vt = VT_EMPTY;
-
296 }
-
297
-
301 variant(_In_ bool bSrc) noexcept
-
302 {
-
303 vt = VT_BOOL;
-
304 boolVal = bSrc ? VARIANT_TRUE : VARIANT_FALSE;
-
305 }
-
306
-
310 variant(_In_ char cSrc) noexcept
-
311 {
-
312 vt = VT_I1;
-
313 cVal = cSrc;
-
314 }
-
315
-
319 variant(_In_ unsigned char nSrc) noexcept
-
320 {
-
321 vt = VT_UI1;
-
322 bVal = nSrc;
-
323 }
-
324
-
328 variant(_In_ short nSrc) noexcept
-
329 {
-
330 vt = VT_I2;
-
331 iVal = nSrc;
-
332 }
-
333
-
337 variant(_In_ unsigned short nSrc) noexcept
-
338 {
-
339 vt = VT_UI2;
-
340 uiVal = nSrc;
-
341 }
-
342
-
346 variant(_In_ int nSrc, _In_ VARTYPE vtSrc = VT_I4) noexcept
-
347 {
-
348 assert(vtSrc == VT_I4 || vtSrc == VT_INT);
-
349 vt = vtSrc;
-
350 intVal = nSrc;
-
351 }
-
352
-
356 variant(_In_ unsigned int nSrc, _In_ VARTYPE vtSrc = VT_UI4) noexcept
-
357 {
-
358 assert(vtSrc == VT_UI4 || vtSrc == VT_UINT);
-
359 vt = vtSrc;
-
360 uintVal= nSrc;
-
361 }
-
362
-
366 variant(_In_ long nSrc, _In_ VARTYPE vtSrc = VT_I4) noexcept
-
367 {
-
368 assert(vtSrc == VT_I4 || vtSrc == VT_ERROR);
-
369 vt = vtSrc;
-
370 lVal = nSrc;
-
371 }
-
372
-
376 variant(_In_ unsigned long nSrc) noexcept
-
377 {
-
378 vt = VT_UI4;
-
379 ulVal = nSrc;
-
380 }
-
381
-
385 variant(_In_ float fltSrc) noexcept
-
386 {
-
387 vt = VT_R4;
-
388 fltVal = fltSrc;
-
389 }
-
390
-
394 variant(_In_ double dblSrc, _In_ VARTYPE vtSrc = VT_R8) noexcept
-
395 {
-
396 assert(vtSrc == VT_R8 || vtSrc == VT_DATE);
-
397 vt = vtSrc;
-
398 dblVal = dblSrc;
-
399 }
-
400
-
404 variant(_In_ long long nSrc) noexcept
-
405 {
-
406 vt = VT_I8;
-
407 llVal = nSrc;
-
408 }
-
409
-
413 variant(_In_ unsigned long long nSrc) noexcept
-
414 {
-
415 vt = VT_UI8;
-
416 ullVal = nSrc;
-
417 }
-
418
-
422 variant(_In_ CY cySrc) noexcept
-
423 {
-
424 vt = VT_CY;
-
425 cyVal.Hi = cySrc.Hi;
-
426 cyVal.Lo = cySrc.Lo;
-
427 }
-
428
-
432 variant(_In_z_ LPCOLESTR lpszSrc) noexcept
-
433 {
-
434 vt = VT_EMPTY;
-
435 *this = lpszSrc;
-
436 }
-
437
-
441 variant(_In_z_ BSTR bstr) noexcept
-
442 {
-
443 vt = VT_EMPTY;
-
444 *this = bstr;
-
445 }
-
446
-
450 variant(_In_opt_ IDispatch* pSrc)
-
451 {
-
452 vt = VT_DISPATCH;
-
453 pdispVal = pSrc;
-
454
-
455 if (pdispVal != NULL)
-
456 pdispVal->AddRef();
-
457 }
-
458
-
462 variant(_In_opt_ IUnknown* pSrc)
-
463 {
-
464 vt = VT_UNKNOWN;
-
465 punkVal = pSrc;
-
466
-
467 if (punkVal != NULL)
-
468 punkVal->AddRef();
-
469 }
-
470
-
474 variant(_In_ const SAFEARRAY *pSrc)
-
475 {
-
476 assert(pSrc != NULL);
-
477
-
478 LPSAFEARRAY pCopy;
-
479 const HRESULT hr = SafeArrayCopy(const_cast<LPSAFEARRAY>(pSrc), &pCopy);
-
480 if (FAILED(hr))
-
481 throw winstd::com_runtime_error(hr, "SafeArrayCopy failed.");
-
482
-
483 SafeArrayGetVartype(const_cast<LPSAFEARRAY>(pSrc), &vt);
-
484 vt |= VT_ARRAY;
-
485 parray = pCopy;
-
486 }
-
487
-
491 virtual ~variant()
-
492 {
-
493 VariantClear(this);
-
494 }
-
495
-
499 variant& operator=(_In_ const VARIANT& varSrc)
-
500 {
-
501 if (this != &varSrc) {
-
502 const HRESULT hr = VariantCopy(this, &varSrc);
-
503 if (FAILED(hr))
-
504 throw winstd::com_runtime_error(hr, "VariantCopy failed.");
-
505 }
-
506 return *this;
-
507 }
-
508
-
512 variant& operator=(_Inout_ VARIANT&& varSrc) noexcept
-
513 {
-
514 if (this != &varSrc) {
-
515 VariantClear(this);
-
516 memcpy(this, &varSrc, sizeof(VARIANT));
-
517 varSrc.vt = VT_EMPTY;
-
518 }
-
519 return *this;
-
520 }
-
521
-
525 variant& operator=(_In_ bool bSrc) noexcept
-
526 {
-
527 if (vt != VT_BOOL) {
-
528 VariantClear(this);
-
529 vt = VT_BOOL;
-
530 }
-
531 boolVal = bSrc ? VARIANT_TRUE : VARIANT_FALSE;
-
532 return *this;
-
533 }
-
534
-
538 variant& operator=(_In_ char cSrc) noexcept
-
539 {
-
540 if (vt != VT_I1) {
-
541 VariantClear(this);
-
542 vt = VT_I1;
-
543 }
-
544 cVal = cSrc;
-
545 return *this;
-
546 }
-
547
-
551 variant& operator=(_In_ unsigned char nSrc) noexcept
-
552 {
-
553 if (vt != VT_UI1) {
-
554 VariantClear(this);
-
555 vt = VT_UI1;
-
556 }
-
557 bVal = nSrc;
-
558 return *this;
-
559 }
-
560
-
564 variant& operator=(_In_ short nSrc) noexcept
-
565 {
-
566 if (vt != VT_I2) {
-
567 VariantClear(this);
-
568 vt = VT_I2;
-
569 }
-
570 iVal = nSrc;
-
571 return *this;
-
572 }
-
573
-
577 variant& operator=(_In_ unsigned short nSrc) noexcept
-
578 {
-
579 if (vt != VT_UI2) {
-
580 VariantClear(this);
-
581 vt = VT_UI2;
-
582 }
-
583 uiVal = nSrc;
-
584 return *this;
-
585 }
-
586
-
590 variant& operator=(_In_ int nSrc) noexcept
-
591 {
-
592 if (vt != VT_I4) {
-
593 VariantClear(this);
-
594 vt = VT_I4;
-
595 }
-
596 intVal = nSrc;
-
597 return *this;
-
598 }
-
599
-
603 variant& operator=(_In_ unsigned int nSrc) noexcept
-
604 {
-
605 if (vt != VT_UI4) {
-
606 VariantClear(this);
-
607 vt = VT_UI4;
-
608 }
-
609 uintVal= nSrc;
-
610 return *this;
-
611 }
-
612
-
616 variant& operator=(_In_ long nSrc) noexcept
-
617 {
-
618 if (vt != VT_I4) {
-
619 VariantClear(this);
-
620 vt = VT_I4;
-
621 }
-
622 lVal = nSrc;
-
623 return *this;
-
624 }
-
625
-
629 variant& operator=(_In_ unsigned long nSrc) noexcept
-
630 {
-
631 if (vt != VT_UI4) {
-
632 VariantClear(this);
-
633 vt = VT_UI4;
-
634 }
-
635 ulVal = nSrc;
-
636 return *this;
-
637 }
-
638
-
642 variant& operator=(_In_ long long nSrc) noexcept
-
643 {
-
644 if (vt != VT_I8) {
-
645 VariantClear(this);
-
646 vt = VT_I8;
-
647 }
-
648 llVal = nSrc;
-
649 return *this;
-
650 }
-
651
-
655 variant& operator=(_In_ unsigned long long nSrc) noexcept
-
656 {
-
657 if (vt != VT_UI8) {
-
658 VariantClear(this);
-
659 vt = VT_UI8;
-
660 }
-
661 ullVal = nSrc;
-
662
-
663 return *this;
-
664 }
-
665
-
669 variant& operator=(_In_ float fltSrc) noexcept
-
670 {
-
671 if (vt != VT_R4) {
-
672 VariantClear(this);
-
673 vt = VT_R4;
-
674 }
-
675 fltVal = fltSrc;
-
676 return *this;
-
677 }
-
678
-
682 variant& operator=(_In_ double dblSrc) noexcept
-
683 {
-
684 if (vt != VT_R8) {
-
685 VariantClear(this);
-
686 vt = VT_R8;
-
687 }
-
688 dblVal = dblSrc;
-
689 return *this;
-
690 }
-
691
-
695 variant& operator=(_In_ CY cySrc) noexcept
-
696 {
-
697 if (vt != VT_CY) {
-
698 VariantClear(this);
-
699 vt = VT_CY;
-
700 }
-
701 cyVal.Hi = cySrc.Hi;
-
702 cyVal.Lo = cySrc.Lo;
-
703 return *this;
-
704 }
-
705
-
709 variant& operator=(_In_z_ LPCOLESTR lpszSrc) noexcept
-
710 {
-
711 VariantClear(this);
-
712 vt = VT_BSTR;
-
713 bstrVal = SysAllocString(lpszSrc);
-
714 return *this;
-
715 }
-
716
-
720 variant& operator=(_Inout_opt_ IDispatch* pSrc)
-
721 {
-
722 VariantClear(this);
-
723 vt = VT_DISPATCH;
-
724 pdispVal = pSrc;
-
725 if (pdispVal != NULL)
-
726 pdispVal->AddRef();
-
727 return *this;
-
728 }
-
729
-
733 variant& operator=(_Inout_opt_ IUnknown* pSrc)
-
734 {
-
735 VariantClear(this);
-
736 vt = VT_UNKNOWN;
-
737 punkVal = pSrc;
-
738 if (punkVal != NULL)
-
739 punkVal->AddRef();
-
740 return *this;
-
741 }
-
742
-
746 variant& operator=(_In_ unsigned char* pbSrc) noexcept
-
747 {
-
748 if (vt != (VT_UI1|VT_BYREF)) {
-
749 VariantClear(this);
-
750 vt = VT_UI1|VT_BYREF;
-
751 }
-
752 pbVal = pbSrc;
-
753 return *this;
-
754 }
-
755
-
759 variant& operator=(_In_ short* pnSrc) noexcept
-
760 {
-
761 if (vt != (VT_I2|VT_BYREF)) {
-
762 VariantClear(this);
-
763 vt = VT_I2|VT_BYREF;
-
764 }
-
765 piVal = pnSrc;
-
766 return *this;
-
767 }
-
768
-
772 variant& operator=(_In_ unsigned short* pnSrc) noexcept
-
773 {
-
774 if (vt != (VT_UI2|VT_BYREF)) {
-
775 VariantClear(this);
-
776 vt = VT_UI2|VT_BYREF;
-
777 }
-
778 puiVal = pnSrc;
-
779 return *this;
-
780 }
-
781
-
785 variant& operator=(_In_ int* pnSrc) noexcept
-
786 {
-
787 if (vt != (VT_I4|VT_BYREF)) {
-
788 VariantClear(this);
-
789 vt = VT_I4|VT_BYREF;
-
790 }
-
791 pintVal = pnSrc;
-
792 return *this;
-
793 }
-
794
-
798 variant& operator=(_In_ unsigned int* pnSrc) noexcept
-
799 {
-
800 if (vt != (VT_UI4|VT_BYREF)) {
-
801 VariantClear(this);
-
802 vt = VT_UI4|VT_BYREF;
-
803 }
-
804 puintVal = pnSrc;
-
805 return *this;
-
806 }
-
807
-
811 variant& operator=(_In_ long* pnSrc) noexcept
-
812 {
-
813 if (vt != (VT_I4|VT_BYREF)) {
-
814 VariantClear(this);
-
815 vt = VT_I4|VT_BYREF;
-
816 }
-
817 plVal = pnSrc;
-
818 return *this;
-
819 }
-
820
-
824 variant& operator=(_In_ unsigned long* pnSrc) noexcept
-
825 {
-
826 if (vt != (VT_UI4|VT_BYREF)) {
-
827 VariantClear(this);
-
828 vt = VT_UI4|VT_BYREF;
-
829 }
-
830 pulVal = pnSrc;
-
831 return *this;
-
832 }
-
833
-
837 variant& operator=(_In_ long long* pnSrc) noexcept
-
838 {
-
839 if (vt != (VT_I8|VT_BYREF)) {
-
840 VariantClear(this);
-
841 vt = VT_I8|VT_BYREF;
-
842 }
-
843 pllVal = pnSrc;
-
844 return *this;
-
845 }
-
846
-
850 variant& operator=(_In_ unsigned long long* pnSrc) noexcept
-
851 {
-
852 if (vt != (VT_UI8|VT_BYREF)) {
-
853 VariantClear(this);
-
854 vt = VT_UI8|VT_BYREF;
-
855 }
-
856 pullVal = pnSrc;
-
857 return *this;
-
858 }
-
859
-
863 variant& operator=(_In_ float* pfSrc) noexcept
-
864 {
-
865 if (vt != (VT_R4|VT_BYREF)) {
-
866 VariantClear(this);
-
867 vt = VT_R4|VT_BYREF;
-
868 }
-
869 pfltVal = pfSrc;
-
870 return *this;
-
871 }
-
872
-
876 variant& operator=(_In_ double* pfSrc) noexcept
-
877 {
-
878 if (vt != (VT_R8|VT_BYREF)) {
-
879 VariantClear(this);
-
880 vt = VT_R8|VT_BYREF;
-
881 }
-
882 pdblVal = pfSrc;
-
883 return *this;
-
884 }
-
885
-
889 variant& operator=(_In_ const SAFEARRAY *pSrc) noexcept
-
890 {
-
891 assert(pSrc != NULL);
-
892 VariantClear(this);
-
893
-
894 LPSAFEARRAY pCopy;
-
895 const HRESULT hr = SafeArrayCopy(const_cast<LPSAFEARRAY>(pSrc), &pCopy);
-
896 if (SUCCEEDED(hr)) {
-
897 SafeArrayGetVartype(const_cast<LPSAFEARRAY>(pSrc), &vt);
-
898 vt |= VT_ARRAY;
-
899 parray = pCopy;
-
900 } else
-
901 assert(0);
-
902
-
903 return *this;
-
904 }
-
905
-
906 public:
-
915 bool operator==(_In_ const VARIANT& varSrc) const noexcept
-
916 {
-
917 if (vt == VT_NULL && varSrc.vt == VT_NULL) return true;
-
918 if (vt != varSrc.vt) return false;
-
919 return compare(static_cast<const VARIANT&>(*this), varSrc, LOCALE_USER_DEFAULT, 0) == static_cast<HRESULT>(VARCMP_EQ);
-
920 }
-
921
-
930 bool operator!=(_In_ const VARIANT& varSrc) const noexcept
-
931 {
-
932 return !operator==(varSrc);
-
933 }
-
934
-
943 bool operator<(_In_ const VARIANT& varSrc) const noexcept
-
944 {
-
945 if (vt == VT_NULL && varSrc.vt == VT_NULL) return false;
-
946 return compare(static_cast<const VARIANT&>(*this), varSrc, LOCALE_USER_DEFAULT, 0)== static_cast<HRESULT>(VARCMP_LT);
-
947 }
-
948
-
957 bool operator>(_In_ const VARIANT& varSrc) const noexcept
-
958 {
-
959 if (vt == VT_NULL && varSrc.vt == VT_NULL) return false;
-
960 return compare(static_cast<const VARIANT&>(*this), varSrc, LOCALE_USER_DEFAULT, 0)== static_cast<HRESULT>(VARCMP_GT);
-
961 }
-
962
-
971 bool operator<=(_In_ const VARIANT& varSrc) const noexcept
-
972 {
-
973 return !operator>(varSrc);
-
974 }
-
975
-
984 bool operator>=(_In_ const VARIANT& varSrc) const noexcept
-
985 {
-
986 return !operator<(varSrc);
-
987 }
-
988
-
994 HRESULT change_type(_In_ VARTYPE _vt, _In_opt_ USHORT wFlags = 0) noexcept
-
995 {
-
996 return VariantChangeType(this, this, wFlags, _vt);
-
997 }
-
998
-
999 private:
-
1001 HRESULT compare(_In_ const VARIANT &varLeft, _In_ const VARIANT &varRight, _In_ LCID lcid, _In_ ULONG dwFlags) const noexcept
-
1002 {
-
1003 switch(vt) {
-
1004 case VT_I1: return varLeft.cVal == varRight.cVal ? VARCMP_EQ : varLeft.cVal > varRight.cVal ? VARCMP_GT : VARCMP_LT;
-
1005 case VT_UI2: return varLeft.uiVal == varRight.uiVal ? VARCMP_EQ : varLeft.uiVal > varRight.uiVal ? VARCMP_GT : VARCMP_LT;
-
1006 case VT_UI4: return varLeft.uintVal == varRight.uintVal ? VARCMP_EQ : varLeft.uintVal > varRight.uintVal ? VARCMP_GT : VARCMP_LT;
-
1007 case VT_UI8: return varLeft.ullVal == varRight.ullVal ? VARCMP_EQ : varLeft.ullVal > varRight.ullVal ? VARCMP_GT : VARCMP_LT;
-
1008 default: return VarCmp(const_cast<LPVARIANT>(&varLeft), const_cast<LPVARIANT>(&varRight), lcid, dwFlags);
-
1009 }
-
1010 }
-
1012 };
-
1013 #pragma warning(pop)
-
1014
- -
1019 {
- - -
1022
-
1023 public:
-
1029 com_initializer(_In_opt_ LPVOID pvReserved) noexcept
-
1030 {
-
1031 m_result = CoInitialize(pvReserved);
-
1032 }
-
1033
-
1039 com_initializer(_In_opt_ LPVOID pvReserved, _In_ DWORD dwCoInit) noexcept
-
1040 {
-
1041 m_result = CoInitializeEx(pvReserved, dwCoInit);
-
1042 }
-
1043
- -
1050 {
-
1051 if (SUCCEEDED(m_result))
-
1052 CoUninitialize();
-
1053 }
-
1054
-
1060 HRESULT status() const noexcept
-
1061 {
-
1062 return m_result;
-
1063 }
-
1064
-
1065 protected:
-
1066 HRESULT m_result;
-
1067 };
+
15namespace winstd
+
16{
+
19
+
25 class com_runtime_error : public num_runtime_error<HRESULT>
+
26 {
+
27 public:
+
34 com_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<HRESULT>(num, msg)
+
35 {
+
36 }
+
37
+
44 com_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<HRESULT>(num, msg)
+
45 {
+
46 }
+
47 };
+
48
+
50
+
53
+ +
58 {
+ +
63
+
69 template <class _T>
+
70 void operator()(_T *_Ptr) const
+
71 {
+
72 CoTaskMemFree(_Ptr);
+
73 }
+
74 };
+
75
+
81 template <class T>
+
82 class com_obj : public dplhandle<T*, NULL>
+
83 {
+ +
85
+
86 public:
+
92 template <class _Other>
+
93 com_obj(_In_ _Other *other)
+
94 {
+
95 assert(other);
+
96 other->QueryInterface(__uuidof(T), (void**)&m_h);
+
97 }
+
98
+
104 template <class _Other>
+ +
106 {
+
107 other->QueryInterface(__uuidof(T), (void**)&m_h);
+
108 }
+
109
+
113 virtual ~com_obj()
+
114 {
+
115 if (m_h != invalid)
+ +
117 }
+
118
+
124 template <class _Other>
+
125 HRESULT query_interface(_Out_ _Other **h) const
+
126 {
+
127 assert(h);
+
128 assert(m_h);
+
129 return m_h->QueryInterface(__uuidof(_Other), (void**)h);
+
130 }
+
131
+
137 template <class _Other>
+
138 HRESULT query_interface(_Out_ com_obj<_Other> &h) const
+
139 {
+
140 assert(m_h);
+
141 _Other *_h;
+
142 HRESULT hr = m_h->QueryInterface(__uuidof(_Other), (void**)&_h);
+
143 if (SUCCEEDED(hr))
+
144 h.attach(_h);
+
145 return hr;
+
146 }
+
147
+
148 protected:
+
154 void free_internal() noexcept override
+
155 {
+
156 m_h->Release();
+
157 }
+
158
+
168 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
+
169 {
+
170 h->AddRef();
+
171 return h;
+
172 }
+
173 };
+
174
+
178 class bstr : public dplhandle<BSTR, NULL>
+
179 {
+ +
181
+
182 public:
+
186 bstr(_In_ LPCOLESTR src) noexcept
+
187 {
+
188 m_h = SysAllocString(src);
+
189 }
+
190
+
194 bstr(_In_ LPCOLESTR src, _In_ UINT len) noexcept
+
195 {
+
196 m_h = SysAllocStringLen(src, len);
+
197 }
+
198
+
202 template<class _Traits, class _Ax>
+
203 bstr(_In_ const std::basic_string<wchar_t, _Traits, _Ax> &src) noexcept
+
204 {
+
205 m_h = SysAllocStringLen(src.c_str(), (UINT)src.length());
+
206 }
+
207
+
213 virtual ~bstr()
+
214 {
+
215 if (m_h != invalid)
+ +
217 }
+
218
+
224 UINT length() const noexcept
+
225 {
+
226 return SysStringLen(m_h);
+
227 }
+
228
+
229 protected:
+
235 void free_internal() noexcept override
+
236 {
+
237 SysFreeString(m_h);
+
238 }
+
239
+
249 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
+
250 {
+
251 return SysAllocStringLen(h, SysStringLen(h));
+
252 }
+
253 };
+
254
+
258 #pragma warning(push)
+
259 #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.
+
260 class variant : public VARIANT
+
261 {
+
262 public:
+
266 variant() noexcept
+
267 {
+
268 VariantInit(this);
+
269 }
+
270
+
274 variant(_In_ const VARIANT& varSrc)
+
275 {
+
276 vt = VT_EMPTY;
+
277 const HRESULT hr = VariantCopy(this, &varSrc);
+
278 if (FAILED(hr))
+
279 throw winstd::com_runtime_error(hr, "VariantCopy failed.");
+
280 }
+
281
+
285 #pragma warning(suppress: 26495) // vt member is initialized as a result of memcpy()
+
286 variant(_Inout_ VARIANT&& varSrc) noexcept
+
287 {
+
288 memcpy(this, &varSrc, sizeof(VARIANT));
+
289 varSrc.vt = VT_EMPTY;
+
290 }
+
291
+
295 variant(_In_ bool bSrc) noexcept
+
296 {
+
297 vt = VT_BOOL;
+
298 boolVal = bSrc ? VARIANT_TRUE : VARIANT_FALSE;
+
299 }
+
300
+
304 variant(_In_ char cSrc) noexcept
+
305 {
+
306 vt = VT_I1;
+
307 cVal = cSrc;
+
308 }
+
309
+
313 variant(_In_ unsigned char nSrc) noexcept
+
314 {
+
315 vt = VT_UI1;
+
316 bVal = nSrc;
+
317 }
+
318
+
322 variant(_In_ short nSrc) noexcept
+
323 {
+
324 vt = VT_I2;
+
325 iVal = nSrc;
+
326 }
+
327
+
331 variant(_In_ unsigned short nSrc) noexcept
+
332 {
+
333 vt = VT_UI2;
+
334 uiVal = nSrc;
+
335 }
+
336
+
340 variant(_In_ int nSrc, _In_ VARTYPE vtSrc = VT_I4) noexcept
+
341 {
+
342 assert(vtSrc == VT_I4 || vtSrc == VT_INT);
+
343 vt = vtSrc;
+
344 intVal = nSrc;
+
345 }
+
346
+
350 variant(_In_ unsigned int nSrc, _In_ VARTYPE vtSrc = VT_UI4) noexcept
+
351 {
+
352 assert(vtSrc == VT_UI4 || vtSrc == VT_UINT);
+
353 vt = vtSrc;
+
354 uintVal= nSrc;
+
355 }
+
356
+
360 variant(_In_ long nSrc, _In_ VARTYPE vtSrc = VT_I4) noexcept
+
361 {
+
362 assert(vtSrc == VT_I4 || vtSrc == VT_ERROR);
+
363 vt = vtSrc;
+
364 lVal = nSrc;
+
365 }
+
366
+
370 variant(_In_ unsigned long nSrc) noexcept
+
371 {
+
372 vt = VT_UI4;
+
373 ulVal = nSrc;
+
374 }
+
375
+
379 variant(_In_ float fltSrc) noexcept
+
380 {
+
381 vt = VT_R4;
+
382 fltVal = fltSrc;
+
383 }
+
384
+
388 variant(_In_ double dblSrc, _In_ VARTYPE vtSrc = VT_R8) noexcept
+
389 {
+
390 assert(vtSrc == VT_R8 || vtSrc == VT_DATE);
+
391 vt = vtSrc;
+
392 dblVal = dblSrc;
+
393 }
+
394
+
398 variant(_In_ long long nSrc) noexcept
+
399 {
+
400 vt = VT_I8;
+
401 llVal = nSrc;
+
402 }
+
403
+
407 variant(_In_ unsigned long long nSrc) noexcept
+
408 {
+
409 vt = VT_UI8;
+
410 ullVal = nSrc;
+
411 }
+
412
+
416 variant(_In_ CY cySrc) noexcept
+
417 {
+
418 vt = VT_CY;
+
419 cyVal.Hi = cySrc.Hi;
+
420 cyVal.Lo = cySrc.Lo;
+
421 }
+
422
+
426 variant(_In_z_ LPCOLESTR lpszSrc) noexcept
+
427 {
+
428 vt = VT_EMPTY;
+
429 *this = lpszSrc;
+
430 }
+
431
+
435 variant(_In_z_ BSTR bstr) noexcept
+
436 {
+
437 vt = VT_EMPTY;
+
438 *this = bstr;
+
439 }
+
440
+
444 variant(_In_opt_ IDispatch* pSrc)
+
445 {
+
446 vt = VT_DISPATCH;
+
447 pdispVal = pSrc;
+
448
+
449 if (pdispVal != NULL)
+
450 pdispVal->AddRef();
+
451 }
+
452
+
456 variant(_In_opt_ IUnknown* pSrc)
+
457 {
+
458 vt = VT_UNKNOWN;
+
459 punkVal = pSrc;
+
460
+
461 if (punkVal != NULL)
+
462 punkVal->AddRef();
+
463 }
+
464
+
468 variant(_In_ const SAFEARRAY *pSrc)
+
469 {
+
470 assert(pSrc != NULL);
+
471
+
472 LPSAFEARRAY pCopy;
+
473 const HRESULT hr = SafeArrayCopy(const_cast<LPSAFEARRAY>(pSrc), &pCopy);
+
474 if (FAILED(hr))
+
475 throw winstd::com_runtime_error(hr, "SafeArrayCopy failed.");
+
476
+
477 SafeArrayGetVartype(const_cast<LPSAFEARRAY>(pSrc), &vt);
+
478 vt |= VT_ARRAY;
+
479 parray = pCopy;
+
480 }
+
481
+
485 virtual ~variant()
+
486 {
+
487 VariantClear(this);
+
488 }
+
489
+
493 variant& operator=(_In_ const VARIANT& varSrc)
+
494 {
+
495 if (this != &varSrc) {
+
496 const HRESULT hr = VariantCopy(this, &varSrc);
+
497 if (FAILED(hr))
+
498 throw winstd::com_runtime_error(hr, "VariantCopy failed.");
+
499 }
+
500 return *this;
+
501 }
+
502
+
506 variant& operator=(_Inout_ VARIANT&& varSrc) noexcept
+
507 {
+
508 if (this != &varSrc) {
+
509 VariantClear(this);
+
510 memcpy(this, &varSrc, sizeof(VARIANT));
+
511 varSrc.vt = VT_EMPTY;
+
512 }
+
513 return *this;
+
514 }
+
515
+
519 variant& operator=(_In_ bool bSrc) noexcept
+
520 {
+
521 if (vt != VT_BOOL) {
+
522 VariantClear(this);
+
523 vt = VT_BOOL;
+
524 }
+
525 boolVal = bSrc ? VARIANT_TRUE : VARIANT_FALSE;
+
526 return *this;
+
527 }
+
528
+
532 variant& operator=(_In_ char cSrc) noexcept
+
533 {
+
534 if (vt != VT_I1) {
+
535 VariantClear(this);
+
536 vt = VT_I1;
+
537 }
+
538 cVal = cSrc;
+
539 return *this;
+
540 }
+
541
+
545 variant& operator=(_In_ unsigned char nSrc) noexcept
+
546 {
+
547 if (vt != VT_UI1) {
+
548 VariantClear(this);
+
549 vt = VT_UI1;
+
550 }
+
551 bVal = nSrc;
+
552 return *this;
+
553 }
+
554
+
558 variant& operator=(_In_ short nSrc) noexcept
+
559 {
+
560 if (vt != VT_I2) {
+
561 VariantClear(this);
+
562 vt = VT_I2;
+
563 }
+
564 iVal = nSrc;
+
565 return *this;
+
566 }
+
567
+
571 variant& operator=(_In_ unsigned short nSrc) noexcept
+
572 {
+
573 if (vt != VT_UI2) {
+
574 VariantClear(this);
+
575 vt = VT_UI2;
+
576 }
+
577 uiVal = nSrc;
+
578 return *this;
+
579 }
+
580
+
584 variant& operator=(_In_ int nSrc) noexcept
+
585 {
+
586 if (vt != VT_I4) {
+
587 VariantClear(this);
+
588 vt = VT_I4;
+
589 }
+
590 intVal = nSrc;
+
591 return *this;
+
592 }
+
593
+
597 variant& operator=(_In_ unsigned int nSrc) noexcept
+
598 {
+
599 if (vt != VT_UI4) {
+
600 VariantClear(this);
+
601 vt = VT_UI4;
+
602 }
+
603 uintVal= nSrc;
+
604 return *this;
+
605 }
+
606
+
610 variant& operator=(_In_ long nSrc) noexcept
+
611 {
+
612 if (vt != VT_I4) {
+
613 VariantClear(this);
+
614 vt = VT_I4;
+
615 }
+
616 lVal = nSrc;
+
617 return *this;
+
618 }
+
619
+
623 variant& operator=(_In_ unsigned long nSrc) noexcept
+
624 {
+
625 if (vt != VT_UI4) {
+
626 VariantClear(this);
+
627 vt = VT_UI4;
+
628 }
+
629 ulVal = nSrc;
+
630 return *this;
+
631 }
+
632
+
636 variant& operator=(_In_ long long nSrc) noexcept
+
637 {
+
638 if (vt != VT_I8) {
+
639 VariantClear(this);
+
640 vt = VT_I8;
+
641 }
+
642 llVal = nSrc;
+
643 return *this;
+
644 }
+
645
+
649 variant& operator=(_In_ unsigned long long nSrc) noexcept
+
650 {
+
651 if (vt != VT_UI8) {
+
652 VariantClear(this);
+
653 vt = VT_UI8;
+
654 }
+
655 ullVal = nSrc;
+
656
+
657 return *this;
+
658 }
+
659
+
663 variant& operator=(_In_ float fltSrc) noexcept
+
664 {
+
665 if (vt != VT_R4) {
+
666 VariantClear(this);
+
667 vt = VT_R4;
+
668 }
+
669 fltVal = fltSrc;
+
670 return *this;
+
671 }
+
672
+
676 variant& operator=(_In_ double dblSrc) noexcept
+
677 {
+
678 if (vt != VT_R8) {
+
679 VariantClear(this);
+
680 vt = VT_R8;
+
681 }
+
682 dblVal = dblSrc;
+
683 return *this;
+
684 }
+
685
+
689 variant& operator=(_In_ CY cySrc) noexcept
+
690 {
+
691 if (vt != VT_CY) {
+
692 VariantClear(this);
+
693 vt = VT_CY;
+
694 }
+
695 cyVal.Hi = cySrc.Hi;
+
696 cyVal.Lo = cySrc.Lo;
+
697 return *this;
+
698 }
+
699
+
703 variant& operator=(_In_z_ LPCOLESTR lpszSrc) noexcept
+
704 {
+
705 VariantClear(this);
+
706 vt = VT_BSTR;
+
707 bstrVal = SysAllocString(lpszSrc);
+
708 return *this;
+
709 }
+
710
+
714 variant& operator=(_Inout_opt_ IDispatch* pSrc)
+
715 {
+
716 VariantClear(this);
+
717 vt = VT_DISPATCH;
+
718 pdispVal = pSrc;
+
719 if (pdispVal != NULL)
+
720 pdispVal->AddRef();
+
721 return *this;
+
722 }
+
723
+
727 variant& operator=(_Inout_opt_ IUnknown* pSrc)
+
728 {
+
729 VariantClear(this);
+
730 vt = VT_UNKNOWN;
+
731 punkVal = pSrc;
+
732 if (punkVal != NULL)
+
733 punkVal->AddRef();
+
734 return *this;
+
735 }
+
736
+
740 variant& operator=(_In_ unsigned char* pbSrc) noexcept
+
741 {
+
742 if (vt != (VT_UI1|VT_BYREF)) {
+
743 VariantClear(this);
+
744 vt = VT_UI1|VT_BYREF;
+
745 }
+
746 pbVal = pbSrc;
+
747 return *this;
+
748 }
+
749
+
753 variant& operator=(_In_ short* pnSrc) noexcept
+
754 {
+
755 if (vt != (VT_I2|VT_BYREF)) {
+
756 VariantClear(this);
+
757 vt = VT_I2|VT_BYREF;
+
758 }
+
759 piVal = pnSrc;
+
760 return *this;
+
761 }
+
762
+
766 variant& operator=(_In_ unsigned short* pnSrc) noexcept
+
767 {
+
768 if (vt != (VT_UI2|VT_BYREF)) {
+
769 VariantClear(this);
+
770 vt = VT_UI2|VT_BYREF;
+
771 }
+
772 puiVal = pnSrc;
+
773 return *this;
+
774 }
+
775
+
779 variant& operator=(_In_ int* pnSrc) noexcept
+
780 {
+
781 if (vt != (VT_I4|VT_BYREF)) {
+
782 VariantClear(this);
+
783 vt = VT_I4|VT_BYREF;
+
784 }
+
785 pintVal = pnSrc;
+
786 return *this;
+
787 }
+
788
+
792 variant& operator=(_In_ unsigned int* pnSrc) noexcept
+
793 {
+
794 if (vt != (VT_UI4|VT_BYREF)) {
+
795 VariantClear(this);
+
796 vt = VT_UI4|VT_BYREF;
+
797 }
+
798 puintVal = pnSrc;
+
799 return *this;
+
800 }
+
801
+
805 variant& operator=(_In_ long* pnSrc) noexcept
+
806 {
+
807 if (vt != (VT_I4|VT_BYREF)) {
+
808 VariantClear(this);
+
809 vt = VT_I4|VT_BYREF;
+
810 }
+
811 plVal = pnSrc;
+
812 return *this;
+
813 }
+
814
+
818 variant& operator=(_In_ unsigned long* pnSrc) noexcept
+
819 {
+
820 if (vt != (VT_UI4|VT_BYREF)) {
+
821 VariantClear(this);
+
822 vt = VT_UI4|VT_BYREF;
+
823 }
+
824 pulVal = pnSrc;
+
825 return *this;
+
826 }
+
827
+
831 variant& operator=(_In_ long long* pnSrc) noexcept
+
832 {
+
833 if (vt != (VT_I8|VT_BYREF)) {
+
834 VariantClear(this);
+
835 vt = VT_I8|VT_BYREF;
+
836 }
+
837 pllVal = pnSrc;
+
838 return *this;
+
839 }
+
840
+
844 variant& operator=(_In_ unsigned long long* pnSrc) noexcept
+
845 {
+
846 if (vt != (VT_UI8|VT_BYREF)) {
+
847 VariantClear(this);
+
848 vt = VT_UI8|VT_BYREF;
+
849 }
+
850 pullVal = pnSrc;
+
851 return *this;
+
852 }
+
853
+
857 variant& operator=(_In_ float* pfSrc) noexcept
+
858 {
+
859 if (vt != (VT_R4|VT_BYREF)) {
+
860 VariantClear(this);
+
861 vt = VT_R4|VT_BYREF;
+
862 }
+
863 pfltVal = pfSrc;
+
864 return *this;
+
865 }
+
866
+
870 variant& operator=(_In_ double* pfSrc) noexcept
+
871 {
+
872 if (vt != (VT_R8|VT_BYREF)) {
+
873 VariantClear(this);
+
874 vt = VT_R8|VT_BYREF;
+
875 }
+
876 pdblVal = pfSrc;
+
877 return *this;
+
878 }
+
879
+
883 variant& operator=(_In_ const SAFEARRAY *pSrc) noexcept
+
884 {
+
885 assert(pSrc != NULL);
+
886 VariantClear(this);
+
887
+
888 LPSAFEARRAY pCopy;
+
889 const HRESULT hr = SafeArrayCopy(const_cast<LPSAFEARRAY>(pSrc), &pCopy);
+
890 if (SUCCEEDED(hr)) {
+
891 SafeArrayGetVartype(const_cast<LPSAFEARRAY>(pSrc), &vt);
+
892 vt |= VT_ARRAY;
+
893 parray = pCopy;
+
894 } else
+
895 assert(0);
+
896
+
897 return *this;
+
898 }
+
899
+
900 public:
+
909 bool operator==(_In_ const VARIANT& varSrc) const noexcept
+
910 {
+
911 if (vt == VT_NULL && varSrc.vt == VT_NULL) return true;
+
912 if (vt != varSrc.vt) return false;
+
913 return compare(static_cast<const VARIANT&>(*this), varSrc, LOCALE_USER_DEFAULT, 0) == static_cast<HRESULT>(VARCMP_EQ);
+
914 }
+
915
+
924 bool operator!=(_In_ const VARIANT& varSrc) const noexcept
+
925 {
+
926 return !operator==(varSrc);
+
927 }
+
928
+
937 bool operator<(_In_ const VARIANT& varSrc) const noexcept
+
938 {
+
939 if (vt == VT_NULL && varSrc.vt == VT_NULL) return false;
+
940 return compare(static_cast<const VARIANT&>(*this), varSrc, LOCALE_USER_DEFAULT, 0)== static_cast<HRESULT>(VARCMP_LT);
+
941 }
+
942
+
951 bool operator>(_In_ const VARIANT& varSrc) const noexcept
+
952 {
+
953 if (vt == VT_NULL && varSrc.vt == VT_NULL) return false;
+
954 return compare(static_cast<const VARIANT&>(*this), varSrc, LOCALE_USER_DEFAULT, 0)== static_cast<HRESULT>(VARCMP_GT);
+
955 }
+
956
+
965 bool operator<=(_In_ const VARIANT& varSrc) const noexcept
+
966 {
+
967 return !operator>(varSrc);
+
968 }
+
969
+
978 bool operator>=(_In_ const VARIANT& varSrc) const noexcept
+
979 {
+
980 return !operator<(varSrc);
+
981 }
+
982
+
988 HRESULT change_type(_In_ VARTYPE _vt, _In_opt_ USHORT wFlags = 0) noexcept
+
989 {
+
990 return VariantChangeType(this, this, wFlags, _vt);
+
991 }
+
992
+
993 private:
+
995 HRESULT compare(_In_ const VARIANT &varLeft, _In_ const VARIANT &varRight, _In_ LCID lcid, _In_ ULONG dwFlags) const noexcept
+
996 {
+
997 switch(vt) {
+
998 case VT_I1: return varLeft.cVal == varRight.cVal ? VARCMP_EQ : varLeft.cVal > varRight.cVal ? VARCMP_GT : VARCMP_LT;
+
999 case VT_UI2: return varLeft.uiVal == varRight.uiVal ? VARCMP_EQ : varLeft.uiVal > varRight.uiVal ? VARCMP_GT : VARCMP_LT;
+
1000 case VT_UI4: return varLeft.uintVal == varRight.uintVal ? VARCMP_EQ : varLeft.uintVal > varRight.uintVal ? VARCMP_GT : VARCMP_LT;
+
1001 case VT_UI8: return varLeft.ullVal == varRight.ullVal ? VARCMP_EQ : varLeft.ullVal > varRight.ullVal ? VARCMP_GT : VARCMP_LT;
+
1002 default: return VarCmp(const_cast<LPVARIANT>(&varLeft), const_cast<LPVARIANT>(&varRight), lcid, dwFlags);
+
1003 }
+
1004 }
+
1006 };
+
1007 #pragma warning(pop)
+
1008
+ +
1013 {
+ + +
1016
+
1017 public:
+
1023 com_initializer(_In_opt_ LPVOID pvReserved) noexcept
+
1024 {
+
1025 m_result = CoInitialize(pvReserved);
+
1026 }
+
1027
+
1033 com_initializer(_In_opt_ LPVOID pvReserved, _In_ DWORD dwCoInit) noexcept
+
1034 {
+
1035 m_result = CoInitializeEx(pvReserved, dwCoInit);
+
1036 }
+
1037
+ +
1044 {
+
1045 if (SUCCEEDED(m_result))
+
1046 CoUninitialize();
+
1047 }
+
1048
+
1054 HRESULT status() const noexcept
+
1055 {
+
1056 return m_result;
+
1057 }
+
1058
+
1059 protected:
+
1060 HRESULT m_result;
+
1061 };
+
1062
+
1064}
+
1065
1068
-
1070}
-
1071
-
1074
-
1080template <class T>
-
1081static _Check_return_ HRESULT CoCreateInstance(_In_ REFCLSID rclsid, _In_opt_ LPUNKNOWN pUnkOuter, _In_ DWORD dwClsContext, _Inout_ winstd::com_obj<T> &v)
-
1082{
-
1083 T* ppv;
-
1084 HRESULT hr = CoCreateInstance(rclsid, pUnkOuter, dwClsContext, __uuidof(T), (LPVOID*)&ppv);
-
1085 if (SUCCEEDED(hr))
-
1086 v.attach(ppv);
-
1087 return hr;
-
1088}
-
1089
-
General API.
-
BSTR string wrapper.
Definition: COM.h:185
-
bstr(LPCOLESTR src) noexcept
Constructs BSTR from OLE string.
Definition: COM.h:192
-
virtual ~bstr()
Destroys the string.
Definition: COM.h:219
-
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the string.
Definition: COM.h:255
-
bstr(const std::basic_string< wchar_t, _Traits, _Ax > &src) noexcept
Constructs BSTR from std::basic_string.
Definition: COM.h:209
-
bstr(LPCOLESTR src, UINT len) noexcept
Constructs BSTR from OLE string with length.
Definition: COM.h:200
-
void free_internal() noexcept override
Destroys the string.
Definition: COM.h:241
-
UINT length() const noexcept
Returns the length of the string.
Definition: COM.h:230
-
Context scope automatic COM (un)initialization.
Definition: COM.h:1019
-
com_initializer(LPVOID pvReserved, DWORD dwCoInit) noexcept
Initializes the COM library for use by the calling thread, sets the thread's concurrency model,...
Definition: COM.h:1039
-
com_initializer(LPVOID pvReserved) noexcept
Initializes the COM library on the current thread and identifies the concurrency model as single-thre...
Definition: COM.h:1029
-
HRESULT status() const noexcept
Return result of CoInitialize() call.
Definition: COM.h:1060
-
virtual ~com_initializer()
Uninitializes COM.
Definition: COM.h:1049
-
HRESULT m_result
Result of CoInitialize call.
Definition: COM.h:1066
-
COM object wrapper template.
Definition: COM.h:89
-
void free_internal() noexcept override
Releases the object by decrementing reference counter.
Definition: COM.h:160
-
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the object by incrementing the reference counter.
Definition: COM.h:174
-
HRESULT query_interface(_Other **h) const
Queries the object for another interface.
Definition: COM.h:131
-
HRESULT query_interface(com_obj< _Other > &h) const
Queries the object for another interface.
Definition: COM.h:144
-
virtual ~com_obj()
Releases object.
Definition: COM.h:119
-
com_obj(_Other *other)
Queries the object for another interface and creates new class with it.
Definition: COM.h:99
-
com_obj(com_obj< _Other > &other)
Queries the object for another interface and creates new class with it.
Definition: COM.h:111
-
COM runtime error.
Definition: COM.h:32
-
com_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition: COM.h:40
-
com_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition: COM.h:50
-
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition: Common.h:877
-
T * handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:620
-
handle_type m_h
Object handle.
Definition: Common.h:866
-
Numerical runtime error.
Definition: Common.h:1011
-
HRESULT error_type
Error number type.
Definition: Common.h:1013
-
VARIANT struct wrapper.
Definition: COM.h:267
-
bool operator<=(const VARIANT &varSrc) const noexcept
Is variant less than or equal to?
Definition: COM.h:971
-
variant(bool bSrc) noexcept
Constructs VARIANT from bool.
Definition: COM.h:301
-
variant & operator=(unsigned int nSrc) noexcept
Copy from unsigned int value.
Definition: COM.h:603
-
variant & operator=(unsigned long nSrc) noexcept
Copy from unsigned long value.
Definition: COM.h:629
-
variant(float fltSrc) noexcept
Constructs VARIANT from float.
Definition: COM.h:385
-
variant(VARIANT &&varSrc) noexcept
Moves VARIANT from another.
Definition: COM.h:292
-
variant & operator=(float fltSrc) noexcept
Copy from float value.
Definition: COM.h:669
-
variant & operator=(float *pfSrc) noexcept
Copy from float reference.
Definition: COM.h:863
-
variant(IDispatch *pSrc)
Constructs VARIANT from IDispatch.
Definition: COM.h:450
-
variant(int nSrc, VARTYPE vtSrc=VT_I4) noexcept
Constructs VARIANT from integer.
Definition: COM.h:346
-
variant(const SAFEARRAY *pSrc)
Constructs VARIANT from SAFEARRAY.
Definition: COM.h:474
-
variant & operator=(double *pfSrc) noexcept
Copy from double reference.
Definition: COM.h:876
-
variant & operator=(int *pnSrc) noexcept
Copy from int reference.
Definition: COM.h:785
-
bool operator>(const VARIANT &varSrc) const noexcept
Is variant greater than?
Definition: COM.h:957
-
variant & operator=(bool bSrc) noexcept
Copy from bool value.
Definition: COM.h:525
-
variant & operator=(long nSrc) noexcept
Copy from long value.
Definition: COM.h:616
-
variant & operator=(const SAFEARRAY *pSrc) noexcept
Copy from SAFEARRAY.
Definition: COM.h:889
-
HRESULT change_type(VARTYPE _vt, USHORT wFlags=0) noexcept
Converts a variant from one type to another.
Definition: COM.h:994
-
variant & operator=(IUnknown *pSrc)
Copy from IUnknown.
Definition: COM.h:733
-
variant & operator=(short nSrc) noexcept
Copy from short value.
Definition: COM.h:564
-
variant & operator=(unsigned char *pbSrc) noexcept
Copy from unsigned char reference.
Definition: COM.h:746
-
variant & operator=(unsigned short nSrc) noexcept
Copy from unsigned short value.
Definition: COM.h:577
-
variant & operator=(unsigned char nSrc) noexcept
Copy from unsigned char value.
Definition: COM.h:551
-
variant & operator=(char cSrc) noexcept
Copy from char value.
Definition: COM.h:538
-
variant(LPCOLESTR lpszSrc) noexcept
Constructs VARIANT from OLE string.
Definition: COM.h:432
-
virtual ~variant()
Destroys VARIANT.
Definition: COM.h:491
-
variant(const VARIANT &varSrc)
Constructs VARIANT from another.
Definition: COM.h:280
-
variant(unsigned char nSrc) noexcept
Constructs VARIANT from byte.
Definition: COM.h:319
-
variant & operator=(double dblSrc) noexcept
Copy from double value.
Definition: COM.h:682
-
bool operator!=(const VARIANT &varSrc) const noexcept
Is variant not equal to?
Definition: COM.h:930
-
variant & operator=(int nSrc) noexcept
Copy from int value.
Definition: COM.h:590
-
variant(unsigned long nSrc) noexcept
Constructs VARIANT from unsigned long.
Definition: COM.h:376
-
bool operator==(const VARIANT &varSrc) const noexcept
Is variant equal to?
Definition: COM.h:915
-
variant(IUnknown *pSrc)
Constructs VARIANT from IUnknown.
Definition: COM.h:462
-
variant(unsigned int nSrc, VARTYPE vtSrc=VT_UI4) noexcept
Constructs VARIANT from unsigned integer.
Definition: COM.h:356
-
variant & operator=(CY cySrc) noexcept
Copy from CY value.
Definition: COM.h:695
-
variant & operator=(LPCOLESTR lpszSrc) noexcept
Copy from OLE string value.
Definition: COM.h:709
-
variant(long long nSrc) noexcept
Constructs VARIANT from 64-bit integer.
Definition: COM.h:404
-
variant & operator=(unsigned int *pnSrc) noexcept
Copy from unsigned int reference.
Definition: COM.h:798
-
variant(long nSrc, VARTYPE vtSrc=VT_I4) noexcept
Constructs VARIANT from long.
Definition: COM.h:366
-
variant & operator=(long *pnSrc) noexcept
Copy from long reference.
Definition: COM.h:811
-
variant(unsigned short nSrc) noexcept
Constructs VARIANT from unsigned short.
Definition: COM.h:337
-
bool operator>=(const VARIANT &varSrc) const noexcept
Is variant greater than or equal to?
Definition: COM.h:984
-
variant & operator=(short *pnSrc) noexcept
Copy from short reference.
Definition: COM.h:759
-
variant() noexcept
Constructs blank VARIANT.
Definition: COM.h:272
-
bool operator<(const VARIANT &varSrc) const noexcept
Is variant less than?
Definition: COM.h:943
-
variant(unsigned long long nSrc) noexcept
Constructs VARIANT from unsigned integer.
Definition: COM.h:413
-
variant(char cSrc) noexcept
Constructs VARIANT from character.
Definition: COM.h:310
-
variant & operator=(unsigned short *pnSrc) noexcept
Copy from unsigned short reference.
Definition: COM.h:772
-
variant & operator=(long long *pnSrc) noexcept
Copy from long long reference.
Definition: COM.h:837
-
variant(BSTR bstr) noexcept
Constructs VARIANT from BSTR.
Definition: COM.h:441
-
variant & operator=(unsigned long long *pnSrc) noexcept
Copy from unsigned long long reference.
Definition: COM.h:850
-
variant(double dblSrc, VARTYPE vtSrc=VT_R8) noexcept
Constructs VARIANT from double or variant date.
Definition: COM.h:394
-
variant(short nSrc) noexcept
Constructs VARIANT from short.
Definition: COM.h:328
-
variant(CY cySrc) noexcept
Constructs VARIANT from CY (64-bit integer)
Definition: COM.h:422
-
variant & operator=(unsigned long long nSrc) noexcept
Copy from unsigned long long value.
Definition: COM.h:655
-
variant & operator=(VARIANT &&varSrc) noexcept
Moves from another VARIANT.
Definition: COM.h:512
-
variant & operator=(long long nSrc) noexcept
Copy from long long value.
Definition: COM.h:642
-
variant & operator=(IDispatch *pSrc)
Copy from IDispatch.
Definition: COM.h:720
-
variant & operator=(unsigned long *pnSrc) noexcept
Copy from unsigned long reference.
Definition: COM.h:824
-
variant & operator=(const VARIANT &varSrc)
Copy from another VARIANT.
Definition: COM.h:499
-
static _Check_return_ HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, winstd::com_obj< T > &v)
Creates and default-initializes a single object of the class associated with a specified CLSID.
Definition: COM.h:1081
-
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:74
-
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition: Common.h:82
-
#define WINSTD_DPLHANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:183
-
static const T * invalid
Invalid handle value.
Definition: Common.h:625
-
Deleter for unique_ptr using CoTaskMemFree.
Definition: COM.h:64
-
void operator()(_T *_Ptr) const
Delete a pointer.
Definition: COM.h:76
-
CoTaskMemFree_delete() noexcept
Default constructor.
Definition: COM.h:68
+
1074template <class T>
+
1075static _Check_return_ HRESULT CoCreateInstance(_In_ REFCLSID rclsid, _In_opt_ LPUNKNOWN pUnkOuter, _In_ DWORD dwClsContext, _Inout_ winstd::com_obj<T> &v)
+
1076{
+
1077 T* ppv;
+
1078 HRESULT hr = CoCreateInstance(rclsid, pUnkOuter, dwClsContext, __uuidof(T), (LPVOID*)&ppv);
+
1079 if (SUCCEEDED(hr))
+
1080 v.attach(ppv);
+
1081 return hr;
+
1082}
+
1083
+
BSTR string wrapper.
Definition: COM.h:179
+
bstr(LPCOLESTR src) noexcept
Constructs BSTR from OLE string.
Definition: COM.h:186
+
virtual ~bstr()
Destroys the string.
Definition: COM.h:213
+
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the string.
Definition: COM.h:249
+
bstr(const std::basic_string< wchar_t, _Traits, _Ax > &src) noexcept
Constructs BSTR from std::basic_string.
Definition: COM.h:203
+
bstr(LPCOLESTR src, UINT len) noexcept
Constructs BSTR from OLE string with length.
Definition: COM.h:194
+
void free_internal() noexcept override
Destroys the string.
Definition: COM.h:235
+
UINT length() const noexcept
Returns the length of the string.
Definition: COM.h:224
+
Context scope automatic COM (un)initialization.
Definition: COM.h:1013
+
com_initializer(LPVOID pvReserved, DWORD dwCoInit) noexcept
Initializes the COM library for use by the calling thread, sets the thread's concurrency model,...
Definition: COM.h:1033
+
com_initializer(LPVOID pvReserved) noexcept
Initializes the COM library on the current thread and identifies the concurrency model as single-thre...
Definition: COM.h:1023
+
HRESULT status() const noexcept
Return result of CoInitialize() call.
Definition: COM.h:1054
+
virtual ~com_initializer()
Uninitializes COM.
Definition: COM.h:1043
+
HRESULT m_result
Result of CoInitialize call.
Definition: COM.h:1060
+
COM object wrapper template.
Definition: COM.h:83
+
void free_internal() noexcept override
Releases the object by decrementing reference counter.
Definition: COM.h:154
+
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the object by incrementing the reference counter.
Definition: COM.h:168
+
HRESULT query_interface(_Other **h) const
Queries the object for another interface.
Definition: COM.h:125
+
HRESULT query_interface(com_obj< _Other > &h) const
Queries the object for another interface.
Definition: COM.h:138
+
virtual ~com_obj()
Releases object.
Definition: COM.h:113
+
com_obj(_Other *other)
Queries the object for another interface and creates new class with it.
Definition: COM.h:93
+
com_obj(com_obj< _Other > &other)
Queries the object for another interface and creates new class with it.
Definition: COM.h:105
+
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:44
+
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition: Common.h:869
+
T * handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:612
+
handle_type m_h
Object handle.
Definition: Common.h:858
+
Numerical runtime error.
Definition: Common.h:1003
+
HRESULT error_type
Error number type.
Definition: Common.h:1005
+
VARIANT struct wrapper.
Definition: COM.h:261
+
bool operator<=(const VARIANT &varSrc) const noexcept
Is variant less than or equal to?
Definition: COM.h:965
+
variant(bool bSrc) noexcept
Constructs VARIANT from bool.
Definition: COM.h:295
+
variant & operator=(unsigned int nSrc) noexcept
Copy from unsigned int value.
Definition: COM.h:597
+
variant & operator=(unsigned long nSrc) noexcept
Copy from unsigned long value.
Definition: COM.h:623
+
variant(float fltSrc) noexcept
Constructs VARIANT from float.
Definition: COM.h:379
+
variant(VARIANT &&varSrc) noexcept
Moves VARIANT from another.
Definition: COM.h:286
+
variant & operator=(float fltSrc) noexcept
Copy from float value.
Definition: COM.h:663
+
variant & operator=(float *pfSrc) noexcept
Copy from float reference.
Definition: COM.h:857
+
variant(IDispatch *pSrc)
Constructs VARIANT from IDispatch.
Definition: COM.h:444
+
variant(int nSrc, VARTYPE vtSrc=VT_I4) noexcept
Constructs VARIANT from integer.
Definition: COM.h:340
+
variant(const SAFEARRAY *pSrc)
Constructs VARIANT from SAFEARRAY.
Definition: COM.h:468
+
variant & operator=(double *pfSrc) noexcept
Copy from double reference.
Definition: COM.h:870
+
variant & operator=(int *pnSrc) noexcept
Copy from int reference.
Definition: COM.h:779
+
bool operator>(const VARIANT &varSrc) const noexcept
Is variant greater than?
Definition: COM.h:951
+
variant & operator=(bool bSrc) noexcept
Copy from bool value.
Definition: COM.h:519
+
variant & operator=(long nSrc) noexcept
Copy from long value.
Definition: COM.h:610
+
variant & operator=(const SAFEARRAY *pSrc) noexcept
Copy from SAFEARRAY.
Definition: COM.h:883
+
HRESULT change_type(VARTYPE _vt, USHORT wFlags=0) noexcept
Converts a variant from one type to another.
Definition: COM.h:988
+
variant & operator=(IUnknown *pSrc)
Copy from IUnknown.
Definition: COM.h:727
+
variant & operator=(short nSrc) noexcept
Copy from short value.
Definition: COM.h:558
+
variant & operator=(unsigned char *pbSrc) noexcept
Copy from unsigned char reference.
Definition: COM.h:740
+
variant & operator=(unsigned short nSrc) noexcept
Copy from unsigned short value.
Definition: COM.h:571
+
variant & operator=(unsigned char nSrc) noexcept
Copy from unsigned char value.
Definition: COM.h:545
+
variant & operator=(char cSrc) noexcept
Copy from char value.
Definition: COM.h:532
+
variant(LPCOLESTR lpszSrc) noexcept
Constructs VARIANT from OLE string.
Definition: COM.h:426
+
virtual ~variant()
Destroys VARIANT.
Definition: COM.h:485
+
variant(const VARIANT &varSrc)
Constructs VARIANT from another.
Definition: COM.h:274
+
variant(unsigned char nSrc) noexcept
Constructs VARIANT from byte.
Definition: COM.h:313
+
variant & operator=(double dblSrc) noexcept
Copy from double value.
Definition: COM.h:676
+
bool operator!=(const VARIANT &varSrc) const noexcept
Is variant not equal to?
Definition: COM.h:924
+
variant & operator=(int nSrc) noexcept
Copy from int value.
Definition: COM.h:584
+
variant(unsigned long nSrc) noexcept
Constructs VARIANT from unsigned long.
Definition: COM.h:370
+
bool operator==(const VARIANT &varSrc) const noexcept
Is variant equal to?
Definition: COM.h:909
+
variant(IUnknown *pSrc)
Constructs VARIANT from IUnknown.
Definition: COM.h:456
+
variant(unsigned int nSrc, VARTYPE vtSrc=VT_UI4) noexcept
Constructs VARIANT from unsigned integer.
Definition: COM.h:350
+
variant & operator=(CY cySrc) noexcept
Copy from CY value.
Definition: COM.h:689
+
variant & operator=(LPCOLESTR lpszSrc) noexcept
Copy from OLE string value.
Definition: COM.h:703
+
variant(long long nSrc) noexcept
Constructs VARIANT from 64-bit integer.
Definition: COM.h:398
+
variant & operator=(unsigned int *pnSrc) noexcept
Copy from unsigned int reference.
Definition: COM.h:792
+
variant(long nSrc, VARTYPE vtSrc=VT_I4) noexcept
Constructs VARIANT from long.
Definition: COM.h:360
+
variant & operator=(long *pnSrc) noexcept
Copy from long reference.
Definition: COM.h:805
+
variant(unsigned short nSrc) noexcept
Constructs VARIANT from unsigned short.
Definition: COM.h:331
+
bool operator>=(const VARIANT &varSrc) const noexcept
Is variant greater than or equal to?
Definition: COM.h:978
+
variant & operator=(short *pnSrc) noexcept
Copy from short reference.
Definition: COM.h:753
+
variant() noexcept
Constructs blank VARIANT.
Definition: COM.h:266
+
bool operator<(const VARIANT &varSrc) const noexcept
Is variant less than?
Definition: COM.h:937
+
variant(unsigned long long nSrc) noexcept
Constructs VARIANT from unsigned integer.
Definition: COM.h:407
+
variant(char cSrc) noexcept
Constructs VARIANT from character.
Definition: COM.h:304
+
variant & operator=(unsigned short *pnSrc) noexcept
Copy from unsigned short reference.
Definition: COM.h:766
+
variant & operator=(long long *pnSrc) noexcept
Copy from long long reference.
Definition: COM.h:831
+
variant(BSTR bstr) noexcept
Constructs VARIANT from BSTR.
Definition: COM.h:435
+
variant & operator=(unsigned long long *pnSrc) noexcept
Copy from unsigned long long reference.
Definition: COM.h:844
+
variant(double dblSrc, VARTYPE vtSrc=VT_R8) noexcept
Constructs VARIANT from double or variant date.
Definition: COM.h:388
+
variant(short nSrc) noexcept
Constructs VARIANT from short.
Definition: COM.h:322
+
variant(CY cySrc) noexcept
Constructs VARIANT from CY (64-bit integer)
Definition: COM.h:416
+
variant & operator=(unsigned long long nSrc) noexcept
Copy from unsigned long long value.
Definition: COM.h:649
+
variant & operator=(VARIANT &&varSrc) noexcept
Moves from another VARIANT.
Definition: COM.h:506
+
variant & operator=(long long nSrc) noexcept
Copy from long long value.
Definition: COM.h:636
+
variant & operator=(IDispatch *pSrc)
Copy from IDispatch.
Definition: COM.h:714
+
variant & operator=(unsigned long *pnSrc) noexcept
Copy from unsigned long reference.
Definition: COM.h:818
+
variant & operator=(const VARIANT &varSrc)
Copy from another VARIANT.
Definition: COM.h:493
+
static _Check_return_ HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, winstd::com_obj< T > &v)
Creates and default-initializes a single object of the class associated with a specified CLSID.
Definition: COM.h:1075
+
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:66
+
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition: Common.h:74
+
#define WINSTD_DPLHANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:175
+
static const T * invalid
Invalid handle value.
Definition: Common.h:617
+
Deleter for unique_ptr using CoTaskMemFree.
Definition: COM.h:58
+
void operator()(_T *_Ptr) const
Delete a pointer.
Definition: COM.h:70
+
CoTaskMemFree_delete() noexcept
Default constructor.
Definition: COM.h:62
diff --git a/_common_8h.html b/_common_8h.html deleted file mode 100644 index e091f4d4..00000000 --- a/_common_8h.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - - -WinStd: include/WinStd/Common.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
Common.h File Reference
-
-
- -

General API. -More...

-
#include <Windows.h>
-#include <assert.h>
-#include <stdarg.h>
-#include <tchar.h>
-#include <iostream>
-#include <memory>
-#include <stdexcept>
-#include <string>
-#include <vector>
-
-

Go to the source code of this file.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Classes

struct  winstd::LocalFree_delete< _Ty >
 Deleter for unique_ptr using LocalFree. More...
 
struct  winstd::LocalFree_delete< _Ty[]>
 Deleter for unique_ptr to array of unknown size using LocalFree. More...
 
class  winstd::ref_unique_ptr< _Ty, _Dx >
 Helper class for returning pointers to std::unique_ptr. More...
 
class  winstd::ref_unique_ptr< _Ty[], _Dx >
 Helper class for returning pointers to std::unique_ptr (specialization for arrays) More...
 
class  winstd::handle< T, INVAL >
 Base abstract template class to support generic object handle keeping. More...
 
class  winstd::dplhandle< T, INVAL >
 Base abstract template class to support object handle keeping for objects that support trivial handle duplication. More...
 
class  winstd::num_runtime_error< _Tn >
 Numerical runtime error. More...
 
class  winstd::win_runtime_error
 Windows runtime error. More...
 
class  winstd::basic_string_printf< _Elem, _Traits, _Ax >
 Base template class to support string formatting using printf() style templates. More...
 
class  winstd::basic_string_msg< _Elem, _Traits, _Ax >
 Base template class to support string formatting using FormatMessage() style templates. More...
 
class  winstd::basic_string_guid< _Elem, _Traits, _Ax >
 Base template class to support converting GUID to string. More...
 
class  winstd::string_guid
 Single-byte character implementation of a class to support converting GUID to string. More...
 
class  winstd::wstring_guid
 Wide character implementation of a class to support converting GUID to string. More...
 
class  winstd::sanitizing_allocator< _Ty >
 An allocator template that sanitizes each memory block before it is destroyed or reallocated. More...
 
struct  winstd::sanitizing_allocator< _Ty >::rebind< _Other >
 Convert this type to sanitizing_allocator<_Other> More...
 
class  winstd::sanitizing_blob< N >
 Sanitizing BLOB. More...
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Macros

-#define __L(x)   L ## x
 "L" stringizing macro
 
-#define _L(x)   __L(x)
 Makes string Unicode.
 
-#define WINSTD_STRING_IMPL(x)   #x
 Stringizing macro helper.
 
-#define WINSTD_STRING(x)   WINSTD_STRING_IMPL(x)
 Stringizing macro.
 
#define WINSTD_NONCOPYABLE(C)
 Declares a class as non-copyable. More...
 
#define WINSTD_NONMOVABLE(C)
 Declares a class as non-movable. More...
 
#define WINSTD_STACK_BUFFER_BYTES   1024
 Size of the stack buffer in bytes used for initial system function call. More...
 
-#define PRINTF_LPTSTR   "s"
 LPTSTR printf/scanf format specifier.
 
-#define PRINTF_LPOLESTR   "ls"
 LPOLESTR printf/scanf format specifier.
 
#define _tcin   (std::cin )
 Standard input stream for TCHAR strings. More...
 
-#define _tcout   (std::cout)
 Standard output stream for TCHAR strings.
 
-#define _tcerr   (std::cerr)
 Standard error stream for TCHAR strings.
 
-#define _tclog   (std::clog)
 Standard logging stream for TCHAR strings.
 
#define WINSTD_HANDLE_IMPL(C, INVAL)
 Implements default constructors and operators to prevent their auto-generation by compiler. More...
 
#define WINSTD_DPLHANDLE_IMPL(C, INVAL)
 Implements default constructors and operators to prevent their auto-generation by compiler. More...
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Typedefs

-typedef std::string winstd::tstring
 Multi-byte / Wide-character string (according to _UNICODE)
 
-typedef basic_string_printf< char, std::char_traits< char >, std::allocator< char > > winstd::string_printf
 Single-byte character implementation of a class to support string formatting using printf() style templates.
 
-typedef basic_string_printf< wchar_t, std::char_traits< wchar_t >, std::allocator< wchar_t > > winstd::wstring_printf
 Wide character implementation of a class to support string formatting using printf() style templates.
 
-typedef string_printf winstd::tstring_printf
 Multi-byte / Wide-character formatted string (according to _UNICODE)
 
-typedef basic_string_msg< char, std::char_traits< char >, std::allocator< char > > winstd::string_msg
 Single-byte character implementation of a class to support string formatting using FormatMessage() style templates.
 
-typedef basic_string_msg< wchar_t, std::char_traits< wchar_t >, std::allocator< wchar_t > > winstd::wstring_msg
 Wide character implementation of a class to support string formatting using FormatMessage() style templates.
 
-typedef string_msg winstd::tstring_msg
 Multi-byte / Wide-character formatted string (according to _UNICODE)
 
-typedef string_guid winstd::tstring_guid
 Multi-byte / Wide-character string GUID (according to _UNICODE)
 
typedef std::basic_string< char, std::char_traits< char >, sanitizing_allocator< char > > winstd::sanitizing_string
 A sanitizing variant of std::string. More...
 
typedef std::basic_string< wchar_t, std::char_traits< wchar_t >, sanitizing_allocator< wchar_t > > winstd::sanitizing_wstring
 A sanitizing variant of std::wstring. More...
 
-typedef sanitizing_string winstd::sanitizing_tstring
 Multi-byte / Wide-character sanitizing string (according to _UNICODE)
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Functions

static int vsnprintf (char *str, size_t capacity, const char *format, va_list arg)
 Formats string using printf(). More...
 
static int vsnprintf (wchar_t *str, size_t capacity, const wchar_t *format, va_list arg) noexcept
 Formats string using printf(). More...
 
template<class _Elem , class _Traits , class _Ax >
static int vsprintf (std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
 Formats string using printf(). More...
 
template<class _Elem , class _Traits , class _Ax >
static int sprintf (std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
 Formats string using printf(). More...
 
template<class _Traits , class _Ax >
static DWORD FormatMessage (DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, std::basic_string< char, _Traits, _Ax > &str, va_list *Arguments)
 Formats a message string. More...
 
template<class _Traits , class _Ax >
static DWORD FormatMessage (DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, std::basic_string< wchar_t, _Traits, _Ax > &str, va_list *Arguments)
 Formats a message string. More...
 
template<class _Ty , class _Dx >
ref_unique_ptr< _Ty, _Dx > winstd::get_ptr (std::unique_ptr< _Ty, _Dx > &owner) noexcept
 Helper function template for returning pointers to std::unique_ptr. More...
 
template<class _Ty , class _Dx >
ref_unique_ptr< _Ty[], _Dx > winstd::get_ptr (std::unique_ptr< _Ty[], _Dx > &owner) noexcept
 Helper function template for returning pointers to std::unique_ptr (specialization for arrays) More...
 
-

Detailed Description

-

General API.

-
- - - - diff --git a/_common_8h_source.html b/_common_8h_source.html index 38d52265..d7490d64 100644 --- a/_common_8h_source.html +++ b/_common_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,7 +70,7 @@ $(function() {
Common.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
@@ -88,960 +88,960 @@ $(function() {
16#include <string>
17#include <vector>
18
-
43
-
46
-
50#ifndef __L
-
51#define __L(x) L ## x
-
52#endif
-
53
-
57#ifndef _L
-
58#define _L(x) __L(x)
-
59#endif
-
60
-
64#define WINSTD_STRING_IMPL(x) #x
-
65
-
69#define WINSTD_STRING(x) WINSTD_STRING_IMPL(x)
+
35
+
38
+
42#ifndef __L
+
43#define __L(x) L ## x
+
44#endif
+
45
+
49#ifndef _L
+
50#define _L(x) __L(x)
+
51#endif
+
52
+
56#define WINSTD_STRING_IMPL(x) #x
+
57
+
61#define WINSTD_STRING(x) WINSTD_STRING_IMPL(x)
+
62
+
66#define WINSTD_NONCOPYABLE(C) \
+
67private: \
+
68 C (_In_ const C &h) noexcept; \
+
69 C& operator=(_In_ const C &h) noexcept;
70
-
74#define WINSTD_NONCOPYABLE(C) \
+
74#define WINSTD_NONMOVABLE(C) \
75private: \
-
76 C (_In_ const C &h) noexcept; \
-
77 C& operator=(_In_ const C &h) noexcept;
+
76 C (_Inout_ C &&h) noexcept; \
+
77 C& operator=(_Inout_ C &&h) noexcept;
78
-
82#define WINSTD_NONMOVABLE(C) \
-
83private: \
-
84 C (_Inout_ C &&h) noexcept; \
-
85 C& operator=(_Inout_ C &&h) noexcept;
-
86
-
87#ifndef WINSTD_STACK_BUFFER_BYTES
-
101#define WINSTD_STACK_BUFFER_BYTES 1024
-
102#endif
-
103
-
105
-
108
-
112#ifdef UNICODE
-
113#define PRINTF_LPTSTR "ls"
-
114#else
-
115#define PRINTF_LPTSTR "s"
-
116#endif
-
117
-
121#ifdef OLE2ANSI
-
122#define PRINTF_LPOLESTR "hs"
-
123#else
-
124#define PRINTF_LPOLESTR "ls"
-
125#endif
-
126
-
130#ifdef _UNICODE
-
131#define _tcin (std::wcin )
-
132#else
-
133#define _tcin (std::cin )
-
134#endif
-
135
-
139#ifdef _UNICODE
-
140#define _tcout (std::wcout)
-
141#else
-
142#define _tcout (std::cout)
-
143#endif
-
144
-
148#ifdef _UNICODE
-
149#define _tcerr (std::wcerr)
-
150#else
-
151#define _tcerr (std::cerr)
-
152#endif
-
153
-
157#ifdef _UNICODE
-
158#define _tclog (std::wclog)
-
159#else
-
160#define _tclog (std::clog)
-
161#endif
-
162
-
164
-
167
-
171#define WINSTD_HANDLE_IMPL(C, INVAL) \
-
172public: \
-
173 C ( ) noexcept { } \
-
174 C (_In_opt_ handle_type h) noexcept : handle<handle_type, INVAL>( h ) { } \
-
175 C (_Inout_ C &&h) noexcept : handle<handle_type, INVAL>(std::move(h)) { } \
-
176 C& operator=(_In_opt_ handle_type h) noexcept { handle<handle_type, INVAL>::operator=( h ); return *this; } \
-
177 C& operator=(_Inout_ C &&h) noexcept { handle<handle_type, INVAL>::operator=(std::move(h)); return *this; } \
-
178WINSTD_NONCOPYABLE(C)
-
179
-
183#define WINSTD_DPLHANDLE_IMPL(C, INVAL) \
-
184public: \
-
185 C ( ) noexcept { } \
-
186 C (_In_opt_ handle_type h) noexcept : dplhandle<handle_type, INVAL>( h ) { } \
-
187 C (_In_ const C &h) noexcept : dplhandle<handle_type, INVAL>(duplicate_internal(h.m_h)) { } \
-
188 C (_Inout_ C &&h) noexcept : dplhandle<handle_type, INVAL>(std::move (h )) { } \
-
189 C& operator=(_In_opt_ handle_type h) noexcept { dplhandle<handle_type, INVAL>::operator=( h ); return *this; } \
-
190 C& operator=(_In_ const C &h) noexcept { dplhandle<handle_type, INVAL>::operator=( h ); return *this; } \
-
191 C& operator=(_Inout_ C &&h) noexcept { dplhandle<handle_type, INVAL>::operator=(std::move(h)); return *this; } \
-
192private:
-
193
-
195
-
196#ifndef _FormatMessage_format_string_
-
197#define _FormatMessage_format_string_ _In_z_
-
198#endif
-
199
-
201#ifndef _LPCBYTE_DEFINED
-
202#define _LPCBYTE_DEFINED
-
203typedef const BYTE *LPCBYTE;
-
204#endif
-
206
-
207#pragma warning(push)
-
208// Do not use _vsnprintf_s/_vsnwprintf_s(), since it terminates string by force even when we explicitly want to write unterminated string.
-
209// Threfore turn off compiler warning instead. ;)
-
210#pragma warning(disable: 4995)
-
211#pragma warning(disable: 4996)
-
212#pragma warning(disable: 4505) // Don't warn on unused code
-
213
-
216
-
227#if _MSC_VER <= 1600
-
228static int vsnprintf(_Out_z_cap_(capacity) char *str, _In_ size_t capacity, _In_z_ _Printf_format_string_ const char *format, _In_ va_list arg)
-
229{
-
230 return _vsnprintf(str, capacity, format, arg);
-
231}
-
232#endif
-
233
-
244static 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
-
245{
-
246 return _vsnwprintf(str, capacity, format, arg);
-
247}
-
248
-
258template<class _Elem, class _Traits, class _Ax>
-
259static int vsprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, _In_ va_list arg)
-
260{
-
261 _Elem buf[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
-
262
-
263 // Try with stack buffer first.
-
264 int count = vsnprintf(buf, _countof(buf) - 1, format, arg);
-
265 if (count >= 0) {
-
266 // Copy from stack.
-
267 str.assign(buf, count);
-
268 } else {
-
269 for (size_t capacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem);; capacity *= 2) {
-
270 // Allocate on heap and retry.
-
271 auto buf_dyn = std::make_unique<_Elem[]>(capacity);
-
272 count = vsnprintf(buf_dyn.get(), capacity - 1, format, arg);
-
273 if (count >= 0) {
-
274 str.assign(buf_dyn.get(), count);
-
275 break;
-
276 }
-
277 }
-
278 }
-
279
-
280 return count;
-
281}
-
282
-
291template<class _Elem, class _Traits, class _Ax>
-
292static int sprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, ...)
-
293{
-
294 va_list arg;
-
295 va_start(arg, format);
-
296 const int res = vsprintf(str, format, arg);
-
297 va_end(arg);
-
298 return res;
-
299}
-
300
-
306template<class _Traits, class _Ax>
-
307static DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<char, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
-
308{
-
309 std::unique_ptr<CHAR[], winstd::LocalFree_delete<CHAR[]> > lpBuffer;
-
310 DWORD dwResult = FormatMessageA(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPSTR>((LPSTR*)get_ptr(lpBuffer)), 0, Arguments);
-
311 if (dwResult)
-
312 str.assign(lpBuffer.get(), dwResult);
-
313 return dwResult;
-
314}
-
315
-
321template<class _Traits, class _Ax>
-
322static DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
-
323{
-
324 std::unique_ptr<WCHAR[], winstd::LocalFree_delete<WCHAR[]> > lpBuffer;
-
325 DWORD dwResult = FormatMessageW(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPWSTR>((LPWSTR*)get_ptr(lpBuffer)), 0, Arguments);
-
326 if (dwResult)
-
327 str.assign(lpBuffer.get(), dwResult);
-
328 return dwResult;
-
329}
-
330
-
332
-
333#pragma warning(pop)
-
334
-
335namespace winstd
-
336{
-
339
-
343#ifdef _UNICODE
-
344 typedef std::wstring tstring;
-
345#else
-
346 typedef std::string tstring;
-
347#endif
+
79#ifndef WINSTD_STACK_BUFFER_BYTES
+
93#define WINSTD_STACK_BUFFER_BYTES 1024
+
94#endif
+
95
+
97
+
100
+
104#ifdef UNICODE
+
105#define PRINTF_LPTSTR "ls"
+
106#else
+
107#define PRINTF_LPTSTR "s"
+
108#endif
+
109
+
113#ifdef OLE2ANSI
+
114#define PRINTF_LPOLESTR "hs"
+
115#else
+
116#define PRINTF_LPOLESTR "ls"
+
117#endif
+
118
+
122#ifdef _UNICODE
+
123#define _tcin (std::wcin )
+
124#else
+
125#define _tcin (std::cin )
+
126#endif
+
127
+
131#ifdef _UNICODE
+
132#define _tcout (std::wcout)
+
133#else
+
134#define _tcout (std::cout)
+
135#endif
+
136
+
140#ifdef _UNICODE
+
141#define _tcerr (std::wcerr)
+
142#else
+
143#define _tcerr (std::cerr)
+
144#endif
+
145
+
149#ifdef _UNICODE
+
150#define _tclog (std::wclog)
+
151#else
+
152#define _tclog (std::clog)
+
153#endif
+
154
+
156
+
159
+
163#define WINSTD_HANDLE_IMPL(C, INVAL) \
+
164public: \
+
165 C ( ) noexcept { } \
+
166 C (_In_opt_ handle_type h) noexcept : handle<handle_type, INVAL>( h ) { } \
+
167 C (_Inout_ C &&h) noexcept : handle<handle_type, INVAL>(std::move(h)) { } \
+
168 C& operator=(_In_opt_ handle_type h) noexcept { handle<handle_type, INVAL>::operator=( h ); return *this; } \
+
169 C& operator=(_Inout_ C &&h) noexcept { handle<handle_type, INVAL>::operator=(std::move(h)); return *this; } \
+
170WINSTD_NONCOPYABLE(C)
+
171
+
175#define WINSTD_DPLHANDLE_IMPL(C, INVAL) \
+
176public: \
+
177 C ( ) noexcept { } \
+
178 C (_In_opt_ handle_type h) noexcept : dplhandle<handle_type, INVAL>( h ) { } \
+
179 C (_In_ const C &h) noexcept : dplhandle<handle_type, INVAL>(duplicate_internal(h.m_h)) { } \
+
180 C (_Inout_ C &&h) noexcept : dplhandle<handle_type, INVAL>(std::move (h )) { } \
+
181 C& operator=(_In_opt_ handle_type h) noexcept { dplhandle<handle_type, INVAL>::operator=( h ); return *this; } \
+
182 C& operator=(_In_ const C &h) noexcept { dplhandle<handle_type, INVAL>::operator=( h ); return *this; } \
+
183 C& operator=(_Inout_ C &&h) noexcept { dplhandle<handle_type, INVAL>::operator=(std::move(h)); return *this; } \
+
184private:
+
185
+
187
+
188#ifndef _FormatMessage_format_string_
+
189#define _FormatMessage_format_string_ _In_z_
+
190#endif
+
191
+
193#ifndef _LPCBYTE_DEFINED
+
194#define _LPCBYTE_DEFINED
+
195typedef const BYTE *LPCBYTE;
+
196#endif
+
198
+
199#pragma warning(push)
+
200// Do not use _vsnprintf_s/_vsnwprintf_s(), since it terminates string by force even when we explicitly want to write unterminated string.
+
201// Threfore turn off compiler warning instead. ;)
+
202#pragma warning(disable: 4995)
+
203#pragma warning(disable: 4996)
+
204#pragma warning(disable: 4505) // Don't warn on unused code
+
205
+
208
+
219#if _MSC_VER <= 1600
+
220static int vsnprintf(_Out_z_cap_(capacity) char *str, _In_ size_t capacity, _In_z_ _Printf_format_string_ const char *format, _In_ va_list arg)
+
221{
+
222 return _vsnprintf(str, capacity, format, arg);
+
223}
+
224#endif
+
225
+
236static 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
+
237{
+
238 return _vsnwprintf(str, capacity, format, arg);
+
239}
+
240
+
250template<class _Elem, class _Traits, class _Ax>
+
251static int vsprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, _In_ va_list arg)
+
252{
+
253 _Elem buf[WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem)];
+
254
+
255 // Try with stack buffer first.
+
256 int count = vsnprintf(buf, _countof(buf) - 1, format, arg);
+
257 if (count >= 0) {
+
258 // Copy from stack.
+
259 str.assign(buf, count);
+
260 } else {
+
261 for (size_t capacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(_Elem);; capacity *= 2) {
+
262 // Allocate on heap and retry.
+
263 auto buf_dyn = std::make_unique<_Elem[]>(capacity);
+
264 count = vsnprintf(buf_dyn.get(), capacity - 1, format, arg);
+
265 if (count >= 0) {
+
266 str.assign(buf_dyn.get(), count);
+
267 break;
+
268 }
+
269 }
+
270 }
+
271
+
272 return count;
+
273}
+
274
+
283template<class _Elem, class _Traits, class _Ax>
+
284static int sprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_ const _Elem *format, ...)
+
285{
+
286 va_list arg;
+
287 va_start(arg, format);
+
288 const int res = vsprintf(str, format, arg);
+
289 va_end(arg);
+
290 return res;
+
291}
+
292
+
298template<class _Traits, class _Ax>
+
299static DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<char, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
+
300{
+
301 std::unique_ptr<CHAR[], winstd::LocalFree_delete<CHAR[]> > lpBuffer;
+
302 DWORD dwResult = FormatMessageA(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPSTR>((LPSTR*)get_ptr(lpBuffer)), 0, Arguments);
+
303 if (dwResult)
+
304 str.assign(lpBuffer.get(), dwResult);
+
305 return dwResult;
+
306}
+
307
+
313template<class _Traits, class _Ax>
+
314static DWORD FormatMessage(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &str, _In_opt_ va_list *Arguments)
+
315{
+
316 std::unique_ptr<WCHAR[], winstd::LocalFree_delete<WCHAR[]> > lpBuffer;
+
317 DWORD dwResult = FormatMessageW(dwFlags | FORMAT_MESSAGE_ALLOCATE_BUFFER, lpSource, dwMessageId, dwLanguageId, reinterpret_cast<LPWSTR>((LPWSTR*)get_ptr(lpBuffer)), 0, Arguments);
+
318 if (dwResult)
+
319 str.assign(lpBuffer.get(), dwResult);
+
320 return dwResult;
+
321}
+
322
+
324
+
325#pragma warning(pop)
+
326
+
327namespace winstd
+
328{
+
331
+
335#ifdef _UNICODE
+
336 typedef std::wstring tstring;
+
337#else
+
338 typedef std::string tstring;
+
339#endif
+
340
+
344 template <class _Ty>
+ +
346 {
+
348
-
352 template <class _Ty>
- -
354 {
- -
356
- -
361
-
365 template <class _Ty2> LocalFree_delete(const LocalFree_delete<_Ty2>&) {}
-
366
-
372 void operator()(_Ty *_Ptr) const
-
373 {
-
374 LocalFree(_Ptr);
-
375 }
-
376 };
+ +
353
+
357 template <class _Ty2> LocalFree_delete(const LocalFree_delete<_Ty2>&) {}
+
358
+
364 void operator()(_Ty *_Ptr) const
+
365 {
+
366 LocalFree(_Ptr);
+
367 }
+
368 };
+
369
+
373 template <class _Ty>
+
374 struct LocalFree_delete<_Ty[]>
+
375 {
+
377
-
381 template <class _Ty>
-
382 struct LocalFree_delete<_Ty[]>
-
383 {
- -
385
-
389 LocalFree_delete() noexcept {}
+
381 LocalFree_delete() noexcept {}
+
382
+
386 void operator()(_Frees_ptr_opt_ _Ty *_Ptr) const noexcept
+
387 {
+
388 LocalFree(_Ptr);
+
389 }
390
-
394 void operator()(_Frees_ptr_opt_ _Ty *_Ptr) const noexcept
-
395 {
-
396 LocalFree(_Ptr);
-
397 }
-
398
-
404 template<class _Other>
-
405 void operator()(_Other *) const
-
406 {
-
407 LocalFree(_Ptr);
-
408 }
-
409 };
-
410
-
414 template<class _Ty, class _Dx>
- -
416 {
-
417 public:
-
423 ref_unique_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) :
-
424 m_own(owner),
-
425 m_ptr(owner.release())
-
426 {}
-
427
- -
434 m_own(other.m_own),
-
435 m_ptr(other.m_ptr)
+
396 template<class _Other>
+
397 void operator()(_Other *) const
+
398 {
+
399 LocalFree(_Ptr);
+
400 }
+
401 };
+
402
+
406 template<class _Ty, class _Dx>
+ +
408 {
+
409 public:
+
415 ref_unique_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) :
+
416 m_own(owner),
+
417 m_ptr(owner.release())
+
418 {}
+
419
+ +
426 m_own(other.m_own),
+
427 m_ptr(other.m_ptr)
+
428 {
+
429 other.m_ptr = nullptr;
+
430 }
+
431
+
436 {
-
437 other.m_ptr = nullptr;
-
438 }
-
439
- -
444 {
-
445 if (m_ptr != nullptr)
-
446 m_own.reset(m_ptr);
-
447 }
-
448
-
454 operator typename _Ty**()
-
455 {
-
456 return &m_ptr;
-
457 }
-
458
-
464 operator typename _Ty*&()
-
465 {
-
466 return m_ptr;
-
467 }
-
468
-
469 protected:
-
470 std::unique_ptr<_Ty, _Dx> &m_own;
-
471 _Ty *m_ptr;
-
472 };
-
473
-
481 template<class _Ty, class _Dx>
-
482 ref_unique_ptr<_Ty, _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) noexcept
-
483 {
-
484 return ref_unique_ptr<_Ty, _Dx>(owner);
-
485 }
-
486
-
495 template<class _Ty, class _Dx>
-
496 ref_unique_ptr<_Ty[], _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept
-
497 {
-
498 return ref_unique_ptr<_Ty[], _Dx>(owner);
-
499 }
-
500
-
505 #pragma warning(push)
-
506 #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.
-
507 template<class _Ty, class _Dx>
-
508 class ref_unique_ptr<_Ty[], _Dx>
-
509 {
-
510 public:
-
516 ref_unique_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept :
-
517 m_own(owner),
-
518 m_ptr(owner.release())
-
519 {}
-
520
-
528 ref_unique_ptr& operator=(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept
-
529 {
-
530 if (this != &other) {
-
531 m_own = owner;
-
532 m_ptr = owner.release();
-
533 }
-
534
-
535 return *this;
-
536 }
-
537
-
543 ref_unique_ptr(_Inout_ ref_unique_ptr<_Ty[], _Dx> &&other) :
-
544 m_own(other.m_own),
-
545 m_ptr(other.m_ptr)
-
546 {
-
547 other.m_ptr = nullptr;
-
548 }
-
549
-
557 ref_unique_ptr& operator=(_Inout_ ref_unique_ptr<_Ty[], _Dx> &&other)
-
558 {
-
559 if (this != &other) {
-
560 m_own = other.m_own;
-
561 m_ptr = other.m_ptr;
-
562 other.m_ptr = nullptr;
-
563 }
-
564
-
565 return *this;
-
566 }
-
567
- -
572 {
-
573 if (m_ptr != nullptr)
-
574 m_own.reset(m_ptr);
-
575 }
-
576
-
582 operator typename _Ty**() noexcept
-
583 {
-
584 return &m_ptr;
-
585 }
-
586
-
592 operator typename _Ty*&()
-
593 {
-
594 return m_ptr;
-
595 }
+
437 if (m_ptr != nullptr)
+
438 m_own.reset(m_ptr);
+
439 }
+
440
+
446 operator typename _Ty**()
+
447 {
+
448 return &m_ptr;
+
449 }
+
450
+
456 operator typename _Ty*&()
+
457 {
+
458 return m_ptr;
+
459 }
+
460
+
461 protected:
+
462 std::unique_ptr<_Ty, _Dx> &m_own;
+
463 _Ty *m_ptr;
+
464 };
+
465
+
473 template<class _Ty, class _Dx>
+
474 ref_unique_ptr<_Ty, _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty, _Dx> &owner) noexcept
+
475 {
+
476 return ref_unique_ptr<_Ty, _Dx>(owner);
+
477 }
+
478
+
487 template<class _Ty, class _Dx>
+
488 ref_unique_ptr<_Ty[], _Dx> get_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept
+
489 {
+
490 return ref_unique_ptr<_Ty[], _Dx>(owner);
+
491 }
+
492
+
497 #pragma warning(push)
+
498 #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.
+
499 template<class _Ty, class _Dx>
+
500 class ref_unique_ptr<_Ty[], _Dx>
+
501 {
+
502 public:
+
508 ref_unique_ptr(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept :
+
509 m_own(owner),
+
510 m_ptr(owner.release())
+
511 {}
+
512
+
520 ref_unique_ptr& operator=(_Inout_ std::unique_ptr<_Ty[], _Dx> &owner) noexcept
+
521 {
+
522 if (this != &other) {
+
523 m_own = owner;
+
524 m_ptr = owner.release();
+
525 }
+
526
+
527 return *this;
+
528 }
+
529
+
535 ref_unique_ptr(_Inout_ ref_unique_ptr<_Ty[], _Dx> &&other) :
+
536 m_own(other.m_own),
+
537 m_ptr(other.m_ptr)
+
538 {
+
539 other.m_ptr = nullptr;
+
540 }
+
541
+
549 ref_unique_ptr& operator=(_Inout_ ref_unique_ptr<_Ty[], _Dx> &&other)
+
550 {
+
551 if (this != &other) {
+
552 m_own = other.m_own;
+
553 m_ptr = other.m_ptr;
+
554 other.m_ptr = nullptr;
+
555 }
+
556
+
557 return *this;
+
558 }
+
559
+ +
564 {
+
565 if (m_ptr != nullptr)
+
566 m_own.reset(m_ptr);
+
567 }
+
568
+
574 operator typename _Ty**() noexcept
+
575 {
+
576 return &m_ptr;
+
577 }
+
578
+
584 operator typename _Ty*&()
+
585 {
+
586 return m_ptr;
+
587 }
+
588
+
589 protected:
+
590 std::unique_ptr<_Ty[], _Dx> &m_own;
+
591 _Ty *m_ptr;
+
592 };
+
593 #pragma warning(pop)
+
594
596
-
597 protected:
-
598 std::unique_ptr<_Ty[], _Dx> &m_own;
-
599 _Ty *m_ptr;
-
600 };
-
601 #pragma warning(pop)
-
602
-
604
-
607
-
613 template <class T, const T INVAL>
-
614 class handle
-
615 {
-
616 public:
-
620 typedef T handle_type;
-
621
-
625 static const T invalid;
-
626
-
630 handle() noexcept : m_h(invalid)
-
631 {
-
632 }
-
633
-
639 handle(_In_opt_ handle_type h) noexcept : m_h(h)
-
640 {
-
641 }
-
642
-
648 handle(_Inout_ handle<handle_type, INVAL> &&h) noexcept
-
649 {
-
650 // Transfer handle.
-
651 m_h = h.m_h;
-
652 h.m_h = invalid;
-
653 }
-
654
-
655 private:
-
656 // This class is noncopyable.
-
657 handle(_In_ const handle<handle_type, INVAL> &h) noexcept {};
-
658 handle<handle_type, INVAL>& operator=(_In_ const handle<handle_type, INVAL> &h) noexcept {};
-
659
-
660 public:
- -
667 {
-
668 attach(h);
-
669 return *this;
-
670 }
-
671
-
677 #pragma warning(suppress: 26432) // Move constructor is also present, but not detected by code analysis somehow.
- -
679 {
-
680 if (this != std::addressof(h)) {
-
681 // Transfer handle.
-
682 if (m_h != invalid)
- -
684 m_h = h.m_h;
-
685 h.m_h = invalid;
-
686 }
-
687 return *this;
-
688 }
-
689
-
695 operator handle_type() const
-
696 {
-
697 return m_h;
-
698 }
-
699
- -
706 {
-
707 assert(m_h != invalid);
-
708 return *m_h;
-
709 }
-
710
- -
716 {
-
717 assert(m_h == invalid);
-
718 return &m_h;
-
719 }
-
720
- -
727 {
-
728 assert(m_h != invalid);
-
729 return m_h;
-
730 }
-
731
-
739 bool operator!() const
-
740 {
-
741 return m_h == invalid;
-
742 }
-
743
-
752 bool operator<(_In_opt_ handle_type h) const
-
753 {
-
754 return m_h < h;
-
755 }
-
756
-
765 bool operator<=(_In_opt_ handle_type h) const
-
766 {
-
767 return !operator>(h);
-
768 }
-
769
-
778 bool operator>=(_In_opt_ handle_type h) const
-
779 {
-
780 return !operator<(h);
-
781 }
-
782
-
791 bool operator>(_In_opt_ handle_type h) const
-
792 {
-
793 return h < m_h;
-
794 }
-
795
-
804 bool operator!=(_In_opt_ handle_type h) const
-
805 {
-
806 return !operator==(h);
-
807 }
-
808
-
817 bool operator==(_In_opt_ handle_type h) const
-
818 {
-
819 return m_h == h;
-
820 }
-
821
-
829 void attach(_In_opt_ handle_type h) noexcept
-
830 {
-
831 if (m_h != invalid)
- -
833 m_h = h;
-
834 }
-
835
- -
842 {
-
843 handle_type h = m_h;
-
844 m_h = invalid;
-
845 return h;
-
846 }
-
847
-
851 void free()
-
852 {
-
853 if (m_h != invalid) {
- -
855 m_h = invalid;
-
856 }
-
857 }
-
858
-
859 protected:
-
863 virtual void free_internal() noexcept = 0;
-
864
-
865 protected:
- -
867 };
-
868
-
869 template <class T, const T INVAL>
-
870 const T handle<T, INVAL>::invalid = INVAL;
-
871
-
875 template <class T, T INVAL>
-
876 class dplhandle : public handle<T, INVAL>
-
877 {
-
878 public:
-
882 dplhandle() noexcept
-
883 {
-
884 }
-
885
- -
892 {
-
893 }
-
894
-
900 dplhandle<handle_type, INVAL>(_In_ const dplhandle<handle_type, INVAL> &h) noexcept : handle<handle_type, INVAL>(duplicate_internal(h.m_h))
-
901 {
-
902 }
-
903
-
909 dplhandle<handle_type, INVAL>(_Inout_ dplhandle<handle_type, INVAL> &&h) noexcept : handle<handle_type, INVAL>(std::move(h))
-
910 {
-
911 }
-
912
- -
919 {
- -
921 return *this;
-
922 }
-
923
- -
930 {
-
931 if (this != std::addressof(h)) {
-
932 if (h.m_h != invalid) {
-
933 handle_type h_new = duplicate_internal(h.m_h);
-
934 if (h_new != invalid) {
-
935 if (m_h != invalid)
- -
937
-
938 m_h = h_new;
-
939 } else
-
940 assert(0); // Could not duplicate the handle
-
941 } else {
-
942 if (m_h != invalid)
- -
944
-
945 m_h = invalid;
-
946 }
-
947 }
-
948 return *this;
-
949 }
-
950
-
956 #pragma warning(disable: 26432) // Move constructor is also present, but not detected by code analysis somehow.
- -
958 {
- -
960 return *this;
-
961 }
-
962
- -
969 {
-
970 return m_h != invalid ? duplicate_internal(m_h) : invalid;
-
971 }
-
972
- -
983 {
-
984 if (m_h != invalid)
- -
986
-
987 return h != invalid ? (m_h = duplicate_internal(h)) != invalid : (m_h = invalid, true);
-
988 }
-
989
-
990 protected:
-
998 virtual handle_type duplicate_internal(_In_ handle_type h) const noexcept = 0;
-
999 };
-
1000
-
1002
-
1005
-
1009 template <typename _Tn>
-
1010 class num_runtime_error : public std::runtime_error
-
1011 {
-
1012 public:
-
1013 typedef _Tn error_type;
-
1014
-
1015 public:
-
1022 num_runtime_error(_In_ error_type num, _In_ const std::string& msg) :
-
1023 m_num(num),
-
1024 runtime_error(msg)
-
1025 {
-
1026 }
-
1027
-
1034 num_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) :
-
1035 m_num(num),
-
1036 runtime_error(msg)
-
1037 {
+
599
+
605 template <class T, const T INVAL>
+
606 class handle
+
607 {
+
608 public:
+
612 typedef T handle_type;
+
613
+
617 static const T invalid;
+
618
+
622 handle() noexcept : m_h(invalid)
+
623 {
+
624 }
+
625
+
631 handle(_In_opt_ handle_type h) noexcept : m_h(h)
+
632 {
+
633 }
+
634
+
640 handle(_Inout_ handle<handle_type, INVAL> &&h) noexcept
+
641 {
+
642 // Transfer handle.
+
643 m_h = h.m_h;
+
644 h.m_h = invalid;
+
645 }
+
646
+
647 private:
+
648 // This class is noncopyable.
+
649 handle(_In_ const handle<handle_type, INVAL> &h) noexcept {};
+
650 handle<handle_type, INVAL>& operator=(_In_ const handle<handle_type, INVAL> &h) noexcept {};
+
651
+
652 public:
+ +
659 {
+
660 attach(h);
+
661 return *this;
+
662 }
+
663
+
669 #pragma warning(suppress: 26432) // Move constructor is also present, but not detected by code analysis somehow.
+ +
671 {
+
672 if (this != std::addressof(h)) {
+
673 // Transfer handle.
+
674 if (m_h != invalid)
+ +
676 m_h = h.m_h;
+
677 h.m_h = invalid;
+
678 }
+
679 return *this;
+
680 }
+
681
+
687 operator handle_type() const
+
688 {
+
689 return m_h;
+
690 }
+
691
+ +
698 {
+
699 assert(m_h != invalid);
+
700 return *m_h;
+
701 }
+
702
+ +
708 {
+
709 assert(m_h == invalid);
+
710 return &m_h;
+
711 }
+
712
+ +
719 {
+
720 assert(m_h != invalid);
+
721 return m_h;
+
722 }
+
723
+
731 bool operator!() const
+
732 {
+
733 return m_h == invalid;
+
734 }
+
735
+
744 bool operator<(_In_opt_ handle_type h) const
+
745 {
+
746 return m_h < h;
+
747 }
+
748
+
757 bool operator<=(_In_opt_ handle_type h) const
+
758 {
+
759 return !operator>(h);
+
760 }
+
761
+
770 bool operator>=(_In_opt_ handle_type h) const
+
771 {
+
772 return !operator<(h);
+
773 }
+
774
+
783 bool operator>(_In_opt_ handle_type h) const
+
784 {
+
785 return h < m_h;
+
786 }
+
787
+
796 bool operator!=(_In_opt_ handle_type h) const
+
797 {
+
798 return !operator==(h);
+
799 }
+
800
+
809 bool operator==(_In_opt_ handle_type h) const
+
810 {
+
811 return m_h == h;
+
812 }
+
813
+
821 void attach(_In_opt_ handle_type h) noexcept
+
822 {
+
823 if (m_h != invalid)
+ +
825 m_h = h;
+
826 }
+
827
+ +
834 {
+
835 handle_type h = m_h;
+
836 m_h = invalid;
+
837 return h;
+
838 }
+
839
+
843 void free()
+
844 {
+
845 if (m_h != invalid) {
+ +
847 m_h = invalid;
+
848 }
+
849 }
+
850
+
851 protected:
+
855 virtual void free_internal() noexcept = 0;
+
856
+
857 protected:
+ +
859 };
+
860
+
861 template <class T, const T INVAL>
+
862 const T handle<T, INVAL>::invalid = INVAL;
+
863
+
867 template <class T, T INVAL>
+
868 class dplhandle : public handle<T, INVAL>
+
869 {
+
870 public:
+
874 dplhandle() noexcept
+
875 {
+
876 }
+
877
+ +
884 {
+
885 }
+
886
+
892 dplhandle<handle_type, INVAL>(_In_ const dplhandle<handle_type, INVAL> &h) noexcept : handle<handle_type, INVAL>(duplicate_internal(h.m_h))
+
893 {
+
894 }
+
895
+
901 dplhandle<handle_type, INVAL>(_Inout_ dplhandle<handle_type, INVAL> &&h) noexcept : handle<handle_type, INVAL>(std::move(h))
+
902 {
+
903 }
+
904
+ +
911 {
+ +
913 return *this;
+
914 }
+
915
+ +
922 {
+
923 if (this != std::addressof(h)) {
+
924 if (h.m_h != invalid) {
+
925 handle_type h_new = duplicate_internal(h.m_h);
+
926 if (h_new != invalid) {
+
927 if (m_h != invalid)
+ +
929
+
930 m_h = h_new;
+
931 } else
+
932 assert(0); // Could not duplicate the handle
+
933 } else {
+
934 if (m_h != invalid)
+ +
936
+
937 m_h = invalid;
+
938 }
+
939 }
+
940 return *this;
+
941 }
+
942
+
948 #pragma warning(disable: 26432) // Move constructor is also present, but not detected by code analysis somehow.
+ +
950 {
+ +
952 return *this;
+
953 }
+
954
+ +
961 {
+
962 return m_h != invalid ? duplicate_internal(m_h) : invalid;
+
963 }
+
964
+ +
975 {
+
976 if (m_h != invalid)
+ +
978
+
979 return h != invalid ? (m_h = duplicate_internal(h)) != invalid : (m_h = invalid, true);
+
980 }
+
981
+
982 protected:
+
990 virtual handle_type duplicate_internal(_In_ handle_type h) const noexcept = 0;
+
991 };
+
992
+
994
+
997
+
1001 template <typename _Tn>
+
1002 class num_runtime_error : public std::runtime_error
+
1003 {
+
1004 public:
+
1005 typedef _Tn error_type;
+
1006
+
1007 public:
+
1014 num_runtime_error(_In_ error_type num, _In_ const std::string& msg) :
+
1015 m_num(num),
+
1016 runtime_error(msg)
+
1017 {
+
1018 }
+
1019
+
1026 num_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) :
+
1027 m_num(num),
+
1028 runtime_error(msg)
+
1029 {
+
1030 }
+
1031
+ +
1036 {
+
1037 return m_num;
1038 }
1039
- -
1044 {
-
1045 return m_num;
-
1046 }
-
1047
-
1048 protected:
- -
1050 };
-
1051
- -
1056 {
-
1057 public:
-
1064 win_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<DWORD>(num, msg)
-
1065 {
-
1066 }
-
1067
-
1074 win_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<DWORD>(num, msg)
-
1075 {
-
1076 }
-
1077
-
1083 win_runtime_error(_In_ const std::string& msg) : num_runtime_error<DWORD>(GetLastError(), msg)
-
1084 {
-
1085 }
-
1086
-
1092 win_runtime_error(_In_opt_z_ const char *msg = nullptr) : num_runtime_error<DWORD>(GetLastError(), msg)
-
1093 {
-
1094 }
-
1095
-
1101 tstring msg(_In_opt_ DWORD dwLanguageId = 0) const
-
1102 {
-
1103 tstring str;
-
1104 if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, m_num, dwLanguageId, str, NULL)) {
-
1105 // Stock Windows error messages contain CRLF. Well... Trim all the trailing white space.
-
1106 str.erase(str.find_last_not_of(_T(" \t\n\r\f\v")) + 1);
-
1107 } else
-
1108 sprintf(str, m_num >= 0x10000 ? _T("Error 0x%X") : _T("Error %u"), m_num);
-
1109 return str;
-
1110 }
-
1111 };
-
1112
-
1114
-
1117
-
1121 template<class _Elem, class _Traits, class _Ax>
-
1122 class basic_string_printf : public std::basic_string<_Elem, _Traits, _Ax>
-
1123 {
-
1124 public:
-
1127
-
1133 basic_string_printf(_In_z_ _Printf_format_string_ const _Elem *format, ...)
-
1134 {
-
1135 va_list arg;
-
1136 va_start(arg, format);
-
1137 vsprintf(*this, format, arg);
-
1138 va_end(arg);
-
1139 }
-
1140
-
1142
-
1145
-
1152 basic_string_printf(_In_ HINSTANCE hInstance, _In_ UINT nFormatID, ...)
-
1153 {
-
1154 _Myt format;
-
1155 ATLENSURE(format.LoadString(hInstance, nFormatID));
-
1156
-
1157 va_list arg;
-
1158 va_start(arg, nFormatID);
-
1159 vsprintf(*this, format, arg);
-
1160 va_end(arg);
-
1161 }
-
1162
-
1170 basic_string_printf(_In_ HINSTANCE hInstance, _In_ WORD wLanguageID, _In_ UINT nFormatID, ...)
-
1171 {
-
1172 _Myt format;
-
1173 ATLENSURE(format.LoadString(hInstance, nFormatID, wLanguageID));
-
1174
-
1175 va_list arg;
-
1176 va_start(arg, nFormatID);
-
1177 vsprintf(*this, format, arg);
-
1178 va_end(arg);
-
1179 }
+
1040 protected:
+ +
1042 };
+
1043
+ +
1048 {
+
1049 public:
+
1056 win_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<DWORD>(num, msg)
+
1057 {
+
1058 }
+
1059
+
1066 win_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<DWORD>(num, msg)
+
1067 {
+
1068 }
+
1069
+
1075 win_runtime_error(_In_ const std::string& msg) : num_runtime_error<DWORD>(GetLastError(), msg)
+
1076 {
+
1077 }
+
1078
+
1084 win_runtime_error(_In_opt_z_ const char *msg = nullptr) : num_runtime_error<DWORD>(GetLastError(), msg)
+
1085 {
+
1086 }
+
1087
+
1093 tstring msg(_In_opt_ DWORD dwLanguageId = 0) const
+
1094 {
+
1095 tstring str;
+
1096 if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, m_num, dwLanguageId, str, NULL)) {
+
1097 // Stock Windows error messages contain CRLF. Well... Trim all the trailing white space.
+
1098 str.erase(str.find_last_not_of(_T(" \t\n\r\f\v")) + 1);
+
1099 } else
+
1100 sprintf(str, m_num >= 0x10000 ? _T("Error 0x%X") : _T("Error %u"), m_num);
+
1101 return str;
+
1102 }
+
1103 };
+
1104
+
1106
+
1109
+
1113 template<class _Elem, class _Traits, class _Ax>
+
1114 class basic_string_printf : public std::basic_string<_Elem, _Traits, _Ax>
+
1115 {
+
1116 public:
+
1119
+
1125 basic_string_printf(_In_z_ _Printf_format_string_ const _Elem *format, ...)
+
1126 {
+
1127 va_list arg;
+
1128 va_start(arg, format);
+
1129 vsprintf(*this, format, arg);
+
1130 va_end(arg);
+
1131 }
+
1132
+
1134
+
1137
+
1144 basic_string_printf(_In_ HINSTANCE hInstance, _In_ UINT nFormatID, ...)
+
1145 {
+
1146 _Myt format;
+
1147 ATLENSURE(format.LoadString(hInstance, nFormatID));
+
1148
+
1149 va_list arg;
+
1150 va_start(arg, nFormatID);
+
1151 vsprintf(*this, format, arg);
+
1152 va_end(arg);
+
1153 }
+
1154
+
1162 basic_string_printf(_In_ HINSTANCE hInstance, _In_ WORD wLanguageID, _In_ UINT nFormatID, ...)
+
1163 {
+
1164 _Myt format;
+
1165 ATLENSURE(format.LoadString(hInstance, nFormatID, wLanguageID));
+
1166
+
1167 va_list arg;
+
1168 va_start(arg, nFormatID);
+
1169 vsprintf(*this, format, arg);
+
1170 va_end(arg);
+
1171 }
+
1172
+
1174 };
+
1175
+
1180
-
1182 };
-
1183
- -
1188
- -
1193
-
1197#ifdef _UNICODE
- -
1199#else
- -
1201#endif
-
1202
-
1206 template<class _Elem, class _Traits, class _Ax>
-
1207 class basic_string_msg : public std::basic_string<_Elem, _Traits, _Ax>
-
1208 {
-
1209 public:
-
1212
-
1218 basic_string_msg(_In_z_ _FormatMessage_format_string_ const _Elem *format, ...)
-
1219 {
-
1220 va_list arg;
-
1221 va_start(arg, format);
-
1222 FormatMessage(FORMAT_MESSAGE_FROM_STRING, format, 0, 0, *this, &arg);
-
1223 va_end(arg);
-
1224 }
-
1225
-
1227
-
1230
-
1237 basic_string_msg(_In_ HINSTANCE hInstance, _In_ UINT nFormatID, ...)
-
1238 {
-
1239 _Myt format(GetManager());
-
1240 ATLENSURE(format.LoadString(hInstance, nFormatID));
-
1241
-
1242 va_list arg;
-
1243 va_start(arg, nFormatID);
-
1244 FormatMessage(FORMAT_MESSAGE_FROM_STRING, format, 0, 0, *this, &arg);
-
1245 va_end(arg);
-
1246 }
-
1247
-
1255 basic_string_msg(_In_ HINSTANCE hInstance, _In_ WORD wLanguageID, _In_ UINT nFormatID, ...)
-
1256 {
-
1257 _Myt format(GetManager());
-
1258 ATLENSURE(format.LoadString(hInstance, nFormatID, wLanguageID));
+ +
1185
+
1189#ifdef _UNICODE
+ +
1191#else
+ +
1193#endif
+
1194
+
1198 template<class _Elem, class _Traits, class _Ax>
+
1199 class basic_string_msg : public std::basic_string<_Elem, _Traits, _Ax>
+
1200 {
+
1201 public:
+
1204
+
1210 basic_string_msg(_In_z_ _FormatMessage_format_string_ const _Elem *format, ...)
+
1211 {
+
1212 va_list arg;
+
1213 va_start(arg, format);
+
1214 FormatMessage(FORMAT_MESSAGE_FROM_STRING, format, 0, 0, *this, &arg);
+
1215 va_end(arg);
+
1216 }
+
1217
+
1219
+
1222
+
1229 basic_string_msg(_In_ HINSTANCE hInstance, _In_ UINT nFormatID, ...)
+
1230 {
+
1231 _Myt format(GetManager());
+
1232 ATLENSURE(format.LoadString(hInstance, nFormatID));
+
1233
+
1234 va_list arg;
+
1235 va_start(arg, nFormatID);
+
1236 FormatMessage(FORMAT_MESSAGE_FROM_STRING, format, 0, 0, *this, &arg);
+
1237 va_end(arg);
+
1238 }
+
1239
+
1247 basic_string_msg(_In_ HINSTANCE hInstance, _In_ WORD wLanguageID, _In_ UINT nFormatID, ...)
+
1248 {
+
1249 _Myt format(GetManager());
+
1250 ATLENSURE(format.LoadString(hInstance, nFormatID, wLanguageID));
+
1251
+
1252 va_list arg;
+
1253 va_start(arg, nFormatID);
+
1254 FormatMessage(FORMAT_MESSAGE_FROM_STRING, format, 0, 0, *this, &arg);
+
1255 va_end(arg);
+
1256 }
+
1257
1259
-
1260 va_list arg;
-
1261 va_start(arg, nFormatID);
-
1262 FormatMessage(FORMAT_MESSAGE_FROM_STRING, format, 0, 0, *this, &arg);
-
1263 va_end(arg);
-
1264 }
-
1265
-
1267
-
1273 basic_string_msg(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _In_opt_ va_list *Arguments)
-
1274 {
-
1275 FormatMessage(dwFlags & ~FORMAT_MESSAGE_ARGUMENT_ARRAY, lpSource, dwMessageId, dwLanguageId, *this, Arguments);
-
1276 }
-
1277
-
1283 basic_string_msg(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _In_opt_ DWORD_PTR *Arguments)
-
1284 {
-
1285 FormatMessage(dwFlags | FORMAT_MESSAGE_ARGUMENT_ARRAY, lpSource, dwMessageId, dwLanguageId, *this, (va_list*)Arguments);
-
1286 }
-
1287
-
1293 basic_string_msg(_In_ DWORD dwFlags, _In_z_ LPCTSTR pszFormat, _In_opt_ va_list *Arguments)
-
1294 {
-
1295 FormatMessage(dwFlags & ~FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_FROM_STRING, pszFormat, 0, 0, *this, Arguments);
-
1296 }
-
1297
-
1303 basic_string_msg(_In_ DWORD dwFlags, _In_z_ LPCTSTR pszFormat, _In_opt_ DWORD_PTR *Arguments)
-
1304 {
-
1305 FormatMessage(dwFlags | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_FROM_STRING, pszFormat, 0, 0, *this, (va_list*)Arguments);
-
1306 }
-
1307 };
-
1308
- -
1313
- -
1318
-
1322#ifdef _UNICODE
-
1323 typedef wstring_msg tstring_msg;
-
1324#else
- -
1326#endif
-
1327
-
1331 template<class _Elem, class _Traits, class _Ax>
-
1332 class basic_string_guid : public std::basic_string<_Elem, _Traits, _Ax>
-
1333 {
-
1334 public:
-
1337
-
1344 basic_string_guid(_In_ const GUID &guid, _In_z_ _Printf_format_string_ const _Elem *format)
-
1345 {
-
1346 sprintf<_Elem, _Traits, _Ax>(*this, format,
-
1347 guid.Data1,
-
1348 guid.Data2,
-
1349 guid.Data3,
-
1350 guid.Data4[0], guid.Data4[1],
-
1351 guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
-
1352 }
-
1353
-
1355 };
-
1356
-
1360 class string_guid : public basic_string_guid<char, std::char_traits<char>, std::allocator<char> >
-
1361 {
-
1362 public:
-
1365
-
1371 string_guid(_In_ const GUID &guid) :
-
1372 basic_string_guid<char, std::char_traits<char>, std::allocator<char> >(guid, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}")
-
1373 {
-
1374 }
-
1375
-
1377 };
-
1378
-
1382 class wstring_guid : public basic_string_guid<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >
-
1383 {
-
1384 public:
-
1387
-
1393 wstring_guid(_In_ const GUID &guid) :
-
1394 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}")
-
1395 {
-
1396 }
-
1397
-
1399 };
-
1400
-
1404#ifdef _UNICODE
-
1405 typedef wstring_guid tstring_guid;
-
1406#else
- -
1408#endif
-
1409
-
1411
-
1414
-
1415 // winstd::sanitizing_allocator::destroy() member generates _Ptr parameter not used warning for primitive datatypes _Ty.
-
1416 #pragma warning(push)
-
1417 #pragma warning(disable: 4100)
-
1418
-
1426 template<class _Ty>
-
1427 class sanitizing_allocator : public std::allocator<_Ty>
-
1428 {
-
1429 public:
-
1430 typedef std::allocator<_Ty> _Mybase;
-
1431
-
1435 template<class _Other>
-
1436 struct rebind
+
1265 basic_string_msg(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _In_opt_ va_list *Arguments)
+
1266 {
+
1267 FormatMessage(dwFlags & ~FORMAT_MESSAGE_ARGUMENT_ARRAY, lpSource, dwMessageId, dwLanguageId, *this, Arguments);
+
1268 }
+
1269
+
1275 basic_string_msg(_In_ DWORD dwFlags, _In_opt_ LPCVOID lpSource, _In_ DWORD dwMessageId, _In_ DWORD dwLanguageId, _In_opt_ DWORD_PTR *Arguments)
+
1276 {
+
1277 FormatMessage(dwFlags | FORMAT_MESSAGE_ARGUMENT_ARRAY, lpSource, dwMessageId, dwLanguageId, *this, (va_list*)Arguments);
+
1278 }
+
1279
+
1285 basic_string_msg(_In_ DWORD dwFlags, _In_z_ LPCTSTR pszFormat, _In_opt_ va_list *Arguments)
+
1286 {
+
1287 FormatMessage(dwFlags & ~FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_FROM_STRING, pszFormat, 0, 0, *this, Arguments);
+
1288 }
+
1289
+
1295 basic_string_msg(_In_ DWORD dwFlags, _In_z_ LPCTSTR pszFormat, _In_opt_ DWORD_PTR *Arguments)
+
1296 {
+
1297 FormatMessage(dwFlags | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_FROM_STRING, pszFormat, 0, 0, *this, (va_list*)Arguments);
+
1298 }
+
1299 };
+
1300
+ +
1305
+ +
1310
+
1314#ifdef _UNICODE
+
1315 typedef wstring_msg tstring_msg;
+
1316#else
+ +
1318#endif
+
1319
+
1323 template<class _Elem, class _Traits, class _Ax>
+
1324 class basic_string_guid : public std::basic_string<_Elem, _Traits, _Ax>
+
1325 {
+
1326 public:
+
1329
+
1336 basic_string_guid(_In_ const GUID &guid, _In_z_ _Printf_format_string_ const _Elem *format)
+
1337 {
+
1338 sprintf<_Elem, _Traits, _Ax>(*this, format,
+
1339 guid.Data1,
+
1340 guid.Data2,
+
1341 guid.Data3,
+
1342 guid.Data4[0], guid.Data4[1],
+
1343 guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
+
1344 }
+
1345
+
1347 };
+
1348
+
1352 class string_guid : public basic_string_guid<char, std::char_traits<char>, std::allocator<char> >
+
1353 {
+
1354 public:
+
1357
+
1363 string_guid(_In_ const GUID &guid) :
+
1364 basic_string_guid<char, std::char_traits<char>, std::allocator<char> >(guid, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}")
+
1365 {
+
1366 }
+
1367
+
1369 };
+
1370
+
1374 class wstring_guid : public basic_string_guid<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >
+
1375 {
+
1376 public:
+
1379
+
1385 wstring_guid(_In_ const GUID &guid) :
+
1386 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}")
+
1387 {
+
1388 }
+
1389
+
1391 };
+
1392
+
1396#ifdef _UNICODE
+
1397 typedef wstring_guid tstring_guid;
+
1398#else
+ +
1400#endif
+
1401
+
1403
+
1406
+
1407 // winstd::sanitizing_allocator::destroy() member generates _Ptr parameter not used warning for primitive datatypes _Ty.
+
1408 #pragma warning(push)
+
1409 #pragma warning(disable: 4100)
+
1410
+
1418 template<class _Ty>
+
1419 class sanitizing_allocator : public std::allocator<_Ty>
+
1420 {
+
1421 public:
+
1422 typedef std::allocator<_Ty> _Mybase;
+
1423
+
1427 template<class _Other>
+
1428 struct rebind
+
1429 {
+ +
1431 };
+
1432
+
1437 {
- -
1439 };
-
1440
- -
1445 {
-
1446 }
-
1447
- +
1438 }
+
1439
+ +
1444 {
+
1445 }
+
1446
+
1450 template<class _Other>
+
1451 sanitizing_allocator(_In_ const sanitizing_allocator<_Other> &_Othr) noexcept : _Mybase(_Othr)
1452 {
1453 }
1454
-
1458 template<class _Other>
-
1459 sanitizing_allocator(_In_ const sanitizing_allocator<_Other> &_Othr) noexcept : _Mybase(_Othr)
-
1460 {
-
1461 }
-
1462
-
1466 void deallocate(_In_ pointer _Ptr, _In_ size_type _Size)
-
1467 {
-
1468 // Sanitize then free.
-
1469 SecureZeroMemory(_Ptr, _Size);
-
1470 _Mybase::deallocate(_Ptr, _Size);
-
1471 }
-
1472 };
-
1473
-
1474 #pragma warning(pop)
-
1475
-
1483 typedef std::basic_string<char, std::char_traits<char>, sanitizing_allocator<char> > sanitizing_string;
-
1484
-
1492 typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, sanitizing_allocator<wchar_t> > sanitizing_wstring;
-
1493
-
1497#ifdef _UNICODE
- -
1499#else
- -
1501#endif
-
1502
-
1506 template<size_t N>
- -
1508 {
-
1509 public:
- +
1458 void deallocate(_In_ pointer _Ptr, _In_ size_type _Size)
+
1459 {
+
1460 // Sanitize then free.
+
1461 SecureZeroMemory(_Ptr, _Size);
+
1462 _Mybase::deallocate(_Ptr, _Size);
+
1463 }
+
1464 };
+
1465
+
1466 #pragma warning(pop)
+
1467
+
1475 typedef std::basic_string<char, std::char_traits<char>, sanitizing_allocator<char> > sanitizing_string;
+
1476
+
1484 typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, sanitizing_allocator<wchar_t> > sanitizing_wstring;
+
1485
+
1489#ifdef _UNICODE
+ +
1491#else
+ +
1493#endif
+
1494
+
1498 template<size_t N>
+ +
1500 {
+
1501 public:
+ +
1506 {
+
1507 ZeroMemory(m_data, N);
+
1508 }
+
1509
+
1514 {
-
1515 ZeroMemory(m_data, N);
+
1515 SecureZeroMemory(m_data, N);
1516 }
1517
- -
1522 {
-
1523 SecureZeroMemory(m_data, N);
-
1524 }
-
1525
-
1526 public:
-
1527 unsigned char m_data[N];
-
1528 };
-
1529
-
1531}
-
Base template class to support converting GUID to string.
Definition: Common.h:1333
-
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:1344
-
Base template class to support string formatting using FormatMessage() style templates.
Definition: Common.h:1208
-
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:1283
-
basic_string_msg(DWORD dwFlags, LPCTSTR pszFormat, va_list *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition: Common.h:1293
-
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:1255
-
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:1273
-
basic_string_msg(const _Elem *format,...)
Initializes a new string and formats its contents using FormatMessage() style template.
Definition: Common.h:1218
-
basic_string_msg(HINSTANCE hInstance, UINT nFormatID,...)
Initializes a new string and formats its contents using FormatMessage() style template in resources.
Definition: Common.h:1237
-
basic_string_msg(DWORD dwFlags, LPCTSTR pszFormat, DWORD_PTR *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition: Common.h:1303
-
Base template class to support string formatting using printf() style templates.
Definition: Common.h:1123
-
basic_string_printf(const _Elem *format,...)
Initializes a new string and formats its contents using printf() style template.
Definition: Common.h:1133
-
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:1170
-
basic_string_printf(HINSTANCE hInstance, UINT nFormatID,...)
Initializes a new string and formats its contents using printf() style template in resources.
Definition: Common.h:1152
-
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition: Common.h:877
-
dplhandle< handle_type, INVAL > & operator=(handle_type h) noexcept
Attaches already available object handle.
Definition: Common.h:918
-
handle_type duplicate() const
Duplicates and returns a new object handle.
Definition: Common.h:968
-
dplhandle< handle_type, INVAL > & operator=(dplhandle< handle_type, INVAL > &&h) noexcept
Moves the object.
Definition: Common.h:957
-
bool attach_duplicated(handle_type h)
Duplicates an object handle and sets a new object handle.
Definition: Common.h:982
+
1518 public:
+
1519 unsigned char m_data[N];
+
1520 };
+
1521
+
1523}
+
Base template class to support converting GUID to string.
Definition: Common.h:1325
+
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:1336
+
Base template class to support string formatting using FormatMessage() style templates.
Definition: Common.h:1200
+
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:1275
+
basic_string_msg(DWORD dwFlags, LPCTSTR pszFormat, va_list *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition: Common.h:1285
+
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:1247
+
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:1265
+
basic_string_msg(const _Elem *format,...)
Initializes a new string and formats its contents using FormatMessage() style template.
Definition: Common.h:1210
+
basic_string_msg(HINSTANCE hInstance, UINT nFormatID,...)
Initializes a new string and formats its contents using FormatMessage() style template in resources.
Definition: Common.h:1229
+
basic_string_msg(DWORD dwFlags, LPCTSTR pszFormat, DWORD_PTR *Arguments)
Initializes a new string and formats its contents using FormatMessage() style.
Definition: Common.h:1295
+
Base template class to support string formatting using printf() style templates.
Definition: Common.h:1115
+
basic_string_printf(const _Elem *format,...)
Initializes a new string and formats its contents using printf() style template.
Definition: Common.h:1125
+
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:1162
+
basic_string_printf(HINSTANCE hInstance, UINT nFormatID,...)
Initializes a new string and formats its contents using printf() style template in resources.
Definition: Common.h:1144
+
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition: Common.h:869
+
dplhandle< handle_type, INVAL > & operator=(handle_type h) noexcept
Attaches already available object handle.
Definition: Common.h:910
+
handle_type duplicate() const
Duplicates and returns a new object handle.
Definition: Common.h:960
+
dplhandle< handle_type, INVAL > & operator=(dplhandle< handle_type, INVAL > &&h) noexcept
Moves the object.
Definition: Common.h:949
+
bool attach_duplicated(handle_type h)
Duplicates an object handle and sets a new object handle.
Definition: Common.h:974
virtual handle_type duplicate_internal(handle_type h) const noexcept=0
Abstract member function that must be implemented by child classes to do the actual object handle dup...
-
dplhandle(handle_type h) noexcept
Initializes a new class instance with an already available object handle.
Definition: Common.h:891
-
dplhandle< handle_type, INVAL > & operator=(const dplhandle< handle_type, INVAL > &h) noexcept
Duplicates the object.
Definition: Common.h:929
-
dplhandle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition: Common.h:882
-
Base abstract template class to support generic object handle keeping.
Definition: Common.h:615
-
handle_type *& operator*() const
Returns the object handle value when the object handle is a pointer to a value (class,...
Definition: Common.h:705
+
dplhandle(handle_type h) noexcept
Initializes a new class instance with an already available object handle.
Definition: Common.h:883
+
dplhandle< handle_type, INVAL > & operator=(const dplhandle< handle_type, INVAL > &h) noexcept
Duplicates the object.
Definition: Common.h:921
+
dplhandle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition: Common.h:874
+
Base abstract template class to support generic object handle keeping.
Definition: Common.h:607
+
handle_type *& operator*() const
Returns the object handle value when the object handle is a pointer to a value (class,...
Definition: Common.h:697
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:630
-
bool operator>=(handle_type h) const
Is handle greater than or equal to?
Definition: Common.h:778
-
handle_type operator->() const
Provides object handle member access when the object handle is a pointer to a class or struct.
Definition: Common.h:726
-
handle_type * operator&()
Returns the object handle reference.
Definition: Common.h:715
-
T handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:620
-
handle(handle_type h) noexcept
Initializes a new class instance with an already available object handle.
Definition: Common.h:639
-
bool operator<(handle_type h) const
Is handle less than?
Definition: Common.h:752
-
handle< handle_type, INVAL > & operator=(handle_type h) noexcept
Attaches already available object handle.
Definition: Common.h:666
-
bool operator!() const
Tests if the object handle is INVAL.
Definition: Common.h:739
-
handle< handle_type, INVAL > & operator=(handle< handle_type, INVAL > &&h) noexcept
Move assignment.
Definition: Common.h:678
-
bool operator!=(handle_type h) const
Is handle not equal to?
Definition: Common.h:804
-
void free()
Destroys the object.
Definition: Common.h:851
-
handle_type m_h
Object handle.
Definition: Common.h:866
-
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:829
-
bool operator==(handle_type h) const
Is handle equal to?
Definition: Common.h:817
-
handle(handle< handle_type, INVAL > &&h) noexcept
Move constructor.
Definition: Common.h:648
-
handle_type detach()
Dismisses the object handle from this class.
Definition: Common.h:841
-
bool operator>(handle_type h) const
Is handle greater than?
Definition: Common.h:791
-
bool operator<=(handle_type h) const
Is handle less than or equal to?
Definition: Common.h:765
-
Numerical runtime error.
Definition: Common.h:1011
-
num_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition: Common.h:1034
-
num_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition: Common.h:1022
-
error_type number() const
Returns the Windows error number.
Definition: Common.h:1043
-
_Tn error_type
Error number type.
Definition: Common.h:1013
-
error_type m_num
Numeric error code.
Definition: Common.h:1049
-
Helper class for returning pointers to std::unique_ptr (specialization for arrays)
Definition: Common.h:509
-
std::unique_ptr< _Ty[], _Dx > & m_own
Original owner of the pointer.
Definition: Common.h:598
-
ref_unique_ptr(ref_unique_ptr< _Ty[], _Dx > &&other)
Moves object.
Definition: Common.h:543
-
virtual ~ref_unique_ptr()
Returns ownership of the pointer.
Definition: Common.h:571
-
ref_unique_ptr & operator=(std::unique_ptr< _Ty[], _Dx > &owner) noexcept
Takes ownership of the pointer.
Definition: Common.h:528
-
ref_unique_ptr(std::unique_ptr< _Ty[], _Dx > &owner) noexcept
Takes ownership of the pointer.
Definition: Common.h:516
-
_Ty * m_ptr
Pointer.
Definition: Common.h:599
-
ref_unique_ptr & operator=(ref_unique_ptr< _Ty[], _Dx > &&other)
Moves object.
Definition: Common.h:557
-
Helper class for returning pointers to std::unique_ptr.
Definition: Common.h:416
-
std::unique_ptr< _Ty, _Dx > & m_own
Original owner of the pointer.
Definition: Common.h:470
-
_Ty * m_ptr
Pointer.
Definition: Common.h:471
-
ref_unique_ptr(ref_unique_ptr< _Ty, _Dx > &&other)
Moves object.
Definition: Common.h:433
-
~ref_unique_ptr()
Returns ownership of the pointer.
Definition: Common.h:443
-
ref_unique_ptr(std::unique_ptr< _Ty, _Dx > &owner)
Takes ownership of the pointer.
Definition: Common.h:423
-
An allocator template that sanitizes each memory block before it is destroyed or reallocated.
Definition: Common.h:1428
-
sanitizing_allocator(const sanitizing_allocator< _Ty > &_Othr)
Construct by copying.
Definition: Common.h:1451
-
void deallocate(pointer _Ptr, size_type _Size)
Deallocate object at _Ptr sanitizing its content first.
Definition: Common.h:1466
-
sanitizing_allocator(const sanitizing_allocator< _Other > &_Othr) noexcept
Construct from a related allocator.
Definition: Common.h:1459
-
std::allocator< _Ty > _Mybase
Base type.
Definition: Common.h:1430
-
sanitizing_allocator() noexcept
Construct default allocator.
Definition: Common.h:1444
-
Sanitizing BLOB.
Definition: Common.h:1508
-
sanitizing_blob()
Constructs uninitialized BLOB.
Definition: Common.h:1513
-
~sanitizing_blob()
Sanitizes BLOB.
Definition: Common.h:1521
-
Single-byte character implementation of a class to support converting GUID to string.
Definition: Common.h:1361
-
string_guid(const GUID &guid)
Initializes a new string and formats its contents to string representation of given GUID.
Definition: Common.h:1371
-
Windows runtime error.
Definition: Common.h:1056
-
tstring msg(DWORD dwLanguageId=0) const
Returns a user-readable Windows error message.
Definition: Common.h:1101
-
win_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition: Common.h:1074
-
win_runtime_error(const std::string &msg)
Constructs an exception using GetLastError()
Definition: Common.h:1083
-
win_runtime_error(const char *msg=nullptr)
Constructs an exception using GetLastError()
Definition: Common.h:1092
-
win_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition: Common.h:1064
-
Wide character implementation of a class to support converting GUID to string.
Definition: Common.h:1383
-
wstring_guid(const GUID &guid)
Initializes a new string and formats its contents to string representation of given GUID.
Definition: Common.h:1393
-
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:101
-
ref_unique_ptr< _Ty[], _Dx > get_ptr(std::unique_ptr< _Ty[], _Dx > &owner) noexcept
Helper function template for returning pointers to std::unique_ptr (specialization for arrays)
Definition: Common.h:496
-
std::string tstring
Multi-byte / Wide-character string (according to _UNICODE)
Definition: Common.h:346
-
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:1492
-
sanitizing_string sanitizing_tstring
Multi-byte / Wide-character sanitizing string (according to _UNICODE)
Definition: Common.h:1500
-
std::basic_string< char, std::char_traits< char >, sanitizing_allocator< char > > sanitizing_string
A sanitizing variant of std::string.
Definition: Common.h:1483
-
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:1192
-
string_guid tstring_guid
Multi-byte / Wide-character string GUID (according to _UNICODE)
Definition: Common.h:1407
-
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:1317
-
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition: Common.h:259
-
static DWORD FormatMessage(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:307
-
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:1187
-
static int vsnprintf(char *str, size_t capacity, const char *format, va_list arg)
Formats string using printf().
Definition: Common.h:228
-
string_printf tstring_printf
Multi-byte / Wide-character formatted string (according to _UNICODE)
Definition: Common.h:1200
-
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition: Common.h:292
-
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:1312
-
string_msg tstring_msg
Multi-byte / Wide-character formatted string (according to _UNICODE)
Definition: Common.h:1325
-
static const T invalid
Invalid handle value.
Definition: Common.h:625
-
LocalFree_delete() noexcept
Default construct.
Definition: Common.h:389
-
LocalFree_delete< _Ty > _Myt
This type.
Definition: Common.h:384
-
void operator()(_Other *) const
Delete a pointer of another type.
Definition: Common.h:405
-
void operator()(_Ty *_Ptr) const noexcept
Delete a pointer.
Definition: Common.h:394
-
Deleter for unique_ptr using LocalFree.
Definition: Common.h:354
-
LocalFree_delete< _Ty > _Myt
This type.
Definition: Common.h:355
-
LocalFree_delete(const LocalFree_delete< _Ty2 > &)
Construct from another LocalFree_delete.
Definition: Common.h:365
-
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: Common.h:372
-
LocalFree_delete()
Default construct.
Definition: Common.h:360
-
Convert this type to sanitizing_allocator<_Other>
Definition: Common.h:1437
-
sanitizing_allocator< _Other > other
Other type.
Definition: Common.h:1438
+
handle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition: Common.h:622
+
bool operator>=(handle_type h) const
Is handle greater than or equal to?
Definition: Common.h:770
+
handle_type operator->() const
Provides object handle member access when the object handle is a pointer to a class or struct.
Definition: Common.h:718
+
handle_type * operator&()
Returns the object handle reference.
Definition: Common.h:707
+
T handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:612
+
handle(handle_type h) noexcept
Initializes a new class instance with an already available object handle.
Definition: Common.h:631
+
bool operator<(handle_type h) const
Is handle less than?
Definition: Common.h:744
+
handle< handle_type, INVAL > & operator=(handle_type h) noexcept
Attaches already available object handle.
Definition: Common.h:658
+
bool operator!() const
Tests if the object handle is INVAL.
Definition: Common.h:731
+
handle< handle_type, INVAL > & operator=(handle< handle_type, INVAL > &&h) noexcept
Move assignment.
Definition: Common.h:670
+
bool operator!=(handle_type h) const
Is handle not equal to?
Definition: Common.h:796
+
void free()
Destroys the object.
Definition: Common.h:843
+
handle_type m_h
Object handle.
Definition: Common.h:858
+
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:821
+
bool operator==(handle_type h) const
Is handle equal to?
Definition: Common.h:809
+
handle(handle< handle_type, INVAL > &&h) noexcept
Move constructor.
Definition: Common.h:640
+
handle_type detach()
Dismisses the object handle from this class.
Definition: Common.h:833
+
bool operator>(handle_type h) const
Is handle greater than?
Definition: Common.h:783
+
bool operator<=(handle_type h) const
Is handle less than or equal to?
Definition: Common.h:757
+
Numerical runtime error.
Definition: Common.h:1003
+
num_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition: Common.h:1026
+
num_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition: Common.h:1014
+
error_type number() const
Returns the Windows error number.
Definition: Common.h:1035
+
_Tn error_type
Error number type.
Definition: Common.h:1005
+
error_type m_num
Numeric error code.
Definition: Common.h:1041
+
Helper class for returning pointers to std::unique_ptr (specialization for arrays)
Definition: Common.h:501
+
std::unique_ptr< _Ty[], _Dx > & m_own
Original owner of the pointer.
Definition: Common.h:590
+
ref_unique_ptr(ref_unique_ptr< _Ty[], _Dx > &&other)
Moves object.
Definition: Common.h:535
+
virtual ~ref_unique_ptr()
Returns ownership of the pointer.
Definition: Common.h:563
+
ref_unique_ptr & operator=(std::unique_ptr< _Ty[], _Dx > &owner) noexcept
Takes ownership of the pointer.
Definition: Common.h:520
+
ref_unique_ptr(std::unique_ptr< _Ty[], _Dx > &owner) noexcept
Takes ownership of the pointer.
Definition: Common.h:508
+
_Ty * m_ptr
Pointer.
Definition: Common.h:591
+
ref_unique_ptr & operator=(ref_unique_ptr< _Ty[], _Dx > &&other)
Moves object.
Definition: Common.h:549
+
Helper class for returning pointers to std::unique_ptr.
Definition: Common.h:408
+
std::unique_ptr< _Ty, _Dx > & m_own
Original owner of the pointer.
Definition: Common.h:462
+
_Ty * m_ptr
Pointer.
Definition: Common.h:463
+
ref_unique_ptr(ref_unique_ptr< _Ty, _Dx > &&other)
Moves object.
Definition: Common.h:425
+
~ref_unique_ptr()
Returns ownership of the pointer.
Definition: Common.h:435
+
ref_unique_ptr(std::unique_ptr< _Ty, _Dx > &owner)
Takes ownership of the pointer.
Definition: Common.h:415
+
An allocator template that sanitizes each memory block before it is destroyed or reallocated.
Definition: Common.h:1420
+
sanitizing_allocator(const sanitizing_allocator< _Ty > &_Othr)
Construct by copying.
Definition: Common.h:1443
+
void deallocate(pointer _Ptr, size_type _Size)
Deallocate object at _Ptr sanitizing its content first.
Definition: Common.h:1458
+
sanitizing_allocator(const sanitizing_allocator< _Other > &_Othr) noexcept
Construct from a related allocator.
Definition: Common.h:1451
+
std::allocator< _Ty > _Mybase
Base type.
Definition: Common.h:1422
+
sanitizing_allocator() noexcept
Construct default allocator.
Definition: Common.h:1436
+
Sanitizing BLOB.
Definition: Common.h:1500
+
sanitizing_blob()
Constructs uninitialized BLOB.
Definition: Common.h:1505
+
~sanitizing_blob()
Sanitizes BLOB.
Definition: Common.h:1513
+
Single-byte character implementation of a class to support converting GUID to string.
Definition: Common.h:1353
+
string_guid(const GUID &guid)
Initializes a new string and formats its contents to string representation of given GUID.
Definition: Common.h:1363
+
Windows runtime error.
Definition: Common.h:1048
+
tstring msg(DWORD dwLanguageId=0) const
Returns a user-readable Windows error message.
Definition: Common.h:1093
+
win_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition: Common.h:1066
+
win_runtime_error(const std::string &msg)
Constructs an exception using GetLastError()
Definition: Common.h:1075
+
win_runtime_error(const char *msg=nullptr)
Constructs an exception using GetLastError()
Definition: Common.h:1084
+
win_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition: Common.h:1056
+
Wide character implementation of a class to support converting GUID to string.
Definition: Common.h:1375
+
wstring_guid(const GUID &guid)
Initializes a new string and formats its contents to string representation of given GUID.
Definition: Common.h:1385
+
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:93
+
ref_unique_ptr< _Ty[], _Dx > get_ptr(std::unique_ptr< _Ty[], _Dx > &owner) noexcept
Helper function template for returning pointers to std::unique_ptr (specialization for arrays)
Definition: Common.h:488
+
std::string tstring
Multi-byte / Wide-character string (according to _UNICODE)
Definition: Common.h:338
+
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:1484
+
sanitizing_string sanitizing_tstring
Multi-byte / Wide-character sanitizing string (according to _UNICODE)
Definition: Common.h:1492
+
std::basic_string< char, std::char_traits< char >, sanitizing_allocator< char > > sanitizing_string
A sanitizing variant of std::string.
Definition: Common.h:1475
+
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:1184
+
string_guid tstring_guid
Multi-byte / Wide-character string GUID (according to _UNICODE)
Definition: Common.h:1399
+
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:1309
+
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition: Common.h:251
+
static DWORD FormatMessage(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:299
+
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:1179
+
static int vsnprintf(char *str, size_t capacity, const char *format, va_list arg)
Formats string using printf().
Definition: Common.h:220
+
string_printf tstring_printf
Multi-byte / Wide-character formatted string (according to _UNICODE)
Definition: Common.h:1192
+
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition: Common.h:284
+
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:1304
+
string_msg tstring_msg
Multi-byte / Wide-character formatted string (according to _UNICODE)
Definition: Common.h:1317
+
static const T invalid
Invalid handle value.
Definition: Common.h:617
+
LocalFree_delete() noexcept
Default construct.
Definition: Common.h:381
+
LocalFree_delete< _Ty > _Myt
This type.
Definition: Common.h:376
+
void operator()(_Other *) const
Delete a pointer of another type.
Definition: Common.h:397
+
void operator()(_Ty *_Ptr) const noexcept
Delete a pointer.
Definition: Common.h:386
+
Deleter for unique_ptr using LocalFree.
Definition: Common.h:346
+
LocalFree_delete< _Ty > _Myt
This type.
Definition: Common.h:347
+
LocalFree_delete(const LocalFree_delete< _Ty2 > &)
Construct from another LocalFree_delete.
Definition: Common.h:357
+
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: Common.h:364
+
LocalFree_delete()
Default construct.
Definition: Common.h:352
+
Convert this type to sanitizing_allocator<_Other>
Definition: Common.h:1429
+
sanitizing_allocator< _Other > other
Other type.
Definition: Common.h:1430
diff --git a/_cred_8h.html b/_cred_8h.html deleted file mode 100644 index f94777cc..00000000 --- a/_cred_8h.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - -WinStd: include/WinStd/Cred.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
Cred.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft Credentials API. -More...

-
#include "Common.h"
-#include <wincred.h>
-#include <memory>
-
-

Go to the source code of this file.

- - - - - - - - -

-Classes

struct  winstd::CredFree_delete< _Ty >
 Deleter for unique_ptr using CredFree. More...
 
struct  winstd::CredFree_delete< _Ty[]>
 Deleter for unique_ptr to array of unknown size using CredFree. More...
 
- - - - - - - - - - - - - - - - - - - - -

-Functions

template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
static BOOL CredEnumerate (LPCTSTR Filter, DWORD Flags, DWORD *Count, std::unique_ptr< PCREDENTIAL[], winstd::CredFree_delete< PCREDENTIAL[]> > &cCredentials) noexcept
 Enumerates the credentials from the user's credential set. The credential set used is the one associated with the logon session of the current token. The token must not have the user's SID disabled. More...
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft Credentials API.

-
- - - - diff --git a/_cred_8h_source.html b/_cred_8h_source.html index 995643ca..09f5ef97 100644 --- a/_cred_8h_source.html +++ b/_cred_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,183 +70,182 @@ $(function() {
Cred.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <wincred.h>
+
13#include <memory>
14
-
15#include "Common.h"
-
16#include <wincred.h>
-
17#include <memory>
-
18
-
21
-
23template<class _Traits, class _Ax>
-
24static BOOL CredProtectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<char, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType)
-
25{
-
26 char buf[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
27 DWORD dwSize = _countof(buf);
-
28
-
29 // Try with the stack buffer first.
-
30 if (CredProtectA(fAsSelf, const_cast<LPSTR>(pszCredentials), cchCredentials, buf, &dwSize, ProtectionType)) {
-
31 // Copy from stack.
-
32 sProtectedCredentials.assign(buf, dwSize - 1);
-
33 return TRUE;
-
34 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
35 // Allocate on heap and retry.
-
36 std::unique_ptr<char[]> buf(new char[dwSize]);
-
37 if (CredProtectA(fAsSelf, const_cast<LPSTR>(pszCredentials), cchCredentials, buf.get(), &dwSize, ProtectionType)) {
-
38 sProtectedCredentials.assign(buf.get(), dwSize - 1);
-
39 return TRUE;
-
40 }
-
41 }
-
42
-
43 return FALSE;
-
44}
-
45
-
51template<class _Traits, class _Ax>
-
52static 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)
-
53{
-
54 wchar_t buf[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
55 DWORD dwSize = _countof(buf);
-
56
-
57 // Try with the stack buffer first.
-
58 if (CredProtectW(fAsSelf, const_cast<LPWSTR>(pszCredentials), cchCredentials, buf, &dwSize, ProtectionType)) {
-
59 // Copy from stack.
-
60 sProtectedCredentials.assign(buf, dwSize - 1);
-
61 return TRUE;
-
62 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
63 // Allocate on heap and retry.
-
64 std::unique_ptr<wchar_t[]> buf(new wchar_t[dwSize]);
-
65 if (CredProtectW(fAsSelf, const_cast<LPWSTR>(pszCredentials), cchCredentials, buf.get(), &dwSize, ProtectionType)) {
-
66 sProtectedCredentials.assign(buf.get(), dwSize - 1);
-
67 return TRUE;
-
68 }
-
69 }
-
70
-
71 return FALSE;
-
72}
-
73
-
75template<class _Traits, class _Ax>
-
76static BOOL CredUnprotectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<char, _Traits, _Ax> &sCredentials)
-
77{
-
78 char buf[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
79 DWORD dwSize = _countof(buf);
-
80
-
81 // Try with the stack buffer first.
-
82 if (CredUnprotectA(fAsSelf, const_cast<LPSTR>(pszProtectedCredentials), cchCredentials, buf, &dwSize)) {
-
83 // Copy from stack.
-
84 sCredentials.assign(buf, dwSize);
-
85 return TRUE;
-
86 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
87 // Allocate on heap and retry.
-
88 std::unique_ptr<char[]> buf(new char[dwSize]);
-
89 if (CredUnprotectA(fAsSelf, const_cast<LPSTR>(pszProtectedCredentials), cchCredentials, buf.get(), &dwSize)) {
-
90 sCredentials.assign(buf.get(), dwSize);
-
91 return TRUE;
-
92 }
-
93 }
-
94
-
95 return FALSE;
-
96}
-
97
-
103template<class _Traits, class _Ax>
-
104static BOOL CredUnprotectW(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCWSTR pszProtectedCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sCredentials)
-
105{
-
106 wchar_t buf[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
107 DWORD dwSize = _countof(buf);
-
108
-
109 // Try with the stack buffer first.
-
110 if (CredUnprotectW(fAsSelf, const_cast<LPWSTR>(pszProtectedCredentials), cchCredentials, buf, &dwSize)) {
-
111 // Copy from stack.
-
112 sCredentials.assign(buf, dwSize);
-
113 return TRUE;
-
114 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
115 // Allocate on heap and retry.
-
116 std::unique_ptr<wchar_t[]> buf(new wchar_t[dwSize]);
-
117 if (CredUnprotectW(fAsSelf, const_cast<LPWSTR>(pszProtectedCredentials), cchCredentials, buf.get(), &dwSize)) {
-
118 sCredentials.assign(buf.get(), dwSize);
-
119 return TRUE;
-
120 }
-
121 }
-
122
-
123 return FALSE;
-
124}
-
125
-
127
-
128namespace winstd
-
129{
-
132
-
136 template <class _Ty> struct CredFree_delete
-
137 {
- -
139
- -
144
-
148 template <class _Ty2> CredFree_delete(const CredFree_delete<_Ty2>&) {}
-
149
-
155 void operator()(_Ty *_Ptr) const
-
156 {
-
157 CredFree(_Ptr);
-
158 }
-
159 };
-
160
-
164 template <class _Ty> struct CredFree_delete<_Ty[]>
-
165 {
- -
167
- -
172
-
178 void operator()(_Ty *_Ptr) const noexcept
-
179 {
-
180 CredFree(_Ptr);
-
181 }
-
182
-
188 template<class _Other>
-
189 void operator()(_Other *) const
-
190 {
-
191 CredFree(_Ptr);
-
192 }
-
193 };
-
194
-
196}
-
197
-
200
-
206#pragma warning(suppress: 4505) // Don't warn on unused code
-
207static BOOL CredEnumerate(_In_z_ LPCTSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Inout_ std::unique_ptr<PCREDENTIAL[], winstd::CredFree_delete<PCREDENTIAL[]> > &cCredentials) noexcept
-
208{
-
209 PCREDENTIAL *pCredentials;
-
210 if (CredEnumerate(Filter, Flags, Count, &pCredentials)) {
-
211 cCredentials.reset(pCredentials);
-
212 return TRUE;
-
213 }
-
214
-
215 return FALSE;
-
216}
-
217
-
General API.
-
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:76
-
static BOOL CredEnumerate(LPCTSTR Filter, DWORD Flags, DWORD *Count, std::unique_ptr< PCREDENTIAL[], winstd::CredFree_delete< PCREDENTIAL[]> > &cCredentials) noexcept
Enumerates the credentials from the user's credential set. The credential set used is the one associa...
Definition: Cred.h:207
-
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:24
-
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:52
-
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:104
-
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:101
-
CredFree_delete< _Ty > _Myt
This type.
Definition: Cred.h:166
-
CredFree_delete()
Default construct.
Definition: Cred.h:171
-
void operator()(_Other *) const
Delete a pointer of another type.
Definition: Cred.h:189
-
void operator()(_Ty *_Ptr) const noexcept
Delete a pointer.
Definition: Cred.h:178
-
Deleter for unique_ptr using CredFree.
Definition: Cred.h:137
-
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: Cred.h:155
-
CredFree_delete()
Default construct.
Definition: Cred.h:143
-
CredFree_delete< _Ty > _Myt
This type.
Definition: Cred.h:138
-
CredFree_delete(const CredFree_delete< _Ty2 > &)
Construct from another CredFree_delete.
Definition: Cred.h:148
+
17
+
19template<class _Traits, class _Ax>
+
20static BOOL CredProtectA(_In_ BOOL fAsSelf, _In_count_(cchCredentials) LPCSTR pszCredentials, _In_ DWORD cchCredentials, _Inout_ std::basic_string<char, _Traits, _Ax> &sProtectedCredentials, _Out_ CRED_PROTECTION_TYPE *ProtectionType)
+
21{
+
22 char buf[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
23 DWORD dwSize = _countof(buf);
+
24
+
25 // Try with the stack buffer first.
+
26 if (CredProtectA(fAsSelf, const_cast<LPSTR>(pszCredentials), cchCredentials, buf, &dwSize, ProtectionType)) {
+
27 // Copy from stack.
+
28 sProtectedCredentials.assign(buf, dwSize - 1);
+
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}
+
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}
+
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}
+
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}
+
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 }
+
155 };
+
156
+
160 template <class _Ty> struct CredFree_delete<_Ty[]>
+
161 {
+ +
163
+ +
168
+
174 void operator()(_Ty *_Ptr) const noexcept
+
175 {
+
176 CredFree(_Ptr);
+
177 }
+
178
+
184 template<class _Other>
+
185 void operator()(_Other *) const
+
186 {
+
187 CredFree(_Ptr);
+
188 }
+
189 };
+
190
+
192}
+
193
+
196
+
202#pragma warning(suppress: 4505) // Don't warn on unused code
+
203static BOOL CredEnumerate(_In_z_ LPCTSTR Filter, _Reserved_ DWORD Flags, _Out_ DWORD *Count, _Inout_ std::unique_ptr<PCREDENTIAL[], winstd::CredFree_delete<PCREDENTIAL[]> > &cCredentials) noexcept
+
204{
+
205 PCREDENTIAL *pCredentials;
+
206 if (CredEnumerate(Filter, Flags, Count, &pCredentials)) {
+
207 cCredentials.reset(pCredentials);
+
208 return TRUE;
+
209 }
+
210
+
211 return FALSE;
+
212}
+
213
+
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
+
static BOOL CredEnumerate(LPCTSTR Filter, DWORD Flags, DWORD *Count, std::unique_ptr< PCREDENTIAL[], winstd::CredFree_delete< PCREDENTIAL[]> > &cCredentials) noexcept
Enumerates the credentials from the user's credential set. The credential set used is the one associa...
Definition: Cred.h:203
+
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 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
+
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:93
+
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
diff --git a/_crypt_8h.html b/_crypt_8h.html deleted file mode 100644 index da1958d6..00000000 --- a/_crypt_8h.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - -WinStd: include/WinStd/Crypt.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
Crypt.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft Cryptography API. -More...

-
#include "Common.h"
-#include <assert.h>
-#include <WinCrypt.h>
-#include <algorithm>
-#include <string>
-#include <vector>
-
-

Go to the source code of this file.

- - - - - - - - - - - - - - - - - - - - - - - -

-Classes

class  winstd::cert_context
 PCCERT_CONTEXT wrapper class. More...
 
class  winstd::cert_chain_context
 PCCERT_CHAIN_CONTEXT wrapper class. More...
 
class  winstd::cert_store
 HCERTSTORE wrapper class. More...
 
class  winstd::crypt_prov
 HCRYPTPROV wrapper class. More...
 
class  winstd::crypt_hash
 HCRYPTHASH wrapper class. More...
 
class  winstd::crypt_key
 HCRYPTKEY wrapper class. More...
 
class  winstd::data_blob
 DATA_BLOB wrapper class. More...
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Functions

template<class _Traits , class _Ax >
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::wstring string. More...
 
template<class _Traits , class _Ax >
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::wstring string. More...
 
template<class _Ty , class _Ax >
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. More...
 
template<class _Ty , class _Ax >
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 by using this function. More...
 
template<class T >
static BOOL CryptGetHashParam (HCRYPTHASH hHash, DWORD dwParam, T &data, DWORD dwFlags)
 Retrieves data that governs the operations of a hash object. The actual hash value can be retrieved by using this function. More...
 
template<class _Ty , class _Ax >
static BOOL CryptGetKeyParam (HCRYPTKEY hKey, DWORD dwParam, std::vector< _Ty, _Ax > &aData, DWORD dwFlags)
 Retrieves data that governs the operations of a key. More...
 
template<class T >
static BOOL CryptGetKeyParam (HCRYPTKEY hKey, DWORD dwParam, T &data, DWORD dwFlags)
 Retrieves data that governs the operations of a key. More...
 
template<class _Ty , class _Ax >
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 manner. More...
 
template<class _Ty , class _Ax >
static BOOL CryptEncrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, std::vector< _Ty, _Ax > &aData)
 Encrypts data. More...
 
template<class _Ty , class _Ax >
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. More...
 
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 certificate and going back, if possible, to a trusted root certificate. More...
 
static BOOL CryptAcquireContextA (winstd::crypt_prov &prov, LPCSTR szContainer, LPCSTR szProvider, DWORD dwProvType, DWORD dwFlags)
 Acquires the cryptographic context. More...
 
static BOOL CryptAcquireContextW (winstd::crypt_prov &prov, LPCWSTR szContainer, LPCWSTR szProvider, DWORD dwProvType, DWORD dwFlags)
 Acquires the cryptographic context. More...
 
static BOOL CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, winstd::crypt_hash &hash)
 Creates the hash context. More...
 
static BOOL CryptGenKey (HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, winstd::crypt_key &key)
 Generates the key. More...
 
static bool CryptImportKey (HCRYPTPROV hProv, __in_bcount(dwDataLen) LPCBYTE pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, winstd::crypt_key &key)
 Imports the key. More...
 
static bool CryptImportPublicKeyInfo (HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, winstd::crypt_key &key)
 Imports the public key. More...
 
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. More...
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft Cryptography API.

-
- - - - diff --git a/_crypt_8h_source.html b/_crypt_8h_source.html index fcc54b94..0834f762 100644 --- a/_crypt_8h_source.html +++ b/_crypt_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,670 +70,669 @@ $(function() {
Crypt.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
-
14
-
15#include "Common.h"
-
16#include <assert.h>
-
17#include <WinCrypt.h>
-
18#include <algorithm>
-
19#include <string>
-
20#include <vector>
-
21
-
24
-
26template<class _Traits, class _Ax>
-
27static DWORD CertGetNameStringA(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<char, _Traits, _Ax> &sNameString)
-
28{
-
29 // Query the final string length first.
-
30 DWORD dwSize = ::CertGetNameStringA(pCertContext, dwType, dwFlags, pvTypePara, NULL, 0);
-
31
-
32 // Allocate buffer on heap to format the string data into and read it.
-
33 std::unique_ptr<char[]> szBuffer(new char[dwSize]);
-
34 dwSize = ::CertGetNameStringA(pCertContext, dwType, dwFlags, pvTypePara, szBuffer.get(), dwSize);
-
35 sNameString.assign(szBuffer.get(), dwSize - 1);
-
36 return dwSize;
-
37}
-
38
-
44template<class _Traits, class _Ax>
-
45static 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)
-
46{
-
47 // Query the final string length first.
-
48 DWORD dwSize = ::CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara, NULL, 0);
-
49
-
50 // Allocate buffer on heap to format the string data into and read it.
-
51 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwSize]);
-
52 dwSize = ::CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara, szBuffer.get(), dwSize);
-
53 sNameString.assign(szBuffer.get(), dwSize - 1);
-
54 return dwSize;
-
55}
-
56
-
62template<class _Ty, class _Ax>
-
63static _Success_(return != 0) BOOL WINAPI CertGetCertificateContextProperty(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwPropId, _Out_ std::vector<_Ty, _Ax> &aData)
-
64{
- -
66 DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
-
67
-
68 // Try with the stack buffer first.
-
69 if (CertGetCertificateContextProperty(pCertContext, dwPropId, buf, &dwSize)) {
-
70 // Copy from stack.
-
71 aData.assign((const _Ty*)buf, (const _Ty*)buf + (dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
72 return TRUE;
-
73 } else if (GetLastError() == ERROR_MORE_DATA) {
-
74 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
75 if (CertGetCertificateContextProperty(pCertContext, dwPropId, (BYTE*)aData.data(), &dwSize))
-
76 return TRUE;
-
77 }
-
78
-
79 return FALSE;
-
80}
-
81
-
87template<class _Ty, class _Ax>
-
88static _Success_(return != 0) BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags)
-
89{
- -
91 DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
-
92
-
93 // Try with the stack buffer first.
-
94 if (CryptGetHashParam(hHash, dwParam, buf, &dwSize, dwFlags)) {
-
95 // Copy from stack.
-
96 aData.assign((const _Ty*)buf, (const _Ty*)buf + (dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
97 return TRUE;
-
98 } else if (GetLastError() == ERROR_MORE_DATA) {
-
99 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
100 if (CryptGetHashParam(hHash, dwParam, (BYTE*)aData.data(), &dwSize, dwFlags))
-
101 return TRUE;
-
102 }
-
103
-
104 return FALSE;
-
105}
-
106
-
112template<class T>
-
113static _Success_(return != 0) BOOL CryptGetHashParam(_In_ HCRYPTHASH hHash, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags)
-
114{
-
115 DWORD dwSize = sizeof(T);
-
116 return CryptGetHashParam(hHash, dwParam, (BYTE*)&data, &dwSize, dwFlags);
-
117}
-
118
-
124template<class _Ty, class _Ax>
-
125static _Success_(return != 0) BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ std::vector<_Ty, _Ax> &aData, _In_ DWORD dwFlags)
-
126{
- -
128 DWORD dwSize = WINSTD_STACK_BUFFER_BYTES;
-
129
-
130 // Try with the stack buffer first.
-
131 if (CryptGetKeyParam(hKey, dwParam, buf, &dwSize, dwFlags)) {
-
132 // Copy from stack.
-
133 aData.assign((const _Ty*)buf, (const _Ty*)buf + (dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
134 return TRUE;
-
135 } else if (GetLastError() == ERROR_MORE_DATA) {
-
136 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
137 if (CryptGetKeyParam(hKey, dwParam, (BYTE*)aData.data(), &dwSize, dwFlags))
-
138 return TRUE;
-
139 }
-
140
-
141 return FALSE;
-
142}
-
143
-
149template<class T>
-
150static BOOL CryptGetKeyParam(_In_ HCRYPTKEY hKey, _In_ DWORD dwParam, _Out_ T &data, _In_ DWORD dwFlags)
-
151{
-
152 DWORD dwSize = sizeof(T);
-
153 return CryptGetKeyParam(hKey, dwParam, (BYTE*)&data, &dwSize, dwFlags);
-
154}
-
155
-
161template<class _Ty, class _Ax>
-
162static _Success_(return != 0) BOOL CryptExportKey(_In_ HCRYPTKEY hKey, _In_ HCRYPTKEY hExpKey, _In_ DWORD dwBlobType, _In_ DWORD dwFlags, _Out_ std::vector<_Ty, _Ax> &aData)
-
163{
-
164 DWORD dwKeyBLOBSize = 0;
-
165
-
166 if (CryptExportKey(hKey, hExpKey, dwBlobType, dwFlags, NULL, &dwKeyBLOBSize)) {
-
167 aData.resize((dwKeyBLOBSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
168 if (CryptExportKey(hKey, hExpKey, dwBlobType, dwFlags, aData.data(), &dwKeyBLOBSize))
-
169 return TRUE;
-
170 }
-
171
-
172 return FALSE;
-
173}
-
174
-
180template<class _Ty, class _Ax>
-
181static _Success_(return != 0) BOOL CryptEncrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData)
-
182{
-
183 DWORD
-
184 dwDataLen = (DWORD)(aData.size() * sizeof(_Ty)),
-
185 dwBufLen = (DWORD)(aData.capacity() * sizeof(_Ty)),
-
186 dwEncLen = dwDataLen,
-
187 dwResult;
-
188
-
189 if (dwBufLen) {
-
190 aData.resize(dwBufLen);
-
191 if (CryptEncrypt(hKey, hHash, Final, dwFlags, (BYTE*)aData.data(), &dwEncLen, dwBufLen)) {
-
192 // Encryption succeeded.
-
193 assert(dwEncLen <= dwBufLen);
-
194 if (dwEncLen < dwBufLen)
-
195 aData.resize((dwEncLen + sizeof(_Ty) - 1) / sizeof(_Ty));
-
196 return TRUE;
-
197 } else
-
198 dwResult = GetLastError();
-
199 } else if (CryptEncrypt(hKey, NULL, Final, dwFlags, NULL, &dwEncLen, 0)) {
-
200 // CryptEncrypt() always succeeds for output data size queries.
-
201 // dwEncLen contains required output data size. Continue as if the buffer was to small. Actually, the output buffer _was_ too small!
-
202 dwResult = ERROR_MORE_DATA;
-
203 } else
-
204 dwResult = GetLastError();
-
205
-
206 if (dwResult == ERROR_MORE_DATA) {
-
207 // Encrypted data will be longer. Reserve more space and retry.
-
208 aData.resize(((dwBufLen = dwEncLen) + sizeof(_Ty) - 1) / sizeof(_Ty));
-
209 dwEncLen = dwDataLen;
-
210 if (CryptEncrypt(hKey, hHash, Final, dwFlags, (BYTE*)aData.data(), &dwEncLen, dwBufLen)) {
-
211 // Encryption succeeded.
-
212 assert(dwEncLen <= dwBufLen);
-
213 if (dwEncLen < dwBufLen)
-
214 aData.resize((dwEncLen + sizeof(_Ty) - 1) / sizeof(_Ty));
-
215 return TRUE;
-
216 }
-
217 } else {
-
218 // Resize back to data length.
-
219 aData.resize((dwDataLen + sizeof(_Ty) - 1) / sizeof(_Ty));
-
220 }
-
221
-
222 return FALSE;
-
223}
-
224
-
230template<class _Ty, class _Ax>
-
231static _Success_(return != 0) BOOL CryptDecrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData)
-
232{
-
233 DWORD dwDataLen = (DWORD)(aData.size() * sizeof(_Ty));
-
234
-
235 if (CryptDecrypt(hKey, hHash, Final, dwFlags, (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}
-
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 }
-
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 }
-
287
-
296 bool operator!=(_In_ const handle_type &other) const noexcept
-
297 {
-
298 return !operator==(other);
-
299 }
-
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 }
-
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 }
-
330
-
339 bool operator<=(_In_ const handle_type &other) const noexcept
-
340 {
-
341 return !operator>(other);
-
342 }
-
343
-
352 bool operator>=(_In_ const handle_type &other) const noexcept
-
353 {
-
354 return !operator<(other);
-
355 }
-
356
-
357 protected:
-
363 void free_internal() noexcept override
-
364 {
-
365 CertFreeCertificateContext(m_h);
-
366 }
-
367
-
377 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
-
378 {
-
379 return CertDuplicateCertificateContext(h);
-
380 }
-
381 };
-
382
-
388 class cert_chain_context : public dplhandle<PCCERT_CHAIN_CONTEXT, NULL>
-
389 {
- -
391
-
392 public:
- -
399 {
-
400 if (m_h != invalid)
- -
402 }
-
403
-
404 protected:
-
410 void free_internal() noexcept override
-
411 {
-
412 CertFreeCertificateChain(m_h);
-
413 }
-
414
-
424 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
-
425 {
-
426 return CertDuplicateCertificateChain(h);
-
427 }
-
428 };
-
429
-
436 class cert_store : public handle<HCERTSTORE, NULL>
-
437 {
- -
439
-
440 public:
-
446 virtual ~cert_store()
-
447 {
-
448 if (m_h != invalid)
- -
450 }
-
451
-
452 protected:
-
458 void free_internal() noexcept override
-
459 {
-
460 CertCloseStore(m_h, 0);
-
461 }
-
462 };
-
463
-
469 class crypt_prov : public handle<HCRYPTPROV, NULL>
-
470 {
- -
472
-
473 public:
-
479 virtual ~crypt_prov()
-
480 {
-
481 if (m_h != invalid)
- -
483 }
-
484
-
485 protected:
-
491 void free_internal() noexcept override
-
492 {
-
493 CryptReleaseContext(m_h, 0);
-
494 }
-
495 };
-
496
-
502 class crypt_hash : public dplhandle<HCRYPTHASH, NULL>
-
503 {
- -
505
-
506 public:
-
512 virtual ~crypt_hash()
-
513 {
-
514 if (m_h != invalid)
- -
516 }
-
517
-
518 protected:
-
524 void free_internal() noexcept override
-
525 {
-
526 CryptDestroyHash(m_h);
-
527 }
-
528
-
538 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
-
539 {
-
540 handle_type hNew;
-
541 return CryptDuplicateHash(h, NULL, 0, &hNew) ? hNew : invalid;
-
542 }
-
543 };
-
544
-
553 class crypt_key : public dplhandle<HCRYPTKEY, NULL>
-
554 {
- -
556
-
557 public:
-
563 virtual ~crypt_key()
-
564 {
-
565 if (m_h != invalid)
- -
567 }
-
568
-
577 bool create_exp1(_In_ HCRYPTPROV hProv, _In_ DWORD dwKeySpec)
-
578 {
-
579 if (dwKeySpec != AT_KEYEXCHANGE && dwKeySpec != AT_SIGNATURE) {
-
580 SetLastError(ERROR_INVALID_PARAMETER);
-
581 return false;
-
582 }
-
583
-
584 // Generate the private key.
-
585 handle_type h;
-
586 if (CryptGenKey(hProv, dwKeySpec, CRYPT_EXPORTABLE, &h)) {
-
587 // Export the private key, we'll convert it to a private exponent of one key.
-
588 std::vector<BYTE, sanitizing_allocator<BYTE>> key_blob;
-
589 if (CryptExportKey(h, 0, PRIVATEKEYBLOB, 0, key_blob)) {
-
590 CryptDestroyKey(h);
-
591
-
592 // Get the byte length of the key.
-
593 size_t
-
594 size_key = *reinterpret_cast<DWORD*>(&key_blob[12])/8,
-
595 size_prime = size_key/2;
-
596
-
597 // Modify the Exponent in Key BLOB format
-
598 // Key BLOB format is documented in SDK
-
599
-
600 // Convert pubexp in rsapubkey to 1
-
601 LPBYTE ptr = &key_blob[16];
-
602 *reinterpret_cast<DWORD*>(ptr) = 1;
-
603 ptr += sizeof(DWORD);
-
604
-
605 // Skip modulus, prime1, prime2
-
606 ptr += size_key;
-
607 ptr += size_prime;
-
608 ptr += size_prime;
-
609
-
610 // Convert exponent1 to 1
-
611 ptr[0] = 1;
-
612 memset(ptr + 1, 0, size_prime - 1);
-
613 ptr += size_prime;
-
614
-
615 // Convert exponent2 to 1
-
616 ptr[0] = 1;
-
617 memset(ptr + 1, 0, size_prime - 1);
-
618 ptr += size_prime;
-
619
-
620 // Skip coefficient
-
621 ptr += size_prime;
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <assert.h>
+
13#include <WinCrypt.h>
+
14#include <algorithm>
+
15#include <string>
+
16#include <vector>
+
17
+
20
+
22template<class _Traits, class _Ax>
+
23static DWORD CertGetNameStringA(_In_ PCCERT_CONTEXT pCertContext, _In_ DWORD dwType, _In_ DWORD dwFlags, _In_opt_ void *pvTypePara, _Out_ std::basic_string<char, _Traits, _Ax> &sNameString)
+
24{
+
25 // Query the final string length first.
+
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}
+
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}
+
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, (BYTE*)aData.data(), &dwSize))
+
72 return TRUE;
+
73 }
+
74
+
75 return FALSE;
+
76}
+
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, (BYTE*)aData.data(), &dwSize, dwFlags))
+
97 return TRUE;
+
98 }
+
99
+
100 return FALSE;
+
101}
+
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}
+
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, (BYTE*)aData.data(), &dwSize, dwFlags))
+
134 return TRUE;
+
135 }
+
136
+
137 return FALSE;
+
138}
+
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}
+
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, aData.data(), &dwKeyBLOBSize))
+
165 return TRUE;
+
166 }
+
167
+
168 return FALSE;
+
169}
+
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 DWORD
+
180 dwDataLen = (DWORD)(aData.size() * sizeof(_Ty)),
+
181 dwBufLen = (DWORD)(aData.capacity() * sizeof(_Ty)),
+
182 dwEncLen = dwDataLen,
+
183 dwResult;
+
184
+
185 if (dwBufLen) {
+
186 aData.resize(dwBufLen);
+
187 if (CryptEncrypt(hKey, hHash, Final, dwFlags, (BYTE*)aData.data(), &dwEncLen, dwBufLen)) {
+
188 // Encryption succeeded.
+
189 assert(dwEncLen <= dwBufLen);
+
190 if (dwEncLen < dwBufLen)
+
191 aData.resize((dwEncLen + sizeof(_Ty) - 1) / sizeof(_Ty));
+
192 return TRUE;
+
193 } else
+
194 dwResult = GetLastError();
+
195 } else if (CryptEncrypt(hKey, NULL, Final, dwFlags, NULL, &dwEncLen, 0)) {
+
196 // CryptEncrypt() always succeeds for output data size queries.
+
197 // dwEncLen contains required output data size. Continue as if the buffer was to small. Actually, the output buffer _was_ too small!
+
198 dwResult = ERROR_MORE_DATA;
+
199 } else
+
200 dwResult = GetLastError();
+
201
+
202 if (dwResult == ERROR_MORE_DATA) {
+
203 // Encrypted data will be longer. Reserve more space and retry.
+
204 aData.resize(((dwBufLen = dwEncLen) + sizeof(_Ty) - 1) / sizeof(_Ty));
+
205 dwEncLen = dwDataLen;
+
206 if (CryptEncrypt(hKey, hHash, Final, dwFlags, (BYTE*)aData.data(), &dwEncLen, dwBufLen)) {
+
207 // Encryption succeeded.
+
208 assert(dwEncLen <= dwBufLen);
+
209 if (dwEncLen < dwBufLen)
+
210 aData.resize((dwEncLen + sizeof(_Ty) - 1) / sizeof(_Ty));
+
211 return TRUE;
+
212 }
+
213 } else {
+
214 // Resize back to data length.
+
215 aData.resize((dwDataLen + sizeof(_Ty) - 1) / sizeof(_Ty));
+
216 }
+
217
+
218 return FALSE;
+
219}
+
220
+
226template<class _Ty, class _Ax>
+
227static _Success_(return != 0) BOOL CryptDecrypt(_In_ HCRYPTKEY hKey, _In_opt_ HCRYPTHASH hHash, _In_ BOOL Final, _In_ DWORD dwFlags, _Inout_ std::vector<_Ty, _Ax> &aData)
+
228{
+
229 DWORD dwDataLen = (DWORD)(aData.size() * sizeof(_Ty));
+
230
+
231 if (CryptDecrypt(hKey, hHash, Final, dwFlags, (BYTE*)aData.data(), &dwDataLen)) {
+
232 // Decryption succeeded.
+
233 aData.resize((dwDataLen + sizeof(_Ty) - 1) / sizeof(_Ty));
+
234 return TRUE;
+
235 }
+
236
+
237 return FALSE;
+
238}
+
239
+
241
+
242namespace winstd
+
243{
+
246
+
252 class cert_context : public dplhandle<PCCERT_CONTEXT, NULL>
+
253 {
+ +
255
+
256 public:
+ +
263 {
+
264 if (m_h != invalid)
+ +
266 }
+
267
+
276 bool operator==(_In_ const handle_type &other) const noexcept
+
277 {
+
278 // TODO: [Crypto] Make constant time.
+
279 return
+
280 m_h == other ||
+
281 m_h->cbCertEncoded == other->cbCertEncoded && memcmp(m_h->pbCertEncoded, other->pbCertEncoded, m_h->cbCertEncoded) == 0;
+
282 }
+
283
+
292 bool operator!=(_In_ const handle_type &other) const noexcept
+
293 {
+
294 return !operator==(other);
+
295 }
+
296
+
305 bool operator<(_In_ const handle_type &other) const noexcept
+
306 {
+
307 // TODO: [Crypto] Make constant time.
+
308 const int r = memcmp(m_h->pbCertEncoded, other->pbCertEncoded, std::min<DWORD>(m_h->cbCertEncoded, other->cbCertEncoded));
+
309 return r < 0 || r == 0 && m_h->cbCertEncoded < other->cbCertEncoded;
+
310 }
+
311
+
320 bool operator>(_In_ const handle_type &other) const noexcept
+
321 {
+
322 // TODO: [Crypto] Make constant time.
+
323 const int r = memcmp(m_h->pbCertEncoded, other->pbCertEncoded, std::min<DWORD>(m_h->cbCertEncoded, other->cbCertEncoded));
+
324 return r > 0 || r == 0 && m_h->cbCertEncoded > other->cbCertEncoded;
+
325 }
+
326
+
335 bool operator<=(_In_ const handle_type &other) const noexcept
+
336 {
+
337 return !operator>(other);
+
338 }
+
339
+
348 bool operator>=(_In_ const handle_type &other) const noexcept
+
349 {
+
350 return !operator<(other);
+
351 }
+
352
+
353 protected:
+
359 void free_internal() noexcept override
+
360 {
+
361 CertFreeCertificateContext(m_h);
+
362 }
+
363
+
373 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
+
374 {
+
375 return CertDuplicateCertificateContext(h);
+
376 }
+
377 };
+
378
+
384 class cert_chain_context : public dplhandle<PCCERT_CHAIN_CONTEXT, NULL>
+
385 {
+ +
387
+
388 public:
+ +
395 {
+
396 if (m_h != invalid)
+ +
398 }
+
399
+
400 protected:
+
406 void free_internal() noexcept override
+
407 {
+
408 CertFreeCertificateChain(m_h);
+
409 }
+
410
+
420 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
+
421 {
+
422 return CertDuplicateCertificateChain(h);
+
423 }
+
424 };
+
425
+
432 class cert_store : public handle<HCERTSTORE, NULL>
+
433 {
+ +
435
+
436 public:
+
442 virtual ~cert_store()
+
443 {
+
444 if (m_h != invalid)
+ +
446 }
+
447
+
448 protected:
+
454 void free_internal() noexcept override
+
455 {
+
456 CertCloseStore(m_h, 0);
+
457 }
+
458 };
+
459
+
465 class crypt_prov : public handle<HCRYPTPROV, NULL>
+
466 {
+ +
468
+
469 public:
+
475 virtual ~crypt_prov()
+
476 {
+
477 if (m_h != invalid)
+ +
479 }
+
480
+
481 protected:
+
487 void free_internal() noexcept override
+
488 {
+
489 CryptReleaseContext(m_h, 0);
+
490 }
+
491 };
+
492
+
498 class crypt_hash : public dplhandle<HCRYPTHASH, NULL>
+
499 {
+ +
501
+
502 public:
+
508 virtual ~crypt_hash()
+
509 {
+
510 if (m_h != invalid)
+ +
512 }
+
513
+
514 protected:
+
520 void free_internal() noexcept override
+
521 {
+
522 CryptDestroyHash(m_h);
+
523 }
+
524
+
534 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
+
535 {
+
536 handle_type hNew;
+
537 return CryptDuplicateHash(h, NULL, 0, &hNew) ? hNew : invalid;
+
538 }
+
539 };
+
540
+
549 class crypt_key : public dplhandle<HCRYPTKEY, NULL>
+
550 {
+ +
552
+
553 public:
+
559 virtual ~crypt_key()
+
560 {
+
561 if (m_h != invalid)
+ +
563 }
+
564
+
573 bool create_exp1(_In_ HCRYPTPROV hProv, _In_ DWORD dwKeySpec)
+
574 {
+
575 if (dwKeySpec != AT_KEYEXCHANGE && dwKeySpec != AT_SIGNATURE) {
+
576 SetLastError(ERROR_INVALID_PARAMETER);
+
577 return false;
+
578 }
+
579
+
580 // Generate the private key.
+
581 handle_type h;
+
582 if (CryptGenKey(hProv, dwKeySpec, CRYPT_EXPORTABLE, &h)) {
+
583 // Export the private key, we'll convert it to a private exponent of one key.
+
584 std::vector<BYTE, sanitizing_allocator<BYTE>> key_blob;
+
585 if (CryptExportKey(h, 0, PRIVATEKEYBLOB, 0, key_blob)) {
+
586 CryptDestroyKey(h);
+
587
+
588 // Get the byte length of the key.
+
589 size_t
+
590 size_key = *reinterpret_cast<DWORD*>(&key_blob[12])/8,
+
591 size_prime = size_key/2;
+
592
+
593 // Modify the Exponent in Key BLOB format
+
594 // Key BLOB format is documented in SDK
+
595
+
596 // Convert pubexp in rsapubkey to 1
+
597 LPBYTE ptr = &key_blob[16];
+
598 *reinterpret_cast<DWORD*>(ptr) = 1;
+
599 ptr += sizeof(DWORD);
+
600
+
601 // Skip modulus, prime1, prime2
+
602 ptr += size_key;
+
603 ptr += size_prime;
+
604 ptr += size_prime;
+
605
+
606 // Convert exponent1 to 1
+
607 ptr[0] = 1;
+
608 memset(ptr + 1, 0, size_prime - 1);
+
609 ptr += size_prime;
+
610
+
611 // Convert exponent2 to 1
+
612 ptr[0] = 1;
+
613 memset(ptr + 1, 0, size_prime - 1);
+
614 ptr += size_prime;
+
615
+
616 // Skip coefficient
+
617 ptr += size_prime;
+
618
+
619 // Convert privateExponent to 1
+
620 ptr[0] = 1;
+
621 memset(ptr + 1, 0, size_key - 1);
622
-
623 // Convert privateExponent to 1
-
624 ptr[0] = 1;
-
625 memset(ptr + 1, 0, size_key - 1);
-
626
-
627 // Import the exponent-of-one private key.
-
628 if (CryptImportKey(hProv, key_blob.data(), static_cast<DWORD>(key_blob.size()), 0, 0, &h)) {
-
629 attach(h);
-
630 return true;
-
631 }
-
632 } else
-
633 CryptDestroyKey(h);
-
634 }
-
635
-
636 return false;
-
637 }
-
638
-
639 protected:
-
645 void free_internal() noexcept override
-
646 {
-
647 CryptDestroyKey(m_h);
-
648 }
-
649
-
659 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
-
660 {
-
661 handle_type hNew;
-
662 return CryptDuplicateKey(h, NULL, 0, &hNew) ? hNew : invalid;
-
663 }
-
664 };
-
665
-
669 #pragma warning(push)
-
670 #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.
-
671 class data_blob : public DATA_BLOB
-
672 {
-
673 public:
-
677 data_blob() noexcept
-
678 {
-
679 cbData = 0;
-
680 pbData = NULL;
-
681 }
-
682
-
686 data_blob(_In_count_(size) BYTE *data, _In_ DWORD size) noexcept
-
687 {
-
688 cbData = size;
-
689 pbData = data;
-
690 }
-
691
-
695 data_blob(_In_ const DATA_BLOB &other)
-
696 {
-
697 cbData = other.cbData;
-
698 if (cbData) {
-
699 pbData = static_cast<BYTE*>(LocalAlloc(LMEM_FIXED, other.cbData));
-
700 if (!pbData) throw win_runtime_error("LocalAlloc failed.");
-
701 memcpy(pbData, other.pbData, other.cbData);
-
702 } else
-
703 pbData = NULL;
-
704 }
-
705
-
709 data_blob(_Inout_ data_blob &&other) noexcept
-
710 {
-
711 cbData = other.cbData;
-
712 pbData = other.pbData;
-
713 other.cbData = 0;
-
714 other.pbData = NULL;
-
715 }
-
716
-
720 virtual ~data_blob()
-
721 {
-
722 if (pbData != NULL)
-
723 LocalFree(pbData);
-
724 }
-
725
-
729 data_blob& operator=(_In_ const DATA_BLOB &other)
-
730 {
-
731 if (this != &other) {
-
732 cbData = other.cbData;
-
733 if (pbData)
-
734 LocalFree(pbData);
-
735 if (cbData) {
-
736 pbData = static_cast<BYTE*>(LocalAlloc(LMEM_FIXED, other.cbData));
-
737 if (!pbData) throw win_runtime_error("LocalAlloc failed.");
-
738 memcpy(pbData, other.pbData, other.cbData);
-
739 } else
-
740 pbData = NULL;
-
741 }
-
742
-
743 return *this;
-
744 }
-
745
-
749 data_blob& operator=(_Inout_ data_blob &&other) noexcept
-
750 {
-
751 if (this != &other) {
-
752 cbData = other.cbData;
-
753 if (pbData)
-
754 LocalFree(pbData);
-
755 pbData = other.pbData;
-
756 other.cbData = 0;
-
757 other.pbData = NULL;
-
758 }
-
759
-
760 return *this;
-
761 }
-
762
-
766 DWORD size() const noexcept
-
767 {
-
768 return cbData;
-
769 }
-
770
-
774 const BYTE* data() const noexcept
-
775 {
-
776 return pbData;
-
777 }
-
778
-
782 BYTE* data() noexcept
-
783 {
-
784 return pbData;
-
785 }
-
786 };
-
787 #pragma warning(pop)
-
788
-
790}
-
791
-
794
-
795#pragma warning(push)
-
796#pragma warning(disable: 4505) // Don't warn on unused code
-
797
-
803static 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)
-
804{
-
805 PCCERT_CHAIN_CONTEXT pChainContext;
-
806 BOOL bResult = CertGetCertificateChain(hChainEngine, pCertContext, pTime, hAdditionalStore, pChainPara, dwFlags, pvReserved, &pChainContext);
-
807 if (bResult)
-
808 ctx.attach(pChainContext);
-
809 return bResult;
-
810}
-
811
-
813static BOOL CryptAcquireContextA(_Inout_ winstd::crypt_prov &prov, _In_opt_ LPCSTR szContainer, _In_opt_ LPCSTR szProvider, _In_ DWORD dwProvType, _In_ DWORD dwFlags)
-
814{
-
815 HCRYPTPROV h;
-
816 BOOL bResult = CryptAcquireContextA(&h, szContainer, szProvider, dwProvType, dwFlags);
-
817 if (bResult)
-
818 prov.attach(h);
-
819 return bResult;
-
820}
-
821
-
827static BOOL CryptAcquireContextW(_Inout_ winstd::crypt_prov &prov, _In_opt_ LPCWSTR szContainer, _In_opt_ LPCWSTR szProvider, _In_ DWORD dwProvType, _In_ DWORD dwFlags)
-
828{
-
829 HCRYPTPROV h;
-
830 BOOL bResult = CryptAcquireContextW(&h, szContainer, szProvider, dwProvType, dwFlags);
-
831 if (bResult)
-
832 prov.attach(h);
-
833 return bResult;
-
834}
-
835
-
841static BOOL CryptCreateHash(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ HCRYPTKEY hKey, _In_ DWORD dwFlags, _Inout_ winstd::crypt_hash &hash)
-
842{
-
843 HCRYPTHASH h;
-
844 BOOL bResult = CryptCreateHash(hProv, Algid, hKey, dwFlags, &h);
-
845 if (bResult)
-
846 hash.attach(h);
-
847 return bResult;
-
848}
-
849
-
855static BOOL CryptGenKey(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
-
856{
-
857 HCRYPTKEY h;
-
858 BOOL bResult = CryptGenKey(hProv, Algid, dwFlags, &h);
-
859 if (bResult)
-
860 key.attach(h);
-
861 return bResult;
-
862}
-
863
-
869static bool CryptImportKey(_In_ HCRYPTPROV hProv, __in_bcount(dwDataLen) LPCBYTE pbData, _In_ DWORD dwDataLen, _In_ HCRYPTKEY hPubKey, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
-
870{
-
871 HCRYPTKEY h;
-
872 BOOL bResult = CryptImportKey(hProv, pbData, dwDataLen, hPubKey, dwFlags, &h);
-
873 if (bResult)
-
874 key.attach(h);
-
875 return bResult;
-
876}
-
877
-
883static bool CryptImportPublicKeyInfo(_In_ HCRYPTPROV hCryptProv, _In_ DWORD dwCertEncodingType, _In_ PCERT_PUBLIC_KEY_INFO pInfo, _Inout_ winstd::crypt_key &key)
-
884{
-
885 HCRYPTKEY h;
-
886 BOOL bResult = CryptImportPublicKeyInfo(hCryptProv, dwCertEncodingType, pInfo, &h);
-
887 if (bResult)
-
888 key.attach(h);
-
889 return bResult;
-
890}
-
891
-
897static bool CryptDeriveKey(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ HCRYPTHASH hBaseData, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
-
898{
-
899 HCRYPTKEY h;
-
900 BOOL bResult = CryptDeriveKey(hProv, Algid, hBaseData, dwFlags, &h);
-
901 if (bResult)
-
902 key.attach(h);
-
903 return bResult;
-
904}
-
905
-
906#pragma warning(pop)
-
907
-
General API.
-
PCCERT_CHAIN_CONTEXT wrapper class.
Definition: Crypt.h:389
-
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the certificate chain context.
Definition: Crypt.h:424
-
virtual ~cert_chain_context()
Destroys the certificate chain context.
Definition: Crypt.h:398
-
void free_internal() noexcept override
Destroys the certificate chain context.
Definition: Crypt.h:410
-
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
-
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the certificate context.
Definition: Crypt.h:377
-
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
-
virtual ~cert_context()
Destroys the certificate context.
Definition: Crypt.h:266
-
HCERTSTORE wrapper class.
Definition: Crypt.h:437
-
virtual ~cert_store()
Closes the certificate store.
Definition: Crypt.h:446
-
void free_internal() noexcept override
Closes the certificate store.
Definition: Crypt.h:458
-
HCRYPTHASH wrapper class.
Definition: Crypt.h:503
-
void free_internal() noexcept override
Destroys the hash context.
Definition: Crypt.h:524
-
virtual ~crypt_hash()
Destroys the hash context.
Definition: Crypt.h:512
-
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the hash context.
Definition: Crypt.h:538
-
HCRYPTKEY wrapper class.
Definition: Crypt.h:554
-
virtual ~crypt_key()
Destroys the key.
Definition: Crypt.h:563
-
bool create_exp1(HCRYPTPROV hProv, DWORD dwKeySpec)
Creates Exponent-of-one key.
Definition: Crypt.h:577
-
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the key.
Definition: Crypt.h:659
-
void free_internal() noexcept override
Destroys the key.
Definition: Crypt.h:645
-
HCRYPTPROV wrapper class.
Definition: Crypt.h:470
-
virtual ~crypt_prov()
Releases the cryptographic context.
Definition: Crypt.h:479
-
void free_internal() noexcept override
Releases the cryptographic context.
Definition: Crypt.h:491
-
DATA_BLOB wrapper class.
Definition: Crypt.h:672
-
data_blob(const DATA_BLOB &other)
Duplicate an existing BLOB.
Definition: Crypt.h:695
-
virtual ~data_blob()
Destroys the BLOB.
Definition: Crypt.h:720
-
BYTE * data() noexcept
Get BLOB buffer.
Definition: Crypt.h:782
-
const BYTE * data() const noexcept
Get BLOB buffer.
Definition: Crypt.h:774
-
data_blob() noexcept
Initializes an empty BLOB.
Definition: Crypt.h:677
-
data_blob(data_blob &&other) noexcept
Move an existing BLOB.
Definition: Crypt.h:709
-
data_blob & operator=(data_blob &&other) noexcept
Move an existing BLOB.
Definition: Crypt.h:749
-
data_blob(BYTE *data, DWORD size) noexcept
Initializes a BLOB from existing data.
Definition: Crypt.h:686
-
DWORD size() const noexcept
Get BLOB size.
Definition: Crypt.h:766
-
data_blob & operator=(const DATA_BLOB &other)
Copy an existing BLOB.
Definition: Crypt.h:729
-
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition: Common.h:877
-
Base abstract template class to support generic object handle keeping.
Definition: Common.h:615
-
PCCERT_CONTEXT handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:620
-
handle_type m_h
Object handle.
Definition: Common.h:866
-
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:829
-
Windows runtime error.
Definition: Common.h:1056
-
static bool CryptImportPublicKeyInfo(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, winstd::crypt_key &key)
Imports the public key.
Definition: Crypt.h:883
-
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:63
-
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:803
-
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:88
-
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:45
-
static BOOL CryptAcquireContextA(winstd::crypt_prov &prov, LPCSTR szContainer, LPCSTR szProvider, DWORD dwProvType, DWORD dwFlags)
Acquires the cryptographic context.
Definition: Crypt.h:813
-
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:27
-
static BOOL CryptGenKey(HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, winstd::crypt_key &key)
Generates the key.
Definition: Crypt.h:855
-
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:162
-
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:125
-
static BOOL CryptCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, winstd::crypt_hash &hash)
Creates the hash context.
Definition: Crypt.h:841
-
static BOOL CryptAcquireContextW(winstd::crypt_prov &prov, LPCWSTR szContainer, LPCWSTR szProvider, DWORD dwProvType, DWORD dwFlags)
Acquires the cryptographic context.
Definition: Crypt.h:827
-
static BOOL CryptEncrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, std::vector< _Ty, _Ax > &aData)
Encrypts data.
Definition: Crypt.h:181
-
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:897
-
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:231
-
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:869
-
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:101
-
#define WINSTD_DPLHANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:183
-
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:171
-
static const PCCERT_CONTEXT invalid
Invalid handle value.
Definition: Common.h:625
+
623 // Import the exponent-of-one private key.
+
624 if (CryptImportKey(hProv, key_blob.data(), static_cast<DWORD>(key_blob.size()), 0, 0, &h)) {
+
625 attach(h);
+
626 return true;
+
627 }
+
628 } else
+
629 CryptDestroyKey(h);
+
630 }
+
631
+
632 return false;
+
633 }
+
634
+
635 protected:
+
641 void free_internal() noexcept override
+
642 {
+
643 CryptDestroyKey(m_h);
+
644 }
+
645
+
655 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
+
656 {
+
657 handle_type hNew;
+
658 return CryptDuplicateKey(h, NULL, 0, &hNew) ? hNew : invalid;
+
659 }
+
660 };
+
661
+
665 #pragma warning(push)
+
666 #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.
+
667 class data_blob : public DATA_BLOB
+
668 {
+
669 public:
+
673 data_blob() noexcept
+
674 {
+
675 cbData = 0;
+
676 pbData = NULL;
+
677 }
+
678
+
682 data_blob(_In_count_(size) BYTE *data, _In_ DWORD size) noexcept
+
683 {
+
684 cbData = size;
+
685 pbData = data;
+
686 }
+
687
+
691 data_blob(_In_ const DATA_BLOB &other)
+
692 {
+
693 cbData = other.cbData;
+
694 if (cbData) {
+
695 pbData = static_cast<BYTE*>(LocalAlloc(LMEM_FIXED, other.cbData));
+
696 if (!pbData) throw win_runtime_error("LocalAlloc failed.");
+
697 memcpy(pbData, other.pbData, other.cbData);
+
698 } else
+
699 pbData = NULL;
+
700 }
+
701
+
705 data_blob(_Inout_ data_blob &&other) noexcept
+
706 {
+
707 cbData = other.cbData;
+
708 pbData = other.pbData;
+
709 other.cbData = 0;
+
710 other.pbData = NULL;
+
711 }
+
712
+
716 virtual ~data_blob()
+
717 {
+
718 if (pbData != NULL)
+
719 LocalFree(pbData);
+
720 }
+
721
+
725 data_blob& operator=(_In_ const DATA_BLOB &other)
+
726 {
+
727 if (this != &other) {
+
728 cbData = other.cbData;
+
729 if (pbData)
+
730 LocalFree(pbData);
+
731 if (cbData) {
+
732 pbData = static_cast<BYTE*>(LocalAlloc(LMEM_FIXED, other.cbData));
+
733 if (!pbData) throw win_runtime_error("LocalAlloc failed.");
+
734 memcpy(pbData, other.pbData, other.cbData);
+
735 } else
+
736 pbData = NULL;
+
737 }
+
738
+
739 return *this;
+
740 }
+
741
+
745 data_blob& operator=(_Inout_ data_blob &&other) noexcept
+
746 {
+
747 if (this != &other) {
+
748 cbData = other.cbData;
+
749 if (pbData)
+
750 LocalFree(pbData);
+
751 pbData = other.pbData;
+
752 other.cbData = 0;
+
753 other.pbData = NULL;
+
754 }
+
755
+
756 return *this;
+
757 }
+
758
+
762 DWORD size() const noexcept
+
763 {
+
764 return cbData;
+
765 }
+
766
+
770 const BYTE* data() const noexcept
+
771 {
+
772 return pbData;
+
773 }
+
774
+
778 BYTE* data() noexcept
+
779 {
+
780 return pbData;
+
781 }
+
782 };
+
783 #pragma warning(pop)
+
784
+
786}
+
787
+
790
+
791#pragma warning(push)
+
792#pragma warning(disable: 4505) // Don't warn on unused code
+
793
+
799static 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)
+
800{
+
801 PCCERT_CHAIN_CONTEXT pChainContext;
+
802 BOOL bResult = CertGetCertificateChain(hChainEngine, pCertContext, pTime, hAdditionalStore, pChainPara, dwFlags, pvReserved, &pChainContext);
+
803 if (bResult)
+
804 ctx.attach(pChainContext);
+
805 return bResult;
+
806}
+
807
+
809static BOOL CryptAcquireContextA(_Inout_ winstd::crypt_prov &prov, _In_opt_ LPCSTR szContainer, _In_opt_ LPCSTR szProvider, _In_ DWORD dwProvType, _In_ DWORD dwFlags)
+
810{
+
811 HCRYPTPROV h;
+
812 BOOL bResult = CryptAcquireContextA(&h, szContainer, szProvider, dwProvType, dwFlags);
+
813 if (bResult)
+
814 prov.attach(h);
+
815 return bResult;
+
816}
+
817
+
823static BOOL CryptAcquireContextW(_Inout_ winstd::crypt_prov &prov, _In_opt_ LPCWSTR szContainer, _In_opt_ LPCWSTR szProvider, _In_ DWORD dwProvType, _In_ DWORD dwFlags)
+
824{
+
825 HCRYPTPROV h;
+
826 BOOL bResult = CryptAcquireContextW(&h, szContainer, szProvider, dwProvType, dwFlags);
+
827 if (bResult)
+
828 prov.attach(h);
+
829 return bResult;
+
830}
+
831
+
837static BOOL CryptCreateHash(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ HCRYPTKEY hKey, _In_ DWORD dwFlags, _Inout_ winstd::crypt_hash &hash)
+
838{
+
839 HCRYPTHASH h;
+
840 BOOL bResult = CryptCreateHash(hProv, Algid, hKey, dwFlags, &h);
+
841 if (bResult)
+
842 hash.attach(h);
+
843 return bResult;
+
844}
+
845
+
851static BOOL CryptGenKey(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
+
852{
+
853 HCRYPTKEY h;
+
854 BOOL bResult = CryptGenKey(hProv, Algid, dwFlags, &h);
+
855 if (bResult)
+
856 key.attach(h);
+
857 return bResult;
+
858}
+
859
+
865static bool CryptImportKey(_In_ HCRYPTPROV hProv, __in_bcount(dwDataLen) LPCBYTE pbData, _In_ DWORD dwDataLen, _In_ HCRYPTKEY hPubKey, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
+
866{
+
867 HCRYPTKEY h;
+
868 BOOL bResult = CryptImportKey(hProv, pbData, dwDataLen, hPubKey, dwFlags, &h);
+
869 if (bResult)
+
870 key.attach(h);
+
871 return bResult;
+
872}
+
873
+
879static bool CryptImportPublicKeyInfo(_In_ HCRYPTPROV hCryptProv, _In_ DWORD dwCertEncodingType, _In_ PCERT_PUBLIC_KEY_INFO pInfo, _Inout_ winstd::crypt_key &key)
+
880{
+
881 HCRYPTKEY h;
+
882 BOOL bResult = CryptImportPublicKeyInfo(hCryptProv, dwCertEncodingType, pInfo, &h);
+
883 if (bResult)
+
884 key.attach(h);
+
885 return bResult;
+
886}
+
887
+
893static bool CryptDeriveKey(_In_ HCRYPTPROV hProv, _In_ ALG_ID Algid, _In_ HCRYPTHASH hBaseData, _In_ DWORD dwFlags, _Inout_ winstd::crypt_key &key)
+
894{
+
895 HCRYPTKEY h;
+
896 BOOL bResult = CryptDeriveKey(hProv, Algid, hBaseData, dwFlags, &h);
+
897 if (bResult)
+
898 key.attach(h);
+
899 return bResult;
+
900}
+
901
+
902#pragma warning(pop)
+
903
+
PCCERT_CHAIN_CONTEXT wrapper class.
Definition: Crypt.h:385
+
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the certificate chain context.
Definition: Crypt.h:420
+
virtual ~cert_chain_context()
Destroys the certificate chain context.
Definition: Crypt.h:394
+
void free_internal() noexcept override
Destroys the certificate chain context.
Definition: Crypt.h:406
+
PCCERT_CONTEXT wrapper class.
Definition: Crypt.h:253
+
bool operator<=(const handle_type &other) const noexcept
Is certificate less than or equal?
Definition: Crypt.h:335
+
void free_internal() noexcept override
Destroys the certificate context.
Definition: Crypt.h:359
+
bool operator==(const handle_type &other) const noexcept
Is certificate equal to?
Definition: Crypt.h:276
+
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the certificate context.
Definition: Crypt.h:373
+
bool operator>=(const handle_type &other) const noexcept
Is certificate greater than or equal?
Definition: Crypt.h:348
+
bool operator>(const handle_type &other) const noexcept
Is certificate greater than?
Definition: Crypt.h:320
+
bool operator<(const handle_type &other) const noexcept
Is certificate less than?
Definition: Crypt.h:305
+
bool operator!=(const handle_type &other) const noexcept
Is certificate not equal to?
Definition: Crypt.h:292
+
virtual ~cert_context()
Destroys the certificate context.
Definition: Crypt.h:262
+
HCERTSTORE wrapper class.
Definition: Crypt.h:433
+
virtual ~cert_store()
Closes the certificate store.
Definition: Crypt.h:442
+
void free_internal() noexcept override
Closes the certificate store.
Definition: Crypt.h:454
+
HCRYPTHASH wrapper class.
Definition: Crypt.h:499
+
void free_internal() noexcept override
Destroys the hash context.
Definition: Crypt.h:520
+
virtual ~crypt_hash()
Destroys the hash context.
Definition: Crypt.h:508
+
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the hash context.
Definition: Crypt.h:534
+
HCRYPTKEY wrapper class.
Definition: Crypt.h:550
+
virtual ~crypt_key()
Destroys the key.
Definition: Crypt.h:559
+
bool create_exp1(HCRYPTPROV hProv, DWORD dwKeySpec)
Creates Exponent-of-one key.
Definition: Crypt.h:573
+
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the key.
Definition: Crypt.h:655
+
void free_internal() noexcept override
Destroys the key.
Definition: Crypt.h:641
+
HCRYPTPROV wrapper class.
Definition: Crypt.h:466
+
virtual ~crypt_prov()
Releases the cryptographic context.
Definition: Crypt.h:475
+
void free_internal() noexcept override
Releases the cryptographic context.
Definition: Crypt.h:487
+
DATA_BLOB wrapper class.
Definition: Crypt.h:668
+
data_blob(const DATA_BLOB &other)
Duplicate an existing BLOB.
Definition: Crypt.h:691
+
virtual ~data_blob()
Destroys the BLOB.
Definition: Crypt.h:716
+
BYTE * data() noexcept
Get BLOB buffer.
Definition: Crypt.h:778
+
const BYTE * data() const noexcept
Get BLOB buffer.
Definition: Crypt.h:770
+
data_blob() noexcept
Initializes an empty BLOB.
Definition: Crypt.h:673
+
data_blob(data_blob &&other) noexcept
Move an existing BLOB.
Definition: Crypt.h:705
+
data_blob & operator=(data_blob &&other) noexcept
Move an existing BLOB.
Definition: Crypt.h:745
+
data_blob(BYTE *data, DWORD size) noexcept
Initializes a BLOB from existing data.
Definition: Crypt.h:682
+
DWORD size() const noexcept
Get BLOB size.
Definition: Crypt.h:762
+
data_blob & operator=(const DATA_BLOB &other)
Copy an existing BLOB.
Definition: Crypt.h:725
+
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition: Common.h:869
+
Base abstract template class to support generic object handle keeping.
Definition: Common.h:607
+
PCCERT_CONTEXT handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:612
+
handle_type m_h
Object handle.
Definition: Common.h:858
+
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:821
+
Windows runtime error.
Definition: Common.h:1048
+
static bool CryptImportPublicKeyInfo(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, winstd::crypt_key &key)
Imports the public key.
Definition: Crypt.h:879
+
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:799
+
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:809
+
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:851
+
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:837
+
static BOOL CryptAcquireContextW(winstd::crypt_prov &prov, LPCWSTR szContainer, LPCWSTR szProvider, DWORD dwProvType, DWORD dwFlags)
Acquires the cryptographic context.
Definition: Crypt.h:823
+
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:893
+
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:227
+
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:865
+
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:93
+
#define WINSTD_DPLHANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:175
+
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:163
+
static const PCCERT_CONTEXT invalid
Invalid handle value.
Definition: Common.h:617
diff --git a/_e_a_p_8h.html b/_e_a_p_8h.html deleted file mode 100644 index 7fa65e0c..00000000 --- a/_e_a_p_8h.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - -WinStd: include/WinStd/EAP.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
EAP.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft EAP API. -More...

-
#include "Common.h"
-#include <eaphostpeerconfigapis.h>
-#include <eaptypes.h>
-#include <EapHostPeerTypes.h>
-#include <eapmethodtypes.h>
-#include <eappapis.h>
-#include <WinSock2.h>
-#include <memory>
-
-

Go to the source code of this file.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Classes

struct  winstd::EapHostPeerFreeMemory_delete
 Deleter for unique_ptr using EapHostPeerFreeMemory. More...
 
struct  winstd::EapHostPeerFreeRuntimeMemory_delete
 Deleter for unique_ptr using EapHostPeerFreeRuntimeMemory. More...
 
struct  winstd::EapHostPeerFreeErrorMemory_delete
 Deleter for unique_ptr to EAP_ERROR using EapHostPeerFreeErrorMemory. More...
 
struct  winstd::EapHostPeerFreeEapError_delete
 Deleter for unique_ptr to EAP_ERROR using EapHostPeerFreeEapError. More...
 
class  winstd::eap_attr
 EAP_ATTRIBUTE wrapper class. More...
 
class  winstd::eap_method_prop
 EAP_METHOD_PROPERTY wrapper class. More...
 
class  winstd::eap_packet
 EapPacket wrapper class. More...
 
class  winstd::eap_method_info_array
 EAP_METHOD_INFO_ARRAY wrapper class. More...
 
class  winstd::eap_runtime_error
 EapHost runtime error. More...
 
- - - - - - - - - - - - - -

-Typedefs

-typedef std::unique_ptr< BYTE[], EapHostPeerFreeMemory_delete > winstd::eap_blob
 EapHost BLOB wrapper class.
 
-typedef std::unique_ptr< BYTE[], EapHostPeerFreeRuntimeMemory_delete > winstd::eap_blob_runtime
 EapHost BLOB wrapper class.
 
-typedef std::unique_ptr< EAP_ERROR, EapHostPeerFreeErrorMemory_delete > winstd::eap_error
 EAP_ERROR wrapper class.
 
-typedef std::unique_ptr< EAP_ERROR, EapHostPeerFreeEapError_delete > winstd::eap_error_runtime
 EAP_ERROR wrapper class.
 
- - - - -

-Enumerations

enum class  winstd::eap_type_t : unsigned char {
-  eap_type_t::undefined = 0 -, eap_type_t::identity = 1 -, eap_type_t::notification = 2 -, eap_type_t::nak = 3 -,
-  eap_type_t::md5_challenge = 4 -, eap_type_t::otp = 5 -, eap_type_t::gtc = 6 -, eap_type_t::tls = 13 -,
-  eap_type_t::ttls = 21 -, eap_type_t::peap = 25 -, eap_type_t::mschapv2 = 26 -, eap_type_t::ms_auth_tlv = 33 -,
-  eap_type_t::gtcp = 128 + gtc -, eap_type_t::legacy_pap = 192 -, eap_type_t::legacy_mschapv2 = 193 -, eap_type_t::start = 1 -,
-  eap_type_t::end = 192 -, eap_type_t::noneap_start = 192 -, eap_type_t::noneap_end = 254 -
- }
 EAP method numbers. More...
 
- - - - - - - -

-Functions

static bool operator== (const EAP_METHOD_TYPE &a, const EAP_METHOD_TYPE &b) noexcept
 Are EAP method types equal? More...
 
static bool operator!= (const EAP_METHOD_TYPE &a, const EAP_METHOD_TYPE &b) noexcept
 Are EAP method types non-equal? More...
 
- - - - -

-Variables

-static const EAP_ATTRIBUTE winstd::blank_eap_attr = {}
 Blank EAP attribute.
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft EAP API.

-
- - - - diff --git a/_e_a_p_8h_source.html b/_e_a_p_8h_source.html index ac9d8b51..f0b06f2c 100644 --- a/_e_a_p_8h_source.html +++ b/_e_a_p_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,524 +70,522 @@ $(function() {
EAP.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
-
14
-
15#include "Common.h"
-
16#include <eaphostpeerconfigapis.h>
-
17#include <eaptypes.h>
-
18#include <EapHostPeerTypes.h>
-
19#include <eapmethodtypes.h>
-
20#include <eappapis.h>
-
21#include <WinSock2.h>
-
22#include <memory>
-
23
-
24#pragma warning(push)
-
25#pragma warning(disable: 26812) // Windows EAP API is using unscoped enums
-
26
-
27#pragma warning(push)
-
28#pragma warning(disable: 4505) // Don't warn on unused code
-
29
-
32
-
43static bool operator==(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept
-
44{
-
45 return
-
46 a.eapType.type == b.eapType.type &&
-
47 a.eapType.dwVendorId == b.eapType.dwVendorId &&
-
48 a.eapType.dwVendorType == b.eapType.dwVendorType &&
-
49 a.dwAuthorId == a.dwAuthorId;
-
50}
-
51
-
62static bool operator!=(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept
-
63{
-
64 return !operator==(a, b);
-
65}
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <eaphostpeerconfigapis.h>
+
13#include <eaptypes.h>
+
14#include <EapHostPeerTypes.h>
+
15#include <eapmethodtypes.h>
+
16#include <eappapis.h>
+
17#include <WinSock2.h>
+
18#include <memory>
+
19
+
20#pragma warning(push)
+
21#pragma warning(disable: 26812) // Windows EAP API is using unscoped enums
+
22
+
23#pragma warning(push)
+
24#pragma warning(disable: 4505) // Don't warn on unused code
+
25
+
28
+
39static bool operator==(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept
+
40{
+
41 return
+
42 a.eapType.type == b.eapType.type &&
+
43 a.eapType.dwVendorId == b.eapType.dwVendorId &&
+
44 a.eapType.dwVendorType == b.eapType.dwVendorType &&
+
45 a.dwAuthorId == a.dwAuthorId;
+
46}
+
47
+
58static bool operator!=(_In_ const EAP_METHOD_TYPE &a, _In_ const EAP_METHOD_TYPE &b) noexcept
+
59{
+
60 return !operator==(a, b);
+
61}
+
62
+
64
+
65#pragma warning(pop)
66
-
68
-
69#pragma warning(pop)
-
70
-
71namespace winstd
-
72{
-
75
-
81 #pragma warning(suppress: 4480)
-
82 enum class eap_type_t : unsigned char {
-
83 undefined = 0,
-
84 identity = 1,
-
85 notification = 2,
-
86 nak = 3,
-
87 md5_challenge = 4,
-
88 otp = 5,
-
89 gtc = 6,
-
90 tls = 13,
-
91 ttls = 21,
-
92 peap = 25,
-
93 mschapv2 = 26,
-
94 ms_auth_tlv = 33,
-
95
-
96 gtcp = 128 + gtc,
-
97
-
98 legacy_pap = 192,
-
99 legacy_mschapv2 = 193,
-
100
-
101 start = 1,
-
102 end = 192,
-
103 noneap_start = 192,
-
104 noneap_end = 254,
-
105 };
-
106
- -
111 {
- -
116
-
122 template <class _T>
-
123 void operator()(_T *_Ptr) const
-
124 {
-
125 EapHostPeerFreeMemory((BYTE*)_Ptr);
-
126 }
-
127 };
-
128
-
132 typedef std::unique_ptr<BYTE[], EapHostPeerFreeMemory_delete> eap_blob;
-
133
- -
138 {
- -
143
-
147 template <class _T>
-
148 void operator()(_T *_Ptr) const
-
149 {
-
150 EapHostPeerFreeRuntimeMemory((BYTE*)_Ptr);
-
151 }
-
152 };
-
153
-
157 typedef std::unique_ptr<BYTE[], EapHostPeerFreeRuntimeMemory_delete> eap_blob_runtime;
-
158
- -
163 {
- -
168
-
174 void operator()(EAP_ERROR *_Ptr) const noexcept
-
175 {
-
176 EapHostPeerFreeErrorMemory(_Ptr);
-
177 }
-
178 };
-
179
-
183 typedef std::unique_ptr<EAP_ERROR, EapHostPeerFreeErrorMemory_delete> eap_error;
-
184
- -
189 {
- -
194
-
200 void operator()(EAP_ERROR *_Ptr) const noexcept
-
201 {
-
202 EapHostPeerFreeEapError(_Ptr);
-
203 }
-
204 };
-
205
-
209 typedef std::unique_ptr<EAP_ERROR, EapHostPeerFreeEapError_delete> eap_error_runtime;
-
210
-
214 #pragma warning(push)
-
215 #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.
-
216 class eap_attr : public EAP_ATTRIBUTE
-
217 {
-
218 public:
-
222 eap_attr() noexcept
-
223 {
-
224 eaType = eatReserved;
-
225 dwLength = 0;
-
226 pValue = NULL;
-
227 }
-
228
-
232 eap_attr(_In_ const EAP_ATTRIBUTE &a)
-
233 {
-
234 eaType = a.eaType;
-
235 dwLength = a.dwLength;
-
236 if (a.dwLength) {
-
237 pValue = new BYTE[a.dwLength];
-
238 assert(pValue);
-
239 memcpy(pValue, a.pValue, a.dwLength);
-
240 } else
-
241 pValue = NULL;
-
242 }
-
243
-
247 eap_attr(_Inout_ eap_attr &&a) noexcept
-
248 {
-
249 eaType = a.eaType;
-
250 dwLength = a.dwLength;
-
251 if (a.dwLength) {
-
252 pValue = a.pValue;
-
253 a.dwLength = 0;
-
254 a.pValue = NULL;
-
255 } else
-
256 pValue = NULL;
-
257 }
-
258
- -
263 {
-
264 if (pValue)
-
265 delete [] pValue;
-
266 }
-
267
-
271 eap_attr& operator=(_In_ const EAP_ATTRIBUTE &a)
-
272 {
-
273 if (this != &a) {
-
274 eaType = a.eaType;
-
275 dwLength = a.dwLength;
-
276 if (a.dwLength) {
-
277 BYTE *pValueNew = new BYTE[a.dwLength];
-
278 if (pValueNew) {
-
279 if (pValue)
-
280 delete [] pValue;
-
281 memcpy(pValueNew, a.pValue, a.dwLength);
-
282 pValue = pValueNew;
-
283 } else
-
284 assert(0); // Could not allocate memory
-
285 } else
-
286 pValue = NULL;
-
287 }
-
288 return *this;
-
289 }
-
290
-
294 eap_attr& operator=(_Inout_ eap_attr &&a) noexcept
-
295 {
-
296 if (this != &a) {
-
297 eaType = a.eaType;
-
298 dwLength = a.dwLength;
-
299 if (pValue)
-
300 delete [] pValue;
-
301 if (a.dwLength) {
-
302 pValue = a.pValue;
-
303 a.dwLength = 0;
-
304 a.pValue = NULL;
-
305 } else
-
306 pValue = NULL;
-
307 }
-
308 return *this;
-
309 }
-
310
-
318 void create_ms_mppe_key(_In_ BYTE bVendorType, _In_count_(nKeySize) LPCBYTE pbKey, _In_ BYTE nKeySize)
-
319 {
-
320 const BYTE nPaddingLength = static_cast<BYTE>((16 - (1 + static_cast<DWORD>(nKeySize))) % 16);
-
321 const DWORD dwLengthNew =
-
322 4 + // Vendor-Id
-
323 1 + // Vendor type
-
324 1 + // Vendor length
-
325 2 + // Salt
-
326 1 + // Key-Length
-
327 nKeySize + // Key
-
328 nPaddingLength; // Padding
-
329
-
330 #pragma warning(push)
-
331 #pragma warning(disable: 6386)
-
332 LPBYTE p = new BYTE[dwLengthNew];
-
333 p[0] = 0x00; // Vendor-Id (0x137 = 311 = Microsoft)
-
334 p[1] = 0x00; // --|
-
335 p[2] = 0x01; // --|
-
336 p[3] = 0x37; // --^
-
337 p[4] = bVendorType; // Vendor type
-
338 p[5] = static_cast<BYTE>(dwLengthNew - 4); // Vendor length
-
339 p[6] = 0x00; // Salt
-
340 p[7] = 0x00; // --^
-
341 p[8] = nKeySize; // Key-Length
-
342 #pragma warning(pop)
-
343 memcpy(p + 9, pbKey, nKeySize); // Key
-
344 memset(p + 9 + nKeySize, 0, nPaddingLength); // Padding
-
345
-
346 if (pValue)
-
347 delete [] pValue;
-
348
-
349 #pragma warning(suppress: 26812) // EAP_ATTRIBUTE_TYPE is unscoped.
-
350 eaType = eatVendorSpecific;
-
351 dwLength = dwLengthNew;
-
352 pValue = p;
-
353 }
-
354 };
-
355 #pragma warning(pop)
-
356
-
360 static const EAP_ATTRIBUTE blank_eap_attr = {};
-
361
-
365 class eap_method_prop : public EAP_METHOD_PROPERTY
-
366 {
-
367 public:
-
374 eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_ BOOL value) noexcept
-
375 {
-
376 eapMethodPropertyType = type;
-
377 eapMethodPropertyValueType = empvtBool;
-
378 eapMethodPropertyValue.empvBool.length = sizeof(BOOL);
-
379 eapMethodPropertyValue.empvBool.value = value;
-
380 }
-
381
-
388 eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_ DWORD value) noexcept
-
389 {
-
390 eapMethodPropertyType = type;
-
391 eapMethodPropertyValueType = empvtDword;
-
392 eapMethodPropertyValue.empvDword.length = sizeof(DWORD);
-
393 eapMethodPropertyValue.empvDword.value = value;
-
394 }
-
395
-
402 eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_z_ LPCWSTR value) noexcept
-
403 {
-
404 eapMethodPropertyType = type;
-
405 eapMethodPropertyValueType = empvtString;
-
406 eapMethodPropertyValue.empvString.length = static_cast<DWORD>(sizeof(WCHAR)*(wcslen(value) + 1));
-
407 eapMethodPropertyValue.empvString.value = const_cast<BYTE*>(reinterpret_cast<const BYTE*>(value));
-
408 }
-
409 };
-
410
-
414 class eap_packet : public dplhandle<EapPacket*, NULL>
-
415 {
- -
417
-
418 public:
-
422 virtual ~eap_packet()
-
423 {
-
424 if (m_h != invalid)
- -
426 }
-
427
-
441 bool create(_In_ EapCode code, _In_ BYTE id, _In_ WORD size) noexcept
-
442 {
-
443 assert(size >= 4); // EAP packets must contain at least Code, Id, and Length fields: 4B.
-
444
-
445 handle_type h = static_cast<handle_type>(HeapAlloc(GetProcessHeap(), 0, size));
-
446 if (h != NULL) {
-
447 h->Code = static_cast<BYTE>(code);
-
448 h->Id = id;
-
449 *reinterpret_cast<WORD*>(h->Length) = htons(size);
-
450
-
451 attach(h);
-
452 return true;
-
453 } else {
-
454 SetLastError(ERROR_OUTOFMEMORY);
-
455 return false;
-
456 }
-
457 }
-
458
-
462 WORD size() const noexcept
-
463 {
-
464 return m_h != NULL ? ntohs(*(WORD*)m_h->Length) : 0;
-
465 }
-
466
-
467 protected:
-
471 void free_internal() noexcept override
-
472 {
-
473 HeapFree(GetProcessHeap(), 0, m_h);
-
474 }
-
475
-
479 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
-
480 {
-
481 const WORD n = ntohs(*reinterpret_cast<WORD*>(h->Length));
-
482 handle_type h2 = static_cast<handle_type>(HeapAlloc(GetProcessHeap(), 0, n));
-
483 if (h2 == NULL) {
-
484 SetLastError(ERROR_OUTOFMEMORY);
-
485 return NULL;
-
486 }
-
487 memcpy(h2, h, n);
-
488 return h2;
-
489 }
-
490 };
-
491
-
495 class eap_method_info_array : public EAP_METHOD_INFO_ARRAY
-
496 {
- -
498
-
499 public:
- -
504 {
-
505 dwNumberOfMethods = 0;
-
506 pEapMethods = NULL;
-
507 }
-
508
- -
515 {
-
516 dwNumberOfMethods = other.dwNumberOfMethods;
-
517 pEapMethods = other.pEapMethods;
-
518 other.dwNumberOfMethods = 0;
-
519 other.pEapMethods = NULL;
-
520 }
-
521
- -
526 {
-
527 if (pEapMethods)
-
528 free_internal();
-
529 }
-
530
- -
537 {
-
538 if (this != std::addressof(other)) {
-
539 if (pEapMethods)
-
540 free_internal();
-
541 dwNumberOfMethods = other.dwNumberOfMethods;
-
542 pEapMethods = other.pEapMethods;
-
543 other.dwNumberOfMethods = 0;
-
544 other.pEapMethods = NULL;
-
545 }
-
546 return *this;
-
547 }
-
548
-
549 protected:
-
551
-
552 void free_internal() noexcept
-
553 {
-
554 for (DWORD i = 0; i < dwNumberOfMethods; i++)
-
555 free_internal(pEapMethods + i);
-
556
-
557 EapHostPeerFreeMemory(reinterpret_cast<BYTE*>(pEapMethods));
-
558 }
-
559
-
560 static void free_internal(_In_ EAP_METHOD_INFO *pMethodInfo) noexcept
-
561 {
-
562 if (pMethodInfo->pInnerMethodInfo)
-
563 free_internal(pMethodInfo->pInnerMethodInfo);
+
67namespace winstd
+
68{
+
71
+
77 #pragma warning(suppress: 4480)
+
78 enum class eap_type_t : unsigned char {
+
79 undefined = 0,
+
80 identity = 1,
+
81 notification = 2,
+
82 nak = 3,
+
83 md5_challenge = 4,
+
84 otp = 5,
+
85 gtc = 6,
+
86 tls = 13,
+
87 ttls = 21,
+
88 peap = 25,
+
89 mschapv2 = 26,
+
90 ms_auth_tlv = 33,
+
91
+
92 gtcp = 128 + gtc,
+
93
+
94 legacy_pap = 192,
+
95 legacy_mschapv2 = 193,
+
96
+
97 start = 1,
+
98 end = 192,
+
99 noneap_start = 192,
+
100 noneap_end = 254,
+
101 };
+
102
+ +
107 {
+ +
112
+
118 template <class _T>
+
119 void operator()(_T *_Ptr) const
+
120 {
+
121 EapHostPeerFreeMemory((BYTE*)_Ptr);
+
122 }
+
123 };
+
124
+
128 typedef std::unique_ptr<BYTE[], EapHostPeerFreeMemory_delete> eap_blob;
+
129
+ +
134 {
+ +
139
+
143 template <class _T>
+
144 void operator()(_T *_Ptr) const
+
145 {
+
146 EapHostPeerFreeRuntimeMemory((BYTE*)_Ptr);
+
147 }
+
148 };
+
149
+
153 typedef std::unique_ptr<BYTE[], EapHostPeerFreeRuntimeMemory_delete> eap_blob_runtime;
+
154
+ +
159 {
+ +
164
+
170 void operator()(EAP_ERROR *_Ptr) const noexcept
+
171 {
+
172 EapHostPeerFreeErrorMemory(_Ptr);
+
173 }
+
174 };
+
175
+
179 typedef std::unique_ptr<EAP_ERROR, EapHostPeerFreeErrorMemory_delete> eap_error;
+
180
+ +
185 {
+ +
190
+
196 void operator()(EAP_ERROR *_Ptr) const noexcept
+
197 {
+
198 EapHostPeerFreeEapError(_Ptr);
+
199 }
+
200 };
+
201
+
205 typedef std::unique_ptr<EAP_ERROR, EapHostPeerFreeEapError_delete> eap_error_runtime;
+
206
+
210 #pragma warning(push)
+
211 #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.
+
212 class eap_attr : public EAP_ATTRIBUTE
+
213 {
+
214 public:
+
218 eap_attr() noexcept
+
219 {
+
220 eaType = eatReserved;
+
221 dwLength = 0;
+
222 pValue = NULL;
+
223 }
+
224
+
228 eap_attr(_In_ const EAP_ATTRIBUTE &a)
+
229 {
+
230 eaType = a.eaType;
+
231 dwLength = a.dwLength;
+
232 if (a.dwLength) {
+
233 pValue = new BYTE[a.dwLength];
+
234 assert(pValue);
+
235 memcpy(pValue, a.pValue, a.dwLength);
+
236 } else
+
237 pValue = NULL;
+
238 }
+
239
+
243 eap_attr(_Inout_ eap_attr &&a) noexcept
+
244 {
+
245 eaType = a.eaType;
+
246 dwLength = a.dwLength;
+
247 if (a.dwLength) {
+
248 pValue = a.pValue;
+
249 a.dwLength = 0;
+
250 a.pValue = NULL;
+
251 } else
+
252 pValue = NULL;
+
253 }
+
254
+ +
259 {
+
260 if (pValue)
+
261 delete [] pValue;
+
262 }
+
263
+
267 eap_attr& operator=(_In_ const EAP_ATTRIBUTE &a)
+
268 {
+
269 if (this != &a) {
+
270 eaType = a.eaType;
+
271 dwLength = a.dwLength;
+
272 if (a.dwLength) {
+
273 BYTE *pValueNew = new BYTE[a.dwLength];
+
274 if (pValueNew) {
+
275 if (pValue)
+
276 delete [] pValue;
+
277 memcpy(pValueNew, a.pValue, a.dwLength);
+
278 pValue = pValueNew;
+
279 } else
+
280 assert(0); // Could not allocate memory
+
281 } else
+
282 pValue = NULL;
+
283 }
+
284 return *this;
+
285 }
+
286
+
290 eap_attr& operator=(_Inout_ eap_attr &&a) noexcept
+
291 {
+
292 if (this != &a) {
+
293 eaType = a.eaType;
+
294 dwLength = a.dwLength;
+
295 if (pValue)
+
296 delete [] pValue;
+
297 if (a.dwLength) {
+
298 pValue = a.pValue;
+
299 a.dwLength = 0;
+
300 a.pValue = NULL;
+
301 } else
+
302 pValue = NULL;
+
303 }
+
304 return *this;
+
305 }
+
306
+
314 void create_ms_mppe_key(_In_ BYTE bVendorType, _In_count_(nKeySize) LPCBYTE pbKey, _In_ BYTE nKeySize)
+
315 {
+
316 const BYTE nPaddingLength = static_cast<BYTE>((16 - (1 + static_cast<DWORD>(nKeySize))) % 16);
+
317 const DWORD dwLengthNew =
+
318 4 + // Vendor-Id
+
319 1 + // Vendor type
+
320 1 + // Vendor length
+
321 2 + // Salt
+
322 1 + // Key-Length
+
323 nKeySize + // Key
+
324 nPaddingLength; // Padding
+
325
+
326 #pragma warning(push)
+
327 #pragma warning(disable: 6386)
+
328 LPBYTE p = new BYTE[dwLengthNew];
+
329 p[0] = 0x00; // Vendor-Id (0x137 = 311 = Microsoft)
+
330 p[1] = 0x00; // --|
+
331 p[2] = 0x01; // --|
+
332 p[3] = 0x37; // --^
+
333 p[4] = bVendorType; // Vendor type
+
334 p[5] = static_cast<BYTE>(dwLengthNew - 4); // Vendor length
+
335 p[6] = 0x00; // Salt
+
336 p[7] = 0x00; // --^
+
337 p[8] = nKeySize; // Key-Length
+
338 #pragma warning(pop)
+
339 memcpy(p + 9, pbKey, nKeySize); // Key
+
340 memset(p + 9 + nKeySize, 0, nPaddingLength); // Padding
+
341
+
342 if (pValue)
+
343 delete [] pValue;
+
344
+
345 #pragma warning(suppress: 26812) // EAP_ATTRIBUTE_TYPE is unscoped.
+
346 eaType = eatVendorSpecific;
+
347 dwLength = dwLengthNew;
+
348 pValue = p;
+
349 }
+
350 };
+
351 #pragma warning(pop)
+
352
+
356 static const EAP_ATTRIBUTE blank_eap_attr = {};
+
357
+
361 class eap_method_prop : public EAP_METHOD_PROPERTY
+
362 {
+
363 public:
+
370 eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_ BOOL value) noexcept
+
371 {
+
372 eapMethodPropertyType = type;
+
373 eapMethodPropertyValueType = empvtBool;
+
374 eapMethodPropertyValue.empvBool.length = sizeof(BOOL);
+
375 eapMethodPropertyValue.empvBool.value = value;
+
376 }
+
377
+
384 eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_ DWORD value) noexcept
+
385 {
+
386 eapMethodPropertyType = type;
+
387 eapMethodPropertyValueType = empvtDword;
+
388 eapMethodPropertyValue.empvDword.length = sizeof(DWORD);
+
389 eapMethodPropertyValue.empvDword.value = value;
+
390 }
+
391
+
398 eap_method_prop(_In_ EAP_METHOD_PROPERTY_TYPE type, _In_z_ LPCWSTR value) noexcept
+
399 {
+
400 eapMethodPropertyType = type;
+
401 eapMethodPropertyValueType = empvtString;
+
402 eapMethodPropertyValue.empvString.length = static_cast<DWORD>(sizeof(WCHAR)*(wcslen(value) + 1));
+
403 eapMethodPropertyValue.empvString.value = const_cast<BYTE*>(reinterpret_cast<const BYTE*>(value));
+
404 }
+
405 };
+
406
+
410 class eap_packet : public dplhandle<EapPacket*, NULL>
+
411 {
+ +
413
+
414 public:
+
418 virtual ~eap_packet()
+
419 {
+
420 if (m_h != invalid)
+ +
422 }
+
423
+
437 bool create(_In_ EapCode code, _In_ BYTE id, _In_ WORD size) noexcept
+
438 {
+
439 assert(size >= 4); // EAP packets must contain at least Code, Id, and Length fields: 4B.
+
440
+
441 handle_type h = static_cast<handle_type>(HeapAlloc(GetProcessHeap(), 0, size));
+
442 if (h != NULL) {
+
443 h->Code = static_cast<BYTE>(code);
+
444 h->Id = id;
+
445 *reinterpret_cast<WORD*>(h->Length) = htons(size);
+
446
+
447 attach(h);
+
448 return true;
+
449 } else {
+
450 SetLastError(ERROR_OUTOFMEMORY);
+
451 return false;
+
452 }
+
453 }
+
454
+
458 WORD size() const noexcept
+
459 {
+
460 return m_h != NULL ? ntohs(*(WORD*)m_h->Length) : 0;
+
461 }
+
462
+
463 protected:
+
467 void free_internal() noexcept override
+
468 {
+
469 HeapFree(GetProcessHeap(), 0, m_h);
+
470 }
+
471
+
475 handle_type duplicate_internal(_In_ handle_type h) const noexcept override
+
476 {
+
477 const WORD n = ntohs(*reinterpret_cast<WORD*>(h->Length));
+
478 handle_type h2 = static_cast<handle_type>(HeapAlloc(GetProcessHeap(), 0, n));
+
479 if (h2 == NULL) {
+
480 SetLastError(ERROR_OUTOFMEMORY);
+
481 return NULL;
+
482 }
+
483 memcpy(h2, h, n);
+
484 return h2;
+
485 }
+
486 };
+
487
+
491 class eap_method_info_array : public EAP_METHOD_INFO_ARRAY
+
492 {
+ +
494
+
495 public:
+ +
500 {
+
501 dwNumberOfMethods = 0;
+
502 pEapMethods = NULL;
+
503 }
+
504
+ +
511 {
+
512 dwNumberOfMethods = other.dwNumberOfMethods;
+
513 pEapMethods = other.pEapMethods;
+
514 other.dwNumberOfMethods = 0;
+
515 other.pEapMethods = NULL;
+
516 }
+
517
+ +
522 {
+
523 if (pEapMethods)
+
524 free_internal();
+
525 }
+
526
+ +
533 {
+
534 if (this != std::addressof(other)) {
+
535 if (pEapMethods)
+
536 free_internal();
+
537 dwNumberOfMethods = other.dwNumberOfMethods;
+
538 pEapMethods = other.pEapMethods;
+
539 other.dwNumberOfMethods = 0;
+
540 other.pEapMethods = NULL;
+
541 }
+
542 return *this;
+
543 }
+
544
+
545 protected:
+
547
+
548 void free_internal() noexcept
+
549 {
+
550 for (DWORD i = 0; i < dwNumberOfMethods; i++)
+
551 free_internal(pEapMethods + i);
+
552
+
553 EapHostPeerFreeMemory(reinterpret_cast<BYTE*>(pEapMethods));
+
554 }
+
555
+
556 static void free_internal(_In_ EAP_METHOD_INFO *pMethodInfo) noexcept
+
557 {
+
558 if (pMethodInfo->pInnerMethodInfo)
+
559 free_internal(pMethodInfo->pInnerMethodInfo);
+
560
+
561 EapHostPeerFreeMemory(reinterpret_cast<BYTE*>(pMethodInfo->pwszAuthorName));
+
562 EapHostPeerFreeMemory(reinterpret_cast<BYTE*>(pMethodInfo->pwszFriendlyName));
+
563 }
564
-
565 EapHostPeerFreeMemory(reinterpret_cast<BYTE*>(pMethodInfo->pwszAuthorName));
-
566 EapHostPeerFreeMemory(reinterpret_cast<BYTE*>(pMethodInfo->pwszFriendlyName));
-
567 }
-
568
-
570 };
-
571
-
573
-
576
- -
583 {
-
584 public:
-
591 eap_runtime_error(_In_ const EAP_ERROR &err, _In_ const std::string& msg) :
-
592 m_type (err.type ),
-
593 m_reason (err.dwReasonCode ),
-
594 m_root_cause_id (err.rootCauseGuid ),
-
595 m_root_cause_desc(err.pRootCauseString ),
-
596 m_repair_id (err.repairGuid ),
-
597 m_repair_desc (err.pRepairString ),
-
598 m_help_link_id (err.helpLinkGuid ),
-
599 win_runtime_error(err.dwWinError, msg.c_str())
-
600 {
-
601 }
-
602
-
609 eap_runtime_error(_In_ const EAP_ERROR &err, _In_opt_z_ const char *msg = nullptr) :
-
610 m_type (err.type ),
-
611 m_reason (err.dwReasonCode ),
-
612 m_root_cause_id (err.rootCauseGuid ),
-
613 m_root_cause_desc(err.pRootCauseString),
-
614 m_repair_id (err.repairGuid ),
-
615 m_repair_desc (err.pRepairString ),
-
616 m_help_link_id (err.helpLinkGuid ),
-
617 win_runtime_error(err.dwWinError, msg )
-
618 {
-
619 }
-
620
-
624 const EAP_METHOD_TYPE& type() const noexcept
-
625 {
-
626 return m_type;
-
627 }
-
628
-
632 DWORD reason() const noexcept
-
633 {
-
634 return m_reason;
-
635 }
-
636
-
640 const GUID& root_cause_id() const noexcept
-
641 {
-
642 return m_root_cause_id;
-
643 }
-
644
-
648 const wchar_t* root_cause() const noexcept
-
649 {
-
650 return m_root_cause_desc.c_str();
-
651 }
-
652
-
656 const GUID& repair_id() const noexcept
-
657 {
-
658 return m_repair_id;
-
659 }
-
660
-
664 const wchar_t* repair() const noexcept
-
665 {
-
666 return m_repair_desc.c_str();
-
667 }
-
668
-
672 const GUID& help_link_id() const noexcept
-
673 {
-
674 return m_help_link_id;
-
675 }
-
676
-
677 protected:
-
678 EAP_METHOD_TYPE m_type;
-
679
-
680 DWORD m_reason;
-
681
- -
683 std::wstring m_root_cause_desc;
-
684
- -
686 std::wstring m_repair_desc;
-
687
- -
689 };
-
690
-
692}
-
693
-
694#pragma warning(pop)
-
General API.
-
Integrates WinStd classes with Microsoft WinSock2 API.
-
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition: Common.h:877
-
EAP_ATTRIBUTE wrapper class.
Definition: EAP.h:217
-
eap_attr() noexcept
Initializes a new EAP attribute set to eatReserved.
Definition: EAP.h:222
-
eap_attr(eap_attr &&a) noexcept
Moves an existing EAP attribute.
Definition: EAP.h:247
-
~eap_attr()
Destroys the EAP attribute.
Definition: EAP.h:262
-
eap_attr & operator=(eap_attr &&a) noexcept
Moves an existing EAP attribute.
Definition: EAP.h:294
-
eap_attr(const EAP_ATTRIBUTE &a)
Copies an existing EAP attribute.
Definition: EAP.h:232
-
void create_ms_mppe_key(BYTE bVendorType, LPCBYTE pbKey, BYTE nKeySize)
Creates MS-MPPE-Send-Key or MS-MPPE-Recv-Key.
Definition: EAP.h:318
-
eap_attr & operator=(const EAP_ATTRIBUTE &a)
Copies an existing EAP attribute.
Definition: EAP.h:271
-
EAP_METHOD_INFO_ARRAY wrapper class.
Definition: EAP.h:496
-
eap_method_info_array(eap_method_info_array &&other) noexcept
Move constructor.
Definition: EAP.h:514
-
eap_method_info_array() noexcept
Constructs an empty array.
Definition: EAP.h:503
-
~eap_method_info_array()
Destructor.
Definition: EAP.h:525
-
eap_method_info_array & operator=(eap_method_info_array &&other) noexcept
Move assignment.
Definition: EAP.h:536
-
EAP_METHOD_PROPERTY wrapper class.
Definition: EAP.h:366
-
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, BOOL value) noexcept
Constructs a BOOL method property.
Definition: EAP.h:374
-
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, DWORD value) noexcept
Constructs a DWORD method property.
Definition: EAP.h:388
-
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, LPCWSTR value) noexcept
Constructs a Unicode string method property.
Definition: EAP.h:402
-
EapPacket wrapper class.
Definition: EAP.h:415
-
WORD size() const noexcept
Returns total EAP packet size in bytes.
Definition: EAP.h:462
-
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the EAP packet.
Definition: EAP.h:479
-
virtual ~eap_packet()
Destroys the EAP packet.
Definition: EAP.h:422
-
void free_internal() noexcept override
Destroys the EAP packet.
Definition: EAP.h:471
-
bool create(EapCode code, BYTE id, WORD size) noexcept
Create new EAP packet.
Definition: EAP.h:441
-
EapHost runtime error.
Definition: EAP.h:583
-
const EAP_METHOD_TYPE & type() const noexcept
Returns EAP method type.
Definition: EAP.h:624
-
GUID m_root_cause_id
A unique ID that identifies cause of error in EAPHost.
Definition: EAP.h:682
-
const wchar_t * root_cause() const noexcept
Returns root cause ID.
Definition: EAP.h:648
-
const GUID & repair_id() const noexcept
Returns repair ID.
Definition: EAP.h:656
-
std::wstring m_repair_desc
A localized and readable string that describes the possible repair action.
Definition: EAP.h:686
-
DWORD reason() const noexcept
Returns the reason code for error.
Definition: EAP.h:632
-
EAP_METHOD_TYPE m_type
Structure that identifies the EAP method that raised the error.
Definition: EAP.h:678
-
eap_runtime_error(const EAP_ERROR &err, const char *msg=nullptr)
Constructs an exception.
Definition: EAP.h:609
-
GUID m_repair_id
A unique ID that maps to a localizable string that identifies the repair action that can be taken to ...
Definition: EAP.h:685
-
eap_runtime_error(const EAP_ERROR &err, const std::string &msg)
Constructs an exception.
Definition: EAP.h:591
-
const wchar_t * repair() const noexcept
Returns root cause ID.
Definition: EAP.h:664
-
GUID m_help_link_id
A unique ID that maps to a localizable string that specifies an URL for a page that contains addition...
Definition: EAP.h:688
-
const GUID & root_cause_id() const noexcept
Returns root cause ID.
Definition: EAP.h:640
-
std::wstring m_root_cause_desc
A localized and readable string that describes the root cause of the error.
Definition: EAP.h:683
-
const GUID & help_link_id() const noexcept
Returns help_link ID.
Definition: EAP.h:672
-
DWORD m_reason
The reason code for the error.
Definition: EAP.h:680
-
EapPacket * handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:620
-
handle_type m_h
Object handle.
Definition: Common.h:866
-
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:829
-
Windows runtime error.
Definition: Common.h:1056
-
tstring msg(DWORD dwLanguageId=0) const
Returns a user-readable Windows error message.
Definition: Common.h:1101
-
std::unique_ptr< EAP_ERROR, EapHostPeerFreeEapError_delete > eap_error_runtime
EAP_ERROR wrapper class.
Definition: EAP.h:209
-
std::unique_ptr< BYTE[], EapHostPeerFreeMemory_delete > eap_blob
EapHost BLOB wrapper class.
Definition: EAP.h:132
-
static bool operator==(const EAP_METHOD_TYPE &a, const EAP_METHOD_TYPE &b) noexcept
Are EAP method types equal?
Definition: EAP.h:43
-
eap_type_t
EAP method numbers.
Definition: EAP.h:82
-
std::unique_ptr< EAP_ERROR, EapHostPeerFreeErrorMemory_delete > eap_error
EAP_ERROR wrapper class.
Definition: EAP.h:183
-
std::unique_ptr< BYTE[], EapHostPeerFreeRuntimeMemory_delete > eap_blob_runtime
EapHost BLOB wrapper class.
Definition: EAP.h:157
-
static bool operator!=(const EAP_METHOD_TYPE &a, const EAP_METHOD_TYPE &b) noexcept
Are EAP method types non-equal?
Definition: EAP.h:62
-
static const EAP_ATTRIBUTE blank_eap_attr
Blank EAP attribute.
Definition: EAP.h:360
+
566 };
+
567
+
569
+
572
+ +
579 {
+
580 public:
+
587 eap_runtime_error(_In_ const EAP_ERROR &err, _In_ const std::string& msg) :
+
588 m_type (err.type ),
+
589 m_reason (err.dwReasonCode ),
+
590 m_root_cause_id (err.rootCauseGuid ),
+
591 m_root_cause_desc(err.pRootCauseString ),
+
592 m_repair_id (err.repairGuid ),
+
593 m_repair_desc (err.pRepairString ),
+
594 m_help_link_id (err.helpLinkGuid ),
+
595 win_runtime_error(err.dwWinError, msg.c_str())
+
596 {
+
597 }
+
598
+
605 eap_runtime_error(_In_ const EAP_ERROR &err, _In_opt_z_ const char *msg = nullptr) :
+
606 m_type (err.type ),
+
607 m_reason (err.dwReasonCode ),
+
608 m_root_cause_id (err.rootCauseGuid ),
+
609 m_root_cause_desc(err.pRootCauseString),
+
610 m_repair_id (err.repairGuid ),
+
611 m_repair_desc (err.pRepairString ),
+
612 m_help_link_id (err.helpLinkGuid ),
+
613 win_runtime_error(err.dwWinError, msg )
+
614 {
+
615 }
+
616
+
620 const EAP_METHOD_TYPE& type() const noexcept
+
621 {
+
622 return m_type;
+
623 }
+
624
+
628 DWORD reason() const noexcept
+
629 {
+
630 return m_reason;
+
631 }
+
632
+
636 const GUID& root_cause_id() const noexcept
+
637 {
+
638 return m_root_cause_id;
+
639 }
+
640
+
644 const wchar_t* root_cause() const noexcept
+
645 {
+
646 return m_root_cause_desc.c_str();
+
647 }
+
648
+
652 const GUID& repair_id() const noexcept
+
653 {
+
654 return m_repair_id;
+
655 }
+
656
+
660 const wchar_t* repair() const noexcept
+
661 {
+
662 return m_repair_desc.c_str();
+
663 }
+
664
+
668 const GUID& help_link_id() const noexcept
+
669 {
+
670 return m_help_link_id;
+
671 }
+
672
+
673 protected:
+
674 EAP_METHOD_TYPE m_type;
+
675
+
676 DWORD m_reason;
+
677
+ +
679 std::wstring m_root_cause_desc;
+
680
+ +
682 std::wstring m_repair_desc;
+
683
+ +
685 };
+
686
+
688}
+
689
+
690#pragma warning(pop)
+
Base abstract template class to support object handle keeping for objects that support trivial handle...
Definition: Common.h:869
+
EAP_ATTRIBUTE wrapper class.
Definition: EAP.h:213
+
eap_attr() noexcept
Initializes a new EAP attribute set to eatReserved.
Definition: EAP.h:218
+
eap_attr(eap_attr &&a) noexcept
Moves an existing EAP attribute.
Definition: EAP.h:243
+
~eap_attr()
Destroys the EAP attribute.
Definition: EAP.h:258
+
eap_attr & operator=(eap_attr &&a) noexcept
Moves an existing EAP attribute.
Definition: EAP.h:290
+
eap_attr(const EAP_ATTRIBUTE &a)
Copies an existing EAP attribute.
Definition: EAP.h:228
+
void create_ms_mppe_key(BYTE bVendorType, LPCBYTE pbKey, BYTE nKeySize)
Creates MS-MPPE-Send-Key or MS-MPPE-Recv-Key.
Definition: EAP.h:314
+
eap_attr & operator=(const EAP_ATTRIBUTE &a)
Copies an existing EAP attribute.
Definition: EAP.h:267
+
EAP_METHOD_INFO_ARRAY wrapper class.
Definition: EAP.h:492
+
eap_method_info_array(eap_method_info_array &&other) noexcept
Move constructor.
Definition: EAP.h:510
+
eap_method_info_array() noexcept
Constructs an empty array.
Definition: EAP.h:499
+
~eap_method_info_array()
Destructor.
Definition: EAP.h:521
+
eap_method_info_array & operator=(eap_method_info_array &&other) noexcept
Move assignment.
Definition: EAP.h:532
+
EAP_METHOD_PROPERTY wrapper class.
Definition: EAP.h:362
+
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, BOOL value) noexcept
Constructs a BOOL method property.
Definition: EAP.h:370
+
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, DWORD value) noexcept
Constructs a DWORD method property.
Definition: EAP.h:384
+
eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, LPCWSTR value) noexcept
Constructs a Unicode string method property.
Definition: EAP.h:398
+
EapPacket wrapper class.
Definition: EAP.h:411
+
WORD size() const noexcept
Returns total EAP packet size in bytes.
Definition: EAP.h:458
+
handle_type duplicate_internal(handle_type h) const noexcept override
Duplicates the EAP packet.
Definition: EAP.h:475
+
virtual ~eap_packet()
Destroys the EAP packet.
Definition: EAP.h:418
+
void free_internal() noexcept override
Destroys the EAP packet.
Definition: EAP.h:467
+
bool create(EapCode code, BYTE id, WORD size) noexcept
Create new EAP packet.
Definition: EAP.h:437
+
EapHost runtime error.
Definition: EAP.h:579
+
const EAP_METHOD_TYPE & type() const noexcept
Returns EAP method type.
Definition: EAP.h:620
+
GUID m_root_cause_id
A unique ID that identifies cause of error in EAPHost.
Definition: EAP.h:678
+
const wchar_t * root_cause() const noexcept
Returns root cause ID.
Definition: EAP.h:644
+
const GUID & repair_id() const noexcept
Returns repair ID.
Definition: EAP.h:652
+
std::wstring m_repair_desc
A localized and readable string that describes the possible repair action.
Definition: EAP.h:682
+
DWORD reason() const noexcept
Returns the reason code for error.
Definition: EAP.h:628
+
EAP_METHOD_TYPE m_type
Structure that identifies the EAP method that raised the error.
Definition: EAP.h:674
+
eap_runtime_error(const EAP_ERROR &err, const char *msg=nullptr)
Constructs an exception.
Definition: EAP.h:605
+
GUID m_repair_id
A unique ID that maps to a localizable string that identifies the repair action that can be taken to ...
Definition: EAP.h:681
+
eap_runtime_error(const EAP_ERROR &err, const std::string &msg)
Constructs an exception.
Definition: EAP.h:587
+
const wchar_t * repair() const noexcept
Returns root cause ID.
Definition: EAP.h:660
+
GUID m_help_link_id
A unique ID that maps to a localizable string that specifies an URL for a page that contains addition...
Definition: EAP.h:684
+
const GUID & root_cause_id() const noexcept
Returns root cause ID.
Definition: EAP.h:636
+
std::wstring m_root_cause_desc
A localized and readable string that describes the root cause of the error.
Definition: EAP.h:679
+
const GUID & help_link_id() const noexcept
Returns help_link ID.
Definition: EAP.h:668
+
DWORD m_reason
The reason code for the error.
Definition: EAP.h:676
+
EapPacket * handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:612
+
handle_type m_h
Object handle.
Definition: Common.h:858
+
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:821
+
Windows runtime error.
Definition: Common.h:1048
+
tstring msg(DWORD dwLanguageId=0) const
Returns a user-readable Windows error message.
Definition: Common.h:1093
+
std::unique_ptr< EAP_ERROR, EapHostPeerFreeEapError_delete > eap_error_runtime
EAP_ERROR wrapper class.
Definition: EAP.h:205
+
std::unique_ptr< BYTE[], EapHostPeerFreeMemory_delete > eap_blob
EapHost BLOB wrapper class.
Definition: EAP.h:128
+
static bool operator==(const EAP_METHOD_TYPE &a, const EAP_METHOD_TYPE &b) noexcept
Are EAP method types equal?
Definition: EAP.h:39
+
eap_type_t
EAP method numbers.
Definition: EAP.h:78
+
std::unique_ptr< EAP_ERROR, EapHostPeerFreeErrorMemory_delete > eap_error
EAP_ERROR wrapper class.
Definition: EAP.h:179
+
std::unique_ptr< BYTE[], EapHostPeerFreeRuntimeMemory_delete > eap_blob_runtime
EapHost BLOB wrapper class.
Definition: EAP.h:153
+
static bool operator!=(const EAP_METHOD_TYPE &a, const EAP_METHOD_TYPE &b) noexcept
Are EAP method types non-equal?
Definition: EAP.h:58
+
static const EAP_ATTRIBUTE blank_eap_attr
Blank EAP attribute.
Definition: EAP.h:356
@ notification
Notification.
@ md5_challenge
MD5-Challenge.
@ legacy_pap
PAP (Not actually an EAP method; Moved to the Unassigned area)
@@ -607,25 +605,25 @@ $(function() {
@ start
Start of EAP methods.
@ mschapv2
EAP-MSCHAPv2.
@ identity
Identity.
-
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:74
-
#define WINSTD_DPLHANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:183
-
static const EapPacket * invalid
Invalid handle value.
Definition: Common.h:625
-
Deleter for unique_ptr to EAP_ERROR using EapHostPeerFreeEapError.
Definition: EAP.h:189
-
EapHostPeerFreeEapError_delete() noexcept
Default constructor.
Definition: EAP.h:193
-
void operator()(EAP_ERROR *_Ptr) const noexcept
Delete a pointer.
Definition: EAP.h:200
-
Deleter for unique_ptr to EAP_ERROR using EapHostPeerFreeErrorMemory.
Definition: EAP.h:163
-
EapHostPeerFreeErrorMemory_delete() noexcept
Default constructor.
Definition: EAP.h:167
-
void operator()(EAP_ERROR *_Ptr) const noexcept
Delete a pointer.
Definition: EAP.h:174
-
Deleter for unique_ptr using EapHostPeerFreeMemory.
Definition: EAP.h:111
-
void operator()(_T *_Ptr) const
Delete a pointer.
Definition: EAP.h:123
-
EapHostPeerFreeMemory_delete() noexcept
Default constructor.
Definition: EAP.h:115
-
Deleter for unique_ptr using EapHostPeerFreeRuntimeMemory.
Definition: EAP.h:138
-
void operator()(_T *_Ptr) const
Delete a pointer.
Definition: EAP.h:148
-
EapHostPeerFreeRuntimeMemory_delete() noexcept
Default constructor.
Definition: EAP.h:142
+
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:66
+
#define WINSTD_DPLHANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:175
+
static const EapPacket * invalid
Invalid handle value.
Definition: Common.h:617
+
Deleter for unique_ptr to EAP_ERROR using EapHostPeerFreeEapError.
Definition: EAP.h:185
+
EapHostPeerFreeEapError_delete() noexcept
Default constructor.
Definition: EAP.h:189
+
void operator()(EAP_ERROR *_Ptr) const noexcept
Delete a pointer.
Definition: EAP.h:196
+
Deleter for unique_ptr to EAP_ERROR using EapHostPeerFreeErrorMemory.
Definition: EAP.h:159
+
EapHostPeerFreeErrorMemory_delete() noexcept
Default constructor.
Definition: EAP.h:163
+
void operator()(EAP_ERROR *_Ptr) const noexcept
Delete a pointer.
Definition: EAP.h:170
+
Deleter for unique_ptr using EapHostPeerFreeMemory.
Definition: EAP.h:107
+
void operator()(_T *_Ptr) const
Delete a pointer.
Definition: EAP.h:119
+
EapHostPeerFreeMemory_delete() noexcept
Default constructor.
Definition: EAP.h:111
+
Deleter for unique_ptr using EapHostPeerFreeRuntimeMemory.
Definition: EAP.h:134
+
void operator()(_T *_Ptr) const
Delete a pointer.
Definition: EAP.h:144
+
EapHostPeerFreeRuntimeMemory_delete() noexcept
Default constructor.
Definition: EAP.h:138
diff --git a/_e_t_w_8h.html b/_e_t_w_8h.html deleted file mode 100644 index 72a77534..00000000 --- a/_e_t_w_8h.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - -WinStd: include/WinStd/ETW.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
ETW.h File Reference
-
-
- -

Integrates WinStd classes with Event Tracing for Windows API. -More...

-
#include "Common.h"
-#include <assert.h>
-#include <evntprov.h>
-#include <evntcons.h>
-#include <stdarg.h>
-#include <tdh.h>
-#include <memory>
-#include <string>
-#include <vector>
-
-

Go to the source code of this file.

- - - - - - - - - - - - - - - - - - - - - - - - - - -

-Classes

class  winstd::event_data
 EVENT_DATA_DESCRIPTOR wrapper. More...
 
class  winstd::event_rec
 EVENT_RECORD wrapper. More...
 
class  winstd::event_provider
 ETW event provider. More...
 
class  winstd::event_session
 ETW session. More...
 
class  winstd::event_trace
 ETW trace. More...
 
class  winstd::event_trace_enabler
 Helper class to enable event provider in constructor and disables it in destructor. More...
 
class  winstd::event_fn_auto
 Helper class to write an event on entry/exit of scope. More...
 
class  winstd::event_fn_auto_ret< T >
 Helper template to write an event on entry/exit of scope with one parameter (typically result). More...
 
- - - - - - - - - - - -

-Functions

template<class _Ty , class _Ax >
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. More...
 
static ULONG TdhGetEventInformation (PEVENT_RECORD pEvent, ULONG TdhContextCount, PTDH_CONTEXT pTdhContext, std::unique_ptr< TRACE_EVENT_INFO > &info)
 Retrieves metadata about an event. More...
 
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. More...
 
- - - - -

-Variables

-static const event_data winstd::blank_event_data
 Blank event data used as terminator.
 
-

Detailed Description

-

Integrates WinStd classes with Event Tracing for Windows API.

-
- - - - diff --git a/_e_t_w_8h_source.html b/_e_t_w_8h_source.html index 3dadeba4..05c7de08 100644 --- a/_e_t_w_8h_source.html +++ b/_e_t_w_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,927 +70,926 @@ $(function() {
ETW.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
-
14
-
15#include "Common.h"
-
16#include <assert.h>
-
17#include <evntprov.h>
-
18#include <evntcons.h>
-
19#include <stdarg.h>
-
20#include <tdh.h>
-
21#include <memory>
-
22#include <string>
-
23#include <vector>
-
24
-
25#pragma warning(push)
-
26#pragma warning(disable: 4505) // Don't warn on unused code
-
27
-
30
-
36template<class _Ty, class _Ax>
-
37static _Success_(return == ERROR_SUCCESS) ULONG TdhGetProperty(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _In_ ULONG PropertyDataCount, _In_reads_(PropertyDataCount) PPROPERTY_DATA_DESCRIPTOR pPropertyData, _Inout_ std::vector<_Ty, _Ax> &aData)
-
38{
-
39 ULONG ulSize, ulResult;
-
40
-
41 // Query property size.
-
42 ulResult = TdhGetPropertySize(pEvent, TdhContextCount, pTdhContext, PropertyDataCount, pPropertyData, &ulSize);
-
43 if (ulResult == ERROR_SUCCESS) {
-
44 if (ulSize) {
-
45 // Query property value.
-
46 aData.resize((ulSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
47 ulResult = TdhGetProperty(pEvent, TdhContextCount, pTdhContext, PropertyDataCount, pPropertyData, ulSize, reinterpret_cast<LPBYTE>(aData.data()));
-
48 } else {
-
49 // Property value size is zero.
-
50 aData.clear();
-
51 }
-
52 }
-
53
-
54 return ulResult;
-
55}
-
56
-
62static _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventInformation(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _Out_ std::unique_ptr<TRACE_EVENT_INFO> &info)
-
63{
-
64 BYTE szBuffer[WINSTD_STACK_BUFFER_BYTES];
-
65 ULONG ulSize = sizeof(szBuffer), ulResult;
-
66
-
67 // Try with stack buffer first.
-
68 ulResult = TdhGetEventInformation(pEvent, TdhContextCount, pTdhContext, (PTRACE_EVENT_INFO)szBuffer, &ulSize);
-
69 if (ulResult == ERROR_SUCCESS) {
-
70 // Copy from stack.
-
71 info.reset(reinterpret_cast<PTRACE_EVENT_INFO>(new char[ulSize]));
-
72 memcpy(info.get(), szBuffer, ulSize);
-
73 return ERROR_SUCCESS;
-
74 } else if (ulResult == ERROR_INSUFFICIENT_BUFFER) {
-
75 // Create buffer on heap and retry.
-
76 info.reset(reinterpret_cast<PTRACE_EVENT_INFO>(new char[ulSize]));
-
77 return TdhGetEventInformation(pEvent, TdhContextCount, pTdhContext, info.get(), &ulSize);
-
78 }
-
79
-
80 return ulResult;
-
81}
-
82
-
88static _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventMapInformation(_In_ PEVENT_RECORD pEvent, _In_ LPWSTR pMapName, _Inout_ std::unique_ptr<EVENT_MAP_INFO> &info)
-
89{
-
90 BYTE szBuffer[WINSTD_STACK_BUFFER_BYTES];
-
91 ULONG ulSize = sizeof(szBuffer), ulResult;
-
92
-
93 // Try with stack buffer first.
-
94 ulResult = TdhGetEventMapInformation(pEvent, pMapName, (PEVENT_MAP_INFO)szBuffer, &ulSize);
-
95 if (ulResult == ERROR_SUCCESS) {
-
96 // Copy from stack.
-
97 info.reset(reinterpret_cast<PEVENT_MAP_INFO>(new char[ulSize]));
-
98 memcpy(info.get(), szBuffer, ulSize);
-
99 return ERROR_SUCCESS;
-
100 } else if (ulResult == ERROR_INSUFFICIENT_BUFFER) {
-
101 // Create buffer on heap and retry.
-
102 info.reset(reinterpret_cast<PEVENT_MAP_INFO>(new char[ulSize]));
-
103 return TdhGetEventMapInformation(pEvent, pMapName, info.get(), &ulSize);
-
104 }
-
105
-
106 return ulResult;
-
107}
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <assert.h>
+
13#include <evntprov.h>
+
14#include <evntcons.h>
+
15#include <stdarg.h>
+
16#include <tdh.h>
+
17#include <memory>
+
18#include <string>
+
19#include <vector>
+
20
+
21#pragma warning(push)
+
22#pragma warning(disable: 4505) // Don't warn on unused code
+
23
+
26
+
32template<class _Ty, class _Ax>
+
33static _Success_(return == ERROR_SUCCESS) ULONG TdhGetProperty(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _In_ ULONG PropertyDataCount, _In_reads_(PropertyDataCount) PPROPERTY_DATA_DESCRIPTOR pPropertyData, _Inout_ std::vector<_Ty, _Ax> &aData)
+
34{
+
35 ULONG ulSize, ulResult;
+
36
+
37 // Query property size.
+
38 ulResult = TdhGetPropertySize(pEvent, TdhContextCount, pTdhContext, PropertyDataCount, pPropertyData, &ulSize);
+
39 if (ulResult == ERROR_SUCCESS) {
+
40 if (ulSize) {
+
41 // Query property value.
+
42 aData.resize((ulSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
43 ulResult = TdhGetProperty(pEvent, TdhContextCount, pTdhContext, PropertyDataCount, pPropertyData, ulSize, reinterpret_cast<LPBYTE>(aData.data()));
+
44 } else {
+
45 // Property value size is zero.
+
46 aData.clear();
+
47 }
+
48 }
+
49
+
50 return ulResult;
+
51}
+
52
+
58static _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventInformation(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _Out_ std::unique_ptr<TRACE_EVENT_INFO> &info)
+
59{
+
60 BYTE szBuffer[WINSTD_STACK_BUFFER_BYTES];
+
61 ULONG ulSize = sizeof(szBuffer), ulResult;
+
62
+
63 // Try with stack buffer first.
+
64 ulResult = TdhGetEventInformation(pEvent, TdhContextCount, pTdhContext, (PTRACE_EVENT_INFO)szBuffer, &ulSize);
+
65 if (ulResult == ERROR_SUCCESS) {
+
66 // Copy from stack.
+
67 info.reset(reinterpret_cast<PTRACE_EVENT_INFO>(new char[ulSize]));
+
68 memcpy(info.get(), szBuffer, ulSize);
+
69 return ERROR_SUCCESS;
+
70 } else if (ulResult == ERROR_INSUFFICIENT_BUFFER) {
+
71 // Create buffer on heap and retry.
+
72 info.reset(reinterpret_cast<PTRACE_EVENT_INFO>(new char[ulSize]));
+
73 return TdhGetEventInformation(pEvent, TdhContextCount, pTdhContext, info.get(), &ulSize);
+
74 }
+
75
+
76 return ulResult;
+
77}
+
78
+
84static _Success_(return == ERROR_SUCCESS) ULONG TdhGetEventMapInformation(_In_ PEVENT_RECORD pEvent, _In_ LPWSTR pMapName, _Inout_ std::unique_ptr<EVENT_MAP_INFO> &info)
+
85{
+
86 BYTE szBuffer[WINSTD_STACK_BUFFER_BYTES];
+
87 ULONG ulSize = sizeof(szBuffer), ulResult;
+
88
+
89 // Try with stack buffer first.
+
90 ulResult = TdhGetEventMapInformation(pEvent, pMapName, (PEVENT_MAP_INFO)szBuffer, &ulSize);
+
91 if (ulResult == ERROR_SUCCESS) {
+
92 // Copy from stack.
+
93 info.reset(reinterpret_cast<PEVENT_MAP_INFO>(new char[ulSize]));
+
94 memcpy(info.get(), szBuffer, ulSize);
+
95 return ERROR_SUCCESS;
+
96 } else if (ulResult == ERROR_INSUFFICIENT_BUFFER) {
+
97 // Create buffer on heap and retry.
+
98 info.reset(reinterpret_cast<PEVENT_MAP_INFO>(new char[ulSize]));
+
99 return TdhGetEventMapInformation(pEvent, pMapName, info.get(), &ulSize);
+
100 }
+
101
+
102 return ulResult;
+
103}
+
104
+
106
+
107#pragma warning(pop)
108
-
110
-
111#pragma warning(pop)
-
112
-
113namespace winstd
-
114{
-
117
-
121 class event_data : public EVENT_DATA_DESCRIPTOR
-
122 {
-
123 public:
- -
128 {
-
129 Ptr = 0;
-
130 Size = 0;
-
131 Reserved = (ULONG)-1; // Used for varadic argument terminator.
-
132 }
-
133
-
141 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
-
142 event_data(_In_ const char &data)
-
143 {
-
144 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
-
145 }
-
146
-
154 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
-
155 event_data(_In_ const unsigned char &data)
-
156 {
-
157 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
-
158 }
-
159
-
167 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
-
168 event_data(_In_ const int &data)
-
169 {
-
170 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
-
171 }
-
172
-
180 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
-
181 event_data(_In_ const unsigned int &data)
-
182 {
-
183 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
-
184 }
-
185
-
193 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
-
194 event_data(_In_ const long &data)
-
195 {
-
196 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
-
197 }
-
198
-
206 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
-
207 event_data(_In_ const unsigned long &data)
-
208 {
-
209 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
-
210 }
-
211
-
219 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
-
220 event_data(_In_ const GUID &data)
-
221 {
-
222 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
-
223 }
-
224
-
232 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
-
233 event_data(_In_opt_z_ const char *data)
-
234 {
-
235 if (data)
-
236 EventDataDescCreate(this, data, (ULONG)((strlen(data) + 1) * sizeof(*data)));
-
237 else {
-
238 // Writing NULL pointer with 0B length causes trouble in Event Viewer: message template string is displayed only, parameters are not rendered.
-
239 static const char null[] = "(null)";
-
240 EventDataDescCreate(this, null, sizeof(null));
-
241 }
-
242 }
-
243
-
251 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
-
252 event_data(_In_opt_z_ const wchar_t *data)
-
253 {
-
254 if (data)
-
255 EventDataDescCreate(this, data, (ULONG)((wcslen(data) + 1) * sizeof(*data)));
-
256 else {
-
257 // Writing NULL pointer with 0B length causes trouble in Event Viewer: message template string is displayed only, parameters are not rendered.
-
258 static const wchar_t null[] = L"(null)";
-
259 EventDataDescCreate(this, null, sizeof(null));
-
260 }
-
261 }
-
262
-
270 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
-
271 template<class _Elem, class _Traits, class _Ax>
-
272 event_data(_In_ const std::basic_string<_Elem, _Traits, _Ax> &data)
-
273 {
-
274 EventDataDescCreate(this, data.c_str(), (ULONG)((data.length() + 1) * sizeof(_Elem)));
-
275 }
-
276
-
285 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
-
286 event_data(_In_bytecount_(size) const void *data, _In_ ULONG size)
-
287 {
-
288 EventDataDescCreate(this, data, size);
-
289 }
-
290 };
-
291
- -
296
-
300 class event_rec : public EVENT_RECORD
-
301 {
-
302 public:
- -
307 {
-
308 memset((EVENT_RECORD*)this, 0, sizeof(EVENT_RECORD));
-
309 }
-
310
-
316 event_rec(_In_ const event_rec &other) : EVENT_RECORD(other)
-
317 {
-
318 set_extended_data_internal(other.ExtendedDataCount, other.ExtendedData);
-
319 set_user_data_internal(other.UserDataLength, other.UserData);
-
320 }
-
321
-
327 event_rec(_In_ const EVENT_RECORD &other) : EVENT_RECORD(other)
-
328 {
-
329 set_extended_data_internal(other.ExtendedDataCount, other.ExtendedData);
-
330 set_user_data_internal(other.UserDataLength, other.UserData);
-
331 }
-
332
-
338 event_rec(_Inout_ event_rec&& other) noexcept : EVENT_RECORD(other)
-
339 {
-
340 memset((EVENT_RECORD*)&other, 0, sizeof(EVENT_RECORD));
-
341 }
-
342
- -
347 {
-
348 if (ExtendedData)
-
349 delete reinterpret_cast<unsigned char*>(ExtendedData);
+
109namespace winstd
+
110{
+
113
+
117 class event_data : public EVENT_DATA_DESCRIPTOR
+
118 {
+
119 public:
+ +
124 {
+
125 Ptr = 0;
+
126 Size = 0;
+
127 Reserved = (ULONG)-1; // Used for varadic argument terminator.
+
128 }
+
129
+
137 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
+
138 event_data(_In_ const char &data)
+
139 {
+
140 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
+
141 }
+
142
+
150 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
+
151 event_data(_In_ const unsigned char &data)
+
152 {
+
153 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
+
154 }
+
155
+
163 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
+
164 event_data(_In_ const int &data)
+
165 {
+
166 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
+
167 }
+
168
+
176 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
+
177 event_data(_In_ const unsigned int &data)
+
178 {
+
179 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
+
180 }
+
181
+
189 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
+
190 event_data(_In_ const long &data)
+
191 {
+
192 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
+
193 }
+
194
+
202 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
+
203 event_data(_In_ const unsigned long &data)
+
204 {
+
205 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
+
206 }
+
207
+
215 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
+
216 event_data(_In_ const GUID &data)
+
217 {
+
218 EventDataDescCreate(this, &data, (ULONG)(sizeof(data)));
+
219 }
+
220
+
228 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
+
229 event_data(_In_opt_z_ const char *data)
+
230 {
+
231 if (data)
+
232 EventDataDescCreate(this, data, (ULONG)((strlen(data) + 1) * sizeof(*data)));
+
233 else {
+
234 // Writing NULL pointer with 0B length causes trouble in Event Viewer: message template string is displayed only, parameters are not rendered.
+
235 static const char null[] = "(null)";
+
236 EventDataDescCreate(this, null, sizeof(null));
+
237 }
+
238 }
+
239
+
247 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
+
248 event_data(_In_opt_z_ const wchar_t *data)
+
249 {
+
250 if (data)
+
251 EventDataDescCreate(this, data, (ULONG)((wcslen(data) + 1) * sizeof(*data)));
+
252 else {
+
253 // Writing NULL pointer with 0B length causes trouble in Event Viewer: message template string is displayed only, parameters are not rendered.
+
254 static const wchar_t null[] = L"(null)";
+
255 EventDataDescCreate(this, null, sizeof(null));
+
256 }
+
257 }
+
258
+
266 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
+
267 template<class _Elem, class _Traits, class _Ax>
+
268 event_data(_In_ const std::basic_string<_Elem, _Traits, _Ax> &data)
+
269 {
+
270 EventDataDescCreate(this, data.c_str(), (ULONG)((data.length() + 1) * sizeof(_Elem)));
+
271 }
+
272
+
281 #pragma warning(suppress: 26495) // EventDataDescCreate() initializes all members of EVENT_DATA_DESCRIPTOR
+
282 event_data(_In_bytecount_(size) const void *data, _In_ ULONG size)
+
283 {
+
284 EventDataDescCreate(this, data, size);
+
285 }
+
286 };
+
287
+ +
292
+
296 class event_rec : public EVENT_RECORD
+
297 {
+
298 public:
+ +
303 {
+
304 memset((EVENT_RECORD*)this, 0, sizeof(EVENT_RECORD));
+
305 }
+
306
+
312 event_rec(_In_ const event_rec &other) : EVENT_RECORD(other)
+
313 {
+
314 set_extended_data_internal(other.ExtendedDataCount, other.ExtendedData);
+
315 set_user_data_internal(other.UserDataLength, other.UserData);
+
316 }
+
317
+
323 event_rec(_In_ const EVENT_RECORD &other) : EVENT_RECORD(other)
+
324 {
+
325 set_extended_data_internal(other.ExtendedDataCount, other.ExtendedData);
+
326 set_user_data_internal(other.UserDataLength, other.UserData);
+
327 }
+
328
+
334 event_rec(_Inout_ event_rec&& other) noexcept : EVENT_RECORD(other)
+
335 {
+
336 memset((EVENT_RECORD*)&other, 0, sizeof(EVENT_RECORD));
+
337 }
+
338
+ +
343 {
+
344 if (ExtendedData)
+
345 delete reinterpret_cast<unsigned char*>(ExtendedData);
+
346
+
347 if (UserData)
+
348 delete reinterpret_cast<unsigned char*>(UserData);
+
349 }
350
-
351 if (UserData)
-
352 delete reinterpret_cast<unsigned char*>(UserData);
-
353 }
-
354
-
360 event_rec& operator=(_In_ const event_rec &other)
-
361 {
-
362 if (this != std::addressof(other)) {
-
363 (EVENT_RECORD&)*this = other;
-
364 set_extended_data_internal(other.ExtendedDataCount, other.ExtendedData);
-
365 set_user_data_internal(other.UserDataLength, other.UserData);
-
366 }
-
367
-
368 return *this;
-
369 }
-
370
-
376 event_rec& operator=(_In_ const EVENT_RECORD &other)
-
377 {
-
378 if (this != std::addressof(other)) {
-
379 (EVENT_RECORD&)*this = other;
-
380 set_extended_data_internal(other.ExtendedDataCount, other.ExtendedData);
-
381 set_user_data_internal(other.UserDataLength, other.UserData);
-
382 }
-
383
-
384 return *this;
-
385 }
-
386
-
392 event_rec& operator=(_Inout_ event_rec&& other) noexcept
-
393 {
-
394 if (this != std::addressof(other)) {
-
395 (EVENT_RECORD&)*this = other;
-
396 memset((EVENT_RECORD*)&other, 0, sizeof(EVENT_RECORD));
-
397 }
-
398
-
399 return *this;
-
400 }
-
401
-
408 void set_extended_data(_In_ USHORT count, _In_count_(count) const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
-
409 {
-
410 if (ExtendedData)
-
411 delete reinterpret_cast<unsigned char*>(ExtendedData);
-
412
-
413 set_extended_data_internal(count, data);
-
414 }
-
415
-
422 void set_user_data(_In_ USHORT size, _In_bytecount_(size) LPCVOID data)
-
423 {
-
424 if (UserData)
-
425 delete reinterpret_cast<unsigned char*>(UserData);
-
426
-
427 set_user_data_internal(size, data);
-
428 }
-
429
-
430 protected:
-
437 void set_extended_data_internal(_In_ USHORT count, _In_count_(count) const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
-
438 {
-
439 if (count) {
-
440 assert(data);
-
441
-
442 // Count the total required memory.
-
443 size_t data_size = 0;
-
444 for (size_t i = 0; i < count; i++)
-
445 data_size += data[i].DataSize;
-
446
-
447 // Allocate memory for extended data.
-
448 ExtendedData = reinterpret_cast<EVENT_HEADER_EXTENDED_DATA_ITEM*>(new unsigned char[sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM)*count + data_size]);
-
449
-
450 // Bulk-copy extended data descriptors.
-
451 memcpy(ExtendedData, data, sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM) * count);
-
452
-
453 // Copy the data.
-
454 unsigned char *ptr = reinterpret_cast<unsigned char*>(ExtendedData + count);
-
455 for (size_t i = 0; i < count; i++) {
-
456 if (data[i].DataSize) {
-
457 memcpy(ptr, (void*)(data[i].DataPtr), data[i].DataSize);
-
458 ExtendedData[i].DataPtr = (ULONGLONG)ptr;
-
459 ptr += data[i].DataSize;
-
460 } else
-
461 ExtendedData[i].DataPtr = NULL;
-
462 }
-
463 } else
-
464 ExtendedData = NULL;
-
465
-
466 ExtendedDataCount = count;
-
467 }
-
468
-
475 void set_user_data_internal(_In_ USHORT size, _In_bytecount_(size) LPCVOID data)
-
476 {
-
477 if (size) {
-
478 assert(data);
-
479
-
480 // Allocate memory for user data.
-
481 UserData = new unsigned char[size];
-
482
-
483 // Copy user data.
-
484 memcpy(UserData, data, size);
-
485 } else
-
486 UserData = NULL;
+
356 event_rec& operator=(_In_ const event_rec &other)
+
357 {
+
358 if (this != std::addressof(other)) {
+
359 (EVENT_RECORD&)*this = other;
+
360 set_extended_data_internal(other.ExtendedDataCount, other.ExtendedData);
+
361 set_user_data_internal(other.UserDataLength, other.UserData);
+
362 }
+
363
+
364 return *this;
+
365 }
+
366
+
372 event_rec& operator=(_In_ const EVENT_RECORD &other)
+
373 {
+
374 if (this != std::addressof(other)) {
+
375 (EVENT_RECORD&)*this = other;
+
376 set_extended_data_internal(other.ExtendedDataCount, other.ExtendedData);
+
377 set_user_data_internal(other.UserDataLength, other.UserData);
+
378 }
+
379
+
380 return *this;
+
381 }
+
382
+
388 event_rec& operator=(_Inout_ event_rec&& other) noexcept
+
389 {
+
390 if (this != std::addressof(other)) {
+
391 (EVENT_RECORD&)*this = other;
+
392 memset((EVENT_RECORD*)&other, 0, sizeof(EVENT_RECORD));
+
393 }
+
394
+
395 return *this;
+
396 }
+
397
+
404 void set_extended_data(_In_ USHORT count, _In_count_(count) const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
+
405 {
+
406 if (ExtendedData)
+
407 delete reinterpret_cast<unsigned char*>(ExtendedData);
+
408
+
409 set_extended_data_internal(count, data);
+
410 }
+
411
+
418 void set_user_data(_In_ USHORT size, _In_bytecount_(size) LPCVOID data)
+
419 {
+
420 if (UserData)
+
421 delete reinterpret_cast<unsigned char*>(UserData);
+
422
+
423 set_user_data_internal(size, data);
+
424 }
+
425
+
426 protected:
+
433 void set_extended_data_internal(_In_ USHORT count, _In_count_(count) const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
+
434 {
+
435 if (count) {
+
436 assert(data);
+
437
+
438 // Count the total required memory.
+
439 size_t data_size = 0;
+
440 for (size_t i = 0; i < count; i++)
+
441 data_size += data[i].DataSize;
+
442
+
443 // Allocate memory for extended data.
+
444 ExtendedData = reinterpret_cast<EVENT_HEADER_EXTENDED_DATA_ITEM*>(new unsigned char[sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM)*count + data_size]);
+
445
+
446 // Bulk-copy extended data descriptors.
+
447 memcpy(ExtendedData, data, sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM) * count);
+
448
+
449 // Copy the data.
+
450 unsigned char *ptr = reinterpret_cast<unsigned char*>(ExtendedData + count);
+
451 for (size_t i = 0; i < count; i++) {
+
452 if (data[i].DataSize) {
+
453 memcpy(ptr, (void*)(data[i].DataPtr), data[i].DataSize);
+
454 ExtendedData[i].DataPtr = (ULONGLONG)ptr;
+
455 ptr += data[i].DataSize;
+
456 } else
+
457 ExtendedData[i].DataPtr = NULL;
+
458 }
+
459 } else
+
460 ExtendedData = NULL;
+
461
+
462 ExtendedDataCount = count;
+
463 }
+
464
+
471 void set_user_data_internal(_In_ USHORT size, _In_bytecount_(size) LPCVOID data)
+
472 {
+
473 if (size) {
+
474 assert(data);
+
475
+
476 // Allocate memory for user data.
+
477 UserData = new unsigned char[size];
+
478
+
479 // Copy user data.
+
480 memcpy(UserData, data, size);
+
481 } else
+
482 UserData = NULL;
+
483
+
484 UserDataLength = size;
+
485 }
+
486 };
487
-
488 UserDataLength = size;
-
489 }
-
490 };
-
491
-
495 class event_provider : public handle<REGHANDLE, NULL>
-
496 {
- -
498
-
499 public:
- -
506 {
-
507 if (m_h != invalid)
- -
509 }
-
510
-
520 ULONG create(_In_ LPCGUID ProviderId)
-
521 {
-
522 handle_type h;
-
523 ULONG ulRes = EventRegister(ProviderId, enable_callback, this, &h);
-
524 if (ulRes == ERROR_SUCCESS)
-
525 attach(h);
-
526 return ulRes;
-
527 }
-
528
-
538 ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
-
539 {
-
540 assert(m_h != invalid);
-
541 return EventWrite(m_h, EventDescriptor, 0, NULL);
-
542 }
-
543
-
553 ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ ULONG UserDataCount = 0, _In_opt_count_(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData = NULL)
-
554 {
-
555 assert(m_h != invalid);
-
556 return EventWrite(m_h, EventDescriptor, UserDataCount, UserData);
-
557 }
-
558
-
570 ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ const EVENT_DATA_DESCRIPTOR param1, ...)
-
571 {
-
572 assert(m_h != invalid);
-
573
-
574 // The first argument (param1) is outside of varadic argument list.
-
575 if (param1.Ptr == winstd::blank_event_data.Ptr &&
-
576 param1.Size == winstd::blank_event_data.Size &&
-
577 param1.Reserved == winstd::blank_event_data.Reserved)
-
578 return EventWrite(m_h, EventDescriptor, 0, NULL);
-
579
-
580 va_list arg;
-
581 va_start(arg, param1);
-
582 va_list arg_start = arg;
-
583 std::vector<EVENT_DATA_DESCRIPTOR> params;
-
584 ULONG param_count;
-
585
-
586 // Preallocate array.
-
587 for (param_count = 1; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
-
588 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
-
589 if (p.Ptr == winstd::blank_event_data.Ptr &&
-
590 p.Size == winstd::blank_event_data.Size &&
-
591 p.Reserved == winstd::blank_event_data.Reserved) break;
-
592 }
-
593 params.reserve(param_count);
-
594
-
595 // Copy parameters to array.
-
596 arg = arg_start;
-
597 params.push_back(param1);
-
598 for (;;) {
-
599 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
-
600 if (p.Ptr == winstd::blank_event_data.Ptr &&
-
601 p.Size == winstd::blank_event_data.Size &&
-
602 p.Reserved == winstd::blank_event_data.Reserved) break;
-
603 params.push_back(p);
-
604 }
-
605
-
606 va_end(arg);
-
607#pragma warning(push)
-
608#pragma warning(disable: 28020)
-
609 return EventWrite(m_h, EventDescriptor, param_count, params.data());
-
610#pragma warning(pop)
-
611 }
-
612
-
624 ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ va_list arg)
-
625 {
-
626 assert(m_h != invalid);
+
491 class event_provider : public handle<REGHANDLE, NULL>
+
492 {
+ +
494
+
495 public:
+ +
502 {
+
503 if (m_h != invalid)
+ +
505 }
+
506
+
516 ULONG create(_In_ LPCGUID ProviderId)
+
517 {
+
518 handle_type h;
+
519 ULONG ulRes = EventRegister(ProviderId, enable_callback, this, &h);
+
520 if (ulRes == ERROR_SUCCESS)
+
521 attach(h);
+
522 return ulRes;
+
523 }
+
524
+
534 ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
+
535 {
+
536 assert(m_h != invalid);
+
537 return EventWrite(m_h, EventDescriptor, 0, NULL);
+
538 }
+
539
+
549 ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ ULONG UserDataCount = 0, _In_opt_count_(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData = NULL)
+
550 {
+
551 assert(m_h != invalid);
+
552 return EventWrite(m_h, EventDescriptor, UserDataCount, UserData);
+
553 }
+
554
+
566 ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ const EVENT_DATA_DESCRIPTOR param1, ...)
+
567 {
+
568 assert(m_h != invalid);
+
569
+
570 // The first argument (param1) is outside of varadic argument list.
+
571 if (param1.Ptr == winstd::blank_event_data.Ptr &&
+
572 param1.Size == winstd::blank_event_data.Size &&
+
573 param1.Reserved == winstd::blank_event_data.Reserved)
+
574 return EventWrite(m_h, EventDescriptor, 0, NULL);
+
575
+
576 va_list arg;
+
577 va_start(arg, param1);
+
578 va_list arg_start = arg;
+
579 std::vector<EVENT_DATA_DESCRIPTOR> params;
+
580 ULONG param_count;
+
581
+
582 // Preallocate array.
+
583 for (param_count = 1; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
+
584 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
+
585 if (p.Ptr == winstd::blank_event_data.Ptr &&
+
586 p.Size == winstd::blank_event_data.Size &&
+
587 p.Reserved == winstd::blank_event_data.Reserved) break;
+
588 }
+
589 params.reserve(param_count);
+
590
+
591 // Copy parameters to array.
+
592 arg = arg_start;
+
593 params.push_back(param1);
+
594 for (;;) {
+
595 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
+
596 if (p.Ptr == winstd::blank_event_data.Ptr &&
+
597 p.Size == winstd::blank_event_data.Size &&
+
598 p.Reserved == winstd::blank_event_data.Reserved) break;
+
599 params.push_back(p);
+
600 }
+
601
+
602 va_end(arg);
+
603#pragma warning(push)
+
604#pragma warning(disable: 28020)
+
605 return EventWrite(m_h, EventDescriptor, param_count, params.data());
+
606#pragma warning(pop)
+
607 }
+
608
+
620 ULONG write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ va_list arg)
+
621 {
+
622 assert(m_h != invalid);
+
623
+
624 va_list arg_start = arg;
+
625 std::vector<EVENT_DATA_DESCRIPTOR> params;
+
626 ULONG param_count;
627
-
628 va_list arg_start = arg;
-
629 std::vector<EVENT_DATA_DESCRIPTOR> params;
-
630 ULONG param_count;
-
631
-
632 // Preallocate array.
-
633 for (param_count = 0; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
-
634 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
-
635 if (p.Ptr == winstd::blank_event_data.Ptr &&
-
636 p.Size == winstd::blank_event_data.Size &&
-
637 p.Reserved == winstd::blank_event_data.Reserved) break;
-
638 }
-
639 params.reserve(param_count);
-
640
-
641 // Copy parameters to array.
-
642 arg = arg_start;
-
643 for (;;) {
-
644 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
-
645 if (p.Ptr == winstd::blank_event_data.Ptr &&
-
646 p.Size == winstd::blank_event_data.Size &&
-
647 p.Reserved == winstd::blank_event_data.Reserved) break;
-
648 params.push_back(p);
-
649 }
-
650
-
651#pragma warning(push)
-
652#pragma warning(disable: 28020)
-
653 return EventWrite(m_h, EventDescriptor, param_count, params.data());
-
654#pragma warning(pop)
-
655 }
-
656
-
666 ULONG write(_In_ UCHAR Level, _In_ ULONGLONG Keyword, _In_z_ _Printf_format_string_ PCWSTR String, ...)
-
667 {
-
668 assert(m_h != invalid);
-
669
-
670 std::wstring msg;
-
671 va_list arg;
-
672
-
673 // Format message.
-
674 va_start(arg, String);
-
675 vsprintf(msg, String, arg);
-
676 va_end(arg);
+
628 // Preallocate array.
+
629 for (param_count = 0; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
+
630 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
+
631 if (p.Ptr == winstd::blank_event_data.Ptr &&
+
632 p.Size == winstd::blank_event_data.Size &&
+
633 p.Reserved == winstd::blank_event_data.Reserved) break;
+
634 }
+
635 params.reserve(param_count);
+
636
+
637 // Copy parameters to array.
+
638 arg = arg_start;
+
639 for (;;) {
+
640 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg, const EVENT_DATA_DESCRIPTOR);
+
641 if (p.Ptr == winstd::blank_event_data.Ptr &&
+
642 p.Size == winstd::blank_event_data.Size &&
+
643 p.Reserved == winstd::blank_event_data.Reserved) break;
+
644 params.push_back(p);
+
645 }
+
646
+
647#pragma warning(push)
+
648#pragma warning(disable: 28020)
+
649 return EventWrite(m_h, EventDescriptor, param_count, params.data());
+
650#pragma warning(pop)
+
651 }
+
652
+
662 ULONG write(_In_ UCHAR Level, _In_ ULONGLONG Keyword, _In_z_ _Printf_format_string_ PCWSTR String, ...)
+
663 {
+
664 assert(m_h != invalid);
+
665
+
666 std::wstring msg;
+
667 va_list arg;
+
668
+
669 // Format message.
+
670 va_start(arg, String);
+
671 vsprintf(msg, String, arg);
+
672 va_end(arg);
+
673
+
674 // Write string event.
+
675 return EventWriteString(m_h, Level, Keyword, msg.c_str());
+
676 }
677
-
678 // Write string event.
-
679 return EventWriteString(m_h, Level, Keyword, msg.c_str());
-
680 }
-
681
-
682 protected:
-
688 void free_internal() noexcept override
-
689 {
-
690 EventUnregister(m_h);
-
691 }
-
692
-
698 virtual void enable_callback(_In_ LPCGUID SourceId, _In_ ULONG IsEnabled, _In_ UCHAR Level, _In_ ULONGLONG MatchAnyKeyword, _In_ ULONGLONG MatchAllKeyword, _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData)
-
699 {
-
700 UNREFERENCED_PARAMETER(SourceId);
-
701 UNREFERENCED_PARAMETER(IsEnabled);
-
702 UNREFERENCED_PARAMETER(Level);
-
703 UNREFERENCED_PARAMETER(MatchAnyKeyword);
-
704 UNREFERENCED_PARAMETER(MatchAllKeyword);
-
705 UNREFERENCED_PARAMETER(FilterData);
-
706 }
-
707
-
713 static VOID NTAPI enable_callback(_In_ LPCGUID SourceId, _In_ ULONG IsEnabled, _In_ UCHAR Level, _In_ ULONGLONG MatchAnyKeyword, _In_ ULONGLONG MatchAllKeyword, _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData, _Inout_opt_ PVOID CallbackContext)
-
714 {
-
715 if (CallbackContext)
-
716 static_cast<event_provider*>(CallbackContext)->enable_callback(SourceId, IsEnabled, Level, MatchAnyKeyword, MatchAllKeyword, FilterData);
-
717 else
-
718 assert(0); // Where did the "this" pointer get lost?
-
719 }
-
720 };
-
721
-
725 class event_session : public handle<TRACEHANDLE, 0>
-
726 {
- -
728
-
729 public:
- -
734 {
-
735 }
-
736
-
743 event_session(_In_opt_ handle_type h, _In_ const EVENT_TRACE_PROPERTIES *prop) :
-
744 m_prop(reinterpret_cast<EVENT_TRACE_PROPERTIES*>(new char[prop->Wnode.BufferSize])),
-
745 handle(h)
-
746 {
-
747 memcpy(m_prop.get(), prop, prop->Wnode.BufferSize);
-
748 }
-
749
-
755 event_session(_Inout_ event_session &&other) noexcept :
-
756 m_prop(std::move(other.m_prop)),
-
757 handle(std::move(other))
-
758 {
-
759 }
-
760
- -
767 {
-
768 if (m_h != invalid)
- -
770 }
-
771
-
777 event_session& operator=(_Inout_ event_session &&other) noexcept
-
778 {
-
779 if (this != std::addressof(other)) {
-
780 (handle<handle_type, 0>&&)*this = std::move(other);
-
781 m_prop = std::move(other.m_prop);
-
782 }
-
783 return *this;
-
784 }
-
785
-
791 operator const EVENT_TRACE_PROPERTIES*() const
-
792 {
-
793 return m_prop.get();
-
794 }
-
795
-
801 LPCTSTR name() const
-
802 {
-
803 const EVENT_TRACE_PROPERTIES *prop = m_prop.get();
-
804 return reinterpret_cast<LPCTSTR>(reinterpret_cast<const char*>(prop) + prop->LoggerNameOffset);
-
805 }
-
806
-
815 void attach(_In_opt_ handle_type h, _In_ EVENT_TRACE_PROPERTIES *prop)
-
816 {
- -
818 m_prop.reset(prop);
-
819 }
-
820
-
830 ULONG create(_In_z_ LPCTSTR SessionName, _In_ const EVENT_TRACE_PROPERTIES *Properties)
-
831 {
-
832 handle_type h;
-
833 std::unique_ptr<EVENT_TRACE_PROPERTIES> prop(reinterpret_cast<EVENT_TRACE_PROPERTIES*>(new char[Properties->Wnode.BufferSize]));
-
834 memcpy(prop.get(), Properties, Properties->Wnode.BufferSize);
-
835 ULONG ulRes = StartTrace(&h, SessionName, prop.get());
-
836 if (ulRes == ERROR_SUCCESS)
-
837 attach(h, prop.release());
-
838 return ulRes;
-
839 }
-
840
-
850 ULONG enable_trace(_In_ LPCGUID ProviderId, _In_ UCHAR Level, _In_opt_ ULONGLONG MatchAnyKeyword = 0, _In_opt_ ULONGLONG MatchAllKeyword = 0, _In_opt_ ULONG EnableProperty = 0, _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL)
-
851 {
-
852 assert(m_h != invalid);
-
853 return EnableTraceEx(
-
854 ProviderId,
-
855 &m_prop->Wnode.Guid,
-
856 m_h,
-
857 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
-
858 Level,
-
859 MatchAnyKeyword,
-
860 MatchAllKeyword,
-
861 EnableProperty,
-
862 EnableFilterDesc);
-
863 }
-
864
-
874 ULONG disable_trace(_In_ LPCGUID ProviderId, _In_ UCHAR Level, _In_opt_ ULONGLONG MatchAnyKeyword = 0, _In_opt_ ULONGLONG MatchAllKeyword = 0, _In_opt_ ULONG EnableProperty = 0, _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL)
-
875 {
-
876 assert(m_h != invalid);
-
877 return EnableTraceEx(
-
878 ProviderId,
-
879 &m_prop->Wnode.Guid,
-
880 m_h,
-
881 EVENT_CONTROL_CODE_DISABLE_PROVIDER,
-
882 Level,
-
883 MatchAnyKeyword,
-
884 MatchAllKeyword,
-
885 EnableProperty,
-
886 EnableFilterDesc);
-
887 }
-
888
-
889 protected:
-
895 void free_internal() noexcept override
-
896 {
-
897 ControlTrace(m_h, name(), m_prop.get(), EVENT_TRACE_CONTROL_STOP);
-
898 }
+
678 protected:
+
684 void free_internal() noexcept override
+
685 {
+
686 EventUnregister(m_h);
+
687 }
+
688
+
694 virtual void enable_callback(_In_ LPCGUID SourceId, _In_ ULONG IsEnabled, _In_ UCHAR Level, _In_ ULONGLONG MatchAnyKeyword, _In_ ULONGLONG MatchAllKeyword, _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData)
+
695 {
+
696 UNREFERENCED_PARAMETER(SourceId);
+
697 UNREFERENCED_PARAMETER(IsEnabled);
+
698 UNREFERENCED_PARAMETER(Level);
+
699 UNREFERENCED_PARAMETER(MatchAnyKeyword);
+
700 UNREFERENCED_PARAMETER(MatchAllKeyword);
+
701 UNREFERENCED_PARAMETER(FilterData);
+
702 }
+
703
+
709 static VOID NTAPI enable_callback(_In_ LPCGUID SourceId, _In_ ULONG IsEnabled, _In_ UCHAR Level, _In_ ULONGLONG MatchAnyKeyword, _In_ ULONGLONG MatchAllKeyword, _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData, _Inout_opt_ PVOID CallbackContext)
+
710 {
+
711 if (CallbackContext)
+
712 static_cast<event_provider*>(CallbackContext)->enable_callback(SourceId, IsEnabled, Level, MatchAnyKeyword, MatchAllKeyword, FilterData);
+
713 else
+
714 assert(0); // Where did the "this" pointer get lost?
+
715 }
+
716 };
+
717
+
721 class event_session : public handle<TRACEHANDLE, 0>
+
722 {
+ +
724
+
725 public:
+ +
730 {
+
731 }
+
732
+
739 event_session(_In_opt_ handle_type h, _In_ const EVENT_TRACE_PROPERTIES *prop) :
+
740 m_prop(reinterpret_cast<EVENT_TRACE_PROPERTIES*>(new char[prop->Wnode.BufferSize])),
+
741 handle(h)
+
742 {
+
743 memcpy(m_prop.get(), prop, prop->Wnode.BufferSize);
+
744 }
+
745
+
751 event_session(_Inout_ event_session &&other) noexcept :
+
752 m_prop(std::move(other.m_prop)),
+
753 handle(std::move(other))
+
754 {
+
755 }
+
756
+ +
763 {
+
764 if (m_h != invalid)
+ +
766 }
+
767
+
773 event_session& operator=(_Inout_ event_session &&other) noexcept
+
774 {
+
775 if (this != std::addressof(other)) {
+
776 (handle<handle_type, 0>&&)*this = std::move(other);
+
777 m_prop = std::move(other.m_prop);
+
778 }
+
779 return *this;
+
780 }
+
781
+
787 operator const EVENT_TRACE_PROPERTIES*() const
+
788 {
+
789 return m_prop.get();
+
790 }
+
791
+
797 LPCTSTR name() const
+
798 {
+
799 const EVENT_TRACE_PROPERTIES *prop = m_prop.get();
+
800 return reinterpret_cast<LPCTSTR>(reinterpret_cast<const char*>(prop) + prop->LoggerNameOffset);
+
801 }
+
802
+
811 void attach(_In_opt_ handle_type h, _In_ EVENT_TRACE_PROPERTIES *prop)
+
812 {
+ +
814 m_prop.reset(prop);
+
815 }
+
816
+
826 ULONG create(_In_z_ LPCTSTR SessionName, _In_ const EVENT_TRACE_PROPERTIES *Properties)
+
827 {
+
828 handle_type h;
+
829 std::unique_ptr<EVENT_TRACE_PROPERTIES> prop(reinterpret_cast<EVENT_TRACE_PROPERTIES*>(new char[Properties->Wnode.BufferSize]));
+
830 memcpy(prop.get(), Properties, Properties->Wnode.BufferSize);
+
831 ULONG ulRes = StartTrace(&h, SessionName, prop.get());
+
832 if (ulRes == ERROR_SUCCESS)
+
833 attach(h, prop.release());
+
834 return ulRes;
+
835 }
+
836
+
846 ULONG enable_trace(_In_ LPCGUID ProviderId, _In_ UCHAR Level, _In_opt_ ULONGLONG MatchAnyKeyword = 0, _In_opt_ ULONGLONG MatchAllKeyword = 0, _In_opt_ ULONG EnableProperty = 0, _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL)
+
847 {
+
848 assert(m_h != invalid);
+
849 return EnableTraceEx(
+
850 ProviderId,
+
851 &m_prop->Wnode.Guid,
+
852 m_h,
+
853 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
+
854 Level,
+
855 MatchAnyKeyword,
+
856 MatchAllKeyword,
+
857 EnableProperty,
+
858 EnableFilterDesc);
+
859 }
+
860
+
870 ULONG disable_trace(_In_ LPCGUID ProviderId, _In_ UCHAR Level, _In_opt_ ULONGLONG MatchAnyKeyword = 0, _In_opt_ ULONGLONG MatchAllKeyword = 0, _In_opt_ ULONG EnableProperty = 0, _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL)
+
871 {
+
872 assert(m_h != invalid);
+
873 return EnableTraceEx(
+
874 ProviderId,
+
875 &m_prop->Wnode.Guid,
+
876 m_h,
+
877 EVENT_CONTROL_CODE_DISABLE_PROVIDER,
+
878 Level,
+
879 MatchAnyKeyword,
+
880 MatchAllKeyword,
+
881 EnableProperty,
+
882 EnableFilterDesc);
+
883 }
+
884
+
885 protected:
+
891 void free_internal() noexcept override
+
892 {
+
893 ControlTrace(m_h, name(), m_prop.get(), EVENT_TRACE_CONTROL_STOP);
+
894 }
+
895
+
896 protected:
+
897 std::unique_ptr<EVENT_TRACE_PROPERTIES> m_prop;
+
898 };
899
-
900 protected:
-
901 std::unique_ptr<EVENT_TRACE_PROPERTIES> m_prop;
-
902 };
-
903
-
909 class event_trace : public handle<TRACEHANDLE, INVALID_PROCESSTRACE_HANDLE>
-
910 {
-
911 WINSTD_HANDLE_IMPL(event_trace, INVALID_PROCESSTRACE_HANDLE)
-
912
-
913 public:
-
919 virtual ~event_trace()
-
920 {
-
921 if (m_h != invalid)
- -
923 }
-
924
-
925 protected:
-
931 void free_internal() noexcept override
-
932 {
-
933 CloseTrace(m_h);
-
934 }
-
935 };
-
936
- -
941 {
-
942 public:
- -
949 _In_opt_ LPCGUID SourceId,
-
950 _In_ TRACEHANDLE TraceHandle,
-
951 _In_ LPCGUID ProviderId,
-
952 _In_ UCHAR Level,
-
953 _In_opt_ ULONGLONG MatchAnyKeyword = 0,
-
954 _In_opt_ ULONGLONG MatchAllKeyword = 0,
-
955 _In_opt_ ULONG EnableProperty = 0,
-
956 _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL) :
-
957 m_provider_id(ProviderId),
-
958 m_source_id(SourceId),
-
959 m_trace_handle(TraceHandle),
-
960 m_level(Level),
-
961 m_match_any_keyword(MatchAnyKeyword),
-
962 m_match_all_keyword(MatchAllKeyword),
-
963 m_enable_property(EnableProperty),
-
964 m_enable_filter_desc(EnableFilterDesc)
-
965 {
-
966 m_status = EnableTraceEx(
- - - -
970 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
-
971 m_level,
- - - - -
976 }
-
977
- -
984 _In_ const event_session &session,
-
985 _In_ LPCGUID ProviderId,
-
986 _In_ UCHAR Level,
-
987 _In_opt_ ULONGLONG MatchAnyKeyword = 0,
-
988 _In_opt_ ULONGLONG MatchAllKeyword = 0,
-
989 _In_opt_ ULONG EnableProperty = 0,
-
990 _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL) :
-
991 m_provider_id(ProviderId),
-
992 m_source_id(&((const EVENT_TRACE_PROPERTIES*)session)->Wnode.Guid),
-
993 m_trace_handle(session),
-
994 m_level(Level),
-
995 m_match_any_keyword(MatchAnyKeyword),
-
996 m_match_all_keyword(MatchAllKeyword),
-
997 m_enable_property(EnableProperty),
-
998 m_enable_filter_desc(EnableFilterDesc)
-
999 {
-
1000 m_status = EnableTraceEx(
- - - -
1004 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
-
1005 m_level,
- - - - -
1010 }
-
1011
-
1017 ULONG status() const
-
1018 {
-
1019 return m_status;
-
1020 }
-
1021
- -
1028 {
-
1029 if (m_status == ERROR_SUCCESS)
-
1030 EnableTraceEx(
- - - -
1034 EVENT_CONTROL_CODE_DISABLE_PROVIDER,
-
1035 m_level,
- - - - -
1040 }
-
1041
-
1042 protected:
-
1043 ULONG m_status;
- -
1045 LPCGUID m_source_id;
-
1046 TRACEHANDLE m_trace_handle;
-
1047 UCHAR m_level;
- - - -
1051 PEVENT_FILTER_DESCRIPTOR m_enable_filter_desc;
-
1052 };
-
1053
- -
1060 {
-
1061 public:
-
1065 event_fn_auto(_In_ event_provider &ep, _In_ const EVENT_DESCRIPTOR *event_cons, _In_ const EVENT_DESCRIPTOR *event_dest, _In_z_ LPCSTR pszFnName) :
-
1066 m_ep(ep),
-
1067 m_event_dest(event_dest)
-
1068 {
-
1069 EventDataDescCreate(&m_fn_name, pszFnName, (ULONG)(strlen(pszFnName) + 1)*sizeof(*pszFnName));
-
1070 m_ep.write(event_cons, 1, &m_fn_name);
-
1071 }
-
1072
-
1076 event_fn_auto(_In_ const event_fn_auto &other) :
-
1077 m_ep(other.m_ep),
- -
1079 m_fn_name(other.m_fn_name)
-
1080 {
-
1081 }
-
1082
-
1086 event_fn_auto(_Inout_ event_fn_auto &&other) noexcept :
-
1087 m_ep(other.m_ep),
-
1088 m_event_dest(other.m_event_dest),
-
1089 m_fn_name(std::move(other.m_fn_name))
-
1090 {
-
1091 other.m_event_dest = NULL;
-
1092 }
-
1093
- -
1098 {
-
1099 if (m_event_dest)
- -
1101 }
-
1102
- -
1107 {
-
1108 if (this != &other) {
-
1109 assert(&m_ep == &other.m_ep);
-
1110 m_event_dest = other.m_event_dest;
-
1111 m_fn_name = other.m_fn_name;
-
1112 }
-
1113
-
1114 return *this;
-
1115 }
-
1116
-
1120 event_fn_auto& operator=(_Inout_ event_fn_auto &&other) noexcept
-
1121 {
-
1122 if (this != &other) {
-
1123 assert(&m_ep == &other.m_ep);
-
1124 m_event_dest = other.m_event_dest;
-
1125 m_fn_name = std::move(other.m_fn_name);
-
1126 other.m_event_dest = NULL;
-
1127 }
-
1128
-
1129 return *this;
-
1130 }
-
1131
-
1132 protected:
- -
1134 const EVENT_DESCRIPTOR *m_event_dest;
-
1135 EVENT_DATA_DESCRIPTOR m_fn_name;
-
1136 };
-
1137
-
1143 template<class T>
- -
1145 {
-
1146 public:
-
1150 event_fn_auto_ret(_In_ event_provider &ep, _In_ const EVENT_DESCRIPTOR *event_cons, _In_ const EVENT_DESCRIPTOR *event_dest, _In_z_ LPCSTR pszFnName, T &result) :
-
1151 m_ep(ep),
-
1152 m_event_dest(event_dest),
-
1153 m_result(result)
-
1154 {
-
1155 EventDataDescCreate(m_desc + 0, pszFnName, (ULONG)(strlen(pszFnName) + 1)*sizeof(*pszFnName));
-
1156 m_ep.write(event_cons, 1, m_desc);
-
1157 }
-
1158
- -
1163 m_ep(other.m_ep),
- -
1165 m_result(other.m_result)
-
1166 {
-
1167 m_desc[0] = other.m_desc[0];
-
1168 }
-
1169
- -
1174 m_ep(other.m_ep),
- -
1176 m_result(other.m_result)
-
1177 {
-
1178 m_desc[0] = std::move(other.m_desc[0]);
-
1179 other.m_event_dest = NULL;
-
1180 }
-
1181
- -
1186 {
-
1187 if (m_event_dest) {
-
1188 EventDataDescCreate(m_desc + 1, &m_result, sizeof(T));
- -
1190 }
-
1191 }
-
1192
- -
1197 {
-
1198 if (this != &other) {
-
1199 assert(&m_ep == &other.m_ep);
-
1200 m_event_dest = other.m_event_dest;
-
1201 m_desc[0] = other.m_desc[0];
-
1202 assert(&m_result == &other.m_result);
-
1203 }
-
1204
-
1205 return *this;
-
1206 }
-
1207
- -
1212 {
-
1213 if (this != &other) {
-
1214 assert(&m_ep == &other.m_ep);
-
1215 m_event_dest = other.m_event_dest;
-
1216 m_desc[0] = std::move(other.m_desc[0]);
-
1217 assert(&m_result == &other.m_result);
-
1218 other.m_event_dest = NULL;
-
1219 }
-
1220
-
1221 return *this;
-
1222 }
-
1223
-
1224 protected:
- -
1226 const EVENT_DESCRIPTOR *m_event_dest;
-
1227 EVENT_DATA_DESCRIPTOR m_desc[2];
- -
1229 };
-
1230
-
1232}
-
General API.
-
EVENT_DATA_DESCRIPTOR wrapper.
Definition: ETW.h:122
-
event_data(const char &data)
Construct class pointing to an char.
Definition: ETW.h:142
-
event_data(const wchar_t *data)
Construct class pointing to a wide string.
Definition: ETW.h:252
-
event_data(const int &data)
Construct class pointing to an int.
Definition: ETW.h:168
-
event_data(const void *data, ULONG size)
Construct class pointing to binary data.
Definition: ETW.h:286
-
event_data(const GUID &data)
Construct class pointing to a GUID.
Definition: ETW.h:220
-
event_data(const unsigned int &data)
Construct class pointing to an unsigned int.
Definition: ETW.h:181
-
event_data(const char *data)
Construct class pointing to a string.
Definition: ETW.h:233
-
event_data(const unsigned char &data)
Construct class pointing to an unsigned char.
Definition: ETW.h:155
-
event_data(const std::basic_string< _Elem, _Traits, _Ax > &data)
Template to construct pointing to a std::basic_string<>.
Definition: ETW.h:272
-
event_data(const unsigned long &data)
Construct class pointing to an unsigned long.
Definition: ETW.h:207
-
event_data()
Construct empty class.
Definition: ETW.h:127
-
event_data(const long &data)
Construct class pointing to a long.
Definition: ETW.h:194
-
Helper template to write an event on entry/exit of scope with one parameter (typically result).
Definition: ETW.h:1145
-
event_fn_auto_ret(const event_fn_auto_ret< T > &other)
Copies the object.
Definition: ETW.h:1162
-
~event_fn_auto_ret()
Writes the event_dest event.
Definition: ETW.h:1185
-
EVENT_DATA_DESCRIPTOR m_desc[2]
Function name and return value.
Definition: ETW.h:1227
-
event_provider & m_ep
Reference to event provider in use.
Definition: ETW.h:1225
-
event_fn_auto_ret(event_provider &ep, const EVENT_DESCRIPTOR *event_cons, const EVENT_DESCRIPTOR *event_dest, LPCSTR pszFnName, T &result)
Writes the event_cons event.
Definition: ETW.h:1150
-
T & m_result
Function result.
Definition: ETW.h:1228
-
event_fn_auto_ret & operator=(const event_fn_auto_ret< T > &other)
Copies the object.
Definition: ETW.h:1196
-
const EVENT_DESCRIPTOR * m_event_dest
Event descriptor at destruction.
Definition: ETW.h:1226
-
event_fn_auto_ret(event_fn_auto_ret< T > &&other)
Moves the object.
Definition: ETW.h:1173
-
event_fn_auto_ret & operator=(event_fn_auto_ret< T > &&other)
Moves the object.
Definition: ETW.h:1211
-
Helper class to write an event on entry/exit of scope.
Definition: ETW.h:1060
-
const EVENT_DESCRIPTOR * m_event_dest
Event descriptor at destruction.
Definition: ETW.h:1134
-
event_fn_auto(event_fn_auto &&other) noexcept
Moves the object.
Definition: ETW.h:1086
-
event_fn_auto(event_provider &ep, const EVENT_DESCRIPTOR *event_cons, const EVENT_DESCRIPTOR *event_dest, LPCSTR pszFnName)
Writes the event_cons event.
Definition: ETW.h:1065
-
~event_fn_auto()
Writes the event_dest event.
Definition: ETW.h:1097
-
event_fn_auto & operator=(event_fn_auto &&other) noexcept
Moves the object.
Definition: ETW.h:1120
-
event_fn_auto & operator=(const event_fn_auto &other)
Copies the object.
Definition: ETW.h:1106
-
event_provider & m_ep
Reference to event provider in use.
Definition: ETW.h:1133
-
EVENT_DATA_DESCRIPTOR m_fn_name
Function name.
Definition: ETW.h:1135
-
event_fn_auto(const event_fn_auto &other)
Copies the object.
Definition: ETW.h:1076
-
ETW event provider.
Definition: ETW.h:496
-
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor)
Writes an event with no parameters.
Definition: ETW.h:538
-
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, ULONG UserDataCount=0, PEVENT_DATA_DESCRIPTOR UserData=NULL)
Writes an event with parameters stored in array.
Definition: ETW.h:553
-
ULONG write(UCHAR Level, ULONGLONG Keyword, PCWSTR String,...)
Writes a string event.
Definition: ETW.h:666
-
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, va_list arg)
Writes an event with variable number of parameters.
Definition: ETW.h:624
-
virtual ~event_provider()
Closes the event provider.
Definition: ETW.h:505
-
virtual void enable_callback(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData)
Receive enable or disable notification requests.
Definition: ETW.h:698
-
void free_internal() noexcept override
Releases the event provider.
Definition: ETW.h:688
-
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, const EVENT_DATA_DESCRIPTOR param1,...)
Writes an event with one or more parameter.
Definition: ETW.h:570
-
static VOID NTAPI enable_callback(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext)
Receive enable or disable notification requests.
Definition: ETW.h:713
-
ULONG create(LPCGUID ProviderId)
Registers the event provider.
Definition: ETW.h:520
-
EVENT_RECORD wrapper.
Definition: ETW.h:301
-
void set_extended_data_internal(USHORT count, const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
Sets event record extended data.
Definition: ETW.h:437
-
void set_user_data(USHORT size, LPCVOID data)
Sets event record user data.
Definition: ETW.h:422
-
event_rec & operator=(event_rec &&other) noexcept
Moves the event record.
Definition: ETW.h:392
-
~event_rec()
Destroys event record data and frees the allocated memory.
Definition: ETW.h:346
-
event_rec & operator=(const EVENT_RECORD &other)
Copies an existing event record.
Definition: ETW.h:376
-
event_rec(const EVENT_RECORD &other)
Copies an existing event record.
Definition: ETW.h:327
-
event_rec & operator=(const event_rec &other)
Copies an existing event record.
Definition: ETW.h:360
-
void set_extended_data(USHORT count, const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
Sets event record extended data.
Definition: ETW.h:408
-
event_rec(event_rec &&other) noexcept
Moves the event record.
Definition: ETW.h:338
-
event_rec()
Constructs a blank event record.
Definition: ETW.h:306
-
void set_user_data_internal(USHORT size, LPCVOID data)
Sets event record user data.
Definition: ETW.h:475
-
event_rec(const event_rec &other)
Copies an existing event record.
Definition: ETW.h:316
-
ETW session.
Definition: ETW.h:726
-
LPCTSTR name() const
Auto-typecasting operator.
Definition: ETW.h:801
-
event_session(event_session &&other) noexcept
Move constructor.
Definition: ETW.h:755
-
event_session(handle_type h, const EVENT_TRACE_PROPERTIES *prop)
Initializes a new session with an already available object handle.
Definition: ETW.h:743
-
event_session()
Initializes a new empty session.
Definition: ETW.h:733
-
virtual ~event_session()
Closes the session.
Definition: ETW.h:766
-
void free_internal() noexcept override
Releases the session.
Definition: ETW.h:895
-
event_session & operator=(event_session &&other) noexcept
Move assignment.
Definition: ETW.h:777
-
ULONG disable_trace(LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Disables the specified event trace provider.
Definition: ETW.h:874
-
ULONG enable_trace(LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Enables the specified event trace provider.
Definition: ETW.h:850
-
std::unique_ptr< EVENT_TRACE_PROPERTIES > m_prop
Session properties.
Definition: ETW.h:901
-
ULONG create(LPCTSTR SessionName, const EVENT_TRACE_PROPERTIES *Properties)
Registers and starts an event tracing session.
Definition: ETW.h:830
-
void attach(handle_type h, EVENT_TRACE_PROPERTIES *prop)
Sets a new session handle for the class.
Definition: ETW.h:815
-
Helper class to enable event provider in constructor and disables it in destructor.
Definition: ETW.h:941
-
UCHAR m_level
Logging level.
Definition: ETW.h:1047
-
PEVENT_FILTER_DESCRIPTOR m_enable_filter_desc
Event filter descriptor.
Definition: ETW.h:1051
-
ULONGLONG m_match_any_keyword
Keyword match mask (any)
Definition: ETW.h:1048
-
event_trace_enabler(LPCGUID SourceId, TRACEHANDLE TraceHandle, LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Enables event trace.
Definition: ETW.h:948
-
ULONG m_status
Result of EnableTraceEx call.
Definition: ETW.h:1043
-
TRACEHANDLE m_trace_handle
Trace handle.
Definition: ETW.h:1046
-
virtual ~event_trace_enabler()
Disables event trace.
Definition: ETW.h:1027
-
ULONG status() const
Return result of EnableTraceEx() call.
Definition: ETW.h:1017
-
event_trace_enabler(const event_session &session, LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Enables event trace.
Definition: ETW.h:983
-
ULONGLONG m_match_all_keyword
Keyword match mask (all)
Definition: ETW.h:1049
-
LPCGUID m_provider_id
Provider ID.
Definition: ETW.h:1044
-
LPCGUID m_source_id
Session ID.
Definition: ETW.h:1045
-
ULONG m_enable_property
Enable property.
Definition: ETW.h:1050
-
ETW trace.
Definition: ETW.h:910
-
virtual ~event_trace()
Closes the trace.
Definition: ETW.h:919
-
void free_internal() noexcept override
Closes the trace.
Definition: ETW.h:931
-
Base abstract template class to support generic object handle keeping.
Definition: Common.h:615
-
handle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition: Common.h:630
-
REGHANDLE handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:620
-
handle_type m_h
Object handle.
Definition: Common.h:866
-
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:829
-
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:62
-
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:37
-
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:88
-
static const event_data blank_event_data
Blank event data used as terminator.
Definition: ETW.h:295
-
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:74
-
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:101
-
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition: Common.h:259
-
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:171
-
static const REGHANDLE invalid
Invalid handle value.
Definition: Common.h:625
+
905 class event_trace : public handle<TRACEHANDLE, INVALID_PROCESSTRACE_HANDLE>
+
906 {
+
907 WINSTD_HANDLE_IMPL(event_trace, INVALID_PROCESSTRACE_HANDLE)
+
908
+
909 public:
+
915 virtual ~event_trace()
+
916 {
+
917 if (m_h != invalid)
+ +
919 }
+
920
+
921 protected:
+
927 void free_internal() noexcept override
+
928 {
+
929 CloseTrace(m_h);
+
930 }
+
931 };
+
932
+ +
937 {
+
938 public:
+ +
945 _In_opt_ LPCGUID SourceId,
+
946 _In_ TRACEHANDLE TraceHandle,
+
947 _In_ LPCGUID ProviderId,
+
948 _In_ UCHAR Level,
+
949 _In_opt_ ULONGLONG MatchAnyKeyword = 0,
+
950 _In_opt_ ULONGLONG MatchAllKeyword = 0,
+
951 _In_opt_ ULONG EnableProperty = 0,
+
952 _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL) :
+
953 m_provider_id(ProviderId),
+
954 m_source_id(SourceId),
+
955 m_trace_handle(TraceHandle),
+
956 m_level(Level),
+
957 m_match_any_keyword(MatchAnyKeyword),
+
958 m_match_all_keyword(MatchAllKeyword),
+
959 m_enable_property(EnableProperty),
+
960 m_enable_filter_desc(EnableFilterDesc)
+
961 {
+
962 m_status = EnableTraceEx(
+ + + +
966 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
+
967 m_level,
+ + + + +
972 }
+
973
+ +
980 _In_ const event_session &session,
+
981 _In_ LPCGUID ProviderId,
+
982 _In_ UCHAR Level,
+
983 _In_opt_ ULONGLONG MatchAnyKeyword = 0,
+
984 _In_opt_ ULONGLONG MatchAllKeyword = 0,
+
985 _In_opt_ ULONG EnableProperty = 0,
+
986 _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL) :
+
987 m_provider_id(ProviderId),
+
988 m_source_id(&((const EVENT_TRACE_PROPERTIES*)session)->Wnode.Guid),
+
989 m_trace_handle(session),
+
990 m_level(Level),
+
991 m_match_any_keyword(MatchAnyKeyword),
+
992 m_match_all_keyword(MatchAllKeyword),
+
993 m_enable_property(EnableProperty),
+
994 m_enable_filter_desc(EnableFilterDesc)
+
995 {
+
996 m_status = EnableTraceEx(
+ + + +
1000 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
+
1001 m_level,
+ + + + +
1006 }
+
1007
+
1013 ULONG status() const
+
1014 {
+
1015 return m_status;
+
1016 }
+
1017
+ +
1024 {
+
1025 if (m_status == ERROR_SUCCESS)
+
1026 EnableTraceEx(
+ + + +
1030 EVENT_CONTROL_CODE_DISABLE_PROVIDER,
+
1031 m_level,
+ + + + +
1036 }
+
1037
+
1038 protected:
+
1039 ULONG m_status;
+ +
1041 LPCGUID m_source_id;
+
1042 TRACEHANDLE m_trace_handle;
+
1043 UCHAR m_level;
+ + + +
1047 PEVENT_FILTER_DESCRIPTOR m_enable_filter_desc;
+
1048 };
+
1049
+ +
1056 {
+
1057 public:
+
1061 event_fn_auto(_In_ event_provider &ep, _In_ const EVENT_DESCRIPTOR *event_cons, _In_ const EVENT_DESCRIPTOR *event_dest, _In_z_ LPCSTR pszFnName) :
+
1062 m_ep(ep),
+
1063 m_event_dest(event_dest)
+
1064 {
+
1065 EventDataDescCreate(&m_fn_name, pszFnName, (ULONG)(strlen(pszFnName) + 1)*sizeof(*pszFnName));
+
1066 m_ep.write(event_cons, 1, &m_fn_name);
+
1067 }
+
1068
+
1072 event_fn_auto(_In_ const event_fn_auto &other) :
+
1073 m_ep(other.m_ep),
+ +
1075 m_fn_name(other.m_fn_name)
+
1076 {
+
1077 }
+
1078
+
1082 event_fn_auto(_Inout_ event_fn_auto &&other) noexcept :
+
1083 m_ep(other.m_ep),
+
1084 m_event_dest(other.m_event_dest),
+
1085 m_fn_name(std::move(other.m_fn_name))
+
1086 {
+
1087 other.m_event_dest = NULL;
+
1088 }
+
1089
+ +
1094 {
+
1095 if (m_event_dest)
+ +
1097 }
+
1098
+ +
1103 {
+
1104 if (this != &other) {
+
1105 assert(&m_ep == &other.m_ep);
+
1106 m_event_dest = other.m_event_dest;
+
1107 m_fn_name = other.m_fn_name;
+
1108 }
+
1109
+
1110 return *this;
+
1111 }
+
1112
+
1116 event_fn_auto& operator=(_Inout_ event_fn_auto &&other) noexcept
+
1117 {
+
1118 if (this != &other) {
+
1119 assert(&m_ep == &other.m_ep);
+
1120 m_event_dest = other.m_event_dest;
+
1121 m_fn_name = std::move(other.m_fn_name);
+
1122 other.m_event_dest = NULL;
+
1123 }
+
1124
+
1125 return *this;
+
1126 }
+
1127
+
1128 protected:
+ +
1130 const EVENT_DESCRIPTOR *m_event_dest;
+
1131 EVENT_DATA_DESCRIPTOR m_fn_name;
+
1132 };
+
1133
+
1139 template<class T>
+ +
1141 {
+
1142 public:
+
1146 event_fn_auto_ret(_In_ event_provider &ep, _In_ const EVENT_DESCRIPTOR *event_cons, _In_ const EVENT_DESCRIPTOR *event_dest, _In_z_ LPCSTR pszFnName, T &result) :
+
1147 m_ep(ep),
+
1148 m_event_dest(event_dest),
+
1149 m_result(result)
+
1150 {
+
1151 EventDataDescCreate(m_desc + 0, pszFnName, (ULONG)(strlen(pszFnName) + 1)*sizeof(*pszFnName));
+
1152 m_ep.write(event_cons, 1, m_desc);
+
1153 }
+
1154
+ +
1159 m_ep(other.m_ep),
+ +
1161 m_result(other.m_result)
+
1162 {
+
1163 m_desc[0] = other.m_desc[0];
+
1164 }
+
1165
+ +
1170 m_ep(other.m_ep),
+ +
1172 m_result(other.m_result)
+
1173 {
+
1174 m_desc[0] = std::move(other.m_desc[0]);
+
1175 other.m_event_dest = NULL;
+
1176 }
+
1177
+ +
1182 {
+
1183 if (m_event_dest) {
+
1184 EventDataDescCreate(m_desc + 1, &m_result, sizeof(T));
+ +
1186 }
+
1187 }
+
1188
+ +
1193 {
+
1194 if (this != &other) {
+
1195 assert(&m_ep == &other.m_ep);
+
1196 m_event_dest = other.m_event_dest;
+
1197 m_desc[0] = other.m_desc[0];
+
1198 assert(&m_result == &other.m_result);
+
1199 }
+
1200
+
1201 return *this;
+
1202 }
+
1203
+ +
1208 {
+
1209 if (this != &other) {
+
1210 assert(&m_ep == &other.m_ep);
+
1211 m_event_dest = other.m_event_dest;
+
1212 m_desc[0] = std::move(other.m_desc[0]);
+
1213 assert(&m_result == &other.m_result);
+
1214 other.m_event_dest = NULL;
+
1215 }
+
1216
+
1217 return *this;
+
1218 }
+
1219
+
1220 protected:
+ +
1222 const EVENT_DESCRIPTOR *m_event_dest;
+
1223 EVENT_DATA_DESCRIPTOR m_desc[2];
+ +
1225 };
+
1226
+
1228}
+
EVENT_DATA_DESCRIPTOR wrapper.
Definition: ETW.h:118
+
event_data(const char &data)
Construct class pointing to an char.
Definition: ETW.h:138
+
event_data(const wchar_t *data)
Construct class pointing to a wide string.
Definition: ETW.h:248
+
event_data(const int &data)
Construct class pointing to an int.
Definition: ETW.h:164
+
event_data(const void *data, ULONG size)
Construct class pointing to binary data.
Definition: ETW.h:282
+
event_data(const GUID &data)
Construct class pointing to a GUID.
Definition: ETW.h:216
+
event_data(const unsigned int &data)
Construct class pointing to an unsigned int.
Definition: ETW.h:177
+
event_data(const char *data)
Construct class pointing to a string.
Definition: ETW.h:229
+
event_data(const unsigned char &data)
Construct class pointing to an unsigned char.
Definition: ETW.h:151
+
event_data(const std::basic_string< _Elem, _Traits, _Ax > &data)
Template to construct pointing to a std::basic_string<>.
Definition: ETW.h:268
+
event_data(const unsigned long &data)
Construct class pointing to an unsigned long.
Definition: ETW.h:203
+
event_data()
Construct empty class.
Definition: ETW.h:123
+
event_data(const long &data)
Construct class pointing to a long.
Definition: ETW.h:190
+
Helper template to write an event on entry/exit of scope with one parameter (typically result).
Definition: ETW.h:1141
+
event_fn_auto_ret(const event_fn_auto_ret< T > &other)
Copies the object.
Definition: ETW.h:1158
+
~event_fn_auto_ret()
Writes the event_dest event.
Definition: ETW.h:1181
+
EVENT_DATA_DESCRIPTOR m_desc[2]
Function name and return value.
Definition: ETW.h:1223
+
event_provider & m_ep
Reference to event provider in use.
Definition: ETW.h:1221
+
event_fn_auto_ret(event_provider &ep, const EVENT_DESCRIPTOR *event_cons, const EVENT_DESCRIPTOR *event_dest, LPCSTR pszFnName, T &result)
Writes the event_cons event.
Definition: ETW.h:1146
+
T & m_result
Function result.
Definition: ETW.h:1224
+
event_fn_auto_ret & operator=(const event_fn_auto_ret< T > &other)
Copies the object.
Definition: ETW.h:1192
+
const EVENT_DESCRIPTOR * m_event_dest
Event descriptor at destruction.
Definition: ETW.h:1222
+
event_fn_auto_ret(event_fn_auto_ret< T > &&other)
Moves the object.
Definition: ETW.h:1169
+
event_fn_auto_ret & operator=(event_fn_auto_ret< T > &&other)
Moves the object.
Definition: ETW.h:1207
+
Helper class to write an event on entry/exit of scope.
Definition: ETW.h:1056
+
const EVENT_DESCRIPTOR * m_event_dest
Event descriptor at destruction.
Definition: ETW.h:1130
+
event_fn_auto(event_fn_auto &&other) noexcept
Moves the object.
Definition: ETW.h:1082
+
event_fn_auto(event_provider &ep, const EVENT_DESCRIPTOR *event_cons, const EVENT_DESCRIPTOR *event_dest, LPCSTR pszFnName)
Writes the event_cons event.
Definition: ETW.h:1061
+
~event_fn_auto()
Writes the event_dest event.
Definition: ETW.h:1093
+
event_fn_auto & operator=(event_fn_auto &&other) noexcept
Moves the object.
Definition: ETW.h:1116
+
event_fn_auto & operator=(const event_fn_auto &other)
Copies the object.
Definition: ETW.h:1102
+
event_provider & m_ep
Reference to event provider in use.
Definition: ETW.h:1129
+
EVENT_DATA_DESCRIPTOR m_fn_name
Function name.
Definition: ETW.h:1131
+
event_fn_auto(const event_fn_auto &other)
Copies the object.
Definition: ETW.h:1072
+
ETW event provider.
Definition: ETW.h:492
+
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor)
Writes an event with no parameters.
Definition: ETW.h:534
+
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, ULONG UserDataCount=0, PEVENT_DATA_DESCRIPTOR UserData=NULL)
Writes an event with parameters stored in array.
Definition: ETW.h:549
+
ULONG write(UCHAR Level, ULONGLONG Keyword, PCWSTR String,...)
Writes a string event.
Definition: ETW.h:662
+
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, va_list arg)
Writes an event with variable number of parameters.
Definition: ETW.h:620
+
virtual ~event_provider()
Closes the event provider.
Definition: ETW.h:501
+
virtual void enable_callback(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData)
Receive enable or disable notification requests.
Definition: ETW.h:694
+
void free_internal() noexcept override
Releases the event provider.
Definition: ETW.h:684
+
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, const EVENT_DATA_DESCRIPTOR param1,...)
Writes an event with one or more parameter.
Definition: ETW.h:566
+
static VOID NTAPI enable_callback(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext)
Receive enable or disable notification requests.
Definition: ETW.h:709
+
ULONG create(LPCGUID ProviderId)
Registers the event provider.
Definition: ETW.h:516
+
EVENT_RECORD wrapper.
Definition: ETW.h:297
+
void set_extended_data_internal(USHORT count, const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
Sets event record extended data.
Definition: ETW.h:433
+
void set_user_data(USHORT size, LPCVOID data)
Sets event record user data.
Definition: ETW.h:418
+
event_rec & operator=(event_rec &&other) noexcept
Moves the event record.
Definition: ETW.h:388
+
~event_rec()
Destroys event record data and frees the allocated memory.
Definition: ETW.h:342
+
event_rec & operator=(const EVENT_RECORD &other)
Copies an existing event record.
Definition: ETW.h:372
+
event_rec(const EVENT_RECORD &other)
Copies an existing event record.
Definition: ETW.h:323
+
event_rec & operator=(const event_rec &other)
Copies an existing event record.
Definition: ETW.h:356
+
void set_extended_data(USHORT count, const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
Sets event record extended data.
Definition: ETW.h:404
+
event_rec(event_rec &&other) noexcept
Moves the event record.
Definition: ETW.h:334
+
event_rec()
Constructs a blank event record.
Definition: ETW.h:302
+
void set_user_data_internal(USHORT size, LPCVOID data)
Sets event record user data.
Definition: ETW.h:471
+
event_rec(const event_rec &other)
Copies an existing event record.
Definition: ETW.h:312
+
ETW session.
Definition: ETW.h:722
+
LPCTSTR name() const
Auto-typecasting operator.
Definition: ETW.h:797
+
event_session(event_session &&other) noexcept
Move constructor.
Definition: ETW.h:751
+
event_session(handle_type h, const EVENT_TRACE_PROPERTIES *prop)
Initializes a new session with an already available object handle.
Definition: ETW.h:739
+
event_session()
Initializes a new empty session.
Definition: ETW.h:729
+
virtual ~event_session()
Closes the session.
Definition: ETW.h:762
+
void free_internal() noexcept override
Releases the session.
Definition: ETW.h:891
+
event_session & operator=(event_session &&other) noexcept
Move assignment.
Definition: ETW.h:773
+
ULONG disable_trace(LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Disables the specified event trace provider.
Definition: ETW.h:870
+
ULONG enable_trace(LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Enables the specified event trace provider.
Definition: ETW.h:846
+
std::unique_ptr< EVENT_TRACE_PROPERTIES > m_prop
Session properties.
Definition: ETW.h:897
+
ULONG create(LPCTSTR SessionName, const EVENT_TRACE_PROPERTIES *Properties)
Registers and starts an event tracing session.
Definition: ETW.h:826
+
void attach(handle_type h, EVENT_TRACE_PROPERTIES *prop)
Sets a new session handle for the class.
Definition: ETW.h:811
+
Helper class to enable event provider in constructor and disables it in destructor.
Definition: ETW.h:937
+
UCHAR m_level
Logging level.
Definition: ETW.h:1043
+
PEVENT_FILTER_DESCRIPTOR m_enable_filter_desc
Event filter descriptor.
Definition: ETW.h:1047
+
ULONGLONG m_match_any_keyword
Keyword match mask (any)
Definition: ETW.h:1044
+
event_trace_enabler(LPCGUID SourceId, TRACEHANDLE TraceHandle, LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Enables event trace.
Definition: ETW.h:944
+
ULONG m_status
Result of EnableTraceEx call.
Definition: ETW.h:1039
+
TRACEHANDLE m_trace_handle
Trace handle.
Definition: ETW.h:1042
+
virtual ~event_trace_enabler()
Disables event trace.
Definition: ETW.h:1023
+
ULONG status() const
Return result of EnableTraceEx() call.
Definition: ETW.h:1013
+
event_trace_enabler(const event_session &session, LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Enables event trace.
Definition: ETW.h:979
+
ULONGLONG m_match_all_keyword
Keyword match mask (all)
Definition: ETW.h:1045
+
LPCGUID m_provider_id
Provider ID.
Definition: ETW.h:1040
+
LPCGUID m_source_id
Session ID.
Definition: ETW.h:1041
+
ULONG m_enable_property
Enable property.
Definition: ETW.h:1046
+
ETW trace.
Definition: ETW.h:906
+
virtual ~event_trace()
Closes the trace.
Definition: ETW.h:915
+
void free_internal() noexcept override
Closes the trace.
Definition: ETW.h:927
+
Base abstract template class to support generic object handle keeping.
Definition: Common.h:607
+
handle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition: Common.h:622
+
REGHANDLE handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:612
+
handle_type m_h
Object handle.
Definition: Common.h:858
+
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:821
+
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:66
+
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:93
+
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition: Common.h:251
+
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:163
+
static const REGHANDLE invalid
Invalid handle value.
Definition: Common.h:617
diff --git a/_g_d_i_8h.html b/_g_d_i_8h.html deleted file mode 100644 index 93538d05..00000000 --- a/_g_d_i_8h.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - -WinStd: include/WinStd/GDI.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
GDI.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft Windows GDI. -More...

-
#include "Common.h"
-
-

Go to the source code of this file.

- - - - - - - - - - - - - - -

-Classes

class  winstd::gdi_handle< T >
 Windows HGDIOBJ wrapper class. More...
 
class  winstd::dc
 Device context wrapper class. More...
 
class  winstd::window_dc
 Device context wrapper class. More...
 
class  winstd::dc_selector
 Context scope DC object restorer. More...
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft Windows GDI.

-
- - - - diff --git a/_g_d_i_8h_source.html b/_g_d_i_8h_source.html index 671b2c53..feddbbc2 100644 --- a/_g_d_i_8h_source.html +++ b/_g_d_i_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,160 +70,159 @@ $(function() {
GDI.h
-Go to the documentation of this file.
1/*
+
1/*
2 ​SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4*/
5
+
7
+
8#pragma once
+
9
+
10#include "Common.h"
11
-
12#pragma once
-
13
-
14#include "Common.h"
-
15
-
16namespace winstd
-
17{
-
20
-
24 template<class T>
-
25 class gdi_handle : public handle<T, NULL>
-
26 {
- -
28
-
29 public:
-
35 virtual ~gdi_handle()
-
36 {
-
37 if (m_h != invalid)
- -
39 }
-
40
-
41 protected:
-
47 void free_internal() noexcept override
-
48 {
-
49 DeleteObject(m_h);
-
50 }
-
51 };
-
52
-
56 class dc : public handle<HDC, NULL>
-
57 {
- -
59
-
60 public:
-
66 virtual ~dc()
-
67 {
-
68 if (m_h != invalid)
- -
70 }
-
71
-
72 protected:
-
78 void free_internal() noexcept override
-
79 {
-
80 DeleteDC(m_h);
-
81 }
-
82 };
-
83
-
87 class window_dc : public handle<HDC, NULL>
-
88 {
-
89 public:
-
93 window_dc() noexcept :
-
94 m_hwnd(NULL)
-
95 {}
-
96
-
100 window_dc(_In_opt_ handle_type h, _In_opt_ HWND hwnd) noexcept :
- -
102 m_hwnd(hwnd)
-
103 {}
-
104
-
108 window_dc(_Inout_ window_dc &&h) noexcept :
-
109 handle<handle_type, NULL>(std::move(h)),
-
110 m_hwnd(h.m_hwnd)
-
111 {}
-
112
-
116 window_dc& operator=(_Inout_ window_dc &&h) noexcept
-
117 {
- -
119 m_hwnd = h.m_hwnd;
-
120 return *this;
-
121 }
-
122
- -
124
-
125 public:
-
131 virtual ~window_dc()
-
132 {
-
133 if (m_h != invalid)
- -
135 }
-
136
-
137 protected:
-
143 void free_internal() noexcept override
-
144 {
-
145 ReleaseDC(m_hwnd, m_h);
-
146 }
+
12namespace winstd
+
13{
+
16
+
20 template<class T>
+
21 class gdi_handle : public handle<T, NULL>
+
22 {
+ +
24
+
25 public:
+
31 virtual ~gdi_handle()
+
32 {
+
33 if (m_h != invalid)
+ +
35 }
+
36
+
37 protected:
+
43 void free_internal() noexcept override
+
44 {
+
45 DeleteObject(m_h);
+
46 }
+
47 };
+
48
+
52 class dc : public handle<HDC, NULL>
+
53 {
+ +
55
+
56 public:
+
62 virtual ~dc()
+
63 {
+
64 if (m_h != invalid)
+ +
66 }
+
67
+
68 protected:
+
74 void free_internal() noexcept override
+
75 {
+
76 DeleteDC(m_h);
+
77 }
+
78 };
+
79
+
83 class window_dc : public handle<HDC, NULL>
+
84 {
+
85 public:
+
89 window_dc() noexcept :
+
90 m_hwnd(NULL)
+
91 {}
+
92
+
96 window_dc(_In_opt_ handle_type h, _In_opt_ HWND hwnd) noexcept :
+ +
98 m_hwnd(hwnd)
+
99 {}
+
100
+
104 window_dc(_Inout_ window_dc &&h) noexcept :
+
105 handle<handle_type, NULL>(std::move(h)),
+
106 m_hwnd(h.m_hwnd)
+
107 {}
+
108
+
112 window_dc& operator=(_Inout_ window_dc &&h) noexcept
+
113 {
+ +
115 m_hwnd = h.m_hwnd;
+
116 return *this;
+
117 }
+
118
+ +
120
+
121 public:
+
127 virtual ~window_dc()
+
128 {
+
129 if (m_h != invalid)
+ +
131 }
+
132
+
133 protected:
+
139 void free_internal() noexcept override
+
140 {
+
141 ReleaseDC(m_hwnd, m_h);
+
142 }
+
143
+
144 protected:
+
145 HWND m_hwnd;
+
146 };
147
-
148 protected:
-
149 HWND m_hwnd;
-
150 };
-
151
- -
156 {
- - -
159
-
160 public:
-
166 dc_selector(_In_ HDC hdc, _In_ HGDIOBJ h) noexcept :
-
167 m_hdc(hdc),
-
168 m_orig(SelectObject(hdc, h))
-
169 {
-
170 }
-
171
-
177 virtual ~dc_selector()
-
178 {
-
179 if (m_orig)
-
180 SelectObject(m_hdc, m_orig);
-
181 }
-
182
-
188 HGDIOBJ status() const noexcept
-
189 {
-
190 return m_orig;
-
191 }
-
192
-
193 protected:
-
194 HDC m_hdc;
-
195 HGDIOBJ m_orig;
-
196 };
-
197
-
199}
-
General API.
-
Context scope DC object restorer.
Definition: GDI.h:156
-
dc_selector(HDC hdc, HGDIOBJ h) noexcept
Selects an object into the specified device context (DC). The new object replaces the previous object...
Definition: GDI.h:166
-
virtual ~dc_selector()
Restores original object.
Definition: GDI.h:177
-
HGDIOBJ m_orig
Original object handle.
Definition: GDI.h:195
-
HGDIOBJ status() const noexcept
Return result of SelectObject() call.
Definition: GDI.h:188
-
HDC m_hdc
A handle to the device context.
Definition: GDI.h:194
-
Device context wrapper class.
Definition: GDI.h:57
-
void free_internal() noexcept override
Deletes the specified device context (DC).
Definition: GDI.h:78
-
virtual ~dc()
Deletes the specified device context (DC).
Definition: GDI.h:66
-
Windows HGDIOBJ wrapper class.
Definition: GDI.h:26
-
void free_internal() noexcept override
Closes an open object handle.
Definition: GDI.h:47
-
virtual ~gdi_handle()
Closes an open object handle.
Definition: GDI.h:35
-
Base abstract template class to support generic object handle keeping.
Definition: Common.h:615
-
HDC handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:620
-
handle_type m_h
Object handle.
Definition: Common.h:866
-
Device context wrapper class.
Definition: GDI.h:88
-
HWND m_hwnd
Window handle.
Definition: GDI.h:149
-
window_dc(handle_type h, HWND hwnd) noexcept
Initializes a device context from existing data.
Definition: GDI.h:100
-
void free_internal() noexcept override
Releases a device context (DC), freeing it for use by other applications.
Definition: GDI.h:143
-
virtual ~window_dc()
Releases a device context (DC), freeing it for use by other applications.
Definition: GDI.h:131
-
window_dc() noexcept
Initializes an empty device context.
Definition: GDI.h:93
-
window_dc & operator=(window_dc &&h) noexcept
Copy an existing device context.
Definition: GDI.h:116
-
window_dc(window_dc &&h) noexcept
Move an existing device context.
Definition: GDI.h:108
-
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:74
-
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition: Common.h:82
-
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:171
-
static const T invalid
Invalid handle value.
Definition: Common.h:625
+ +
152 {
+ + +
155
+
156 public:
+
162 dc_selector(_In_ HDC hdc, _In_ HGDIOBJ h) noexcept :
+
163 m_hdc(hdc),
+
164 m_orig(SelectObject(hdc, h))
+
165 {
+
166 }
+
167
+
173 virtual ~dc_selector()
+
174 {
+
175 if (m_orig)
+
176 SelectObject(m_hdc, m_orig);
+
177 }
+
178
+
184 HGDIOBJ status() const noexcept
+
185 {
+
186 return m_orig;
+
187 }
+
188
+
189 protected:
+
190 HDC m_hdc;
+
191 HGDIOBJ m_orig;
+
192 };
+
193
+
195}
+
Context scope DC object restorer.
Definition: GDI.h:152
+
dc_selector(HDC hdc, HGDIOBJ h) noexcept
Selects an object into the specified device context (DC). The new object replaces the previous object...
Definition: GDI.h:162
+
virtual ~dc_selector()
Restores original object.
Definition: GDI.h:173
+
HGDIOBJ m_orig
Original object handle.
Definition: GDI.h:191
+
HGDIOBJ status() const noexcept
Return result of SelectObject() call.
Definition: GDI.h:184
+
HDC m_hdc
A handle to the device context.
Definition: GDI.h:190
+
Device context wrapper class.
Definition: GDI.h:53
+
void free_internal() noexcept override
Deletes the specified device context (DC).
Definition: GDI.h:74
+
virtual ~dc()
Deletes the specified device context (DC).
Definition: GDI.h:62
+
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:607
+
HDC handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:612
+
handle_type m_h
Object handle.
Definition: Common.h:858
+
Device context wrapper class.
Definition: GDI.h:84
+
HWND m_hwnd
Window handle.
Definition: GDI.h:145
+
window_dc(handle_type h, HWND hwnd) noexcept
Initializes a device context from existing data.
Definition: GDI.h:96
+
void free_internal() noexcept override
Releases a device context (DC), freeing it for use by other applications.
Definition: GDI.h:139
+
virtual ~window_dc()
Releases a device context (DC), freeing it for use by other applications.
Definition: GDI.h:127
+
window_dc() noexcept
Initializes an empty device context.
Definition: GDI.h:89
+
window_dc & operator=(window_dc &&h) noexcept
Copy an existing device context.
Definition: GDI.h:112
+
window_dc(window_dc &&h) noexcept
Move an existing device context.
Definition: GDI.h:104
+
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:66
+
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition: Common.h:74
+
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:163
+
static const T invalid
Invalid handle value.
Definition: Common.h:617
diff --git a/_m_s_i_8h.html b/_m_s_i_8h.html deleted file mode 100644 index 5468268c..00000000 --- a/_m_s_i_8h.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - -WinStd: include/WinStd/MSI.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
MSI.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft Installer API. -More...

-
#include "Common.h"
-#include <MsiQuery.h>
-#include <string>
-#include <vector>
-
-

Go to the source code of this file.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Functions

template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Ty , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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 string. More...
 
template<class _Traits , class _Ax >
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 string. More...
 
template<class _Traits , class _Ax >
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 then the registry key is returned. More...
 
template<class _Traits , class _Ax >
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 then the registry key is returned. More...
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft Installer API.

-
- - - - diff --git a/_m_s_i_8h_source.html b/_m_s_i_8h_source.html index 0d8ac71a..28fd404b 100644 --- a/_m_s_i_8h_source.html +++ b/_m_s_i_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,315 +70,314 @@ $(function() {
MSI.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
-
14
-
15#include "Common.h"
-
16#include <MsiQuery.h>
-
17#include <string>
-
18#include <vector>
-
19
-
22
-
24template<class _Traits, class _Ax>
-
25static UINT MsiGetPropertyA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szName, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
-
26{
-
27 assert(0); // TODO: Test this code.
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <MsiQuery.h>
+
13#include <string>
+
14#include <vector>
+
15
+
18
+
20template<class _Traits, class _Ax>
+
21static UINT MsiGetPropertyA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szName, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
+
22{
+
23 assert(0); // TODO: Test this code.
+
24
+
25 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
26 DWORD dwSize = _countof(szStackBuffer);
+
27 UINT uiResult;
28
-
29 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
30 DWORD dwSize = _countof(szStackBuffer);
-
31 UINT uiResult;
-
32
-
33 // Try with stack buffer first.
-
34 uiResult = ::MsiGetPropertyA(hInstall, szName, szStackBuffer, &dwSize);
-
35 if (uiResult == ERROR_SUCCESS) {
-
36 // Copy from stack.
-
37 sValue.assign(szStackBuffer, dwSize);
-
38 return ERROR_SUCCESS;
-
39 } else if (uiResult == ERROR_MORE_DATA) {
-
40 // Allocate buffer on heap to read the string data into and read it.
-
41 std::unique_ptr<char[]> szBuffer(new char[++dwSize]);
-
42 uiResult = ::MsiGetPropertyA(hInstall, szName, szBuffer.get(), &dwSize);
-
43 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
44 return uiResult;
-
45 } else {
-
46 // Return error code.
-
47 return uiResult;
-
48 }
-
49}
-
50
-
56template<class _Traits, class _Ax>
-
57static UINT MsiGetPropertyW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szName, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
58{
-
59 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
60 DWORD dwSize = _countof(szStackBuffer);
-
61 UINT uiResult;
-
62
-
63 // Try with stack buffer first.
-
64 uiResult = ::MsiGetPropertyW(hInstall, szName, szStackBuffer, &dwSize);
-
65 if (uiResult == ERROR_SUCCESS) {
-
66 // Copy from stack.
-
67 sValue.assign(szStackBuffer, dwSize);
-
68 return ERROR_SUCCESS;
-
69 } else if (uiResult == ERROR_MORE_DATA) {
-
70 // Allocate buffer on heap to read the string data into and read it.
-
71 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++dwSize]);
-
72 uiResult = ::MsiGetPropertyW(hInstall, szName, szBuffer.get(), &dwSize);
-
73 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
74 return uiResult;
-
75 } else {
-
76 // Return error code.
-
77 return uiResult;
-
78 }
-
79}
-
80
-
82template<class _Traits, class _Ax>
-
83static UINT MsiRecordGetStringA(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
-
84{
-
85 assert(0); // TODO: Test this code.
+
29 // Try with stack buffer first.
+
30 uiResult = ::MsiGetPropertyA(hInstall, szName, szStackBuffer, &dwSize);
+
31 if (uiResult == ERROR_SUCCESS) {
+
32 // Copy from stack.
+
33 sValue.assign(szStackBuffer, dwSize);
+
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}
+
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}
+
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.
+
82
+
83 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
84 DWORD dwSize = _countof(szStackBuffer);
+
85 UINT uiResult;
86
-
87 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
88 DWORD dwSize = _countof(szStackBuffer);
-
89 UINT uiResult;
-
90
-
91 // Try with stack buffer first.
-
92 uiResult = ::MsiRecordGetStringA(hRecord, iField, szStackBuffer, &dwSize);
-
93 if (uiResult == ERROR_SUCCESS) {
-
94 // Copy from stack.
-
95 sValue.assign(szStackBuffer, dwSize);
-
96 return ERROR_SUCCESS;
-
97 } else if (uiResult == ERROR_MORE_DATA) {
-
98 // Allocate buffer on heap to read the string data into and read it.
-
99 std::unique_ptr<char[]> szBuffer(new char[++dwSize]);
-
100 uiResult = ::MsiRecordGetStringA(hRecord, iField, szBuffer.get(), &dwSize);
-
101 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
102 return uiResult;
-
103 } else {
-
104 // Return error code.
-
105 return uiResult;
-
106 }
-
107}
-
108
-
114template<class _Traits, class _Ax>
-
115static UINT MsiRecordGetStringW(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
116{
-
117 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
118 DWORD dwSize = _countof(szStackBuffer);
-
119 UINT uiResult;
-
120
-
121 // Try with stack buffer first.
-
122 uiResult = ::MsiRecordGetStringW(hRecord, iField, szStackBuffer, &dwSize);
-
123 if (uiResult == ERROR_SUCCESS) {
-
124 // Copy from stack.
-
125 sValue.assign(szStackBuffer, dwSize);
-
126 return ERROR_SUCCESS;
-
127 } else if (uiResult == ERROR_MORE_DATA) {
-
128 // Allocate buffer on heap to read the string data into and read it.
-
129 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++dwSize]);
-
130 uiResult = ::MsiRecordGetStringW(hRecord, iField, szBuffer.get(), &dwSize);
-
131 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
132 return uiResult;
-
133 } else {
-
134 // Return error code.
-
135 return uiResult;
-
136 }
-
137}
-
138
-
140template<class _Traits, class _Ax>
-
141static UINT MsiFormatRecordA(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
-
142{
-
143 assert(0); // TODO: Test this code.
+
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}
+
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}
+
134
+
136template<class _Traits, class _Ax>
+
137static UINT MsiFormatRecordA(_In_ 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 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
146 DWORD dwSize = _countof(szStackBuffer);
-
147 UINT uiResult;
-
148
-
149 // Try with stack buffer first.
-
150 uiResult = ::MsiFormatRecordA(hInstall, hRecord, szStackBuffer, &dwSize);
-
151 if (uiResult == ERROR_SUCCESS) {
-
152 // Copy from stack.
-
153 sValue.assign(szStackBuffer, dwSize);
-
154 return ERROR_SUCCESS;
-
155 } else if (uiResult == ERROR_MORE_DATA) {
-
156 // Allocate buffer on heap to format the string data into and read it.
-
157 std::unique_ptr<char[]> szBuffer(new char[++dwSize]);
-
158 uiResult = ::MsiFormatRecordA(hInstall, hRecord, szBuffer.get(), &dwSize);
-
159 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
160 return uiResult;
-
161 } else {
-
162 // Return error code.
-
163 return uiResult;
-
164 }
-
165}
-
166
-
172template<class _Traits, class _Ax>
-
173static UINT MsiFormatRecordW(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
174{
-
175 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
176 DWORD dwSize = _countof(szStackBuffer);
-
177 UINT uiResult;
-
178
-
179 // Try with stack buffer first.
-
180 uiResult = ::MsiFormatRecordW(hInstall, hRecord, szStackBuffer, &dwSize);
-
181 if (uiResult == ERROR_SUCCESS) {
-
182 // Copy from stack.
-
183 sValue.assign(szStackBuffer, dwSize);
-
184 return ERROR_SUCCESS;
-
185 } else if (uiResult == ERROR_MORE_DATA) {
-
186 // Allocate buffer on heap to format the string data into and read it.
-
187 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++dwSize]);
-
188 uiResult = ::MsiFormatRecordW(hInstall, hRecord, szBuffer.get(), &dwSize);
-
189 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
190 return uiResult;
-
191 } else {
-
192 // Return error code.
-
193 return uiResult;
-
194 }
-
195}
-
196
-
202template<class _Ty, class _Ax>
-
203static UINT MsiRecordReadStream(_In_ MSIHANDLE hRecord, _In_ unsigned int iField, _Inout_ std::vector<_Ty, _Ax> &binData)
-
204{
-
205 assert(0); // TODO: Test this code.
-
206
-
207 DWORD dwSize = 0;
-
208 UINT uiResult;
-
209
-
210 // Query the actual data length first.
-
211 uiResult = ::MsiRecordReadStream(hRecord, iField, NULL, &dwSize);
-
212 if (uiResult == ERROR_SUCCESS) {
-
213 binData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
214 return ::MsiRecordReadStream(hRecord, iField, reinterpret_cast<char*>(binData.data()), &dwSize);
-
215 } else {
-
216 // Return error code.
-
217 return uiResult;
-
218 }
-
219}
-
220
-
222template<class _Traits, class _Ax>
-
223static UINT MsiGetTargetPathA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szFolder, _Out_ std::basic_string<char, _Traits, _Ax> &sValue)
-
224{
-
225 assert(0); // TODO: Test this code.
+
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}
+
162
+
168template<class _Traits, class _Ax>
+
169static UINT MsiFormatRecordW(_In_ 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}
+
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}
+
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 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
228 DWORD dwSize = _countof(szStackBuffer);
-
229 UINT uiResult;
-
230
-
231 // Try with stack buffer first.
-
232 uiResult = ::MsiGetTargetPathA(hInstall, szFolder, szStackBuffer, &dwSize);
-
233 if (uiResult == ERROR_SUCCESS) {
-
234 // Copy from stack.
-
235 sValue.assign(szStackBuffer, dwSize);
-
236 return ERROR_SUCCESS;
-
237 } else if (uiResult == ERROR_MORE_DATA) {
-
238 // Allocate buffer on heap to format the string data into and read it.
-
239 std::unique_ptr<char[]> szBuffer(new char[++dwSize]);
-
240 uiResult = ::MsiGetTargetPathA(hInstall, szFolder, szBuffer.get(), &dwSize);
-
241 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
242 return uiResult;
-
243 } else {
-
244 // Return error code.
-
245 return uiResult;
-
246 }
-
247}
-
248
-
254template<class _Traits, class _Ax>
-
255static UINT MsiGetTargetPathW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szFolder, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
256{
-
257 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
258 DWORD dwSize = _countof(szStackBuffer);
-
259 UINT uiResult;
-
260
-
261 // Try with stack buffer first.
-
262 uiResult = ::MsiGetTargetPathW(hInstall, szFolder, szStackBuffer, &dwSize);
-
263 if (uiResult == ERROR_SUCCESS) {
-
264 // Copy from stack.
-
265 sValue.assign(szStackBuffer, dwSize);
-
266 return ERROR_SUCCESS;
-
267 } else if (uiResult == ERROR_MORE_DATA) {
-
268 // Allocate buffer on heap to format the string data into and read it.
-
269 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++dwSize]);
-
270 uiResult = ::MsiGetTargetPathW(hInstall, szFolder, szBuffer.get(), &dwSize);
-
271 sValue.assign(szBuffer.get(), uiResult == ERROR_SUCCESS ? dwSize : 0);
-
272 return uiResult;
-
273 } else {
-
274 // Return error code.
-
275 return uiResult;
-
276 }
-
277}
-
278
-
280template<class _Traits, class _Ax>
-
281static INSTALLSTATE MsiGetComponentPathA(_In_z_ LPCSTR szProduct, _In_z_ LPCSTR szComponent, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
-
282{
-
283 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
284 DWORD dwSize = _countof(szStackBuffer);
-
285 INSTALLSTATE state;
-
286
-
287 // Try with stack buffer first.
-
288 state = ::MsiGetComponentPathA(szProduct, szComponent, szStackBuffer, &dwSize);
-
289 if (state >= INSTALLSTATE_BROKEN) {
-
290 // Copy from stack.
-
291 sValue.assign(szStackBuffer, dwSize);
-
292 return state;
-
293 } else if (state == INSTALLSTATE_MOREDATA) {
-
294 // Allocate buffer on heap to format the string data into and read it.
-
295 std::unique_ptr<char[]> szBuffer(new char[++dwSize]);
-
296 state = ::MsiGetComponentPathA(szProduct, szComponent, szBuffer.get(), &dwSize);
-
297 sValue.assign(szBuffer.get(), state >= INSTALLSTATE_BROKEN ? dwSize : 0);
-
298 return state;
-
299 } else {
-
300 // Return error code.
-
301 return state;
-
302 }
-
303}
-
304
-
310template<class _Traits, class _Ax>
-
311static INSTALLSTATE MsiGetComponentPathW(_In_z_ LPCWSTR szProduct, _In_z_ LPCWSTR szComponent, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
-
312{
-
313 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
314 DWORD dwSize = _countof(szStackBuffer);
-
315 INSTALLSTATE state;
-
316
-
317 // Try with stack buffer first.
-
318 state = ::MsiGetComponentPathW(szProduct, szComponent, szStackBuffer, &dwSize);
-
319 if (state >= INSTALLSTATE_BROKEN) {
-
320 // Copy from stack.
-
321 sValue.assign(szStackBuffer, dwSize);
-
322 return state;
-
323 } else if (state == INSTALLSTATE_MOREDATA) {
-
324 // Allocate buffer on heap to format the string data into and read it.
-
325 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++dwSize]);
-
326 state = ::MsiGetComponentPathW(szProduct, szComponent, szBuffer.get(), &dwSize);
-
327 sValue.assign(szBuffer.get(), state >= INSTALLSTATE_BROKEN ? dwSize : 0);
-
328 return state;
-
329 } else {
-
330 // Return error code.
-
331 return state;
-
332 }
-
333}
-
334
-
General API.
-
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:101
-
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:173
-
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:57
-
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:223
-
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:281
-
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:115
-
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:255
-
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:25
-
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:141
-
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:203
-
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:311
-
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:83
+
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}
+
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}
+
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}
+
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
+
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:93
+
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 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
diff --git a/_sec_8h.html b/_sec_8h.html deleted file mode 100644 index a47826aa..00000000 --- a/_sec_8h.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - -WinStd: include/WinStd/Sec.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
Sec.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft Security API. -More...

-
#include "Common.h"
-#include <Security.h>
-#include <string>
-
-

Go to the source code of this file.

- - - - - - - - - - - - - - -

-Classes

class  winstd::sec_credentials
 PCredHandle wrapper class. More...
 
class  winstd::sec_context
 PCtxtHandle wrapper class. More...
 
class  winstd::sec_buffer_desc
 SecBufferDesc wrapper class. More...
 
class  winstd::sec_runtime_error
 Security runtime error. More...
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft Security API.

-
- - - - diff --git a/_sec_8h_source.html b/_sec_8h_source.html index f2b97b2f..e72004d7 100644 --- a/_sec_8h_source.html +++ b/_sec_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,307 +70,306 @@ $(function() {
Sec.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <Security.h>
+
13#include <string>
14
-
15#include "Common.h"
-
16#include <Security.h>
-
17#include <string>
-
18
-
21
-
22#if defined(SECURITY_WIN32) || defined(SECURITY_KERNEL)
-
23
-
25template<class _Traits, class _Ax>
-
26static BOOLEAN GetUserNameExA(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<char, _Traits, _Ax> &sName)
-
27{
-
28 assert(0); // TODO: Test this code.
-
29
-
30 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
31 ULONG ulSize = _countof(szStackBuffer);
-
32
-
33 // Try with stack buffer first.
-
34 if (::GetUserNameExA(NameFormat, szStackBuffer, &ulSize)) {
-
35 // Copy from stack.
-
36 sName.assign(szStackBuffer, ulSize);
-
37 return TRUE;
-
38 } else {
-
39 if (::GetLastError() == ERROR_MORE_DATA) {
-
40 // Allocate buffer on heap and retry.
-
41 std::unique_ptr<char[]> szBuffer(new char[ulSize]);
-
42 if (::GetUserNameExA(NameFormat, szBuffer.get(), &ulSize)) {
-
43 sName.assign(szBuffer.get(), ulSize);
-
44 return TRUE;
-
45 }
-
46 }
-
47 }
-
48
-
49 return FALSE;
-
50}
-
51
-
57template<class _Traits, class _Ax>
-
58static BOOLEAN GetUserNameExW(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sName)
-
59{
-
60 assert(0); // TODO: Test this code.
-
61
-
62 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
63 ULONG ulSize = _countof(szStackBuffer);
-
64
-
65 // Try with stack buffer first.
-
66 if (::GetUserNameExW(NameFormat, szStackBuffer, &ulSize)) {
-
67 // Copy from stack.
-
68 sName.assign(szStackBuffer, ulSize);
-
69 return TRUE;
-
70 } else {
-
71 if (::GetLastError() == ERROR_MORE_DATA) {
-
72 // Allocate buffer on heap and retry.
-
73 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[ulSize]);
-
74 if (::GetUserNameExW(NameFormat, szBuffer.get(), &ulSize)) {
-
75 sName.assign(szBuffer.get(), ulSize);
-
76 return TRUE;
-
77 }
-
78 }
-
79 }
-
80
-
81 return FALSE;
-
82}
+
17
+
18#if defined(SECURITY_WIN32) || defined(SECURITY_KERNEL)
+
19
+
21template<class _Traits, class _Ax>
+
22static BOOLEAN GetUserNameExA(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<char, _Traits, _Ax> &sName)
+
23{
+
24 assert(0); // TODO: Test this code.
+
25
+
26 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
27 ULONG ulSize = _countof(szStackBuffer);
+
28
+
29 // Try with stack buffer first.
+
30 if (::GetUserNameExA(NameFormat, szStackBuffer, &ulSize)) {
+
31 // Copy from stack.
+
32 sName.assign(szStackBuffer, ulSize);
+
33 return TRUE;
+
34 } else {
+
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 }
+
44
+
45 return FALSE;
+
46}
+
47
+
53template<class _Traits, class _Ax>
+
54static BOOLEAN GetUserNameExW(_In_ EXTENDED_NAME_FORMAT NameFormat, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sName)
+
55{
+
56 assert(0); // TODO: Test this code.
+
57
+
58 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
59 ULONG ulSize = _countof(szStackBuffer);
+
60
+
61 // Try with stack buffer first.
+
62 if (::GetUserNameExW(NameFormat, szStackBuffer, &ulSize)) {
+
63 // Copy from stack.
+
64 sName.assign(szStackBuffer, ulSize);
+
65 return TRUE;
+
66 } else {
+
67 if (::GetLastError() == ERROR_MORE_DATA) {
+
68 // Allocate buffer on heap and retry.
+
69 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[ulSize]);
+
70 if (::GetUserNameExW(NameFormat, szBuffer.get(), &ulSize)) {
+
71 sName.assign(szBuffer.get(), ulSize);
+
72 return TRUE;
+
73 }
+
74 }
+
75 }
+
76
+
77 return FALSE;
+
78}
+
79
+
80#endif
+
81
83
-
84#endif
-
85
-
87
-
88namespace winstd
-
89{
-
92
-
96 class sec_credentials : public handle<PCredHandle, NULL>
-
97 {
- -
99
-
100 public:
- -
105 {
-
106 m_expires.QuadPart = -1;
-
107 }
-
108
-
115 sec_credentials(_In_opt_ handle_type h, _In_ const TimeStamp expires) :
-
116 m_expires(expires),
-
117 handle(h)
-
118 {
-
119 }
-
120
-
126 sec_credentials(_Inout_ sec_credentials &&h) noexcept :
-
127 m_expires(std::move(h.m_expires)),
-
128 handle<PCredHandle, NULL>(std::move(h))
-
129 {
-
130 }
-
131
- -
138 {
-
139 if (m_h != invalid)
- -
141 }
-
142
- -
149 {
-
150 if (this != std::addressof(h)) {
-
151 *(handle<handle_type, NULL>*)this = std::move(h);
-
152 m_expires = std::move(h.m_expires);
-
153 }
-
154 return *this;
-
155 }
-
156
-
166 SECURITY_STATUS acquire(
-
167 _In_opt_ LPTSTR pszPrincipal,
-
168 _In_ LPTSTR pszPackage,
-
169 _In_ unsigned long fCredentialUse,
-
170 _In_opt_ void *pvLogonId,
-
171 _In_opt_ void *pAuthData,
-
172 _In_opt_ SEC_GET_KEY_FN pGetKeyFn = NULL,
-
173 _In_opt_ void *pvGetKeyArgument = NULL)
-
174 {
-
175 handle_type h = new CredHandle;
-
176 TimeStamp exp;
-
177 SECURITY_STATUS res = AcquireCredentialsHandle(pszPrincipal, pszPackage, fCredentialUse, pvLogonId, pAuthData, pGetKeyFn, pvGetKeyArgument, h, &exp);
-
178 if (SUCCEEDED(res)) {
-
179 attach(h);
-
180 m_expires = exp;
-
181 } else
-
182 delete h;
-
183 return res;
-
184 }
-
185
-
186 protected:
-
192 void free_internal() noexcept override
-
193 {
-
194 FreeCredentialsHandle(m_h);
-
195 delete m_h;
-
196 }
+
84namespace winstd
+
85{
+
88
+
92 class sec_credentials : public handle<PCredHandle, NULL>
+
93 {
+ +
95
+
96 public:
+ +
101 {
+
102 m_expires.QuadPart = -1;
+
103 }
+
104
+
111 sec_credentials(_In_opt_ handle_type h, _In_ const TimeStamp expires) :
+
112 m_expires(expires),
+
113 handle(h)
+
114 {
+
115 }
+
116
+
122 sec_credentials(_Inout_ sec_credentials &&h) noexcept :
+
123 m_expires(std::move(h.m_expires)),
+
124 handle<PCredHandle, NULL>(std::move(h))
+
125 {
+
126 }
+
127
+ +
134 {
+
135 if (m_h != invalid)
+ +
137 }
+
138
+ +
145 {
+
146 if (this != std::addressof(h)) {
+
147 *(handle<handle_type, NULL>*)this = std::move(h);
+
148 m_expires = std::move(h.m_expires);
+
149 }
+
150 return *this;
+
151 }
+
152
+
162 SECURITY_STATUS acquire(
+
163 _In_opt_ LPTSTR pszPrincipal,
+
164 _In_ LPTSTR pszPackage,
+
165 _In_ unsigned long fCredentialUse,
+
166 _In_opt_ void *pvLogonId,
+
167 _In_opt_ void *pAuthData,
+
168 _In_opt_ SEC_GET_KEY_FN pGetKeyFn = NULL,
+
169 _In_opt_ void *pvGetKeyArgument = NULL)
+
170 {
+
171 handle_type h = new CredHandle;
+
172 TimeStamp exp;
+
173 SECURITY_STATUS res = AcquireCredentialsHandle(pszPrincipal, pszPackage, fCredentialUse, pvLogonId, pAuthData, pGetKeyFn, pvGetKeyArgument, h, &exp);
+
174 if (SUCCEEDED(res)) {
+
175 attach(h);
+
176 m_expires = exp;
+
177 } else
+
178 delete h;
+
179 return res;
+
180 }
+
181
+
182 protected:
+
188 void free_internal() noexcept override
+
189 {
+
190 FreeCredentialsHandle(m_h);
+
191 delete m_h;
+
192 }
+
193
+
194 public:
+
195 TimeStamp m_expires;
+
196 };
197
-
198 public:
-
199 TimeStamp m_expires;
-
200 };
-
201
-
205 class sec_context : public handle<PCtxtHandle, NULL>
-
206 {
-
207 public:
- -
212 m_attrib(0),
-
213 handle<PCtxtHandle, NULL>()
-
214 {
-
215 m_expires.QuadPart = -1;
-
216 }
-
217
-
223 sec_context(_Inout_ sec_context &&h) noexcept :
-
224 m_attrib (std::move(h.m_attrib )),
-
225 m_expires(std::move(h.m_expires)),
-
226 handle<PCtxtHandle, NULL>(std::move(h))
-
227 {
-
228 }
-
229
-
235 virtual ~sec_context()
-
236 {
-
237 if (m_h != invalid)
- -
239 }
-
240
-
246 sec_context& operator=(_Inout_ sec_context &&h) noexcept
-
247 {
-
248 if (this != std::addressof(h)) {
-
249 *(handle<handle_type, NULL>*)this = std::move(h);
-
250 m_attrib = std::move(h.m_attrib);
-
251 m_expires = std::move(h.m_expires);
-
252 }
-
253 return *this;
-
254 }
-
255
-
265 SECURITY_STATUS initialize(
-
266 _In_opt_ PCredHandle phCredential,
-
267 _In_opt_z_ LPCTSTR pszTargetName,
-
268 _In_ ULONG fContextReq,
-
269 _In_ ULONG TargetDataRep,
-
270 _In_opt_ PSecBufferDesc pInput,
-
271 _Inout_opt_ PSecBufferDesc pOutput)
-
272 {
-
273 handle_type h = new CtxtHandle;
-
274 h->dwUpper = 0;
-
275 h->dwLower = 0;
-
276 ULONG attr;
-
277 TimeStamp exp;
-
278 SECURITY_STATUS res = InitializeSecurityContext(phCredential, NULL, const_cast<LPTSTR>(pszTargetName), fContextReq, 0, TargetDataRep, pInput, 0, h, pOutput, &attr, &exp);
-
279 if (SUCCEEDED(res)) {
-
280 attach(h);
-
281 m_attrib = attr;
-
282 m_expires = exp;
-
283 } else
-
284 delete h;
-
285 return res;
-
286 }
-
287
-
297 SECURITY_STATUS process(
-
298 _In_opt_ PCredHandle phCredential,
-
299 _In_opt_z_ LPCTSTR pszTargetName,
-
300 _In_ ULONG fContextReq,
-
301 _In_ ULONG TargetDataRep,
-
302 _In_opt_ PSecBufferDesc pInput,
-
303 _Inout_opt_ PSecBufferDesc pOutput)
-
304 {
-
305 return InitializeSecurityContext(phCredential, m_h, const_cast<LPTSTR>(pszTargetName), fContextReq, 0, TargetDataRep, pInput, 0, NULL, pOutput, &m_attrib, &m_expires);
-
306 }
-
307
-
308 protected:
-
314 void free_internal() noexcept override
-
315 {
-
316 DeleteSecurityContext(m_h);
-
317 delete m_h;
-
318 }
-
319
-
320 public:
-
321 ULONG m_attrib;
-
322 TimeStamp m_expires;
-
323 };
-
324
-
328 class sec_buffer_desc : public SecBufferDesc
-
329 {
-
330 public:
-
334 sec_buffer_desc(_Inout_count_(count) PSecBuffer buf, ULONG count, _In_ ULONG version = SECBUFFER_VERSION)
-
335 {
-
336 ulVersion = version;
-
337 cBuffers = count;
-
338 pBuffers = buf;
-
339 }
-
340
- -
347 {
-
348 for (ULONG i = 0; i < cBuffers; i++) {
-
349 if (pBuffers[i].pvBuffer)
-
350 FreeContextBuffer(pBuffers[i].pvBuffer);
-
351 }
-
352 }
-
353 };
-
354
-
356
-
359
-
365 class sec_runtime_error : public num_runtime_error<SECURITY_STATUS>
-
366 {
-
367 public:
-
374 sec_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<SECURITY_STATUS>(num, msg)
-
375 {
-
376 }
-
377
-
384 sec_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<SECURITY_STATUS>(num, msg)
-
385 {
-
386 }
-
387
-
393 sec_runtime_error(const sec_runtime_error &other) : num_runtime_error<SECURITY_STATUS>(other)
-
394 {
-
395 }
-
396 };
-
397
-
399}
-
General API.
-
Base abstract template class to support generic object handle keeping.
Definition: Common.h:615
-
PCredHandle handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:620
-
handle_type m_h
Object handle.
Definition: Common.h:866
-
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:829
-
Numerical runtime error.
Definition: Common.h:1011
-
SECURITY_STATUS error_type
Error number type.
Definition: Common.h:1013
-
SecBufferDesc wrapper class.
Definition: Sec.h:329
-
virtual ~sec_buffer_desc()
Frees the security buffer descriptor.
Definition: Sec.h:346
-
sec_buffer_desc(PSecBuffer buf, ULONG count, ULONG version=SECBUFFER_VERSION)
Initializes security buffer descriptor.
Definition: Sec.h:334
-
PCtxtHandle wrapper class.
Definition: Sec.h:206
-
sec_context(sec_context &&h) noexcept
Move constructor.
Definition: Sec.h:223
-
SECURITY_STATUS process(PCredHandle phCredential, LPCTSTR pszTargetName, ULONG fContextReq, ULONG TargetDataRep, PSecBufferDesc pInput, PSecBufferDesc pOutput)
Continue security context.
Definition: Sec.h:297
-
virtual ~sec_context()
Frees the security context.
Definition: Sec.h:235
-
sec_context()
Initializes a new class instance with the object handle set to NULL.
Definition: Sec.h:211
-
SECURITY_STATUS initialize(PCredHandle phCredential, LPCTSTR pszTargetName, ULONG fContextReq, ULONG TargetDataRep, PSecBufferDesc pInput, PSecBufferDesc pOutput)
Initializes security context.
Definition: Sec.h:265
-
ULONG m_attrib
Context attributes.
Definition: Sec.h:321
-
TimeStamp m_expires
Context expiration time.
Definition: Sec.h:322
-
sec_context & operator=(sec_context &&h) noexcept
Move assignment.
Definition: Sec.h:246
-
void free_internal() noexcept override
Frees the security context.
Definition: Sec.h:314
-
PCredHandle wrapper class.
Definition: Sec.h:97
-
sec_credentials()
Initializes a new class instance with the object handle set to NULL.
Definition: Sec.h:104
-
void free_internal() noexcept override
Frees the security credentials.
Definition: Sec.h:192
-
TimeStamp m_expires
Credentials expiration time.
Definition: Sec.h:199
-
sec_credentials(sec_credentials &&h) noexcept
Move constructor.
Definition: Sec.h:126
-
virtual ~sec_credentials()
Frees the security credentials.
Definition: Sec.h:137
-
sec_credentials(handle_type h, const TimeStamp expires)
Initializes a new class with an already available object handle.
Definition: Sec.h:115
-
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:166
-
sec_credentials & operator=(sec_credentials &&h) noexcept
Move assignment.
Definition: Sec.h:148
-
Security runtime error.
Definition: Sec.h:366
-
sec_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition: Sec.h:384
-
sec_runtime_error(const sec_runtime_error &other)
Copies an exception.
Definition: Sec.h:393
-
sec_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition: Sec.h:374
-
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:74
-
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:101
-
static const PCredHandle invalid
Invalid handle value.
Definition: Common.h:625
+
201 class sec_context : public handle<PCtxtHandle, NULL>
+
202 {
+
203 public:
+ +
208 m_attrib(0),
+
209 handle<PCtxtHandle, NULL>()
+
210 {
+
211 m_expires.QuadPart = -1;
+
212 }
+
213
+
219 sec_context(_Inout_ sec_context &&h) noexcept :
+
220 m_attrib (std::move(h.m_attrib )),
+
221 m_expires(std::move(h.m_expires)),
+
222 handle<PCtxtHandle, NULL>(std::move(h))
+
223 {
+
224 }
+
225
+
231 virtual ~sec_context()
+
232 {
+
233 if (m_h != invalid)
+ +
235 }
+
236
+
242 sec_context& operator=(_Inout_ sec_context &&h) noexcept
+
243 {
+
244 if (this != std::addressof(h)) {
+
245 *(handle<handle_type, NULL>*)this = std::move(h);
+
246 m_attrib = std::move(h.m_attrib);
+
247 m_expires = std::move(h.m_expires);
+
248 }
+
249 return *this;
+
250 }
+
251
+
261 SECURITY_STATUS initialize(
+
262 _In_opt_ PCredHandle phCredential,
+
263 _In_opt_z_ LPCTSTR pszTargetName,
+
264 _In_ ULONG fContextReq,
+
265 _In_ ULONG TargetDataRep,
+
266 _In_opt_ PSecBufferDesc pInput,
+
267 _Inout_opt_ PSecBufferDesc pOutput)
+
268 {
+
269 handle_type h = new CtxtHandle;
+
270 h->dwUpper = 0;
+
271 h->dwLower = 0;
+
272 ULONG attr;
+
273 TimeStamp exp;
+
274 SECURITY_STATUS res = InitializeSecurityContext(phCredential, NULL, const_cast<LPTSTR>(pszTargetName), fContextReq, 0, TargetDataRep, pInput, 0, h, pOutput, &attr, &exp);
+
275 if (SUCCEEDED(res)) {
+
276 attach(h);
+
277 m_attrib = attr;
+
278 m_expires = exp;
+
279 } else
+
280 delete h;
+
281 return res;
+
282 }
+
283
+
293 SECURITY_STATUS process(
+
294 _In_opt_ PCredHandle phCredential,
+
295 _In_opt_z_ LPCTSTR pszTargetName,
+
296 _In_ ULONG fContextReq,
+
297 _In_ ULONG TargetDataRep,
+
298 _In_opt_ PSecBufferDesc pInput,
+
299 _Inout_opt_ PSecBufferDesc pOutput)
+
300 {
+
301 return InitializeSecurityContext(phCredential, m_h, const_cast<LPTSTR>(pszTargetName), fContextReq, 0, TargetDataRep, pInput, 0, NULL, pOutput, &m_attrib, &m_expires);
+
302 }
+
303
+
304 protected:
+
310 void free_internal() noexcept override
+
311 {
+
312 DeleteSecurityContext(m_h);
+
313 delete m_h;
+
314 }
+
315
+
316 public:
+
317 ULONG m_attrib;
+
318 TimeStamp m_expires;
+
319 };
+
320
+
324 class sec_buffer_desc : public SecBufferDesc
+
325 {
+
326 public:
+
330 sec_buffer_desc(_Inout_count_(count) PSecBuffer buf, ULONG count, _In_ ULONG version = SECBUFFER_VERSION)
+
331 {
+
332 ulVersion = version;
+
333 cBuffers = count;
+
334 pBuffers = buf;
+
335 }
+
336
+ +
343 {
+
344 for (ULONG i = 0; i < cBuffers; i++) {
+
345 if (pBuffers[i].pvBuffer)
+
346 FreeContextBuffer(pBuffers[i].pvBuffer);
+
347 }
+
348 }
+
349 };
+
350
+
352
+
355
+
361 class sec_runtime_error : public num_runtime_error<SECURITY_STATUS>
+
362 {
+
363 public:
+
370 sec_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<SECURITY_STATUS>(num, msg)
+
371 {
+
372 }
+
373
+
380 sec_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<SECURITY_STATUS>(num, msg)
+
381 {
+
382 }
+
383
+
389 sec_runtime_error(const sec_runtime_error &other) : num_runtime_error<SECURITY_STATUS>(other)
+
390 {
+
391 }
+
392 };
+
393
+
395}
+
Base abstract template class to support generic object handle keeping.
Definition: Common.h:607
+
PCredHandle handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:612
+
handle_type m_h
Object handle.
Definition: Common.h:858
+
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:821
+
Numerical runtime error.
Definition: Common.h:1003
+
SECURITY_STATUS error_type
Error number type.
Definition: Common.h:1005
+
SecBufferDesc wrapper class.
Definition: Sec.h:325
+
virtual ~sec_buffer_desc()
Frees the security buffer descriptor.
Definition: Sec.h:342
+
sec_buffer_desc(PSecBuffer buf, ULONG count, ULONG version=SECBUFFER_VERSION)
Initializes security buffer descriptor.
Definition: Sec.h:330
+
PCtxtHandle wrapper class.
Definition: Sec.h:202
+
sec_context(sec_context &&h) noexcept
Move constructor.
Definition: Sec.h:219
+
SECURITY_STATUS process(PCredHandle phCredential, LPCTSTR pszTargetName, ULONG fContextReq, ULONG TargetDataRep, PSecBufferDesc pInput, PSecBufferDesc pOutput)
Continue security context.
Definition: Sec.h:293
+
virtual ~sec_context()
Frees the security context.
Definition: Sec.h:231
+
sec_context()
Initializes a new class instance with the object handle set to NULL.
Definition: Sec.h:207
+
SECURITY_STATUS initialize(PCredHandle phCredential, LPCTSTR pszTargetName, ULONG fContextReq, ULONG TargetDataRep, PSecBufferDesc pInput, PSecBufferDesc pOutput)
Initializes security context.
Definition: Sec.h:261
+
ULONG m_attrib
Context attributes.
Definition: Sec.h:317
+
TimeStamp m_expires
Context expiration time.
Definition: Sec.h:318
+
sec_context & operator=(sec_context &&h) noexcept
Move assignment.
Definition: Sec.h:242
+
void free_internal() noexcept override
Frees the security context.
Definition: Sec.h:310
+
PCredHandle wrapper class.
Definition: Sec.h:93
+
sec_credentials()
Initializes a new class instance with the object handle set to NULL.
Definition: Sec.h:100
+
void free_internal() noexcept override
Frees the security credentials.
Definition: Sec.h:188
+
TimeStamp m_expires
Credentials expiration time.
Definition: Sec.h:195
+
sec_credentials(sec_credentials &&h) noexcept
Move constructor.
Definition: Sec.h:122
+
virtual ~sec_credentials()
Frees the security credentials.
Definition: Sec.h:133
+
sec_credentials(handle_type h, const TimeStamp expires)
Initializes a new class with an already available object handle.
Definition: Sec.h:111
+
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:162
+
sec_credentials & operator=(sec_credentials &&h) noexcept
Move assignment.
Definition: Sec.h:144
+
Security runtime error.
Definition: Sec.h:362
+
sec_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition: Sec.h:380
+
sec_runtime_error(const sec_runtime_error &other)
Copies an exception.
Definition: Sec.h:389
+
sec_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition: Sec.h:370
+
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:66
+
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:93
+
static const PCredHandle invalid
Invalid handle value.
Definition: Common.h:617
diff --git a/_setup_a_p_i_8h.html b/_setup_a_p_i_8h.html deleted file mode 100644 index d41c2b3f..00000000 --- a/_setup_a_p_i_8h.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - -WinStd: include/WinStd/SetupAPI.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
SetupAPI.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft Setup API. -More...

-
#include "Common.h"
-#include <SetupAPI.h>
-
-

Go to the source code of this file.

- - - - - - - - -

-Classes

class  winstd::setup_device_info_list
 HDEVINFO wrapper class. More...
 
class  winstd::setup_driver_info_list_builder
 Builds a list of drivers in constructor and deletes it in destructor. More...
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft Setup API.

-
- - - - diff --git a/_setup_a_p_i_8h_source.html b/_setup_a_p_i_8h_source.html index b48dd919..a90c27bb 100644 --- a/_setup_a_p_i_8h_source.html +++ b/_setup_a_p_i_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,94 +70,92 @@ $(function() {
SetupAPI.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
-
14
-
15#include "Common.h"
-
16#include <SetupAPI.h>
-
17
-
18namespace winstd
-
19{
-
22
-
29 class setup_device_info_list : public handle<HDEVINFO, INVALID_HANDLE_VALUE>
-
30 {
-
31 WINSTD_HANDLE_IMPL(setup_device_info_list, INVALID_HANDLE_VALUE)
-
32
-
33 public:
- -
40 {
-
41 if (m_h != invalid)
- -
43 }
-
44
-
45 protected:
-
51 void free_internal() noexcept override
-
52 {
-
53 SetupDiDestroyDeviceInfoList(m_h);
-
54 }
-
55 };
-
56
- -
61 {
- - -
64
-
65 public:
- -
72 _In_ HDEVINFO DeviceInfoSet,
-
73 _Inout_opt_ PSP_DEVINFO_DATA DeviceInfoData,
-
74 _In_ DWORD DriverType) noexcept :
-
75 m_DeviceInfoSet (DeviceInfoSet),
-
76 m_DeviceInfoData(DeviceInfoData),
-
77 m_DriverType (DriverType)
-
78 {
-
79 m_result = SetupDiBuildDriverInfoList(m_DeviceInfoSet, m_DeviceInfoData, m_DriverType);
-
80 }
-
81
- -
88 {
-
89 if (m_result)
-
90 SetupDiDestroyDriverInfoList(m_DeviceInfoSet, m_DeviceInfoData, m_DriverType);
-
91 }
-
92
-
98 BOOL status() const noexcept
-
99 {
-
100 return m_result;
-
101 }
-
102
-
103 protected:
-
105 HDEVINFO m_DeviceInfoSet;
-
106 PSP_DEVINFO_DATA m_DeviceInfoData;
-
107 DWORD m_DriverType;
-
108 BOOL m_result;
-
110 };
-
111
-
113}
-
General API.
-
Integrates WinStd classes with Microsoft Setup API.
-
Base abstract template class to support generic object handle keeping.
Definition: Common.h:615
-
handle_type m_h
Object handle.
Definition: Common.h:866
-
HDEVINFO wrapper class.
Definition: SetupAPI.h:30
-
virtual ~setup_device_info_list()
Frees the device information set.
Definition: SetupAPI.h:39
-
void free_internal() noexcept override
Frees the device information set.
Definition: SetupAPI.h:51
-
Builds a list of drivers in constructor and deletes it in destructor.
Definition: SetupAPI.h:61
-
setup_driver_info_list_builder(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType) noexcept
Construct the builder and builds a list of drivers that is associated with a specific device or with ...
Definition: SetupAPI.h:71
-
virtual ~setup_driver_info_list_builder()
Deletes a driver list and destructs the builder.
Definition: SetupAPI.h:87
-
BOOL status() const noexcept
Return result of SetupDiBuildDriverInfoList() call.
Definition: SetupAPI.h:98
-
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:74
-
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition: Common.h:82
-
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:171
-
static const HDEVINFO invalid
Invalid handle value.
Definition: Common.h:625
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <SetupAPI.h>
+
13
+
14namespace winstd
+
15{
+
18
+
25 class setup_device_info_list : public handle<HDEVINFO, INVALID_HANDLE_VALUE>
+
26 {
+
27 WINSTD_HANDLE_IMPL(setup_device_info_list, INVALID_HANDLE_VALUE)
+
28
+
29 public:
+ +
36 {
+
37 if (m_h != invalid)
+ +
39 }
+
40
+
41 protected:
+
47 void free_internal() noexcept override
+
48 {
+
49 SetupDiDestroyDeviceInfoList(m_h);
+
50 }
+
51 };
+
52
+ +
57 {
+ + +
60
+
61 public:
+ +
68 _In_ HDEVINFO DeviceInfoSet,
+
69 _Inout_opt_ PSP_DEVINFO_DATA DeviceInfoData,
+
70 _In_ DWORD DriverType) noexcept :
+
71 m_DeviceInfoSet (DeviceInfoSet),
+
72 m_DeviceInfoData(DeviceInfoData),
+
73 m_DriverType (DriverType)
+
74 {
+
75 m_result = SetupDiBuildDriverInfoList(m_DeviceInfoSet, m_DeviceInfoData, m_DriverType);
+
76 }
+
77
+ +
84 {
+
85 if (m_result)
+
86 SetupDiDestroyDriverInfoList(m_DeviceInfoSet, m_DeviceInfoData, m_DriverType);
+
87 }
+
88
+
94 BOOL status() const noexcept
+
95 {
+
96 return m_result;
+
97 }
+
98
+
99 protected:
+
101 HDEVINFO m_DeviceInfoSet;
+
102 PSP_DEVINFO_DATA m_DeviceInfoData;
+
103 DWORD m_DriverType;
+
104 BOOL m_result;
+
106 };
+
107
+
109}
+
Base abstract template class to support generic object handle keeping.
Definition: Common.h:607
+
handle_type m_h
Object handle.
Definition: Common.h:858
+
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
+
Builds a list of drivers in constructor and deletes it in destructor.
Definition: SetupAPI.h:57
+
setup_driver_info_list_builder(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType) noexcept
Construct the builder and builds a list of drivers that is associated with a specific device or with ...
Definition: SetupAPI.h:67
+
virtual ~setup_driver_info_list_builder()
Deletes a driver list and destructs the builder.
Definition: SetupAPI.h:83
+
BOOL status() const noexcept
Return result of SetupDiBuildDriverInfoList() call.
Definition: SetupAPI.h:94
+
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:66
+
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition: Common.h:74
+
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:163
+
static const HDEVINFO invalid
Invalid handle value.
Definition: Common.h:617
diff --git a/_shell_8h.html b/_shell_8h.html deleted file mode 100644 index 75f85d2b..00000000 --- a/_shell_8h.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - -WinStd: include/WinStd/Shell.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
Shell.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft Shell API. -More...

-
#include "Common.h"
-#include <Shlwapi.h>
-#include <string>
-
-

Go to the source code of this file.

- - - - - - - - - - -

-Functions

template<class _Traits , class _Ax >
static BOOL PathCanonicalizeA (std::basic_string< char, _Traits, _Ax > &sValue, LPCSTR pszPath)
 Simplifies a path by removing navigation elements such as "." and ".." to produce a direct, well-formed path, and stores it in a std::wstring string. More...
 
template<class _Traits , class _Ax >
static BOOL PathCanonicalizeW (std::basic_string< wchar_t, _Traits, _Ax > &sValue, LPCWSTR pszPath)
 Simplifies a path by removing navigation elements such as "." and ".." to produce a direct, well-formed path, and stores it in a std::wstring string. More...
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft Shell API.

-
- - - - diff --git a/_shell_8h_source.html b/_shell_8h_source.html index 7f6d5c86..019ab3f1 100644 --- a/_shell_8h_source.html +++ b/_shell_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,50 +70,49 @@ $(function() {
Shell.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <Shlwapi.h>
+
13#include <string>
14
-
15#include "Common.h"
-
16#include <Shlwapi.h>
-
17#include <string>
-
18
-
21
-
23template<class _Traits, class _Ax>
-
24static BOOL PathCanonicalizeA(_Inout_ std::basic_string<char, _Traits, _Ax> &sValue, _In_ LPCSTR pszPath)
-
25{
-
26 assert(0); // TODO: Test this code.
-
27
-
28 // Allocate buffer on heap and read into it.
-
29 char szBuffer[MAX_PATH + 1];
-
30 BOOL bResult = ::PathCanonicalizeA(szBuffer, pszPath);
-
31 sValue.assign(szBuffer, bResult ? MAX_PATH : 0);
-
32 return bResult;
-
33}
-
34
-
40template<class _Traits, class _Ax>
-
41static BOOL PathCanonicalizeW(_Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, _In_ LPCWSTR pszPath)
-
42{
-
43 assert(0); // TODO: Test this code.
-
44
-
45 wchar_t szBuffer[MAX_PATH + 1];
-
46 BOOL bResult = ::PathCanonicalizeW(szBuffer, pszPath);
-
47 sValue.assign(szBuffer, bResult ? MAX_PATH : 0);
-
48 return bResult;
-
49}
-
50
-
General API.
-
static BOOL PathCanonicalizeW(std::basic_string< wchar_t, _Traits, _Ax > &sValue, LPCWSTR pszPath)
Simplifies a path by removing navigation elements such as "." and ".." to produce a direct,...
Definition: Shell.h:41
-
static BOOL PathCanonicalizeA(std::basic_string< char, _Traits, _Ax > &sValue, LPCSTR pszPath)
Simplifies a path by removing navigation elements such as "." and ".." to produce a direct,...
Definition: Shell.h:24
+
17
+
19template<class _Traits, class _Ax>
+
20static BOOL PathCanonicalizeA(_Inout_ std::basic_string<char, _Traits, _Ax> &sValue, _In_ LPCSTR pszPath)
+
21{
+
22 assert(0); // TODO: Test this code.
+
23
+
24 // Allocate buffer on heap and read into it.
+
25 char szBuffer[MAX_PATH + 1];
+
26 BOOL bResult = ::PathCanonicalizeA(szBuffer, pszPath);
+
27 sValue.assign(szBuffer, bResult ? MAX_PATH : 0);
+
28 return bResult;
+
29}
+
30
+
36template<class _Traits, class _Ax>
+
37static BOOL PathCanonicalizeW(_Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, _In_ LPCWSTR pszPath)
+
38{
+
39 assert(0); // TODO: Test this code.
+
40
+
41 wchar_t szBuffer[MAX_PATH + 1];
+
42 BOOL bResult = ::PathCanonicalizeW(szBuffer, pszPath);
+
43 sValue.assign(szBuffer, bResult ? MAX_PATH : 0);
+
44 return bResult;
+
45}
+
46
+
static BOOL PathCanonicalizeW(std::basic_string< wchar_t, _Traits, _Ax > &sValue, LPCWSTR pszPath)
Simplifies a path by removing navigation elements such as "." and ".." to produce a direct,...
Definition: Shell.h:37
+
static BOOL PathCanonicalizeA(std::basic_string< char, _Traits, _Ax > &sValue, LPCSTR pszPath)
Simplifies a path by removing navigation elements such as "." and ".." to produce a direct,...
Definition: Shell.h:20
diff --git a/_w_l_a_n_8h.html b/_w_l_a_n_8h.html deleted file mode 100644 index 789be688..00000000 --- a/_w_l_a_n_8h.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - -WinStd: include/WinStd/WLAN.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
WLAN.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft WLAN API. -More...

-
#include "Common.h"
-#include <wlanapi.h>
-#include <string>
-
-

Go to the source code of this file.

- - - - - - - - - - - -

-Classes

struct  winstd::WlanFreeMemory_delete< _Ty >
 Deleter for unique_ptr using WlanFreeMemory. More...
 
struct  winstd::WlanFreeMemory_delete< _Ty[]>
 Deleter for unique_ptr to array of unknown size using WlanFreeMemory. More...
 
class  winstd::wlan_handle
 WLAN handle wrapper. More...
 
- - - - - - - - -

-Functions

template<class _Traits , class _Ax >
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. More...
 
static DWORD WlanOpenHandle (DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, winstd::wlan_handle &handle)
 Opens a connection to the server. More...
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft WLAN API.

-
- - - - diff --git a/_w_l_a_n_8h_source.html b/_w_l_a_n_8h_source.html index a8ce5255..f121f11e 100644 --- a/_w_l_a_n_8h_source.html +++ b/_w_l_a_n_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,147 +70,146 @@ $(function() {
WLAN.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <wlanapi.h>
+
13#include <string>
14
-
15#include "Common.h"
-
16#include <wlanapi.h>
-
17#include <string>
-
18
-
21
-
23// Must not statically link to Wlanapi.dll as it is not available on Windows
-
24// without a WLAN interface.
-
25extern DWORD (WINAPI *pfnWlanReasonCodeToString)(__in DWORD dwReasonCode, __in DWORD dwBufferSize, __in_ecount(dwBufferSize) PWCHAR pStringBuffer, __reserved PVOID pReserved);
-
27
-
37template<class _Traits, class _Ax>
-
38static DWORD WlanReasonCodeToString(_In_ DWORD dwReasonCode, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, __reserved PVOID pReserved)
-
39{
-
40 DWORD dwSize = 0;
-
41
-
42 if (!::pfnWlanReasonCodeToString)
-
43 return ERROR_CALL_NOT_IMPLEMENTED;
-
44
-
45 for (;;) {
-
46 // Increment size and allocate buffer.
-
47 dwSize += 1024;
-
48 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwSize]);
-
49
-
50 // Try!
-
51 DWORD dwResult = ::pfnWlanReasonCodeToString(dwReasonCode, dwSize, szBuffer.get(), pReserved);
-
52 if (dwResult == ERROR_SUCCESS) {
-
53 DWORD dwLength = (DWORD)wcsnlen(szBuffer.get(), dwSize);
-
54 if (dwLength < dwSize - 1) {
-
55 // Buffer was long enough.
-
56 sValue.assign(szBuffer.get(), dwLength);
-
57 return ERROR_SUCCESS;
-
58 }
-
59 } else {
-
60 // Return error code.
-
61 return dwResult;
-
62 }
-
63 }
-
64}
-
65
-
67
-
68namespace winstd
-
69{
-
72
-
76 template <class _Ty> struct WlanFreeMemory_delete
-
77 {
- -
79
- -
84
-
88 template <class _Ty2> WlanFreeMemory_delete(const WlanFreeMemory_delete<_Ty2>&) {}
-
89
-
93 void operator()(_Ty *_Ptr) const
-
94 {
-
95 WlanFreeMemory(_Ptr);
-
96 }
-
97 };
-
98
-
102 template <class _Ty> struct WlanFreeMemory_delete<_Ty[]>
-
103 {
- -
105
- -
110
-
114 void operator()(_Ty *_Ptr) const
-
115 {
-
116 WlanFreeMemory(_Ptr);
-
117 }
-
118
-
122 template<class _Other>
-
123 void operator()(_Other *) const
-
124 {
-
125 WlanFreeMemory(_Ptr);
-
126 }
-
127 };
-
128
-
134 class wlan_handle : public handle<HANDLE, NULL>
-
135 {
- -
137
-
138 public:
-
144 virtual ~wlan_handle()
-
145 {
-
146 if (m_h != invalid)
- -
148 }
-
149
-
150 protected:
-
156 void free_internal() noexcept override
-
157 {
-
158 WlanCloseHandle(m_h, NULL);
-
159 }
-
160 };
-
161
-
163}
-
164
-
167
-
173#pragma warning(suppress: 4505) // Don't warn on unused code
-
174static DWORD WlanOpenHandle(
-
175 _In_ DWORD dwClientVersion,
-
176 _Reserved_ PVOID pReserved,
-
177 _Out_ PDWORD pdwNegotiatedVersion,
-
178 _Inout_ winstd::wlan_handle &handle)
-
179{
-
180 HANDLE h;
-
181 DWORD dwResult = WlanOpenHandle(dwClientVersion, pReserved, pdwNegotiatedVersion, &h);
-
182 if (dwResult == ERROR_SUCCESS)
-
183 handle.attach(h);
-
184 return dwResult;
-
185}
-
186
-
General API.
-
Base abstract template class to support generic object handle keeping.
Definition: Common.h:615
-
handle_type m_h
Object handle.
Definition: Common.h:866
-
WLAN handle wrapper.
Definition: WLAN.h:135
-
virtual ~wlan_handle()
Closes a connection to the server.
Definition: WLAN.h:144
-
void free_internal() noexcept override
Closes a connection to the server.
Definition: WLAN.h:156
-
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:171
-
static const HANDLE invalid
Invalid handle value.
Definition: Common.h:625
-
static DWORD WlanOpenHandle(DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, winstd::wlan_handle &handle)
Opens a connection to the server.
Definition: WLAN.h:174
-
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:38
-
WlanFreeMemory_delete()
Default construct.
Definition: WLAN.h:109
-
void operator()(_Other *) const
Delete a pointer of another type.
Definition: WLAN.h:123
-
WlanFreeMemory_delete< _Ty > _Myt
This type.
Definition: WLAN.h:104
-
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: WLAN.h:114
-
Deleter for unique_ptr using WlanFreeMemory.
Definition: WLAN.h:77
-
WlanFreeMemory_delete()
Default construct.
Definition: WLAN.h:83
-
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: WLAN.h:93
-
WlanFreeMemory_delete< _Ty > _Myt
This type.
Definition: WLAN.h:78
-
WlanFreeMemory_delete(const WlanFreeMemory_delete< _Ty2 > &)
Construct from another WlanFreeMemory_delete.
Definition: WLAN.h:88
+
17
+
19// Must not statically link to Wlanapi.dll as it is not available on Windows
+
20// without a WLAN interface.
+
21extern DWORD (WINAPI *pfnWlanReasonCodeToString)(__in DWORD dwReasonCode, __in DWORD dwBufferSize, __in_ecount(dwBufferSize) PWCHAR pStringBuffer, __reserved PVOID pReserved);
+
23
+
33template<class _Traits, class _Ax>
+
34static DWORD WlanReasonCodeToString(_In_ DWORD dwReasonCode, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, __reserved PVOID pReserved)
+
35{
+
36 DWORD dwSize = 0;
+
37
+
38 if (!::pfnWlanReasonCodeToString)
+
39 return ERROR_CALL_NOT_IMPLEMENTED;
+
40
+
41 for (;;) {
+
42 // Increment size and allocate buffer.
+
43 dwSize += 1024;
+
44 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwSize]);
+
45
+
46 // Try!
+
47 DWORD dwResult = ::pfnWlanReasonCodeToString(dwReasonCode, dwSize, szBuffer.get(), pReserved);
+
48 if (dwResult == ERROR_SUCCESS) {
+
49 DWORD dwLength = (DWORD)wcsnlen(szBuffer.get(), dwSize);
+
50 if (dwLength < dwSize - 1) {
+
51 // Buffer was long enough.
+
52 sValue.assign(szBuffer.get(), dwLength);
+
53 return ERROR_SUCCESS;
+
54 }
+
55 } else {
+
56 // Return error code.
+
57 return dwResult;
+
58 }
+
59 }
+
60}
+
61
+
63
+
64namespace winstd
+
65{
+
68
+
72 template <class _Ty> struct WlanFreeMemory_delete
+
73 {
+ +
75
+ +
80
+
84 template <class _Ty2> WlanFreeMemory_delete(const WlanFreeMemory_delete<_Ty2>&) {}
+
85
+
89 void operator()(_Ty *_Ptr) const
+
90 {
+
91 WlanFreeMemory(_Ptr);
+
92 }
+
93 };
+
94
+
98 template <class _Ty> struct WlanFreeMemory_delete<_Ty[]>
+
99 {
+ +
101
+ +
106
+
110 void operator()(_Ty *_Ptr) const
+
111 {
+
112 WlanFreeMemory(_Ptr);
+
113 }
+
114
+
118 template<class _Other>
+
119 void operator()(_Other *) const
+
120 {
+
121 WlanFreeMemory(_Ptr);
+
122 }
+
123 };
+
124
+
130 class wlan_handle : public handle<HANDLE, NULL>
+
131 {
+ +
133
+
134 public:
+
140 virtual ~wlan_handle()
+
141 {
+
142 if (m_h != invalid)
+ +
144 }
+
145
+
146 protected:
+
152 void free_internal() noexcept override
+
153 {
+
154 WlanCloseHandle(m_h, NULL);
+
155 }
+
156 };
+
157
+
159}
+
160
+
163
+
169#pragma warning(suppress: 4505) // Don't warn on unused code
+
170static DWORD WlanOpenHandle(
+
171 _In_ DWORD dwClientVersion,
+
172 _Reserved_ PVOID pReserved,
+
173 _Out_ PDWORD pdwNegotiatedVersion,
+
174 _Inout_ winstd::wlan_handle &handle)
+
175{
+
176 HANDLE h;
+
177 DWORD dwResult = WlanOpenHandle(dwClientVersion, pReserved, pdwNegotiatedVersion, &h);
+
178 if (dwResult == ERROR_SUCCESS)
+
179 handle.attach(h);
+
180 return dwResult;
+
181}
+
182
+
Base abstract template class to support generic object handle keeping.
Definition: Common.h:607
+
handle_type m_h
Object handle.
Definition: Common.h:858
+
WLAN handle wrapper.
Definition: WLAN.h:131
+
virtual ~wlan_handle()
Closes a connection to the server.
Definition: WLAN.h:140
+
void free_internal() noexcept override
Closes a connection to the server.
Definition: WLAN.h:152
+
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:163
+
static const HANDLE invalid
Invalid handle value.
Definition: Common.h:617
+
static DWORD WlanOpenHandle(DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, winstd::wlan_handle &handle)
Opens a connection to the server.
Definition: WLAN.h:170
+
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:105
+
void operator()(_Other *) const
Delete a pointer of another type.
Definition: WLAN.h:119
+
WlanFreeMemory_delete< _Ty > _Myt
This type.
Definition: WLAN.h:100
+
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: WLAN.h:110
+
Deleter for unique_ptr using WlanFreeMemory.
Definition: WLAN.h:73
+
WlanFreeMemory_delete()
Default construct.
Definition: WLAN.h:79
+
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: WLAN.h:89
+
WlanFreeMemory_delete< _Ty > _Myt
This type.
Definition: WLAN.h:74
+
WlanFreeMemory_delete(const WlanFreeMemory_delete< _Ty2 > &)
Construct from another WlanFreeMemory_delete.
Definition: WLAN.h:84
diff --git a/_win_8h.html b/_win_8h.html deleted file mode 100644 index ff5004d3..00000000 --- a/_win_8h.html +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - - -WinStd: include/WinStd/Win.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
Win.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft Windows API. -More...

-
#include "Common.h"
-#include <string>
-#include <vector>
-
-

Go to the source code of this file.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Classes

class  winstd::win_handle< INVALID >
 Windows HANDLE wrapper class. More...
 
class  winstd::library
 Module handle wrapper. More...
 
struct  winstd::UnmapViewOfFile_delete< _Ty >
 Deleter for unique_ptr using UnmapViewOfFile. More...
 
struct  winstd::UnmapViewOfFile_delete< _Ty[]>
 Deleter for unique_ptr to array of unknown size using UnmapViewOfFile. More...
 
class  winstd::critical_section
 Critical section wrapper. More...
 
class  winstd::find_file
 Find-file handle wrapper. More...
 
class  winstd::heap
 Heap handle wrapper. More...
 
class  winstd::heap_allocator< _Ty >
 HeapAlloc allocator. More...
 
struct  winstd::heap_allocator< _Ty >::rebind< _Other >
 A structure that enables an allocator for objects of one type to allocate storage for objects of another type. More...
 
class  winstd::actctx_activator
 Activates given activation context in constructor and deactivates it in destructor. More...
 
class  winstd::user_impersonator
 Lets the calling thread impersonate the security context of a logged-on user. More...
 
class  winstd::console_ctrl_handler
 Console control handler stack management. More...
 
class  winstd::vmemory
 Memory in virtual address space of a process handle wrapper. More...
 
class  winstd::reg_key
 Registry key wrapper class. More...
 
class  winstd::security_id
 SID wrapper class. More...
 
class  winstd::process_information
 PROCESS_INFORMATION struct wrapper. More...
 
class  winstd::event_log
 Event log handle wrapper. More...
 
- - - - - - - -

-Macros

#define GuidToString   GuidToStringA
 Formats GUID and stores it in a std::wstring string. More...
 
#define StringToGuid   StringToGuidA
 Parses string with GUID and stores it to GUID. More...
 
- - - - - - - - - - - - - - - - - - - -

-Typedefs

typedef win_handle< NULL > winstd::process
 Process handle wrapper. More...
 
typedef win_handle< NULL > winstd::thread
 Thread handle wrapper. More...
 
typedef win_handle< INVALID_HANDLE_VALUE > winstd::process_snapshot
 Process snapshot handle wrapper. More...
 
typedef win_handle< INVALID_HANDLE_VALUE > winstd::file
 File handle wrapper. More...
 
typedef win_handle< NULL > winstd::file_mapping
 File mapping. More...
 
typedef win_handle< NULL > winstd::event
 Event handle wrapper. More...
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Functions

template<class _Traits , class _Ax >
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 std::wstring string. More...
 
template<class _Traits , class _Ax >
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 std::wstring string. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Ty , class _Ax >
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. More...
 
template<class _Ty , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
static DWORD ExpandEnvironmentStringsA (LPCSTR lpSrc, std::basic_string< char, _Traits, _Ax > &sValue) noexcept
 Expands environment-variable strings, replaces them with the values defined for the current user, and stores it in a std::wstring string. More...
 
template<class _Traits , class _Ax >
static DWORD ExpandEnvironmentStringsW (LPCWSTR lpSrc, std::basic_string< wchar_t, _Traits, _Ax > &sValue) noexcept
 Expands environment-variable strings, replaces them with the values defined for the current user, and stores it in a std::wstring string. More...
 
template<class _Traits , class _Ax >
static VOID GuidToStringA (LPCGUID lpGuid, std::basic_string< char, _Traits, _Ax > &str) noexcept
 Formats GUID and stores it in a std::wstring string. More...
 
template<class _Traits , class _Ax >
static VOID GuidToStringW (LPCGUID lpGuid, std::basic_string< wchar_t, _Traits, _Ax > &str) noexcept
 Formats GUID and stores it in a std::wstring string. More...
 
static BOOL StringToGuidA (LPCSTR lpszGuid, LPGUID lpGuid, LPCSTR *lpszGuidEnd=NULL) noexcept
 Parses string with GUID and stores it to GUID. More...
 
static BOOL StringToGuidW (LPCWSTR lpszGuid, LPGUID lpGuid, LPCWSTR *lpszGuidEnd=NULL) noexcept
 Parses string with GUID and stores it to GUID. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
static LSTATUS RegQueryStringValue (HKEY hReg, LPCWSTR pszName, std::basic_string< wchar_t, _Traits, _Ax > &sValue) noexcept
 Queries for a string value in the registry and stores it in a std::wstring string. More...
 
template<class _Ty , class _Ax >
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 stores the data in a std::vector buffer. More...
 
template<class _Ty , class _Ax >
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 stores the data in a std::vector buffer. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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 from a multibyte character set. More...
 
template<class _Ax >
static int WideCharToMultiByte (UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::vector< char, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
 Maps a UTF-16 (wide character) string to a std::vector. The new character vector is not necessarily from a multibyte character set. More...
 
template<class _Traits1 , class _Ax1 , class _Traits2 , class _Ax2 >
static int WideCharToMultiByte (UINT CodePage, DWORD dwFlags, std::basic_string< wchar_t, _Traits1, _Ax1 > sWideCharStr, std::basic_string< char, _Traits2, _Ax2 > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
 Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily from a multibyte character set. More...
 
template<class _Traits , class _Ax >
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 from a multibyte character set. More...
 
template<class _Ax >
static int SecureWideCharToMultiByte (UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::vector< char, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
 Maps a UTF-16 (wide character) string to a std::vector. The new character vector is not necessarily from a multibyte character set. More...
 
template<class _Traits1 , class _Ax1 , class _Traits2 , class _Ax2 >
static int SecureWideCharToMultiByte (UINT CodePage, DWORD dwFlags, std::basic_string< wchar_t, _Traits1, _Ax1 > sWideCharStr, std::basic_string< char, _Traits2, _Ax2 > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept
 Maps a UTF-16 (wide character) string to a std::string. The new character string is not necessarily from a multibyte character set. More...
 
template<class _Traits , class _Ax >
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 necessarily from a multibyte character set. More...
 
template<class _Ax >
static int MultiByteToWideChar (UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::vector< wchar_t, _Ax > &sWideCharStr) noexcept
 Maps a character string to a UTF-16 (wide character) std::vector. The character vector is not necessarily from a multibyte character set. More...
 
template<class _Traits1 , class _Ax1 , class _Traits2 , class _Ax2 >
static int MultiByteToWideChar (UINT CodePage, DWORD dwFlags, const std::basic_string< char, _Traits1, _Ax1 > &sMultiByteStr, std::basic_string< wchar_t, _Traits2, _Ax2 > &sWideCharStr) noexcept
 Maps a character string to a UTF-16 (wide character) std::wstring. The character string is not necessarily from a multibyte character set. More...
 
template<class _Traits , class _Ax >
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 necessarily from a multibyte character set. More...
 
template<class _Ax >
static int SecureMultiByteToWideChar (UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::vector< wchar_t, _Ax > &sWideCharStr) noexcept
 Maps a character string to a UTF-16 (wide character) std::vector. The character vector is not necessarily from a multibyte character set. More...
 
template<class _Traits1 , class _Ax1 , class _Traits2 , class _Ax2 >
static int SecureMultiByteToWideChar (UINT CodePage, DWORD dwFlags, const std::basic_string< char, _Traits1, _Ax1 > &sMultiByteStr, std::basic_string< wchar_t, _Traits2, _Ax2 > &sWideCharStr) noexcept
 Maps a character string to a UTF-16 (wide character) std::wstring. The character string is not necessarily from a multibyte character set. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits1 , class _Ax1 , class _Traits2 , class _Ax2 >
static int NormalizeString (NORM_FORM NormForm, const std::basic_string< wchar_t, _Traits1, _Ax1 > &sSrcString, std::basic_string< wchar_t, _Traits2, _Ax2 > &sDstString) noexcept
 Normalizes characters of a text string according to Unicode 4.0 TR#15. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
static VOID OutputDebugStrV (LPCSTR lpOutputString, va_list arg) noexcept
 Formats and sends a string to the debugger for display. More...
 
static VOID OutputDebugStrV (LPCWSTR lpOutputString, va_list arg) noexcept
 Formats and sends a string to the debugger for display. More...
 
static VOID OutputDebugStr (LPCSTR lpOutputString,...) noexcept
 Formats and sends a string to the debugger for display. More...
 
static VOID OutputDebugStr (LPCWSTR lpOutputString,...) noexcept
 Formats and sends a string to the debugger for display. More...
 
template<class _Traits , class _Ax >
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 either a specified date or the local system date. More...
 
template<class _Traits , class _Ax >
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 either a specified date or the local system date. More...
 
template<class _Traits , class _Ax >
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 found. More...
 
template<class _Traits , class _Ax >
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 found. More...
 
template<class _Ty >
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 appropriate access rights to obtain the information. More...
 
template<class _Traits , class _Ax >
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. More...
 
template<class _Traits , class _Ax >
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. More...
 
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. More...
 
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. More...
 
static LSTATUS RegOpenKeyExA (HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
 Opens the specified registry key. More...
 
static LSTATUS RegOpenKeyExW (HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
 Opens the specified registry key. More...
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft Windows API.

-
- - - - diff --git a/_win_8h_source.html b/_win_8h_source.html index 7c993fab..5f09724f 100644 --- a/_win_8h_source.html +++ b/_win_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,1840 +70,1839 @@ $(function() {
Win.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <string>
+
13#include <vector>
14
-
15#include "Common.h"
-
16#include <string>
-
17#include <vector>
-
18
-
19#pragma warning(push)
-
20#pragma warning(disable: 4505) // Don't warn on unused code
-
21
-
24
-
26template<class _Traits, class _Ax>
-
27static DWORD GetModuleFileNameA(_In_opt_ HMODULE hModule, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
-
28{
-
29 assert(0); // TODO: Test this code.
-
30
-
31 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
32
-
33 // Try with stack buffer first.
-
34 DWORD dwResult = ::GetModuleFileNameA(hModule, szStackBuffer, _countof(szStackBuffer));
-
35 if (dwResult < _countof(szStackBuffer)) {
-
36 // Copy from stack.
-
37 sValue.assign(szStackBuffer, dwResult);
-
38 return dwResult;
-
39 } else {
-
40 for (DWORD dwCapacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(char);; dwCapacity *= 2) {
-
41 // Allocate on heap and retry.
-
42 std::unique_ptr<char[]> szBuffer(new char[dwCapacity]);
-
43 dwResult = ::GetModuleFileNameA(hModule, szBuffer.get(), dwCapacity);
-
44 if (dwResult < dwCapacity) {
-
45 sValue.assign(szBuffer.get(), dwResult);
-
46 return dwResult;
-
47 }
-
48 }
-
49 }
-
50}
-
51
-
57template<class _Traits, class _Ax>
-
58static DWORD GetModuleFileNameW(_In_opt_ HMODULE hModule, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
-
59{
-
60 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
61
-
62 // Try with stack buffer first.
-
63 DWORD dwResult = ::GetModuleFileNameW(hModule, szStackBuffer, _countof(szStackBuffer));
-
64 if (dwResult < _countof(szStackBuffer)) {
-
65 // Copy from stack.
-
66 sValue.assign(szStackBuffer, dwResult);
-
67 return dwResult;
-
68 } else {
-
69 for (DWORD dwCapacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t);; dwCapacity *= 2) {
-
70 // Allocate on heap and retry.
-
71 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwCapacity]);
-
72 dwResult = ::GetModuleFileNameW(hModule, szBuffer.get(), dwCapacity);
-
73 if (dwResult < dwCapacity) {
-
74 sValue.assign(szBuffer.get(), dwResult);
-
75 return dwResult;
-
76 }
-
77 }
-
78 }
-
79}
-
80
-
82template<class _Traits, class _Ax>
-
83static _Success_(return != 0) int GetWindowTextA(_In_ HWND hWnd, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
-
84{
-
85 assert(0); // TODO: Test this code.
-
86
-
87 int iResult;
-
88
-
89 // Query the final string length first.
-
90 iResult = ::GetWindowTextLengthA(hWnd);
-
91 if (iResult > 0) {
-
92 if (++iResult < WINSTD_STACK_BUFFER_BYTES/sizeof(char)) {
-
93 // Read string data to stack.
-
94 char szBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
95 iResult = ::GetWindowTextA(hWnd, szBuffer, _countof(szBuffer));
-
96 sValue.assign(szBuffer, iResult);
-
97 } else {
-
98 // Allocate buffer on heap and read the string data into it.
-
99 std::unique_ptr<char[]> szBuffer(new char[++iResult]);
-
100 iResult = ::GetWindowTextA(hWnd, szBuffer.get(), iResult);
-
101 sValue.assign(szBuffer.get(), iResult);
-
102 }
-
103 return iResult;
-
104 }
+
15#pragma warning(push)
+
16#pragma warning(disable: 4505) // Don't warn on unused code
+
17
+
20
+
22template<class _Traits, class _Ax>
+
23static DWORD GetModuleFileNameA(_In_opt_ HMODULE hModule, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
+
24{
+
25 assert(0); // TODO: Test this code.
+
26
+
27 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
28
+
29 // Try with stack buffer first.
+
30 DWORD dwResult = ::GetModuleFileNameA(hModule, szStackBuffer, _countof(szStackBuffer));
+
31 if (dwResult < _countof(szStackBuffer)) {
+
32 // Copy from stack.
+
33 sValue.assign(szStackBuffer, dwResult);
+
34 return dwResult;
+
35 } else {
+
36 for (DWORD dwCapacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(char);; dwCapacity *= 2) {
+
37 // Allocate on heap and retry.
+
38 std::unique_ptr<char[]> szBuffer(new char[dwCapacity]);
+
39 dwResult = ::GetModuleFileNameA(hModule, szBuffer.get(), dwCapacity);
+
40 if (dwResult < dwCapacity) {
+
41 sValue.assign(szBuffer.get(), dwResult);
+
42 return dwResult;
+
43 }
+
44 }
+
45 }
+
46}
+
47
+
53template<class _Traits, class _Ax>
+
54static DWORD GetModuleFileNameW(_In_opt_ HMODULE hModule, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
+
55{
+
56 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
57
+
58 // Try with stack buffer first.
+
59 DWORD dwResult = ::GetModuleFileNameW(hModule, szStackBuffer, _countof(szStackBuffer));
+
60 if (dwResult < _countof(szStackBuffer)) {
+
61 // Copy from stack.
+
62 sValue.assign(szStackBuffer, dwResult);
+
63 return dwResult;
+
64 } else {
+
65 for (DWORD dwCapacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t);; dwCapacity *= 2) {
+
66 // Allocate on heap and retry.
+
67 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwCapacity]);
+
68 dwResult = ::GetModuleFileNameW(hModule, szBuffer.get(), dwCapacity);
+
69 if (dwResult < dwCapacity) {
+
70 sValue.assign(szBuffer.get(), dwResult);
+
71 return dwResult;
+
72 }
+
73 }
+
74 }
+
75}
+
76
+
78template<class _Traits, class _Ax>
+
79static _Success_(return != 0) int GetWindowTextA(_In_ HWND hWnd, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
+
80{
+
81 assert(0); // TODO: Test this code.
+
82
+
83 int iResult;
+
84
+
85 // Query the final string length first.
+
86 iResult = ::GetWindowTextLengthA(hWnd);
+
87 if (iResult > 0) {
+
88 if (++iResult < WINSTD_STACK_BUFFER_BYTES/sizeof(char)) {
+
89 // Read string data to stack.
+
90 char szBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
91 iResult = ::GetWindowTextA(hWnd, szBuffer, _countof(szBuffer));
+
92 sValue.assign(szBuffer, iResult);
+
93 } else {
+
94 // Allocate buffer on heap and read the string data into it.
+
95 std::unique_ptr<char[]> szBuffer(new char[++iResult]);
+
96 iResult = ::GetWindowTextA(hWnd, szBuffer.get(), iResult);
+
97 sValue.assign(szBuffer.get(), iResult);
+
98 }
+
99 return iResult;
+
100 }
+
101
+
102 sValue.clear();
+
103 return 0;
+
104}
105
-
106 sValue.clear();
-
107 return 0;
-
108}
-
109
-
115template<class _Traits, class _Ax>
-
116static _Success_(return != 0) int GetWindowTextW(_In_ HWND hWnd, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
-
117{
-
118 assert(0); // TODO: Test this code.
-
119
-
120 int iResult;
-
121
-
122 // Query the final string length first.
-
123 iResult = ::GetWindowTextLengthW(hWnd);
-
124 if (iResult > 0) {
-
125 if (++iResult < WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)) {
-
126 // Read string data to stack.
-
127 wchar_t szBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
128 iResult = ::GetWindowTextW(hWnd, szBuffer, _countof(szBuffer));
-
129 sValue.assign(szBuffer, iResult);
-
130 } else {
-
131 // Allocate buffer on heap and read the string data into it.
-
132 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++iResult]);
-
133 iResult = ::GetWindowTextW(hWnd, szBuffer.get(), iResult);
-
134 sValue.assign(szBuffer.get(), iResult);
-
135 }
-
136 return iResult;
-
137 }
+
111template<class _Traits, class _Ax>
+
112static _Success_(return != 0) int GetWindowTextW(_In_ HWND hWnd, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
+
113{
+
114 assert(0); // TODO: Test this code.
+
115
+
116 int iResult;
+
117
+
118 // Query the final string length first.
+
119 iResult = ::GetWindowTextLengthW(hWnd);
+
120 if (iResult > 0) {
+
121 if (++iResult < WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)) {
+
122 // Read string data to stack.
+
123 wchar_t szBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
124 iResult = ::GetWindowTextW(hWnd, szBuffer, _countof(szBuffer));
+
125 sValue.assign(szBuffer, iResult);
+
126 } else {
+
127 // Allocate buffer on heap and read the string data into it.
+
128 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++iResult]);
+
129 iResult = ::GetWindowTextW(hWnd, szBuffer.get(), iResult);
+
130 sValue.assign(szBuffer.get(), iResult);
+
131 }
+
132 return iResult;
+
133 }
+
134
+
135 sValue.clear();
+
136 return 0;
+
137}
138
-
139 sValue.clear();
-
140 return 0;
-
141}
-
142
-
144template<class _Ty, class _Ax>
-
145static _Success_(return != 0) BOOL GetFileVersionInfoA(_In_z_ LPCSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
-
146{
-
147 assert(0); // TODO: Test this code.
-
148
-
149 // Get version info size.
-
150 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeA(lptstrFilename, &dwHandle);
-
151 if (dwVerInfoSize != 0) {
-
152 // Read version info.
-
153 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
154 return ::GetFileVersionInfoA(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
-
155 } else
-
156 return FALSE;
-
157}
-
158
-
164template<class _Ty, class _Ax>
-
165static _Success_(return != 0) BOOL GetFileVersionInfoW(_In_z_ LPCWSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
-
166{
-
167 assert(0); // TODO: Test this code.
-
168
-
169 // Get version info size.
-
170 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeW(lptstrFilename, &dwHandle);
-
171 if (dwVerInfoSize != 0) {
-
172 // Read version info.
-
173 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
174 return ::GetFileVersionInfoW(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
-
175 } else
-
176 return FALSE;
-
177}
-
178
-
180template<class _Traits, class _Ax>
-
181static _Success_(return != 0) DWORD ExpandEnvironmentStringsA(_In_z_ LPCSTR lpSrc, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
-
182{
-
183 assert(0); // TODO: Test this code.
-
184
-
185 for (DWORD dwSizeOut = (DWORD)strlen(lpSrc) + 0x100;;) {
-
186 DWORD dwSizeIn = dwSizeOut;
-
187 std::unique_ptr<char[]> szBuffer(new char[(size_t)dwSizeIn + 2]); // Note: ANSI version requires one extra char.
-
188 dwSizeOut = ::ExpandEnvironmentStringsA(lpSrc, szBuffer.get(), dwSizeIn);
-
189 if (dwSizeOut == 0) {
-
190 // Error or zero-length input.
-
191 break;
-
192 } else if (dwSizeOut <= dwSizeIn) {
-
193 // The buffer was sufficient.
-
194 sValue.assign(szBuffer.get(), dwSizeOut - 1);
-
195 return dwSizeOut;
-
196 }
-
197 }
+
140template<class _Ty, class _Ax>
+
141static _Success_(return != 0) BOOL GetFileVersionInfoA(_In_z_ LPCSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
+
142{
+
143 assert(0); // TODO: Test this code.
+
144
+
145 // Get version info size.
+
146 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeA(lptstrFilename, &dwHandle);
+
147 if (dwVerInfoSize != 0) {
+
148 // Read version info.
+
149 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
150 return ::GetFileVersionInfoA(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
+
151 } else
+
152 return FALSE;
+
153}
+
154
+
160template<class _Ty, class _Ax>
+
161static _Success_(return != 0) BOOL GetFileVersionInfoW(_In_z_ LPCWSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
+
162{
+
163 assert(0); // TODO: Test this code.
+
164
+
165 // Get version info size.
+
166 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeW(lptstrFilename, &dwHandle);
+
167 if (dwVerInfoSize != 0) {
+
168 // Read version info.
+
169 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
170 return ::GetFileVersionInfoW(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
+
171 } else
+
172 return FALSE;
+
173}
+
174
+
176template<class _Traits, class _Ax>
+
177static _Success_(return != 0) DWORD ExpandEnvironmentStringsA(_In_z_ LPCSTR lpSrc, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
+
178{
+
179 assert(0); // TODO: Test this code.
+
180
+
181 for (DWORD dwSizeOut = (DWORD)strlen(lpSrc) + 0x100;;) {
+
182 DWORD dwSizeIn = dwSizeOut;
+
183 std::unique_ptr<char[]> szBuffer(new char[(size_t)dwSizeIn + 2]); // Note: ANSI version requires one extra char.
+
184 dwSizeOut = ::ExpandEnvironmentStringsA(lpSrc, szBuffer.get(), dwSizeIn);
+
185 if (dwSizeOut == 0) {
+
186 // Error or zero-length input.
+
187 break;
+
188 } else if (dwSizeOut <= dwSizeIn) {
+
189 // The buffer was sufficient.
+
190 sValue.assign(szBuffer.get(), dwSizeOut - 1);
+
191 return dwSizeOut;
+
192 }
+
193 }
+
194
+
195 sValue.clear();
+
196 return 0;
+
197}
198
-
199 sValue.clear();
-
200 return 0;
-
201}
-
202
-
208template<class _Traits, class _Ax>
-
209static _Success_(return != 0) DWORD ExpandEnvironmentStringsW(_In_z_ LPCWSTR lpSrc, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
-
210{
-
211 for (DWORD dwSizeOut = (DWORD)wcslen(lpSrc) + 0x100;;) {
-
212 DWORD dwSizeIn = dwSizeOut;
-
213 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[(size_t)dwSizeIn + 1]);
-
214 dwSizeOut = ::ExpandEnvironmentStringsW(lpSrc, szBuffer.get(), dwSizeIn);
-
215 if (dwSizeOut == 0) {
-
216 // Error or zero-length input.
-
217 break;
-
218 } else if (dwSizeOut <= dwSizeIn) {
-
219 // The buffer was sufficient.
-
220 sValue.assign(szBuffer.get(), dwSizeOut - 1);
-
221 return dwSizeOut;
-
222 }
-
223 }
+
204template<class _Traits, class _Ax>
+
205static _Success_(return != 0) DWORD ExpandEnvironmentStringsW(_In_z_ LPCWSTR lpSrc, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
+
206{
+
207 for (DWORD dwSizeOut = (DWORD)wcslen(lpSrc) + 0x100;;) {
+
208 DWORD dwSizeIn = dwSizeOut;
+
209 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[(size_t)dwSizeIn + 1]);
+
210 dwSizeOut = ::ExpandEnvironmentStringsW(lpSrc, szBuffer.get(), dwSizeIn);
+
211 if (dwSizeOut == 0) {
+
212 // Error or zero-length input.
+
213 break;
+
214 } else if (dwSizeOut <= dwSizeIn) {
+
215 // The buffer was sufficient.
+
216 sValue.assign(szBuffer.get(), dwSizeOut - 1);
+
217 return dwSizeOut;
+
218 }
+
219 }
+
220
+
221 sValue.clear();
+
222 return 0;
+
223}
224
-
225 sValue.clear();
-
226 return 0;
-
227}
-
228
-
230template<class _Traits, class _Ax>
-
231static VOID GuidToStringA(_In_ LPCGUID lpGuid, _Out_ std::basic_string<char, _Traits, _Ax> &str) noexcept
-
232{
-
233 assert(0); // TODO: Test this code.
-
234
-
235 sprintf(str, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-
236 lpGuid->Data1,
-
237 lpGuid->Data2,
-
238 lpGuid->Data3,
-
239 lpGuid->Data4[0], lpGuid->Data4[1],
-
240 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
-
241}
-
242
-
249template<class _Traits, class _Ax>
-
250static VOID GuidToStringW(_In_ LPCGUID lpGuid, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &str) noexcept
-
251{
-
252 assert(0); // TODO: Test this code.
-
253
-
254 sprintf(str, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-
255 lpGuid->Data1,
-
256 lpGuid->Data2,
-
257 lpGuid->Data3,
-
258 lpGuid->Data4[0], lpGuid->Data4[1],
-
259 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
-
260}
-
261
-
263#ifdef _UNICODE
-
264#define GuidToString GuidToStringW
-
265#else
-
266#define GuidToString GuidToStringA
-
267#endif
-
268
-
270static _Success_(return) BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd = NULL) noexcept
-
271{
-
272 GUID g;
-
273 LPSTR lpszEnd;
-
274 unsigned long ulTmp;
-
275 unsigned long long ullTmp;
-
276
-
277 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
-
278 lpszGuid++;
+
226template<class _Traits, class _Ax>
+
227static VOID GuidToStringA(_In_ LPCGUID lpGuid, _Out_ std::basic_string<char, _Traits, _Ax> &str) noexcept
+
228{
+
229 assert(0); // TODO: Test this code.
+
230
+
231 sprintf(str, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+
232 lpGuid->Data1,
+
233 lpGuid->Data2,
+
234 lpGuid->Data3,
+
235 lpGuid->Data4[0], lpGuid->Data4[1],
+
236 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
+
237}
+
238
+
245template<class _Traits, class _Ax>
+
246static VOID GuidToStringW(_In_ LPCGUID lpGuid, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &str) noexcept
+
247{
+
248 assert(0); // TODO: Test this code.
+
249
+
250 sprintf(str, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+
251 lpGuid->Data1,
+
252 lpGuid->Data2,
+
253 lpGuid->Data3,
+
254 lpGuid->Data4[0], lpGuid->Data4[1],
+
255 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
+
256}
+
257
+
259#ifdef _UNICODE
+
260#define GuidToString GuidToStringW
+
261#else
+
262#define GuidToString GuidToStringA
+
263#endif
+
264
+
266static _Success_(return) BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd = NULL) noexcept
+
267{
+
268 GUID g;
+
269 LPSTR lpszEnd;
+
270 unsigned long ulTmp;
+
271 unsigned long long ullTmp;
+
272
+
273 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
+
274 lpszGuid++;
+
275
+
276 g.Data1 = strtoul(lpszGuid, &lpszEnd, 16);
+
277 if (errno == ERANGE) return FALSE;
+
278 lpszGuid = lpszEnd;
279
-
280 g.Data1 = strtoul(lpszGuid, &lpszEnd, 16);
-
281 if (errno == ERANGE) return FALSE;
-
282 lpszGuid = lpszEnd;
-
283
-
284 if (*lpszGuid != '-') return FALSE;
-
285 lpszGuid++;
-
286
-
287 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
-
288 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
289 g.Data2 = static_cast<unsigned short>(ulTmp);
-
290 lpszGuid = lpszEnd;
-
291
-
292 if (*lpszGuid != '-') return FALSE;
-
293 lpszGuid++;
-
294
-
295 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
-
296 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
297 g.Data3 = static_cast<unsigned short>(ulTmp);
-
298 lpszGuid = lpszEnd;
-
299
-
300 if (*lpszGuid != '-') return FALSE;
-
301 lpszGuid++;
-
302
-
303 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
-
304 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
305 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
-
306 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
-
307 lpszGuid = lpszEnd;
-
308
-
309 if (*lpszGuid != '-') return FALSE;
-
310 lpszGuid++;
-
311
-
312 ullTmp = _strtoui64(lpszGuid, &lpszEnd, 16);
-
313 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
-
314 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
-
315 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
-
316 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
-
317 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
-
318 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
-
319 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
-
320 lpszGuid = lpszEnd;
-
321
-
322 if (*lpszGuid != '}') return FALSE;
-
323 lpszGuid++;
-
324
-
325 if (lpszGuidEnd)
-
326 *lpszGuidEnd = lpszGuid;
+
280 if (*lpszGuid != '-') return FALSE;
+
281 lpszGuid++;
+
282
+
283 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
+
284 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
285 g.Data2 = static_cast<unsigned short>(ulTmp);
+
286 lpszGuid = lpszEnd;
+
287
+
288 if (*lpszGuid != '-') return FALSE;
+
289 lpszGuid++;
+
290
+
291 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
+
292 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
293 g.Data3 = static_cast<unsigned short>(ulTmp);
+
294 lpszGuid = lpszEnd;
+
295
+
296 if (*lpszGuid != '-') return FALSE;
+
297 lpszGuid++;
+
298
+
299 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
+
300 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
301 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
+
302 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
+
303 lpszGuid = lpszEnd;
+
304
+
305 if (*lpszGuid != '-') return FALSE;
+
306 lpszGuid++;
+
307
+
308 ullTmp = _strtoui64(lpszGuid, &lpszEnd, 16);
+
309 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
+
310 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
+
311 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
+
312 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
+
313 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
+
314 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
+
315 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
+
316 lpszGuid = lpszEnd;
+
317
+
318 if (*lpszGuid != '}') return FALSE;
+
319 lpszGuid++;
+
320
+
321 if (lpszGuidEnd)
+
322 *lpszGuidEnd = lpszGuid;
+
323
+
324 *lpGuid = g;
+
325 return TRUE;
+
326}
327
-
328 *lpGuid = g;
-
329 return TRUE;
-
330}
-
331
-
343static _Success_(return) BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd = NULL) noexcept
-
344{
-
345 GUID g;
-
346 LPWSTR lpszEnd;
-
347 unsigned long ulTmp;
-
348 unsigned long long ullTmp;
-
349
-
350 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
-
351 lpszGuid++;
+
339static _Success_(return) BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd = NULL) noexcept
+
340{
+
341 GUID g;
+
342 LPWSTR lpszEnd;
+
343 unsigned long ulTmp;
+
344 unsigned long long ullTmp;
+
345
+
346 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
+
347 lpszGuid++;
+
348
+
349 g.Data1 = wcstoul(lpszGuid, &lpszEnd, 16);
+
350 if (errno == ERANGE) return FALSE;
+
351 lpszGuid = lpszEnd;
352
-
353 g.Data1 = wcstoul(lpszGuid, &lpszEnd, 16);
-
354 if (errno == ERANGE) return FALSE;
-
355 lpszGuid = lpszEnd;
-
356
-
357 if (*lpszGuid != '-') return FALSE;
-
358 lpszGuid++;
-
359
-
360 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
-
361 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
362 g.Data2 = static_cast<unsigned short>(ulTmp);
-
363 lpszGuid = lpszEnd;
-
364
-
365 if (*lpszGuid != '-') return FALSE;
-
366 lpszGuid++;
-
367
-
368 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
-
369 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
370 g.Data3 = static_cast<unsigned short>(ulTmp);
-
371 lpszGuid = lpszEnd;
-
372
-
373 if (*lpszGuid != '-') return FALSE;
-
374 lpszGuid++;
-
375
-
376 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
-
377 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
378 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
-
379 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
-
380 lpszGuid = lpszEnd;
-
381
-
382 if (*lpszGuid != '-') return FALSE;
-
383 lpszGuid++;
-
384
-
385 ullTmp = _wcstoui64(lpszGuid, &lpszEnd, 16);
-
386 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
-
387 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
-
388 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
-
389 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
-
390 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
-
391 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
-
392 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
-
393 lpszGuid = lpszEnd;
-
394
-
395 if (*lpszGuid != '}') return FALSE;
-
396 lpszGuid++;
-
397
-
398 if (lpszGuidEnd)
-
399 *lpszGuidEnd = lpszGuid;
+
353 if (*lpszGuid != '-') return FALSE;
+
354 lpszGuid++;
+
355
+
356 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
+
357 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
358 g.Data2 = static_cast<unsigned short>(ulTmp);
+
359 lpszGuid = lpszEnd;
+
360
+
361 if (*lpszGuid != '-') return FALSE;
+
362 lpszGuid++;
+
363
+
364 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
+
365 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
366 g.Data3 = static_cast<unsigned short>(ulTmp);
+
367 lpszGuid = lpszEnd;
+
368
+
369 if (*lpszGuid != '-') return FALSE;
+
370 lpszGuid++;
+
371
+
372 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
+
373 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
374 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
+
375 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
+
376 lpszGuid = lpszEnd;
+
377
+
378 if (*lpszGuid != '-') return FALSE;
+
379 lpszGuid++;
+
380
+
381 ullTmp = _wcstoui64(lpszGuid, &lpszEnd, 16);
+
382 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
+
383 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
+
384 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
+
385 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
+
386 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
+
387 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
+
388 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
+
389 lpszGuid = lpszEnd;
+
390
+
391 if (*lpszGuid != '}') return FALSE;
+
392 lpszGuid++;
+
393
+
394 if (lpszGuidEnd)
+
395 *lpszGuidEnd = lpszGuid;
+
396
+
397 *lpGuid = g;
+
398 return TRUE;
+
399}
400
-
401 *lpGuid = g;
-
402 return TRUE;
-
403}
-
404
-
406#ifdef _UNICODE
-
407#define StringToGuid StringToGuidW
-
408#else
-
409#define StringToGuid StringToGuidA
-
410#endif
-
411
-
430template<class _Traits, class _Ax>
-
431static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
-
432{
-
433 LSTATUS lResult;
-
434 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
435 DWORD dwSize = sizeof(aStackBuffer), dwType;
-
436
-
437 // Try with stack buffer first.
-
438 lResult = ::RegQueryValueExA(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
-
439 if (lResult == ERROR_SUCCESS) {
-
440 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
441 // The value is REG_SZ or REG_MULTI_SZ.
-
442 dwSize /= sizeof(CHAR);
-
443 sValue.assign(reinterpret_cast<LPCSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
-
444 } else if (dwType == REG_EXPAND_SZ) {
-
445 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
-
446 if (::ExpandEnvironmentStringsA(reinterpret_cast<LPCSTR>(aStackBuffer), sValue) == 0)
-
447 lResult = ::GetLastError();
-
448 } else {
-
449 // The value is not a string type.
-
450 lResult = ERROR_INVALID_DATA;
-
451 }
-
452 } else if (lResult == ERROR_MORE_DATA) {
-
453 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
454 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
-
455 std::unique_ptr<CHAR[]> szBuffer(new CHAR[dwSize / sizeof(CHAR)]);
-
456 if ((lResult = ::RegQueryValueExA(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
457 dwSize /= sizeof(CHAR);
-
458 sValue.assign(szBuffer.get(), dwSize && szBuffer[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
-
459 }
-
460 } else if (dwType == REG_EXPAND_SZ) {
-
461 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
-
462 std::unique_ptr<CHAR[]> szBuffer(new CHAR[dwSize / sizeof(CHAR)]);
-
463 if ((lResult = ::RegQueryValueExA(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
464 if (::ExpandEnvironmentStringsA(szBuffer.get(), sValue) == 0)
-
465 lResult = ::GetLastError();
-
466 }
-
467 } else {
-
468 // The value is not a string type.
-
469 lResult = ERROR_INVALID_DATA;
-
470 }
-
471 }
-
472
-
473 return lResult;
-
474}
-
475
-
494template<class _Traits, class _Ax>
-
495static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCWSTR pszName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
-
496{
-
497 LSTATUS lResult;
-
498 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
499 DWORD dwSize = sizeof(aStackBuffer), dwType;
-
500
-
501 // Try with stack buffer first.
-
502 lResult = ::RegQueryValueExW(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
-
503 if (lResult == ERROR_SUCCESS) {
-
504 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
505 // The value is REG_SZ or REG_MULTI_SZ.
-
506 dwSize /= sizeof(WCHAR);
-
507 sValue.assign(reinterpret_cast<LPCWSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCWSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
-
508 } else if (dwType == REG_EXPAND_SZ) {
-
509 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
-
510 if (::ExpandEnvironmentStringsW(reinterpret_cast<LPCWSTR>(aStackBuffer), sValue) == 0)
-
511 lResult = ::GetLastError();
-
512 } else {
-
513 // The value is not a string type.
-
514 lResult = ERROR_INVALID_DATA;
-
515 }
-
516 } else if (lResult == ERROR_MORE_DATA) {
-
517 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
518 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
-
519 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[dwSize / sizeof(WCHAR)]);
-
520 if ((lResult = ::RegQueryValueExW(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
521 dwSize /= sizeof(WCHAR);
-
522 sValue.assign(szBuffer.get(), dwSize && szBuffer[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
-
523 }
-
524 } else if (dwType == REG_EXPAND_SZ) {
-
525 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
-
526 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[dwSize / sizeof(WCHAR)]);
-
527 if ((lResult = ::RegQueryValueExW(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
528 if (::ExpandEnvironmentStringsW(szBuffer.get(), sValue) == 0)
-
529 lResult = ::GetLastError();
-
530 }
-
531 } else {
-
532 // The value is not a string type.
-
533 lResult = ERROR_INVALID_DATA;
-
534 }
-
535 }
-
536
-
537 return lResult;
-
538}
-
539
-
541template<class _Ty, class _Ax>
-
542static LSTATUS RegQueryValueExA(_In_ HKEY hKey, _In_opt_z_ LPCSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
-
543{
-
544 LSTATUS lResult;
-
545 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
546 DWORD dwSize = sizeof(aStackBuffer);
-
547
-
548 // Try with stack buffer first.
-
549 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
-
550 if (lResult == ERROR_SUCCESS) {
-
551 // Copy from stack buffer.
+
402#ifdef _UNICODE
+
403#define StringToGuid StringToGuidW
+
404#else
+
405#define StringToGuid StringToGuidA
+
406#endif
+
407
+
426template<class _Traits, class _Ax>
+
427static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
+
428{
+
429 LSTATUS lResult;
+
430 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
431 DWORD dwSize = sizeof(aStackBuffer), dwType;
+
432
+
433 // Try with stack buffer first.
+
434 lResult = ::RegQueryValueExA(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
+
435 if (lResult == ERROR_SUCCESS) {
+
436 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
437 // The value is REG_SZ or REG_MULTI_SZ.
+
438 dwSize /= sizeof(CHAR);
+
439 sValue.assign(reinterpret_cast<LPCSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
440 } else if (dwType == REG_EXPAND_SZ) {
+
441 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
+
442 if (::ExpandEnvironmentStringsA(reinterpret_cast<LPCSTR>(aStackBuffer), sValue) == 0)
+
443 lResult = ::GetLastError();
+
444 } else {
+
445 // The value is not a string type.
+
446 lResult = ERROR_INVALID_DATA;
+
447 }
+
448 } else if (lResult == ERROR_MORE_DATA) {
+
449 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
450 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
+
451 std::unique_ptr<CHAR[]> szBuffer(new CHAR[dwSize / sizeof(CHAR)]);
+
452 if ((lResult = ::RegQueryValueExA(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
+
453 dwSize /= sizeof(CHAR);
+
454 sValue.assign(szBuffer.get(), dwSize && szBuffer[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
455 }
+
456 } else if (dwType == REG_EXPAND_SZ) {
+
457 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
+
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 if (::ExpandEnvironmentStringsA(szBuffer.get(), sValue) == 0)
+
461 lResult = ::GetLastError();
+
462 }
+
463 } else {
+
464 // The value is not a string type.
+
465 lResult = ERROR_INVALID_DATA;
+
466 }
+
467 }
+
468
+
469 return lResult;
+
470}
+
471
+
490template<class _Traits, class _Ax>
+
491static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCWSTR pszName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
+
492{
+
493 LSTATUS lResult;
+
494 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
495 DWORD dwSize = sizeof(aStackBuffer), dwType;
+
496
+
497 // Try with stack buffer first.
+
498 lResult = ::RegQueryValueExW(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
+
499 if (lResult == ERROR_SUCCESS) {
+
500 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
501 // The value is REG_SZ or REG_MULTI_SZ.
+
502 dwSize /= sizeof(WCHAR);
+
503 sValue.assign(reinterpret_cast<LPCWSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCWSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
504 } else if (dwType == REG_EXPAND_SZ) {
+
505 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
+
506 if (::ExpandEnvironmentStringsW(reinterpret_cast<LPCWSTR>(aStackBuffer), sValue) == 0)
+
507 lResult = ::GetLastError();
+
508 } else {
+
509 // The value is not a string type.
+
510 lResult = ERROR_INVALID_DATA;
+
511 }
+
512 } else if (lResult == ERROR_MORE_DATA) {
+
513 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
514 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
+
515 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[dwSize / sizeof(WCHAR)]);
+
516 if ((lResult = ::RegQueryValueExW(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
+
517 dwSize /= sizeof(WCHAR);
+
518 sValue.assign(szBuffer.get(), dwSize && szBuffer[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
519 }
+
520 } else if (dwType == REG_EXPAND_SZ) {
+
521 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
+
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 if (::ExpandEnvironmentStringsW(szBuffer.get(), sValue) == 0)
+
525 lResult = ::GetLastError();
+
526 }
+
527 } else {
+
528 // The value is not a string type.
+
529 lResult = ERROR_INVALID_DATA;
+
530 }
+
531 }
+
532
+
533 return lResult;
+
534}
+
535
+
537template<class _Ty, class _Ax>
+
538static LSTATUS RegQueryValueExA(_In_ HKEY hKey, _In_opt_z_ LPCSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
+
539{
+
540 LSTATUS lResult;
+
541 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
542 DWORD dwSize = sizeof(aStackBuffer);
+
543
+
544 // Try with stack buffer first.
+
545 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
+
546 if (lResult == ERROR_SUCCESS) {
+
547 // Copy from stack buffer.
+
548 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
549 memcpy(aData.data(), aStackBuffer, dwSize);
+
550 } else if (lResult == ERROR_MORE_DATA) {
+
551 // Allocate buffer on heap and retry.
552 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
553 memcpy(aData.data(), aStackBuffer, dwSize);
-
554 } else if (lResult == ERROR_MORE_DATA) {
-
555 // Allocate buffer on heap and retry.
-
556 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
557 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, NULL, aData.data(), &dwSize);
-
558 }
-
559
-
560 return lResult;
-
561}
-
562
-
568template<class _Ty, class _Ax>
-
569static LSTATUS RegQueryValueExW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
-
570{
-
571 LSTATUS lResult;
-
572 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
573 DWORD dwSize = sizeof(aStackBuffer);
-
574
-
575 // Try with stack buffer first.
-
576 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
-
577 if (lResult == ERROR_SUCCESS) {
-
578 // Copy from stack buffer.
+
553 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, NULL, aData.data(), &dwSize);
+
554 }
+
555
+
556 return lResult;
+
557}
+
558
+
564template<class _Ty, class _Ax>
+
565static LSTATUS RegQueryValueExW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
+
566{
+
567 LSTATUS lResult;
+
568 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
569 DWORD dwSize = sizeof(aStackBuffer);
+
570
+
571 // Try with stack buffer first.
+
572 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
+
573 if (lResult == ERROR_SUCCESS) {
+
574 // Copy from stack buffer.
+
575 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
576 memcpy(aData.data(), aStackBuffer, dwSize);
+
577 } else if (lResult == ERROR_MORE_DATA) {
+
578 // Allocate buffer on heap and retry.
579 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
580 memcpy(aData.data(), aStackBuffer, dwSize);
-
581 } else if (lResult == ERROR_MORE_DATA) {
-
582 // Allocate buffer on heap and retry.
-
583 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
584 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, NULL, aData.data(), &dwSize);
-
585 }
-
586
-
587 return lResult;
-
588}
-
589
-
590#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
-
591
-
593template<class _Traits, class _Ax>
-
594static 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
-
595{
-
596 // According to "Remarks" section in MSDN documentation of RegLoadMUIString(),
-
597 // this function is defined but not implemented as ANSI variation.
-
598 assert(0);
-
599 return ERROR_CALL_NOT_IMPLEMENTED;
-
600}
-
601
-
607template<class _Traits, class _Ax>
-
608static 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
-
609{
-
610 LSTATUS lResult;
-
611 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
612 DWORD dwSize;
-
613
-
614 Flags &= ~REG_MUI_STRING_TRUNCATE;
-
615
-
616 // Try with stack buffer first.
-
617 lResult = RegLoadMUIStringW(hKey, pszValue, szStackBuffer, sizeof(szStackBuffer), &dwSize, Flags, pszDirectory);
-
618 if (lResult == ERROR_SUCCESS) {
-
619 // Copy from stack buffer.
-
620 sOut.assign(szStackBuffer, wcsnlen(szStackBuffer, dwSize/sizeof(wchar_t)));
-
621 } else if (lResult == ERROR_MORE_DATA) {
-
622 // Allocate buffer on heap and retry.
-
623 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[(dwSize + sizeof(wchar_t) - 1)/sizeof(wchar_t)]);
-
624 sOut.assign(szBuffer.get(), (lResult = RegLoadMUIStringW(hKey, pszValue, szBuffer.get(), dwSize, &dwSize, Flags, pszDirectory)) == ERROR_SUCCESS ? wcsnlen(szBuffer.get(), dwSize/sizeof(wchar_t)) : 0);
-
625 }
-
626
-
627 return lResult;
-
628}
-
629
-
630#endif
-
631
-
637template<class _Traits, class _Ax>
-
638static _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
-
639{
-
640 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
641
-
642 // Try to convert to stack buffer first.
-
643 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
644 if (cch) {
-
645 // Copy from stack. Be careful not to include zero terminator.
-
646 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
647 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
648 // Query the required output size. Allocate buffer. Then convert again.
-
649 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
650 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
651 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
652 sMultiByteStr.assign(szBuffer.get(), cchWideChar != -1 ? strnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
653 }
-
654
-
655 return cch;
-
656}
-
657
-
663template<class _Ax>
-
664static _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
-
665{
-
666 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
667
-
668 // Try to convert to stack buffer first.
-
669 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
670 if (cch) {
-
671 // Copy from stack.
-
672 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
-
673 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
674 // Query the required output size. Allocate buffer. Then convert again.
-
675 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
676 sMultiByteStr.resize(cch);
-
677 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
-
678 }
-
679
-
680 return cch;
-
681}
-
682
-
688template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
689static _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
-
690{
-
691 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
692
-
693 // Try to convert to stack buffer first.
-
694 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
695 if (cch) {
-
696 // Copy from stack.
-
697 sMultiByteStr.assign(szStackBuffer, cch);
-
698 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
699 // Query the required output size. Allocate buffer. Then convert again.
-
700 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
701 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
702 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
703 sMultiByteStr.assign(szBuffer.get(), cch);
-
704 }
-
705
-
706 return cch;
-
707}
-
708
-
716template<class _Traits, class _Ax>
-
717static _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
-
718{
-
719 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
720
-
721 // Try to convert to stack buffer first.
-
722 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
723 if (cch) {
-
724 // Copy from stack. Be careful not to include zero terminator.
-
725 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
726 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
727 // Query the required output size. Allocate buffer. Then convert again.
-
728 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
729 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
730 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
731 sMultiByteStr.assign(szBuffer.get(), cchWideChar != -1 ? strnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
732 SecureZeroMemory(szBuffer.get(), sizeof(CHAR)*cch);
-
733 }
-
734
-
735 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
736
-
737 return cch;
-
738}
-
739
-
747template<class _Ax>
-
748static _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
-
749{
-
750 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
751
-
752 // Try to convert to stack buffer first.
-
753 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
754 if (cch) {
-
755 // Copy from stack.
-
756 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
-
757 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
758 // Query the required output size. Allocate buffer. Then convert again.
-
759 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
760 sMultiByteStr.resize(cch);
-
761 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
-
762 }
-
763
-
764 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
765
-
766 return cch;
-
767}
-
768
-
776template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
777static _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
-
778{
-
779 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
780
-
781 // Try to convert to stack buffer first.
-
782 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
783 if (cch) {
-
784 // Copy from stack.
-
785 sMultiByteStr.assign(szStackBuffer, cch);
-
786 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
787 // Query the required output size. Allocate buffer. Then convert again.
-
788 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
789 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
790 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
791 sMultiByteStr.assign(szBuffer.get(), cch);
-
792 SecureZeroMemory(szBuffer.get(), sizeof(CHAR)*cch);
-
793 }
-
794
-
795 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
796
-
797 return cch;
-
798}
-
799
-
805template<class _Traits, class _Ax>
-
806static _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
-
807{
-
808 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
809
-
810 // Try to convert to stack buffer first.
-
811 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
812 if (cch) {
-
813 // Copy from stack.
-
814 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
815 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
816 // Query the required output size. Allocate buffer. Then convert again.
-
817 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
818 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
819 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szBuffer.get(), cch);
-
820 sWideCharStr.assign(szBuffer.get(), cbMultiByte != -1 ? wcsnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
821 }
-
822
-
823 return cch;
-
824}
-
825
-
831template<class _Ax>
-
832static _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
-
833{
-
834 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
835
-
836 // Try to convert to stack buffer first.
-
837 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
838 if (cch) {
-
839 // Copy from stack.
-
840 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
-
841 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
842 // Query the required output size. Allocate buffer. Then convert again.
-
843 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
844 sWideCharStr.resize(cch);
-
845 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
-
846 }
-
847
-
848 return cch;
-
849}
-
850
-
856template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
857static _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
-
858{
-
859 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
860
-
861 // Try to convert to stack buffer first.
-
862 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
-
863 if (cch) {
-
864 // Copy from stack.
-
865 sWideCharStr.assign(szStackBuffer, cch);
-
866 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
867 // Query the required output size. Allocate buffer. Then convert again.
-
868 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
-
869 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
870 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szBuffer.get(), cch);
-
871 sWideCharStr.assign(szBuffer.get(), cch);
-
872 }
-
873
-
874 return cch;
-
875}
-
876
-
884template<class _Traits, class _Ax>
-
885static _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
-
886{
-
887 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
888
-
889 // Try to convert to stack buffer first.
-
890 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
891 if (cch) {
-
892 // Copy from stack.
-
893 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
894 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
895 // Query the required output size. Allocate buffer. Then convert again.
-
896 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
897 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
898 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szBuffer.get(), cch);
-
899 sWideCharStr.assign(szBuffer.get(), cbMultiByte != -1 ? wcsnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
900 SecureZeroMemory(szBuffer.get(), sizeof(WCHAR)*cch);
-
901 }
-
902
-
903 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
904
-
905 return cch;
-
906}
-
907
-
915template<class _Ax>
-
916static _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
-
917{
-
918 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
919
-
920 // Try to convert to stack buffer first.
-
921 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
922 if (cch) {
-
923 // Copy from stack.
-
924 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
-
925 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
926 // Query the required output size. Allocate buffer. Then convert again.
-
927 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
928 sWideCharStr.resize(cch);
-
929 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
-
930 }
-
931
-
932 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
933
-
934 return cch;
-
935}
-
936
-
944template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
945static _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
-
946{
-
947 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
948
-
949 // Try to convert to stack buffer first.
-
950 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
-
951 if (cch) {
-
952 // Copy from stack.
-
953 sWideCharStr.assign(szStackBuffer, cch);
-
954 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
955 // Query the required output size. Allocate buffer. Then convert again.
-
956 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
-
957 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
958 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szBuffer.get(), cch);
-
959 sWideCharStr.assign(szBuffer.get(), cch);
-
960 SecureZeroMemory(szBuffer.get(), sizeof(WCHAR)*cch);
-
961 }
-
962
-
963 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
964
-
965 return cch;
-
966}
-
967
-
973template<class _Traits, class _Ax>
-
974static _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
-
975{
-
976 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
977
-
978 // Try to convert to stack buffer first.
-
979 int cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szStackBuffer, _countof(szStackBuffer));
-
980 if (cch > 0) {
-
981 // Copy from stack.
-
982 sDstString.assign(szStackBuffer, cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
983 } else {
-
984 switch (::GetLastError()) {
-
985 case ERROR_INSUFFICIENT_BUFFER:
-
986 for (int i = 10; i--;) {
-
987 // Allocate buffer. Then convert again.
-
988 cch = -cch;
-
989 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
990 cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szBuffer.get(), cch);
-
991 if (cch > 0) {
-
992 sDstString.assign(szBuffer.get(), cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
580 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, NULL, aData.data(), &dwSize);
+
581 }
+
582
+
583 return lResult;
+
584}
+
585
+
586#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
+
587
+
589template<class _Traits, class _Ax>
+
590static 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
+
591{
+
592 // According to "Remarks" section in MSDN documentation of RegLoadMUIString(),
+
593 // this function is defined but not implemented as ANSI variation.
+
594 assert(0);
+
595 return ERROR_CALL_NOT_IMPLEMENTED;
+
596}
+
597
+
603template<class _Traits, class _Ax>
+
604static 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
+
605{
+
606 LSTATUS lResult;
+
607 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
608 DWORD dwSize;
+
609
+
610 Flags &= ~REG_MUI_STRING_TRUNCATE;
+
611
+
612 // Try with stack buffer first.
+
613 lResult = RegLoadMUIStringW(hKey, pszValue, szStackBuffer, sizeof(szStackBuffer), &dwSize, Flags, pszDirectory);
+
614 if (lResult == ERROR_SUCCESS) {
+
615 // Copy from stack buffer.
+
616 sOut.assign(szStackBuffer, wcsnlen(szStackBuffer, dwSize/sizeof(wchar_t)));
+
617 } else if (lResult == ERROR_MORE_DATA) {
+
618 // Allocate buffer on heap and retry.
+
619 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[(dwSize + sizeof(wchar_t) - 1)/sizeof(wchar_t)]);
+
620 sOut.assign(szBuffer.get(), (lResult = RegLoadMUIStringW(hKey, pszValue, szBuffer.get(), dwSize, &dwSize, Flags, pszDirectory)) == ERROR_SUCCESS ? wcsnlen(szBuffer.get(), dwSize/sizeof(wchar_t)) : 0);
+
621 }
+
622
+
623 return lResult;
+
624}
+
625
+
626#endif
+
627
+
633template<class _Traits, class _Ax>
+
634static _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
+
635{
+
636 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
637
+
638 // Try to convert to stack buffer first.
+
639 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
640 if (cch) {
+
641 // Copy from stack. Be careful not to include zero terminator.
+
642 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
643 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
644 // Query the required output size. Allocate buffer. Then convert again.
+
645 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
646 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
+
647 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
+
648 sMultiByteStr.assign(szBuffer.get(), cchWideChar != -1 ? strnlen(szBuffer.get(), cch) : (size_t)cch - 1);
+
649 }
+
650
+
651 return cch;
+
652}
+
653
+
659template<class _Ax>
+
660static _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
+
661{
+
662 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
663
+
664 // Try to convert to stack buffer first.
+
665 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
666 if (cch) {
+
667 // Copy from stack.
+
668 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
+
669 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
670 // Query the required output size. Allocate buffer. Then convert again.
+
671 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
672 sMultiByteStr.resize(cch);
+
673 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
+
674 }
+
675
+
676 return cch;
+
677}
+
678
+
684template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
685static _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
+
686{
+
687 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
688
+
689 // Try to convert to stack buffer first.
+
690 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
691 if (cch) {
+
692 // Copy from stack.
+
693 sMultiByteStr.assign(szStackBuffer, cch);
+
694 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
695 // Query the required output size. Allocate buffer. Then convert again.
+
696 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
697 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
+
698 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
+
699 sMultiByteStr.assign(szBuffer.get(), cch);
+
700 }
+
701
+
702 return cch;
+
703}
+
704
+
712template<class _Traits, class _Ax>
+
713static _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
+
714{
+
715 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
716
+
717 // Try to convert to stack buffer first.
+
718 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
719 if (cch) {
+
720 // Copy from stack. Be careful not to include zero terminator.
+
721 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
722 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
723 // Query the required output size. Allocate buffer. Then convert again.
+
724 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
725 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
+
726 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
+
727 sMultiByteStr.assign(szBuffer.get(), cchWideChar != -1 ? strnlen(szBuffer.get(), cch) : (size_t)cch - 1);
+
728 SecureZeroMemory(szBuffer.get(), sizeof(CHAR)*cch);
+
729 }
+
730
+
731 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
732
+
733 return cch;
+
734}
+
735
+
743template<class _Ax>
+
744static _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
+
745{
+
746 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
747
+
748 // Try to convert to stack buffer first.
+
749 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
750 if (cch) {
+
751 // Copy from stack.
+
752 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
+
753 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
754 // Query the required output size. Allocate buffer. Then convert again.
+
755 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
756 sMultiByteStr.resize(cch);
+
757 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
+
758 }
+
759
+
760 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
761
+
762 return cch;
+
763}
+
764
+
772template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
773static _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
+
774{
+
775 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
776
+
777 // Try to convert to stack buffer first.
+
778 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
779 if (cch) {
+
780 // Copy from stack.
+
781 sMultiByteStr.assign(szStackBuffer, cch);
+
782 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
783 // Query the required output size. Allocate buffer. Then convert again.
+
784 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
785 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
+
786 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
+
787 sMultiByteStr.assign(szBuffer.get(), cch);
+
788 SecureZeroMemory(szBuffer.get(), sizeof(CHAR)*cch);
+
789 }
+
790
+
791 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
792
+
793 return cch;
+
794}
+
795
+
801template<class _Traits, class _Ax>
+
802static _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
+
803{
+
804 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
805
+
806 // Try to convert to stack buffer first.
+
807 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
808 if (cch) {
+
809 // Copy from stack.
+
810 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
811 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
812 // Query the required output size. Allocate buffer. Then convert again.
+
813 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
814 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
815 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szBuffer.get(), cch);
+
816 sWideCharStr.assign(szBuffer.get(), cbMultiByte != -1 ? wcsnlen(szBuffer.get(), cch) : (size_t)cch - 1);
+
817 }
+
818
+
819 return cch;
+
820}
+
821
+
827template<class _Ax>
+
828static _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
+
829{
+
830 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
831
+
832 // Try to convert to stack buffer first.
+
833 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
834 if (cch) {
+
835 // Copy from stack.
+
836 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
+
837 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
838 // Query the required output size. Allocate buffer. Then convert again.
+
839 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
840 sWideCharStr.resize(cch);
+
841 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
+
842 }
+
843
+
844 return cch;
+
845}
+
846
+
852template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
853static _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
+
854{
+
855 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
856
+
857 // Try to convert to stack buffer first.
+
858 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
+
859 if (cch) {
+
860 // Copy from stack.
+
861 sWideCharStr.assign(szStackBuffer, cch);
+
862 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
863 // Query the required output size. Allocate buffer. Then convert again.
+
864 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
+
865 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
866 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szBuffer.get(), cch);
+
867 sWideCharStr.assign(szBuffer.get(), cch);
+
868 }
+
869
+
870 return cch;
+
871}
+
872
+
880template<class _Traits, class _Ax>
+
881static _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
+
882{
+
883 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
884
+
885 // Try to convert to stack buffer first.
+
886 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
887 if (cch) {
+
888 // Copy from stack.
+
889 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
890 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
891 // Query the required output size. Allocate buffer. Then convert again.
+
892 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
893 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
894 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szBuffer.get(), cch);
+
895 sWideCharStr.assign(szBuffer.get(), cbMultiByte != -1 ? wcsnlen(szBuffer.get(), cch) : (size_t)cch - 1);
+
896 SecureZeroMemory(szBuffer.get(), sizeof(WCHAR)*cch);
+
897 }
+
898
+
899 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
900
+
901 return cch;
+
902}
+
903
+
911template<class _Ax>
+
912static _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
+
913{
+
914 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
915
+
916 // Try to convert to stack buffer first.
+
917 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
918 if (cch) {
+
919 // Copy from stack.
+
920 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
+
921 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
922 // Query the required output size. Allocate buffer. Then convert again.
+
923 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
924 sWideCharStr.resize(cch);
+
925 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
+
926 }
+
927
+
928 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
929
+
930 return cch;
+
931}
+
932
+
940template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
941static _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
+
942{
+
943 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
944
+
945 // Try to convert to stack buffer first.
+
946 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
+
947 if (cch) {
+
948 // Copy from stack.
+
949 sWideCharStr.assign(szStackBuffer, cch);
+
950 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
951 // Query the required output size. Allocate buffer. Then convert again.
+
952 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
+
953 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
954 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szBuffer.get(), cch);
+
955 sWideCharStr.assign(szBuffer.get(), cch);
+
956 SecureZeroMemory(szBuffer.get(), sizeof(WCHAR)*cch);
+
957 }
+
958
+
959 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
960
+
961 return cch;
+
962}
+
963
+
969template<class _Traits, class _Ax>
+
970static _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
+
971{
+
972 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
973
+
974 // Try to convert to stack buffer first.
+
975 int cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szStackBuffer, _countof(szStackBuffer));
+
976 if (cch > 0) {
+
977 // Copy from stack.
+
978 sDstString.assign(szStackBuffer, cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
979 } else {
+
980 switch (::GetLastError()) {
+
981 case ERROR_INSUFFICIENT_BUFFER:
+
982 for (int i = 10; i--;) {
+
983 // Allocate buffer. Then convert again.
+
984 cch = -cch;
+
985 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
986 cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szBuffer.get(), cch);
+
987 if (cch > 0) {
+
988 sDstString.assign(szBuffer.get(), cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
989 break;
+
990 }
+
991 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+
992 sDstString.clear();
993 break;
994 }
-
995 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-
996 sDstString.clear();
-
997 break;
-
998 }
-
999 }
+
995 }
+
996 break;
+
997
+
998 case ERROR_SUCCESS:
+
999 sDstString.clear();
1000 break;
-
1001
-
1002 case ERROR_SUCCESS:
-
1003 sDstString.clear();
-
1004 break;
-
1005 }
-
1006 }
-
1007
-
1008 return cch;
-
1009}
-
1010
-
1016template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
1017static _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
-
1018{
-
1019 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
1020
-
1021 // Try to convert to stack buffer first.
-
1022 int cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), szStackBuffer, _countof(szStackBuffer));
-
1023 if (cch > 0) {
-
1024 // Copy from stack.
-
1025 sDstString.assign(szStackBuffer, cch);
-
1026 } else {
-
1027 switch (::GetLastError()) {
-
1028 case ERROR_INSUFFICIENT_BUFFER:
-
1029 for (int i = 10; i--;) {
-
1030 // Allocate buffer. Then convert again.
-
1031 cch = -cch;
-
1032 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
1033 cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), szBuffer.get(), cch);
-
1034 if (cch > 0) {
-
1035 sDstString.assign(szBuffer.get(), cch);
+
1001 }
+
1002 }
+
1003
+
1004 return cch;
+
1005}
+
1006
+
1012template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
1013static _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
+
1014{
+
1015 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
1016
+
1017 // Try to convert to stack buffer first.
+
1018 int cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), szStackBuffer, _countof(szStackBuffer));
+
1019 if (cch > 0) {
+
1020 // Copy from stack.
+
1021 sDstString.assign(szStackBuffer, cch);
+
1022 } else {
+
1023 switch (::GetLastError()) {
+
1024 case ERROR_INSUFFICIENT_BUFFER:
+
1025 for (int i = 10; i--;) {
+
1026 // Allocate buffer. Then convert again.
+
1027 cch = -cch;
+
1028 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
1029 cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), szBuffer.get(), cch);
+
1030 if (cch > 0) {
+
1031 sDstString.assign(szBuffer.get(), cch);
+
1032 break;
+
1033 }
+
1034 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+
1035 sDstString.clear();
1036 break;
1037 }
-
1038 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-
1039 sDstString.clear();
-
1040 break;
-
1041 }
-
1042 }
+
1038 }
+
1039 break;
+
1040
+
1041 case ERROR_SUCCESS:
+
1042 sDstString.clear();
1043 break;
-
1044
-
1045 case ERROR_SUCCESS:
-
1046 sDstString.clear();
-
1047 break;
-
1048 }
-
1049 }
-
1050
-
1051 return cch;
-
1052}
-
1053
-
1055template<class _Traits, class _Ax>
-
1056static _Success_(return != 0) int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<char, _Traits, _Ax> &sBuffer) noexcept
-
1057{
-
1058 // Get read-only pointer to string resource.
-
1059 LPCSTR pszStr;
-
1060 int i = LoadStringA(hInstance, uID, reinterpret_cast<LPSTR>(&pszStr), 0);
-
1061 if (i) {
-
1062 sBuffer.assign(pszStr, i);
-
1063 return i;
-
1064 } else
-
1065 return 0;
-
1066}
-
1067
-
1073template<class _Traits, class _Ax>
-
1074static _Success_(return != 0) int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sBuffer) noexcept
-
1075{
-
1076 // Get read-only pointer to string resource.
-
1077 LPCWSTR pszStr;
-
1078 int i = LoadStringW(hInstance, uID, reinterpret_cast<LPWSTR>(&pszStr), 0);
-
1079 if (i) {
-
1080 sBuffer.assign(pszStr, i);
-
1081 return i;
-
1082 } else
-
1083 return 0;
-
1084}
-
1085
-
1091static VOID OutputDebugStrV(_In_z_ LPCSTR lpOutputString, _In_ va_list arg) noexcept
-
1092{
-
1093 std::string str;
-
1094 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
-
1095 OutputDebugStringA(str.c_str());
-
1096}
-
1097
-
1103static VOID OutputDebugStrV(_In_z_ LPCWSTR lpOutputString, _In_ va_list arg) noexcept
-
1104{
-
1105 std::wstring str;
-
1106 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
-
1107 OutputDebugStringW(str.c_str());
-
1108}
-
1109
-
1115static VOID OutputDebugStr(_In_z_ LPCSTR lpOutputString, ...) noexcept
-
1116{
-
1117 va_list arg;
-
1118 va_start(arg, lpOutputString);
-
1119 OutputDebugStrV(lpOutputString, arg);
-
1120 va_end(arg);
-
1121}
-
1122
-
1128static VOID OutputDebugStr(_In_z_ LPCWSTR lpOutputString, ...) noexcept
-
1129{
-
1130 va_list arg;
-
1131 va_start(arg, lpOutputString);
-
1132 OutputDebugStrV(lpOutputString, arg);
-
1133 va_end(arg);
-
1134}
-
1135
-
1137template<class _Traits, class _Ax>
-
1138static _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
-
1139{
-
1140 int iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
-
1141 if (iResult) {
-
1142 // Allocate buffer on heap and retry.
-
1143 std::unique_ptr<char[]> szBuffer(new char[iResult]);
-
1144 iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, szBuffer.get(), iResult);
-
1145 sDate.assign(szBuffer.get(), iResult ? iResult - 1 : 0);
-
1146 return iResult;
-
1147 }
-
1148
-
1149 return iResult;
-
1150}
-
1151
-
1157template<class _Traits, class _Ax>
-
1158static _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
-
1159{
-
1160 int iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
-
1161 if (iResult) {
-
1162 // Allocate buffer on heap and retry.
-
1163 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[iResult]);
-
1164 iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, szBuffer.get(), iResult);
-
1165 sDate.assign(szBuffer.get(), iResult ? iResult - 1 : 0);
-
1166 return iResult;
-
1167 }
-
1168
-
1169 return iResult;
-
1170}
-
1171
-
1173template<class _Traits, class _Ax>
-
1174static _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
-
1175{
-
1176 assert(0); // TODO: Test this code.
-
1177
-
1178 DWORD dwNameLen = 0, dwRefDomainLen = 0;
-
1179
-
1180 if (LookupAccountSidA(lpSystemName, lpSid,
-
1181 NULL, &dwNameLen ,
-
1182 NULL, &dwRefDomainLen,
-
1183 peUse))
-
1184 {
-
1185 // Name and domain is blank.
-
1186 if (sName ) sName ->clear();
-
1187 if (sReferencedDomainName) sReferencedDomainName->clear();
-
1188 return TRUE;
-
1189 } else if (GetLastError() == ERROR_MORE_DATA) {
-
1190 // Allocate on heap and retry.
-
1191 std::unique_ptr<char[]> bufName (new char[dwNameLen ]);
-
1192 std::unique_ptr<char[]> bufRefDomain(new char[dwRefDomainLen]);
-
1193 if (LookupAccountSidA(lpSystemName, lpSid,
-
1194 bufName .get(), &dwNameLen ,
-
1195 bufRefDomain.get(), &dwRefDomainLen,
-
1196 peUse))
-
1197 {
-
1198 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
-
1199 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
-
1200 return TRUE;
-
1201 }
-
1202 }
-
1203
-
1204 return FALSE;
-
1205}
-
1206
-
1212template<class _Traits, class _Ax>
-
1213static _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
-
1214{
-
1215 assert(0); // TODO: Test this code.
-
1216
-
1217 DWORD dwNameLen = 0, dwRefDomainLen = 0;
-
1218
-
1219 if (LookupAccountSidW(lpSystemName, lpSid,
-
1220 NULL, &dwNameLen ,
-
1221 NULL, &dwRefDomainLen,
-
1222 peUse))
-
1223 {
-
1224 // Name and domain is blank.
-
1225 if (sName ) sName ->clear();
-
1226 if (sReferencedDomainName) sReferencedDomainName->clear();
-
1227 return TRUE;
-
1228 } else if (GetLastError() == ERROR_MORE_DATA) {
-
1229 // Allocate on heap and retry.
-
1230 std::unique_ptr<wchar_t[]> bufName (new wchar_t[dwNameLen ]);
-
1231 std::unique_ptr<wchar_t[]> bufRefDomain(new wchar_t[dwRefDomainLen]);
-
1232 if (LookupAccountSidW(lpSystemName, lpSid,
-
1233 bufName .get(), &dwNameLen ,
-
1234 bufRefDomain.get(), &dwRefDomainLen,
-
1235 peUse))
-
1236 {
-
1237 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
-
1238 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
-
1239 return TRUE;
-
1240 }
-
1241 }
-
1242
-
1243 return FALSE;
-
1244}
-
1245
-
1251template<class _Ty>
-
1252static _Success_(return != 0) BOOL GetTokenInformation(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_ std::unique_ptr<_Ty> &TokenInformation) noexcept
-
1253{
-
1254 BYTE szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(BYTE)];
-
1255 DWORD dwSize;
-
1256
-
1257 if (GetTokenInformation(TokenHandle, TokenInformationClass, szStackBuffer, sizeof(szStackBuffer), &dwSize)) {
-
1258 // The stack buffer was big enough to retrieve complete data. Alloc and copy.
-
1259 TokenInformation.reset((_Ty*)(new BYTE[dwSize / sizeof(BYTE)]));
-
1260 if (!TokenInformation) {
-
1261 SetLastError(ERROR_OUTOFMEMORY);
-
1262 return FALSE;
-
1263 }
-
1264 memcpy(TokenInformation.get(), szStackBuffer, dwSize);
-
1265 return TRUE;
-
1266 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
1267 // The stack buffer was too small to retrieve complete data. Alloc and retry.
-
1268 TokenInformation.reset((_Ty*)(new BYTE[dwSize / sizeof(BYTE)]));
-
1269 if (!TokenInformation) {
-
1270 SetLastError(ERROR_OUTOFMEMORY);
-
1271 return FALSE;
-
1272 }
-
1273 return GetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation.get(), dwSize, &dwSize);
-
1274 } else
-
1275 return FALSE;
-
1276}
-
1277
-
1283template<class _Traits, class _Ax>
-
1284static _Success_(return != 0) BOOL QueryFullProcessImageNameA(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<char, _Traits, _Ax>& sExeName)
-
1285{
-
1286 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(char)];
-
1287 DWORD dwSize = _countof(szStackBuffer);
-
1288
-
1289 // Try with stack buffer first.
-
1290 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szStackBuffer, &dwSize)) {
-
1291 // Copy from stack.
-
1292 sExeName.assign(szStackBuffer, dwSize);
-
1293 return TRUE;
-
1294 }
-
1295 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(char); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
-
1296 // Allocate on heap and retry.
-
1297 std::unique_ptr<char[]> szBuffer(new char[dwCapacity]);
-
1298 dwSize = dwCapacity;
-
1299 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szBuffer.get(), &dwSize)) {
-
1300 sExeName.assign(szBuffer.get(), dwSize);
-
1301 return TRUE;
-
1302 }
-
1303 }
-
1304 return FALSE;
-
1305}
-
1306
-
1312template<class _Traits, class _Ax>
-
1313static _Success_(return != 0) BOOL QueryFullProcessImageNameW(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<wchar_t, _Traits, _Ax>& sExeName)
-
1314{
-
1315 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t)];
-
1316 DWORD dwSize = _countof(szStackBuffer);
-
1317
-
1318 // Try with stack buffer first.
-
1319 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szStackBuffer, &dwSize)) {
-
1320 // Copy from stack.
-
1321 sExeName.assign(szStackBuffer, dwSize);
-
1322 return TRUE;
-
1323 }
-
1324 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
-
1325 // Allocate on heap and retry.
-
1326 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwCapacity]);
-
1327 dwSize = dwCapacity;
-
1328 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szBuffer.get(), &dwSize)) {
-
1329 sExeName.assign(szBuffer.get(), dwSize);
-
1330 return TRUE;
-
1331 }
-
1332 }
-
1333 return FALSE;
-
1334}
+
1044 }
+
1045 }
+
1046
+
1047 return cch;
+
1048}
+
1049
+
1051template<class _Traits, class _Ax>
+
1052static _Success_(return != 0) int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<char, _Traits, _Ax> &sBuffer) noexcept
+
1053{
+
1054 // Get read-only pointer to string resource.
+
1055 LPCSTR pszStr;
+
1056 int i = LoadStringA(hInstance, uID, reinterpret_cast<LPSTR>(&pszStr), 0);
+
1057 if (i) {
+
1058 sBuffer.assign(pszStr, i);
+
1059 return i;
+
1060 } else
+
1061 return 0;
+
1062}
+
1063
+
1069template<class _Traits, class _Ax>
+
1070static _Success_(return != 0) int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sBuffer) noexcept
+
1071{
+
1072 // Get read-only pointer to string resource.
+
1073 LPCWSTR pszStr;
+
1074 int i = LoadStringW(hInstance, uID, reinterpret_cast<LPWSTR>(&pszStr), 0);
+
1075 if (i) {
+
1076 sBuffer.assign(pszStr, i);
+
1077 return i;
+
1078 } else
+
1079 return 0;
+
1080}
+
1081
+
1087static VOID OutputDebugStrV(_In_z_ LPCSTR lpOutputString, _In_ va_list arg) noexcept
+
1088{
+
1089 std::string str;
+
1090 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
+
1091 OutputDebugStringA(str.c_str());
+
1092}
+
1093
+
1099static VOID OutputDebugStrV(_In_z_ LPCWSTR lpOutputString, _In_ va_list arg) noexcept
+
1100{
+
1101 std::wstring str;
+
1102 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
+
1103 OutputDebugStringW(str.c_str());
+
1104}
+
1105
+
1111static VOID OutputDebugStr(_In_z_ LPCSTR lpOutputString, ...) noexcept
+
1112{
+
1113 va_list arg;
+
1114 va_start(arg, lpOutputString);
+
1115 OutputDebugStrV(lpOutputString, arg);
+
1116 va_end(arg);
+
1117}
+
1118
+
1124static VOID OutputDebugStr(_In_z_ LPCWSTR lpOutputString, ...) noexcept
+
1125{
+
1126 va_list arg;
+
1127 va_start(arg, lpOutputString);
+
1128 OutputDebugStrV(lpOutputString, arg);
+
1129 va_end(arg);
+
1130}
+
1131
+
1133template<class _Traits, class _Ax>
+
1134static _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
+
1135{
+
1136 int iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
+
1137 if (iResult) {
+
1138 // Allocate buffer on heap and retry.
+
1139 std::unique_ptr<char[]> szBuffer(new char[iResult]);
+
1140 iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, szBuffer.get(), iResult);
+
1141 sDate.assign(szBuffer.get(), iResult ? iResult - 1 : 0);
+
1142 return iResult;
+
1143 }
+
1144
+
1145 return iResult;
+
1146}
+
1147
+
1153template<class _Traits, class _Ax>
+
1154static _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
+
1155{
+
1156 int iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
+
1157 if (iResult) {
+
1158 // Allocate buffer on heap and retry.
+
1159 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[iResult]);
+
1160 iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, szBuffer.get(), iResult);
+
1161 sDate.assign(szBuffer.get(), iResult ? iResult - 1 : 0);
+
1162 return iResult;
+
1163 }
+
1164
+
1165 return iResult;
+
1166}
+
1167
+
1169template<class _Traits, class _Ax>
+
1170static _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
+
1171{
+
1172 assert(0); // TODO: Test this code.
+
1173
+
1174 DWORD dwNameLen = 0, dwRefDomainLen = 0;
+
1175
+
1176 if (LookupAccountSidA(lpSystemName, lpSid,
+
1177 NULL, &dwNameLen ,
+
1178 NULL, &dwRefDomainLen,
+
1179 peUse))
+
1180 {
+
1181 // Name and domain is blank.
+
1182 if (sName ) sName ->clear();
+
1183 if (sReferencedDomainName) sReferencedDomainName->clear();
+
1184 return TRUE;
+
1185 } else if (GetLastError() == ERROR_MORE_DATA) {
+
1186 // Allocate on heap and retry.
+
1187 std::unique_ptr<char[]> bufName (new char[dwNameLen ]);
+
1188 std::unique_ptr<char[]> bufRefDomain(new char[dwRefDomainLen]);
+
1189 if (LookupAccountSidA(lpSystemName, lpSid,
+
1190 bufName .get(), &dwNameLen ,
+
1191 bufRefDomain.get(), &dwRefDomainLen,
+
1192 peUse))
+
1193 {
+
1194 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
+
1195 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
+
1196 return TRUE;
+
1197 }
+
1198 }
+
1199
+
1200 return FALSE;
+
1201}
+
1202
+
1208template<class _Traits, class _Ax>
+
1209static _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
+
1210{
+
1211 assert(0); // TODO: Test this code.
+
1212
+
1213 DWORD dwNameLen = 0, dwRefDomainLen = 0;
+
1214
+
1215 if (LookupAccountSidW(lpSystemName, lpSid,
+
1216 NULL, &dwNameLen ,
+
1217 NULL, &dwRefDomainLen,
+
1218 peUse))
+
1219 {
+
1220 // Name and domain is blank.
+
1221 if (sName ) sName ->clear();
+
1222 if (sReferencedDomainName) sReferencedDomainName->clear();
+
1223 return TRUE;
+
1224 } else if (GetLastError() == ERROR_MORE_DATA) {
+
1225 // Allocate on heap and retry.
+
1226 std::unique_ptr<wchar_t[]> bufName (new wchar_t[dwNameLen ]);
+
1227 std::unique_ptr<wchar_t[]> bufRefDomain(new wchar_t[dwRefDomainLen]);
+
1228 if (LookupAccountSidW(lpSystemName, lpSid,
+
1229 bufName .get(), &dwNameLen ,
+
1230 bufRefDomain.get(), &dwRefDomainLen,
+
1231 peUse))
+
1232 {
+
1233 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
+
1234 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
+
1235 return TRUE;
+
1236 }
+
1237 }
+
1238
+
1239 return FALSE;
+
1240}
+
1241
+
1247template<class _Ty>
+
1248static _Success_(return != 0) BOOL GetTokenInformation(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_ std::unique_ptr<_Ty> &TokenInformation) noexcept
+
1249{
+
1250 BYTE szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(BYTE)];
+
1251 DWORD dwSize;
+
1252
+
1253 if (GetTokenInformation(TokenHandle, TokenInformationClass, szStackBuffer, sizeof(szStackBuffer), &dwSize)) {
+
1254 // The stack buffer was big enough to retrieve complete data. Alloc and copy.
+
1255 TokenInformation.reset((_Ty*)(new BYTE[dwSize / sizeof(BYTE)]));
+
1256 if (!TokenInformation) {
+
1257 SetLastError(ERROR_OUTOFMEMORY);
+
1258 return FALSE;
+
1259 }
+
1260 memcpy(TokenInformation.get(), szStackBuffer, dwSize);
+
1261 return TRUE;
+
1262 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
1263 // The stack buffer was too small to retrieve complete data. Alloc and retry.
+
1264 TokenInformation.reset((_Ty*)(new BYTE[dwSize / sizeof(BYTE)]));
+
1265 if (!TokenInformation) {
+
1266 SetLastError(ERROR_OUTOFMEMORY);
+
1267 return FALSE;
+
1268 }
+
1269 return GetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation.get(), dwSize, &dwSize);
+
1270 } else
+
1271 return FALSE;
+
1272}
+
1273
+
1279template<class _Traits, class _Ax>
+
1280static _Success_(return != 0) BOOL QueryFullProcessImageNameA(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<char, _Traits, _Ax>& sExeName)
+
1281{
+
1282 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(char)];
+
1283 DWORD dwSize = _countof(szStackBuffer);
+
1284
+
1285 // Try with stack buffer first.
+
1286 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szStackBuffer, &dwSize)) {
+
1287 // Copy from stack.
+
1288 sExeName.assign(szStackBuffer, dwSize);
+
1289 return TRUE;
+
1290 }
+
1291 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(char); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
+
1292 // Allocate on heap and retry.
+
1293 std::unique_ptr<char[]> szBuffer(new char[dwCapacity]);
+
1294 dwSize = dwCapacity;
+
1295 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szBuffer.get(), &dwSize)) {
+
1296 sExeName.assign(szBuffer.get(), dwSize);
+
1297 return TRUE;
+
1298 }
+
1299 }
+
1300 return FALSE;
+
1301}
+
1302
+
1308template<class _Traits, class _Ax>
+
1309static _Success_(return != 0) BOOL QueryFullProcessImageNameW(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<wchar_t, _Traits, _Ax>& sExeName)
+
1310{
+
1311 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t)];
+
1312 DWORD dwSize = _countof(szStackBuffer);
+
1313
+
1314 // Try with stack buffer first.
+
1315 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szStackBuffer, &dwSize)) {
+
1316 // Copy from stack.
+
1317 sExeName.assign(szStackBuffer, dwSize);
+
1318 return TRUE;
+
1319 }
+
1320 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
+
1321 // Allocate on heap and retry.
+
1322 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwCapacity]);
+
1323 dwSize = dwCapacity;
+
1324 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szBuffer.get(), &dwSize)) {
+
1325 sExeName.assign(szBuffer.get(), dwSize);
+
1326 return TRUE;
+
1327 }
+
1328 }
+
1329 return FALSE;
+
1330}
+
1331
+
1333
+
1334#pragma warning(pop)
1335
-
1337
-
1338#pragma warning(pop)
-
1339
-
1340namespace winstd
-
1341{
-
1344
-
1348 template<HANDLE INVALID>
-
1349 class win_handle : public handle<HANDLE, INVALID>
-
1350 {
- -
1352
-
1353 public:
-
1359 virtual ~win_handle()
-
1360 {
-
1361 if (m_h != invalid)
-
1362 free_internal();
-
1363 }
-
1364
-
1365 protected:
-
1371 void free_internal() noexcept override
-
1372 {
-
1373 CloseHandle(m_h);
-
1374 }
-
1375 };
-
1376
-
1382 class library : public handle<HMODULE, NULL>
-
1383 {
- -
1385
-
1386 public:
-
1392 virtual ~library()
-
1393 {
-
1394 if (m_h != invalid)
-
1395 free_internal();
-
1396 }
-
1397
-
1398 protected:
-
1404 void free_internal() noexcept override
-
1405 {
-
1406 FreeLibrary(m_h);
-
1407 }
-
1408 };
-
1409
- -
1416
- -
1423
- -
1430
- -
1437
- -
1444
-
1448 template <class _Ty> struct UnmapViewOfFile_delete
-
1449 {
- -
1451
- -
1456
- -
1461
-
1465 void operator()(_Ty* _Ptr) const
-
1466 {
-
1467 if (!UnmapViewOfFile(_Ptr))
-
1468 throw win_runtime_error("UnmapViewOfFile failed");
-
1469 }
-
1470 };
-
1471
-
1475 template <class _Ty> struct UnmapViewOfFile_delete<_Ty[]>
-
1476 {
- -
1478
- -
1483
-
1487 void operator()(_Ty* _Ptr) const
-
1488 {
-
1489 if (!UnmapViewOfFile(_Ptr))
-
1490 throw win_runtime_error("UnmapViewOfFile failed");
-
1491 }
-
1492
-
1496 template<class _Other>
-
1497 void operator()(_Other*) const
-
1498 {
-
1499 if (!UnmapViewOfFile(_Ptr))
-
1500 throw win_runtime_error("UnmapViewOfFile failed");
-
1501 }
-
1502 };
-
1503
- -
1511
- -
1516 {
- - -
1519
-
1520 public:
- -
1527 {
-
1528 __try {
-
1529 InitializeCriticalSection(&m_data);
-
1530 } __except(EXCEPTION_EXECUTE_HANDLER) {
-
1531 throw std::runtime_error("InitializeCriticalSection failed");
-
1532 }
-
1533 }
-
1534
- -
1541 {
-
1542 DeleteCriticalSection(&m_data);
-
1543 }
-
1544
-
1550 operator LPCRITICAL_SECTION() noexcept
-
1551 {
-
1552 return &m_data;
-
1553 }
+
1336namespace winstd
+
1337{
+
1340
+
1344 template<HANDLE INVALID>
+
1345 class win_handle : public handle<HANDLE, INVALID>
+
1346 {
+ +
1348
+
1349 public:
+
1355 virtual ~win_handle()
+
1356 {
+
1357 if (m_h != invalid)
+
1358 free_internal();
+
1359 }
+
1360
+
1361 protected:
+
1367 void free_internal() noexcept override
+
1368 {
+
1369 CloseHandle(m_h);
+
1370 }
+
1371 };
+
1372
+
1378 class library : public handle<HMODULE, NULL>
+
1379 {
+ +
1381
+
1382 public:
+
1388 virtual ~library()
+
1389 {
+
1390 if (m_h != invalid)
+
1391 free_internal();
+
1392 }
+
1393
+
1394 protected:
+
1400 void free_internal() noexcept override
+
1401 {
+
1402 FreeLibrary(m_h);
+
1403 }
+
1404 };
+
1405
+ +
1412
+ +
1419
+ +
1426
+ +
1433
+ +
1440
+
1444 template <class _Ty> struct UnmapViewOfFile_delete
+
1445 {
+ +
1447
+ +
1452
+ +
1457
+
1461 void operator()(_Ty* _Ptr) const
+
1462 {
+
1463 if (!UnmapViewOfFile(_Ptr))
+
1464 throw win_runtime_error("UnmapViewOfFile failed");
+
1465 }
+
1466 };
+
1467
+
1471 template <class _Ty> struct UnmapViewOfFile_delete<_Ty[]>
+
1472 {
+ +
1474
+ +
1479
+
1483 void operator()(_Ty* _Ptr) const
+
1484 {
+
1485 if (!UnmapViewOfFile(_Ptr))
+
1486 throw win_runtime_error("UnmapViewOfFile failed");
+
1487 }
+
1488
+
1492 template<class _Other>
+
1493 void operator()(_Other*) const
+
1494 {
+
1495 if (!UnmapViewOfFile(_Ptr))
+
1496 throw win_runtime_error("UnmapViewOfFile failed");
+
1497 }
+
1498 };
+
1499
+ +
1507
+ +
1512 {
+ + +
1515
+
1516 public:
+ +
1523 {
+
1524 __try {
+
1525 InitializeCriticalSection(&m_data);
+
1526 } __except(EXCEPTION_EXECUTE_HANDLER) {
+
1527 throw std::runtime_error("InitializeCriticalSection failed");
+
1528 }
+
1529 }
+
1530
+ +
1537 {
+
1538 DeleteCriticalSection(&m_data);
+
1539 }
+
1540
+
1546 operator LPCRITICAL_SECTION() noexcept
+
1547 {
+
1548 return &m_data;
+
1549 }
+
1550
+
1551 protected:
+
1552 CRITICAL_SECTION m_data;
+
1553 };
1554
-
1555 protected:
-
1556 CRITICAL_SECTION m_data;
-
1557 };
-
1558
-
1564 class find_file : public handle<HANDLE, INVALID_HANDLE_VALUE>
-
1565 {
-
1566 WINSTD_HANDLE_IMPL(find_file, INVALID_HANDLE_VALUE)
-
1567
-
1568 public:
-
1574 virtual ~find_file()
-
1575 {
-
1576 if (m_h != invalid)
-
1577 free_internal();
-
1578 }
-
1579
-
1580 protected:
-
1586 void free_internal() noexcept override
-
1587 {
-
1588 FindClose(m_h);
-
1589 }
-
1590 };
-
1591
-
1597 class heap : public handle<HANDLE, NULL>
-
1598 {
- -
1600
-
1601 public:
-
1607 virtual ~heap()
-
1608 {
-
1609 if (m_h != invalid)
-
1610 free_internal();
-
1611 }
-
1612
-
1620 bool enumerate() noexcept
-
1621 {
-
1622 assert(m_h != invalid);
-
1623
-
1624 bool found = false;
-
1625
-
1626 // Lock the heap for exclusive access.
-
1627 HeapLock(m_h);
-
1628
-
1629 PROCESS_HEAP_ENTRY e;
-
1630 e.lpData = NULL;
-
1631 while (HeapWalk(m_h, &e) != FALSE) {
-
1632 if ((e.wFlags & PROCESS_HEAP_ENTRY_BUSY) != 0) {
- -
1634 _T("Allocated block%s%s\n")
-
1635 _T(" Data portion begins at: %#p\n Size: %d bytes\n")
-
1636 _T(" Overhead: %d bytes\n Region index: %d\n"),
-
1637 (e.wFlags & PROCESS_HEAP_ENTRY_MOVEABLE) != 0 ? tstring_printf(_T(", movable with HANDLE %#p"), e.Block.hMem).c_str() : _T(""),
-
1638 (e.wFlags & PROCESS_HEAP_ENTRY_DDESHARE) != 0 ? _T(", DDESHARE") : _T(""),
-
1639 e.lpData,
-
1640 e.cbData,
-
1641 e.cbOverhead,
-
1642 e.iRegionIndex);
+
1560 class find_file : public handle<HANDLE, INVALID_HANDLE_VALUE>
+
1561 {
+
1562 WINSTD_HANDLE_IMPL(find_file, INVALID_HANDLE_VALUE)
+
1563
+
1564 public:
+
1570 virtual ~find_file()
+
1571 {
+
1572 if (m_h != invalid)
+
1573 free_internal();
+
1574 }
+
1575
+
1576 protected:
+
1582 void free_internal() noexcept override
+
1583 {
+
1584 FindClose(m_h);
+
1585 }
+
1586 };
+
1587
+
1593 class heap : public handle<HANDLE, NULL>
+
1594 {
+ +
1596
+
1597 public:
+
1603 virtual ~heap()
+
1604 {
+
1605 if (m_h != invalid)
+
1606 free_internal();
+
1607 }
+
1608
+
1616 bool enumerate() noexcept
+
1617 {
+
1618 assert(m_h != invalid);
+
1619
+
1620 bool found = false;
+
1621
+
1622 // Lock the heap for exclusive access.
+
1623 HeapLock(m_h);
+
1624
+
1625 PROCESS_HEAP_ENTRY e;
+
1626 e.lpData = NULL;
+
1627 while (HeapWalk(m_h, &e) != FALSE) {
+
1628 if ((e.wFlags & PROCESS_HEAP_ENTRY_BUSY) != 0) {
+ +
1630 _T("Allocated block%s%s\n")
+
1631 _T(" Data portion begins at: %#p\n Size: %d bytes\n")
+
1632 _T(" Overhead: %d bytes\n Region index: %d\n"),
+
1633 (e.wFlags & PROCESS_HEAP_ENTRY_MOVEABLE) != 0 ? tstring_printf(_T(", movable with HANDLE %#p"), e.Block.hMem).c_str() : _T(""),
+
1634 (e.wFlags & PROCESS_HEAP_ENTRY_DDESHARE) != 0 ? _T(", DDESHARE") : _T(""),
+
1635 e.lpData,
+
1636 e.cbData,
+
1637 e.cbOverhead,
+
1638 e.iRegionIndex);
+
1639
+
1640 found = true;
+
1641 }
+
1642 }
1643
-
1644 found = true;
-
1645 }
-
1646 }
+
1644 const DWORD dwResult = GetLastError();
+
1645 if (dwResult != ERROR_NO_MORE_ITEMS)
+
1646 OutputDebugStr(_T("HeapWalk failed (error %u).\n"), dwResult);
1647
-
1648 const DWORD dwResult = GetLastError();
-
1649 if (dwResult != ERROR_NO_MORE_ITEMS)
-
1650 OutputDebugStr(_T("HeapWalk failed (error %u).\n"), dwResult);
-
1651
-
1652 // Unlock the heap.
-
1653 HeapUnlock(m_h);
-
1654
-
1655 return found;
-
1656 }
-
1657
-
1658 protected:
-
1664 void free_internal() noexcept override
-
1665 {
-
1666 enumerate();
-
1667 HeapDestroy(m_h);
-
1668 }
-
1669 };
-
1670
-
1674 template <class _Ty>
- -
1676 {
-
1677 public:
-
1678 typedef typename _Ty value_type;
-
1679
-
1680 typedef _Ty *pointer;
-
1681 typedef _Ty& reference;
-
1682 typedef const _Ty *const_pointer;
-
1683 typedef const _Ty& const_reference;
-
1684
-
1685 typedef SIZE_T size_type;
-
1686 typedef ptrdiff_t difference_type;
-
1687
-
1691 template <class _Other>
-
1692 struct rebind
-
1693 {
- -
1695 };
-
1696
-
1697 public:
- -
1704 {
-
1705 }
-
1706
-
1712 template <class _Other>
- -
1714 {
-
1715 }
-
1716
- -
1725 {
-
1726 assert(m_heap);
-
1727 return (pointer)HeapAlloc(m_heap, 0, count * sizeof(_Ty));
-
1728 }
-
1729
-
1736 void deallocate(_In_ pointer ptr, _In_ size_type size)
-
1737 {
-
1738 UNREFERENCED_PARAMETER(size);
-
1739 assert(m_heap);
-
1740 HeapFree(m_heap, 0, ptr);
-
1741 }
-
1742
-
1749 void construct(_Inout_ pointer ptr, _In_ const _Ty& val)
-
1750 {
-
1751 ::new ((void*)ptr) _Ty(val);
-
1752 }
-
1753
-
1760 void construct(_Inout_ pointer ptr, _Inout_ _Ty&& val)
-
1761 {
-
1762 ::new ((void*)ptr) _Ty(std::forward<_Ty>(val));
-
1763 }
-
1764
-
1770 void destroy(_Inout_ pointer ptr)
-
1771 {
-
1772 ptr->_Ty::~_Ty();
-
1773 }
-
1774
- -
1779 {
-
1780 return (SIZE_T)-1;
-
1781 }
+
1648 // Unlock the heap.
+
1649 HeapUnlock(m_h);
+
1650
+
1651 return found;
+
1652 }
+
1653
+
1654 protected:
+
1660 void free_internal() noexcept override
+
1661 {
+
1662 enumerate();
+
1663 HeapDestroy(m_h);
+
1664 }
+
1665 };
+
1666
+
1670 template <class _Ty>
+ +
1672 {
+
1673 public:
+
1674 typedef typename _Ty value_type;
+
1675
+
1676 typedef _Ty *pointer;
+
1677 typedef _Ty& reference;
+
1678 typedef const _Ty *const_pointer;
+
1679 typedef const _Ty& const_reference;
+
1680
+
1681 typedef SIZE_T size_type;
+
1682 typedef ptrdiff_t difference_type;
+
1683
+
1687 template <class _Other>
+
1688 struct rebind
+
1689 {
+ +
1691 };
+
1692
+
1693 public:
+ +
1700 {
+
1701 }
+
1702
+
1708 template <class _Other>
+ +
1710 {
+
1711 }
+
1712
+ +
1721 {
+
1722 assert(m_heap);
+
1723 return (pointer)HeapAlloc(m_heap, 0, count * sizeof(_Ty));
+
1724 }
+
1725
+
1732 void deallocate(_In_ pointer ptr, _In_ size_type size)
+
1733 {
+
1734 UNREFERENCED_PARAMETER(size);
+
1735 assert(m_heap);
+
1736 HeapFree(m_heap, 0, ptr);
+
1737 }
+
1738
+
1745 void construct(_Inout_ pointer ptr, _In_ const _Ty& val)
+
1746 {
+
1747 ::new ((void*)ptr) _Ty(val);
+
1748 }
+
1749
+
1756 void construct(_Inout_ pointer ptr, _Inout_ _Ty&& val)
+
1757 {
+
1758 ::new ((void*)ptr) _Ty(std::forward<_Ty>(val));
+
1759 }
+
1760
+
1766 void destroy(_Inout_ pointer ptr)
+
1767 {
+
1768 ptr->_Ty::~_Ty();
+
1769 }
+
1770
+ +
1775 {
+
1776 return (SIZE_T)-1;
+
1777 }
+
1778
+
1779 public:
+
1780 HANDLE m_heap;
+
1781 };
1782
-
1783 public:
-
1784 HANDLE m_heap;
-
1785 };
-
1786
- -
1791 {
- - -
1794
-
1795 public:
-
1803 actctx_activator(_In_ HANDLE hActCtx) noexcept
-
1804 {
-
1805 if (!ActivateActCtx(hActCtx, &m_cookie))
-
1806 m_cookie = 0;
-
1807 }
-
1808
- -
1815 {
-
1816 if (m_cookie)
-
1817 DeactivateActCtx(0, m_cookie);
-
1818 }
+ +
1787 {
+ + +
1790
+
1791 public:
+
1799 actctx_activator(_In_ HANDLE hActCtx) noexcept
+
1800 {
+
1801 if (!ActivateActCtx(hActCtx, &m_cookie))
+
1802 m_cookie = 0;
+
1803 }
+
1804
+ +
1811 {
+
1812 if (m_cookie)
+
1813 DeactivateActCtx(0, m_cookie);
+
1814 }
+
1815
+
1816 protected:
+
1817 ULONG_PTR m_cookie;
+
1818 };
1819
-
1820 protected:
-
1821 ULONG_PTR m_cookie;
-
1822 };
-
1823
- -
1828 {
- - -
1831
-
1832 public:
-
1840 user_impersonator(_In_opt_ HANDLE hToken) noexcept
-
1841 {
-
1842 m_cookie = hToken && ImpersonateLoggedOnUser(hToken);
-
1843 }
-
1844
- -
1851 {
-
1852 if (m_cookie)
-
1853 RevertToSelf();
-
1854 }
+ +
1824 {
+ + +
1827
+
1828 public:
+
1836 user_impersonator(_In_opt_ HANDLE hToken) noexcept
+
1837 {
+
1838 m_cookie = hToken && ImpersonateLoggedOnUser(hToken);
+
1839 }
+
1840
+ +
1847 {
+
1848 if (m_cookie)
+
1849 RevertToSelf();
+
1850 }
+
1851
+
1852 protected:
+ +
1854 };
1855
-
1856 protected:
- -
1858 };
-
1859
- -
1864 {
- - -
1867
-
1868 public:
-
1876 console_ctrl_handler(_In_opt_ PHANDLER_ROUTINE HandlerRoutine) noexcept : m_handler(HandlerRoutine)
-
1877 {
-
1878 m_cookie = SetConsoleCtrlHandler(m_handler, TRUE);
-
1879 }
-
1880
- -
1887 {
-
1888 if (m_cookie)
-
1889 SetConsoleCtrlHandler(m_handler, FALSE);
-
1890 }
-
1891
-
1892 protected:
- -
1894 PHANDLER_ROUTINE m_handler;
-
1895 };
-
1896
-
1900 class vmemory : public handle<LPVOID, NULL>
-
1901 {
- -
1903
-
1904 public:
-
1908 vmemory() noexcept : m_proc(NULL)
-
1909 {
-
1910 }
-
1911
-
1918 vmemory(_In_ handle_type h, _In_ HANDLE proc) noexcept :
-
1919 m_proc(proc),
- -
1921 {
-
1922 }
-
1923
-
1929 vmemory(_Inout_ vmemory &&h) noexcept :
-
1930 m_proc(std::move(h.m_proc)),
-
1931 handle<LPVOID, NULL>(std::move(h))
-
1932 {
-
1933 }
-
1934
-
1940 virtual ~vmemory()
-
1941 {
-
1942 if (m_h != invalid)
-
1943 VirtualFreeEx(m_proc, m_h, 0, MEM_RELEASE);
-
1944 }
-
1945
-
1951 vmemory& operator=(_Inout_ vmemory &&other) noexcept
-
1952 {
-
1953 if (this != std::addressof(other)) {
-
1954 (handle<handle_type, NULL>&&)*this = std::move(other);
-
1955 m_proc = std::move(other.m_proc);
-
1956 }
-
1957 return *this;
-
1958 }
-
1959
-
1968 void attach(_In_ HANDLE proc, _In_opt_ handle_type h) noexcept
-
1969 {
-
1970 m_proc = proc;
-
1971 if (m_h != invalid)
-
1972 free_internal();
-
1973 m_h = h;
-
1974 }
-
1975
-
1985 bool alloc(
-
1986 _In_ HANDLE hProcess,
-
1987 _In_opt_ LPVOID lpAddress,
-
1988 _In_ SIZE_T dwSize,
-
1989 _In_ DWORD flAllocationType,
-
1990 _In_ DWORD flProtect) noexcept
-
1991 {
-
1992 handle_type h = VirtualAllocEx(hProcess, lpAddress, dwSize, flAllocationType, flProtect);
-
1993 if (h != invalid) {
-
1994 attach(hProcess, h);
-
1995 return true;
-
1996 } else
-
1997 return false;
-
1998 }
-
1999
-
2000 protected:
-
2006 void free_internal() noexcept override
-
2007 {
-
2008 VirtualFreeEx(m_proc, m_h, 0, MEM_RELEASE);
-
2009 }
+ +
1860 {
+ + +
1863
+
1864 public:
+
1872 console_ctrl_handler(_In_opt_ PHANDLER_ROUTINE HandlerRoutine) noexcept : m_handler(HandlerRoutine)
+
1873 {
+
1874 m_cookie = SetConsoleCtrlHandler(m_handler, TRUE);
+
1875 }
+
1876
+ +
1883 {
+
1884 if (m_cookie)
+
1885 SetConsoleCtrlHandler(m_handler, FALSE);
+
1886 }
+
1887
+
1888 protected:
+ +
1890 PHANDLER_ROUTINE m_handler;
+
1891 };
+
1892
+
1896 class vmemory : public handle<LPVOID, NULL>
+
1897 {
+ +
1899
+
1900 public:
+
1904 vmemory() noexcept : m_proc(NULL)
+
1905 {
+
1906 }
+
1907
+
1914 vmemory(_In_ handle_type h, _In_ HANDLE proc) noexcept :
+
1915 m_proc(proc),
+ +
1917 {
+
1918 }
+
1919
+
1925 vmemory(_Inout_ vmemory &&h) noexcept :
+
1926 m_proc(std::move(h.m_proc)),
+
1927 handle<LPVOID, NULL>(std::move(h))
+
1928 {
+
1929 }
+
1930
+
1936 virtual ~vmemory()
+
1937 {
+
1938 if (m_h != invalid)
+
1939 VirtualFreeEx(m_proc, m_h, 0, MEM_RELEASE);
+
1940 }
+
1941
+
1947 vmemory& operator=(_Inout_ vmemory &&other) noexcept
+
1948 {
+
1949 if (this != std::addressof(other)) {
+
1950 (handle<handle_type, NULL>&&)*this = std::move(other);
+
1951 m_proc = std::move(other.m_proc);
+
1952 }
+
1953 return *this;
+
1954 }
+
1955
+
1964 void attach(_In_ HANDLE proc, _In_opt_ handle_type h) noexcept
+
1965 {
+
1966 m_proc = proc;
+
1967 if (m_h != invalid)
+
1968 free_internal();
+
1969 m_h = h;
+
1970 }
+
1971
+
1981 bool alloc(
+
1982 _In_ HANDLE hProcess,
+
1983 _In_opt_ LPVOID lpAddress,
+
1984 _In_ SIZE_T dwSize,
+
1985 _In_ DWORD flAllocationType,
+
1986 _In_ DWORD flProtect) noexcept
+
1987 {
+
1988 handle_type h = VirtualAllocEx(hProcess, lpAddress, dwSize, flAllocationType, flProtect);
+
1989 if (h != invalid) {
+
1990 attach(hProcess, h);
+
1991 return true;
+
1992 } else
+
1993 return false;
+
1994 }
+
1995
+
1996 protected:
+
2002 void free_internal() noexcept override
+
2003 {
+
2004 VirtualFreeEx(m_proc, m_h, 0, MEM_RELEASE);
+
2005 }
+
2006
+
2007 protected:
+
2008 HANDLE m_proc;
+
2009 };
2010
-
2011 protected:
-
2012 HANDLE m_proc;
-
2013 };
-
2014
-
2021 class reg_key : public handle<HKEY, NULL>
-
2022 {
- -
2024
-
2025 public:
-
2031 virtual ~reg_key()
-
2032 {
-
2033 if (m_h != invalid)
-
2034 free_internal();
-
2035 }
-
2036
-
2046 bool delete_subkey(_In_z_ LPCTSTR szSubkey)
-
2047 {
-
2048 LSTATUS s;
+
2017 class reg_key : public handle<HKEY, NULL>
+
2018 {
+ +
2020
+
2021 public:
+
2027 virtual ~reg_key()
+
2028 {
+
2029 if (m_h != invalid)
+
2030 free_internal();
+
2031 }
+
2032
+
2042 bool delete_subkey(_In_z_ LPCTSTR szSubkey)
+
2043 {
+
2044 LSTATUS s;
+
2045
+
2046 s = RegDeleteKey(m_h, szSubkey);
+
2047 if (s == ERROR_SUCCESS || s == ERROR_FILE_NOT_FOUND)
+
2048 return true;
2049
-
2050 s = RegDeleteKey(m_h, szSubkey);
-
2051 if (s == ERROR_SUCCESS || s == ERROR_FILE_NOT_FOUND)
-
2052 return true;
-
2053
-
2054 {
-
2055 reg_key k;
-
2056 handle_type h;
-
2057 s = RegOpenKeyEx(m_h, szSubkey, 0, KEY_ENUMERATE_SUB_KEYS, &h);
-
2058 if (s == ERROR_SUCCESS)
-
2059 k.attach(h);
-
2060 else {
-
2061 SetLastError(s);
-
2062 return false;
-
2063 }
-
2064 for (;;) {
-
2065 TCHAR szName[MAX_PATH];
-
2066 DWORD dwSize = _countof(szName);
-
2067 s = RegEnumKeyEx(k, 0, szName, &dwSize, NULL, NULL, NULL, NULL);
-
2068 if (s == ERROR_SUCCESS)
-
2069 k.delete_subkey(szName);
-
2070 else if (s == ERROR_NO_MORE_ITEMS)
-
2071 break;
-
2072 else {
-
2073 SetLastError(s);
-
2074 return false;
-
2075 }
-
2076 }
-
2077 }
-
2078
-
2079 s = RegDeleteKey(m_h, szSubkey);
-
2080 if (s == ERROR_SUCCESS)
-
2081 return true;
-
2082 else {
-
2083 SetLastError(s);
-
2084 return false;
-
2085 }
-
2086 }
-
2087
-
2088 protected:
-
2094 void free_internal() noexcept override
-
2095 {
-
2096 RegCloseKey(m_h);
-
2097 }
-
2098 };
-
2099
-
2103 class security_id : public handle<PSID, NULL>
-
2104 {
- -
2106
-
2107 public:
- -
2114 {
-
2115 if (m_h != invalid)
-
2116 free_internal();
-
2117 }
-
2118
-
2119 protected:
-
2125 void free_internal() noexcept override
-
2126 {
-
2127 FreeSid(m_h);
-
2128 }
-
2129 };
-
2130
-
2134 class process_information : public PROCESS_INFORMATION
-
2135 {
- - -
2138
-
2139 public:
- -
2144 {
-
2145 hProcess = INVALID_HANDLE_VALUE;
-
2146 hThread = INVALID_HANDLE_VALUE;
-
2147 dwProcessId = 0;
-
2148 dwThreadId = 0;
-
2149 }
-
2150
- -
2155 {
-
2156 #pragma warning(push)
-
2157 #pragma warning(disable: 6001) // Using uninitialized memory '*this'. << ???
-
2158
-
2159 if (hProcess != INVALID_HANDLE_VALUE)
-
2160 CloseHandle(hProcess);
-
2161
-
2162 if (hThread != INVALID_HANDLE_VALUE)
-
2163 CloseHandle(hThread);
+
2050 {
+
2051 reg_key k;
+
2052 handle_type h;
+
2053 s = RegOpenKeyEx(m_h, szSubkey, 0, KEY_ENUMERATE_SUB_KEYS, &h);
+
2054 if (s == ERROR_SUCCESS)
+
2055 k.attach(h);
+
2056 else {
+
2057 SetLastError(s);
+
2058 return false;
+
2059 }
+
2060 for (;;) {
+
2061 TCHAR szName[MAX_PATH];
+
2062 DWORD dwSize = _countof(szName);
+
2063 s = RegEnumKeyEx(k, 0, szName, &dwSize, NULL, NULL, NULL, NULL);
+
2064 if (s == ERROR_SUCCESS)
+
2065 k.delete_subkey(szName);
+
2066 else if (s == ERROR_NO_MORE_ITEMS)
+
2067 break;
+
2068 else {
+
2069 SetLastError(s);
+
2070 return false;
+
2071 }
+
2072 }
+
2073 }
+
2074
+
2075 s = RegDeleteKey(m_h, szSubkey);
+
2076 if (s == ERROR_SUCCESS)
+
2077 return true;
+
2078 else {
+
2079 SetLastError(s);
+
2080 return false;
+
2081 }
+
2082 }
+
2083
+
2084 protected:
+
2090 void free_internal() noexcept override
+
2091 {
+
2092 RegCloseKey(m_h);
+
2093 }
+
2094 };
+
2095
+
2099 class security_id : public handle<PSID, NULL>
+
2100 {
+ +
2102
+
2103 public:
+ +
2110 {
+
2111 if (m_h != invalid)
+
2112 free_internal();
+
2113 }
+
2114
+
2115 protected:
+
2121 void free_internal() noexcept override
+
2122 {
+
2123 FreeSid(m_h);
+
2124 }
+
2125 };
+
2126
+
2130 class process_information : public PROCESS_INFORMATION
+
2131 {
+ + +
2134
+
2135 public:
+ +
2140 {
+
2141 hProcess = INVALID_HANDLE_VALUE;
+
2142 hThread = INVALID_HANDLE_VALUE;
+
2143 dwProcessId = 0;
+
2144 dwThreadId = 0;
+
2145 }
+
2146
+ +
2151 {
+
2152 #pragma warning(push)
+
2153 #pragma warning(disable: 6001) // Using uninitialized memory '*this'. << ???
+
2154
+
2155 if (hProcess != INVALID_HANDLE_VALUE)
+
2156 CloseHandle(hProcess);
+
2157
+
2158 if (hThread != INVALID_HANDLE_VALUE)
+
2159 CloseHandle(hThread);
+
2160
+
2161 #pragma warning(pop)
+
2162 }
+
2163 };
2164
-
2165 #pragma warning(pop)
-
2166 }
-
2167 };
-
2168
-
2174 class event_log : public handle<HANDLE, NULL>
-
2175 {
- -
2177
-
2178 public:
-
2184 virtual ~event_log()
-
2185 {
-
2186 if (m_h != invalid)
-
2187 free_internal();
-
2188 }
-
2189
-
2190 protected:
-
2196 void free_internal() noexcept override
-
2197 {
-
2198 DeregisterEventSource(m_h);
-
2199 }
-
2200 };
-
2201
-
2203}
-
2204
-
2207
-
2208#pragma warning(push)
-
2209#pragma warning(disable: 4505) // Don't warn on unused code
-
2210
-
2212static LSTATUS RegCreateKeyExA(
-
2213 _In_ HKEY hKey,
-
2214 _In_ LPCSTR lpSubKey,
-
2215 _Reserved_ DWORD Reserved,
-
2216 _In_opt_ LPSTR lpClass,
-
2217 _In_ DWORD dwOptions,
-
2218 _In_ REGSAM samDesired,
-
2219 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
-
2220 _Inout_ winstd::reg_key &result,
-
2221 _Out_opt_ LPDWORD lpdwDisposition)
-
2222{
-
2223 HKEY h;
-
2224 LSTATUS s = RegCreateKeyExA(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
-
2225 if (s == ERROR_SUCCESS)
-
2226 result.attach(h);
-
2227 return s;
-
2228}
-
2229
-
2235static LSTATUS RegCreateKeyExW(
-
2236 _In_ HKEY hKey,
-
2237 _In_ LPCWSTR lpSubKey,
-
2238 _Reserved_ DWORD Reserved,
-
2239 _In_opt_ LPWSTR lpClass,
-
2240 _In_ DWORD dwOptions,
-
2241 _In_ REGSAM samDesired,
-
2242 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
-
2243 _Inout_ winstd::reg_key &result,
-
2244 _Out_opt_ LPDWORD lpdwDisposition)
-
2245{
-
2246 HKEY h;
-
2247 LSTATUS s = RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
-
2248 if (s == ERROR_SUCCESS)
-
2249 result.attach(h);
-
2250 return s;
-
2251}
-
2252
-
2254static LSTATUS RegOpenKeyExA(
-
2255 _In_ HKEY hKey,
-
2256 _In_opt_ LPCSTR lpSubKey,
-
2257 _In_opt_ DWORD ulOptions,
-
2258 _In_ REGSAM samDesired,
-
2259 _Inout_ winstd::reg_key &result)
-
2260{
-
2261 HKEY h;
-
2262 LSTATUS s = RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, &h);
-
2263 if (s == ERROR_SUCCESS)
-
2264 result.attach(h);
-
2265 return s;
-
2266}
-
2267
-
2277static LSTATUS RegOpenKeyExW(
-
2278 _In_ HKEY hKey,
-
2279 _In_opt_ LPCWSTR lpSubKey,
-
2280 _In_opt_ DWORD ulOptions,
-
2281 _In_ REGSAM samDesired,
-
2282 _Inout_ winstd::reg_key &result)
-
2283{
-
2284 HKEY h;
-
2285 LSTATUS s = RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, &h);
-
2286 if (s == ERROR_SUCCESS)
-
2287 result.attach(h);
-
2288 return s;
-
2289}
-
2290
-
2291#pragma warning(pop)
-
2292
-
General API.
-
Activates given activation context in constructor and deactivates it in destructor.
Definition: Win.h:1791
-
actctx_activator(HANDLE hActCtx) noexcept
Construct the activator and activates the given activation context.
Definition: Win.h:1803
-
virtual ~actctx_activator()
Deactivates activation context and destructs the activator.
Definition: Win.h:1814
-
ULONG_PTR m_cookie
Cookie for context deactivation.
Definition: Win.h:1821
-
Base template class to support string formatting using printf() style templates.
Definition: Common.h:1123
-
Console control handler stack management.
Definition: Win.h:1864
-
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:1876
-
virtual ~console_ctrl_handler()
Pops console control handler from the console control handler stack.
Definition: Win.h:1886
-
PHANDLER_ROUTINE m_handler
Pointer to console control handler.
Definition: Win.h:1894
-
BOOL m_cookie
Did pushing the console control handler succeed?
Definition: Win.h:1893
-
Critical section wrapper.
Definition: Win.h:1516
-
CRITICAL_SECTION m_data
Critical section struct.
Definition: Win.h:1556
-
virtual ~critical_section()
Releases all resources used by an unowned critical section object.
Definition: Win.h:1540
-
critical_section()
Construct the object and initializes a critical section object.
Definition: Win.h:1526
-
Event log handle wrapper.
Definition: Win.h:2175
-
void free_internal() noexcept override
Closes an event log handle.
Definition: Win.h:2196
-
virtual ~event_log()
Closes an event log handle.
Definition: Win.h:2184
-
Find-file handle wrapper.
Definition: Win.h:1565
-
virtual ~find_file()
Closes a file search handle.
Definition: Win.h:1574
-
void free_internal() noexcept override
Closes a file search handle.
Definition: Win.h:1586
-
Base abstract template class to support generic object handle keeping.
Definition: Common.h:615
-
LPVOID handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:620
-
handle_type m_h
Object handle.
Definition: Common.h:866
-
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:829
-
HeapAlloc allocator.
Definition: Win.h:1676
-
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:1685
-
_Ty value_type
A type that is managed by the allocator.
Definition: Win.h:1678
-
heap_allocator(const heap_allocator< _Other > &other)
Constructs allocator from another type.
Definition: Win.h:1713
-
HANDLE m_heap
Heap handle.
Definition: Win.h:1784
-
pointer allocate(size_type count)
Allocates a new memory block.
Definition: Win.h:1724
-
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:1686
-
heap_allocator(HANDLE heap)
Constructs allocator.
Definition: Win.h:1703
-
_Ty & reference
A type that provides a reference to the type of object managed by the allocator.
Definition: Win.h:1681
-
void construct(pointer ptr, _Ty &&val)
Calls moving constructor for the element.
Definition: Win.h:1760
-
void deallocate(pointer ptr, size_type size)
Frees memory block.
Definition: Win.h:1736
-
size_type max_size() const
Returns maximum memory block size.
Definition: Win.h:1778
-
void construct(pointer ptr, const _Ty &val)
Calls copying constructor for the element.
Definition: Win.h:1749
-
const _Ty & const_reference
A type that provides a constant reference to type of object managed by the allocator.
Definition: Win.h:1683
-
const _Ty * const_pointer
A type that provides a constant pointer to the type of object managed by the allocator.
Definition: Win.h:1682
-
_Ty * pointer
A type that provides a pointer to the type of object managed by the allocator.
Definition: Win.h:1680
-
void destroy(pointer ptr)
Calls destructor for the element.
Definition: Win.h:1770
-
Heap handle wrapper.
Definition: Win.h:1598
-
bool enumerate() noexcept
Enumerates allocated heap blocks using OutputDebugString()
Definition: Win.h:1620
-
void free_internal() noexcept override
Destroys the heap.
Definition: Win.h:1664
-
virtual ~heap()
Destroys the heap.
Definition: Win.h:1607
-
Module handle wrapper.
Definition: Win.h:1383
-
void free_internal() noexcept override
Frees the module.
Definition: Win.h:1404
-
virtual ~library()
Frees the module.
Definition: Win.h:1392
-
PROCESS_INFORMATION struct wrapper.
Definition: Win.h:2135
-
~process_information()
Closes process and thread handles.
Definition: Win.h:2154
-
process_information() noexcept
Constructs blank PROCESS_INFORMATION.
Definition: Win.h:2143
-
Registry key wrapper class.
Definition: Win.h:2022
-
void free_internal() noexcept override
Closes a handle to the registry key.
Definition: Win.h:2094
-
bool delete_subkey(LPCTSTR szSubkey)
Deletes the specified registry subkey.
Definition: Win.h:2046
-
virtual ~reg_key()
Closes a handle to the registry key.
Definition: Win.h:2031
-
SID wrapper class.
Definition: Win.h:2104
-
void free_internal() noexcept override
Closes a handle to the SID.
Definition: Win.h:2125
-
virtual ~security_id()
Closes a handle to the SID.
Definition: Win.h:2113
-
Lets the calling thread impersonate the security context of a logged-on user.
Definition: Win.h:1828
-
BOOL m_cookie
Did impersonation succeed?
Definition: Win.h:1857
-
user_impersonator(HANDLE hToken) noexcept
Construct the impersonator and impersonates the given user.
Definition: Win.h:1840
-
virtual ~user_impersonator()
Reverts to current user and destructs the impersonator.
Definition: Win.h:1850
-
Memory in virtual address space of a process handle wrapper.
Definition: Win.h:1901
-
vmemory & operator=(vmemory &&other) noexcept
Move assignment.
Definition: Win.h:1951
-
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:1985
-
void free_internal() noexcept override
Frees the memory.
Definition: Win.h:2006
-
void attach(HANDLE proc, handle_type h) noexcept
Sets a new memory handle for the class.
Definition: Win.h:1968
-
virtual ~vmemory()
Frees the memory.
Definition: Win.h:1940
-
vmemory(handle_type h, HANDLE proc) noexcept
Initializes a new class instance with an already available object handle.
Definition: Win.h:1918
-
vmemory() noexcept
Initializes a new class instance with the memory handle set to INVAL.
Definition: Win.h:1908
-
vmemory(vmemory &&h) noexcept
Move constructor.
Definition: Win.h:1929
-
HANDLE m_proc
Handle of memory's process.
Definition: Win.h:2012
-
Windows HANDLE wrapper class.
Definition: Win.h:1350
-
void free_internal() noexcept override
Closes an open object handle.
Definition: Win.h:1371
-
virtual ~win_handle()
Closes an open object handle.
Definition: Win.h:1359
-
Windows runtime error.
Definition: Common.h:1056
-
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:74
-
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:101
-
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition: Common.h:82
-
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition: Common.h:259
-
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition: Common.h:292
-
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:171
-
static const HANDLE invalid
Invalid handle value.
Definition: Common.h:625
-
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:974
-
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: Win.h:717
-
static DWORD ExpandEnvironmentStringsA(LPCSTR lpSrc, std::basic_string< char, _Traits, _Ax > &sValue) noexcept
Expands environment-variable strings, replaces them with the values defined for the current user,...
Definition: Win.h:181
-
static BOOL StringToGuidA(LPCSTR lpszGuid, LPGUID lpGuid, LPCSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition: Win.h:270
-
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:83
-
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:2235
-
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:1056
-
win_handle< INVALID_HANDLE_VALUE > file
File handle wrapper.
Definition: Win.h:1436
-
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:145
-
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: Win.h:806
-
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:2212
-
static LSTATUS RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition: Win.h:2254
-
static LSTATUS RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition: Win.h:2277
-
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:231
-
static BOOL StringToGuidW(LPCWSTR lpszGuid, LPGUID lpGuid, LPCWSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition: Win.h:343
-
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:608
-
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:1174
-
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:58
-
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:1213
-
win_handle< INVALID_HANDLE_VALUE > process_snapshot
Process snapshot handle wrapper.
Definition: Win.h:1429
-
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:27
-
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:1158
-
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:1074
-
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:1252
-
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:569
-
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:165
-
win_handle< NULL > event
Event handle wrapper.
Definition: Win.h:1510
-
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:594
-
static VOID OutputDebugStr(LPCSTR lpOutputString,...) noexcept
Formats and sends a string to the debugger for display.
Definition: Win.h:1115
-
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:1284
-
win_handle< NULL > file_mapping
File mapping.
Definition: Win.h:1443
-
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: Win.h:885
-
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: Win.h:638
-
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:1313
-
win_handle< NULL > process
Process handle wrapper.
Definition: Win.h:1415
-
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:542
-
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:431
-
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:116
-
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:1138
-
static DWORD ExpandEnvironmentStringsW(LPCWSTR lpSrc, std::basic_string< wchar_t, _Traits, _Ax > &sValue) noexcept
Expands environment-variable strings, replaces them with the values defined for the current user,...
Definition: Win.h:209
-
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:250
-
static VOID OutputDebugStrV(LPCSTR lpOutputString, va_list arg) noexcept
Formats and sends a string to the debugger for display.
Definition: Win.h:1091
-
win_handle< NULL > thread
Thread handle wrapper.
Definition: Win.h:1422
-
UnmapViewOfFile_delete()
Default construct.
Definition: Win.h:1482
-
void operator()(_Other *) const
Delete a pointer of another type.
Definition: Win.h:1497
-
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: Win.h:1487
-
UnmapViewOfFile_delete< _Ty > _Myt
This type.
Definition: Win.h:1477
-
Deleter for unique_ptr using UnmapViewOfFile.
Definition: Win.h:1449
-
UnmapViewOfFile_delete(const UnmapViewOfFile_delete< _Ty2 > &)
Construct from another UnmapViewOfFile_delete.
Definition: Win.h:1460
-
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: Win.h:1465
-
UnmapViewOfFile_delete< _Ty > _Myt
This type.
Definition: Win.h:1450
-
UnmapViewOfFile_delete()
Default construct.
Definition: Win.h:1455
-
A structure that enables an allocator for objects of one type to allocate storage for objects of anot...
Definition: Win.h:1693
-
heap_allocator< _Other > other
Other allocator type.
Definition: Win.h:1694
+
2170 class event_log : public handle<HANDLE, NULL>
+
2171 {
+ +
2173
+
2174 public:
+
2180 virtual ~event_log()
+
2181 {
+
2182 if (m_h != invalid)
+
2183 free_internal();
+
2184 }
+
2185
+
2186 protected:
+
2192 void free_internal() noexcept override
+
2193 {
+
2194 DeregisterEventSource(m_h);
+
2195 }
+
2196 };
+
2197
+
2199}
+
2200
+
2203
+
2204#pragma warning(push)
+
2205#pragma warning(disable: 4505) // Don't warn on unused code
+
2206
+
2208static LSTATUS RegCreateKeyExA(
+
2209 _In_ HKEY hKey,
+
2210 _In_ LPCSTR lpSubKey,
+
2211 _Reserved_ DWORD Reserved,
+
2212 _In_opt_ LPSTR lpClass,
+
2213 _In_ DWORD dwOptions,
+
2214 _In_ REGSAM samDesired,
+
2215 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+
2216 _Inout_ winstd::reg_key &result,
+
2217 _Out_opt_ LPDWORD lpdwDisposition)
+
2218{
+
2219 HKEY h;
+
2220 LSTATUS s = RegCreateKeyExA(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
+
2221 if (s == ERROR_SUCCESS)
+
2222 result.attach(h);
+
2223 return s;
+
2224}
+
2225
+
2231static LSTATUS RegCreateKeyExW(
+
2232 _In_ HKEY hKey,
+
2233 _In_ LPCWSTR lpSubKey,
+
2234 _Reserved_ DWORD Reserved,
+
2235 _In_opt_ LPWSTR lpClass,
+
2236 _In_ DWORD dwOptions,
+
2237 _In_ REGSAM samDesired,
+
2238 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+
2239 _Inout_ winstd::reg_key &result,
+
2240 _Out_opt_ LPDWORD lpdwDisposition)
+
2241{
+
2242 HKEY h;
+
2243 LSTATUS s = RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
+
2244 if (s == ERROR_SUCCESS)
+
2245 result.attach(h);
+
2246 return s;
+
2247}
+
2248
+
2250static LSTATUS RegOpenKeyExA(
+
2251 _In_ HKEY hKey,
+
2252 _In_opt_ LPCSTR lpSubKey,
+
2253 _In_opt_ DWORD ulOptions,
+
2254 _In_ REGSAM samDesired,
+
2255 _Inout_ winstd::reg_key &result)
+
2256{
+
2257 HKEY h;
+
2258 LSTATUS s = RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, &h);
+
2259 if (s == ERROR_SUCCESS)
+
2260 result.attach(h);
+
2261 return s;
+
2262}
+
2263
+
2273static LSTATUS RegOpenKeyExW(
+
2274 _In_ HKEY hKey,
+
2275 _In_opt_ LPCWSTR lpSubKey,
+
2276 _In_opt_ DWORD ulOptions,
+
2277 _In_ REGSAM samDesired,
+
2278 _Inout_ winstd::reg_key &result)
+
2279{
+
2280 HKEY h;
+
2281 LSTATUS s = RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, &h);
+
2282 if (s == ERROR_SUCCESS)
+
2283 result.attach(h);
+
2284 return s;
+
2285}
+
2286
+
2287#pragma warning(pop)
+
2288
+
Activates given activation context in constructor and deactivates it in destructor.
Definition: Win.h:1787
+
actctx_activator(HANDLE hActCtx) noexcept
Construct the activator and activates the given activation context.
Definition: Win.h:1799
+
virtual ~actctx_activator()
Deactivates activation context and destructs the activator.
Definition: Win.h:1810
+
ULONG_PTR m_cookie
Cookie for context deactivation.
Definition: Win.h:1817
+
Base template class to support string formatting using printf() style templates.
Definition: Common.h:1115
+
Console control handler stack management.
Definition: Win.h:1860
+
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:1872
+
virtual ~console_ctrl_handler()
Pops console control handler from the console control handler stack.
Definition: Win.h:1882
+
PHANDLER_ROUTINE m_handler
Pointer to console control handler.
Definition: Win.h:1890
+
BOOL m_cookie
Did pushing the console control handler succeed?
Definition: Win.h:1889
+
Critical section wrapper.
Definition: Win.h:1512
+
CRITICAL_SECTION m_data
Critical section struct.
Definition: Win.h:1552
+
virtual ~critical_section()
Releases all resources used by an unowned critical section object.
Definition: Win.h:1536
+
critical_section()
Construct the object and initializes a critical section object.
Definition: Win.h:1522
+
Event log handle wrapper.
Definition: Win.h:2171
+
void free_internal() noexcept override
Closes an event log handle.
Definition: Win.h:2192
+
virtual ~event_log()
Closes an event log handle.
Definition: Win.h:2180
+
Find-file handle wrapper.
Definition: Win.h:1561
+
virtual ~find_file()
Closes a file search handle.
Definition: Win.h:1570
+
void free_internal() noexcept override
Closes a file search handle.
Definition: Win.h:1582
+
Base abstract template class to support generic object handle keeping.
Definition: Common.h:607
+
LPVOID handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:612
+
handle_type m_h
Object handle.
Definition: Common.h:858
+
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:821
+
HeapAlloc allocator.
Definition: Win.h:1672
+
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:1681
+
_Ty value_type
A type that is managed by the allocator.
Definition: Win.h:1674
+
heap_allocator(const heap_allocator< _Other > &other)
Constructs allocator from another type.
Definition: Win.h:1709
+
HANDLE m_heap
Heap handle.
Definition: Win.h:1780
+
pointer allocate(size_type count)
Allocates a new memory block.
Definition: Win.h:1720
+
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:1682
+
heap_allocator(HANDLE heap)
Constructs allocator.
Definition: Win.h:1699
+
_Ty & reference
A type that provides a reference to the type of object managed by the allocator.
Definition: Win.h:1677
+
void construct(pointer ptr, _Ty &&val)
Calls moving constructor for the element.
Definition: Win.h:1756
+
void deallocate(pointer ptr, size_type size)
Frees memory block.
Definition: Win.h:1732
+
size_type max_size() const
Returns maximum memory block size.
Definition: Win.h:1774
+
void construct(pointer ptr, const _Ty &val)
Calls copying constructor for the element.
Definition: Win.h:1745
+
const _Ty & const_reference
A type that provides a constant reference to type of object managed by the allocator.
Definition: Win.h:1679
+
const _Ty * const_pointer
A type that provides a constant pointer to the type of object managed by the allocator.
Definition: Win.h:1678
+
_Ty * pointer
A type that provides a pointer to the type of object managed by the allocator.
Definition: Win.h:1676
+
void destroy(pointer ptr)
Calls destructor for the element.
Definition: Win.h:1766
+
Heap handle wrapper.
Definition: Win.h:1594
+
bool enumerate() noexcept
Enumerates allocated heap blocks using OutputDebugString()
Definition: Win.h:1616
+
void free_internal() noexcept override
Destroys the heap.
Definition: Win.h:1660
+
virtual ~heap()
Destroys the heap.
Definition: Win.h:1603
+
Module handle wrapper.
Definition: Win.h:1379
+
void free_internal() noexcept override
Frees the module.
Definition: Win.h:1400
+
virtual ~library()
Frees the module.
Definition: Win.h:1388
+
PROCESS_INFORMATION struct wrapper.
Definition: Win.h:2131
+
~process_information()
Closes process and thread handles.
Definition: Win.h:2150
+
process_information() noexcept
Constructs blank PROCESS_INFORMATION.
Definition: Win.h:2139
+
Registry key wrapper class.
Definition: Win.h:2018
+
void free_internal() noexcept override
Closes a handle to the registry key.
Definition: Win.h:2090
+
bool delete_subkey(LPCTSTR szSubkey)
Deletes the specified registry subkey.
Definition: Win.h:2042
+
virtual ~reg_key()
Closes a handle to the registry key.
Definition: Win.h:2027
+
SID wrapper class.
Definition: Win.h:2100
+
void free_internal() noexcept override
Closes a handle to the SID.
Definition: Win.h:2121
+
virtual ~security_id()
Closes a handle to the SID.
Definition: Win.h:2109
+
Lets the calling thread impersonate the security context of a logged-on user.
Definition: Win.h:1824
+
BOOL m_cookie
Did impersonation succeed?
Definition: Win.h:1853
+
user_impersonator(HANDLE hToken) noexcept
Construct the impersonator and impersonates the given user.
Definition: Win.h:1836
+
virtual ~user_impersonator()
Reverts to current user and destructs the impersonator.
Definition: Win.h:1846
+
Memory in virtual address space of a process handle wrapper.
Definition: Win.h:1897
+
vmemory & operator=(vmemory &&other) noexcept
Move assignment.
Definition: Win.h:1947
+
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:1981
+
void free_internal() noexcept override
Frees the memory.
Definition: Win.h:2002
+
void attach(HANDLE proc, handle_type h) noexcept
Sets a new memory handle for the class.
Definition: Win.h:1964
+
virtual ~vmemory()
Frees the memory.
Definition: Win.h:1936
+
vmemory(handle_type h, HANDLE proc) noexcept
Initializes a new class instance with an already available object handle.
Definition: Win.h:1914
+
vmemory() noexcept
Initializes a new class instance with the memory handle set to INVAL.
Definition: Win.h:1904
+
vmemory(vmemory &&h) noexcept
Move constructor.
Definition: Win.h:1925
+
HANDLE m_proc
Handle of memory's process.
Definition: Win.h:2008
+
Windows HANDLE wrapper class.
Definition: Win.h:1346
+
void free_internal() noexcept override
Closes an open object handle.
Definition: Win.h:1367
+
virtual ~win_handle()
Closes an open object handle.
Definition: Win.h:1355
+
Windows runtime error.
Definition: Common.h:1048
+
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:66
+
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:93
+
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition: Common.h:74
+
static int vsprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format, va_list arg)
Formats string using printf().
Definition: Common.h:251
+
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition: Common.h:284
+
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:163
+
static const HANDLE invalid
Invalid handle value.
Definition: Common.h:617
+
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:970
+
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: Win.h:713
+
static DWORD ExpandEnvironmentStringsA(LPCSTR lpSrc, std::basic_string< char, _Traits, _Ax > &sValue) noexcept
Expands environment-variable strings, replaces them with the values defined for the current user,...
Definition: Win.h:177
+
static BOOL StringToGuidA(LPCSTR lpszGuid, LPGUID lpGuid, LPCSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition: Win.h:266
+
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:79
+
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:2231
+
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:1052
+
win_handle< INVALID_HANDLE_VALUE > file
File handle wrapper.
Definition: Win.h:1432
+
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:141
+
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: Win.h:802
+
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:2208
+
static LSTATUS RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition: Win.h:2250
+
static LSTATUS RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition: Win.h:2273
+
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:227
+
static BOOL StringToGuidW(LPCWSTR lpszGuid, LPGUID lpGuid, LPCWSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition: Win.h:339
+
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:604
+
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:1170
+
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:54
+
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:1209
+
win_handle< INVALID_HANDLE_VALUE > process_snapshot
Process snapshot handle wrapper.
Definition: Win.h:1425
+
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:23
+
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:1154
+
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:1070
+
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:1248
+
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:565
+
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:161
+
win_handle< NULL > event
Event handle wrapper.
Definition: Win.h:1506
+
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:590
+
static VOID OutputDebugStr(LPCSTR lpOutputString,...) noexcept
Formats and sends a string to the debugger for display.
Definition: Win.h:1111
+
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:1280
+
win_handle< NULL > file_mapping
File mapping.
Definition: Win.h:1439
+
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: Win.h:881
+
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: Win.h:634
+
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:1309
+
win_handle< NULL > process
Process handle wrapper.
Definition: Win.h:1411
+
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:538
+
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:427
+
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:112
+
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:1134
+
static DWORD ExpandEnvironmentStringsW(LPCWSTR lpSrc, std::basic_string< wchar_t, _Traits, _Ax > &sValue) noexcept
Expands environment-variable strings, replaces them with the values defined for the current user,...
Definition: Win.h:205
+
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:246
+
static VOID OutputDebugStrV(LPCSTR lpOutputString, va_list arg) noexcept
Formats and sends a string to the debugger for display.
Definition: Win.h:1087
+
win_handle< NULL > thread
Thread handle wrapper.
Definition: Win.h:1418
+
UnmapViewOfFile_delete()
Default construct.
Definition: Win.h:1478
+
void operator()(_Other *) const
Delete a pointer of another type.
Definition: Win.h:1493
+
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: Win.h:1483
+
UnmapViewOfFile_delete< _Ty > _Myt
This type.
Definition: Win.h:1473
+
Deleter for unique_ptr using UnmapViewOfFile.
Definition: Win.h:1445
+
UnmapViewOfFile_delete(const UnmapViewOfFile_delete< _Ty2 > &)
Construct from another UnmapViewOfFile_delete.
Definition: Win.h:1456
+
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: Win.h:1461
+
UnmapViewOfFile_delete< _Ty > _Myt
This type.
Definition: Win.h:1446
+
UnmapViewOfFile_delete()
Default construct.
Definition: Win.h:1451
+
A structure that enables an allocator for objects of one type to allocate storage for objects of anot...
Definition: Win.h:1689
+
heap_allocator< _Other > other
Other allocator type.
Definition: Win.h:1690
diff --git a/_win_sock2_8h.html b/_win_sock2_8h.html deleted file mode 100644 index 3507d59a..00000000 --- a/_win_sock2_8h.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - -WinStd: include/WinStd/WinSock2.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
WinSock2.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft WinSock2 API. -More...

-
#include "Common.h"
-#include <WinSock2.h>
-#include <ws2def.h>
-#include <WS2tcpip.h>
-
-

Go to the source code of this file.

- - - - - - - - - - - -

-Classes

class  winstd::ws2_runtime_error
 WinSock2 runtime error. More...
 
class  winstd::addrinfo
 SID wrapper class. More...
 
class  winstd::waddrinfo
 SID wrapper class. More...
 
- - - - -

-Typedefs

-typedef addrinfo winstd::taddrinfo
 Multi-byte / Wide-character SID wrapper class (according to _UNICODE)
 
- - - - - - - -

-Functions

static INT GetAddrInfoA (PCSTR pNodeName, PCSTR pServiceName, const ADDRINFOA *pHints, winstd::addrinfo &result)
 Provides protocol-independent translation from a host name to an address. More...
 
static INT GetAddrInfoW (PCWSTR pNodeName, PCWSTR pServiceName, const ADDRINFOW *pHints, winstd::waddrinfo &result)
 Provides protocol-independent translation from a host name to an address. More...
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft WinSock2 API.

-
- - - - diff --git a/_win_sock2_8h_source.html b/_win_sock2_8h_source.html index 65496add..177840ae 100644 --- a/_win_sock2_8h_source.html +++ b/_win_sock2_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,167 +70,165 @@ $(function() {
WinSock2.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
-
14
-
15#include "Common.h"
-
16#include <WinSock2.h>
-
17#include <ws2def.h>
-
18#include <WS2tcpip.h>
-
19
-
20namespace winstd
-
21{
-
24
- -
29 {
-
30 public:
-
37 ws2_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<int>(num, msg)
-
38 {
-
39 }
-
40
-
47 ws2_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<int>(num, msg)
-
48 {
-
49 }
-
50
-
56 ws2_runtime_error(_In_ const std::string& msg) : num_runtime_error<int>(WSAGetLastError(), msg)
-
57 {
-
58 }
-
59
-
65 ws2_runtime_error(_In_opt_z_ const char *msg = nullptr) : num_runtime_error<int>(WSAGetLastError(), msg)
-
66 {
-
67 }
-
68
-
74 tstring msg(_In_opt_ DWORD dwLanguageId = 0) const
-
75 {
-
76 tstring str;
-
77 if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, m_num, dwLanguageId, str, NULL)) {
-
78 // Stock Windows error messages contain CRLF. Well... Trim all the trailing white space.
-
79 str.erase(str.find_last_not_of(_T(" \t\n\r\f\v")) + 1);
-
80 } else
-
81 sprintf(str, m_num >= 0x10000 ? _T("Error 0x%X") : _T("Error %u"), m_num);
-
82 return str;
-
83 }
-
84 };
-
85
-
87
-
90
-
91#if (NTDDI_VERSION >= NTDDI_WINXPSP2) || (_WIN32_WINNT >= 0x0502)
-
92
-
98 class addrinfo : public handle<PADDRINFOA, NULL>
-
99 {
- -
101
-
102 public:
-
108 virtual ~addrinfo()
-
109 {
-
110 if (m_h != invalid)
- -
112 }
-
113
-
114 protected:
-
120 void free_internal() noexcept override
-
121 {
-
122 FreeAddrInfoA(m_h);
-
123 }
-
124 };
-
125
-
131 class waddrinfo : public handle<PADDRINFOW, NULL>
-
132 {
- -
134
-
135 public:
-
141 virtual ~waddrinfo()
-
142 {
-
143 if (m_h != invalid)
- -
145 }
-
146
-
147 protected:
-
153 void free_internal() noexcept override
-
154 {
-
155 FreeAddrInfoW(m_h);
-
156 }
-
157 };
-
158
-
162#ifdef _UNICODE
-
163 typedef waddrinfo taddrinfo;
-
164#else
- -
166#endif
-
167
-
168#endif
-
169
-
171}
-
172
-
175
-
176#pragma warning(push)
-
177#pragma warning(disable: 4505) // Don't warn on unused code
-
178
-
180static INT GetAddrInfoA(
-
181 _In_opt_ PCSTR pNodeName,
-
182 _In_opt_ PCSTR pServiceName,
-
183 _In_opt_ const ADDRINFOA *pHints,
-
184 _Inout_ winstd::addrinfo &result)
-
185{
-
186 PADDRINFOA h;
-
187 INT iResult = GetAddrInfoA(pNodeName, pServiceName, pHints, &h);
-
188 if (iResult == 0)
-
189 result.attach(h);
-
190 return iResult;
-
191}
-
192
-
198static INT GetAddrInfoW(
-
199 _In_opt_ PCWSTR pNodeName,
-
200 _In_opt_ PCWSTR pServiceName,
-
201 _In_opt_ const ADDRINFOW *pHints,
-
202 _Inout_ winstd::waddrinfo &result)
-
203{
-
204 PADDRINFOW h;
-
205 INT iResult = GetAddrInfoW(pNodeName, pServiceName, pHints, &h);
-
206 if (iResult == 0)
-
207 result.attach(h);
-
208 return iResult;
-
209}
-
210
-
211#pragma warning(pop)
-
212
-
General API.
-
Integrates WinStd classes with Microsoft WinSock2 API.
-
SID wrapper class.
Definition: WinSock2.h:99
-
void free_internal() noexcept override
Frees address information.
Definition: WinSock2.h:120
-
virtual ~addrinfo()
Frees address information.
Definition: WinSock2.h:108
-
Base abstract template class to support generic object handle keeping.
Definition: Common.h:615
-
handle_type m_h
Object handle.
Definition: Common.h:866
-
Numerical runtime error.
Definition: Common.h:1011
-
int error_type
Error number type.
Definition: Common.h:1013
-
error_type m_num
Numeric error code.
Definition: Common.h:1049
-
SID wrapper class.
Definition: WinSock2.h:132
-
virtual ~waddrinfo()
Frees address information.
Definition: WinSock2.h:141
-
void free_internal() noexcept override
Frees address information.
Definition: WinSock2.h:153
-
WinSock2 runtime error.
Definition: WinSock2.h:29
-
ws2_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition: WinSock2.h:47
-
ws2_runtime_error(const char *msg=nullptr)
Constructs an exception using WSAGetLastError()
Definition: WinSock2.h:65
-
ws2_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition: WinSock2.h:37
-
ws2_runtime_error(const std::string &msg)
Constructs an exception using WSAGetLastError()
Definition: WinSock2.h:56
-
tstring msg(DWORD dwLanguageId=0) const
Returns a user-readable Windows error message.
Definition: WinSock2.h:74
-
addrinfo taddrinfo
Multi-byte / Wide-character SID wrapper class (according to _UNICODE)
Definition: WinSock2.h:165
-
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:198
-
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:180
-
std::string tstring
Multi-byte / Wide-character string (according to _UNICODE)
Definition: Common.h:346
-
static DWORD FormatMessage(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:307
-
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition: Common.h:292
-
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:171
-
static const PADDRINFOA invalid
Invalid handle value.
Definition: Common.h:625
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <WinSock2.h>
+
13#include <ws2def.h>
+
14#include <WS2tcpip.h>
+
15
+
16namespace winstd
+
17{
+
20
+ +
25 {
+
26 public:
+
33 ws2_runtime_error(_In_ error_type num, _In_ const std::string& msg) : num_runtime_error<int>(num, msg)
+
34 {
+
35 }
+
36
+
43 ws2_runtime_error(_In_ error_type num, _In_opt_z_ const char *msg = nullptr) : num_runtime_error<int>(num, msg)
+
44 {
+
45 }
+
46
+
52 ws2_runtime_error(_In_ const std::string& msg) : num_runtime_error<int>(WSAGetLastError(), msg)
+
53 {
+
54 }
+
55
+
61 ws2_runtime_error(_In_opt_z_ const char *msg = nullptr) : num_runtime_error<int>(WSAGetLastError(), msg)
+
62 {
+
63 }
+
64
+
70 tstring msg(_In_opt_ DWORD dwLanguageId = 0) const
+
71 {
+
72 tstring str;
+
73 if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, m_num, dwLanguageId, str, NULL)) {
+
74 // Stock Windows error messages contain CRLF. Well... Trim all the trailing white space.
+
75 str.erase(str.find_last_not_of(_T(" \t\n\r\f\v")) + 1);
+
76 } else
+
77 sprintf(str, m_num >= 0x10000 ? _T("Error 0x%X") : _T("Error %u"), m_num);
+
78 return str;
+
79 }
+
80 };
+
81
+
83
+
86
+
87#if (NTDDI_VERSION >= NTDDI_WINXPSP2) || (_WIN32_WINNT >= 0x0502)
+
88
+
94 class addrinfo : public handle<PADDRINFOA, NULL>
+
95 {
+ +
97
+
98 public:
+
104 virtual ~addrinfo()
+
105 {
+
106 if (m_h != invalid)
+ +
108 }
+
109
+
110 protected:
+
116 void free_internal() noexcept override
+
117 {
+
118 FreeAddrInfoA(m_h);
+
119 }
+
120 };
+
121
+
127 class waddrinfo : public handle<PADDRINFOW, NULL>
+
128 {
+ +
130
+
131 public:
+
137 virtual ~waddrinfo()
+
138 {
+
139 if (m_h != invalid)
+ +
141 }
+
142
+
143 protected:
+
149 void free_internal() noexcept override
+
150 {
+
151 FreeAddrInfoW(m_h);
+
152 }
+
153 };
+
154
+
158#ifdef _UNICODE
+
159 typedef waddrinfo taddrinfo;
+
160#else
+ +
162#endif
+
163
+
164#endif
+
165
+
167}
+
168
+
171
+
172#pragma warning(push)
+
173#pragma warning(disable: 4505) // Don't warn on unused code
+
174
+
176static INT GetAddrInfoA(
+
177 _In_opt_ PCSTR pNodeName,
+
178 _In_opt_ PCSTR pServiceName,
+
179 _In_opt_ const ADDRINFOA *pHints,
+
180 _Inout_ winstd::addrinfo &result)
+
181{
+
182 PADDRINFOA h;
+
183 INT iResult = GetAddrInfoA(pNodeName, pServiceName, pHints, &h);
+
184 if (iResult == 0)
+
185 result.attach(h);
+
186 return iResult;
+
187}
+
188
+
194static INT GetAddrInfoW(
+
195 _In_opt_ PCWSTR pNodeName,
+
196 _In_opt_ PCWSTR pServiceName,
+
197 _In_opt_ const ADDRINFOW *pHints,
+
198 _Inout_ winstd::waddrinfo &result)
+
199{
+
200 PADDRINFOW h;
+
201 INT iResult = GetAddrInfoW(pNodeName, pServiceName, pHints, &h);
+
202 if (iResult == 0)
+
203 result.attach(h);
+
204 return iResult;
+
205}
+
206
+
207#pragma warning(pop)
+
208
+
SID wrapper class.
Definition: WinSock2.h:95
+
void free_internal() noexcept override
Frees address information.
Definition: WinSock2.h:116
+
virtual ~addrinfo()
Frees address information.
Definition: WinSock2.h:104
+
Base abstract template class to support generic object handle keeping.
Definition: Common.h:607
+
handle_type m_h
Object handle.
Definition: Common.h:858
+
Numerical runtime error.
Definition: Common.h:1003
+
int error_type
Error number type.
Definition: Common.h:1005
+
error_type m_num
Numeric error code.
Definition: Common.h:1041
+
SID wrapper class.
Definition: WinSock2.h:128
+
virtual ~waddrinfo()
Frees address information.
Definition: WinSock2.h:137
+
void free_internal() noexcept override
Frees address information.
Definition: WinSock2.h:149
+
WinSock2 runtime error.
Definition: WinSock2.h:25
+
ws2_runtime_error(error_type num, const char *msg=nullptr)
Constructs an exception.
Definition: WinSock2.h:43
+
ws2_runtime_error(const char *msg=nullptr)
Constructs an exception using WSAGetLastError()
Definition: WinSock2.h:61
+
ws2_runtime_error(error_type num, const std::string &msg)
Constructs an exception.
Definition: WinSock2.h:33
+
ws2_runtime_error(const std::string &msg)
Constructs an exception using WSAGetLastError()
Definition: WinSock2.h:52
+
tstring msg(DWORD dwLanguageId=0) const
Returns a user-readable Windows error message.
Definition: WinSock2.h:70
+
addrinfo taddrinfo
Multi-byte / Wide-character SID wrapper class (according to _UNICODE)
Definition: WinSock2.h:161
+
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:194
+
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:176
+
std::string tstring
Multi-byte / Wide-character string (according to _UNICODE)
Definition: Common.h:338
+
static DWORD FormatMessage(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:299
+
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition: Common.h:284
+
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:163
+
static const PADDRINFOA invalid
Invalid handle value.
Definition: Common.h:617
diff --git a/_win_trust_8h.html b/_win_trust_8h.html deleted file mode 100644 index 31098f8e..00000000 --- a/_win_trust_8h.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - -WinStd: include/WinStd/WinTrust.h File Reference - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
- -
WinTrust.h File Reference
-
-
- -

Integrates WinStd classes with Microsoft WinTrust API. -More...

-
#include "Common.h"
-#include <WinTrust.h>
-
-

Go to the source code of this file.

- - - - - -

-Classes

class  winstd::wintrust
 WinTrust engine wrapper class. More...
 
-

Detailed Description

-

Integrates WinStd classes with Microsoft WinTrust API.

-
- - - - diff --git a/_win_trust_8h_source.html b/_win_trust_8h_source.html index a4e475b0..f30c6854 100644 --- a/_win_trust_8h_source.html +++ b/_win_trust_8h_source.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,62 +70,60 @@ $(function() {
WinTrust.h
-Go to the documentation of this file.
1/*
+
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
-
12
-
13#pragma once
-
14
-
15#include "Common.h"
-
16#include <WinTrust.h>
-
17
-
18namespace winstd
-
19{
-
22
- -
27 {
- - -
30
-
31 public:
-
35 wintrust(_In_opt_ HWND hwnd, _In_ const GUID &action, _Inout_ WINTRUST_DATA &wtd) :
-
36 m_hwnd(hwnd),
-
37 m_action(action),
-
38 m_wtd(wtd)
-
39 {
-
40 const LONG lResult = WinVerifyTrust(m_hwnd, &m_action, &m_wtd);
-
41 if (lResult != ERROR_SUCCESS)
-
42 throw win_runtime_error(lResult, "WinVerifyTrust failed.");
-
43 }
-
44
-
48 virtual ~wintrust()
-
49 {
-
50 m_wtd.dwStateAction = WTD_STATEACTION_CLOSE;
-
51 WinVerifyTrust(m_hwnd, &m_action, &m_wtd);
-
52 }
-
53
-
54 protected:
-
56 HWND m_hwnd;
-
57 GUID m_action;
-
58 WINTRUST_DATA &m_wtd;
-
60 };
-
61
-
63}
-
General API.
-
Integrates WinStd classes with Microsoft WinTrust API.
-
Windows runtime error.
Definition: Common.h:1056
-
WinTrust engine wrapper class.
Definition: WinTrust.h:27
-
wintrust(HWND hwnd, const GUID &action, WINTRUST_DATA &wtd)
Initializes a new class instance.
Definition: WinTrust.h:35
-
virtual ~wintrust()
Destroys the WinTrust context.
Definition: WinTrust.h:48
-
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:74
-
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition: Common.h:82
+
8
+
9#pragma once
+
10
+
11#include "Common.h"
+
12#include <WinTrust.h>
+
13
+
14namespace winstd
+
15{
+
18
+ +
23 {
+ + +
26
+
27 public:
+
31 wintrust(_In_opt_ HWND hwnd, _In_ const GUID &action, _Inout_ WINTRUST_DATA &wtd) :
+
32 m_hwnd(hwnd),
+
33 m_action(action),
+
34 m_wtd(wtd)
+
35 {
+
36 const LONG lResult = WinVerifyTrust(m_hwnd, &m_action, &m_wtd);
+
37 if (lResult != ERROR_SUCCESS)
+
38 throw win_runtime_error(lResult, "WinVerifyTrust failed.");
+
39 }
+
40
+
44 virtual ~wintrust()
+
45 {
+
46 m_wtd.dwStateAction = WTD_STATEACTION_CLOSE;
+
47 WinVerifyTrust(m_hwnd, &m_action, &m_wtd);
+
48 }
+
49
+
50 protected:
+
52 HWND m_hwnd;
+
53 GUID m_action;
+
54 WINTRUST_DATA &m_wtd;
+
56 };
+
57
+
59}
+
Windows runtime error.
Definition: Common.h:1048
+
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
+
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:66
+
#define WINSTD_NONMOVABLE(C)
Declares a class as non-movable.
Definition: Common.h:74
diff --git a/annotated.html b/annotated.html index 2b5264fd..6a8c0d54 100644 --- a/annotated.html +++ b/annotated.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -156,7 +156,7 @@ $(function() {
diff --git a/classes.html b/classes.html index 8bf541ca..298cce08 100644 --- a/classes.html +++ b/classes.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -120,7 +120,7 @@ $(function() { diff --git a/classwinstd_1_1actctx__activator-members.html b/classwinstd_1_1actctx__activator-members.html index abdb8948..416f7894 100644 --- a/classwinstd_1_1actctx__activator-members.html +++ b/classwinstd_1_1actctx__activator-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -79,7 +79,7 @@ $(function() { diff --git a/classwinstd_1_1actctx__activator.html b/classwinstd_1_1actctx__activator.html index 78847d25..dc9b82db 100644 --- a/classwinstd_1_1actctx__activator.html +++ b/classwinstd_1_1actctx__activator.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -168,7 +168,7 @@ ULONG_PTR m_cookie diff --git a/classwinstd_1_1addrinfo-members.html b/classwinstd_1_1addrinfo-members.html index 5e266f95..d9edfe64 100644 --- a/classwinstd_1_1addrinfo-members.html +++ b/classwinstd_1_1addrinfo-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1addrinfo.html b/classwinstd_1_1addrinfo.html index 1b5d6584..b515a2cc 100644 --- a/classwinstd_1_1addrinfo.html +++ b/classwinstd_1_1addrinfo.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -251,7 +251,7 @@ static const PADDRINFOA in diff --git a/classwinstd_1_1basic__string__guid-members.html b/classwinstd_1_1basic__string__guid-members.html index 698a45f5..e1fcf552 100644 --- a/classwinstd_1_1basic__string__guid-members.html +++ b/classwinstd_1_1basic__string__guid-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -77,7 +77,7 @@ $(function() { diff --git a/classwinstd_1_1basic__string__guid.html b/classwinstd_1_1basic__string__guid.html index ddce1fdb..097224ec 100644 --- a/classwinstd_1_1basic__string__guid.html +++ b/classwinstd_1_1basic__string__guid.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -148,7 +148,7 @@ template<class _Elem , class _Traits , class _Ax > diff --git a/classwinstd_1_1basic__string__msg-members.html b/classwinstd_1_1basic__string__msg-members.html index 96e18616..b42038fb 100644 --- a/classwinstd_1_1basic__string__msg-members.html +++ b/classwinstd_1_1basic__string__msg-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -83,7 +83,7 @@ $(function() { diff --git a/classwinstd_1_1basic__string__msg.html b/classwinstd_1_1basic__string__msg.html index 1e633897..bbb5d559 100644 --- a/classwinstd_1_1basic__string__msg.html +++ b/classwinstd_1_1basic__string__msg.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -492,7 +492,7 @@ template<class _Elem , class _Traits , class _Ax > diff --git a/classwinstd_1_1basic__string__printf-members.html b/classwinstd_1_1basic__string__printf-members.html index e05f70d8..cd40e2a2 100644 --- a/classwinstd_1_1basic__string__printf-members.html +++ b/classwinstd_1_1basic__string__printf-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -79,7 +79,7 @@ $(function() { diff --git a/classwinstd_1_1basic__string__printf.html b/classwinstd_1_1basic__string__printf.html index ceeaeab9..4cf0436e 100644 --- a/classwinstd_1_1basic__string__printf.html +++ b/classwinstd_1_1basic__string__printf.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -267,7 +267,7 @@ template<class _Elem , class _Traits , class _Ax > diff --git a/classwinstd_1_1bstr-members.html b/classwinstd_1_1bstr-members.html index c581dcb2..cef48a95 100644 --- a/classwinstd_1_1bstr-members.html +++ b/classwinstd_1_1bstr-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -113,7 +113,7 @@ $(function() { diff --git a/classwinstd_1_1bstr.html b/classwinstd_1_1bstr.html index d1de4dae..93505b50 100644 --- a/classwinstd_1_1bstr.html +++ b/classwinstd_1_1bstr.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -71,7 +71,7 @@ $(function() { Public Member Functions | Protected Member Functions | List of all members -
winstd::bstr Class Reference
+
winstd::bstr Class Reference
@@ -368,7 +368,7 @@ static const BSTR invalid<
diff --git a/classwinstd_1_1cert__chain__context-members.html b/classwinstd_1_1cert__chain__context-members.html index 2f983259..3ecb338a 100644 --- a/classwinstd_1_1cert__chain__context-members.html +++ b/classwinstd_1_1cert__chain__context-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -109,7 +109,7 @@ $(function() { diff --git a/classwinstd_1_1cert__chain__context.html b/classwinstd_1_1cert__chain__context.html index 5b10725a..3ef6ddd2 100644 --- a/classwinstd_1_1cert__chain__context.html +++ b/classwinstd_1_1cert__chain__context.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -325,7 +325,7 @@ static const PCCERT_CHAIN_CONTEXT  diff --git a/classwinstd_1_1cert__context-members.html b/classwinstd_1_1cert__context-members.html index 73af4421..66d11835 100644 --- a/classwinstd_1_1cert__context-members.html +++ b/classwinstd_1_1cert__context-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -115,7 +115,7 @@ $(function() { diff --git a/classwinstd_1_1cert__context.html b/classwinstd_1_1cert__context.html index 91f36977..ef5955fb 100644 --- a/classwinstd_1_1cert__context.html +++ b/classwinstd_1_1cert__context.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -577,7 +577,7 @@ static const PCCERT_CONTEXT < diff --git a/classwinstd_1_1cert__store-members.html b/classwinstd_1_1cert__store-members.html index 83d52254..d2610591 100644 --- a/classwinstd_1_1cert__store-members.html +++ b/classwinstd_1_1cert__store-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1cert__store.html b/classwinstd_1_1cert__store.html index da12f97e..137d1f8b 100644 --- a/classwinstd_1_1cert__store.html +++ b/classwinstd_1_1cert__store.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -253,7 +253,7 @@ static const HCERTSTORE in diff --git a/classwinstd_1_1com__initializer-members.html b/classwinstd_1_1com__initializer-members.html index 213d71af..296f373a 100644 --- a/classwinstd_1_1com__initializer-members.html +++ b/classwinstd_1_1com__initializer-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -81,7 +81,7 @@ $(function() { diff --git a/classwinstd_1_1com__initializer.html b/classwinstd_1_1com__initializer.html index 4129380c..18222471 100644 --- a/classwinstd_1_1com__initializer.html +++ b/classwinstd_1_1com__initializer.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -71,7 +71,7 @@ $(function() { Public Member Functions | Protected Attributes | List of all members -
winstd::com_initializer Class Reference
+
winstd::com_initializer Class Reference
@@ -236,7 +236,7 @@ HRESULT m_result<
diff --git a/classwinstd_1_1com__obj-members.html b/classwinstd_1_1com__obj-members.html index ee0b9701..bd7e347e 100644 --- a/classwinstd_1_1com__obj-members.html +++ b/classwinstd_1_1com__obj-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -113,7 +113,7 @@ $(function() { diff --git a/classwinstd_1_1com__obj.html b/classwinstd_1_1com__obj.html index 7c3da1af..4d08a0d2 100644 --- a/classwinstd_1_1com__obj.html +++ b/classwinstd_1_1com__obj.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -71,7 +71,7 @@ $(function() { Public Member Functions | Protected Member Functions | List of all members -
winstd::com_obj< T > Class Template Reference
+
winstd::com_obj< T > Class Template Reference
@@ -451,7 +451,7 @@ template<class _Other >
diff --git a/classwinstd_1_1com__runtime__error-members.html b/classwinstd_1_1com__runtime__error-members.html index d502f4d3..2e1f1cd1 100644 --- a/classwinstd_1_1com__runtime__error-members.html +++ b/classwinstd_1_1com__runtime__error-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -83,7 +83,7 @@ $(function() { diff --git a/classwinstd_1_1com__runtime__error.html b/classwinstd_1_1com__runtime__error.html index 8db701b4..8aebca93 100644 --- a/classwinstd_1_1com__runtime__error.html +++ b/classwinstd_1_1com__runtime__error.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -221,7 +221,7 @@ typedef HRESULT error_type diff --git a/classwinstd_1_1console__ctrl__handler-members.html b/classwinstd_1_1console__ctrl__handler-members.html index 23cbb249..2933ee8b 100644 --- a/classwinstd_1_1console__ctrl__handler-members.html +++ b/classwinstd_1_1console__ctrl__handler-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,7 @@ $(function() { diff --git a/classwinstd_1_1console__ctrl__handler.html b/classwinstd_1_1console__ctrl__handler.html index 5a9ff2fa..a7fcc5e7 100644 --- a/classwinstd_1_1console__ctrl__handler.html +++ b/classwinstd_1_1console__ctrl__handler.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -172,7 +172,7 @@ PHANDLER_ROUTINE m_handler diff --git a/classwinstd_1_1critical__section-members.html b/classwinstd_1_1critical__section-members.html index 2afe4b95..5fdb5452 100644 --- a/classwinstd_1_1critical__section-members.html +++ b/classwinstd_1_1critical__section-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,7 @@ $(function() { diff --git a/classwinstd_1_1critical__section.html b/classwinstd_1_1critical__section.html index 9afd8233..ff40dcb7 100644 --- a/classwinstd_1_1critical__section.html +++ b/classwinstd_1_1critical__section.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -193,7 +193,7 @@ CRITICAL_SECTION m_data diff --git a/classwinstd_1_1crypt__hash-members.html b/classwinstd_1_1crypt__hash-members.html index d616ab53..acd281bc 100644 --- a/classwinstd_1_1crypt__hash-members.html +++ b/classwinstd_1_1crypt__hash-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -109,7 +109,7 @@ $(function() { diff --git a/classwinstd_1_1crypt__hash.html b/classwinstd_1_1crypt__hash.html index af44b2aa..5d848cef 100644 --- a/classwinstd_1_1crypt__hash.html +++ b/classwinstd_1_1crypt__hash.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -325,7 +325,7 @@ static const HCRYPTHASH in diff --git a/classwinstd_1_1crypt__key-members.html b/classwinstd_1_1crypt__key-members.html index f79a0267..e3bf82ef 100644 --- a/classwinstd_1_1crypt__key-members.html +++ b/classwinstd_1_1crypt__key-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -110,7 +110,7 @@ $(function() { diff --git a/classwinstd_1_1crypt__key.html b/classwinstd_1_1crypt__key.html index b9376ffa..957472a4 100644 --- a/classwinstd_1_1crypt__key.html +++ b/classwinstd_1_1crypt__key.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -380,7 +380,7 @@ static const HCRYPTKEY inv diff --git a/classwinstd_1_1crypt__prov-members.html b/classwinstd_1_1crypt__prov-members.html index 7c0abdfa..4d2ac507 100644 --- a/classwinstd_1_1crypt__prov-members.html +++ b/classwinstd_1_1crypt__prov-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1crypt__prov.html b/classwinstd_1_1crypt__prov.html index 618102d5..ce91abb8 100644 --- a/classwinstd_1_1crypt__prov.html +++ b/classwinstd_1_1crypt__prov.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -251,7 +251,7 @@ static const HCRYPTPROV in diff --git a/classwinstd_1_1data__blob-members.html b/classwinstd_1_1data__blob-members.html index 93f5231b..6c88299f 100644 --- a/classwinstd_1_1data__blob-members.html +++ b/classwinstd_1_1data__blob-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -86,7 +86,7 @@ $(function() { diff --git a/classwinstd_1_1data__blob.html b/classwinstd_1_1data__blob.html index 676738eb..b1d8ad70 100644 --- a/classwinstd_1_1data__blob.html +++ b/classwinstd_1_1data__blob.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -136,7 +136,7 @@ BYTE * data () noexcep diff --git a/classwinstd_1_1dc-members.html b/classwinstd_1_1dc-members.html index 6725612e..26b67aad 100644 --- a/classwinstd_1_1dc-members.html +++ b/classwinstd_1_1dc-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1dc.html b/classwinstd_1_1dc.html index e1d330a3..dc6b8382 100644 --- a/classwinstd_1_1dc.html +++ b/classwinstd_1_1dc.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -250,7 +250,7 @@ static const HDC invalid diff --git a/classwinstd_1_1dc__selector-members.html b/classwinstd_1_1dc__selector-members.html index 072eb9b7..36e5abf7 100644 --- a/classwinstd_1_1dc__selector-members.html +++ b/classwinstd_1_1dc__selector-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -81,7 +81,7 @@ $(function() { diff --git a/classwinstd_1_1dc__selector.html b/classwinstd_1_1dc__selector.html index c2d04b7d..62acb835 100644 --- a/classwinstd_1_1dc__selector.html +++ b/classwinstd_1_1dc__selector.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -208,7 +208,7 @@ HGDIOBJ m_orig diff --git a/classwinstd_1_1dplhandle-members.html b/classwinstd_1_1dplhandle-members.html index 3df68cef..d232eb74 100644 --- a/classwinstd_1_1dplhandle-members.html +++ b/classwinstd_1_1dplhandle-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -108,7 +108,7 @@ $(function() { diff --git a/classwinstd_1_1dplhandle.html b/classwinstd_1_1dplhandle.html index e517d949..61651fff 100644 --- a/classwinstd_1_1dplhandle.html +++ b/classwinstd_1_1dplhandle.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -545,7 +545,7 @@ template<class T , T INVAL> diff --git a/classwinstd_1_1eap__attr-members.html b/classwinstd_1_1eap__attr-members.html index 3ff84af0..b5931cd1 100644 --- a/classwinstd_1_1eap__attr-members.html +++ b/classwinstd_1_1eap__attr-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -83,7 +83,7 @@ $(function() { diff --git a/classwinstd_1_1eap__attr.html b/classwinstd_1_1eap__attr.html index aa8493bd..4be1b152 100644 --- a/classwinstd_1_1eap__attr.html +++ b/classwinstd_1_1eap__attr.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -173,7 +173,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 4bdd4abc..831e2248 100644 --- a/classwinstd_1_1eap__method__info__array-members.html +++ b/classwinstd_1_1eap__method__info__array-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,7 @@ $(function() { diff --git a/classwinstd_1_1eap__method__info__array.html b/classwinstd_1_1eap__method__info__array.html index 28a0fac8..b3828c07 100644 --- a/classwinstd_1_1eap__method__info__array.html +++ b/classwinstd_1_1eap__method__info__array.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -180,7 +180,7 @@ Public Member Functions diff --git a/classwinstd_1_1eap__method__prop-members.html b/classwinstd_1_1eap__method__prop-members.html index f8909df9..8b536d67 100644 --- a/classwinstd_1_1eap__method__prop-members.html +++ b/classwinstd_1_1eap__method__prop-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -79,7 +79,7 @@ $(function() { diff --git a/classwinstd_1_1eap__method__prop.html b/classwinstd_1_1eap__method__prop.html index d4861426..0ce94be4 100644 --- a/classwinstd_1_1eap__method__prop.html +++ b/classwinstd_1_1eap__method__prop.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -241,7 +241,7 @@ Public Member Functions diff --git a/classwinstd_1_1eap__packet-members.html b/classwinstd_1_1eap__packet-members.html index ed459128..afe44e92 100644 --- a/classwinstd_1_1eap__packet-members.html +++ b/classwinstd_1_1eap__packet-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -111,7 +111,7 @@ $(function() { diff --git a/classwinstd_1_1eap__packet.html b/classwinstd_1_1eap__packet.html index 5528add6..63f4432f 100644 --- a/classwinstd_1_1eap__packet.html +++ b/classwinstd_1_1eap__packet.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -352,7 +352,7 @@ static const EapPacket * i diff --git a/classwinstd_1_1eap__runtime__error-members.html b/classwinstd_1_1eap__runtime__error-members.html index 3349f788..1702d082 100644 --- a/classwinstd_1_1eap__runtime__error-members.html +++ b/classwinstd_1_1eap__runtime__error-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -102,7 +102,7 @@ $(function() { diff --git a/classwinstd_1_1eap__runtime__error.html b/classwinstd_1_1eap__runtime__error.html index 8f515a50..63aebae8 100644 --- a/classwinstd_1_1eap__runtime__error.html +++ b/classwinstd_1_1eap__runtime__error.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -298,7 +298,7 @@ typedef DWORD error_type diff --git a/classwinstd_1_1event__data-members.html b/classwinstd_1_1event__data-members.html index 5e963c3e..a0ca14e9 100644 --- a/classwinstd_1_1event__data-members.html +++ b/classwinstd_1_1event__data-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -88,7 +88,7 @@ $(function() { diff --git a/classwinstd_1_1event__data.html b/classwinstd_1_1event__data.html index d6a0ed5d..a3edb8ff 100644 --- a/classwinstd_1_1event__data.html +++ b/classwinstd_1_1event__data.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -533,7 +533,7 @@ template<class _Elem , class _Traits , class _Ax > diff --git a/classwinstd_1_1event__fn__auto-members.html b/classwinstd_1_1event__fn__auto-members.html index 29c1b62b..654148ae 100644 --- a/classwinstd_1_1event__fn__auto-members.html +++ b/classwinstd_1_1event__fn__auto-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -85,7 +85,7 @@ $(function() { diff --git a/classwinstd_1_1event__fn__auto.html b/classwinstd_1_1event__fn__auto.html index 0ae40d4d..aefa271e 100644 --- a/classwinstd_1_1event__fn__auto.html +++ b/classwinstd_1_1event__fn__auto.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -131,7 +131,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 4d29fc92..24b926f5 100644 --- a/classwinstd_1_1event__fn__auto__ret-members.html +++ b/classwinstd_1_1event__fn__auto__ret-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -86,7 +86,7 @@ $(function() { diff --git a/classwinstd_1_1event__fn__auto__ret.html b/classwinstd_1_1event__fn__auto__ret.html index b90fc398..689aa7fc 100644 --- a/classwinstd_1_1event__fn__auto__ret.html +++ b/classwinstd_1_1event__fn__auto__ret.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -136,7 +136,7 @@ class winstd::event_fn_auto_ret< T >

Helper template to write an

diff --git a/classwinstd_1_1event__log-members.html b/classwinstd_1_1event__log-members.html index 1167cc7f..31554b24 100644 --- a/classwinstd_1_1event__log-members.html +++ b/classwinstd_1_1event__log-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1event__log.html b/classwinstd_1_1event__log.html index a36e0a21..fd2fce90 100644 --- a/classwinstd_1_1event__log.html +++ b/classwinstd_1_1event__log.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -251,7 +251,7 @@ static const HANDLE invali diff --git a/classwinstd_1_1event__provider-members.html b/classwinstd_1_1event__provider-members.html index 12afbb48..086cf0c4 100644 --- a/classwinstd_1_1event__provider-members.html +++ b/classwinstd_1_1event__provider-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -108,7 +108,7 @@ $(function() { diff --git a/classwinstd_1_1event__provider.html b/classwinstd_1_1event__provider.html index baa1e2b0..a3345886 100644 --- a/classwinstd_1_1event__provider.html +++ b/classwinstd_1_1event__provider.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -680,7 +680,7 @@ static const REGHANDLE inv diff --git a/classwinstd_1_1event__rec-members.html b/classwinstd_1_1event__rec-members.html index 81dd74b0..4e9781f3 100644 --- a/classwinstd_1_1event__rec-members.html +++ b/classwinstd_1_1event__rec-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -88,7 +88,7 @@ $(function() { diff --git a/classwinstd_1_1event__rec.html b/classwinstd_1_1event__rec.html index a411e477..76daee05 100644 --- a/classwinstd_1_1event__rec.html +++ b/classwinstd_1_1event__rec.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -524,7 +524,7 @@ Protected Member Functions diff --git a/classwinstd_1_1event__session-members.html b/classwinstd_1_1event__session-members.html index 1143dd97..c997eb4c 100644 --- a/classwinstd_1_1event__session-members.html +++ b/classwinstd_1_1event__session-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -111,7 +111,7 @@ $(function() { diff --git a/classwinstd_1_1event__session.html b/classwinstd_1_1event__session.html index c358a9b9..7cf138ec 100644 --- a/classwinstd_1_1event__session.html +++ b/classwinstd_1_1event__session.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -684,7 +684,7 @@ static const TRACEHANDLE i diff --git a/classwinstd_1_1event__trace-members.html b/classwinstd_1_1event__trace-members.html index 74a908fa..aa320f40 100644 --- a/classwinstd_1_1event__trace-members.html +++ b/classwinstd_1_1event__trace-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1event__trace.html b/classwinstd_1_1event__trace.html index e83025fb..fdbaf4c2 100644 --- a/classwinstd_1_1event__trace.html +++ b/classwinstd_1_1event__trace.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -251,7 +251,7 @@ static const TRACEHANDLE i diff --git a/classwinstd_1_1event__trace__enabler-members.html b/classwinstd_1_1event__trace__enabler-members.html index b5a232b8..ef8a342a 100644 --- a/classwinstd_1_1event__trace__enabler-members.html +++ b/classwinstd_1_1event__trace__enabler-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -89,7 +89,7 @@ $(function() { diff --git a/classwinstd_1_1event__trace__enabler.html b/classwinstd_1_1event__trace__enabler.html index f3f92bf2..a5eaa854 100644 --- a/classwinstd_1_1event__trace__enabler.html +++ b/classwinstd_1_1event__trace__enabler.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -344,7 +344,7 @@ PEVENT_FILTER_DESCRIPTOR m diff --git a/classwinstd_1_1find__file-members.html b/classwinstd_1_1find__file-members.html index 0760e67c..31103a80 100644 --- a/classwinstd_1_1find__file-members.html +++ b/classwinstd_1_1find__file-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1find__file.html b/classwinstd_1_1find__file.html index 31fde7e7..9fac23ba 100644 --- a/classwinstd_1_1find__file.html +++ b/classwinstd_1_1find__file.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -251,7 +251,7 @@ static const HANDLE invali diff --git a/classwinstd_1_1gdi__handle-members.html b/classwinstd_1_1gdi__handle-members.html index 715ae0ad..05b1c5e8 100644 --- a/classwinstd_1_1gdi__handle-members.html +++ b/classwinstd_1_1gdi__handle-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1gdi__handle.html b/classwinstd_1_1gdi__handle.html index f32b3c23..456e79de 100644 --- a/classwinstd_1_1gdi__handle.html +++ b/classwinstd_1_1gdi__handle.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -255,7 +255,7 @@ template<class T > diff --git a/classwinstd_1_1handle-members.html b/classwinstd_1_1handle-members.html index 8f088e5c..0fb171b3 100644 --- a/classwinstd_1_1handle-members.html +++ b/classwinstd_1_1handle-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -99,7 +99,7 @@ $(function() { diff --git a/classwinstd_1_1handle.html b/classwinstd_1_1handle.html index 7c8359cf..89bd5226 100644 --- a/classwinstd_1_1handle.html +++ b/classwinstd_1_1handle.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -835,7 +835,7 @@ template<class T , const T INVAL> diff --git a/classwinstd_1_1heap-members.html b/classwinstd_1_1heap-members.html index 9bc14aed..fcccd0ef 100644 --- a/classwinstd_1_1heap-members.html +++ b/classwinstd_1_1heap-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -101,7 +101,7 @@ $(function() { diff --git a/classwinstd_1_1heap.html b/classwinstd_1_1heap.html index 653a714b..1328b476 100644 --- a/classwinstd_1_1heap.html +++ b/classwinstd_1_1heap.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -286,7 +286,7 @@ static const HANDLE invali diff --git a/classwinstd_1_1heap__allocator-members.html b/classwinstd_1_1heap__allocator-members.html index d8e7da0d..618e0678 100644 --- a/classwinstd_1_1heap__allocator-members.html +++ b/classwinstd_1_1heap__allocator-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -92,7 +92,7 @@ $(function() { diff --git a/classwinstd_1_1heap__allocator.html b/classwinstd_1_1heap__allocator.html index 1330c280..8cb482a2 100644 --- a/classwinstd_1_1heap__allocator.html +++ b/classwinstd_1_1heap__allocator.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -454,7 +454,7 @@ template<class _Ty > diff --git a/classwinstd_1_1library-members.html b/classwinstd_1_1library-members.html index bc4a849a..8d2c9d3a 100644 --- a/classwinstd_1_1library-members.html +++ b/classwinstd_1_1library-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1library.html b/classwinstd_1_1library.html index 7840f51d..914a0e1f 100644 --- a/classwinstd_1_1library.html +++ b/classwinstd_1_1library.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -251,7 +251,7 @@ static const HMODULE inval diff --git a/classwinstd_1_1num__runtime__error-members.html b/classwinstd_1_1num__runtime__error-members.html index 191042a5..52ab3675 100644 --- a/classwinstd_1_1num__runtime__error-members.html +++ b/classwinstd_1_1num__runtime__error-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -81,7 +81,7 @@ $(function() { diff --git a/classwinstd_1_1num__runtime__error.html b/classwinstd_1_1num__runtime__error.html index cf69af01..9fca9676 100644 --- a/classwinstd_1_1num__runtime__error.html +++ b/classwinstd_1_1num__runtime__error.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -218,7 +218,7 @@ template<typename _Tn > diff --git a/classwinstd_1_1process__information-members.html b/classwinstd_1_1process__information-members.html index 3efd65fa..af919960 100644 --- a/classwinstd_1_1process__information-members.html +++ b/classwinstd_1_1process__information-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -78,7 +78,7 @@ $(function() { diff --git a/classwinstd_1_1process__information.html b/classwinstd_1_1process__information.html index 6306b511..328607eb 100644 --- a/classwinstd_1_1process__information.html +++ b/classwinstd_1_1process__information.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -104,7 +104,7 @@ Public Member Functions diff --git a/classwinstd_1_1ref__unique__ptr-members.html b/classwinstd_1_1ref__unique__ptr-members.html index f612e8df..2c397eb9 100644 --- a/classwinstd_1_1ref__unique__ptr-members.html +++ b/classwinstd_1_1ref__unique__ptr-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -83,7 +83,7 @@ $(function() { diff --git a/classwinstd_1_1ref__unique__ptr.html b/classwinstd_1_1ref__unique__ptr.html index 154184e1..1680286e 100644 --- a/classwinstd_1_1ref__unique__ptr.html +++ b/classwinstd_1_1ref__unique__ptr.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -253,7 +253,7 @@ template<class _Ty , class _Dx > 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 eb5cbf93..9ccc34e3 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -85,7 +85,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 e0780b60..cb83e2c6 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -333,7 +333,7 @@ template<class _Ty , class _Dx > diff --git a/classwinstd_1_1reg__key-members.html b/classwinstd_1_1reg__key-members.html index 36b54c3e..c9ff1b45 100644 --- a/classwinstd_1_1reg__key-members.html +++ b/classwinstd_1_1reg__key-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -101,7 +101,7 @@ $(function() { diff --git a/classwinstd_1_1reg__key.html b/classwinstd_1_1reg__key.html index 62a793a0..ad69a2d1 100644 --- a/classwinstd_1_1reg__key.html +++ b/classwinstd_1_1reg__key.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -295,7 +295,7 @@ static const HKEY invalid< diff --git a/classwinstd_1_1sanitizing__allocator-members.html b/classwinstd_1_1sanitizing__allocator-members.html index 1cf765d2..7eca4e42 100644 --- a/classwinstd_1_1sanitizing__allocator-members.html +++ b/classwinstd_1_1sanitizing__allocator-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -81,7 +81,7 @@ $(function() { diff --git a/classwinstd_1_1sanitizing__allocator.html b/classwinstd_1_1sanitizing__allocator.html index f8af0113..f2d41d18 100644 --- a/classwinstd_1_1sanitizing__allocator.html +++ b/classwinstd_1_1sanitizing__allocator.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -130,7 +130,7 @@ class winstd::sanitizing_allocator< _Ty >

An allocator template t

diff --git a/classwinstd_1_1sanitizing__blob-members.html b/classwinstd_1_1sanitizing__blob-members.html index 5dda5077..3c50ce49 100644 --- a/classwinstd_1_1sanitizing__blob-members.html +++ b/classwinstd_1_1sanitizing__blob-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -79,7 +79,7 @@ $(function() { diff --git a/classwinstd_1_1sanitizing__blob.html b/classwinstd_1_1sanitizing__blob.html index c417235c..009acab6 100644 --- a/classwinstd_1_1sanitizing__blob.html +++ b/classwinstd_1_1sanitizing__blob.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -107,7 +107,7 @@ class winstd::sanitizing_blob< N >

Sanitizing BLOB.

diff --git a/classwinstd_1_1sec__buffer__desc-members.html b/classwinstd_1_1sec__buffer__desc-members.html index c7a12770..12753340 100644 --- a/classwinstd_1_1sec__buffer__desc-members.html +++ b/classwinstd_1_1sec__buffer__desc-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -78,7 +78,7 @@ $(function() { diff --git a/classwinstd_1_1sec__buffer__desc.html b/classwinstd_1_1sec__buffer__desc.html index 9be643da..fcb697a1 100644 --- a/classwinstd_1_1sec__buffer__desc.html +++ b/classwinstd_1_1sec__buffer__desc.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -132,7 +132,7 @@ Public Member Functions diff --git a/classwinstd_1_1sec__context-members.html b/classwinstd_1_1sec__context-members.html index 069fbde9..ccc80eb9 100644 --- a/classwinstd_1_1sec__context-members.html +++ b/classwinstd_1_1sec__context-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1sec__context.html b/classwinstd_1_1sec__context.html index 388583ed..37f62283 100644 --- a/classwinstd_1_1sec__context.html +++ b/classwinstd_1_1sec__context.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -482,7 +482,7 @@ static const PCtxtHandle i diff --git a/classwinstd_1_1sec__credentials-members.html b/classwinstd_1_1sec__credentials-members.html index 901a28d3..c2764861 100644 --- a/classwinstd_1_1sec__credentials-members.html +++ b/classwinstd_1_1sec__credentials-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -106,7 +106,7 @@ $(function() { diff --git a/classwinstd_1_1sec__credentials.html b/classwinstd_1_1sec__credentials.html index 4b84258a..537e260b 100644 --- a/classwinstd_1_1sec__credentials.html +++ b/classwinstd_1_1sec__credentials.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -461,7 +461,7 @@ static const PCredHandle i diff --git a/classwinstd_1_1sec__runtime__error-members.html b/classwinstd_1_1sec__runtime__error-members.html index e35fc7c1..438a6449 100644 --- a/classwinstd_1_1sec__runtime__error-members.html +++ b/classwinstd_1_1sec__runtime__error-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -84,7 +84,7 @@ $(function() { diff --git a/classwinstd_1_1sec__runtime__error.html b/classwinstd_1_1sec__runtime__error.html index 48181ece..ba1b3ba4 100644 --- a/classwinstd_1_1sec__runtime__error.html +++ b/classwinstd_1_1sec__runtime__error.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -258,7 +258,7 @@ typedef SECURITY_STATUS er diff --git a/classwinstd_1_1security__id-members.html b/classwinstd_1_1security__id-members.html index bd29cd7e..a401e536 100644 --- a/classwinstd_1_1security__id-members.html +++ b/classwinstd_1_1security__id-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1security__id.html b/classwinstd_1_1security__id.html index bddff261..fb0b2cd7 100644 --- a/classwinstd_1_1security__id.html +++ b/classwinstd_1_1security__id.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -250,7 +250,7 @@ static const PSID invalid< diff --git a/classwinstd_1_1setup__device__info__list-members.html b/classwinstd_1_1setup__device__info__list-members.html index 8b61f1ba..0b20de20 100644 --- a/classwinstd_1_1setup__device__info__list-members.html +++ b/classwinstd_1_1setup__device__info__list-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1setup__device__info__list.html b/classwinstd_1_1setup__device__info__list.html index ff388dd5..6c60f758 100644 --- a/classwinstd_1_1setup__device__info__list.html +++ b/classwinstd_1_1setup__device__info__list.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -253,7 +253,7 @@ static const HDEVINFO inva diff --git a/classwinstd_1_1setup__driver__info__list__builder-members.html b/classwinstd_1_1setup__driver__info__list__builder-members.html index 44c485af..15ad3ee7 100644 --- a/classwinstd_1_1setup__driver__info__list__builder-members.html +++ b/classwinstd_1_1setup__driver__info__list__builder-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -79,7 +79,7 @@ $(function() { diff --git a/classwinstd_1_1setup__driver__info__list__builder.html b/classwinstd_1_1setup__driver__info__list__builder.html index 5f07212a..246a8eea 100644 --- a/classwinstd_1_1setup__driver__info__list__builder.html +++ b/classwinstd_1_1setup__driver__info__list__builder.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -202,7 +202,7 @@ Public Member Functions diff --git a/classwinstd_1_1string__guid-members.html b/classwinstd_1_1string__guid-members.html index 653aca0f..f473f92d 100644 --- a/classwinstd_1_1string__guid-members.html +++ b/classwinstd_1_1string__guid-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -78,7 +78,7 @@ $(function() { diff --git a/classwinstd_1_1string__guid.html b/classwinstd_1_1string__guid.html index e64fbf8e..a7c13ed5 100644 --- a/classwinstd_1_1string__guid.html +++ b/classwinstd_1_1string__guid.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -141,7 +141,7 @@ Public Member Functions diff --git a/classwinstd_1_1user__impersonator-members.html b/classwinstd_1_1user__impersonator-members.html index 146a1a4d..a69acb2d 100644 --- a/classwinstd_1_1user__impersonator-members.html +++ b/classwinstd_1_1user__impersonator-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -79,7 +79,7 @@ $(function() { diff --git a/classwinstd_1_1user__impersonator.html b/classwinstd_1_1user__impersonator.html index 79b33b81..8f90f554 100644 --- a/classwinstd_1_1user__impersonator.html +++ b/classwinstd_1_1user__impersonator.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -168,7 +168,7 @@ BOOL m_cookie diff --git a/classwinstd_1_1variant-members.html b/classwinstd_1_1variant-members.html index 1bd236aa..122596bb 100644 --- a/classwinstd_1_1variant-members.html +++ b/classwinstd_1_1variant-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -137,7 +137,7 @@ $(function() { diff --git a/classwinstd_1_1variant.html b/classwinstd_1_1variant.html index 8511006e..55713147 100644 --- a/classwinstd_1_1variant.html +++ b/classwinstd_1_1variant.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,7 +70,7 @@ $(function() { -
winstd::variant Class Reference
+
winstd::variant Class Reference
@@ -607,7 +607,7 @@ virtual ~variant () diff --git a/classwinstd_1_1vmemory-members.html b/classwinstd_1_1vmemory-members.html index bfe52104..68feaa61 100644 --- a/classwinstd_1_1vmemory-members.html +++ b/classwinstd_1_1vmemory-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -107,7 +107,7 @@ $(function() {
diff --git a/classwinstd_1_1vmemory.html b/classwinstd_1_1vmemory.html index ecffe907..2a0e6c68 100644 --- a/classwinstd_1_1vmemory.html +++ b/classwinstd_1_1vmemory.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -498,7 +498,7 @@ static const LPVOID invali diff --git a/classwinstd_1_1waddrinfo-members.html b/classwinstd_1_1waddrinfo-members.html index e4c971cd..e4c6d36e 100644 --- a/classwinstd_1_1waddrinfo-members.html +++ b/classwinstd_1_1waddrinfo-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1waddrinfo.html b/classwinstd_1_1waddrinfo.html index 19d29de4..fa385389 100644 --- a/classwinstd_1_1waddrinfo.html +++ b/classwinstd_1_1waddrinfo.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -251,7 +251,7 @@ static const PADDRINFOW in diff --git a/classwinstd_1_1win__handle-members.html b/classwinstd_1_1win__handle-members.html index 13000f43..23f77206 100644 --- a/classwinstd_1_1win__handle-members.html +++ b/classwinstd_1_1win__handle-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1win__handle.html b/classwinstd_1_1win__handle.html index b3e6f985..d8c2c8f7 100644 --- a/classwinstd_1_1win__handle.html +++ b/classwinstd_1_1win__handle.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -255,7 +255,7 @@ template<HANDLE INVALID> diff --git a/classwinstd_1_1win__runtime__error-members.html b/classwinstd_1_1win__runtime__error-members.html index ad7e25fa..a9e1cb15 100644 --- a/classwinstd_1_1win__runtime__error-members.html +++ b/classwinstd_1_1win__runtime__error-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -86,7 +86,7 @@ $(function() { diff --git a/classwinstd_1_1win__runtime__error.html b/classwinstd_1_1win__runtime__error.html index c6dd60d8..08b9fb4f 100644 --- a/classwinstd_1_1win__runtime__error.html +++ b/classwinstd_1_1win__runtime__error.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -328,7 +328,7 @@ typedef DWORD error_type diff --git a/classwinstd_1_1window__dc-members.html b/classwinstd_1_1window__dc-members.html index ba1c86a6..d42c5da5 100644 --- a/classwinstd_1_1window__dc-members.html +++ b/classwinstd_1_1window__dc-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -105,7 +105,7 @@ $(function() { diff --git a/classwinstd_1_1window__dc.html b/classwinstd_1_1window__dc.html index 1279b364..17cd9b1b 100644 --- a/classwinstd_1_1window__dc.html +++ b/classwinstd_1_1window__dc.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -274,7 +274,7 @@ static const HDC invalid diff --git a/classwinstd_1_1wintrust-members.html b/classwinstd_1_1wintrust-members.html index 46d1c178..9974ffd2 100644 --- a/classwinstd_1_1wintrust-members.html +++ b/classwinstd_1_1wintrust-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -78,7 +78,7 @@ $(function() { diff --git a/classwinstd_1_1wintrust.html b/classwinstd_1_1wintrust.html index c9c35d11..93ac40c1 100644 --- a/classwinstd_1_1wintrust.html +++ b/classwinstd_1_1wintrust.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -98,7 +98,7 @@ virtual ~wintrust () diff --git a/classwinstd_1_1wlan__handle-members.html b/classwinstd_1_1wlan__handle-members.html index f052ee21..95ffc687 100644 --- a/classwinstd_1_1wlan__handle-members.html +++ b/classwinstd_1_1wlan__handle-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -100,7 +100,7 @@ $(function() { diff --git a/classwinstd_1_1wlan__handle.html b/classwinstd_1_1wlan__handle.html index 898ae87b..e833aebe 100644 --- a/classwinstd_1_1wlan__handle.html +++ b/classwinstd_1_1wlan__handle.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -251,7 +251,7 @@ static const HANDLE invali diff --git a/classwinstd_1_1ws2__runtime__error-members.html b/classwinstd_1_1ws2__runtime__error-members.html index af81acf9..90c179c9 100644 --- a/classwinstd_1_1ws2__runtime__error-members.html +++ b/classwinstd_1_1ws2__runtime__error-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -86,7 +86,7 @@ $(function() { diff --git a/classwinstd_1_1ws2__runtime__error.html b/classwinstd_1_1ws2__runtime__error.html index 56e5037a..eb4ec291 100644 --- a/classwinstd_1_1ws2__runtime__error.html +++ b/classwinstd_1_1ws2__runtime__error.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -327,7 +327,7 @@ typedef int error_type diff --git a/classwinstd_1_1wstring__guid-members.html b/classwinstd_1_1wstring__guid-members.html index 1fc6812f..c379f910 100644 --- a/classwinstd_1_1wstring__guid-members.html +++ b/classwinstd_1_1wstring__guid-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -78,7 +78,7 @@ $(function() { diff --git a/classwinstd_1_1wstring__guid.html b/classwinstd_1_1wstring__guid.html index 2bfb1c7b..34bab34f 100644 --- a/classwinstd_1_1wstring__guid.html +++ b/classwinstd_1_1wstring__guid.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -141,7 +141,7 @@ Public Member Functions diff --git a/dir_6f50bb204833d887b928571856c82fbe.html b/dir_6f50bb204833d887b928571856c82fbe.html index ca670c86..7a44345a 100644 --- a/dir_6f50bb204833d887b928571856c82fbe.html +++ b/dir_6f50bb204833d887b928571856c82fbe.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -73,56 +73,41 @@ $(function() { - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - +

Files

file  COM.h [code]
 Provides helper templates for Windows COM object manipulation.
file  COM.h [code]
 
file  Common.h [code]
 General API.
file  Common.h [code]
 
file  Cred.h [code]
 Integrates WinStd classes with Microsoft Credentials API.
file  Cred.h [code]
 
file  Crypt.h [code]
 Integrates WinStd classes with Microsoft Cryptography API.
file  Crypt.h [code]
 
file  EAP.h [code]
 Integrates WinStd classes with Microsoft EAP API.
file  EAP.h [code]
 
file  ETW.h [code]
 Integrates WinStd classes with Event Tracing for Windows API.
file  ETW.h [code]
 
file  GDI.h [code]
 Integrates WinStd classes with Microsoft Windows GDI.
file  GDI.h [code]
 
file  MSI.h [code]
 Integrates WinStd classes with Microsoft Installer API.
file  MSI.h [code]
 
file  Sec.h [code]
 Integrates WinStd classes with Microsoft Security API.
file  Sec.h [code]
 
file  SetupAPI.h [code]
 Integrates WinStd classes with Microsoft Setup API.
file  SetupAPI.h [code]
 
file  Shell.h [code]
 Integrates WinStd classes with Microsoft Shell API.
file  Shell.h [code]
 
file  Win.h [code]
 Integrates WinStd classes with Microsoft Windows API.
file  Win.h [code]
 
file  WinSock2.h [code]
 Integrates WinStd classes with Microsoft WinSock2 API.
file  WinSock2.h [code]
 
file  WinTrust.h [code]
 Integrates WinStd classes with Microsoft WinTrust API.
file  WinTrust.h [code]
 
file  WLAN.h [code]
 Integrates WinStd classes with Microsoft WLAN API.
file  WLAN.h [code]
 
diff --git a/dir_d44c64559bbebec7f509842c48db8b23.html b/dir_d44c64559bbebec7f509842c48db8b23.html index 2836d2aa..fc0c3b35 100644 --- a/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/dir_d44c64559bbebec7f509842c48db8b23.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -79,7 +79,7 @@ Directories diff --git a/files.html b/files.html index 2b08a9f5..ba17f2e1 100644 --- a/files.html +++ b/files.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,27 +70,27 @@ $(function() {
[detail level 123]
- - - - - - - - - - - - - - - + + + + + + + + + + + + + + +
  include
  WinStd
 COM.hProvides helper templates for Windows COM object manipulation
 Common.hGeneral API
 Cred.hIntegrates WinStd classes with Microsoft Credentials API
 Crypt.hIntegrates WinStd classes with Microsoft Cryptography API
 EAP.hIntegrates WinStd classes with Microsoft EAP API
 ETW.hIntegrates WinStd classes with Event Tracing for Windows API
 GDI.hIntegrates WinStd classes with Microsoft Windows GDI
 MSI.hIntegrates WinStd classes with Microsoft Installer API
 Sec.hIntegrates WinStd classes with Microsoft Security API
 SetupAPI.hIntegrates WinStd classes with Microsoft Setup API
 Shell.hIntegrates WinStd classes with Microsoft Shell API
 Win.hIntegrates WinStd classes with Microsoft Windows API
 WinSock2.hIntegrates WinStd classes with Microsoft WinSock2 API
 WinTrust.hIntegrates WinStd classes with Microsoft WinTrust API
 WLAN.hIntegrates WinStd classes with Microsoft WLAN API
 COM.h
 Common.h
 Cred.h
 Crypt.h
 EAP.h
 ETW.h
 GDI.h
 MSI.h
 Sec.h
 SetupAPI.h
 Shell.h
 Win.h
 WinSock2.h
 WinTrust.h
 WLAN.h
diff --git a/functions.html b/functions.html index f2e81d98..a2ea4959 100644 --- a/functions.html +++ b/functions.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,7 +72,7 @@ $(function() { diff --git a/functions_a.html b/functions_a.html index 69b4f743..260b85a0 100644 --- a/functions_a.html +++ b/functions_a.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -76,7 +76,7 @@ $(function() { diff --git a/functions_b.html b/functions_b.html index c7868b4d..d742995e 100644 --- a/functions_b.html +++ b/functions_b.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -74,7 +74,7 @@ $(function() { diff --git a/functions_c.html b/functions_c.html index ac3c13cb..75433857 100644 --- a/functions_c.html +++ b/functions_c.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -84,7 +84,7 @@ $(function() { diff --git a/functions_d.html b/functions_d.html index 5c95940e..a6758f44 100644 --- a/functions_d.html +++ b/functions_d.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -82,7 +82,7 @@ $(function() { diff --git a/functions_e.html b/functions_e.html index e7948dd5..f862f2f8 100644 --- a/functions_e.html +++ b/functions_e.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -88,7 +88,7 @@ $(function() { diff --git a/functions_f.html b/functions_f.html index 5e32a984..540a29e8 100644 --- a/functions_f.html +++ b/functions_f.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,7 +72,7 @@ $(function() { diff --git a/functions_func.html b/functions_func.html index e4419d3c..b3d83b0a 100644 --- a/functions_func.html +++ b/functions_func.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -76,7 +76,7 @@ $(function() { diff --git a/functions_func_b.html b/functions_func_b.html index db0c6d7f..2303a56c 100644 --- a/functions_func_b.html +++ b/functions_func_b.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -74,7 +74,7 @@ $(function() { diff --git a/functions_func_c.html b/functions_func_c.html index bdb65dd9..50e1e261 100644 --- a/functions_func_c.html +++ b/functions_func_c.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -82,7 +82,7 @@ $(function() { diff --git a/functions_func_d.html b/functions_func_d.html index a8de3020..917b3c0d 100644 --- a/functions_func_d.html +++ b/functions_func_d.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -81,7 +81,7 @@ $(function() { diff --git a/functions_func_e.html b/functions_func_e.html index 49447319..82c980fe 100644 --- a/functions_func_e.html +++ b/functions_func_e.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -87,7 +87,7 @@ $(function() { diff --git a/functions_func_f.html b/functions_func_f.html index d56d3967..cacdb348 100644 --- a/functions_func_f.html +++ b/functions_func_f.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,7 +72,7 @@ $(function() { diff --git a/functions_func_h.html b/functions_func_h.html index 606701e7..f33d5ccd 100644 --- a/functions_func_h.html +++ b/functions_func_h.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -73,7 +73,7 @@ $(function() { diff --git a/functions_func_i.html b/functions_func_i.html index 15f33a0d..51adc4b1 100644 --- a/functions_func_i.html +++ b/functions_func_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -71,7 +71,7 @@ $(function() { diff --git a/functions_func_l.html b/functions_func_l.html index 40939594..2a817e50 100644 --- a/functions_func_l.html +++ b/functions_func_l.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,7 +72,7 @@ $(function() { diff --git a/functions_func_m.html b/functions_func_m.html index d60fb23c..6cd145cf 100644 --- a/functions_func_m.html +++ b/functions_func_m.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,7 +72,7 @@ $(function() { diff --git a/functions_func_n.html b/functions_func_n.html index abfa92cd..326e43c3 100644 --- a/functions_func_n.html +++ b/functions_func_n.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -73,7 +73,7 @@ $(function() { diff --git a/functions_func_o.html b/functions_func_o.html index 481348cd..71a57798 100644 --- a/functions_func_o.html +++ b/functions_func_o.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -87,7 +87,7 @@ $(function() { diff --git a/functions_func_p.html b/functions_func_p.html index 3fc9df54..79adcd29 100644 --- a/functions_func_p.html +++ b/functions_func_p.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,7 +72,7 @@ $(function() { diff --git a/functions_func_q.html b/functions_func_q.html index f8d0e41a..dfeeb146 100644 --- a/functions_func_q.html +++ b/functions_func_q.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -71,7 +71,7 @@ $(function() { diff --git a/functions_func_r.html b/functions_func_r.html index 7c31d071..ec598736 100644 --- a/functions_func_r.html +++ b/functions_func_r.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -76,7 +76,7 @@ $(function() { diff --git a/functions_func_s.html b/functions_func_s.html index 1a1e171c..84a701d1 100644 --- a/functions_func_s.html +++ b/functions_func_s.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -84,7 +84,7 @@ $(function() { diff --git a/functions_func_t.html b/functions_func_t.html index 29fe52c4..2c66c5eb 100644 --- a/functions_func_t.html +++ b/functions_func_t.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -71,7 +71,7 @@ $(function() { diff --git a/functions_func_u.html b/functions_func_u.html index ee4081de..022c008e 100644 --- a/functions_func_u.html +++ b/functions_func_u.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,7 +72,7 @@ $(function() { diff --git a/functions_func_v.html b/functions_func_v.html index 8439f14c..f1153a6f 100644 --- a/functions_func_v.html +++ b/functions_func_v.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,7 +72,7 @@ $(function() { diff --git a/functions_func_w.html b/functions_func_w.html index 60f2fb23..ef03bbfd 100644 --- a/functions_func_w.html +++ b/functions_func_w.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -77,7 +77,7 @@ $(function() { diff --git a/functions_func_~.html b/functions_func_~.html index 28609dc5..a98446ad 100644 --- a/functions_func_~.html +++ b/functions_func_~.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -119,7 +119,7 @@ $(function() { diff --git a/functions_h.html b/functions_h.html index fe09a82c..ebbeeded 100644 --- a/functions_h.html +++ b/functions_h.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -74,7 +74,7 @@ $(function() { diff --git a/functions_i.html b/functions_i.html index b542512a..74d29f66 100644 --- a/functions_i.html +++ b/functions_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,7 +72,7 @@ $(function() { diff --git a/functions_l.html b/functions_l.html index 91a62438..07890190 100644 --- a/functions_l.html +++ b/functions_l.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,7 +72,7 @@ $(function() { diff --git a/functions_m.html b/functions_m.html index 4c4acff7..a96cbbdb 100644 --- a/functions_m.html +++ b/functions_m.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -108,7 +108,7 @@ $(function() { diff --git a/functions_n.html b/functions_n.html index df201899..f5012f0b 100644 --- a/functions_n.html +++ b/functions_n.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -73,7 +73,7 @@ $(function() { diff --git a/functions_o.html b/functions_o.html index fa456c32..7661a1df 100644 --- a/functions_o.html +++ b/functions_o.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -88,7 +88,7 @@ $(function() { diff --git a/functions_p.html b/functions_p.html index 6cf0806a..60594286 100644 --- a/functions_p.html +++ b/functions_p.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -73,7 +73,7 @@ $(function() { diff --git a/functions_q.html b/functions_q.html index 11847387..70932010 100644 --- a/functions_q.html +++ b/functions_q.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -71,7 +71,7 @@ $(function() { diff --git a/functions_r.html b/functions_r.html index fc8aebd8..60f35f14 100644 --- a/functions_r.html +++ b/functions_r.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -77,7 +77,7 @@ $(function() { diff --git a/functions_s.html b/functions_s.html index 8caa2773..fa7f8576 100644 --- a/functions_s.html +++ b/functions_s.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -85,7 +85,7 @@ $(function() { diff --git a/functions_t.html b/functions_t.html index 0dd8f4ff..a6e95181 100644 --- a/functions_t.html +++ b/functions_t.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -71,7 +71,7 @@ $(function() { diff --git a/functions_type.html b/functions_type.html index fae51dda..4fcccf3e 100644 --- a/functions_type.html +++ b/functions_type.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,7 @@ $(function() { diff --git a/functions_u.html b/functions_u.html index 9067e417..08e89312 100644 --- a/functions_u.html +++ b/functions_u.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,7 +72,7 @@ $(function() { diff --git a/functions_v.html b/functions_v.html index 4b55137c..44b13516 100644 --- a/functions_v.html +++ b/functions_v.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -73,7 +73,7 @@ $(function() { diff --git a/functions_vars.html b/functions_vars.html index 10c46409..eba11844 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -111,7 +111,7 @@ $(function() { diff --git a/functions_w.html b/functions_w.html index 0e764a13..b9f694f9 100644 --- a/functions_w.html +++ b/functions_w.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -77,7 +77,7 @@ $(function() { diff --git a/functions_~.html b/functions_~.html index 09def668..b4a9feee 100644 --- a/functions_~.html +++ b/functions_~.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -119,7 +119,7 @@ $(function() { diff --git a/globals.html b/globals.html deleted file mode 100644 index 2fee6d04..00000000 --- a/globals.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - -WinStd: File Members - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - -
- -
-
- - -
- -
- -
-
Here is a list of all documented file members with links to the documentation:
- -

- _ -

- - -

- c -

- - -

- e -

    -
  • ExpandEnvironmentStringsA() : Win.h
  • -
  • ExpandEnvironmentStringsW() : Win.h
  • -
- - -

- f -

- - -

- g -

    -
  • GetAddrInfoA() : WinSock2.h
  • -
  • GetAddrInfoW() : WinSock2.h
  • -
  • GetDateFormatA() : Win.h
  • -
  • GetDateFormatW() : Win.h
  • -
  • GetFileVersionInfoA() : Win.h
  • -
  • GetFileVersionInfoW() : Win.h
  • -
  • GetModuleFileNameA() : Win.h
  • -
  • GetModuleFileNameW() : Win.h
  • -
  • GetTokenInformation() : Win.h
  • -
  • GetWindowTextA() : Win.h
  • -
  • GetWindowTextW() : Win.h
  • -
  • GuidToString : Win.h
  • -
  • GuidToStringA() : Win.h
  • -
  • GuidToStringW() : Win.h
  • -
- - -

- l -

    -
  • LoadStringA() : Win.h
  • -
  • LoadStringW() : Win.h
  • -
  • LookupAccountSidA() : Win.h
  • -
  • LookupAccountSidW() : Win.h
  • -
- - -

- m -

    -
  • MsiFormatRecordA() : MSI.h
  • -
  • MsiFormatRecordW() : MSI.h
  • -
  • MsiGetComponentPathA() : MSI.h
  • -
  • MsiGetComponentPathW() : MSI.h
  • -
  • MsiGetPropertyA() : MSI.h
  • -
  • MsiGetPropertyW() : MSI.h
  • -
  • MsiGetTargetPathA() : MSI.h
  • -
  • MsiGetTargetPathW() : MSI.h
  • -
  • MsiRecordGetStringA() : MSI.h
  • -
  • MsiRecordGetStringW() : MSI.h
  • -
  • MsiRecordReadStream() : MSI.h
  • -
  • MultiByteToWideChar() : Win.h
  • -
- - -

- n -

    -
  • NormalizeString() : Win.h
  • -
- - -

- o -

    -
  • operator!=() : EAP.h
  • -
  • operator==() : EAP.h
  • -
  • OutputDebugStr() : Win.h
  • -
  • OutputDebugStrV() : Win.h
  • -
- - -

- p -

- - -

- q -

    -
  • QueryFullProcessImageNameA() : Win.h
  • -
  • QueryFullProcessImageNameW() : Win.h
  • -
- - -

- r -

    -
  • RegCreateKeyExA() : Win.h
  • -
  • RegCreateKeyExW() : Win.h
  • -
  • RegLoadMUIStringA() : Win.h
  • -
  • RegLoadMUIStringW() : Win.h
  • -
  • RegOpenKeyExA() : Win.h
  • -
  • RegOpenKeyExW() : Win.h
  • -
  • RegQueryStringValue() : Win.h
  • -
  • RegQueryValueExA() : Win.h
  • -
  • RegQueryValueExW() : Win.h
  • -
- - -

- s -

    -
  • SecureMultiByteToWideChar() : Win.h
  • -
  • SecureWideCharToMultiByte() : Win.h
  • -
  • sprintf() : Common.h
  • -
  • StringToGuid : Win.h
  • -
  • StringToGuidA() : Win.h
  • -
  • StringToGuidW() : Win.h
  • -
- - -

- t -

    -
  • TdhGetEventInformation() : ETW.h
  • -
  • TdhGetEventMapInformation() : ETW.h
  • -
  • TdhGetProperty() : ETW.h
  • -
- - -

- v -

- - -

- w -

-
- - - - diff --git a/globals_defs.html b/globals_defs.html deleted file mode 100644 index 5ff4c6fe..00000000 --- a/globals_defs.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - -WinStd: File Members - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - -
- -
-
- - -
- -
- -
-
- - - - diff --git a/globals_func.html b/globals_func.html deleted file mode 100644 index 45c92c1b..00000000 --- a/globals_func.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - -WinStd: File Members - - - - - - - - - -
-
- - - - - - -
-
WinStd -
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
-
-
- - - - - - - -
- -
-
- - -
- -
- -
-  - -

- c -

- - -

- e -

    -
  • ExpandEnvironmentStringsA() : Win.h
  • -
  • ExpandEnvironmentStringsW() : Win.h
  • -
- - -

- f -

- - -

- g -

    -
  • GetAddrInfoA() : WinSock2.h
  • -
  • GetAddrInfoW() : WinSock2.h
  • -
  • GetDateFormatA() : Win.h
  • -
  • GetDateFormatW() : Win.h
  • -
  • GetFileVersionInfoA() : Win.h
  • -
  • GetFileVersionInfoW() : Win.h
  • -
  • GetModuleFileNameA() : Win.h
  • -
  • GetModuleFileNameW() : Win.h
  • -
  • GetTokenInformation() : Win.h
  • -
  • GetWindowTextA() : Win.h
  • -
  • GetWindowTextW() : Win.h
  • -
  • GuidToStringA() : Win.h
  • -
  • GuidToStringW() : Win.h
  • -
- - -

- l -

    -
  • LoadStringA() : Win.h
  • -
  • LoadStringW() : Win.h
  • -
  • LookupAccountSidA() : Win.h
  • -
  • LookupAccountSidW() : Win.h
  • -
- - -

- m -

    -
  • MsiFormatRecordA() : MSI.h
  • -
  • MsiFormatRecordW() : MSI.h
  • -
  • MsiGetComponentPathA() : MSI.h
  • -
  • MsiGetComponentPathW() : MSI.h
  • -
  • MsiGetPropertyA() : MSI.h
  • -
  • MsiGetPropertyW() : MSI.h
  • -
  • MsiGetTargetPathA() : MSI.h
  • -
  • MsiGetTargetPathW() : MSI.h
  • -
  • MsiRecordGetStringA() : MSI.h
  • -
  • MsiRecordGetStringW() : MSI.h
  • -
  • MsiRecordReadStream() : MSI.h
  • -
  • MultiByteToWideChar() : Win.h
  • -
- - -

- n -

    -
  • NormalizeString() : Win.h
  • -
- - -

- o -

    -
  • operator!=() : EAP.h
  • -
  • operator==() : EAP.h
  • -
  • OutputDebugStr() : Win.h
  • -
  • OutputDebugStrV() : Win.h
  • -
- - -

- p -

- - -

- q -

    -
  • QueryFullProcessImageNameA() : Win.h
  • -
  • QueryFullProcessImageNameW() : Win.h
  • -
- - -

- r -

    -
  • RegCreateKeyExA() : Win.h
  • -
  • RegCreateKeyExW() : Win.h
  • -
  • RegLoadMUIStringA() : Win.h
  • -
  • RegLoadMUIStringW() : Win.h
  • -
  • RegOpenKeyExA() : Win.h
  • -
  • RegOpenKeyExW() : Win.h
  • -
  • RegQueryStringValue() : Win.h
  • -
  • RegQueryValueExA() : Win.h
  • -
  • RegQueryValueExW() : Win.h
  • -
- - -

- s -

    -
  • SecureMultiByteToWideChar() : Win.h
  • -
  • SecureWideCharToMultiByte() : Win.h
  • -
  • sprintf() : Common.h
  • -
  • StringToGuidA() : Win.h
  • -
  • StringToGuidW() : Win.h
  • -
- - -

- t -

    -
  • TdhGetEventInformation() : ETW.h
  • -
  • TdhGetEventMapInformation() : ETW.h
  • -
  • TdhGetProperty() : ETW.h
  • -
- - -

- v -

- - -

- w -

    -
  • WideCharToMultiByte() : Win.h
  • -
  • WlanOpenHandle() : WLAN.h
  • -
  • WlanReasonCodeToString() : WLAN.h
  • -
-
- - - - diff --git a/group___setup_a_p_i.html b/group___setup_a_p_i.html index 6d8055c2..4656fe2f 100644 --- a/group___setup_a_p_i.html +++ b/group___setup_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -68,9 +68,6 @@ $(function() {
Setup API
- -

Integrates WinStd classes with Microsoft Setup API. -More...

@@ -82,11 +79,10 @@ Classes

Classes

 

Detailed Description

-

Integrates WinStd classes with Microsoft Setup API.

diff --git a/group___win_sock2_a_p_i.html b/group___win_sock2_a_p_i.html index 434226e8..817a9b9f 100644 --- a/group___win_sock2_a_p_i.html +++ b/group___win_sock2_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,9 +70,6 @@ $(function() {
WinSock2 API
- -

Integrates WinStd classes with Microsoft WinSock2 API. -More...

@@ -103,7 +100,6 @@ Functions

Classes

 

Detailed Description

-

Integrates WinStd classes with Microsoft WinSock2 API.

Function Documentation

◆ GetAddrInfoA()

@@ -210,7 +206,7 @@ Functions
diff --git a/group___win_std_c_o_m.html b/group___win_std_c_o_m.html index 457f5dad..e729c0a7 100644 --- a/group___win_std_c_o_m.html +++ b/group___win_std_c_o_m.html @@ -5,7 +5,7 @@ -WinStd: COM object management +WinStd: COM Object Management @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -66,12 +66,9 @@ $(function() { -
COM object management
+
COM Object Management
- -

Provides helper templates for Windows COM object manipulation. -More...

@@ -99,7 +96,6 @@ Functions

Classes

 

Detailed Description

-

Provides helper templates for Windows COM object manipulation.

Function Documentation

◆ CoCreateInstance()

@@ -157,7 +153,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 f0004a2a..909aadc4 100644 --- a/group___win_std_cred_a_p_i.html +++ b/group___win_std_cred_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -69,9 +69,6 @@ $(function() {
Credentials API
- -

Integrates WinStd classes with Microsoft Credentials API. -More...

@@ -105,7 +102,6 @@ Functions

Classes

 

Detailed Description

-

Integrates WinStd classes with Microsoft Credentials API.

Function Documentation

◆ CredEnumerate()

@@ -385,7 +381,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 44a35391..16c1b555 100644 --- a/group___win_std_crypto_a_p_i.html +++ b/group___win_std_crypto_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -69,9 +69,6 @@ $(function() {
Cryptography API
- -

Integrates WinStd classes with Microsoft Cryptography API. -More...

@@ -165,7 +162,6 @@ Functions

Classes

 

Detailed Description

-

Integrates WinStd classes with Microsoft Cryptography API.

Function Documentation

◆ CertGetCertificateChain()

@@ -1192,7 +1188,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 86a2bff8..c147fe9e 100644 --- a/group___win_std_e_a_p_a_p_i.html +++ b/group___win_std_e_a_p_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -72,9 +72,6 @@ $(function() {
Extensible Authentication Protocol API
- -

Integrates WinStd classes with Microsoft EAP API. -More...

@@ -170,7 +167,6 @@ static const EAP_ATTRIBUTE 

Classes

 

Detailed Description

-

Integrates WinStd classes with Microsoft EAP API.

Enumeration Type Documentation

◆ eap_type_t

@@ -341,7 +337,7 @@ static const EAP_ATTRIBUTE  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 d3f51383..979b7da9 100644 --- a/group___win_std_e_t_w_a_p_i.html +++ b/group___win_std_e_t_w_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,9 +70,6 @@ $(function() {
Event Tracing for Windows API
- -

Integrates WinStd classes with Event Tracing for Windows API. -More...

@@ -122,7 +119,6 @@ static const event_data

Classes

 

Detailed Description

-

Integrates WinStd classes with Event Tracing for Windows API.

Function Documentation

◆ TdhGetEventInformation()

@@ -288,7 +284,7 @@ template<class _Ty , class _Ax >
diff --git a/group___win_std_exceptions.html b/group___win_std_exceptions.html index eec691b0..6f2c81f7 100644 --- a/group___win_std_exceptions.html +++ b/group___win_std_exceptions.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -68,9 +68,6 @@ $(function() {
Exceptions
- -

Additional exceptions. -More...

@@ -91,11 +88,10 @@ Classes

Classes

 

Detailed Description

-

Additional exceptions.

diff --git a/group___win_std_gdi_a_p_i.html b/group___win_std_gdi_a_p_i.html index 5b30724f..328ada72 100644 --- a/group___win_std_gdi_a_p_i.html +++ b/group___win_std_gdi_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -68,9 +68,6 @@ $(function() {
GDI API
- -

Integrates WinStd classes with Microsoft Windows GDI. -More...

@@ -88,11 +85,10 @@ Classes

Classes

 

Detailed Description

-

Integrates WinStd classes with Microsoft Windows GDI.

diff --git a/group___win_std_general.html b/group___win_std_general.html index 346c409f..6b2c08c9 100644 --- a/group___win_std_general.html +++ b/group___win_std_general.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -71,9 +71,6 @@ $(function() {
General
- -

General API. -More...

@@ -137,7 +134,6 @@ Functions

Classes

 

Detailed Description

-

General API.

Macro Definition Documentation

◆ WINSTD_NONCOPYABLE

@@ -281,7 +277,7 @@ template<class _Ty , class _Dx >
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 d6915b91..c2970dd2 100644 --- a/group___win_std_m_s_i_a_p_i.html +++ b/group___win_std_m_s_i_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -68,9 +68,6 @@ $(function() {
Microsoft Installer API
- -

Integrates WinStd classes with Microsoft Installer API. -More...

@@ -120,7 +117,6 @@ Functions

Functions

 

Detailed Description

-

Integrates WinStd classes with Microsoft Installer API.

Function Documentation

◆ MsiFormatRecordA()

@@ -642,7 +638,7 @@ template<class _Ty , class _Ax >
diff --git a/group___win_std_mem_sanitize.html b/group___win_std_mem_sanitize.html index f07d1666..aac3d007 100644 --- a/group___win_std_mem_sanitize.html +++ b/group___win_std_mem_sanitize.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -69,9 +69,6 @@ $(function() {
Auto-sanitize Memory Management
- -

Sanitizes memory before dismissed. -More...

@@ -96,7 +93,6 @@ typedef

Classes

 

Detailed Description

-

Sanitizes memory before dismissed.

Typedef Documentation

◆ sanitizing_string

@@ -135,7 +131,7 @@ typedef diff --git a/group___win_std_security_a_p_i.html b/group___win_std_security_a_p_i.html index 748df1b2..ba58e53f 100644 --- a/group___win_std_security_a_p_i.html +++ b/group___win_std_security_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -68,9 +68,6 @@ $(function() {
Security API
- -

Integrates WinStd classes with Microsoft Security API. -More...

@@ -85,11 +82,10 @@ Classes

Classes

 

Detailed Description

-

Integrates WinStd classes with Microsoft Security API.

diff --git a/group___win_std_shell_w_a_p_i.html b/group___win_std_shell_w_a_p_i.html index 5fb4901a..3dcc0f98 100644 --- a/group___win_std_shell_w_a_p_i.html +++ b/group___win_std_shell_w_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -68,9 +68,6 @@ $(function() {
Shell API
- -

Integrates WinStd classes with Microsoft Shell API. -More...

@@ -84,7 +81,6 @@ Functions

Functions

 

Detailed Description

-

Integrates WinStd classes with Microsoft Shell API.

Function Documentation

◆ PathCanonicalizeA()

@@ -171,7 +167,7 @@ template<class _Traits , class _Ax >
diff --git a/group___win_std_str_format.html b/group___win_std_str_format.html index 8e81876d..36091a0c 100644 --- a/group___win_std_str_format.html +++ b/group___win_std_str_format.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -71,9 +71,6 @@ $(function() {
String Formatting
- -

Formatted string generation. -More...

@@ -176,11 +173,10 @@ Functions

Classes

 

Detailed Description

-

Formatted string generation.

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));
-
Base template class to support string formatting using printf() style templates.
Definition: Common.h:1123
+
Base template class to support string formatting using printf() style templates.
Definition: Common.h:1115

Macro Definition Documentation

@@ -563,7 +559,7 @@ template<class _Elem , class _Traits , class _Ax >
diff --git a/group___win_std_sys_handles.html b/group___win_std_sys_handles.html index 4c50cbb2..235333a1 100644 --- a/group___win_std_sys_handles.html +++ b/group___win_std_sys_handles.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,9 +70,6 @@ $(function() {
System Handles
- -

Simplifies work with object handles of various type. -More...

@@ -100,7 +97,6 @@ static const T 

Classes

winstd::han
 

Detailed Description

-

Simplifies work with object handles of various type.

Macro Definition Documentation

◆ WINSTD_DPLHANDLE_IMPL

@@ -181,7 +177,7 @@ static const T winstd::han
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 a424dfee..04dc33e6 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -69,9 +69,6 @@ $(function() {
WLAN API
- -

Integrates WinStd classes with Microsoft WLAN API. -More...

@@ -96,7 +93,6 @@ Functions

Classes

 

Detailed Description

-

Integrates WinStd classes with Microsoft WLAN API.

Function Documentation

◆ WlanOpenHandle()

@@ -200,7 +196,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 235420ea..4dfb8c76 100644 --- a/group___win_std_win_a_p_i.html +++ b/group___win_std_win_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -71,9 +71,6 @@ $(function() {
Windows API
- -

Integrates WinStd classes with Microsoft Windows API. -More...

@@ -346,7 +343,6 @@ Functions

Classes

 

Detailed Description

-

Integrates WinStd classes with Microsoft Windows API.

Macro Definition Documentation

◆ GuidToString

@@ -3198,7 +3194,7 @@ template<class _Traits1 , class _Ax1 , class _Traits2 , class _Ax2 >
diff --git a/group___win_trust_a_p_i.html b/group___win_trust_a_p_i.html index 5852b0ce..c9915eb9 100644 --- a/group___win_trust_a_p_i.html +++ b/group___win_trust_a_p_i.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -68,9 +68,6 @@ $(function() {
WinTrust API
- -

Integrates WinStd classes with Microsoft WinTrust API. -More...

@@ -79,11 +76,10 @@ Classes

Classes

 

Detailed Description

-

Integrates WinStd classes with Microsoft WinTrust API.

diff --git a/hierarchy.html b/hierarchy.html index 86a9037c..94d8e7c8 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -206,7 +206,7 @@ $(function() { diff --git a/index.html b/index.html index c9b7460e..38322ef7 100644 --- a/index.html +++ b/index.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -66,16 +66,15 @@ $(function() {
WinStd
-

Provides additional templates and function helpers for Windows API using Standard C++ in Microsoft Visual C++ 2017-2019

+

Provides templates and function helpers for Windows Win32 API using Standard C++ in Microsoft Visual C++ 2017-2019

Features

Portable

This project does not require building. Just #include individual files from this repository into your source code and get started.

-Lightweight Classes

-

...to simplify Windows allocated memory and resources focused on their release to prevent leakage

-

The classes provide unified create methods and free destructors. They are like smart-pointers for various Windows resources. Once created, you use the class instance as a snap-in replacement for pointers/handles parameters in the standard Win32 API functions.

+Memory and Resource Helper Classes +

Simplify memory and resource management. The classes release memory and resources automatically. They are like smart-pointers for various Windows resources. Once created, you use the class instance as a snap-in replacement for pointers/handles parameters in the standard Win32 API function calls.

Example

{C++}
@@ -86,7 +85,6 @@ Example
m_note_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(48)));

Functions and Templates

-

...to extend standard Win32 API functions for variable-size outputs

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...

WinStd provides a subset of Win32 API identically named functions (C++ polymorphism to the rescue), where one can use std::string, std::wstring, std::vector<> etc. as an output parameter. WinStd handles all the dirty work with memory allocation for you, so you can focus on your code.

@@ -98,7 +96,7 @@ Example

std::cout << response.c_str() << std::endl;

String Formatters

-

...for those situations where one must quckly compose a temporary string using sprintf() or FormatMessage()

+

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.

Example

{C++}
@@ -109,6 +107,9 @@ Example
sizeof(EapPacket) + 1,
dwMaxSendPacketSize));

+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++.

+

Usage

  1. Clone the repository into your solution folder.
  2. @@ -129,12 +130,13 @@ Usage

An auto-generated documentation is here.

-

More examples and use-cases can be found in GÉANTLink and ZRCola projects source code. They make heavy use of WinStd.

+

More examples and use-cases can be found in GÉANTLink and ZRCola projects source code. They make heavy use of WinStd.

+

This is a one-man project for the time being, so the Win32 API support is far from complete. It is added as needed. Contributions are welcome.

diff --git a/menudata.js b/menudata.js index b490c3d5..23cdb6d8 100644 --- a/menudata.js +++ b/menudata.js @@ -80,39 +80,4 @@ var menudata={children:[ {text:"m",url:"functions_vars.html#index_m"}]}, {text:"Typedefs",url:"functions_type.html"}]}]}, {text:"Files",url:"files.html",children:[ -{text:"File List",url:"files.html"}, -{text:"File Members",url:"globals.html",children:[ -{text:"All",url:"globals.html",children:[ -{text:"_",url:"globals.html#index__5F"}, -{text:"c",url:"globals.html#index_c"}, -{text:"e",url:"globals.html#index_e"}, -{text:"f",url:"globals.html#index_f"}, -{text:"g",url:"globals.html#index_g"}, -{text:"l",url:"globals.html#index_l"}, -{text:"m",url:"globals.html#index_m"}, -{text:"n",url:"globals.html#index_n"}, -{text:"o",url:"globals.html#index_o"}, -{text:"p",url:"globals.html#index_p"}, -{text:"q",url:"globals.html#index_q"}, -{text:"r",url:"globals.html#index_r"}, -{text:"s",url:"globals.html#index_s"}, -{text:"t",url:"globals.html#index_t"}, -{text:"v",url:"globals.html#index_v"}, -{text:"w",url:"globals.html#index_w"}]}, -{text:"Functions",url:"globals_func.html",children:[ -{text:"c",url:"globals_func.html#index_c"}, -{text:"e",url:"globals_func.html#index_e"}, -{text:"f",url:"globals_func.html#index_f"}, -{text:"g",url:"globals_func.html#index_g"}, -{text:"l",url:"globals_func.html#index_l"}, -{text:"m",url:"globals_func.html#index_m"}, -{text:"n",url:"globals_func.html#index_n"}, -{text:"o",url:"globals_func.html#index_o"}, -{text:"p",url:"globals_func.html#index_p"}, -{text:"q",url:"globals_func.html#index_q"}, -{text:"r",url:"globals_func.html#index_r"}, -{text:"s",url:"globals_func.html#index_s"}, -{text:"t",url:"globals_func.html#index_t"}, -{text:"v",url:"globals_func.html#index_v"}, -{text:"w",url:"globals_func.html#index_w"}]}, -{text:"Macros",url:"globals_defs.html"}]}]}]} +{text:"File List",url:"files.html"}]}]} diff --git a/modules.html b/modules.html index 86cf27e7..8dfb1427 100644 --- a/modules.html +++ b/modules.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -68,31 +68,31 @@ $(function() {
Here is a list of all modules:
- - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + +
 COM object managementProvides helper templates for Windows COM object manipulation
 GeneralGeneral API
 String FormattingFormatted string generation
 System HandlesSimplifies work with object handles of various type
 ExceptionsAdditional exceptions
 Auto-sanitize Memory ManagementSanitizes memory before dismissed
 Credentials APIIntegrates WinStd classes with Microsoft Credentials API
 Cryptography APIIntegrates WinStd classes with Microsoft Cryptography API
 Extensible Authentication Protocol APIIntegrates WinStd classes with Microsoft EAP API
 Event Tracing for Windows APIIntegrates WinStd classes with Event Tracing for Windows API
 GDI APIIntegrates WinStd classes with Microsoft Windows GDI
 Microsoft Installer APIIntegrates WinStd classes with Microsoft Installer API
 Security APIIntegrates WinStd classes with Microsoft Security API
 Setup APIIntegrates WinStd classes with Microsoft Setup API
 Shell APIIntegrates WinStd classes with Microsoft Shell API
 Windows APIIntegrates WinStd classes with Microsoft Windows API
 WinSock2 APIIntegrates WinStd classes with Microsoft WinSock2 API
 WinTrust APIIntegrates WinStd classes with Microsoft WinTrust API
 WLAN APIIntegrates WinStd classes with Microsoft WLAN API
 COM Object Management
 General
 String Formatting
 System Handles
 Exceptions
 Auto-sanitize Memory Management
 Credentials API
 Cryptography API
 Extensible Authentication Protocol API
 Event Tracing for Windows API
 GDI API
 Microsoft Installer API
 Security API
 Setup API
 Shell API
 Windows API
 WinSock2 API
 WinTrust API
 WLAN API
diff --git a/search/all_11.js b/search/all_11.js index 7b82aafa..4602cba9 100644 --- a/search/all_11.js +++ b/search/all_11.js @@ -5,36 +5,33 @@ var searchData= ['sanitizing_5fstring_2',['sanitizing_string',['../group___win_std_mem_sanitize.html#gafaf527687e080349d49b51c2362c32e8',1,'winstd']]], ['sanitizing_5ftstring_3',['sanitizing_tstring',['../group___win_std_mem_sanitize.html#gaa149b89d04cc80c125023a14e241e8bd',1,'winstd']]], ['sanitizing_5fwstring_4',['sanitizing_wstring',['../group___win_std_mem_sanitize.html#ga57776f4affaac5040ba220302003eedc',1,'winstd']]], - ['sec_2eh_5',['Sec.h',['../_sec_8h.html',1,'']]], - ['sec_5fbuffer_5fdesc_6',['sec_buffer_desc',['../classwinstd_1_1sec__buffer__desc.html#aed8a33ad87b31098a60facb3f656cea5',1,'winstd::sec_buffer_desc::sec_buffer_desc()'],['../classwinstd_1_1sec__buffer__desc.html',1,'winstd::sec_buffer_desc']]], - ['sec_5fcontext_7',['sec_context',['../classwinstd_1_1sec__context.html#a05356227fbaa04cf65cd8da86daac49e',1,'winstd::sec_context::sec_context(sec_context &&h) noexcept'],['../classwinstd_1_1sec__context.html#a5d41cc2cbe613fcc2bd37cc260de9763',1,'winstd::sec_context::sec_context()'],['../classwinstd_1_1sec__context.html',1,'winstd::sec_context']]], - ['sec_5fcredentials_8',['sec_credentials',['../classwinstd_1_1sec__credentials.html#ac9ece1c98aebffa3efc90a0b37f6d2ba',1,'winstd::sec_credentials::sec_credentials(sec_credentials &&h) noexcept'],['../classwinstd_1_1sec__credentials.html#adac21d2b22fba61197ad315e8996f946',1,'winstd::sec_credentials::sec_credentials(handle_type h, const TimeStamp expires)'],['../classwinstd_1_1sec__credentials.html#a4cc86fe337998e5becc41c3f78563df8',1,'winstd::sec_credentials::sec_credentials()'],['../classwinstd_1_1sec__credentials.html',1,'winstd::sec_credentials']]], - ['sec_5fruntime_5ferror_9',['sec_runtime_error',['../classwinstd_1_1sec__runtime__error.html#afc95fcf773b18fc72aaacf4ec025471b',1,'winstd::sec_runtime_error::sec_runtime_error(error_type num, const std::string &msg)'],['../classwinstd_1_1sec__runtime__error.html#aa1d671d5c996a8217de62a816f39a5d4',1,'winstd::sec_runtime_error::sec_runtime_error(error_type num, const char *msg=nullptr)'],['../classwinstd_1_1sec__runtime__error.html#ac9f3ac01e422ce43aebb8e5eae9290ce',1,'winstd::sec_runtime_error::sec_runtime_error(const sec_runtime_error &other)'],['../classwinstd_1_1sec__runtime__error.html',1,'winstd::sec_runtime_error']]], - ['securemultibytetowidechar_10',['SecureMultiByteToWideChar',['../group___win_std_win_a_p_i.html#gab02484a16fea41e3d9a5c64c2ee1da1a',1,'SecureMultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::basic_string< wchar_t, _Traits, _Ax > &sWideCharStr) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#gaa15c8edc525c24109fafea640cdedfcb',1,'SecureMultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::vector< wchar_t, _Ax > &sWideCharStr) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#ga9aaaa6113374b6cbad241626819d06c9',1,'SecureMultiByteToWideChar(UINT CodePage, DWORD dwFlags, const std::basic_string< char, _Traits1, _Ax1 > &sMultiByteStr, std::basic_string< wchar_t, _Traits2, _Ax2 > &sWideCharStr) noexcept: Win.h']]], - ['securewidechartomultibyte_11',['SecureWideCharToMultiByte',['../group___win_std_win_a_p_i.html#ga1a0accb3a54ae0ed34944fd483e0c329',1,'SecureWideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::vector< char, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#ga05ac1b43a241f1bbcbf1440cf26c6335',1,'SecureWideCharToMultiByte(UINT CodePage, DWORD dwFlags, std::basic_string< wchar_t, _Traits1, _Ax1 > sWideCharStr, std::basic_string< char, _Traits2, _Ax2 > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#ga04f5e27a0e2066c85d7a421fe4e4c462',1,'SecureWideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::basic_string< char, _Traits, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept: Win.h']]], - ['security_20api_12',['Security API',['../group___win_std_security_a_p_i.html',1,'']]], - ['security_5fid_13',['security_id',['../classwinstd_1_1security__id.html',1,'winstd']]], - ['set_5fextended_5fdata_14',['set_extended_data',['../classwinstd_1_1event__rec.html#abfab939c3bb27839c3b591b9a62f9470',1,'winstd::event_rec']]], - ['set_5fextended_5fdata_5finternal_15',['set_extended_data_internal',['../classwinstd_1_1event__rec.html#a0c1c63cc3a3e2f83924aa9f21a298f6c',1,'winstd::event_rec']]], - ['set_5fuser_5fdata_16',['set_user_data',['../classwinstd_1_1event__rec.html#a0df49a47cf45cb76003b85148d7d5098',1,'winstd::event_rec']]], - ['set_5fuser_5fdata_5finternal_17',['set_user_data_internal',['../classwinstd_1_1event__rec.html#af71cc10ff1b9f9935c824b7c7a4130b8',1,'winstd::event_rec']]], - ['setup_20api_18',['Setup API',['../group___setup_a_p_i.html',1,'']]], - ['setup_5fdevice_5finfo_5flist_19',['setup_device_info_list',['../classwinstd_1_1setup__device__info__list.html',1,'winstd']]], - ['setup_5fdriver_5finfo_5flist_5fbuilder_20',['setup_driver_info_list_builder',['../classwinstd_1_1setup__driver__info__list__builder.html#a4774edfbe680a3a496e243544a68c94f',1,'winstd::setup_driver_info_list_builder::setup_driver_info_list_builder()'],['../classwinstd_1_1setup__driver__info__list__builder.html',1,'winstd::setup_driver_info_list_builder']]], - ['setupapi_2eh_21',['SetupAPI.h',['../_setup_a_p_i_8h.html',1,'']]], - ['shell_20api_22',['Shell API',['../group___win_std_shell_w_a_p_i.html',1,'']]], - ['shell_2eh_23',['Shell.h',['../_shell_8h.html',1,'']]], - ['size_24',['size',['../classwinstd_1_1eap__packet.html#a2534ad15ae47e2d46354d9f535f4031f',1,'winstd::eap_packet::size()'],['../classwinstd_1_1data__blob.html#ab2ad06e271e8503d7158408773054d23',1,'winstd::data_blob::size()']]], - ['size_5ftype_25',['size_type',['../classwinstd_1_1heap__allocator.html#a01815f4f9097b1447c7ddaa2de868f59',1,'winstd::heap_allocator']]], - ['sprintf_26',['sprintf',['../group___win_std_str_format.html#gac397f655a858a069b3e521940af64331',1,'Common.h']]], - ['start_27',['start',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315aea2b2676c28c0db26d39331a336c6b92',1,'winstd']]], - ['status_28',['status',['../classwinstd_1_1com__initializer.html#ac3c997f810e8439096d8ca14fecb5b7d',1,'winstd::com_initializer::status()'],['../classwinstd_1_1event__trace__enabler.html#a726b84e91002da1243d512c37a060293',1,'winstd::event_trace_enabler::status()'],['../classwinstd_1_1dc__selector.html#aacb4060094f2c4b1747ffa76455b235d',1,'winstd::dc_selector::status()'],['../classwinstd_1_1setup__driver__info__list__builder.html#ae9c062e82afc1ee1eda5926a0567637e',1,'winstd::setup_driver_info_list_builder::status()']]], - ['string_20formatting_29',['String Formatting',['../group___win_std_str_format.html',1,'']]], - ['string_5fguid_30',['string_guid',['../classwinstd_1_1string__guid.html#a507ceea48ffeccc4179239dfb5f4cdb2',1,'winstd::string_guid::string_guid()'],['../classwinstd_1_1string__guid.html',1,'winstd::string_guid']]], - ['string_5fmsg_31',['string_msg',['../group___win_std_str_format.html#gae63195e25e08e2b3d9a9b9c2987f5740',1,'winstd']]], - ['string_5fprintf_32',['string_printf',['../group___win_std_str_format.html#ga9dda7a9a763b666f6fe00c4c6626621d',1,'winstd']]], - ['stringtoguid_33',['StringToGuid',['../group___win_std_win_a_p_i.html#gab9c35127ac48f8d941a5354b1a1b7abe',1,'Win.h']]], - ['stringtoguida_34',['StringToGuidA',['../group___win_std_win_a_p_i.html#ga0a3545c7b4d6509b77a9a156e882f32c',1,'Win.h']]], - ['stringtoguidw_35',['StringToGuidW',['../group___win_std_win_a_p_i.html#ga3411488c7daa5c8e03b2ad34764914aa',1,'Win.h']]], - ['system_20handles_36',['System Handles',['../group___win_std_sys_handles.html',1,'']]] + ['sec_5fbuffer_5fdesc_5',['sec_buffer_desc',['../classwinstd_1_1sec__buffer__desc.html#aed8a33ad87b31098a60facb3f656cea5',1,'winstd::sec_buffer_desc::sec_buffer_desc()'],['../classwinstd_1_1sec__buffer__desc.html',1,'winstd::sec_buffer_desc']]], + ['sec_5fcontext_6',['sec_context',['../classwinstd_1_1sec__context.html#a5d41cc2cbe613fcc2bd37cc260de9763',1,'winstd::sec_context::sec_context()'],['../classwinstd_1_1sec__context.html#a05356227fbaa04cf65cd8da86daac49e',1,'winstd::sec_context::sec_context(sec_context &&h) noexcept'],['../classwinstd_1_1sec__context.html',1,'winstd::sec_context']]], + ['sec_5fcredentials_7',['sec_credentials',['../classwinstd_1_1sec__credentials.html#a4cc86fe337998e5becc41c3f78563df8',1,'winstd::sec_credentials::sec_credentials()'],['../classwinstd_1_1sec__credentials.html#adac21d2b22fba61197ad315e8996f946',1,'winstd::sec_credentials::sec_credentials(handle_type h, const TimeStamp expires)'],['../classwinstd_1_1sec__credentials.html#ac9ece1c98aebffa3efc90a0b37f6d2ba',1,'winstd::sec_credentials::sec_credentials(sec_credentials &&h) noexcept'],['../classwinstd_1_1sec__credentials.html',1,'winstd::sec_credentials']]], + ['sec_5fruntime_5ferror_8',['sec_runtime_error',['../classwinstd_1_1sec__runtime__error.html#ac9f3ac01e422ce43aebb8e5eae9290ce',1,'winstd::sec_runtime_error::sec_runtime_error(const sec_runtime_error &other)'],['../classwinstd_1_1sec__runtime__error.html#aa1d671d5c996a8217de62a816f39a5d4',1,'winstd::sec_runtime_error::sec_runtime_error(error_type num, const char *msg=nullptr)'],['../classwinstd_1_1sec__runtime__error.html#afc95fcf773b18fc72aaacf4ec025471b',1,'winstd::sec_runtime_error::sec_runtime_error(error_type num, const std::string &msg)'],['../classwinstd_1_1sec__runtime__error.html',1,'winstd::sec_runtime_error']]], + ['securemultibytetowidechar_9',['SecureMultiByteToWideChar',['../group___win_std_win_a_p_i.html#ga9aaaa6113374b6cbad241626819d06c9',1,'SecureMultiByteToWideChar(UINT CodePage, DWORD dwFlags, const std::basic_string< char, _Traits1, _Ax1 > &sMultiByteStr, std::basic_string< wchar_t, _Traits2, _Ax2 > &sWideCharStr) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#gaa15c8edc525c24109fafea640cdedfcb',1,'SecureMultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::vector< wchar_t, _Ax > &sWideCharStr) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#gab02484a16fea41e3d9a5c64c2ee1da1a',1,'SecureMultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::basic_string< wchar_t, _Traits, _Ax > &sWideCharStr) noexcept: Win.h']]], + ['securewidechartomultibyte_10',['SecureWideCharToMultiByte',['../group___win_std_win_a_p_i.html#ga05ac1b43a241f1bbcbf1440cf26c6335',1,'SecureWideCharToMultiByte(UINT CodePage, DWORD dwFlags, std::basic_string< wchar_t, _Traits1, _Ax1 > sWideCharStr, std::basic_string< char, _Traits2, _Ax2 > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#ga1a0accb3a54ae0ed34944fd483e0c329',1,'SecureWideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::vector< char, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#ga04f5e27a0e2066c85d7a421fe4e4c462',1,'SecureWideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::basic_string< char, _Traits, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept: Win.h']]], + ['security_20api_11',['Security API',['../group___win_std_security_a_p_i.html',1,'']]], + ['security_5fid_12',['security_id',['../classwinstd_1_1security__id.html',1,'winstd']]], + ['set_5fextended_5fdata_13',['set_extended_data',['../classwinstd_1_1event__rec.html#abfab939c3bb27839c3b591b9a62f9470',1,'winstd::event_rec']]], + ['set_5fextended_5fdata_5finternal_14',['set_extended_data_internal',['../classwinstd_1_1event__rec.html#a0c1c63cc3a3e2f83924aa9f21a298f6c',1,'winstd::event_rec']]], + ['set_5fuser_5fdata_15',['set_user_data',['../classwinstd_1_1event__rec.html#a0df49a47cf45cb76003b85148d7d5098',1,'winstd::event_rec']]], + ['set_5fuser_5fdata_5finternal_16',['set_user_data_internal',['../classwinstd_1_1event__rec.html#af71cc10ff1b9f9935c824b7c7a4130b8',1,'winstd::event_rec']]], + ['setup_20api_17',['Setup API',['../group___setup_a_p_i.html',1,'']]], + ['setup_5fdevice_5finfo_5flist_18',['setup_device_info_list',['../classwinstd_1_1setup__device__info__list.html',1,'winstd']]], + ['setup_5fdriver_5finfo_5flist_5fbuilder_19',['setup_driver_info_list_builder',['../classwinstd_1_1setup__driver__info__list__builder.html#a4774edfbe680a3a496e243544a68c94f',1,'winstd::setup_driver_info_list_builder::setup_driver_info_list_builder()'],['../classwinstd_1_1setup__driver__info__list__builder.html',1,'winstd::setup_driver_info_list_builder']]], + ['shell_20api_20',['Shell API',['../group___win_std_shell_w_a_p_i.html',1,'']]], + ['size_21',['size',['../classwinstd_1_1data__blob.html#ab2ad06e271e8503d7158408773054d23',1,'winstd::data_blob::size()'],['../classwinstd_1_1eap__packet.html#a2534ad15ae47e2d46354d9f535f4031f',1,'winstd::eap_packet::size()']]], + ['size_5ftype_22',['size_type',['../classwinstd_1_1heap__allocator.html#a01815f4f9097b1447c7ddaa2de868f59',1,'winstd::heap_allocator']]], + ['sprintf_23',['sprintf',['../group___win_std_str_format.html#gac397f655a858a069b3e521940af64331',1,'Common.h']]], + ['start_24',['start',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315aea2b2676c28c0db26d39331a336c6b92',1,'winstd']]], + ['status_25',['status',['../classwinstd_1_1setup__driver__info__list__builder.html#ae9c062e82afc1ee1eda5926a0567637e',1,'winstd::setup_driver_info_list_builder::status()'],['../classwinstd_1_1dc__selector.html#aacb4060094f2c4b1747ffa76455b235d',1,'winstd::dc_selector::status()'],['../classwinstd_1_1event__trace__enabler.html#a726b84e91002da1243d512c37a060293',1,'winstd::event_trace_enabler::status()'],['../classwinstd_1_1com__initializer.html#ac3c997f810e8439096d8ca14fecb5b7d',1,'winstd::com_initializer::status()']]], + ['string_20formatting_26',['String Formatting',['../group___win_std_str_format.html',1,'']]], + ['string_5fguid_27',['string_guid',['../classwinstd_1_1string__guid.html#a507ceea48ffeccc4179239dfb5f4cdb2',1,'winstd::string_guid::string_guid()'],['../classwinstd_1_1string__guid.html',1,'winstd::string_guid']]], + ['string_5fmsg_28',['string_msg',['../group___win_std_str_format.html#gae63195e25e08e2b3d9a9b9c2987f5740',1,'winstd']]], + ['string_5fprintf_29',['string_printf',['../group___win_std_str_format.html#ga9dda7a9a763b666f6fe00c4c6626621d',1,'winstd']]], + ['stringtoguid_30',['StringToGuid',['../group___win_std_win_a_p_i.html#gab9c35127ac48f8d941a5354b1a1b7abe',1,'Win.h']]], + ['stringtoguida_31',['StringToGuidA',['../group___win_std_win_a_p_i.html#ga0a3545c7b4d6509b77a9a156e882f32c',1,'Win.h']]], + ['stringtoguidw_32',['StringToGuidW',['../group___win_std_win_a_p_i.html#ga3411488c7daa5c8e03b2ad34764914aa',1,'Win.h']]], + ['system_20handles_33',['System Handles',['../group___win_std_sys_handles.html',1,'']]] ]; diff --git a/search/all_15.js b/search/all_15.js index c97c4d49..eff487aa 100644 --- a/search/all_15.js +++ b/search/all_15.js @@ -2,34 +2,30 @@ var searchData= [ ['waddrinfo_0',['waddrinfo',['../classwinstd_1_1waddrinfo.html',1,'winstd']]], ['widechartomultibyte_1',['WideCharToMultiByte',['../group___win_std_win_a_p_i.html#gabf5eed22d7c5d7a89334dbe1e04e2656',1,'WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::basic_string< char, _Traits, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#ga9ab082dc4cba91b23c4364a125f2f778',1,'WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, std::vector< char, _Ax > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#ga2eee7ccbf8faa628b303df158b67fb2b',1,'WideCharToMultiByte(UINT CodePage, DWORD dwFlags, std::basic_string< wchar_t, _Traits1, _Ax1 > sWideCharStr, std::basic_string< char, _Traits2, _Ax2 > &sMultiByteStr, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar) noexcept: Win.h']]], - ['win_2eh_2',['Win.h',['../_win_8h.html',1,'']]], - ['win_5fhandle_3',['win_handle',['../classwinstd_1_1win__handle.html',1,'winstd']]], - ['win_5fruntime_5ferror_4',['win_runtime_error',['../classwinstd_1_1win__runtime__error.html#aca84ec751726966e72136c67ef7f694f',1,'winstd::win_runtime_error::win_runtime_error(error_type num, const std::string &msg)'],['../classwinstd_1_1win__runtime__error.html#a9adb54bf4ff1bfece100a3886b441a77',1,'winstd::win_runtime_error::win_runtime_error(error_type num, const char *msg=nullptr)'],['../classwinstd_1_1win__runtime__error.html#ab38b42a2a55681bb97cc83ae4a6e5635',1,'winstd::win_runtime_error::win_runtime_error(const std::string &msg)'],['../classwinstd_1_1win__runtime__error.html#ac22014ee7d3fee84ca95ab52ac66e5b6',1,'winstd::win_runtime_error::win_runtime_error(const char *msg=nullptr)'],['../classwinstd_1_1win__runtime__error.html',1,'winstd::win_runtime_error']]], - ['window_5fdc_5',['window_dc',['../classwinstd_1_1window__dc.html#af4841fbba9da009955938892fad8de0e',1,'winstd::window_dc::window_dc(window_dc &&h) noexcept'],['../classwinstd_1_1window__dc.html#a2b4c7b6f55d8d87dedadf08457031d12',1,'winstd::window_dc::window_dc(handle_type h, HWND hwnd) noexcept'],['../classwinstd_1_1window__dc.html#a82c191df2785d2d83517d44744b28e0a',1,'winstd::window_dc::window_dc() noexcept'],['../classwinstd_1_1window__dc.html',1,'winstd::window_dc']]], - ['windows_20api_6',['Windows API',['../group___win_std_win_a_p_i.html',1,'']]], - ['winsock2_20api_7',['WinSock2 API',['../group___win_sock2_a_p_i.html',1,'']]], - ['winsock2_2eh_8',['WinSock2.h',['../_win_sock2_8h.html',1,'']]], - ['winstd_9',['WinStd',['../index.html',1,'']]], - ['winstd_5fdplhandle_5fimpl_10',['WINSTD_DPLHANDLE_IMPL',['../group___win_std_sys_handles.html#ga2768b80bcf124e3127f0b7fe64395adb',1,'Common.h']]], - ['winstd_5fhandle_5fimpl_11',['WINSTD_HANDLE_IMPL',['../group___win_std_sys_handles.html#ga419efffd12b5c96abc8a275ba375ca60',1,'Common.h']]], - ['winstd_5fnoncopyable_12',['WINSTD_NONCOPYABLE',['../group___win_std_general.html#ga11254c72ad33a6e0f5de31db708f784c',1,'Common.h']]], - ['winstd_5fnonmovable_13',['WINSTD_NONMOVABLE',['../group___win_std_general.html#gac91fa8d79c860b1fdbba65b6a322f760',1,'Common.h']]], - ['winstd_5fstack_5fbuffer_5fbytes_14',['WINSTD_STACK_BUFFER_BYTES',['../group___win_std_general.html#ga3ca39107a61bbcd05f901898ec584986',1,'Common.h']]], - ['winstd_5fstring_15',['WINSTD_STRING',['../group___win_std_general.html#gac2a4fa0600886ba34fd4f7d2116d35da',1,'Common.h']]], - ['winstd_5fstring_5fimpl_16',['WINSTD_STRING_IMPL',['../group___win_std_general.html#ga4a46b36a9276ea0451d0790e51c7621f',1,'Common.h']]], - ['wintrust_17',['wintrust',['../classwinstd_1_1wintrust.html',1,'winstd::wintrust'],['../classwinstd_1_1wintrust.html#a5f01f7952ccb4e4f6b3b52968470e49b',1,'winstd::wintrust::wintrust()']]], - ['wintrust_20api_18',['WinTrust API',['../group___win_trust_a_p_i.html',1,'']]], - ['wintrust_2eh_19',['WinTrust.h',['../_win_trust_8h.html',1,'']]], - ['wlan_20api_20',['WLAN API',['../group___win_std_w_l_a_n_a_p_i.html',1,'']]], - ['wlan_2eh_21',['WLAN.h',['../_w_l_a_n_8h.html',1,'']]], - ['wlan_5fhandle_22',['wlan_handle',['../classwinstd_1_1wlan__handle.html',1,'winstd']]], - ['wlanfreememory_5fdelete_23',['WlanFreeMemory_delete',['../structwinstd_1_1_wlan_free_memory__delete.html',1,'winstd::WlanFreeMemory_delete< _Ty >'],['../structwinstd_1_1_wlan_free_memory__delete.html#a3e356b7c4a09f33100e3e35a71d1d94e',1,'winstd::WlanFreeMemory_delete::WlanFreeMemory_delete()'],['../structwinstd_1_1_wlan_free_memory__delete.html#ab30e2946800931f214e9a55a527fe546',1,'winstd::WlanFreeMemory_delete::WlanFreeMemory_delete(const WlanFreeMemory_delete< _Ty2 > &)'],['../structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4.html#a39d42f9429ac337513cd2cad1b5c8fdf',1,'winstd::WlanFreeMemory_delete< _Ty[]>::WlanFreeMemory_delete()']]], - ['wlanfreememory_5fdelete_3c_20_5fty_5b_5d_3e_24',['WlanFreeMemory_delete< _Ty[]>',['../structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4.html',1,'winstd']]], - ['wlanopenhandle_25',['WlanOpenHandle',['../group___win_std_w_l_a_n_a_p_i.html#ga2d1669a80ed12f13ffa780048076c586',1,'WLAN.h']]], - ['wlanreasoncodetostring_26',['WlanReasonCodeToString',['../group___win_std_w_l_a_n_a_p_i.html#gaf621eeb252e56982bc063a629bee30c7',1,'WLAN.h']]], - ['write_27',['write',['../classwinstd_1_1event__provider.html#a068407834baa836c690b80a39a2d2692',1,'winstd::event_provider::write(PCEVENT_DESCRIPTOR EventDescriptor)'],['../classwinstd_1_1event__provider.html#a570ec5977a37f490ddac7aaa047db5e9',1,'winstd::event_provider::write(PCEVENT_DESCRIPTOR EventDescriptor, ULONG UserDataCount=0, PEVENT_DATA_DESCRIPTOR UserData=NULL)'],['../classwinstd_1_1event__provider.html#ad782c4daf27784c0762d09578362db08',1,'winstd::event_provider::write(PCEVENT_DESCRIPTOR EventDescriptor, const EVENT_DATA_DESCRIPTOR param1,...)'],['../classwinstd_1_1event__provider.html#aa956835d2f62705db20e6c82c07be7fe',1,'winstd::event_provider::write(PCEVENT_DESCRIPTOR EventDescriptor, va_list arg)'],['../classwinstd_1_1event__provider.html#a9063c2f40716779223fe618b70df0888',1,'winstd::event_provider::write(UCHAR Level, ULONGLONG Keyword, PCWSTR String,...)']]], - ['ws2_5fruntime_5ferror_28',['ws2_runtime_error',['../classwinstd_1_1ws2__runtime__error.html',1,'winstd::ws2_runtime_error'],['../classwinstd_1_1ws2__runtime__error.html#aa6ed38106310751800eca077c2fcb71a',1,'winstd::ws2_runtime_error::ws2_runtime_error(error_type num, const std::string &msg)'],['../classwinstd_1_1ws2__runtime__error.html#a2e54221cc0f78724af416f9af1415267',1,'winstd::ws2_runtime_error::ws2_runtime_error(const char *msg=nullptr)'],['../classwinstd_1_1ws2__runtime__error.html#ae7914ed1c76d543399992573bc580b4e',1,'winstd::ws2_runtime_error::ws2_runtime_error(const std::string &msg)'],['../classwinstd_1_1ws2__runtime__error.html#a0f57437dbc7c87ac05230a5a5458846b',1,'winstd::ws2_runtime_error::ws2_runtime_error(error_type num, const char *msg=nullptr)']]], - ['wstring_5fguid_29',['wstring_guid',['../classwinstd_1_1wstring__guid.html',1,'winstd::wstring_guid'],['../classwinstd_1_1wstring__guid.html#adca059128e082167a19d1281719d9d60',1,'winstd::wstring_guid::wstring_guid()']]], - ['wstring_5fmsg_30',['wstring_msg',['../group___win_std_str_format.html#ga52a88ab19a1a96f778dbf7a2938bc98f',1,'winstd']]], - ['wstring_5fprintf_31',['wstring_printf',['../group___win_std_str_format.html#ga0abdccf0a03840f984b7a889fea13cac',1,'winstd']]] + ['win_5fhandle_2',['win_handle',['../classwinstd_1_1win__handle.html',1,'winstd']]], + ['win_5fruntime_5ferror_3',['win_runtime_error',['../classwinstd_1_1win__runtime__error.html#aca84ec751726966e72136c67ef7f694f',1,'winstd::win_runtime_error::win_runtime_error(error_type num, const std::string &msg)'],['../classwinstd_1_1win__runtime__error.html#a9adb54bf4ff1bfece100a3886b441a77',1,'winstd::win_runtime_error::win_runtime_error(error_type num, const char *msg=nullptr)'],['../classwinstd_1_1win__runtime__error.html#ab38b42a2a55681bb97cc83ae4a6e5635',1,'winstd::win_runtime_error::win_runtime_error(const std::string &msg)'],['../classwinstd_1_1win__runtime__error.html#ac22014ee7d3fee84ca95ab52ac66e5b6',1,'winstd::win_runtime_error::win_runtime_error(const char *msg=nullptr)'],['../classwinstd_1_1win__runtime__error.html',1,'winstd::win_runtime_error']]], + ['window_5fdc_4',['window_dc',['../classwinstd_1_1window__dc.html#a82c191df2785d2d83517d44744b28e0a',1,'winstd::window_dc::window_dc() noexcept'],['../classwinstd_1_1window__dc.html#a2b4c7b6f55d8d87dedadf08457031d12',1,'winstd::window_dc::window_dc(handle_type h, HWND hwnd) noexcept'],['../classwinstd_1_1window__dc.html#af4841fbba9da009955938892fad8de0e',1,'winstd::window_dc::window_dc(window_dc &&h) noexcept'],['../classwinstd_1_1window__dc.html',1,'winstd::window_dc']]], + ['windows_20api_5',['Windows API',['../group___win_std_win_a_p_i.html',1,'']]], + ['winsock2_20api_6',['WinSock2 API',['../group___win_sock2_a_p_i.html',1,'']]], + ['winstd_7',['WinStd',['../index.html',1,'']]], + ['winstd_5fdplhandle_5fimpl_8',['WINSTD_DPLHANDLE_IMPL',['../group___win_std_sys_handles.html#ga2768b80bcf124e3127f0b7fe64395adb',1,'Common.h']]], + ['winstd_5fhandle_5fimpl_9',['WINSTD_HANDLE_IMPL',['../group___win_std_sys_handles.html#ga419efffd12b5c96abc8a275ba375ca60',1,'Common.h']]], + ['winstd_5fnoncopyable_10',['WINSTD_NONCOPYABLE',['../group___win_std_general.html#ga11254c72ad33a6e0f5de31db708f784c',1,'Common.h']]], + ['winstd_5fnonmovable_11',['WINSTD_NONMOVABLE',['../group___win_std_general.html#gac91fa8d79c860b1fdbba65b6a322f760',1,'Common.h']]], + ['winstd_5fstack_5fbuffer_5fbytes_12',['WINSTD_STACK_BUFFER_BYTES',['../group___win_std_general.html#ga3ca39107a61bbcd05f901898ec584986',1,'Common.h']]], + ['winstd_5fstring_13',['WINSTD_STRING',['../group___win_std_general.html#gac2a4fa0600886ba34fd4f7d2116d35da',1,'Common.h']]], + ['winstd_5fstring_5fimpl_14',['WINSTD_STRING_IMPL',['../group___win_std_general.html#ga4a46b36a9276ea0451d0790e51c7621f',1,'Common.h']]], + ['wintrust_15',['wintrust',['../classwinstd_1_1wintrust.html',1,'winstd::wintrust'],['../classwinstd_1_1wintrust.html#a5f01f7952ccb4e4f6b3b52968470e49b',1,'winstd::wintrust::wintrust()']]], + ['wintrust_20api_16',['WinTrust API',['../group___win_trust_a_p_i.html',1,'']]], + ['wlan_20api_17',['WLAN API',['../group___win_std_w_l_a_n_a_p_i.html',1,'']]], + ['wlan_5fhandle_18',['wlan_handle',['../classwinstd_1_1wlan__handle.html',1,'winstd']]], + ['wlanfreememory_5fdelete_19',['WlanFreeMemory_delete',['../structwinstd_1_1_wlan_free_memory__delete.html',1,'winstd::WlanFreeMemory_delete< _Ty >'],['../structwinstd_1_1_wlan_free_memory__delete.html#a3e356b7c4a09f33100e3e35a71d1d94e',1,'winstd::WlanFreeMemory_delete::WlanFreeMemory_delete()'],['../structwinstd_1_1_wlan_free_memory__delete.html#ab30e2946800931f214e9a55a527fe546',1,'winstd::WlanFreeMemory_delete::WlanFreeMemory_delete(const WlanFreeMemory_delete< _Ty2 > &)'],['../structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4.html#a39d42f9429ac337513cd2cad1b5c8fdf',1,'winstd::WlanFreeMemory_delete< _Ty[]>::WlanFreeMemory_delete()']]], + ['wlanfreememory_5fdelete_3c_20_5fty_5b_5d_3e_20',['WlanFreeMemory_delete< _Ty[]>',['../structwinstd_1_1_wlan_free_memory__delete_3_01___ty_0f_0e_4.html',1,'winstd']]], + ['wlanopenhandle_21',['WlanOpenHandle',['../group___win_std_w_l_a_n_a_p_i.html#ga2d1669a80ed12f13ffa780048076c586',1,'WLAN.h']]], + ['wlanreasoncodetostring_22',['WlanReasonCodeToString',['../group___win_std_w_l_a_n_a_p_i.html#gaf621eeb252e56982bc063a629bee30c7',1,'WLAN.h']]], + ['write_23',['write',['../classwinstd_1_1event__provider.html#aa956835d2f62705db20e6c82c07be7fe',1,'winstd::event_provider::write(PCEVENT_DESCRIPTOR EventDescriptor, va_list arg)'],['../classwinstd_1_1event__provider.html#a068407834baa836c690b80a39a2d2692',1,'winstd::event_provider::write(PCEVENT_DESCRIPTOR EventDescriptor)'],['../classwinstd_1_1event__provider.html#a570ec5977a37f490ddac7aaa047db5e9',1,'winstd::event_provider::write(PCEVENT_DESCRIPTOR EventDescriptor, ULONG UserDataCount=0, PEVENT_DATA_DESCRIPTOR UserData=NULL)'],['../classwinstd_1_1event__provider.html#ad782c4daf27784c0762d09578362db08',1,'winstd::event_provider::write(PCEVENT_DESCRIPTOR EventDescriptor, const EVENT_DATA_DESCRIPTOR param1,...)'],['../classwinstd_1_1event__provider.html#a9063c2f40716779223fe618b70df0888',1,'winstd::event_provider::write(UCHAR Level, ULONGLONG Keyword, PCWSTR String,...)']]], + ['ws2_5fruntime_5ferror_24',['ws2_runtime_error',['../classwinstd_1_1ws2__runtime__error.html',1,'winstd::ws2_runtime_error'],['../classwinstd_1_1ws2__runtime__error.html#aa6ed38106310751800eca077c2fcb71a',1,'winstd::ws2_runtime_error::ws2_runtime_error(error_type num, const std::string &msg)'],['../classwinstd_1_1ws2__runtime__error.html#a0f57437dbc7c87ac05230a5a5458846b',1,'winstd::ws2_runtime_error::ws2_runtime_error(error_type num, const char *msg=nullptr)'],['../classwinstd_1_1ws2__runtime__error.html#ae7914ed1c76d543399992573bc580b4e',1,'winstd::ws2_runtime_error::ws2_runtime_error(const std::string &msg)'],['../classwinstd_1_1ws2__runtime__error.html#a2e54221cc0f78724af416f9af1415267',1,'winstd::ws2_runtime_error::ws2_runtime_error(const char *msg=nullptr)']]], + ['wstring_5fguid_25',['wstring_guid',['../classwinstd_1_1wstring__guid.html',1,'winstd::wstring_guid'],['../classwinstd_1_1wstring__guid.html#adca059128e082167a19d1281719d9d60',1,'winstd::wstring_guid::wstring_guid()']]], + ['wstring_5fmsg_26',['wstring_msg',['../group___win_std_str_format.html#ga52a88ab19a1a96f778dbf7a2938bc98f',1,'winstd']]], + ['wstring_5fprintf_27',['wstring_printf',['../group___win_std_str_format.html#ga0abdccf0a03840f984b7a889fea13cac',1,'winstd']]] ]; diff --git a/search/all_3.js b/search/all_3.js index 0ce41eb8..cc7061f6 100644 --- a/search/all_3.js +++ b/search/all_3.js @@ -9,45 +9,41 @@ var searchData= ['certgetnamestringw_6',['CertGetNameStringW',['../group___win_std_crypto_a_p_i.html#ga2a0de58b33f5eb080e3b6ba9a7fe1e53',1,'Crypt.h']]], ['change_5ftype_7',['change_type',['../classwinstd_1_1variant.html#a499d38db49d577c816e447c6a3875ff5',1,'winstd::variant']]], ['cocreateinstance_8',['CoCreateInstance',['../group___win_std_c_o_m.html#gaa05e677aa01b9b1f2f8b58571532c965',1,'COM.h']]], - ['com_20object_20management_9',['COM object management',['../group___win_std_c_o_m.html',1,'']]], - ['com_2eh_10',['COM.h',['../_c_o_m_8h.html',1,'']]], - ['com_5finitializer_11',['com_initializer',['../classwinstd_1_1com__initializer.html#a2e1dceaa4a658f2d35b93fe85d71e109',1,'winstd::com_initializer::com_initializer(LPVOID pvReserved) noexcept'],['../classwinstd_1_1com__initializer.html#a20c89f6e237eb97166aac61f0dbdcbf6',1,'winstd::com_initializer::com_initializer(LPVOID pvReserved, DWORD dwCoInit) noexcept'],['../classwinstd_1_1com__initializer.html',1,'winstd::com_initializer']]], - ['com_5fobj_12',['com_obj',['../classwinstd_1_1com__obj.html#aace64e8520e9caf7c258ae207a5ef874',1,'winstd::com_obj::com_obj(com_obj< _Other > &other)'],['../classwinstd_1_1com__obj.html#aa2c8f855aaad8e35c1da6cfd9f32e01e',1,'winstd::com_obj::com_obj(_Other *other)'],['../classwinstd_1_1com__obj.html',1,'winstd::com_obj< T >']]], - ['com_5fruntime_5ferror_13',['com_runtime_error',['../classwinstd_1_1com__runtime__error.html#a75030cbe7acc6532140c73caf4b15ed8',1,'winstd::com_runtime_error::com_runtime_error(error_type num, const std::string &msg)'],['../classwinstd_1_1com__runtime__error.html#aa1b65214e16b18bf8b9b191abff254b7',1,'winstd::com_runtime_error::com_runtime_error(error_type num, const char *msg=nullptr)'],['../classwinstd_1_1com__runtime__error.html',1,'winstd::com_runtime_error']]], - ['common_2eh_14',['Common.h',['../_common_8h.html',1,'']]], - ['console_5fctrl_5fhandler_15',['console_ctrl_handler',['../classwinstd_1_1console__ctrl__handler.html#a1c05134a4453123739ac5b45f62fe13a',1,'winstd::console_ctrl_handler::console_ctrl_handler()'],['../classwinstd_1_1console__ctrl__handler.html',1,'winstd::console_ctrl_handler']]], - ['const_5fpointer_16',['const_pointer',['../classwinstd_1_1heap__allocator.html#adc56ad9f2484d7d34299bef73709ef9c',1,'winstd::heap_allocator']]], - ['const_5freference_17',['const_reference',['../classwinstd_1_1heap__allocator.html#ad98c7e8fc3e14da42a8dfc897e75a790',1,'winstd::heap_allocator']]], - ['construct_18',['construct',['../classwinstd_1_1heap__allocator.html#ad307cb4c9eaf2dcbcd29b379bc01b463',1,'winstd::heap_allocator::construct(pointer ptr, const _Ty &val)'],['../classwinstd_1_1heap__allocator.html#a95485648de70d7896f81ef9cdad01fbf',1,'winstd::heap_allocator::construct(pointer ptr, _Ty &&val)']]], - ['cotaskmemfree_5fdelete_19',['CoTaskMemFree_delete',['../structwinstd_1_1_co_task_mem_free__delete.html#a712d2e91abc99bebe8cf8d32ac649326',1,'winstd::CoTaskMemFree_delete::CoTaskMemFree_delete()'],['../structwinstd_1_1_co_task_mem_free__delete.html',1,'winstd::CoTaskMemFree_delete']]], - ['create_20',['create',['../classwinstd_1_1event__provider.html#aeb28bf6cc859920913e604b2d342f316',1,'winstd::event_provider::create()'],['../classwinstd_1_1event__session.html#af75b790f98bc16ed94f1167fe4acdb50',1,'winstd::event_session::create()'],['../classwinstd_1_1eap__packet.html#ac769190286a427b778b17215f19010e9',1,'winstd::eap_packet::create()']]], - ['create_5fexp1_21',['create_exp1',['../classwinstd_1_1crypt__key.html#a9a6097582df953795969c29ec134914a',1,'winstd::crypt_key']]], - ['create_5fms_5fmppe_5fkey_22',['create_ms_mppe_key',['../classwinstd_1_1eap__attr.html#a8098b30108457f2c96c865bfabce3021',1,'winstd::eap_attr']]], - ['cred_2eh_23',['Cred.h',['../_cred_8h.html',1,'']]], - ['credentials_20api_24',['Credentials API',['../group___win_std_cred_a_p_i.html',1,'']]], - ['credenumerate_25',['CredEnumerate',['../group___win_std_cred_a_p_i.html#ga3279ce4382680fc19b1a89ea5a3f261e',1,'Cred.h']]], - ['credfree_5fdelete_26',['CredFree_delete',['../structwinstd_1_1_cred_free__delete.html#a3959d2b3727e557e19d8b0f5c449b57a',1,'winstd::CredFree_delete::CredFree_delete()'],['../structwinstd_1_1_cred_free__delete.html#ac4cc203e783bcc1c71011cde00ddf9ad',1,'winstd::CredFree_delete::CredFree_delete(const CredFree_delete< _Ty2 > &)'],['../structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4.html#aad102423f4fb96fd105b57a88a6031ab',1,'winstd::CredFree_delete< _Ty[]>::CredFree_delete()'],['../structwinstd_1_1_cred_free__delete.html',1,'winstd::CredFree_delete< _Ty >']]], - ['credfree_5fdelete_3c_20_5fty_5b_5d_3e_27',['CredFree_delete< _Ty[]>',['../structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4.html',1,'winstd']]], - ['credprotecta_28',['CredProtectA',['../group___win_std_cred_a_p_i.html#ga66f305cb6a0bf6d4f2c6f2f49180df9b',1,'Cred.h']]], - ['credprotectw_29',['CredProtectW',['../group___win_std_cred_a_p_i.html#gaa140d15e40f91b075ad1fa69429a0922',1,'Cred.h']]], - ['credunprotecta_30',['CredUnprotectA',['../group___win_std_cred_a_p_i.html#ga289617e5856f3f4fd18b86754726407b',1,'Cred.h']]], - ['credunprotectw_31',['CredUnprotectW',['../group___win_std_cred_a_p_i.html#gac5fc6137d0a5f7c4bc713676e08a214e',1,'Cred.h']]], - ['critical_5fsection_32',['critical_section',['../classwinstd_1_1critical__section.html#aa8875ee96e273ba72e86457fe0f4c768',1,'winstd::critical_section::critical_section()'],['../classwinstd_1_1critical__section.html',1,'winstd::critical_section']]], - ['crypt_2eh_33',['Crypt.h',['../_crypt_8h.html',1,'']]], - ['crypt_5fhash_34',['crypt_hash',['../classwinstd_1_1crypt__hash.html',1,'winstd']]], - ['crypt_5fkey_35',['crypt_key',['../classwinstd_1_1crypt__key.html',1,'winstd']]], - ['crypt_5fprov_36',['crypt_prov',['../classwinstd_1_1crypt__prov.html',1,'winstd']]], - ['cryptacquirecontexta_37',['CryptAcquireContextA',['../group___win_std_crypto_a_p_i.html#ga54a61f3b9b1ddc10544d7156184a9c51',1,'Crypt.h']]], - ['cryptacquirecontextw_38',['CryptAcquireContextW',['../group___win_std_crypto_a_p_i.html#gaa4a362230b1471ad35e4072a8d506ad4',1,'Crypt.h']]], - ['cryptcreatehash_39',['CryptCreateHash',['../group___win_std_crypto_a_p_i.html#ga947da720e2b4c51947e06f9489cf71eb',1,'Crypt.h']]], - ['cryptdecrypt_40',['CryptDecrypt',['../group___win_std_crypto_a_p_i.html#gae93b1a49d6eafd5c7d8abe48ee97faf8',1,'Crypt.h']]], - ['cryptderivekey_41',['CryptDeriveKey',['../group___win_std_crypto_a_p_i.html#gad2de3e63d5df80d031a13aaa50bade53',1,'Crypt.h']]], - ['cryptencrypt_42',['CryptEncrypt',['../group___win_std_crypto_a_p_i.html#gabd30cb0e884c2c88c3e4f3321ea5efff',1,'Crypt.h']]], - ['cryptexportkey_43',['CryptExportKey',['../group___win_std_crypto_a_p_i.html#ga72ee7a873236f55ff0cb56d46e4ff0a6',1,'Crypt.h']]], - ['cryptgenkey_44',['CryptGenKey',['../group___win_std_crypto_a_p_i.html#ga5e6ab0e4e8a49e8c52c1c5b3bb9b0965',1,'Crypt.h']]], - ['cryptgethashparam_45',['CryptGetHashParam',['../group___win_std_crypto_a_p_i.html#ga231b40581fbe230fdc82d4f473f2e43f',1,'CryptGetHashParam(HCRYPTHASH hHash, DWORD dwParam, std::vector< _Ty, _Ax > &aData, DWORD dwFlags): Crypt.h'],['../group___win_std_crypto_a_p_i.html#gab3ae01f33782c38e84f2ec4a520c0628',1,'CryptGetHashParam(HCRYPTHASH hHash, DWORD dwParam, T &data, DWORD dwFlags): Crypt.h']]], - ['cryptgetkeyparam_46',['CryptGetKeyParam',['../group___win_std_crypto_a_p_i.html#gaba94a7e33622f959702ac0e24edc3aee',1,'CryptGetKeyParam(HCRYPTKEY hKey, DWORD dwParam, T &data, DWORD dwFlags): Crypt.h'],['../group___win_std_crypto_a_p_i.html#ga782fd6fda714da07b5e687b80fc6f443',1,'CryptGetKeyParam(HCRYPTKEY hKey, DWORD dwParam, std::vector< _Ty, _Ax > &aData, DWORD dwFlags): Crypt.h']]], - ['cryptimportkey_47',['CryptImportKey',['../group___win_std_crypto_a_p_i.html#gaf835e8e1fa80cfed905aa535e210a177',1,'Crypt.h']]], - ['cryptimportpublickeyinfo_48',['CryptImportPublicKeyInfo',['../group___win_std_crypto_a_p_i.html#ga0e1662683cff5871962961a6f49664a0',1,'Crypt.h']]], - ['cryptography_20api_49',['Cryptography API',['../group___win_std_crypto_a_p_i.html',1,'']]] + ['com_20object_20management_9',['COM Object Management',['../group___win_std_c_o_m.html',1,'']]], + ['com_5finitializer_10',['com_initializer',['../classwinstd_1_1com__initializer.html#a20c89f6e237eb97166aac61f0dbdcbf6',1,'winstd::com_initializer::com_initializer(LPVOID pvReserved, DWORD dwCoInit) noexcept'],['../classwinstd_1_1com__initializer.html#a2e1dceaa4a658f2d35b93fe85d71e109',1,'winstd::com_initializer::com_initializer(LPVOID pvReserved) noexcept'],['../classwinstd_1_1com__initializer.html',1,'winstd::com_initializer']]], + ['com_5fobj_11',['com_obj',['../classwinstd_1_1com__obj.html#aa2c8f855aaad8e35c1da6cfd9f32e01e',1,'winstd::com_obj::com_obj(_Other *other)'],['../classwinstd_1_1com__obj.html#aace64e8520e9caf7c258ae207a5ef874',1,'winstd::com_obj::com_obj(com_obj< _Other > &other)'],['../classwinstd_1_1com__obj.html',1,'winstd::com_obj< T >']]], + ['com_5fruntime_5ferror_12',['com_runtime_error',['../classwinstd_1_1com__runtime__error.html#a75030cbe7acc6532140c73caf4b15ed8',1,'winstd::com_runtime_error::com_runtime_error(error_type num, const std::string &msg)'],['../classwinstd_1_1com__runtime__error.html#aa1b65214e16b18bf8b9b191abff254b7',1,'winstd::com_runtime_error::com_runtime_error(error_type num, const char *msg=nullptr)'],['../classwinstd_1_1com__runtime__error.html',1,'winstd::com_runtime_error']]], + ['console_5fctrl_5fhandler_13',['console_ctrl_handler',['../classwinstd_1_1console__ctrl__handler.html#a1c05134a4453123739ac5b45f62fe13a',1,'winstd::console_ctrl_handler::console_ctrl_handler()'],['../classwinstd_1_1console__ctrl__handler.html',1,'winstd::console_ctrl_handler']]], + ['const_5fpointer_14',['const_pointer',['../classwinstd_1_1heap__allocator.html#adc56ad9f2484d7d34299bef73709ef9c',1,'winstd::heap_allocator']]], + ['const_5freference_15',['const_reference',['../classwinstd_1_1heap__allocator.html#ad98c7e8fc3e14da42a8dfc897e75a790',1,'winstd::heap_allocator']]], + ['construct_16',['construct',['../classwinstd_1_1heap__allocator.html#ad307cb4c9eaf2dcbcd29b379bc01b463',1,'winstd::heap_allocator::construct(pointer ptr, const _Ty &val)'],['../classwinstd_1_1heap__allocator.html#a95485648de70d7896f81ef9cdad01fbf',1,'winstd::heap_allocator::construct(pointer ptr, _Ty &&val)']]], + ['cotaskmemfree_5fdelete_17',['CoTaskMemFree_delete',['../structwinstd_1_1_co_task_mem_free__delete.html#a712d2e91abc99bebe8cf8d32ac649326',1,'winstd::CoTaskMemFree_delete::CoTaskMemFree_delete()'],['../structwinstd_1_1_co_task_mem_free__delete.html',1,'winstd::CoTaskMemFree_delete']]], + ['create_18',['create',['../classwinstd_1_1eap__packet.html#ac769190286a427b778b17215f19010e9',1,'winstd::eap_packet::create()'],['../classwinstd_1_1event__provider.html#aeb28bf6cc859920913e604b2d342f316',1,'winstd::event_provider::create()'],['../classwinstd_1_1event__session.html#af75b790f98bc16ed94f1167fe4acdb50',1,'winstd::event_session::create()']]], + ['create_5fexp1_19',['create_exp1',['../classwinstd_1_1crypt__key.html#a9a6097582df953795969c29ec134914a',1,'winstd::crypt_key']]], + ['create_5fms_5fmppe_5fkey_20',['create_ms_mppe_key',['../classwinstd_1_1eap__attr.html#a8098b30108457f2c96c865bfabce3021',1,'winstd::eap_attr']]], + ['credentials_20api_21',['Credentials API',['../group___win_std_cred_a_p_i.html',1,'']]], + ['credenumerate_22',['CredEnumerate',['../group___win_std_cred_a_p_i.html#ga3279ce4382680fc19b1a89ea5a3f261e',1,'Cred.h']]], + ['credfree_5fdelete_23',['CredFree_delete',['../structwinstd_1_1_cred_free__delete.html#ac4cc203e783bcc1c71011cde00ddf9ad',1,'winstd::CredFree_delete::CredFree_delete(const CredFree_delete< _Ty2 > &)'],['../structwinstd_1_1_cred_free__delete.html#a3959d2b3727e557e19d8b0f5c449b57a',1,'winstd::CredFree_delete::CredFree_delete()'],['../structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4.html#aad102423f4fb96fd105b57a88a6031ab',1,'winstd::CredFree_delete< _Ty[]>::CredFree_delete()'],['../structwinstd_1_1_cred_free__delete.html',1,'winstd::CredFree_delete< _Ty >']]], + ['credfree_5fdelete_3c_20_5fty_5b_5d_3e_24',['CredFree_delete< _Ty[]>',['../structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4.html',1,'winstd']]], + ['credprotecta_25',['CredProtectA',['../group___win_std_cred_a_p_i.html#ga66f305cb6a0bf6d4f2c6f2f49180df9b',1,'Cred.h']]], + ['credprotectw_26',['CredProtectW',['../group___win_std_cred_a_p_i.html#gaa140d15e40f91b075ad1fa69429a0922',1,'Cred.h']]], + ['credunprotecta_27',['CredUnprotectA',['../group___win_std_cred_a_p_i.html#ga289617e5856f3f4fd18b86754726407b',1,'Cred.h']]], + ['credunprotectw_28',['CredUnprotectW',['../group___win_std_cred_a_p_i.html#gac5fc6137d0a5f7c4bc713676e08a214e',1,'Cred.h']]], + ['critical_5fsection_29',['critical_section',['../classwinstd_1_1critical__section.html#aa8875ee96e273ba72e86457fe0f4c768',1,'winstd::critical_section::critical_section()'],['../classwinstd_1_1critical__section.html',1,'winstd::critical_section']]], + ['crypt_5fhash_30',['crypt_hash',['../classwinstd_1_1crypt__hash.html',1,'winstd']]], + ['crypt_5fkey_31',['crypt_key',['../classwinstd_1_1crypt__key.html',1,'winstd']]], + ['crypt_5fprov_32',['crypt_prov',['../classwinstd_1_1crypt__prov.html',1,'winstd']]], + ['cryptacquirecontexta_33',['CryptAcquireContextA',['../group___win_std_crypto_a_p_i.html#ga54a61f3b9b1ddc10544d7156184a9c51',1,'Crypt.h']]], + ['cryptacquirecontextw_34',['CryptAcquireContextW',['../group___win_std_crypto_a_p_i.html#gaa4a362230b1471ad35e4072a8d506ad4',1,'Crypt.h']]], + ['cryptcreatehash_35',['CryptCreateHash',['../group___win_std_crypto_a_p_i.html#ga947da720e2b4c51947e06f9489cf71eb',1,'Crypt.h']]], + ['cryptdecrypt_36',['CryptDecrypt',['../group___win_std_crypto_a_p_i.html#gae93b1a49d6eafd5c7d8abe48ee97faf8',1,'Crypt.h']]], + ['cryptderivekey_37',['CryptDeriveKey',['../group___win_std_crypto_a_p_i.html#gad2de3e63d5df80d031a13aaa50bade53',1,'Crypt.h']]], + ['cryptencrypt_38',['CryptEncrypt',['../group___win_std_crypto_a_p_i.html#gabd30cb0e884c2c88c3e4f3321ea5efff',1,'Crypt.h']]], + ['cryptexportkey_39',['CryptExportKey',['../group___win_std_crypto_a_p_i.html#ga72ee7a873236f55ff0cb56d46e4ff0a6',1,'Crypt.h']]], + ['cryptgenkey_40',['CryptGenKey',['../group___win_std_crypto_a_p_i.html#ga5e6ab0e4e8a49e8c52c1c5b3bb9b0965',1,'Crypt.h']]], + ['cryptgethashparam_41',['CryptGetHashParam',['../group___win_std_crypto_a_p_i.html#ga231b40581fbe230fdc82d4f473f2e43f',1,'CryptGetHashParam(HCRYPTHASH hHash, DWORD dwParam, std::vector< _Ty, _Ax > &aData, DWORD dwFlags): Crypt.h'],['../group___win_std_crypto_a_p_i.html#gab3ae01f33782c38e84f2ec4a520c0628',1,'CryptGetHashParam(HCRYPTHASH hHash, DWORD dwParam, T &data, DWORD dwFlags): Crypt.h']]], + ['cryptgetkeyparam_42',['CryptGetKeyParam',['../group___win_std_crypto_a_p_i.html#ga782fd6fda714da07b5e687b80fc6f443',1,'CryptGetKeyParam(HCRYPTKEY hKey, DWORD dwParam, std::vector< _Ty, _Ax > &aData, DWORD dwFlags): Crypt.h'],['../group___win_std_crypto_a_p_i.html#gaba94a7e33622f959702ac0e24edc3aee',1,'CryptGetKeyParam(HCRYPTKEY hKey, DWORD dwParam, T &data, DWORD dwFlags): Crypt.h']]], + ['cryptimportkey_43',['CryptImportKey',['../group___win_std_crypto_a_p_i.html#gaf835e8e1fa80cfed905aa535e210a177',1,'Crypt.h']]], + ['cryptimportpublickeyinfo_44',['CryptImportPublicKeyInfo',['../group___win_std_crypto_a_p_i.html#ga0e1662683cff5871962961a6f49664a0',1,'Crypt.h']]], + ['cryptography_20api_45',['Cryptography API',['../group___win_std_crypto_a_p_i.html',1,'']]] ]; diff --git a/search/all_5.js b/search/all_5.js index 373757a6..d00dea80 100644 --- a/search/all_5.js +++ b/search/all_5.js @@ -1,39 +1,37 @@ var searchData= [ - ['eap_2eh_0',['EAP.h',['../_e_a_p_8h.html',1,'']]], - ['eap_5fattr_1',['eap_attr',['../classwinstd_1_1eap__attr.html#a029d15ddb8b9cd33b4907f01719da5b8',1,'winstd::eap_attr::eap_attr(eap_attr &&a) noexcept'],['../classwinstd_1_1eap__attr.html#a4cb8d6fbf7f4e53ec64a030bea00d148',1,'winstd::eap_attr::eap_attr(const EAP_ATTRIBUTE &a)'],['../classwinstd_1_1eap__attr.html#a015a82d7f91679f76ca590bbdabc04c1',1,'winstd::eap_attr::eap_attr() noexcept'],['../classwinstd_1_1eap__attr.html',1,'winstd::eap_attr']]], - ['eap_5fblob_2',['eap_blob',['../group___win_std_e_a_p_a_p_i.html#ga25f2a0eea11e8332bfcec6b032a17a05',1,'winstd']]], - ['eap_5fblob_5fruntime_3',['eap_blob_runtime',['../group___win_std_e_a_p_a_p_i.html#gabd2665596cc49191b36e6378147c47ad',1,'winstd']]], - ['eap_5ferror_4',['eap_error',['../group___win_std_e_a_p_a_p_i.html#ga910edec3d3d1ba4f6f306dcafdc2117a',1,'winstd']]], - ['eap_5ferror_5fruntime_5',['eap_error_runtime',['../group___win_std_e_a_p_a_p_i.html#ga102f6e28f2ae479af7b6555894f110ac',1,'winstd']]], - ['eap_5fmethod_5finfo_5farray_6',['eap_method_info_array',['../classwinstd_1_1eap__method__info__array.html#a3c3e0f0150d21c09801c67ceb927e873',1,'winstd::eap_method_info_array::eap_method_info_array(eap_method_info_array &&other) noexcept'],['../classwinstd_1_1eap__method__info__array.html#a3dc5d1571c9e85dedd3dd3d6626947b7',1,'winstd::eap_method_info_array::eap_method_info_array() noexcept'],['../classwinstd_1_1eap__method__info__array.html',1,'winstd::eap_method_info_array']]], - ['eap_5fmethod_5fprop_7',['eap_method_prop',['../classwinstd_1_1eap__method__prop.html#a06b8588c10a52d60556ced6b6a111ac3',1,'winstd::eap_method_prop::eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, BOOL value) noexcept'],['../classwinstd_1_1eap__method__prop.html#a7f0f5817c41e839a1e71eda3a2284949',1,'winstd::eap_method_prop::eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, DWORD value) noexcept'],['../classwinstd_1_1eap__method__prop.html#adc01bff4048e03f5f7b88d186940b9d8',1,'winstd::eap_method_prop::eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, LPCWSTR value) noexcept'],['../classwinstd_1_1eap__method__prop.html',1,'winstd::eap_method_prop']]], - ['eap_5fpacket_8',['eap_packet',['../classwinstd_1_1eap__packet.html',1,'winstd']]], - ['eap_5fruntime_5ferror_9',['eap_runtime_error',['../classwinstd_1_1eap__runtime__error.html#a4e271e11e866ee7114df20b63022d827',1,'winstd::eap_runtime_error::eap_runtime_error(const EAP_ERROR &err, const char *msg=nullptr)'],['../classwinstd_1_1eap__runtime__error.html#a68708f0598e27325339cc34473131240',1,'winstd::eap_runtime_error::eap_runtime_error(const EAP_ERROR &err, const std::string &msg)'],['../classwinstd_1_1eap__runtime__error.html',1,'winstd::eap_runtime_error']]], - ['eap_5ftype_5ft_10',['eap_type_t',['../group___win_std_e_a_p_a_p_i.html#ga50f5584ca708165f43cec42c42243315',1,'winstd']]], - ['eaphostpeerfreeeaperror_5fdelete_11',['EapHostPeerFreeEapError_delete',['../structwinstd_1_1_eap_host_peer_free_eap_error__delete.html#ab4dd927d7e4cd40b2ce7068fe252b76e',1,'winstd::EapHostPeerFreeEapError_delete::EapHostPeerFreeEapError_delete()'],['../structwinstd_1_1_eap_host_peer_free_eap_error__delete.html',1,'winstd::EapHostPeerFreeEapError_delete']]], - ['eaphostpeerfreeerrormemory_5fdelete_12',['EapHostPeerFreeErrorMemory_delete',['../structwinstd_1_1_eap_host_peer_free_error_memory__delete.html#a43f0b1a440b9a431e9fee807bc1386be',1,'winstd::EapHostPeerFreeErrorMemory_delete::EapHostPeerFreeErrorMemory_delete()'],['../structwinstd_1_1_eap_host_peer_free_error_memory__delete.html',1,'winstd::EapHostPeerFreeErrorMemory_delete']]], - ['eaphostpeerfreememory_5fdelete_13',['EapHostPeerFreeMemory_delete',['../structwinstd_1_1_eap_host_peer_free_memory__delete.html#af6220ac1d99cc114670c363ecfe64557',1,'winstd::EapHostPeerFreeMemory_delete::EapHostPeerFreeMemory_delete()'],['../structwinstd_1_1_eap_host_peer_free_memory__delete.html',1,'winstd::EapHostPeerFreeMemory_delete']]], - ['eaphostpeerfreeruntimememory_5fdelete_14',['EapHostPeerFreeRuntimeMemory_delete',['../structwinstd_1_1_eap_host_peer_free_runtime_memory__delete.html#afdd46f3517e59ce19fdaddebbbaeb10d',1,'winstd::EapHostPeerFreeRuntimeMemory_delete::EapHostPeerFreeRuntimeMemory_delete()'],['../structwinstd_1_1_eap_host_peer_free_runtime_memory__delete.html',1,'winstd::EapHostPeerFreeRuntimeMemory_delete']]], - ['enable_5fcallback_15',['enable_callback',['../classwinstd_1_1event__provider.html#ac896e3a23b3f44ef0b1cb0ac6717e894',1,'winstd::event_provider::enable_callback(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData)'],['../classwinstd_1_1event__provider.html#ae1bde7438a09da9e878e86890de50a07',1,'winstd::event_provider::enable_callback(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext)']]], - ['enable_5ftrace_16',['enable_trace',['../classwinstd_1_1event__session.html#aa140384c61972ebabbf6489e8aa5700b',1,'winstd::event_session']]], - ['end_17',['end',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315a7f021a1415b86f2d013b2618fb31ae53',1,'winstd']]], - ['enumerate_18',['enumerate',['../classwinstd_1_1heap.html#a938dca2d614e8d33ae5add61b013847f',1,'winstd::heap']]], - ['error_5ftype_19',['error_type',['../classwinstd_1_1num__runtime__error.html#a6fa2de87d0151b3ad9cac58f838852e0',1,'winstd::num_runtime_error']]], - ['etw_2eh_20',['ETW.h',['../_e_t_w_8h.html',1,'']]], - ['event_21',['event',['../group___win_std_win_a_p_i.html#ga8aad78395ff021f46a34e51816038d20',1,'winstd']]], - ['event_20tracing_20for_20windows_20api_22',['Event Tracing for Windows API',['../group___win_std_e_t_w_a_p_i.html',1,'']]], - ['event_5fdata_23',['event_data',['../classwinstd_1_1event__data.html#acb4032673a3b2376eb0d62115bb37c4f',1,'winstd::event_data::event_data()'],['../classwinstd_1_1event__data.html#a0a53ee58077eed5bca18f146c34ced44',1,'winstd::event_data::event_data(const char &data)'],['../classwinstd_1_1event__data.html#a86447ba8727fe91c0de85b8f7835a4c1',1,'winstd::event_data::event_data(const unsigned char &data)'],['../classwinstd_1_1event__data.html#a26563233e9507adbf183291974005eaf',1,'winstd::event_data::event_data(const int &data)'],['../classwinstd_1_1event__data.html#a59b2ac8e1b681412ea0aa582b3028681',1,'winstd::event_data::event_data(const unsigned int &data)'],['../classwinstd_1_1event__data.html#aef6715d8e3e68eac7b7bbceacb3aff93',1,'winstd::event_data::event_data(const long &data)'],['../classwinstd_1_1event__data.html#aba0a6535c84e9165b5ccdf943449e10c',1,'winstd::event_data::event_data(const unsigned long &data)'],['../classwinstd_1_1event__data.html#a4d309bcda353b42ba1005b3c7b6f8dc1',1,'winstd::event_data::event_data(const GUID &data)'],['../classwinstd_1_1event__data.html#a74be98ecad61265232c0752e0e823a8e',1,'winstd::event_data::event_data(const char *data)'],['../classwinstd_1_1event__data.html#a0ac38aca75ec84f5265eb897fb3c7a7e',1,'winstd::event_data::event_data(const wchar_t *data)'],['../classwinstd_1_1event__data.html#aa9741846e354b469b750db2ea982b12d',1,'winstd::event_data::event_data(const std::basic_string< _Elem, _Traits, _Ax > &data)'],['../classwinstd_1_1event__data.html#a31af4a774845ec0f7db4267f573cd422',1,'winstd::event_data::event_data(const void *data, ULONG size)'],['../classwinstd_1_1event__data.html',1,'winstd::event_data']]], - ['event_5ffn_5fauto_24',['event_fn_auto',['../classwinstd_1_1event__fn__auto.html#aed0b955ff2db183f6667345925801b0b',1,'winstd::event_fn_auto::event_fn_auto(const event_fn_auto &other)'],['../classwinstd_1_1event__fn__auto.html#a5c45c1de3b87f6547f6e76a80b80f500',1,'winstd::event_fn_auto::event_fn_auto(event_fn_auto &&other) noexcept'],['../classwinstd_1_1event__fn__auto.html#a751244aeeeceb01401da27c5080fc590',1,'winstd::event_fn_auto::event_fn_auto(event_provider &ep, const EVENT_DESCRIPTOR *event_cons, const EVENT_DESCRIPTOR *event_dest, LPCSTR pszFnName)'],['../classwinstd_1_1event__fn__auto.html',1,'winstd::event_fn_auto']]], - ['event_5ffn_5fauto_5fret_25',['event_fn_auto_ret',['../classwinstd_1_1event__fn__auto__ret.html#a52fe971a33082d3652dd6d99378f17c5',1,'winstd::event_fn_auto_ret::event_fn_auto_ret(event_provider &ep, const EVENT_DESCRIPTOR *event_cons, const EVENT_DESCRIPTOR *event_dest, LPCSTR pszFnName, T &result)'],['../classwinstd_1_1event__fn__auto__ret.html#a0f656d3899f65afdaee9c651baf69bff',1,'winstd::event_fn_auto_ret::event_fn_auto_ret(const event_fn_auto_ret< T > &other)'],['../classwinstd_1_1event__fn__auto__ret.html#ac8b93b2bb498280707f795c03024d7d3',1,'winstd::event_fn_auto_ret::event_fn_auto_ret(event_fn_auto_ret< T > &&other)'],['../classwinstd_1_1event__fn__auto__ret.html',1,'winstd::event_fn_auto_ret< T >']]], - ['event_5flog_26',['event_log',['../classwinstd_1_1event__log.html',1,'winstd']]], - ['event_5fprovider_27',['event_provider',['../classwinstd_1_1event__provider.html',1,'winstd']]], - ['event_5frec_28',['event_rec',['../classwinstd_1_1event__rec.html#a73f9f035b70ce7c030e2c616d3f42e37',1,'winstd::event_rec::event_rec(const EVENT_RECORD &other)'],['../classwinstd_1_1event__rec.html#ac3a21e4c1a4469e7b85fc235f65006ca',1,'winstd::event_rec::event_rec(event_rec &&other) noexcept'],['../classwinstd_1_1event__rec.html#afd6e48f124743c9f5b0c576db2165787',1,'winstd::event_rec::event_rec(const event_rec &other)'],['../classwinstd_1_1event__rec.html#af2f781ca85c2d92b001bb32bf4839f11',1,'winstd::event_rec::event_rec()'],['../classwinstd_1_1event__rec.html',1,'winstd::event_rec']]], - ['event_5fsession_29',['event_session',['../classwinstd_1_1event__session.html#a24a43016accd86270c6a2ca6cf4934de',1,'winstd::event_session::event_session()'],['../classwinstd_1_1event__session.html#a21775ae7a7620d92be3b63d36bba757d',1,'winstd::event_session::event_session(handle_type h, const EVENT_TRACE_PROPERTIES *prop)'],['../classwinstd_1_1event__session.html#a14581a7203ad6d89bf69903093cfe83c',1,'winstd::event_session::event_session(event_session &&other) noexcept'],['../classwinstd_1_1event__session.html',1,'winstd::event_session']]], - ['event_5ftrace_30',['event_trace',['../classwinstd_1_1event__trace.html',1,'winstd']]], - ['event_5ftrace_5fenabler_31',['event_trace_enabler',['../classwinstd_1_1event__trace__enabler.html#a50ce2e4286dbfc133c7f4a4762b65a05',1,'winstd::event_trace_enabler::event_trace_enabler(LPCGUID SourceId, TRACEHANDLE TraceHandle, LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)'],['../classwinstd_1_1event__trace__enabler.html#a8666ba08639a65fa01eb64c4855d68a3',1,'winstd::event_trace_enabler::event_trace_enabler(const event_session &session, LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)'],['../classwinstd_1_1event__trace__enabler.html',1,'winstd::event_trace_enabler']]], - ['exceptions_32',['Exceptions',['../group___win_std_exceptions.html',1,'']]], - ['expandenvironmentstringsa_33',['ExpandEnvironmentStringsA',['../group___win_std_win_a_p_i.html#ga07fbe3c3b5aceaf3442a26fc3b6ce4b0',1,'Win.h']]], - ['expandenvironmentstringsw_34',['ExpandEnvironmentStringsW',['../group___win_std_win_a_p_i.html#gad2e379fa7f86f101bff21d2c10b7d430',1,'Win.h']]], - ['extensible_20authentication_20protocol_20api_35',['Extensible Authentication Protocol API',['../group___win_std_e_a_p_a_p_i.html',1,'']]] + ['eap_5fattr_0',['eap_attr',['../classwinstd_1_1eap__attr.html#a029d15ddb8b9cd33b4907f01719da5b8',1,'winstd::eap_attr::eap_attr(eap_attr &&a) noexcept'],['../classwinstd_1_1eap__attr.html#a4cb8d6fbf7f4e53ec64a030bea00d148',1,'winstd::eap_attr::eap_attr(const EAP_ATTRIBUTE &a)'],['../classwinstd_1_1eap__attr.html#a015a82d7f91679f76ca590bbdabc04c1',1,'winstd::eap_attr::eap_attr() noexcept'],['../classwinstd_1_1eap__attr.html',1,'winstd::eap_attr']]], + ['eap_5fblob_1',['eap_blob',['../group___win_std_e_a_p_a_p_i.html#ga25f2a0eea11e8332bfcec6b032a17a05',1,'winstd']]], + ['eap_5fblob_5fruntime_2',['eap_blob_runtime',['../group___win_std_e_a_p_a_p_i.html#gabd2665596cc49191b36e6378147c47ad',1,'winstd']]], + ['eap_5ferror_3',['eap_error',['../group___win_std_e_a_p_a_p_i.html#ga910edec3d3d1ba4f6f306dcafdc2117a',1,'winstd']]], + ['eap_5ferror_5fruntime_4',['eap_error_runtime',['../group___win_std_e_a_p_a_p_i.html#ga102f6e28f2ae479af7b6555894f110ac',1,'winstd']]], + ['eap_5fmethod_5finfo_5farray_5',['eap_method_info_array',['../classwinstd_1_1eap__method__info__array.html#a3c3e0f0150d21c09801c67ceb927e873',1,'winstd::eap_method_info_array::eap_method_info_array(eap_method_info_array &&other) noexcept'],['../classwinstd_1_1eap__method__info__array.html#a3dc5d1571c9e85dedd3dd3d6626947b7',1,'winstd::eap_method_info_array::eap_method_info_array() noexcept'],['../classwinstd_1_1eap__method__info__array.html',1,'winstd::eap_method_info_array']]], + ['eap_5fmethod_5fprop_6',['eap_method_prop',['../classwinstd_1_1eap__method__prop.html#adc01bff4048e03f5f7b88d186940b9d8',1,'winstd::eap_method_prop::eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, LPCWSTR value) noexcept'],['../classwinstd_1_1eap__method__prop.html#a7f0f5817c41e839a1e71eda3a2284949',1,'winstd::eap_method_prop::eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, DWORD value) noexcept'],['../classwinstd_1_1eap__method__prop.html#a06b8588c10a52d60556ced6b6a111ac3',1,'winstd::eap_method_prop::eap_method_prop(EAP_METHOD_PROPERTY_TYPE type, BOOL value) noexcept'],['../classwinstd_1_1eap__method__prop.html',1,'winstd::eap_method_prop']]], + ['eap_5fpacket_7',['eap_packet',['../classwinstd_1_1eap__packet.html',1,'winstd']]], + ['eap_5fruntime_5ferror_8',['eap_runtime_error',['../classwinstd_1_1eap__runtime__error.html#a4e271e11e866ee7114df20b63022d827',1,'winstd::eap_runtime_error::eap_runtime_error(const EAP_ERROR &err, const char *msg=nullptr)'],['../classwinstd_1_1eap__runtime__error.html#a68708f0598e27325339cc34473131240',1,'winstd::eap_runtime_error::eap_runtime_error(const EAP_ERROR &err, const std::string &msg)'],['../classwinstd_1_1eap__runtime__error.html',1,'winstd::eap_runtime_error']]], + ['eap_5ftype_5ft_9',['eap_type_t',['../group___win_std_e_a_p_a_p_i.html#ga50f5584ca708165f43cec42c42243315',1,'winstd']]], + ['eaphostpeerfreeeaperror_5fdelete_10',['EapHostPeerFreeEapError_delete',['../structwinstd_1_1_eap_host_peer_free_eap_error__delete.html#ab4dd927d7e4cd40b2ce7068fe252b76e',1,'winstd::EapHostPeerFreeEapError_delete::EapHostPeerFreeEapError_delete()'],['../structwinstd_1_1_eap_host_peer_free_eap_error__delete.html',1,'winstd::EapHostPeerFreeEapError_delete']]], + ['eaphostpeerfreeerrormemory_5fdelete_11',['EapHostPeerFreeErrorMemory_delete',['../structwinstd_1_1_eap_host_peer_free_error_memory__delete.html#a43f0b1a440b9a431e9fee807bc1386be',1,'winstd::EapHostPeerFreeErrorMemory_delete::EapHostPeerFreeErrorMemory_delete()'],['../structwinstd_1_1_eap_host_peer_free_error_memory__delete.html',1,'winstd::EapHostPeerFreeErrorMemory_delete']]], + ['eaphostpeerfreememory_5fdelete_12',['EapHostPeerFreeMemory_delete',['../structwinstd_1_1_eap_host_peer_free_memory__delete.html#af6220ac1d99cc114670c363ecfe64557',1,'winstd::EapHostPeerFreeMemory_delete::EapHostPeerFreeMemory_delete()'],['../structwinstd_1_1_eap_host_peer_free_memory__delete.html',1,'winstd::EapHostPeerFreeMemory_delete']]], + ['eaphostpeerfreeruntimememory_5fdelete_13',['EapHostPeerFreeRuntimeMemory_delete',['../structwinstd_1_1_eap_host_peer_free_runtime_memory__delete.html#afdd46f3517e59ce19fdaddebbbaeb10d',1,'winstd::EapHostPeerFreeRuntimeMemory_delete::EapHostPeerFreeRuntimeMemory_delete()'],['../structwinstd_1_1_eap_host_peer_free_runtime_memory__delete.html',1,'winstd::EapHostPeerFreeRuntimeMemory_delete']]], + ['enable_5fcallback_14',['enable_callback',['../classwinstd_1_1event__provider.html#ac896e3a23b3f44ef0b1cb0ac6717e894',1,'winstd::event_provider::enable_callback(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData)'],['../classwinstd_1_1event__provider.html#ae1bde7438a09da9e878e86890de50a07',1,'winstd::event_provider::enable_callback(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext)']]], + ['enable_5ftrace_15',['enable_trace',['../classwinstd_1_1event__session.html#aa140384c61972ebabbf6489e8aa5700b',1,'winstd::event_session']]], + ['end_16',['end',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315a7f021a1415b86f2d013b2618fb31ae53',1,'winstd']]], + ['enumerate_17',['enumerate',['../classwinstd_1_1heap.html#a938dca2d614e8d33ae5add61b013847f',1,'winstd::heap']]], + ['error_5ftype_18',['error_type',['../classwinstd_1_1num__runtime__error.html#a6fa2de87d0151b3ad9cac58f838852e0',1,'winstd::num_runtime_error']]], + ['event_19',['event',['../group___win_std_win_a_p_i.html#ga8aad78395ff021f46a34e51816038d20',1,'winstd']]], + ['event_20tracing_20for_20windows_20api_20',['Event Tracing for Windows API',['../group___win_std_e_t_w_a_p_i.html',1,'']]], + ['event_5fdata_21',['event_data',['../classwinstd_1_1event__data.html#acb4032673a3b2376eb0d62115bb37c4f',1,'winstd::event_data::event_data()'],['../classwinstd_1_1event__data.html#a0a53ee58077eed5bca18f146c34ced44',1,'winstd::event_data::event_data(const char &data)'],['../classwinstd_1_1event__data.html#a86447ba8727fe91c0de85b8f7835a4c1',1,'winstd::event_data::event_data(const unsigned char &data)'],['../classwinstd_1_1event__data.html#a26563233e9507adbf183291974005eaf',1,'winstd::event_data::event_data(const int &data)'],['../classwinstd_1_1event__data.html#a59b2ac8e1b681412ea0aa582b3028681',1,'winstd::event_data::event_data(const unsigned int &data)'],['../classwinstd_1_1event__data.html#aef6715d8e3e68eac7b7bbceacb3aff93',1,'winstd::event_data::event_data(const long &data)'],['../classwinstd_1_1event__data.html#aba0a6535c84e9165b5ccdf943449e10c',1,'winstd::event_data::event_data(const unsigned long &data)'],['../classwinstd_1_1event__data.html#a4d309bcda353b42ba1005b3c7b6f8dc1',1,'winstd::event_data::event_data(const GUID &data)'],['../classwinstd_1_1event__data.html#a74be98ecad61265232c0752e0e823a8e',1,'winstd::event_data::event_data(const char *data)'],['../classwinstd_1_1event__data.html#a0ac38aca75ec84f5265eb897fb3c7a7e',1,'winstd::event_data::event_data(const wchar_t *data)'],['../classwinstd_1_1event__data.html#aa9741846e354b469b750db2ea982b12d',1,'winstd::event_data::event_data(const std::basic_string< _Elem, _Traits, _Ax > &data)'],['../classwinstd_1_1event__data.html#a31af4a774845ec0f7db4267f573cd422',1,'winstd::event_data::event_data(const void *data, ULONG size)'],['../classwinstd_1_1event__data.html',1,'winstd::event_data']]], + ['event_5ffn_5fauto_22',['event_fn_auto',['../classwinstd_1_1event__fn__auto.html#aed0b955ff2db183f6667345925801b0b',1,'winstd::event_fn_auto::event_fn_auto(const event_fn_auto &other)'],['../classwinstd_1_1event__fn__auto.html#a5c45c1de3b87f6547f6e76a80b80f500',1,'winstd::event_fn_auto::event_fn_auto(event_fn_auto &&other) noexcept'],['../classwinstd_1_1event__fn__auto.html#a751244aeeeceb01401da27c5080fc590',1,'winstd::event_fn_auto::event_fn_auto(event_provider &ep, const EVENT_DESCRIPTOR *event_cons, const EVENT_DESCRIPTOR *event_dest, LPCSTR pszFnName)'],['../classwinstd_1_1event__fn__auto.html',1,'winstd::event_fn_auto']]], + ['event_5ffn_5fauto_5fret_23',['event_fn_auto_ret',['../classwinstd_1_1event__fn__auto__ret.html#a52fe971a33082d3652dd6d99378f17c5',1,'winstd::event_fn_auto_ret::event_fn_auto_ret(event_provider &ep, const EVENT_DESCRIPTOR *event_cons, const EVENT_DESCRIPTOR *event_dest, LPCSTR pszFnName, T &result)'],['../classwinstd_1_1event__fn__auto__ret.html#a0f656d3899f65afdaee9c651baf69bff',1,'winstd::event_fn_auto_ret::event_fn_auto_ret(const event_fn_auto_ret< T > &other)'],['../classwinstd_1_1event__fn__auto__ret.html#ac8b93b2bb498280707f795c03024d7d3',1,'winstd::event_fn_auto_ret::event_fn_auto_ret(event_fn_auto_ret< T > &&other)'],['../classwinstd_1_1event__fn__auto__ret.html',1,'winstd::event_fn_auto_ret< T >']]], + ['event_5flog_24',['event_log',['../classwinstd_1_1event__log.html',1,'winstd']]], + ['event_5fprovider_25',['event_provider',['../classwinstd_1_1event__provider.html',1,'winstd']]], + ['event_5frec_26',['event_rec',['../classwinstd_1_1event__rec.html#a73f9f035b70ce7c030e2c616d3f42e37',1,'winstd::event_rec::event_rec(const EVENT_RECORD &other)'],['../classwinstd_1_1event__rec.html#ac3a21e4c1a4469e7b85fc235f65006ca',1,'winstd::event_rec::event_rec(event_rec &&other) noexcept'],['../classwinstd_1_1event__rec.html#afd6e48f124743c9f5b0c576db2165787',1,'winstd::event_rec::event_rec(const event_rec &other)'],['../classwinstd_1_1event__rec.html#af2f781ca85c2d92b001bb32bf4839f11',1,'winstd::event_rec::event_rec()'],['../classwinstd_1_1event__rec.html',1,'winstd::event_rec']]], + ['event_5fsession_27',['event_session',['../classwinstd_1_1event__session.html#a24a43016accd86270c6a2ca6cf4934de',1,'winstd::event_session::event_session()'],['../classwinstd_1_1event__session.html#a21775ae7a7620d92be3b63d36bba757d',1,'winstd::event_session::event_session(handle_type h, const EVENT_TRACE_PROPERTIES *prop)'],['../classwinstd_1_1event__session.html#a14581a7203ad6d89bf69903093cfe83c',1,'winstd::event_session::event_session(event_session &&other) noexcept'],['../classwinstd_1_1event__session.html',1,'winstd::event_session']]], + ['event_5ftrace_28',['event_trace',['../classwinstd_1_1event__trace.html',1,'winstd']]], + ['event_5ftrace_5fenabler_29',['event_trace_enabler',['../classwinstd_1_1event__trace__enabler.html#a50ce2e4286dbfc133c7f4a4762b65a05',1,'winstd::event_trace_enabler::event_trace_enabler(LPCGUID SourceId, TRACEHANDLE TraceHandle, LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)'],['../classwinstd_1_1event__trace__enabler.html#a8666ba08639a65fa01eb64c4855d68a3',1,'winstd::event_trace_enabler::event_trace_enabler(const event_session &session, LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)'],['../classwinstd_1_1event__trace__enabler.html',1,'winstd::event_trace_enabler']]], + ['exceptions_30',['Exceptions',['../group___win_std_exceptions.html',1,'']]], + ['expandenvironmentstringsa_31',['ExpandEnvironmentStringsA',['../group___win_std_win_a_p_i.html#ga07fbe3c3b5aceaf3442a26fc3b6ce4b0',1,'Win.h']]], + ['expandenvironmentstringsw_32',['ExpandEnvironmentStringsW',['../group___win_std_win_a_p_i.html#gad2e379fa7f86f101bff21d2c10b7d430',1,'Win.h']]], + ['extensible_20authentication_20protocol_20api_33',['Extensible Authentication Protocol API',['../group___win_std_e_a_p_a_p_i.html',1,'']]] ]; diff --git a/search/all_7.js b/search/all_7.js index 501bf037..4acec5da 100644 --- a/search/all_7.js +++ b/search/all_7.js @@ -1,24 +1,23 @@ var searchData= [ ['gdi_20api_0',['GDI API',['../group___win_std_gdi_a_p_i.html',1,'']]], - ['gdi_2eh_1',['GDI.h',['../_g_d_i_8h.html',1,'']]], - ['gdi_5fhandle_2',['gdi_handle',['../classwinstd_1_1gdi__handle.html',1,'winstd']]], - ['general_3',['General',['../group___win_std_general.html',1,'']]], - ['get_5fptr_4',['get_ptr',['../group___win_std_general.html#ga7ecb3b65341fd45c36fce1fe692ec19a',1,'winstd::get_ptr(std::unique_ptr< _Ty[], _Dx > &owner) noexcept'],['../group___win_std_general.html#gab4ddaca47a234b4f81a1c3314b3ba205',1,'winstd::get_ptr(std::unique_ptr< _Ty, _Dx > &owner) noexcept']]], - ['getaddrinfoa_5',['GetAddrInfoA',['../group___win_sock2_a_p_i.html#gae9f6e09e2e81a57135dc30bc999d27af',1,'WinSock2.h']]], - ['getaddrinfow_6',['GetAddrInfoW',['../group___win_sock2_a_p_i.html#gad222deae09d76241e018a2e350aa1ec9',1,'WinSock2.h']]], - ['getdateformata_7',['GetDateFormatA',['../group___win_std_win_a_p_i.html#gacacc28dcab4a8e45fadccdb51993e40b',1,'Win.h']]], - ['getdateformatw_8',['GetDateFormatW',['../group___win_std_win_a_p_i.html#ga6a9b892bd42f7de12e7e17e89e10fb01',1,'Win.h']]], - ['getfileversioninfoa_9',['GetFileVersionInfoA',['../group___win_std_win_a_p_i.html#ga195210dac36b34baa0e616c86bb2b147',1,'Win.h']]], - ['getfileversioninfow_10',['GetFileVersionInfoW',['../group___win_std_win_a_p_i.html#ga7dbb645a5381e6e7bba37429d3de2d51',1,'Win.h']]], - ['getmodulefilenamea_11',['GetModuleFileNameA',['../group___win_std_win_a_p_i.html#ga6934cae7e0b3133206b8324e4372e1cc',1,'Win.h']]], - ['getmodulefilenamew_12',['GetModuleFileNameW',['../group___win_std_win_a_p_i.html#ga51dfe8b12845850282f4d120e51e80fa',1,'Win.h']]], - ['gettokeninformation_13',['GetTokenInformation',['../group___win_std_win_a_p_i.html#ga75b761473822ee6e9cf336d28b30b073',1,'Win.h']]], - ['getwindowtexta_14',['GetWindowTextA',['../group___win_std_win_a_p_i.html#ga11fd1f3e9a51e636f6e0f060e604c1aa',1,'Win.h']]], - ['getwindowtextw_15',['GetWindowTextW',['../group___win_std_win_a_p_i.html#gacab04e9e5cbbc759fe83cf70fb891acc',1,'Win.h']]], - ['gtc_16',['gtc',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315a3761e7920c97542314b1aa50434f9293',1,'winstd']]], - ['gtcp_17',['gtcp',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315a811f41353a6e1e0ecf7a03308c4f8e0e',1,'winstd']]], - ['guidtostring_18',['GuidToString',['../group___win_std_win_a_p_i.html#gad08dfb2a0d1254918a2a4ed45061a50d',1,'Win.h']]], - ['guidtostringa_19',['GuidToStringA',['../group___win_std_win_a_p_i.html#ga2ec9f457e182c451486333fa0a994313',1,'Win.h']]], - ['guidtostringw_20',['GuidToStringW',['../group___win_std_win_a_p_i.html#gad8dcada3be8a9e8c0d2f0db263c2a5e3',1,'Win.h']]] + ['gdi_5fhandle_1',['gdi_handle',['../classwinstd_1_1gdi__handle.html',1,'winstd']]], + ['general_2',['General',['../group___win_std_general.html',1,'']]], + ['get_5fptr_3',['get_ptr',['../group___win_std_general.html#gab4ddaca47a234b4f81a1c3314b3ba205',1,'winstd::get_ptr(std::unique_ptr< _Ty, _Dx > &owner) noexcept'],['../group___win_std_general.html#ga7ecb3b65341fd45c36fce1fe692ec19a',1,'winstd::get_ptr(std::unique_ptr< _Ty[], _Dx > &owner) noexcept']]], + ['getaddrinfoa_4',['GetAddrInfoA',['../group___win_sock2_a_p_i.html#gae9f6e09e2e81a57135dc30bc999d27af',1,'WinSock2.h']]], + ['getaddrinfow_5',['GetAddrInfoW',['../group___win_sock2_a_p_i.html#gad222deae09d76241e018a2e350aa1ec9',1,'WinSock2.h']]], + ['getdateformata_6',['GetDateFormatA',['../group___win_std_win_a_p_i.html#gacacc28dcab4a8e45fadccdb51993e40b',1,'Win.h']]], + ['getdateformatw_7',['GetDateFormatW',['../group___win_std_win_a_p_i.html#ga6a9b892bd42f7de12e7e17e89e10fb01',1,'Win.h']]], + ['getfileversioninfoa_8',['GetFileVersionInfoA',['../group___win_std_win_a_p_i.html#ga195210dac36b34baa0e616c86bb2b147',1,'Win.h']]], + ['getfileversioninfow_9',['GetFileVersionInfoW',['../group___win_std_win_a_p_i.html#ga7dbb645a5381e6e7bba37429d3de2d51',1,'Win.h']]], + ['getmodulefilenamea_10',['GetModuleFileNameA',['../group___win_std_win_a_p_i.html#ga6934cae7e0b3133206b8324e4372e1cc',1,'Win.h']]], + ['getmodulefilenamew_11',['GetModuleFileNameW',['../group___win_std_win_a_p_i.html#ga51dfe8b12845850282f4d120e51e80fa',1,'Win.h']]], + ['gettokeninformation_12',['GetTokenInformation',['../group___win_std_win_a_p_i.html#ga75b761473822ee6e9cf336d28b30b073',1,'Win.h']]], + ['getwindowtexta_13',['GetWindowTextA',['../group___win_std_win_a_p_i.html#ga11fd1f3e9a51e636f6e0f060e604c1aa',1,'Win.h']]], + ['getwindowtextw_14',['GetWindowTextW',['../group___win_std_win_a_p_i.html#gacab04e9e5cbbc759fe83cf70fb891acc',1,'Win.h']]], + ['gtc_15',['gtc',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315a3761e7920c97542314b1aa50434f9293',1,'winstd']]], + ['gtcp_16',['gtcp',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315a811f41353a6e1e0ecf7a03308c4f8e0e',1,'winstd']]], + ['guidtostring_17',['GuidToString',['../group___win_std_win_a_p_i.html#gad08dfb2a0d1254918a2a4ed45061a50d',1,'Win.h']]], + ['guidtostringa_18',['GuidToStringA',['../group___win_std_win_a_p_i.html#ga2ec9f457e182c451486333fa0a994313',1,'Win.h']]], + ['guidtostringw_19',['GuidToStringW',['../group___win_std_win_a_p_i.html#gad8dcada3be8a9e8c0d2f0db263c2a5e3',1,'Win.h']]] ]; diff --git a/search/all_b.js b/search/all_b.js index bbaa031e..cdd9923b 100644 --- a/search/all_b.js +++ b/search/all_b.js @@ -1,7 +1,7 @@ var searchData= [ ['m_5fattrib_0',['m_attrib',['../classwinstd_1_1sec__context.html#a8a211355b63585e9cc633639d801a13f',1,'winstd::sec_context']]], - ['m_5fcookie_1',['m_cookie',['../classwinstd_1_1actctx__activator.html#ab3556f1baf628459929c8c394341a9a6',1,'winstd::actctx_activator::m_cookie()'],['../classwinstd_1_1user__impersonator.html#a28b0a9c7d1759b2be3ae3deb960a287c',1,'winstd::user_impersonator::m_cookie()'],['../classwinstd_1_1console__ctrl__handler.html#ae46848a80c517f95fc3fd7c1ee832134',1,'winstd::console_ctrl_handler::m_cookie()']]], + ['m_5fcookie_1',['m_cookie',['../classwinstd_1_1actctx__activator.html#ab3556f1baf628459929c8c394341a9a6',1,'winstd::actctx_activator::m_cookie()'],['../classwinstd_1_1console__ctrl__handler.html#ae46848a80c517f95fc3fd7c1ee832134',1,'winstd::console_ctrl_handler::m_cookie()'],['../classwinstd_1_1user__impersonator.html#a28b0a9c7d1759b2be3ae3deb960a287c',1,'winstd::user_impersonator::m_cookie()']]], ['m_5fdata_2',['m_data',['../classwinstd_1_1sanitizing__blob.html#a38187ccd591a6a7cfa4a9d0a6f6f7701',1,'winstd::sanitizing_blob::m_data()'],['../classwinstd_1_1critical__section.html#a55b9b9e7f38b94cd5c3fc15a319a6719',1,'winstd::critical_section::m_data()']]], ['m_5fdesc_3',['m_desc',['../classwinstd_1_1event__fn__auto__ret.html#a23fa88c6a7aea86536cc0e4bee2746cf',1,'winstd::event_fn_auto_ret']]], ['m_5fenable_5ffilter_5fdesc_4',['m_enable_filter_desc',['../classwinstd_1_1event__trace__enabler.html#a358d20e2dbbc7dcaccbe8d3d303cc3c4',1,'winstd::event_trace_enabler']]], @@ -25,7 +25,7 @@ var searchData= ['m_5fproc_22',['m_proc',['../classwinstd_1_1vmemory.html#af448989be292da246dd25469d7a70b87',1,'winstd::vmemory']]], ['m_5fprop_23',['m_prop',['../classwinstd_1_1event__session.html#ad2b5e63572d44c37dc3f4f64feefa3cc',1,'winstd::event_session']]], ['m_5fprovider_5fid_24',['m_provider_id',['../classwinstd_1_1event__trace__enabler.html#ade3cdf424d3a4eb85f0fdc554dfcf673',1,'winstd::event_trace_enabler']]], - ['m_5fptr_25',['m_ptr',['../classwinstd_1_1ref__unique__ptr.html#a72486d304d712600e6b222fab19d1032',1,'winstd::ref_unique_ptr::m_ptr()'],['../classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4.html#a8d9eb2287c86ebcb89a0417842410d0b',1,'winstd::ref_unique_ptr< _Ty[], _Dx >::m_ptr()']]], + ['m_5fptr_25',['m_ptr',['../classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4.html#a8d9eb2287c86ebcb89a0417842410d0b',1,'winstd::ref_unique_ptr< _Ty[], _Dx >::m_ptr()'],['../classwinstd_1_1ref__unique__ptr.html#a72486d304d712600e6b222fab19d1032',1,'winstd::ref_unique_ptr::m_ptr()']]], ['m_5freason_26',['m_reason',['../classwinstd_1_1eap__runtime__error.html#af7d0e9785475719f4b1b0b59c4ae49e3',1,'winstd::eap_runtime_error']]], ['m_5frepair_5fdesc_27',['m_repair_desc',['../classwinstd_1_1eap__runtime__error.html#a2b237993f0c860b8b0ad83416d499f18',1,'winstd::eap_runtime_error']]], ['m_5frepair_5fid_28',['m_repair_id',['../classwinstd_1_1eap__runtime__error.html#a526d2ae63c12d1a439d69412e7f13ec7',1,'winstd::eap_runtime_error']]], @@ -42,17 +42,16 @@ var searchData= ['ms_5fauth_5ftlv_39',['ms_auth_tlv',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315ae19141eb8aa04ffb76d616409efcdf03',1,'winstd']]], ['mschapv2_40',['mschapv2',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315af579ec4460aed7126de9ed539845a0f4',1,'winstd']]], ['msg_41',['msg',['../classwinstd_1_1win__runtime__error.html#a868231adfa74636792a474a6362aeea7',1,'winstd::win_runtime_error::msg()'],['../classwinstd_1_1ws2__runtime__error.html#af6984de4ac18e732a6844f379d67c52f',1,'winstd::ws2_runtime_error::msg()']]], - ['msi_2eh_42',['MSI.h',['../_m_s_i_8h.html',1,'']]], - ['msiformatrecorda_43',['MsiFormatRecordA',['../group___win_std_m_s_i_a_p_i.html#ga7cb245425b74bdf9b89c754636486f0c',1,'MSI.h']]], - ['msiformatrecordw_44',['MsiFormatRecordW',['../group___win_std_m_s_i_a_p_i.html#ga016f87f038892fe3121a2dd5232468d2',1,'MSI.h']]], - ['msigetcomponentpatha_45',['MsiGetComponentPathA',['../group___win_std_m_s_i_a_p_i.html#ga41c26288267e69f5bba73f9b125bf2a3',1,'MSI.h']]], - ['msigetcomponentpathw_46',['MsiGetComponentPathW',['../group___win_std_m_s_i_a_p_i.html#gac4be55d9d370a31e064787675c518c58',1,'MSI.h']]], - ['msigetpropertya_47',['MsiGetPropertyA',['../group___win_std_m_s_i_a_p_i.html#ga7a5853cf74ed8adb1b5cd1289c39e385',1,'MSI.h']]], - ['msigetpropertyw_48',['MsiGetPropertyW',['../group___win_std_m_s_i_a_p_i.html#ga32e20a17013eb7660fda19f2b1de389d',1,'MSI.h']]], - ['msigettargetpatha_49',['MsiGetTargetPathA',['../group___win_std_m_s_i_a_p_i.html#ga340ee7efbd658e2d6ecfb199c41856bc',1,'MSI.h']]], - ['msigettargetpathw_50',['MsiGetTargetPathW',['../group___win_std_m_s_i_a_p_i.html#ga51696a19fb4b748eed04fa3b6a8f9eca',1,'MSI.h']]], - ['msirecordgetstringa_51',['MsiRecordGetStringA',['../group___win_std_m_s_i_a_p_i.html#gaedc818f42d945e54f6956c928b3ffc29',1,'MSI.h']]], - ['msirecordgetstringw_52',['MsiRecordGetStringW',['../group___win_std_m_s_i_a_p_i.html#ga487c38b4353054a4e518ca01d1397cf6',1,'MSI.h']]], - ['msirecordreadstream_53',['MsiRecordReadStream',['../group___win_std_m_s_i_a_p_i.html#ga83052d8dfbdf437cc45e6a4b46357036',1,'MSI.h']]], - ['multibytetowidechar_54',['MultiByteToWideChar',['../group___win_std_win_a_p_i.html#ga1a92ed50a4e4cdaea5d470a52291098c',1,'MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::basic_string< wchar_t, _Traits, _Ax > &sWideCharStr) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#gaeb4d134b8910610678988196480a29cc',1,'MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::vector< wchar_t, _Ax > &sWideCharStr) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#ga5fe48d031512d6acbd14095b6d4e182d',1,'MultiByteToWideChar(UINT CodePage, DWORD dwFlags, const std::basic_string< char, _Traits1, _Ax1 > &sMultiByteStr, std::basic_string< wchar_t, _Traits2, _Ax2 > &sWideCharStr) noexcept: Win.h']]] + ['msiformatrecorda_42',['MsiFormatRecordA',['../group___win_std_m_s_i_a_p_i.html#ga7cb245425b74bdf9b89c754636486f0c',1,'MSI.h']]], + ['msiformatrecordw_43',['MsiFormatRecordW',['../group___win_std_m_s_i_a_p_i.html#ga016f87f038892fe3121a2dd5232468d2',1,'MSI.h']]], + ['msigetcomponentpatha_44',['MsiGetComponentPathA',['../group___win_std_m_s_i_a_p_i.html#ga41c26288267e69f5bba73f9b125bf2a3',1,'MSI.h']]], + ['msigetcomponentpathw_45',['MsiGetComponentPathW',['../group___win_std_m_s_i_a_p_i.html#gac4be55d9d370a31e064787675c518c58',1,'MSI.h']]], + ['msigetpropertya_46',['MsiGetPropertyA',['../group___win_std_m_s_i_a_p_i.html#ga7a5853cf74ed8adb1b5cd1289c39e385',1,'MSI.h']]], + ['msigetpropertyw_47',['MsiGetPropertyW',['../group___win_std_m_s_i_a_p_i.html#ga32e20a17013eb7660fda19f2b1de389d',1,'MSI.h']]], + ['msigettargetpatha_48',['MsiGetTargetPathA',['../group___win_std_m_s_i_a_p_i.html#ga340ee7efbd658e2d6ecfb199c41856bc',1,'MSI.h']]], + ['msigettargetpathw_49',['MsiGetTargetPathW',['../group___win_std_m_s_i_a_p_i.html#ga51696a19fb4b748eed04fa3b6a8f9eca',1,'MSI.h']]], + ['msirecordgetstringa_50',['MsiRecordGetStringA',['../group___win_std_m_s_i_a_p_i.html#gaedc818f42d945e54f6956c928b3ffc29',1,'MSI.h']]], + ['msirecordgetstringw_51',['MsiRecordGetStringW',['../group___win_std_m_s_i_a_p_i.html#ga487c38b4353054a4e518ca01d1397cf6',1,'MSI.h']]], + ['msirecordreadstream_52',['MsiRecordReadStream',['../group___win_std_m_s_i_a_p_i.html#ga83052d8dfbdf437cc45e6a4b46357036',1,'MSI.h']]], + ['multibytetowidechar_53',['MultiByteToWideChar',['../group___win_std_win_a_p_i.html#ga1a92ed50a4e4cdaea5d470a52291098c',1,'MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::basic_string< wchar_t, _Traits, _Ax > &sWideCharStr) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#gaeb4d134b8910610678988196480a29cc',1,'MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, std::vector< wchar_t, _Ax > &sWideCharStr) noexcept: Win.h'],['../group___win_std_win_a_p_i.html#ga5fe48d031512d6acbd14095b6d4e182d',1,'MultiByteToWideChar(UINT CodePage, DWORD dwFlags, const std::basic_string< char, _Traits1, _Ax1 > &sMultiByteStr, std::basic_string< wchar_t, _Traits2, _Ax2 > &sWideCharStr) noexcept: Win.h']]] ]; diff --git a/search/files_0.html b/search/files_0.html deleted file mode 100644 index da83704e..00000000 --- a/search/files_0.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/search/files_0.js b/search/files_0.js deleted file mode 100644 index 305c5103..00000000 --- a/search/files_0.js +++ /dev/null @@ -1,7 +0,0 @@ -var searchData= -[ - ['com_2eh_0',['COM.h',['../_c_o_m_8h.html',1,'']]], - ['common_2eh_1',['Common.h',['../_common_8h.html',1,'']]], - ['cred_2eh_2',['Cred.h',['../_cred_8h.html',1,'']]], - ['crypt_2eh_3',['Crypt.h',['../_crypt_8h.html',1,'']]] -]; diff --git a/search/files_1.html b/search/files_1.html deleted file mode 100644 index f7e1582a..00000000 --- a/search/files_1.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/search/files_1.js b/search/files_1.js deleted file mode 100644 index 95ec5389..00000000 --- a/search/files_1.js +++ /dev/null @@ -1,5 +0,0 @@ -var searchData= -[ - ['eap_2eh_0',['EAP.h',['../_e_a_p_8h.html',1,'']]], - ['etw_2eh_1',['ETW.h',['../_e_t_w_8h.html',1,'']]] -]; diff --git a/search/files_2.html b/search/files_2.html deleted file mode 100644 index 99aca620..00000000 --- a/search/files_2.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/search/files_2.js b/search/files_2.js deleted file mode 100644 index eeb250f8..00000000 --- a/search/files_2.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['gdi_2eh_0',['GDI.h',['../_g_d_i_8h.html',1,'']]] -]; diff --git a/search/files_3.html b/search/files_3.html deleted file mode 100644 index 25e128c8..00000000 --- a/search/files_3.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/search/files_3.js b/search/files_3.js deleted file mode 100644 index 9059d2d8..00000000 --- a/search/files_3.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['msi_2eh_0',['MSI.h',['../_m_s_i_8h.html',1,'']]] -]; diff --git a/search/files_4.html b/search/files_4.html deleted file mode 100644 index 3c8ba6ea..00000000 --- a/search/files_4.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/search/files_4.js b/search/files_4.js deleted file mode 100644 index f7022867..00000000 --- a/search/files_4.js +++ /dev/null @@ -1,6 +0,0 @@ -var searchData= -[ - ['sec_2eh_0',['Sec.h',['../_sec_8h.html',1,'']]], - ['setupapi_2eh_1',['SetupAPI.h',['../_setup_a_p_i_8h.html',1,'']]], - ['shell_2eh_2',['Shell.h',['../_shell_8h.html',1,'']]] -]; diff --git a/search/files_5.html b/search/files_5.html deleted file mode 100644 index 7ff9613b..00000000 --- a/search/files_5.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/search/files_5.js b/search/files_5.js deleted file mode 100644 index 52215418..00000000 --- a/search/files_5.js +++ /dev/null @@ -1,7 +0,0 @@ -var searchData= -[ - ['win_2eh_0',['Win.h',['../_win_8h.html',1,'']]], - ['winsock2_2eh_1',['WinSock2.h',['../_win_sock2_8h.html',1,'']]], - ['wintrust_2eh_2',['WinTrust.h',['../_win_trust_8h.html',1,'']]], - ['wlan_2eh_3',['WLAN.h',['../_w_l_a_n_8h.html',1,'']]] -]; diff --git a/search/groups_1.js b/search/groups_1.js index ff67f5a5..ee5d88be 100644 --- a/search/groups_1.js +++ b/search/groups_1.js @@ -1,6 +1,6 @@ var searchData= [ - ['com_20object_20management_0',['COM object management',['../group___win_std_c_o_m.html',1,'']]], + ['com_20object_20management_0',['COM Object Management',['../group___win_std_c_o_m.html',1,'']]], ['credentials_20api_1',['Credentials API',['../group___win_std_cred_a_p_i.html',1,'']]], ['cryptography_20api_2',['Cryptography API',['../group___win_std_crypto_a_p_i.html',1,'']]] ]; diff --git a/search/searchdata.js b/search/searchdata.js index c1b3f6f9..6eb505f5 100644 --- a/search/searchdata.js +++ b/search/searchdata.js @@ -2,41 +2,38 @@ var indexSectionsWithContent = { 0: "_abcdefghilmnopqrstuvw~", 1: "abcdefghlnprsuvw", - 2: "cegmsw", - 3: "abcdefghilmnopqrstuvw~", - 4: "bim", - 5: "_cdefhoprstvw", - 6: "e", - 7: "egilmnopstu", - 8: "acegmsw", - 9: "w" + 2: "abcdefghilmnopqrstuvw~", + 3: "bim", + 4: "_cdefhoprstvw", + 5: "e", + 6: "egilmnopstu", + 7: "acegmsw", + 8: "w" }; var indexSectionNames = { 0: "all", 1: "classes", - 2: "files", - 3: "functions", - 4: "variables", - 5: "typedefs", - 6: "enums", - 7: "enumvalues", - 8: "groups", - 9: "pages" + 2: "functions", + 3: "variables", + 4: "typedefs", + 5: "enums", + 6: "enumvalues", + 7: "groups", + 8: "pages" }; var indexSectionLabels = { 0: "All", 1: "Classes", - 2: "Files", - 3: "Functions", - 4: "Variables", - 5: "Typedefs", - 6: "Enumerations", - 7: "Enumerator", - 8: "Modules", - 9: "Pages" + 2: "Functions", + 3: "Variables", + 4: "Typedefs", + 5: "Enumerations", + 6: "Enumerator", + 7: "Modules", + 8: "Pages" }; 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 1ddbca35..ead901bd 100644 --- a/structwinstd_1_1_co_task_mem_free__delete-members.html +++ b/structwinstd_1_1_co_task_mem_free__delete-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -78,7 +78,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 2a039f0a..1d1bcc96 100644 --- a/structwinstd_1_1_co_task_mem_free__delete.html +++ b/structwinstd_1_1_co_task_mem_free__delete.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -70,7 +70,7 @@ $(function() { -
winstd::CoTaskMemFree_delete Struct Reference
+
winstd::CoTaskMemFree_delete Struct Reference
@@ -130,7 +130,7 @@ template<class _T >
diff --git a/structwinstd_1_1_cred_free__delete-members.html b/structwinstd_1_1_cred_free__delete-members.html index 514030dd..10d63bba 100644 --- a/structwinstd_1_1_cred_free__delete-members.html +++ b/structwinstd_1_1_cred_free__delete-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,7 @@ $(function() { diff --git a/structwinstd_1_1_cred_free__delete.html b/structwinstd_1_1_cred_free__delete.html index 966b9f4b..9b4bdb1f 100644 --- a/structwinstd_1_1_cred_free__delete.html +++ b/structwinstd_1_1_cred_free__delete.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -143,7 +143,7 @@ template<class _Ty > 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 f8fc268b..1b593d2d 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,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 1cb3db0a..99c2ac39 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -175,7 +175,7 @@ template<class _Ty > 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 9a6d06b8..3036a7b6 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -78,7 +78,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 18db7620..764fdd9c 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -127,7 +127,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 efd48539..c8fab245 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -78,7 +78,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 fe3d5b86..0864a85f 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -127,7 +127,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 79d64c9b..21d4404b 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -78,7 +78,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 d2825c77..4cedbd50 100644 --- a/structwinstd_1_1_eap_host_peer_free_memory__delete.html +++ b/structwinstd_1_1_eap_host_peer_free_memory__delete.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -130,7 +130,7 @@ template<class _T > 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 f9210a14..a908fdc5 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -78,7 +78,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 81586c86..34ade107 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -99,7 +99,7 @@ template<class _T > diff --git a/structwinstd_1_1_local_free__delete-members.html b/structwinstd_1_1_local_free__delete-members.html index 55a1bf47..b834a7e1 100644 --- a/structwinstd_1_1_local_free__delete-members.html +++ b/structwinstd_1_1_local_free__delete-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,7 @@ $(function() { diff --git a/structwinstd_1_1_local_free__delete.html b/structwinstd_1_1_local_free__delete.html index 47d553a2..5637397e 100644 --- a/structwinstd_1_1_local_free__delete.html +++ b/structwinstd_1_1_local_free__delete.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -143,7 +143,7 @@ template<class _Ty > 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 eb9e0a7e..ef2e0f10 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,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 c483d930..8ce2fcf0 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -145,7 +145,7 @@ template<class _Other > 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 a9b724b1..b4296f88 100644 --- a/structwinstd_1_1_unmap_view_of_file__delete-members.html +++ b/structwinstd_1_1_unmap_view_of_file__delete-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,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 2841d855..4956b7a7 100644 --- a/structwinstd_1_1_unmap_view_of_file__delete.html +++ b/structwinstd_1_1_unmap_view_of_file__delete.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -112,7 +112,7 @@ struct winstd::UnmapViewOfFile_delete< _Ty >

Deleter for unique_p

diff --git a/structwinstd_1_1_unmap_view_of_file__delete_3_01___ty_0f_0e_4-members.html b/structwinstd_1_1_unmap_view_of_file__delete_3_01___ty_0f_0e_4-members.html index c2b260e2..0d76c6ff 100644 --- a/structwinstd_1_1_unmap_view_of_file__delete_3_01___ty_0f_0e_4-members.html +++ b/structwinstd_1_1_unmap_view_of_file__delete_3_01___ty_0f_0e_4-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,7 @@ $(function() { diff --git a/structwinstd_1_1_unmap_view_of_file__delete_3_01___ty_0f_0e_4.html b/structwinstd_1_1_unmap_view_of_file__delete_3_01___ty_0f_0e_4.html index 67a8c8f9..bbb04175 100644 --- a/structwinstd_1_1_unmap_view_of_file__delete_3_01___ty_0f_0e_4.html +++ b/structwinstd_1_1_unmap_view_of_file__delete_3_01___ty_0f_0e_4.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -112,7 +112,7 @@ struct winstd::UnmapViewOfFile_delete< _Ty[]>

Deleter for unique_

diff --git a/structwinstd_1_1_wlan_free_memory__delete-members.html b/structwinstd_1_1_wlan_free_memory__delete-members.html index 78e0b329..03baba61 100644 --- a/structwinstd_1_1_wlan_free_memory__delete-members.html +++ b/structwinstd_1_1_wlan_free_memory__delete-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,7 @@ $(function() { diff --git a/structwinstd_1_1_wlan_free_memory__delete.html b/structwinstd_1_1_wlan_free_memory__delete.html index 32a39f0c..dbcdab1c 100644 --- a/structwinstd_1_1_wlan_free_memory__delete.html +++ b/structwinstd_1_1_wlan_free_memory__delete.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -112,7 +112,7 @@ struct winstd::WlanFreeMemory_delete< _Ty >

Deleter for unique_pt

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 39d3eb23..72890a10 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -80,7 +80,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 ba09ef49..b797741e 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 @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -112,7 +112,7 @@ struct winstd::WlanFreeMemory_delete< _Ty[]>

Deleter for unique_p

diff --git a/structwinstd_1_1heap__allocator_1_1rebind-members.html b/structwinstd_1_1heap__allocator_1_1rebind-members.html index 9d45c683..7b42bd02 100644 --- a/structwinstd_1_1heap__allocator_1_1rebind-members.html +++ b/structwinstd_1_1heap__allocator_1_1rebind-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -77,7 +77,7 @@ $(function() { diff --git a/structwinstd_1_1heap__allocator_1_1rebind.html b/structwinstd_1_1heap__allocator_1_1rebind.html index 0827c918..c9b414bd 100644 --- a/structwinstd_1_1heap__allocator_1_1rebind.html +++ b/structwinstd_1_1heap__allocator_1_1rebind.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -96,7 +96,7 @@ struct winstd::heap_allocator< _Ty >::rebind< _Other >

A st

diff --git a/structwinstd_1_1sanitizing__allocator_1_1rebind-members.html b/structwinstd_1_1sanitizing__allocator_1_1rebind-members.html index 9e3f96d7..31f80914 100644 --- a/structwinstd_1_1sanitizing__allocator_1_1rebind-members.html +++ b/structwinstd_1_1sanitizing__allocator_1_1rebind-members.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -77,7 +77,7 @@ $(function() { diff --git a/structwinstd_1_1sanitizing__allocator_1_1rebind.html b/structwinstd_1_1sanitizing__allocator_1_1rebind.html index ec6e046e..fe66f4cc 100644 --- a/structwinstd_1_1sanitizing__allocator_1_1rebind.html +++ b/structwinstd_1_1sanitizing__allocator_1_1rebind.html @@ -23,7 +23,7 @@
WinStd
-
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
+
Windows Win32 API using Standard C++
@@ -96,7 +96,7 @@ struct winstd::sanitizing_allocator< _Ty >::rebind< _Other >