#ifndef __OBFUSCATOR_H
#define __OBFUSCATOR_H


#include "Windas.h"
#include "XedWrap.h"
#include "NativeCode.h"
#include "Jit.h"
#include "OpaqueBranching.h"

#define OBF_ATTRIBUTE_JIT				(1<<0)
#define OBF_ATTRIBUTE_OPAQUE_BRANCHES	(1<<1)
#define OBF_ATTRIBUTE_RANDOMIZE_DIVISOR	(1<<2)

typedef struct _OPBR_SETS
{
	ULONG MaxDepth;
	ULONG MinBranchSize;
	FLOAT Divisor;
	ULONG Flags;
	ULONG MinDepthForBranch;
	ULONG ChanceForBranch;
	PNATIVE_CODE_BLOCK ParentBlock;
}OPBR_SETS, *POPBR_SETS;

typedef struct _INSTMUT_SETS
{
	ULONG MutateStart;
	ULONG MutateChance;
}INSTMUT_SETS, *PINSTMUT_SETS;

//Recursive obfuscation routine using opaque branches and jit
VOID ObfGenerateOpaqueBranches(POPBR_SETS Obf, PNATIVE_CODE_BLOCK Block, ULONG Depth = 0);

VOID ObfMutateInstructions(PINSTMUT_SETS Obf, PNATIVE_CODE_BLOCK Block);

#endif