diff --git a/NtRaiseHardError.sln b/NtRaiseHardError.sln new file mode 100644 index 0000000..df4023c --- /dev/null +++ b/NtRaiseHardError.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NtRaiseHardError", "NtRaiseHardError\NtRaiseHardError.vcproj", "{47BDCBBC-954F-4560-A875-BD2F4BA71573}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {47BDCBBC-954F-4560-A875-BD2F4BA71573}.Debug|Win32.ActiveCfg = Debug|Win32 + {47BDCBBC-954F-4560-A875-BD2F4BA71573}.Debug|Win32.Build.0 = Debug|Win32 + {47BDCBBC-954F-4560-A875-BD2F4BA71573}.Release|Win32.ActiveCfg = Release|Win32 + {47BDCBBC-954F-4560-A875-BD2F4BA71573}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/NtRaiseHardError/NtRaiseHardError.cpp b/NtRaiseHardError/NtRaiseHardError.cpp new file mode 100644 index 0000000..05e925e --- /dev/null +++ b/NtRaiseHardError/NtRaiseHardError.cpp @@ -0,0 +1,70 @@ +// NtRaiseHardError.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" + +EXTERN_C NTSTATUS NTAPI RtlAdjustPrivilege(ULONG Privilege, BOOLEAN Enable, BOOLEAN Client, PBOOLEAN WasEnabled); +EXTERN_C NTSTATUS NTAPI NtRaiseHardError(NTSTATUS ErrorStatus, ULONG Params, ULONG UnicodeStringParameterMask, PULONG_PTR Parameters, ULONG ValidResponseOptions, PULONG Response); + +ULONG evil(NTSTATUS option, NTSTATUS responseType) { + BOOLEAN fuck; + ULONG resp; + /*UNICODE_STRING Message; + ANSI_STRING MSG; + RtlInitUnicodeString(&Message, L"Puneet Ballabh"); + ULONG_PTR p[]={(ULONG_PTR)&Message,(ULONG_PTR)&Message,0x0,0x0}; */ // Parameters not implemennted yet + NTSTATUS privilege = RtlAdjustPrivilege(19, true, false, &fuck); + if (privilege != STATUS_SUCCESS) { + printf("\nERROR: Could not get privilege to shutdown system. This is needed for this program"); + printf("\nError code: %d (0x%x)", privilege, privilege); + printf("\n"); + Sleep(5000); + return privilege; + } + + const NTSTATUS limit = 0xC0000000, success = 0x00000000; + if (responseType == 0x6 && (option >= limit && option <= success)) + { + int confirmation = MessageBox(NULL, L"An Error value was specified and the response has been set to OptionShutdownSystem.\r\n !!! THIS WILL RESULT IN A BLUE SCREEN !!!\r\nAre you sure you want to continue?", L"WARNING", MB_YESNO|MB_ICONWARNING); + if (confirmation != 0x6) { + printf("\nConfirmation refused, closing..."); + Sleep(2000); + return confirmation; + } + } + Sleep(2000); + NTSTATUS herror = NtRaiseHardError(option, 0x0, 0x0, 0x0, responseType, &resp); + + printf("\nHard error result: %d (0x%x)", herror, herror); + printf("\nResponse: %d (0x%x)", resp, resp); + printf("\nClosing automatically in 5 seconds..."); + printf("\n"); + Sleep(5000); + return resp; +} + +int _tmain(int argc, _TCHAR* argv[]) +{ + int cfrm = 100; + printf("Welcome to NtRaiseHardError Generator\n"); + printf("Version 1.0. Currently missing any kind of parameter specifiers"); + Sleep(1000); + NTSTATUS value,response = 0xFFFFFFFF; + + + printf("\n\nFirst you need to specify the error you wanna generate\nTo see a complete list of errors, find all the statuses defined in ntstatus.h for your Windows version."); + printf("\nAs a rule of thumb: \n 0x0??????? -> Success codes\n 0x4??????? -> Information codes\n 0x8??????? -> Warning codes\n 0xC??????? -> Error codes"); + + printf("\n\nEnter NTSTATUS hex code: 0x"); + scanf("%lx%*c", &value); + printf("\nNow give a response option. \nValid options:\n0x0: OptionAbortRetryIgnore\n0x1: OptionOk\n0x2: OptionOkCancel\n0x3: OptionRetryCancel\n0x4: OptionYesNo\n0x5: OptionYesNoCancel\n0x6: OptionShutdownSystem (DANGEROUS)\n0x7: OptionOkNoWait (spawns message in tray)\n0x8: OptionCancelTryContinue\nInvalid Options default to 0x1"); + printf("\n\nEnter response option: 0x"); + scanf("%x%*c", &response); + if (response < 0x0 || response > 0x8) + response = 0x1; + + printf("\nWaiting for 4 seconds to allow user to close in case of mistake"); + Sleep(4000); + return evil(value, response); +} + diff --git a/NtRaiseHardError/NtRaiseHardError.vcproj b/NtRaiseHardError/NtRaiseHardError.vcproj new file mode 100644 index 0000000..f58966a --- /dev/null +++ b/NtRaiseHardError/NtRaiseHardError.vcproj @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NtRaiseHardError/ReadMe.txt b/NtRaiseHardError/ReadMe.txt new file mode 100644 index 0000000..6b3e201 --- /dev/null +++ b/NtRaiseHardError/ReadMe.txt @@ -0,0 +1,33 @@ +======================================================================== + CONSOLE APPLICATION : NtRaiseHardError Project Overview +======================================================================== + +AppWizard has created this NtRaiseHardError application for you. + +This file contains a summary of what you will find in each of the files that +make up your NtRaiseHardError application. + + +NtRaiseHardError.vcproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +NtRaiseHardError.cpp + This is the main application source file. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named NtRaiseHardError.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/NtRaiseHardError/stdafx.cpp b/NtRaiseHardError/stdafx.cpp new file mode 100644 index 0000000..57f85de --- /dev/null +++ b/NtRaiseHardError/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// NtRaiseHardError.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/NtRaiseHardError/stdafx.h b/NtRaiseHardError/stdafx.h new file mode 100644 index 0000000..101ac2a --- /dev/null +++ b/NtRaiseHardError/stdafx.h @@ -0,0 +1,20 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + + +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#include +#define WIN32_NO_STATUS +#include +#undef WIN32_NO_STATUS +#define _WIN32_WINNT 0x0500 +#include +#include +#include + +// TODO: reference additional headers your program requires here diff --git a/README.md b/README.md index 6686ef0..228f19a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ # NtRaiseHardError -make your NT hard \ No newline at end of file +A way to generate "hard errors" in all Windows NT versions (works from Windows NT 3.51 all the way to Windows 11). + +Currently, it can signal any NTSTATUS and can use any one of the 8 possible responses. + +## Error on Windows 10 + + + +## BSOD on Windows XP + + + +## TODO + +Add the ability to supply parameters to NtRaiseHardError in order to customize the messages. diff --git a/pictures/bsod.png b/pictures/bsod.png new file mode 100644 index 0000000..e32b09b Binary files /dev/null and b/pictures/bsod.png differ diff --git a/pictures/error.png b/pictures/error.png new file mode 100644 index 0000000..5864021 Binary files /dev/null and b/pictures/error.png differ