HyperDbg Debugger
Loading...
Searching...
No Matches
pch.h
Go to the documentation of this file.
1
12#pragma once
13
14//
15// Environment headers
16//
18
19//
20// Windows SDK headers
21//
22#define WIN32_LEAN_AND_MEAN
23
24//
25// IA32-doc has structures for the entire intel SDM.
26//
27
28#define USE_LIB_IA32
29#if defined(USE_LIB_IA32)
30# pragma warning(push, 0)
31// # pragma warning(disable : 4201) // suppress nameless struct/union warning
32# include <ia32-doc/out/ia32.h>
33# pragma warning(pop)
34typedef RFLAGS * PRFLAGS;
35#endif // USE_LIB_IA32
36
37//
38// Native API header files for the Process Hacker project.
39//
40// #define USE__NATIVE_PHNT_HEADERS
41#define USE_NATIVE_SDK_HEADERS
42#define _AMD64_
43
44
45#ifdef _WIN32
46#if defined(USE__NATIVE_PHNT_HEADERS)
47
48//
49// Dirty fix: the "PCWCHAR" in undefined in "ntrtl.h" so I deifined it here.
50//
51typedef const wchar_t *LPCWCHAR, *PCWCHAR;
52
53# define PHNT_MODE PHNT_MODE_USER
54# define PHNT_VERSION PHNT_WIN11 // Windows 11
55# define PHNT_PATCH_FOR_HYPERDBG TRUE
56
57# include <phnt/phnt_windows.h>
58# include <phnt/phnt.h>
59
60#elif defined(USE_NATIVE_SDK_HEADERS)
61
62# include <winternl.h>
63# include <Windows.h>
64# include <winioctl.h>
66
67#endif
68
69#endif //_WIN32
70
71#ifdef _WIN32
72# include <winsock2.h>
73# include <ws2tcpip.h>
74# include <strsafe.h>
75# include <shlobj.h>
76# include <tchar.h>
77# include <tlhelp32.h>
78# include <shlwapi.h>
79# include <VersionHelpers.h>
80# include <psapi.h>
81# include <conio.h>
82# include <intrin.h>
83#endif
84#include <time.h>
85#include <inttypes.h>
86#include <stdio.h>
87#include <stdlib.h>
88
89//
90// STL headers
91//
92#include <algorithm>
93#include <string>
94#include <vector>
95#include <array>
96#include <bitset>
97#include <iomanip>
98#include <iostream>
99#include <iterator>
100#include <sstream>
101#include <fstream>
102#include <map>
103#include <numeric>
104#include <list>
105#include <locale>
106#include <memory>
107#include <cctype>
108#include <cstring>
109#include <unordered_set>
110#include <regex>
111
112//
113// Scope definitions
114//
115#define SCRIPT_ENGINE_USER_MODE
116#define HYPERDBG_USER_MODE
117#define HYPERDBG_LIBHYPERDBG
118
119//
120// Zydis Debug Disable Flag
121//
122#ifndef NDEBUG
123# define NDEBUG
124#endif // !NDEBUG
125
126//
127// HyperDbg defined headers
128//
129#include "config/Configuration.h"
130#include "config/Definition.h"
131#include "SDK/HyperDbgSdk.h"
132
133//
134// Keystone
135//
136#include "keystone/keystone.h"
137
138//
139// Script-engine
140//
142
143//
144// Imports/Exports
145//
146#include "SDK/imports/user/HyperDbgScriptImports.h"
147#include "SDK/imports/user/HyperDbgLibImports.h"
148
149//
150// Platform lib calls (cross-platform wrappers)
151//
153
154//
155// Platform intrinsics (cross-platform CPU instructions and atomic ops)
156//
158
159//
160// Platform serial transport (cross-platform kernel-debugger serial I/O)
161//
163
164//
165// Platform IOCTL transport (cross-platform local kernel-driver device I/O)
166//
168
169//
170// Platform signal (cross-platform console-control / CTRL+C handler registration)
171//
173
174//
175// NT-style intrusive linked-list helpers + CONTAINING_RECORD (self-guards to
176// non-Windows; Windows gets these from <windows.h> / the native-SDK shim)
177//
179
180//
181// Platform-specific intrinsics
182//
183#ifdef _WIN32
185#endif
186
187//
188// PCI IDs
189//
190#include "header/pci-id.h"
191
192//
193// General
194//
195#include "header/libhyperdbg.h"
196#include "header/export.h"
197#include "header/inipp.h"
198#include "header/commands.h"
199#include "header/common.h"
200#include "header/symbol.h"
201#include "header/debugger.h"
202#include "header/script-engine.h"
203#include "header/help.h"
204#ifdef _WIN32
205# include "header/install.h"
206#endif
207#include "header/list.h"
208#include "header/tests.h"
209#include "header/messaging.h"
210#include "header/packets.h"
211#include "header/transparency.h"
212#include "header/communication.h"
213#include "header/namedpipe.h"
214#include "header/forwarding.h"
215#include "header/kd.h"
216
217//
218// Components
219//
221
222#include "header/pe-parser.h"
223#include "header/ud.h"
224#include "header/objects.h"
225#include "header/steppings.h"
226#include "header/rev-ctrl.h"
227#include "header/assembler.h"
228
229//
230// hwdbg
231//
233#include "header/hwdbg-scripts.h"
234
235//
236// Libraries
237//
238
239#ifdef HYPERDBG_ENV_WINDOWS
240
241# pragma comment(lib, "ntdll.lib")
242
243//
244// For path combine
245//
246# pragma comment(lib, "Shlwapi.lib")
247
248//
249// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
250// for tcpclient.cpp and tcpserver.cpp
251//
252# pragma comment(lib, "Ws2_32.lib")
253# pragma comment(lib, "Mswsock.lib")
254# pragma comment(lib, "AdvApi32.lib")
255
256//
257// For GetModuleFileNameExA on script-engine for user-mode
258// Kernel32.lib is not needed, but seems that it's the library
259// for Windows 7
260//
261# pragma comment(lib, "Psapi.lib")
262# pragma comment(lib, "Kernel32.lib")
263
264#endif // HYPERDBG_ENV_WINDOWS
Global configuration that applies on compile time.
Header files for global definitions.
The running environment of HyperDbg.
Headers for exported script engine headers.
Windows specific headers.
Headers for turning assembly codes into bytes.
The hyperdbg command interpreter and driver connector.
headers for controller of the reversing machine's module
Headers for event source forwarding.
help of commands header
Headers for the interpreter of hwdbg packets and requests.
Headers for the hardware scripts for hwdbg.
RFLAGS * PRFLAGS
Definition pch.h:34
Main interface to connect applications to driver headers.
header for HyperDbg's general functions for reading and converting and etc
General debugger functions.
routines for remote kernel debugging
headers for test functions
headers for user-mode debugging routines
Named pipe communication headers.
General script-engine functions and wrappers.
headers for libhyperdbg
The list working functions headers.
headers for messaging functions
Cross-platform NT-style intrusive doubly-linked list helpers + CONTAINING_RECORD.
Header for routines related to objects.
headers for kernel packet functions
PCI ID-related data structures.
Bounded in-memory Portable Executable reader.
Header for Portable Executable parser.
User mode Cross platform APIs for intrinsic functions (x86 instructions).
User mode cross-platform interface for the local kernel-driver IOCTL transport.
User mode Cross platform APIs for platofrm dependend library calls.
User mode cross-platform interface for the kernel-debugger serial transport.
User mode cross-platform interface for the console-control (CTRL+C / CTRL+BREAK) handler.
headers for controller of the reversing machine's module
headers for stepping instructions
Symbol related functions header.
headers for test functions
Windows only APIs for adjusting privileges.