-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
101 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,17 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
config: | ||
- name: 'Windows' | ||
id: win | ||
- name: 'Windows (32-bit)' | ||
id: win-32 | ||
arch: x86 | ||
os: windows-latest | ||
build_tests: true | ||
extra_flags: '-DCMAKE_BUILD_TYPE=Debug' | ||
out_paths: './build/src/TulipHook.lib' | ||
|
||
- name: 'Windows (64-bit)' | ||
id: win-64 | ||
arch: x64 | ||
os: windows-latest | ||
build_tests: true | ||
extra_flags: '-DCMAKE_BUILD_TYPE=Debug' | ||
|
@@ -65,8 +74,8 @@ jobs: | |
- name: Setup MSVC | ||
uses: ilammy/[email protected] | ||
with: | ||
arch: x86 | ||
if: matrix.config.id == 'win' | ||
arch: ${{ matrix.config.arch }} | ||
if: matrix.config.id == 'win-32' || matrix.config.id == 'win-64' | ||
|
||
# https://github.com/hendrikmuhs/ccache-action/pull/182 | ||
- name: Setup sccache | ||
|
@@ -77,7 +86,7 @@ jobs: | |
|
||
- name: Install ninja-build tool | ||
uses: seanmiddleditch/gha-setup-ninja@v3 | ||
if: matrix.config.id != 'win' | ||
if: matrix.config.id != 'win-32' && matrix.config.id != 'win-64' | ||
|
||
- name: Configure | ||
shell: bash | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "Windows64Target.hpp" | ||
|
||
#include <Platform.hpp> | ||
|
||
using namespace tulip::hook; | ||
|
||
#if defined(TULIP_HOOK_WINDOWS) && defined(TULIP_HOOK_X64) | ||
|
||
Target& Target::get() { | ||
static Windows64Target ret; | ||
return ret; | ||
} | ||
|
||
Result<csh> Windows64Target::openCapstone() { | ||
cs_err status; | ||
|
||
status = cs_open(CS_ARCH_X86, CS_MODE_64, &m_capstone); | ||
if (status != CS_ERR_OK) { | ||
return Err("Couldn't open capstone"); | ||
} | ||
|
||
return Ok(m_capstone); | ||
} | ||
|
||
std::unique_ptr<HandlerGenerator> Windows64Target::getHandlerGenerator( | ||
void* address, void* trampoline, void* handler, void* content, void* wrapped, HandlerMetadata const& metadata | ||
) { | ||
return std::make_unique<X64HandlerGenerator>(address, trampoline, handler, content, wrapped, metadata); | ||
} | ||
|
||
std::unique_ptr<WrapperGenerator> Windows64Target::getWrapperGenerator(void* address, WrapperMetadata const& metadata) { | ||
return std::make_unique<X64WrapperGenerator>(address, metadata); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <Platform.hpp> | ||
|
||
#if defined(TULIP_HOOK_WINDOWS) && defined(TULIP_HOOK_X64) | ||
|
||
#include "../generator/X86Generator.hpp" | ||
#include "Windows32Target.hpp" | ||
|
||
namespace tulip::hook { | ||
class Windows64Target : public Windows32Target { | ||
public: | ||
using Target::Target; | ||
|
||
Result<csh> openCapstone() override; | ||
|
||
std::unique_ptr<HandlerGenerator> getHandlerGenerator( | ||
void* address, void* trampoline, void* handler, void* content, void* wrapped, HandlerMetadata const& metadata | ||
) override; | ||
std::unique_ptr<WrapperGenerator> getWrapperGenerator(void* address, WrapperMetadata const& metadata) override; | ||
}; | ||
} | ||
|
||
#endif |