mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-04-19 05:32:55 +00:00
Create include file
This commit is contained in:
parent
8b4c277f11
commit
083e67e1d7
18
src/include/hyperhook.h
Normal file
18
src/include/hyperhook.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef EXTERN_C
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN_C extern "C"
|
||||
#else
|
||||
#define EXTERN_C
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DLL_IMPORT
|
||||
#define DLL_IMPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
EXTERN_C DLL_IMPORT
|
||||
int hyperhook_initialize();
|
||||
|
||||
EXTERN_C DLL_IMPORT
|
||||
int hyperhook_write(unsigned int process_id, unsigned long long address, const void* data,
|
||||
unsigned long long size);
|
@ -15,6 +15,10 @@ target_link_libraries(library PRIVATE
|
||||
driver_file
|
||||
)
|
||||
|
||||
target_include_directories(library PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||
)
|
||||
|
||||
set_source_files_properties(resource.rc PROPERTIES LANGUAGE RC)
|
||||
target_sources(library PRIVATE
|
||||
resource.rc
|
||||
|
@ -1,18 +1,19 @@
|
||||
#include "std_include.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <conio.h>
|
||||
#include <set>
|
||||
|
||||
#include "driver.hpp"
|
||||
#include "driver_device.hpp"
|
||||
#include <driver_file.h>
|
||||
#include <irp_data.hpp>
|
||||
|
||||
#include "resource.hpp"
|
||||
#include "utils/io.hpp"
|
||||
|
||||
void patch_data(const driver_device& driver_device, const uint32_t pid, const uint64_t address, const uint8_t* buffer,
|
||||
#define DLL_IMPORT __declspec(dllexport)
|
||||
#include <hyperhook.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
void patch_data(const driver_device& driver_device, const uint32_t pid, const uint64_t address,
|
||||
const uint8_t* buffer,
|
||||
const size_t length)
|
||||
{
|
||||
hook_request hook_request{};
|
||||
@ -56,8 +57,8 @@ driver_device& get_driver_device()
|
||||
|
||||
return device;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport)
|
||||
int hyperhook_initialize()
|
||||
{
|
||||
try
|
||||
@ -76,8 +77,6 @@ int hyperhook_initialize()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
extern "C" __declspec(dllexport)
|
||||
int hyperhook_write(const unsigned int process_id, const unsigned long long address, const void* data,
|
||||
const unsigned long long size)
|
||||
{
|
||||
|
@ -1 +0,0 @@
|
||||
#pragma once
|
@ -8,7 +8,6 @@
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "windows.h"
|
||||
#include "resource.hpp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
@ -5,10 +5,13 @@
|
||||
#include <mutex>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
|
||||
#include <Windows.h>
|
||||
#include <Shlwapi.h>
|
||||
#include <ShlObj.h>
|
||||
#include <Psapi.h>
|
||||
#include <conio.h>
|
||||
|
||||
#pragma comment(lib, "Shlwapi.lib")
|
||||
|
@ -6,10 +6,6 @@ add_executable(runner #WIN32
|
||||
${runner_headers}
|
||||
)
|
||||
|
||||
target_precompile_headers(runner PRIVATE
|
||||
std_include.hpp
|
||||
)
|
||||
|
||||
set_property(TARGET runner APPEND_STRING PROPERTY LINK_FLAGS " /MANIFESTUAC:\"level='requireAdministrator'\"")
|
||||
|
||||
target_link_libraries(runner PRIVATE
|
||||
|
@ -1,17 +1,13 @@
|
||||
#include "std_include.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <conio.h>
|
||||
#include <set>
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "resource.hpp"
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
|
||||
extern "C" __declspec(dllimport)
|
||||
int hyperhook_initialize();
|
||||
#include <hyperhook.h>
|
||||
|
||||
extern "C" __declspec(dllimport)
|
||||
int hyperhook_write(unsigned int process_id, unsigned long long address, const void* data,
|
||||
unsigned long long size);
|
||||
|
||||
bool patch_data(const uint32_t process_id, const uint64_t address, const void* buffer,
|
||||
const size_t length)
|
||||
|
@ -1 +0,0 @@
|
||||
#pragma once
|
@ -8,7 +8,6 @@
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "windows.h"
|
||||
#include "resource.hpp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
|
||||
#include <Windows.h>
|
||||
#include <Shlwapi.h>
|
||||
#include <ShlObj.h>
|
||||
#include <Psapi.h>
|
||||
|
||||
#pragma comment(lib, "Shlwapi.lib")
|
Loading…
x
Reference in New Issue
Block a user