├── NotMe_CPP
├── .idea
│ ├── .name
│ ├── Trigger-BSOD.iml
│ ├── .gitignore
│ ├── vcs.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── cmake.xml
│ ├── deployment.xml
│ ├── inspectionProfiles
│ │ └── Project_Default.xml
│ └── runConfigurations
│ │ └── All_targets.xml
├── rc.rc
├── icon.ico
├── PowerShell_Wininit.cpp
├── TaskKill_Wininit.cpp
├── NTSD_Winlogon.cpp
├── CloseWindowStation.cpp
├── SetProcessIsCritical.h
├── CMakeSettings.json
├── NTSD_Winlogon.h
├── SetProcessIsCritical.cpp
├── NtRaiseHardError.cpp
├── ZwRaiseHardError.cpp
├── CMakeLists.txt
├── AllinOne.cpp
└── RaiseHardError.h
├── .gitattributes
├── Assets
└── Images
│ ├── icon.ico
│ └── hazard_stripes_seamless.jpg
├── NotMe_CSharp
├── GUI
│ ├── icon.ico
│ ├── hazard_stripes_seamless.jpg
│ ├── app.config
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── Settings.Designer.cs
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── App.xaml.cs
│ ├── App.xaml
│ ├── MainWindow.xaml.cs
│ ├── MainWindow.xaml
│ └── NotMe.csproj
├── NTSD_Winlogon
│ ├── icon.ico
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── NTSD_Winlogon.csproj
├── CloseWindowStation
│ ├── icon.ico
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Program.cs
│ └── CloseWindowStation.csproj
├── NtRaiseHardError
│ ├── icon.ico
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Program.cs
│ └── NtRaiseHardError.csproj
├── PowerShell_Wininit
│ ├── icon.ico
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── PowerShell_Wininit.csproj
├── TaskKill_Wininit
│ ├── icon.ico
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── TaskKill_Wininit.csproj
├── ZwRaiseHardError
│ ├── icon.ico
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Program.cs
│ └── ZwRaiseHardError.csproj
├── SetProcessIsCritical
│ ├── icon.ico
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Program.cs
│ └── SetProcessIsCritical.csproj
└── NotMe_CSharp.sln
├── NotMyFault
├── exe
│ ├── icon1.ico
│ ├── notmyfault.rc
│ ├── NotMyfault.suo.old
│ ├── NotMyfault.dep
│ ├── notmyfault.h
│ ├── resource.h
│ ├── NotMyfault.sln
│ ├── IOCTLCMD.H
│ ├── NotMyfault.vcxproj.filters
│ ├── driver.c
│ ├── NotMyfault.vcproj
│ ├── NotMyfault.vcxproj
│ └── notmyfault.c
└── sys
│ ├── SOURCES
│ ├── MAKEFILE
│ ├── myfault.rc
│ └── myfault.c
├── .github
└── workflows
│ └── cmake-single-platform.yml
├── README.md
└── .gitignore
/NotMe_CPP/.idea/.name:
--------------------------------------------------------------------------------
1 | Trigger-BSOD
--------------------------------------------------------------------------------
/NotMe_CPP/rc.rc:
--------------------------------------------------------------------------------
1 | IDI_ICON1 ICON DISCARDABLE "icon.ico"
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/NotMe_CPP/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMe_CPP/icon.ico
--------------------------------------------------------------------------------
/Assets/Images/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/Assets/Images/icon.ico
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMe_CSharp/GUI/icon.ico
--------------------------------------------------------------------------------
/NotMyFault/exe/icon1.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMyFault/exe/icon1.ico
--------------------------------------------------------------------------------
/NotMyFault/exe/notmyfault.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMyFault/exe/notmyfault.rc
--------------------------------------------------------------------------------
/NotMyFault/sys/SOURCES:
--------------------------------------------------------------------------------
1 | TARGETNAME=myfault
2 | TARGETTYPE=DRIVER
3 |
4 | SOURCES=myfault.c myfault.rc
5 |
6 |
--------------------------------------------------------------------------------
/NotMe_CSharp/NTSD_Winlogon/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMe_CSharp/NTSD_Winlogon/icon.ico
--------------------------------------------------------------------------------
/NotMyFault/exe/NotMyfault.suo.old:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMyFault/exe/NotMyfault.suo.old
--------------------------------------------------------------------------------
/NotMe_CPP/.idea/Trigger-BSOD.iml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/NotMe_CSharp/CloseWindowStation/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMe_CSharp/CloseWindowStation/icon.ico
--------------------------------------------------------------------------------
/NotMe_CSharp/NtRaiseHardError/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMe_CSharp/NtRaiseHardError/icon.ico
--------------------------------------------------------------------------------
/NotMe_CSharp/PowerShell_Wininit/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMe_CSharp/PowerShell_Wininit/icon.ico
--------------------------------------------------------------------------------
/NotMe_CSharp/TaskKill_Wininit/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMe_CSharp/TaskKill_Wininit/icon.ico
--------------------------------------------------------------------------------
/NotMe_CSharp/ZwRaiseHardError/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMe_CSharp/ZwRaiseHardError/icon.ico
--------------------------------------------------------------------------------
/Assets/Images/hazard_stripes_seamless.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/Assets/Images/hazard_stripes_seamless.jpg
--------------------------------------------------------------------------------
/NotMe_CSharp/SetProcessIsCritical/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMe_CSharp/SetProcessIsCritical/icon.ico
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/hazard_stripes_seamless.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lzcapp/NotMe-BSOD/HEAD/NotMe_CSharp/GUI/hazard_stripes_seamless.jpg
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/NotMyFault/exe/NotMyfault.dep:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Generated Dependency File, included by NotMyfault.mak
2 |
3 | .\notmyfault.c : \
4 | ".\IOCTLCMD.H"\
5 | ".\notmyfault.h"\
6 |
7 |
--------------------------------------------------------------------------------
/NotMe_CPP/PowerShell_Wininit.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 | HWND hWnd = GetConsoleWindow();
5 | ShowWindow(hWnd, SW_HIDE);
6 |
7 | return system("powershell wininit");
8 | }
--------------------------------------------------------------------------------
/NotMe_CPP/TaskKill_Wininit.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 | HWND hWnd = GetConsoleWindow();
5 | ShowWindow(hWnd, SW_HIDE);
6 |
7 | return system("taskkill /f /im wininit.exe");
8 | }
--------------------------------------------------------------------------------
/NotMe_CPP/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 | # Datasource local storage ignored files
7 | /dataSources/
8 | /dataSources.local.xml
9 |
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/NotMe_CPP/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/NotMyFault/sys/MAKEFILE:
--------------------------------------------------------------------------------
1 | #
2 | # DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
3 | # file to this component. This file merely indirects to the real make file
4 | # that is shared by all the driver components of the Windows NT DDK
5 | #
6 |
7 | !INCLUDE $(NTMAKEENV)\makefile.def
8 |
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Windows;
6 |
7 | namespace NotMe {
8 | ///
9 | /// App.xaml 的交互逻辑
10 | ///
11 | public partial class App : Application { }
12 | }
--------------------------------------------------------------------------------
/NotMe_CPP/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/NotMe_CPP/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/NotMe_CPP/.idea/cmake.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/NotMe_CPP/NTSD_Winlogon.cpp:
--------------------------------------------------------------------------------
1 | #include "NTSD_Winlogon.h"
2 |
3 | int main() {
4 | HWND hWnd = GetConsoleWindow();
5 | ShowWindow(hWnd, SW_HIDE);
6 |
7 | DWORD pid = FindPID("winlogon.exe");
8 | if (pid == NULL) {
9 | pid = FindPID("WINLOGON.EXE");
10 | }
11 | char command[100];
12 | sprintf(command, "cmd /c start /min ntsd -c q -p %lu 1>nul 2>nul", pid);
13 | return system(command);
14 | }
--------------------------------------------------------------------------------
/NotMe_CPP/CloseWindowStation.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 | HWND hWnd = GetConsoleWindow();
5 | ShowWindow(hWnd, SW_HIDE);
6 |
7 | DWORD dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
8 | HWINSTA hWinSta = CreateWindowStation("WindowStation", NULL, dwDesiredAccess, nullptr);
9 | SetHandleInformation(hWinSta, HANDLE_FLAG_PROTECT_FROM_CLOSE, HANDLE_FLAG_PROTECT_FROM_CLOSE);
10 | return CloseWindowStation(hWinSta);
11 | }
--------------------------------------------------------------------------------
/NotMe_CPP/.idea/deployment.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/NotMe_CPP/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/NotMe_CPP/.idea/runConfigurations/All_targets.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/NotMe_CPP/SetProcessIsCritical.h:
--------------------------------------------------------------------------------
1 | #ifndef TRIGGER_BSOD_SETPROCESSISCRITICAL_H
2 | #define TRIGGER_BSOD_SETPROCESSISCRITICAL_H
3 |
4 | #define SE_DEBUG_PRIVILEGE 0x14
5 |
6 | #include
7 |
8 | typedef NTSTATUS(NTAPI *pdef_RtlAdjustPrivilege)(
9 | ULONG Privilege,
10 | BOOLEAN Enable,
11 | BOOLEAN Client,
12 | PBOOLEAN WasEnabled
13 | );
14 |
15 | typedef NTSTATUS(NTAPI *pdef_RtlSetProcessIsCritical)(
16 | IN BOOLEAN NewValue,
17 | OUT PBOOLEAN OldValue OPTIONAL,
18 | IN BOOLEAN CheckFlag
19 | );
20 |
21 | #endif //TRIGGER_BSOD_SETPROCESSISCRITICAL_H
22 |
--------------------------------------------------------------------------------
/NotMyFault/exe/notmyfault.h:
--------------------------------------------------------------------------------
1 | //======================================================================
2 | //
3 | // NotMyFault.h
4 | //
5 | // Copyright (C) 2002 Mark Russinovich
6 | // Sysinternals - www.sysinternals.com
7 | //
8 | // Simple interface to myfault device driver.
9 | //
10 | //======================================================================
11 |
12 |
13 | #define SYS_FILE "MYFAULT.SYS"
14 | #define SYS_NAME "MYFAULT"
15 |
16 | #define MYFAULT_DRIVER_KEY "System\\CurrentControlSet\\Services\\Myfault"
17 |
18 | extern HANDLE SysHandle;
19 |
20 |
21 | BOOL LoadDeviceDriver(const char* Name, const char* Path,
22 | HANDLE* lphDevice, PDWORD Error);
23 | BOOL UnloadDeviceDriver(const char* Name);
24 |
--------------------------------------------------------------------------------
/NotMe_CSharp/NTSD_Winlogon/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace NTSD_Winlogon {
5 | public abstract class Program {
6 | private static void Main() {
7 | NTSD_Winlogo();
8 | }
9 |
10 | public static void NTSD_Winlogo() {
11 | try {
12 | var process = new Process();
13 | var startInfo = new ProcessStartInfo {
14 | WindowStyle = ProcessWindowStyle.Hidden,
15 | FileName = "ntsd.exe",
16 | Arguments = "-c q -pn winlogon.exe"
17 | };
18 | process.StartInfo = startInfo;
19 | process.Start();
20 | } catch (Exception) {
21 | // ignored
22 | }
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/NotMe_CPP/CMakeSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Debug-x86",
5 | "generator": "Visual Studio 17 2022",
6 | "configurationType": "Debug",
7 | "inheritEnvironments": [
8 | "msvc_x86"
9 | ],
10 | "buildRoot": "${projectDir}\\out\\vs\\${name}",
11 | "installRoot": "${projectDir}\\out\\install\\${name}",
12 | "cmakeCommandArgs": "",
13 | "ctestCommandArgs": ""
14 | },
15 | {
16 | "name": "Release-x86",
17 | "generator": "Visual Studio 17 2022",
18 | "configurationType": "MinSizeRel",
19 | "buildRoot": "${projectDir}\\out\\vs\\${name}",
20 | "installRoot": "${projectDir}\\out\\install\\${name}",
21 | "ctestCommandArgs": "",
22 | "inheritEnvironments": [
23 | "msvc_x86"
24 | ],
25 | "intelliSenseMode": "windows-msvc-x86"
26 | }
27 | ]
28 | }
--------------------------------------------------------------------------------
/NotMe_CPP/NTSD_Winlogon.h:
--------------------------------------------------------------------------------
1 | #ifndef TRIGGER_BSOD_NTSD_WINLOGON_H
2 | #define TRIGGER_BSOD_NTSD_WINLOGON_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | inline DWORD FindPID(const char *procname) {
9 | PROCESSENTRY32 pe;
10 | DWORD pid = NULL;
11 |
12 | HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
13 | if (INVALID_HANDLE_VALUE == hSnapshot) {
14 | return NULL;
15 | }
16 |
17 | pe.dwSize = sizeof(PROCESSENTRY32);
18 | BOOL hResult = Process32First(hSnapshot, &pe);
19 |
20 | while (hResult) {
21 | if (strcmp(procname, pe.szExeFile) == 0) {
22 | pid = pe.th32ProcessID;
23 | break;
24 | }
25 | hResult = Process32Next(hSnapshot, &pe);
26 | }
27 |
28 | CloseHandle(hSnapshot);
29 |
30 | return pid;
31 | }
32 |
33 | #endif //TRIGGER_BSOD_NTSD_WINLOGON_H
34 |
--------------------------------------------------------------------------------
/NotMe_CPP/SetProcessIsCritical.cpp:
--------------------------------------------------------------------------------
1 | #include "SetProcessIsCritical.h"
2 |
3 | int main() {
4 | HWND hWnd = GetConsoleWindow();
5 | ShowWindow(hWnd, SW_HIDE);
6 |
7 | auto hNtdll = LoadLibraryA("ntdll.dll");
8 | if (hNtdll == nullptr) {
9 | FreeLibrary(hNtdll);
10 | return ERROR_BAD_ENVIRONMENT;
11 | }
12 |
13 | auto RtlAdjustPrivilege = reinterpret_cast(GetProcAddress(hNtdll, "RtlAdjustPrivilege"));
14 | BOOLEAN enabled;
15 | if (RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE, TRUE, FALSE, &enabled) != 0) {
16 | FreeLibrary(hNtdll);
17 | return ERROR_ACCESS_DENIED;
18 | }
19 |
20 | auto RtlSetProcessIsCritical = reinterpret_cast(GetProcAddress(hNtdll, "RtlSetProcessIsCritical"));
21 | FreeLibrary(hNtdll);
22 | BOOLEAN OldValue;
23 | return RtlSetProcessIsCritical(TRUE, &OldValue, FALSE);
24 | }
25 |
--------------------------------------------------------------------------------
/NotMe_CSharp/TaskKill_Wininit/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace TaskKill_Wininit {
5 | public abstract class Program {
6 | private static void Main() {
7 | TaskKill_Wininit();
8 | }
9 |
10 | public static void TaskKill_Wininit() {
11 | try {
12 | var process = new Process {
13 | StartInfo = new ProcessStartInfo {
14 | WindowStyle = ProcessWindowStyle.Hidden,
15 | FileName = "taskkill",
16 | Arguments = "-f -im wininit.exe",
17 | UseShellExecute = true,
18 | Verb = "runas"
19 | }
20 | };
21 | process.Start();
22 | } catch (Exception) {
23 | // ignored
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/NotMe_CSharp/PowerShell_Wininit/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace PowerShell_Wininit {
5 | public abstract class Program {
6 | private static void Main() {
7 | PowerShell_Wininit();
8 | }
9 |
10 | public static void PowerShell_Wininit() {
11 | try {
12 | var process = new Process {
13 | StartInfo = new ProcessStartInfo {
14 | WindowStyle = ProcessWindowStyle.Hidden,
15 | FileName = "powershell.exe",
16 | Arguments = "wininit",
17 | UseShellExecute = true,
18 | Verb = "runas"
19 | }
20 | };
21 | process.Start();
22 | } catch (Exception) {
23 | // ignored
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/NotMe_CPP/NtRaiseHardError.cpp:
--------------------------------------------------------------------------------
1 | #include "RaiseHardError.h"
2 |
3 | int main() {
4 | HWND hWnd = GetConsoleWindow();
5 | ShowWindow(hWnd, SW_HIDE);
6 |
7 | auto hNtdll = LoadLibraryA("ntdll.dll");
8 | if (hNtdll == nullptr) {
9 | FreeLibrary(hNtdll);
10 | return ERROR_BAD_ENVIRONMENT;
11 | }
12 |
13 | auto RtlAdjustPrivilege = reinterpret_cast(GetProcAddress(hNtdll, "RtlAdjustPrivilege"));
14 | BOOLEAN enabled;
15 | if (RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE, TRUE, FALSE, &enabled) != 0) {
16 | FreeLibrary(hNtdll);
17 | return ERROR_ACCESS_DENIED;
18 | }
19 |
20 | auto NtRaiseHardError = reinterpret_cast(GetProcAddress(hNtdll, "NtRaiseHardError"));
21 | FreeLibrary(hNtdll);
22 | HARDERROR_RESPONSE Response;
23 | return NtRaiseHardError(Error_Status, 0, nullptr, nullptr, OptionShutdownSystem, &Response);
24 | }
--------------------------------------------------------------------------------
/NotMe_CPP/ZwRaiseHardError.cpp:
--------------------------------------------------------------------------------
1 | #include "RaiseHardError.h"
2 |
3 | int main() {
4 | HWND hWnd = GetConsoleWindow();
5 | ShowWindow(hWnd, SW_HIDE);
6 |
7 | auto hNtdll = LoadLibraryA("ntdll.dll");
8 | if (hNtdll == nullptr) {
9 | FreeLibrary(hNtdll);
10 | return ERROR_BAD_ENVIRONMENT;
11 | }
12 |
13 | auto RtlAdjustPrivilege = reinterpret_cast(GetProcAddress(hNtdll, "RtlAdjustPrivilege"));
14 | BOOLEAN enabled;
15 | if (RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE, TRUE, FALSE, &enabled) != 0) {
16 | FreeLibrary(hNtdll);
17 | return ERROR_ACCESS_DENIED;
18 | }
19 |
20 | auto ZwRaiseHardError = reinterpret_cast(GetProcAddress(hNtdll, "ZwRaiseHardError"));
21 | FreeLibrary(hNtdll);
22 | HARDERROR_RESPONSE Response;
23 | return ZwRaiseHardError(Error_Status, 0, nullptr, nullptr, OptionShutdownSystem, &Response);
24 | }
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace NotMe.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/NotMe_CSharp/NTSD_Winlogon/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("NTSD_Winlogon")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("NTSD_Winlogon")]
13 | [assembly: AssemblyCopyright("Copyright © 2024")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("067eb2ed-57f8-4a9c-860e-a563a8a13211")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/NotMe_CSharp/NtRaiseHardError/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("NtRaiseHardError")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("NtRaiseHardError")]
13 | [assembly: AssemblyCopyright("Copyright © 2024")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("65340c14-3429-4bca-8b10-d4b6cb708da2")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/NotMe_CSharp/ZwRaiseHardError/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("ZwRaiseHardError")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ZwRaiseHardError")]
13 | [assembly: AssemblyCopyright("Copyright © 2024")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("253c96c1-80c6-4f8a-8123-dce0b983e44d")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/NotMe_CSharp/TaskKill_Wininit/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("TaskKill_Wininit")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TaskKill_Wininit")]
13 | [assembly: AssemblyCopyright("Copyright © 2024")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("fd7e0d8a-5f2d-44b3-b254-bb64d6bb4c82")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/NotMe_CSharp/CloseWindowStation/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("CloseWindowStation")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("CloseWindowStation")]
13 | [assembly: AssemblyCopyright("Copyright © 2024")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("ce7207fa-118a-4576-9a41-b64da63eb332")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/NotMe_CSharp/PowerShell_Wininit/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("PowerShell_Wininit")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("PowerShell_Wininit")]
13 | [assembly: AssemblyCopyright("Copyright © 2024")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("05a3813e-0e43-46d1-bcae-1edd9c67836f")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/NotMe_CSharp/SetProcessIsCritical/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("RtlSetProcessIsCritical")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("RtlSetProcessIsCritical")]
13 | [assembly: AssemblyCopyright("Copyright © 2024")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("3929947f-7c8b-44aa-b103-e3211cbb934e")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/NotMyFault/sys/myfault.rc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #define VER_DEBUG 0
4 | #define VER_PRERELEASE 0
5 | #define VER_FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
6 | #define VER_FILEOS VOS_NT_WINDOWS32
7 | #define VER_FILEFLAGS (VER_PRERELEASE|VER_DEBUG)
8 |
9 | #define VER_FILETYPE VFT_DRV
10 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM
11 |
12 | #define VER_COMPANYNAME_STR "Sysinternals"
13 | #define VER_PRODUCTNAME_STR "Sysinternals Myfault"
14 | #define VER_LEGALCOPYRIGHT_YEARS "2002-2004"
15 | #define VER_LEGALCOPYRIGHT_STR "Copyright (C) M. Russinovich " VER_LEGALCOPYRIGHT_YEARS
16 | #define VER_LEGALTRADEMARKS_STR "Copyright (C) 2002-2004 Mark Russinovich"
17 |
18 | #define VER_PRODUCTVERSION 2,0,00,00
19 | #define VER_PRODUCTVERSION_STR "2.0"
20 | #define VER_PRODUCTVERSION_W (0x0200)
21 | #define VER_PRODUCTVERSION_DW (0x0200)
22 | #define VER_FILEDESCRIPTION_STR "Crash Test Driver"
23 | #define VER_INTERNALNAME_STR "myfault.sys"
24 | #define VER_ORIGINALFILENAME_STR "myfault.sys"
25 |
26 | #include "common.ver"
27 |
28 |
--------------------------------------------------------------------------------
/NotMe_CSharp/NtRaiseHardError/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace NtRaiseHardError {
5 | public abstract class Program {
6 | [DllImport("ntdll.dll")]
7 | private static extern uint RtlAdjustPrivilege(int privilege, bool bEnablePrivilege, bool isThreadPrivilege, out bool previousValue);
8 |
9 | [DllImport("ntdll.dll")]
10 | private static extern uint NtRaiseHardError(uint errorStatus, uint numberOfParameters, uint unicodeStringParameterMask, IntPtr parameters, uint validResponseOption, out uint response);
11 |
12 | private const int Privilege = 19;
13 |
14 | private const uint ErrorStatus = 0xc0000022;
15 |
16 | private const uint ValidResponseOption = 6;
17 |
18 | private static void Main() {
19 | NtRaiseHardError();
20 | }
21 |
22 | public static void NtRaiseHardError() {
23 | try {
24 | _ = RtlAdjustPrivilege(Privilege, true, false, out _);
25 |
26 | NtRaiseHardError(ErrorStatus, 0, 0, IntPtr.Zero, ValidResponseOption, out _);
27 | } catch (Exception) {
28 | // ignored
29 | }
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/NotMe_CSharp/ZwRaiseHardError/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace ZwRaiseHardError {
5 | public abstract class Program {
6 | [DllImport("ntdll.dll")]
7 | private static extern uint RtlAdjustPrivilege(int privilege, bool bEnablePrivilege, bool isThreadPrivilege, out bool previousValue);
8 |
9 | [DllImport("ntdll.dll")]
10 | private static extern uint ZwRaiseHardError(uint errorStatus, uint numberOfParameters, uint unicodeStringParameterMask, IntPtr parameters, uint validResponseOption, out uint response);
11 |
12 | private const int Privilege = 19;
13 |
14 | private const uint ErrorStatus = 0xc0000022;
15 |
16 | private const uint ValidResponseOption = 6;
17 |
18 | private static void Main() {
19 | ZwRaiseHardError();
20 | }
21 |
22 | public static void ZwRaiseHardError() {
23 | try {
24 | _ = RtlAdjustPrivilege(Privilege, true, false, out _);
25 |
26 | ZwRaiseHardError(ErrorStatus, 0, 0, IntPtr.Zero, ValidResponseOption, out _);
27 | } catch (Exception) {
28 | // ignored
29 | }
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/NotMe_CSharp/SetProcessIsCritical/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Reflection;
4 | using System.Runtime.InteropServices;
5 |
6 | namespace SetProcessIsCritical {
7 | public abstract class Program {
8 | [DllImport("ntdll.dll")]
9 | private static extern void RtlSetProcessIsCritical(uint newValue, uint oldValue, uint checkFlag);
10 |
11 | private static void Main() {
12 | SetProcessIsCritical();
13 | }
14 |
15 | public static void SetProcessIsCritical() {
16 | try {
17 | Process.EnterDebugMode();
18 | } catch (Exception) {
19 | var process = new Process {
20 | StartInfo = {
21 | FileName = Assembly.GetExecutingAssembly().Location,
22 | UseShellExecute = true,
23 | Verb = "runas"
24 | }
25 | };
26 | try {
27 | process.Start();
28 | } catch (Exception) {
29 | return;
30 | }
31 | }
32 |
33 | RtlSetProcessIsCritical(1, 0, 0);
34 |
35 | Environment.Exit(1);
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace NotMe {
4 | public partial class MainWindow {
5 | public MainWindow() {
6 | InitializeComponent();
7 | }
8 |
9 | private void BtnNtRaiseHardError_Click(object sender, RoutedEventArgs e) {
10 | NtRaiseHardError.Program.NtRaiseHardError();
11 | }
12 |
13 | private void BtnZwRaiseHardError_Click(object sender, RoutedEventArgs e) {
14 | ZwRaiseHardError.Program.ZwRaiseHardError();
15 | }
16 |
17 | private void BtnSetProcessIsCritical_Click(object sender, RoutedEventArgs e) {
18 | SetProcessIsCritical.Program.SetProcessIsCritical();
19 | }
20 |
21 | private void BtnCloseWindowStation_Click(object sender, RoutedEventArgs e) {
22 | CloseWindowStation.Program.CloseWindowStation();
23 | }
24 |
25 | private void BtnNTSDWinlogon_Click(object sender, RoutedEventArgs e) {
26 | NTSD_Winlogon.Program.NTSD_Winlogo();
27 | }
28 |
29 | private void BtnPowerShellWininit_Click(object sender, RoutedEventArgs e) {
30 | PowerShell_Wininit.Program.PowerShell_Wininit();
31 | }
32 |
33 | private void BtnTaskKillWininit_Click(object sender, RoutedEventArgs e) {
34 | TaskKill_Wininit.Program.TaskKill_Wininit();
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/NotMe_CSharp/CloseWindowStation/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace CloseWindowStation {
5 | public abstract class Program {
6 | [DllImport("user32.dll")]
7 | private static extern IntPtr CreateWindowStation(string lpwinsta, uint dwFlags, uint dwDesiredAccess, IntPtr lpsa);
8 |
9 | [DllImport("kernel32.dll")]
10 | private static extern bool SetHandleInformation(IntPtr hObject, uint dwMask, uint dwFlags);
11 |
12 | [DllImport("user32.dll")]
13 | private static extern bool CloseWindowStation(IntPtr hWinSta);
14 |
15 | private const long GENERIC_READ = 0x80000000L;
16 |
17 | private const long GENERIC_WRITE = 0x40000000L;
18 |
19 | private const int HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x2;
20 |
21 | private static void Main() {
22 | CloseWindowStation();
23 | }
24 |
25 | public static void CloseWindowStation() {
26 | try {
27 | const uint dwDesiredAccess = (uint)(GENERIC_READ | GENERIC_WRITE);
28 | IntPtr hWinSta = CreateWindowStation("WindowStation", 0, dwDesiredAccess, IntPtr.Zero);
29 | SetHandleInformation(hWinSta, HANDLE_FLAG_PROTECT_FROM_CLOSE, HANDLE_FLAG_PROTECT_FROM_CLOSE);
30 | CloseWindowStation(hWinSta);
31 | } catch (Exception) {
32 | // ignored
33 | }
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/NotMyFault/exe/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by notmyfault.rc
4 | //
5 | #define IDI_ICON1 105
6 | #define IDC_BUFFEROVERFLOW 1000
7 | #define IDC_WILDPOINTER 1001
8 | #define IDC_DEADLOCK 1002
9 | #define IDC_STACKTRASH 1003
10 | #define IDC_HANG 1004
11 | #define IDC_PAGEFAULT 1005
12 | #define IDC_IRQL 1006
13 | #define IDC_LEAK 1007
14 | #define IDC_LEAK_PAGE 1007
15 | #define IDC_HANGIRP 1008
16 | #define IDC_LEAK_NONPAGE 1009
17 | #define IDC_EDIT1 1010
18 | #define IDC_LEAKMB 1010
19 | #define IDC_SPIN1 1011
20 | #define IDCOLOR 1012
21 | #define IDC_RADIOFG 1013
22 | #define IDC_RADIOBG 1014
23 | #define IDC_DONE 1015
24 | #define IDC_PREVIEW 1016
25 | #define IDC_STATIC -1
26 |
27 | // Next default values for new objects
28 | //
29 | #ifdef APSTUDIO_INVOKED
30 | #ifndef APSTUDIO_READONLY_SYMBOLS
31 | #define _APS_NEXT_RESOURCE_VALUE 106
32 | #define _APS_NEXT_COMMAND_VALUE 40001
33 | #define _APS_NEXT_CONTROL_VALUE 1017
34 | #define _APS_NEXT_SYMED_VALUE 101
35 | #endif
36 | #endif
37 |
--------------------------------------------------------------------------------
/NotMyFault/exe/NotMyfault.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.11.35327.3
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NotMyfault", "NotMyfault.vcxproj", "{7C86ACEC-4A92-4977-8346-F9A6C37896B8}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {7C86ACEC-4A92-4977-8346-F9A6C37896B8}.Debug|x64.ActiveCfg = Debug|x64
17 | {7C86ACEC-4A92-4977-8346-F9A6C37896B8}.Debug|x64.Build.0 = Debug|x64
18 | {7C86ACEC-4A92-4977-8346-F9A6C37896B8}.Debug|x86.ActiveCfg = Debug|Win32
19 | {7C86ACEC-4A92-4977-8346-F9A6C37896B8}.Debug|x86.Build.0 = Debug|Win32
20 | {7C86ACEC-4A92-4977-8346-F9A6C37896B8}.Release|x64.ActiveCfg = Release|x64
21 | {7C86ACEC-4A92-4977-8346-F9A6C37896B8}.Release|x64.Build.0 = Release|x64
22 | {7C86ACEC-4A92-4977-8346-F9A6C37896B8}.Release|x86.ActiveCfg = Release|Win32
23 | {7C86ACEC-4A92-4977-8346-F9A6C37896B8}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {D83E184A-B459-4859-A5B5-60D1FAAF04A1}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/.github/workflows/cmake-single-platform.yml:
--------------------------------------------------------------------------------
1 | # This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
2 | # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
3 | name: CMake on a single platform
4 |
5 | on:
6 | push:
7 | branches: [ "main" ]
8 | pull_request:
9 | branches: [ "main" ]
10 |
11 | env:
12 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
13 | BUILD_TYPE: Release
14 |
15 | jobs:
16 | build:
17 | defaults:
18 | run:
19 | working-directory: NotMe_CPP
20 |
21 | # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
22 | # You can convert this to a matrix build if you need cross-platform coverage.
23 | # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
24 | runs-on: windows-latest
25 |
26 | steps:
27 | - uses: actions/checkout@v4
28 |
29 | - name: Configure CMake
30 | # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
31 | # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
32 | run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
33 |
34 | - name: Build
35 | # Build your program with the given configuration
36 | run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
37 |
38 |
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("NotMe")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("NotMe")]
15 | [assembly: AssemblyCopyright("Copyright © Seeleo (LZC.app) 2024")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 会使此程序集中的类型
20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //在 中。例如,如果你使用的是美国英语。
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(ResourceDictionaryLocation.None, //主题特定资源词典所处位置
35 | //(未在页面中找到资源时使用,
36 | //或应用程序资源字典中找到时使用)
37 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
38 | //(未在页面中找到资源时使用,
39 | //、应用程序或任何主题专用资源字典中找到时使用)
40 | )]
41 |
42 |
43 | // 程序集的版本信息由下列四个值组成:
44 | //
45 | // 主版本
46 | // 次版本
47 | // 生成号
48 | // 修订号
49 | //
50 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
51 | //通过使用 "*",如下所示:
52 | // [assembly: AssemblyVersion("1.0.*")]
53 | [assembly: AssemblyVersion("1.0.0.0")]
54 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/NotMyFault/exe/IOCTLCMD.H:
--------------------------------------------------------------------------------
1 | //======================================================================
2 | //
3 | // ioctlcmd.h
4 | //
5 | // Copyright (C) 2002 Mark Russinovich
6 | //
7 | // This file contains driver IOCTLs and definitions shared by the
8 | // driver and the GUI.
9 | //
10 | //======================================================================
11 |
12 | //
13 | // Device type
14 | //
15 | #define FILE_DEVICE_MYFAULT 0x00008336
16 |
17 |
18 | //
19 | // IOCTLS
20 | //
21 | #define IOCTL_BUFFER_OVERFLOW (ULONG) CTL_CODE( FILE_DEVICE_MYFAULT, 0x00, METHOD_BUFFERED, FILE_ANY_ACCESS )
22 | #define IOCTL_WILD_POINTER (ULONG) CTL_CODE( FILE_DEVICE_MYFAULT, 0x01, METHOD_BUFFERED, FILE_ANY_ACCESS )
23 | #define IOCTL_PAGE_FAULT (ULONG) CTL_CODE( FILE_DEVICE_MYFAULT, 0x02, METHOD_BUFFERED, FILE_ANY_ACCESS )
24 | #define IOCTL_DEADLOCK (ULONG) CTL_CODE( FILE_DEVICE_MYFAULT, 0x03, METHOD_BUFFERED, FILE_ANY_ACCESS )
25 | #define IOCTL_TRASH_STACK (ULONG) CTL_CODE( FILE_DEVICE_MYFAULT, 0x04, METHOD_BUFFERED, FILE_ANY_ACCESS )
26 | #define IOCTL_LEAK_PAGED (ULONG) CTL_CODE( FILE_DEVICE_MYFAULT, 0x05, METHOD_BUFFERED, FILE_ANY_ACCESS )
27 | #define IOCTL_IRQL (ULONG) CTL_CODE( FILE_DEVICE_MYFAULT, 0x06, METHOD_BUFFERED, FILE_ANY_ACCESS )
28 | #define IOCTL_HANG (ULONG) CTL_CODE( FILE_DEVICE_MYFAULT, 0x07, METHOD_BUFFERED, FILE_ANY_ACCESS )
29 | #define IOCTL_HANG_IRP (ULONG) CTL_CODE( FILE_DEVICE_MYFAULT, 0x08, METHOD_BUFFERED, FILE_ANY_ACCESS )
30 | #define IOCTL_LEAK_NONPAGED (ULONG) CTL_CODE( FILE_DEVICE_MYFAULT, 0x09, METHOD_BUFFERED, FILE_ANY_ACCESS )
31 | #define IOCTL_BSOD_COLOR (ULONG) CTL_CODE( FILE_DEVICE_MYFAULT, 0x10, METHOD_BUFFERED, FILE_ANY_ACCESS )
32 |
--------------------------------------------------------------------------------
/NotMyFault/exe/NotMyfault.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {8244ffb9-4ad7-454f-a48b-e69f5b138640}
6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat
7 |
8 |
9 | {a3b94c08-2c31-4b38-b78c-8d56007a276d}
10 | h;hpp;hxx;hm;inl
11 |
12 |
13 | {965922dc-decf-4f13-9801-8ec2169ac873}
14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 | Source Files
23 |
24 |
25 |
26 |
27 | Header Files
28 |
29 |
30 | Header Files
31 |
32 |
33 | Header Files
34 |
35 |
36 |
37 |
38 | Resource Files
39 |
40 |
41 |
42 |
43 | Resource Files
44 |
45 |
46 |
--------------------------------------------------------------------------------
/NotMe_CPP/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 |
3 | project(Trigger-BSOD)
4 |
5 | set(CMAKE_CXX_STANDARD 11)
6 | set(CMAKE_CXX_STANDARD_REQUIRED True)
7 |
8 | set(CMAKE_EXE_LINKER_FLAGS -static)
9 |
10 | add_executable(AllinOne AllinOne.cpp rc.rc)
11 |
12 | add_executable(NTSD_Winlogon NTSD_Winlogon.cpp rc.rc)
13 |
14 | add_executable(TaskKill_Wininit TaskKill_Wininit.cpp rc.rc)
15 |
16 | add_executable(NtRaiseHardError NtRaiseHardError.cpp rc.rc)
17 | add_executable(ZwRaiseHardError ZwRaiseHardError.cpp rc.rc)
18 |
19 | add_executable(PowerShell_Wininit PowerShell_Wininit.cpp rc.rc)
20 |
21 | add_executable(CloseWindowStation CloseWindowStation.cpp rc.rc)
22 |
23 | add_executable(SetProcessIsCritical SetProcessIsCritical.cpp rc.rc)
24 |
25 | add_custom_command(TARGET SetProcessIsCritical POST_BUILD
26 | COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/CMakeCache.txt
27 | COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/cmake_install.cmake
28 | COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/Makefile
29 | COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/CTestTestfile.cmake
30 | COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/CTestConfiguration.cmake
31 | COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/CTestCustom.cmake
32 | COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/cmake_install.cmake
33 | COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/Trigger-BSOD.cbp
34 | COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/.cmake
35 | COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/CMakeFiles
36 | COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/CMakeScripts
37 | COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/Testing
38 | )
--------------------------------------------------------------------------------
/NotMe_CPP/AllinOne.cpp:
--------------------------------------------------------------------------------
1 | #include "RaiseHardError.h"
2 | #include "SetProcessIsCritical.h"
3 |
4 | int RaiseHardError() {
5 | auto hNtdll = LoadLibraryA("ntdll.dll");
6 | if (hNtdll == nullptr) {
7 | FreeLibrary(hNtdll);
8 | return ERROR_BAD_ENVIRONMENT;
9 | }
10 |
11 | auto RtlAdjustPrivilege = reinterpret_cast(GetProcAddress(hNtdll, "RtlAdjustPrivilege"));
12 | BOOLEAN enabled;
13 | if (RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE, TRUE, FALSE, &enabled) != 0) {
14 | FreeLibrary(hNtdll);
15 | return ERROR_ACCESS_DENIED;
16 | }
17 |
18 | auto NtRaiseHardError = reinterpret_cast(GetProcAddress(hNtdll, "NtRaiseHardError"));
19 | auto ZwRaiseHardError = reinterpret_cast(GetProcAddress(hNtdll, "ZwRaiseHardError"));
20 | FreeLibrary(hNtdll);
21 | HARDERROR_RESPONSE Response;
22 | NtRaiseHardError(Error_Status, 0, nullptr, nullptr, OptionShutdownSystem, &Response);
23 | ZwRaiseHardError(Error_Status, 0, nullptr, nullptr, OptionShutdownSystem, &Response);
24 | return Response;
25 | }
26 |
27 | int SetCriticalProcess() {
28 | auto hNtdll = LoadLibraryA("ntdll.dll");
29 | if (hNtdll == nullptr) {
30 | FreeLibrary(hNtdll);
31 | return ERROR_BAD_ENVIRONMENT;
32 | }
33 |
34 | auto RtlAdjustPrivilege = reinterpret_cast(GetProcAddress(hNtdll, "RtlAdjustPrivilege"));
35 | BOOLEAN enabled;
36 | if (RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE, TRUE, FALSE, &enabled) != 0) {
37 | FreeLibrary(hNtdll);
38 | return ERROR_ACCESS_DENIED;
39 | }
40 |
41 | auto RtlSetProcessIsCritical = reinterpret_cast(GetProcAddress(hNtdll, "RtlSetProcessIsCritical"));
42 | FreeLibrary(hNtdll);
43 | BOOLEAN OldValue;
44 | return RtlSetProcessIsCritical(TRUE, &OldValue, FALSE);
45 | }
46 |
47 | int main() {
48 | HWND hWnd = GetConsoleWindow();
49 | ShowWindow(hWnd, SW_HIDE);
50 |
51 | RaiseHardError();
52 | SetCriticalProcess();
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/NotMe_CPP/RaiseHardError.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #pragma clang diagnostic push
3 | #pragma ide diagnostic ignored "bugprone-reserved-identifier"
4 | #ifndef TRIGGER_BSOD_RAISEHARDERROR_H
5 | #define TRIGGER_BSOD_RAISEHARDERROR_H
6 |
7 | #define Error_Status 0xC0000002
8 | #define SE_SHUTDOWN_PRIVILEGE 0x13
9 |
10 | #include
11 | #include
12 |
13 | typedef enum _HARDERROR_RESPONSE_OPTION {
14 | OptionAbortRetryIgnore,
15 | OptionOk,
16 | OptionOkCancel,
17 | OptionRetryCancel,
18 | OptionYesNo,
19 | OptionYesNoCancel,
20 | OptionShutdownSystem
21 | } HARDERROR_RESPONSE_OPTION, * PHARDERROR_RESPONSE_OPTION;
22 |
23 | typedef enum _HARDERROR_RESPONSE {
24 | ResponseReturnToCaller,
25 | ResponseNotHandled,
26 | ResponseAbort,
27 | ResponseCancel,
28 | ResponseIgnore,
29 | ResponseNo,
30 | ResponseOk,
31 | ResponseRetry,
32 | ResponseYes
33 | } HARDERROR_RESPONSE, * PHARDERROR_RESPONSE;
34 |
35 | typedef NTSTATUS(NTAPI *pdef_RtlAdjustPrivilege)(
36 | ULONG Privilege,
37 | BOOLEAN Enable,
38 | BOOLEAN Client,
39 | PBOOLEAN WasEnabled
40 | );
41 |
42 | typedef NTSTATUS(NTAPI *pdef_NtRaiseHardError)(
43 | IN NTSTATUS ErrorStatus,
44 | IN ULONG NumberOfParameters,
45 | IN PUNICODE_STRING UnicodeStringParameterMask,
46 | IN PULONG_PTR Parameters,
47 | IN HARDERROR_RESPONSE_OPTION ValidResponseOptions,
48 | OUT PHARDERROR_RESPONSE Response
49 | );
50 |
51 | typedef NTSTATUS(NTAPI *pdef_ZwRaiseHardError)(
52 | IN NTSTATUS ErrorStatus,
53 | IN ULONG NumberOfParameters,
54 | IN PUNICODE_STRING UnicodeStringParameterMask,
55 | IN PULONG_PTR Parameters,
56 | IN HARDERROR_RESPONSE_OPTION ValidResponseOptions,
57 | OUT PHARDERROR_RESPONSE Response
58 | );
59 |
60 | #endif //TRIGGER_BSOD_RAISEHARDERROR_H
61 |
62 | #pragma clang diagnostic pop
--------------------------------------------------------------------------------
/NotMe_CSharp/NTSD_Winlogon/NTSD_Winlogon.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {067EB2ED-57F8-4A9C-860E-A563A8A13211}
8 | WinExe
9 | NTSD_Winlogon
10 | NTSD_Winlogon
11 | v4.0
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | icon.ico
36 |
37 |
38 | NTSD_Winlogon.Program
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/NotMe_CSharp/NtRaiseHardError/NtRaiseHardError.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {65340C14-3429-4BCA-8B10-D4B6CB708DA2}
8 | WinExe
9 | NtRaiseHardError
10 | NtRaiseHardError
11 | v4.0
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | NtRaiseHardError.Program
36 |
37 |
38 | icon.ico
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/NotMe_CSharp/TaskKill_Wininit/TaskKill_Wininit.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {FD7E0D8A-5F2D-44B3-B254-BB64D6BB4C82}
8 | WinExe
9 | TaskKill_Wininit
10 | TaskKill_Wininit
11 | v4.0
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | icon.ico
36 |
37 |
38 | TaskKill_Wininit.Program
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/NotMe_CSharp/ZwRaiseHardError/ZwRaiseHardError.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {253C96C1-80C6-4F8A-8123-DCE0B983E44D}
8 | WinExe
9 | ZwRaiseHardError
10 | ZwRaiseHardError
11 | v4.0
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | ZwRaiseHardError.Program
36 |
37 |
38 | icon.ico
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/NotMe_CSharp/CloseWindowStation/CloseWindowStation.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {CE7207FA-118A-4576-9A41-B64DA63EB332}
8 | WinExe
9 | CloseWindowStation
10 | CloseWindowStation
11 | v4.0
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | icon.ico
36 |
37 |
38 | CloseWindowStation.Program
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/NotMe_CSharp/PowerShell_Wininit/PowerShell_Wininit.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {05A3813E-0E43-46D1-BCAE-1EDD9C67836F}
8 | WinExe
9 | PowerShell_Wininit
10 | PowerShell_Wininit
11 | v4.0
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | PowerShell_Wininit.Program
36 |
37 |
38 | icon.ico
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/NotMe_CSharp/SetProcessIsCritical/SetProcessIsCritical.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {3929947F-7C8B-44AA-B103-E3211CBB934E}
8 | WinExe
9 | SetProcessIsCritical
10 | SetProcessIsCritical
11 | v4.0
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | SetProcessIsCritical.Program
36 |
37 |
38 | icon.ico
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace NotMe.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NotMe.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 重写当前线程的 CurrentUICulture 属性,对
51 | /// 使用此强类型资源类的所有资源查找执行重写。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
13 |
16 |
19 |
21 |
23 |
25 |
27 |
29 |
30 |
--------------------------------------------------------------------------------
/NotMe_CSharp/NotMe_CSharp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.9.34728.123
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NtRaiseHardError", "NtRaiseHardError\NtRaiseHardError.csproj", "{65340C14-3429-4BCA-8B10-D4B6CB708DA2}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZwRaiseHardError", "ZwRaiseHardError\ZwRaiseHardError.csproj", "{253C96C1-80C6-4F8A-8123-DCE0B983E44D}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SetProcessIsCritical", "SetProcessIsCritical\SetProcessIsCritical.csproj", "{3929947F-7C8B-44AA-B103-E3211CBB934E}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotMe", "GUI\NotMe.csproj", "{BD06A036-0431-4E42-8AC7-0EEBA5818621}"
13 | ProjectSection(ProjectDependencies) = postProject
14 | {253C96C1-80C6-4F8A-8123-DCE0B983E44D} = {253C96C1-80C6-4F8A-8123-DCE0B983E44D}
15 | {3929947F-7C8B-44AA-B103-E3211CBB934E} = {3929947F-7C8B-44AA-B103-E3211CBB934E}
16 | {65340C14-3429-4BCA-8B10-D4B6CB708DA2} = {65340C14-3429-4BCA-8B10-D4B6CB708DA2}
17 | {CE7207FA-118A-4576-9A41-B64DA63EB332} = {CE7207FA-118A-4576-9A41-B64DA63EB332}
18 | EndProjectSection
19 | EndProject
20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloseWindowStation", "CloseWindowStation\CloseWindowStation.csproj", "{CE7207FA-118A-4576-9A41-B64DA63EB332}"
21 | EndProject
22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NTSD_Winlogon", "NTSD_Winlogon\NTSD_Winlogon.csproj", "{067EB2ED-57F8-4A9C-860E-A563A8A13211}"
23 | EndProject
24 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShell_Wininit", "PowerShell_Wininit\PowerShell_Wininit.csproj", "{05A3813E-0E43-46D1-BCAE-1EDD9C67836F}"
25 | EndProject
26 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskKill_Wininit", "TaskKill_Wininit\TaskKill_Wininit.csproj", "{FD7E0D8A-5F2D-44B3-B254-BB64D6BB4C82}"
27 | EndProject
28 | Global
29 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
30 | Debug|Any CPU = Debug|Any CPU
31 | Release|Any CPU = Release|Any CPU
32 | EndGlobalSection
33 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
34 | {65340C14-3429-4BCA-8B10-D4B6CB708DA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35 | {65340C14-3429-4BCA-8B10-D4B6CB708DA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
36 | {65340C14-3429-4BCA-8B10-D4B6CB708DA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
37 | {65340C14-3429-4BCA-8B10-D4B6CB708DA2}.Release|Any CPU.Build.0 = Release|Any CPU
38 | {253C96C1-80C6-4F8A-8123-DCE0B983E44D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {253C96C1-80C6-4F8A-8123-DCE0B983E44D}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {253C96C1-80C6-4F8A-8123-DCE0B983E44D}.Release|Any CPU.ActiveCfg = Release|Any CPU
41 | {253C96C1-80C6-4F8A-8123-DCE0B983E44D}.Release|Any CPU.Build.0 = Release|Any CPU
42 | {3929947F-7C8B-44AA-B103-E3211CBB934E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43 | {3929947F-7C8B-44AA-B103-E3211CBB934E}.Debug|Any CPU.Build.0 = Debug|Any CPU
44 | {3929947F-7C8B-44AA-B103-E3211CBB934E}.Release|Any CPU.ActiveCfg = Release|Any CPU
45 | {3929947F-7C8B-44AA-B103-E3211CBB934E}.Release|Any CPU.Build.0 = Release|Any CPU
46 | {BD06A036-0431-4E42-8AC7-0EEBA5818621}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47 | {BD06A036-0431-4E42-8AC7-0EEBA5818621}.Debug|Any CPU.Build.0 = Debug|Any CPU
48 | {BD06A036-0431-4E42-8AC7-0EEBA5818621}.Release|Any CPU.ActiveCfg = Release|Any CPU
49 | {BD06A036-0431-4E42-8AC7-0EEBA5818621}.Release|Any CPU.Build.0 = Release|Any CPU
50 | {CE7207FA-118A-4576-9A41-B64DA63EB332}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51 | {CE7207FA-118A-4576-9A41-B64DA63EB332}.Debug|Any CPU.Build.0 = Debug|Any CPU
52 | {CE7207FA-118A-4576-9A41-B64DA63EB332}.Release|Any CPU.ActiveCfg = Release|Any CPU
53 | {CE7207FA-118A-4576-9A41-B64DA63EB332}.Release|Any CPU.Build.0 = Release|Any CPU
54 | {067EB2ED-57F8-4A9C-860E-A563A8A13211}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
55 | {067EB2ED-57F8-4A9C-860E-A563A8A13211}.Debug|Any CPU.Build.0 = Debug|Any CPU
56 | {067EB2ED-57F8-4A9C-860E-A563A8A13211}.Release|Any CPU.ActiveCfg = Release|Any CPU
57 | {067EB2ED-57F8-4A9C-860E-A563A8A13211}.Release|Any CPU.Build.0 = Release|Any CPU
58 | {05A3813E-0E43-46D1-BCAE-1EDD9C67836F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
59 | {05A3813E-0E43-46D1-BCAE-1EDD9C67836F}.Debug|Any CPU.Build.0 = Debug|Any CPU
60 | {05A3813E-0E43-46D1-BCAE-1EDD9C67836F}.Release|Any CPU.ActiveCfg = Release|Any CPU
61 | {05A3813E-0E43-46D1-BCAE-1EDD9C67836F}.Release|Any CPU.Build.0 = Release|Any CPU
62 | {FD7E0D8A-5F2D-44B3-B254-BB64D6BB4C82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
63 | {FD7E0D8A-5F2D-44B3-B254-BB64D6BB4C82}.Debug|Any CPU.Build.0 = Debug|Any CPU
64 | {FD7E0D8A-5F2D-44B3-B254-BB64D6BB4C82}.Release|Any CPU.ActiveCfg = Release|Any CPU
65 | {FD7E0D8A-5F2D-44B3-B254-BB64D6BB4C82}.Release|Any CPU.Build.0 = Release|Any CPU
66 | EndGlobalSection
67 | GlobalSection(SolutionProperties) = preSolution
68 | HideSolutionNode = FALSE
69 | EndGlobalSection
70 | GlobalSection(ExtensibilityGlobals) = postSolution
71 | SolutionGuid = {95813E6C-2D57-419D-9BF6-71B61362D387}
72 | EndGlobalSection
73 | EndGlobal
74 |
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/NotMe_CSharp/GUI/NotMe.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {BD06A036-0431-4E42-8AC7-0EEBA5818621}
8 | WinExe
9 | NotMe
10 | NotMe
11 | v4.0
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 | icon.ico
38 |
39 |
40 | NotMe.App
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | 4.0
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | MSBuild:Compile
61 | Designer
62 |
63 |
64 | MSBuild:Compile
65 | Designer
66 |
67 |
68 | App.xaml
69 | Code
70 |
71 |
72 | MainWindow.xaml
73 | Code
74 |
75 |
76 |
77 |
78 | Code
79 |
80 |
81 | True
82 | True
83 | Resources.resx
84 |
85 |
86 | True
87 | Settings.settings
88 | True
89 |
90 |
91 | ResXFileCodeGenerator
92 | Resources.Designer.cs
93 |
94 |
95 | SettingsSingleFileGenerator
96 | Settings.Designer.cs
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 | {ce7207fa-118a-4576-9a41-b64da63eb332}
108 | CloseWindowStation
109 |
110 |
111 | {65340c14-3429-4bca-8b10-d4b6cb708da2}
112 | NtRaiseHardError
113 |
114 |
115 | {067eb2ed-57f8-4a9c-860e-a563a8a13211}
116 | NTSD_Winlogon
117 |
118 |
119 | {05a3813e-0e43-46d1-bcae-1edd9c67836f}
120 | PowerShell_Wininit
121 |
122 |
123 | {3929947f-7c8b-44aa-b103-e3211cbb934e}
124 | SetProcessIsCritical
125 |
126 |
127 | {fd7e0d8a-5f2d-44b3-b254-bb64d6bb4c82}
128 | TaskKill_Wininit
129 |
130 |
131 | {253c96c1-80c6-4f8a-8123-dce0b983e44d}
132 | ZwRaiseHardError
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NotMe
2 |
3 | **:warning: SOLELY FOR SECURITY RESEARCH PURPOSES. DO NOT USE THIS REPO FOR ILLEGAL PURPOSES. :warning:**
4 |
5 | The name "**NotMe**" is inspired by the Microsoft tool "**NotMyFault**", also a tool that can be used to cause BSOD (Blue Screen of Death) on Windows system.
6 |
7 |  
8 |
9 | ## Project Structure
10 |
11 | ### NotMe_CPP
12 |
13 | `C++` project that uses `CMake` and `CLion` to build.
14 |
15 | - Toolchain: MinGW32 from MSYS2
16 |
17 | ### NotMe_CSharp
18 |
19 | `C#` and `.Net Framework 4`. Including a GUI app.
20 |
21 | ## NtRaiseHardError & ZwRaiseHardError
22 |
23 | > Ref:
24 |
25 | Both functions are undocumented `Windows APIs (NTAPI)` included in `ntdll.dll`, which can
26 | cause `BlueScreen (BSOD, Blue Screen of Death)` with certain parameters.
27 |
28 | ```C++
29 | NtRaiseHardError(
30 | IN NTSTATUS ErrorStatus,
31 | IN ULONG NumberOfParameters,
32 | IN PUNICODE_STRING UnicodeStringParameterMask OPTIONAL,
33 | IN PVOID *Parameters,
34 | IN HARDERROR_RESPONSE_OPTION ResponseOption,
35 | OUT PHARDERROR_RESPONSE Response
36 | );
37 | ```
38 |
39 | ```C++
40 | ZwRaiseHardError(
41 | IN NTSTATUS ErrorStatus,
42 | IN ULONG NumberOfParameters,
43 | IN PUNICODE_STRING UnicodeStringParameterMask OPTIONAL,
44 | IN PVOID *Parameters,
45 | IN HARDERROR_RESPONSE_OPTION ResponseOption,
46 | OUT PHARDERROR_RESPONSE Response
47 | );
48 | ```
49 |
50 | - `ErrorStatus` Error code.
51 | - `NumberOfParameters` Number of optional parameters in Parameters array.
52 | - `UnicodeStringParameterMask` Optional string parameter (can be only one per error code).
53 | - `*Parameters` Array of **DWORD** parameters for use in error message string.
54 | - `ResponseOption` See `HARDERROR_RESPONSE_OPTION` for possible values description.
55 | - `Response` Pointer to `HARDERROR_RESPONSE` enumeration.
56 |
57 | ### Parameters
58 |
59 | #### PUNICODE_STRING
60 |
61 | ```C++
62 | #include
63 | ```
64 |
65 | ```C++
66 | typedef struct _UNICODE_STRING {
67 | USHORT Length;
68 | USHORT MaximumLength;
69 | PWSTR Buffer;
70 | } UNICODE_STRING, *PUNICODE_STRING;
71 | ```
72 |
73 | #### HARDERROR_RESPONSE_OPTION
74 |
75 | ```C++
76 | typedef enum _HARDERROR_RESPONSE_OPTION {
77 | OptionAbortRetryIgnore,
78 | OptionOk,
79 | OptionOkCancel,
80 | OptionRetryCancel,
81 | OptionYesNo,
82 | OptionYesNoCancel,
83 | OptionShutdownSystem
84 | } HARDERROR_RESPONSE_OPTION, *PHARDERROR_RESPONSE_OPTION;
85 | ```
86 |
87 | #### PHARDERROR_RESPONSE
88 |
89 | ```C++
90 | typedef enum _HARDERROR_RESPONSE {
91 | ResponseReturnToCaller,
92 | ResponseNotHandled,
93 | ResponseAbort,
94 | ResponseCancel,
95 | ResponseIgnore,
96 | ResponseNo,
97 | ResponseOk,
98 | ResponseRetry,
99 | ResponseYes
100 | } HARDERROR_RESPONSE, *PHARDERROR_RESPONSE;
101 | ```
102 |
103 | ## SetProcessIsCritical
104 |
105 | > Ref:
106 |
107 | `RtlSetProcessIsCritical` is yet another undocumented function hidden in the Windows kernel. It is one of the few which
108 | do not have a kernel32 equivalent.
109 |
110 | `RtlSetProcessIsCritical` sets a process to a system critical status. This means that the process is now "critical" to
111 | the running of Windows, which also means that on termination of your process, Windows itself terminates as well. When a
112 | system critical process ends/terminates, the stop code is CRITICAL_PROCESS_DIED (0xEF) for process exiting, and
113 | CRITICAL_OBJECT_TERMINATION (0xF4) if the process was abnormally terminated.
114 |
115 | ```C++
116 | /**
117 | * @param NewValue the new critical setting: 1 for a critical process, 0 for a normal process
118 | * @param OldValue if not null, will receive the old setting for the process
119 | * @param bNeedScb specifics whether system critical breaks will be required (and already enabled) for the process
120 | */
121 | NTSTATUS RtlSetProcessIsCritical (IN BOOLEAN bNew, OUT BOOLEAN *pbOld, IN BOOLEAN bNeedScb);
122 | ```
123 |
124 | This means that calling `RtlSetProcessIsCritical(TRUE, NULL, FALSE)` would make a process critical, while another call
125 | to `RtlSetProcessIsCritical(FALSE, NULL, FALSE)` would return the process to normal. When critical status is set,
126 | termination or ending of the process in any way will usually cause either a BSOD (if BSOD-ing is enabled), or will cause
127 | the system to reboot itself.
128 |
129 | ## CloseWindowStation
130 |
131 | ```C++
132 | HWINSTA CreateWindowStationA(
133 | [in, optional] LPCSTR lpwinsta,
134 | DWORD dwFlags,
135 | [in] ACCESS_MASK dwDesiredAccess,
136 | [in, optional] LPSECURITY_ATTRIBUTES lpsa
137 | );
138 | ```
139 |
140 | ```C++
141 | BOOL CloseWindowStation(
142 | [in] HWINSTA hWinSta
143 | );
144 | ```
145 |
146 | ## NTSD_Winlogon
147 |
148 | ```shell
149 | cmd /c start /min ntsd -c q -pn winlogon.exe 1>nul 2>nul
150 | ```
151 |
152 | ## PowerShell_Wininit
153 |
154 | ```shell
155 | powershell wininit
156 | ```
157 |
158 | ## TaskKill_Wininit
159 |
160 | ```shell
161 | taskkill /f /im wininit.exe
162 | ```
163 |
164 | ## Compatibility
165 |
166 | ### NtRaiseHardError & ZwRaiseHardError
167 |
168 | Works on all Windows systems with `Windows NT kernel` (`ntdll.dll`). Does not triger the `UAC (User Account Control)` prompt.
169 |
170 | ### SetProcessIsCritical
171 |
172 | Require `ntdll.dll` versions 5.1 (`Windows XP`) and higher.
173 |
174 | Needs `Administrator privilege` / trigers `UAC (User Account Control)` on `Winodws 10` and `Windows 11`.
175 |
176 | ### Compatibility Table
177 |
178 | | | ReactOS 0.4.14 | Windows 2000 | Windows XP | Windows Vista | Windows 7 | Windows 10 | Windows 11 |
179 | | ----------------------------------- | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
180 | | NtRaiseHardError / ZwRaiseHardError | :x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
181 | | SetProcessIsCritical | :heavy_check_mark: | :x: | :heavy_check_mark: | :o: | :o: | :o: | :o: |
182 | | CloseWindowStation | :x: | :x: | :heavy_check_mark: | :x: | :x: | :x: | :x: |
183 | | NTSD_Winlogon | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: | :x: | :x: |
184 | | PowerShell_Wininit | :x: | :x: | :x: | :x: | :o: | :x: | :x: |
185 | | TaskKill_Wininit | :x: | :x: | :x: | :o: | :o: | :x: | :x: |
186 |
187 | > :heavy_check_mark:: Works Well
188 | >
189 | > :o:: Requires `Administrator Privilege` / `UAC (User Account Control)`
190 | >
191 | > :x:: Not Working
192 |
193 | ## Star History
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
--------------------------------------------------------------------------------
/NotMyFault/exe/driver.c:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | *
3 | * Regmon - Registry Monitor for Windows 95/98/Me/NT/2K/XP/IA64
4 | *
5 | * Copyright (c) 1996-2002 Mark Russinovich and Bryce Cogswell
6 | * See readme.txt for terms and conditions.
7 | *
8 | * Displays Registry activity in real-time.
9 | *
10 | ******************************************************************************/
11 | #include
12 | #include
13 | #include
14 |
15 |
16 | // Driver handle
17 | HANDLE SysHandle = INVALID_HANDLE_VALUE;
18 |
19 |
20 | /****************************************************************************
21 | *
22 | * FUNCTION: InstallDriver( IN SC_HANDLE, IN LPCTSTR, IN LPCTSTR)
23 | *
24 | * PURPOSE: Creates a driver service.
25 | *
26 | ****************************************************************************/
27 | BOOL InstallDriver(IN SC_HANDLE SchSCManager, IN LPCTSTR DriverName, IN LPCTSTR ServiceExe)
28 | {
29 | SC_HANDLE schService;
30 |
31 | //
32 | // NOTE: This creates an entry for a standalone driver. If this
33 | // is modified for use with a driver that requires a Tag,
34 | // Group, and/or Dependencies, it may be necessary to
35 | // query the registry for existing driver information
36 | // (in order to determine a unique Tag, etc.).
37 | //
38 |
39 | schService = CreateService(SchSCManager, // SCManager database
40 | DriverName, // name of service
41 | DriverName, // name to display
42 | SERVICE_ALL_ACCESS, // desired access
43 | SERVICE_KERNEL_DRIVER, // service type
44 | SERVICE_DEMAND_START, // start type
45 | SERVICE_ERROR_IGNORE, // error control type
46 | ServiceExe, // service's binary
47 | NULL, // no load ordering group
48 | NULL, // no tag identifier
49 | NULL, // no dependencies
50 | NULL, // LocalSystem account
51 | NULL // no password
52 | );
53 | if (schService == NULL)
54 | return FALSE;
55 |
56 | CloseServiceHandle(schService);
57 |
58 | return TRUE;
59 | }
60 |
61 |
62 | /****************************************************************************
63 | *
64 | * FUNCTION: StartDriver( IN SC_HANDLE, IN LPCTSTR)
65 | *
66 | * PURPOSE: Starts the driver service.
67 | *
68 | ****************************************************************************/
69 | BOOL StartDriver(IN SC_HANDLE SchSCManager, IN LPCTSTR DriverName)
70 | {
71 | SC_HANDLE schService;
72 | BOOL ret;
73 |
74 | schService = OpenService(SchSCManager,
75 | DriverName,
76 | SERVICE_ALL_ACCESS
77 | );
78 | if (schService == NULL)
79 | return FALSE;
80 |
81 | ret = StartService(schService, 0, NULL)
82 | || GetLastError() == ERROR_SERVICE_ALREADY_RUNNING
83 | || GetLastError() == ERROR_SERVICE_DISABLED;
84 |
85 | CloseServiceHandle(schService);
86 | return ret;
87 | }
88 |
89 |
90 | /****************************************************************************
91 | *
92 | * FUNCTION: OpenDevice( IN LPCTSTR, HANDLE *)
93 | *
94 | * PURPOSE: Opens the device and returns a handle if desired.
95 | *
96 | ****************************************************************************/
97 | BOOL OpenDevice(IN LPCTSTR DriverName, HANDLE* lphDevice)
98 | {
99 | TCHAR completeDeviceName[64];
100 | HANDLE hDevice;
101 |
102 | //
103 | // Create a \\.\XXX device name that CreateFile can use
104 | //
105 | // NOTE: We're making an assumption here that the driver
106 | // has created a symbolic link using it's own name
107 | // (i.e. if the driver has the name "XXX" we assume
108 | // that it used IoCreateSymbolicLink to create a
109 | // symbolic link "\DosDevices\XXX". Usually, there
110 | // is this understanding between related apps/drivers.
111 | //
112 | // An application might also peruse the DEVICEMAP
113 | // section of the registry, or use the QueryDosDevice
114 | // API to enumerate the existing symbolic links in the
115 | // system.
116 | //
117 |
118 | if ((GetVersion() & 0xFF) >= 5)
119 | {
120 | //
121 | // We reference the global name so that the application can
122 | // be executed in Terminal Services sessions on Win2K
123 | //
124 | wsprintf(completeDeviceName, TEXT("\\\\.\\Global\\%s"), DriverName);
125 | }
126 | else
127 | {
128 | wsprintf(completeDeviceName, TEXT("\\\\.\\%s"), DriverName);
129 | }
130 |
131 | hDevice = CreateFile(completeDeviceName,
132 | GENERIC_READ | GENERIC_WRITE,
133 | 0,
134 | NULL,
135 | OPEN_EXISTING,
136 | FILE_ATTRIBUTE_NORMAL,
137 | NULL
138 | );
139 | if (hDevice == ((HANDLE)-1))
140 | return FALSE;
141 |
142 | // If user wants handle, give it to them. Otherwise, just close it.
143 | if (lphDevice)
144 | *lphDevice = hDevice;
145 | else
146 | CloseHandle(hDevice);
147 |
148 | return TRUE;
149 | }
150 |
151 |
152 | /****************************************************************************
153 | *
154 | * FUNCTION: StopDriver( IN SC_HANDLE, IN LPCTSTR)
155 | *
156 | * PURPOSE: Has the configuration manager stop the driver (unload it)
157 | *
158 | ****************************************************************************/
159 | BOOL StopDriver(IN SC_HANDLE SchSCManager, IN LPCTSTR DriverName)
160 | {
161 | SC_HANDLE schService;
162 | BOOL ret;
163 | SERVICE_STATUS serviceStatus;
164 |
165 | schService = OpenService(SchSCManager, DriverName, SERVICE_ALL_ACCESS);
166 | if (schService == NULL)
167 | return FALSE;
168 |
169 | ret = ControlService(schService, SERVICE_CONTROL_STOP, &serviceStatus);
170 |
171 | CloseServiceHandle(schService);
172 |
173 | return ret;
174 | }
175 |
176 |
177 | /****************************************************************************
178 | *
179 | * FUNCTION: RemoveDriver( IN SC_HANDLE, IN LPCTSTR)
180 | *
181 | * PURPOSE: Deletes the driver service.
182 | *
183 | ****************************************************************************/
184 | BOOL RemoveDriver(IN SC_HANDLE SchSCManager, IN LPCTSTR DriverName)
185 | {
186 | SC_HANDLE schService;
187 | BOOL ret;
188 |
189 | schService = OpenService(SchSCManager,
190 | DriverName,
191 | SERVICE_ALL_ACCESS
192 | );
193 |
194 | if (schService == NULL)
195 | return FALSE;
196 |
197 | ret = DeleteService(schService);
198 | CloseServiceHandle(schService);
199 | return ret;
200 | }
201 |
202 |
203 | /****************************************************************************
204 | *
205 | * FUNCTION: UnloadDeviceDriver( const TCHAR *)
206 | *
207 | * PURPOSE: Stops the driver and has the configuration manager unload it.
208 | *
209 | ****************************************************************************/
210 | BOOL UnloadDeviceDriver(const TCHAR* Name)
211 | {
212 | SC_HANDLE schSCManager;
213 |
214 | schSCManager = OpenSCManager(NULL, // machine (NULL == local)
215 | NULL, // database (NULL == default)
216 | SC_MANAGER_ALL_ACCESS // access required
217 | );
218 |
219 | StopDriver(schSCManager, Name);
220 | RemoveDriver(schSCManager, Name);
221 |
222 | CloseServiceHandle(schSCManager);
223 |
224 | return TRUE;
225 | }
226 |
227 | /****************************************************************************
228 | *
229 | * FUNCTION: LoadDeviceDriver( const TCHAR, const TCHAR, HANDLE *)
230 | *
231 | * PURPOSE: Registers a driver with the system configuration manager
232 | * and then loads it.
233 | *
234 | ****************************************************************************/
235 | BOOL LoadDeviceDriver(const TCHAR* Name, const TCHAR* Path,
236 | HANDLE* lphDevice, PDWORD Error)
237 | {
238 | SC_HANDLE schSCManager;
239 | BOOL okay;
240 |
241 | schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
242 |
243 | // Remove old instances
244 | RemoveDriver(schSCManager, Name);
245 |
246 | // Ignore success of installation: it may already be installed.
247 | InstallDriver(schSCManager, Name, Path);
248 |
249 | // Ignore success of start: it may already be started.
250 | StartDriver(schSCManager, Name);
251 |
252 | // Do make sure we can open it.
253 | okay = OpenDevice(Name, lphDevice);
254 | *Error = GetLastError();
255 | CloseServiceHandle(schSCManager);
256 |
257 | return okay;
258 | }
259 |
--------------------------------------------------------------------------------
/NotMyFault/exe/NotMyfault.vcproj:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
17 |
18 |
19 |
20 |
21 |
31 |
34 |
37 |
40 |
43 |
52 |
67 |
70 |
75 |
78 |
90 |
93 |
96 |
99 |
104 |
107 |
110 |
113 |
114 |
124 |
127 |
130 |
133 |
136 |
145 |
160 |
163 |
168 |
171 |
183 |
186 |
189 |
192 |
197 |
200 |
203 |
206 |
207 |
217 |
220 |
223 |
226 |
229 |
238 |
253 |
256 |
261 |
264 |
276 |
279 |
282 |
285 |
290 |
293 |
296 |
299 |
300 |
310 |
313 |
316 |
319 |
322 |
331 |
346 |
349 |
354 |
357 |
369 |
372 |
375 |
378 |
383 |
386 |
389 |
392 |
393 |
394 |
395 |
396 |
397 |
401 |
404 |
407 |
411 |
412 |
415 |
419 |
420 |
423 |
427 |
428 |
431 |
435 |
436 |
437 |
440 |
443 |
447 |
448 |
451 |
455 |
456 |
459 |
463 |
464 |
467 |
471 |
472 |
473 |
474 |
478 |
481 |
482 |
485 |
486 |
489 |
490 |
491 |
495 |
498 |
499 |
502 |
505 |
509 |
510 |
513 |
517 |
518 |
521 |
525 |
526 |
529 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
--------------------------------------------------------------------------------
/NotMyFault/exe/NotMyfault.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Debug
10 | x64
11 |
12 |
13 | Release
14 | Win32
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | 17.0
23 | {7C86ACEC-4A92-4977-8346-F9A6C37896B8}
24 | NotMyfault
25 |
26 |
27 |
28 | Application
29 | v143
30 | false
31 | MultiByte
32 |
33 |
34 | Application
35 | v143
36 | false
37 | MultiByte
38 |
39 |
40 | Application
41 | v143
42 | false
43 | MultiByte
44 |
45 |
46 | Application
47 | v143
48 | false
49 | MultiByte
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | <_ProjectFileVersion>17.0.35327.3
73 |
74 |
75 | .\Debug\
76 | .\Debug\
77 | true
78 |
79 |
80 | $(Platform)\$(Configuration)\
81 | $(Platform)\$(Configuration)\
82 | true
83 |
84 |
85 | .\Release\
86 | .\Release\
87 | false
88 |
89 |
90 | $(Platform)\$(Configuration)\
91 | $(Platform)\$(Configuration)\
92 | false
93 |
94 |
95 |
96 | _DEBUG;%(PreprocessorDefinitions)
97 | true
98 | true
99 | Win32
100 | .\Debug/NotMyfault.tlb
101 |
102 |
103 |
104 | Disabled
105 | WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)
106 | true
107 | EnableFastChecks
108 | MultiThreadedDebug
109 | .\Debug/NotMyfault.pch
110 | .\Debug/
111 | .\Debug/
112 | .\Debug/
113 | Level3
114 | true
115 | EditAndContinue
116 |
117 |
118 | _DEBUG;%(PreprocessorDefinitions)
119 | 0x0409
120 |
121 |
122 | .\Debug/NotMyfault.exe
123 | true
124 | true
125 | .\Debug/NotMyfault.pdb
126 | Windows
127 | false
128 |
129 | MachineX86
130 |
131 |
132 | true
133 | .\Debug/NotMyfault.bsc
134 |
135 |
136 |
137 |
138 | _DEBUG;%(PreprocessorDefinitions)
139 | true
140 | true
141 | X64
142 | .\Debug/NotMyfault.tlb
143 |
144 |
145 |
146 | Disabled
147 | WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)
148 | true
149 | EnableFastChecks
150 | MultiThreadedDebug
151 | .\Debug/NotMyfault.pch
152 | .\Debug/
153 | .\Debug/
154 | .\Debug/
155 | Level3
156 | true
157 | ProgramDatabase
158 |
159 |
160 | _DEBUG;%(PreprocessorDefinitions)
161 | 0x0409
162 |
163 |
164 | .\Debug/NotMyfault.exe
165 | true
166 | true
167 | .\Debug/NotMyfault.pdb
168 | Windows
169 | false
170 |
171 | MachineX64
172 |
173 |
174 | true
175 | .\Debug/NotMyfault.bsc
176 |
177 |
178 |
179 |
180 | NDEBUG;%(PreprocessorDefinitions)
181 | true
182 | true
183 | Win32
184 | .\Release/NotMyfault.tlb
185 |
186 |
187 |
188 | MaxSpeed
189 | OnlyExplicitInline
190 | WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)
191 | true
192 | MultiThreaded
193 | true
194 | .\Release/NotMyfault.pch
195 | .\Release/
196 | .\Release/
197 | .\Release/
198 | Level3
199 | true
200 |
201 |
202 | NDEBUG;%(PreprocessorDefinitions)
203 | 0x0409
204 |
205 |
206 | .\Release/NotMyfault.exe
207 | true
208 | RequireAdministrator
209 | .\Release/NotMyfault.pdb
210 | Windows
211 | false
212 |
213 | MachineX86
214 |
215 |
216 | true
217 | .\Release/NotMyfault.bsc
218 |
219 |
220 |
221 |
222 | NDEBUG;%(PreprocessorDefinitions)
223 | true
224 | true
225 | X64
226 | .\Release/NotMyfault.tlb
227 |
228 |
229 |
230 | MaxSpeed
231 | OnlyExplicitInline
232 | WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)
233 | true
234 | MultiThreaded
235 | true
236 | .\x64\Release/NotMyfault.pch
237 | .\x64\Release/
238 | .\x64\Release/
239 | .\x64\Release/
240 | Level3
241 | true
242 |
243 |
244 | NDEBUG;%(PreprocessorDefinitions)
245 | 0x0409
246 |
247 |
248 | .\x64\Release/NotMyfault.exe
249 | true
250 | RequireAdministrator
251 | .\x64\Release/NotMyfault.pdb
252 | Windows
253 | false
254 |
255 | MachineX64
256 |
257 |
258 | true
259 | .\Release/NotMyfault.bsc
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
--------------------------------------------------------------------------------
/NotMyFault/exe/notmyfault.c:
--------------------------------------------------------------------------------
1 | //======================================================================
2 | //
3 | // NotMyFault.c
4 | //
5 | // Copyright (C) 2002 Mark Russinovich
6 | // Sysinternals - www.sysinternals.com
7 | //
8 | // Simple interface to myfault device driver.
9 | //
10 | //======================================================================
11 | #include
12 | #include
13 | #include
14 | #include "resource.h"
15 | #include "ioctlcmd.h"
16 | #include "notmyfault.h"
17 |
18 | COLORREF BsodFg = RGB(0xFF, 0xFF, 0xFF);
19 | COLORREF BsodBg = RGB(0xFF, 0, 0);
20 |
21 | #pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
22 |
23 |
24 | //----------------------------------------------------------------------
25 | //
26 | // Abort
27 | //
28 | // Exit with a fatal error.
29 | //
30 | //----------------------------------------------------------------------
31 | LONG Abort(HWND hWnd, char* Msg, DWORD Error)
32 | {
33 | LPVOID lpMsgBuf;
34 | char errmsg[MAX_PATH * 2];
35 | DWORD error = GetLastError();
36 |
37 | FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
38 | NULL, Error,
39 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
40 | (LPTSTR)&lpMsgBuf, 0, NULL);
41 | UnloadDeviceDriver(SYS_NAME);
42 | sprintf(errmsg, "%s: %s", Msg, lpMsgBuf);
43 | if ((Error == ERROR_INVALID_HANDLE || Error == ERROR_ACCESS_DENIED ||
44 | Error == ERROR_FILE_NOT_FOUND))
45 | wsprintf(errmsg, "%s\nMake sure that you are an administrator and that NotMyFault is "
46 | "not already running.", errmsg);
47 | MessageBox(hWnd, errmsg, "NotMyFault", MB_OK | MB_ICONERROR);
48 | PostQuitMessage(1);
49 | LocalFree(lpMsgBuf);
50 | return (DWORD)-1;
51 | }
52 |
53 |
54 | //----------------------------------------------------------------------
55 | //
56 | // CenterWindow
57 | //
58 | // Centers the Window on the screen.
59 | //
60 | //----------------------------------------------------------------------
61 | VOID CenterWindow(HWND hDlg)
62 | {
63 | RECT aRt;
64 |
65 | // center the dialog box
66 | GetWindowRect(hDlg, &aRt);
67 | OffsetRect(&aRt, -aRt.left, -aRt.top);
68 | MoveWindow(hDlg,
69 | ((GetSystemMetrics(SM_CXSCREEN) -
70 | aRt.right) / 2 + 4) & ~7,
71 | (GetSystemMetrics(SM_CYSCREEN) -
72 | aRt.bottom) / 2,
73 | aRt.right, aRt.bottom, 0);
74 | }
75 |
76 | //----------------------------------------------------------------------
77 | //
78 | // BsodColorsCallback
79 | //
80 | //----------------------------------------------------------------------
81 | UINT_PTR CALLBACK BsodColorsCallback(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
82 | {
83 | static COLORREF newFg, newBg;
84 | static UINT wm_colorOkString, wm_setRgbString;
85 | HBRUSH hBack;
86 |
87 | switch (uiMsg)
88 | {
89 | case WM_INITDIALOG:
90 | newFg = BsodFg;
91 | newBg = BsodBg;
92 | wm_colorOkString = RegisterWindowMessage(COLOROKSTRING);
93 | wm_setRgbString = RegisterWindowMessage(SETRGBSTRING);
94 | CheckRadioButton(hDlg, IDC_RADIOFG, IDC_RADIOBG, IDC_RADIOFG);
95 | SendMessage(hDlg, wm_setRgbString, 0, newFg);
96 | SetFocus(GetDlgItem(hDlg, IDC_DONE));
97 | break;
98 |
99 | case WM_CTLCOLORSTATIC:
100 | if ((HWND)lParam == GetDlgItem(hDlg,IDC_PREVIEW))
101 | {
102 | SetBkColor((HDC)wParam, newBg);
103 | SetTextColor((HDC)wParam, newFg);
104 | hBack = CreateSolidBrush(newBg);
105 | return (BOOL)hBack;
106 | }
107 | break;
108 |
109 | case WM_COMMAND:
110 | if (wParam == IDC_DONE)
111 | {
112 | BsodFg = newFg;
113 | BsodBg = newBg;
114 | PostMessage(hDlg, WM_COMMAND, IDABORT, 1);
115 | return FALSE;
116 | }
117 | break;
118 |
119 | default:
120 | if (uiMsg == wm_colorOkString)
121 | {
122 | CHOOSECOLOR* choose = (CHOOSECOLOR*)lParam;
123 | if (IsDlgButtonChecked(hDlg, IDC_RADIOBG))
124 | {
125 | newBg = choose->rgbResult;
126 | InvalidateRect(GetDlgItem(hDlg,IDC_PREVIEW), NULL, TRUE);
127 | //SendMessage( hDlg, wm_setRgbString, 0, newFg );
128 | return TRUE;
129 | }
130 | else
131 | {
132 | newFg = choose->rgbResult;
133 | InvalidateRect(GetDlgItem(hDlg,IDC_PREVIEW), NULL, TRUE);
134 | //SendMessage( hDlg, wm_setRgbString, 0, newBg );
135 | return TRUE;
136 | }
137 | }
138 | break;
139 | }
140 | return 0;
141 | }
142 |
143 |
144 | //----------------------------------------------------------------------
145 | //
146 | // StartMyFaultDriver
147 | //
148 | // Loads and starts the driver.
149 | //
150 | //----------------------------------------------------------------------
151 | LONG StartMyFaultDriver(HWND hDlg)
152 | {
153 | char driverPath[MAX_PATH];
154 | char systemRoot[MAX_PATH];
155 | char path[MAX_PATH];
156 | WIN32_FIND_DATA findData;
157 | HANDLE findHandle;
158 | char* file;
159 | DWORD error;
160 | char msgbuf[MAX_PATH * 2];
161 |
162 | //
163 | // Load the myfault driver
164 | //
165 | GetCurrentDirectory(sizeof path, path);
166 | sprintf(path + lstrlen(path), "\\%s", SYS_FILE);
167 |
168 | findHandle = FindFirstFile(path, &findData);
169 | if (findHandle == INVALID_HANDLE_VALUE)
170 | {
171 | if (!SearchPath(NULL, SYS_FILE, NULL, sizeof(path), path, &file))
172 | {
173 | sprintf(msgbuf, "%s was not found.", SYS_FILE);
174 | return Abort(hDlg, msgbuf, GetLastError());
175 | }
176 | }
177 | else FindClose(findHandle);
178 |
179 | if (!GetEnvironmentVariable("SYSTEMROOT", systemRoot, sizeof(systemRoot)))
180 | {
181 | strcpy(msgbuf, "Could not resolve SYSTEMROOT environment variable");
182 | return Abort(hDlg, msgbuf, GetLastError());
183 | }
184 | sprintf(driverPath, "%s\\system32\\drivers\\myfault.sys", systemRoot);
185 | SetFileAttributes(driverPath, FILE_ATTRIBUTE_NORMAL);
186 | CopyFile(path, driverPath, FALSE);
187 | if (!LoadDeviceDriver(SYS_NAME, driverPath, &SysHandle, &error))
188 | {
189 | if (!CopyFile(path, driverPath, FALSE))
190 | {
191 | sprintf(msgbuf, "Unable to copy %s to %s\n\n"
192 | "Make sure that %s is in the current directory.",
193 | SYS_NAME, driverPath, SYS_FILE);
194 | return Abort(hDlg, msgbuf, GetLastError());
195 | }
196 | SetFileAttributes(driverPath, FILE_ATTRIBUTE_NORMAL);
197 | if (!LoadDeviceDriver(SYS_NAME, driverPath, &SysHandle, &error))
198 | {
199 | UnloadDeviceDriver(SYS_NAME);
200 | if (!LoadDeviceDriver(SYS_NAME, driverPath, &SysHandle, &error))
201 | {
202 | sprintf(msgbuf, "Error loading %s:", path);
203 | DeleteFile(driverPath);
204 | return Abort(hDlg, msgbuf, error);
205 | }
206 | }
207 | }
208 | return TRUE;
209 | }
210 |
211 | //----------------------------------------------------------------------
212 | //
213 | // IoctlThreadProc
214 | //
215 | //----------------------------------------------------------------------
216 | void IoctlThreadProc(PVOID Context)
217 | {
218 | DWORD nb;
219 | DeviceIoControl(SysHandle, (DWORD)Context, NULL, 0, NULL, 0, &nb, NULL);
220 | }
221 |
222 |
223 | //---------------------------------------------------------------------
224 | //
225 | // LeakPool
226 | //
227 | //---------------------------------------------------------------------
228 | void LeakPool(UINT PoolType, DWORD allocSize)
229 | {
230 | DWORD maxAlloc, bytesAllocated, nb;
231 | DWORD tickCount = GetTickCount();
232 |
233 | maxAlloc = allocSize;
234 | bytesAllocated = 0;
235 | while (bytesAllocated < maxAlloc && tickCount - GetTickCount() < 1000)
236 | {
237 | if (!DeviceIoControl(SysHandle,
238 | PoolType ? IOCTL_LEAK_NONPAGED : IOCTL_LEAK_PAGED, &allocSize, sizeof(allocSize),
239 | NULL, 0, &nb, NULL))
240 | {
241 | // can't even allocate 1 byte
242 | if (allocSize == 1) break;
243 |
244 | allocSize /= 2;
245 | if (allocSize == 0) allocSize = 1;
246 | }
247 | else
248 | {
249 | bytesAllocated += allocSize;
250 | }
251 | }
252 |
253 | // one more try going from 2 to 8192
254 | if (bytesAllocated < maxAlloc)
255 | {
256 | allocSize = 8192;
257 | while (allocSize > 1 && bytesAllocated < maxAlloc
258 | && tickCount - GetTickCount() < 1000)
259 | {
260 | while (DeviceIoControl(SysHandle,
261 | PoolType ? IOCTL_LEAK_NONPAGED : IOCTL_LEAK_PAGED, &allocSize, sizeof(allocSize),
262 | NULL, 0, &nb, NULL) && bytesAllocated < maxAlloc)
263 | {
264 | bytesAllocated += allocSize;
265 | }
266 | allocSize /= 2;
267 | }
268 | }
269 | }
270 |
271 |
272 | //----------------------------------------------------------------------
273 | //
274 | // MainDialog
275 | //
276 | // This is the main window.
277 | //
278 | //----------------------------------------------------------------------
279 | LRESULT APIENTRY MainDialog(HWND hDlg, UINT message, UINT wParam,
280 | LONG lParam)
281 | {
282 | char label[MAX_PATH];
283 | SYSTEM_INFO sysInfo;
284 | DWORD i, nb, ioctl;
285 | DWORD allocSize, maxAlloc;
286 | static BOOLEAN leakPaged = FALSE;
287 | static BOOLEAN leakNonpaged = FALSE;
288 | CHOOSECOLOR colorArgs;
289 | static DWORD rgbCurrent;
290 | static COLORREF acrCustClr[16];
291 |
292 | switch (message)
293 | {
294 | case WM_INITDIALOG:
295 |
296 | //
297 | // Start driver
298 | //
299 | if (!StartMyFaultDriver(hDlg))
300 | {
301 | return FALSE;
302 | }
303 |
304 | //
305 | // We can delete the driver and its Registry key now that its loaded
306 | //
307 | CheckDlgButton(hDlg, IDC_IRQL, BST_CHECKED);
308 | CenterWindow(hDlg);
309 | SetDlgItemText(hDlg, IDC_LEAKMB, "1000");
310 | break;
311 |
312 | case WM_TIMER:
313 |
314 | GetDlgItemText(hDlg, IDC_LEAKMB, label, _countof(label));
315 | allocSize = maxAlloc = (atoi(label) * 1024);
316 | LeakPool(wParam, allocSize);
317 | break;
318 |
319 | case WM_COMMAND:
320 | switch (LOWORD(wParam))
321 | {
322 | case IDOK:
323 |
324 | if (IsDlgButtonChecked(hDlg, IDC_BUFFEROVERFLOW) == BST_CHECKED)
325 | {
326 | ioctl = IOCTL_BUFFER_OVERFLOW;
327 | }
328 | else if (IsDlgButtonChecked(hDlg, IDC_WILDPOINTER) == BST_CHECKED)
329 | {
330 | ioctl = IOCTL_WILD_POINTER;
331 | }
332 | else if (IsDlgButtonChecked(hDlg, IDC_DEADLOCK) == BST_CHECKED)
333 | {
334 | ioctl = IOCTL_DEADLOCK;
335 | }
336 | else if (IsDlgButtonChecked(hDlg, IDC_HANG) == BST_CHECKED)
337 | {
338 | ioctl = IOCTL_HANG;
339 | }
340 | else if (IsDlgButtonChecked(hDlg, IDC_STACKTRASH) == BST_CHECKED)
341 | {
342 | ioctl = IOCTL_TRASH_STACK;
343 | }
344 | else if (IsDlgButtonChecked(hDlg, IDC_PAGEFAULT) == BST_CHECKED)
345 | {
346 | ioctl = IOCTL_PAGE_FAULT;
347 | }
348 | else if (IsDlgButtonChecked(hDlg, IDC_IRQL) == BST_CHECKED)
349 | {
350 | ioctl = IOCTL_IRQL;
351 | }
352 | else if (IsDlgButtonChecked(hDlg, IDC_HANGIRP) == BST_CHECKED)
353 | {
354 | _beginthread(IoctlThreadProc, 0, (PVOID)IOCTL_HANG_IRP);
355 | break;
356 | }
357 |
358 | //
359 | // Execute hang and deadlock on each CPU
360 | //
361 | if (ioctl == IOCTL_HANG || ioctl == IOCTL_DEADLOCK)
362 | {
363 | GetSystemInfo(&sysInfo);
364 | for (i = 0; i < sysInfo.dwNumberOfProcessors; i++)
365 | {
366 | DeviceIoControl(SysHandle, ioctl, NULL, 0, NULL, 0, &nb, NULL);
367 | }
368 | }
369 | else
370 | {
371 | DeviceIoControl(SysHandle, ioctl, NULL, 0, NULL, 0, &nb, NULL);
372 | }
373 | break;
374 |
375 | case IDC_LEAK_PAGE:
376 |
377 | if (leakPaged)
378 | {
379 | KillTimer(hDlg, 0);
380 | SetDlgItemText(hDlg, IDC_LEAK_PAGE, "Leak &Paged");
381 | }
382 | else
383 | {
384 | SetTimer(hDlg, 0, 1000, NULL);
385 | SetDlgItemText(hDlg, IDC_LEAK_PAGE, "Stop &Paged");
386 | }
387 | leakPaged = !leakPaged;
388 | break;
389 |
390 | case IDC_LEAK_NONPAGE:
391 |
392 | if (leakNonpaged)
393 | {
394 | KillTimer(hDlg, 1);
395 | SetDlgItemText(hDlg, IDC_LEAK_NONPAGE, "Leak &Nonpaged");
396 | }
397 | else
398 | {
399 | SetTimer(hDlg, 1, 1000, NULL);
400 | SetDlgItemText(hDlg, IDC_LEAK_NONPAGE, "Stop &Nonpaged");
401 | }
402 | leakNonpaged = !leakNonpaged;
403 | break;
404 |
405 | case IDCOLOR:
406 | {
407 | COLORREF CustomColors[16];
408 | int i;
409 | for (i = 0; i < 16; i++)
410 | {
411 | CustomColors[i] = RGB(255, 255, 255);
412 | }
413 | colorArgs.lStructSize = sizeof colorArgs;
414 | colorArgs.Flags = CC_RGBINIT | CC_ENABLEHOOK | CC_ENABLETEMPLATE | CC_FULLOPEN;
415 | colorArgs.hwndOwner = hDlg;
416 | colorArgs.hInstance = (HWND)GetModuleHandle(NULL);
417 | colorArgs.rgbResult = RGB(0, 0, 0);
418 | colorArgs.lpCustColors = CustomColors;
419 | colorArgs.lCustData = 0;
420 | colorArgs.rgbResult = BsodFg;
421 | colorArgs.lpTemplateName = "BSODCOLORS";
422 | colorArgs.lpfnHook = BsodColorsCallback;
423 | if (ChooseColor(&colorArgs) == TRUE)
424 | {
425 | LARGE_INTEGER Color;
426 | Color.LowPart = RGB(GetRValue(BsodBg)/4,
427 | GetGValue(BsodBg)/4,
428 | GetBValue(BsodBg)/4);
429 | Color.HighPart = RGB(GetRValue(BsodFg)/4,
430 | GetGValue(BsodFg)/4,
431 | GetBValue(BsodFg)/4);
432 | DeviceIoControl(SysHandle, IOCTL_BSOD_COLOR, &Color, sizeof(LARGE_INTEGER), NULL, 0, &nb, NULL);
433 | }
434 | }
435 | break;
436 |
437 | case IDCANCEL:
438 |
439 | //
440 | // Cancel
441 | //
442 | EndDialog(hDlg, 0);
443 | PostQuitMessage(0);
444 | break ;
445 | }
446 | break;
447 |
448 | case WM_CLOSE:
449 | EndDialog(hDlg, 0);
450 | PostQuitMessage(0);
451 | break;
452 | }
453 | return DefWindowProc(hDlg, message, wParam, lParam);
454 | }
455 |
456 |
457 | //----------------------------------------------------------------------
458 | //
459 | // WinMain
460 | //
461 | // Initialize a dialog window class and pop the autologon dialog.
462 | //
463 | //----------------------------------------------------------------------
464 | int WINAPI WinMain(HINSTANCE hInstance,
465 | HINSTANCE hPrevInstance,
466 | LPSTR lpCmdLine,
467 | int nCmdShow)
468 | {
469 | static TCHAR szAppName[] = TEXT("NOTMYFAULT");
470 | MSG msg;
471 | HWND hMainDlg;
472 | WNDCLASSEX wndclass;
473 | PWSTR* cmdLine;
474 | int numArgs, i;
475 | DWORD nb;
476 |
477 | cmdLine = CommandLineToArgvW(GetCommandLineW(), &numArgs);
478 | for (i = 0; i < numArgs; i++)
479 | {
480 | if (cmdLine[i][0] == '/' ||
481 | cmdLine[i][0] == '-')
482 | {
483 | if (!_wcsicmp(&cmdLine[i][1], L"crash"))
484 | {
485 | if (StartMyFaultDriver(NULL))
486 | {
487 | DeviceIoControl(SysHandle, IOCTL_IRQL, NULL, 0, NULL, 0, &nb, NULL);
488 | }
489 | }
490 | else
491 | {
492 | MessageBox(NULL, "Usage: notmyfault [/crash]\n"
493 | "/crash Crashes the system.", "NotMyFault", MB_ICONERROR);
494 | return -1;
495 | }
496 | }
497 | }
498 |
499 | //
500 | // Create the main window class
501 | //
502 | wndclass.cbSize = sizeof(WNDCLASSEX);
503 | wndclass.style = CS_HREDRAW | CS_VREDRAW;
504 | wndclass.lpfnWndProc = (WNDPROC)MainDialog;
505 | wndclass.cbClsExtra = 0;
506 | wndclass.cbWndExtra = DLGWINDOWEXTRA;
507 | wndclass.hInstance = hInstance;
508 | wndclass.hIcon = LoadIcon(hInstance, "APPICON");
509 | wndclass.hIconSm = LoadIcon(hInstance, "APPICON");
510 | wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
511 | wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
512 | wndclass.lpszMenuName = NULL;
513 | wndclass.lpszClassName = szAppName;
514 | RegisterClassEx(&wndclass);
515 |
516 | //
517 | // Create the dialog
518 | //
519 | hMainDlg = CreateDialog(hInstance, "NOTMYFAULT", NULL, (DLGPROC)MainDialog);
520 | ShowWindow(hMainDlg, nCmdShow);
521 |
522 | while (GetMessage(&msg, NULL, 0, 0))
523 | {
524 | if (!IsDialogMessage(hMainDlg, &msg))
525 | {
526 | TranslateMessage(&msg);
527 | DispatchMessage(&msg);
528 | }
529 | }
530 | return (int)msg.wParam;
531 | }
532 |
--------------------------------------------------------------------------------
/NotMyFault/sys/myfault.c:
--------------------------------------------------------------------------------
1 | //----------------------------------------------------------------------
2 | //
3 | // Myfault
4 | //
5 | // Copyright (C) 2002 Mark Russinovich
6 | // Sysinternals - www.sysinternals.com
7 | //
8 | // Crash demonstration driver.
9 | //
10 | // * buffer overflow
11 | // * wild pointer
12 | // * paged pool at high irql
13 | // * deadlock
14 | // * trash stack
15 | // * set callback and then unload
16 | //
17 | //----------------------------------------------------------------------
18 | #include "ntddk.h"
19 | #include "..\exe\ioctlcmd.h"
20 |
21 |
22 | //----------------------------------------------------------------------
23 | //
24 | // DeadLock
25 | //
26 | // Try to grab a fast mutext when we already own it so that there's a
27 | // deadlock. This can be debugged with CrashOnCtrlScroll and then
28 | // using the ~ debugger command to look at the thread stack on each CPU.
29 | // The XP Verifier's deadlock detection catches this.
30 | //
31 | //----------------------------------------------------------------------
32 | FAST_MUTEX Fmutex;
33 |
34 | VOID
35 | DeadLock(
36 | VOID
37 | )
38 | {
39 | KIRQL prevIrql1, prevIrql2;
40 |
41 | ExInitializeFastMutex( &Fmutex );
42 | ExAcquireFastMutex( &Fmutex );
43 | ExAcquireFastMutex( &Fmutex );
44 | }
45 |
46 |
47 | //----------------------------------------------------------------------
48 | //
49 | // Hang
50 | //
51 | // This causes the execution of a DPC that stalls the system
52 | // by executing in an infinite loop at raised IRQL.
53 | //
54 | //----------------------------------------------------------------------
55 | KDPC HangDpc;
56 |
57 | VOID
58 | HangDpcRoutine(
59 | PKDPC Dpc,
60 | PVOID Context,
61 | PVOID SystemArgument1,
62 | PVOID SystemArgument2
63 | )
64 | {
65 | while( 1 );
66 | }
67 |
68 | VOID
69 | Hang(
70 | VOID
71 | )
72 | {
73 | CCHAR i;
74 |
75 | #if AMD64
76 | for( i = 0; i < KeNumberProcessors; i++ ) {
77 | #else
78 | for( i = 0; i < *KeNumberProcessors; i++ ) {
79 | #endif
80 |
81 |
82 | KeInitializeDpc( &HangDpc,
83 | HangDpcRoutine,
84 | NULL );
85 | KeSetTargetProcessorDpc(&HangDpc, i );
86 | KeInsertQueueDpc( &HangDpc,
87 | NULL, NULL );
88 | }
89 | }
90 |
91 | //----------------------------------------------------------------------
92 | //
93 | // HangIrp
94 | //
95 | // Never completes the IRP, resulting in an unkillable process.
96 | //
97 | //----------------------------------------------------------------------
98 | VOID
99 | HangIrp(
100 | VOID
101 | )
102 | {
103 | //
104 | // This can't be on the stack because the stack is pageable
105 | // when the thread performs a user-mode wait
106 | //
107 | static KEVENT event;
108 |
109 | KeInitializeEvent( &event, SynchronizationEvent, FALSE );
110 | KeWaitForSingleObject( &event, UserRequest, UserMode, FALSE, NULL );
111 | }
112 |
113 |
114 | //----------------------------------------------------------------------
115 | //
116 | // PageFault
117 | //
118 | // Fault at high IRQL in user-mode. This is virtually impossible to
119 | // debug, but Verifier with IRQL checking on XP catches it.
120 | //
121 | //----------------------------------------------------------------------
122 | VOID
123 | PageFault(
124 | VOID
125 | )
126 | {
127 | KIRQL prevIrql;
128 |
129 | KeRaiseIrql( DISPATCH_LEVEL, &prevIrql );
130 | }
131 |
132 |
133 | //----------------------------------------------------------------------
134 | //
135 | // IrqlFault
136 | //
137 | // Fault at high IRQL. !analyze easily figures this one out.
138 | //
139 | //----------------------------------------------------------------------
140 | VOID
141 | IrqlFault(
142 | VOID
143 | )
144 | {
145 | KIRQL prevIrql;
146 | PCHAR memoryPtr;
147 | int i = 0;
148 | volatile int data;
149 |
150 | //
151 | // Allocation size. Thist *must* be less than a page size minus a little
152 | // (for verifier header info) for the Verifier to allocate it from
153 | // special pool.
154 | //
155 | #define ALLOCATION_SIZE 2048
156 |
157 |
158 | //
159 | // Allocate and then free memory
160 | //
161 | memoryPtr = ExAllocatePool( PagedPool, ALLOCATION_SIZE );
162 | ExFreePool( memoryPtr );
163 |
164 | //
165 | // Dereference the freed area at high IRQL and keep going
166 | // on through pool touching at high IRQL.
167 | //
168 | KeRaiseIrql( DISPATCH_LEVEL, &prevIrql );
169 | while( 1 ) {
170 |
171 | data = *((PULONG) (memoryPtr+i));
172 | i += 4096;
173 | }
174 | KeLowerIrql( prevIrql );
175 | }
176 |
177 |
178 |
179 | //----------------------------------------------------------------------
180 | //
181 | // TrashStack
182 | //
183 | // Just blast through the stack. The pending IRP on the current
184 | // thread in the crash dump hints that this driver might be the cause,
185 | // but otherwise there's no way to verify it.
186 | //
187 | //----------------------------------------------------------------------
188 | VOID
189 | TrashStack(
190 | VOID
191 | )
192 | {
193 | volatile CHAR buffer[256];
194 | static int i;
195 |
196 | for( i = 0; i < sizeof(buffer)+32; i++ ) {
197 |
198 | buffer[i] = 0x0;
199 | }
200 | }
201 |
202 |
203 |
204 | //----------------------------------------------------------------------
205 | //
206 | // WildPointer
207 | //
208 | // Overwrite some code. This is very hard to catch without verifier
209 | // because the driver is not active when a crash occurs of
210 | // write-protection is off ( >= 128MB on Win2K, >= 256MB on XP).
211 | // Force write protection on by setting
212 | // HKLM\System\CurrentControlSet\Session Manager\Memory Management\
213 | // LargePageMinimum to 0xFFFFFFFF.
214 | //
215 | //----------------------------------------------------------------------
216 | NTSYSAPI
217 | NTSTATUS
218 | NTAPI
219 | NtReadFile(
220 | IN HANDLE FileHandle,
221 | IN HANDLE Event OPTIONAL,
222 | IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
223 | IN PVOID ApcContext OPTIONAL,
224 | OUT PIO_STATUS_BLOCK IoStatusBlock,
225 | OUT PVOID Buffer,
226 | IN ULONG Length,
227 | IN PLARGE_INTEGER ByteOffset OPTIONAL,
228 | IN PULONG Key OPTIONAL
229 | );
230 |
231 | VOID
232 | WildPointer(
233 | VOID
234 | )
235 | {
236 | *(PCHAR) IoGetCurrentProcess = 0x24;
237 | }
238 |
239 |
240 | //----------------------------------------------------------------------
241 | //
242 | // BufferOverflow
243 | //
244 | // Write past the end of the buffer. Verifier will catch it, but
245 | // without it the crash is impossible to diagnose.
246 | //
247 | //----------------------------------------------------------------------
248 | VOID
249 | BufferOverflow(
250 | VOID
251 | )
252 | {
253 | PCHAR buffer;
254 | int i;
255 | CHAR overflow[] = "OVERFLOW";
256 |
257 | //
258 | // Allocate a buffer and zip past the end of it
259 | //
260 | buffer = ExAllocatePool( NonPagedPool, ALLOCATION_SIZE );
261 | for( i = 0; i < ALLOCATION_SIZE+40; i ++ ) {
262 |
263 | strcpy( &buffer[i], overflow );
264 | }
265 |
266 | //
267 | // Leak the memory so that if we have to try again we
268 | // get a fresh block of memory to overrun
269 | //
270 | // ExFreePool( buffer );
271 | }
272 |
273 |
274 |
275 |
276 | //----------------------------------------------------------------------
277 | //
278 | // PoolLeak
279 | //
280 | // Leak some pool.
281 | //
282 | //----------------------------------------------------------------------
283 |
284 | ULONG_PTR *PagedLeakedPoolHead = NULL;
285 | ULONG_PTR *NonPagedLeakedPoolHead = NULL;
286 |
287 | PVOID
288 | PoolLeak(
289 | POOL_TYPE PoolType,
290 | ULONG LeakSize
291 | )
292 | {
293 | ULONG_PTR *buffer;
294 | ULONG_PTR *next;
295 |
296 | if( LeakSize < sizeof(ULONG_PTR) ) LeakSize = sizeof(ULONG_PTR);
297 |
298 | buffer = (ULONG_PTR *) ExAllocatePoolWithTag( PoolType, LeakSize, 'kaeL' );
299 | if( buffer ) {
300 |
301 | if( PoolType == PagedPool ) {
302 |
303 | next = PagedLeakedPoolHead;
304 | *buffer = (ULONG_PTR) next;
305 | PagedLeakedPoolHead = buffer;
306 |
307 | } else {
308 |
309 | next = NonPagedLeakedPoolHead;
310 | *buffer = (ULONG_PTR) next;
311 | NonPagedLeakedPoolHead = buffer;
312 | }
313 | }
314 | return buffer;
315 | }
316 |
317 | void
318 | FreePoolLeak( void )
319 | {
320 | ULONG_PTR next;
321 |
322 | while( NonPagedLeakedPoolHead ) {
323 |
324 | next = *NonPagedLeakedPoolHead;
325 | ExFreePool( NonPagedLeakedPoolHead );
326 | NonPagedLeakedPoolHead = (ULONG_PTR *) next;
327 | }
328 | while( PagedLeakedPoolHead ) {
329 |
330 | next = (ULONG_PTR) *PagedLeakedPoolHead;
331 | ExFreePool( PagedLeakedPoolHead );
332 | PagedLeakedPoolHead = (ULONG_PTR *) next;
333 | }
334 | }
335 |
336 |
337 | //----------------------------------------------------------------------
338 | //
339 | // MyfaultDeviceControl
340 | //
341 | //----------------------------------------------------------------------
342 | NTSTATUS
343 | MyfaultDeviceControl(
344 | IN PFILE_OBJECT FileObject,
345 | IN BOOLEAN Wait,
346 | IN PVOID InputBuffer,
347 | IN ULONG InputBufferLength,
348 | OUT PVOID OutputBuffer,
349 | IN ULONG OutputBufferLength,
350 | IN ULONG IoControlCode,
351 | OUT PIO_STATUS_BLOCK IoStatus,
352 | IN PDEVICE_OBJECT DeviceObject
353 | )
354 | {
355 | IoStatus->Status = STATUS_SUCCESS;
356 | IoStatus->Information = 0;
357 | switch ( IoControlCode ) {
358 |
359 | case IOCTL_BUFFER_OVERFLOW:
360 |
361 | BufferOverflow();
362 | break;
363 |
364 | case IOCTL_WILD_POINTER:
365 |
366 | WildPointer();
367 | break;
368 |
369 | case IOCTL_PAGE_FAULT:
370 |
371 | PageFault();
372 | break;
373 |
374 | case IOCTL_DEADLOCK:
375 |
376 | DeadLock();
377 | break;
378 |
379 | case IOCTL_HANG:
380 |
381 | Hang();
382 | break;
383 |
384 | case IOCTL_TRASH_STACK:
385 |
386 | TrashStack();
387 | break;
388 |
389 | case IOCTL_IRQL:
390 |
391 | IrqlFault();
392 | break;
393 |
394 | case IOCTL_LEAK_PAGED:
395 |
396 | if( InputBufferLength != sizeof(ULONG)) {
397 |
398 | IoStatus->Status = STATUS_INVALID_PARAMETER;
399 | break;
400 | }
401 | if( !PoolLeak( PagedPool, *(PULONG) InputBuffer )) {
402 |
403 | IoStatus->Status = STATUS_INSUFFICIENT_RESOURCES;
404 | }
405 | break;
406 |
407 | case IOCTL_LEAK_NONPAGED:
408 |
409 | if( InputBufferLength != sizeof(ULONG)) {
410 |
411 | IoStatus->Status = STATUS_INVALID_PARAMETER;
412 | break;
413 | }
414 | if( !PoolLeak( NonPagedPool, *(PULONG) InputBuffer )) {
415 |
416 | IoStatus->Status = STATUS_INSUFFICIENT_RESOURCES;
417 | }
418 | break;
419 |
420 | default:
421 |
422 | IoStatus->Status = STATUS_NOT_SUPPORTED;
423 | break;
424 | }
425 | return IoStatus->Status;
426 | }
427 |
428 |
429 | //----------------------------------------------------------------------
430 | //
431 | // MyfaultDispatch
432 | //
433 | // In this routine we Myfault requests to our own device. The only
434 | // requests we care about handling explicitely are IOCTL commands that
435 | // we will get from the GUI. We also expect to get Create and Close
436 | // commands when the GUI opens and closes communications with us.
437 | //
438 | //----------------------------------------------------------------------
439 | NTSTATUS
440 | MyfaultDispatch(
441 | IN PDEVICE_OBJECT DeviceObject,
442 | IN PIRP Irp
443 | )
444 | {
445 | PIO_STACK_LOCATION iosp;
446 | PVOID inputBuffer;
447 | PVOID outputBuffer;
448 | ULONG inputBufferLength;
449 | ULONG outputBufferLength;
450 | ULONG ioControlCode;
451 | NTSTATUS status;
452 |
453 | //
454 | // Switch on the request type
455 | //
456 | iosp = IoGetCurrentIrpStackLocation (Irp);
457 | switch (iosp->MajorFunction) {
458 |
459 | case IRP_MJ_CREATE:
460 | status = STATUS_SUCCESS;
461 | break;
462 |
463 | case IRP_MJ_CLOSE:
464 | status = STATUS_SUCCESS;
465 | FreePoolLeak();
466 | break;
467 |
468 | case IRP_MJ_DEVICE_CONTROL:
469 |
470 | inputBuffer = Irp->AssociatedIrp.SystemBuffer;
471 | inputBufferLength = iosp->Parameters.DeviceIoControl.InputBufferLength;
472 | outputBuffer = Irp->AssociatedIrp.SystemBuffer;
473 | outputBufferLength = iosp->Parameters.DeviceIoControl.OutputBufferLength;
474 | ioControlCode = iosp->Parameters.DeviceIoControl.IoControlCode;
475 |
476 | //
477 | // Special case: handle the IRP hang so as not to complete the IRP
478 | //
479 | if( ioControlCode == IOCTL_HANG_IRP ) {
480 |
481 | HangIrp();
482 | return STATUS_PENDING;
483 |
484 | } else {
485 |
486 | status = MyfaultDeviceControl( iosp->FileObject, TRUE,
487 | inputBuffer, inputBufferLength,
488 | outputBuffer, outputBufferLength,
489 | ioControlCode, &Irp->IoStatus,
490 | DeviceObject );
491 | }
492 | break;
493 |
494 | default:
495 |
496 | status = STATUS_INVALID_DEVICE_REQUEST;
497 | break;
498 | }
499 |
500 | //
501 | // Complete the request
502 | //
503 | Irp->IoStatus.Status = status;
504 | IoCompleteRequest( Irp, IO_NO_INCREMENT );
505 | return status;
506 | }
507 |
508 |
509 | //----------------------------------------------------------------------
510 | //
511 | // MyfaultUnload
512 | //
513 | // Our job is done - time to leave.
514 | //
515 | //----------------------------------------------------------------------
516 | VOID
517 | MyfaultUnload(
518 | IN PDRIVER_OBJECT DriverObject
519 | )
520 | {
521 | WCHAR deviceLinkBuffer[] = L"\\DosDevices\\MyFault";
522 | UNICODE_STRING deviceLinkUnicodeString;
523 |
524 | //
525 | // Delete the symbolic link for our device
526 | //
527 | RtlInitUnicodeString( &deviceLinkUnicodeString, deviceLinkBuffer );
528 | IoDeleteSymbolicLink( &deviceLinkUnicodeString );
529 |
530 | //
531 | // Delete the device object
532 | //
533 | IoDeleteDevice( DriverObject->DeviceObject );
534 | }
535 |
536 |
537 |
538 | //----------------------------------------------------------------------
539 | //
540 | // Tiner crash
541 | //
542 | // This causes a crash during the boot process, after smss.exe
543 | // has saved a boot log.
544 | //
545 | //----------------------------------------------------------------------
546 | KDPC TimerDpc;
547 | KTIMER CrashTimer;
548 | VOID
549 | TimerDpcRoutine(
550 | PKDPC Dpc,
551 | PVOID Context,
552 | PVOID SystemArgument1,
553 | PVOID SystemArgument2
554 | )
555 | {
556 | IrqlFault();
557 | }
558 |
559 |
560 | //----------------------------------------------------------------------
561 | //
562 | // DriverEntry
563 | //
564 | // Installable driver initialization. Here we just set ourselves up.
565 | //
566 | //----------------------------------------------------------------------
567 | NTSTATUS
568 | DriverEntry(
569 | IN PDRIVER_OBJECT DriverObject,
570 | IN PUNICODE_STRING RegistryPath
571 | )
572 | {
573 | NTSTATUS status;
574 | WCHAR deviceNameBuffer[] = L"\\Device\\Myfault";
575 | UNICODE_STRING deviceNameUnicodeString;
576 | WCHAR deviceLinkBuffer[] = L"\\DosDevices\\Myfault";
577 | UNICODE_STRING deviceLinkUnicodeString;
578 | PDEVICE_OBJECT interfaceDevice = NULL;
579 | ULONG startType, demandStart;
580 | RTL_QUERY_REGISTRY_TABLE paramTable[2];
581 | UNICODE_STRING registryPath;
582 | LARGE_INTEGER crashTime;
583 |
584 | //
585 | // Create a named device object
586 | //
587 | RtlInitUnicodeString (&deviceNameUnicodeString,
588 | deviceNameBuffer );
589 | status = IoCreateDevice ( DriverObject,
590 | 0,
591 | &deviceNameUnicodeString,
592 | FILE_DEVICE_MYFAULT,
593 | 0,
594 | TRUE,
595 | &interfaceDevice );
596 | if (NT_SUCCESS(status)) {
597 |
598 | //
599 | // Create a symbolic link that the GUI can specify to gain access
600 | // to this driver/device
601 | //
602 | RtlInitUnicodeString (&deviceLinkUnicodeString,
603 | deviceLinkBuffer );
604 | status = IoCreateSymbolicLink (&deviceLinkUnicodeString,
605 | &deviceNameUnicodeString );
606 |
607 | //
608 | // Create dispatch points for all routines that must be Myfaultd
609 | //
610 | DriverObject->MajorFunction[IRP_MJ_CREATE] =
611 | DriverObject->MajorFunction[IRP_MJ_CLOSE] =
612 | DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = MyfaultDispatch;
613 | DriverObject->DriverUnload = MyfaultUnload;
614 | }
615 |
616 | if (!NT_SUCCESS(status)) {
617 |
618 | //
619 | // Something went wrong, so clean up
620 | //
621 | if( interfaceDevice ) {
622 |
623 | IoDeleteDevice( interfaceDevice );
624 | }
625 | }
626 |
627 | //
628 | // Query our start type to see if we are supposed to monitor starting
629 | // at boot time
630 | //
631 | registryPath.Buffer = ExAllocatePool( PagedPool,
632 | RegistryPath->Length + sizeof(UNICODE_NULL));
633 | if(!registryPath.Buffer) {
634 |
635 | return STATUS_INSUFFICIENT_RESOURCES;
636 | }
637 |
638 | registryPath.Length = RegistryPath->Length + sizeof(UNICODE_NULL);
639 | registryPath.MaximumLength = registryPath.Length;
640 |
641 | RtlZeroMemory( registryPath.Buffer, registryPath.Length );
642 | RtlMoveMemory( registryPath.Buffer, RegistryPath->Buffer,
643 | RegistryPath->Length );
644 |
645 | demandStart = SERVICE_DEMAND_START;
646 | startType = demandStart;
647 | RtlZeroMemory( ¶mTable[0], sizeof(paramTable));
648 | paramTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
649 | paramTable[0].Name = L"Start";
650 | paramTable[0].EntryContext = &startType;
651 | paramTable[0].DefaultType = REG_DWORD;
652 | paramTable[0].DefaultData = &demandStart;
653 | paramTable[0].DefaultLength = sizeof(ULONG);
654 |
655 | RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE,
656 | registryPath.Buffer, ¶mTable[0],
657 | NULL, NULL );
658 |
659 | if( startType != SERVICE_DEMAND_START ) {
660 |
661 | //
662 | // Crash here during the boot process
663 | //
664 | KeInitializeDpc( &TimerDpc,
665 | TimerDpcRoutine,
666 | NULL );
667 |
668 | KeInitializeTimer( &CrashTimer );
669 |
670 | //
671 | // Give SMSS 5 seconds to start
672 | //
673 | crashTime.QuadPart = 5 * -10000000;
674 | KeSetTimer( &CrashTimer,
675 | crashTime,
676 | &TimerDpc );
677 | }
678 | return status;
679 | }
680 |
681 |
682 |
683 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
2 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
3 |
4 | # User-specific stuff
5 | .idea/**/workspace.xml
6 | .idea/**/tasks.xml
7 | .idea/**/usage.statistics.xml
8 | .idea/**/dictionaries
9 | .idea/**/shelf
10 |
11 | # AWS User-specific
12 | .idea/**/aws.xml
13 |
14 | # Generated files
15 | .idea/**/contentModel.xml
16 |
17 | # Sensitive or high-churn files
18 | .idea/**/dataSources/
19 | .idea/**/dataSources.ids
20 | .idea/**/dataSources.local.xml
21 | .idea/**/sqlDataSources.xml
22 | .idea/**/dynamic.xml
23 | .idea/**/uiDesigner.xml
24 | .idea/**/dbnavigator.xml
25 |
26 | # Gradle
27 | .idea/**/gradle.xml
28 | .idea/**/libraries
29 |
30 | # Gradle and Maven with auto-import
31 | # When using Gradle or Maven with auto-import, you should exclude module files,
32 | # since they will be recreated, and may cause churn. Uncomment if using
33 | # auto-import.
34 | # .idea/artifacts
35 | # .idea/compiler.xml
36 | # .idea/jarRepositories.xml
37 | # .idea/modules.xml
38 | # .idea/*.iml
39 | # .idea/modules
40 | # *.iml
41 | # *.ipr
42 |
43 | # CMake
44 | cmake-build-*/
45 |
46 | # Mongo Explorer plugin
47 | .idea/**/mongoSettings.xml
48 |
49 | # File-based project format
50 | *.iws
51 |
52 | # IntelliJ
53 | out/
54 |
55 | # mpeltonen/sbt-idea plugin
56 | .idea_modules/
57 |
58 | # JIRA plugin
59 | atlassian-ide-plugin.xml
60 |
61 | # Cursive Clojure plugin
62 | .idea/replstate.xml
63 |
64 | # SonarLint plugin
65 | .idea/sonarlint/
66 |
67 | # Crashlytics plugin (for Android Studio and IntelliJ)
68 | com_crashlytics_export_strings.xml
69 | crashlytics.properties
70 | crashlytics-build.properties
71 | fabric.properties
72 |
73 | # Editor-based Rest Client
74 | .idea/httpRequests
75 |
76 | # Android studio 3.1+ serialized cache file
77 | .idea/caches/build_file_checksums.ser
78 |
79 | ## Ignore Visual Studio temporary files, build results, and
80 | ## files generated by popular Visual Studio add-ons.
81 | ##
82 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
83 |
84 | # User-specific files
85 | *.rsuser
86 | *.suo
87 | *.user
88 | *.userosscache
89 | *.sln.docstates
90 |
91 | # User-specific files (MonoDevelop/Xamarin Studio)
92 | *.userprefs
93 |
94 | # Mono auto generated files
95 | mono_crash.*
96 |
97 | # Build results
98 | [Dd]ebug/
99 | [Dd]ebugPublic/
100 | [Rr]elease/
101 | [Rr]eleases/
102 | x64/
103 | x86/
104 | [Ww][Ii][Nn]32/
105 | [Aa][Rr][Mm]/
106 | [Aa][Rr][Mm]64/
107 | bld/
108 | [Bb]in/
109 | [Oo]bj/
110 | [Ll]og/
111 | [Ll]ogs/
112 |
113 | # Visual Studio 2015/2017 cache/options directory
114 | .vs/
115 | # Uncomment if you have tasks that create the project's static files in wwwroot
116 | #wwwroot/
117 |
118 | # Visual Studio 2017 auto generated files
119 | Generated\ Files/
120 |
121 | # MSTest test Results
122 | [Tt]est[Rr]esult*/
123 | [Bb]uild[Ll]og.*
124 |
125 | # NUnit
126 | *.VisualState.xml
127 | TestResult.xml
128 | nunit-*.xml
129 |
130 | # Build Results of an ATL Project
131 | [Dd]ebugPS/
132 | [Rr]eleasePS/
133 | dlldata.c
134 |
135 | # Benchmark Results
136 | BenchmarkDotNet.Artifacts/
137 |
138 | # .NET Core
139 | project.lock.json
140 | project.fragment.lock.json
141 | artifacts/
142 |
143 | # ASP.NET Scaffolding
144 | ScaffoldingReadMe.txt
145 |
146 | # StyleCop
147 | StyleCopReport.xml
148 |
149 | # Files built by Visual Studio
150 | *_i.c
151 | *_p.c
152 | *_h.h
153 | *.ilk
154 | *.meta
155 | *.obj
156 | *.iobj
157 | *.pch
158 | *.pdb
159 | *.ipdb
160 | *.pgc
161 | *.pgd
162 | *.rsp
163 | *.sbr
164 | *.tlb
165 | *.tli
166 | *.tlh
167 | *.tmp
168 | *.tmp_proj
169 | *_wpftmp.csproj
170 | *.log
171 | *.tlog
172 | *.vspscc
173 | *.vssscc
174 | .builds
175 | *.pidb
176 | *.svclog
177 | *.scc
178 |
179 | # Chutzpah Test files
180 | _Chutzpah*
181 |
182 | # Visual C++ cache files
183 | ipch/
184 | *.aps
185 | *.ncb
186 | *.opendb
187 | *.opensdf
188 | *.sdf
189 | *.cachefile
190 | *.VC.db
191 | *.VC.VC.opendb
192 |
193 | # Visual Studio profiler
194 | *.psess
195 | *.vsp
196 | *.vspx
197 | *.sap
198 |
199 | # Visual Studio Trace Files
200 | *.e2e
201 |
202 | # TFS 2012 Local Workspace
203 | $tf/
204 |
205 | # Guidance Automation Toolkit
206 | *.gpState
207 |
208 | # ReSharper is a .NET coding add-in
209 | _ReSharper*/
210 | *.[Rr]e[Ss]harper
211 | *.DotSettings.user
212 |
213 | # TeamCity is a build add-in
214 | _TeamCity*
215 |
216 | # DotCover is a Code Coverage Tool
217 | *.dotCover
218 |
219 | # AxoCover is a Code Coverage Tool
220 | .axoCover/*
221 | !.axoCover/settings.json
222 |
223 | # Coverlet is a free, cross platform Code Coverage Tool
224 | coverage*.json
225 | coverage*.xml
226 | coverage*.info
227 |
228 | # Visual Studio code coverage results
229 | *.coverage
230 | *.coveragexml
231 |
232 | # NCrunch
233 | _NCrunch_*
234 | .*crunch*.local.xml
235 | nCrunchTemp_*
236 |
237 | # MightyMoose
238 | *.mm.*
239 | AutoTest.Net/
240 |
241 | # Web workbench (sass)
242 | .sass-cache/
243 |
244 | # Installshield output folder
245 | [Ee]xpress/
246 |
247 | # DocProject is a documentation generator add-in
248 | DocProject/buildhelp/
249 | DocProject/Help/*.HxT
250 | DocProject/Help/*.HxC
251 | DocProject/Help/*.hhc
252 | DocProject/Help/*.hhk
253 | DocProject/Help/*.hhp
254 | DocProject/Help/Html2
255 | DocProject/Help/html
256 |
257 | # Click-Once directory
258 | publish/
259 |
260 | # Publish Web Output
261 | *.[Pp]ublish.xml
262 | *.azurePubxml
263 | # Note: Comment the next line if you want to checkin your web deploy settings,
264 | # but database connection strings (with potential passwords) will be unencrypted
265 | *.pubxml
266 | *.publishproj
267 |
268 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
269 | # checkin your Azure Web App publish settings, but sensitive information contained
270 | # in these scripts will be unencrypted
271 | PublishScripts/
272 |
273 | # NuGet Packages
274 | *.nupkg
275 | # NuGet Symbol Packages
276 | *.snupkg
277 | # The packages folder can be ignored because of Package Restore
278 | **/[Pp]ackages/*
279 | # except build/, which is used as an MSBuild target.
280 | !**/[Pp]ackages/build/
281 | # Uncomment if necessary however generally it will be regenerated when needed
282 | #!**/[Pp]ackages/repositories.config
283 | # NuGet v3's project.json files produces more ignorable files
284 | *.nuget.props
285 | *.nuget.targets
286 |
287 | # Microsoft Azure Build Output
288 | csx/
289 | *.build.csdef
290 |
291 | # Microsoft Azure Emulator
292 | ecf/
293 | rcf/
294 |
295 | # Windows Store app package directories and files
296 | AppPackages/
297 | BundleArtifacts/
298 | Package.StoreAssociation.xml
299 | _pkginfo.txt
300 | *.appx
301 | *.appxbundle
302 | *.appxupload
303 |
304 | # Visual Studio cache files
305 | # files ending in .cache can be ignored
306 | *.[Cc]ache
307 | # but keep track of directories ending in .cache
308 | !?*.[Cc]ache/
309 |
310 | # Others
311 | ClientBin/
312 | ~$*
313 | *~
314 | *.dbmdl
315 | *.dbproj.schemaview
316 | *.jfm
317 | *.pfx
318 | *.publishsettings
319 | orleans.codegen.cs
320 |
321 | # Including strong name files can present a security risk
322 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
323 | #*.snk
324 |
325 | # Since there are multiple workflows, uncomment next line to ignore bower_components
326 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
327 | #bower_components/
328 |
329 | # RIA/Silverlight projects
330 | Generated_Code/
331 |
332 | # Backup & report files from converting an old project file
333 | # to a newer Visual Studio version. Backup files are not needed,
334 | # because we have git ;-)
335 | _UpgradeReport_Files/
336 | Backup*/
337 | UpgradeLog*.XML
338 | UpgradeLog*.htm
339 | ServiceFabricBackup/
340 | *.rptproj.bak
341 |
342 | # SQL Server files
343 | *.mdf
344 | *.ldf
345 | *.ndf
346 |
347 | # Business Intelligence projects
348 | *.rdl.data
349 | *.bim.layout
350 | *.bim_*.settings
351 | *.rptproj.rsuser
352 | *- [Bb]ackup.rdl
353 | *- [Bb]ackup ([0-9]).rdl
354 | *- [Bb]ackup ([0-9][0-9]).rdl
355 |
356 | # Microsoft Fakes
357 | FakesAssemblies/
358 |
359 | # GhostDoc plugin setting file
360 | *.GhostDoc.xml
361 |
362 | # Node.js Tools for Visual Studio
363 | .ntvs_analysis.dat
364 | node_modules/
365 |
366 | # Visual Studio 6 build log
367 | *.plg
368 |
369 | # Visual Studio 6 workspace options file
370 | *.opt
371 |
372 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
373 | *.vbw
374 |
375 | # Visual Studio 6 auto-generated project file (contains which files were open etc.)
376 | *.vbp
377 |
378 | # Visual Studio 6 workspace and project file (working project files containing files to include in project)
379 | *.dsw
380 | *.dsp
381 |
382 | # Visual Studio 6 technical files
383 | *.ncb
384 | *.aps
385 |
386 | # Visual Studio LightSwitch build output
387 | **/*.HTMLClient/GeneratedArtifacts
388 | **/*.DesktopClient/GeneratedArtifacts
389 | **/*.DesktopClient/ModelManifest.xml
390 | **/*.Server/GeneratedArtifacts
391 | **/*.Server/ModelManifest.xml
392 | _Pvt_Extensions
393 |
394 | # Paket dependency manager
395 | .paket/paket.exe
396 | paket-files/
397 |
398 | # FAKE - F# Make
399 | .fake/
400 |
401 | # CodeRush personal settings
402 | .cr/personal
403 |
404 | # Python Tools for Visual Studio (PTVS)
405 | __pycache__/
406 | *.pyc
407 |
408 | # Cake - Uncomment if you are using it
409 | # tools/**
410 | # !tools/packages.config
411 |
412 | # Tabs Studio
413 | *.tss
414 |
415 | # Telerik's JustMock configuration file
416 | *.jmconfig
417 |
418 | # BizTalk build output
419 | *.btp.cs
420 | *.btm.cs
421 | *.odx.cs
422 | *.xsd.cs
423 |
424 | # OpenCover UI analysis results
425 | OpenCover/
426 |
427 | # Azure Stream Analytics local run output
428 | ASALocalRun/
429 |
430 | # MSBuild Binary and Structured Log
431 | *.binlog
432 |
433 | # NVidia Nsight GPU debugger configuration file
434 | *.nvuser
435 |
436 | # MFractors (Xamarin productivity tool) working folder
437 | .mfractor/
438 |
439 | # Local History for Visual Studio
440 | .localhistory/
441 |
442 | # Visual Studio History (VSHistory) files
443 | .vshistory/
444 |
445 | # BeatPulse healthcheck temp database
446 | healthchecksdb
447 |
448 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
449 | MigrationBackup/
450 |
451 | # Ionide (cross platform F# VS Code tools) working folder
452 | .ionide/
453 |
454 | # Fody - auto-generated XML schema
455 | FodyWeavers.xsd
456 |
457 | # VS Code files for those working on multiple tools
458 | .vscode/*
459 | !.vscode/settings.json
460 | !.vscode/tasks.json
461 | !.vscode/launch.json
462 | !.vscode/extensions.json
463 | *.code-workspace
464 |
465 | # Local History for Visual Studio Code
466 | .history/
467 |
468 | # Windows Installer files from build outputs
469 | *.cab
470 | *.msi
471 | *.msix
472 | *.msm
473 | *.msp
474 |
475 | # JetBrains Rider
476 | *.sln.iml
477 |
478 | ## Ignore Visual Studio temporary files, build results, and
479 | ## files generated by popular Visual Studio add-ons.
480 | ##
481 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
482 |
483 | # User-specific files
484 | *.rsuser
485 | *.suo
486 | *.user
487 | *.userosscache
488 | *.sln.docstates
489 |
490 | # User-specific files (MonoDevelop/Xamarin Studio)
491 | *.userprefs
492 |
493 | # Mono auto generated files
494 | mono_crash.*
495 |
496 | # Build results
497 | [Dd]ebug/
498 | [Dd]ebugPublic/
499 | [Rr]elease/
500 | [Rr]eleases/
501 | x64/
502 | x86/
503 | [Ww][Ii][Nn]32/
504 | [Aa][Rr][Mm]/
505 | [Aa][Rr][Mm]64/
506 | bld/
507 | [Bb]in/
508 | [Oo]bj/
509 | [Ll]og/
510 | [Ll]ogs/
511 |
512 | # Visual Studio 2015/2017 cache/options directory
513 | .vs/
514 | # Uncomment if you have tasks that create the project's static files in wwwroot
515 | #wwwroot/
516 |
517 | # Visual Studio 2017 auto generated files
518 | Generated\ Files/
519 |
520 | # MSTest test Results
521 | [Tt]est[Rr]esult*/
522 | [Bb]uild[Ll]og.*
523 |
524 | # NUnit
525 | *.VisualState.xml
526 | TestResult.xml
527 | nunit-*.xml
528 |
529 | # Build Results of an ATL Project
530 | [Dd]ebugPS/
531 | [Rr]eleasePS/
532 | dlldata.c
533 |
534 | # Benchmark Results
535 | BenchmarkDotNet.Artifacts/
536 |
537 | # .NET Core
538 | project.lock.json
539 | project.fragment.lock.json
540 | artifacts/
541 |
542 | # ASP.NET Scaffolding
543 | ScaffoldingReadMe.txt
544 |
545 | # StyleCop
546 | StyleCopReport.xml
547 |
548 | # Files built by Visual Studio
549 | *_i.c
550 | *_p.c
551 | *_h.h
552 | *.ilk
553 | *.meta
554 | *.obj
555 | *.iobj
556 | *.pch
557 | *.pdb
558 | *.ipdb
559 | *.pgc
560 | *.pgd
561 | *.rsp
562 | *.sbr
563 | *.tlb
564 | *.tli
565 | *.tlh
566 | *.tmp
567 | *.tmp_proj
568 | *_wpftmp.csproj
569 | *.log
570 | *.tlog
571 | *.vspscc
572 | *.vssscc
573 | .builds
574 | *.pidb
575 | *.svclog
576 | *.scc
577 |
578 | # Chutzpah Test files
579 | _Chutzpah*
580 |
581 | # Visual C++ cache files
582 | ipch/
583 | *.aps
584 | *.ncb
585 | *.opendb
586 | *.opensdf
587 | *.sdf
588 | *.cachefile
589 | *.VC.db
590 | *.VC.VC.opendb
591 |
592 | # Visual Studio profiler
593 | *.psess
594 | *.vsp
595 | *.vspx
596 | *.sap
597 |
598 | # Visual Studio Trace Files
599 | *.e2e
600 |
601 | # TFS 2012 Local Workspace
602 | $tf/
603 |
604 | # Guidance Automation Toolkit
605 | *.gpState
606 |
607 | # ReSharper is a .NET coding add-in
608 | _ReSharper*/
609 | *.[Rr]e[Ss]harper
610 | *.DotSettings.user
611 |
612 | # TeamCity is a build add-in
613 | _TeamCity*
614 |
615 | # DotCover is a Code Coverage Tool
616 | *.dotCover
617 |
618 | # AxoCover is a Code Coverage Tool
619 | .axoCover/*
620 | !.axoCover/settings.json
621 |
622 | # Coverlet is a free, cross platform Code Coverage Tool
623 | coverage*.json
624 | coverage*.xml
625 | coverage*.info
626 |
627 | # Visual Studio code coverage results
628 | *.coverage
629 | *.coveragexml
630 |
631 | # NCrunch
632 | _NCrunch_*
633 | .*crunch*.local.xml
634 | nCrunchTemp_*
635 |
636 | # MightyMoose
637 | *.mm.*
638 | AutoTest.Net/
639 |
640 | # Web workbench (sass)
641 | .sass-cache/
642 |
643 | # Installshield output folder
644 | [Ee]xpress/
645 |
646 | # DocProject is a documentation generator add-in
647 | DocProject/buildhelp/
648 | DocProject/Help/*.HxT
649 | DocProject/Help/*.HxC
650 | DocProject/Help/*.hhc
651 | DocProject/Help/*.hhk
652 | DocProject/Help/*.hhp
653 | DocProject/Help/Html2
654 | DocProject/Help/html
655 |
656 | # Click-Once directory
657 | publish/
658 |
659 | # Publish Web Output
660 | *.[Pp]ublish.xml
661 | *.azurePubxml
662 | # Note: Comment the next line if you want to checkin your web deploy settings,
663 | # but database connection strings (with potential passwords) will be unencrypted
664 | *.pubxml
665 | *.publishproj
666 |
667 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
668 | # checkin your Azure Web App publish settings, but sensitive information contained
669 | # in these scripts will be unencrypted
670 | PublishScripts/
671 |
672 | # NuGet Packages
673 | *.nupkg
674 | # NuGet Symbol Packages
675 | *.snupkg
676 | # The packages folder can be ignored because of Package Restore
677 | **/[Pp]ackages/*
678 | # except build/, which is used as an MSBuild target.
679 | !**/[Pp]ackages/build/
680 | # Uncomment if necessary however generally it will be regenerated when needed
681 | #!**/[Pp]ackages/repositories.config
682 | # NuGet v3's project.json files produces more ignorable files
683 | *.nuget.props
684 | *.nuget.targets
685 |
686 | # Microsoft Azure Build Output
687 | csx/
688 | *.build.csdef
689 |
690 | # Microsoft Azure Emulator
691 | ecf/
692 | rcf/
693 |
694 | # Windows Store app package directories and files
695 | AppPackages/
696 | BundleArtifacts/
697 | Package.StoreAssociation.xml
698 | _pkginfo.txt
699 | *.appx
700 | *.appxbundle
701 | *.appxupload
702 |
703 | # Visual Studio cache files
704 | # files ending in .cache can be ignored
705 | *.[Cc]ache
706 | # but keep track of directories ending in .cache
707 | !?*.[Cc]ache/
708 |
709 | # Others
710 | ClientBin/
711 | ~$*
712 | *~
713 | *.dbmdl
714 | *.dbproj.schemaview
715 | *.jfm
716 | *.pfx
717 | *.publishsettings
718 | orleans.codegen.cs
719 |
720 | # Including strong name files can present a security risk
721 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
722 | #*.snk
723 |
724 | # Since there are multiple workflows, uncomment next line to ignore bower_components
725 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
726 | #bower_components/
727 |
728 | # RIA/Silverlight projects
729 | Generated_Code/
730 |
731 | # Backup & report files from converting an old project file
732 | # to a newer Visual Studio version. Backup files are not needed,
733 | # because we have git ;-)
734 | _UpgradeReport_Files/
735 | Backup*/
736 | UpgradeLog*.XML
737 | UpgradeLog*.htm
738 | ServiceFabricBackup/
739 | *.rptproj.bak
740 |
741 | # SQL Server files
742 | *.mdf
743 | *.ldf
744 | *.ndf
745 |
746 | # Business Intelligence projects
747 | *.rdl.data
748 | *.bim.layout
749 | *.bim_*.settings
750 | *.rptproj.rsuser
751 | *- [Bb]ackup.rdl
752 | *- [Bb]ackup ([0-9]).rdl
753 | *- [Bb]ackup ([0-9][0-9]).rdl
754 |
755 | # Microsoft Fakes
756 | FakesAssemblies/
757 |
758 | # GhostDoc plugin setting file
759 | *.GhostDoc.xml
760 |
761 | # Node.js Tools for Visual Studio
762 | .ntvs_analysis.dat
763 | node_modules/
764 |
765 | # Visual Studio 6 build log
766 | *.plg
767 |
768 | # Visual Studio 6 workspace options file
769 | *.opt
770 |
771 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
772 | *.vbw
773 |
774 | # Visual Studio 6 auto-generated project file (contains which files were open etc.)
775 | *.vbp
776 |
777 | # Visual Studio 6 workspace and project file (working project files containing files to include in project)
778 | *.dsw
779 | *.dsp
780 |
781 | # Visual Studio 6 technical files
782 | *.ncb
783 | *.aps
784 |
785 | # Visual Studio LightSwitch build output
786 | **/*.HTMLClient/GeneratedArtifacts
787 | **/*.DesktopClient/GeneratedArtifacts
788 | **/*.DesktopClient/ModelManifest.xml
789 | **/*.Server/GeneratedArtifacts
790 | **/*.Server/ModelManifest.xml
791 | _Pvt_Extensions
792 |
793 | # Paket dependency manager
794 | .paket/paket.exe
795 | paket-files/
796 |
797 | # FAKE - F# Make
798 | .fake/
799 |
800 | # CodeRush personal settings
801 | .cr/personal
802 |
803 | # Python Tools for Visual Studio (PTVS)
804 | __pycache__/
805 | *.pyc
806 |
807 | # Cake - Uncomment if you are using it
808 | # tools/**
809 | # !tools/packages.config
810 |
811 | # Tabs Studio
812 | *.tss
813 |
814 | # Telerik's JustMock configuration file
815 | *.jmconfig
816 |
817 | # BizTalk build output
818 | *.btp.cs
819 | *.btm.cs
820 | *.odx.cs
821 | *.xsd.cs
822 |
823 | # OpenCover UI analysis results
824 | OpenCover/
825 |
826 | # Azure Stream Analytics local run output
827 | ASALocalRun/
828 |
829 | # MSBuild Binary and Structured Log
830 | *.binlog
831 |
832 | # NVidia Nsight GPU debugger configuration file
833 | *.nvuser
834 |
835 | # MFractors (Xamarin productivity tool) working folder
836 | .mfractor/
837 |
838 | # Local History for Visual Studio
839 | .localhistory/
840 |
841 | # Visual Studio History (VSHistory) files
842 | .vshistory/
843 |
844 | # BeatPulse healthcheck temp database
845 | healthchecksdb
846 |
847 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
848 | MigrationBackup/
849 |
850 | # Ionide (cross platform F# VS Code tools) working folder
851 | .ionide/
852 |
853 | # Fody - auto-generated XML schema
854 | FodyWeavers.xsd
855 |
856 | # VS Code files for those working on multiple tools
857 | .vscode/*
858 | !.vscode/settings.json
859 | !.vscode/tasks.json
860 | !.vscode/launch.json
861 | !.vscode/extensions.json
862 | *.code-workspace
863 |
864 | # Local History for Visual Studio Code
865 | .history/
866 |
867 | # Windows Installer files from build outputs
868 | *.cab
869 | *.msi
870 | *.msix
871 | *.msm
872 | *.msp
873 |
874 | # JetBrains Rider
875 | *.sln.iml
876 |
--------------------------------------------------------------------------------