Fix stupid s4

This commit is contained in:
Gray
2024-03-18 22:59:09 -04:00
parent ef97a84822
commit a8e3bd4fbf
3 changed files with 41 additions and 8 deletions

View File

@@ -54,12 +54,12 @@ uint64 FindGIsClient()
{0x88, 0x05}, // 20.40 21.00
{0xC6, 0x05}, // mov cs X // Checked on 1.11, 12.41
{0x88, 0x1D}, // mov cs bl // Checked on 17.50, 19.10
{0x44, 0x88} // IDK WHAT VERSION This for but it scuffs older builds
{0x44, 0x88} // 4.5
};
int Skip = 2; // Skip GIsServer and some variable i forgot
int Skip = 2;
uint64 Addy;
uint64 Addy = 0;
for (int i = 0; i < 50; i++) // we should subtract from skip if go up
{
@@ -87,16 +87,25 @@ uint64 FindGIsClient()
}
if (Found)
{
int Relative = Bytes[0] == 0x44 ? 3 : 2;
bool bIsScuffedByte = Bytes[0] == 0x44;
int Relative = bIsScuffedByte ? 3 : 2;
auto current = Memcury::Scanner(Addr.Get() - i);
// LOG_INFO(LogDev, "[{}] No Rel 0x{:x} Rel: 0x{:x}", Skip, current.Get() - __int64(GetModuleHandleW(0)), Memcury::Scanner(Addr.Get() - i).RelativeOffset(Relative).Get() - __int64(GetModuleHandleW(0)));
if (bIsScuffedByte)
{
if (Bytes[2] == 0x74) // DIE 4.5 (todo check length of entire instruction)
continue;
}
if (Skip > 0)
{
Skip--;
continue;
}
LOG_INFO(LogDev, "Found GIsClient with byte 0x{:x}", Bytes[0]);
Addy = Bytes[0] == 0xC6
? current.RelativeOffset(Relative, 1).Get() // If mov cs then we add 1 because the last byte is the value and makes whole instructions 1 byte longer
: current.RelativeOffset(Relative).Get();