Update natives for new paths
This commit is contained in:
parent
1cd569d200
commit
21690627d4
|
@ -1,14 +1,13 @@
|
|||
@echo off
|
||||
echo Setting up native env
|
||||
cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build"
|
||||
cd "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build"
|
||||
call vcvarsall x86_x64
|
||||
cd %~dp0
|
||||
echo Building natives
|
||||
cl .\io_gitlab_jfronny_breakme_breakme_NativeCrash.cpp /I"C:\Program Files\OpenJDK\jdk-12.0.2\include" /I"C:\Program Files\OpenJDK\jdk-12.0.2\include\win32" -Fenatives.dll -MD -LD
|
||||
cl .\io_gitlab_jfronny_breakme_crash_unsafe_WinApiProvider.cpp /I"jdk\include" /I"jdk\include\win32" -Fenatives.dll -MD -LD
|
||||
echo Running post-build steps
|
||||
del .\natives.exp
|
||||
del .\natives.lib
|
||||
del .\io_gitlab_jfronny_breakme_breakme_NativeCrash.obj
|
||||
del ..\resources\native\natives.dll
|
||||
copy /y natives.dll ..\resources\native\natives.dll
|
||||
echo Natives complete
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
#include <windows.h>
|
||||
#include "io_gitlab_jfronny_breakme_breakme_NativeCrash.h"
|
||||
#pragma comment(lib, "ntdll.lib")
|
||||
|
||||
extern "C" NTSTATUS NTAPI RtlAdjustPrivilege(ULONG Privilege, BOOLEAN Enable, BOOLEAN CurrentThread, PBOOLEAN OldValue);
|
||||
extern "C" NTSTATUS NTAPI NtRaiseHardError(LONG ErrorStatus, ULONG NumberOfParameters, ULONG UnicodeStringParameterMask,
|
||||
PULONG_PTR Parameters, ULONG ValidResponseOptions, PULONG Response);
|
||||
|
||||
JNIEXPORT void JNICALL Java_io_gitlab_jfronny_breakme_breakme_NativeCrash_CrashWindows_1Native(JNIEnv* env, jobject thisObject)
|
||||
{
|
||||
BOOLEAN bl;
|
||||
ULONG Response;
|
||||
RtlAdjustPrivilege(19, TRUE, FALSE, &bl); // Enable SeShutdownPrivilege
|
||||
NtRaiseHardError(STATUS_ASSERTION_FAILURE, 0, 0, NULL, 6, &Response); // Shutdown
|
||||
}
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <Windows.h>
|
||||
#include <winternl.h>
|
||||
#include "io_gitlab_jfronny_breakme_breakme_NativeCrash.h"
|
||||
using namespace std;
|
||||
typedef NTSTATUS(NTAPI *pdef_NtRaiseHardError)(NTSTATUS ErrorStatus, ULONG NumberOfParameters, ULONG UnicodeStringParameterMask OPTIONAL, PULONG_PTR Parameters, ULONG ResponseOption, PULONG Response);
|
||||
typedef NTSTATUS(NTAPI *pdef_RtlAdjustPrivilege)(ULONG Privilege, BOOLEAN Enable, BOOLEAN CurrentThread, PBOOLEAN Enabled);
|
||||
JNIEXPORT void JNICALL Java_io_gitlab_jfronny_breakme_breakme_NativeCrash_CrashWindows_1Native(JNIEnv* env, jobject thisObject)
|
||||
{
|
||||
BOOLEAN bEnabled;
|
||||
ULONG uResp;
|
||||
LPVOID lpFuncAddress = GetProcAddress(LoadLibraryA("ntdll.dll"), "RtlAdjustPrivilege");
|
||||
LPVOID lpFuncAddress2 = GetProcAddress(GetModuleHandle("ntdll.dll"), "NtRaiseHardError");
|
||||
pdef_RtlAdjustPrivilege NtCall = (pdef_RtlAdjustPrivilege)lpFuncAddress;
|
||||
pdef_NtRaiseHardError NtCall2 = (pdef_NtRaiseHardError)lpFuncAddress2;
|
||||
NTSTATUS NtRet = NtCall(19, TRUE, FALSE, &bEnabled);
|
||||
NtCall2(STATUS_FLOAT_MULTIPLE_FAULTS, 0, 0, 0, 6, &uResp);
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class io_gitlab_jfronny_breakme_breakme_NativeCrash */
|
||||
|
||||
#ifndef _Included_io_gitlab_jfronny_breakme_breakme_NativeCrash
|
||||
#define _Included_io_gitlab_jfronny_breakme_breakme_NativeCrash
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: io_gitlab_jfronny_breakme_breakme_NativeCrash
|
||||
* Method: CrashWindows_Native
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_io_gitlab_jfronny_breakme_breakme_NativeCrash_CrashWindows_1Native
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
#include <iostream>
|
||||
#include <Windows.h>
|
||||
#include <winternl.h>
|
||||
#include "io_gitlab_jfronny_breakme_crash_unsafe_WinApiProvider.h"
|
||||
using namespace std;
|
||||
typedef NTSTATUS(NTAPI *pdef_NtRaiseHardError)(NTSTATUS ErrorStatus, ULONG NumberOfParameters, ULONG UnicodeStringParameterMask OPTIONAL, PULONG_PTR Parameters, ULONG ResponseOption, PULONG Response);
|
||||
typedef NTSTATUS(NTAPI *pdef_RtlAdjustPrivilege)(ULONG Privilege, BOOLEAN Enable, BOOLEAN CurrentThread, PBOOLEAN Enabled);
|
||||
JNIEXPORT void JNICALL Java_io_gitlab_jfronny_breakme_crash_unsafe_WinApiProvider_CrashWindows_1Native(JNIEnv* env, jobject thisObject)
|
||||
{
|
||||
BOOLEAN bEnabled;
|
||||
ULONG uResp;
|
||||
LPVOID lpFuncAddress = GetProcAddress(LoadLibraryA("ntdll.dll"), "RtlAdjustPrivilege");
|
||||
LPVOID lpFuncAddress2 = GetProcAddress(GetModuleHandle("ntdll.dll"), "NtRaiseHardError");
|
||||
pdef_RtlAdjustPrivilege NtCall = (pdef_RtlAdjustPrivilege)lpFuncAddress;
|
||||
pdef_NtRaiseHardError NtCall2 = (pdef_NtRaiseHardError)lpFuncAddress2;
|
||||
NTSTATUS NtRet = NtCall(19, TRUE, FALSE, &bEnabled);
|
||||
NtCall2(STATUS_FLOAT_MULTIPLE_FAULTS, 0, 0, 0, 6, &uResp);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class io_gitlab_jfronny_breakme_crash_unsafe_WinApiProvider */
|
||||
|
||||
#ifndef _Included_io_gitlab_jfronny_breakme_crash_unsafe_WinApiProvider
|
||||
#define _Included_io_gitlab_jfronny_breakme_crash_unsafe_WinApiProvider
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: io_gitlab_jfronny_breakme_crash_unsafe_WinApiProvider
|
||||
* Method: CrashWindows_Native
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_io_gitlab_jfronny_breakme_crash_unsafe_WinApiProvider_CrashWindows_1Native
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
Binary file not shown.
Loading…
Reference in New Issue