From 41532ab40f22a3b2b4e222f499ef207fb1de6990 Mon Sep 17 00:00:00 2001 From: "matanki.saito" Date: Sat, 1 Jun 2024 10:21:14 +0900 Subject: [PATCH] input, ime --- Plugin64/ime.cpp | 11 ++++---- Plugin64/ime_asm.asm | 48 +++++++++++++++++++++++++++++++++ Plugin64/input.cpp | 18 ++++++++++++- Plugin64/input_asm.asm | 60 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+), 6 deletions(-) diff --git a/Plugin64/ime.cpp b/Plugin64/ime.cpp index d9ff930..1f42388 100644 --- a/Plugin64/ime.cpp +++ b/Plugin64/ime.cpp @@ -8,6 +8,7 @@ namespace Ime { void imeProc1V137(); void imeProc2(); void imeProc3(); + void imeProc3V137(); uintptr_t imeProc1ReturnAddress1; uintptr_t imeProc1ReturnAddress2; uintptr_t imeProc1CallAddress; @@ -338,7 +339,7 @@ namespace Ime { // 直前の部分でjmpに使う14byteを確保することができなかった。 // そのためWM_KEYDOWNのコードをすべて移植した // mov rcx, [rbp+0C0h+hRawInput] - BytePattern::temp_instance().find_pattern("48 8B 8D E8 ? ? ? ? 8B D6 E8 ? ? ? ? 33"); + BytePattern::temp_instance().find_pattern("48 8B 8D F8 00 00 00 48 8B D6 E8 ? ? ? ? 33"); if (BytePattern::temp_instance().has_size(2, u8"SDL_windowsevents.cの修正")) { uintptr_t address = BytePattern::temp_instance().get_first().address(); @@ -355,12 +356,12 @@ namespace Ime { imeProc3CallAddress4 = Injector::GetBranchDestination(address + 0x50).as_int(); // call {sub_xxxxx} / SDL_SendKeyboardKey - imeProc3CallAddress5 = Injector::GetBranchDestination(address + 0x61).as_int(); + imeProc3CallAddress5 = Injector::GetBranchDestination(address + 0x65).as_int(); // xor edi, edi - imeProc3ReturnAddress = address + 0x66; + imeProc3ReturnAddress = address + 0x6A; - Injector::MakeJMP(address, imeProc3, true); + Injector::MakeJMP(address, imeProc3V137, true); } else { e.ime.unmatchdImeProc3Injector = true; @@ -378,7 +379,7 @@ namespace Ime { result |= imeProc1Injector(options); result |= imeProc2Injector(options); - //result |= imeProc3Injector(options); + result |= imeProc3Injector(options); return result; } diff --git a/Plugin64/ime_asm.asm b/Plugin64/ime_asm.asm index a580bf6..4cb8dc9 100644 --- a/Plugin64/ime_asm.asm +++ b/Plugin64/ime_asm.asm @@ -129,4 +129,52 @@ JMP_D: ret; imeProc3 ENDP +;-------------------------------------------; + +imeProc3V137 PROC + mov rcx,qword ptr [rbp + 0D0h + 28h]; + mov rdx, rsi; + call imeProc3CallAddress1; + xor ecx, ecx; + mov edi, eax; + call imeProc3CallAddress2; + cmp byte ptr [rax + 0E2h], r14b; + jz JMP_A; + cmp byte ptr [rax + 0E6h], r14b; + jnz JMP_B; + +JMP_A: + cmp edi, 3Dh; + jnz JMP_B; + lea rcx, aSdl_windows_no; + call imeProc3CallAddress3; + test rax, rax; + jz JMP_C; + cmp byte ptr [rax], 30h; + jnz JMP_E; + +JMP_C: + mov rcx, qword ptr [rbx]; + xor r9d, r9d; + xor r8d, r8d; + mov dl, 0Eh; + call imeProc3CallAddress4; + jmp JMP_E; + +JMP_B: + test edi, edi; + jz JMP_D; + +JMP_E: + cmp rsi,229; {ɂ肽̂͂ + jz JMP_D; + mov edx, edi + movzx ecx, r14b; + call imeProc3CallAddress5; + +JMP_D: + push imeProc3ReturnAddress; + ret; +imeProc3V137 ENDP + END \ No newline at end of file diff --git a/Plugin64/input.cpp b/Plugin64/input.cpp index 7df9cf1..a2ee580 100644 --- a/Plugin64/input.cpp +++ b/Plugin64/input.cpp @@ -13,6 +13,7 @@ namespace Input { uintptr_t inputProc1CallAddress; void inputProc2(); + void inputProc2V137(); uintptr_t inputProc2ReturnAddress; } @@ -168,6 +169,21 @@ namespace Input { e.input.unmatchdInputProc2Injector = true; } break; + case v1_37_0_0: + // xor ecx, ecx + BytePattern::temp_instance().find_pattern("33 C9 48 89 4C 24 20 48 C7 44 24 38 0F 00 00 00 48 89 4C 24 30"); + if (BytePattern::temp_instance().has_size(3, u8"バックスペース処理の修正")) { + uintptr_t address = BytePattern::temp_instance().get(2).address(); + + // movzx r8d, word ptr [rdi+56h] + inputProc2ReturnAddress = address + 0x165; + + Injector::MakeJMP(address, inputProc2V137, true); + } + else { + e.input.unmatchdInputProc2Injector = true; + } + break; default: e.input.versionInputProc2Injector = true; } @@ -179,7 +195,7 @@ namespace Input { DllError result = {}; result |= inputProc1Injector(options); - //result |= inputProc2Injector(options); + result |= inputProc2Injector(options); return result; } diff --git a/Plugin64/input_asm.asm b/Plugin64/input_asm.asm index e616871..ef79fef 100644 --- a/Plugin64/input_asm.asm +++ b/Plugin64/input_asm.asm @@ -340,4 +340,64 @@ JMP_F: push inputProc2ReturnAddress; ret; inputProc2 ENDP + +;-------------------------------------------; + +inputProc2V137 PROC + mov inputProc2Tmp2,rsi; // JE^ƂĎg + xor rsi,rsi; + + xor ecx, ecx + mov [rsp+48h-28h], rcx + mov qword ptr [rsp+48h-10h], 0Fh + mov [rsp+48h-18h], rcx + cmp [rdi+80h], rcx + + + mov rcx, qword ptr [rdi + 40h]; + cmp rcx, 10h; + lea rcx, [rdi + 30h]; + jbe JMP_A; + mov rcx, [rcx]; + +JMP_A: + movsxd rax, dword ptr [rdi + 54h]; + sub rax, 3; + js JMP_C; + mov al, byte ptr [rcx + rax]; + cmp al, ESCAPE_SEQ_1; + jz JMP_B; + cmp al, ESCAPE_SEQ_2; + jz JMP_B; + cmp al, ESCAPE_SEQ_3; + jz JMP_B; + cmp al, ESCAPE_SEQ_4; + jnz JMP_C; + +JMP_B: + mov rsi, 2; + +JMP_C: + mov rax, qword ptr [rdi]; + mov rcx, rdi; + cmp qword ptr [rdi+80h] ,0 + jz JMP_D; + call qword ptr [rax+140h]; + jmp JMP_E; + +JMP_D: + call qword ptr [rax+138h]; + +JMP_E: + cmp rsi, 0; + jz JMP_F; + dec rsi; + jmp JMP_C; + +JMP_F: + mov rsi,inputProc2Tmp2; + + push inputProc2ReturnAddress; + ret; +inputProc2V137 ENDP END \ No newline at end of file