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{
bool hook2(){
//誘惑女教師~熟れた蜜の味~
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)TextOutA);
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) ) {
for (auto addr : findiatcallormov_all((DWORD)TextOutA,processStartAddress,processStartAddress,processStopAddress,PAGE_EXECUTE)) {
auto funcaddr = findfuncstart(addr,0x1000);
ConsoleOutput("funcaddr %p",funcaddr);

View File

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

View File

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

View File

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

View File

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

View File

@ -404,13 +404,9 @@ bool Elf2::attach_function(){
bool ElfFunClubFinal::attach_function(){
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)TextOutA);
if(entry==0)return false;
BYTE bytes[]={0x8b,XX,XX4};//mov reg,ds:TextOutA
memcpy(bytes+2,&entry,4);
//mov reg,ds:TextOutA
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};
addr=reverseFindBytes(s,4,addr-0x100,addr);
if(addr==0)continue;

View File

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

View File

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

View File

@ -5,11 +5,7 @@ bool Tarte::attach_function() {
//ひなたると~ひなたぼっこファンディスク~
//スクールぱにっく!
//こいじばし https://vndb.org/v4247
auto entry=Util::FindImportEntry(processStartAddress,(DWORD)GetGlyphOutlineA);
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)){
for(auto addr: findiatcallormov_all((DWORD)GetGlyphOutlineA,processStartAddress,processStartAddress,processStopAddress,PAGE_EXECUTE)){
addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr) continue;
auto xrefs=findxref_reverse_checkcallop(addr,addr-0x1000,addr+0x1000,0xe8);

View File

@ -1,12 +1,8 @@
#include"Tomato.h"
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;
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);
if (!addr) continue;
HookParam hp;

View File

@ -3,12 +3,8 @@
namespace{
bool _1(){
//どうしていじってプリンセス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;
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);
if (!addr) continue;
HookParam hp;
@ -23,12 +19,8 @@ namespace{
bool _2(){
//ねとって女神
//ねとって女神 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;
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);
if (!addr) continue;
HookParam hp;

View File

@ -3,12 +3,8 @@
bool Xbangbang::attach_function() {
//さわさわ絵にっき
//さわさわ絵にっき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;
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);
if (!addr) continue;
HookParam hp;

View File

@ -1,6 +1,6 @@
#include"solfasys.h"
bool solfasys::attach_function() {
bool solfasys1() {
auto addr=MemDbg::findCallerAddressAfterInt3((DWORD)GetGlyphOutlineA,processStartAddress,processStopAddress);
ConsoleOutput("%p",addr);
if(!addr)return false;
@ -22,4 +22,32 @@ bool solfasys::attach_function() {
hp.type=CODEC_ANSI_BE|USING_CHAR;
hp.offset=get_stack(1);
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);
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
@ -647,4 +668,4 @@ std::vector<WindowInfo>get_proc_windows(){
std::vector<WindowInfo> windows;
EnumWindows(EnumWindowsProc, reinterpret_cast<LPARAM>(&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) ;
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 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
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);
std::vector<uintptr_t> findxref_reverse(uintptr_t addr, uintptr_t from, uintptr_t to);