| 62 | } |
| 63 | |
| 64 | bool CProcess::SetPrivilege(LPCTSTR lpszPrivilege, BOOL bEnablePrivilege) |
| 65 | { |
| 66 | TOKEN_PRIVILEGES priv = { 0,0,0,0 }; |
| 67 | HANDLE hToken = NULL; |
| 68 | LUID luid = { 0,0 }; |
| 69 | BOOL Status = true; |
| 70 | |
| 71 | if (!OpenProcessToken(this->hProcess, TOKEN_ADJUST_PRIVILEGES, &hToken)) |
| 72 | { |
| 73 | Status = false; |
| 74 | goto EXIT; |
| 75 | } |
| 76 | |
| 77 | if (!LookupPrivilegeValueA(0, lpszPrivilege, &luid)) |
| 78 | { |
| 79 | Status = false; |
| 80 | goto EXIT; |
| 81 | } |
| 82 | |
| 83 | priv.PrivilegeCount = 1; |
| 84 | priv.Privileges[0].Luid = luid; |
| 85 | priv.Privileges[0].Attributes = bEnablePrivilege ? SE_PRIVILEGE_ENABLED : SE_PRIVILEGE_REMOVED; |
| 86 | |
| 87 | if (!AdjustTokenPrivileges(hToken, false, &priv, 0, 0, 0)) |
| 88 | { |
| 89 | Status = false; |
| 90 | goto EXIT; |
| 91 | } |
| 92 | EXIT: |
| 93 | if(hToken) |
| 94 | CloseHandle(hToken); |
| 95 | return Status; |
| 96 | } |
| 97 | |
| 98 | bool CProcess::Suspend() |
| 99 | { |
nothing calls this directly
no outgoing calls
no test coverage detected