WinStd
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
Classes | Macros | Functions | Variables
Windows API

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

Classes

class  winstd::win_handle< INVALID >
 Windows HANDLE wrapper class. More...
 
class  winstd::library
 Module handle wrapper. More...
 
class  winstd::process
 Process handle wrapper. More...
 
class  winstd::file
 File handle wrapper. More...
 
class  winstd::event
 Event handle wrapper. More...
 
class  winstd::critical_section
 Critical section wrapper. More...
 
class  winstd::find_file
 Find-file handle wrapper. More...
 
class  winstd::heap
 Heap handle wrapper. More...
 
class  winstd::heap_allocator< _Ty >
 HeapAlloc allocator. More...
 
class  winstd::actctx_activator
 Activates given activation context in constructor and deactivates it in destructor. More...
 
class  winstd::user_impersonator
 Lets the calling thread impersonate the security context of a logged-on user. More...
 
class  winstd::console_ctrl_handler
 Console control handler stack management. More...
 
class  winstd::vmemory
 Memory in virtual address space of a process handle wrapper. More...
 
class  winstd::reg_key
 Registry wrapper class. More...
 
class  winstd::security_id
 SID wrapper class. More...
 
class  winstd::process_information
 PROCESS_INFORMATION struct wrapper. More...
 

Macros

#define GuidToString   GuidToStringA
 Formats GUID and stores it in a std::wstring string. More...
 

Functions

 if (iResult > 0)
 
sValue clear ()
 
 if (dwVerInfoSize !=0)
 
 for (DWORD dwSizeOut=(DWORD) strlen(lpSrc)+0x100;;)
 
static _Out_ LPGUID _Out_opt_ LPCSTR class _Ax static LSTATUS RegQueryStringValue (_In_ HKEY hReg, _In_z_ LPCSTR pszName, _Out_ std::basic_string< char, _Traits, _Ax > &sValue) noexcept
 
static _In_ DWORD _In_z_count_ (cchWideChar) LPCWSTR lpWideCharStr
 
 if (cch)
 
else if (::GetLastError()==ERROR_INSUFFICIENT_BUFFER)
 
 SecureZeroMemory (szStackBuffer, sizeof(szStackBuffer))
 
static _In_ DWORD _In_z_count_ (cbMultiByte) LPCSTR lpMultiByteStr
 
 if (cch > 0)
 
 if (i)
 
 if (iResult)
 
 if (LookupAccountSidA(lpSystemName, lpSid, NULL, &dwNameLen, NULL, &dwRefDomainLen, peUse))
 
else if (GetLastError()==ERROR_MORE_DATA)
 
 if (LookupAccountSidW(lpSystemName, lpSid, NULL, &dwNameLen, NULL, &dwRefDomainLen, peUse))
 
 if (GetTokenInformation(TokenHandle, TokenInformationClass, szStackBuffer, sizeof(szStackBuffer), &dwSize))
 
 if (::QueryFullProcessImageNameA(hProcess, dwFlags, szStackBuffer, &dwSize))
 
 if (::QueryFullProcessImageNameW(hProcess, dwFlags, szStackBuffer, &dwSize))
 

Variables

static _Out_ std::basic_string< char, _Traits, _Ax > &sValue noexcept
 
int iResult = ::GetWindowTextLengthA(hWnd)
 
 return
 
static __reserved DWORD dwHandle
 
DWORD dwVerInfoSize = ::GetFileVersionInfoSizeA(lptstrFilename, &dwHandle)
 
else return FALSE
 
static _Out_ LPGUID lpGuid
 
static _Out_ LPGUID _Out_opt_ LPCSTR * lpszGuidEnd
 
static _In_ DWORD dwFlags
 
static _In_ DWORD _In_ int cchWideChar
 
static _In_ DWORD _In_ int _Out_ std::basic_string< char, _Traits, _Ax > & sMultiByteStr
 
static _In_ DWORD _In_ int _Out_ std::basic_string< char, _Traits, _Ax > _In_opt_z_ LPCSTR lpDefaultChar
 
int cch = ::WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, szStackBuffer, _countof(szStackBuffer), lpDefaultChar, lpUsedDefaultChar)
 
static _In_ DWORD _In_ std::basic_string< wchar_t, _Traits1, _Ax1 > sWideCharStr
 
static _In_ DWORD _In_ int cbMultiByte
 
static _In_ LPCWSTR lpSrcString
 
static _In_ LPCWSTR _In_ int cwSrcLength
 
 else
 
static _In_ const std::basic_string< wchar_t, _Traits1, _Ax1 > & sSrcString
 
static _In_ UINT uID
 
int i = LoadStringA(hInstance, uID, reinterpret_cast<LPSTR>(&pszStr), 0)
 
static _In_ DWORD _In_opt_ const SYSTEMTIME * lpDate
 
static _In_ DWORD _In_opt_ const SYSTEMTIME _In_opt_z_ LPCSTR lpFormat
 
static _In_ PSID lpSid
 
static _In_ PSID _Out_opt_ std::basic_string< char, _Traits, _Ax > * sName
 
static _In_ PSID _Out_opt_ std::basic_string< char, _Traits, _Ax > _Out_opt_ std::basic_string< char, _Traits, _Ax > * sReferencedDomainName
 
DWORD dwNameLen = 0
 
DWORD dwRefDomainLen = 0
 
static _In_ TOKEN_INFORMATION_CLASS TokenInformationClass
 
DWORD dwSize = _countof(szStackBuffer)
 
static _In_ DWORD _Inout_ std::basic_string< char, _Traits, _Ax > & sExeName
 

Detailed Description

Integrates WinStd classes with Microsoft Windows API.

Macro Definition Documentation

◆ GuidToString

#define GuidToString   GuidToStringA

Formats GUID and stores it in a std::wstring string.

Parameters
[in]lpGuidPointer to GUID
[out]strString to store the result to

Variable Documentation

◆ else

else
Initial value:
{
switch (::GetLastError()) {
case ERROR_INSUFFICIENT_BUFFER:
for (int i = 10; i--;) {
cch = -cch;
std::unique_ptr<WCHAR[]> szBuffer(new WCHAR[cch]);
cch = ::NormalizeString(NormForm, lpSrcString, cwSrcLength, szBuffer.get(), cch);
if (cch > 0) {
sDstString.assign(szBuffer.get(), cwSrcLength != -1 ? wcsnlen(szStackBuffer, cch) : (size_t)cch - 1);
break;
}
if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
sDstString.clear();
break;
}
}
break;
case ERROR_SUCCESS:
sDstString.clear();
break;
}
}
return cch

◆ noexcept

static _In_ TOKEN_INFORMATION_CLASS _Out_ std::unique_ptr< _Ty > &TokenInformation noexcept
Initial value:
{
assert(0)

◆ sExeName

static _In_ DWORD _Inout_ std::basic_string< wchar_t, _Traits, _Ax > & sExeName
Initial value:
{
char szStackBuffer[WINSTD_STACK_BUFFER_BYTES / sizeof(char)]
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:80