34 lines
999 B
C++
Raw Normal View History

2024-10-03 14:53:59 +08:00
#include "5pb.h"
#include "mages/mages.h"
namespace
{
// https://vndb.org/v46553
// 新宿葬命
bool _strncat()
{
2024-05-24 19:07:16 +08:00
HookParam hp;
2024-10-03 14:53:59 +08:00
hp.address = (uintptr_t)GetProcAddress(GetModuleHandleA("ucrtbase.dll"), "strncat");
hp.type = USING_STRING | CODEC_UTF8 | NO_CONTEXT;
hp.text_fun = [](hook_stack *stack, HookParam *hp, uintptr_t *data, uintptr_t *split, size_t *len)
{
*data = stack->ARG2;
*len = stack->ARG3;
*split = stack->ARG1;
2024-05-24 19:07:16 +08:00
};
2024-10-03 14:53:59 +08:00
hp.filter_fun = [](void *data, size_t *len, HookParam *hp)
{
auto s = std::string((char *)data, *len);
strReplace(s, "%N", "\n");
// sub_140096E80
2024-05-24 19:07:16 +08:00
//%I %B %C %R( %Z %%
2024-10-03 14:53:59 +08:00
return write_string_overwrite(data, len, s);
2024-05-24 19:07:16 +08:00
};
2024-10-03 14:53:59 +08:00
return NewHook(hp, "strncat");
2024-05-24 19:07:16 +08:00
}
}
2024-10-03 14:53:59 +08:00
bool _5pb::attach_function()
{
// CHAOS;HEAD_NOAH
bool b3 = hookmages::MAGES();
return b3 || _strncat();
2024-05-24 19:07:16 +08:00
}