Merge pull request #46 from attickdoor/idasig

Support IDA sigs that are based off of the first CALL instruction for…
This commit is contained in:
goaaats 2020-03-05 20:50:47 +09:00 committed by GitHub
commit 1855246265
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -155,10 +155,25 @@ namespace Dalamud.Game {
if (IsCopy)
scanRet = new IntPtr(scanRet.ToInt64() - this.moduleCopyOffset);
if (Marshal.ReadByte(scanRet) == 0xE8)
return ReadCallSig(scanRet);
return scanRet;
}
/// <summary>
/// Helper for ScanText to get the correct address for
/// IDA sigs that mark the first CALL location.
/// </summary>
/// <param name="sigLocation">The address the CALL sig resolved to.</param>
/// <returns>The real offset of the signature.</returns>
private IntPtr ReadCallSig(IntPtr SigLocation)
{
int jumpOffset = Marshal.ReadInt32(IntPtr.Add(SigLocation, 1));
return IntPtr.Add(SigLocation, 5 + jumpOffset);
}
/// <summary>
/// Scan for a byte signature in the .data section.
/// </summary>