Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
AbortSystemShutdown (advapi32)
The AbortSystemShutdown function stops a system shutdown that has been initiated.

C# Signature:

[DllImport("advapi32.dll")] static extern bool AbortSystemShutdown(String lpMachineName);

Alternative Managed API:

Do you know one? Please contribute it!


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
      throw new Exception("Could not abort system shutdown");
  } else{
    throw new Exception("Could not set the SeShutdownPrivilege");


Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

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).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version