mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-11-27 07:44:02 +08:00
Update NNNConfig.cpp
Update NNNConfig.cpp
This commit is contained in:
parent
614ba2aa7e
commit
37f9ff69af
@ -1,36 +1,43 @@
|
||||
#include"NNNConfig.h"
|
||||
bool NNNConfig::attach_function() {
|
||||
//blackcyc
|
||||
//开头有一些究极重复的,没办法
|
||||
//夢幻廻廊
|
||||
const BYTE bytes[] = {
|
||||
0x68,0xE8,0x03,0x00,0x00,0x6a,0x00,
|
||||
|
||||
};
|
||||
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
|
||||
if (addr == 0)return false;
|
||||
//夢幻廻廊
|
||||
//復讐の女仕官ハイネ ~肢体に刻まれる淫欲のプログラム~
|
||||
//https://vndb.org/v24955
|
||||
const BYTE bytes[] = {
|
||||
0x68,0xE8,0x03,0x00,0x00,0x6a,0x00,
|
||||
|
||||
};
|
||||
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
|
||||
if (addr == 0)return false;
|
||||
|
||||
addr = addr + sizeof(bytes);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (*(BYTE*)addr == 0xe8) {
|
||||
addr += 1;
|
||||
break;
|
||||
}
|
||||
addr += 1;
|
||||
}
|
||||
uintptr_t offset = *(uintptr_t*)(addr);
|
||||
uintptr_t funcaddr = offset + addr + 4;
|
||||
const BYTE check[] = { 0x83 ,0xEC ,0x1C };
|
||||
auto checkoffset = MemDbg::findBytes(check, sizeof(check), funcaddr, funcaddr +0x20);
|
||||
|
||||
ConsoleOutput("%p %p %p %d", addr, offset, funcaddr,checkoffset);
|
||||
if (checkoffset == 0)offset = get_stack(5);
|
||||
else offset = get_stack(6);
|
||||
HookParam hp;
|
||||
hp.address = funcaddr;
|
||||
|
||||
hp.offset = offset;
|
||||
|
||||
hp.type = USING_STRING ;
|
||||
return NewHook(hp, "NNNhook");
|
||||
addr = addr + sizeof(bytes);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (*(BYTE*)addr == 0xe8) {
|
||||
addr += 1;
|
||||
break;
|
||||
}
|
||||
addr += 1;
|
||||
}
|
||||
uintptr_t offset = *(uintptr_t*)(addr);
|
||||
uintptr_t funcaddr = offset + addr + 4;
|
||||
const BYTE check[] = { 0x83 ,0xEC ,0x1C };
|
||||
auto checkoffset = MemDbg::findBytes(check, sizeof(check), funcaddr, funcaddr +0x20);
|
||||
|
||||
if (checkoffset == 0)offset = get_stack(5);
|
||||
else offset = get_stack(6);
|
||||
HookParam hp;
|
||||
hp.address = funcaddr;
|
||||
hp.offset = offset;
|
||||
hp.type = USING_STRING|FULL_STRING;
|
||||
hp.text_fun=[](hook_stack* stack, HookParam *, uintptr_t *data, uintptr_t *split, size_t *len){
|
||||
//当前文本可以过滤重复,上一条文本会按照换行符切分不停刷新。
|
||||
static std::unordered_map<uintptr_t,std::string>everythreadlast;
|
||||
if(everythreadlast.find(stack->retaddr)==everythreadlast.end())everythreadlast[stack->retaddr]="";
|
||||
auto thisstr=std::string((char*)*data);
|
||||
if(everythreadlast[stack->retaddr]==thisstr)return;
|
||||
everythreadlast[stack->retaddr]=thisstr;
|
||||
*len=everythreadlast[stack->retaddr].size();
|
||||
};
|
||||
return NewHook(hp, "NNNhook");
|
||||
}
|
Loading…
Reference in New Issue
Block a user