mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-01 21:58:55 +08:00
Merge pull request #9932 from xeropresence/polyhook2-update
[polyhook2 ] Update port
This commit is contained in:
commit
7a78d51e2f
@ -1,8 +1,8 @@
|
|||||||
Source: polyhook2
|
Source: polyhook2
|
||||||
Version: 2019-10-24
|
Version: 2020-02-03
|
||||||
Homepage: https://github.com/stevemk14ebr/PolyHook_2_0
|
Homepage: https://github.com/stevemk14ebr/PolyHook_2_0
|
||||||
Description: C++17, x86/x64 Hooking Libary v2.0
|
Description: C++17, x86/x64 Hooking Libary v2.0
|
||||||
Build-Depends: capstone
|
Build-Depends: capstone[x86]
|
||||||
|
|
||||||
Feature: tool
|
Feature: tool
|
||||||
Description: Build tests
|
Description: Build tests
|
@ -1,8 +1,104 @@
|
|||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
index 62dbdba..55a3068 100644
|
index 2577bb2..e88761c 100644
|
||||||
--- a/CMakeLists.txt
|
--- a/CMakeLists.txt
|
||||||
+++ b/CMakeLists.txt
|
+++ b/CMakeLists.txt
|
||||||
@@ -217,8 +217,10 @@ if(NOT ${CAPSTONE_FULL})
|
@@ -12,18 +12,19 @@ option(FEATURE_PE "Implement all win pe hooking functionality" ON)
|
||||||
|
option(BUILD_DLL "Build dll & lib instead of tests" OFF)
|
||||||
|
option(BUILD_STATIC "If BUILD_DLL is set, create the type that can be statically linked" ON)
|
||||||
|
option(CAPSTONE_FULL "Build all features of capstone." OFF)
|
||||||
|
+option(BUILD_TOOLS "Build tests" OFF)
|
||||||
|
|
||||||
|
# Calculate inclusion of necessary dependencies based on features
|
||||||
|
|
||||||
|
# for now only inlinentd uses asmjit
|
||||||
|
set(DEP_ASMJIT_NEED ${FEATURE_INLINENTD})
|
||||||
|
-set(DEP_ZYDIS_NEED ON)
|
||||||
|
+set(DEP_ZYDIS_NEED OFF)
|
||||||
|
# todo: make inclusion of capstone stuff depend on feature flags
|
||||||
|
|
||||||
|
#IDE's like it when header file are included as source files
|
||||||
|
set(HEADER_FILES ${PROJECT_SOURCE_DIR}/polyhook2/ADisassembler.hpp
|
||||||
|
${PROJECT_SOURCE_DIR}/polyhook2/CapstoneDisassembler.hpp
|
||||||
|
- ${PROJECT_SOURCE_DIR}/polyhook2/ZydisDisassembler.hpp
|
||||||
|
+# ${PROJECT_SOURCE_DIR}/polyhook2/ZydisDisassembler.hpp
|
||||||
|
${PROJECT_SOURCE_DIR}/polyhook2/Enums.hpp
|
||||||
|
${PROJECT_SOURCE_DIR}/polyhook2/IHook.hpp
|
||||||
|
${PROJECT_SOURCE_DIR}/polyhook2/Instruction.hpp
|
||||||
|
@@ -35,13 +36,13 @@ set(HEADER_FILES ${PROJECT_SOURCE_DIR}/polyhook2/ADisassembler.hpp
|
||||||
|
|
||||||
|
set(HEADER_IMP_SOURCES
|
||||||
|
${PROJECT_SOURCE_DIR}/sources/CapstoneDisassembler.cpp
|
||||||
|
- ${PROJECT_SOURCE_DIR}/sources/ZydisDisassembler.cpp
|
||||||
|
+# ${PROJECT_SOURCE_DIR}/sources/ZydisDisassembler.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/sources/MemProtector.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/sources/TestEffectTracker.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/sources/PageAllocator.cpp)
|
||||||
|
|
||||||
|
# only build tests if making exe
|
||||||
|
-if(BUILD_DLL MATCHES OFF)
|
||||||
|
+if(BUILD_TOOLS)
|
||||||
|
set(UNIT_TEST_SOURCES
|
||||||
|
${PROJECT_SOURCE_DIR}/MainTests.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/UnitTests/TestDisassembler.cpp
|
||||||
|
@@ -65,7 +66,7 @@ if(FEATURE_DETOURS MATCHES ON)
|
||||||
|
set(HEADER_IMP_SOURCES ${HEADER_IMP_SOURCES} ${DETOUR_IMP_SOURCES})
|
||||||
|
|
||||||
|
# only build tests if making exe
|
||||||
|
- if(BUILD_DLL MATCHES OFF)
|
||||||
|
+ if(BUILD_TOOLS)
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
# 64 bits
|
||||||
|
set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES}
|
||||||
|
@@ -93,7 +94,7 @@ if(FEATURE_EXCEPTION MATCHES ON)
|
||||||
|
set(HEADER_IMP_SOURCES ${HEADER_IMP_SOURCES} ${EXCEPTION_IMP_SOURCES})
|
||||||
|
|
||||||
|
# only build tests if making exe
|
||||||
|
- if(BUILD_DLL MATCHES OFF)
|
||||||
|
+ if(BUILD_TOOLS)
|
||||||
|
set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES}
|
||||||
|
${PROJECT_SOURCE_DIR}/UnitTests/TestBreakpointHook.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/UnitTests/TestHWBreakpointHook.cpp)
|
||||||
|
@@ -113,7 +114,7 @@ if(FEATURE_VIRTUALS MATCHES ON)
|
||||||
|
set(HEADER_IMP_SOURCES ${HEADER_IMP_SOURCES} ${VIRTUAL_IMP_SOURCES})
|
||||||
|
|
||||||
|
# only build tests if making exe
|
||||||
|
- if(BUILD_DLL MATCHES OFF)
|
||||||
|
+ if(BUILD_TOOLS)
|
||||||
|
set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES}
|
||||||
|
${PROJECT_SOURCE_DIR}/UnitTests/TestVTableSwapHook.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/UnitTests/TestVFuncSwapHook.cpp)
|
||||||
|
@@ -134,7 +135,7 @@ if(FEATURE_PE MATCHES ON)
|
||||||
|
set(HEADER_IMP_SOURCES ${HEADER_IMP_SOURCES} ${PE_IMP_SOURCES})
|
||||||
|
|
||||||
|
# only build tests if making exe
|
||||||
|
- if(BUILD_DLL MATCHES OFF)
|
||||||
|
+ if(BUILD_TOOLS)
|
||||||
|
set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES}
|
||||||
|
${PROJECT_SOURCE_DIR}/UnitTests/TestEatHook.cpp
|
||||||
|
${PROJECT_SOURCE_DIR}/UnitTests/TestIatHook.cpp)
|
||||||
|
@@ -152,7 +153,7 @@ if(FEATURE_INLINENTD MATCHES ON)
|
||||||
|
set(HEADER_IMP_SOURCES ${HEADER_IMP_SOURCES} ${NTD_SOURCES})
|
||||||
|
|
||||||
|
# only build tests if making exe
|
||||||
|
- if(BUILD_DLL MATCHES OFF)
|
||||||
|
+ if(BUILD_TOOLS)
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
# 64 bits
|
||||||
|
set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES}
|
||||||
|
@@ -175,8 +176,10 @@ if(BUILD_DLL MATCHES ON)
|
||||||
|
else()
|
||||||
|
add_library(PolyHook_2 SHARED ${SOURCE_FILES_PLH})
|
||||||
|
endif()
|
||||||
|
-else()
|
||||||
|
- add_executable(PolyHook_2 ${SOURCE_FILES_PLH})
|
||||||
|
+endif()
|
||||||
|
+
|
||||||
|
+if(BUILD_TOOLS)
|
||||||
|
+ add_executable(PolyHook2_tool ${SOURCE_FILES_PLH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# add WALL + PDB flags
|
||||||
|
@@ -220,8 +223,16 @@ if(NOT ${CAPSTONE_FULL})
|
||||||
set(CAPSTONE_EVM_SUPPORT OFF CACHE BOOL "EVM support")
|
set(CAPSTONE_EVM_SUPPORT OFF CACHE BOOL "EVM support")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -12,33 +108,28 @@ index 62dbdba..55a3068 100644
|
|||||||
+find_path(CAPSTONE_INCLUDE_DIR NAMES capstone/capstone.h)
|
+find_path(CAPSTONE_INCLUDE_DIR NAMES capstone/capstone.h)
|
||||||
+target_link_libraries(${PROJECT_NAME} ${CAPSTONE_LIBRARY})
|
+target_link_libraries(${PROJECT_NAME} ${CAPSTONE_LIBRARY})
|
||||||
+target_include_directories(${PROJECT_NAME} PRIVATE ${CAPSTONE_INCLUDE_DIR})
|
+target_include_directories(${PROJECT_NAME} PRIVATE ${CAPSTONE_INCLUDE_DIR})
|
||||||
|
+
|
||||||
|
+if(BUILD_TOOLS)
|
||||||
|
+ target_link_libraries(PolyHook2_tool ${CAPSTONE_LIBRARY})
|
||||||
|
+ target_include_directories(PolyHook2_tool PRIVATE ${CAPSTONE_INCLUDE_DIR})
|
||||||
|
+ install(TARGETS PolyHook2_tool DESTINATION tool)
|
||||||
|
+endif()
|
||||||
|
|
||||||
# ASMJIT
|
# ASMJIT
|
||||||
if(DEP_ASMJIT_NEED MATCHES ON)
|
if(DEP_ASMJIT_NEED MATCHES ON)
|
||||||
@@ -230,3 +232,13 @@ if(DEP_ASMJIT_NEED MATCHES ON)
|
diff --git a/polyhook2/CapstoneDisassembler.hpp b/polyhook2/CapstoneDisassembler.hpp
|
||||||
add_subdirectory(${ASMJIT_DIR}) # build it
|
index d227b30..bb5d222 100644
|
||||||
target_link_libraries(${PROJECT_NAME} asmjit)
|
--- a/polyhook2/CapstoneDisassembler.hpp
|
||||||
endif()
|
+++ b/polyhook2/CapstoneDisassembler.hpp
|
||||||
+
|
|
||||||
+#Install targets
|
|
||||||
+install(TARGETS ${PROJECT_NAME}
|
|
||||||
+ RUNTIME DESTINATION bin
|
|
||||||
+ LIBRARY DESTINATION lib
|
|
||||||
+ ARCHIVE DESTINATION lib
|
|
||||||
+)
|
|
||||||
+
|
|
||||||
+#Install headers
|
|
||||||
+install(FILES ${HEADER_FILES} DESTINATION include)
|
|
||||||
diff --git a/headers/CapstoneDisassembler.hpp b/headers/CapstoneDisassembler.hpp
|
|
||||||
index 2c31bfe..5f3a8ee 100644
|
|
||||||
--- a/headers/CapstoneDisassembler.hpp
|
|
||||||
+++ b/headers/CapstoneDisassembler.hpp
|
|
||||||
@@ -7,7 +7,7 @@
|
@@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include "headers/ADisassembler.hpp"
|
#include "polyhook2/ADisassembler.hpp"
|
||||||
|
|
||||||
-#include <capstone/include/capstone/capstone.h>
|
-#include <capstone/include/capstone/capstone.h>
|
||||||
+#include <capstone/capstone.h>
|
+#include <capstone/capstone.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <iostream> //for debug printing
|
#include <iostream> //for debug printing
|
||||||
|
--
|
||||||
|
2.25.0.windows.1
|
||||||
|
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
||||||
index 55a3068..c45f7bf 100644
|
|
||||||
--- a/CMakeLists.txt
|
|
||||||
+++ b/CMakeLists.txt
|
|
||||||
@@ -12,6 +12,7 @@ option(FEATURE_PE "Implement all win pe hooking functionality" ON)
|
|
||||||
option(BUILD_DLL "Build dll & lib instead of tests" OFF)
|
|
||||||
option(BUILD_STATIC "If BUILD_DLL is set, create the type that can be statically linked" ON)
|
|
||||||
option(CAPSTONE_FULL "Build all features of capstone." OFF)
|
|
||||||
+option(BUILD_TOOLS "Build tests" OFF)
|
|
||||||
|
|
||||||
# Calculate inclusion of necessary dependencies based on features
|
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ set(HEADER_IMP_SOURCES
|
|
||||||
${PROJECT_SOURCE_DIR}/sources/PageAllocator.cpp)
|
|
||||||
|
|
||||||
# only build tests if making exe
|
|
||||||
-if(BUILD_DLL MATCHES OFF)
|
|
||||||
+if(BUILD_TOOLS)
|
|
||||||
set(UNIT_TEST_SOURCES
|
|
||||||
${PROJECT_SOURCE_DIR}/MainTests.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/UnitTests/TestDisassembler.cpp
|
|
||||||
@@ -62,7 +63,7 @@ if(FEATURE_DETOURS MATCHES ON)
|
|
||||||
set(HEADER_IMP_SOURCES ${HEADER_IMP_SOURCES} ${DETOUR_IMP_SOURCES})
|
|
||||||
|
|
||||||
# only build tests if making exe
|
|
||||||
- if(BUILD_DLL MATCHES OFF)
|
|
||||||
+ if(BUILD_TOOLS)
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
||||||
# 64 bits
|
|
||||||
set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES}
|
|
||||||
@@ -90,7 +91,7 @@ if(FEATURE_EXCEPTION MATCHES ON)
|
|
||||||
set(HEADER_IMP_SOURCES ${HEADER_IMP_SOURCES} ${EXCEPTION_IMP_SOURCES})
|
|
||||||
|
|
||||||
# only build tests if making exe
|
|
||||||
- if(BUILD_DLL MATCHES OFF)
|
|
||||||
+ if(BUILD_TOOLS)
|
|
||||||
set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES}
|
|
||||||
${PROJECT_SOURCE_DIR}/UnitTests/TestBreakpointHook.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/UnitTests/TestHWBreakpointHook.cpp)
|
|
||||||
@@ -110,7 +111,7 @@ if(FEATURE_VIRTUALS MATCHES ON)
|
|
||||||
set(HEADER_IMP_SOURCES ${HEADER_IMP_SOURCES} ${VIRTUAL_IMP_SOURCES})
|
|
||||||
|
|
||||||
# only build tests if making exe
|
|
||||||
- if(BUILD_DLL MATCHES OFF)
|
|
||||||
+ if(BUILD_TOOLS)
|
|
||||||
set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES}
|
|
||||||
${PROJECT_SOURCE_DIR}/UnitTests/TestVTableSwapHook.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/UnitTests/TestVFuncSwapHook.cpp)
|
|
||||||
@@ -131,7 +132,7 @@ if(FEATURE_PE MATCHES ON)
|
|
||||||
set(HEADER_IMP_SOURCES ${HEADER_IMP_SOURCES} ${PE_IMP_SOURCES})
|
|
||||||
|
|
||||||
# only build tests if making exe
|
|
||||||
- if(BUILD_DLL MATCHES OFF)
|
|
||||||
+ if(BUILD_TOOLS)
|
|
||||||
set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES}
|
|
||||||
${PROJECT_SOURCE_DIR}/UnitTests/TestEatHook.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/UnitTests/TestIatHook.cpp)
|
|
||||||
@@ -149,7 +150,7 @@ if(FEATURE_INLINENTD MATCHES ON)
|
|
||||||
set(HEADER_IMP_SOURCES ${HEADER_IMP_SOURCES} ${NTD_SOURCES})
|
|
||||||
|
|
||||||
# only build tests if making exe
|
|
||||||
- if(BUILD_DLL MATCHES OFF)
|
|
||||||
+ if(BUILD_TOOLS)
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
||||||
# 64 bits
|
|
||||||
set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES}
|
|
||||||
@@ -172,8 +173,10 @@ if(BUILD_DLL MATCHES ON)
|
|
||||||
else()
|
|
||||||
add_library(PolyHook_2 SHARED ${SOURCE_FILES_PLH})
|
|
||||||
endif()
|
|
||||||
-else()
|
|
||||||
- add_executable(PolyHook_2 ${SOURCE_FILES_PLH})
|
|
||||||
+endif()
|
|
||||||
+
|
|
||||||
+if(BUILD_TOOLS)
|
|
||||||
+ add_executable(PolyHook2_tool ${SOURCE_FILES_PLH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# add WALL + PDB flags
|
|
||||||
@@ -222,6 +225,12 @@ find_path(CAPSTONE_INCLUDE_DIR NAMES capstone/capstone.h)
|
|
||||||
target_link_libraries(${PROJECT_NAME} ${CAPSTONE_LIBRARY})
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CAPSTONE_INCLUDE_DIR})
|
|
||||||
|
|
||||||
+if(BUILD_TOOLS)
|
|
||||||
+ target_link_libraries(PolyHook2_tool ${CAPSTONE_LIBRARY})
|
|
||||||
+ target_include_directories(PolyHook2_tool PRIVATE ${CAPSTONE_INCLUDE_DIR})
|
|
||||||
+ install(TARGETS PolyHook2_tool DESTINATION tool)
|
|
||||||
+endif()
|
|
||||||
+
|
|
||||||
# ASMJIT
|
|
||||||
if(DEP_ASMJIT_NEED MATCHES ON)
|
|
||||||
# AsmJit is a dep iff inlinetd is on
|
|
@ -3,12 +3,11 @@ vcpkg_fail_port_install(ON_ARCH "arm" "arm64" ON_TARGET "Linux" "OSX" "UWP")
|
|||||||
vcpkg_from_github(
|
vcpkg_from_github(
|
||||||
OUT_SOURCE_PATH SOURCE_PATH
|
OUT_SOURCE_PATH SOURCE_PATH
|
||||||
REPO stevemk14ebr/PolyHook_2_0
|
REPO stevemk14ebr/PolyHook_2_0
|
||||||
REF 00709c8621af8a6f9e91200088178e6d9f751097
|
REF f5051a47888cc0960e6592f0c65dec2b214f9139
|
||||||
SHA512 c6fe9ef9e21de440556cbeb8269e13ef0daafcbc760b04a06e1689d181b6a097c4de9a0f364f7e10f8b0b2f3e419e0ede62aaf4a2a9b16eb2fb57d24eb1b9b5c
|
SHA512 a08f2433bfa26282458bb8327bb5fc366ac3f80eda4b40324d197ea58e11cc05d877b3ff2ea9fc13a269b1f9a051437dff5baec93be09d8df5f69a8e7f454d83
|
||||||
HEAD_REF master
|
HEAD_REF master
|
||||||
PATCHES
|
PATCHES
|
||||||
fix-build-error.patch
|
fix-build-error.patch
|
||||||
fix-build-tests-error.patch
|
|
||||||
)
|
)
|
||||||
|
|
||||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user