group copying/building

master
James 3 years ago
parent 273401b754
commit 386b7d8849

@ -347,12 +347,30 @@ bool obf_gen_label(pobfuscator_t obf, pcode_link_t jmp, int32_t delta)
bool obf_allocate_group_buffers(pobfuscator_t obf, FnAllocateMem AllocMem)
{
for (code_group_t& group : obf->groups)
{
group.base_address = (uint64_t)AllocMem(group.size_in_bytes);
if (!group.base_address)
return false;
}
return true;
}
bool obf_copy_groups_into_buffers(pobfuscator_t obf, FnMemCopy MemCopy)
{
for (uint32_t i = 0; i < obf->groups.size(); i)
{
pcode_group_t group = &obf->groups[i];
uint64_t cur_addr = group->base_address;
for (pcode_link_t t = group->start; t && t->group == i; t = t->next)
{
if (!(t->flags & CLFLAG_IS_LABEL))
{
MemCopy((void*)cur_addr, t->raw_data, t->raw_data_size);
cur_addr += t->raw_data_size;
}
}
}
}
#include <Windows.h>

@ -46,7 +46,6 @@ typedef struct _obfuscator_t
pcode_link_t code_start;
pcode_link_t code_end;
std::vector<code_group_t> groups;
int32_t group_size;
int32_t current_label_id;
xed_machine_mode_enum_t machine_mode;
xed_address_width_enum_t addr_width;

Loading…
Cancel
Save