BlackBone
Windows memory hacking library
 All Classes Functions
ProcessCore.h
1 #pragma once
2 
3 #include "../Include/NativeStructures.h"
4 #include "../Subsystem/Wow64Subsystem.h"
5 #include "../Subsystem/x86Subsystem.h"
6 
7 #include <memory>
8 #include <stdint.h>
9 
10 namespace blackbone
11 {
12 
14 {
15  friend class Process;
16 
17  typedef std::unique_ptr<Native> ptrNative;
18 
19 public:
20 
25  BLACKBONE_API inline bool isWow64() const { return _native->GetWow64Barrier().targetWow64; }
26 
31  BLACKBONE_API inline HANDLE handle() const { return _hProcess; }
32 
37  BLACKBONE_API inline DWORD pid() const { return _pid; }
38 
43  BLACKBONE_API inline bool DEP() const { return _dep; };
44 
49  BLACKBONE_API inline Native* native() { return _native.get(); }
50 
56  BLACKBONE_API inline ptr_t peb( _PEB32* ppeb ) { return _native->getPEB( ppeb ); }
57 
63  BLACKBONE_API inline ptr_t peb( _PEB64* ppeb ) { return _native->getPEB( ppeb ); }
64 
70  BLACKBONE_API inline ptr_t peb() { return peb( (PEB_T*)nullptr ); }
71 
76  BLACKBONE_API bool isProtected();
77 
78 private:
79  ProcessCore();
80  ProcessCore( const ProcessCore& ) = delete;
81  ~ProcessCore();
82 
89  NTSTATUS Open( DWORD pid, DWORD access );
90 
96  NTSTATUS Open( HANDLE handle );
97 
102  NTSTATUS Init();
103 
107  void Close();
108 
109 private:
110  HANDLE _hProcess = NULL; // Process handle
111  DWORD _pid = 0; // Process ID
112  ptrNative _native; // Api wrapper
113  bool _dep = true; // DEP state for process
114 };
115 
116 }
Definition: NativeSubsystem.h:27
BLACKBONE_API ptr_t peb()
Get PEB
Definition: ProcessCore.h:70
BLACKBONE_API ptr_t peb(_PEB64 *ppeb)
Get native PEB
Definition: ProcessCore.h:63
BLACKBONE_API bool DEP() const
Get process data execution prevention state
Definition: ProcessCore.h:43
Definition: NativeStructures.h:174
BLACKBONE_API bool isProtected()
Check if process is a protected process
Definition: ProcessCore.cpp:128
BLACKBONE_API DWORD pid() const
Get process ID
Definition: ProcessCore.h:37
Definition: Process.h:80
BLACKBONE_API bool isWow64() const
Check if target process is running in WOW64 mode
Definition: ProcessCore.h:25
BLACKBONE_API ptr_t peb(_PEB32 *ppeb)
Get WOW64 PEB
Definition: ProcessCore.h:56
Definition: ProcessCore.h:13
BLACKBONE_API Native * native()
Get system routines
Definition: ProcessCore.h:49
BLACKBONE_API HANDLE handle() const
Get process handle
Definition: ProcessCore.h:31
Definition: AsmHelper32.cpp:6