Skip to content

Commit 9dcef6a

Browse files
committed
new elevated method
1 parent 7560ee9 commit 9dcef6a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

x64_dbg_dbg/debugger.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,16 +1483,17 @@ void cbDetach()
14831483

14841484
bool IsProcessElevated()
14851485
{
1486+
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
1487+
PSID SecurityIdentifier;
1488+
if(!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &SecurityIdentifier))
1489+
return 0;
14861490

1487-
HANDLE hToken;
1488-
DWORD tkInfoLen;
1489-
TOKEN_ELEVATION tkElevation;
1490-
1491-
OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken);
1492-
1493-
GetTokenInformation(hToken, TokenElevation, &tkElevation, sizeof(tkElevation), &tkInfoLen);
1491+
BOOL IsAdminMember;
1492+
if(!CheckTokenMembership(NULL, SecurityIdentifier, &IsAdminMember))
1493+
IsAdminMember = FALSE;
14941494

1495-
return (tkElevation.TokenIsElevated != 0);
1495+
FreeSid(SecurityIdentifier);
1496+
return IsAdminMember ? true : false;
14961497
}
14971498

14981499
bool _readwritejitkey(char* jit_key_value, DWORD* jit_key_vale_size, char* key, arch arch_in, arch* arch_out, readwritejitkey_error_t* error, bool write)

0 commit comments

Comments
 (0)