justinstenning / SharpDisasm

SharpDisasm - x86 / x86-64 disassembler for .NET
https://www.nuget.org/packages/SharpDisasm
Other
214 stars 39 forks source link

add an option to resolve rip relatives to real absolute address #13

Closed Fonger closed 6 years ago

Fonger commented 6 years ago

This resolves #11

Most of the disassembler tool (e.g. x64dbg, Cheat Engine) will resolve rip into absolute address. To enable this behavior, just make ResolveRip true in Translator

Input 64bit with code starting at 0x7FF648E4A9C5 : 48 8B 0D 1C ED 01 00

SharpDisasm.Disassembler.Translator.ResolveRip = false; //default

mov rcx, [rip+0x1ed1c]

SharpDisasm.Disassembler.Translator.ResolveRip = true;

mov rcx, [0x7ff648e696e8]

When using CLI, use it like this

type instructions64.txt | disasmcli 64 resolveRip

where resolveRip is not case sensitive. RESOLVERIP and ResolveRip works too.

Negative rip relatives also work and it is included in the test case.