int main(int argc, char* argv[]) { BEA_UNUSED_ARG (argc); BEA_UNUSED_ARG (argv); /* ============================= Init the Disasm structure (important !)*/ (void) memset (&MyDisasm, 0, sizeof(DISASM)); pSourceCode = main; pBuffer = malloc(0x600); /* ============================= Let's NOP the buffer */ (void) memset (pBuffer, 0x90, 0x600); /* ============================= Copy 100 bytes in it */ (void) memcpy (pBuffer,(void*)(UIntPtr) pSourceCode, 0x600); (void) printf("******************************************************* \n"); (void) printf("Display only Instructions modifying memory. \ndon't display stack modifications. \n"); (void) printf("******************************************************* \n"); /* ============================= Select Display Option */ MyDisasm.Options = Tabulation + MasmSyntax; /* ============================= Disassemble code located in that buffer */ DisassembleCode (pBuffer, (char*) pBuffer + 0x600, pSourceCode); return 0; }
int main(int argc, char* argv []) { /* ============================= Init datas */ DISASM MyDisasm; int len, i = 0; int Error = 0; BEA_UNUSED_ARG (argc); BEA_UNUSED_ARG (argv); /* ============================= Init the Disasm structure (important !)*/ (void) memset (&MyDisasm, 0, sizeof(DISASM)); /* ============================= Init EIP */ MyDisasm.EIP = (UIntPtr) &main; /* ============================= Loop for Disasm */ while ((!Error) && (i<20)){ len = Disasm(&MyDisasm); if (len != UNKNOWN_OPCODE) { (void) puts(MyDisasm.CompleteInstr); MyDisasm.EIP = MyDisasm.EIP + (UIntPtr)len; i++; } else { Error = 1; } }; return 0; }
int main(int argc, char* argv[]) { BEA_UNUSED_ARG (argc); BEA_UNUSED_ARG (argv); /* ============================= Init the Disasm structure (important !)*/ (void) memset (&MyDisasm, 0, sizeof(DISASM)); pSourceCode = main; pBuffer = malloc(100); /* ============================= Let's NOP the buffer */ (void) memset (pBuffer, 0x90, 100); /* ============================= Copy 100 bytes in it */ (void) memcpy (pBuffer,(void*)(UIntPtr) pSourceCode, 100); /* ============================= Select Display Option */ (void) printf("******************************************************* \n"); (void) printf("Display Option : No Tabulation + MasmSyntax. \n"); (void) printf("******************************************************* \n"); MyDisasm.Options = NoTabulation + MasmSyntax; /* ============================= Disassemble code located in that buffer */ DisassembleCode (pBuffer, (char*) pBuffer + 100, pSourceCode); /* ============================= Select another Display Option */ (void) printf("******************************************************* \n"); (void) printf("Display Option : Tabulation + MasmSyntax. \n"); (void) printf("******************************************************* \n"); MyDisasm.Options = Tabulation + MasmSyntax; /* ============================= Disassemble code located in that buffer */ DisassembleCode (pBuffer, (char*) pBuffer + 100, pSourceCode); /* ============================= Select another Display Option */ (void) printf("******************************************************* \n"); (void) printf("Display Option : Tabulation + NasmSyntax + PrefixedNumeral + ShowSegmentRegs. \n"); (void) printf("******************************************************* \n"); MyDisasm.Options = Tabulation + NasmSyntax + PrefixedNumeral + ShowSegmentRegs; /* ============================= Disassemble code located in that buffer */ DisassembleCode (pBuffer, (char*) pBuffer + 100, pSourceCode); /* ============================= Select another Display Option */ (void) printf("******************************************************* \n"); (void) printf("Display Option : Tabulation + GoAsmSyntax + SuffixedNumeral. \n"); (void) printf("******************************************************* \n"); MyDisasm.Options = Tabulation + GoAsmSyntax + SuffixedNumeral; /* ============================= Disassemble code located in that buffer */ DisassembleCode (pBuffer, (char*) pBuffer + 100, pSourceCode); /* ============================= Select another Display Option */ (void) printf("******************************************************* \n"); (void) printf("Display Option : Tabulation + ATSyntax + SuffixedNumeral + ShowSegmentRegs. \n"); (void) printf("******************************************************* \n"); MyDisasm.Options = Tabulation + ATSyntax + SuffixedNumeral + ShowSegmentRegs; /* ============================= Disassemble code located in that buffer */ DisassembleCode (pBuffer, (char*) pBuffer + 100, pSourceCode); return 0; }