Skip to content

Commit b9d044c

Browse files
authored
Add files via upload
1 parent 6f0769a commit b9d044c

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

Diff for: Detours.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -7597,14 +7597,18 @@ namespace Detours {
75977597
}
75987598

75997599
pInsn = pInstruction.get();
7600-
g_CachedInstructions.insert(it, std::make_pair(pExceptionAddress, std::move(pInstruction)));
7600+
g_CachedInstructions.emplace_hint(it, std::make_pair(pExceptionAddress, std::move(pInstruction)));
76017601
}
76027602
}
76037603

7604+
if (!pInsn) {
7605+
return;
7606+
}
7607+
76047608
switch (unOperation) {
76057609
case MEMORY_HOOK_OPERATION::MEMORY_READ: {
76067610
if (pInsn->OperandsCount) {
7607-
auto& ReadOperand = pInsn->Operands[pInsn->OperandsCount - 1];
7611+
auto ReadOperand = pInsn->Operands[pInsn->OperandsCount - 1];
76087612
if (!ReadOperand.Access.Read) {
76097613
return;
76107614
}
@@ -7644,18 +7648,16 @@ namespace Detours {
76447648
if (unBase) {
76457649
const size_t unOffset = reinterpret_cast<size_t>(pAddress) - unBase;
76467650
SetRegisterValue(pCTX, ReadOperand.Info.Memory.Base, ReadOperand.Info.Memory.BaseSize, reinterpret_cast<size_t>(pNewAddress) - unOffset);
7647-
auto OperandCopy = ReadOperand;
7648-
OperandCopy.Info.Memory.HasIndex = false;
7649-
g_CachedOperations.emplace_back(const_cast<void*>(pExceptionAddress), unOperation, const_cast<void*>(pAddress), OperandCopy, static_cast<char*>(pNewAddress) - unOffset);
7651+
ReadOperand.Info.Memory.HasIndex = false;
7652+
g_CachedOperations.emplace_back(const_cast<void*>(pExceptionAddress), unOperation, const_cast<void*>(pAddress), ReadOperand, static_cast<char*>(pNewAddress) - unOffset);
76507653
return;
76517654
}
76527655

76537656
if (unIndex) {
76547657
const size_t unOffset = reinterpret_cast<size_t>(pAddress) - unIndex;
76557658
SetRegisterValue(pCTX, ReadOperand.Info.Memory.Index, ReadOperand.Info.Memory.IndexSize, reinterpret_cast<size_t>(pNewAddress) - unOffset);
7656-
auto OperandCopy = ReadOperand;
7657-
OperandCopy.Info.Memory.HasBase = false;
7658-
g_CachedOperations.emplace_back(const_cast<void*>(pExceptionAddress), unOperation, const_cast<void*>(pAddress), OperandCopy, static_cast<char*>(pNewAddress) - unOffset);
7659+
ReadOperand.Info.Memory.HasBase = false;
7660+
g_CachedOperations.emplace_back(const_cast<void*>(pExceptionAddress), unOperation, const_cast<void*>(pAddress), ReadOperand, static_cast<char*>(pNewAddress) - unOffset);
76597661
return;
76607662
}
76617663
}
@@ -7675,7 +7677,7 @@ namespace Detours {
76757677

76767678
case MEMORY_HOOK_OPERATION::MEMORY_WRITE: {
76777679
if (pInsn->OperandsCount) {
7678-
auto& WriteOperand = pInsn->Operands[pInsn->OperandsCount - 1];
7680+
auto WriteOperand = pInsn->Operands[pInsn->OperandsCount - 1];
76797681
if (!WriteOperand.Access.Write) {
76807682
if (pInsn->OperandsCount > 1) {
76817683
WriteOperand = pInsn->Operands[pInsn->OperandsCount - 2];
@@ -7721,17 +7723,15 @@ namespace Detours {
77217723
if (unBase) {
77227724
const size_t unOffset = reinterpret_cast<size_t>(pAddress) - unBase;
77237725
SetRegisterValue(pCTX, WriteOperand.Info.Memory.Base, WriteOperand.Info.Memory.BaseSize, reinterpret_cast<size_t>(pNewAddress) - unOffset);
7724-
auto OperandCopy = WriteOperand;
7725-
OperandCopy.Info.Memory.HasIndex = false;
7726+
WriteOperand.Info.Memory.HasIndex = false;
77267727
g_CachedOperations.emplace_back(const_cast<void*>(pExceptionAddress), unOperation, const_cast<void*>(pAddress), OperandCopy, static_cast<char*>(pNewAddress) - unOffset);
77277728
return;
77287729
}
77297730

77307731
if (unIndex) {
77317732
const size_t unOffset = reinterpret_cast<size_t>(pAddress) - unIndex;
77327733
SetRegisterValue(pCTX, WriteOperand.Info.Memory.Index, WriteOperand.Info.Memory.IndexSize, reinterpret_cast<size_t>(pNewAddress) - unOffset);
7733-
auto OperandCopy = WriteOperand;
7734-
OperandCopy.Info.Memory.HasBase = false;
7734+
WriteOperand.Info.Memory.HasBase = false;
77357735
g_CachedOperations.emplace_back(const_cast<void*>(pExceptionAddress), unOperation, const_cast<void*>(pAddress), OperandCopy, static_cast<char*>(pNewAddress) - unOffset);
77367736
return;
77377737
}

Diff for: SuppressionFile.suppress

+8
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@
161161
<CodeCurrent>564295918</CodeCurrent>
162162
<CodeNext>49736095</CodeNext>
163163
</Detours>
164+
<Detours>
165+
<FileName>Detours.cpp</FileName>
166+
<ErrorCode>V802</ErrorCode>
167+
<Message>On _-bit platform, structure size can be reduced from _ to _ bytes by rearranging the fields according to their sizes in decreasing order.</Message>
168+
<CodePrev>0</CodePrev>
169+
<CodeCurrent>463190756</CodeCurrent>
170+
<CodeNext>623829659</CodeNext>
171+
</Detours>
164172
<Detours>
165173
<FileName>Detours.cpp</FileName>
166174
<ErrorCode>V835</ErrorCode>

0 commit comments

Comments
 (0)