MCPcopy Create free account
hub / github.com/LiteLoaderQQNT/QQNTFileVerifyPatch / IsRunAsAdmin

Function IsRunAsAdmin

HijackMethod/dllmain.cpp:125–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125bool IsRunAsAdmin()
126{
127 BOOL fIsRunAsAdmin = FALSE;
128 DWORD dwError = ERROR_SUCCESS;
129 PSID pAdministratorsGroup = NULL;
130
131 SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
132 if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &pAdministratorsGroup))
133 {
134 dwError = GetLastError();
135 }
136 else
137 {
138 if (!CheckTokenMembership(NULL, pAdministratorsGroup, &fIsRunAsAdmin))
139 {
140 dwError = GetLastError();
141 }
142
143 FreeSid(pAdministratorsGroup);
144 }
145
146 return fIsRunAsAdmin != FALSE;
147}
148
149bool RestartAsAdmin()
150{

Callers 1

Hk_CreateFileWFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected