system: basic_sys_object::get → basic_sys_object::operator T
The handle validation is done with valid() method now, so using operator T to auto-retrieve object handle should not provide ambiguities any more. As long as we remember to use valid() for testing! Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
db91035b42
commit
5f2b243942
@ -193,12 +193,12 @@ namespace stdex
|
|||||||
|
|
||||||
TOKEN_ELEVATION elevation;
|
TOKEN_ELEVATION elevation;
|
||||||
DWORD size = sizeof(TOKEN_ELEVATION);
|
DWORD size = sizeof(TOKEN_ELEVATION);
|
||||||
if (GetTokenInformation(token_h, TokenElevation, &elevation, sizeof(elevation), &size))
|
if (GetTokenInformation(token, TokenElevation, &elevation, sizeof(elevation), &size))
|
||||||
elevated = elevation.TokenIsElevated;
|
elevated = elevation.TokenIsElevated;
|
||||||
|
|
||||||
GetTokenInformation(token.get(), TokenGroups, NULL, 0, &size);
|
GetTokenInformation(token, TokenGroups, NULL, 0, &size);
|
||||||
std::unique_ptr<TOKEN_GROUPS> groups((TOKEN_GROUPS*)new uint8_t[size]);
|
std::unique_ptr<TOKEN_GROUPS> groups((TOKEN_GROUPS*)new uint8_t[size]);
|
||||||
if (GetTokenInformation(token.get(), TokenGroups, (LPVOID)groups.get(), size, &size)) {
|
if (GetTokenInformation(token, TokenGroups, (LPVOID)groups.get(), size, &size)) {
|
||||||
SID_IDENTIFIER_AUTHORITY authority = SECURITY_NT_AUTHORITY;
|
SID_IDENTIFIER_AUTHORITY authority = SECURITY_NT_AUTHORITY;
|
||||||
PSID sid_admins_h = NULL;
|
PSID sid_admins_h = NULL;
|
||||||
if (AllocateAndInitializeSid(&authority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &sid_admins_h)) {
|
if (AllocateAndInitializeSid(&authority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &sid_admins_h)) {
|
||||||
|
@ -198,7 +198,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
/// Returns object handle
|
/// Returns object handle
|
||||||
///
|
///
|
||||||
T get() const noexcept { return m_h; }
|
operator T() const noexcept { return m_h; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
T m_h;
|
T m_h;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user