xentara-utils v2.0.4
The Xentara Utility Library
Loading...
Searching...
No Matches
xentara::utils::windows Namespace Reference

Windows functionality. More...

Namespaces

namespace  com
 Windows COM functionality.
 
namespace  path
 Filesystem path functionality.
 
namespace  wmi
 Windows WMI functionality.
 

Classes

class  AbstractHresultErrorCategory
 Base class for error categories for Windows HRESULT values. More...
 
class  Handle
 A Windows handle that closes itself on destruct. More...
 
struct  LocalFreeDeleter
 A deleter that uses LocalFree(). More...
 
class  LocalFreePointer
 A smart pointer that frees its object using LocalFree(). More...
 
class  OverlappedResult
 The result of an overlapped operation that used extra wait objects. More...
 
class  RegistryKey
 A Windows registry key handle that closes itself on destruct. More...
 
class  Sid
 A Windows security descriptor (SID) that is automatically freed on destruct. More...
 
class  Socket
 A Windows socket that closes itself on destruct. More...
 

Concepts

concept  RegistryValue
 A concept that describes C++ data types used for registry values.
 

Functions

auto retainConsole () -> void
 Make sure that the console is not closed after the application exits.
 
auto hresultErrorCategory () -> const std::error_category &
 Returns the global error category for use with Windows HRESULT values.
 
auto wait (functional::function_ref< auto(DWORD) → DWORD > waitFunction, std::optional< std::chrono::nanoseconds > timeout, DWORD timeoutReturnValue=WAIT_TIMEOUT) -> DWORD
 Wrapper to use Windows waiting functions with a nanosecond timeout.
 

Detailed Description

Windows functionality.

This namespace contains Windows-specific functionality.

Function Documentation

◆ hresultErrorCategory()

auto xentara::utils::windows::hresultErrorCategory ( ) -> const std::error_category &

Returns the global error category for use with Windows HRESULT values.

Include file
#include <xentara/utils/windows/Errors.hpp>
Returns
The category.

◆ retainConsole()

auto xentara::utils::windows::retainConsole ( ) -> void

Make sure that the console is not closed after the application exits.

Under Windows, this function starts a second process in the Windows console, if it would otherwise close once the application has terminated. Use this function to enable the user to read the console output of the application even if it was started from the explorer.

On non-Windows platforms, this function does nothing.

Include file
#include <xentara/utils/windows/console.hpp>
Note
This class is available on all platforms, but is a no-op on non-Windows platforms

◆ wait()

auto xentara::utils::windows::wait ( functional::function_ref< auto(DWORD) → DWORD >  waitFunction,
std::optional< std::chrono::nanoseconds timeout,
DWORD  timeoutReturnValue = WAIT_TIMEOUT 
) -> DWORD

Wrapper to use Windows waiting functions with a nanosecond timeout.

This function calls a Windows callback like WaitForSingleObject() or SleepEx() using std::chrono::nanoseconds as the timeout value. The timeout is rounded up to milliseconds, and the function is called repeatedly in necessary.

Note
This function is only available under Windows
Include file
#include <xentara/utils/windows/wait.hpp>
Parameters
waitFunctionThe funmction to use to wait. The function will be passed the timeout as a millisecond value, or the special Windows value INFINITE if timeout is std::nullopt. The function must return timeoutReturnValue if the timeout expires.
timeoutThe timeout, or std::nullopt to pass INFINITE to waitFunction.
timeoutReturnValueThe value that waitFunction returns on timeout. This is usually WAIT_TIMEOUT, but SleepEx(), for example, returns 0.