Skip to content

Instantly share code, notes, and snippets.

@ldmsys
Created June 4, 2023 00:35
Show Gist options
  • Save ldmsys/fd8207314d3668e5a2297c502edbb7aa to your computer and use it in GitHub Desktop.
Save ldmsys/fd8207314d3668e5a2297c502edbb7aa to your computer and use it in GitHub Desktop.
이게 뭐였더라
#include <stdio.h>
#include <Windows.h>
typedef NTSTATUS(NTAPI *pdef_RtlAdjustPrivilege) (ULONG privilege,BOOLEAN enable,BOOLEAN current_thread,PBOOLEAN enabled);
typedef NTSTATUS(NTAPI *pdef_NtRaiseHardError)(NTSTATUS error_status,ULONG number_of_parameters,ULONG unicode_string_parameter_mask,PULONG_PTR parameters,ULONG response_option,PULONG reponse);
int main(void) {
pdef_RtlAdjustPrivilege RtlAdjustPrivilege = (pdef_RtlAdjustPrivilege)GetProcAddress(LoadLibraryA("ntdll.dll"), "RtlAdjustPrivilege");
BOOLEAN enabled;
if (RtlAdjustPrivilege(19, TRUE, FALSE, &enabled) == 0)
{
pdef_NtRaiseHardError NtRaiseHardError = (pdef_NtRaiseHardError)GetProcAddress(LoadLibraryA("ntdll.dll"), "NtRaiseHardError");
unsigned long dummy;
NtRaiseHardError(0xC8C8C8C8, 0, 0, 0, 6, &dummy);
}else{
printf("failed\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment