From 654646c97f239b5252735ab13026c8fca0845443 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sat, 17 Aug 2024 09:43:25 +0200 Subject: [PATCH] Add process hacker headers --- .gitmodules | 3 +++ deps/CMakeLists.txt | 6 ++++-- deps/phnt | 1 + src/emulator/CMakeLists.txt | 2 +- src/emulator/std_include.hpp | 12 ++++++------ src/emulator/unicorn.hpp | 5 +---- 6 files changed, 16 insertions(+), 13 deletions(-) create mode 160000 deps/phnt diff --git a/.gitmodules b/.gitmodules index 91b9ad64..bcc9c0dd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,3 +3,6 @@ url = https://github.com/unicorn-engine/unicorn.git shallow = true branch = dev +[submodule "deps/phnt"] + path = deps/phnt + url = https://github.com/winsiderss/phnt.git diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index df0677b9..91fb3a62 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -1,5 +1,7 @@ set(UNICORN_ARCH "x86" CACHE STRING "") -add_subdirectory(unicorn) - ########################################## + +add_subdirectory(unicorn) +add_subdirectory(phnt) + diff --git a/deps/phnt b/deps/phnt new file mode 160000 index 00000000..a564eb15 --- /dev/null +++ b/deps/phnt @@ -0,0 +1 @@ +Subproject commit a564eb15114fe1b0626d626d80c912078d4c0cf8 diff --git a/src/emulator/CMakeLists.txt b/src/emulator/CMakeLists.txt index 17d102f9..9ad6a25a 100644 --- a/src/emulator/CMakeLists.txt +++ b/src/emulator/CMakeLists.txt @@ -12,7 +12,7 @@ momo_assign_source_group(${SRC_FILES}) target_precompile_headers(client PRIVATE std_include.hpp) -target_link_libraries(client PRIVATE unicorn) +target_link_libraries(client PRIVATE unicorn phnt::phnt) set_target_properties(client PROPERTIES OUTPUT_NAME "bird") diff --git a/src/emulator/std_include.hpp b/src/emulator/std_include.hpp index de75f06a..064de7cc 100644 --- a/src/emulator/std_include.hpp +++ b/src/emulator/std_include.hpp @@ -2,6 +2,7 @@ #ifdef _WIN32 #pragma warning(push) +#pragma warning(disable: 4005) #pragma warning(disable: 4127) #pragma warning(disable: 4244) #pragma warning(disable: 4245) @@ -27,12 +28,6 @@ #define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include -#include - // min and max is required by gdi, therefore NOMINMAX won't work #ifdef max #undef max @@ -69,6 +64,11 @@ #include +#define NTDDI_WIN11_GE 0 +#define PHNT_VERSION PHNT_WIN11 +#include +#include + #ifdef _WIN32 #pragma warning(pop) #endif diff --git a/src/emulator/unicorn.hpp b/src/emulator/unicorn.hpp index 3c211a92..82ea24d2 100644 --- a/src/emulator/unicorn.hpp +++ b/src/emulator/unicorn.hpp @@ -19,10 +19,7 @@ inline void ThrowIfUnicornError(const uc_err error_code) } } -inline void e(const uc_err error_code) -{ - ThrowIfUnicornError(error_code); -} +#define e ThrowIfUnicornError class unicorn {