xentara-utils v2.0.4
The Xentara Utility Library
|
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. | |
Windows functionality.
This namespace contains Windows-specific functionality.
auto xentara::utils::windows::hresultErrorCategory | ( | ) | -> const std::error_category & |
Returns the global error category for use with Windows HRESULT values.
#include <xentara/utils/windows/Errors.hpp>
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 <xentara/utils/windows/console.hpp>
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.
#include <xentara/utils/windows/wait.hpp>
waitFunction | The 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. |
timeout | The timeout, or std::nullopt to pass INFINITE to waitFunction. |
timeoutReturnValue | The value that waitFunction returns on timeout. This is usually WAIT_TIMEOUT, but SleepEx(), for example, returns 0. |