![]() |
![]() |
![]() |
![]() |
![]() |
FTP | ![]() |
![]() |
CCD | ![]() |
![]() |
Buscar | ![]() |
![]() |
Trucos | ![]() |
![]() |
Trabajo | ![]() |
![]() |
Foros | ![]() |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
![]() |
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
Apagar PC en XP
Investigando ya sé cómo hacer que funcione la función API ExitWindowsEx en Windows XP, tienen que tener privilegios para eso, y se obtiene con la API también:
Código:
var hToken: THandle; tkp: TTokenPrivileges; tkp2: PTokenPrivileges; r: Dword; //Esta variable sobra, pero se tiene que usar para pasársela a la función AdjustToken.... implementation if OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken) then if LookupPrivilegeValue(nil, 'SeShutdownPrivilege', tkp.Privileges[0].Luid) then begin tkp.PrivilegeCount := 1; tkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED; if AdjustTokenPrivileges(hToken, FALSE, tkp, 0, nil, r) then ExitWindowsEx( .. , 0 ); end;
__________________
“Daría todo lo que sé por la mitad de lo que ignoro” |
![]() |
|
|
![]() |
|