From 9b9b9dae5726165fe68bbd860533fea80ad29a4e 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: Tue, 19 Mar 2024 23:45:33 +0800 Subject: [PATCH] Update v8.cpp --- LunaHook/engines/v8/v8.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LunaHook/engines/v8/v8.cpp b/LunaHook/engines/v8/v8.cpp index 0dcf4be..9e95596 100644 --- a/LunaHook/engines/v8/v8.cpp +++ b/LunaHook/engines/v8/v8.cpp @@ -20,13 +20,14 @@ namespace{ GlobalUnlock(hClipboardData); }; hp.hook_after=[](hook_stack*s,void* data, size_t len){ - HGLOBAL hClipboardData = GlobalAlloc(GMEM_MOVEABLE, len +2); - auto pchData = (wchar_t*)GlobalLock(hClipboardData); + std::wstring transwithfont; transwithfont+=L'\x01'; transwithfont+=embedsharedmem->fontFamily; transwithfont+=L'\x01'; transwithfont+=std::wstring((wchar_t*)data,len/2); + HGLOBAL hClipboardData = GlobalAlloc(GMEM_MOVEABLE, transwithfont.size()*2 +2); + auto pchData = (wchar_t*)GlobalLock(hClipboardData); wcscpy(pchData, (wchar_t*)transwithfont.c_str()); GlobalUnlock(hClipboardData); s->arg2=(uintptr_t)hClipboardData;