ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ[ADE32.TXT]ÄÄÄ Advanced Disassembler Engine v2.02 additional stuff: ADE202\*.* ABSTRACT -------- ADE is based on LDE engine. Its purpose is to split given opcode into easy modifiable structure, and then to assemble this structure back into opcode. PUBLIC SUBROUTINES ------------------ ADE has 3 public subroutines: ade32_init() -- to initialize internal flag table, ade32_disasm() -- to disassemble opcode into structure, ade32_asm() -- to assemble structure into opcode. ade32_init() ------------ void __cdecl ade32_init(DWORD flagtable[512]); This subroutine initializes internal flag table, which is of 2048 bytes size. This table contains 512 DWORD-entries, 1st half for normal opcodes, and 2nd half for 0F-prefixed opcodes. Each DWORD-entry is a bitset of C_xxx flags. Because data is packed with huffman algorithm, total subroutine size is of about 500 bytes. Once flag table is initialized, you can pass it to ade32_disasm() subroutine to disassemble opcodes. ade32_disasm() -------------- DWORD __cdecl ade32_disasm(IN BYTE* opcode, IN OUT disasm_struct* s, IN DWORD flagtable[512]); This subroutine disassembles opcode into disasm_struct* s structure, using previously initialized flag table. Before passing disasm_struct* s to this subroutine, you should set s.disasm_defaddr and s.disasm_defdata records to 4, in case of disassembling standard 32-bit code. On successfull return, EAX contains total length of the opcode, and the same is in s.disasm_len. All other fields of the structure are also filled in. Records s.disasm_defaddr and s.disasm_defdata may be changed from 4 to 2 and vice versa, in case of prefixes 66/67 encountered. On error, EAX contains 0, and disasm_len is set to 0; other field values are undefined. ade32_asm() ----------- DWORD __cdecl ade32_asm(OUT BYTE* opcode, IN OUT disasm_struct* s); This subroutine assembles structure s into opcode, using the following algorithm: if (s.disasm_flag & C_SEG) *opcode++ = s.disasm_seg; if (s.disasm_flag & C_LOCK) *opcode++ = 0xF0; if (s.disasm_flag & C_REP) *opcode++ = s.disasm_rep; if (s.disasm_flag & C_67) *opcode++ = 0x67; if (s.disasm_flag & C_66) *opcode++ = 0x66; *opcode++ = s.disasm_opcode; if (s.disasm_flag & C_OPCODE2) *opcode++ = s.disasm_opcode2; if (s.disasm_flag & C_MODRM) *opcode++ = s.disasm_modrm; if (s.disasm_flag & C_SIB) *opcode++ = s.disasm_sib; for (DWORD i=0; i