From 4070ea09821f6ba0dea2060f684f62b2a8b6c19c Mon Sep 17 00:00:00 2001 From: Ren Date: Thu, 19 Sep 2024 20:09:49 +0300 Subject: [PATCH] Add files via upload --- Detours.cpp | 8 ++++---- main.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Detours.cpp b/Detours.cpp index 6f54931..a426dc9 100644 --- a/Detours.cpp +++ b/Detours.cpp @@ -7668,11 +7668,11 @@ namespace Detours { #endif unsigned long long unDisp = 0; - if (pReadOperand->Info.Memory.HasBase && pReadOperand->Info.Memory.BaseSize) { + if (pReadOperand->Info.Memory.HasBase) { unBase = GetRegisterValue(pCTX, pReadOperand->Info.Memory.Base, pReadOperand->Info.Memory.BaseSize); } - if (pReadOperand->Info.Memory.HasIndex && pReadOperand->Info.Memory.IndexSize) { + if (pReadOperand->Info.Memory.HasIndex) { unIndex = GetRegisterValue(pCTX, pReadOperand->Info.Memory.Index, pReadOperand->Info.Memory.IndexSize) * pReadOperand->Info.Memory.Scale; } @@ -7816,11 +7816,11 @@ namespace Detours { #endif unsigned long long unDisp = 0; - if (pWriteOperand->Info.Memory.HasBase && pWriteOperand->Info.Memory.BaseSize) { + if (pWriteOperand->Info.Memory.HasBase) { unBase = GetRegisterValue(pCTX, pWriteOperand->Info.Memory.Base, pWriteOperand->Info.Memory.BaseSize); } - if (pWriteOperand->Info.Memory.HasIndex && pWriteOperand->Info.Memory.IndexSize) { + if (pWriteOperand->Info.Memory.HasIndex) { unIndex = GetRegisterValue(pCTX, pWriteOperand->Info.Memory.Index, pWriteOperand->Info.Memory.IndexSize) * pWriteOperand->Info.Memory.Scale; } diff --git a/main.cpp b/main.cpp index 8bdfdb8..a785629 100644 --- a/main.cpp +++ b/main.cpp @@ -1901,7 +1901,7 @@ TEST_SUITE("Detours::Hook") { #ifndef DEBUG // FIXME: MemoryHook don't support instructions with imm in write operand // Like `mov dword ptr [1], 0xDEEDBEEF` -#pragma optimize("g", off) +#pragma optimize("", off) #endif TEST_CASE("MemoryHook 3") { @@ -1914,9 +1914,9 @@ TEST_SUITE("Detours::Hook") { pVirtualAddress[1] = 0xDEEDFACE; pVirtualAddress[2] = 0xFACE; - printf("*(0x1) = 0x%X\n", pVirtualAddress[0]); - printf("*(0x1 + 4) = 0x%X\n", pVirtualAddress[1]); - printf("*(0x1 + 8) = 0x%X\n", pVirtualAddress[2]); + //printf("*(0x1) = 0x%X\n", pVirtualAddress[0]); + //printf("*(0x1 + 4) = 0x%X\n", pVirtualAddress[1]); + //printf("*(0x1 + 8) = 0x%X\n", pVirtualAddress[2]); CHECK(pVirtualAddress[0] == 0xDEEDBEEF); CHECK(pVirtualAddress[1] == 0xDEEDFACE); @@ -1926,7 +1926,7 @@ TEST_SUITE("Detours::Hook") { } #ifndef DEBUG -#pragma optimize("g", on) +#pragma optimize("", on) #endif TEST_CASE("MemoryHook [benchmark]" * doctest::skip(false)) {