Skip to content

Commit 4070ea0

Browse files
authored
Add files via upload
1 parent e4013c8 commit 4070ea0

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Diff for: Detours.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -7668,11 +7668,11 @@ namespace Detours {
76687668
#endif
76697669
unsigned long long unDisp = 0;
76707670

7671-
if (pReadOperand->Info.Memory.HasBase && pReadOperand->Info.Memory.BaseSize) {
7671+
if (pReadOperand->Info.Memory.HasBase) {
76727672
unBase = GetRegisterValue(pCTX, pReadOperand->Info.Memory.Base, pReadOperand->Info.Memory.BaseSize);
76737673
}
76747674

7675-
if (pReadOperand->Info.Memory.HasIndex && pReadOperand->Info.Memory.IndexSize) {
7675+
if (pReadOperand->Info.Memory.HasIndex) {
76767676
unIndex = GetRegisterValue(pCTX, pReadOperand->Info.Memory.Index, pReadOperand->Info.Memory.IndexSize) * pReadOperand->Info.Memory.Scale;
76777677
}
76787678

@@ -7816,11 +7816,11 @@ namespace Detours {
78167816
#endif
78177817
unsigned long long unDisp = 0;
78187818

7819-
if (pWriteOperand->Info.Memory.HasBase && pWriteOperand->Info.Memory.BaseSize) {
7819+
if (pWriteOperand->Info.Memory.HasBase) {
78207820
unBase = GetRegisterValue(pCTX, pWriteOperand->Info.Memory.Base, pWriteOperand->Info.Memory.BaseSize);
78217821
}
78227822

7823-
if (pWriteOperand->Info.Memory.HasIndex && pWriteOperand->Info.Memory.IndexSize) {
7823+
if (pWriteOperand->Info.Memory.HasIndex) {
78247824
unIndex = GetRegisterValue(pCTX, pWriteOperand->Info.Memory.Index, pWriteOperand->Info.Memory.IndexSize) * pWriteOperand->Info.Memory.Scale;
78257825
}
78267826

Diff for: main.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1901,7 +1901,7 @@ TEST_SUITE("Detours::Hook") {
19011901
#ifndef DEBUG
19021902
// FIXME: MemoryHook don't support instructions with imm in write operand
19031903
// Like `mov dword ptr [1], 0xDEEDBEEF`
1904-
#pragma optimize("g", off)
1904+
#pragma optimize("", off)
19051905
#endif
19061906

19071907
TEST_CASE("MemoryHook 3") {
@@ -1914,9 +1914,9 @@ TEST_SUITE("Detours::Hook") {
19141914
pVirtualAddress[1] = 0xDEEDFACE;
19151915
pVirtualAddress[2] = 0xFACE;
19161916

1917-
printf("*(0x1) = 0x%X\n", pVirtualAddress[0]);
1918-
printf("*(0x1 + 4) = 0x%X\n", pVirtualAddress[1]);
1919-
printf("*(0x1 + 8) = 0x%X\n", pVirtualAddress[2]);
1917+
//printf("*(0x1) = 0x%X\n", pVirtualAddress[0]);
1918+
//printf("*(0x1 + 4) = 0x%X\n", pVirtualAddress[1]);
1919+
//printf("*(0x1 + 8) = 0x%X\n", pVirtualAddress[2]);
19201920

19211921
CHECK(pVirtualAddress[0] == 0xDEEDBEEF);
19221922
CHECK(pVirtualAddress[1] == 0xDEEDFACE);
@@ -1926,7 +1926,7 @@ TEST_SUITE("Detours::Hook") {
19261926
}
19271927

19281928
#ifndef DEBUG
1929-
#pragma optimize("g", on)
1929+
#pragma optimize("", on)
19301930
#endif
19311931

19321932
TEST_CASE("MemoryHook [benchmark]" * doctest::skip(false)) {

0 commit comments

Comments
 (0)