MCPcopy Create free account
hub / github.com/ElyDotDev/windows-kill / setPrivilege

Method setPrivilege

windows-kill-library/remote-process.cpp:66–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64 }
65
66 bool RemoteProcess::setPrivilege(bool enable_privilege) {
67 TOKEN_PRIVILEGES tp;
68 LUID luid;
69
70 if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid)) {
71 return false;
72 }
73
74 tp.PrivilegeCount = 1;
75 tp.Privileges[0].Luid = luid;
76 if (enable_privilege) {
77 tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
78 }
79 else {
80 tp.Privileges[0].Attributes = 0;
81 }
82
83 AdjustTokenPrivileges(this->process_token, false, &tp, sizeof(TOKEN_PRIVILEGES), NULL, NULL);
84
85 if (GetLastError() != 0L) {
86 return false;
87 }
88
89 return true;
90 }
91
92 void RemoteProcess::startRemoteThread(void) {
93 this->remote_thread = CreateRemoteThread(

Callers 1

openMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected