TelMic
asked on
AdjustTokenPrivileges()
I need an Exmple of how to set SE_SHUTDOWN_NAME Privilege.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
TOKEN_PRIVILEGES tkp;
char szBuf[100];
if (!OpenProcessToken(GetCurr
wsprintf(szBuf, "OpenProcessToken Error #%d", GetLastError ());
AfxMessageBox(szBuf, MB_OK);
EndDialog(IDC_REBOOT);
}
// Get the LUID for shutdown privilege
if(!LookupPrivilegeValue(N
AfxMessageBox("LookupPrivi
EndDialog(IDC_REBOOT);
}
else{
tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attribut
}
// Get shutdown privilege for this process.
if (!AdjustTokenPrivileges(hT
wsprintf(szBuf, "AdjustTokenPrivileges Error #%d", GetLastError ());
AfxMessageBox(szBuf, MB_OK);
EndDialog(IDC_REBOOT);
}
if(GetLastError() != ERROR_SUCCESS){
wsprintf(szBuf, "AdjustTokenPrivileges() failed for reason %d", GetLastError());
AfxMessageBox(szBuf, MB_OK);
EndDialog(IDC_REBOOT);
}