Re: Resetting the computer

"Theo Bebekis" <[email protected]>
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <000e01c352d4$74be5180$8100a8c0@EPEKTASIS>
(*----------------------------------------------------------------------------
  uFlags : see the MS SDK for ExitWindowsEx
    EWX_LOGOFF    = 0;
    EWX_SHUTDOWN  = 1;
    EWX_REBOOT    = 2;
    EWX_FORCE     = 4;
 ----------------------------------------------------------------------------*)
function ExitWindows(uFlags: UINT): BOOL;
var
 ProcessHandle : THandle;
 TokenHandle   : THandle;
 Luid          : Int64;
 Tkp           : TTokenPrivileges;
 BufferNeeded  : DWORD;
begin

 if Win32Platform = VER_PLATFORM_WIN32_NT  then
 begin
  ProcessHandle:=GetCurrentProcess;
  OpenProcessToken(ProcessHandle, TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, TokenHandle);
  LookupPrivilegeValue(nil, 'SeShutdownPrivilege', Luid);
  Tkp.PrivilegeCount:=1;
  Tkp.Privileges[0].Luid:=Luid;
  Tkp.Privileges[0].Attributes:=SE_PRIVILEGE_ENABLED;
  AdjustTokenPrivileges(TokenHandle, FALSE, Tkp, 0, nil, BufferNeeded);
 end;
 Result:=ExitWindowsEx(uFlags, $FFFF);
end;

It's not mine though and I don't remember who the author is.
Regards

-----------------------------------
Theo Bebekis
Thessaloniki, Greece
[email protected]
[email protected]
-----------------------------------
----- Original Message -----
From: "Mike Hutchins" <[email protected]>
To: <[email protected]>
Sent: Friday, July 25, 2003 8:34 PM
Subject: [Delphi] Resetting the computer


> Hi all,
>
> I have a friend who has asked me to write a quick app which resets
> his machine at 4.am each day. He wants to use a runonce.exe -q DOS
> call. I don't know if this is peculiar to win '98 as this does not
> reset my computer running in WIN2k. Is there another system or DOS
> call which will reset the computer? I would like to make it so that
> this ran in all versions of windows.
>
> Thanks
>
> Mike
>
>
>
>
>
> CodeCoffer - new Delphi code protection Tool!
> http://www.delphicollection.com/public/CodeCoffer.htm
> ---------------------------------------------------------------
> Unsubscribe:[email protected]
> List owner:[email protected]
> ---------------------------------------------------------------
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges & Refill Kits for Your Epson at Myinks.com
Free shipping on orders $50 or more to the US and Canada.
http://www.c1tracking.com/l.asp?cid=5705&lp=home/epson.asp
http://us.click.yahoo.com/brYXfA/_xWGAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.