issues/20

This commit is contained in:
恍兮惚兮 2024-04-25 18:09:46 +08:00
parent 668e701d6a
commit e84af745ca
15 changed files with 78 additions and 78 deletions

View File

@ -51,12 +51,7 @@ bool InsertAGSHook()
namespace{ namespace{
bool hook2(){ bool hook2(){
//誘惑女教師~熟れた蜜の味~ //誘惑女教師~熟れた蜜の味~
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)TextOutA); for (auto addr : findiatcallormov_all((DWORD)TextOutA,processStartAddress,processStartAddress,processStopAddress,PAGE_EXECUTE)) {
if(entry==0)return false;
BYTE bytes[]={0xFF,0x15,XX4};
memcpy(bytes+2,&entry,4);
for (auto addr : Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress) ) {
auto funcaddr = findfuncstart(addr,0x1000); auto funcaddr = findfuncstart(addr,0x1000);
ConsoleOutput("funcaddr %p",funcaddr); ConsoleOutput("funcaddr %p",funcaddr);

View File

@ -176,12 +176,7 @@ DWORD calladdr(DWORD addr){
return addr; return addr;
} }
DWORD lastcall(){ DWORD lastcall(){
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)TextOutA); auto addr = findiatcallormov((DWORD)TextOutA,processStartAddress,processStartAddress, processStopAddress,true);
if(entry==0)return 0;
BYTE bytes[]={0xFF,0x15,XX4};
memcpy(bytes+2,&entry,4);
auto addr = reverseFindBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
if(addr==0)return 0; if(addr==0)return 0;
addr = MemDbg::findEnclosingAlignedFunction(addr); addr = MemDbg::findEnclosingAlignedFunction(addr);
return addr; return addr;

View File

@ -200,16 +200,12 @@ bool InsertArtemis3Hook()
namespace{ namespace{
bool a4(){ bool a4(){
//高慢な奥さんは好きですか?~傲慢人妻教師の堕とし方~ //高慢な奥さんは好きですか?~傲慢人妻教師の堕とし方~
auto entryA=Util::FindImportEntry(processStartAddress,(DWORD)GetGlyphOutlineA);
auto entryW=Util::FindImportEntry(processStartAddress,(DWORD)GetGlyphOutlineW);
std::vector<uint64_t> addrs; std::vector<uint64_t> addrs;
BYTE bytes[]={0xFF,0x15,XX4}; for(DWORD func:{(DWORD)GetGlyphOutlineA,(DWORD)GetGlyphOutlineW})
for(DWORD entry:{entryA,entryW}) {
if(entry) { auto addrs_ = findiatcallormov_all(func,processStartAddress,processStartAddress,processStopAddress,PAGE_EXECUTE);
memcpy(bytes+2,&entry,4); addrs.insert(addrs.end(), addrs_.begin(), addrs_.end());
auto addrs_ = Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress); }
addrs.insert(addrs.end(), addrs_.begin(), addrs_.end());
}
bool ok=false; bool ok=false;
for (auto addr : addrs) { for (auto addr : addrs) {
auto funcaddr = MemDbg::findEnclosingAlignedFunction(addr); auto funcaddr = MemDbg::findEnclosingAlignedFunction(addr);

View File

@ -1499,15 +1499,9 @@ namespace{
bool veryold(){ bool veryold(){
//紅月-くれないつき- //紅月-くれないつき-
//あの街の恋の詩 //あの街の恋の詩
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)GetGlyphOutlineA); auto addr = findiatcallormov((DWORD)GetGlyphOutlineA,processStartAddress,processStartAddress,processStopAddress);
if(entry==0)return false; if (addr == 0)//銀行淫~堕ちゆく女達~ //mov ebp, ds:GetGlyphOutlineA
BYTE bytes[]={0xFF,0x15,XX4}; addr = findiatcallormov((DWORD)GetGlyphOutlineA,processStartAddress,processStartAddress,processStopAddress,false,XX);
memcpy(bytes+2,&entry,4);
BYTE bytes2[]={0x8b,XX,XX4}; //mov ebp, ds:GetGlyphOutlineA
memcpy(bytes2+2,&entry,4); //銀行淫~堕ちゆく女達~
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
if (addr == 0)
addr = MemDbg::findBytes(bytes2, sizeof(bytes2), processStartAddress, processStopAddress);
if (addr == 0)return false; if (addr == 0)return false;
addr = MemDbg::findEnclosingAlignedFunction(addr); addr = MemDbg::findEnclosingAlignedFunction(addr);
if (addr == 0)return false; if (addr == 0)return false;

View File

@ -23,11 +23,7 @@ bool InsertCMVS1Hook()
//例外: //例外:
//みはる -あるとアナザーストーリー- //みはる -あるとアナザーストーリー-
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)GetGlyphOutlineA); addr = findiatcallormov((DWORD)GetGlyphOutlineA,processStartAddress,processStartAddress,processStopAddress,false,XX);
if(entry==0)return false;
BYTE bytes2[]={0x8b,XX,XX4};
memcpy(bytes2+2,&entry,4);
addr = MemDbg::findBytes(bytes2, sizeof(bytes2), processStartAddress, processStopAddress);
if (addr == 0)return false; if (addr == 0)return false;
addr = MemDbg::findEnclosingAlignedFunction(addr); addr = MemDbg::findEnclosingAlignedFunction(addr);
if (addr == 0)return false; if (addr == 0)return false;

View File

@ -404,13 +404,9 @@ bool Elf2::attach_function(){
bool ElfFunClubFinal::attach_function(){ bool ElfFunClubFinal::attach_function(){
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)TextOutA); //mov reg,ds:TextOutA
if(entry==0)return false;
BYTE bytes[]={0x8b,XX,XX4};//mov reg,ds:TextOutA
memcpy(bytes+2,&entry,4);
bool succ=false; bool succ=false;
for(auto addr:Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress)){ for(auto addr: findiatcallormov_all((DWORD)TextOutA,processStartAddress,processStartAddress,processStopAddress,PAGE_EXECUTE,XX)){
BYTE s[]={XX,0xCC,0xCC,0xCC}; BYTE s[]={XX,0xCC,0xCC,0xCC};
addr=reverseFindBytes(s,4,addr-0x100,addr); addr=reverseFindBytes(s,4,addr-0x100,addr);
if(addr==0)continue; if(addr==0)continue;

View File

@ -27,11 +27,7 @@ bool RUNE1() {
} }
bool RUNE2(){ bool RUNE2(){
//ANGEL CORE //ANGEL CORE
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)GetGlyphOutlineA); auto addr = findiatcallormov((DWORD)GetGlyphOutlineA,processStartAddress,processStartAddress, processStopAddress);
if(entry==0)return false;
BYTE bytes2[]={0xff,0x15,XX4};
memcpy(bytes2+2,&entry,4);
auto addr = MemDbg::findBytes(bytes2, sizeof(bytes2), processStartAddress, processStopAddress);
if (addr == 0)return false; if (addr == 0)return false;
BYTE sig1[]={ 0x81,0xe1,0x01,0x00,0x00,0x80,XX2,0x49,0x83,0xc9,0xfe,0x41 }; BYTE sig1[]={ 0x81,0xe1,0x01,0x00,0x00,0x80,XX2,0x49,0x83,0xc9,0xfe,0x41 };
auto _=MemDbg::findBytes(sig1, sizeof(sig1), addr, addr+0x100); auto _=MemDbg::findBytes(sig1, sizeof(sig1), addr, addr+0x100);

View File

@ -2,11 +2,8 @@
bool Speed::attach_function() { bool Speed::attach_function() {
// 藍色狂詩曲Deep Blue Rhapsody // 藍色狂詩曲Deep Blue Rhapsody
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)DrawTextA); //mov esi, ds:DrawTextA
if(entry==0)return false; auto addr = findiatcallormov((DWORD)DrawTextA,processStartAddress,processStartAddress,processStopAddress,false,0x35);
BYTE bytes2[]={0x8b,0x35,XX4}; //mov esi, ds:DrawTextA
memcpy(bytes2+2,&entry,4);
auto addr = MemDbg::findBytes(bytes2, sizeof(bytes2), processStartAddress, processStopAddress);
if (addr == 0)return false; if (addr == 0)return false;
BYTE sig1[]={ 0x68,0x00,0x04,0x00,0x00 }; BYTE sig1[]={ 0x68,0x00,0x04,0x00,0x00 };
BYTE sig2[]={ 0xFF,0xD6 }; BYTE sig2[]={ 0xFF,0xD6 };

View File

@ -5,11 +5,7 @@ bool Tarte::attach_function() {
//ひなたると~ひなたぼっこファンディスク~ //ひなたると~ひなたぼっこファンディスク~
//スクールぱにっく! //スクールぱにっく!
//こいじばし https://vndb.org/v4247 //こいじばし https://vndb.org/v4247
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)GetGlyphOutlineA); for(auto addr: findiatcallormov_all((DWORD)GetGlyphOutlineA,processStartAddress,processStartAddress,processStopAddress,PAGE_EXECUTE)){
if(entry==0)return false;
BYTE bytes[]={0xFF,0x15,XX4};
memcpy(bytes+2,&entry,4);
for(auto addr:Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress)){
addr = MemDbg::findEnclosingAlignedFunction(addr); addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr) continue; if (!addr) continue;
auto xrefs=findxref_reverse_checkcallop(addr,addr-0x1000,addr+0x1000,0xe8); auto xrefs=findxref_reverse_checkcallop(addr,addr-0x1000,addr+0x1000,0xe8);

View File

@ -1,12 +1,8 @@
#include"Tomato.h" #include"Tomato.h"
bool Tomato::attach_function() { bool Tomato::attach_function() {
//姫武者 //姫武者
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)TextOutA);
if(entry==0)return false;
BYTE bytes[]={0xFF,0x15,XX4};
memcpy(bytes+2,&entry,4);
bool ok=false; bool ok=false;
for(auto addr:Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress)){ for(auto addr:findiatcallormov_all((DWORD)TextOutA,processStartAddress,processStartAddress,processStopAddress,PAGE_EXECUTE)){
addr = MemDbg::findEnclosingAlignedFunction(addr); addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr) continue; if (!addr) continue;
HookParam hp; HookParam hp;

View File

@ -3,12 +3,8 @@
namespace{ namespace{
bool _1(){ bool _1(){
//どうしていじってプリンセスFinalRoadもうまたこんなところで3 //どうしていじってプリンセスFinalRoadもうまたこんなところで3
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)ExtTextOutA);
if(entry==0)return false;
BYTE bytes[]={0xFF,0x15,XX4};
memcpy(bytes+2,&entry,4);
bool ok=false; bool ok=false;
for(auto addr:Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress)){ for(auto addr:findiatcallormov_all((DWORD)ExtTextOutA,processStartAddress,processStartAddress,processStopAddress,PAGE_EXECUTE)){
addr = MemDbg::findEnclosingAlignedFunction(addr); addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr) continue; if (!addr) continue;
HookParam hp; HookParam hp;
@ -23,12 +19,8 @@ namespace{
bool _2(){ bool _2(){
//ねとって女神 //ねとって女神
//ねとって女神 NEO //ねとって女神 NEO
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)TextOutA);
if(entry==0)return false;
BYTE bytes[]={0xFF,0x15,XX4};
memcpy(bytes+2,&entry,4);
bool ok=false; bool ok=false;
for(auto addr:Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress)){ for(auto addr:findiatcallormov_all((DWORD)TextOutA,processStartAddress,processStartAddress,processStopAddress,PAGE_EXECUTE)){
addr = MemDbg::findEnclosingAlignedFunction(addr); addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr) continue; if (!addr) continue;
HookParam hp; HookParam hp;

View File

@ -3,12 +3,8 @@
bool Xbangbang::attach_function() { bool Xbangbang::attach_function() {
//さわさわ絵にっき //さわさわ絵にっき
//さわさわ絵にっき2 //さわさわ絵にっき2
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)GetTextExtentPoint32A);
if(entry==0)return false;
BYTE bytes[]={0xFF,0x15,XX4};
memcpy(bytes+2,&entry,4);
bool ok=false; bool ok=false;
for(auto addr:Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress)){ for(auto addr:findiatcallormov_all((DWORD)GetTextExtentPoint32A,processStartAddress,processStartAddress,processStopAddress,PAGE_EXECUTE)){
addr = MemDbg::findEnclosingAlignedFunction(addr); addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr) continue; if (!addr) continue;
HookParam hp; HookParam hp;

View File

@ -1,6 +1,6 @@
#include"solfasys.h" #include"solfasys.h"
bool solfasys::attach_function() { bool solfasys1() {
auto addr=MemDbg::findCallerAddressAfterInt3((DWORD)GetGlyphOutlineA,processStartAddress,processStopAddress); auto addr=MemDbg::findCallerAddressAfterInt3((DWORD)GetGlyphOutlineA,processStartAddress,processStopAddress);
ConsoleOutput("%p",addr); ConsoleOutput("%p",addr);
if(!addr)return false; if(!addr)return false;
@ -22,4 +22,32 @@ bool solfasys::attach_function() {
hp.type=CODEC_ANSI_BE|USING_CHAR; hp.type=CODEC_ANSI_BE|USING_CHAR;
hp.offset=get_stack(1); hp.offset=get_stack(1);
return NewHook(hp,"solfasys"); return NewHook(hp,"solfasys");
}
bool solfasys2() {
//https://vndb.org/v5173
//Princess Fortissimo
auto addr=findiatcallormov((DWORD)GetGlyphOutlineA,processStartAddress,processStartAddress,processStopAddress);
ConsoleOutput("%p",addr);
if(!addr)return false;
addr=MemDbg::findEnclosingAlignedFunction(addr);
ConsoleOutput("%p",addr);
if(!addr)return false;
auto addrs=findxref_reverse_checkcallop(addr,processStartAddress,processStopAddress,0xe8);
if(addrs.size()!=2)return false;
addr=addrs[1];//仅这作是第一个,其他作都是第二个
ConsoleOutput("%p",addr);
addr=MemDbg::findEnclosingAlignedFunction(addr);
ConsoleOutput("%p",addr);
if(!addr)return false;
HookParam hp;
hp.address=addr;
hp.type=CODEC_ANSI_BE|USING_CHAR;
hp.offset=get_stack(1);
return NewHook(hp,"solfasys");
}
bool solfasys::attach_function() {
return solfasys1()||solfasys2();
} }

View File

@ -439,7 +439,28 @@ uintptr_t findfuncstart(uintptr_t addr,uintptr_t range){
addr = reverseFindBytes(funcstart, sizeof(funcstart), addr-range, addr); addr = reverseFindBytes(funcstart, sizeof(funcstart), addr-range, addr);
return addr; return addr;
} }
#define buildbytes(ret) auto entry=Util::FindImportEntry(hmodule,addr); \
if(entry==0)return ret;\
BYTE bytes[]={XX,XX,XX4};\
if(movreg){\
bytes[0]=0x8b,bytes[1]=movreg;\
}\
else{\
bytes[0]=0xff;bytes[1]=0x15;\
}\
memcpy(bytes+2,&entry,4);
uintptr_t findiatcallormov(uintptr_t addr,DWORD hmodule, uintptr_t start, uintptr_t end,bool reverse,BYTE movreg){
buildbytes(0)
if(reverse)
return reverseFindBytes(bytes, sizeof(bytes), start, end);
else
return MemDbg::findBytes(bytes, sizeof(bytes), start, end);
}
std::vector<uintptr_t> findiatcallormov_all(uintptr_t addr, DWORD hmodule,uintptr_t start, uintptr_t end,DWORD protect,BYTE movreg){
buildbytes({})
return Util::SearchMemory(bytes, sizeof(bytes), protect, start, end);
}
#endif #endif
@ -647,4 +668,4 @@ std::vector<WindowInfo>get_proc_windows(){
std::vector<WindowInfo> windows; std::vector<WindowInfo> windows;
EnumWindows(EnumWindowsProc, reinterpret_cast<LPARAM>(&windows)); EnumWindows(EnumWindowsProc, reinterpret_cast<LPARAM>(&windows));
return windows; return windows;
} }

View File

@ -57,10 +57,16 @@ std::vector<DWORD> findrelativecall(const BYTE* pattern ,int length,DWORD callad
std::vector<DWORD> findxref_reverse_checkcallop(DWORD addr, DWORD from, DWORD to,BYTE op) ; std::vector<DWORD> findxref_reverse_checkcallop(DWORD addr, DWORD from, DWORD to,BYTE op) ;
uintptr_t finddllfunctioncall(uintptr_t funcptr,uintptr_t start, uintptr_t end,WORD sig=0x15ff,bool reverse=false); uintptr_t finddllfunctioncall(uintptr_t funcptr,uintptr_t start, uintptr_t end,WORD sig=0x15ff,bool reverse=false);
uintptr_t findfuncstart(uintptr_t addr,uintptr_t range=0x100); uintptr_t findfuncstart(uintptr_t addr,uintptr_t range=0x100);
uintptr_t findiatcallormov(uintptr_t addr, DWORD hmodule,uintptr_t start, uintptr_t end,bool reverse=false,BYTE movreg=0);
std::vector<uintptr_t> findiatcallormov_all(uintptr_t addr, DWORD hmodule,uintptr_t start, uintptr_t end,DWORD protect,BYTE movreg=0);
#endif #endif
uintptr_t find_pattern(const char* pattern,uintptr_t start,uintptr_t end); uintptr_t find_pattern(const char* pattern,uintptr_t start,uintptr_t end);
uintptr_t reverseFindBytes(const BYTE* pattern, int length, uintptr_t start, uintptr_t end,int offset=0,bool checkalign=false); uintptr_t reverseFindBytes(const BYTE* pattern, int length, uintptr_t start, uintptr_t end,int offset=0,bool checkalign=false);
std::vector<uintptr_t> findxref_reverse(uintptr_t addr, uintptr_t from, uintptr_t to); std::vector<uintptr_t> findxref_reverse(uintptr_t addr, uintptr_t from, uintptr_t to);