mirror of
https://github.com/HIllya51/LunaHook.git
synced 2025-01-11 20:39:34 +08:00
fix
This commit is contained in:
parent
d329bc0525
commit
d3136b04a8
@ -5,7 +5,7 @@
|
||||
#define INJECT_FAILED L"couldn't inject"
|
||||
#define INVALID_CODEPAGE L"couldn't convert text (invalid codepage?)"
|
||||
#define PIPE_CONNECTED u8"pipe connected"
|
||||
#define INSERTING_HOOK u8"inserting hook: %s"
|
||||
#define INSERTING_HOOK u8"inserting hook: %s %p"
|
||||
#define REMOVING_HOOK u8"removing hook: %s"
|
||||
#define TOO_MANY_HOOKS u8"too many hooks: can't insert"
|
||||
#define HOOK_SEARCH_STARTING u8"starting hook search"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#define INJECT_FAILED L"注入失败"
|
||||
#define INVALID_CODEPAGE L"无法转换文本 (无效的代码页?)"
|
||||
#define PIPE_CONNECTED u8"管道已连接"
|
||||
#define INSERTING_HOOK u8"注入钩子: %s"
|
||||
#define INSERTING_HOOK u8"注入钩子: %s %p"
|
||||
#define REMOVING_HOOK u8"移除钩子: %s"
|
||||
#define TOO_MANY_HOOKS u8"钩子数量已达上限: 无法注入"
|
||||
#define HOOK_SEARCH_STARTING u8"开始搜索钩子"
|
||||
|
@ -98,6 +98,7 @@ namespace monocommon{
|
||||
hp.argidx=hook.argidx;
|
||||
hp.type = USING_STRING | CODEC_UTF16|FULL_STRING;
|
||||
hp.text_fun =(decltype(hp.text_fun))hook.text_fun;
|
||||
if(!hp.text_fun)hp.type|=SPECIAL_JIT_STRING;
|
||||
hp.jittype=JITTYPE::UNITY;
|
||||
strcpy(hp.unityfunctioninfo,hook.info().c_str());
|
||||
if(hook.Embed)
|
||||
|
@ -175,7 +175,7 @@ bool NewHook_1(HookParam& hp, LPCSTR lpname)
|
||||
return false;
|
||||
}
|
||||
if (lpname && *lpname) strncpy_s(hp.name, lpname, HOOK_NAME_SIZE - 1);
|
||||
ConsoleOutput(INSERTING_HOOK, hp.name);
|
||||
ConsoleOutput(INSERTING_HOOK, hp.name,hp.address);
|
||||
|
||||
wcscpy_s(hp.hookcode,HOOKCODE_LEN,HookCode::Generate(hp, GetCurrentProcessId()).c_str());
|
||||
if (!(*hooks)[currentHook].Insert(hp))
|
||||
@ -193,7 +193,7 @@ static std::mutex delayinsertlock;
|
||||
void delayinsertadd(HookParam hp,std::string name){
|
||||
std::lock_guard _(maplock);
|
||||
delayinserthook[hp.emu_addr]={name,hp};
|
||||
ConsoleOutput(INSERTING_HOOK, name.c_str());
|
||||
ConsoleOutput(INSERTING_HOOK, name.c_str(),hp.emu_addr);
|
||||
}
|
||||
void delayinsertNewHook(uintptr_t em_address){
|
||||
if(delayinserthook.find(em_address)==delayinserthook.end())return;
|
||||
|
@ -201,6 +201,10 @@ void TextHook::Send(uintptr_t lpDataBase)
|
||||
lpDataIn=jitgetaddr(stack,&hp);
|
||||
plpdatain=(uintptr_t)&lpDataIn;
|
||||
}
|
||||
else if(hp.jittype==JITTYPE::UNITY){
|
||||
plpdatain=(uintptr_t)argidx(stack,hp.argidx);
|
||||
lpDataIn=*(uintptr_t*)plpdatain;
|
||||
}
|
||||
|
||||
auto use_custom_embed_fun=(hp.type&EMBED_ABLE)&&!(hp.type&EMBED_BEFORE_SIMPLE);
|
||||
if(use_custom_embed_fun)
|
||||
@ -214,15 +218,10 @@ void TextHook::Send(uintptr_t lpDataBase)
|
||||
isstring=true;
|
||||
hp.text_fun(stack, &hp, &lpDataIn, &lpSplit, &lpCount);
|
||||
}
|
||||
else if(hp.jittype==JITTYPE::UNITY)
|
||||
else if(hp.type&SPECIAL_JIT_STRING)
|
||||
{
|
||||
auto ptr=*argidx(stack,hp.argidx);
|
||||
if(hp.type&USING_STRING)
|
||||
commonsolvemonostring(ptr,&lpDataIn,&lpCount);
|
||||
else{
|
||||
lpDataIn=(wchar_t)ptr;
|
||||
lpCount=2;
|
||||
}
|
||||
if(hp.jittype==JITTYPE::UNITY)
|
||||
commonsolvemonostring(lpDataIn,&lpDataIn,&lpCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -306,7 +305,8 @@ void TextHook::Send(uintptr_t lpDataBase)
|
||||
}
|
||||
else if(hp.hook_after)
|
||||
hp.hook_after(stack,pbData,lpCount);
|
||||
else if(hp.jittype==JITTYPE::UNITY){
|
||||
else if(hp.type&SPECIAL_JIT_STRING){
|
||||
if(hp.jittype==JITTYPE::UNITY)
|
||||
unity_ui_string_hook_after(argidx(stack,hp.argidx),pbData,lpCount);
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ enum HookParamType : uint64_t
|
||||
|
||||
USING_CHAR =0x2000000,//text_fun!=nullptr && (CODE_ANSI_BE||CODE_UTF16)
|
||||
USING_STRING = 0x1,
|
||||
|
||||
SPECIAL_JIT_STRING=0x10000000,
|
||||
|
||||
DATA_INDIRECT = 0x8,
|
||||
USING_SPLIT = 0x10, // use ctx2 or not
|
||||
|
@ -88,6 +88,9 @@ namespace
|
||||
case L'Q':
|
||||
hp.type |= USING_STRING | CODEC_UTF16;
|
||||
break;
|
||||
case L'M':
|
||||
hp.type |=SPECIAL_JIT_STRING|USING_STRING|CODEC_UTF16;
|
||||
break;
|
||||
case L'U':
|
||||
hp.type |= USING_STRING | CODEC_UTF32;
|
||||
break;
|
||||
@ -299,7 +302,9 @@ namespace
|
||||
|
||||
if(hp.type & USING_STRING)
|
||||
{
|
||||
if(hp.type&CODEC_UTF16)
|
||||
if(hp.type&SPECIAL_JIT_STRING)
|
||||
HCode+=L'M';
|
||||
else if(hp.type&CODEC_UTF16)
|
||||
HCode += L'Q';
|
||||
else if(hp.type&CODEC_UTF8)
|
||||
HCode += L'V';
|
||||
|
Loading…
x
Reference in New Issue
Block a user