Monado OpenXR Runtime
|
Various helpers for doing Windows specific things. More...
Go to the source code of this file.
Functions | |
const char * | u_winerror (char *buffer, size_t size, DWORD err, bool remove_end) |
This function formats a Windows error number, as returned by GetLastError , and writes it into the given buffer. More... | |
bool | u_win_grant_inc_base_priorty_base_privileges (enum u_logging_level log_level) |
Tries to grant the 'SeIncreaseBasePriorityPrivilege' privilege to this process. More... | |
bool | u_win_raise_cpu_priority (enum u_logging_level log_level) |
Tries to raise the CPU priority of the process as high as possible. More... | |
void | u_win_try_privilege_or_priority_from_args (enum u_logging_level log_level, int argc, char *argv[]) |
Small helper function that checks process arguments for which to try. More... | |
Various helpers for doing Windows specific things.
bool u_win_grant_inc_base_priorty_base_privileges | ( | enum u_logging_level | log_level | ) |
Tries to grant the 'SeIncreaseBasePriorityPrivilege' privilege to this process.
It is needed for HIGH and REALTIME priority Vulkan queues on NVIDIA.
log_level | Control the amount of logging this function does. |
bool u_win_raise_cpu_priority | ( | enum u_logging_level | log_level | ) |
Tries to raise the CPU priority of the process as high as possible.
Returns false if it could not raise the priority at all. Normal processes can raise themselves from NORMAL to HIGH, while REALTIME requires either administrator privileges or the 'SeIncreaseBasePriorityPrivilege' privilege to be granted.
log_level | Control the amount of logging this function does. |
void u_win_try_privilege_or_priority_from_args | ( | enum u_logging_level | log_level, |
int | argc, | ||
char * | argv[] | ||
) |
Small helper function that checks process arguments for which to try.
The parsing is really simplistic and only looks at the first argument for the values nothing
, priority
, privilege
, both
. No argument at all implies the value both
making the function try to set both.
log_level | Control the amount of logging this function does. |
argc | Number of arguments, as passed into main. |
argv | Array of argument strings, as passed into main. |
This function formats a Windows error number, as returned by GetLastError
, and writes it into the given buffer.
buffer | Buffer to format the error into. |
size | Size of the given buffer. |
err | Error number to format a string for. |
remove_end | Removes and trailing \n , \r and . characters. |