Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.08.14;
Скачать: CL | DM;

Вниз

2 секунды   Найти похожие ветки 

 
dan   (2005-06-23 02:31) [0]

Всем привет, у меня вопрос на 2 секунды.
Как выключить комп в XP?
Заранее спасибо.


 
Kerk ©   (2005-06-23 07:57) [1]

ExitWindowSex

The ExitWindowsEx function either logs off the current user, shuts down the system, or shuts down and restarts the system. It sends the WM_QUERYENDSESSION message to all applications to determine if they can be terminated.


 
MS-MEN ©   (2005-06-23 09:52) [2]

> Kerk
Не забывай надо ещё иметь привилигий DEBUG  )

procedure NTShutdown;
var
 TokenHandle: Cardinal;
 RetLength: Cardinal;
 TP: TTokenPrivileges;
begin
 OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES
   or TOKEN_QUERY, TokenHandle);
 if LookupPrivilegeValue(nil, "SeShutdownPrivilege",
   TP.Privileges[0].Luid) then
 begin
   TP.PrivilegeCount := 1;
   TP.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
   RetLength := 0;
   if AdjustTokenPrivileges(TokenHandle, FALSE, TP, 0, nil, RetLength) then
   begin
     if not SetProcessShutdownParameters($4FF, SHUTDOWN_NORETRY) then
     begin
       MessageBox(0, "Shutdown failed", nil, MB_OK or MB_ICONSTOP);
     end
     else
     begin
       ExitWindowsEx(EWX_FORCE or EWX_SHUTDOWN, 0);
     end;
     exit;
   end;
 end;
 MessageBox(0, "Access denied", nil, MB_OK or MB_ICONSTOP);
end;


 
Kerk ©   (2005-06-23 09:57) [3]

To shut down or restart the system, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege.


 
MS-MEN ©   (2005-06-23 10:03) [4]

:)



Страницы: 1 вся ветка

Текущий архив: 2005.08.14;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.055 c
14-1121727913
pasha_golub
2005-07-19 03:05
2005.08.14
Пока меня не заставили работать


4-1118515044
ctranik
2005-06-11 22:37
2005.08.14
получит из ключа реестра, значения определённы типов


4-1118729844
vinni_0FFh
2005-06-14 10:17
2005.08.14
Как нажать кнопку в тулбаре чужой программы


4-1119466233
volser
2005-06-22 22:50
2005.08.14
Помогите кто работал с LVM_SORTGROUPS


5-1093259795
Jenek
2004-08-23 15:16
2005.08.14
Windows и меню