mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-11-26 23:34:01 +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(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)
|
||||
return u32strlen((uint32_t*)data)*4;
|
||||
else
|
||||
return strlen((char*)data);
|
||||
return strnlen((char*)data,TEXT_BUFFER_SIZE);
|
||||
|
||||
}
|
||||
static std::mutex maplock;
|
||||
|
@ -413,14 +413,20 @@ void TextHook::Read()
|
||||
}
|
||||
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);
|
||||
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);
|
||||
}
|
||||
if(!location)continue;
|
||||
int currentLen = HookStrlen((BYTE*)location);
|
||||
bool changed=memcmp(pbData, location, dataLen) != 0;
|
||||
if(changed ||(currentLen!=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