Desktop Functions: Smart Device Functions:
|
AbortSystemShutdown (advapi32)
C# Signature:
[DllImport("advapi32.dll")] static extern bool AbortSystemShutdown(String lpMachineName); Alternative Managed API:Do you know one? Please contribute it! Notes:Please add some! Tips & Tricks:Please add some! Sample Code:[DllImport("ntdll.dll", SetLastError = true)]
public static extern IntPtr RtlAdjustPrivilege(int Privilege, bool bEnablePrivilege, bool IsThreadPrivilege, out bool PreviousValue); [DllImport("advapi32.dll")] static extern bool AbortSystemShutdown(String lpMachineName); int SeShutdownPrivilege = 19; bool PreviousValue = false; IntPtr STATUS_SUCCESS = new IntPtr(0); if(RltAdjustPrivilege(SeShutdownPrivilege, true, false, out PreviousValue) == STATUS_SUCCESS){ //Sets privileges to abort shutdown
if(!AbortSystemShutdown(null)){ //Abort the system shutdown of the local machine } else{
throw new Exception("Could not set the SE_SHUTDOWN_PRIVILEGE"); } Please edit this page!Do you have...
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more). |
|