This commit is contained in:
恍兮惚兮 2024-02-17 12:06:27 +08:00
parent 90b8dcd04a
commit 5a45c950de
5 changed files with 19 additions and 14 deletions

View File

@ -25,7 +25,7 @@
#define HIJACK_ERROR u8"Hijack ERROR"
#define COULD_NOT_FIND u8"could not find text"
#define CONSOLE L"Console"
#define InvalidLength u8"something went very wrong (invalid length %d at hook address %I64d)"
#define InvalidLength u8"something went very wrong (invalid length %d in %s)"
#define InsertHookFailed u8"failed to insert hook %s"
#define Match_Error u8"ERROR happened when matching engine %s "
#define Attach_Error u8"ERROR happened when attaching engine %s ERROR"

View File

@ -25,7 +25,7 @@
#define HIJACK_ERROR u8"Hijack 错误"
#define COULD_NOT_FIND u8"无法找到文本"
#define CONSOLE L"控制台"
#define InvalidLength u8"可能存在错误 (无效的文本长度 %d 出现在Hook地址 %I64d)"
#define InvalidLength u8"可能存在错误 (无效的文本长度 %d 出现 %s)"
#define InsertHookFailed u8"钩子注入失败 %s"
#define Match_Error u8"匹配 %s 引擎时发生错误"
#define Attach_Error u8"连接到 %s 引擎时发送错误"

View File

@ -1278,6 +1278,7 @@ namespace Private {
auto text = (LPCSTR)s->ecx;
if ( !text || !*text)
return false;
if(strlen(text)>2000)return false;
if (all_ascii(text,strlen(text)))return false;
//"。」』?―!、"
auto chatflags={"\xe3\x80\x82", "\xe3\x80\x8d","\xe3\x80\x8f","\xef\xbc\x9f","\xe2\x80\x95","\xef\xbc\x81","\xe3\x80\x81"};

View File

@ -95,7 +95,6 @@ DWORD WINAPI Pipe(LPVOID)
void TextOutput(ThreadParam tp, TextOutput_T*buffer, int len)
{
if (len < 0 || len > PIPE_BUFFER_SIZE - sizeof(tp)) ConsoleOutput(InvalidLength, len, tp.addr);
buffer->tp=tp;
WriteFile(hookPipe, buffer, sizeof(TextOutput_T) + len, DUMMY, nullptr);
}

View File

@ -128,14 +128,12 @@ void TextHook::Send(uintptr_t lpDataBase)
buffer->type=hp.type;
bool isstring=false;
if((hp.type&EMBED_ABLE)&&!(hp.type&EMBED_BEFORE_SIMPLE) )
auto use_custom_embed_fun=(hp.type&EMBED_ABLE)&&!(hp.type&EMBED_BEFORE_SIMPLE);
if(use_custom_embed_fun)
{
isstring=true;
lpRetn=0;
lpSplit=Engine::ScenarioRole;
if(hp.hook_before(stack,pbData,&lpCount,&lpSplit)==false)__leave;
if (hp.filter_fun && !hp.filter_fun(pbData, &lpCount, &hp) || lpCount <= 0) __leave;
}
else
{
@ -164,9 +162,16 @@ void TextHook::Send(uintptr_t lpDataBase)
//hook_fun&&text_fun change hookparam.type
buffer->type=hp.type;
}
if (lpCount <= 0) __leave;
if (lpCount > TEXT_BUFFER_SIZE)
{
ConsoleOutput(InvalidLength, lpCount, hp.name);
lpCount = TEXT_BUFFER_SIZE;
}
if (lpCount <= 0) __leave;
if (lpCount > TEXT_BUFFER_SIZE) lpCount = TEXT_BUFFER_SIZE;
if(!use_custom_embed_fun)
{
if ((!(hp.type&USING_CHAR))&&(isstring||(hp.type&USING_STRING)))
{
if(lpDataIn == 0)__leave;
@ -185,11 +190,11 @@ void TextHook::Send(uintptr_t lpDataBase)
*(WORD*)pbData = lpDataIn & 0xffff;
}
}
if (hp.filter_fun && !hp.filter_fun(pbData, &lpCount, &hp) || lpCount <= 0) __leave;
if (hp.type & (NO_CONTEXT | FIXING_SPLIT)) lpRetn = 0;
}
if (hp.filter_fun && !hp.filter_fun(pbData, &lpCount, &hp) || lpCount <= 0) __leave;
if (hp.type & (NO_CONTEXT | FIXING_SPLIT)) lpRetn = 0;
ThreadParam tp{ GetCurrentProcessId(), address, lpRetn, lpSplit };
if((hp.type&EMBED_ABLE)&&(check_embed_able(tp)))