Salut à tous!
Comment faire pour qu'une application dispose du privilège SE_SHUTDOWN_NAME.
Je vue sa dans la faq bcb mais on ne dit pas comment faire.
Merci!
Version imprimable
Salut à tous!
Comment faire pour qu'une application dispose du privilège SE_SHUTDOWN_NAME.
Je vue sa dans la faq bcb mais on ne dit pas comment faire.
Merci!
Bonjour,
essaye ceci :
CordialementCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 HANDLE hToken; TOKEN_PRIVILEGES tkp; OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken); LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); tkp.PrivilegeCount = 1; tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); if (GetLastError() != ERROR_SUCCESS) ShowMessage("AdjustTokenPrivileges");
Eric
Merci beaucoup sa marche!
il me reste plus qu'a comprendre comment! :D