HyperDbg Debugger
Loading...
Searching...
No Matches
Common.h
Go to the documentation of this file.
1
13#pragma once
14
16// External Functions //
18
19UCHAR *
20PsGetProcessImageFileName(IN PEPROCESS Process);
21
22PVOID
23PsGetProcessSectionBaseAddress(PEPROCESS Process); // Used to get the base address of process's executable image
24
25NTKERNELAPI NTSTATUS NTAPI
27 PACCESS_STATE AccessState,
28 PVOID AuxData,
29 ACCESS_MASK DesiredAccess,
30 PGENERIC_MAPPING Mapping);
31
32NTKERNELAPI VOID NTAPI
34 PACCESS_STATE AccessState);
35
36NTSTATUS
37MmUnmapViewOfSection(PEPROCESS Process, PVOID BaseAddress); // Used to unmap process's executable image
38
40// Windows-specific structures //
42
47typedef struct _NT_KPROCESS
48{
49 DISPATCHER_HEADER Header;
50 LIST_ENTRY ProfileListHead;
51 ULONG_PTR DirectoryTableBase;
52 UCHAR Data[1];
54
56// Enums //
58
70
72// Constants //
74
75/*
76 * @brief Segment register and corresponding GDT meaning in Windows
77 */
78#define KGDT64_NULL (0 * 16) // NULL descriptor
79#define KGDT64_R0_CODE (1 * 16) // kernel mode 64-bit code
80#define KGDT64_R0_DATA (1 * 16) + 8 // kernel mode 64-bit data (stack)
81#define KGDT64_R3_CMCODE (2 * 16) // user mode 32-bit code
82#define KGDT64_R3_DATA (2 * 16) + 8 // user mode 32-bit data
83#define KGDT64_R3_CODE (3 * 16) // user mode 64-bit code
84#define KGDT64_SYS_TSS (4 * 16) // kernel mode system task state
85#define KGDT64_R3_CMTEB (5 * 16) // user mode 32-bit TEB
86#define KGDT64_R0_CMCODE (6 * 16) // kernel mode 32-bit code
87#define KGDT64_LAST (7 * 16) // last entry
88
90// Loader Functions //
92
95
96PCHAR
98
100CommonKillProcess(UINT32 ProcessId, PROCESS_KILL_METHODS KillingMethod);
101
UCHAR BOOLEAN
Definition BasicTypes.h:39
unsigned char UCHAR
Definition BasicTypes.h:35
#define VOID
Definition BasicTypes.h:33
unsigned int UINT32
Definition BasicTypes.h:48
PHANDLE ACCESS_MASK DesiredAccess
Definition Hooks.h:130
struct _NT_KPROCESS * PNT_KPROCESS
PCHAR CommonGetProcessNameFromProcessControlBlock(PEPROCESS eprocess)
Get process name by eprocess.
Definition Common.c:48
struct _NT_KPROCESS NT_KPROCESS
KPROCESS Brief structure.
UCHAR * PsGetProcessImageFileName(IN PEPROCESS Process)
NTSTATUS MmUnmapViewOfSection(PEPROCESS Process, PVOID BaseAddress)
BOOLEAN CommonValidateCoreNumber(UINT32 CoreNumber)
Validate core number.
Definition Common.c:256
BOOLEAN CommonKillProcess(UINT32 ProcessId, PROCESS_KILL_METHODS KillingMethod)
Kill a user-mode process with different methods.
Definition Common.c:159
_PROCESS_KILL_METHODS
Different methods of killing a process.
Definition Common.h:64
@ PROCESS_KILL_METHOD_2
Definition Common.h:66
@ PROCESS_KILL_METHOD_1
Definition Common.h:65
@ PROCESS_KILL_METHOD_3
Definition Common.h:67
NTKERNELAPI VOID NTAPI SeDeleteAccessState(PACCESS_STATE AccessState)
enum _PROCESS_KILL_METHODS PROCESS_KILL_METHODS
Different methods of killing a process.
BOOLEAN CommonIsProcessExist(UINT32 ProcId)
Checks whether the process with ProcId exists or not.
Definition Common.c:24
PVOID PsGetProcessSectionBaseAddress(PEPROCESS Process)
NTKERNELAPI NTSTATUS NTAPI SeCreateAccessState(PACCESS_STATE AccessState, PVOID AuxData, ACCESS_MASK DesiredAccess, PGENERIC_MAPPING Mapping)
KPROCESS Brief structure.
Definition Common.h:265
ULONG_PTR DirectoryTableBase
Definition Common.h:268
UCHAR Data[1]
Definition Common.h:269
DISPATCHER_HEADER Header
Definition Common.h:266
LIST_ENTRY ProfileListHead
Definition Common.h:267