Bonjour ,
Je cherche a mettre en oeuvre cette Q/R de la FAQ BCB :
http://c.developpez.com/faq/bcb/?pag...ndreordinateur
cependant je ne sais pas comment :
Envoyé par FAQ BCB
![]()
Bonjour ,
Je cherche a mettre en oeuvre cette Q/R de la FAQ BCB :
http://c.developpez.com/faq/bcb/?pag...ndreordinateur
cependant je ne sais pas comment :
Envoyé par FAQ BCB
![]()
Alors j'ai fait ca :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 void ArretWindows(void); void ArretWindows(void) { TOKEN_PRIVILEGES wTokenIn, wTokenOut; DWORD wLength; HANDLE wCurrentProcess, wToken; _LUID wLuid; wCurrentProcess = GetCurrentProcess(); OpenProcessToken(wCurrentProcess, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &wToken); LookupPrivilegeValue(NULL, "SeShutdownPrivilege", &wLuid); wTokenIn.PrivilegeCount = 1; wTokenIn.Privileges[0].Luid = wLuid; wTokenIn.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges(wToken, FALSE, &wTokenIn, sizeof(TOKEN_PRIVILEGES), &wTokenOut,&wLength); CloseHandle(wToken); ExitWindowsEx(EWX_POWEROFF | EWX_FORCEIFHUNG, 0); }
si ca peux servir![]()
Partager