BlackBone
Windows memory hacking library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
VadHelpers.h
Go to the documentation of this file.
1 #pragma once
2 
3 #define SANITIZE_PARENT_NODE(Parent) ((PMMADDRESS_NODE)(((ULONG_PTR)(Parent)) & ~0x3))
4 
5 //
6 // Various Rtl macros that reference Parent use private versions here since
7 // Parent is overloaded with Balance.
8 //
9 
10 //
11 // The macro function Parent takes as input a pointer to a splay link in a
12 // tree and returns a pointer to the splay link of the parent of the input
13 // node. If the input node is the root of the tree the return value is
14 // equal to the input value.
15 //
16 // PRTL_SPLAY_LINKS
17 // MiParent (
18 // PRTL_SPLAY_LINKS Links
19 // );
20 //
21 
22 #define MiParent(Links) ( \
23  (PRTL_SPLAY_LINKS)(SANITIZE_PARENT_NODE((Links)->u1.Parent)) \
24  )
25 
26 //
27 // The macro function IsLeftChild takes as input a pointer to a splay link
28 // in a tree and returns TRUE if the input node is the left child of its
29 // parent, otherwise it returns FALSE.
30 //
31 // BOOLEAN
32 // MiIsLeftChild (
33 // PRTL_SPLAY_LINKS Links
34 // );
35 //
36 
37 #define MiIsLeftChild(Links) ( \
38  (RtlLeftChild(MiParent(Links)) == (PRTL_SPLAY_LINKS)(Links)) \
39  )
40 
41 //
42 // The macro function IsRightChild takes as input a pointer to a splay link
43 // in a tree and returns TRUE if the input node is the right child of its
44 // parent, otherwise it returns FALSE.
45 //
46 // BOOLEAN
47 // MiIsRightChild (
48 // PRTL_SPLAY_LINKS Links
49 // );
50 //
51 
52 #define MiIsRightChild(Links) ( \
53  (RtlRightChild(MiParent(Links)) == (PRTL_SPLAY_LINKS)(Links)) \
54  )
55 
56 #define MI_MAKE_PARENT(ParentNode, ExistingBalance) \
57  (PMMADDRESS_NODE)((ULONG_PTR)(ParentNode) | (((ULONG_PTR)ExistingBalance) & 0x3))
58 
59 #define COUNT_BALANCE_MAX(a)
60 
61 
62 TABLE_SEARCH_RESULT MiFindNodeOrParent( IN PMM_AVL_TABLE Table, IN ULONG_PTR StartingVpn, OUT PMMADDRESS_NODE *NodeOrParent );
64 ULONG MiRebalanceNode( IN PMMADDRESS_NODE S );
65 VOID MiInsertNode( IN PMMADDRESS_NODE NodeToInsert, IN PMM_AVL_TABLE Table );
66 VOID MiRemoveNode( IN PMMADDRESS_NODE NodeToDelete, IN PMM_AVL_TABLE Table );
VOID MiInsertNode(IN PMMADDRESS_NODE NodeToInsert, IN PMM_AVL_TABLE Table)
ULONG MiRebalanceNode(IN PMMADDRESS_NODE S)
Definition: VadHelpers.c:139
VOID MiPromoteNode(IN PMMADDRESS_NODE C)
Definition: VadHelpers.c:11
VOID MiRemoveNode(IN PMMADDRESS_NODE NodeToDelete, IN PMM_AVL_TABLE Table)
Definition: VadHelpers.c:522
TABLE_SEARCH_RESULT MiFindNodeOrParent(IN PMM_AVL_TABLE Table, IN ULONG_PTR StartingVpn, OUT PMMADDRESS_NODE *NodeOrParent)
Definition: VadHelpers.c:788
typedef VOID(NTAPI *PKNORMAL_ROUTINE)(PVOID NormalContext
Definition: NativeStructs7.h:111
Definition: NativeStructs7.h:101