#pragma once #include #include #include namespace theo::obf { /// /// this pass is like the next_inst_pass, however, relocations are encrypted /// with transformations instead of the address of the next instruction. this /// pass only runs at the instruction level and appends transformations into the /// reloc_t object of the instruction symbol. /// /// given the following code: /// /// mov rax, &MessageBoxA /// /// this pass will generate a random number of transformations to encrypt the /// address of "MessageBoxA". These transformations will then be applied by /// theodosius internally when resolving relocations. /// /// mov rax, enc_MessageBoxA /// xor rax, 0x389284324 /// add rax, 0x345332567 /// ror rax, 0x5353 /// class reloc_transform_pass_t : public pass_t { explicit reloc_transform_pass_t() : pass_t(decomp::sym_type_t::instruction){}; public: static reloc_transform_pass_t* get(); void run(decomp::symbol_t* sym); private: std::optional has_legit_reloc(decomp::symbol_t* sym); }; } // namespace theo::obf