HyperDbg/examples/user/hyperdbg_app/code/hyperdbg-app.cpp

59 lines
1 KiB
C++
Raw Permalink Normal View History

2023-02-02 12:48:15 +09:00
#include "pch.h"
static int
ShowMessages(const char * Text)
2023-02-02 12:48:15 +09:00
{
printf("%s", Text);
return 0;
2023-02-02 12:48:15 +09:00
}
2023-09-12 11:45:50 +09:00
static int
2026-06-13 15:22:34 +02:00
LoadVmm()
2026-06-04 01:55:42 +02:00
{
hyperdbg_u_set_text_message_callback((PVOID)ShowMessages);
2026-06-04 01:55:42 +02:00
if (!hyperdbg_u_detect_vmx_support())
{
printf("[-] VT-x (VMX) is not supported / enabled on this processor\n");
2026-06-04 01:55:42 +02:00
return 1;
}
printf("[*] loading HyperDbg VMM...\n");
if (hyperdbg_u_install_kd_driver() == 1 || hyperdbg_u_load_vmm() == 1)
2026-06-04 01:55:42 +02:00
{
printf("[-] cannot load the HyperDbg VMM\n");
2026-06-04 01:55:42 +02:00
return 1;
}
2023-09-12 11:45:50 +09:00
printf("[+] HyperDbg VMM is running\n");
2026-06-13 14:20:32 +02:00
2023-09-12 11:45:50 +09:00
return 0;
}
int
2026-06-13 15:22:34 +02:00
main(int argc, char ** argv)
2023-09-12 11:45:50 +09:00
{
2026-06-13 15:42:40 +02:00
return main2(argc, argv);
2026-06-13 15:22:34 +02:00
if (LoadVmm() != 0)
2023-09-12 11:45:50 +09:00
{
2026-06-04 01:55:42 +02:00
return 1;
2023-09-12 11:45:50 +09:00
}
2026-06-04 01:55:42 +02:00
2026-06-13 15:22:34 +02:00
hyperdbg_u_run_command((CHAR*)"lm");
2026-06-04 01:55:42 +02:00
printf("[*] unloading HyperDbg VMM...\n");
//
// Unload the driver
//
2026-06-04 01:55:42 +02:00
hyperdbg_u_unload_vmm();
hyperdbg_u_unload_kd();
hyperdbg_u_stop_kd_driver();
hyperdbg_u_uninstall_kd_driver();
printf("[+] done\n");
2026-06-04 01:55:42 +02:00
return 0;
2023-09-12 11:45:50 +09:00
}