xentara-utils v2.0.4
The Xentara Utility Library
|
A Windows security descriptor (SID) that is automatically freed on destruct. More...
#include <xentara/utils/windows/Sid.hpp>
Classes | |
class | Setter |
Helper class for calling functions that take an output parameter. More... | |
Public Types | |
using | NativeType = PSID |
A native Windows SID pointer. | |
Public Member Functions | |
constexpr | Sid () noexcept=default |
Default constructor. | |
constexpr | Sid (PSID sid) noexcept |
Conversion from a native SID pointer. | |
constexpr | Sid (Sid &&other) noexcept |
Move constructor. | |
~Sid () | |
Destructor. Frees the SID. | |
auto | operator= (Sid &&rhs) noexcept -> Sid & |
Move assignment operator. | |
operator PSID () const | |
Conversion to a native SID pointer. | |
constexpr | operator bool () const noexcept |
Checks whether the object contains an SID. | |
auto | operator= (PSID sid) noexcept -> Sid & |
Assignment from a native SID pointer. | |
constexpr auto | release () noexcept -> PSID |
Removes the SID and passes ownership to the caller. | |
auto | reset () noexcept -> void |
Frees the SID, if any. | |
auto | setter () noexcept -> Setter |
Gets a setter for use as an output parameter for C functions. | |
A Windows security descriptor (SID) that is automatically freed on destruct.
This class can be moved but not copied.
using xentara::utils::windows::Sid::NativeType = PSID |
A native Windows SID pointer.
|
constexprdefaultnoexcept |
Default constructor.
Creates an empty object that does not contain an SID.
|
constexprnoexcept |
Conversion from a native SID pointer.
sid | The native SID, or nullptr for none. |
|
constexprnoexcept |
Move constructor.
Takes ownership of the other object’s SID, if any.
other | The object to move. Will be reset and no longer contain an SID afterwards. |
xentara::utils::windows::Sid::~Sid | ( | ) |
Destructor. Frees the SID.
|
explicitconstexprnoexcept |
Checks whether the object contains an SID.
xentara::utils::windows::Sid::operator PSID | ( | ) | const |
Conversion to a native SID pointer.
|
noexcept |
Assignment from a native SID pointer.
Any existing SID is freed.
sid | The native SID pointer, or nullptr for none. |
Move assignment operator.
Takes ownership of the other SID’s value. Any existing SID pointer is freed.
rhs | The object to move. Will be reset and no longer contain an SID afterwards. |
|
constexprnoexcept |
Removes the SID and passes ownership to the caller.
After this call, this object will no longer contain an SID.
|
noexcept |
Frees the SID, if any.
|
noexcept |
Gets a setter for use as an output parameter for C functions.
This function returns a helper object that can be passed to a function that takes an PSID * as output parameter, like e.g. AllocateAndInitializeSid (). This provides a safe way of creating SIDs using such a function without running the risk of leaking the created objects.
AllocateAndInitializeSid() can be called like this, for example: