From cd3d8c492402bcd4ce5bae2a5cd264f835f78efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 27 Sep 2024 15:28:18 +0800 Subject: [PATCH] fix --- LunaHook/embed_util.cc | 4 ++-- LunaHook/engine32/KiriKiri.cpp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/LunaHook/embed_util.cc b/LunaHook/embed_util.cc index 3feeca1..75d2c4d 100644 --- a/LunaHook/embed_util.cc +++ b/LunaHook/embed_util.cc @@ -221,7 +221,7 @@ void TextHook::parsenewlineseperator(void *data, size_t *len) if (hp.type & CODEC_UTF16) { - StringReplacer((wchar_t *)data, len, hp.newlineseperator, wcslen(hp.newlineseperator), L"\n", 1); + StringCharReplacer((wchar_t *)data, len, hp.newlineseperator, wcslen(hp.newlineseperator), L'\n'); } else if (hp.type & CODEC_UTF32) return; @@ -231,7 +231,7 @@ void TextHook::parsenewlineseperator(void *data, size_t *len) std::string newlineseperatorA; for (int i = 0; i < wcslen(hp.newlineseperator); i++) newlineseperatorA += (char)hp.newlineseperator[i]; - StringReplacer((char *)data, len, newlineseperatorA.c_str(), newlineseperatorA.size(), "\n", 1); + StringCharReplacer((char *)data, len, newlineseperatorA.c_str(), newlineseperatorA.size(), '\n'); } } UINT64 texthash(void *data, size_t len) diff --git a/LunaHook/engine32/KiriKiri.cpp b/LunaHook/engine32/KiriKiri.cpp index 7c63778..8b8fc0c 100644 --- a/LunaHook/engine32/KiriKiri.cpp +++ b/LunaHook/engine32/KiriKiri.cpp @@ -1390,12 +1390,14 @@ namespace Private { std::wstring ConvertToFullWidth(const std::wstring& str) { std::wstring fullWidthStr; + wchar_t last=0; for (wchar_t c : str) { - if (c >= 32 && c <= 126) { + if (c >= 32 && c <= 126 && c!=L'\\' && last!=L'\\') { fullWidthStr += static_cast(c + 65248); } else { fullWidthStr += c; } + last=c; } return fullWidthStr; } @@ -1532,6 +1534,7 @@ bool attach(ULONG startAddress, ULONG stopAddress) hp.type = EMBED_ABLE|CODEC_UTF8; hp.hook_before=hookBeforez; hp.hook_after=after; + hp.newlineseperator=L"\\n"; succ|=NewHook(hp, "EmbedKrkrZ"); // return true; }