HyperDbg Debugger
Loading...
Searching...
No Matches
MetaMacros.h File Reference

Helper macros. More...

Go to the source code of this file.

Macros

#define MetaScopedExpr(Pre_, Post_, ScopedExpr_)
 
#define LIST_FOR_EACH(_head, _struct_type, _var)   _LIST_FOR_EACH(_head, _struct_type, Link, _var)
 
#define LIST_FOR_NEXT(_start, _head, _type, _var)   _LIST_FOR_NEXT(_start, _head, _type, Link, _var)
 
#define LIST_FOR_EACH_LINK(_head, _struct_type, _member, _var)   _LIST_FOR_EACH(_head, _struct_type, _member, _var)
 
#define HANDLE_TO_UINT32(_var)   (UINT32)((UINT64)_var & 0xffffffff)
 
#define PVOID_TO_BOOLEAN(_var)   (BOOLEAN)((UINT64)_var & 0xff)
 
#define _NEXT(_var, _member)   _var->_member.Flink
 
#define _NEXT_ENTRY(_var, _member, _type)   CONTAINING_RECORD(_NEXT(_var, _member), _type, _member)
 
#define PREPROC_CONCAT(a, b)   PREPROC_CONCAT_1(a, b)
 
#define PREPROC_CONCAT_1(a, b)   PREPROC_CONCAT_2(~, a##b)
 
#define PREPROC_CONCAT_2(p, res)   res
 
#define UNIQUE_NAME(base)   PREPROC_CONCAT(base, __LINE__)
 
#define _LIST_FOR_EACH(_head, _type, _member, _var)
 
#define _LIST_FOR_NEXT(_start, _head, _type, _member, _var)
 

Detailed Description

Helper macros.

Author
Behrooz Abbassi (Behro.nosp@m.ozAb.nosp@m.bassi.nosp@m.@hyp.nosp@m.erdbg.nosp@m..org)
Version
0.1
Date
2022-05-05

Macro Definition Documentation

◆ _LIST_FOR_EACH

#define _LIST_FOR_EACH ( _head,
_type,
_member,
_var )
Value:
for (_type * _var = CONTAINING_RECORD(_head.Flink, _type, _member), *UNIQUE_NAME(_n) = _NEXT_ENTRY(_var, _member, _type); \
&_var->_member != &_head; \
_var = UNIQUE_NAME(_n), UNIQUE_NAME(_n) = _NEXT_ENTRY(_var, _member, _type))
#define _NEXT_ENTRY(_var, _member, _type)
Definition MetaMacros.h:46
#define UNIQUE_NAME(base)
Definition MetaMacros.h:52
54#define _LIST_FOR_EACH(_head, _type, _member, _var) \
55 for (_type * _var = CONTAINING_RECORD(_head.Flink, _type, _member), *UNIQUE_NAME(_n) = _NEXT_ENTRY(_var, _member, _type); \
56 &_var->_member != &_head; \
57 _var = UNIQUE_NAME(_n), UNIQUE_NAME(_n) = _NEXT_ENTRY(_var, _member, _type))

◆ _LIST_FOR_NEXT

#define _LIST_FOR_NEXT ( _start,
_head,
_type,
_member,
_var )
Value:
for (_type * _var = _NEXT_ENTRY(_start, _member, _type), *UNIQUE_NAME(_n) = _NEXT_ENTRY(_var, _member, _type); \
&_var->_member != &_head; \
_var = UNIQUE_NAME(_n), UNIQUE_NAME(_n) = _NEXT_ENTRY(_var, _member, _type))
59#define _LIST_FOR_NEXT(_start, _head, _type, _member, _var) \
60 for (_type * _var = _NEXT_ENTRY(_start, _member, _type), *UNIQUE_NAME(_n) = _NEXT_ENTRY(_var, _member, _type); \
61 &_var->_member != &_head; \
62 _var = UNIQUE_NAME(_n), UNIQUE_NAME(_n) = _NEXT_ENTRY(_var, _member, _type))

◆ _NEXT

#define _NEXT ( _var,
_member )   _var->_member.Flink

◆ _NEXT_ENTRY

#define _NEXT_ENTRY ( _var,
_member,
_type )   CONTAINING_RECORD(_NEXT(_var, _member), _type, _member)

◆ HANDLE_TO_UINT32

#define HANDLE_TO_UINT32 ( _var)    (UINT32)((UINT64)_var & 0xffffffff)

◆ LIST_FOR_EACH

#define LIST_FOR_EACH ( _head,
_struct_type,
_var )   _LIST_FOR_EACH(_head, _struct_type, Link, _var)

◆ LIST_FOR_EACH_LINK

#define LIST_FOR_EACH_LINK ( _head,
_struct_type,
_member,
_var )   _LIST_FOR_EACH(_head, _struct_type, _member, _var)

◆ LIST_FOR_NEXT

#define LIST_FOR_NEXT ( _start,
_head,
_type,
_var )   _LIST_FOR_NEXT(_start, _head, _type, Link, _var)

◆ MetaScopedExpr

#define MetaScopedExpr ( Pre_,
Post_,
ScopedExpr_ )
Value:
do \
{ \
Pre_; \
ScopedExpr_; \
Post_; \
} while (FALSE);
#define FALSE
Definition BasicTypes.h:54
14#define MetaScopedExpr(Pre_, Post_, ScopedExpr_) \
15 do \
16 { \
17 Pre_; \
18 ScopedExpr_; \
19 Post_; \
20 } while (FALSE);

◆ PREPROC_CONCAT

#define PREPROC_CONCAT ( a,
b )   PREPROC_CONCAT_1(a, b)

◆ PREPROC_CONCAT_1

#define PREPROC_CONCAT_1 ( a,
b )   PREPROC_CONCAT_2(~, a##b)

◆ PREPROC_CONCAT_2

#define PREPROC_CONCAT_2 ( p,
res )   res

◆ PVOID_TO_BOOLEAN

#define PVOID_TO_BOOLEAN ( _var)    (BOOLEAN)((UINT64)_var & 0xff)

◆ UNIQUE_NAME

#define UNIQUE_NAME ( base)    PREPROC_CONCAT(base, __LINE__)