Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 28th, 2012  |  syntax: None  |  size: 0.45 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Disabling any possibility to exit a software?
  2. public static class Utility
  3. {
  4.     [DllImport("ntdll.dll", SetLastError = true)]
  5.     private static extern void RtlSetProcessIsCritical(UInt32 v1, UInt32 v2, UInt32 v3);
  6.  
  7.     public static void BsodIfProcessEnds()
  8.     {
  9.         Process.EnterDebugMode();
  10.         RtlSetProcessIsCritical(1, 0, 0);
  11.     }
  12.  
  13.     public static void NoFireworksIfProcessEnds()
  14.     {
  15.         RtlSetProcessIsCritical(0, 0, 0);
  16.     }
  17. }