MCPcopy Create free account
hub / github.com/Atarity/Lightpack / SetPrivilege

Function SetPrivilege

Software/grab/WinUtils.cpp:42–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40static LPCWSTR pwstrExcludeProcesses[]={L"skype.exe", L"chrome.exe", L"firefox.exe", L"iexplore.exe", L"qtcreator.exe"};
41
42BOOL SetPrivilege(HANDLE hToken, LPCTSTR szPrivName, BOOL fEnable) {
43
44 TOKEN_PRIVILEGES tp;
45 tp.PrivilegeCount = 1;
46 LookupPrivilegeValue(NULL, szPrivName, &tp.Privileges[0].Luid);
47 tp.Privileges[0].Attributes = fEnable ? SE_PRIVILEGE_ENABLED : 0;
48 AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof (tp), NULL, NULL);
49 return ((GetLastError() == ERROR_SUCCESS));
50
51}
52
53BOOL AcquirePrivileges() {
54

Callers 1

AcquirePrivilegesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected