SeDebugPrivilege
Hello good evening. I'm having trouble setting privileges for my application, it's not setting. follow the code below.
Note: I am using this function in Console Window.
How i use:
Note: I am using this function in Console Window.
Code:
void SetPrivilege()
{
TOKEN_PRIVILEGES TP;
LUID luid;
HANDLE hToken;
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken);
LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid);
TP.PrivilegeCount = 1;
TP.Privileges[0].Luid = luid;
TP.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &TP, sizeof(TP), NULL, NULL);
CloseHandle(hToken);
}
Code:
int main()
{
SetPrivilege();
return 0;
}
