I am trying to write a plugin which, beside other things, would need to write assembly of some code segments into a file. Since the documentation is somewhat lacking I'm lost on some things and not sure how to use functions for disassembly. I'm reading commands with Readcommand function and then using Disasm function to get the assembly code but all I am getting is some gibberish. Also, in a help file it says that Readcommand function should return the actual size of instruction read, but it always returns maximum size. Any help on what I'm doing wrong or how to proceed to get the assembly code would be appreciated. Code with which I'm trying to get disassembly is located below.
code_length = Readcommand(reg->ip, cmd);
instruction_length = Disasm(cmd, code_length, reg->ip, dest, disasm, DISASM_ALL,thread_id);