-
Notifications
You must be signed in to change notification settings - Fork 1
/
nt.h
85 lines (71 loc) · 2.12 KB
/
nt.h
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*++
Copyright (c) 2019 changeofpace. All rights reserved.
Use of this source code is governed by the MIT license. See the 'LICENSE' file
for more information.
--*/
#pragma once
#include <fltKernel.h>
//=============================================================================
// Macros
//=============================================================================
#define OFFSET_POINTER(Pointer, Offset, Type) \
((Type*)(((PUCHAR)(Pointer)) + (Offset)))
#define POINTER_OFFSET(Offset, Base) \
((SIZE_T)(((ULONG_PTR)(Offset)) - ((ULONG_PTR)(Base))))
//=============================================================================
// Globals
//=============================================================================
EXTERN_C POBJECT_TYPE* IoDriverObjectType;
//=============================================================================
// Object Interface
//=============================================================================
EXTERN_C
NTSTATUS
NTAPI
ObReferenceObjectByName(
_In_ PUNICODE_STRING ObjectName,
_In_ ULONG Attributes,
_In_opt_ PACCESS_STATE AccessState,
_In_opt_ ACCESS_MASK DesiredAccess,
_In_ POBJECT_TYPE ObjectType,
_In_ KPROCESSOR_MODE AccessMode,
_Inout_opt_ PVOID ParseContext,
_Out_ PVOID* Object
);
//=============================================================================
// Process Interface
//=============================================================================
EXTERN_C
PUCHAR
NTAPI
PsGetProcessImageFileName(
_In_ PEPROCESS Process
);
EXTERN_C
NTSTATUS
NTAPI
PsAcquireProcessExitSynchronization(
_In_ PEPROCESS Process
);
EXTERN_C
VOID
NTAPI
PsReleaseProcessExitSynchronization(
_In_ PEPROCESS Process
);
//=============================================================================
// Rtl Interface
//=============================================================================
EXTERN_C
PIMAGE_NT_HEADERS
NTAPI
RtlImageNtHeader(
_In_ PVOID ImageBase
);
EXTERN_C
PVOID
NTAPI
RtlPcToFileHeader(
_In_ PVOID PcValue,
_Out_ PVOID* BaseOfImage
);