Showing
1 changed file
with
47 additions
and
1 deletions
... | @@ -10924,7 +10924,8 @@ bool InsertTencoHook() | ... | @@ -10924,7 +10924,8 @@ bool InsertTencoHook() |
10924 | * 00e3c354 |. 85c9 test ecx,ecx | 10924 | * 00e3c354 |. 85c9 test ecx,ecx |
10925 | * 00e3c356 |. 74 32 je short 恋する�00e3c38a | 10925 | * 00e3c356 |. 74 32 je short 恋する�00e3c38a |
10926 | */ | 10926 | */ |
10927 | -bool InsertAOSHook() | 10927 | + |
10928 | +bool InsertAOS1Hook() | ||
10928 | { | 10929 | { |
10929 | // jichi 4/2/2014: The starting of this function is different from ヂ�モノツキ | 10930 | // jichi 4/2/2014: The starting of this function is different from ヂ�モノツキ |
10930 | // So, use a pattern in the middle of the function instead. | 10931 | // So, use a pattern in the middle of the function instead. |
... | @@ -10982,6 +10983,51 @@ bool InsertAOSHook() | ... | @@ -10982,6 +10983,51 @@ bool InsertAOSHook() |
10982 | return true; | 10983 | return true; |
10983 | } | 10984 | } |
10984 | 10985 | ||
10986 | +bool InsertAOS2Hook() | ||
10987 | +{ | ||
10988 | + const BYTE bytes[] = { | ||
10989 | + 0x51, // 00C4E7E0 /$ 51 PUSH ECX ; mireado: hook here, function begins | ||
10990 | + 0x33,0xc0, // 00C4E7E1 |. 33C0 XOR EAX,EAX | ||
10991 | + 0x53, // 00C4E7E3 |. 53 PUSH EBX | ||
10992 | + 0x55, // 00C4E7E4 |. 55 PUSH EBP | ||
10993 | + 0x8b,0x2d, 0x40,0xa3,0xcf,0x00, // 00C4E7E5 |. 8B2D 40A3CF00 MOV EBP,DWORD PTR DS:[0CFA340] | ||
10994 | + 0x89,0x07, // 00C4E7EB |. 8907 MOV DWORD PTR DS:[EDI],EAX | ||
10995 | + 0x89,0x47, 0x04, // 00C4E7ED |. 8947 04 MOV DWORD PTR DS:[EDI+4],EAX | ||
10996 | + 0x56, // 00C4E7F0 |. 56 PUSH ESI | ||
10997 | + 0x8b,0x75, 0x44, // 00C4E7F1 |. 8B75 44 MOV ESI,DWORD PTR SS:[EBP+44] | ||
10998 | + }; | ||
10999 | + | ||
11000 | + enum { addr_offset = 0 }; // distance to the beginning of the function, which is 0x51 (push ecx) | ||
11001 | + ULONG range = min(module_limit_ - module_base_, MAX_REL_ADDR); | ||
11002 | + ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), module_base_, module_base_ + range); | ||
11003 | + //GROWL(reladdr); | ||
11004 | + if (!addr) { | ||
11005 | + ConsoleOutput("vnreng:AOS: pattern not found"); | ||
11006 | + return false; | ||
11007 | + } | ||
11008 | + addr += addr_offset; | ||
11009 | + //GROWL(addr); | ||
11010 | + enum { push_ecx = 0x51 }; // beginning of the function | ||
11011 | + if (*(BYTE *)addr != push_ecx) { | ||
11012 | + ConsoleOutput("vnreng:AOS: beginning of the function not found"); | ||
11013 | + return false; | ||
11014 | + } | ||
11015 | + | ||
11016 | + HookParam hp = {}; | ||
11017 | + hp.address = addr; | ||
11018 | + hp.length_offset = 1; | ||
11019 | + hp.offset = 8; | ||
11020 | + hp.type = DATA_INDIRECT; | ||
11021 | + | ||
11022 | + ConsoleOutput("vnreng: INSERT AOS2"); | ||
11023 | + NewHook(hp, "AOS2"); | ||
11024 | + return true; | ||
11025 | +} | ||
11026 | + | ||
11027 | +bool InsertAOSHook() | ||
11028 | +{ return InsertAOS1Hook() || InsertAOS2Hook();} | ||
11029 | + | ||
11030 | + | ||
10985 | /** | 11031 | /** |
10986 | * jichi 1/10/2014: Rai7 puk | 11032 | * jichi 1/10/2014: Rai7 puk |
10987 | * See: http://www.hongfire.com/forum/showthread.php/421909-%E3%80%90Space-Warfare-Sim%E3%80%91Rai-7-PUK/page10 | 11033 | * See: http://www.hongfire.com/forum/showthread.php/421909-%E3%80%90Space-Warfare-Sim%E3%80%91Rai-7-PUK/page10 | ... | ... |
-
Please register or login to post a comment