From f3923af178cf18b4b97ade47ca8f9abc0407e57b Mon Sep 17 00:00:00 2001 From: "matanki.saito" Date: Wed, 22 Jun 2022 10:27:48 +0900 Subject: [PATCH] #230 Test code --- Plugin64/injector.hpp | 1 + Plugin64/plugin_64.h | 14 ++++- Plugin64/tooltip_and_button.cpp | 91 +++++++++++++++++++++++++++++ Plugin64/tooltip_and_button_asm.asm | 67 ++++++++++++++++++++- 4 files changed, 171 insertions(+), 2 deletions(-) diff --git a/Plugin64/injector.hpp b/Plugin64/injector.hpp index a7257dc..aa8e3f4 100644 --- a/Plugin64/injector.hpp +++ b/Plugin64/injector.hpp @@ -589,6 +589,7 @@ namespace Injector case 0x8D: // jge case 0x84: // jz case 0x8E: // jle + case 0x82: // jb auto a = ReadRelativeOffset(at + 2, 4, vp); return a; } diff --git a/Plugin64/plugin_64.h b/Plugin64/plugin_64.h index 646726a..e925a4b 100644 --- a/Plugin64/plugin_64.h +++ b/Plugin64/plugin_64.h @@ -426,6 +426,12 @@ struct DllError{ bool versionTooltipAndButtonProc6Injector : 1; bool unmatchdTooltipAndButtonProc7Injector : 1; bool versionTooltipAndButtonProc7Injector : 1; + bool unmatchdTooltipAndButtonProc8Injector : 1; + bool versionTooltipAndButtonProc8Injector : 1; + bool unmatchdTooltipAndButtonProc9Injector : 1; + bool versionTooltipAndButtonProc9Injector : 1; + bool unmatchdTooltipAndButtonProc10Injector : 1; + bool versionTooltipAndButtonProc10Injector : 1; }; std::string print() { @@ -441,7 +447,13 @@ struct DllError{ + PL(unmatchdTooltipAndButtonProc6Injector) + PL(versionTooltipAndButtonProc6Injector) + PL(unmatchdTooltipAndButtonProc7Injector) - + PL(versionTooltipAndButtonProc7Injector); + + PL(versionTooltipAndButtonProc7Injector) + + PL(unmatchdTooltipAndButtonProc8Injector) + + PL(versionTooltipAndButtonProc8Injector) + + PL(unmatchdTooltipAndButtonProc9Injector) + + PL(versionTooltipAndButtonProc9Injector) + + PL(unmatchdTooltipAndButtonProc10Injector) + + PL(versionTooltipAndButtonProc10Injector); } } tooltipAndButton; diff --git a/Plugin64/tooltip_and_button.cpp b/Plugin64/tooltip_and_button.cpp index cb3b204..9a51ad6 100644 --- a/Plugin64/tooltip_and_button.cpp +++ b/Plugin64/tooltip_and_button.cpp @@ -14,6 +14,10 @@ namespace TooltipAndButton { void tooltipAndButtonProc5V130(); void tooltipAndButtonProc7(); void tooltipAndButtonProc7V133(); + void tooltipAndButtonProc8(); + void tooltipAndButtonProc9(); + void tooltipAndButtonProc10(); + uintptr_t tooltipAndButtonProc1ReturnAddress; uintptr_t tooltipAndButtonProc1CallAddress; uintptr_t tooltipAndButtonProc2ReturnAddress; @@ -24,6 +28,11 @@ namespace TooltipAndButton { uintptr_t tooltipAndButtonProc5ReturnAddress2; uintptr_t tooltipAndButtonProc7ReturnAddress1; uintptr_t tooltipAndButtonProc7ReturnAddress2; + uintptr_t tooltipAndButtonProc8ReturnAddress1; + uintptr_t tooltipAndButtonProc9ReturnAddress1; + uintptr_t tooltipAndButtonProc9ReturnAddress2; + uintptr_t tooltipAndButtonProc10ReturnAddress1; + uintptr_t tooltipAndButtonProc10ReturnAddress2; } DllError tooltipAndButtonProc1Injector(RunOptions options) { @@ -470,6 +479,85 @@ namespace TooltipAndButton { return e; } + DllError tooltipAndButtonProc8Injector(RunOptions options) { + DllError e = {}; + + switch (options.version) { + case v1_33_3_0: + // mov eax, [rbp+22A0h+var_2294] + BytePattern::temp_instance().find_pattern("8B 44 24 4C 0F 57 C0 F3 48 0F 2A C0 0F 2F C8"); + if (BytePattern::temp_instance().has_size(2, u8"改行処理")) { + uintptr_t address = BytePattern::temp_instance().get_first().address(); + + // jg loc_xxxxx + tooltipAndButtonProc8ReturnAddress1 = Injector::GetBranchDestination(address + 0xF).as_int(); + + Injector::MakeJMP(address, tooltipAndButtonProc8, true); + } + else { + e.tooltipAndButton.unmatchdTooltipAndButtonProc8Injector = true; + } + break; + default: + e.tooltipAndButton.versionTooltipAndButtonProc8Injector = true; + } + + return e; + } + + DllError tooltipAndButtonProc9Injector(RunOptions options) { + DllError e = {}; + + switch (options.version) { + case v1_33_3_0: + // + BytePattern::temp_instance().find_pattern("48 8D 44 24 50 48 83 FF 10 48 0F 43 C6 80 3C 10 0A"); + if (BytePattern::temp_instance().has_size(1, u8"文字がないときの改行処理?")) { + uintptr_t address = BytePattern::temp_instance().get_first().address(); + + tooltipAndButtonProc9ReturnAddress1 = address + 0x2A; + tooltipAndButtonProc9ReturnAddress2 = Injector::GetBranchDestination(address + 0x24).as_int(); + + + Injector::MakeJMP(address, tooltipAndButtonProc9, true); + } + else { + e.tooltipAndButton.unmatchdTooltipAndButtonProc9Injector = true; + } + break; + default: + e.tooltipAndButton.versionTooltipAndButtonProc9Injector = true; + } + + return e; + } + + DllError tooltipAndButtonProc10Injector(RunOptions options) { + DllError e = {}; + + switch (options.version) { + case v1_33_3_0: + // + BytePattern::temp_instance().find_pattern("0F 28 B4 24 C0 00 00 00 48 81 C4 F0 00 00 00 41"); + if (BytePattern::temp_instance().has_size(1, u8"DEBUG")) { + uintptr_t address = BytePattern::temp_instance().get_first().address(); + + // retn + tooltipAndButtonProc10ReturnAddress1 = address + 0x11; + + Injector::MakeJMP(address, tooltipAndButtonProc10, true); + } + else { + e.tooltipAndButton.unmatchdTooltipAndButtonProc9Injector = true; + } + break; + default: + e.tooltipAndButton.versionTooltipAndButtonProc9Injector = true; + } + + return e; + } + DllError Init(RunOptions options) { DllError result = {}; @@ -480,6 +568,9 @@ namespace TooltipAndButton { result |= tooltipAndButtonProc5Injector(options); result |= tooltipAndButtonProc6Injector(options); result |= tooltipAndButtonProc7Injector(options); + //result |= tooltipAndButtonProc8Injector(options); + //result |= tooltipAndButtonProc9Injector(options); + //result |= tooltipAndButtonProc10Injector(options); return result; } diff --git a/Plugin64/tooltip_and_button_asm.asm b/Plugin64/tooltip_and_button_asm.asm index f0901db..0e61c74 100644 --- a/Plugin64/tooltip_and_button_asm.asm +++ b/Plugin64/tooltip_and_button_asm.asm @@ -8,6 +8,10 @@ EXTERN tooltipAndButtonProc5ReturnAddress1 : QWORD EXTERN tooltipAndButtonProc5ReturnAddress2 : QWORD EXTERN tooltipAndButtonProc7ReturnAddress1 : QWORD EXTERN tooltipAndButtonProc7ReturnAddress2 : QWORD +EXTERN tooltipAndButtonProc8ReturnAddress1 : QWORD +EXTERN tooltipAndButtonProc9ReturnAddress1 : QWORD +EXTERN tooltipAndButtonProc9ReturnAddress2 : QWORD +EXTERN tooltipAndButtonProc10ReturnAddress1 : QWORD ESCAPE_SEQ_1 = 10h ESCAPE_SEQ_2 = 11h @@ -84,6 +88,10 @@ tooltipAndButtonProc1V133 PROC jmp JMP_B; JMP_A: mov tooltipAndButtonProc2TmpFlag, 1h; + + ; debug + mov r8, qword ptr [rbp + 21D0h - 2220h]; + lea r8, qword ptr [rax + rcx]; mov tooltipAndButtonProc2TmpCharacterAddress, r8; movzx r8d, byte ptr[rax + rcx]; @@ -292,11 +300,14 @@ tooltipAndButtonProc4V133 PROC jz JMP_A; cmp tooltipAndButtonProc2TmpCharacter, 00FFh; - ja JMP_A; + ja JMP_X; push tooltipAndButtonProc4ReturnAddress1; ret; +JMP_X: + nop; + JMP_A: cmp dword ptr [rbp + 21D0h - 2210h], 0; push tooltipAndButtonProc4ReturnAddress2; @@ -408,7 +419,9 @@ JMP_F: JMP_H: add rbx, 3; add edi, 3; + sub rbx, 3; cmp rbx, r13; + add rbx, 3 ja JMP_J; dec rbx; dec edi; @@ -461,8 +474,60 @@ JMP_A: ret; JMP_B: + ; debug + mov rdi, qword ptr [rbp + 21D0h - 2220h]; + push tooltipAndButtonProc7ReturnAddress2; ret; tooltipAndButtonProc7V133 ENDP + +;-------------------------------------------; + +tooltipAndButtonProc8 PROC + mov eax, [rbp + 22A0h - 2294h] + xorps xmm0, xmm0 + cvtsi2ss xmm0, rax + comiss xmm1, xmm0 + + push tooltipAndButtonProc8ReturnAddress1; + ret; +tooltipAndButtonProc8 ENDP + +;-------------------------------------------; + +tooltipAndButtonProc9 PROC + lea rax, [rsp + 22D0h - 2280h] + cmp rdi, 10h + cmovnb rax, rsi + cmp byte ptr [rax+rdx], 0Ah + jz JMP_A; + + lea rax, [rsp + 22D0h - 2280h] + cmp rdi, 10h + cmovnb rax, rsi + cmp byte ptr [rax + rdx], 0Dh + jnz JMP_B; + +JMP_A: + push tooltipAndButtonProc9ReturnAddress1; + ret; + +JMP_B: + push tooltipAndButtonProc9ReturnAddress2; + ret; + +tooltipAndButtonProc9 ENDP + +;-------------------------------------------; + +tooltipAndButtonProc10 PROC + movaps xmm6, [rsp + 0F8h - 38h] + add rsp, 0F0h + pop r15 + + push tooltipAndButtonProc10ReturnAddress1; + ret; +tooltipAndButtonProc10 ENDP + END \ No newline at end of file