-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCBasePattern.hpp
More file actions
52 lines (44 loc) · 1.36 KB
/
Copy pathCBasePattern.hpp
File metadata and controls
52 lines (44 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#include <Common/Common.hpp>
enum eBasePatternSearchType : int32_t
{
SEARCH_TYPE_NONE ,
SEARCH_TYPE_PTR ,
SEARCH_TYPE_CALL ,
SEARCH_TYPE_PTR2 ,
SEARCH_TYPE_PROC
};
class IBasePattern
{
public:
virtual bool Search( bool SkipError ) = 0;
virtual PVOID GetFunction() = 0;
virtual const char* GetPatternName() = 0;
virtual const char* GetDllName() = 0;
};
class CBasePattern final : public IBasePattern
{
public:
CBasePattern( const char* szPatternName , const char* szPattern , const char* szDll , uint32_t Offset = 0 , eBasePatternSearchType Type = eBasePatternSearchType::SEARCH_TYPE_NONE );
public:
virtual bool Search( bool SkipError = false ) override;
virtual PVOID GetFunction() override;
virtual const char* GetPatternName() override;
virtual const char* GetDllName() override;
private:
// !!! std::string_view crash on vmprotect !!!
const char* PatternName = nullptr;
const char* Pattern = nullptr;
const char* Dll = nullptr;
private:
PVOID pFunction = nullptr;
uint32_t dwOffset = 0;
eBasePatternSearchType m_Type = eBasePatternSearchType::SEARCH_TYPE_NONE;
};
#define DECLARATE_DEADLOCK_FUNCTION(Ret,Name,Decl,InterfaceSearch,DeclFn,ParamCall)\
Ret Name Decl\
{\
using Fn = Ret ( __fastcall* ) DeclFn;\
Fn Original = reinterpret_cast<Fn>( ##InterfaceSearch##_Search::##Name##Fn.GetFunction() );\
return Original##ParamCall##;\
}