diff --git a/_c_o_m_8h_source.html b/_c_o_m_8h_source.html index 18911a75..22b6a41c 100644 --- a/_c_o_m_8h_source.html +++ b/_c_o_m_8h_source.html @@ -911,7 +911,7 @@ $(function() { diff --git a/_common_8h_source.html b/_common_8h_source.html index 4bfe54c6..3e21ffaf 100644 --- a/_common_8h_source.html +++ b/_common_8h_source.html @@ -1021,7 +1021,7 @@ $(function() { diff --git a/_cred_8h_source.html b/_cred_8h_source.html index b45b864a..bd388f47 100644 --- a/_cred_8h_source.html +++ b/_cred_8h_source.html @@ -268,7 +268,7 @@ $(function() { diff --git a/_crypt_8h_source.html b/_crypt_8h_source.html index 837d1551..97be0c27 100644 --- a/_crypt_8h_source.html +++ b/_crypt_8h_source.html @@ -739,7 +739,7 @@ $(function() { diff --git a/_e_a_p_8h_source.html b/_e_a_p_8h_source.html index c8dab241..02aacc97 100644 --- a/_e_a_p_8h_source.html +++ b/_e_a_p_8h_source.html @@ -630,7 +630,7 @@ $(function() { diff --git a/_e_t_w_8h_source.html b/_e_t_w_8h_source.html index 31cf4482..28f62249 100644 --- a/_e_t_w_8h_source.html +++ b/_e_t_w_8h_source.html @@ -996,7 +996,7 @@ $(function() { diff --git a/_g_d_i_8h_source.html b/_g_d_i_8h_source.html index 344f1cff..ce00feec 100644 --- a/_g_d_i_8h_source.html +++ b/_g_d_i_8h_source.html @@ -229,7 +229,7 @@ $(function() { diff --git a/_m_s_i_8h_source.html b/_m_s_i_8h_source.html index ea0d0931..6fa1a724 100644 --- a/_m_s_i_8h_source.html +++ b/_m_s_i_8h_source.html @@ -197,7 +197,7 @@ $(function() {
133}
134
136template<class _Traits, class _Ax>
-
137static UINT MsiFormatRecordA(_In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
+
137static UINT MsiFormatRecordA(_In_opt_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
138{
139 assert(0); // TODO: Test this code.
140
@@ -224,7 +224,7 @@ $(function() {
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)
+
169static UINT MsiFormatRecordW(_In_opt_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
170{
171 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
172 DWORD dwSize = _countof(szStackBuffer);
@@ -384,7 +384,7 @@ $(function() { diff --git a/_s_d_d_l_8h_source.html b/_s_d_d_l_8h_source.html index 3bf1ad83..3d796df6 100644 --- a/_s_d_d_l_8h_source.html +++ b/_s_d_d_l_8h_source.html @@ -174,7 +174,7 @@ $(function() { diff --git a/_sec_8h_source.html b/_sec_8h_source.html index 2f22ca6f..f49535b2 100644 --- a/_sec_8h_source.html +++ b/_sec_8h_source.html @@ -376,7 +376,7 @@ $(function() { diff --git a/_setup_a_p_i_8h_source.html b/_setup_a_p_i_8h_source.html index b77a85ff..b8b2ae51 100644 --- a/_setup_a_p_i_8h_source.html +++ b/_setup_a_p_i_8h_source.html @@ -162,7 +162,7 @@ $(function() { diff --git a/_shell_8h_source.html b/_shell_8h_source.html index 47c4620d..0240cc42 100644 --- a/_shell_8h_source.html +++ b/_shell_8h_source.html @@ -109,12 +109,54 @@ $(function() {
39 return bResult;
40}
41
+
43template<class _Traits, class _Ax>
+
44static void PathRemoveBackslashA(_Inout_ std::basic_string<char, _Traits, _Ax>& sValue)
+
45{
+
46 char szBuffer[MAX_PATH + 1];
+
47 size_t len = sValue.length();
+
48 if (len < _countof(szBuffer)) {
+
49 memcpy(szBuffer, sValue.c_str(), len);
+
50 szBuffer[len] = 0;
+
51 PathRemoveBackslashA(szBuffer);
+
52 sValue.assign(szBuffer);
+
53 }
+
54 else {
+
55 std::unique_ptr<char[]> buf(new char[len + 1]);
+
56 memcpy(buf.get(), sValue.c_str(), len);
+
57 buf[len] = 0;
+
58 PathRemoveBackslashA(buf.get());
+
59 sValue.assign(buf.get());
+
60 }
+
61}
+
62
+
68template<class _Traits, class _Ax>
+
69static void PathRemoveBackslashW(_Inout_ std::basic_string<wchar_t, _Traits, _Ax>& sValue)
+
70{
+
71 wchar_t szBuffer[MAX_PATH + 1];
+
72 size_t len = sValue.length();
+
73 if (len < _countof(szBuffer)) {
+
74 wmemcpy(szBuffer, sValue.c_str(), len);
+
75 szBuffer[len] = 0;
+
76 PathRemoveBackslashW(szBuffer);
+
77 sValue.assign(szBuffer);
+
78 }
+
79 else {
+
80 std::unique_ptr<wchar_t[]> buf(new wchar_t[len + 1]);
+
81 wmemcpy(buf.get(), sValue.c_str(), len);
+
82 buf[len] = 0;
+
83 PathRemoveBackslashW(buf.get());
+
84 sValue.assign(buf.get());
+
85 }
+
86}
+
87
PathCanonicalizeW
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:34
+
PathRemoveBackslashW
static void PathRemoveBackslashW(std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Removes the trailing backslash from a given path.
Definition: Shell.h:69
+
PathRemoveBackslashA
static void PathRemoveBackslashA(std::basic_string< char, _Traits, _Ax > &sValue)
Removes the trailing backslash from a given path.
Definition: Shell.h:44
PathCanonicalizeA
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_source.html b/_w_l_a_n_8h_source.html index 22eab23e..2ca7f3f8 100644 --- a/_w_l_a_n_8h_source.html +++ b/_w_l_a_n_8h_source.html @@ -216,7 +216,7 @@ $(function() { diff --git a/_win_8h_source.html b/_win_8h_source.html index cde018c9..dba6cec1 100644 --- a/_win_8h_source.html +++ b/_win_8h_source.html @@ -87,1875 +87,1904 @@ $(function() {
9#pragma once
10
11#include "Common.h"
-
12#include <tlhelp32.h>
-
13#include <string>
-
14#include <vector>
-
15
-
16#pragma warning(push)
-
17#pragma warning(disable: 4505) // Don't warn on unused code
-
18
-
21
-
23template<class _Traits, class _Ax>
-
24static DWORD GetModuleFileNameA(_In_opt_ HMODULE hModule, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
-
25{
-
26 assert(0); // TODO: Test this code.
-
27
-
28 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
29
-
30 // Try with stack buffer first.
-
31 DWORD dwResult = ::GetModuleFileNameA(hModule, szStackBuffer, _countof(szStackBuffer));
-
32 if (dwResult < _countof(szStackBuffer)) {
-
33 // Copy from stack.
-
34 sValue.assign(szStackBuffer, dwResult);
-
35 return dwResult;
-
36 } else {
-
37 for (DWORD dwCapacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(char);; dwCapacity *= 2) {
-
38 // Allocate on heap and retry.
-
39 std::unique_ptr<char[]> szBuffer(new char[dwCapacity]);
-
40 dwResult = ::GetModuleFileNameA(hModule, szBuffer.get(), dwCapacity);
-
41 if (dwResult < dwCapacity) {
-
42 sValue.assign(szBuffer.get(), dwResult);
-
43 return dwResult;
-
44 }
-
45 }
-
46 }
-
47}
-
48
-
54template<class _Traits, class _Ax>
-
55static DWORD GetModuleFileNameW(_In_opt_ HMODULE hModule, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
-
56{
-
57 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
58
-
59 // Try with stack buffer first.
-
60 DWORD dwResult = ::GetModuleFileNameW(hModule, szStackBuffer, _countof(szStackBuffer));
-
61 if (dwResult < _countof(szStackBuffer)) {
-
62 // Copy from stack.
-
63 sValue.assign(szStackBuffer, dwResult);
-
64 return dwResult;
-
65 } else {
-
66 for (DWORD dwCapacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t);; dwCapacity *= 2) {
-
67 // Allocate on heap and retry.
-
68 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwCapacity]);
-
69 dwResult = ::GetModuleFileNameW(hModule, szBuffer.get(), dwCapacity);
-
70 if (dwResult < dwCapacity) {
-
71 sValue.assign(szBuffer.get(), dwResult);
-
72 return dwResult;
-
73 }
-
74 }
-
75 }
-
76}
-
77
-
79template<class _Traits, class _Ax>
-
80static _Success_(return != 0) int GetWindowTextA(_In_ HWND hWnd, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
-
81{
-
82 assert(0); // TODO: Test this code.
-
83
-
84 int iResult;
-
85
-
86 // Query the final string length first.
-
87 iResult = ::GetWindowTextLengthA(hWnd);
-
88 if (iResult > 0) {
-
89 if (++iResult < WINSTD_STACK_BUFFER_BYTES/sizeof(char)) {
-
90 // Read string data to stack.
-
91 char szBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
-
92 iResult = ::GetWindowTextA(hWnd, szBuffer, _countof(szBuffer));
-
93 sValue.assign(szBuffer, iResult);
-
94 } else {
-
95 // Allocate buffer on heap and read the string data into it.
-
96 std::unique_ptr<char[]> szBuffer(new char[++iResult]);
-
97 iResult = ::GetWindowTextA(hWnd, szBuffer.get(), iResult);
-
98 sValue.assign(szBuffer.get(), iResult);
-
99 }
-
100 return iResult;
-
101 }
-
102
-
103 sValue.clear();
-
104 return 0;
-
105}
-
106
-
112template<class _Traits, class _Ax>
-
113static _Success_(return != 0) int GetWindowTextW(_In_ HWND hWnd, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
-
114{
-
115 assert(0); // TODO: Test this code.
-
116
-
117 int iResult;
-
118
-
119 // Query the final string length first.
-
120 iResult = ::GetWindowTextLengthW(hWnd);
-
121 if (iResult > 0) {
-
122 if (++iResult < WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)) {
-
123 // Read string data to stack.
-
124 wchar_t szBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
125 iResult = ::GetWindowTextW(hWnd, szBuffer, _countof(szBuffer));
-
126 sValue.assign(szBuffer, iResult);
-
127 } else {
-
128 // Allocate buffer on heap and read the string data into it.
-
129 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++iResult]);
-
130 iResult = ::GetWindowTextW(hWnd, szBuffer.get(), iResult);
-
131 sValue.assign(szBuffer.get(), iResult);
-
132 }
-
133 return iResult;
-
134 }
-
135
-
136 sValue.clear();
-
137 return 0;
-
138}
-
139
-
141template<class _Ty, class _Ax>
-
142static _Success_(return != 0) BOOL GetFileVersionInfoA(_In_z_ LPCSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
-
143{
-
144 assert(0); // TODO: Test this code.
-
145
-
146 // Get version info size.
-
147 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeA(lptstrFilename, &dwHandle);
-
148 if (dwVerInfoSize != 0) {
-
149 // Read version info.
-
150 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
151 return ::GetFileVersionInfoA(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
-
152 } else
-
153 return FALSE;
-
154}
-
155
-
161template<class _Ty, class _Ax>
-
162static _Success_(return != 0) BOOL GetFileVersionInfoW(_In_z_ LPCWSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
-
163{
-
164 assert(0); // TODO: Test this code.
-
165
-
166 // Get version info size.
-
167 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeW(lptstrFilename, &dwHandle);
-
168 if (dwVerInfoSize != 0) {
-
169 // Read version info.
-
170 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
171 return ::GetFileVersionInfoW(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
-
172 } else
-
173 return FALSE;
-
174}
-
175
-
177template<class _Traits, class _Ax>
-
178static _Success_(return != 0) DWORD ExpandEnvironmentStringsA(_In_z_ LPCSTR lpSrc, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
-
179{
-
180 assert(0); // TODO: Test this code.
-
181
-
182 for (DWORD dwSizeOut = (DWORD)strlen(lpSrc) + 0x100;;) {
-
183 DWORD dwSizeIn = dwSizeOut;
-
184 std::unique_ptr<char[]> szBuffer(new char[(size_t)dwSizeIn + 2]); // Note: ANSI version requires one extra char.
-
185 dwSizeOut = ::ExpandEnvironmentStringsA(lpSrc, szBuffer.get(), dwSizeIn);
-
186 if (dwSizeOut == 0) {
-
187 // Error or zero-length input.
-
188 break;
-
189 } else if (dwSizeOut <= dwSizeIn) {
-
190 // The buffer was sufficient.
-
191 sValue.assign(szBuffer.get(), dwSizeOut - 1);
-
192 return dwSizeOut;
-
193 }
-
194 }
-
195
-
196 sValue.clear();
-
197 return 0;
-
198}
-
199
-
205template<class _Traits, class _Ax>
-
206static _Success_(return != 0) DWORD ExpandEnvironmentStringsW(_In_z_ LPCWSTR lpSrc, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
-
207{
-
208 for (DWORD dwSizeOut = (DWORD)wcslen(lpSrc) + 0x100;;) {
-
209 DWORD dwSizeIn = dwSizeOut;
-
210 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[(size_t)dwSizeIn + 1]);
-
211 dwSizeOut = ::ExpandEnvironmentStringsW(lpSrc, szBuffer.get(), dwSizeIn);
-
212 if (dwSizeOut == 0) {
-
213 // Error or zero-length input.
-
214 break;
-
215 } else if (dwSizeOut <= dwSizeIn) {
-
216 // The buffer was sufficient.
-
217 sValue.assign(szBuffer.get(), dwSizeOut - 1);
-
218 return dwSizeOut;
-
219 }
-
220 }
-
221
-
222 sValue.clear();
-
223 return 0;
-
224}
-
225
-
227template<class _Traits, class _Ax>
-
228static VOID GuidToStringA(_In_ LPCGUID lpGuid, _Out_ std::basic_string<char, _Traits, _Ax> &str) noexcept
-
229{
-
230 assert(0); // TODO: Test this code.
-
231
-
232 sprintf(str, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-
233 lpGuid->Data1,
-
234 lpGuid->Data2,
-
235 lpGuid->Data3,
-
236 lpGuid->Data4[0], lpGuid->Data4[1],
-
237 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
-
238}
-
239
-
246template<class _Traits, class _Ax>
-
247static VOID GuidToStringW(_In_ LPCGUID lpGuid, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &str) noexcept
-
248{
-
249 assert(0); // TODO: Test this code.
-
250
-
251 sprintf(str, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-
252 lpGuid->Data1,
-
253 lpGuid->Data2,
-
254 lpGuid->Data3,
-
255 lpGuid->Data4[0], lpGuid->Data4[1],
-
256 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
-
257}
-
258
-
260#ifdef _UNICODE
-
261#define GuidToString GuidToStringW
-
262#else
-
263#define GuidToString GuidToStringA
-
264#endif
-
265
-
267static _Success_(return) BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd = NULL) noexcept
-
268{
-
269 GUID g;
-
270 LPSTR lpszEnd;
-
271 unsigned long ulTmp;
-
272 unsigned long long ullTmp;
-
273
-
274 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
-
275 lpszGuid++;
-
276
-
277 g.Data1 = strtoul(lpszGuid, &lpszEnd, 16);
-
278 if (errno == ERANGE) return FALSE;
-
279 lpszGuid = lpszEnd;
-
280
-
281 if (*lpszGuid != '-') return FALSE;
-
282 lpszGuid++;
-
283
-
284 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
-
285 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
286 g.Data2 = static_cast<unsigned short>(ulTmp);
-
287 lpszGuid = lpszEnd;
-
288
-
289 if (*lpszGuid != '-') return FALSE;
-
290 lpszGuid++;
-
291
-
292 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
-
293 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
294 g.Data3 = static_cast<unsigned short>(ulTmp);
-
295 lpszGuid = lpszEnd;
-
296
-
297 if (*lpszGuid != '-') return FALSE;
-
298 lpszGuid++;
-
299
-
300 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
-
301 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
302 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
-
303 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
-
304 lpszGuid = lpszEnd;
-
305
-
306 if (*lpszGuid != '-') return FALSE;
-
307 lpszGuid++;
-
308
-
309 ullTmp = _strtoui64(lpszGuid, &lpszEnd, 16);
-
310 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
-
311 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
-
312 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
-
313 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
-
314 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
-
315 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
-
316 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
-
317 lpszGuid = lpszEnd;
-
318
-
319 if (*lpszGuid != '}') return FALSE;
-
320 lpszGuid++;
-
321
-
322 if (lpszGuidEnd)
-
323 *lpszGuidEnd = lpszGuid;
-
324
-
325 *lpGuid = g;
-
326 return TRUE;
-
327}
-
328
-
340static _Success_(return) BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd = NULL) noexcept
-
341{
-
342 GUID g;
-
343 LPWSTR lpszEnd;
-
344 unsigned long ulTmp;
-
345 unsigned long long ullTmp;
-
346
-
347 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
-
348 lpszGuid++;
-
349
-
350 g.Data1 = wcstoul(lpszGuid, &lpszEnd, 16);
-
351 if (errno == ERANGE) return FALSE;
-
352 lpszGuid = lpszEnd;
-
353
-
354 if (*lpszGuid != '-') return FALSE;
-
355 lpszGuid++;
-
356
-
357 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
-
358 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
359 g.Data2 = static_cast<unsigned short>(ulTmp);
-
360 lpszGuid = lpszEnd;
-
361
-
362 if (*lpszGuid != '-') return FALSE;
-
363 lpszGuid++;
-
364
-
365 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
-
366 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
367 g.Data3 = static_cast<unsigned short>(ulTmp);
-
368 lpszGuid = lpszEnd;
-
369
-
370 if (*lpszGuid != '-') return FALSE;
-
371 lpszGuid++;
-
372
-
373 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
-
374 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
-
375 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
-
376 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
-
377 lpszGuid = lpszEnd;
-
378
-
379 if (*lpszGuid != '-') return FALSE;
-
380 lpszGuid++;
-
381
-
382 ullTmp = _wcstoui64(lpszGuid, &lpszEnd, 16);
-
383 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
-
384 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
-
385 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
-
386 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
-
387 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
-
388 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
-
389 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
-
390 lpszGuid = lpszEnd;
-
391
-
392 if (*lpszGuid != '}') return FALSE;
-
393 lpszGuid++;
-
394
-
395 if (lpszGuidEnd)
-
396 *lpszGuidEnd = lpszGuid;
-
397
-
398 *lpGuid = g;
-
399 return TRUE;
-
400}
-
401
-
403#ifdef _UNICODE
-
404#define StringToGuid StringToGuidW
-
405#else
-
406#define StringToGuid StringToGuidA
-
407#endif
-
408
-
427template<class _Traits, class _Ax>
-
428static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
-
429{
-
430 LSTATUS lResult;
-
431 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
432 DWORD dwSize = sizeof(aStackBuffer), dwType;
-
433
-
434 // Try with stack buffer first.
-
435 lResult = ::RegQueryValueExA(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
-
436 if (lResult == ERROR_SUCCESS) {
-
437 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
438 // The value is REG_SZ or REG_MULTI_SZ.
-
439 dwSize /= sizeof(CHAR);
-
440 sValue.assign(reinterpret_cast<LPCSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
-
441 } else if (dwType == REG_EXPAND_SZ) {
-
442 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
-
443 if (::ExpandEnvironmentStringsA(reinterpret_cast<LPCSTR>(aStackBuffer), sValue) == 0)
-
444 lResult = ::GetLastError();
-
445 } else {
-
446 // The value is not a string type.
-
447 lResult = ERROR_INVALID_DATA;
-
448 }
-
449 } else if (lResult == ERROR_MORE_DATA) {
-
450 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
451 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
-
452 std::unique_ptr<CHAR[]> szBuffer(new CHAR[dwSize / sizeof(CHAR)]);
-
453 if ((lResult = ::RegQueryValueExA(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
454 dwSize /= sizeof(CHAR);
-
455 sValue.assign(szBuffer.get(), dwSize && szBuffer[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
-
456 }
-
457 } else if (dwType == REG_EXPAND_SZ) {
-
458 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
-
459 std::unique_ptr<CHAR[]> szBuffer(new CHAR[dwSize / sizeof(CHAR)]);
-
460 if ((lResult = ::RegQueryValueExA(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
461 if (::ExpandEnvironmentStringsA(szBuffer.get(), sValue) == 0)
-
462 lResult = ::GetLastError();
-
463 }
-
464 } else {
-
465 // The value is not a string type.
-
466 lResult = ERROR_INVALID_DATA;
-
467 }
-
468 }
-
469
-
470 return lResult;
-
471}
-
472
-
491template<class _Traits, class _Ax>
-
492static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCWSTR pszName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
-
493{
-
494 LSTATUS lResult;
-
495 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
496 DWORD dwSize = sizeof(aStackBuffer), dwType;
-
497
-
498 // Try with stack buffer first.
-
499 lResult = ::RegQueryValueExW(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
-
500 if (lResult == ERROR_SUCCESS) {
-
501 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
502 // The value is REG_SZ or REG_MULTI_SZ.
-
503 dwSize /= sizeof(WCHAR);
-
504 sValue.assign(reinterpret_cast<LPCWSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCWSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
-
505 } else if (dwType == REG_EXPAND_SZ) {
-
506 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
-
507 if (::ExpandEnvironmentStringsW(reinterpret_cast<LPCWSTR>(aStackBuffer), sValue) == 0)
-
508 lResult = ::GetLastError();
-
509 } else {
-
510 // The value is not a string type.
-
511 lResult = ERROR_INVALID_DATA;
-
512 }
-
513 } else if (lResult == ERROR_MORE_DATA) {
-
514 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
-
515 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
-
516 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[dwSize / sizeof(WCHAR)]);
-
517 if ((lResult = ::RegQueryValueExW(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
518 dwSize /= sizeof(WCHAR);
-
519 sValue.assign(szBuffer.get(), dwSize && szBuffer[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
-
520 }
-
521 } else if (dwType == REG_EXPAND_SZ) {
-
522 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
-
523 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[dwSize / sizeof(WCHAR)]);
-
524 if ((lResult = ::RegQueryValueExW(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
-
525 if (::ExpandEnvironmentStringsW(szBuffer.get(), sValue) == 0)
-
526 lResult = ::GetLastError();
-
527 }
-
528 } else {
-
529 // The value is not a string type.
-
530 lResult = ERROR_INVALID_DATA;
-
531 }
-
532 }
-
533
-
534 return lResult;
-
535}
-
536
-
538template<class _Ty, class _Ax>
-
539static LSTATUS RegQueryValueExA(_In_ HKEY hKey, _In_opt_z_ LPCSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
-
540{
-
541 LSTATUS lResult;
-
542 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
543 DWORD dwSize = sizeof(aStackBuffer);
-
544
-
545 // Try with stack buffer first.
-
546 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
-
547 if (lResult == ERROR_SUCCESS) {
-
548 // Copy from stack buffer.
-
549 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
550 memcpy(aData.data(), aStackBuffer, dwSize);
-
551 } else if (lResult == ERROR_MORE_DATA) {
-
552 // Allocate buffer on heap and retry.
-
553 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
554 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, NULL, reinterpret_cast<LPBYTE>(aData.data()), &dwSize);
-
555 }
-
556
-
557 return lResult;
-
558}
-
559
-
565template<class _Ty, class _Ax>
-
566static LSTATUS RegQueryValueExW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
-
567{
-
568 LSTATUS lResult;
-
569 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
570 DWORD dwSize = sizeof(aStackBuffer);
-
571
-
572 // Try with stack buffer first.
-
573 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
-
574 if (lResult == ERROR_SUCCESS) {
-
575 // Copy from stack buffer.
-
576 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
577 memcpy(aData.data(), aStackBuffer, dwSize);
-
578 } else if (lResult == ERROR_MORE_DATA) {
-
579 // Allocate buffer on heap and retry.
-
580 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
-
581 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, NULL, reinterpret_cast<LPBYTE>(aData.data()), &dwSize);
-
582 }
-
583
-
584 return lResult;
-
585}
-
586
-
587#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
-
588
-
590template<class _Traits, class _Ax>
-
591static 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
-
592{
-
593 // According to "Remarks" section in MSDN documentation of RegLoadMUIString(),
-
594 // this function is defined but not implemented as ANSI variation.
-
595 assert(0);
-
596 return ERROR_CALL_NOT_IMPLEMENTED;
-
597}
-
598
-
604template<class _Traits, class _Ax>
-
605static 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
-
606{
-
607 LSTATUS lResult;
-
608 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
-
609 DWORD dwSize;
-
610
-
611 Flags &= ~REG_MUI_STRING_TRUNCATE;
-
612
-
613 // Try with stack buffer first.
-
614 lResult = RegLoadMUIStringW(hKey, pszValue, szStackBuffer, sizeof(szStackBuffer), &dwSize, Flags, pszDirectory);
-
615 if (lResult == ERROR_SUCCESS) {
-
616 // Copy from stack buffer.
-
617 sOut.assign(szStackBuffer, wcsnlen(szStackBuffer, dwSize/sizeof(wchar_t)));
-
618 } else if (lResult == ERROR_MORE_DATA) {
-
619 // Allocate buffer on heap and retry.
-
620 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[(dwSize + sizeof(wchar_t) - 1)/sizeof(wchar_t)]);
-
621 sOut.assign(szBuffer.get(), (lResult = RegLoadMUIStringW(hKey, pszValue, szBuffer.get(), dwSize, &dwSize, Flags, pszDirectory)) == ERROR_SUCCESS ? wcsnlen(szBuffer.get(), dwSize/sizeof(wchar_t)) : 0);
-
622 }
-
623
-
624 return lResult;
-
625}
-
626
-
627#endif
-
628
-
634template<class _Traits, class _Ax>
-
635static _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
-
636{
-
637 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
638
-
639 // Try to convert to stack buffer first.
-
640 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
641 if (cch) {
-
642 // Copy from stack. Be careful not to include zero terminator.
-
643 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
644 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
645 // Query the required output size. Allocate buffer. Then convert again.
-
646 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
647 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
648 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
649 sMultiByteStr.assign(szBuffer.get(), cchWideChar != -1 ? strnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
650 }
-
651
-
652 return cch;
-
653}
-
654
-
660template<class _Ax>
-
661static _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
-
662{
-
663 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
664
-
665 // Try to convert to stack buffer first.
-
666 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
667 if (cch) {
-
668 // Copy from stack.
-
669 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
-
670 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
671 // Query the required output size. Allocate buffer. Then convert again.
-
672 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
673 sMultiByteStr.resize(cch);
-
674 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
-
675 }
-
676
-
677 return cch;
-
678}
-
679
-
685template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
686static _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
-
687{
-
688 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
689
-
690 // Try to convert to stack buffer first.
-
691 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
692 if (cch) {
-
693 // Copy from stack.
-
694 sMultiByteStr.assign(szStackBuffer, cch);
-
695 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
696 // Query the required output size. Allocate buffer. Then convert again.
-
697 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
698 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
699 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
700 sMultiByteStr.assign(szBuffer.get(), cch);
-
701 }
-
702
-
703 return cch;
-
704}
-
705
-
713template<class _Traits, class _Ax>
-
714static _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
-
715{
-
716 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
717
-
718 // Try to convert to stack buffer first.
-
719 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
720 if (cch) {
-
721 // Copy from stack. Be careful not to include zero terminator.
-
722 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
723 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
724 // Query the required output size. Allocate buffer. Then convert again.
-
725 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
726 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
727 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
728 sMultiByteStr.assign(szBuffer.get(), cchWideChar != -1 ? strnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
729 SecureZeroMemory(szBuffer.get(), sizeof(CHAR)*cch);
-
730 }
-
731
-
732 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
733
-
734 return cch;
-
735}
-
736
-
744template<class _Ax>
-
745static _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
-
746{
-
747 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
748
-
749 // Try to convert to stack buffer first.
-
750 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
751 if (cch) {
-
752 // Copy from stack.
-
753 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
-
754 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
755 // Query the required output size. Allocate buffer. Then convert again.
-
756 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
757 sMultiByteStr.resize(cch);
-
758 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
-
759 }
-
760
-
761 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
762
-
763 return cch;
-
764}
-
765
-
773template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
774static _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
-
775{
-
776 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
-
777
-
778 // Try to convert to stack buffer first.
-
779 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
-
780 if (cch) {
-
781 // Copy from stack.
-
782 sMultiByteStr.assign(szStackBuffer, cch);
-
783 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
784 // Query the required output size. Allocate buffer. Then convert again.
-
785 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
-
786 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
-
787 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
-
788 sMultiByteStr.assign(szBuffer.get(), cch);
-
789 SecureZeroMemory(szBuffer.get(), sizeof(CHAR)*cch);
-
790 }
-
791
-
792 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
793
-
794 return cch;
-
795}
-
796
-
802template<class _Traits, class _Ax>
-
803static _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
-
804{
-
805 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
806
-
807 // Try to convert to stack buffer first.
-
808 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
809 if (cch) {
-
810 // Copy from stack.
-
811 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
812 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
813 // Query the required output size. Allocate buffer. Then convert again.
-
814 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
815 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
816 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szBuffer.get(), cch);
-
817 sWideCharStr.assign(szBuffer.get(), cbMultiByte != -1 ? wcsnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
818 }
-
819
-
820 return cch;
-
821}
-
822
-
828template<class _Ax>
-
829static _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
-
830{
-
831 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
832
-
833 // Try to convert to stack buffer first.
-
834 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
835 if (cch) {
-
836 // Copy from stack.
-
837 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
-
838 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
839 // Query the required output size. Allocate buffer. Then convert again.
-
840 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
841 sWideCharStr.resize(cch);
-
842 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
-
843 }
-
844
-
845 return cch;
-
846}
-
847
-
853template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
854static _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
-
855{
-
856 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
857
-
858 // Try to convert to stack buffer first.
-
859 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
-
860 if (cch) {
-
861 // Copy from stack.
-
862 sWideCharStr.assign(szStackBuffer, cch);
-
863 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
864 // Query the required output size. Allocate buffer. Then convert again.
-
865 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
-
866 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
867 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szBuffer.get(), cch);
-
868 sWideCharStr.assign(szBuffer.get(), cch);
-
869 }
-
870
-
871 return cch;
-
872}
-
873
-
881template<class _Traits, class _Ax>
-
882static _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
-
883{
-
884 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
885
-
886 // Try to convert to stack buffer first.
-
887 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
888 if (cch) {
-
889 // Copy from stack.
-
890 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
891 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
892 // Query the required output size. Allocate buffer. Then convert again.
-
893 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
894 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
895 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szBuffer.get(), cch);
-
896 sWideCharStr.assign(szBuffer.get(), cbMultiByte != -1 ? wcsnlen(szBuffer.get(), cch) : (size_t)cch - 1);
-
897 SecureZeroMemory(szBuffer.get(), sizeof(WCHAR)*cch);
-
898 }
-
899
-
900 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
901
-
902 return cch;
-
903}
-
904
-
912template<class _Ax>
-
913static _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
-
914{
-
915 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
916
-
917 // Try to convert to stack buffer first.
-
918 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
-
919 if (cch) {
-
920 // Copy from stack.
-
921 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
-
922 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
923 // Query the required output size. Allocate buffer. Then convert again.
-
924 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
-
925 sWideCharStr.resize(cch);
-
926 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
-
927 }
-
928
-
929 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
930
-
931 return cch;
-
932}
-
933
-
941template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
942static _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
-
943{
-
944 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
945
-
946 // Try to convert to stack buffer first.
-
947 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
-
948 if (cch) {
-
949 // Copy from stack.
-
950 sWideCharStr.assign(szStackBuffer, cch);
-
951 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
952 // Query the required output size. Allocate buffer. Then convert again.
-
953 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
-
954 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
955 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szBuffer.get(), cch);
-
956 sWideCharStr.assign(szBuffer.get(), cch);
-
957 SecureZeroMemory(szBuffer.get(), sizeof(WCHAR)*cch);
-
958 }
-
959
-
960 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
-
961
-
962 return cch;
-
963}
-
964
-
970template<class _Traits, class _Ax>
-
971static _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
-
972{
-
973 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
974
-
975 // Try to convert to stack buffer first.
-
976 int cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szStackBuffer, _countof(szStackBuffer));
-
977 if (cch > 0) {
-
978 // Copy from stack.
-
979 sDstString.assign(szStackBuffer, cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
980 } else {
-
981 switch (::GetLastError()) {
-
982 case ERROR_INSUFFICIENT_BUFFER:
-
983 for (int i = 10; i--;) {
-
984 // Allocate buffer. Then convert again.
-
985 cch = -cch;
-
986 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
987 cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szBuffer.get(), cch);
-
988 if (cch > 0) {
-
989 sDstString.assign(szBuffer.get(), cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
-
990 break;
-
991 }
-
992 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-
993 sDstString.clear();
-
994 break;
-
995 }
-
996 }
-
997 break;
-
998
-
999 case ERROR_SUCCESS:
-
1000 sDstString.clear();
-
1001 break;
-
1002 }
-
1003 }
-
1004
-
1005 return cch;
-
1006}
-
1007
-
1013template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
-
1014static _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
-
1015{
-
1016 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
-
1017
-
1018 // Try to convert to stack buffer first.
-
1019 int cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), szStackBuffer, _countof(szStackBuffer));
-
1020 if (cch > 0) {
-
1021 // Copy from stack.
-
1022 sDstString.assign(szStackBuffer, cch);
-
1023 } else {
-
1024 switch (::GetLastError()) {
-
1025 case ERROR_INSUFFICIENT_BUFFER:
-
1026 for (int i = 10; i--;) {
-
1027 // Allocate buffer. Then convert again.
-
1028 cch = -cch;
-
1029 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
-
1030 cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), szBuffer.get(), cch);
-
1031 if (cch > 0) {
-
1032 sDstString.assign(szBuffer.get(), cch);
-
1033 break;
-
1034 }
-
1035 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-
1036 sDstString.clear();
-
1037 break;
-
1038 }
-
1039 }
-
1040 break;
-
1041
-
1042 case ERROR_SUCCESS:
-
1043 sDstString.clear();
-
1044 break;
-
1045 }
-
1046 }
-
1047
-
1048 return cch;
-
1049}
-
1050
-
1052template<class _Traits, class _Ax>
-
1053static _Success_(return != 0) int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<char, _Traits, _Ax> &sBuffer) noexcept
-
1054{
-
1055 // Get read-only pointer to string resource.
-
1056 LPCSTR pszStr;
-
1057 int i = LoadStringA(hInstance, uID, reinterpret_cast<LPSTR>(&pszStr), 0);
-
1058 if (i) {
-
1059 sBuffer.assign(pszStr, i);
-
1060 return i;
-
1061 } else
-
1062 return 0;
-
1063}
-
1064
-
1070template<class _Traits, class _Ax>
-
1071static _Success_(return != 0) int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sBuffer) noexcept
-
1072{
-
1073 // Get read-only pointer to string resource.
-
1074 LPCWSTR pszStr;
-
1075 int i = LoadStringW(hInstance, uID, reinterpret_cast<LPWSTR>(&pszStr), 0);
-
1076 if (i) {
-
1077 sBuffer.assign(pszStr, i);
-
1078 return i;
-
1079 } else
-
1080 return 0;
-
1081}
-
1082
-
1088static VOID OutputDebugStrV(_In_z_ LPCSTR lpOutputString, _In_ va_list arg) noexcept
-
1089{
-
1090 std::string str;
-
1091 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
-
1092 OutputDebugStringA(str.c_str());
-
1093}
-
1094
-
1100static VOID OutputDebugStrV(_In_z_ LPCWSTR lpOutputString, _In_ va_list arg) noexcept
-
1101{
-
1102 std::wstring str;
-
1103 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
-
1104 OutputDebugStringW(str.c_str());
-
1105}
-
1106
-
1112static VOID OutputDebugStr(_In_z_ LPCSTR lpOutputString, ...) noexcept
-
1113{
-
1114 va_list arg;
-
1115 va_start(arg, lpOutputString);
-
1116 OutputDebugStrV(lpOutputString, arg);
-
1117 va_end(arg);
-
1118}
-
1119
-
1125static VOID OutputDebugStr(_In_z_ LPCWSTR lpOutputString, ...) noexcept
-
1126{
-
1127 va_list arg;
-
1128 va_start(arg, lpOutputString);
-
1129 OutputDebugStrV(lpOutputString, arg);
-
1130 va_end(arg);
-
1131}
-
1132
-
1134template<class _Traits, class _Ax>
-
1135static _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
-
1136{
-
1137 int iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
-
1138 if (iResult) {
-
1139 // Allocate buffer on heap and retry.
-
1140 std::unique_ptr<char[]> szBuffer(new char[iResult]);
-
1141 iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, szBuffer.get(), iResult);
-
1142 sDate.assign(szBuffer.get(), iResult ? iResult - 1 : 0);
-
1143 return iResult;
-
1144 }
-
1145
-
1146 return iResult;
-
1147}
-
1148
-
1154template<class _Traits, class _Ax>
-
1155static _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
-
1156{
-
1157 int iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
-
1158 if (iResult) {
-
1159 // Allocate buffer on heap and retry.
-
1160 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[iResult]);
-
1161 iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, szBuffer.get(), iResult);
-
1162 sDate.assign(szBuffer.get(), iResult ? iResult - 1 : 0);
-
1163 return iResult;
-
1164 }
-
1165
-
1166 return iResult;
-
1167}
-
1168
-
1170template<class _Traits, class _Ax>
-
1171static _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
-
1172{
-
1173 assert(0); // TODO: Test this code.
-
1174
-
1175 DWORD dwNameLen = 0, dwRefDomainLen = 0;
-
1176
-
1177 if (LookupAccountSidA(lpSystemName, lpSid,
-
1178 NULL, &dwNameLen ,
-
1179 NULL, &dwRefDomainLen,
-
1180 peUse))
-
1181 {
-
1182 // Name and domain is blank.
-
1183 if (sName ) sName ->clear();
-
1184 if (sReferencedDomainName) sReferencedDomainName->clear();
-
1185 return TRUE;
-
1186 } else if (GetLastError() == ERROR_MORE_DATA) {
-
1187 // Allocate on heap and retry.
-
1188 std::unique_ptr<char[]> bufName (new char[dwNameLen ]);
-
1189 std::unique_ptr<char[]> bufRefDomain(new char[dwRefDomainLen]);
-
1190 if (LookupAccountSidA(lpSystemName, lpSid,
-
1191 bufName .get(), &dwNameLen ,
-
1192 bufRefDomain.get(), &dwRefDomainLen,
-
1193 peUse))
-
1194 {
-
1195 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
-
1196 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
-
1197 return TRUE;
-
1198 }
-
1199 }
-
1200
-
1201 return FALSE;
-
1202}
-
1203
-
1209template<class _Traits, class _Ax>
-
1210static _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
-
1211{
-
1212 assert(0); // TODO: Test this code.
-
1213
-
1214 DWORD dwNameLen = 0, dwRefDomainLen = 0;
-
1215
-
1216 if (LookupAccountSidW(lpSystemName, lpSid,
-
1217 NULL, &dwNameLen ,
-
1218 NULL, &dwRefDomainLen,
-
1219 peUse))
-
1220 {
-
1221 // Name and domain is blank.
-
1222 if (sName ) sName ->clear();
-
1223 if (sReferencedDomainName) sReferencedDomainName->clear();
-
1224 return TRUE;
-
1225 } else if (GetLastError() == ERROR_MORE_DATA) {
-
1226 // Allocate on heap and retry.
-
1227 std::unique_ptr<wchar_t[]> bufName (new wchar_t[dwNameLen ]);
-
1228 std::unique_ptr<wchar_t[]> bufRefDomain(new wchar_t[dwRefDomainLen]);
-
1229 if (LookupAccountSidW(lpSystemName, lpSid,
-
1230 bufName .get(), &dwNameLen ,
-
1231 bufRefDomain.get(), &dwRefDomainLen,
-
1232 peUse))
-
1233 {
-
1234 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
-
1235 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
-
1236 return TRUE;
-
1237 }
-
1238 }
-
1239
-
1240 return FALSE;
-
1241}
-
1242
-
1248static _Success_(return != FALSE) BOOL CreateWellKnownSid(_In_ WELL_KNOWN_SID_TYPE WellKnownSidType, _In_opt_ PSID DomainSid, _Inout_ std::unique_ptr<SID> &Sid)
-
1249{
-
1250 BYTE szStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
1251 DWORD dwSize = sizeof(szStackBuffer);
-
1252
-
1253 if (CreateWellKnownSid(WellKnownSidType, DomainSid, szStackBuffer, &dwSize)) {
-
1254 // The stack buffer was big enough to retrieve complete data. Alloc and copy.
-
1255 Sid.reset((SID*)new BYTE[dwSize]);
-
1256 memcpy(Sid.get(), szStackBuffer, dwSize);
-
1257 return TRUE;
-
1258 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
1259 // The stack buffer was too small to retrieve complete data. Alloc and retry.
-
1260 Sid.reset((SID*)new BYTE[dwSize]);
-
1261 return CreateWellKnownSid(WellKnownSidType, DomainSid, Sid.get(), &dwSize);
-
1262 } else
-
1263 return FALSE;
-
1264}
-
1265
-
1271template<class _Ty>
-
1272static _Success_(return != 0) BOOL GetTokenInformation(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_ std::unique_ptr<_Ty> &TokenInformation) noexcept
-
1273{
-
1274 BYTE szStackBuffer[WINSTD_STACK_BUFFER_BYTES];
-
1275 DWORD dwSize;
-
1276
-
1277 if (GetTokenInformation(TokenHandle, TokenInformationClass, szStackBuffer, sizeof(szStackBuffer), &dwSize)) {
-
1278 // The stack buffer was big enough to retrieve complete data. Alloc and copy.
-
1279 TokenInformation.reset((_Ty*)(new BYTE[dwSize]));
-
1280 memcpy(TokenInformation.get(), szStackBuffer, dwSize);
-
1281 return TRUE;
-
1282 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
1283 // The stack buffer was too small to retrieve complete data. Alloc and retry.
-
1284 TokenInformation.reset((_Ty*)(new BYTE[dwSize]));
-
1285 return GetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation.get(), dwSize, &dwSize);
-
1286 } else
-
1287 return FALSE;
-
1288}
-
1289
-
1295template<class _Traits, class _Ax>
-
1296static _Success_(return != 0) BOOL QueryFullProcessImageNameA(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<char, _Traits, _Ax>& sExeName)
-
1297{
-
1298 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(char)];
-
1299 DWORD dwSize = _countof(szStackBuffer);
-
1300
-
1301 // Try with stack buffer first.
-
1302 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szStackBuffer, &dwSize)) {
-
1303 // Copy from stack.
-
1304 sExeName.assign(szStackBuffer, dwSize);
-
1305 return TRUE;
-
1306 }
-
1307 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(char); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
-
1308 // Allocate on heap and retry.
-
1309 std::unique_ptr<char[]> szBuffer(new char[dwCapacity]);
-
1310 dwSize = dwCapacity;
-
1311 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szBuffer.get(), &dwSize)) {
-
1312 sExeName.assign(szBuffer.get(), dwSize);
-
1313 return TRUE;
-
1314 }
-
1315 }
-
1316 return FALSE;
-
1317}
-
1318
-
1324template<class _Traits, class _Ax>
-
1325static _Success_(return != 0) BOOL QueryFullProcessImageNameW(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<wchar_t, _Traits, _Ax>& sExeName)
-
1326{
-
1327 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t)];
-
1328 DWORD dwSize = _countof(szStackBuffer);
-
1329
-
1330 // Try with stack buffer first.
-
1331 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szStackBuffer, &dwSize)) {
-
1332 // Copy from stack.
-
1333 sExeName.assign(szStackBuffer, dwSize);
-
1334 return TRUE;
-
1335 }
-
1336 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
-
1337 // Allocate on heap and retry.
-
1338 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwCapacity]);
-
1339 dwSize = dwCapacity;
-
1340 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szBuffer.get(), &dwSize)) {
-
1341 sExeName.assign(szBuffer.get(), dwSize);
-
1342 return TRUE;
-
1343 }
-
1344 }
-
1345 return FALSE;
-
1346}
-
1347
-
1349
-
1350#pragma warning(pop)
-
1351
-
1352namespace winstd
-
1353{
-
1356
-
1360 template<HANDLE INVALID>
-
1361 class win_handle : public handle<HANDLE, INVALID>
-
1362 {
-
1363 WINSTD_HANDLE_IMPL(win_handle, INVALID)
-
1364
-
1365 public:
-
1371 virtual ~win_handle()
-
1372 {
-
1373 if (m_h != invalid)
-
1374 free_internal();
-
1375 }
-
1376
-
1377 protected:
-
1383 void free_internal() noexcept override
-
1384 {
-
1385 CloseHandle(m_h);
-
1386 }
-
1387 };
-
1388
-
1394 class library : public handle<HMODULE, NULL>
-
1395 {
-
1396 WINSTD_HANDLE_IMPL(library, NULL)
-
1397
-
1398 public:
-
1404 virtual ~library()
-
1405 {
-
1406 if (m_h != invalid)
-
1407 free_internal();
-
1408 }
-
1409
-
1410 protected:
-
1416 void free_internal() noexcept override
-
1417 {
-
1418 FreeLibrary(m_h);
-
1419 }
-
1420 };
-
1421
-
1427 typedef win_handle<NULL> process;
-
1428
-
1434 typedef win_handle<NULL> thread;
-
1435
-
1441 typedef win_handle<INVALID_HANDLE_VALUE> process_snapshot;
-
1442
-
1449 typedef win_handle<INVALID_HANDLE_VALUE> file;
-
1450
-
1456 typedef win_handle<NULL> file_mapping;
-
1457
-
1461 template <class _Ty> struct UnmapViewOfFile_delete
-
1462 {
-
1463 typedef UnmapViewOfFile_delete<_Ty> _Myt;
-
1464
-
1468 UnmapViewOfFile_delete() {}
-
1469
-
1473 template <class _Ty2> UnmapViewOfFile_delete(const UnmapViewOfFile_delete<_Ty2>&) {}
-
1474
-
1478 void operator()(_Ty* _Ptr) const
-
1479 {
-
1480 if (!UnmapViewOfFile(_Ptr))
-
1481 throw win_runtime_error("UnmapViewOfFile failed");
-
1482 }
-
1483 };
-
1484
-
1488 template <class _Ty> struct UnmapViewOfFile_delete<_Ty[]>
-
1489 {
-
1490 typedef UnmapViewOfFile_delete<_Ty> _Myt;
-
1491
-
1495 UnmapViewOfFile_delete() {}
-
1496
-
1500 void operator()(_Ty* _Ptr) const
-
1501 {
-
1502 if (!UnmapViewOfFile(_Ptr))
-
1503 throw win_runtime_error("UnmapViewOfFile failed");
-
1504 }
-
1505
-
1509 template<class _Other>
-
1510 void operator()(_Other*) const
-
1511 {
-
1512 if (!UnmapViewOfFile(_Ptr))
-
1513 throw win_runtime_error("UnmapViewOfFile failed");
-
1514 }
-
1515 };
-
1516
-
1523 typedef win_handle<NULL> event;
-
1524
-
1528 class critical_section
-
1529 {
-
1530 WINSTD_NONCOPYABLE(critical_section)
-
1531 WINSTD_NONMOVABLE(critical_section)
-
1532
-
1533 public:
-
1539 critical_section() noexcept
-
1540 {
-
1541 InitializeCriticalSection(&m_data);
-
1542 }
-
1543
-
1549 virtual ~critical_section()
-
1550 {
-
1551 DeleteCriticalSection(&m_data);
-
1552 }
-
1553
-
1559 operator LPCRITICAL_SECTION() noexcept
-
1560 {
-
1561 return &m_data;
-
1562 }
-
1563
-
1564 protected:
-
1565 CRITICAL_SECTION m_data;
-
1566 };
-
1567
-
1573 class find_file : public handle<HANDLE, INVALID_HANDLE_VALUE>
-
1574 {
-
1575 WINSTD_HANDLE_IMPL(find_file, INVALID_HANDLE_VALUE)
-
1576
-
1577 public:
-
1583 virtual ~find_file()
-
1584 {
-
1585 if (m_h != invalid)
-
1586 free_internal();
-
1587 }
-
1588
-
1589 protected:
-
1595 void free_internal() noexcept override
-
1596 {
-
1597 FindClose(m_h);
-
1598 }
-
1599 };
-
1600
-
1606 class heap : public handle<HANDLE, NULL>
-
1607 {
-
1608 WINSTD_HANDLE_IMPL(heap, NULL)
-
1609
-
1610 public:
-
1616 virtual ~heap()
-
1617 {
-
1618 if (m_h != invalid)
-
1619 free_internal();
-
1620 }
-
1621
-
1629 bool enumerate() noexcept
-
1630 {
-
1631 assert(m_h != invalid);
-
1632
-
1633 bool found = false;
-
1634
-
1635 // Lock the heap for exclusive access.
-
1636 HeapLock(m_h);
-
1637
-
1638 PROCESS_HEAP_ENTRY e;
-
1639 e.lpData = NULL;
-
1640 while (HeapWalk(m_h, &e) != FALSE) {
-
1641 if ((e.wFlags & PROCESS_HEAP_ENTRY_BUSY) != 0) {
-
1642 OutputDebugStr(
-
1643 _T("Allocated block%s%s\n")
-
1644 _T(" Data portion begins at: %#p\n Size: %d bytes\n")
-
1645 _T(" Overhead: %d bytes\n Region index: %d\n"),
-
1646 (e.wFlags & PROCESS_HEAP_ENTRY_MOVEABLE) != 0 ? tstring_printf(_T(", movable with HANDLE %#p"), e.Block.hMem).c_str() : _T(""),
-
1647 (e.wFlags & PROCESS_HEAP_ENTRY_DDESHARE) != 0 ? _T(", DDESHARE") : _T(""),
-
1648 e.lpData,
-
1649 e.cbData,
-
1650 e.cbOverhead,
-
1651 e.iRegionIndex);
-
1652
-
1653 found = true;
-
1654 }
-
1655 }
-
1656
-
1657 const DWORD dwResult = GetLastError();
-
1658 if (dwResult != ERROR_NO_MORE_ITEMS)
-
1659 OutputDebugStr(_T("HeapWalk failed (error %u).\n"), dwResult);
-
1660
-
1661 // Unlock the heap.
-
1662 HeapUnlock(m_h);
-
1663
-
1664 return found;
-
1665 }
-
1666
-
1667 protected:
-
1673 void free_internal() noexcept override
-
1674 {
-
1675 enumerate();
-
1676 HeapDestroy(m_h);
-
1677 }
-
1678 };
-
1679
-
1683 template <class _Ty>
-
1684 class heap_allocator
-
1685 {
-
1686 public:
-
1687 typedef typename _Ty value_type;
-
1688
-
1689 typedef _Ty *pointer;
-
1690 typedef _Ty& reference;
-
1691 typedef const _Ty *const_pointer;
-
1692 typedef const _Ty& const_reference;
-
1693
-
1694 typedef SIZE_T size_type;
-
1695 typedef ptrdiff_t difference_type;
-
1696
-
1700 template <class _Other>
-
1701 struct rebind
-
1702 {
-
1703 typedef heap_allocator<_Other> other;
-
1704 };
-
1705
-
1706 public:
-
1712 heap_allocator(_In_ HANDLE heap) : m_heap(heap)
-
1713 {
-
1714 }
-
1715
-
1721 template <class _Other>
-
1722 heap_allocator(_In_ const heap_allocator<_Other> &other) : m_heap(other.m_heap)
-
1723 {
-
1724 }
-
1725
-
1733 pointer allocate(_In_ size_type count)
-
1734 {
-
1735 assert(m_heap);
-
1736 return (pointer)HeapAlloc(m_heap, 0, count * sizeof(_Ty));
-
1737 }
-
1738
-
1745 void deallocate(_In_ pointer ptr, _In_ size_type size)
-
1746 {
-
1747 UNREFERENCED_PARAMETER(size);
-
1748 assert(m_heap);
-
1749 HeapFree(m_heap, 0, ptr);
-
1750 }
-
1751
-
1758 void construct(_Inout_ pointer ptr, _In_ const _Ty& val)
-
1759 {
-
1760 ::new ((void*)ptr) _Ty(val);
-
1761 }
-
1762
-
1769 void construct(_Inout_ pointer ptr, _Inout_ _Ty&& val)
-
1770 {
-
1771 ::new ((void*)ptr) _Ty(std::forward<_Ty>(val));
-
1772 }
-
1773
-
1779 void destroy(_Inout_ pointer ptr)
-
1780 {
-
1781 ptr->_Ty::~_Ty();
-
1782 }
-
1783
-
1787 size_type max_size() const
-
1788 {
-
1789 return (SIZE_T)-1;
-
1790 }
-
1791
-
1792 public:
-
1793 HANDLE m_heap;
-
1794 };
-
1795
-
1799 class actctx_activator
-
1800 {
-
1801 WINSTD_NONCOPYABLE(actctx_activator)
-
1802 WINSTD_NONMOVABLE(actctx_activator)
-
1803
-
1804 public:
-
1812 actctx_activator(_In_ HANDLE hActCtx) noexcept
-
1813 {
-
1814 if (!ActivateActCtx(hActCtx, &m_cookie))
-
1815 m_cookie = 0;
-
1816 }
-
1817
-
1823 virtual ~actctx_activator()
-
1824 {
-
1825 if (m_cookie)
-
1826 DeactivateActCtx(0, m_cookie);
-
1827 }
-
1828
-
1829 protected:
-
1830 ULONG_PTR m_cookie;
-
1831 };
-
1832
-
1836 class impersonator
-
1837 {
-
1838 public:
-
1842 impersonator() noexcept : m_cookie(FALSE) {}
-
1843
-
1849 virtual ~impersonator()
-
1850 {
-
1851 if (m_cookie)
-
1852 RevertToSelf();
-
1853 }
-
1854
-
1858 operator bool () const { return m_cookie; }
-
1859
-
1860 protected:
-
1861 BOOL m_cookie;
-
1862 };
-
1863
-
1867 class user_impersonator : public impersonator
-
1868 {
-
1869 WINSTD_NONCOPYABLE(user_impersonator)
-
1870 WINSTD_NONMOVABLE(user_impersonator)
-
1871
-
1872 public:
-
1880 user_impersonator(_In_opt_ HANDLE hToken) noexcept
-
1881 {
-
1882 m_cookie = hToken && ImpersonateLoggedOnUser(hToken);
-
1883 }
-
1884 };
-
1885
-
1889 class system_impersonator : public impersonator
-
1890 {
-
1891 WINSTD_NONCOPYABLE(system_impersonator)
-
1892 WINSTD_NONMOVABLE(system_impersonator)
-
1893
-
1894 public:
-
1898 system_impersonator() noexcept
-
1899 {
-
1900 TOKEN_PRIVILEGES privileges = { 1, {{{ 0, 0 }, SE_PRIVILEGE_ENABLED }} };
-
1901 if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &privileges.Privileges[0].Luid) ||
-
1902 !ImpersonateSelf(SecurityImpersonation))
-
1903 return;
-
1904
-
1905 {
-
1906 HANDLE h;
-
1907 if (!OpenThreadToken(GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES, FALSE, &h))
-
1908 goto revert;
-
1909 win_handle<INVALID_HANDLE_VALUE> thread_token(h);
-
1910 if (!AdjustTokenPrivileges(thread_token, FALSE, &privileges, sizeof(privileges), NULL, NULL))
-
1911 goto revert;
-
1912 process_snapshot process_snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
-
1913 if (!process_snapshot)
-
1914 goto revert;
-
1915 PROCESSENTRY32 entry = { sizeof(PROCESSENTRY32) };
-
1916 if (!Process32First(process_snapshot, &entry))
-
1917 goto revert;
-
1918 while (_tcsicmp(entry.szExeFile, TEXT("winlogon.exe")) != 0)
-
1919 if (!Process32Next(process_snapshot, &entry))
-
1920 goto revert;
-
1921 process winlogon_process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, entry.th32ProcessID);
-
1922 if (!winlogon_process)
-
1923 goto revert;
-
1924 if (!OpenProcessToken(winlogon_process, TOKEN_IMPERSONATE | TOKEN_DUPLICATE, &h))
-
1925 goto revert;
-
1926 win_handle<INVALID_HANDLE_VALUE> winlogon_token(h);
-
1927 if (!DuplicateToken(winlogon_token, SecurityImpersonation, &h))
-
1928 goto revert;
-
1929 win_handle<INVALID_HANDLE_VALUE> duplicated_token(h);
-
1930 if (!SetThreadToken(NULL, duplicated_token))
-
1931 goto revert;
-
1932 }
-
1933
-
1934 m_cookie = TRUE;
-
1935 return;
-
1936
-
1937 revert:
-
1938 DWORD dwResult = GetLastError();
-
1939 RevertToSelf();
-
1940 SetLastError(dwResult);
-
1941 }
-
1942 };
-
1943
-
1947 class console_ctrl_handler
-
1948 {
-
1949 WINSTD_NONCOPYABLE(console_ctrl_handler)
-
1950 WINSTD_NONMOVABLE(console_ctrl_handler)
-
1951
-
1952 public:
-
1960 console_ctrl_handler(_In_opt_ PHANDLER_ROUTINE HandlerRoutine) noexcept : m_handler(HandlerRoutine)
-
1961 {
-
1962 m_cookie = SetConsoleCtrlHandler(m_handler, TRUE);
-
1963 }
-
1964
-
1970 virtual ~console_ctrl_handler()
-
1971 {
-
1972 if (m_cookie)
-
1973 SetConsoleCtrlHandler(m_handler, FALSE);
-
1974 }
-
1975
-
1976 protected:
-
1977 BOOL m_cookie;
-
1978 PHANDLER_ROUTINE m_handler;
-
1979 };
-
1980
-
1984 class vmemory : public handle<LPVOID, NULL>
-
1985 {
-
1986 WINSTD_NONCOPYABLE(vmemory)
-
1987
-
1988 public:
-
1992 vmemory() noexcept : m_proc(NULL)
-
1993 {
-
1994 }
-
1995
-
2002 vmemory(_In_ handle_type h, _In_ HANDLE proc) noexcept :
-
2003 m_proc(proc),
-
2004 handle<LPVOID, NULL>(h)
-
2005 {
-
2006 }
-
2007
-
2013 vmemory(_Inout_ vmemory &&h) noexcept :
-
2014 m_proc(std::move(h.m_proc)),
-
2015 handle<LPVOID, NULL>(std::move(h))
-
2016 {
-
2017 }
-
2018
-
2024 virtual ~vmemory()
-
2025 {
-
2026 if (m_h != invalid)
-
2027 VirtualFreeEx(m_proc, m_h, 0, MEM_RELEASE);
-
2028 }
-
2029
-
2035 vmemory& operator=(_Inout_ vmemory &&other) noexcept
-
2036 {
-
2037 if (this != std::addressof(other)) {
-
2038 (handle<handle_type, NULL>&&)*this = std::move(other);
-
2039 m_proc = std::move(other.m_proc);
-
2040 }
-
2041 return *this;
-
2042 }
-
2043
-
2052 void attach(_In_ HANDLE proc, _In_opt_ handle_type h) noexcept
-
2053 {
-
2054 m_proc = proc;
-
2055 if (m_h != invalid)
-
2056 free_internal();
-
2057 m_h = h;
-
2058 }
-
2059
-
2069 bool alloc(
-
2070 _In_ HANDLE hProcess,
-
2071 _In_opt_ LPVOID lpAddress,
-
2072 _In_ SIZE_T dwSize,
-
2073 _In_ DWORD flAllocationType,
-
2074 _In_ DWORD flProtect) noexcept
-
2075 {
-
2076 handle_type h = VirtualAllocEx(hProcess, lpAddress, dwSize, flAllocationType, flProtect);
-
2077 if (h != invalid) {
-
2078 attach(hProcess, h);
-
2079 return true;
-
2080 } else
-
2081 return false;
-
2082 }
-
2083
-
2084 protected:
-
2090 void free_internal() noexcept override
-
2091 {
-
2092 VirtualFreeEx(m_proc, m_h, 0, MEM_RELEASE);
-
2093 }
-
2094
-
2095 protected:
-
2096 HANDLE m_proc;
-
2097 };
-
2098
-
2105 class reg_key : public handle<HKEY, NULL>
-
2106 {
-
2107 WINSTD_HANDLE_IMPL(reg_key, NULL)
-
2108
-
2109 public:
-
2115 virtual ~reg_key()
-
2116 {
-
2117 if (m_h != invalid)
-
2118 free_internal();
-
2119 }
-
2120
-
2130 bool delete_subkey(_In_z_ LPCTSTR szSubkey)
-
2131 {
-
2132 LSTATUS s;
-
2133
-
2134 s = RegDeleteKey(m_h, szSubkey);
-
2135 if (s == ERROR_SUCCESS || s == ERROR_FILE_NOT_FOUND)
-
2136 return true;
-
2137
-
2138 {
-
2139 reg_key k;
-
2140 handle_type h;
-
2141 s = RegOpenKeyEx(m_h, szSubkey, 0, KEY_ENUMERATE_SUB_KEYS, &h);
-
2142 if (s == ERROR_SUCCESS)
-
2143 k.attach(h);
-
2144 else {
-
2145 SetLastError(s);
-
2146 return false;
-
2147 }
-
2148 for (;;) {
-
2149 TCHAR szName[MAX_PATH];
-
2150 DWORD dwSize = _countof(szName);
-
2151 s = RegEnumKeyEx(k, 0, szName, &dwSize, NULL, NULL, NULL, NULL);
-
2152 if (s == ERROR_SUCCESS)
-
2153 k.delete_subkey(szName);
-
2154 else if (s == ERROR_NO_MORE_ITEMS)
-
2155 break;
-
2156 else {
-
2157 SetLastError(s);
-
2158 return false;
-
2159 }
-
2160 }
-
2161 }
-
2162
-
2163 s = RegDeleteKey(m_h, szSubkey);
-
2164 if (s == ERROR_SUCCESS)
-
2165 return true;
-
2166 else {
-
2167 SetLastError(s);
-
2168 return false;
-
2169 }
-
2170 }
-
2171
-
2172 protected:
-
2178 void free_internal() noexcept override
-
2179 {
-
2180 RegCloseKey(m_h);
-
2181 }
-
2182 };
-
2183
-
2187 class security_id : public handle<PSID, NULL>
-
2188 {
-
2189 WINSTD_HANDLE_IMPL(security_id, NULL)
-
2190
-
2191 public:
-
2197 virtual ~security_id()
-
2198 {
-
2199 if (m_h != invalid)
-
2200 free_internal();
-
2201 }
-
2202
-
2203 protected:
-
2209 void free_internal() noexcept override
-
2210 {
-
2211 FreeSid(m_h);
-
2212 }
-
2213 };
-
2214
-
2218 class process_information : public PROCESS_INFORMATION
-
2219 {
-
2220 WINSTD_NONCOPYABLE(process_information)
-
2221 WINSTD_NONMOVABLE(process_information)
-
2222
-
2223 public:
-
2227 process_information() noexcept
-
2228 {
-
2229 hProcess = INVALID_HANDLE_VALUE;
-
2230 hThread = INVALID_HANDLE_VALUE;
-
2231 dwProcessId = 0;
-
2232 dwThreadId = 0;
-
2233 }
-
2234
-
2238 ~process_information()
-
2239 {
-
2240 #pragma warning(push)
-
2241 #pragma warning(disable: 6001) // Using uninitialized memory '*this'. << ???
-
2242
-
2243 if (hProcess != INVALID_HANDLE_VALUE)
-
2244 CloseHandle(hProcess);
-
2245
-
2246 if (hThread != INVALID_HANDLE_VALUE)
-
2247 CloseHandle(hThread);
-
2248
-
2249 #pragma warning(pop)
-
2250 }
-
2251 };
-
2252
-
2258 class event_log : public handle<HANDLE, NULL>
-
2259 {
-
2260 WINSTD_HANDLE_IMPL(event_log, NULL)
-
2261
-
2262 public:
-
2268 virtual ~event_log()
-
2269 {
-
2270 if (m_h != invalid)
-
2271 free_internal();
-
2272 }
-
2273
-
2274 protected:
-
2280 void free_internal() noexcept override
-
2281 {
-
2282 DeregisterEventSource(m_h);
-
2283 }
-
2284 };
-
2285
-
2289 class sc_handle : public handle<SC_HANDLE, NULL>
-
2290 {
-
2291 WINSTD_HANDLE_IMPL(sc_handle, NULL)
-
2292
-
2293 public:
-
2299 virtual ~sc_handle()
-
2300 {
-
2301 if (m_h != invalid)
-
2302 free_internal();
-
2303 }
-
2304
-
2305 protected:
-
2311 void free_internal() noexcept override
-
2312 {
-
2313 CloseServiceHandle(m_h);
-
2314 }
-
2315 };
-
2316
-
2318}
-
2319
-
2322
-
2323#pragma warning(push)
-
2324#pragma warning(disable: 4505) // Don't warn on unused code
-
2325
-
2327static LSTATUS RegCreateKeyExA(
-
2328 _In_ HKEY hKey,
-
2329 _In_ LPCSTR lpSubKey,
-
2330 _Reserved_ DWORD Reserved,
-
2331 _In_opt_ LPSTR lpClass,
-
2332 _In_ DWORD dwOptions,
-
2333 _In_ REGSAM samDesired,
-
2334 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
-
2335 _Inout_ winstd::reg_key &result,
-
2336 _Out_opt_ LPDWORD lpdwDisposition)
-
2337{
-
2338 HKEY h;
-
2339 LSTATUS s = RegCreateKeyExA(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
-
2340 if (s == ERROR_SUCCESS)
-
2341 result.attach(h);
-
2342 return s;
-
2343}
-
2344
-
2350static LSTATUS RegCreateKeyExW(
-
2351 _In_ HKEY hKey,
-
2352 _In_ LPCWSTR lpSubKey,
-
2353 _Reserved_ DWORD Reserved,
-
2354 _In_opt_ LPWSTR lpClass,
-
2355 _In_ DWORD dwOptions,
-
2356 _In_ REGSAM samDesired,
-
2357 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
-
2358 _Inout_ winstd::reg_key &result,
-
2359 _Out_opt_ LPDWORD lpdwDisposition)
-
2360{
-
2361 HKEY h;
-
2362 LSTATUS s = RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
-
2363 if (s == ERROR_SUCCESS)
-
2364 result.attach(h);
-
2365 return s;
-
2366}
-
2367
-
2369static LSTATUS RegOpenKeyExA(
-
2370 _In_ HKEY hKey,
-
2371 _In_opt_ LPCSTR lpSubKey,
-
2372 _In_opt_ DWORD ulOptions,
-
2373 _In_ REGSAM samDesired,
-
2374 _Inout_ winstd::reg_key &result)
-
2375{
-
2376 HKEY h;
-
2377 LSTATUS s = RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, &h);
-
2378 if (s == ERROR_SUCCESS)
-
2379 result.attach(h);
-
2380 return s;
-
2381}
-
2382
-
2388static LSTATUS RegOpenKeyExW(
-
2389 _In_ HKEY hKey,
-
2390 _In_opt_ LPCWSTR lpSubKey,
-
2391 _In_opt_ DWORD ulOptions,
-
2392 _In_ REGSAM samDesired,
-
2393 _Inout_ winstd::reg_key &result)
-
2394{
-
2395 HKEY h;
-
2396 LSTATUS s = RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, &h);
-
2397 if (s == ERROR_SUCCESS)
-
2398 result.attach(h);
-
2399 return s;
-
2400}
-
2401
-
2407static BOOL OpenProcessToken(_In_ HANDLE ProcessHandle, _In_ DWORD DesiredAccess, _Inout_ winstd::win_handle<NULL> &TokenHandle)
-
2408{
-
2409 HANDLE h;
-
2410 if (OpenProcessToken(ProcessHandle, DesiredAccess, &h)) {
-
2411 TokenHandle.attach(h);
-
2412 return TRUE;
-
2413 }
-
2414 return FALSE;
-
2415}
-
2416
-
2422static BOOL DuplicateTokenEx(_In_ HANDLE hExistingToken, _In_ DWORD dwDesiredAccess, _In_opt_ LPSECURITY_ATTRIBUTES lpTokenAttributes, _In_ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, _In_ TOKEN_TYPE TokenType, _Inout_ winstd::win_handle<NULL> &NewToken)
-
2423{
-
2424 HANDLE h;
-
2425 if (DuplicateTokenEx(hExistingToken, dwDesiredAccess, lpTokenAttributes, ImpersonationLevel, TokenType, &h)) {
-
2426 NewToken.attach(h);
-
2427 return TRUE;
-
2428 }
-
2429 return FALSE;
-
2430}
-
2431
-
2432#pragma warning(pop)
-
2433
-
winstd::actctx_activator
Activates given activation context in constructor and deactivates it in destructor.
Definition: Win.h:1800
-
winstd::actctx_activator::actctx_activator
actctx_activator(HANDLE hActCtx) noexcept
Construct the activator and activates the given activation context.
Definition: Win.h:1812
-
winstd::actctx_activator::~actctx_activator
virtual ~actctx_activator()
Deactivates activation context and destructs the activator.
Definition: Win.h:1823
-
winstd::actctx_activator::m_cookie
ULONG_PTR m_cookie
Cookie for context deactivation.
Definition: Win.h:1830
+
12#include <AclAPI.h>
+
13#include <tlhelp32.h>
+
14#include <string>
+
15#include <vector>
+
16
+
17#pragma warning(push)
+
18#pragma warning(disable: 4505) // Don't warn on unused code
+
19
+
22
+
24template<class _Traits, class _Ax>
+
25static DWORD GetModuleFileNameA(_In_opt_ HMODULE hModule, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
+
26{
+
27 assert(0); // TODO: Test this code.
+
28
+
29 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
30
+
31 // Try with stack buffer first.
+
32 DWORD dwResult = ::GetModuleFileNameA(hModule, szStackBuffer, _countof(szStackBuffer));
+
33 if (dwResult < _countof(szStackBuffer)) {
+
34 // Copy from stack.
+
35 sValue.assign(szStackBuffer, dwResult);
+
36 return dwResult;
+
37 } else {
+
38 for (DWORD dwCapacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(char);; dwCapacity *= 2) {
+
39 // Allocate on heap and retry.
+
40 std::unique_ptr<char[]> szBuffer(new char[dwCapacity]);
+
41 dwResult = ::GetModuleFileNameA(hModule, szBuffer.get(), dwCapacity);
+
42 if (dwResult < dwCapacity) {
+
43 sValue.assign(szBuffer.get(), dwResult);
+
44 return dwResult;
+
45 }
+
46 }
+
47 }
+
48}
+
49
+
55template<class _Traits, class _Ax>
+
56static DWORD GetModuleFileNameW(_In_opt_ HMODULE hModule, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
+
57{
+
58 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
59
+
60 // Try with stack buffer first.
+
61 DWORD dwResult = ::GetModuleFileNameW(hModule, szStackBuffer, _countof(szStackBuffer));
+
62 if (dwResult < _countof(szStackBuffer)) {
+
63 // Copy from stack.
+
64 sValue.assign(szStackBuffer, dwResult);
+
65 return dwResult;
+
66 } else {
+
67 for (DWORD dwCapacity = 2*WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t);; dwCapacity *= 2) {
+
68 // Allocate on heap and retry.
+
69 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwCapacity]);
+
70 dwResult = ::GetModuleFileNameW(hModule, szBuffer.get(), dwCapacity);
+
71 if (dwResult < dwCapacity) {
+
72 sValue.assign(szBuffer.get(), dwResult);
+
73 return dwResult;
+
74 }
+
75 }
+
76 }
+
77}
+
78
+
80template<class _Traits, class _Ax>
+
81static _Success_(return != 0) int GetWindowTextA(_In_ HWND hWnd, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
+
82{
+
83 assert(0); // TODO: Test this code.
+
84
+
85 int iResult;
+
86
+
87 // Query the final string length first.
+
88 iResult = ::GetWindowTextLengthA(hWnd);
+
89 if (iResult > 0) {
+
90 if (++iResult < WINSTD_STACK_BUFFER_BYTES/sizeof(char)) {
+
91 // Read string data to stack.
+
92 char szBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(char)];
+
93 iResult = ::GetWindowTextA(hWnd, szBuffer, _countof(szBuffer));
+
94 sValue.assign(szBuffer, iResult);
+
95 } else {
+
96 // Allocate buffer on heap and read the string data into it.
+
97 std::unique_ptr<char[]> szBuffer(new char[++iResult]);
+
98 iResult = ::GetWindowTextA(hWnd, szBuffer.get(), iResult);
+
99 sValue.assign(szBuffer.get(), iResult);
+
100 }
+
101 return iResult;
+
102 }
+
103
+
104 sValue.clear();
+
105 return 0;
+
106}
+
107
+
113template<class _Traits, class _Ax>
+
114static _Success_(return != 0) int GetWindowTextW(_In_ HWND hWnd, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
+
115{
+
116 assert(0); // TODO: Test this code.
+
117
+
118 int iResult;
+
119
+
120 // Query the final string length first.
+
121 iResult = ::GetWindowTextLengthW(hWnd);
+
122 if (iResult > 0) {
+
123 if (++iResult < WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)) {
+
124 // Read string data to stack.
+
125 wchar_t szBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
126 iResult = ::GetWindowTextW(hWnd, szBuffer, _countof(szBuffer));
+
127 sValue.assign(szBuffer, iResult);
+
128 } else {
+
129 // Allocate buffer on heap and read the string data into it.
+
130 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[++iResult]);
+
131 iResult = ::GetWindowTextW(hWnd, szBuffer.get(), iResult);
+
132 sValue.assign(szBuffer.get(), iResult);
+
133 }
+
134 return iResult;
+
135 }
+
136
+
137 sValue.clear();
+
138 return 0;
+
139}
+
140
+
142template<class _Ty, class _Ax>
+
143static _Success_(return != 0) BOOL GetFileVersionInfoA(_In_z_ LPCSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
+
144{
+
145 assert(0); // TODO: Test this code.
+
146
+
147 // Get version info size.
+
148 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeA(lptstrFilename, &dwHandle);
+
149 if (dwVerInfoSize != 0) {
+
150 // Read version info.
+
151 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
152 return ::GetFileVersionInfoA(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
+
153 } else
+
154 return FALSE;
+
155}
+
156
+
162template<class _Ty, class _Ax>
+
163static _Success_(return != 0) BOOL GetFileVersionInfoW(_In_z_ LPCWSTR lptstrFilename, __reserved DWORD dwHandle, _Out_ std::vector<_Ty, _Ax> &aValue) noexcept
+
164{
+
165 assert(0); // TODO: Test this code.
+
166
+
167 // Get version info size.
+
168 DWORD dwVerInfoSize = ::GetFileVersionInfoSizeW(lptstrFilename, &dwHandle);
+
169 if (dwVerInfoSize != 0) {
+
170 // Read version info.
+
171 aValue.resize((dwVerInfoSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
172 return ::GetFileVersionInfoW(lptstrFilename, dwHandle, dwVerInfoSize, aValue.data());
+
173 } else
+
174 return FALSE;
+
175}
+
176
+
178template<class _Traits, class _Ax>
+
179static _Success_(return != 0) DWORD ExpandEnvironmentStringsA(_In_z_ LPCSTR lpSrc, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
+
180{
+
181 assert(0); // TODO: Test this code.
+
182
+
183 for (DWORD dwSizeOut = (DWORD)strlen(lpSrc) + 0x100;;) {
+
184 DWORD dwSizeIn = dwSizeOut;
+
185 std::unique_ptr<char[]> szBuffer(new char[(size_t)dwSizeIn + 2]); // Note: ANSI version requires one extra char.
+
186 dwSizeOut = ::ExpandEnvironmentStringsA(lpSrc, szBuffer.get(), dwSizeIn);
+
187 if (dwSizeOut == 0) {
+
188 // Error or zero-length input.
+
189 break;
+
190 } else if (dwSizeOut <= dwSizeIn) {
+
191 // The buffer was sufficient.
+
192 sValue.assign(szBuffer.get(), dwSizeOut - 1);
+
193 return dwSizeOut;
+
194 }
+
195 }
+
196
+
197 sValue.clear();
+
198 return 0;
+
199}
+
200
+
206template<class _Traits, class _Ax>
+
207static _Success_(return != 0) DWORD ExpandEnvironmentStringsW(_In_z_ LPCWSTR lpSrc, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
+
208{
+
209 for (DWORD dwSizeOut = (DWORD)wcslen(lpSrc) + 0x100;;) {
+
210 DWORD dwSizeIn = dwSizeOut;
+
211 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[(size_t)dwSizeIn + 1]);
+
212 dwSizeOut = ::ExpandEnvironmentStringsW(lpSrc, szBuffer.get(), dwSizeIn);
+
213 if (dwSizeOut == 0) {
+
214 // Error or zero-length input.
+
215 break;
+
216 } else if (dwSizeOut <= dwSizeIn) {
+
217 // The buffer was sufficient.
+
218 sValue.assign(szBuffer.get(), dwSizeOut - 1);
+
219 return dwSizeOut;
+
220 }
+
221 }
+
222
+
223 sValue.clear();
+
224 return 0;
+
225}
+
226
+
228template<class _Traits, class _Ax>
+
229static VOID GuidToStringA(_In_ LPCGUID lpGuid, _Out_ std::basic_string<char, _Traits, _Ax> &str) noexcept
+
230{
+
231 assert(0); // TODO: Test this code.
+
232
+
233 sprintf(str, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+
234 lpGuid->Data1,
+
235 lpGuid->Data2,
+
236 lpGuid->Data3,
+
237 lpGuid->Data4[0], lpGuid->Data4[1],
+
238 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
+
239}
+
240
+
247template<class _Traits, class _Ax>
+
248static VOID GuidToStringW(_In_ LPCGUID lpGuid, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &str) noexcept
+
249{
+
250 assert(0); // TODO: Test this code.
+
251
+
252 sprintf(str, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+
253 lpGuid->Data1,
+
254 lpGuid->Data2,
+
255 lpGuid->Data3,
+
256 lpGuid->Data4[0], lpGuid->Data4[1],
+
257 lpGuid->Data4[2], lpGuid->Data4[3], lpGuid->Data4[4], lpGuid->Data4[5], lpGuid->Data4[6], lpGuid->Data4[7]);
+
258}
+
259
+
261#ifdef _UNICODE
+
262#define GuidToString GuidToStringW
+
263#else
+
264#define GuidToString GuidToStringA
+
265#endif
+
266
+
268static _Success_(return) BOOL StringToGuidA(_In_z_ LPCSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCSTR *lpszGuidEnd = NULL) noexcept
+
269{
+
270 GUID g;
+
271 LPSTR lpszEnd;
+
272 unsigned long ulTmp;
+
273 unsigned long long ullTmp;
+
274
+
275 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
+
276 lpszGuid++;
+
277
+
278 g.Data1 = strtoul(lpszGuid, &lpszEnd, 16);
+
279 if (errno == ERANGE) return FALSE;
+
280 lpszGuid = lpszEnd;
+
281
+
282 if (*lpszGuid != '-') return FALSE;
+
283 lpszGuid++;
+
284
+
285 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
+
286 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
287 g.Data2 = static_cast<unsigned short>(ulTmp);
+
288 lpszGuid = lpszEnd;
+
289
+
290 if (*lpszGuid != '-') return FALSE;
+
291 lpszGuid++;
+
292
+
293 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
+
294 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
295 g.Data3 = static_cast<unsigned short>(ulTmp);
+
296 lpszGuid = lpszEnd;
+
297
+
298 if (*lpszGuid != '-') return FALSE;
+
299 lpszGuid++;
+
300
+
301 ulTmp = strtoul(lpszGuid, &lpszEnd, 16);
+
302 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
303 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
+
304 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
+
305 lpszGuid = lpszEnd;
+
306
+
307 if (*lpszGuid != '-') return FALSE;
+
308 lpszGuid++;
+
309
+
310 ullTmp = _strtoui64(lpszGuid, &lpszEnd, 16);
+
311 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
+
312 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
+
313 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
+
314 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
+
315 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
+
316 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
+
317 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
+
318 lpszGuid = lpszEnd;
+
319
+
320 if (*lpszGuid != '}') return FALSE;
+
321 lpszGuid++;
+
322
+
323 if (lpszGuidEnd)
+
324 *lpszGuidEnd = lpszGuid;
+
325
+
326 *lpGuid = g;
+
327 return TRUE;
+
328}
+
329
+
341static _Success_(return) BOOL StringToGuidW(_In_z_ LPCWSTR lpszGuid, _Out_ LPGUID lpGuid, _Out_opt_ LPCWSTR *lpszGuidEnd = NULL) noexcept
+
342{
+
343 GUID g;
+
344 LPWSTR lpszEnd;
+
345 unsigned long ulTmp;
+
346 unsigned long long ullTmp;
+
347
+
348 if (!lpszGuid || !lpGuid || *lpszGuid != '{') return FALSE;
+
349 lpszGuid++;
+
350
+
351 g.Data1 = wcstoul(lpszGuid, &lpszEnd, 16);
+
352 if (errno == ERANGE) return FALSE;
+
353 lpszGuid = lpszEnd;
+
354
+
355 if (*lpszGuid != '-') return FALSE;
+
356 lpszGuid++;
+
357
+
358 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
+
359 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
360 g.Data2 = static_cast<unsigned short>(ulTmp);
+
361 lpszGuid = lpszEnd;
+
362
+
363 if (*lpszGuid != '-') return FALSE;
+
364 lpszGuid++;
+
365
+
366 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
+
367 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
368 g.Data3 = static_cast<unsigned short>(ulTmp);
+
369 lpszGuid = lpszEnd;
+
370
+
371 if (*lpszGuid != '-') return FALSE;
+
372 lpszGuid++;
+
373
+
374 ulTmp = wcstoul(lpszGuid, &lpszEnd, 16);
+
375 if (errno == ERANGE || ulTmp > 0xFFFF) return FALSE;
+
376 g.Data4[0] = static_cast<unsigned char>((ulTmp >> 8) & 0xff);
+
377 g.Data4[1] = static_cast<unsigned char>( ulTmp & 0xff);
+
378 lpszGuid = lpszEnd;
+
379
+
380 if (*lpszGuid != '-') return FALSE;
+
381 lpszGuid++;
+
382
+
383 ullTmp = _wcstoui64(lpszGuid, &lpszEnd, 16);
+
384 if (errno == ERANGE || ullTmp > 0xFFFFFFFFFFFF) return FALSE;
+
385 g.Data4[2] = static_cast<unsigned char>((ullTmp >> 40) & 0xff);
+
386 g.Data4[3] = static_cast<unsigned char>((ullTmp >> 32) & 0xff);
+
387 g.Data4[4] = static_cast<unsigned char>((ullTmp >> 24) & 0xff);
+
388 g.Data4[5] = static_cast<unsigned char>((ullTmp >> 16) & 0xff);
+
389 g.Data4[6] = static_cast<unsigned char>((ullTmp >> 8) & 0xff);
+
390 g.Data4[7] = static_cast<unsigned char>( ullTmp & 0xff);
+
391 lpszGuid = lpszEnd;
+
392
+
393 if (*lpszGuid != '}') return FALSE;
+
394 lpszGuid++;
+
395
+
396 if (lpszGuidEnd)
+
397 *lpszGuidEnd = lpszGuid;
+
398
+
399 *lpGuid = g;
+
400 return TRUE;
+
401}
+
402
+
404#ifdef _UNICODE
+
405#define StringToGuid StringToGuidW
+
406#else
+
407#define StringToGuid StringToGuidA
+
408#endif
+
409
+
428template<class _Traits, class _Ax>
+
429static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_ std::basic_string<char, _Traits, _Ax> &sValue) noexcept
+
430{
+
431 LSTATUS lResult;
+
432 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
433 DWORD dwSize = sizeof(aStackBuffer), dwType;
+
434
+
435 // Try with stack buffer first.
+
436 lResult = ::RegQueryValueExA(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
+
437 if (lResult == ERROR_SUCCESS) {
+
438 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
439 // The value is REG_SZ or REG_MULTI_SZ.
+
440 dwSize /= sizeof(CHAR);
+
441 sValue.assign(reinterpret_cast<LPCSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
442 } else if (dwType == REG_EXPAND_SZ) {
+
443 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
+
444 if (::ExpandEnvironmentStringsA(reinterpret_cast<LPCSTR>(aStackBuffer), sValue) == 0)
+
445 lResult = ::GetLastError();
+
446 } else {
+
447 // The value is not a string type.
+
448 lResult = ERROR_INVALID_DATA;
+
449 }
+
450 } else if (lResult == ERROR_MORE_DATA) {
+
451 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
452 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
+
453 std::unique_ptr<CHAR[]> szBuffer(new CHAR[dwSize / sizeof(CHAR)]);
+
454 if ((lResult = ::RegQueryValueExA(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
+
455 dwSize /= sizeof(CHAR);
+
456 sValue.assign(szBuffer.get(), dwSize && szBuffer[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
457 }
+
458 } else if (dwType == REG_EXPAND_SZ) {
+
459 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
+
460 std::unique_ptr<CHAR[]> szBuffer(new CHAR[dwSize / sizeof(CHAR)]);
+
461 if ((lResult = ::RegQueryValueExA(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
+
462 if (::ExpandEnvironmentStringsA(szBuffer.get(), sValue) == 0)
+
463 lResult = ::GetLastError();
+
464 }
+
465 } else {
+
466 // The value is not a string type.
+
467 lResult = ERROR_INVALID_DATA;
+
468 }
+
469 }
+
470
+
471 return lResult;
+
472}
+
473
+
492template<class _Traits, class _Ax>
+
493static LSTATUS RegQueryStringValue(_In_ HKEY hReg, _In_z_ LPCWSTR pszName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue) noexcept
+
494{
+
495 LSTATUS lResult;
+
496 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
497 DWORD dwSize = sizeof(aStackBuffer), dwType;
+
498
+
499 // Try with stack buffer first.
+
500 lResult = ::RegQueryValueExW(hReg, pszName, NULL, &dwType, aStackBuffer, &dwSize);
+
501 if (lResult == ERROR_SUCCESS) {
+
502 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
503 // The value is REG_SZ or REG_MULTI_SZ.
+
504 dwSize /= sizeof(WCHAR);
+
505 sValue.assign(reinterpret_cast<LPCWSTR>(aStackBuffer), dwSize && reinterpret_cast<LPCWSTR>(aStackBuffer)[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
506 } else if (dwType == REG_EXPAND_SZ) {
+
507 // The value is REG_EXPAND_SZ. Expand it from stack buffer.
+
508 if (::ExpandEnvironmentStringsW(reinterpret_cast<LPCWSTR>(aStackBuffer), sValue) == 0)
+
509 lResult = ::GetLastError();
+
510 } else {
+
511 // The value is not a string type.
+
512 lResult = ERROR_INVALID_DATA;
+
513 }
+
514 } else if (lResult == ERROR_MORE_DATA) {
+
515 if (dwType == REG_SZ || dwType == REG_MULTI_SZ) {
+
516 // The value is REG_SZ or REG_MULTI_SZ. Read it now.
+
517 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[dwSize / sizeof(WCHAR)]);
+
518 if ((lResult = ::RegQueryValueExW(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
+
519 dwSize /= sizeof(WCHAR);
+
520 sValue.assign(szBuffer.get(), dwSize && szBuffer[dwSize - 1] == 0 ? dwSize - 1 : dwSize);
+
521 }
+
522 } else if (dwType == REG_EXPAND_SZ) {
+
523 // The value is REG_EXPAND_SZ. Read it and expand environment variables.
+
524 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[dwSize / sizeof(WCHAR)]);
+
525 if ((lResult = ::RegQueryValueExW(hReg, pszName, NULL, NULL, reinterpret_cast<LPBYTE>(szBuffer.get()), &dwSize)) == ERROR_SUCCESS) {
+
526 if (::ExpandEnvironmentStringsW(szBuffer.get(), sValue) == 0)
+
527 lResult = ::GetLastError();
+
528 }
+
529 } else {
+
530 // The value is not a string type.
+
531 lResult = ERROR_INVALID_DATA;
+
532 }
+
533 }
+
534
+
535 return lResult;
+
536}
+
537
+
539template<class _Ty, class _Ax>
+
540static LSTATUS RegQueryValueExA(_In_ HKEY hKey, _In_opt_z_ LPCSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
+
541{
+
542 LSTATUS lResult;
+
543 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
544 DWORD dwSize = sizeof(aStackBuffer);
+
545
+
546 // Try with stack buffer first.
+
547 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
+
548 if (lResult == ERROR_SUCCESS) {
+
549 // Copy from stack buffer.
+
550 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
551 memcpy(aData.data(), aStackBuffer, dwSize);
+
552 } else if (lResult == ERROR_MORE_DATA) {
+
553 // Allocate buffer on heap and retry.
+
554 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
555 lResult = RegQueryValueExA(hKey, lpValueName, lpReserved, NULL, reinterpret_cast<LPBYTE>(aData.data()), &dwSize);
+
556 }
+
557
+
558 return lResult;
+
559}
+
560
+
566template<class _Ty, class _Ax>
+
567static LSTATUS RegQueryValueExW(_In_ HKEY hKey, _In_opt_z_ LPCWSTR lpValueName, __reserved LPDWORD lpReserved, _Out_opt_ LPDWORD lpType, _Out_ std::vector<_Ty, _Ax> &aData) noexcept
+
568{
+
569 LSTATUS lResult;
+
570 BYTE aStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
571 DWORD dwSize = sizeof(aStackBuffer);
+
572
+
573 // Try with stack buffer first.
+
574 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, aStackBuffer, &dwSize);
+
575 if (lResult == ERROR_SUCCESS) {
+
576 // Copy from stack buffer.
+
577 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
578 memcpy(aData.data(), aStackBuffer, dwSize);
+
579 } else if (lResult == ERROR_MORE_DATA) {
+
580 // Allocate buffer on heap and retry.
+
581 aData.resize((dwSize + sizeof(_Ty) - 1) / sizeof(_Ty));
+
582 lResult = RegQueryValueExW(hKey, lpValueName, lpReserved, NULL, reinterpret_cast<LPBYTE>(aData.data()), &dwSize);
+
583 }
+
584
+
585 return lResult;
+
586}
+
587
+
588#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
+
589
+
591template<class _Traits, class _Ax>
+
592static 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
+
593{
+
594 // According to "Remarks" section in MSDN documentation of RegLoadMUIString(),
+
595 // this function is defined but not implemented as ANSI variation.
+
596 assert(0);
+
597 return ERROR_CALL_NOT_IMPLEMENTED;
+
598}
+
599
+
605template<class _Traits, class _Ax>
+
606static 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
+
607{
+
608 LSTATUS lResult;
+
609 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(wchar_t)];
+
610 DWORD dwSize;
+
611
+
612 Flags &= ~REG_MUI_STRING_TRUNCATE;
+
613
+
614 // Try with stack buffer first.
+
615 lResult = RegLoadMUIStringW(hKey, pszValue, szStackBuffer, sizeof(szStackBuffer), &dwSize, Flags, pszDirectory);
+
616 if (lResult == ERROR_SUCCESS) {
+
617 // Copy from stack buffer.
+
618 sOut.assign(szStackBuffer, wcsnlen(szStackBuffer, dwSize/sizeof(wchar_t)));
+
619 } else if (lResult == ERROR_MORE_DATA) {
+
620 // Allocate buffer on heap and retry.
+
621 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[(dwSize + sizeof(wchar_t) - 1)/sizeof(wchar_t)]);
+
622 sOut.assign(szBuffer.get(), (lResult = RegLoadMUIStringW(hKey, pszValue, szBuffer.get(), dwSize, &dwSize, Flags, pszDirectory)) == ERROR_SUCCESS ? wcsnlen(szBuffer.get(), dwSize/sizeof(wchar_t)) : 0);
+
623 }
+
624
+
625 return lResult;
+
626}
+
627
+
628#endif
+
629
+
635template<class _Traits, class _Ax>
+
636static _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
+
637{
+
638 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
639
+
640 // Try to convert to stack buffer first.
+
641 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
642 if (cch) {
+
643 // Copy from stack. Be careful not to include zero terminator.
+
644 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
645 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
646 // Query the required output size. Allocate buffer. Then convert again.
+
647 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
648 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
+
649 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
+
650 sMultiByteStr.assign(szBuffer.get(), cchWideChar != -1 ? strnlen(szBuffer.get(), cch) : (size_t)cch - 1);
+
651 }
+
652
+
653 return cch;
+
654}
+
655
+
661template<class _Ax>
+
662static _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
+
663{
+
664 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
665
+
666 // Try to convert to stack buffer first.
+
667 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
668 if (cch) {
+
669 // Copy from stack.
+
670 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
+
671 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
672 // Query the required output size. Allocate buffer. Then convert again.
+
673 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
674 sMultiByteStr.resize(cch);
+
675 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
+
676 }
+
677
+
678 return cch;
+
679}
+
680
+
686template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
687static _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
+
688{
+
689 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
690
+
691 // Try to convert to stack buffer first.
+
692 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
693 if (cch) {
+
694 // Copy from stack.
+
695 sMultiByteStr.assign(szStackBuffer, cch);
+
696 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
697 // Query the required output size. Allocate buffer. Then convert again.
+
698 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
699 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
+
700 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
+
701 sMultiByteStr.assign(szBuffer.get(), cch);
+
702 }
+
703
+
704 return cch;
+
705}
+
706
+
714template<class _Traits, class _Ax>
+
715static _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
+
716{
+
717 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
718
+
719 // Try to convert to stack buffer first.
+
720 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
721 if (cch) {
+
722 // Copy from stack. Be careful not to include zero terminator.
+
723 sMultiByteStr.assign(szStackBuffer, cchWideChar != -1 ? strnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
724 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
725 // Query the required output size. Allocate buffer. Then convert again.
+
726 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
727 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
+
728 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
+
729 sMultiByteStr.assign(szBuffer.get(), cchWideChar != -1 ? strnlen(szBuffer.get(), cch) : (size_t)cch - 1);
+
730 SecureZeroMemory(szBuffer.get(), sizeof(CHAR)*cch);
+
731 }
+
732
+
733 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
734
+
735 return cch;
+
736}
+
737
+
745template<class _Ax>
+
746static _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
+
747{
+
748 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
749
+
750 // Try to convert to stack buffer first.
+
751 int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
752 if (cch) {
+
753 // Copy from stack.
+
754 sMultiByteStr.assign(szStackBuffer, szStackBuffer + cch);
+
755 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
756 // Query the required output size. Allocate buffer. Then convert again.
+
757 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
758 sMultiByteStr.resize(cch);
+
759 cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, sMultiByteStr.data(), cch, lpDefaultChar, lpUsedDefaultChar);
+
760 }
+
761
+
762 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
763
+
764 return cch;
+
765}
+
766
+
774template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
775static _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
+
776{
+
777 CHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(CHAR)];
+
778
+
779 // Try to convert to stack buffer first.
+
780 int cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar);
+
781 if (cch) {
+
782 // Copy from stack.
+
783 sMultiByteStr.assign(szStackBuffer, cch);
+
784 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
785 // Query the required output size. Allocate buffer. Then convert again.
+
786 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), NULL, 0, lpDefaultChar, lpUsedDefaultChar);
+
787 std::unique_ptr<CHAR[]> szBuffer(new CHAR[cch]);
+
788 cch = ::WideCharToMultiByte(CodePage, dwFlags, sWideCharStr.c_str(), (int)sWideCharStr.length(), szBuffer.get(), cch, lpDefaultChar, lpUsedDefaultChar);
+
789 sMultiByteStr.assign(szBuffer.get(), cch);
+
790 SecureZeroMemory(szBuffer.get(), sizeof(CHAR)*cch);
+
791 }
+
792
+
793 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
794
+
795 return cch;
+
796}
+
797
+
803template<class _Traits, class _Ax>
+
804static _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
+
805{
+
806 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
807
+
808 // Try to convert to stack buffer first.
+
809 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
810 if (cch) {
+
811 // Copy from stack.
+
812 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
813 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
814 // Query the required output size. Allocate buffer. Then convert again.
+
815 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
816 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
817 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szBuffer.get(), cch);
+
818 sWideCharStr.assign(szBuffer.get(), cbMultiByte != -1 ? wcsnlen(szBuffer.get(), cch) : (size_t)cch - 1);
+
819 }
+
820
+
821 return cch;
+
822}
+
823
+
829template<class _Ax>
+
830static _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
+
831{
+
832 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
833
+
834 // Try to convert to stack buffer first.
+
835 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
836 if (cch) {
+
837 // Copy from stack.
+
838 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
+
839 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
840 // Query the required output size. Allocate buffer. Then convert again.
+
841 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
842 sWideCharStr.resize(cch);
+
843 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
+
844 }
+
845
+
846 return cch;
+
847}
+
848
+
854template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
855static _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
+
856{
+
857 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
858
+
859 // Try to convert to stack buffer first.
+
860 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
+
861 if (cch) {
+
862 // Copy from stack.
+
863 sWideCharStr.assign(szStackBuffer, cch);
+
864 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
865 // Query the required output size. Allocate buffer. Then convert again.
+
866 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
+
867 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
868 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szBuffer.get(), cch);
+
869 sWideCharStr.assign(szBuffer.get(), cch);
+
870 }
+
871
+
872 return cch;
+
873}
+
874
+
882template<class _Traits, class _Ax>
+
883static _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
+
884{
+
885 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
886
+
887 // Try to convert to stack buffer first.
+
888 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
889 if (cch) {
+
890 // Copy from stack.
+
891 sWideCharStr.assign(szStackBuffer, cbMultiByte != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
892 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
893 // Query the required output size. Allocate buffer. Then convert again.
+
894 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
895 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
896 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szBuffer.get(), cch);
+
897 sWideCharStr.assign(szBuffer.get(), cbMultiByte != -1 ? wcsnlen(szBuffer.get(), cch) : (size_t)cch - 1);
+
898 SecureZeroMemory(szBuffer.get(), sizeof(WCHAR)*cch);
+
899 }
+
900
+
901 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
902
+
903 return cch;
+
904}
+
905
+
913template<class _Ax>
+
914static _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
+
915{
+
916 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
917
+
918 // Try to convert to stack buffer first.
+
919 int cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, szStackBuffer, _countof(szStackBuffer));
+
920 if (cch) {
+
921 // Copy from stack.
+
922 sWideCharStr.assign(szStackBuffer, szStackBuffer + cch);
+
923 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
924 // Query the required output size. Allocate buffer. Then convert again.
+
925 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, NULL, 0);
+
926 sWideCharStr.resize(cch);
+
927 cch = ::MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, sWideCharStr.data(), cch);
+
928 }
+
929
+
930 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
931
+
932 return cch;
+
933}
+
934
+
942template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
943static _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
+
944{
+
945 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
946
+
947 // Try to convert to stack buffer first.
+
948 int cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szStackBuffer, _countof(szStackBuffer));
+
949 if (cch) {
+
950 // Copy from stack.
+
951 sWideCharStr.assign(szStackBuffer, cch);
+
952 } else if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
953 // Query the required output size. Allocate buffer. Then convert again.
+
954 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), NULL, 0);
+
955 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
956 cch = ::MultiByteToWideChar(CodePage, dwFlags, sMultiByteStr.c_str(), (int)sMultiByteStr.length(), szBuffer.get(), cch);
+
957 sWideCharStr.assign(szBuffer.get(), cch);
+
958 SecureZeroMemory(szBuffer.get(), sizeof(WCHAR)*cch);
+
959 }
+
960
+
961 SecureZeroMemory(szStackBuffer, sizeof(szStackBuffer));
+
962
+
963 return cch;
+
964}
+
965
+
971template<class _Traits, class _Ax>
+
972static _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
+
973{
+
974 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
975
+
976 // Try to convert to stack buffer first.
+
977 int cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szStackBuffer, _countof(szStackBuffer));
+
978 if (cch > 0) {
+
979 // Copy from stack.
+
980 sDstString.assign(szStackBuffer, cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
981 } else {
+
982 switch (::GetLastError()) {
+
983 case ERROR_INSUFFICIENT_BUFFER:
+
984 for (int i = 10; i--;) {
+
985 // Allocate buffer. Then convert again.
+
986 cch = -cch;
+
987 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
988 cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szBuffer.get(), cch);
+
989 if (cch > 0) {
+
990 sDstString.assign(szBuffer.get(), cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
+
991 break;
+
992 }
+
993 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+
994 sDstString.clear();
+
995 break;
+
996 }
+
997 }
+
998 break;
+
999
+
1000 case ERROR_SUCCESS:
+
1001 sDstString.clear();
+
1002 break;
+
1003 }
+
1004 }
+
1005
+
1006 return cch;
+
1007}
+
1008
+
1014template<class _Traits1, class _Ax1, class _Traits2, class _Ax2>
+
1015static _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
+
1016{
+
1017 WCHAR szStackBuffer[WINSTD_STACK_BUFFER_BYTES/sizeof(WCHAR)];
+
1018
+
1019 // Try to convert to stack buffer first.
+
1020 int cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), szStackBuffer, _countof(szStackBuffer));
+
1021 if (cch > 0) {
+
1022 // Copy from stack.
+
1023 sDstString.assign(szStackBuffer, cch);
+
1024 } else {
+
1025 switch (::GetLastError()) {
+
1026 case ERROR_INSUFFICIENT_BUFFER:
+
1027 for (int i = 10; i--;) {
+
1028 // Allocate buffer. Then convert again.
+
1029 cch = -cch;
+
1030 std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
+
1031 cch = ::NormalizeString(NormForm, sSrcString.c_str(), (int)sSrcString.length(), szBuffer.get(), cch);
+
1032 if (cch > 0) {
+
1033 sDstString.assign(szBuffer.get(), cch);
+
1034 break;
+
1035 }
+
1036 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+
1037 sDstString.clear();
+
1038 break;
+
1039 }
+
1040 }
+
1041 break;
+
1042
+
1043 case ERROR_SUCCESS:
+
1044 sDstString.clear();
+
1045 break;
+
1046 }
+
1047 }
+
1048
+
1049 return cch;
+
1050}
+
1051
+
1053template<class _Traits, class _Ax>
+
1054static _Success_(return != 0) int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<char, _Traits, _Ax> &sBuffer) noexcept
+
1055{
+
1056 // Get read-only pointer to string resource.
+
1057 LPCSTR pszStr;
+
1058 int i = LoadStringA(hInstance, uID, reinterpret_cast<LPSTR>(&pszStr), 0);
+
1059 if (i) {
+
1060 sBuffer.assign(pszStr, i);
+
1061 return i;
+
1062 } else
+
1063 return 0;
+
1064}
+
1065
+
1071template<class _Traits, class _Ax>
+
1072static _Success_(return != 0) int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sBuffer) noexcept
+
1073{
+
1074 // Get read-only pointer to string resource.
+
1075 LPCWSTR pszStr;
+
1076 int i = LoadStringW(hInstance, uID, reinterpret_cast<LPWSTR>(&pszStr), 0);
+
1077 if (i) {
+
1078 sBuffer.assign(pszStr, i);
+
1079 return i;
+
1080 } else
+
1081 return 0;
+
1082}
+
1083
+
1089static VOID OutputDebugStrV(_In_z_ LPCSTR lpOutputString, _In_ va_list arg) noexcept
+
1090{
+
1091 std::string str;
+
1092 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
+
1093 OutputDebugStringA(str.c_str());
+
1094}
+
1095
+
1101static VOID OutputDebugStrV(_In_z_ LPCWSTR lpOutputString, _In_ va_list arg) noexcept
+
1102{
+
1103 std::wstring str;
+
1104 try { vsprintf(str, lpOutputString, arg); } catch (...) { return; }
+
1105 OutputDebugStringW(str.c_str());
+
1106}
+
1107
+
1113static VOID OutputDebugStr(_In_z_ LPCSTR lpOutputString, ...) noexcept
+
1114{
+
1115 va_list arg;
+
1116 va_start(arg, lpOutputString);
+
1117 OutputDebugStrV(lpOutputString, arg);
+
1118 va_end(arg);
+
1119}
+
1120
+
1126static VOID OutputDebugStr(_In_z_ LPCWSTR lpOutputString, ...) noexcept
+
1127{
+
1128 va_list arg;
+
1129 va_start(arg, lpOutputString);
+
1130 OutputDebugStrV(lpOutputString, arg);
+
1131 va_end(arg);
+
1132}
+
1133
+
1135template<class _Traits, class _Ax>
+
1136static _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
+
1137{
+
1138 int iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
+
1139 if (iResult) {
+
1140 // Allocate buffer on heap and retry.
+
1141 std::unique_ptr<char[]> szBuffer(new char[iResult]);
+
1142 iResult = GetDateFormatA(Locale, dwFlags, lpDate, lpFormat, szBuffer.get(), iResult);
+
1143 sDate.assign(szBuffer.get(), iResult ? iResult - 1 : 0);
+
1144 return iResult;
+
1145 }
+
1146
+
1147 return iResult;
+
1148}
+
1149
+
1155template<class _Traits, class _Ax>
+
1156static _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
+
1157{
+
1158 int iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, NULL, 0);
+
1159 if (iResult) {
+
1160 // Allocate buffer on heap and retry.
+
1161 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[iResult]);
+
1162 iResult = GetDateFormatW(Locale, dwFlags, lpDate, lpFormat, szBuffer.get(), iResult);
+
1163 sDate.assign(szBuffer.get(), iResult ? iResult - 1 : 0);
+
1164 return iResult;
+
1165 }
+
1166
+
1167 return iResult;
+
1168}
+
1169
+
1171template<class _Traits, class _Ax>
+
1172static _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
+
1173{
+
1174 assert(0); // TODO: Test this code.
+
1175
+
1176 DWORD dwNameLen = 0, dwRefDomainLen = 0;
+
1177
+
1178 if (LookupAccountSidA(lpSystemName, lpSid,
+
1179 NULL, &dwNameLen ,
+
1180 NULL, &dwRefDomainLen,
+
1181 peUse))
+
1182 {
+
1183 // Name and domain is blank.
+
1184 if (sName ) sName ->clear();
+
1185 if (sReferencedDomainName) sReferencedDomainName->clear();
+
1186 return TRUE;
+
1187 } else if (GetLastError() == ERROR_MORE_DATA) {
+
1188 // Allocate on heap and retry.
+
1189 std::unique_ptr<char[]> bufName (new char[dwNameLen ]);
+
1190 std::unique_ptr<char[]> bufRefDomain(new char[dwRefDomainLen]);
+
1191 if (LookupAccountSidA(lpSystemName, lpSid,
+
1192 bufName .get(), &dwNameLen ,
+
1193 bufRefDomain.get(), &dwRefDomainLen,
+
1194 peUse))
+
1195 {
+
1196 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
+
1197 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
+
1198 return TRUE;
+
1199 }
+
1200 }
+
1201
+
1202 return FALSE;
+
1203}
+
1204
+
1210template<class _Traits, class _Ax>
+
1211static _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
+
1212{
+
1213 assert(0); // TODO: Test this code.
+
1214
+
1215 DWORD dwNameLen = 0, dwRefDomainLen = 0;
+
1216
+
1217 if (LookupAccountSidW(lpSystemName, lpSid,
+
1218 NULL, &dwNameLen ,
+
1219 NULL, &dwRefDomainLen,
+
1220 peUse))
+
1221 {
+
1222 // Name and domain is blank.
+
1223 if (sName ) sName ->clear();
+
1224 if (sReferencedDomainName) sReferencedDomainName->clear();
+
1225 return TRUE;
+
1226 } else if (GetLastError() == ERROR_MORE_DATA) {
+
1227 // Allocate on heap and retry.
+
1228 std::unique_ptr<wchar_t[]> bufName (new wchar_t[dwNameLen ]);
+
1229 std::unique_ptr<wchar_t[]> bufRefDomain(new wchar_t[dwRefDomainLen]);
+
1230 if (LookupAccountSidW(lpSystemName, lpSid,
+
1231 bufName .get(), &dwNameLen ,
+
1232 bufRefDomain.get(), &dwRefDomainLen,
+
1233 peUse))
+
1234 {
+
1235 if (sName ) sName ->assign(bufName .get(), dwNameLen - 1);
+
1236 if (sReferencedDomainName) sReferencedDomainName->assign(bufRefDomain.get(), dwRefDomainLen - 1);
+
1237 return TRUE;
+
1238 }
+
1239 }
+
1240
+
1241 return FALSE;
+
1242}
+
1243
+
1249static _Success_(return != FALSE) BOOL CreateWellKnownSid(_In_ WELL_KNOWN_SID_TYPE WellKnownSidType, _In_opt_ PSID DomainSid, _Inout_ std::unique_ptr<SID> &Sid)
+
1250{
+
1251 BYTE szStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
1252 DWORD dwSize = sizeof(szStackBuffer);
+
1253
+
1254 if (CreateWellKnownSid(WellKnownSidType, DomainSid, szStackBuffer, &dwSize)) {
+
1255 // The stack buffer was big enough to retrieve complete data. Alloc and copy.
+
1256 Sid.reset((SID*)new BYTE[dwSize]);
+
1257 memcpy(Sid.get(), szStackBuffer, dwSize);
+
1258 return TRUE;
+
1259 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
1260 // The stack buffer was too small to retrieve complete data. Alloc and retry.
+
1261 Sid.reset((SID*)new BYTE[dwSize]);
+
1262 return CreateWellKnownSid(WellKnownSidType, DomainSid, Sid.get(), &dwSize);
+
1263 } else
+
1264 return FALSE;
+
1265}
+
1266
+
1272template<class _Ty>
+
1273static _Success_(return != 0) BOOL GetTokenInformation(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_ std::unique_ptr<_Ty> &TokenInformation) noexcept
+
1274{
+
1275 BYTE szStackBuffer[WINSTD_STACK_BUFFER_BYTES];
+
1276 DWORD dwSize;
+
1277
+
1278 if (GetTokenInformation(TokenHandle, TokenInformationClass, szStackBuffer, sizeof(szStackBuffer), &dwSize)) {
+
1279 // The stack buffer was big enough to retrieve complete data. Alloc and copy.
+
1280 TokenInformation.reset((_Ty*)(new BYTE[dwSize]));
+
1281 memcpy(TokenInformation.get(), szStackBuffer, dwSize);
+
1282 return TRUE;
+
1283 } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
1284 // The stack buffer was too small to retrieve complete data. Alloc and retry.
+
1285 TokenInformation.reset((_Ty*)(new BYTE[dwSize]));
+
1286 return GetTokenInformation(TokenHandle, TokenInformationClass, TokenInformation.get(), dwSize, &dwSize);
+
1287 } else
+
1288 return FALSE;
+
1289}
+
1290
+
1296template<class _Traits, class _Ax>
+
1297static _Success_(return != 0) BOOL QueryFullProcessImageNameA(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<char, _Traits, _Ax>& sExeName)
+
1298{
+
1299 char szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(char)];
+
1300 DWORD dwSize = _countof(szStackBuffer);
+
1301
+
1302 // Try with stack buffer first.
+
1303 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szStackBuffer, &dwSize)) {
+
1304 // Copy from stack.
+
1305 sExeName.assign(szStackBuffer, dwSize);
+
1306 return TRUE;
+
1307 }
+
1308 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(char); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
+
1309 // Allocate on heap and retry.
+
1310 std::unique_ptr<char[]> szBuffer(new char[dwCapacity]);
+
1311 dwSize = dwCapacity;
+
1312 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szBuffer.get(), &dwSize)) {
+
1313 sExeName.assign(szBuffer.get(), dwSize);
+
1314 return TRUE;
+
1315 }
+
1316 }
+
1317 return FALSE;
+
1318}
+
1319
+
1325template<class _Traits, class _Ax>
+
1326static _Success_(return != 0) BOOL QueryFullProcessImageNameW(_In_ HANDLE hProcess, _In_ DWORD dwFlags, _Inout_ std::basic_string<wchar_t, _Traits, _Ax>& sExeName)
+
1327{
+
1328 wchar_t szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t)];
+
1329 DWORD dwSize = _countof(szStackBuffer);
+
1330
+
1331 // Try with stack buffer first.
+
1332 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szStackBuffer, &dwSize)) {
+
1333 // Copy from stack.
+
1334 sExeName.assign(szStackBuffer, dwSize);
+
1335 return TRUE;
+
1336 }
+
1337 for (DWORD dwCapacity = 2 * WINSTD_STACK_BUFFER_BYTES / sizeof(wchar_t); GetLastError() == ERROR_INSUFFICIENT_BUFFER; dwCapacity *= 2) {
+
1338 // Allocate on heap and retry.
+
1339 std::unique_ptr<wchar_t[]> szBuffer(new wchar_t[dwCapacity]);
+
1340 dwSize = dwCapacity;
+
1341 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szBuffer.get(), &dwSize)) {
+
1342 sExeName.assign(szBuffer.get(), dwSize);
+
1343 return TRUE;
+
1344 }
+
1345 }
+
1346 return FALSE;
+
1347}
+
1348
+
1350
+
1351#pragma warning(pop)
+
1352
+
1353namespace winstd
+
1354{
+
1357
+
1361 template<HANDLE INVALID>
+
1362 class win_handle : public handle<HANDLE, INVALID>
+
1363 {
+
1364 WINSTD_HANDLE_IMPL(win_handle, INVALID)
+
1365
+
1366 public:
+
1372 virtual ~win_handle()
+
1373 {
+
1374 if (m_h != invalid)
+
1375 free_internal();
+
1376 }
+
1377
+
1378 protected:
+
1384 void free_internal() noexcept override
+
1385 {
+
1386 CloseHandle(m_h);
+
1387 }
+
1388 };
+
1389
+
1395 class library : public handle<HMODULE, NULL>
+
1396 {
+
1397 WINSTD_HANDLE_IMPL(library, NULL)
+
1398
+
1399 public:
+
1405 virtual ~library()
+
1406 {
+
1407 if (m_h != invalid)
+
1408 free_internal();
+
1409 }
+
1410
+
1411 protected:
+
1417 void free_internal() noexcept override
+
1418 {
+
1419 FreeLibrary(m_h);
+
1420 }
+
1421 };
+
1422
+
1428 typedef win_handle<NULL> process;
+
1429
+
1435 typedef win_handle<NULL> thread;
+
1436
+
1442 typedef win_handle<INVALID_HANDLE_VALUE> process_snapshot;
+
1443
+
1450 typedef win_handle<INVALID_HANDLE_VALUE> file;
+
1451
+
1457 typedef win_handle<NULL> file_mapping;
+
1458
+
1462 template <class _Ty> struct UnmapViewOfFile_delete
+
1463 {
+
1464 typedef UnmapViewOfFile_delete<_Ty> _Myt;
+
1465
+
1469 UnmapViewOfFile_delete() {}
+
1470
+
1474 template <class _Ty2> UnmapViewOfFile_delete(const UnmapViewOfFile_delete<_Ty2>&) {}
+
1475
+
1479 void operator()(_Ty* _Ptr) const
+
1480 {
+
1481 if (!UnmapViewOfFile(_Ptr))
+
1482 throw win_runtime_error("UnmapViewOfFile failed");
+
1483 }
+
1484 };
+
1485
+
1489 template <class _Ty> struct UnmapViewOfFile_delete<_Ty[]>
+
1490 {
+
1491 typedef UnmapViewOfFile_delete<_Ty> _Myt;
+
1492
+
1496 UnmapViewOfFile_delete() {}
+
1497
+
1501 void operator()(_Ty* _Ptr) const
+
1502 {
+
1503 if (!UnmapViewOfFile(_Ptr))
+
1504 throw win_runtime_error("UnmapViewOfFile failed");
+
1505 }
+
1506
+
1510 template<class _Other>
+
1511 void operator()(_Other*) const
+
1512 {
+
1513 if (!UnmapViewOfFile(_Ptr))
+
1514 throw win_runtime_error("UnmapViewOfFile failed");
+
1515 }
+
1516 };
+
1517
+
1524 typedef win_handle<NULL> event;
+
1525
+
1529 class critical_section
+
1530 {
+
1531 WINSTD_NONCOPYABLE(critical_section)
+
1532 WINSTD_NONMOVABLE(critical_section)
+
1533
+
1534 public:
+
1540 critical_section() noexcept
+
1541 {
+
1542 InitializeCriticalSection(&m_data);
+
1543 }
+
1544
+
1550 virtual ~critical_section()
+
1551 {
+
1552 DeleteCriticalSection(&m_data);
+
1553 }
+
1554
+
1560 operator LPCRITICAL_SECTION() noexcept
+
1561 {
+
1562 return &m_data;
+
1563 }
+
1564
+
1565 protected:
+
1566 CRITICAL_SECTION m_data;
+
1567 };
+
1568
+
1574 class find_file : public handle<HANDLE, INVALID_HANDLE_VALUE>
+
1575 {
+
1576 WINSTD_HANDLE_IMPL(find_file, INVALID_HANDLE_VALUE)
+
1577
+
1578 public:
+
1584 virtual ~find_file()
+
1585 {
+
1586 if (m_h != invalid)
+
1587 free_internal();
+
1588 }
+
1589
+
1590 protected:
+
1596 void free_internal() noexcept override
+
1597 {
+
1598 FindClose(m_h);
+
1599 }
+
1600 };
+
1601
+
1607 class heap : public handle<HANDLE, NULL>
+
1608 {
+
1609 WINSTD_HANDLE_IMPL(heap, NULL)
+
1610
+
1611 public:
+
1617 virtual ~heap()
+
1618 {
+
1619 if (m_h != invalid)
+
1620 free_internal();
+
1621 }
+
1622
+
1630 bool enumerate() noexcept
+
1631 {
+
1632 assert(m_h != invalid);
+
1633
+
1634 bool found = false;
+
1635
+
1636 // Lock the heap for exclusive access.
+
1637 HeapLock(m_h);
+
1638
+
1639 PROCESS_HEAP_ENTRY e;
+
1640 e.lpData = NULL;
+
1641 while (HeapWalk(m_h, &e) != FALSE) {
+
1642 if ((e.wFlags & PROCESS_HEAP_ENTRY_BUSY) != 0) {
+
1643 OutputDebugStr(
+
1644 _T("Allocated block%s%s\n")
+
1645 _T(" Data portion begins at: %#p\n Size: %d bytes\n")
+
1646 _T(" Overhead: %d bytes\n Region index: %d\n"),
+
1647 (e.wFlags & PROCESS_HEAP_ENTRY_MOVEABLE) != 0 ? tstring_printf(_T(", movable with HANDLE %#p"), e.Block.hMem).c_str() : _T(""),
+
1648 (e.wFlags & PROCESS_HEAP_ENTRY_DDESHARE) != 0 ? _T(", DDESHARE") : _T(""),
+
1649 e.lpData,
+
1650 e.cbData,
+
1651 e.cbOverhead,
+
1652 e.iRegionIndex);
+
1653
+
1654 found = true;
+
1655 }
+
1656 }
+
1657
+
1658 const DWORD dwResult = GetLastError();
+
1659 if (dwResult != ERROR_NO_MORE_ITEMS)
+
1660 OutputDebugStr(_T("HeapWalk failed (error %u).\n"), dwResult);
+
1661
+
1662 // Unlock the heap.
+
1663 HeapUnlock(m_h);
+
1664
+
1665 return found;
+
1666 }
+
1667
+
1668 protected:
+
1674 void free_internal() noexcept override
+
1675 {
+
1676 enumerate();
+
1677 HeapDestroy(m_h);
+
1678 }
+
1679 };
+
1680
+
1684 template <class _Ty>
+
1685 class heap_allocator
+
1686 {
+
1687 public:
+
1688 typedef typename _Ty value_type;
+
1689
+
1690 typedef _Ty *pointer;
+
1691 typedef _Ty& reference;
+
1692 typedef const _Ty *const_pointer;
+
1693 typedef const _Ty& const_reference;
+
1694
+
1695 typedef SIZE_T size_type;
+
1696 typedef ptrdiff_t difference_type;
+
1697
+
1701 template <class _Other>
+
1702 struct rebind
+
1703 {
+
1704 typedef heap_allocator<_Other> other;
+
1705 };
+
1706
+
1707 public:
+
1713 heap_allocator(_In_ HANDLE heap) : m_heap(heap)
+
1714 {
+
1715 }
+
1716
+
1722 template <class _Other>
+
1723 heap_allocator(_In_ const heap_allocator<_Other> &other) : m_heap(other.m_heap)
+
1724 {
+
1725 }
+
1726
+
1734 pointer allocate(_In_ size_type count)
+
1735 {
+
1736 assert(m_heap);
+
1737 return (pointer)HeapAlloc(m_heap, 0, count * sizeof(_Ty));
+
1738 }
+
1739
+
1746 void deallocate(_In_ pointer ptr, _In_ size_type size)
+
1747 {
+
1748 UNREFERENCED_PARAMETER(size);
+
1749 assert(m_heap);
+
1750 HeapFree(m_heap, 0, ptr);
+
1751 }
+
1752
+
1759 void construct(_Inout_ pointer ptr, _In_ const _Ty& val)
+
1760 {
+
1761 ::new ((void*)ptr) _Ty(val);
+
1762 }
+
1763
+
1770 void construct(_Inout_ pointer ptr, _Inout_ _Ty&& val)
+
1771 {
+
1772 ::new ((void*)ptr) _Ty(std::forward<_Ty>(val));
+
1773 }
+
1774
+
1780 void destroy(_Inout_ pointer ptr)
+
1781 {
+
1782 ptr->_Ty::~_Ty();
+
1783 }
+
1784
+
1788 size_type max_size() const
+
1789 {
+
1790 return (SIZE_T)-1;
+
1791 }
+
1792
+
1793 public:
+
1794 HANDLE m_heap;
+
1795 };
+
1796
+
1800 class actctx_activator
+
1801 {
+
1802 WINSTD_NONCOPYABLE(actctx_activator)
+
1803 WINSTD_NONMOVABLE(actctx_activator)
+
1804
+
1805 public:
+
1813 actctx_activator(_In_ HANDLE hActCtx) noexcept
+
1814 {
+
1815 if (!ActivateActCtx(hActCtx, &m_cookie))
+
1816 m_cookie = 0;
+
1817 }
+
1818
+
1824 virtual ~actctx_activator()
+
1825 {
+
1826 if (m_cookie)
+
1827 DeactivateActCtx(0, m_cookie);
+
1828 }
+
1829
+
1830 protected:
+
1831 ULONG_PTR m_cookie;
+
1832 };
+
1833
+
1837 class impersonator
+
1838 {
+
1839 public:
+
1843 impersonator() noexcept : m_cookie(FALSE) {}
+
1844
+
1850 virtual ~impersonator()
+
1851 {
+
1852 if (m_cookie)
+
1853 RevertToSelf();
+
1854 }
+
1855
+
1859 operator bool () const { return m_cookie; }
+
1860
+
1861 protected:
+
1862 BOOL m_cookie;
+
1863 };
+
1864
+
1868 class user_impersonator : public impersonator
+
1869 {
+
1870 WINSTD_NONCOPYABLE(user_impersonator)
+
1871 WINSTD_NONMOVABLE(user_impersonator)
+
1872
+
1873 public:
+
1881 user_impersonator(_In_opt_ HANDLE hToken) noexcept
+
1882 {
+
1883 m_cookie = hToken && ImpersonateLoggedOnUser(hToken);
+
1884 }
+
1885 };
+
1886
+
1890 class system_impersonator : public impersonator
+
1891 {
+
1892 WINSTD_NONCOPYABLE(system_impersonator)
+
1893 WINSTD_NONMOVABLE(system_impersonator)
+
1894
+
1895 public:
+
1899 system_impersonator() noexcept
+
1900 {
+
1901 TOKEN_PRIVILEGES privileges = { 1, {{{ 0, 0 }, SE_PRIVILEGE_ENABLED }} };
+
1902 if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &privileges.Privileges[0].Luid) ||
+
1903 !ImpersonateSelf(SecurityImpersonation))
+
1904 return;
+
1905
+
1906 {
+
1907 HANDLE h;
+
1908 if (!OpenThreadToken(GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES, FALSE, &h))
+
1909 goto revert;
+
1910 win_handle<INVALID_HANDLE_VALUE> thread_token(h);
+
1911 if (!AdjustTokenPrivileges(thread_token, FALSE, &privileges, sizeof(privileges), NULL, NULL))
+
1912 goto revert;
+
1913 process_snapshot process_snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+
1914 if (!process_snapshot)
+
1915 goto revert;
+
1916 PROCESSENTRY32 entry = { sizeof(PROCESSENTRY32) };
+
1917 if (!Process32First(process_snapshot, &entry))
+
1918 goto revert;
+
1919 while (_tcsicmp(entry.szExeFile, TEXT("winlogon.exe")) != 0)
+
1920 if (!Process32Next(process_snapshot, &entry))
+
1921 goto revert;
+
1922 process winlogon_process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, entry.th32ProcessID);
+
1923 if (!winlogon_process)
+
1924 goto revert;
+
1925 if (!OpenProcessToken(winlogon_process, TOKEN_IMPERSONATE | TOKEN_DUPLICATE, &h))
+
1926 goto revert;
+
1927 win_handle<INVALID_HANDLE_VALUE> winlogon_token(h);
+
1928 if (!DuplicateToken(winlogon_token, SecurityImpersonation, &h))
+
1929 goto revert;
+
1930 win_handle<INVALID_HANDLE_VALUE> duplicated_token(h);
+
1931 if (!SetThreadToken(NULL, duplicated_token))
+
1932 goto revert;
+
1933 }
+
1934
+
1935 m_cookie = TRUE;
+
1936 return;
+
1937
+
1938 revert:
+
1939 DWORD dwResult = GetLastError();
+
1940 RevertToSelf();
+
1941 SetLastError(dwResult);
+
1942 }
+
1943 };
+
1944
+
1948 class console_ctrl_handler
+
1949 {
+
1950 WINSTD_NONCOPYABLE(console_ctrl_handler)
+
1951 WINSTD_NONMOVABLE(console_ctrl_handler)
+
1952
+
1953 public:
+
1961 console_ctrl_handler(_In_opt_ PHANDLER_ROUTINE HandlerRoutine) noexcept : m_handler(HandlerRoutine)
+
1962 {
+
1963 m_cookie = SetConsoleCtrlHandler(m_handler, TRUE);
+
1964 }
+
1965
+
1971 virtual ~console_ctrl_handler()
+
1972 {
+
1973 if (m_cookie)
+
1974 SetConsoleCtrlHandler(m_handler, FALSE);
+
1975 }
+
1976
+
1977 protected:
+
1978 BOOL m_cookie;
+
1979 PHANDLER_ROUTINE m_handler;
+
1980 };
+
1981
+
1985 class vmemory : public handle<LPVOID, NULL>
+
1986 {
+
1987 WINSTD_NONCOPYABLE(vmemory)
+
1988
+
1989 public:
+
1993 vmemory() noexcept : m_proc(NULL)
+
1994 {
+
1995 }
+
1996
+
2003 vmemory(_In_ handle_type h, _In_ HANDLE proc) noexcept :
+
2004 m_proc(proc),
+
2005 handle<LPVOID, NULL>(h)
+
2006 {
+
2007 }
+
2008
+
2014 vmemory(_Inout_ vmemory &&h) noexcept :
+
2015 m_proc(std::move(h.m_proc)),
+
2016 handle<LPVOID, NULL>(std::move(h))
+
2017 {
+
2018 }
+
2019
+
2025 virtual ~vmemory()
+
2026 {
+
2027 if (m_h != invalid)
+
2028 VirtualFreeEx(m_proc, m_h, 0, MEM_RELEASE);
+
2029 }
+
2030
+
2036 vmemory& operator=(_Inout_ vmemory &&other) noexcept
+
2037 {
+
2038 if (this != std::addressof(other)) {
+
2039 (handle<handle_type, NULL>&&)*this = std::move(other);
+
2040 m_proc = std::move(other.m_proc);
+
2041 }
+
2042 return *this;
+
2043 }
+
2044
+
2053 void attach(_In_ HANDLE proc, _In_opt_ handle_type h) noexcept
+
2054 {
+
2055 m_proc = proc;
+
2056 if (m_h != invalid)
+
2057 free_internal();
+
2058 m_h = h;
+
2059 }
+
2060
+
2070 bool alloc(
+
2071 _In_ HANDLE hProcess,
+
2072 _In_opt_ LPVOID lpAddress,
+
2073 _In_ SIZE_T dwSize,
+
2074 _In_ DWORD flAllocationType,
+
2075 _In_ DWORD flProtect) noexcept
+
2076 {
+
2077 handle_type h = VirtualAllocEx(hProcess, lpAddress, dwSize, flAllocationType, flProtect);
+
2078 if (h != invalid) {
+
2079 attach(hProcess, h);
+
2080 return true;
+
2081 } else
+
2082 return false;
+
2083 }
+
2084
+
2085 protected:
+
2091 void free_internal() noexcept override
+
2092 {
+
2093 VirtualFreeEx(m_proc, m_h, 0, MEM_RELEASE);
+
2094 }
+
2095
+
2096 protected:
+
2097 HANDLE m_proc;
+
2098 };
+
2099
+
2106 class reg_key : public handle<HKEY, NULL>
+
2107 {
+
2108 WINSTD_HANDLE_IMPL(reg_key, NULL)
+
2109
+
2110 public:
+
2116 virtual ~reg_key()
+
2117 {
+
2118 if (m_h != invalid)
+
2119 free_internal();
+
2120 }
+
2121
+
2131 bool delete_subkey(_In_z_ LPCTSTR szSubkey)
+
2132 {
+
2133 LSTATUS s;
+
2134
+
2135 s = RegDeleteKey(m_h, szSubkey);
+
2136 if (s == ERROR_SUCCESS || s == ERROR_FILE_NOT_FOUND)
+
2137 return true;
+
2138
+
2139 {
+
2140 reg_key k;
+
2141 handle_type h;
+
2142 s = RegOpenKeyEx(m_h, szSubkey, 0, KEY_ENUMERATE_SUB_KEYS, &h);
+
2143 if (s == ERROR_SUCCESS)
+
2144 k.attach(h);
+
2145 else {
+
2146 SetLastError(s);
+
2147 return false;
+
2148 }
+
2149 for (;;) {
+
2150 TCHAR szName[MAX_PATH];
+
2151 DWORD dwSize = _countof(szName);
+
2152 s = RegEnumKeyEx(k, 0, szName, &dwSize, NULL, NULL, NULL, NULL);
+
2153 if (s == ERROR_SUCCESS)
+
2154 k.delete_subkey(szName);
+
2155 else if (s == ERROR_NO_MORE_ITEMS)
+
2156 break;
+
2157 else {
+
2158 SetLastError(s);
+
2159 return false;
+
2160 }
+
2161 }
+
2162 }
+
2163
+
2164 s = RegDeleteKey(m_h, szSubkey);
+
2165 if (s == ERROR_SUCCESS)
+
2166 return true;
+
2167 else {
+
2168 SetLastError(s);
+
2169 return false;
+
2170 }
+
2171 }
+
2172
+
2173 protected:
+
2179 void free_internal() noexcept override
+
2180 {
+
2181 RegCloseKey(m_h);
+
2182 }
+
2183 };
+
2184
+
2188 class security_id : public handle<PSID, NULL>
+
2189 {
+
2190 WINSTD_HANDLE_IMPL(security_id, NULL)
+
2191
+
2192 public:
+
2198 virtual ~security_id()
+
2199 {
+
2200 if (m_h != invalid)
+
2201 free_internal();
+
2202 }
+
2203
+
2204 protected:
+
2210 void free_internal() noexcept override
+
2211 {
+
2212 FreeSid(m_h);
+
2213 }
+
2214 };
+
2215
+
2219 class process_information : public PROCESS_INFORMATION
+
2220 {
+
2221 WINSTD_NONCOPYABLE(process_information)
+
2222 WINSTD_NONMOVABLE(process_information)
+
2223
+
2224 public:
+
2228 process_information() noexcept
+
2229 {
+
2230 hProcess = INVALID_HANDLE_VALUE;
+
2231 hThread = INVALID_HANDLE_VALUE;
+
2232 dwProcessId = 0;
+
2233 dwThreadId = 0;
+
2234 }
+
2235
+
2239 ~process_information()
+
2240 {
+
2241 #pragma warning(push)
+
2242 #pragma warning(disable: 6001) // Using uninitialized memory '*this'. << ???
+
2243
+
2244 if (hProcess != INVALID_HANDLE_VALUE)
+
2245 CloseHandle(hProcess);
+
2246
+
2247 if (hThread != INVALID_HANDLE_VALUE)
+
2248 CloseHandle(hThread);
+
2249
+
2250 #pragma warning(pop)
+
2251 }
+
2252 };
+
2253
+
2259 class event_log : public handle<HANDLE, NULL>
+
2260 {
+
2261 WINSTD_HANDLE_IMPL(event_log, NULL)
+
2262
+
2263 public:
+
2269 virtual ~event_log()
+
2270 {
+
2271 if (m_h != invalid)
+
2272 free_internal();
+
2273 }
+
2274
+
2275 protected:
+
2281 void free_internal() noexcept override
+
2282 {
+
2283 DeregisterEventSource(m_h);
+
2284 }
+
2285 };
+
2286
+
2290 class sc_handle : public handle<SC_HANDLE, NULL>
+
2291 {
+
2292 WINSTD_HANDLE_IMPL(sc_handle, NULL)
+
2293
+
2294 public:
+
2300 virtual ~sc_handle()
+
2301 {
+
2302 if (m_h != invalid)
+
2303 free_internal();
+
2304 }
+
2305
+
2306 protected:
+
2312 void free_internal() noexcept override
+
2313 {
+
2314 CloseServiceHandle(m_h);
+
2315 }
+
2316 };
+
2317
+
2319}
+
2320
+
2323
+
2324#pragma warning(push)
+
2325#pragma warning(disable: 4505) // Don't warn on unused code
+
2326
+
2328static LSTATUS RegCreateKeyExA(
+
2329 _In_ HKEY hKey,
+
2330 _In_ LPCSTR lpSubKey,
+
2331 _Reserved_ DWORD Reserved,
+
2332 _In_opt_ LPSTR lpClass,
+
2333 _In_ DWORD dwOptions,
+
2334 _In_ REGSAM samDesired,
+
2335 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+
2336 _Inout_ winstd::reg_key &result,
+
2337 _Out_opt_ LPDWORD lpdwDisposition)
+
2338{
+
2339 HKEY h;
+
2340 LSTATUS s = RegCreateKeyExA(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
+
2341 if (s == ERROR_SUCCESS)
+
2342 result.attach(h);
+
2343 return s;
+
2344}
+
2345
+
2351static LSTATUS RegCreateKeyExW(
+
2352 _In_ HKEY hKey,
+
2353 _In_ LPCWSTR lpSubKey,
+
2354 _Reserved_ DWORD Reserved,
+
2355 _In_opt_ LPWSTR lpClass,
+
2356 _In_ DWORD dwOptions,
+
2357 _In_ REGSAM samDesired,
+
2358 _In_opt_ CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+
2359 _Inout_ winstd::reg_key &result,
+
2360 _Out_opt_ LPDWORD lpdwDisposition)
+
2361{
+
2362 HKEY h;
+
2363 LSTATUS s = RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, &h, lpdwDisposition);
+
2364 if (s == ERROR_SUCCESS)
+
2365 result.attach(h);
+
2366 return s;
+
2367}
+
2368
+
2370static LSTATUS RegOpenKeyExA(
+
2371 _In_ HKEY hKey,
+
2372 _In_opt_ LPCSTR lpSubKey,
+
2373 _In_opt_ DWORD ulOptions,
+
2374 _In_ REGSAM samDesired,
+
2375 _Inout_ winstd::reg_key &result)
+
2376{
+
2377 HKEY h;
+
2378 LSTATUS s = RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, &h);
+
2379 if (s == ERROR_SUCCESS)
+
2380 result.attach(h);
+
2381 return s;
+
2382}
+
2383
+
2389static LSTATUS RegOpenKeyExW(
+
2390 _In_ HKEY hKey,
+
2391 _In_opt_ LPCWSTR lpSubKey,
+
2392 _In_opt_ DWORD ulOptions,
+
2393 _In_ REGSAM samDesired,
+
2394 _Inout_ winstd::reg_key &result)
+
2395{
+
2396 HKEY h;
+
2397 LSTATUS s = RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, &h);
+
2398 if (s == ERROR_SUCCESS)
+
2399 result.attach(h);
+
2400 return s;
+
2401}
+
2402
+
2408static BOOL OpenProcessToken(_In_ HANDLE ProcessHandle, _In_ DWORD DesiredAccess, _Inout_ winstd::win_handle<NULL> &TokenHandle)
+
2409{
+
2410 HANDLE h;
+
2411 if (OpenProcessToken(ProcessHandle, DesiredAccess, &h)) {
+
2412 TokenHandle.attach(h);
+
2413 return TRUE;
+
2414 }
+
2415 return FALSE;
+
2416}
+
2417
+
2423static BOOL DuplicateTokenEx(_In_ HANDLE hExistingToken, _In_ DWORD dwDesiredAccess, _In_opt_ LPSECURITY_ATTRIBUTES lpTokenAttributes, _In_ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, _In_ TOKEN_TYPE TokenType, _Inout_ winstd::win_handle<NULL> &NewToken)
+
2424{
+
2425 HANDLE h;
+
2426 if (DuplicateTokenEx(hExistingToken, dwDesiredAccess, lpTokenAttributes, ImpersonationLevel, TokenType, &h)) {
+
2427 NewToken.attach(h);
+
2428 return TRUE;
+
2429 }
+
2430 return FALSE;
+
2431}
+
2432
+
2438static BOOL AllocateAndInitializeSid(_In_ PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, _In_ BYTE nSubAuthorityCount, _In_ DWORD nSubAuthority0, _In_ DWORD nSubAuthority1, _In_ DWORD nSubAuthority2, _In_ DWORD nSubAuthority3, _In_ DWORD nSubAuthority4, _In_ DWORD nSubAuthority5, _In_ DWORD nSubAuthority6, _In_ DWORD nSubAuthority7, _Inout_ winstd::security_id& Sid)
+
2439{
+
2440 PSID h;
+
2441 if (AllocateAndInitializeSid(pIdentifierAuthority, nSubAuthorityCount, nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, &h)) {
+
2442 Sid.attach(h);
+
2443 return TRUE;
+
2444 }
+
2445 return FALSE;
+
2446}
+
2447
+
2449static DWORD SetEntriesInAclA(_In_ ULONG cCountOfExplicitEntries, _In_reads_opt_(cCountOfExplicitEntries) PEXPLICIT_ACCESS_A pListOfExplicitEntries, _In_opt_ PACL OldAcl, _Inout_ std::unique_ptr<ACL, winstd::LocalFree_delete<ACL>>& Acl)
+
2450{
+
2451 PACL h;
+
2452 DWORD dwResult = SetEntriesInAclA(cCountOfExplicitEntries, pListOfExplicitEntries, OldAcl, &h);
+
2453 if (dwResult == ERROR_SUCCESS)
+
2454 Acl.reset(h);
+
2455 return ERROR_SUCCESS;
+
2456}
+
2457
+
2463static DWORD SetEntriesInAclW(_In_ ULONG cCountOfExplicitEntries, _In_reads_opt_(cCountOfExplicitEntries) PEXPLICIT_ACCESS_W pListOfExplicitEntries, _In_opt_ PACL OldAcl, _Inout_ std::unique_ptr<ACL, winstd::LocalFree_delete<ACL>>& Acl)
+
2464{
+
2465 PACL h;
+
2466 DWORD dwResult = SetEntriesInAclW(cCountOfExplicitEntries, pListOfExplicitEntries, OldAcl, &h);
+
2467 if (dwResult == ERROR_SUCCESS)
+
2468 Acl.reset(h);
+
2469 return ERROR_SUCCESS;
+
2470}
+
2471
+
2472#pragma warning(pop)
+
2473
+
winstd::actctx_activator
Activates given activation context in constructor and deactivates it in destructor.
Definition: Win.h:1801
+
winstd::actctx_activator::actctx_activator
actctx_activator(HANDLE hActCtx) noexcept
Construct the activator and activates the given activation context.
Definition: Win.h:1813
+
winstd::actctx_activator::~actctx_activator
virtual ~actctx_activator()
Deactivates activation context and destructs the activator.
Definition: Win.h:1824
+
winstd::actctx_activator::m_cookie
ULONG_PTR m_cookie
Cookie for context deactivation.
Definition: Win.h:1831
winstd::basic_string_printf
Base template class to support string formatting using printf() style templates.
Definition: Common.h:1080
-
winstd::console_ctrl_handler
Console control handler stack management.
Definition: Win.h:1948
-
winstd::console_ctrl_handler::console_ctrl_handler
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:1960
-
winstd::console_ctrl_handler::~console_ctrl_handler
virtual ~console_ctrl_handler()
Pops console control handler from the console control handler stack.
Definition: Win.h:1970
-
winstd::console_ctrl_handler::m_handler
PHANDLER_ROUTINE m_handler
Pointer to console control handler.
Definition: Win.h:1978
-
winstd::console_ctrl_handler::m_cookie
BOOL m_cookie
Did pushing the console control handler succeed?
Definition: Win.h:1977
-
winstd::critical_section
Critical section wrapper.
Definition: Win.h:1529
-
winstd::critical_section::critical_section
critical_section() noexcept
Construct the object and initializes a critical section object.
Definition: Win.h:1539
-
winstd::critical_section::m_data
CRITICAL_SECTION m_data
Critical section struct.
Definition: Win.h:1565
-
winstd::critical_section::~critical_section
virtual ~critical_section()
Releases all resources used by an unowned critical section object.
Definition: Win.h:1549
-
winstd::event_log
Event log handle wrapper.
Definition: Win.h:2259
-
winstd::event_log::free_internal
void free_internal() noexcept override
Closes an event log handle.
Definition: Win.h:2280
-
winstd::event_log::~event_log
virtual ~event_log()
Closes an event log handle.
Definition: Win.h:2268
-
winstd::find_file
Find-file handle wrapper.
Definition: Win.h:1574
-
winstd::find_file::~find_file
virtual ~find_file()
Closes a file search handle.
Definition: Win.h:1583
-
winstd::find_file::free_internal
void free_internal() noexcept override
Closes a file search handle.
Definition: Win.h:1595
+
winstd::console_ctrl_handler
Console control handler stack management.
Definition: Win.h:1949
+
winstd::console_ctrl_handler::console_ctrl_handler
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:1961
+
winstd::console_ctrl_handler::~console_ctrl_handler
virtual ~console_ctrl_handler()
Pops console control handler from the console control handler stack.
Definition: Win.h:1971
+
winstd::console_ctrl_handler::m_handler
PHANDLER_ROUTINE m_handler
Pointer to console control handler.
Definition: Win.h:1979
+
winstd::console_ctrl_handler::m_cookie
BOOL m_cookie
Did pushing the console control handler succeed?
Definition: Win.h:1978
+
winstd::critical_section
Critical section wrapper.
Definition: Win.h:1530
+
winstd::critical_section::critical_section
critical_section() noexcept
Construct the object and initializes a critical section object.
Definition: Win.h:1540
+
winstd::critical_section::m_data
CRITICAL_SECTION m_data
Critical section struct.
Definition: Win.h:1566
+
winstd::critical_section::~critical_section
virtual ~critical_section()
Releases all resources used by an unowned critical section object.
Definition: Win.h:1550
+
winstd::event_log
Event log handle wrapper.
Definition: Win.h:2260
+
winstd::event_log::free_internal
void free_internal() noexcept override
Closes an event log handle.
Definition: Win.h:2281
+
winstd::event_log::~event_log
virtual ~event_log()
Closes an event log handle.
Definition: Win.h:2269
+
winstd::find_file
Find-file handle wrapper.
Definition: Win.h:1575
+
winstd::find_file::~find_file
virtual ~find_file()
Closes a file search handle.
Definition: Win.h:1584
+
winstd::find_file::free_internal
void free_internal() noexcept override
Closes a file search handle.
Definition: Win.h:1596
winstd::handle
Base abstract template class to support generic object handle keeping.
Definition: Common.h:569
winstd::handle< LPVOID, NULL >::handle_type
LPVOID handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:574
winstd::handle< HANDLE, INVALID >::m_h
handle_type m_h
Object handle.
Definition: Common.h:823
winstd::handle::attach
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:786
-
winstd::heap_allocator
HeapAlloc allocator.
Definition: Win.h:1685
-
winstd::heap_allocator::size_type
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:1694
-
winstd::heap_allocator::value_type
_Ty value_type
A type that is managed by the allocator.
Definition: Win.h:1687
-
winstd::heap_allocator::heap_allocator
heap_allocator(const heap_allocator< _Other > &other)
Constructs allocator from another type.
Definition: Win.h:1722
-
winstd::heap_allocator::m_heap
HANDLE m_heap
Heap handle.
Definition: Win.h:1793
-
winstd::heap_allocator::allocate
pointer allocate(size_type count)
Allocates a new memory block.
Definition: Win.h:1733
-
winstd::heap_allocator::difference_type
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:1695
-
winstd::heap_allocator::heap_allocator
heap_allocator(HANDLE heap)
Constructs allocator.
Definition: Win.h:1712
-
winstd::heap_allocator::reference
_Ty & reference
A type that provides a reference to the type of object managed by the allocator.
Definition: Win.h:1690
-
winstd::heap_allocator::construct
void construct(pointer ptr, _Ty &&val)
Calls moving constructor for the element.
Definition: Win.h:1769
-
winstd::heap_allocator::deallocate
void deallocate(pointer ptr, size_type size)
Frees memory block.
Definition: Win.h:1745
-
winstd::heap_allocator::max_size
size_type max_size() const
Returns maximum memory block size.
Definition: Win.h:1787
-
winstd::heap_allocator::construct
void construct(pointer ptr, const _Ty &val)
Calls copying constructor for the element.
Definition: Win.h:1758
-
winstd::heap_allocator::const_reference
const _Ty & const_reference
A type that provides a constant reference to type of object managed by the allocator.
Definition: Win.h:1692
-
winstd::heap_allocator::const_pointer
const _Ty * const_pointer
A type that provides a constant pointer to the type of object managed by the allocator.
Definition: Win.h:1691
-
winstd::heap_allocator::pointer
_Ty * pointer
A type that provides a pointer to the type of object managed by the allocator.
Definition: Win.h:1689
-
winstd::heap_allocator::destroy
void destroy(pointer ptr)
Calls destructor for the element.
Definition: Win.h:1779
-
winstd::heap
Heap handle wrapper.
Definition: Win.h:1607
-
winstd::heap::enumerate
bool enumerate() noexcept
Enumerates allocated heap blocks using OutputDebugString()
Definition: Win.h:1629
-
winstd::heap::free_internal
void free_internal() noexcept override
Destroys the heap.
Definition: Win.h:1673
-
winstd::heap::~heap
virtual ~heap()
Destroys the heap.
Definition: Win.h:1616
-
winstd::impersonator
Base class for thread impersonation of another security context.
Definition: Win.h:1837
-
winstd::impersonator::~impersonator
virtual ~impersonator()
Reverts to current user and destructs the impersonator.
Definition: Win.h:1849
-
winstd::impersonator::impersonator
impersonator() noexcept
Construct the impersonator.
Definition: Win.h:1842
-
winstd::impersonator::m_cookie
BOOL m_cookie
Did impersonation succeed?
Definition: Win.h:1861
-
winstd::library
Module handle wrapper.
Definition: Win.h:1395
-
winstd::library::free_internal
void free_internal() noexcept override
Frees the module.
Definition: Win.h:1416
-
winstd::library::~library
virtual ~library()
Frees the module.
Definition: Win.h:1404
-
winstd::process_information
PROCESS_INFORMATION struct wrapper.
Definition: Win.h:2219
-
winstd::process_information::~process_information
~process_information()
Closes process and thread handles.
Definition: Win.h:2238
-
winstd::process_information::process_information
process_information() noexcept
Constructs blank PROCESS_INFORMATION.
Definition: Win.h:2227
-
winstd::reg_key
Registry key wrapper class.
Definition: Win.h:2106
-
winstd::reg_key::free_internal
void free_internal() noexcept override
Closes a handle to the registry key.
Definition: Win.h:2178
-
winstd::reg_key::delete_subkey
bool delete_subkey(LPCTSTR szSubkey)
Deletes the specified registry subkey.
Definition: Win.h:2130
-
winstd::reg_key::~reg_key
virtual ~reg_key()
Closes a handle to the registry key.
Definition: Win.h:2115
-
winstd::sc_handle
SC_HANDLE wrapper class.
Definition: Win.h:2290
-
winstd::sc_handle::free_internal
void free_internal() noexcept override
Closes an open object handle.
Definition: Win.h:2311
-
winstd::sc_handle::~sc_handle
virtual ~sc_handle()
Closes an open object handle.
Definition: Win.h:2299
-
winstd::security_id
SID wrapper class.
Definition: Win.h:2188
-
winstd::security_id::free_internal
void free_internal() noexcept override
Closes a handle to the SID.
Definition: Win.h:2209
-
winstd::security_id::~security_id
virtual ~security_id()
Closes a handle to the SID.
Definition: Win.h:2197
-
winstd::system_impersonator
Lets the calling thread impersonate the security context of the SYSTEM user.
Definition: Win.h:1890
-
winstd::system_impersonator::system_impersonator
system_impersonator() noexcept
Construct the impersonator and impersonates the SYSTEM user.
Definition: Win.h:1898
-
winstd::user_impersonator
Lets the calling thread impersonate the security context of a logged-on user.
Definition: Win.h:1868
-
winstd::user_impersonator::user_impersonator
user_impersonator(HANDLE hToken) noexcept
Construct the impersonator and impersonates the given user.
Definition: Win.h:1880
-
winstd::vmemory
Memory in virtual address space of a process handle wrapper.
Definition: Win.h:1985
-
winstd::vmemory::operator=
vmemory & operator=(vmemory &&other) noexcept
Move assignment.
Definition: Win.h:2035
-
winstd::vmemory::alloc
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:2069
-
winstd::vmemory::free_internal
void free_internal() noexcept override
Frees the memory.
Definition: Win.h:2090
-
winstd::vmemory::attach
void attach(HANDLE proc, handle_type h) noexcept
Sets a new memory handle for the class.
Definition: Win.h:2052
-
winstd::vmemory::~vmemory
virtual ~vmemory()
Frees the memory.
Definition: Win.h:2024
-
winstd::vmemory::vmemory
vmemory(handle_type h, HANDLE proc) noexcept
Initializes a new class instance with an already available object handle.
Definition: Win.h:2002
-
winstd::vmemory::vmemory
vmemory() noexcept
Initializes a new class instance with the memory handle set to INVAL.
Definition: Win.h:1992
-
winstd::vmemory::vmemory
vmemory(vmemory &&h) noexcept
Move constructor.
Definition: Win.h:2013
-
winstd::vmemory::m_proc
HANDLE m_proc
Handle of memory's process.
Definition: Win.h:2096
-
winstd::win_handle
Windows HANDLE wrapper class.
Definition: Win.h:1362
-
winstd::win_handle::free_internal
void free_internal() noexcept override
Closes an open object handle.
Definition: Win.h:1383
-
winstd::win_handle::~win_handle
virtual ~win_handle()
Closes an open object handle.
Definition: Win.h:1371
+
winstd::heap_allocator
HeapAlloc allocator.
Definition: Win.h:1686
+
winstd::heap_allocator::size_type
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:1695
+
winstd::heap_allocator::value_type
_Ty value_type
A type that is managed by the allocator.
Definition: Win.h:1688
+
winstd::heap_allocator::heap_allocator
heap_allocator(const heap_allocator< _Other > &other)
Constructs allocator from another type.
Definition: Win.h:1723
+
winstd::heap_allocator::m_heap
HANDLE m_heap
Heap handle.
Definition: Win.h:1794
+
winstd::heap_allocator::allocate
pointer allocate(size_type count)
Allocates a new memory block.
Definition: Win.h:1734
+
winstd::heap_allocator::difference_type
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:1696
+
winstd::heap_allocator::heap_allocator
heap_allocator(HANDLE heap)
Constructs allocator.
Definition: Win.h:1713
+
winstd::heap_allocator::reference
_Ty & reference
A type that provides a reference to the type of object managed by the allocator.
Definition: Win.h:1691
+
winstd::heap_allocator::construct
void construct(pointer ptr, _Ty &&val)
Calls moving constructor for the element.
Definition: Win.h:1770
+
winstd::heap_allocator::deallocate
void deallocate(pointer ptr, size_type size)
Frees memory block.
Definition: Win.h:1746
+
winstd::heap_allocator::max_size
size_type max_size() const
Returns maximum memory block size.
Definition: Win.h:1788
+
winstd::heap_allocator::construct
void construct(pointer ptr, const _Ty &val)
Calls copying constructor for the element.
Definition: Win.h:1759
+
winstd::heap_allocator::const_reference
const _Ty & const_reference
A type that provides a constant reference to type of object managed by the allocator.
Definition: Win.h:1693
+
winstd::heap_allocator::const_pointer
const _Ty * const_pointer
A type that provides a constant pointer to the type of object managed by the allocator.
Definition: Win.h:1692
+
winstd::heap_allocator::pointer
_Ty * pointer
A type that provides a pointer to the type of object managed by the allocator.
Definition: Win.h:1690
+
winstd::heap_allocator::destroy
void destroy(pointer ptr)
Calls destructor for the element.
Definition: Win.h:1780
+
winstd::heap
Heap handle wrapper.
Definition: Win.h:1608
+
winstd::heap::enumerate
bool enumerate() noexcept
Enumerates allocated heap blocks using OutputDebugString()
Definition: Win.h:1630
+
winstd::heap::free_internal
void free_internal() noexcept override
Destroys the heap.
Definition: Win.h:1674
+
winstd::heap::~heap
virtual ~heap()
Destroys the heap.
Definition: Win.h:1617
+
winstd::impersonator
Base class for thread impersonation of another security context.
Definition: Win.h:1838
+
winstd::impersonator::~impersonator
virtual ~impersonator()
Reverts to current user and destructs the impersonator.
Definition: Win.h:1850
+
winstd::impersonator::impersonator
impersonator() noexcept
Construct the impersonator.
Definition: Win.h:1843
+
winstd::impersonator::m_cookie
BOOL m_cookie
Did impersonation succeed?
Definition: Win.h:1862
+
winstd::library
Module handle wrapper.
Definition: Win.h:1396
+
winstd::library::free_internal
void free_internal() noexcept override
Frees the module.
Definition: Win.h:1417
+
winstd::library::~library
virtual ~library()
Frees the module.
Definition: Win.h:1405
+
winstd::process_information
PROCESS_INFORMATION struct wrapper.
Definition: Win.h:2220
+
winstd::process_information::~process_information
~process_information()
Closes process and thread handles.
Definition: Win.h:2239
+
winstd::process_information::process_information
process_information() noexcept
Constructs blank PROCESS_INFORMATION.
Definition: Win.h:2228
+
winstd::reg_key
Registry key wrapper class.
Definition: Win.h:2107
+
winstd::reg_key::free_internal
void free_internal() noexcept override
Closes a handle to the registry key.
Definition: Win.h:2179
+
winstd::reg_key::delete_subkey
bool delete_subkey(LPCTSTR szSubkey)
Deletes the specified registry subkey.
Definition: Win.h:2131
+
winstd::reg_key::~reg_key
virtual ~reg_key()
Closes a handle to the registry key.
Definition: Win.h:2116
+
winstd::sc_handle
SC_HANDLE wrapper class.
Definition: Win.h:2291
+
winstd::sc_handle::free_internal
void free_internal() noexcept override
Closes an open object handle.
Definition: Win.h:2312
+
winstd::sc_handle::~sc_handle
virtual ~sc_handle()
Closes an open object handle.
Definition: Win.h:2300
+
winstd::security_id
SID wrapper class.
Definition: Win.h:2189
+
winstd::security_id::free_internal
void free_internal() noexcept override
Closes a handle to the SID.
Definition: Win.h:2210
+
winstd::security_id::~security_id
virtual ~security_id()
Closes a handle to the SID.
Definition: Win.h:2198
+
winstd::system_impersonator
Lets the calling thread impersonate the security context of the SYSTEM user.
Definition: Win.h:1891
+
winstd::system_impersonator::system_impersonator
system_impersonator() noexcept
Construct the impersonator and impersonates the SYSTEM user.
Definition: Win.h:1899
+
winstd::user_impersonator
Lets the calling thread impersonate the security context of a logged-on user.
Definition: Win.h:1869
+
winstd::user_impersonator::user_impersonator
user_impersonator(HANDLE hToken) noexcept
Construct the impersonator and impersonates the given user.
Definition: Win.h:1881
+
winstd::vmemory
Memory in virtual address space of a process handle wrapper.
Definition: Win.h:1986
+
winstd::vmemory::operator=
vmemory & operator=(vmemory &&other) noexcept
Move assignment.
Definition: Win.h:2036
+
winstd::vmemory::alloc
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:2070
+
winstd::vmemory::free_internal
void free_internal() noexcept override
Frees the memory.
Definition: Win.h:2091
+
winstd::vmemory::attach
void attach(HANDLE proc, handle_type h) noexcept
Sets a new memory handle for the class.
Definition: Win.h:2053
+
winstd::vmemory::~vmemory
virtual ~vmemory()
Frees the memory.
Definition: Win.h:2025
+
winstd::vmemory::vmemory
vmemory(handle_type h, HANDLE proc) noexcept
Initializes a new class instance with an already available object handle.
Definition: Win.h:2003
+
winstd::vmemory::vmemory
vmemory() noexcept
Initializes a new class instance with the memory handle set to INVAL.
Definition: Win.h:1993
+
winstd::vmemory::vmemory
vmemory(vmemory &&h) noexcept
Move constructor.
Definition: Win.h:2014
+
winstd::vmemory::m_proc
HANDLE m_proc
Handle of memory's process.
Definition: Win.h:2097
+
winstd::win_handle
Windows HANDLE wrapper class.
Definition: Win.h:1363
+
winstd::win_handle::free_internal
void free_internal() noexcept override
Closes an open object handle.
Definition: Win.h:1384
+
winstd::win_handle::~win_handle
virtual ~win_handle()
Closes an open object handle.
Definition: Win.h:1372
winstd::win_runtime_error
Windows runtime error.
Definition: Common.h:1013
WINSTD_NONCOPYABLE
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:66
WINSTD_STACK_BUFFER_BYTES
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:93
@@ -1964,67 +1993,71 @@ $(function() {
sprintf
static int sprintf(std::basic_string< _Elem, _Traits, _Ax > &str, const _Elem *format,...)
Formats string using printf().
Definition: Common.h:284
WINSTD_HANDLE_IMPL
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:163
winstd::handle< HANDLE, INVALID >::invalid
static const HANDLE invalid
Invalid handle value.
Definition: Common.h:579
-
NormalizeString
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:971
-
SecureWideCharToMultiByte
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:714
-
ExpandEnvironmentStringsA
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:178
-
StringToGuidA
static BOOL StringToGuidA(LPCSTR lpszGuid, LPGUID lpGuid, LPCSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition: Win.h:267
-
GetWindowTextA
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:80
-
RegCreateKeyExW
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:2350
-
LoadStringA
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:1053
-
winstd::file
win_handle< INVALID_HANDLE_VALUE > file
File handle wrapper.
Definition: Win.h:1449
-
GetFileVersionInfoA
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:142
-
MultiByteToWideChar
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:803
-
RegCreateKeyExA
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:2327
-
RegOpenKeyExA
static LSTATUS RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition: Win.h:2369
-
RegOpenKeyExW
static LSTATUS RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition: Win.h:2388
-
GuidToStringA
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:228
-
StringToGuidW
static BOOL StringToGuidW(LPCWSTR lpszGuid, LPGUID lpGuid, LPCWSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition: Win.h:340
-
RegLoadMUIStringW
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:605
-
OpenProcessToken
static BOOL OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, winstd::win_handle< NULL > &TokenHandle)
Opens the access token associated with a process.
Definition: Win.h:2407
-
LookupAccountSidA
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:1171
-
GetModuleFileNameW
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:55
-
LookupAccountSidW
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:1210
-
winstd::process_snapshot
win_handle< INVALID_HANDLE_VALUE > process_snapshot
Process snapshot handle wrapper.
Definition: Win.h:1441
-
GetModuleFileNameA
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:24
-
GetDateFormatW
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:1155
-
CreateWellKnownSid
static BOOL CreateWellKnownSid(WELL_KNOWN_SID_TYPE WellKnownSidType, PSID DomainSid, std::unique_ptr< SID > &Sid)
Creates a SID for predefined aliases.
Definition: Win.h:1248
-
LoadStringW
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:1071
-
GetTokenInformation
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:1272
-
DuplicateTokenEx
static BOOL DuplicateTokenEx(HANDLE hExistingToken, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, winstd::win_handle< NULL > &NewToken)
Creates a new access token that duplicates an existing token. This function can create either a prima...
Definition: Win.h:2422
-
RegQueryValueExW
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:566
-
GetFileVersionInfoW
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:162
-
winstd::event
win_handle< NULL > event
Event handle wrapper.
Definition: Win.h:1523
-
RegLoadMUIStringA
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:591
-
OutputDebugStr
static VOID OutputDebugStr(LPCSTR lpOutputString,...) noexcept
Formats and sends a string to the debugger for display.
Definition: Win.h:1112
-
QueryFullProcessImageNameA
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:1296
-
winstd::file_mapping
win_handle< NULL > file_mapping
File mapping.
Definition: Win.h:1456
-
SecureMultiByteToWideChar
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:882
-
WideCharToMultiByte
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:635
-
QueryFullProcessImageNameW
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:1325
-
winstd::process
win_handle< NULL > process
Process handle wrapper.
Definition: Win.h:1427
-
RegQueryValueExA
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:539
-
RegQueryStringValue
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:428
-
GetWindowTextW
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:113
-
GetDateFormatA
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:1135
-
ExpandEnvironmentStringsW
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:206
-
GuidToStringW
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:247
-
OutputDebugStrV
static VOID OutputDebugStrV(LPCSTR lpOutputString, va_list arg) noexcept
Formats and sends a string to the debugger for display.
Definition: Win.h:1088
-
winstd::thread
win_handle< NULL > thread
Thread handle wrapper.
Definition: Win.h:1434
-
winstd::UnmapViewOfFile_delete< _Ty[]>::UnmapViewOfFile_delete
UnmapViewOfFile_delete()
Default construct.
Definition: Win.h:1495
-
winstd::UnmapViewOfFile_delete< _Ty[]>::operator()
void operator()(_Other *) const
Delete a pointer of another type.
Definition: Win.h:1510
-
winstd::UnmapViewOfFile_delete< _Ty[]>::operator()
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: Win.h:1500
-
winstd::UnmapViewOfFile_delete< _Ty[]>::_Myt
UnmapViewOfFile_delete< _Ty > _Myt
This type.
Definition: Win.h:1490
-
winstd::UnmapViewOfFile_delete
Deleter for unique_ptr using UnmapViewOfFile.
Definition: Win.h:1462
-
winstd::UnmapViewOfFile_delete::UnmapViewOfFile_delete
UnmapViewOfFile_delete(const UnmapViewOfFile_delete< _Ty2 > &)
Construct from another UnmapViewOfFile_delete.
Definition: Win.h:1473
-
winstd::UnmapViewOfFile_delete::operator()
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: Win.h:1478
-
winstd::UnmapViewOfFile_delete::_Myt
UnmapViewOfFile_delete< _Ty > _Myt
This type.
Definition: Win.h:1463
-
winstd::UnmapViewOfFile_delete::UnmapViewOfFile_delete
UnmapViewOfFile_delete()
Default construct.
Definition: Win.h:1468
-
winstd::heap_allocator::rebind
A structure that enables an allocator for objects of one type to allocate storage for objects of anot...
Definition: Win.h:1702
-
winstd::heap_allocator::rebind::other
heap_allocator< _Other > other
Other allocator type.
Definition: Win.h:1703
+
NormalizeString
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:972
+
SecureWideCharToMultiByte
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:715
+
ExpandEnvironmentStringsA
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:179
+
StringToGuidA
static BOOL StringToGuidA(LPCSTR lpszGuid, LPGUID lpGuid, LPCSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition: Win.h:268
+
GetWindowTextA
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:81
+
RegCreateKeyExW
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:2351
+
LoadStringA
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:1054
+
winstd::file
win_handle< INVALID_HANDLE_VALUE > file
File handle wrapper.
Definition: Win.h:1450
+
GetFileVersionInfoA
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:143
+
MultiByteToWideChar
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:804
+
RegCreateKeyExA
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:2328
+
RegOpenKeyExA
static LSTATUS RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition: Win.h:2370
+
RegOpenKeyExW
static LSTATUS RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, winstd::reg_key &result)
Opens the specified registry key.
Definition: Win.h:2389
+
GuidToStringA
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:229
+
StringToGuidW
static BOOL StringToGuidW(LPCWSTR lpszGuid, LPGUID lpGuid, LPCWSTR *lpszGuidEnd=NULL) noexcept
Parses string with GUID and stores it to GUID.
Definition: Win.h:341
+
RegLoadMUIStringW
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:606
+
OpenProcessToken
static BOOL OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, winstd::win_handle< NULL > &TokenHandle)
Opens the access token associated with a process.
Definition: Win.h:2408
+
SetEntriesInAclW
static DWORD SetEntriesInAclW(ULONG cCountOfExplicitEntries, PEXPLICIT_ACCESS_W pListOfExplicitEntries, PACL OldAcl, std::unique_ptr< ACL, winstd::LocalFree_delete< ACL > > &Acl)
Creates a new access control list (ACL) by merging new access control or audit control information in...
Definition: Win.h:2463
+
LookupAccountSidA
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:1172
+
GetModuleFileNameW
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:56
+
LookupAccountSidW
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:1211
+
AllocateAndInitializeSid
static BOOL AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, winstd::security_id &Sid)
Allocates and initializes a security identifier (SID) with up to eight subauthorities.
Definition: Win.h:2438
+
winstd::process_snapshot
win_handle< INVALID_HANDLE_VALUE > process_snapshot
Process snapshot handle wrapper.
Definition: Win.h:1442
+
GetModuleFileNameA
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:25
+
GetDateFormatW
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:1156
+
CreateWellKnownSid
static BOOL CreateWellKnownSid(WELL_KNOWN_SID_TYPE WellKnownSidType, PSID DomainSid, std::unique_ptr< SID > &Sid)
Creates a SID for predefined aliases.
Definition: Win.h:1249
+
LoadStringW
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:1072
+
GetTokenInformation
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:1273
+
DuplicateTokenEx
static BOOL DuplicateTokenEx(HANDLE hExistingToken, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, winstd::win_handle< NULL > &NewToken)
Creates a new access token that duplicates an existing token. This function can create either a prima...
Definition: Win.h:2423
+
SetEntriesInAclA
static DWORD SetEntriesInAclA(ULONG cCountOfExplicitEntries, PEXPLICIT_ACCESS_A pListOfExplicitEntries, PACL OldAcl, std::unique_ptr< ACL, winstd::LocalFree_delete< ACL > > &Acl)
Creates a new access control list (ACL) by merging new access control or audit control information in...
Definition: Win.h:2449
+
RegQueryValueExW
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:567
+
GetFileVersionInfoW
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:163
+
winstd::event
win_handle< NULL > event
Event handle wrapper.
Definition: Win.h:1524
+
RegLoadMUIStringA
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:592
+
OutputDebugStr
static VOID OutputDebugStr(LPCSTR lpOutputString,...) noexcept
Formats and sends a string to the debugger for display.
Definition: Win.h:1113
+
QueryFullProcessImageNameA
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:1297
+
winstd::file_mapping
win_handle< NULL > file_mapping
File mapping.
Definition: Win.h:1457
+
SecureMultiByteToWideChar
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:883
+
WideCharToMultiByte
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:636
+
QueryFullProcessImageNameW
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:1326
+
winstd::process
win_handle< NULL > process
Process handle wrapper.
Definition: Win.h:1428
+
RegQueryValueExA
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:540
+
RegQueryStringValue
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:429
+
GetWindowTextW
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:114
+
GetDateFormatA
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:1136
+
ExpandEnvironmentStringsW
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:207
+
GuidToStringW
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:248
+
OutputDebugStrV
static VOID OutputDebugStrV(LPCSTR lpOutputString, va_list arg) noexcept
Formats and sends a string to the debugger for display.
Definition: Win.h:1089
+
winstd::thread
win_handle< NULL > thread
Thread handle wrapper.
Definition: Win.h:1435
+
winstd::LocalFree_delete
Deleter for unique_ptr using LocalFree.
Definition: Common.h:346
+
winstd::UnmapViewOfFile_delete< _Ty[]>::UnmapViewOfFile_delete
UnmapViewOfFile_delete()
Default construct.
Definition: Win.h:1496
+
winstd::UnmapViewOfFile_delete< _Ty[]>::operator()
void operator()(_Other *) const
Delete a pointer of another type.
Definition: Win.h:1511
+
winstd::UnmapViewOfFile_delete< _Ty[]>::operator()
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: Win.h:1501
+
winstd::UnmapViewOfFile_delete< _Ty[]>::_Myt
UnmapViewOfFile_delete< _Ty > _Myt
This type.
Definition: Win.h:1491
+
winstd::UnmapViewOfFile_delete
Deleter for unique_ptr using UnmapViewOfFile.
Definition: Win.h:1463
+
winstd::UnmapViewOfFile_delete::UnmapViewOfFile_delete
UnmapViewOfFile_delete(const UnmapViewOfFile_delete< _Ty2 > &)
Construct from another UnmapViewOfFile_delete.
Definition: Win.h:1474
+
winstd::UnmapViewOfFile_delete::operator()
void operator()(_Ty *_Ptr) const
Delete a pointer.
Definition: Win.h:1479
+
winstd::UnmapViewOfFile_delete::_Myt
UnmapViewOfFile_delete< _Ty > _Myt
This type.
Definition: Win.h:1464
+
winstd::UnmapViewOfFile_delete::UnmapViewOfFile_delete
UnmapViewOfFile_delete()
Default construct.
Definition: Win.h:1469
+
winstd::heap_allocator::rebind
A structure that enables an allocator for objects of one type to allocate storage for objects of anot...
Definition: Win.h:1703
+
winstd::heap_allocator::rebind::other
heap_allocator< _Other > other
Other allocator type.
Definition: Win.h:1704
diff --git a/_win_sock2_8h_source.html b/_win_sock2_8h_source.html index 03118243..d0c6408f 100644 --- a/_win_sock2_8h_source.html +++ b/_win_sock2_8h_source.html @@ -235,7 +235,7 @@ $(function() { diff --git a/_win_trust_8h_source.html b/_win_trust_8h_source.html index 8d862ac3..3d0dfd2a 100644 --- a/_win_trust_8h_source.html +++ b/_win_trust_8h_source.html @@ -130,7 +130,7 @@ $(function() { diff --git a/annotated.html b/annotated.html index a190bbf1..1ee3db1c 100644 --- a/annotated.html +++ b/annotated.html @@ -167,7 +167,7 @@ $(function() { diff --git a/classes.html b/classes.html index b078a89e..3ef784cf 100644 --- a/classes.html +++ b/classes.html @@ -130,7 +130,7 @@ $(function() { diff --git a/classwinstd_1_1actctx__activator-members.html b/classwinstd_1_1actctx__activator-members.html index c60b1511..6987e9b1 100644 --- a/classwinstd_1_1actctx__activator-members.html +++ b/classwinstd_1_1actctx__activator-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/classwinstd_1_1actctx__activator.html b/classwinstd_1_1actctx__activator.html index 10cb4305..bb76a5c2 100644 --- a/classwinstd_1_1actctx__activator.html +++ b/classwinstd_1_1actctx__activator.html @@ -175,7 +175,7 @@ ULONG_PTR m_cookie diff --git a/classwinstd_1_1addrinfo-members.html b/classwinstd_1_1addrinfo-members.html index c1965b77..4f0bbd59 100644 --- a/classwinstd_1_1addrinfo-members.html +++ b/classwinstd_1_1addrinfo-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1addrinfo.html b/classwinstd_1_1addrinfo.html index 168fb313..7ab9a7d6 100644 --- a/classwinstd_1_1addrinfo.html +++ b/classwinstd_1_1addrinfo.html @@ -258,7 +258,7 @@ static const PADDRINFOA in diff --git a/classwinstd_1_1basic__string__guid-members.html b/classwinstd_1_1basic__string__guid-members.html index f577f9b5..08e04f6b 100644 --- a/classwinstd_1_1basic__string__guid-members.html +++ b/classwinstd_1_1basic__string__guid-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/classwinstd_1_1basic__string__guid.html b/classwinstd_1_1basic__string__guid.html index fa7d01f5..bf612f7a 100644 --- a/classwinstd_1_1basic__string__guid.html +++ b/classwinstd_1_1basic__string__guid.html @@ -155,7 +155,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 91e05f50..ef540a25 100644 --- a/classwinstd_1_1basic__string__msg-members.html +++ b/classwinstd_1_1basic__string__msg-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classwinstd_1_1basic__string__msg.html b/classwinstd_1_1basic__string__msg.html index 8c5b23a1..af27c04c 100644 --- a/classwinstd_1_1basic__string__msg.html +++ b/classwinstd_1_1basic__string__msg.html @@ -499,7 +499,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 d8debc94..d03afe25 100644 --- a/classwinstd_1_1basic__string__printf-members.html +++ b/classwinstd_1_1basic__string__printf-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/classwinstd_1_1basic__string__printf.html b/classwinstd_1_1basic__string__printf.html index 97e883ec..8d6312d4 100644 --- a/classwinstd_1_1basic__string__printf.html +++ b/classwinstd_1_1basic__string__printf.html @@ -274,7 +274,7 @@ template<class _Elem , class _Traits , class _Ax > diff --git a/classwinstd_1_1bstr-members.html b/classwinstd_1_1bstr-members.html index 8a97e71d..cacf37d2 100644 --- a/classwinstd_1_1bstr-members.html +++ b/classwinstd_1_1bstr-members.html @@ -120,7 +120,7 @@ $(function() { diff --git a/classwinstd_1_1bstr.html b/classwinstd_1_1bstr.html index a4fb2331..23090b97 100644 --- a/classwinstd_1_1bstr.html +++ b/classwinstd_1_1bstr.html @@ -375,7 +375,7 @@ static const T invalid diff --git a/classwinstd_1_1cert__chain__context-members.html b/classwinstd_1_1cert__chain__context-members.html index 04ba212c..01212edd 100644 --- a/classwinstd_1_1cert__chain__context-members.html +++ b/classwinstd_1_1cert__chain__context-members.html @@ -116,7 +116,7 @@ $(function() { diff --git a/classwinstd_1_1cert__chain__context.html b/classwinstd_1_1cert__chain__context.html index e404eadc..98faf251 100644 --- a/classwinstd_1_1cert__chain__context.html +++ b/classwinstd_1_1cert__chain__context.html @@ -332,7 +332,7 @@ static const T invalid diff --git a/classwinstd_1_1cert__context-members.html b/classwinstd_1_1cert__context-members.html index 42802812..6d378e6c 100644 --- a/classwinstd_1_1cert__context-members.html +++ b/classwinstd_1_1cert__context-members.html @@ -122,7 +122,7 @@ $(function() { diff --git a/classwinstd_1_1cert__context.html b/classwinstd_1_1cert__context.html index e819b846..6e8709fa 100644 --- a/classwinstd_1_1cert__context.html +++ b/classwinstd_1_1cert__context.html @@ -584,7 +584,7 @@ static const T invalid diff --git a/classwinstd_1_1cert__store-members.html b/classwinstd_1_1cert__store-members.html index 262e0e83..80f9c77d 100644 --- a/classwinstd_1_1cert__store-members.html +++ b/classwinstd_1_1cert__store-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1cert__store.html b/classwinstd_1_1cert__store.html index b4ef1694..913d8135 100644 --- a/classwinstd_1_1cert__store.html +++ b/classwinstd_1_1cert__store.html @@ -260,7 +260,7 @@ static const HCERTSTORE in diff --git a/classwinstd_1_1com__initializer-members.html b/classwinstd_1_1com__initializer-members.html index 479c512e..bda38b80 100644 --- a/classwinstd_1_1com__initializer-members.html +++ b/classwinstd_1_1com__initializer-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classwinstd_1_1com__initializer.html b/classwinstd_1_1com__initializer.html index 5f599cd9..de9127a3 100644 --- a/classwinstd_1_1com__initializer.html +++ b/classwinstd_1_1com__initializer.html @@ -243,7 +243,7 @@ HRESULT m_result< diff --git a/classwinstd_1_1com__obj-members.html b/classwinstd_1_1com__obj-members.html index d35c1449..208f0ac7 100644 --- a/classwinstd_1_1com__obj-members.html +++ b/classwinstd_1_1com__obj-members.html @@ -120,7 +120,7 @@ $(function() { diff --git a/classwinstd_1_1com__obj.html b/classwinstd_1_1com__obj.html index 63be4a9b..6f140ea1 100644 --- a/classwinstd_1_1com__obj.html +++ b/classwinstd_1_1com__obj.html @@ -458,7 +458,7 @@ template<class _Other > diff --git a/classwinstd_1_1com__runtime__error-members.html b/classwinstd_1_1com__runtime__error-members.html index 05335639..a5733d46 100644 --- a/classwinstd_1_1com__runtime__error-members.html +++ b/classwinstd_1_1com__runtime__error-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classwinstd_1_1com__runtime__error.html b/classwinstd_1_1com__runtime__error.html index e61af81c..8f30cc99 100644 --- a/classwinstd_1_1com__runtime__error.html +++ b/classwinstd_1_1com__runtime__error.html @@ -228,7 +228,7 @@ typedef HRESULT error_type diff --git a/classwinstd_1_1console__ctrl__handler-members.html b/classwinstd_1_1console__ctrl__handler-members.html index a5cdbc11..19e6a947 100644 --- a/classwinstd_1_1console__ctrl__handler-members.html +++ b/classwinstd_1_1console__ctrl__handler-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classwinstd_1_1console__ctrl__handler.html b/classwinstd_1_1console__ctrl__handler.html index a5d4861b..69e8421c 100644 --- a/classwinstd_1_1console__ctrl__handler.html +++ b/classwinstd_1_1console__ctrl__handler.html @@ -179,7 +179,7 @@ PHANDLER_ROUTINE m_handler diff --git a/classwinstd_1_1critical__section-members.html b/classwinstd_1_1critical__section-members.html index 53565b0b..c5b24bc9 100644 --- a/classwinstd_1_1critical__section-members.html +++ b/classwinstd_1_1critical__section-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classwinstd_1_1critical__section.html b/classwinstd_1_1critical__section.html index f2704d30..d93a9dea 100644 --- a/classwinstd_1_1critical__section.html +++ b/classwinstd_1_1critical__section.html @@ -200,7 +200,7 @@ CRITICAL_SECTION m_data diff --git a/classwinstd_1_1crypt__hash-members.html b/classwinstd_1_1crypt__hash-members.html index cb86accc..a707538e 100644 --- a/classwinstd_1_1crypt__hash-members.html +++ b/classwinstd_1_1crypt__hash-members.html @@ -116,7 +116,7 @@ $(function() { diff --git a/classwinstd_1_1crypt__hash.html b/classwinstd_1_1crypt__hash.html index 773ae58c..93fd18cb 100644 --- a/classwinstd_1_1crypt__hash.html +++ b/classwinstd_1_1crypt__hash.html @@ -332,7 +332,7 @@ static const T invalid diff --git a/classwinstd_1_1crypt__key-members.html b/classwinstd_1_1crypt__key-members.html index 02001957..5c1abb2c 100644 --- a/classwinstd_1_1crypt__key-members.html +++ b/classwinstd_1_1crypt__key-members.html @@ -117,7 +117,7 @@ $(function() { diff --git a/classwinstd_1_1crypt__key.html b/classwinstd_1_1crypt__key.html index 061aa516..931bf82c 100644 --- a/classwinstd_1_1crypt__key.html +++ b/classwinstd_1_1crypt__key.html @@ -387,7 +387,7 @@ static const T invalid diff --git a/classwinstd_1_1crypt__prov-members.html b/classwinstd_1_1crypt__prov-members.html index 8f2456e1..1cb23676 100644 --- a/classwinstd_1_1crypt__prov-members.html +++ b/classwinstd_1_1crypt__prov-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1crypt__prov.html b/classwinstd_1_1crypt__prov.html index 454fd0ac..915daf70 100644 --- a/classwinstd_1_1crypt__prov.html +++ b/classwinstd_1_1crypt__prov.html @@ -258,7 +258,7 @@ static const HCRYPTPROV in diff --git a/classwinstd_1_1data__blob-members.html b/classwinstd_1_1data__blob-members.html index 5265efcb..5250fb06 100644 --- a/classwinstd_1_1data__blob-members.html +++ b/classwinstd_1_1data__blob-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classwinstd_1_1data__blob.html b/classwinstd_1_1data__blob.html index c7d94dca..8930e3fe 100644 --- a/classwinstd_1_1data__blob.html +++ b/classwinstd_1_1data__blob.html @@ -143,7 +143,7 @@ BYTE * data () noexcep diff --git a/classwinstd_1_1dc-members.html b/classwinstd_1_1dc-members.html index e1dac1f2..2b4a9d27 100644 --- a/classwinstd_1_1dc-members.html +++ b/classwinstd_1_1dc-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1dc.html b/classwinstd_1_1dc.html index c463bbe4..aacc0ec7 100644 --- a/classwinstd_1_1dc.html +++ b/classwinstd_1_1dc.html @@ -257,7 +257,7 @@ static const HDC invalid diff --git a/classwinstd_1_1dc__selector-members.html b/classwinstd_1_1dc__selector-members.html index 35dfc717..502b5e2f 100644 --- a/classwinstd_1_1dc__selector-members.html +++ b/classwinstd_1_1dc__selector-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classwinstd_1_1dc__selector.html b/classwinstd_1_1dc__selector.html index 7410a5c1..a5995a1e 100644 --- a/classwinstd_1_1dc__selector.html +++ b/classwinstd_1_1dc__selector.html @@ -215,7 +215,7 @@ HGDIOBJ m_orig diff --git a/classwinstd_1_1dplhandle-members.html b/classwinstd_1_1dplhandle-members.html index 934639ca..6d18e1b1 100644 --- a/classwinstd_1_1dplhandle-members.html +++ b/classwinstd_1_1dplhandle-members.html @@ -115,7 +115,7 @@ $(function() { diff --git a/classwinstd_1_1dplhandle.html b/classwinstd_1_1dplhandle.html index 67d00451..bfa2536f 100644 --- a/classwinstd_1_1dplhandle.html +++ b/classwinstd_1_1dplhandle.html @@ -552,7 +552,7 @@ template<class T , T INVAL> diff --git a/classwinstd_1_1eap__attr-members.html b/classwinstd_1_1eap__attr-members.html index ce92c6df..7deb1bc6 100644 --- a/classwinstd_1_1eap__attr-members.html +++ b/classwinstd_1_1eap__attr-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classwinstd_1_1eap__attr.html b/classwinstd_1_1eap__attr.html index 77bb6551..6989f540 100644 --- a/classwinstd_1_1eap__attr.html +++ b/classwinstd_1_1eap__attr.html @@ -180,7 +180,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 a54cfb4c..94ef403e 100644 --- a/classwinstd_1_1eap__method__info__array-members.html +++ b/classwinstd_1_1eap__method__info__array-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classwinstd_1_1eap__method__info__array.html b/classwinstd_1_1eap__method__info__array.html index f51a6b99..021adf78 100644 --- a/classwinstd_1_1eap__method__info__array.html +++ b/classwinstd_1_1eap__method__info__array.html @@ -187,7 +187,7 @@ Public Member Functions diff --git a/classwinstd_1_1eap__method__prop-members.html b/classwinstd_1_1eap__method__prop-members.html index 7d72c227..95798fa2 100644 --- a/classwinstd_1_1eap__method__prop-members.html +++ b/classwinstd_1_1eap__method__prop-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/classwinstd_1_1eap__method__prop.html b/classwinstd_1_1eap__method__prop.html index 02c9353c..e9fea829 100644 --- a/classwinstd_1_1eap__method__prop.html +++ b/classwinstd_1_1eap__method__prop.html @@ -248,7 +248,7 @@ Public Member Functions diff --git a/classwinstd_1_1eap__packet-members.html b/classwinstd_1_1eap__packet-members.html index de525c88..565f9531 100644 --- a/classwinstd_1_1eap__packet-members.html +++ b/classwinstd_1_1eap__packet-members.html @@ -118,7 +118,7 @@ $(function() { diff --git a/classwinstd_1_1eap__packet.html b/classwinstd_1_1eap__packet.html index cb348e61..7ede65f8 100644 --- a/classwinstd_1_1eap__packet.html +++ b/classwinstd_1_1eap__packet.html @@ -359,7 +359,7 @@ static const T invalid diff --git a/classwinstd_1_1eap__runtime__error-members.html b/classwinstd_1_1eap__runtime__error-members.html index 8fb99184..652bb58c 100644 --- a/classwinstd_1_1eap__runtime__error-members.html +++ b/classwinstd_1_1eap__runtime__error-members.html @@ -109,7 +109,7 @@ $(function() { diff --git a/classwinstd_1_1eap__runtime__error.html b/classwinstd_1_1eap__runtime__error.html index 564f912b..9ea2f895 100644 --- a/classwinstd_1_1eap__runtime__error.html +++ b/classwinstd_1_1eap__runtime__error.html @@ -305,7 +305,7 @@ typedef DWORD error_type diff --git a/classwinstd_1_1event__data-members.html b/classwinstd_1_1event__data-members.html index f72d8c31..8ff4a095 100644 --- a/classwinstd_1_1event__data-members.html +++ b/classwinstd_1_1event__data-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classwinstd_1_1event__data.html b/classwinstd_1_1event__data.html index 72a7b767..fcbdb972 100644 --- a/classwinstd_1_1event__data.html +++ b/classwinstd_1_1event__data.html @@ -540,7 +540,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 3014d63e..dce90ecf 100644 --- a/classwinstd_1_1event__fn__auto-members.html +++ b/classwinstd_1_1event__fn__auto-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classwinstd_1_1event__fn__auto.html b/classwinstd_1_1event__fn__auto.html index 869595e6..a3d49d6e 100644 --- a/classwinstd_1_1event__fn__auto.html +++ b/classwinstd_1_1event__fn__auto.html @@ -138,7 +138,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 c7032966..820c50be 100644 --- a/classwinstd_1_1event__fn__auto__ret-members.html +++ b/classwinstd_1_1event__fn__auto__ret-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classwinstd_1_1event__fn__auto__ret.html b/classwinstd_1_1event__fn__auto__ret.html index 0f3b717d..1ce0c738 100644 --- a/classwinstd_1_1event__fn__auto__ret.html +++ b/classwinstd_1_1event__fn__auto__ret.html @@ -143,7 +143,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 de16da3d..7ecf227a 100644 --- a/classwinstd_1_1event__log-members.html +++ b/classwinstd_1_1event__log-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1event__log.html b/classwinstd_1_1event__log.html index 11638dc5..43858c7c 100644 --- a/classwinstd_1_1event__log.html +++ b/classwinstd_1_1event__log.html @@ -258,7 +258,7 @@ static const HANDLE invali diff --git a/classwinstd_1_1event__provider-members.html b/classwinstd_1_1event__provider-members.html index 1b2ddf45..bd23da49 100644 --- a/classwinstd_1_1event__provider-members.html +++ b/classwinstd_1_1event__provider-members.html @@ -115,7 +115,7 @@ $(function() { diff --git a/classwinstd_1_1event__provider.html b/classwinstd_1_1event__provider.html index 7f8cb05d..d2517a43 100644 --- a/classwinstd_1_1event__provider.html +++ b/classwinstd_1_1event__provider.html @@ -687,7 +687,7 @@ static const REGHANDLE inv diff --git a/classwinstd_1_1event__rec-members.html b/classwinstd_1_1event__rec-members.html index 7ac1998d..0c75b39c 100644 --- a/classwinstd_1_1event__rec-members.html +++ b/classwinstd_1_1event__rec-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classwinstd_1_1event__rec.html b/classwinstd_1_1event__rec.html index 82159fa2..f4fad320 100644 --- a/classwinstd_1_1event__rec.html +++ b/classwinstd_1_1event__rec.html @@ -531,7 +531,7 @@ Protected Member Functions diff --git a/classwinstd_1_1event__session-members.html b/classwinstd_1_1event__session-members.html index 7b3b2a65..2d663043 100644 --- a/classwinstd_1_1event__session-members.html +++ b/classwinstd_1_1event__session-members.html @@ -118,7 +118,7 @@ $(function() { diff --git a/classwinstd_1_1event__session.html b/classwinstd_1_1event__session.html index 3cb43aa4..3e83a97b 100644 --- a/classwinstd_1_1event__session.html +++ b/classwinstd_1_1event__session.html @@ -691,7 +691,7 @@ static const TRACEHANDLE i diff --git a/classwinstd_1_1event__trace-members.html b/classwinstd_1_1event__trace-members.html index 3abc6af7..836bdd30 100644 --- a/classwinstd_1_1event__trace-members.html +++ b/classwinstd_1_1event__trace-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1event__trace.html b/classwinstd_1_1event__trace.html index 25cd8b0f..aa7dabfe 100644 --- a/classwinstd_1_1event__trace.html +++ b/classwinstd_1_1event__trace.html @@ -258,7 +258,7 @@ static const TRACEHANDLE i diff --git a/classwinstd_1_1event__trace__enabler-members.html b/classwinstd_1_1event__trace__enabler-members.html index 2ea5f908..dfaa4487 100644 --- a/classwinstd_1_1event__trace__enabler-members.html +++ b/classwinstd_1_1event__trace__enabler-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classwinstd_1_1event__trace__enabler.html b/classwinstd_1_1event__trace__enabler.html index faea51c5..87bb46cf 100644 --- a/classwinstd_1_1event__trace__enabler.html +++ b/classwinstd_1_1event__trace__enabler.html @@ -351,7 +351,7 @@ PEVENT_FILTER_DESCRIPTOR m diff --git a/classwinstd_1_1find__file-members.html b/classwinstd_1_1find__file-members.html index d43fba59..1f28fd47 100644 --- a/classwinstd_1_1find__file-members.html +++ b/classwinstd_1_1find__file-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1find__file.html b/classwinstd_1_1find__file.html index 0534d64e..32088d17 100644 --- a/classwinstd_1_1find__file.html +++ b/classwinstd_1_1find__file.html @@ -258,7 +258,7 @@ static const HANDLE invali diff --git a/classwinstd_1_1gdi__handle-members.html b/classwinstd_1_1gdi__handle-members.html index 9871a678..05786d16 100644 --- a/classwinstd_1_1gdi__handle-members.html +++ b/classwinstd_1_1gdi__handle-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1gdi__handle.html b/classwinstd_1_1gdi__handle.html index b3ba3b10..49d09b5d 100644 --- a/classwinstd_1_1gdi__handle.html +++ b/classwinstd_1_1gdi__handle.html @@ -262,7 +262,7 @@ template<class T > diff --git a/classwinstd_1_1handle-members.html b/classwinstd_1_1handle-members.html index a326026e..d31e584e 100644 --- a/classwinstd_1_1handle-members.html +++ b/classwinstd_1_1handle-members.html @@ -106,7 +106,7 @@ $(function() { diff --git a/classwinstd_1_1handle.html b/classwinstd_1_1handle.html index aff4d910..bcf039e6 100644 --- a/classwinstd_1_1handle.html +++ b/classwinstd_1_1handle.html @@ -850,7 +850,7 @@ template<class T , const T INVAL> diff --git a/classwinstd_1_1heap-members.html b/classwinstd_1_1heap-members.html index c7474af7..ce07976a 100644 --- a/classwinstd_1_1heap-members.html +++ b/classwinstd_1_1heap-members.html @@ -108,7 +108,7 @@ $(function() { diff --git a/classwinstd_1_1heap.html b/classwinstd_1_1heap.html index 1f447474..21fadf42 100644 --- a/classwinstd_1_1heap.html +++ b/classwinstd_1_1heap.html @@ -293,7 +293,7 @@ static const HANDLE invali diff --git a/classwinstd_1_1heap__allocator-members.html b/classwinstd_1_1heap__allocator-members.html index cf4a2179..96e75391 100644 --- a/classwinstd_1_1heap__allocator-members.html +++ b/classwinstd_1_1heap__allocator-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/classwinstd_1_1heap__allocator.html b/classwinstd_1_1heap__allocator.html index 766feb57..8102dc89 100644 --- a/classwinstd_1_1heap__allocator.html +++ b/classwinstd_1_1heap__allocator.html @@ -461,7 +461,7 @@ template<class _Ty > diff --git a/classwinstd_1_1impersonator-members.html b/classwinstd_1_1impersonator-members.html index 98194909..472f1773 100644 --- a/classwinstd_1_1impersonator-members.html +++ b/classwinstd_1_1impersonator-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classwinstd_1_1impersonator.html b/classwinstd_1_1impersonator.html index 73b8f5b1..cf26440f 100644 --- a/classwinstd_1_1impersonator.html +++ b/classwinstd_1_1impersonator.html @@ -155,7 +155,7 @@ BOOL m_cookie diff --git a/classwinstd_1_1library-members.html b/classwinstd_1_1library-members.html index 472c3271..59bcf20d 100644 --- a/classwinstd_1_1library-members.html +++ b/classwinstd_1_1library-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1library.html b/classwinstd_1_1library.html index 72852707..6783f5b4 100644 --- a/classwinstd_1_1library.html +++ b/classwinstd_1_1library.html @@ -258,7 +258,7 @@ static const HMODULE inval diff --git a/classwinstd_1_1num__runtime__error-members.html b/classwinstd_1_1num__runtime__error-members.html index d8944905..9ae5329a 100644 --- a/classwinstd_1_1num__runtime__error-members.html +++ b/classwinstd_1_1num__runtime__error-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classwinstd_1_1num__runtime__error.html b/classwinstd_1_1num__runtime__error.html index 48225fcc..3e2e07be 100644 --- a/classwinstd_1_1num__runtime__error.html +++ b/classwinstd_1_1num__runtime__error.html @@ -225,7 +225,7 @@ template<typename _Tn > diff --git a/classwinstd_1_1process__information-members.html b/classwinstd_1_1process__information-members.html index ebe6ebf8..019c9ae3 100644 --- a/classwinstd_1_1process__information-members.html +++ b/classwinstd_1_1process__information-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/classwinstd_1_1process__information.html b/classwinstd_1_1process__information.html index 7f74bdb4..f1e51372 100644 --- a/classwinstd_1_1process__information.html +++ b/classwinstd_1_1process__information.html @@ -111,7 +111,7 @@ Public Member Functions diff --git a/classwinstd_1_1ref__unique__ptr-members.html b/classwinstd_1_1ref__unique__ptr-members.html index 20eeead7..a9c3344f 100644 --- a/classwinstd_1_1ref__unique__ptr-members.html +++ b/classwinstd_1_1ref__unique__ptr-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classwinstd_1_1ref__unique__ptr.html b/classwinstd_1_1ref__unique__ptr.html index ab037dd6..805ed494 100644 --- a/classwinstd_1_1ref__unique__ptr.html +++ b/classwinstd_1_1ref__unique__ptr.html @@ -260,7 +260,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 55959970..bf1f4319 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 @@ -90,7 +90,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 1b214c3f..fc746c21 100644 --- a/classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4.html +++ b/classwinstd_1_1ref__unique__ptr_3_01___ty_0f_0e_00_01___dx_01_4.html @@ -260,7 +260,7 @@ template<class _Ty , class _Dx > diff --git a/classwinstd_1_1reg__key-members.html b/classwinstd_1_1reg__key-members.html index d24c38c1..c3e99ded 100644 --- a/classwinstd_1_1reg__key-members.html +++ b/classwinstd_1_1reg__key-members.html @@ -108,7 +108,7 @@ $(function() { diff --git a/classwinstd_1_1reg__key.html b/classwinstd_1_1reg__key.html index ec27f063..0bd5feac 100644 --- a/classwinstd_1_1reg__key.html +++ b/classwinstd_1_1reg__key.html @@ -302,7 +302,7 @@ static const HKEY invalid< diff --git a/classwinstd_1_1sanitizing__allocator-members.html b/classwinstd_1_1sanitizing__allocator-members.html index b490647e..87d096ad 100644 --- a/classwinstd_1_1sanitizing__allocator-members.html +++ b/classwinstd_1_1sanitizing__allocator-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classwinstd_1_1sanitizing__allocator.html b/classwinstd_1_1sanitizing__allocator.html index ecde16f3..0d7fd1cb 100644 --- a/classwinstd_1_1sanitizing__allocator.html +++ b/classwinstd_1_1sanitizing__allocator.html @@ -137,7 +137,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 ffaf7aa6..7ec52018 100644 --- a/classwinstd_1_1sanitizing__blob-members.html +++ b/classwinstd_1_1sanitizing__blob-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/classwinstd_1_1sanitizing__blob.html b/classwinstd_1_1sanitizing__blob.html index 7798fc52..20f3075f 100644 --- a/classwinstd_1_1sanitizing__blob.html +++ b/classwinstd_1_1sanitizing__blob.html @@ -114,7 +114,7 @@ class winstd::sanitizing_blob< N >

Sanitizing BLOB.

diff --git a/classwinstd_1_1sc__handle-members.html b/classwinstd_1_1sc__handle-members.html index 8ee880ef..b7a99c22 100644 --- a/classwinstd_1_1sc__handle-members.html +++ b/classwinstd_1_1sc__handle-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1sc__handle.html b/classwinstd_1_1sc__handle.html index b02fc7b6..6622c628 100644 --- a/classwinstd_1_1sc__handle.html +++ b/classwinstd_1_1sc__handle.html @@ -257,7 +257,7 @@ static const SC_HANDLE inv diff --git a/classwinstd_1_1sec__buffer__desc-members.html b/classwinstd_1_1sec__buffer__desc-members.html index 1cf92aa3..b520189a 100644 --- a/classwinstd_1_1sec__buffer__desc-members.html +++ b/classwinstd_1_1sec__buffer__desc-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/classwinstd_1_1sec__buffer__desc.html b/classwinstd_1_1sec__buffer__desc.html index caeb1e3c..4424fe00 100644 --- a/classwinstd_1_1sec__buffer__desc.html +++ b/classwinstd_1_1sec__buffer__desc.html @@ -139,7 +139,7 @@ Public Member Functions diff --git a/classwinstd_1_1sec__context-members.html b/classwinstd_1_1sec__context-members.html index ff5eba6b..fcd65d41 100644 --- a/classwinstd_1_1sec__context-members.html +++ b/classwinstd_1_1sec__context-members.html @@ -114,7 +114,7 @@ $(function() { diff --git a/classwinstd_1_1sec__context.html b/classwinstd_1_1sec__context.html index 9542074a..3d0a696d 100644 --- a/classwinstd_1_1sec__context.html +++ b/classwinstd_1_1sec__context.html @@ -489,7 +489,7 @@ static const PCtxtHandle i diff --git a/classwinstd_1_1sec__credentials-members.html b/classwinstd_1_1sec__credentials-members.html index 1eeb968b..000ede6d 100644 --- a/classwinstd_1_1sec__credentials-members.html +++ b/classwinstd_1_1sec__credentials-members.html @@ -113,7 +113,7 @@ $(function() { diff --git a/classwinstd_1_1sec__credentials.html b/classwinstd_1_1sec__credentials.html index c765121b..13dcd22e 100644 --- a/classwinstd_1_1sec__credentials.html +++ b/classwinstd_1_1sec__credentials.html @@ -468,7 +468,7 @@ static const PCredHandle i diff --git a/classwinstd_1_1sec__runtime__error-members.html b/classwinstd_1_1sec__runtime__error-members.html index c5fe0866..5a733694 100644 --- a/classwinstd_1_1sec__runtime__error-members.html +++ b/classwinstd_1_1sec__runtime__error-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classwinstd_1_1sec__runtime__error.html b/classwinstd_1_1sec__runtime__error.html index 39b9c13c..865cf148 100644 --- a/classwinstd_1_1sec__runtime__error.html +++ b/classwinstd_1_1sec__runtime__error.html @@ -265,7 +265,7 @@ typedef SECURITY_STATUS er diff --git a/classwinstd_1_1security__attributes-members.html b/classwinstd_1_1security__attributes-members.html index c31a299e..4ebdcf9c 100644 --- a/classwinstd_1_1security__attributes-members.html +++ b/classwinstd_1_1security__attributes-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classwinstd_1_1security__attributes.html b/classwinstd_1_1security__attributes.html index 28dc1a56..ba0f2967 100644 --- a/classwinstd_1_1security__attributes.html +++ b/classwinstd_1_1security__attributes.html @@ -112,7 +112,7 @@ Public Member Functions diff --git a/classwinstd_1_1security__id-members.html b/classwinstd_1_1security__id-members.html index 3a51caa6..17fd56a2 100644 --- a/classwinstd_1_1security__id-members.html +++ b/classwinstd_1_1security__id-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1security__id.html b/classwinstd_1_1security__id.html index 76056f39..61d6fc0f 100644 --- a/classwinstd_1_1security__id.html +++ b/classwinstd_1_1security__id.html @@ -257,7 +257,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 c5999f2b..3f4be9cc 100644 --- a/classwinstd_1_1setup__device__info__list-members.html +++ b/classwinstd_1_1setup__device__info__list-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1setup__device__info__list.html b/classwinstd_1_1setup__device__info__list.html index fa74fc98..bdf173d7 100644 --- a/classwinstd_1_1setup__device__info__list.html +++ b/classwinstd_1_1setup__device__info__list.html @@ -260,7 +260,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 3d0ccb17..7cb35b5f 100644 --- a/classwinstd_1_1setup__driver__info__list__builder-members.html +++ b/classwinstd_1_1setup__driver__info__list__builder-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/classwinstd_1_1setup__driver__info__list__builder.html b/classwinstd_1_1setup__driver__info__list__builder.html index 59894ae0..77c1bb71 100644 --- a/classwinstd_1_1setup__driver__info__list__builder.html +++ b/classwinstd_1_1setup__driver__info__list__builder.html @@ -209,7 +209,7 @@ Public Member Functions diff --git a/classwinstd_1_1string__guid-members.html b/classwinstd_1_1string__guid-members.html index aef6b51c..0045a8b5 100644 --- a/classwinstd_1_1string__guid-members.html +++ b/classwinstd_1_1string__guid-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/classwinstd_1_1string__guid.html b/classwinstd_1_1string__guid.html index 566c9db6..964cbb37 100644 --- a/classwinstd_1_1string__guid.html +++ b/classwinstd_1_1string__guid.html @@ -148,7 +148,7 @@ Public Member Functions diff --git a/classwinstd_1_1system__impersonator-members.html b/classwinstd_1_1system__impersonator-members.html index 2e57ca34..afcd8cbd 100644 --- a/classwinstd_1_1system__impersonator-members.html +++ b/classwinstd_1_1system__impersonator-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classwinstd_1_1system__impersonator.html b/classwinstd_1_1system__impersonator.html index 9822221f..00ddb953 100644 --- a/classwinstd_1_1system__impersonator.html +++ b/classwinstd_1_1system__impersonator.html @@ -130,7 +130,7 @@ BOOL m_cookie diff --git a/classwinstd_1_1user__impersonator-members.html b/classwinstd_1_1user__impersonator-members.html index cb56861e..78cbb382 100644 --- a/classwinstd_1_1user__impersonator-members.html +++ b/classwinstd_1_1user__impersonator-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classwinstd_1_1user__impersonator.html b/classwinstd_1_1user__impersonator.html index 00e5b216..61bd26f1 100644 --- a/classwinstd_1_1user__impersonator.html +++ b/classwinstd_1_1user__impersonator.html @@ -165,7 +165,7 @@ BOOL m_cookie diff --git a/classwinstd_1_1variant-members.html b/classwinstd_1_1variant-members.html index 49e362a1..0880cefa 100644 --- a/classwinstd_1_1variant-members.html +++ b/classwinstd_1_1variant-members.html @@ -144,7 +144,7 @@ $(function() { diff --git a/classwinstd_1_1variant.html b/classwinstd_1_1variant.html index c126782d..57f7a39c 100644 --- a/classwinstd_1_1variant.html +++ b/classwinstd_1_1variant.html @@ -614,7 +614,7 @@ virtual ~variant () diff --git a/classwinstd_1_1vmemory-members.html b/classwinstd_1_1vmemory-members.html index 47d0381f..48a02548 100644 --- a/classwinstd_1_1vmemory-members.html +++ b/classwinstd_1_1vmemory-members.html @@ -114,7 +114,7 @@ $(function() { diff --git a/classwinstd_1_1vmemory.html b/classwinstd_1_1vmemory.html index 1985b258..29f1cfd9 100644 --- a/classwinstd_1_1vmemory.html +++ b/classwinstd_1_1vmemory.html @@ -505,7 +505,7 @@ static const LPVOID invali diff --git a/classwinstd_1_1waddrinfo-members.html b/classwinstd_1_1waddrinfo-members.html index 9386fd3e..471eea34 100644 --- a/classwinstd_1_1waddrinfo-members.html +++ b/classwinstd_1_1waddrinfo-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1waddrinfo.html b/classwinstd_1_1waddrinfo.html index 5855d8da..c02343c0 100644 --- a/classwinstd_1_1waddrinfo.html +++ b/classwinstd_1_1waddrinfo.html @@ -258,7 +258,7 @@ static const PADDRINFOW in diff --git a/classwinstd_1_1win__handle-members.html b/classwinstd_1_1win__handle-members.html index c317bffe..a69466ec 100644 --- a/classwinstd_1_1win__handle-members.html +++ b/classwinstd_1_1win__handle-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1win__handle.html b/classwinstd_1_1win__handle.html index a3b9713e..199ac224 100644 --- a/classwinstd_1_1win__handle.html +++ b/classwinstd_1_1win__handle.html @@ -262,7 +262,7 @@ template<HANDLE INVALID> diff --git a/classwinstd_1_1win__runtime__error-members.html b/classwinstd_1_1win__runtime__error-members.html index 0ecf6a7f..9d0957dc 100644 --- a/classwinstd_1_1win__runtime__error-members.html +++ b/classwinstd_1_1win__runtime__error-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classwinstd_1_1win__runtime__error.html b/classwinstd_1_1win__runtime__error.html index b4cb81c7..e30cf72c 100644 --- a/classwinstd_1_1win__runtime__error.html +++ b/classwinstd_1_1win__runtime__error.html @@ -335,7 +335,7 @@ typedef DWORD error_type diff --git a/classwinstd_1_1window__dc-members.html b/classwinstd_1_1window__dc-members.html index b89b29da..b0d52517 100644 --- a/classwinstd_1_1window__dc-members.html +++ b/classwinstd_1_1window__dc-members.html @@ -112,7 +112,7 @@ $(function() { diff --git a/classwinstd_1_1window__dc.html b/classwinstd_1_1window__dc.html index d1b99aff..dfcc6ea5 100644 --- a/classwinstd_1_1window__dc.html +++ b/classwinstd_1_1window__dc.html @@ -281,7 +281,7 @@ static const HDC invalid diff --git a/classwinstd_1_1wintrust-members.html b/classwinstd_1_1wintrust-members.html index 03b68346..16452ac8 100644 --- a/classwinstd_1_1wintrust-members.html +++ b/classwinstd_1_1wintrust-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/classwinstd_1_1wintrust.html b/classwinstd_1_1wintrust.html index f0ff6f20..cc2a836e 100644 --- a/classwinstd_1_1wintrust.html +++ b/classwinstd_1_1wintrust.html @@ -105,7 +105,7 @@ virtual ~wintrust () diff --git a/classwinstd_1_1wlan__handle-members.html b/classwinstd_1_1wlan__handle-members.html index 171c6a7a..c69762e4 100644 --- a/classwinstd_1_1wlan__handle-members.html +++ b/classwinstd_1_1wlan__handle-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classwinstd_1_1wlan__handle.html b/classwinstd_1_1wlan__handle.html index 4d3a2e3d..130fcfb4 100644 --- a/classwinstd_1_1wlan__handle.html +++ b/classwinstd_1_1wlan__handle.html @@ -258,7 +258,7 @@ static const HANDLE invali diff --git a/classwinstd_1_1ws2__runtime__error-members.html b/classwinstd_1_1ws2__runtime__error-members.html index 0c975722..728d8062 100644 --- a/classwinstd_1_1ws2__runtime__error-members.html +++ b/classwinstd_1_1ws2__runtime__error-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classwinstd_1_1ws2__runtime__error.html b/classwinstd_1_1ws2__runtime__error.html index 6bb0e6fd..d506cea9 100644 --- a/classwinstd_1_1ws2__runtime__error.html +++ b/classwinstd_1_1ws2__runtime__error.html @@ -334,7 +334,7 @@ typedef int error_type diff --git a/classwinstd_1_1wstring__guid-members.html b/classwinstd_1_1wstring__guid-members.html index a024b6b6..85f05f33 100644 --- a/classwinstd_1_1wstring__guid-members.html +++ b/classwinstd_1_1wstring__guid-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/classwinstd_1_1wstring__guid.html b/classwinstd_1_1wstring__guid.html index 103e9b20..71bcadf8 100644 --- a/classwinstd_1_1wstring__guid.html +++ b/classwinstd_1_1wstring__guid.html @@ -148,7 +148,7 @@ Public Member Functions diff --git a/dir_4be4f7b278e009bf0f1906cf31fb73bd.html b/dir_4be4f7b278e009bf0f1906cf31fb73bd.html index 6d570887..d066b2e0 100644 --- a/dir_4be4f7b278e009bf0f1906cf31fb73bd.html +++ b/dir_4be4f7b278e009bf0f1906cf31fb73bd.html @@ -86,7 +86,7 @@ Files diff --git a/dir_6f50bb204833d887b928571856c82fbe.html b/dir_6f50bb204833d887b928571856c82fbe.html index d1fb75ca..8bd6711f 100644 --- a/dir_6f50bb204833d887b928571856c82fbe.html +++ b/dir_6f50bb204833d887b928571856c82fbe.html @@ -116,7 +116,7 @@ Files diff --git a/dir_d44c64559bbebec7f509842c48db8b23.html b/dir_d44c64559bbebec7f509842c48db8b23.html index cc20aaf8..e2140338 100644 --- a/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/dir_d44c64559bbebec7f509842c48db8b23.html @@ -86,7 +86,7 @@ Directories diff --git a/files.html b/files.html index e2407637..800a7c16 100644 --- a/files.html +++ b/files.html @@ -100,7 +100,7 @@ $(function() { diff --git a/functions.html b/functions.html index 4c28c207..2d0c4def 100644 --- a/functions.html +++ b/functions.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_a.html b/functions_a.html index 94983f20..848c6e68 100644 --- a/functions_a.html +++ b/functions_a.html @@ -83,7 +83,7 @@ $(function() { diff --git a/functions_b.html b/functions_b.html index dc3eccb0..6c6743fc 100644 --- a/functions_b.html +++ b/functions_b.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_c.html b/functions_c.html index 71d7ac22..78db1b90 100644 --- a/functions_c.html +++ b/functions_c.html @@ -91,7 +91,7 @@ $(function() { diff --git a/functions_d.html b/functions_d.html index 5b6ec621..40e74670 100644 --- a/functions_d.html +++ b/functions_d.html @@ -89,7 +89,7 @@ $(function() { diff --git a/functions_e.html b/functions_e.html index a5b825fa..7a6d2907 100644 --- a/functions_e.html +++ b/functions_e.html @@ -95,7 +95,7 @@ $(function() { diff --git a/functions_f.html b/functions_f.html index 25fbcbae..d9b6a784 100644 --- a/functions_f.html +++ b/functions_f.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func.html b/functions_func.html index c966b58b..6fae3ebe 100644 --- a/functions_func.html +++ b/functions_func.html @@ -83,7 +83,7 @@ $(function() { diff --git a/functions_func_b.html b/functions_func_b.html index 2cbe95e6..01984d5b 100644 --- a/functions_func_b.html +++ b/functions_func_b.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_func_c.html b/functions_func_c.html index cc5f0063..cf9fa01b 100644 --- a/functions_func_c.html +++ b/functions_func_c.html @@ -89,7 +89,7 @@ $(function() { diff --git a/functions_func_d.html b/functions_func_d.html index d643e678..30572290 100644 --- a/functions_func_d.html +++ b/functions_func_d.html @@ -88,7 +88,7 @@ $(function() { diff --git a/functions_func_e.html b/functions_func_e.html index cf6eb6b0..c5757a85 100644 --- a/functions_func_e.html +++ b/functions_func_e.html @@ -94,7 +94,7 @@ $(function() { diff --git a/functions_func_f.html b/functions_func_f.html index 262bc036..3d90cad4 100644 --- a/functions_func_f.html +++ b/functions_func_f.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func_h.html b/functions_func_h.html index 28639a7b..dad72972 100644 --- a/functions_func_h.html +++ b/functions_func_h.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_func_i.html b/functions_func_i.html index 02abc10e..9174a81e 100644 --- a/functions_func_i.html +++ b/functions_func_i.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func_l.html b/functions_func_l.html index 452a8e27..63db45a9 100644 --- a/functions_func_l.html +++ b/functions_func_l.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func_m.html b/functions_func_m.html index 5f01ce13..8e71ead7 100644 --- a/functions_func_m.html +++ b/functions_func_m.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func_n.html b/functions_func_n.html index d72137c0..551d33ec 100644 --- a/functions_func_n.html +++ b/functions_func_n.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_func_o.html b/functions_func_o.html index 94bf4dd4..63585716 100644 --- a/functions_func_o.html +++ b/functions_func_o.html @@ -95,7 +95,7 @@ $(function() { diff --git a/functions_func_p.html b/functions_func_p.html index 4392296f..bdb80033 100644 --- a/functions_func_p.html +++ b/functions_func_p.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func_q.html b/functions_func_q.html index e3438318..1f11b196 100644 --- a/functions_func_q.html +++ b/functions_func_q.html @@ -78,7 +78,7 @@ $(function() { diff --git a/functions_func_r.html b/functions_func_r.html index 4553e61f..3d7e4564 100644 --- a/functions_func_r.html +++ b/functions_func_r.html @@ -83,7 +83,7 @@ $(function() { diff --git a/functions_func_s.html b/functions_func_s.html index 777fecef..e8d52fa6 100644 --- a/functions_func_s.html +++ b/functions_func_s.html @@ -93,7 +93,7 @@ $(function() { diff --git a/functions_func_t.html b/functions_func_t.html index c51edfac..506266ce 100644 --- a/functions_func_t.html +++ b/functions_func_t.html @@ -78,7 +78,7 @@ $(function() { diff --git a/functions_func_u.html b/functions_func_u.html index 27a013d8..62f83d6b 100644 --- a/functions_func_u.html +++ b/functions_func_u.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func_v.html b/functions_func_v.html index 584621ad..bd84832d 100644 --- a/functions_func_v.html +++ b/functions_func_v.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func_w.html b/functions_func_w.html index 9cc1f424..b513d9d2 100644 --- a/functions_func_w.html +++ b/functions_func_w.html @@ -84,7 +84,7 @@ $(function() { diff --git a/functions_func_~.html b/functions_func_~.html index 74d4fade..eeccf532 100644 --- a/functions_func_~.html +++ b/functions_func_~.html @@ -128,7 +128,7 @@ $(function() { diff --git a/functions_h.html b/functions_h.html index e85a162b..b84dc633 100644 --- a/functions_h.html +++ b/functions_h.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_i.html b/functions_i.html index e49e0c73..a8282e77 100644 --- a/functions_i.html +++ b/functions_i.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_l.html b/functions_l.html index 0bd44b12..9453600a 100644 --- a/functions_l.html +++ b/functions_l.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_m.html b/functions_m.html index 3daa26b3..456a46a9 100644 --- a/functions_m.html +++ b/functions_m.html @@ -115,7 +115,7 @@ $(function() { diff --git a/functions_n.html b/functions_n.html index d93c2f4d..e7b4ca2c 100644 --- a/functions_n.html +++ b/functions_n.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_o.html b/functions_o.html index 41d6363d..02fbe101 100644 --- a/functions_o.html +++ b/functions_o.html @@ -96,7 +96,7 @@ $(function() { diff --git a/functions_p.html b/functions_p.html index 06441896..1777e233 100644 --- a/functions_p.html +++ b/functions_p.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_q.html b/functions_q.html index 14339d0e..1da457aa 100644 --- a/functions_q.html +++ b/functions_q.html @@ -78,7 +78,7 @@ $(function() { diff --git a/functions_r.html b/functions_r.html index 730cc49f..3a9a34f7 100644 --- a/functions_r.html +++ b/functions_r.html @@ -84,7 +84,7 @@ $(function() { diff --git a/functions_s.html b/functions_s.html index 6879f6c7..c9c736cf 100644 --- a/functions_s.html +++ b/functions_s.html @@ -94,7 +94,7 @@ $(function() { diff --git a/functions_t.html b/functions_t.html index fef3a72d..e0e2f1d5 100644 --- a/functions_t.html +++ b/functions_t.html @@ -78,7 +78,7 @@ $(function() { diff --git a/functions_type.html b/functions_type.html index 7a0d9d15..c2c0ab75 100644 --- a/functions_type.html +++ b/functions_type.html @@ -87,7 +87,7 @@ $(function() { diff --git a/functions_u.html b/functions_u.html index cf4e9351..a11247f3 100644 --- a/functions_u.html +++ b/functions_u.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_v.html b/functions_v.html index d5d925ec..04760efb 100644 --- a/functions_v.html +++ b/functions_v.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_vars.html b/functions_vars.html index 37b6d905..9b837fa3 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -118,7 +118,7 @@ $(function() { diff --git a/functions_w.html b/functions_w.html index 35386770..9eee88a3 100644 --- a/functions_w.html +++ b/functions_w.html @@ -84,7 +84,7 @@ $(function() { diff --git a/functions_~.html b/functions_~.html index 97c2600c..98a6a509 100644 --- a/functions_~.html +++ b/functions_~.html @@ -128,7 +128,7 @@ $(function() { diff --git a/group___setup_a_p_i.html b/group___setup_a_p_i.html index d27966a1..8a045cc0 100644 --- a/group___setup_a_p_i.html +++ b/group___setup_a_p_i.html @@ -89,7 +89,7 @@ Classes diff --git a/group___win_sock2_a_p_i.html b/group___win_sock2_a_p_i.html index 5cebb086..dab94789 100644 --- a/group___win_sock2_a_p_i.html +++ b/group___win_sock2_a_p_i.html @@ -213,7 +213,7 @@ Functions diff --git a/group___win_std_c_o_m.html b/group___win_std_c_o_m.html index 31234719..03b3e5e5 100644 --- a/group___win_std_c_o_m.html +++ b/group___win_std_c_o_m.html @@ -217,7 +217,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 63e1dd0b..578ff7ab 100644 --- a/group___win_std_cred_a_p_i.html +++ b/group___win_std_cred_a_p_i.html @@ -442,7 +442,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 f5450703..def6cd37 100644 --- a/group___win_std_crypto_a_p_i.html +++ b/group___win_std_crypto_a_p_i.html @@ -1195,7 +1195,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 4ab59e93..829629f0 100644 --- a/group___win_std_e_a_p_a_p_i.html +++ b/group___win_std_e_a_p_a_p_i.html @@ -344,7 +344,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 49d9d612..cfda07d6 100644 --- a/group___win_std_e_t_w_a_p_i.html +++ b/group___win_std_e_t_w_a_p_i.html @@ -291,7 +291,7 @@ template<class _Ty , class _Ax > diff --git a/group___win_std_exceptions.html b/group___win_std_exceptions.html index ed3e4452..8b564d93 100644 --- a/group___win_std_exceptions.html +++ b/group___win_std_exceptions.html @@ -98,7 +98,7 @@ Classes diff --git a/group___win_std_gdi_a_p_i.html b/group___win_std_gdi_a_p_i.html index 4a02008b..bcab8e97 100644 --- a/group___win_std_gdi_a_p_i.html +++ b/group___win_std_gdi_a_p_i.html @@ -95,7 +95,7 @@ Classes diff --git a/group___win_std_general.html b/group___win_std_general.html index c1f0a32b..89f3aed1 100644 --- a/group___win_std_general.html +++ b/group___win_std_general.html @@ -284,7 +284,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 d0667f43..ac81a207 100644 --- a/group___win_std_m_s_i_a_p_i.html +++ b/group___win_std_m_s_i_a_p_i.html @@ -645,7 +645,7 @@ template<class _Ty , class _Ax > diff --git a/group___win_std_mem_sanitize.html b/group___win_std_mem_sanitize.html index a4816315..d5387f19 100644 --- a/group___win_std_mem_sanitize.html +++ b/group___win_std_mem_sanitize.html @@ -138,7 +138,7 @@ typedef diff --git a/group___win_std_s_d_d_l.html b/group___win_std_s_d_d_l.html index e917930e..c61db68d 100644 --- a/group___win_std_s_d_d_l.html +++ b/group___win_std_s_d_d_l.html @@ -198,7 +198,7 @@ Functions diff --git a/group___win_std_security_a_p_i.html b/group___win_std_security_a_p_i.html index 69496cad..c8f35071 100644 --- a/group___win_std_security_a_p_i.html +++ b/group___win_std_security_a_p_i.html @@ -92,7 +92,7 @@ Classes diff --git a/group___win_std_shell_w_a_p_i.html b/group___win_std_shell_w_a_p_i.html index 333b2dd9..3414ba59 100644 --- a/group___win_std_shell_w_a_p_i.html +++ b/group___win_std_shell_w_a_p_i.html @@ -86,6 +86,14 @@ Functions 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...
  +template<class _Traits , class _Ax > +static void PathRemoveBackslashA (std::basic_string< char, _Traits, _Ax > &sValue) + Removes the trailing backslash from a given path. More...
+  +template<class _Traits , class _Ax > +static void PathRemoveBackslashW (std::basic_string< wchar_t, _Traits, _Ax > &sValue) + Removes the trailing backslash from a given path. More...

Detailed Description

Function Documentation

@@ -169,12 +177,74 @@ template<class _Traits , class _Ax >

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.

See also
PathCanonicalize function
+ + + +

◆ PathRemoveBackslashA()

+ +
+
+
+template<class _Traits , class _Ax >
+ + + + + +
+ + + + + + + + +
static void PathRemoveBackslashA (std::basic_string< char, _Traits, _Ax > & sValue)
+
+static
+
+ +

Removes the trailing backslash from a given path.

+
See also
PathRemoveBackslashW function
+ +
+
+ +

◆ PathRemoveBackslashW()

+ +
+
+
+template<class _Traits , class _Ax >
+ + + + + +
+ + + + + + + + +
static void PathRemoveBackslashW (std::basic_string< wchar_t, _Traits, _Ax > & sValue)
+
+static
+
+ +

Removes the trailing backslash from a given path.

+
See also
PathRemoveBackslashW function
+
diff --git a/group___win_std_str_format.html b/group___win_std_str_format.html index 46134801..d12576e4 100644 --- a/group___win_std_str_format.html +++ b/group___win_std_str_format.html @@ -566,7 +566,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 1aa90737..298c043a 100644 --- a/group___win_std_sys_handles.html +++ b/group___win_std_sys_handles.html @@ -184,7 +184,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 29ecc8e8..1bccffdb 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 @@ -203,7 +203,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 1831a945..a65b51c5 100644 --- a/group___win_std_win_a_p_i.html +++ b/group___win_std_win_a_p_i.html @@ -366,6 +366,15 @@ Functions static BOOL DuplicateTokenEx (HANDLE hExistingToken, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, winstd::win_handle< NULL > &NewToken)  Creates a new access token that duplicates an existing token. This function can create either a primary token or an impersonation token. More...
  +static BOOL AllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, winstd::security_id &Sid) + Allocates and initializes a security identifier (SID) with up to eight subauthorities. More...
+  +static DWORD SetEntriesInAclA (ULONG cCountOfExplicitEntries, PEXPLICIT_ACCESS_A pListOfExplicitEntries, PACL OldAcl, std::unique_ptr< ACL, winstd::LocalFree_delete< ACL > > &Acl) + Creates a new access control list (ACL) by merging new access control or audit control information into an existing ACL structure. More...
+  +static DWORD SetEntriesInAclW (ULONG cCountOfExplicitEntries, PEXPLICIT_ACCESS_W pListOfExplicitEntries, PACL OldAcl, std::unique_ptr< ACL, winstd::LocalFree_delete< ACL > > &Acl) + Creates a new access control list (ACL) by merging new access control or audit control information into an existing ACL structure. More...

Detailed Description

Macro Definition Documentation

@@ -529,6 +538,99 @@ Functions

Function Documentation

+ +

◆ AllocateAndInitializeSid()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static BOOL AllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
BYTE nSubAuthorityCount,
DWORD nSubAuthority0,
DWORD nSubAuthority1,
DWORD nSubAuthority2,
DWORD nSubAuthority3,
DWORD nSubAuthority4,
DWORD nSubAuthority5,
DWORD nSubAuthority6,
DWORD nSubAuthority7,
winstd::security_idSid 
)
+
+static
+
+ +

Allocates and initializes a security identifier (SID) with up to eight subauthorities.

+
See also
AllocateAndInitializeSid function
+ +
+

◆ CreateWellKnownSid()

@@ -3038,6 +3140,108 @@ template<class _Traits1 , class _Ax1 , class _Traits2 , class _Ax2 >
Note
This function cleans all internal buffers using SecureZeroMemory() before returning.
See also
WideCharToMultiByte function
+ + + +

◆ SetEntriesInAclA()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static DWORD SetEntriesInAclA (ULONG cCountOfExplicitEntries,
PEXPLICIT_ACCESS_A pListOfExplicitEntries,
PACL OldAcl,
std::unique_ptr< ACL, winstd::LocalFree_delete< ACL > > & Acl 
)
+
+static
+
+ +

Creates a new access control list (ACL) by merging new access control or audit control information into an existing ACL structure.

+
See also
SetEntriesInAclW function
+ +
+
+ +

◆ SetEntriesInAclW()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static DWORD SetEntriesInAclW (ULONG cCountOfExplicitEntries,
PEXPLICIT_ACCESS_W pListOfExplicitEntries,
PACL OldAcl,
std::unique_ptr< ACL, winstd::LocalFree_delete< ACL > > & Acl 
)
+
+static
+
+ +

Creates a new access control list (ACL) by merging new access control or audit control information into an existing ACL structure.

+
See also
SetEntriesInAclW function
+
@@ -3364,7 +3568,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 e3ca3958..6ad49aff 100644 --- a/group___win_trust_a_p_i.html +++ b/group___win_trust_a_p_i.html @@ -86,7 +86,7 @@ Classes diff --git a/hierarchy.html b/hierarchy.html index 8ee1ae18..36d78b1a 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -219,7 +219,7 @@ $(function() { diff --git a/index.html b/index.html index b40538de..0e8bb976 100644 --- a/index.html +++ b/index.html @@ -143,7 +143,7 @@ Usage diff --git a/md__s_e_c_u_r_i_t_y.html b/md__s_e_c_u_r_i_t_y.html index f864b222..af19632d 100644 --- a/md__s_e_c_u_r_i_t_y.html +++ b/md__s_e_c_u_r_i_t_y.html @@ -89,7 +89,7 @@ Reporting a Vulnerability diff --git a/modules.html b/modules.html index e5ba142d..62334379 100644 --- a/modules.html +++ b/modules.html @@ -100,7 +100,7 @@ $(function() { diff --git a/pages.html b/pages.html index 43d3e44b..b9ab88e7 100644 --- a/pages.html +++ b/pages.html @@ -81,7 +81,7 @@ $(function() { diff --git a/pch_8h_source.html b/pch_8h_source.html index b2187086..6f9f2886 100644 --- a/pch_8h_source.html +++ b/pch_8h_source.html @@ -107,7 +107,7 @@ $(function() { diff --git a/search/all_1.js b/search/all_1.js index 06bd9915..24825947 100644 --- a/search/all_1.js +++ b/search/all_1.js @@ -5,7 +5,8 @@ var searchData= ['addrinfo_2',['addrinfo',['../classwinstd_1_1addrinfo.html',1,'winstd']]], ['alloc_3',['alloc',['../classwinstd_1_1vmemory.html#a3a2a287a47ac11ce1eb0490b5bb37c3c',1,'winstd::vmemory']]], ['allocate_4',['allocate',['../classwinstd_1_1heap__allocator.html#a371eaa06a2056171126eba66d7023b03',1,'winstd::heap_allocator']]], - ['attach_5',['attach',['../classwinstd_1_1handle.html#ab2a98042c3b88fda687e34d370756f11',1,'winstd::handle::attach()'],['../classwinstd_1_1event__session.html#afe43f725628f047dadc8e44f4a8028b7',1,'winstd::event_session::attach()'],['../classwinstd_1_1vmemory.html#a70e3154374bf7a00c7ba1ea62c6f16a4',1,'winstd::vmemory::attach()']]], - ['attach_5fduplicated_6',['attach_duplicated',['../classwinstd_1_1dplhandle.html#a876c939da531b1c4f493c2e6ea042f65',1,'winstd::dplhandle']]], - ['auto_2dsanitize_20memory_20management_7',['Auto-sanitize Memory Management',['../group___win_std_mem_sanitize.html',1,'']]] + ['allocateandinitializesid_5',['AllocateAndInitializeSid',['../group___win_std_win_a_p_i.html#ga588f0eb22a9ea276dc2c72d44f44781a',1,'Win.h']]], + ['attach_6',['attach',['../classwinstd_1_1handle.html#ab2a98042c3b88fda687e34d370756f11',1,'winstd::handle::attach()'],['../classwinstd_1_1event__session.html#afe43f725628f047dadc8e44f4a8028b7',1,'winstd::event_session::attach()'],['../classwinstd_1_1vmemory.html#a70e3154374bf7a00c7ba1ea62c6f16a4',1,'winstd::vmemory::attach()']]], + ['attach_5fduplicated_7',['attach_duplicated',['../classwinstd_1_1dplhandle.html#a876c939da531b1c4f493c2e6ea042f65',1,'winstd::dplhandle']]], + ['auto_2dsanitize_20memory_20management_8',['Auto-sanitize Memory Management',['../group___win_std_mem_sanitize.html',1,'']]] ]; diff --git a/search/all_11.js b/search/all_11.js index 332c0555..b44543da 100644 --- a/search/all_11.js +++ b/search/all_11.js @@ -15,28 +15,30 @@ var searchData= ['securewidechartomultibyte_12',['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#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'],['../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']]], ['security_20api_13',['Security API',['../group___win_std_security_a_p_i.html',1,'']]], ['security_20policy_14',['Security Policy',['../md__s_e_c_u_r_i_t_y.html',1,'']]], - ['security_5fattributes_15',['security_attributes',['../classwinstd_1_1security__attributes.html#aa65302a5a16ca4dae9d76a2aea0788b2',1,'winstd::security_attributes::security_attributes() noexcept'],['../classwinstd_1_1security__attributes.html#a230282fcc282814fd18aa239c7daaa17',1,'winstd::security_attributes::security_attributes(security_attributes &&a) noexcept'],['../classwinstd_1_1security__attributes.html',1,'winstd::security_attributes']]], + ['security_5fattributes_15',['security_attributes',['../classwinstd_1_1security__attributes.html#a230282fcc282814fd18aa239c7daaa17',1,'winstd::security_attributes::security_attributes(security_attributes &&a) noexcept'],['../classwinstd_1_1security__attributes.html#aa65302a5a16ca4dae9d76a2aea0788b2',1,'winstd::security_attributes::security_attributes() noexcept'],['../classwinstd_1_1security__attributes.html',1,'winstd::security_attributes']]], ['security_5fid_16',['security_id',['../classwinstd_1_1security__id.html',1,'winstd']]], ['set_5fextended_5fdata_17',['set_extended_data',['../classwinstd_1_1event__rec.html#abfab939c3bb27839c3b591b9a62f9470',1,'winstd::event_rec']]], ['set_5fextended_5fdata_5finternal_18',['set_extended_data_internal',['../classwinstd_1_1event__rec.html#a0c1c63cc3a3e2f83924aa9f21a298f6c',1,'winstd::event_rec']]], ['set_5fuser_5fdata_19',['set_user_data',['../classwinstd_1_1event__rec.html#a0df49a47cf45cb76003b85148d7d5098',1,'winstd::event_rec']]], ['set_5fuser_5fdata_5finternal_20',['set_user_data_internal',['../classwinstd_1_1event__rec.html#af71cc10ff1b9f9935c824b7c7a4130b8',1,'winstd::event_rec']]], - ['setup_20api_21',['Setup API',['../group___setup_a_p_i.html',1,'']]], - ['setup_5fdevice_5finfo_5flist_22',['setup_device_info_list',['../classwinstd_1_1setup__device__info__list.html',1,'winstd']]], - ['setup_5fdriver_5finfo_5flist_5fbuilder_23',['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_24',['Shell API',['../group___win_std_shell_w_a_p_i.html',1,'']]], - ['size_25',['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_26',['size_type',['../classwinstd_1_1heap__allocator.html#a01815f4f9097b1447c7ddaa2de868f59',1,'winstd::heap_allocator']]], - ['sprintf_27',['sprintf',['../group___win_std_str_format.html#gac397f655a858a069b3e521940af64331',1,'Common.h']]], - ['start_28',['start',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315aea2b2676c28c0db26d39331a336c6b92',1,'winstd']]], - ['status_29',['status',['../classwinstd_1_1com__initializer.html#ac3c997f810e8439096d8ca14fecb5b7d',1,'winstd::com_initializer::status()'],['../classwinstd_1_1setup__driver__info__list__builder.html#ae9c062e82afc1ee1eda5926a0567637e',1,'winstd::setup_driver_info_list_builder::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()']]], - ['string_20formatting_30',['String Formatting',['../group___win_std_str_format.html',1,'']]], - ['string_5fguid_31',['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_32',['string_msg',['../group___win_std_str_format.html#gae63195e25e08e2b3d9a9b9c2987f5740',1,'winstd']]], - ['string_5fprintf_33',['string_printf',['../group___win_std_str_format.html#ga9dda7a9a763b666f6fe00c4c6626621d',1,'winstd']]], - ['stringtoguid_34',['StringToGuid',['../group___win_std_win_a_p_i.html#gab9c35127ac48f8d941a5354b1a1b7abe',1,'Win.h']]], - ['stringtoguida_35',['StringToGuidA',['../group___win_std_win_a_p_i.html#ga0a3545c7b4d6509b77a9a156e882f32c',1,'Win.h']]], - ['stringtoguidw_36',['StringToGuidW',['../group___win_std_win_a_p_i.html#ga3411488c7daa5c8e03b2ad34764914aa',1,'Win.h']]], - ['system_20handles_37',['System Handles',['../group___win_std_sys_handles.html',1,'']]], - ['system_5fimpersonator_38',['system_impersonator',['../classwinstd_1_1system__impersonator.html#a5e46322f6b3a64e74b6e711cc9dd059b',1,'winstd::system_impersonator::system_impersonator()'],['../classwinstd_1_1system__impersonator.html',1,'winstd::system_impersonator']]] + ['setentriesinacla_21',['SetEntriesInAclA',['../group___win_std_win_a_p_i.html#ga78c62cf670ca44d4cd25fb838dfd06e8',1,'Win.h']]], + ['setentriesinaclw_22',['SetEntriesInAclW',['../group___win_std_win_a_p_i.html#ga473c00779893dfff195afab022a3113e',1,'Win.h']]], + ['setup_20api_23',['Setup API',['../group___setup_a_p_i.html',1,'']]], + ['setup_5fdevice_5finfo_5flist_24',['setup_device_info_list',['../classwinstd_1_1setup__device__info__list.html',1,'winstd']]], + ['setup_5fdriver_5finfo_5flist_5fbuilder_25',['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_26',['Shell API',['../group___win_std_shell_w_a_p_i.html',1,'']]], + ['size_27',['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_28',['size_type',['../classwinstd_1_1heap__allocator.html#a01815f4f9097b1447c7ddaa2de868f59',1,'winstd::heap_allocator']]], + ['sprintf_29',['sprintf',['../group___win_std_str_format.html#gac397f655a858a069b3e521940af64331',1,'Common.h']]], + ['start_30',['start',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315aea2b2676c28c0db26d39331a336c6b92',1,'winstd']]], + ['status_31',['status',['../classwinstd_1_1setup__driver__info__list__builder.html#ae9c062e82afc1ee1eda5926a0567637e',1,'winstd::setup_driver_info_list_builder::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()']]], + ['string_20formatting_32',['String Formatting',['../group___win_std_str_format.html',1,'']]], + ['string_5fguid_33',['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_34',['string_msg',['../group___win_std_str_format.html#gae63195e25e08e2b3d9a9b9c2987f5740',1,'winstd']]], + ['string_5fprintf_35',['string_printf',['../group___win_std_str_format.html#ga9dda7a9a763b666f6fe00c4c6626621d',1,'winstd']]], + ['stringtoguid_36',['StringToGuid',['../group___win_std_win_a_p_i.html#gab9c35127ac48f8d941a5354b1a1b7abe',1,'Win.h']]], + ['stringtoguida_37',['StringToGuidA',['../group___win_std_win_a_p_i.html#ga0a3545c7b4d6509b77a9a156e882f32c',1,'Win.h']]], + ['stringtoguidw_38',['StringToGuidW',['../group___win_std_win_a_p_i.html#ga3411488c7daa5c8e03b2ad34764914aa',1,'Win.h']]], + ['system_20handles_39',['System Handles',['../group___win_std_sys_handles.html',1,'']]], + ['system_5fimpersonator_40',['system_impersonator',['../classwinstd_1_1system__impersonator.html#a5e46322f6b3a64e74b6e711cc9dd059b',1,'winstd::system_impersonator::system_impersonator()'],['../classwinstd_1_1system__impersonator.html',1,'winstd::system_impersonator']]] ]; diff --git a/search/all_e.js b/search/all_e.js index 666d27da..08eb9818 100644 --- a/search/all_e.js +++ b/search/all_e.js @@ -2,11 +2,13 @@ var searchData= [ ['pathcanonicalizea_0',['PathCanonicalizeA',['../group___win_std_shell_w_a_p_i.html#gabc79615c035f76d08ddced61807b6676',1,'Shell.h']]], ['pathcanonicalizew_1',['PathCanonicalizeW',['../group___win_std_shell_w_a_p_i.html#ga2bb4436e8e3b7452b48d01cbb18bc818',1,'Shell.h']]], - ['peap_2',['peap',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315ab62d9100a672844bff4ac5cbc8de9fce',1,'winstd']]], - ['pointer_3',['pointer',['../classwinstd_1_1heap__allocator.html#ae04bc3ff970d32e6a2967072efdb06cd',1,'winstd::heap_allocator']]], - ['printf_5flpolestr_4',['PRINTF_LPOLESTR',['../group___win_std_str_format.html#ga1bb2b564655d7b0dee3ec63a0fda2eb5',1,'Common.h']]], - ['printf_5flptstr_5',['PRINTF_LPTSTR',['../group___win_std_str_format.html#ga145b6285cc6fced0a7a61c4368b0bf12',1,'Common.h']]], - ['process_6',['process',['../classwinstd_1_1sec__context.html#a07d7c85d0db22a2b7ababdac632b3c54',1,'winstd::sec_context::process()'],['../group___win_std_win_a_p_i.html#gac5db2a322de45a52343ca98bbec302df',1,'winstd::process()']]], - ['process_5finformation_7',['process_information',['../classwinstd_1_1process__information.html#a8b66efb1e5c75ac7aef0ea02b9f9fd39',1,'winstd::process_information::process_information()'],['../classwinstd_1_1process__information.html',1,'winstd::process_information']]], - ['process_5fsnapshot_8',['process_snapshot',['../group___win_std_win_a_p_i.html#ga59cd7dece6bf5649013f07c929547e80',1,'winstd']]] + ['pathremovebackslasha_2',['PathRemoveBackslashA',['../group___win_std_shell_w_a_p_i.html#gaa1ba3f71c61d6d0c7cb611f3cdc193a8',1,'Shell.h']]], + ['pathremovebackslashw_3',['PathRemoveBackslashW',['../group___win_std_shell_w_a_p_i.html#ga5784e817cc8d4a8e45199e871f61da6c',1,'Shell.h']]], + ['peap_4',['peap',['../group___win_std_e_a_p_a_p_i.html#gga50f5584ca708165f43cec42c42243315ab62d9100a672844bff4ac5cbc8de9fce',1,'winstd']]], + ['pointer_5',['pointer',['../classwinstd_1_1heap__allocator.html#ae04bc3ff970d32e6a2967072efdb06cd',1,'winstd::heap_allocator']]], + ['printf_5flpolestr_6',['PRINTF_LPOLESTR',['../group___win_std_str_format.html#ga1bb2b564655d7b0dee3ec63a0fda2eb5',1,'Common.h']]], + ['printf_5flptstr_7',['PRINTF_LPTSTR',['../group___win_std_str_format.html#ga145b6285cc6fced0a7a61c4368b0bf12',1,'Common.h']]], + ['process_8',['process',['../classwinstd_1_1sec__context.html#a07d7c85d0db22a2b7ababdac632b3c54',1,'winstd::sec_context::process()'],['../group___win_std_win_a_p_i.html#gac5db2a322de45a52343ca98bbec302df',1,'winstd::process()']]], + ['process_5finformation_9',['process_information',['../classwinstd_1_1process__information.html#a8b66efb1e5c75ac7aef0ea02b9f9fd39',1,'winstd::process_information::process_information()'],['../classwinstd_1_1process__information.html',1,'winstd::process_information']]], + ['process_5fsnapshot_10',['process_snapshot',['../group___win_std_win_a_p_i.html#ga59cd7dece6bf5649013f07c929547e80',1,'winstd']]] ]; diff --git a/search/functions_0.js b/search/functions_0.js index ead10693..6526eed4 100644 --- a/search/functions_0.js +++ b/search/functions_0.js @@ -4,6 +4,7 @@ var searchData= ['actctx_5factivator_1',['actctx_activator',['../classwinstd_1_1actctx__activator.html#a557774255df823c979be34bf5f82a0f2',1,'winstd::actctx_activator']]], ['alloc_2',['alloc',['../classwinstd_1_1vmemory.html#a3a2a287a47ac11ce1eb0490b5bb37c3c',1,'winstd::vmemory']]], ['allocate_3',['allocate',['../classwinstd_1_1heap__allocator.html#a371eaa06a2056171126eba66d7023b03',1,'winstd::heap_allocator']]], - ['attach_4',['attach',['../classwinstd_1_1handle.html#ab2a98042c3b88fda687e34d370756f11',1,'winstd::handle::attach()'],['../classwinstd_1_1event__session.html#afe43f725628f047dadc8e44f4a8028b7',1,'winstd::event_session::attach()'],['../classwinstd_1_1vmemory.html#a70e3154374bf7a00c7ba1ea62c6f16a4',1,'winstd::vmemory::attach()']]], - ['attach_5fduplicated_5',['attach_duplicated',['../classwinstd_1_1dplhandle.html#a876c939da531b1c4f493c2e6ea042f65',1,'winstd::dplhandle']]] + ['allocateandinitializesid_4',['AllocateAndInitializeSid',['../group___win_std_win_a_p_i.html#ga588f0eb22a9ea276dc2c72d44f44781a',1,'Win.h']]], + ['attach_5',['attach',['../classwinstd_1_1handle.html#ab2a98042c3b88fda687e34d370756f11',1,'winstd::handle::attach()'],['../classwinstd_1_1event__session.html#afe43f725628f047dadc8e44f4a8028b7',1,'winstd::event_session::attach()'],['../classwinstd_1_1vmemory.html#a70e3154374bf7a00c7ba1ea62c6f16a4',1,'winstd::vmemory::attach()']]], + ['attach_5fduplicated_6',['attach_duplicated',['../classwinstd_1_1dplhandle.html#a876c939da531b1c4f493c2e6ea042f65',1,'winstd::dplhandle']]] ]; diff --git a/search/functions_10.js b/search/functions_10.js index 81daca05..a9e3ee0d 100644 --- a/search/functions_10.js +++ b/search/functions_10.js @@ -5,20 +5,22 @@ var searchData= ['sec_5fbuffer_5fdesc_2',['sec_buffer_desc',['../classwinstd_1_1sec__buffer__desc.html#aed8a33ad87b31098a60facb3f656cea5',1,'winstd::sec_buffer_desc']]], ['sec_5fcontext_3',['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']]], ['sec_5fcredentials_4',['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']]], - ['sec_5fruntime_5ferror_5',['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)']]], - ['securemultibytetowidechar_6',['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']]], + ['sec_5fruntime_5ferror_5',['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)']]], + ['securemultibytetowidechar_6',['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_7',['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_5fattributes_8',['security_attributes',['../classwinstd_1_1security__attributes.html#aa65302a5a16ca4dae9d76a2aea0788b2',1,'winstd::security_attributes::security_attributes() noexcept'],['../classwinstd_1_1security__attributes.html#a230282fcc282814fd18aa239c7daaa17',1,'winstd::security_attributes::security_attributes(security_attributes &&a) noexcept']]], + ['security_5fattributes_8',['security_attributes',['../classwinstd_1_1security__attributes.html#a230282fcc282814fd18aa239c7daaa17',1,'winstd::security_attributes::security_attributes(security_attributes &&a) noexcept'],['../classwinstd_1_1security__attributes.html#aa65302a5a16ca4dae9d76a2aea0788b2',1,'winstd::security_attributes::security_attributes() noexcept']]], ['set_5fextended_5fdata_9',['set_extended_data',['../classwinstd_1_1event__rec.html#abfab939c3bb27839c3b591b9a62f9470',1,'winstd::event_rec']]], ['set_5fextended_5fdata_5finternal_10',['set_extended_data_internal',['../classwinstd_1_1event__rec.html#a0c1c63cc3a3e2f83924aa9f21a298f6c',1,'winstd::event_rec']]], ['set_5fuser_5fdata_11',['set_user_data',['../classwinstd_1_1event__rec.html#a0df49a47cf45cb76003b85148d7d5098',1,'winstd::event_rec']]], ['set_5fuser_5fdata_5finternal_12',['set_user_data_internal',['../classwinstd_1_1event__rec.html#af71cc10ff1b9f9935c824b7c7a4130b8',1,'winstd::event_rec']]], - ['setup_5fdriver_5finfo_5flist_5fbuilder_13',['setup_driver_info_list_builder',['../classwinstd_1_1setup__driver__info__list__builder.html#a4774edfbe680a3a496e243544a68c94f',1,'winstd::setup_driver_info_list_builder']]], - ['size_14',['size',['../classwinstd_1_1eap__packet.html#a2534ad15ae47e2d46354d9f535f4031f',1,'winstd::eap_packet::size()'],['../classwinstd_1_1data__blob.html#ab2ad06e271e8503d7158408773054d23',1,'winstd::data_blob::size()']]], - ['sprintf_15',['sprintf',['../group___win_std_str_format.html#gac397f655a858a069b3e521940af64331',1,'Common.h']]], - ['status_16',['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_5fguid_17',['string_guid',['../classwinstd_1_1string__guid.html#a507ceea48ffeccc4179239dfb5f4cdb2',1,'winstd::string_guid']]], - ['stringtoguida_18',['StringToGuidA',['../group___win_std_win_a_p_i.html#ga0a3545c7b4d6509b77a9a156e882f32c',1,'Win.h']]], - ['stringtoguidw_19',['StringToGuidW',['../group___win_std_win_a_p_i.html#ga3411488c7daa5c8e03b2ad34764914aa',1,'Win.h']]], - ['system_5fimpersonator_20',['system_impersonator',['../classwinstd_1_1system__impersonator.html#a5e46322f6b3a64e74b6e711cc9dd059b',1,'winstd::system_impersonator']]] + ['setentriesinacla_13',['SetEntriesInAclA',['../group___win_std_win_a_p_i.html#ga78c62cf670ca44d4cd25fb838dfd06e8',1,'Win.h']]], + ['setentriesinaclw_14',['SetEntriesInAclW',['../group___win_std_win_a_p_i.html#ga473c00779893dfff195afab022a3113e',1,'Win.h']]], + ['setup_5fdriver_5finfo_5flist_5fbuilder_15',['setup_driver_info_list_builder',['../classwinstd_1_1setup__driver__info__list__builder.html#a4774edfbe680a3a496e243544a68c94f',1,'winstd::setup_driver_info_list_builder']]], + ['size_16',['size',['../classwinstd_1_1eap__packet.html#a2534ad15ae47e2d46354d9f535f4031f',1,'winstd::eap_packet::size()'],['../classwinstd_1_1data__blob.html#ab2ad06e271e8503d7158408773054d23',1,'winstd::data_blob::size()']]], + ['sprintf_17',['sprintf',['../group___win_std_str_format.html#gac397f655a858a069b3e521940af64331',1,'Common.h']]], + ['status_18',['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_5fguid_19',['string_guid',['../classwinstd_1_1string__guid.html#a507ceea48ffeccc4179239dfb5f4cdb2',1,'winstd::string_guid']]], + ['stringtoguida_20',['StringToGuidA',['../group___win_std_win_a_p_i.html#ga0a3545c7b4d6509b77a9a156e882f32c',1,'Win.h']]], + ['stringtoguidw_21',['StringToGuidW',['../group___win_std_win_a_p_i.html#ga3411488c7daa5c8e03b2ad34764914aa',1,'Win.h']]], + ['system_5fimpersonator_22',['system_impersonator',['../classwinstd_1_1system__impersonator.html#a5e46322f6b3a64e74b6e711cc9dd059b',1,'winstd::system_impersonator']]] ]; diff --git a/search/functions_d.js b/search/functions_d.js index 0cfa2276..a9a36500 100644 --- a/search/functions_d.js +++ b/search/functions_d.js @@ -2,6 +2,8 @@ var searchData= [ ['pathcanonicalizea_0',['PathCanonicalizeA',['../group___win_std_shell_w_a_p_i.html#gabc79615c035f76d08ddced61807b6676',1,'Shell.h']]], ['pathcanonicalizew_1',['PathCanonicalizeW',['../group___win_std_shell_w_a_p_i.html#ga2bb4436e8e3b7452b48d01cbb18bc818',1,'Shell.h']]], - ['process_2',['process',['../classwinstd_1_1sec__context.html#a07d7c85d0db22a2b7ababdac632b3c54',1,'winstd::sec_context']]], - ['process_5finformation_3',['process_information',['../classwinstd_1_1process__information.html#a8b66efb1e5c75ac7aef0ea02b9f9fd39',1,'winstd::process_information']]] + ['pathremovebackslasha_2',['PathRemoveBackslashA',['../group___win_std_shell_w_a_p_i.html#gaa1ba3f71c61d6d0c7cb611f3cdc193a8',1,'Shell.h']]], + ['pathremovebackslashw_3',['PathRemoveBackslashW',['../group___win_std_shell_w_a_p_i.html#ga5784e817cc8d4a8e45199e871f61da6c',1,'Shell.h']]], + ['process_4',['process',['../classwinstd_1_1sec__context.html#a07d7c85d0db22a2b7ababdac632b3c54',1,'winstd::sec_context']]], + ['process_5finformation_5',['process_information',['../classwinstd_1_1process__information.html#a8b66efb1e5c75ac7aef0ea02b9f9fd39',1,'winstd::process_information']]] ]; 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 41445c0a..ba0b6b45 100644 --- a/structwinstd_1_1_co_task_mem_free__delete-members.html +++ b/structwinstd_1_1_co_task_mem_free__delete-members.html @@ -85,7 +85,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 a1807ebb..9758c980 100644 --- a/structwinstd_1_1_co_task_mem_free__delete.html +++ b/structwinstd_1_1_co_task_mem_free__delete.html @@ -137,7 +137,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 dc295d01..234e22e4 100644 --- a/structwinstd_1_1_cred_free__delete-members.html +++ b/structwinstd_1_1_cred_free__delete-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/structwinstd_1_1_cred_free__delete.html b/structwinstd_1_1_cred_free__delete.html index efdb0179..875788fc 100644 --- a/structwinstd_1_1_cred_free__delete.html +++ b/structwinstd_1_1_cred_free__delete.html @@ -150,7 +150,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 3b1afa2d..7e1f5494 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 @@ -87,7 +87,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 35a8ad71..55f7df86 100644 --- a/structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4.html +++ b/structwinstd_1_1_cred_free__delete_3_01___ty_0f_0e_4.html @@ -182,7 +182,7 @@ template<class _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 5125317a..fa53c3f6 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 @@ -85,7 +85,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 5f633b54..6267465d 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 @@ -134,7 +134,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 b74e9c36..6040ba59 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 @@ -85,7 +85,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 ab4e874c..7bf34e33 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 @@ -134,7 +134,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 34921e87..8783fd3a 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 @@ -85,7 +85,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 94fd4eff..cb3aabd4 100644 --- a/structwinstd_1_1_eap_host_peer_free_memory__delete.html +++ b/structwinstd_1_1_eap_host_peer_free_memory__delete.html @@ -137,7 +137,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 3be6535f..df9bce72 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 @@ -85,7 +85,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 6cf98964..1fca4e91 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 @@ -106,7 +106,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 87f555bb..ddb835db 100644 --- a/structwinstd_1_1_local_free__delete-members.html +++ b/structwinstd_1_1_local_free__delete-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/structwinstd_1_1_local_free__delete.html b/structwinstd_1_1_local_free__delete.html index 3f98d21c..3572510b 100644 --- a/structwinstd_1_1_local_free__delete.html +++ b/structwinstd_1_1_local_free__delete.html @@ -150,7 +150,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 3e42a15c..506a81c3 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 @@ -87,7 +87,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 0a1edf2a..a7a89ebd 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 @@ -152,7 +152,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 ca9f4a9c..97668b00 100644 --- a/structwinstd_1_1_unmap_view_of_file__delete-members.html +++ b/structwinstd_1_1_unmap_view_of_file__delete-members.html @@ -87,7 +87,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 d7ee2080..5ef3ad39 100644 --- a/structwinstd_1_1_unmap_view_of_file__delete.html +++ b/structwinstd_1_1_unmap_view_of_file__delete.html @@ -119,7 +119,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 9354f58b..9bbfeaaa 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 @@ -87,7 +87,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 f1491688..a46a9e34 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 @@ -119,7 +119,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 b5544c27..554caa00 100644 --- a/structwinstd_1_1_wlan_free_memory__delete-members.html +++ b/structwinstd_1_1_wlan_free_memory__delete-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/structwinstd_1_1_wlan_free_memory__delete.html b/structwinstd_1_1_wlan_free_memory__delete.html index cc67ddd6..7a506f6f 100644 --- a/structwinstd_1_1_wlan_free_memory__delete.html +++ b/structwinstd_1_1_wlan_free_memory__delete.html @@ -119,7 +119,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 a374e963..40a02485 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 @@ -87,7 +87,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 9e2150e6..b7c324dc 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 @@ -119,7 +119,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 342ef876..5ca05e22 100644 --- a/structwinstd_1_1heap__allocator_1_1rebind-members.html +++ b/structwinstd_1_1heap__allocator_1_1rebind-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/structwinstd_1_1heap__allocator_1_1rebind.html b/structwinstd_1_1heap__allocator_1_1rebind.html index bcc2433e..6fc9ca21 100644 --- a/structwinstd_1_1heap__allocator_1_1rebind.html +++ b/structwinstd_1_1heap__allocator_1_1rebind.html @@ -103,7 +103,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 cb6ae29f..62c12e8e 100644 --- a/structwinstd_1_1sanitizing__allocator_1_1rebind-members.html +++ b/structwinstd_1_1sanitizing__allocator_1_1rebind-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/structwinstd_1_1sanitizing__allocator_1_1rebind.html b/structwinstd_1_1sanitizing__allocator_1_1rebind.html index 475d0001..777baa67 100644 --- a/structwinstd_1_1sanitizing__allocator_1_1rebind.html +++ b/structwinstd_1_1sanitizing__allocator_1_1rebind.html @@ -103,7 +103,7 @@ struct winstd::sanitizing_allocator< _Ty >::rebind< _Other >