mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-11-27 07:44:02 +08:00
rs length changed
This commit is contained in:
parent
06503ed972
commit
16852394ff
@ -154,11 +154,11 @@ int HookStrLen(HookParam* hp,BYTE* data){
|
|||||||
if(data==0)return 0;
|
if(data==0)return 0;
|
||||||
|
|
||||||
if(hp->type&CODEC_UTF16)
|
if(hp->type&CODEC_UTF16)
|
||||||
return wcslen((wchar_t*)data)*2;
|
return wcsnlen((wchar_t*)data,TEXT_BUFFER_SIZE)*2;
|
||||||
else if(hp->type&CODEC_UTF32)
|
else if(hp->type&CODEC_UTF32)
|
||||||
return u32strlen((uint32_t*)data)*4;
|
return u32strlen((uint32_t*)data)*4;
|
||||||
else
|
else
|
||||||
return strlen((char*)data);
|
return strnlen((char*)data,TEXT_BUFFER_SIZE);
|
||||||
|
|
||||||
}
|
}
|
||||||
static std::mutex maplock;
|
static std::mutex maplock;
|
||||||
|
@ -413,13 +413,19 @@ void TextHook::Read()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (WaitForSingleObject(readerEvent, 500) == WAIT_TIMEOUT) if (location&&(memcmp(pbData, location, dataLen) != 0)) if (int currentLen = HookStrlen((BYTE*)location))
|
while (WaitForSingleObject(readerEvent, 500) == WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
dataLen = min(currentLen, TEXT_BUFFER_SIZE);
|
if(!location)continue;
|
||||||
memcpy(pbData, location, dataLen);
|
int currentLen = HookStrlen((BYTE*)location);
|
||||||
if (hp.filter_fun && !hp.filter_fun(pbData, &dataLen, &hp) || dataLen <= 0) continue;
|
bool changed=memcmp(pbData, location, dataLen) != 0;
|
||||||
TextOutput({ GetCurrentProcessId(), address, 0, 0 },hp, buffer, dataLen);
|
if(changed ||(currentLen!=dataLen))
|
||||||
memcpy(pbData, location, dataLen);
|
{
|
||||||
|
dataLen = min(currentLen, TEXT_BUFFER_SIZE);
|
||||||
|
memcpy(pbData, location, dataLen);
|
||||||
|
if (hp.filter_fun && !hp.filter_fun(pbData, &dataLen, &hp) || dataLen <= 0) continue;
|
||||||
|
TextOutput({ GetCurrentProcessId(), address, 0, 0 },hp, buffer, dataLen);
|
||||||
|
memcpy(pbData, location, dataLen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user