English
Regulars table & Café

InitiateSystemShutdown.

 


Description:

InitiateSystemShutdown drives whom computer to one Zeitintervall down and gives thereby a Message from. These function there only NT-based Windowssystemen.




Deklaration:

DEF @InitiateSystemShutdown(5) !ADVAPI32,InitiateSystemShutdownA




Parameter:

1.Parameter: address one Strings or Memory-Variable with a String,, the whom Computernamen the herunterzufahrenden Systems contains. is this Parameter one Leerstring or 0, becomes the actually system heruntergefahren.
2.Parameter: address one Strings or Memory-Variable with a String,, the a Message contains, The at Shutdown showing should. this Parameter can 0 his.
3.Parameter: Time until Shutdown the Rechners in sec as LongInt.
4.Parameter: Flag, the angibt whether any Applications with the Shutdown all right his must.=>
1 = without demand Shutdown.
0 = Shutdown Cancel, if a application not your OK gives.
circa computer at all Shutdown to, must The Privilegien SeShutdownPrivilege and SeRemoteShutdownPrivilege present his and activate go.
5.Parameter: Flag, the angibt whether to the Shutdown one Neustart the Rechners erfolgen should.=>
1 = Neustart
0 = only Shutdown



Return Value:

1 with success, 0 with one Error.


Examples:

CompileMarkSeparation
DEF @InitiateSystemShutdown(5) !"ADVAPI32","InitiateSystemShutdownA"
DEF @LookupPrivilegeName(4)!"advapi32","LookupPrivilegeNameA“
DEF @LookupPrivilegeValue(3) !"advapi32","LookupPrivilegeValueA"
DEF @OpenProcessToken(3) !"advapi32","OpenProcessToken"
DEF @AdjustTokenPrivileges(6) !"advapi32","AdjustTokenPrivileges”
DEF @GetCurrentProcess(0) !"kernel32","GetCurrentProcess"
DEF @CloseHandle(1) !"kernel32","CloseHandle“
Declare Message$,TIME&,NewState#,token#,System$
Declare Privileg#,Luid#
dim token#,4
DIM NewState#,16
DIM Luid#,8
DIM Privileg#,256
Long NewState#,0=1 Nur ein Privileg soll geändert werden
Long NewState#,12=$00000002 Das Privileg soll eingeschaltet werden
Print @OpenProcessToken(@GetCurrentProcess(),$0020 | $0008,Token#)
STRING Privileg#,0="SeShutdownPrivilege"
Print @LookupPrivilegeValue(0,Privileg#,LUID#)
Byte NewState#,4=@Byte(Luid#,0)
Byte NewState#,5=@Byte(Luid#,1)
Byte NewState#,6=@Byte(Luid#,2)
Byte NewState#,7=@Byte(Luid#,3)
Byte NewState#,8=@Byte(Luid#,4)
Byte NewState#,9=@Byte(Luid#,5)
Byte NewState#,10=@Byte(Luid#,6)
Byte NewState#,11=@Byte(Luid#,7)
Print @AdjustTokenPrivileges(@LONG(Token#,0),0,NewState#,0,0,0)
Long NewState#,0=1 Nur ein Privileg soll geändert werden
Long NewState#,12=$00000002 Das Privileg soll eingeschaltet werden
Print @OpenProcessToken(@GetCurrentProcess(),$0020 | $0008,Token#) Es wird ein Process mit dem Handle Token gestartet, der Privilegien für mein Programm einstellen soll.
STRING Privileg#,0="SeRemoteShutdownPrivilege"
Print @LookupPrivilegeValue(0,Privileg#,LUID#)
Byte NewState#,4=@Byte(Luid#,0)
Byte NewState#,5=@Byte(Luid#,1)
Byte NewState#,6=@Byte(Luid#,2)
Byte NewState#,7=@Byte(Luid#,3)
Byte NewState#,8=@Byte(Luid#,4)
Byte NewState#,9=@Byte(Luid#,5)
Byte NewState#,10=@Byte(Luid#,6)
Byte NewState#,11=@Byte(Luid#,7)
Print @AdjustTokenPrivileges(@LONG(Token#,0),0,NewState#,0,0,0)
LET TIME&=60
LET Message$="Der Rechner wird neu gestartet!"
Print @InitiateSystemShutdown(@ADDR(System$),@ADDR(Message$),TIME&,1,1)
@CloseHandle(@LONG(Token#,0))
Dispose Luid#
Dispose Privileg#
Dispose NewState#
Dispose token#
Waitinput

[keywords:21d2f6baf0]
Shutdown Shutdown dialog Message Time Zeitintervall warning
[/keywords:21d2f6baf0]
 
04/23/05  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.320 Views

Untitledvor 0 min.
RudiB.06/05/16

Themeninformationen

this Topic has 1 subscriber:

unbekannt (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie