fix: use longer sig for AntiDebug

This commit is contained in:
goat 2021-01-19 22:43:42 +01:00
parent 5df28e4e22
commit add9fe89e4

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Dalamud.Hooking;
@ -14,12 +15,16 @@ namespace Dalamud.Game.Internal
public bool IsEnabled { get; private set; }
public AntiDebug(SigScanner scanner) {
DebugCheckAddress = scanner.ScanText("FF 15 ?? ?? ?? ?? 85 C0 74 11");
Log.Verbose("IsDebuggerPresent address {IsDebuggerPresent}", DebugCheckAddress);
try {
DebugCheckAddress = scanner.ScanText("FF 15 ?? ?? ?? ?? 85 C0 74 11 41");
} catch (KeyNotFoundException) {
DebugCheckAddress = IntPtr.Zero;
}
Log.Verbose("DebugCheck address {DebugCheckAddress}", DebugCheckAddress);
}
private readonly byte[] nop = new byte[] { 0x31, 0xC0, 0x90, 0x90, 0x90, 0x90 };
private readonly byte[] nop = new byte[] { 0x31, 0xC0, 0x90, 0x90, 0x90, 0x90, 0x90 };
private byte[] original;
public void Enable() {
@ -28,6 +33,8 @@ namespace Dalamud.Game.Internal
Log.Information($"Overwriting Debug Check @ 0x{DebugCheckAddress.ToInt64():X}");
Marshal.Copy(DebugCheckAddress, this.original, 0, this.nop.Length);
Marshal.Copy(this.nop, 0, DebugCheckAddress, this.nop.Length);
} else {
Log.Information("DebugCheck already overwritten?");
}
IsEnabled = true;