Forumunuz.Com

Forumunuz.Com (https://www.forumunuz.com/)
-   Webmaster Forum (https://www.forumunuz.com/webmaster-forum/)
-   -   Bilgisayari yeniden baslat xp icin (https://www.forumunuz.com/webmaster-forum/17409-bilgisayari-yeniden-baslat-xp-icin.html)

Kaf Dağı 27 Mart 2015 15:31

Bilgisayari yeniden baslat xp icin
 
Kod:

implementation
 
function WindowsExit(RebootParam: Longword): Boolean;
var
  TTokenHd: THandle;
  TTokenPvg: TTokenPrivileges;
  cbtpPrevious: DWORD;
  rTTokenPvg: TTokenPrivileges;
  pcbtpPreviousRequired: DWORD;
  tpResult: Boolean;
const
  SE_SHUTDOWN_NAME = 'SeShutdownPrivilege';
begin
  if Win32Platform = VER_PLATFORM_WIN32_NT then
  begin
    tpResult := OpenProcessToken(GetCurrentProcess(),
      TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY,
      TTokenHd) ;
    if tpResult then
    begin
      tpResult := LookupPrivilegeValue(nil,
                                        SE_SHUTDOWN_NAME,
                                        TTokenPvg.Privileges[0].Luid) ;
      TTokenPvg.PrivilegeCount := 1;
      TTokenPvg.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
      cbtpPrevious := SizeOf(rTTokenPvg) ;
      pcbtpPreviousRequired := 0;
      if tpResult then
        Windows.AdjustTokenPrivileges(TTokenHd,
                                      False,
                                      TTokenPvg,
                                      cbtpPrevious,
                                      rTTokenPvg,
                                      pcbtpPreviousRequired) ;
    end;
  end;
  Result := ExitWindowsEx(RebootParam, 0) ;
end;
 
{$R *.dfm}
 
procedure TForm1.Button1Click(Sender: TObject);
begin
WindowsExit(EWX_REBOOT or EWX_FORCE) ;
end;



Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 09:58.

Powered by vBulletin® Version 3.8.9   Copyright ©2000 - 2026, vBulletin Solutions, Inc.

Site kurucuları: Damla ve Meltem