-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathMacros.h
35 lines (28 loc) · 867 Bytes
/
Macros.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
/*!
*
* MINBEACON
*
* GuidePoint Security LLC
*
* Threat and Attack Simulation Team
*
!*/
#pragma once
/* Finds a function / variable / string address via its relative offset to GetIp() */
#define G_PTR( x ) ( ULONG_PTR )( GetIp( ) - ( ( ULONG_PTR ) & GetIp - ( ULONG_PTR ) x ) )
/* Cast as a function / variable / string in a specific region of memory */
#define D_SEC( x ) __attribute__(( section( ".text$" #x ) ))
/* Cast as a pointer with the specified typedef */
#define D_API( x ) __typeof__( x ) * x
/* Cast as a pointer-wide integer */
#define U_PTR( x ) ( ( ULONG_PTR) x )
/* Cast as a pointer */
#define C_PTR( x ) ( ( PVOID ) x )
/* Arch Specific Macros */
#if defined( _WIN64 )
/* Get the end of code: x64 */
#define G_END( x ) U_PTR( GetIp( ) + 11 )
#else
/* Get the end of code: x86 */
#define G_END( x ) U_PTR( GetIp( ) + 10 )
#endif