2024-02-07 20:59:24 +08:00
# include"Siglus.h"
namespace { // unnamed
/**
* jichi 8 / 17 / 2013 : SiglusEngine from siglusengine . exe
* The old hook does not work for new games .
* The new hook cannot recognize character names .
* Insert old first . As the pattern could also be found in the old engine .
*/
/** jichi 10/25/2014: new SiglusEngine3 that can extract character name
*
* Sample game : リ ア 兂 <EFBFBD> ラ ス メ イ ト 孕 ま せ 催 <EFBFBD> - - / HW - 4 @ F67DC : SiglusEngine . exe
* The character is in [ edx + ecx * 2 ] . Text in edx , and offset in ecx .
*
* 002667 be cc int3
* 002667 bf cc int3
* 002667 c0 55 push ebp ; jichi : hook here
* 002667 c1 8 bec mov ebp , esp
* 002667 c3 8 bd1 mov edx , ecx
* 002667 c5 8 b4d 0 c mov ecx , dword ptr ss : [ ebp + 0xc ]
* 002667 c8 83f 9 01 cmp ecx , 0x1
* 002667 cb 75 17 jnz short .002667e4
* 002667 cd 837 a 14 08 cmp dword ptr ds : [ edx + 0x14 ] , 0x8
* 002667 d1 72 02 jb short .002667 d5
* 002667 d3 8 b12 mov edx , dword ptr ds : [ edx ]
* 002667 d5 8 b4d 08 mov ecx , dword ptr ss : [ ebp + 0x8 ]
* 002667 d8 66 : 8 b45 10 mov ax , word ptr ss : [ ebp + 0x10 ]
* 002667 dc 66 : 89044 a mov word ptr ds : [ edx + ecx * 2 ] , ax ; jichi : wchar_t is in ax
* 002667e0 5 d pop ebp
* 002667e1 c2 0 c00 retn 0xc
* 002667e4 837 a 14 08 cmp dword ptr ds : [ edx + 0x14 ] , 0x8
* 002667e8 72 02 jb short .002667 ec
* 002667 ea 8 b12 mov edx , dword ptr ds : [ edx ]
* 002667 ec 8 b45 08 mov eax , dword ptr ss : [ ebp + 0x8 ]
* 002667 ef 57 push edi
* 002667f 0 8 d3c42 lea edi , dword ptr ds : [ edx + eax * 2 ]
* 002667f 3 85 c9 test ecx , ecx
* 002667f 5 74 16 je short .0026680 d
* 002667f 7 8 b45 10 mov eax , dword ptr ss : [ ebp + 0x10 ]
* 002667f a 0f b7d0 movzx edx , ax
* 002667f d 8 bc2 mov eax , edx
* 002667ff c1e2 10 shl edx , 0x10
* 00266 802 0 bc2 or eax , edx
* 00266 804 d1e9 shr ecx , 1
* 00266 806 f3 : ab rep stos dword ptr es : [ edi ]
* 00266 808 13 c9 adc ecx , ecx
* 00266 80 a 66 : f3 : ab rep stos word ptr es : [ edi ]
* 00266 80 d 5f pop edi
* 00266 80 e 5 d pop ebp
* 0026680f c2 0 c00 retn 0xc
* 00266 812 cc int3
* 00266 813 cc int3
*
* Stack when enter function call :
* 04 cee270 00266 870 return to .00266870 from .002667 c0
* 04 cee274 00000002 jichi : arg1 , ecx
* 04 cee278 00000001 jichi : arg2 , always 1
* 04 cee27c 000050 ac jichi : arg3 , wchar_t
* 04 cee280 04 cee4fc jichi : text address
* 04 cee284 0 ead055c arg5
* 04 cee288 0 ead0568 arg6 , last text when arg6 = arg5 = 2
* 04 cee28c / 04 cee2c0
* 04 cee290 | 00266 969 return to .00266969 from .00266820
* 04 cee294 | 00000001
* 04 cee298 | 000050 ac
* 04 cee29c | e1466fb2
* 04 cee2a0 | 072f 45f 0
*
* Target address ( edx ) is at [[ecx]] when enter function .
*/
// jichi: 8/17/2013: Change return type to bool
bool InsertSiglus3Hook ( )
{
const BYTE bytes [ ] = {
0x8b , 0x12 , // 002667d3 8b12 mov edx,dword ptr ds:[edx]
0x8b , 0x4d , 0x08 , // 002667d5 8b4d 08 mov ecx,dword ptr ss:[ebp+0x8]
0x66 , 0x8b , 0x45 , 0x10 , // 002667d8 66:8b45 10 mov ax,word ptr ss:[ebp+0x10]
0x66 , 0x89 , 0x04 , 0x4a // 002667dc 66:89044a mov word ptr ds:[edx+ecx*2],ax ; jichi: wchar_t in ax
// 002667e0 5d pop ebp
// 002667e1 c2 0c00 retn 0xc
} ;
enum { addr_offset = sizeof ( bytes ) - 4 } ;
ULONG range = max ( processStopAddress - processStartAddress , MAX_REL_ADDR ) ;
ULONG addr = MemDbg : : findBytes ( bytes , sizeof ( bytes ) , processStartAddress , processStartAddress + range ) ;
if ( ! addr ) {
//ConsoleOutput("Unknown SiglusEngine");
ConsoleOutput ( " Siglus3: pattern not found " ) ;
return false ;
}
//addr = MemDbg::findEnclosingAlignedFunction(addr, 50); // 0x002667dc - 0x002667c0 = 28
//if (!addr) {
// ConsoleOutput("Siglus3: enclosing function not found");
// return false;
//}
HookParam hp ;
hp . address = addr + addr_offset ;
hp . offset = get_reg ( regs : : eax ) ;
hp . type = CODEC_UTF16 ;
//hp.text_fun = SpecialHookSiglus3;
ConsoleOutput ( " INSERT Siglus3 " ) ;
return NewHook ( hp , " SiglusEngine3 " ) ;
}
/** SiglusEngine4 5/23/2015
* Sample game : AngleBeats trial
* Alternative ATcode from EGDB :
* UNIKOFILTER ( 30 ) , FORCEFONT ( 5 ) , HOOK ( SiglusEngine . exe ! 0x0018CF39 , TRANS ( EAX , UNICODE , SMSTR , ADDNULL ) , RETNPOS ( SOURCE ) )
* Text address is [ eax ]
*
* 0042 CEFD CC INT3
* 0042 CEFE CC INT3
* 0042 CEFF CC INT3
* 0042 CF00 55 PUSH EBP
* 0042 CF01 8 BEC MOV EBP , ESP
* 0042 CF03 51 PUSH ECX
* 0042 CF04 A1 005E8 A00 MOV EAX , DWORD PTR DS : [ 0x8A5E00 ]
* 0042 CF09 53 PUSH EBX
* 0042 CF0A 56 PUSH ESI
* 0042 CF0B 57 PUSH EDI
* 0042 CF0C 8 B40 10 MOV EAX , DWORD PTR DS : [ EAX + 0x10 ]
* 0042 CF0F 8 BF9 MOV EDI , ECX
* 0042 CF11 33 C9 XOR ECX , ECX
* 0042 CF13 C745 FC 00000000 MOV DWORD PTR SS : [ EBP - 0x4 ] , 0x0
* 0042 CF1A 6 A FF PUSH - 0x1
* 0042 CF1C 51 PUSH ECX
* 0042 CF1D 83E8 18 SUB EAX , 0x18
* 0042 CF20 C747 14 07000000 MOV DWORD PTR DS : [ EDI + 0x14 ] , 0x7
* 0042 CF27 C747 10 00000000 MOV DWORD PTR DS : [ EDI + 0x10 ] , 0x0
* 0042 CF2E 66 : 890F MOV WORD PTR DS : [ EDI ] , CX
* 0042 CF31 8 BCF MOV ECX , EDI
* 0042 CF33 50 PUSH EAX
* 0042 CF34 E8 E725F6FF CALL .0038F 520
* 0042 CF39 8 B1D 005E8 A00 MOV EBX , DWORD PTR DS : [ 0x8A5E00 ] ; jichi : ATcode hooked here , text sometimes in eax sometimes address in eax , size in [ eax + 0x16 ]
* 0042 CF3F 8 B73 10 MOV ESI , DWORD PTR DS : [ EBX + 0x10 ]
* 0042 CF42 837 E FC 08 CMP DWORD PTR DS : [ ESI - 0x4 ] , 0x8
* 0042 CF46 72 0 B JB SHORT .0042 CF53
* 0042 CF48 FF76 E8 PUSH DWORD PTR DS : [ ESI - 0x18 ]
* 0042 CF4B E8 EA131300 CALL .0055E33 A
* 0042 CF50 83 C4 04 ADD ESP , 0x4
* 0042 CF53 33 C0 XOR EAX , EAX
* 0042 CF55 C746 FC 07000000 MOV DWORD PTR DS : [ ESI - 0x4 ] , 0x7
* 0042 CF5C C746 F8 00000000 MOV DWORD PTR DS : [ ESI - 0x8 ] , 0x0
* 0042 CF63 66 : 8946 E8 MOV WORD PTR DS : [ ESI - 0x18 ] , AX
* 0042 CF67 8 BC7 MOV EAX , EDI
* 0042 CF69 8343 10 E8 ADD DWORD PTR DS : [ EBX + 0x10 ] , - 0x18
* 0042 CF6D 5F POP EDI
* 0042 CF6E 5 E POP ESI
* 0042 CF6F 5 B POP EBX
* 0042 CF70 8 BE5 MOV ESP , EBP
* 0042 CF72 5 D POP EBP
* 0042 CF73 C3 RETN
* 0042 CF74 CC INT3
* 0042 CF75 CC INT3
* 0042 CF76 CC INT3
* 0042 CF77 CC INT3
*/
bool Siglus4Filter ( LPVOID data , size_t * size , HookParam * )
{
auto text = reinterpret_cast < LPWSTR > ( data ) ;
auto len = reinterpret_cast < size_t * > ( size ) ;
// Remove "NNLI"
//if (*len > 2 && ::all_ascii(text))
// return false;
//if (*len == 2 && *text == L'N')
// return false;
StringFilter ( text , len , L " NLI " , 3 ) ;
// Replace 『<> (300e, 300f) with 「<> (300c,300d)
//CharReplacer(text, len, 0x300e, 0x300c);
//CharReplacer(text, len, 0x300f, 0x300d);
return true ;
}
void SpecialHookSiglus4 ( hook_stack * stack , HookParam * hp , uintptr_t * data , uintptr_t * split , size_t * len )
{
//static uint64_t lastTextHash_;
DWORD eax = stack - > eax ; // text
if ( ! eax | | ! * ( const BYTE * ) eax ) // empty data
return ;
DWORD size = * ( DWORD * ) ( eax + 0x10 ) ;
if ( ! size )
return ;
if ( size < 8 )
* data = eax ;
else
* data = * ( DWORD * ) eax ;
// Skip all ascii characters
if ( all_ascii ( ( LPCWSTR ) * data ) )
return ;
// Avoid duplication
//LPCWSTR text = (LPCWSTR)*data;
//auto hash = hashstr(text);
//if (hash == lastTextHash_)
// return;
//lastTextHash_ = hash;
* len = size * 2 ; // UTF-16
DWORD s0 = stack - > retaddr ; // use stack[0] as split
if ( s0 < = 0xff ) // scenario text
* split = FIXED_SPLIT_VALUE ;
else if ( : : IsBadReadPtr ( ( LPCVOID ) s0 , 4 ) )
* split = s0 ;
else {
* split = * ( DWORD * ) s0 ; // This value is runtime dependent
if ( * split = = 0x54 )
* split = FIXED_SPLIT_VALUE * 2 ;
}
* split + = stack - > stack [ 1 ] ; // plus stack[1] as split
}
bool InsertSiglus4Hook ( )
{
const BYTE bytes [ ] = {
0xc7 , 0x47 , 0x14 , 0x07 , 0x00 , 0x00 , 0x00 , // 0042cf20 c747 14 07000000 mov dword ptr ds:[edi+0x14],0x7
0xc7 , 0x47 , 0x10 , 0x00 , 0x00 , 0x00 , 0x00 , // 0042cf27 c747 10 00000000 mov dword ptr ds:[edi+0x10],0x0
0x66 , 0x89 , 0x0f , // 0042cf2e 66:890f mov word ptr ds:[edi],cx
0x8b , 0xcf , // 0042cf31 8bcf mov ecx,edi
0x50 , // 0042cf33 50 push eax
0xe8 //XX4 // 0042cf34 e8 e725f6ff call .0038f520
// hook here
} ;
enum { addr_offset = sizeof ( bytes ) + 4 } ; // +4 for the call address
ULONG range = max ( processStopAddress - processStartAddress , MAX_REL_ADDR ) ;
ULONG addr = MemDbg : : findBytes ( bytes , sizeof ( bytes ) , processStartAddress , processStartAddress + range ) ;
//ULONG addr = processStartAddress + 0x0018cf39;
if ( ! addr ) {
//ConsoleOutput("Unknown SiglusEngine");
ConsoleOutput ( " Siglus4: pattern not found " ) ;
return false ;
}
//addr = MemDbg::findEnclosingAlignedFunction(addr, 50); // 0x002667dc - 0x002667c0 = 28
//if (!addr) {
// ConsoleOutput("Siglus3: enclosing function not found");
// return false;
//}
HookParam hp ;
hp . address = addr + addr_offset ;
hp . type = NO_CONTEXT | CODEC_UTF16 ;
hp . text_fun = SpecialHookSiglus4 ;
hp . filter_fun = Siglus4Filter ;
//hp.offset=get_reg(regs::eax);
//hp.type = CODEC_UTF16|DATA_INDIRECT|USING_SPLIT|NO_CONTEXT;
//hp.type = CODEC_UTF16|USING_SPLIT|NO_CONTEXT;
ConsoleOutput ( " INSERT Siglus4 " ) ;
return NewHook ( hp , " SiglusEngine4 " ) ;
}
#if 0 // not all text can be extracted
/** jichi: 6/16/2015 Siglus4Engine for Frill games
* Sample game : 冺 <EFBFBD> 少 女
*
* This function is found by tracking where the text length is modified
*
* Base address : 0x070000
*
* 0020F 51 B CC INT3
* 0020F 51 C CC INT3
* 0020F 51 D CC INT3
* 0020F 51 E CC INT3
* 0020F 51F CC INT3
* 0020F 520 55 PUSH EBP ; jichi : memory address in [ arg1 + 0x4 ] , text length in arg1
* 0020F 521 8 BEC MOV EBP , ESP
* 0020F 523 6 A FF PUSH - 0x1
* 0020F 525 68 889 B5900 PUSH .00599 B88
* 0020F 52 A 64 : A1 00000000 MOV EAX , DWORD PTR FS : [ 0 ]
* 0020F 530 50 PUSH EAX
* 0020F 531 83 EC 1 C SUB ESP , 0x1C
* 0020F 534 53 PUSH EBX
* 0020F 535 56 PUSH ESI
* 0020F 536 57 PUSH EDI
* 0020F 537 A1 E0946500 MOV EAX , DWORD PTR DS : [ 0x6594E0 ]
* 0020F 53 C 33 C5 XOR EAX , EBP
* 0020F 53 E 50 PUSH EAX
* 0020F 53F 8 D45 F4 LEA EAX , DWORD PTR SS : [ EBP - 0xC ]
* 0020F 542 64 : A3 00000000 MOV DWORD PTR FS : [ 0 ] , EAX
* 0020F 548 8 BD1 MOV EDX , ECX
* 0020F 54 A 8955 F0 MOV DWORD PTR SS : [ EBP - 0x10 ] , EDX
* 0020F 54 D 8 B45 0 C MOV EAX , DWORD PTR SS : [ EBP + 0xC ]
* 0020F 550 8 B5D 10 MOV EBX , DWORD PTR SS : [ EBP + 0x10 ]
* 0020F 553 3 BC3 CMP EAX , EBX
* 0020F 555 0F 8 D DF000000 JGE .0020F 63 A
* 0020F 55 B 8 B75 08 MOV ESI , DWORD PTR SS : [ EBP + 0x8 ]
* 0020F 55 E 8 D0C40 LEA ECX , DWORD PTR DS : [ EAX + EAX * 2 ]
* 0020F 561 C1E1 03 SHL ECX , 0x3
* 0020F 564 2 BD8 SUB EBX , EAX
* 0020F 566 894 D 0 C MOV DWORD PTR SS : [ EBP + 0xC ] , ECX
* 0020F 569 8 DA424 00000000 LEA ESP , DWORD PTR SS : [ ESP ]
* 0020F 570 8 B82 A4000000 MOV EAX , DWORD PTR DS : [ EDX + 0xA4 ]
* 0020F 576 03 C1 ADD EAX , ECX
* 0020F 578 C745 EC 07000000 MOV DWORD PTR SS : [ EBP - 0x14 ] , 0x7
* 0020F 57F 33 C9 XOR ECX , ECX
* 0020F 581 C745 E8 00000000 MOV DWORD PTR SS : [ EBP - 0x18 ] , 0x0
* 0020F 588 6 A FF PUSH - 0x1
* 0020F 58 A 51 PUSH ECX
* 0020F 58 B 66 : 894 D D8 MOV WORD PTR SS : [ EBP - 0x28 ] , CX
* 0020F 58F 8 D4D D8 LEA ECX , DWORD PTR SS : [ EBP - 0x28 ]
* 0020F 592 50 PUSH EAX
* 0020F 593 E8 68 EFF4FF CALL .0015E500
* 0020F 598 C745 FC 00000000 MOV DWORD PTR SS : [ EBP - 0x4 ] , 0x0
* 0020F 59F 8 BCE MOV ECX , ESI
* 0020F 5 A1 8 B46 0 C MOV EAX , DWORD PTR DS : [ ESI + 0xC ]
* 0020F 5 A4 8 B7D E8 MOV EDI , DWORD PTR SS : [ EBP - 0x18 ]
* 0020F 5 A7 83 C0 04 ADD EAX , 0x4
* 0020F 5 AA 50 PUSH EAX
* 0020F 5 AB E8 209 DF5FF CALL .001692 D0
* 0020F 5 B0 8 B0E MOV ECX , DWORD PTR DS : [ ESI ]
* 0020F 5 B2 8 D55 D8 LEA EDX , DWORD PTR SS : [ EBP - 0x28 ]
* 0020F 5 B5 33 C0 XOR EAX , EAX
* 0020F 5 B7 3 B4E 04 CMP ECX , DWORD PTR DS : [ ESI + 0x4 ]
* 0020F 5 BA 0F 44 C8 CMOVE ECX , EAX
* 0020F 5 BD 8 B46 0 C MOV EAX , DWORD PTR DS : [ ESI + 0xC ]
* 0020F 5 C0 893 C01 MOV DWORD PTR DS : [ ECX + EAX ] , EDI ; jichi : text length modified here
* 0020F 5 C3 8 B45 E8 MOV EAX , DWORD PTR SS : [ EBP - 0x18 ]
* 0020F 5 C6 8346 0 C 04 ADD DWORD PTR DS : [ ESI + 0xC ] , 0x4
* 0020F 5 CA 8 B4D D8 MOV ECX , DWORD PTR SS : [ EBP - 0x28 ]
* 0020F 5 CD 8 D3C00 LEA EDI , DWORD PTR DS : [ EAX + EAX ]
* 0020F 5 D0 8 B45 EC MOV EAX , DWORD PTR SS : [ EBP - 0x14 ]
* 0020F 5 D3 83F 8 08 CMP EAX , 0x8
* 0020F 5 D6 0F 43 D1 CMOVNB EDX , ECX
* 0020F 5 D9 8955 10 MOV DWORD PTR SS : [ EBP + 0x10 ] , EDX
* 0020F 5 DC 85FF TEST EDI , EDI
* 0020F 5 DE 7 E 32 JLE SHORT .0020F 612
* 0020F 5E0 8 B46 0 C MOV EAX , DWORD PTR DS : [ ESI + 0xC ]
* 0020F 5E3 8 BCE MOV ECX , ESI
* 0020F 5E5 03 C7 ADD EAX , EDI
* 0020F 5E7 50 PUSH EAX
* 0020F 5E8 E8 E39CF5FF CALL .001692 D0
* 0020F 5 ED 8 B0E MOV ECX , DWORD PTR DS : [ ESI ]
* 0020F 5 EF 33 C0 XOR EAX , EAX
* 0020F 5F 1 3 B4E 04 CMP ECX , DWORD PTR DS : [ ESI + 0x4 ]
* 0020F 5F 4 57 PUSH EDI
* 0020F 5F 5 FF75 10 PUSH DWORD PTR SS : [ EBP + 0x10 ]
* 0020F 5F 8 0F 44 C8 CMOVE ECX , EAX
* 0020F 5F B 8 B46 0 C MOV EAX , DWORD PTR DS : [ ESI + 0xC ]
* 0020F 5F E 03 C1 ADD EAX , ECX
* 0020F 600 50 PUSH EAX
* 0020F 601 E8 EA1B1200 CALL .003311F 0
* 0020F 606 8 B45 EC MOV EAX , DWORD PTR SS : [ EBP - 0x14 ]
* 0020F 609 83 C4 0 C ADD ESP , 0xC
* 0020F 60 C 017 E 0 C ADD DWORD PTR DS : [ ESI + 0xC ] , EDI
* 0020F 60F 8 B4D D8 MOV ECX , DWORD PTR SS : [ EBP - 0x28 ]
* 0020F 612 C745 FC FFFFFFFF MOV DWORD PTR SS : [ EBP - 0x4 ] , - 0x1
* 0020F 619 83F 8 08 CMP EAX , 0x8
* 0020F 61 C 72 09 JB SHORT .0020F 627
* 0020F 61 E 51 PUSH ECX
* 0020F 61F E8 A6DC1100 CALL .0032 D2CA
* 0020F 624 83 C4 04 ADD ESP , 0x4
* 0020F 627 8 B4D 0 C MOV ECX , DWORD PTR SS : [ EBP + 0xC ]
* 0020F 62 A 8 B55 F0 MOV EDX , DWORD PTR SS : [ EBP - 0x10 ]
* 0020F 62 D 83 C1 18 ADD ECX , 0x18
* 0020F 630 894 D 0 C MOV DWORD PTR SS : [ EBP + 0xC ] , ECX
* 0020F 633 4 B DEC EBX
* 0020F 634 ^ 0F 85 36FF FFFF JNZ .0020F 570
* 0020F 63 A 8 B4D F4 MOV ECX , DWORD PTR SS : [ EBP - 0xC ]
* 0020F 63 D 64 : 890 D 00000000 MOV DWORD PTR FS : [ 0 ] , ECX
* 0020F 644 59 POP ECX
* 0020F 645 5F POP EDI
* 0020F 646 5 E POP ESI
* 0020F 647 5 B POP EBX
* 0020F 648 8 BE5 MOV ESP , EBP
* 0020F 64 A 5 D POP EBP
* 0020F 64 B C2 0 C00 RETN 0xC
* 0020F 64 E CC INT3
* 0020F 64F CC INT3
*/
void SpecialHookSiglus4 ( hook_stack * stack , HookParam * hp , uintptr_t * data , uintptr_t * split , size_t * len )
{
static uint64_t lastTextHash_ ;
DWORD arg1 = argof ( 1 , esp_base ) ; // arg1
DWORD addr = * ( DWORD * ) ( arg1 + 4 ) ;
int size = * ( DWORD * ) addr ;
if ( size < = 0 | | size > VNR_TEXT_CAPACITY )
return ;
auto text = LPWSTR ( addr + 4 ) ;
if ( ! text | | : : IsBadWritePtr ( text , size * 2 ) | | ! * text | | : : wcslen ( text ) ! = size | | lastTextHash_ = = hashstr ( text ) ) // || text[size+1], skip if text's size + 1 is not empty
return ;
lastTextHash_ = hashstr ( text ) ; // skip last repetition
* len = size * 2 ;
* data = ( DWORD ) text ;
* split = argof ( 3 , esp_base ) ; // arg3
}
bool InsertSiglus4Hook ( )
{
ULONG processStartAddress , processStopAddress ;
if ( ! FillRange ( processName , & startAddress , & stopAddress ) ) { // need accurate stopAddress
ConsoleOutput ( " Siglus4: failed to get memory range " ) ;
return false ;
}
const BYTE bytes [ ] = {
0x8b , 0x75 , 0x08 , // 0020f55b 8b75 08 mov esi,dword ptr ss:[ebp+0x8]
0x8d , 0x0c , 0x40 , // 0020f55e 8d0c40 lea ecx,dword ptr ds:[eax+eax*2]
0xc1 , 0xe1 , 0x03 , // 0020f561 c1e1 03 shl ecx,0x3
0x2b , 0xd8 , // 0020f564 2bd8 sub ebx,eax
0x89 , 0x4d , 0x0c // 0020f566 894d 0c mov dword ptr ss:[ebp+0xc],ecx
// The following pattern is not unique, there are at least four matches
// // 0020f5b7 3b4e 04 cmp ecx,dword ptr ds:[esi+0x4]
// // 0020f5ba 0f44c8 cmove ecx,eax
//0x8b,0x46, 0x0c, // 0020f5bd 8b46 0c mov eax,dword ptr ds:[esi+0xc]
//0x89,0x3c,0x01, // 0020f5c0 893c01 mov dword ptr ds:[ecx+eax],edi ; jichi: text length modified here
//0x8b,0x45, 0xe8, // 0020f5c3 8b45 e8 mov eax,dword ptr ss:[ebp-0x18]
//0x83,0x46, 0x0c, 0x04, // 0020f5c6 8346 0c 04 add dword ptr ds:[esi+0xc],0x4
//0x8b,0x4d, 0xd8, // 0020f5ca 8b4d d8 mov ecx,dword ptr ss:[ebp-0x28]
//0x8d,0x3c,0x00 // 0020f5cd 8d3c00 lea edi,dword ptr ds:[eax+eax]
// // 0020f5d0 8b45 ec mov eax,dword ptr ss:[ebp-0x14]
} ;
ULONG addr = MemDbg : : findBytes ( bytes , sizeof ( bytes ) , processStartAddress , processStopAddress ) ;
if ( ! addr ) {
//ConsoleOutput("Unknown SiglusEngine");
ConsoleOutput ( " Siglus4: pattern not found " ) ;
return false ;
}
addr = MemDbg : : findEnclosingAlignedFunction ( addr , 0x100 ) ; // 0x0020f55b - 0x0020F520 = 59
if ( ! addr ) {
ConsoleOutput ( " Siglus4: enclosing function not found " ) ;
return false ;
}
//addr += 0x0020f64b - 0x0020f520; // hook to ret instead
HookParam hp ;
hp . address = addr ;
//hp.type = CODEC_UTF16;
hp . type = NO_CONTEXT ;
hp . text_fun = SpecialHookSiglus4 ;
hp . filter_fun = Siglus4Filter ; // remove NLI from the game
//GROWL_DWORD(addr);
ConsoleOutput ( " INSERT Siglus4 " ) ;
NewHook ( hp , " SiglusEngine4 " ) ;
ConsoleOutput ( " Siglus4: disable GDI hooks " ) ;
return true ;
}
# endif // 0
/**
* jichi 8 / 16 / 2013 : Insert new siglus hook
* See ( CaoNiMaGeBi ) : http : //tieba.baidu.com/p/2531786952
* Issue : floating text
* Example :
* 01535 88 b9534fdffff8b43583bd7
* 0153 58 add dword ptr ds : [ ebx + 58 ] , edx
* 8 b95 34f dffff mov edx , dword ptr ss : [ ebp - 2 cc ]
* 8 b43 58 mov eax , dword ptr ds : [ ebx + 58 ]
* 3 bd7 cmp edx , edi ; hook here
*
* / HW - 1 C @ D9DB2 : SiglusEngine . exe
* - addr : 892338 ( 0xd9db2 )
* - text_fun : 0x0
* - function : 0
* - hook_len : 0
* - ind : 0
* - length_offset : 1
* - module : 356004490 ( 0x1538328a )
* - off : 4294967264 ( 0xffffffe0L , 0 x - 20 )
* - recover_len : 0
* - split : 0
* - split_ind : 0
* - type : 66 ( 0x42 )
*
* 10 / 19 / 2014 : There are currently two patterns to find the function to render scenario text .
* In the future , if both of them do not work again , try the following pattern instead .
* It is used to infer SiglusEngine2 ' s logic in vnragent .
*
* 01140f 8 d 56 push esi
* 01140f 8 e 8 d8b 0 c010000 lea ecx , dword ptr ds : [ ebx + 0x10c ]
* 01140f 94 e8 67 acfcff call .0110 bc00
* 01140f 99 837f 14 08 cmp dword ptr ds : [ edi + 0x14 ] , 0x8
* 01140f 9 d 72 04 jb short .01140f a3
* 01140f 9f 8 b37 mov esi , dword ptr ds : [ edi ]
* 01140f a1 eb 02 jmp short .01140f a5
*
* Type1 ( 聖 娼 女 ) :
*
* 013 aac6c cc int3
* 013 aac6d cc int3
* 013 aac6e cc int3
* 013 aac6f cc int3
* 013 aac70 55 push ebp ; jichi : vnragent hooked here
* 013 aac71 8 bec mov ebp , esp
* 013 aac73 6 a ff push - 0x1
* 013 aac75 68 d8306101 push .016130 d8
* 013 aac7a 64 : a1 00000000 mov eax , dword ptr fs : [ 0 ]
* 013 aac80 50 push eax
* 013 aac81 81 ec dc020000 sub esp , 0x2dc
* 013 aac87 a1 90f 46 a01 mov eax , dword ptr ds : [ 0x16af490 ]
* 013 aac8c 33 c5 xor eax , ebp
* 013 aac8e 8945 f0 mov dword ptr ss : [ ebp - 0x10 ] , eax
* 013 aac91 53 push ebx
* 013 aac92 56 push esi
* 013 aac93 57 push edi
* 013 aac94 50 push eax
* 013 aac95 8 d45 f4 lea eax , dword ptr ss : [ ebp - 0xc ]
* 013 aac98 64 : a3 00000000 mov dword ptr fs : [ 0 ] , eax
* 013 aac9e 8 b45 0 c mov eax , dword ptr ss : [ ebp + 0xc ]
* 013 aaca1 8 b5d 08 mov ebx , dword ptr ss : [ ebp + 0x8 ]
* 013 aaca4 8 bf9 mov edi , ecx
* 013 aaca6 8 b77 10 mov esi , dword ptr ds : [ edi + 0x10 ]
* 013 aaca9 89 bd 20f dffff mov dword ptr ss : [ ebp - 0x2e0 ] , edi
* 013 aacaf 8985 18f dffff mov dword ptr ss : [ ebp - 0x2e8 ] , eax
* 013 aacb5 85f 6 test esi , esi
* 013 aacb7 0f 84 77040000 je .013 ab134
* 013 aacbd 8 b93 18010000 mov edx , dword ptr ds : [ ebx + 0x118 ]
* 013 aacc3 2 b93 14010000 sub edx , dword ptr ds : [ ebx + 0x114 ]
* 013 aacc9 8 d8b 14010000 lea ecx , dword ptr ds : [ ebx + 0x114 ]
* 013 aaccf b8 67666666 mov eax , 0x66666667
* 013 aacd4 f7ea imul edx
* 013 aacd6 c1fa 08 sar edx , 0x8
* 013 aacd9 8 bc2 mov eax , edx
* 013 aacdb c1e8 1f shr eax , 0x1f
* 013 aacde 03 c2 add eax , edx
* 013 aace0 03 c6 add eax , esi
* 013 aace2 50 push eax
* 013 aace3 e8 5896f cff call .01374340
* 013 aace8 837f 14 08 cmp dword ptr ds : [ edi + 0x14 ] , 0x8
* 013 aacec 72 04 jb short .013 aacf2
* 013 aacee 8 b07 mov eax , dword ptr ds : [ edi ]
* 013 aacf0 eb 02 jmp short .013 aacf4
* 013 aacf2 8 bc7 mov eax , edi
* 013 aacf4 8985 24f dffff mov dword ptr ss : [ ebp - 0x2dc ] , eax
* 013 aacfa 8 b57 14 mov edx , dword ptr ds : [ edi + 0x14 ]
* 013 aacfd 83f a 08 cmp edx , 0x8
* 013 aad00 72 04 jb short .013 aad06
* 013 aad02 8 b0f mov ecx , dword ptr ds : [ edi ]
* 013 aad04 eb 02 jmp short .013 aad08
* 013 aad06 8 bcf mov ecx , edi
* 013 aad08 8 b47 10 mov eax , dword ptr ds : [ edi + 0x10 ]
* 013 aad0b 8 bb5 24f dffff mov esi , dword ptr ss : [ ebp - 0x2dc ]
* 013 aad11 03 c0 add eax , eax
* 013 aad13 03 c8 add ecx , eax
* 013 aad15 3 bf1 cmp esi , ecx
* 013 aad17 0f 84 17040000 je .013 ab134
* 013 aad1d c785 34f dffff 00 > mov dword ptr ss : [ ebp - 0x2cc ] , 0x0
* 013 aad27 c785 2 cfdffff ff > mov dword ptr ss : [ ebp - 0x2d4 ] , - 0x1
* 013 aad31 89 b5 1 cfdffff mov dword ptr ss : [ ebp - 0x2e4 ] , esi
* 013 aad37 83f a 08 cmp edx , 0x8
* 013 aad3a 72 04 jb short .013 aad40
* 013 aad3c 8 b0f mov ecx , dword ptr ds : [ edi ]
* 013 aad3e eb 02 jmp short .013 aad42
* 013 aad40 8 bcf mov ecx , edi
* 013 aad42 03 c1 add eax , ecx
* 013 aad44 8 d8d 2 cfdffff lea ecx , dword ptr ss : [ ebp - 0x2d4 ]
* 013 aad4a 51 push ecx
* 013 aad4b 8 d95 34f dffff lea edx , dword ptr ss : [ ebp - 0x2cc ]
* 013 aad51 52 push edx
* 013 aad52 50 push eax
* 013 aad53 8 d85 24f dffff lea eax , dword ptr ss : [ ebp - 0x2dc ]
* 013 aad59 50 push eax
* 013 aad5a e8 b183faff call .01353110
* 013 aad5f 8 bb5 2 cfdffff mov esi , dword ptr ss : [ ebp - 0x2d4 ]
* 013 aad65 83 c4 10 add esp , 0x10
* 013 aad68 83f e 0 a cmp esi , 0xa
* 013 aad6b 75 09 jnz short .013 aad76
* 013 aad6d 8 bcb mov ecx , ebx
* 013 aad6f e8 ac050000 call .013 ab320
* 013 aad74 ^ eb 84 jmp short .013 aacfa
* 013 aad76 83f e 07 cmp esi , 0x7
* 013 aad79 75 2 a jnz short .013 aada5
* 013 aad7b 33 c9 xor ecx , ecx
* 013 aad7d 33 c0 xor eax , eax
* 013 aad7f 66 : 898 b ec000000 mov word ptr ds : [ ebx + 0xec ] , cx
* 013 aad86 8 bcb mov ecx , ebx
* 013 aad88 8983 e8000000 mov dword ptr ds : [ ebx + 0xe8 ] , eax
* 013 aad8e 8983 f0000000 mov dword ptr ds : [ ebx + 0xf0 ] , eax
* 013 aad94 e8 87050000 call .013 ab320
* 013 aad99 c683 f9000000 01 mov byte ptr ds : [ ebx + 0xf9 ] , 0x1
* 013 aada0 ^ e9 55ff ffff jmp .013 aacfa
* 013 aada5 8 b85 34f dffff mov eax , dword ptr ss : [ ebp - 0x2cc ]
* 013 aadab 85 c0 test eax , eax
* 013 aadad 75 37 jnz short .013 aade6
* 013 aadaf 85f 6 test esi , esi
* 013 aadb1 ^ 0f 84 43ff ffff je .013 aacfa
* 013 aadb7 85 c0 test eax , eax
* 013 aadb9 75 2 b jnz short .013 aade6
* 013 aadbb f605 c0be9f05 01 test byte ptr ds : [ 0x59fbec0 ] , 0x1
* 013 aadc2 75 0 c jnz short .013 aadd0
* 013 aadc4 830 d c0be9f05 01 or dword ptr ds : [ 0x59fbec0 ] , 0x1
* 013 aadcb e8 f02a0b00 call .0145 d8c0
* 013 aadd0 0f b7d6 movzx edx , si
* 013 aadd3 80 ba c0be9e05 01 cmp byte ptr ds : [ edx + 0x59ebec0 ] , 0x1
* 013 aadda 75 0 a jnz short .013 aade6
* 013 aaddc 8 b43 68 mov eax , dword ptr ds : [ ebx + 0x68 ]
* 013 aaddf 99 cdq
* 013 aade0 2 bc2 sub eax , edx
* 013 aade2 d1f8 sar eax , 1
* 013 aade4 eb 03 jmp short .013 aade9
* 013 aade6 8 b43 68 mov eax , dword ptr ds : [ ebx + 0x68 ]
* 013 aade9 8 b8b a0000000 mov ecx , dword ptr ds : [ ebx + 0xa0 ]
* 013 aadef 8 b53 18 mov edx , dword ptr ds : [ ebx + 0x18 ]
* 013 aadf2 8985 30f dffff mov dword ptr ss : [ ebp - 0x2d0 ] , eax
* 013 aadf8 0343 58 add eax , dword ptr ds : [ ebx + 0x58 ]
* 013 aadfb 03 d1 add edx , ecx
* 013 aadfd 3 bc2 cmp eax , edx
* 013 aadff 7f 0f jg short .013 aae10
* 013 aae01 3 bc1 cmp eax , ecx
* 013 aae03 7 e 30 jle short .013 aae35
* 013 aae05 8 bc6 mov eax , esi
* 013 aae07 e8 94f affff call .013 aa8a0
* 013 aae0c 84 c0 test al , al
* 013 aae0e 75 25 jnz short .013 aae35
* 013 aae10 8 bcb mov ecx , ebx
* 013 aae12 e8 09050000 call .013 ab320
* 013 aae17 83 bd 34f dffff 00 cmp dword ptr ss : [ ebp - 0x2cc ] , 0x0
* 013 aae1e 75 15 jnz short .013 aae35
* 013 aae20 83f e 20 cmp esi , 0x20
* 013 aae23 ^ 0f 84 d1feffff je .013 aacfa
* 013 aae29 81f e 00300000 cmp esi , 0x3000
* 013 aae2f ^ 0f 84 c5feffff je .013 aacfa
* 013 aae35 8 b43 5 c mov eax , dword ptr ds : [ ebx + 0x5c ]
* 013 aae38 3 b83 a4000000 cmp eax , dword ptr ds : [ ebx + 0xa4 ]
* 013 aae3e 0f 8 d 7e020000 jge .013 ab0c2
* 013 aae44 8 d8d 38f dffff lea ecx , dword ptr ss : [ ebp - 0x2c8 ]
* 013 aae4a 51 push ecx
* 013 aae4b e8 30e4 ffff call .013 a9280
* 013 aae50 c745 fc 01000000 mov dword ptr ss : [ ebp - 0x4 ] , 0x1
* 013 aae57 8 b43 74 mov eax , dword ptr ds : [ ebx + 0x74 ]
* 013 aae5a 8 b0d 88 b26c01 mov ecx , dword ptr ds : [ 0x16cb288 ]
* 013 aae60 83f 8 ff cmp eax , - 0x1
* 013 aae63 74 04 je short .013 aae69
* 013 aae65 8 bd0 mov edx , eax
* 013 aae67 eb 19 jmp short .013 aae82
* 013 aae69 80 b9 60010000 00 cmp byte ptr ds : [ ecx + 0x160 ] , 0x0
* 013 aae70 74 0 d je short .013 aae7f
* 013 aae72 8 b83 e0000000 mov eax , dword ptr ds : [ ebx + 0xe0 ]
* 013 aae78 8 bd0 mov edx , eax
* 013 aae7a 83f 8 ff cmp eax , - 0x1
* 013 aae7d 75 03 jnz short .013 aae82
* 013 aae7f 8 b53 24 mov edx , dword ptr ds : [ ebx + 0x24 ]
* 013 aae82 8 b43 78 mov eax , dword ptr ds : [ ebx + 0x78 ]
* 013 aae85 83f 8 ff cmp eax , - 0x1
* 013 aae88 75 17 jnz short .013 aaea1
* 013 aae8a 80 b9 60010000 00 cmp byte ptr ds : [ ecx + 0x160 ] , 0x0
* 013 aae91 74 0 b je short .013 aae9e
* 013 aae93 8 b83 e4000000 mov eax , dword ptr ds : [ ebx + 0xe4 ]
* 013 aae99 83f 8 ff cmp eax , - 0x1
* 013 aae9c 75 03 jnz short .013 aaea1
* 013 aae9e 8 b43 28 mov eax , dword ptr ds : [ ebx + 0x28 ]
* 013 aaea1 8 b4b 60 mov ecx , dword ptr ds : [ ebx + 0x60 ]
* 013 aaea4 8 bb5 34f dffff mov esi , dword ptr ss : [ ebp - 0x2cc ]
* 013 aaeaa 034 b 58 add ecx , dword ptr ds : [ ebx + 0x58 ]
* 013 aaead 8 b7b 68 mov edi , dword ptr ds : [ ebx + 0x68 ]
* 013 aaeb0 8985 28f dffff mov dword ptr ss : [ ebp - 0x2d8 ] , eax
* 013 aaeb6 8 b43 5 c mov eax , dword ptr ds : [ ebx + 0x5c ]
* 013 aaeb9 0343 64 add eax , dword ptr ds : [ ebx + 0x64 ]
* 013 aaebc 83f e 01 cmp esi , 0x1
* 013 aaebf 75 02 jnz short .013 aaec3
* 013 aaec1 33 d2 xor edx , edx
* 013 aaec3 80 bb fa000000 00 cmp byte ptr ds : [ ebx + 0xfa ] , 0x0
* 013 aaeca 89 b5 38f dffff mov dword ptr ss : [ ebp - 0x2c8 ] , esi
* 013 aaed0 8 bb5 2 cfdffff mov esi , dword ptr ss : [ ebp - 0x2d4 ]
* 013 aaed6 8995 44f dffff mov dword ptr ss : [ ebp - 0x2bc ] , edx
* 013 aaedc 8 b95 28f dffff mov edx , dword ptr ss : [ ebp - 0x2d8 ]
* 013 aaee2 89 b5 3 cfdffff mov dword ptr ss : [ ebp - 0x2c4 ] , esi
* 013 aaee8 89 bd 40f dffff mov dword ptr ss : [ ebp - 0x2c0 ] , edi
* 013 aaeee 8995 48f dffff mov dword ptr ss : [ ebp - 0x2b8 ] , edx
* 013 aaef4 898 d 4 cfdffff mov dword ptr ss : [ ebp - 0x2b4 ] , ecx
* 013 aaefa 8985 50f dffff mov dword ptr ss : [ ebp - 0x2b0 ] , eax
* 013 aaf00 74 19 je short .013 aaf1b
* 013 aaf02 8 b43 58 mov eax , dword ptr ds : [ ebx + 0x58 ]
* 013 aaf05 8 b4b 5 c mov ecx , dword ptr ds : [ ebx + 0x5c ]
* 013 aaf08 8983 fc000000 mov dword ptr ds : [ ebx + 0xfc ] , eax
* 013 aaf0e 898 b 00010000 mov dword ptr ds : [ ebx + 0x100 ] , ecx
* 013 aaf14 c683 fa000000 00 mov byte ptr ds : [ ebx + 0xfa ] , 0x0
* 013 aaf1b 8 b53 6 c mov edx , dword ptr ds : [ ebx + 0x6c ]
* 013 aaf1e 03 95 30f dffff add edx , dword ptr ss : [ ebp - 0x2d0 ]
* 013 aaf24 33ff xor edi , edi
* 013 aaf26 0153 58 add dword ptr ds : [ ebx + 0x58 ] , edx
* 013 aaf29 8 b95 34f dffff mov edx , dword ptr ss : [ ebp - 0x2cc ]
* 013 aaf2f 8 b43 58 mov eax , dword ptr ds : [ ebx + 0x58 ]
* 013 aaf32 3 bd7 cmp edx , edi ; jichi : hook here
* 013 aaf34 75 4 b jnz short .013 aaf81
* 013 aaf36 81f e 0 c300000 cmp esi , 0x300c ; jichi 10 / 18 / 2014 : searched here found the new siglus function
* 013 aaf3c 74 10 je short .013 aaf4e
* 013 aaf3e 81f e 0e300000 cmp esi , 0x300e
* 013 aaf44 74 08 je short .013 aaf4e
* 013 aaf46 81f e 08ff 0000 cmp esi , 0xff08
* 013 aaf4c 75 33 jnz short .013 aaf81
* 013 aaf4e 80 bb f9000000 00 cmp byte ptr ds : [ ebx + 0xf9 ] , 0x0
* 013 aaf55 74 19 je short .013 aaf70
* 013 aaf57 8983 e8000000 mov dword ptr ds : [ ebx + 0xe8 ] , eax
* 013 aaf5d 66 : 89 b3 ec000000 mov word ptr ds : [ ebx + 0xec ] , si
* 013 aaf64 c783 f0000000 01 > mov dword ptr ds : [ ebx + 0xf0 ] , 0x1
* 013 aaf6e eb 11 jmp short .013 aaf81
* 013 aaf70 0f b783 ec000000 movzx eax , word ptr ds : [ ebx + 0xec ]
* 013 aaf77 3 bf0 cmp esi , eax
* 013 aaf79 75 06 jnz short .013 aaf81
* 013 aaf7b ff83 f0000000 inc dword ptr ds : [ ebx + 0xf0 ]
* 013 aaf81 8 b8b f0000000 mov ecx , dword ptr ds : [ ebx + 0xf0 ]
* 013 aaf87 3 bcf cmp ecx , edi
* 013 aaf89 7 e 71 jle short .013 aaffc
* 013 aaf8b 3 bd7 cmp edx , edi
* 013 aaf8d 75 50 jnz short .013 aafdf
* 013 aaf8f 0f b783 ec000000 movzx eax , word ptr ds : [ ebx + 0xec ]
* 013 aaf96 ba 0 c300000 mov edx , 0x300c
* 013 aaf9b 66 : 3 bc2 cmp ax , dx
* 013 aaf9e 75 0f jnz short .013 aafaf
* 013 aafa0 81f e 0 d300000 cmp esi , 0x300d
* 013 aafa6 75 07 jnz short .013 aafaf
* 013 aafa8 49 dec ecx
* 013 aafa9 898 b f0000000 mov dword ptr ds : [ ebx + 0xf0 ] , ecx
* 013 aafaf b9 0e300000 mov ecx , 0x300e
* 013 aafb4 66 : 3 bc1 cmp ax , cx
* 013 aafb7 75 0 e jnz short .013 aafc7
* 013 aafb9 81f e 0f 300000 cmp esi , 0x300f
* 013 aafbf 75 06 jnz short .013 aafc7
* 013 aafc1 ff8b f0000000 dec dword ptr ds : [ ebx + 0xf0 ]
* 013 aafc7 ba 08ff 0000 mov edx , 0xff08
* 013 aafcc 66 : 3 bc2 cmp ax , dx
* 013 aafcf 75 0 e jnz short .013 aafdf
* 013 aafd1 81f e 09ff 0000 cmp esi , 0xff09
* 013 aafd7 75 06 jnz short .013 aafdf
* 013 aafd9 ff8b f0000000 dec dword ptr ds : [ ebx + 0xf0 ]
* 013 aafdf 39 bb f0000000 cmp dword ptr ds : [ ebx + 0xf0 ] , edi
* 013 aafe5 75 15 jnz short .013 aaffc
* 013 aafe7 33 c0 xor eax , eax
* 013 aafe9 89 bb e8000000 mov dword ptr ds : [ ebx + 0xe8 ] , edi
* 013 aafef 66 : 8983 ec000000 mov word ptr ds : [ ebx + 0xec ] , ax
* 013 aaff6 89 bb f0000000 mov dword ptr ds : [ ebx + 0xf0 ] , edi
* 013 aaffc 8 d8d 38f dffff lea ecx , dword ptr ss : [ ebp - 0x2c8 ]
* 013 ab002 8 dbb 14010000 lea edi , dword ptr ds : [ ebx + 0x114 ]
* 013 ab008 e8 b390fcff call .013740 c0
* 013 ab00d 33ff xor edi , edi
* 013 ab00f 39 bd 34f dffff cmp dword ptr ss : [ ebp - 0x2cc ] , edi
* 013 ab015 75 0 e jnz short .013 ab025
* 013 ab017 56 push esi
* 013 ab018 8 d83 a8000000 lea eax , dword ptr ds : [ ebx + 0xa8 ]
* 013 ab01e e8 5 d080000 call .013 ab880
* 013 ab023 eb 65 jmp short .013 ab08a
* 013 ab025 8 b85 1 cfdffff mov eax , dword ptr ss : [ ebp - 0x2e4 ]
* 013 ab02b 33 c9 xor ecx , ecx
* 013 ab02d 66 : 894 d d4 mov word ptr ss : [ ebp - 0x2c ] , cx
* 013 ab031 8 b8d 24f dffff mov ecx , dword ptr ss : [ ebp - 0x2dc ]
* 013 ab037 c745 e8 07000000 mov dword ptr ss : [ ebp - 0x18 ] , 0x7
* 013 ab03e 897 d e4 mov dword ptr ss : [ ebp - 0x1c ] , edi
* 013 ab041 3 bc1 cmp eax , ecx
* 013 ab043 74 0 d je short .013 ab052
* 013 ab045 2 bc8 sub ecx , eax
* 013 ab047 d1f9 sar ecx , 1
* 013 ab049 51 push ecx
* 013 ab04a 8 d75 d4 lea esi , dword ptr ss : [ ebp - 0x2c ]
* 013 ab04d e8 de72f2ff call .012 d2330
* 013 ab052 6 a ff push - 0x1
* 013 ab054 57 push edi
* 013 ab055 8 d55 d4 lea edx , dword ptr ss : [ ebp - 0x2c ]
* 013 ab058 52 push edx
* 013 ab059 8 db3 a8000000 lea esi , dword ptr ds : [ ebx + 0xa8 ]
* 013 ab05f c645 fc 02 mov byte ptr ss : [ ebp - 0x4 ] , 0x2
* 013 ab063 e8 3879f 2ff call .012 d29a0
* 013 ab068 837 d e8 08 cmp dword ptr ss : [ ebp - 0x18 ] , 0x8
* 013 ab06c 72 0 c jb short .013 ab07a
* 013 ab06e 8 b45 d4 mov eax , dword ptr ss : [ ebp - 0x2c ]
* 013 ab071 50 push eax
* 013 ab072 e8 5f be1900 call .01546 ed6
* 013 ab077 83 c4 04 add esp , 0x4
* 013 ab07a 33 c9 xor ecx , ecx
* 013 ab07c c745 e8 07000000 mov dword ptr ss : [ ebp - 0x18 ] , 0x7
* 013 ab083 897 d e4 mov dword ptr ss : [ ebp - 0x1c ] , edi
* 013 ab086 66 : 894 d d4 mov word ptr ss : [ ebp - 0x2c ] , cx
* 013 ab08a 8 bbd 20f dffff mov edi , dword ptr ss : [ ebp - 0x2e0 ]
* 013 ab090 c683 f9000000 00 mov byte ptr ds : [ ebx + 0xf9 ] , 0x0
* 013 ab097 8 d95 88f effff lea edx , dword ptr ss : [ ebp - 0x178 ]
* 013 ab09d 52 push edx
* 013 ab09e c745 fc 03000000 mov dword ptr ss : [ ebp - 0x4 ] , 0x3
* 013 ab0a5 e8 d6c70800 call .01437880
* 013 ab0aa 8 d85 58f dffff lea eax , dword ptr ss : [ ebp - 0x2a8 ]
* 013 ab0b0 50 push eax
* 013 ab0b1 c745 fc ffffffff mov dword ptr ss : [ ebp - 0x4 ] , - 0x1
* 013 ab0b8 e8 c3c70800 call .01437880
* 013 ab0bd ^ e9 38f cffff jmp .013 aacfa
* 013 ab0c2 8 b9d 18f dffff mov ebx , dword ptr ss : [ ebp - 0x2e8 ]
* 013 ab0c8 85 db test ebx , ebx
* 013 ab0ca 74 68 je short .013 ab134
* 013 ab0cc 837f 14 08 cmp dword ptr ds : [ edi + 0x14 ] , 0x8
* 013 ab0d0 72 04 jb short .013 ab0d6
* 013 ab0d2 8 b07 mov eax , dword ptr ds : [ edi ]
* 013 ab0d4 eb 02 jmp short .013 ab0d8
* 013 ab0d6 8 bc7 mov eax , edi
* 013 ab0d8 8 b4f 10 mov ecx , dword ptr ds : [ edi + 0x10 ]
* 013 ab0db 8 d0448 lea eax , dword ptr ds : [ eax + ecx * 2 ]
* 013 ab0de 8 b8d 1 cfdffff mov ecx , dword ptr ss : [ ebp - 0x2e4 ]
* 013 ab0e4 33 d2 xor edx , edx
* 013 ab0e6 c745 cc 07000000 mov dword ptr ss : [ ebp - 0x34 ] , 0x7
* 013 ab0ed c745 c8 00000000 mov dword ptr ss : [ ebp - 0x38 ] , 0x0
* 013 ab0f4 66 : 8955 b8 mov word ptr ss : [ ebp - 0x48 ] , dx
* 013 ab0f8 3 bc8 cmp ecx , eax
* 013 ab0fa 74 0f je short .013 ab10b
* 013 ab0fc 2 bc1 sub eax , ecx
* 013 ab0fe d1f8 sar eax , 1
* 013 ab100 50 push eax
* 013 ab101 8 bc1 mov eax , ecx
* 013 ab103 8 d75 b8 lea esi , dword ptr ss : [ ebp - 0x48 ]
* 013 ab106 e8 2572f 2ff call .012 d2330
* 013 ab10b 6 a 00 push 0x0
* 013 ab10d 8 d45 b8 lea eax , dword ptr ss : [ ebp - 0x48 ]
* 013 ab110 50 push eax
* 013 ab111 83 c8 ff or eax , 0xffffffff
* 013 ab114 8 bcb mov ecx , ebx
* 013 ab116 c745 fc 00000000 mov dword ptr ss : [ ebp - 0x4 ] , 0x0
* 013 ab11d e8 2e6 ef2ff call .012 d1f50
* 013 ab122 837 d cc 08 cmp dword ptr ss : [ ebp - 0x34 ] , 0x8
* 013 ab126 72 0 c jb short .013 ab134
* 013 ab128 8 b4d b8 mov ecx , dword ptr ss : [ ebp - 0x48 ]
* 013 ab12b 51 push ecx
* 013 ab12c e8 a5bd1900 call .01546 ed6
* 013 ab131 83 c4 04 add esp , 0x4
* 013 ab134 8 b4d f4 mov ecx , dword ptr ss : [ ebp - 0xc ]
* 013 ab137 64 : 890 d 00000000 mov dword ptr fs : [ 0 ] , ecx
* 013 ab13e 59 pop ecx
* 013 ab13f 5f pop edi
* 013 ab140 5 e pop esi
* 013 ab141 5 b pop ebx
* 013 ab142 8 b4d f0 mov ecx , dword ptr ss : [ ebp - 0x10 ]
* 013 ab145 33 cd xor ecx , ebp
* 013 ab147 e8 6 ab30e00 call .014964 b6
* 013 ab14c 8 be5 mov esp , ebp
* 013 ab14e 5 d pop ebp
* 013 ab14f c2 0800 retn 0x8
* 013 ab152 cc int3
* 013 ab153 cc int3
* 013 ab154 cc int3
*
* 10 / 18 / 2014 Type2 : リ ア 兂 <EFBFBD> ラ ス メ イ ト 孕 ま せ 催 <EFBFBD>
*
* 01140 edb cc int3
* 01140 edc cc int3
* 01140 edd cc int3
* 01140 ede cc int3
* 01140 edf cc int3
* 01140 ee0 55 push ebp
* 01140 ee1 8 bec mov ebp , esp
* 01140 ee3 6 a ff push - 0x1
* 01140 ee5 68 c6514a01 push .014 a51c6
* 01140 eea 64 : a1 00000000 mov eax , dword ptr fs : [ 0 ]
* 01140 ef0 50 push eax
* 01140 ef1 81 ec dc020000 sub esp , 0x2dc
* 01140 ef7 a1 10745501 mov eax , dword ptr ds : [ 0x1557410 ]
* 01140 efc 33 c5 xor eax , ebp
* 01140 efe 8945 f0 mov dword ptr ss : [ ebp - 0x10 ] , eax
* 01140f 01 53 push ebx
* 01140f 02 56 push esi
* 01140f 03 57 push edi
* 01140f 04 50 push eax
* 01140f 05 8 d45 f4 lea eax , dword ptr ss : [ ebp - 0xc ]
* 01140f 08 64 : a3 00000000 mov dword ptr fs : [ 0 ] , eax
* 01140f 0 e 8 bd9 mov ebx , ecx
* 01140f 10 8 b7d 08 mov edi , dword ptr ss : [ ebp + 0x8 ]
* 01140f 13 837f 10 00 cmp dword ptr ds : [ edi + 0x10 ] , 0x0
* 01140f 17 8 b45 0 c mov eax , dword ptr ss : [ ebp + 0xc ]
* 01140f 1 a 8985 1 cfdffff mov dword ptr ss : [ ebp - 0x2e4 ] , eax
* 01140f 20 8 d47 10 lea eax , dword ptr ds : [ edi + 0x10 ]
* 01140f 23 89 bd 38f dffff mov dword ptr ss : [ ebp - 0x2c8 ] , edi
* 01140f 29 8985 20f dffff mov dword ptr ss : [ ebp - 0x2e0 ] , eax
* 01140f 2f 0f 84 2 a050000 je .0114145f
* 01140f 35 8 b8b 10010000 mov ecx , dword ptr ds : [ ebx + 0x110 ]
* 01140f 3 b b8 67666666 mov eax , 0x66666667
* 01140f 40 2 b8b 0 c010000 sub ecx , dword ptr ds : [ ebx + 0x10c ]
* 01140f 46 f7e9 imul ecx
* 01140f 48 8 b85 20f dffff mov eax , dword ptr ss : [ ebp - 0x2e0 ]
* 01140f 4 e 8 b8b 14010000 mov ecx , dword ptr ds : [ ebx + 0x114 ]
* 01140f 54 2 b8b 0 c010000 sub ecx , dword ptr ds : [ ebx + 0x10c ]
* 01140f 5 a c1fa 08 sar edx , 0x8
* 01140f 5 d 8 bf2 mov esi , edx
* 01140f 5f c1ee 1f shr esi , 0x1f
* 01140f 62 03f 2 add esi , edx
* 01140f 64 0330 add esi , dword ptr ds : [ eax ]
* 01140f 66 b8 67666666 mov eax , 0x66666667
* 01140f 6 b f7e9 imul ecx
* 01140f 6 d c1fa 08 sar edx , 0x8
* 01140f 70 8 bc2 mov eax , edx
* 01140f 72 c1e8 1f shr eax , 0x1f
* 01140f 75 03 c2 add eax , edx
* 01140f 77 3 bc6 cmp eax , esi
* 01140f 79 73 1 e jnb short .01140f 99
* 01140f 7 b 81f e 66666600 cmp esi , 0x666666 ; unicode " s the data.
* 01140f 81 76 0 a jbe short .01140f 8 d
* 01140f 83 68 c00f4f01 push .014f 0f c0 ; ascii " vector<t> too long "
* 01140f 88 e8 b1a30e00 call .0122 b33e
* 01140f 8 d 56 push esi
* 01140f 8 e 8 d8b 0 c010000 lea ecx , dword ptr ds : [ ebx + 0x10c ]
* 01140f 94 e8 67 acfcff call .0110 bc00
* 01140f 99 837f 14 08 cmp dword ptr ds : [ edi + 0x14 ] , 0x8
* 01140f 9 d 72 04 jb short .01140f a3
* 01140f 9f 8 b37 mov esi , dword ptr ds : [ edi ]
* 01140f a1 eb 02 jmp short .01140f a5
* 01140f a3 8 bf7 mov esi , edi
* 01140f a5 89 b5 34f dffff mov dword ptr ss : [ ebp - 0x2cc ] , esi
* 01140f ab eb 03 jmp short .01140f b0
* 01140f ad 8 d49 00 lea ecx , dword ptr ds : [ ecx ]
* 01140f b0 8 b57 14 mov edx , dword ptr ds : [ edi + 0x14 ]
* 01140f b3 83f a 08 cmp edx , 0x8
* 01140f b6 72 04 jb short .01140f bc
* 01140f b8 8 b07 mov eax , dword ptr ds : [ edi ]
* 01140f ba eb 02 jmp short .01140f be
* 01140f bc 8 bc7 mov eax , edi
* 01140f be 8 b8d 20f dffff mov ecx , dword ptr ss : [ ebp - 0x2e0 ]
* 01140f c4 8 b09 mov ecx , dword ptr ds : [ ecx ]
* 01140f c6 03 c9 add ecx , ecx
* 01140f c8 03 c1 add eax , ecx
* 01140f ca 3 bf0 cmp esi , eax
* 01140f cc 0f 84 8 d040000 je .0114145f
* 01140f d2 8 b85 38f dffff mov eax , dword ptr ss : [ ebp - 0x2c8 ]
* 01140f d8 8 bfe mov edi , esi
* 01140f da c785 3 cfdffff 00 > mov dword ptr ss : [ ebp - 0x2c4 ] , 0x0
* 01140f e4 c785 2 cfdffff ff > mov dword ptr ss : [ ebp - 0x2d4 ] , - 0x1
* 01140f ee 83f a 08 cmp edx , 0x8
* 01140ff 1 72 02 jb short .01140f f5
* 01140ff 3 8 b00 mov eax , dword ptr ds : [ eax ]
* 01140ff 5 03 c1 add eax , ecx
* 01140ff 7 8 d95 3 cfdffff lea edx , dword ptr ss : [ ebp - 0x2c4 ]
* 01140ff d 8 d8d 2 cfdffff lea ecx , dword ptr ss : [ ebp - 0x2d4 ]
* 01141003 51 push ecx
* 01141004 50 push eax
* 01141005 8 d8d 34f dffff lea ecx , dword ptr ss : [ ebp - 0x2cc ]
* 0114100 b e8 e033fbff call .010f 43f 0
* 01141010 8 bb5 2 cfdffff mov esi , dword ptr ss : [ ebp - 0x2d4 ]
* 01141016 83 c4 08 add esp , 0x8
* 0114101 9 83f e 0 a cmp esi , 0xa
* 0114101 c 75 18 jnz short .01141036
* 0114101 e 8 bcb mov ecx , ebx
* 01141020 e8 2 b060000 call .01141650
* 01141025 8 bb5 34f dffff mov esi , dword ptr ss : [ ebp - 0x2cc ]
* 0114102 b 8 bbd 38f dffff mov edi , dword ptr ss : [ ebp - 0x2c8 ]
* 01141031 ^ e9 7 affffff jmp .01140f b0
* 01141036 83f e 07 cmp esi , 0x7
* 0114103 9 75 38 jnz short .01141073
* 0114103 b 33 c0 xor eax , eax
* 0114103 d c783 e0000000 00 > mov dword ptr ds : [ ebx + 0xe0 ] , 0x0
* 01141047 8 bcb mov ecx , ebx
* 0114104 9 66 : 8983 e4000000 mov word ptr ds : [ ebx + 0xe4 ] , ax
* 01141050 8983 e8000000 mov dword ptr ds : [ ebx + 0xe8 ] , eax
* 01141056 e8 f5050000 call .01141650
* 0114105 b 8 bb5 34f dffff mov esi , dword ptr ss : [ ebp - 0x2cc ]
* 01141061 8 bbd 38f dffff mov edi , dword ptr ss : [ ebp - 0x2c8 ]
* 01141067 c683 f1000000 01 mov byte ptr ds : [ ebx + 0xf1 ] , 0x1
* 0114106 e ^ e9 3 dffffff jmp .01140f b0
* 01141073 8 b85 3 cfdffff mov eax , dword ptr ss : [ ebp - 0x2c4 ]
* 0114107 9 85 c0 test eax , eax
* 0114107 b 75 36 jnz short .011410 b3
* 0114107 d 85f 6 test esi , esi
* 0114107f 74 7f je short .01141100
* 011410 81 85 c0 test eax , eax
* 011410 83 75 2 e jnz short .011410 b3
* 011410 85 a1 0035 8905 mov eax , dword ptr ds : [ 0x5893500 ]
* 011410 8 a a8 01 test al , 0x1
* 011410 8 c 75 0 d jnz short .0114109 b
* 011410 8 e 83 c8 01 or eax , 0x1
* 011410 91 a3 0035 8905 mov dword ptr ds : [ 0x5893500 ] , eax
* 011410 96 e8 65160 b00 call .011f 2700
* 011410 9 b 0f b7c6 movzx eax , si
* 011410 9 e 80 b8 10358905 01 cmp byte ptr ds : [ eax + 0x5893510 ] , 0x1
* 011410 a5 75 0 c jnz short .011410 b3
* 011410 a7 8 b43 68 mov eax , dword ptr ds : [ ebx + 0x68 ]
* 011410 aa 99 cdq
* 011410 ab 2 bc2 sub eax , edx
* 011410 ad 8 bc8 mov ecx , eax
* 011410 af d1f9 sar ecx , 1
* 011410 b1 eb 03 jmp short .011410 b6
* 011410 b3 8 b4b 68 mov ecx , dword ptr ds : [ ebx + 0x68 ]
* 011410 b6 8 b43 18 mov eax , dword ptr ds : [ ebx + 0x18 ]
* 011410 b9 8 b93 a0000000 mov edx , dword ptr ds : [ ebx + 0xa0 ]
* 011410 bf 03 c2 add eax , edx
* 011410 c1 898 d 28f dffff mov dword ptr ss : [ ebp - 0x2d8 ] , ecx
* 011410 c7 034 b 58 add ecx , dword ptr ds : [ ebx + 0x58 ]
* 011410 ca 3 bc8 cmp ecx , eax
* 011410 cc 7f 0f jg short .011410 dd
* 011410 ce 3 bca cmp ecx , edx
* 011410 d0 7 e 3f jle short .01141111
* 011410 d2 8 bce mov ecx , esi
* 011410 d4 e8 37f affff call .01140 b10
* 011410 d9 84 c0 test al , al
* 011410 db 75 34 jnz short .01141111
* 011410 dd 8 bcb mov ecx , ebx
* 011410 df e8 6 c050000 call .01141650
* 011410e4 83 bd 3 cfdffff 00 cmp dword ptr ss : [ ebp - 0x2c4 ] , 0x0
* 011410 eb 75 24 jnz short .01141111
* 011410 ed 83f e 20 cmp esi , 0x20
* 011410f 0 74 0 e je short .01141100
* 011410f 2 81f e 00300000 cmp esi , 0x3000
* 011410f 8 75 17 jnz short .01141111
* 011410f a 8 d9b 00000000 lea ebx , dword ptr ds : [ ebx ]
* 01141100 8 bb5 34f dffff mov esi , dword ptr ss : [ ebp - 0x2cc ]
* 01141106 8 bbd 38f dffff mov edi , dword ptr ss : [ ebp - 0x2c8 ]
* 0114110 c ^ e9 9ff effff jmp .01140f b0
* 01141111 8 b43 5 c mov eax , dword ptr ds : [ ebx + 0x5c ]
* 01141114 3 b83 a4000000 cmp eax , dword ptr ds : [ ebx + 0xa4 ]
* 0114111 a 0f 8 d cb020000 jge .011413 eb
* 01141120 8 d8d 40f dffff lea ecx , dword ptr ss : [ ebp - 0x2c0 ]
* 01141126 e8 d5e3ffff call .0113f 500
* 0114112 b c745 fc 01000000 mov dword ptr ss : [ ebp - 0x4 ] , 0x1
* 01141132 8 b4b 74 mov ecx , dword ptr ds : [ ebx + 0x74 ]
* 01141135 8 b15 98285701 mov edx , dword ptr ds : [ 0x1572898 ]
* 0114113 b 898 d 30f dffff mov dword ptr ss : [ ebp - 0x2d0 ] , ecx
* 01141141 83f 9 ff cmp ecx , - 0x1
* 01141144 75 23 jnz short .01141169
* 01141146 80 ba 58010000 00 cmp byte ptr ds : [ edx + 0x158 ] , 0x0
* 0114114 d 74 11 je short .01141160
* 0114114f 8 b8b d8000000 mov ecx , dword ptr ds : [ ebx + 0xd8 ]
* 01141155 898 d 30f dffff mov dword ptr ss : [ ebp - 0x2d0 ] , ecx
* 0114115 b 83f 9 ff cmp ecx , - 0x1
* 0114115 e 75 09 jnz short .01141169
* 01141160 8 b43 24 mov eax , dword ptr ds : [ ebx + 0x24 ]
* 01141163 8985 30f dffff mov dword ptr ss : [ ebp - 0x2d0 ] , eax
* 0114116 9 8 b43 78 mov eax , dword ptr ds : [ ebx + 0x78 ]
* 0114116 c 8985 24f dffff mov dword ptr ss : [ ebp - 0x2dc ] , eax
* 01141172 83f 8 ff cmp eax , - 0x1
* 01141175 75 23 jnz short .0114119 a
* 01141177 80 ba 58010000 00 cmp byte ptr ds : [ edx + 0x158 ] , 0x0
* 0114117 e 74 11 je short .01141191
* 011411 80 8 b83 dc000000 mov eax , dword ptr ds : [ ebx + 0xdc ]
* 011411 86 8985 24f dffff mov dword ptr ss : [ ebp - 0x2dc ] , eax
* 011411 8 c 83f 8 ff cmp eax , - 0x1
* 0114118f 75 09 jnz short .0114119 a
* 011411 91 8 b43 28 mov eax , dword ptr ds : [ ebx + 0x28 ]
* 011411 94 8985 24f dffff mov dword ptr ss : [ ebp - 0x2dc ] , eax
* 011411 9 a 8 b53 64 mov edx , dword ptr ds : [ ebx + 0x64 ]
* 011411 9 d 0353 5 c add edx , dword ptr ds : [ ebx + 0x5c ]
* 011411 a0 8 b4b 60 mov ecx , dword ptr ds : [ ebx + 0x60 ]
* 011411 a3 034 b 58 add ecx , dword ptr ds : [ ebx + 0x58 ]
* 011411 a6 83 bd 3 cfdffff 01 cmp dword ptr ss : [ ebp - 0x2c4 ] , 0x1
* 011411 ad 8 bb5 30f dffff mov esi , dword ptr ss : [ ebp - 0x2d0 ]
* 011411 b3 8 b43 68 mov eax , dword ptr ds : [ ebx + 0x68 ]
* 011411 b6 c785 18f dffff 00 > mov dword ptr ss : [ ebp - 0x2e8 ] , 0x0
* 011411 c0 0f 44 b5 18f dffff cmove esi , dword ptr ss : [ ebp - 0x2e8 ]
* 011411 c7 80 bb f2000000 00 cmp byte ptr ds : [ ebx + 0xf2 ] , 0x0
* 011411 ce 89 b5 30f dffff mov dword ptr ss : [ ebp - 0x2d0 ] , esi
* 011411 d4 8 bb5 3 cfdffff mov esi , dword ptr ss : [ ebp - 0x2c4 ]
* 011411 da 8985 48f dffff mov dword ptr ss : [ ebp - 0x2b8 ] , eax
* 011411e0 8 b85 30f dffff mov eax , dword ptr ss : [ ebp - 0x2d0 ]
* 011411e6 89 b5 40f dffff mov dword ptr ss : [ ebp - 0x2c0 ] , esi
* 011411 ec 8 bb5 2 cfdffff mov esi , dword ptr ss : [ ebp - 0x2d4 ]
* 011411f 2 8985 4 cfdffff mov dword ptr ss : [ ebp - 0x2b4 ] , eax
* 011411f 8 8 b85 24f dffff mov eax , dword ptr ss : [ ebp - 0x2dc ]
* 011411f e 89 b5 44f dffff mov dword ptr ss : [ ebp - 0x2bc ] , esi
* 01141204 8985 50f dffff mov dword ptr ss : [ ebp - 0x2b0 ] , eax
* 0114120 a 898 d 54f dffff mov dword ptr ss : [ ebp - 0x2ac ] , ecx
* 01141210 8995 58f dffff mov dword ptr ss : [ ebp - 0x2a8 ] , edx
* 01141216 74 19 je short .01141231
* 0114121 8 8 b43 58 mov eax , dword ptr ds : [ ebx + 0x58 ]
* 0114121 b 8983 f4000000 mov dword ptr ds : [ ebx + 0xf4 ] , eax
* 01141221 8 b43 5 c mov eax , dword ptr ds : [ ebx + 0x5c ]
* 01141224 8983 f8000000 mov dword ptr ds : [ ebx + 0xf8 ] , eax
* 0114122 a c683 f2000000 00 mov byte ptr ds : [ ebx + 0xf2 ] , 0x0
* 01141231 8 b43 6 c mov eax , dword ptr ds : [ ebx + 0x6c ]
* 01141234 03 85 28f dffff add eax , dword ptr ss : [ ebp - 0x2d8 ]
* 0114123 a 0143 58 add dword ptr ds : [ ebx + 0x58 ] , eax
* 0114123 d 8 b85 3 cfdffff mov eax , dword ptr ss : [ ebp - 0x2c4 ]
* 01141243 8 b4b 58 mov ecx , dword ptr ds : [ ebx + 0x58 ]
* 01141246 85 c0 test eax , eax
* 0114124 8 75 51 jnz short .0114129 b
* 0114124 a 81f e 0 c300000 cmp esi , 0x300c ; jichi : hook here , utf16 character is in esi
* 01141250 74 10 je short .01141262
* 01141252 81f e 0e300000 cmp esi , 0x300e
* 0114125 8 74 08 je short .01141262
* 0114125 a 81f e 08ff 0000 cmp esi , 0xff08
* 01141260 75 39 jnz short .0114129 b
* 01141262 80 bb f1000000 00 cmp byte ptr ds : [ ebx + 0xf1 ] , 0x0
* 0114126 9 74 19 je short .01141284
* 0114126 b 898 b e0000000 mov dword ptr ds : [ ebx + 0xe0 ] , ecx
* 01141271 66 : 89 b3 e4000000 mov word ptr ds : [ ebx + 0xe4 ] , si
* 0114127 8 c783 e8000000 01 > mov dword ptr ds : [ ebx + 0xe8 ] , 0x1
* 011412 82 eb 17 jmp short .0114129 b
* 011412 84 0f b783 e4000000 movzx eax , word ptr ds : [ ebx + 0xe4 ]
* 011412 8 b 3 bf0 cmp esi , eax
* 011412 8 d 8 b85 3 cfdffff mov eax , dword ptr ss : [ ebp - 0x2c4 ]
* 011412 93 75 06 jnz short .0114129 b
* 011412 95 ff83 e8000000 inc dword ptr ds : [ ebx + 0xe8 ]
* 011412 9 b 8 b93 e8000000 mov edx , dword ptr ds : [ ebx + 0xe8 ]
* 011412 a1 85 d2 test edx , edx
* 011412 a3 7 e 78 jle short .0114131 d
* 011412 a5 85 c0 test eax , eax
* 011412 a7 75 52 jnz short .011412f b
* 011412 a9 0f b78b e4000000 movzx ecx , word ptr ds : [ ebx + 0xe4 ]
* 011412 b0 b8 0 c300000 mov eax , 0x300c
* 011412 b5 66 : 3 bc8 cmp cx , ax
* 011412 b8 75 11 jnz short .011412 cb
* 011412 ba 81f e 0 d300000 cmp esi , 0x300d
* 011412 c0 75 09 jnz short .011412 cb
* 011412 c2 8 d42 ff lea eax , dword ptr ds : [ edx - 0x1 ]
* 011412 c5 8983 e8000000 mov dword ptr ds : [ ebx + 0xe8 ] , eax
* 011412 cb b8 0e300000 mov eax , 0x300e
* 011412 d0 66 : 3 bc8 cmp cx , ax
* 011412 d3 75 0 e jnz short .011412e3
* 011412 d5 81f e 0f 300000 cmp esi , 0x300f
* 011412 db 75 06 jnz short .011412e3
* 011412 dd ff8b e8000000 dec dword ptr ds : [ ebx + 0xe8 ]
* 011412e3 b8 08ff 0000 mov eax , 0xff08
* 011412e8 66 : 3 bc8 cmp cx , ax
* 011412 eb 75 0 e jnz short .011412f b
* 011412 ed 81f e 09ff 0000 cmp esi , 0xff09
* 011412f 3 75 06 jnz short .011412f b
* 011412f 5 ff8b e8000000 dec dword ptr ds : [ ebx + 0xe8 ]
* 011412f b 83 bb e8000000 00 cmp dword ptr ds : [ ebx + 0xe8 ] , 0x0
* 01141302 75 19 jnz short .0114131 d
* 01141304 33 c0 xor eax , eax
* 01141306 c783 e0000000 00 > mov dword ptr ds : [ ebx + 0xe0 ] , 0x0
* 01141310 66 : 8983 e4000000 mov word ptr ds : [ ebx + 0xe4 ] , ax
* 01141317 8983 e8000000 mov dword ptr ds : [ ebx + 0xe8 ] , eax
* 0114131 d 8 d85 40f dffff lea eax , dword ptr ss : [ ebp - 0x2c0 ]
* 01141323 50 push eax
* 01141324 8 d8b 0 c010000 lea ecx , dword ptr ds : [ ebx + 0x10c ]
* 0114132 a e8 31 a6fcff call .0110 b960
* 0114132f 83 bd 3 cfdffff 00 cmp dword ptr ss : [ ebp - 0x2c4 ] , 0x0
* 01141336 8 bb5 34f dffff mov esi , dword ptr ss : [ ebp - 0x2cc ]
* 0114133 c 75 13 jnz short .01141351
* 0114133 e ffb5 2 cfdffff push dword ptr ss : [ ebp - 0x2d4 ]
* 01141344 8 d8b a8000000 lea ecx , dword ptr ds : [ ebx + 0xa8 ]
* 0114134 a e8 010 a0000 call .01141 d50
* 0114134f eb 64 jmp short .011413 b5
* 01141351 33 c0 xor eax , eax
* 01141353 c745 ec 07000000 mov dword ptr ss : [ ebp - 0x14 ] , 0x7
* 0114135 a c745 e8 00000000 mov dword ptr ss : [ ebp - 0x18 ] , 0x0
* 01141361 66 : 8945 d8 mov word ptr ss : [ ebp - 0x28 ] , ax
* 01141365 3 bfe cmp edi , esi
* 01141367 74 10 je short .01141379
* 0114136 9 8 bc6 mov eax , esi
* 0114136 b 8 d4d d8 lea ecx , dword ptr ss : [ ebp - 0x28 ]
* 0114136 e 2 bc7 sub eax , edi
* 01141370 d1f8 sar eax , 1
* 01141372 50 push eax
* 01141373 57 push edi
* 01141374 e8 b7daf2ff call .0106 ee30
* 0114137 9 6 a ff push - 0x1
* 0114137 b 6 a 00 push 0x0
* 0114137 d 8 d45 d8 lea eax , dword ptr ss : [ ebp - 0x28 ]
* 011413 80 c645 fc 02 mov byte ptr ss : [ ebp - 0x4 ] , 0x2
* 011413 84 50 push eax
* 011413 85 8 d8b a8000000 lea ecx , dword ptr ds : [ ebx + 0xa8 ]
* 011413 8 b e8 205 cf3ff call .01076f b0
* 011413 90 837 d ec 08 cmp dword ptr ss : [ ebp - 0x14 ] , 0x8
* 011413 94 72 0 b jb short .011413 a1
* 011413 96 ff75 d8 push dword ptr ss : [ ebp - 0x28 ]
* 011413 99 e8 fccb0e00 call .0122 df9a
* 011413 9 e 83 c4 04 add esp , 0x4
* 011413 a1 33 c0 xor eax , eax
* 011413 a3 c745 ec 07000000 mov dword ptr ss : [ ebp - 0x14 ] , 0x7
* 011413 aa c745 e8 00000000 mov dword ptr ss : [ ebp - 0x18 ] , 0x0
* 011413 b1 66 : 8945 d8 mov word ptr ss : [ ebp - 0x28 ] , ax
* 011413 b5 c683 f1000000 00 mov byte ptr ds : [ ebx + 0xf1 ] , 0x0
* 011413 bc 8 d8d 90f effff lea ecx , dword ptr ss : [ ebp - 0x170 ]
* 011413 c2 c745 fc 03000000 mov dword ptr ss : [ ebp - 0x4 ] , 0x3
* 011413 c9 e8 42 bb0800 call .011 ccf10
* 011413 ce 8 d8d 60f dffff lea ecx , dword ptr ss : [ ebp - 0x2a0 ]
* 011413 d4 c745 fc ffffffff mov dword ptr ss : [ ebp - 0x4 ] , - 0x1
* 011413 db e8 30 bb0800 call .011 ccf10
* 011413e0 8 bbd 38f dffff mov edi , dword ptr ss : [ ebp - 0x2c8 ]
* 011413e6 ^ e9 c5fbffff jmp .01140f b0
* 011413 eb 8 b9d 1 cfdffff mov ebx , dword ptr ss : [ ebp - 0x2e4 ]
* 011413f 1 85 db test ebx , ebx
* 011413f 3 74 6 a je short .0114145f
* 011413f 5 8 b8d 38f dffff mov ecx , dword ptr ss : [ ebp - 0x2c8 ]
* 011413f b 8379 14 08 cmp dword ptr ds : [ ecx + 0x14 ] , 0x8
* 011413ff 72 02 jb short .01141403
* 01141401 8 b09 mov ecx , dword ptr ds : [ ecx ]
* 01141403 8 b85 20f dffff mov eax , dword ptr ss : [ ebp - 0x2e0 ]
* 0114140 9 c745 d4 07000000 mov dword ptr ss : [ ebp - 0x2c ] , 0x7
* 01141410 c745 d0 00000000 mov dword ptr ss : [ ebp - 0x30 ] , 0x0
* 01141417 8 b00 mov eax , dword ptr ds : [ eax ]
* 0114141 9 8 d0441 lea eax , dword ptr ds : [ ecx + eax * 2 ]
* 0114141 c 33 c9 xor ecx , ecx
* 0114141 e 66 : 894 d c0 mov word ptr ss : [ ebp - 0x40 ] , cx
* 01141422 3 bf8 cmp edi , eax
* 01141424 74 0 e je short .01141434
* 01141426 2 bc7 sub eax , edi
* 0114142 8 8 d4d c0 lea ecx , dword ptr ss : [ ebp - 0x40 ]
* 0114142 b d1f8 sar eax , 1
* 0114142 d 50 push eax
* 0114142 e 57 push edi
* 0114142f e8 fcd9f2ff call .0106 ee30
* 01141434 8 d45 c0 lea eax , dword ptr ss : [ ebp - 0x40 ]
* 01141437 c745 fc 00000000 mov dword ptr ss : [ ebp - 0x4 ] , 0x0
* 0114143 e 3 bd8 cmp ebx , eax
* 01141440 74 0 c je short .0114144 e
* 01141442 6 a ff push - 0x1
* 01141444 6 a 00 push 0x0
* 01141446 50 push eax
* 01141447 8 bcb mov ecx , ebx
* 0114144 9 e8 c2def2ff call .0106f 310
* 0114144 e 837 d d4 08 cmp dword ptr ss : [ ebp - 0x2c ] , 0x8
* 01141452 72 0 b jb short .0114145f
* 01141454 ff75 c0 push dword ptr ss : [ ebp - 0x40 ]
* 01141457 e8 3 ecb0e00 call .0122 df9a
* 0114145 c 83 c4 04 add esp , 0x4
* 0114145f 8 b4d f4 mov ecx , dword ptr ss : [ ebp - 0xc ]
* 01141462 64 : 890 d 00000000 mov dword ptr fs : [ 0 ] , ecx
* 0114146 9 59 pop ecx
* 0114146 a 5f pop edi
* 0114146 b 5 e pop esi
* 0114146 c 5 b pop ebx
* 0114146 d 8 b4d f0 mov ecx , dword ptr ss : [ ebp - 0x10 ]
* 01141470 33 cd xor ecx , ebp
* 01141472 e8 14 cb0e00 call .0122 df8b
* 01141477 8 be5 mov esp , ebp
* 0114147 9 5 d pop ebp
* 0114147 a c2 0800 retn 0x8
* 0114147 d cc int3
* 0114147 e cc int3
*
* In AngleBeats , base = 0x09a0000
* 00 B6B87C CC INT3
* 00 B6B87D CC INT3
* 00 B6B87E CC INT3
* 00 B6B87F CC INT3
* 00 B6B880 55 PUSH EBP
* 00 B6B881 8 BEC MOV EBP , ESP
* 00 B6B883 6 A FF PUSH - 0x1
* 00 B6B885 68 7964 ED00 PUSH .00 ED6479
* 00 B6B88A 64 : A1 00000000 MOV EAX , DWORD PTR FS : [ 0 ]
* 00 B6B890 50 PUSH EAX
* 00 B6B891 81 EC 1 C040000 SUB ESP , 0x41C
* 00 B6B897 A1 E0A4F800 MOV EAX , DWORD PTR DS : [ 0xF8A4E0 ]
* 00 B6B89C 33 C5 XOR EAX , EBP
* 00 B6B89E 8945 F0 MOV DWORD PTR SS : [ EBP - 0x10 ] , EAX
* 00 B6B8A1 53 PUSH EBX
* 00 B6B8A2 56 PUSH ESI
* 00 B6B8A3 57 PUSH EDI
* 00 B6B8A4 50 PUSH EAX
* 00 B6B8A5 8 D45 F4 LEA EAX , DWORD PTR SS : [ EBP - 0xC ]
* 00 B6B8A8 64 : A3 00000000 MOV DWORD PTR FS : [ 0 ] , EAX
* 00 B6B8AE 8 BD9 MOV EBX , ECX
* 00 B6B8B0 8 B7D 08 MOV EDI , DWORD PTR SS : [ EBP + 0x8 ]
* 00 B6B8B3 837F 10 00 CMP DWORD PTR DS : [ EDI + 0x10 ] , 0x0
* 00 B6B8B7 8 B45 0 C MOV EAX , DWORD PTR SS : [ EBP + 0xC ]
* 00 B6B8BA 8985 E0FBFFFF MOV DWORD PTR SS : [ EBP - 0x420 ] , EAX
* 00 B6B8C0 8 D47 10 LEA EAX , DWORD PTR DS : [ EDI + 0x10 ]
* 00 B6B8C3 89 BD FCFBFFFF MOV DWORD PTR SS : [ EBP - 0x404 ] , EDI
* 00 B6B8C9 8985 F0FBFFFF MOV DWORD PTR SS : [ EBP - 0x410 ] , EAX
* 00 B6B8CF 0F 84 31060000 JE .00 B6BF06
* 00 B6B8D5 8 B8B 1 C010000 MOV ECX , DWORD PTR DS : [ EBX + 0x11C ]
* 00 B6B8DB B8 71F 8428 A MOV EAX , 0x8A42F871
* 00 B6B8E0 2 B8B 18010000 SUB ECX , DWORD PTR DS : [ EBX + 0x118 ]
* 00 B6B8E6 F7E9 IMUL ECX
* 00 B6B8E8 8 B85 F0FBFFFF MOV EAX , DWORD PTR SS : [ EBP - 0x410 ]
* 00 B6B8EE 03 D1 ADD EDX , ECX
* 00 B6B8F0 8 B8B 20010000 MOV ECX , DWORD PTR DS : [ EBX + 0x120 ]
* 00 B6B8F6 2 B8B 18010000 SUB ECX , DWORD PTR DS : [ EBX + 0x118 ]
* 00 B6B8FC C1FA 09 SAR EDX , 0x9
* 00 B6B8FF 8 BF2 MOV ESI , EDX
* 00 B6B901 C1EE 1F SHR ESI , 0x1F
* 00 B6B904 03F 2 ADD ESI , EDX
* 00 B6B906 0330 ADD ESI , DWORD PTR DS : [ EAX ]
* 00 B6B908 B8 71F 8428 A MOV EAX , 0x8A42F871
* 00 B6B90D F7E9 IMUL ECX
* 00 B6B90F 03 D1 ADD EDX , ECX
* 00 B6B911 C1FA 09 SAR EDX , 0x9
* 00 B6B914 8 BC2 MOV EAX , EDX
* 00 B6B916 C1E8 1F SHR EAX , 0x1F
* 00 B6B919 03 C2 ADD EAX , EDX
* 00 B6B91B 3 BC6 CMP EAX , ESI
* 00 B6B91D 73 1 E JNB SHORT .00 B6B93D
* 00 B6B91F 81F E 7 C214500 CMP ESI , 0x45217C
* 00 B6B925 76 0 A JBE SHORT .00 B6B931
* 00 B6B927 68 C031F200 PUSH .00F 231 C0 ; ASCII " vector<T> too long "
* 00 B6B92C E8 D2FC0E00 CALL .00 C5B603
* 00 B6B931 56 PUSH ESI
* 00 B6B932 8 D8B 18010000 LEA ECX , DWORD PTR DS : [ EBX + 0x118 ]
* 00 B6B938 E8 A38DFCFF CALL .00 B346E0
* 00 B6B93D 837F 14 08 CMP DWORD PTR DS : [ EDI + 0x14 ] , 0x8
* 00 B6B941 72 04 JB SHORT .00 B6B947
* 00 B6B943 8 B37 MOV ESI , DWORD PTR DS : [ EDI ]
* 00 B6B945 EB 02 JMP SHORT .00 B6B949
* 00 B6B947 8 BF7 MOV ESI , EDI
* 00 B6B949 89 B5 F8FBFFFF MOV DWORD PTR SS : [ EBP - 0x408 ] , ESI
* 00 B6B94F 90 NOP
* 00 B6B950 8 B57 14 MOV EDX , DWORD PTR DS : [ EDI + 0x14 ]
* 00 B6B953 83F A 08 CMP EDX , 0x8
* 00 B6B956 72 04 JB SHORT .00 B6B95C
* 00 B6B958 8 B07 MOV EAX , DWORD PTR DS : [ EDI ]
* 00 B6B95A EB 02 JMP SHORT .00 B6B95E
* 00 B6B95C 8 BC7 MOV EAX , EDI
* 00 B6B95E 8 B8D F0FBFFFF MOV ECX , DWORD PTR SS : [ EBP - 0x410 ]
* 00 B6B964 8 B09 MOV ECX , DWORD PTR DS : [ ECX ]
* 00 B6B966 03 C9 ADD ECX , ECX
* 00 B6B968 03 C1 ADD EAX , ECX
* 00 B6B96A 3 BF0 CMP ESI , EAX
* 00 B6B96C 0F 84 94050000 JE .00 B6BF06
* 00 B6B972 8 B85 FCFBFFFF MOV EAX , DWORD PTR SS : [ EBP - 0x404 ]
* 00 B6B978 8 BFE MOV EDI , ESI
* 00 B6B97A C785 00F CFFFF 00 > MOV DWORD PTR SS : [ EBP - 0x400 ] , 0x0
* 00 B6B984 C785 E8FBFFFF FF > MOV DWORD PTR SS : [ EBP - 0x418 ] , - 0x1
* 00 B6B98E 83F A 08 CMP EDX , 0x8
* 00 B6B991 72 02 JB SHORT .00 B6B995
* 00 B6B993 8 B00 MOV EAX , DWORD PTR DS : [ EAX ]
* 00 B6B995 03 C1 ADD EAX , ECX
* 00 B6B997 8 D95 00F CFFFF LEA EDX , DWORD PTR SS : [ EBP - 0x400 ]
* 00 B6B99D 8 D8D E8FBFFFF LEA ECX , DWORD PTR SS : [ EBP - 0x418 ]
* 00 B6B9A3 51 PUSH ECX
* 00 B6B9A4 50 PUSH EAX
* 00 B6B9A5 8 D8D F8FBFFFF LEA ECX , DWORD PTR SS : [ EBP - 0x408 ]
* 00 B6B9AB E8 5025F BFF CALL .00 B1DF00
* 00 B6B9B0 8 BB5 E8FBFFFF MOV ESI , DWORD PTR SS : [ EBP - 0x418 ]
* 00 B6B9B6 83 C4 08 ADD ESP , 0x8
* 00 B6B9B9 83F E 0 A CMP ESI , 0xA
* 00 B6B9BC 75 18 JNZ SHORT .00 B6B9D6
* 00 B6B9BE 8 BCB MOV ECX , EBX
* 00 B6B9C0 E8 FB070000 CALL .00 B6C1C0
* 00 B6B9C5 8 BB5 F8FBFFFF MOV ESI , DWORD PTR SS : [ EBP - 0x408 ]
* 00 B6B9CB 8 BBD FCFBFFFF MOV EDI , DWORD PTR SS : [ EBP - 0x404 ]
* 00 B6B9D1 ^ E9 7 AFFFFFF JMP .00 B6B950
* 00 B6B9D6 83F E 07 CMP ESI , 0x7
* 00 B6B9D9 75 38 JNZ SHORT .00 B6BA13
* 00 B6B9DB 33 C0 XOR EAX , EAX
* 00 B6B9DD C783 EC000000 00 > MOV DWORD PTR DS : [ EBX + 0xEC ] , 0x0
* 00 B6B9E7 8 BCB MOV ECX , EBX
* 00 B6B9E9 66 : 8983 F0000000 MOV WORD PTR DS : [ EBX + 0xF0 ] , AX
* 00 B6B9F0 8983 F4000000 MOV DWORD PTR DS : [ EBX + 0xF4 ] , EAX
* 00 B6B9F6 E8 C5070000 CALL .00 B6C1C0
* 00 B6B9FB 8 BB5 F8FBFFFF MOV ESI , DWORD PTR SS : [ EBP - 0x408 ]
* 00 B6BA01 8 BBD FCFBFFFF MOV EDI , DWORD PTR SS : [ EBP - 0x404 ]
* 00 B6BA07 C683 FD000000 01 MOV BYTE PTR DS : [ EBX + 0xFD ] , 0x1
* 00 B6BA0E ^ E9 3 DFFFFFF JMP .00 B6B950
* 00 B6BA13 8 B85 00F CFFFF MOV EAX , DWORD PTR SS : [ EBP - 0x400 ]
* 00 B6BA19 85 C0 TEST EAX , EAX
* 00 B6BA1B 75 3 A JNZ SHORT .00 B6BA57
* 00 B6BA1D 85F 6 TEST ESI , ESI
* 00 B6BA1F 0F 84 BE000000 JE .00 B6BAE3
* 00 B6BA25 85 C0 TEST EAX , EAX
* 00 B6BA27 75 2 E JNZ SHORT .00 B6BA57
* 00 B6BA29 A1 486 A2C05 MOV EAX , DWORD PTR DS : [ 0x52C6A48 ]
* 00 B6BA2E A8 01 TEST AL , 0x1
* 00 B6BA30 75 0 D JNZ SHORT .00 B6BA3F
* 00 B6BA32 83 C8 01 OR EAX , 0x1
* 00 B6BA35 A3 486 A2C05 MOV DWORD PTR DS : [ 0x52C6A48 ] , EAX
* 00 B6BA3A E8 B15F0B00 CALL .00 C219F0
* 00 B6BA3F 0F B7C6 MOVZX EAX , SI
* 00 B6BA42 80 B8 506 A2C05 01 CMP BYTE PTR DS : [ EAX + 0x52C6A50 ] , 0x1
* 00 B6BA49 75 0 C JNZ SHORT .00 B6BA57
* 00 B6BA4B 8 B43 6 C MOV EAX , DWORD PTR DS : [ EBX + 0x6C ]
* 00 B6BA4E 99 CDQ
* 00 B6BA4F 2 BC2 SUB EAX , EDX
* 00 B6BA51 8 BC8 MOV ECX , EAX
* 00 B6BA53 D1F9 SAR ECX , 1
* 00 B6BA55 EB 03 JMP SHORT .00 B6BA5A
* 00 B6BA57 8 B4B 6 C MOV ECX , DWORD PTR DS : [ EBX + 0x6C ]
* 00 B6BA5A 8 B15 9 C5DFA00 MOV EDX , DWORD PTR DS : [ 0xFA5D9C ]
* 00 B6BA60 898 D ECFBFFFF MOV DWORD PTR SS : [ EBP - 0x414 ] , ECX
* 00 B6BA66 83 BA 84 CF0000 01 CMP DWORD PTR DS : [ EDX + 0xCF84 ] , 0x1
* 00 B6BA6D 75 26 JNZ SHORT .00 B6BA95
* 00 B6BA6F 8 B43 60 MOV EAX , DWORD PTR DS : [ EBX + 0x60 ]
* 00 B6BA72 03 C1 ADD EAX , ECX
* 00 B6BA74 8 B8B AC000000 MOV ECX , DWORD PTR DS : [ EBX + 0xAC ]
* 00 B6BA7A 8985 04F CFFFF MOV DWORD PTR SS : [ EBP - 0x3FC ] , EAX
* 00 B6BA80 8 B43 18 MOV EAX , DWORD PTR DS : [ EBX + 0x18 ]
* 00 B6BA83 03 C1 ADD EAX , ECX
* 00 B6BA85 3985 04F CFFFF CMP DWORD PTR SS : [ EBP - 0x3FC ] , EAX
* 00 B6BA8B 7F 39 JG SHORT .00 B6BAC6
* 00 B6BA8D 398 D 04F CFFFF CMP DWORD PTR SS : [ EBP - 0x3FC ] , ECX
* 00 B6BA93 EB 24 JMP SHORT .00 B6BAB9
* 00 B6BA95 8 B43 5 C MOV EAX , DWORD PTR DS : [ EBX + 0x5C ]
* 00 B6BA98 03 C1 ADD EAX , ECX
* 00 B6BA9A 8 B8B A8000000 MOV ECX , DWORD PTR DS : [ EBX + 0xA8 ]
* 00 B6BAA0 8985 04F CFFFF MOV DWORD PTR SS : [ EBP - 0x3FC ] , EAX
* 00 B6BAA6 8 B43 18 MOV EAX , DWORD PTR DS : [ EBX + 0x18 ]
* 00 B6BAA9 03 C1 ADD EAX , ECX
* 00 B6BAAB 3985 04F CFFFF CMP DWORD PTR SS : [ EBP - 0x3FC ] , EAX
* 00 B6BAB1 7F 13 JG SHORT .00 B6BAC6
* 00 B6BAB3 398 D 04F CFFFF CMP DWORD PTR SS : [ EBP - 0x3FC ] , ECX
* 00 B6BAB9 7 E 3F JLE SHORT .00 B6BAFA
* 00 B6BABB 8 BCE MOV ECX , ESI
* 00 B6BABD E8 EEF9FFFF CALL .00 B6B4B0
* 00 B6BAC2 84 C0 TEST AL , AL
* 00 B6BAC4 75 34 JNZ SHORT .00 B6BAFA
* 00 B6BAC6 8 BCB MOV ECX , EBX
* 00 B6BAC8 E8 F3060000 CALL .00 B6C1C0
* 00 B6BACD 83 BD 00F CFFFF 00 CMP DWORD PTR SS : [ EBP - 0x400 ] , 0x0
* 00 B6BAD4 75 1 E JNZ SHORT .00 B6BAF4
* 00 B6BAD6 83F E 20 CMP ESI , 0x20
* 00 B6BAD9 74 08 JE SHORT .00 B6BAE3
* 00 B6BADB 81F E 00300000 CMP ESI , 0x3000
* 00 B6BAE1 75 11 JNZ SHORT .00 B6BAF4
* 00 B6BAE3 8 BB5 F8FBFFFF MOV ESI , DWORD PTR SS : [ EBP - 0x408 ]
* 00 B6BAE9 8 BBD FCFBFFFF MOV EDI , DWORD PTR SS : [ EBP - 0x404 ]
* 00 B6BAEF ^ E9 5 CFEFFFF JMP .00 B6B950
* 00 B6BAF4 8 B15 9 C5DFA00 MOV EDX , DWORD PTR DS : [ 0xFA5D9C ]
* 00 B6BAFA 83 BA 84 CF0000 01 CMP DWORD PTR DS : [ EDX + 0xCF84 ] , 0x1
* 00 B6BB01 75 66 JNZ SHORT .00 B6BB69
* 00 B6BB03 8 B83 A8000000 MOV EAX , DWORD PTR DS : [ EBX + 0xA8 ]
* 00 B6BB09 F7D8 NEG EAX
* 00 B6BB0B 3943 5 C CMP DWORD PTR DS : [ EBX + 0x5C ] , EAX
* 00 B6BB0E 7F 68 JG SHORT .00 B6BB78
* 00 B6BB10 8 B9D E0FBFFFF MOV EBX , DWORD PTR SS : [ EBP - 0x420 ]
* 00 B6BB16 85 DB TEST EBX , EBX
* 00 B6BB18 0F 84 E8030000 JE .00 B6BF06
* 00 B6BB1E 8 B8D FCFBFFFF MOV ECX , DWORD PTR SS : [ EBP - 0x404 ]
* 00 B6BB24 8379 14 08 CMP DWORD PTR DS : [ ECX + 0x14 ] , 0x8
* 00 B6BB28 72 02 JB SHORT .00 B6BB2C
* 00 B6BB2A 8 B09 MOV ECX , DWORD PTR DS : [ ECX ]
* 00 B6BB2C 8 B85 F0FBFFFF MOV EAX , DWORD PTR SS : [ EBP - 0x410 ]
* 00 B6BB32 C745 EC 07000000 MOV DWORD PTR SS : [ EBP - 0x14 ] , 0x7
* 00 B6BB39 C745 E8 00000000 MOV DWORD PTR SS : [ EBP - 0x18 ] , 0x0
* 00 B6BB40 8 B00 MOV EAX , DWORD PTR DS : [ EAX ]
* 00 B6BB42 8 D0441 LEA EAX , DWORD PTR DS : [ ECX + EAX * 2 ]
* 00 B6BB45 33 C9 XOR ECX , ECX
* 00 B6BB47 66 : 894 D D8 MOV WORD PTR SS : [ EBP - 0x28 ] , CX
* 00 B6BB4B 3 BF8 CMP EDI , EAX
* 00 B6BB4D 74 0 E JE SHORT .00 B6BB5D
* 00 B6BB4F 2 BC7 SUB EAX , EDI
* 00 B6BB51 8 D4D D8 LEA ECX , DWORD PTR SS : [ EBP - 0x28 ]
* 00 B6BB54 D1F8 SAR EAX , 1
* 00 B6BB56 50 PUSH EAX
* 00 B6BB57 57 PUSH EDI
* 00 B6BB58 E8 E334F2FF CALL .00 A8F040
* 00 B6BB5D C745 FC 00000000 MOV DWORD PTR SS : [ EBP - 0x4 ] , 0x0
* 00 B6BB64 E9 82030000 JMP .00 B6BEEB
* 00 B6BB69 8 B43 60 MOV EAX , DWORD PTR DS : [ EBX + 0x60 ]
* 00 B6BB6C 3 B83 AC000000 CMP EAX , DWORD PTR DS : [ EBX + 0xAC ]
* 00 B6BB72 0F 8 D 23030000 JGE .00 B6BE9B
* 00 B6BB78 8 D8D 08F CFFFF LEA ECX , DWORD PTR SS : [ EBP - 0x3F8 ]
* 00 B6BB7E E8 EDDEFFFF CALL .00 B69A70
* 00 B6BB83 C745 FC 02000000 MOV DWORD PTR SS : [ EBP - 0x4 ] , 0x2
* 00 B6BB8A 8 B43 78 MOV EAX , DWORD PTR DS : [ EBX + 0x78 ]
* 00 B6BB8D 8 B15 C05DFA00 MOV EDX , DWORD PTR DS : [ 0xFA5DC0 ]
* 00 B6BB93 8985 F4FBFFFF MOV DWORD PTR SS : [ EBP - 0x40C ] , EAX
* 00 B6BB99 83F 8 FF CMP EAX , - 0x1
* 00 B6BB9C 75 23 JNZ SHORT .00 B6BBC1
* 00 B6BB9E 80 BA 60010000 00 CMP BYTE PTR DS : [ EDX + 0x160 ] , 0x0
* 00 B6BBA5 74 11 JE SHORT .00 B6BBB8
* 00 B6BBA7 8 B83 E0000000 MOV EAX , DWORD PTR DS : [ EBX + 0xE0 ]
* 00 B6BBAD 8985 F4FBFFFF MOV DWORD PTR SS : [ EBP - 0x40C ] , EAX
* 00 B6BBB3 83F 8 FF CMP EAX , - 0x1
* 00 B6BBB6 75 09 JNZ SHORT .00 B6BBC1
* 00 B6BBB8 8 B43 24 MOV EAX , DWORD PTR DS : [ EBX + 0x24 ]
* 00 B6BBBB 8985 F4FBFFFF MOV DWORD PTR SS : [ EBP - 0x40C ] , EAX
* 00 B6BBC1 8 B4B 7 C MOV ECX , DWORD PTR DS : [ EBX + 0x7C ]
* 00 B6BBC4 898 D E4FBFFFF MOV DWORD PTR SS : [ EBP - 0x41C ] , ECX
* 00 B6BBCA 83F 9 FF CMP ECX , - 0x1
* 00 B6BBCD 75 23 JNZ SHORT .00 B6BBF2
* 00 B6BBCF 80 BA 60010000 00 CMP BYTE PTR DS : [ EDX + 0x160 ] , 0x0
* 00 B6BBD6 74 11 JE SHORT .00 B6BBE9
* 00 B6BBD8 8 B8B E4000000 MOV ECX , DWORD PTR DS : [ EBX + 0xE4 ]
* 00 B6BBDE 898 D E4FBFFFF MOV DWORD PTR SS : [ EBP - 0x41C ] , ECX
* 00 B6BBE4 83F 9 FF CMP ECX , - 0x1
* 00 B6BBE7 75 09 JNZ SHORT .00 B6BBF2
* 00 B6BBE9 8 B43 28 MOV EAX , DWORD PTR DS : [ EBX + 0x28 ]
* 00 B6BBEC 8985 E4FBFFFF MOV DWORD PTR SS : [ EBP - 0x41C ] , EAX
* 00 B6BBF2 8 B83 80000000 MOV EAX , DWORD PTR DS : [ EBX + 0x80 ]
* 00 B6BBF8 8985 04F CFFFF MOV DWORD PTR SS : [ EBP - 0x3FC ] , EAX
* 00 B6BBFE 83F 8 FF CMP EAX , - 0x1
* 00 B6BC01 75 23 JNZ SHORT .00 B6BC26
* 00 B6BC03 80 BA 60010000 00 CMP BYTE PTR DS : [ EDX + 0x160 ] , 0x0
* 00 B6BC0A 74 11 JE SHORT .00 B6BC1D
* 00 B6BC0C 8 B83 E8000000 MOV EAX , DWORD PTR DS : [ EBX + 0xE8 ]
* 00 B6BC12 8985 04F CFFFF MOV DWORD PTR SS : [ EBP - 0x3FC ] , EAX
* 00 B6BC18 83F 8 FF CMP EAX , - 0x1
* 00 B6BC1B 75 09 JNZ SHORT .00 B6BC26
* 00 B6BC1D 8 B43 2 C MOV EAX , DWORD PTR DS : [ EBX + 0x2C ]
* 00 B6BC20 8985 04F CFFFF MOV DWORD PTR SS : [ EBP - 0x3FC ] , EAX
* 00 B6BC26 8 B53 68 MOV EDX , DWORD PTR DS : [ EBX + 0x68 ]
* 00 B6BC29 0353 60 ADD EDX , DWORD PTR DS : [ EBX + 0x60 ]
* 00 B6BC2C 8 B4B 5 C MOV ECX , DWORD PTR DS : [ EBX + 0x5C ]
* 00 B6BC2F 034 B 64 ADD ECX , DWORD PTR DS : [ EBX + 0x64 ]
* 00 B6BC32 83 BD 00F CFFFF 01 CMP DWORD PTR SS : [ EBP - 0x400 ] , 0x1
* 00 B6BC39 8 BB5 F4FBFFFF MOV ESI , DWORD PTR SS : [ EBP - 0x40C ]
* 00 B6BC3F 8 B43 6 C MOV EAX , DWORD PTR DS : [ EBX + 0x6C ]
* 00 B6BC42 C785 DCFBFFFF 00 > MOV DWORD PTR SS : [ EBP - 0x424 ] , 0x0
* 00 B6BC4C 0F 44 B5 DCFBFFFF CMOVE ESI , DWORD PTR SS : [ EBP - 0x424 ]
* 00 B6BC53 80 BB FE000000 00 CMP BYTE PTR DS : [ EBX + 0xFE ] , 0x0
* 00 B6BC5A 89 B5 F4FBFFFF MOV DWORD PTR SS : [ EBP - 0x40C ] , ESI
* 00 B6BC60 8 BB5 00F CFFFF MOV ESI , DWORD PTR SS : [ EBP - 0x400 ]
* 00 B6BC66 8985 10F CFFFF MOV DWORD PTR SS : [ EBP - 0x3F0 ] , EAX
* 00 B6BC6C 8 B85 F4FBFFFF MOV EAX , DWORD PTR SS : [ EBP - 0x40C ]
* 00 B6BC72 8985 14F CFFFF MOV DWORD PTR SS : [ EBP - 0x3EC ] , EAX
* 00 B6BC78 8 B85 E4FBFFFF MOV EAX , DWORD PTR SS : [ EBP - 0x41C ]
* 00 B6BC7E 89 B5 08F CFFFF MOV DWORD PTR SS : [ EBP - 0x3F8 ] , ESI
* 00 B6BC84 8 BB5 E8FBFFFF MOV ESI , DWORD PTR SS : [ EBP - 0x418 ]
* 00 B6BC8A 8985 18F CFFFF MOV DWORD PTR SS : [ EBP - 0x3E8 ] , EAX
* 00 B6BC90 8 B85 04F CFFFF MOV EAX , DWORD PTR SS : [ EBP - 0x3FC ]
* 00 B6BC96 89 B5 0 CFCFFFF MOV DWORD PTR SS : [ EBP - 0x3F4 ] , ESI
* 00 B6BC9C 8985 1 CFCFFFF MOV DWORD PTR SS : [ EBP - 0x3E4 ] , EAX
* 00 B6BCA2 898 D 20F CFFFF MOV DWORD PTR SS : [ EBP - 0x3E0 ] , ECX
* 00 B6BCA8 8995 24F CFFFF MOV DWORD PTR SS : [ EBP - 0x3DC ] , EDX
* 00 B6BCAE 74 19 JE SHORT .00 B6BCC9
* 00 B6BCB0 8 B43 5 C MOV EAX , DWORD PTR DS : [ EBX + 0x5C ]
* 00 B6BCB3 8983 00010000 MOV DWORD PTR DS : [ EBX + 0x100 ] , EAX
* 00 B6BCB9 8 B43 60 MOV EAX , DWORD PTR DS : [ EBX + 0x60 ]
* 00 B6BCBC 8983 04010000 MOV DWORD PTR DS : [ EBX + 0x104 ] , EAX
* 00 B6BCC2 C683 FE000000 00 MOV BYTE PTR DS : [ EBX + 0xFE ] , 0x0
* 00 B6BCC9 A1 9 C5DFA00 MOV EAX , DWORD PTR DS : [ 0xFA5D9C ]
* 00 B6BCCE 83 B8 84 CF0000 01 CMP DWORD PTR DS : [ EAX + 0xCF84 ] , 0x1
* 00 B6BCD5 8 B43 70 MOV EAX , DWORD PTR DS : [ EBX + 0x70 ]
* 00 B6BCD8 75 0 B JNZ SHORT .00 B6BCE5
* 00 B6BCDA 03 85 ECFBFFFF ADD EAX , DWORD PTR SS : [ EBP - 0x414 ]
* 00 B6BCE0 0143 60 ADD DWORD PTR DS : [ EBX + 0x60 ] , EAX
* 00 B6BCE3 EB 09 JMP SHORT .00 B6BCEE
* 00 B6BCE5 03 85 ECFBFFFF ADD EAX , DWORD PTR SS : [ EBP - 0x414 ]
* 00 B6BCEB 0143 5 C ADD DWORD PTR DS : [ EBX + 0x5C ] , EAX
* 00 B6BCEE 8 B8D 00F CFFFF MOV ECX , DWORD PTR SS : [ EBP - 0x400 ]
* 00 B6BCF4 85 C9 TEST ECX , ECX
* 00 B6BCF6 75 42 JNZ SHORT .00 B6BD3A
* 00 B6BCF8 81F E 0 C300000 CMP ESI , 0x300C ; jichi : type2 found here
* 00 B6BCFE 74 10 JE SHORT .00 B6BD10
* 00 B6BD00 81F E 0E300000 CMP ESI , 0x300E
* 00 B6BD06 74 08 JE SHORT .00 B6BD10
* 00 B6BD08 81F E 08FF 0000 CMP ESI , 0xFF08
* 00 B6BD0E 75 2 A JNZ SHORT .00 B6BD3A
* 00 B6BD10 80 BB FD000000 00 CMP BYTE PTR DS : [ EBX + 0xFD ] , 0x0
* 00 B6BD17 74 10 JE SHORT .00 B6BD29
* 00 B6BD19 56 PUSH ESI
*/
bool InsertSiglus2Hook ( )
{
//const BYTE bytes[] = { // size = 14
// 0x01,0x53, 0x58, // 0153 58 add dword ptr ds:[ebx+58],edx
// 0x8b,0x95, 0x34,0xfd,0xff,0xff, // 8b95 34fdffff mov edx,dword ptr ss:[ebp-2cc]
// 0x8b,0x43, 0x58, // 8b43 58 mov eax,dword ptr ds:[ebx+58]
// 0x3b,0xd7 // 3bd7 cmp edx,edi ; hook here
//};
//enum { cur_ins_size = 2 };
//enum { addr_offset = sizeof(bytes) - cur_ins_size }; // = 14 - 2 = 12, current inst is the last one
ULONG range = min ( processStopAddress - processStartAddress , MAX_REL_ADDR ) ;
ULONG addr ;
{ // type 1
const BYTE bytes [ ] = {
0x3b , 0xd7 , // cmp edx,edi ; hook here
0x75 , 0x4b // jnz short
} ;
//enum { addr_offset = 0 };
addr = MemDbg : : findBytes ( bytes , sizeof ( bytes ) , processStartAddress , processStartAddress + range ) ;
if ( addr )
ConsoleOutput ( " Siglus2: type 1 pattern found " ) ;
}
if ( ! addr ) {
// 81fe0c300000
const BYTE bytes [ ] = {
0x81 , 0xfe , 0x0c , 0x30 , 0x00 , 0x00 // 0114124a 81fe 0c300000 cmp esi,0x300c ; jichi: hook here
} ;
//enum { addr_offset = 0 };
addr = MemDbg : : findBytes ( bytes , sizeof ( bytes ) , processStartAddress , processStartAddress + range ) ;
if ( addr )
ConsoleOutput ( " Siglus2: type 2 pattern found " ) ;
}
if ( ! addr ) {
ConsoleOutput ( " Siglus2: both type1 and type2 patterns not found " ) ;
return false ;
}
HookParam hp ;
hp . address = addr ;
hp . offset = get_reg ( regs : : esi ) ;
hp . type = CODEC_UTF16 | FIXING_SPLIT ; // jichi 6/1/2014: fixing the split value
ConsoleOutput ( " INSERT Siglus2 " ) ;
return NewHook ( hp , " SiglusEngine2 " ) ;
}
static void SpecialHookSiglus1 ( hook_stack * stack , HookParam * hp , uintptr_t * data , uintptr_t * split , size_t * len )
{
//写回有乱码
auto textu = ( TextUnionW * ) ( stack - > ecx + 4 ) ;
* len = textu - > size * 2 ;
* data = ( DWORD ) textu - > getText ( ) ;
}
// jichi: 8/17/2013: Change return type to bool
bool InsertSiglus1Hook ( )
{
const BYTE bytes [ ] = { 0x33 , 0xc0 , 0x8b , 0xf9 , 0x89 , 0x7c , 0x24 } ;
ULONG range = max ( processStopAddress - processStartAddress , MAX_REL_ADDR ) ;
ULONG addr = MemDbg : : findBytes ( bytes , sizeof ( bytes ) , processStartAddress , processStartAddress + range ) ;
if ( ! addr ) { // jichi 8/17/2013: Add "== 0" check to prevent breaking new games
//ConsoleOutput("Unknown SiglusEngine");
ConsoleOutput ( " Siglus: pattern not found " ) ;
return false ;
}
DWORD limit = addr - 0x100 ;
while ( addr > limit ) {
if ( * ( WORD * ) addr = = 0xff6a ) {
HookParam hp ;
hp . address = addr ;
hp . text_fun = SpecialHookSiglus1 ;
hp . type = CODEC_UTF16 ;
ConsoleOutput ( " INSERT Siglus " ) ;
return NewHook ( hp , " SiglusEngine " ) ;
}
addr - - ;
}
ConsoleOutput ( " Siglus: failed " ) ;
return false ;
}
} // unnamed namespace
// jichi 8/17/2013: Insert old first. As the pattern could also be found in the old engine.
bool InsertSiglusHook ( )
{
if ( InsertSiglus1Hook ( ) )
return true ;
bool ok = InsertSiglus2Hook ( ) ;
ok = InsertSiglus3Hook ( ) | | ok ;
ok = InsertSiglus4Hook ( ) | | ok ;
return ok ;
}
bool InsertSiglusHookZ ( ) {
BYTE bytes [ ] = {
0x8b , 0x12 ,
0x66 , 0x89 , 0x04 , 0x72
} ;
auto addr = MemDbg : : findBytes ( bytes , sizeof ( bytes ) , processStartAddress , processStopAddress ) ;
ConsoleOutput ( " SiglusHookZ %p " , addr ) ;
if ( addr = = 0 ) return false ;
HookParam hp ;
hp . address = addr + 2 ;
hp . offset = get_reg ( regs : : eax ) ;
hp . type = CODEC_UTF16 ;
return NewHook ( hp , " SiglusHookZ " ) ;
}
namespace {
namespace ScenarioHook {
namespace Private {
/**
* jichi 8 / 16 / 2013 : Insert new siglus hook
* See ( CaoNiMaGeBi ) : http : //tieba.baidu.com/p/2531786952
*
* 013 bac6e cc int3
* 013 bac6f cc int3
* 013 bac70 / $ 55 push ebp ; jichi : function starts
* 013 bac71 | . 8 bec mov ebp , esp
* 013 bac73 | . 6 a ff push - 0x1
* 013 bac75 | . 68 d8306201 push siglusen .016230 d8
* 013 bac7a | . 64 : a1 00000000 mov eax , dword ptr fs : [ 0 ]
* 013 bac80 | . 50 push eax
* 013 bac81 | . 81 ec dc020000 sub esp , 0x2dc
* 013 bac87 | . a1 90f 46 b01 mov eax , dword ptr ds : [ 0x16bf490 ]
* 013 bac8c | . 33 c5 xor eax , ebp
* 013 bac8e | . 8945 f0 mov dword ptr ss : [ ebp - 0x10 ] , eax
* 013 bac91 | . 53 push ebx
* 013 bac92 | . 56 push esi
* 013 bac93 | . 57 push edi
* 013 bac94 | . 50 push eax
* . . .
* 013 baf32 | . 3 bd7 | cmp edx , edi ; jichi : ITH hook here , char saved in edi
* 013 baf34 | . 75 4 b | jnz short siglusen .013 baf81
*/
enum Type {
Type1 // Old SiglusEngine2, arg in ecx
, Type2 // New SiglusENgine2, arg in arg1, since リア充クラスメイト孕ませ催眠 in 9/26/2014
} type_ ; // static
/**
* Sample game : 聖 娼 女 体 験 版
*
* IDA : sub_4DAC70 proc near ; Attributes : bp - based frame
*
* Observations :
* - return : number of bytes = 2 * number of size
* - arg1 : unknown pointer , remains the same
* - arg2 : unknown , remains the same
* - this ( ecx )
* - union
* - char x 3 : if size < ( 3 * 2 - 1 ) & &
* - pointer x 4
* - 0x0 : UTF - 16 text
* - 0x4 : the same as 0x0
* - 0x8 : unknown variate pointer
* - 0xc : wchar_t pointer to a flag , the pointed value is zero when union is used as a char
* - 0x10 : size of the text without null char
* - 0x14 : unknown size , always slightly larger than size
* - 0x18 : constant pointer
* . . .
*
* Sample stack :
* 0025 edf0 a8 f3 13 0 a a8 f3 13 0 a ィ ・ . ィ ・ . ; jichi : ecx = 0025 edf0
* LPCWSTR LPCWSTR
* 0025 edf8 10 ee 25 00 d0 ee 37 01 ・ . ミ ・
* LPCWSTR LPCWSTR
* 0025 ee00 13 00 00 00 17 00 00 00 . . . …
* SIZE_T SIZE_T
*
* 0025 ee08 18 0 c f6 09 27 00 00 00 . ・ ' . . . ; jichi : following three lines are constants
* 0025 ee10 01 00 00 00 01 00 00 00 . . . . . .
* 0025 ee18 d2 d9 5 d 9f 1 c a2 e7 09 メ ル ] ・ 「 ・
*
* 0025 ee20 40 8 c 10 07 00 00 00 00 @ ・ . . . .
* 0025 ee28 00 00 00 00 00 00 00 00 . . . . . . . .
* 0025 ee30 b8 ee ce 0 c b8 ee ce 0 c ク 﨩 . ク 﨩 .
* 0025 ee38 b8 ee ce 0 c 00 00 00 00 ク 﨩 . . . . .
* 0025 ee40 00 00 00 00 01 00 00 00 . . . . . . .
* 0025 ee48 00 00 00 00 00 00 00 00 . . . . . . . .
* 0025 ee50 00 00 00 00 00 00 00 00 . . . . . . . .
* 0025 ee58 00 00 00 00 00 00 00 00 . . . . . . . .
*
* 0025 ee60 01 00 00 00 01 00 00 00 . . . . . .
*/
ULONG search ( ULONG startAddress , ULONG stopAddress , Type * type )
{
ULONG addr ;
{
const uint8_t bytes1 [ ] = {
0x3b , 0xd7 , // 013baf32 |. 3bd7 |cmp edx,edi ; jichi: ITH hook here, char saved in edi
0x75 , 0x4b // 013baf34 |. 75 4b |jnz short siglusen.013baf81
} ;
addr = MemDbg : : findBytes ( bytes1 , sizeof ( bytes1 ) , startAddress , stopAddress ) ;
if ( addr & & type )
* type = Type1 ;
}
if ( ! addr ) {
const uint8_t bytes2 [ ] = { // 81fe0c300000
0x81 , 0xfe , 0x0c , 0x30 , 0x00 , 0x00 // 0114124a 81fe 0c300000 cmp esi,0x300c ; jichi: hook here
} ;
addr = MemDbg : : findBytes ( bytes2 , sizeof ( bytes2 ) , startAddress , stopAddress ) ;
if ( addr & & type )
* type = Type2 ;
}
if ( ! addr )
return 0 ;
const uint8_t bytes [ ] = {
0x55 , // 013bac70 /$ 55 push ebp ; jichi: function starts
0x8b , 0xec , // 013bac71 |. 8bec mov ebp,esp
0x6a , 0xff // 013bac73 |. 6a ff push -0x1
} ;
//enum { range = 0x300 }; // 0x013baf32 - 0x013bac70 = 706 = 0x2c2
//enum { range = 0x400 }; // 0x013baf32 - 0x013bac70 = 0x36a
enum { range = 0x500 } ; // 0x00b6bcf8 - 0x00b6b880 = 0x478
return MemDbg : : findBytes ( bytes , sizeof ( bytes ) , addr - range , addr ) ;
//if (!reladdr)
// //ConsoleOutput("Siglus2: pattern not found");
// return 0;
//addr += reladdr;
//return addr;
}
bool text_fun ( hook_stack * s , void * data , size_t * len , uintptr_t * role ) {
auto arg = ( TextUnionW * ) ( type_ = = Type1 ? s - > ecx : s - > stack [ 1 ] ) ;
if ( ! arg | | ! arg - > isValid ( ) )
return false ;
2024-03-21 17:57:04 +08:00
write_string_overwrite ( data , len , std : : wstring ( arg - > getText ( ) , arg - > size ) ) ;
2024-02-07 20:59:24 +08:00
return true ;
}
void hookafter ( hook_stack * s , void * data , size_t len ) {
auto arg = ( TextUnionW * ) ( type_ = = Type1 ? s - > ecx : s - > stack [ 1 ] ) ;
auto argValue = * arg ;
std : : wstring newText = std : : wstring ( ( wchar_t * ) data , len / 2 ) ;
arg - > setLongText ( newText ) ;
// Restoring is indispensible, and as a result, the default hook does not work
//*arg = argValue;
}
}
bool attach ( ULONG startAddress , ULONG stopAddress ) // attach scenario
{
ULONG addr = Private : : search ( startAddress , stopAddress , & Private : : type_ ) ;
ConsoleOutput ( " %p " , addr ) ;
if ( ! addr )
return false ;
//return Private::oldHookFun = (Private::hook_fun_t)winhook::replace_fun(addr, (ULONG)Private::newHookFun);
HookParam hp ;
hp . address = addr ;
hp . type = EMBED_ABLE | CODEC_UTF16 ; // 0x41
hp . hook_before = Private : : text_fun ;
hp . hook_after = Private : : hookafter ;
hp . hook_font = F_GetGlyphOutlineW ;
return NewHook ( hp , " EmbedSiglus " ) ;
}
}
}
namespace OtherHook {
namespace Private {
TextUnionW * arg_ ,
argValue_ ;
bool hookBefore ( hook_stack * s , void * data , size_t * len , uintptr_t * role )
{
static std : : wstring text_ ;
auto arg = ( TextUnionW * ) s - > stack [ 0 ] ;
if ( ! arg | | ! arg - > isValid ( ) )
return false ;
LPCWSTR text = arg - > getText ( ) ;
// Skip all ascii
if ( ! text | | ! * text | | * text < = 127 | | arg - > size > 1500 ) // there could be garbage
return false ;
* role = Engine : : OtherRole ;
ULONG split = s - > stack [ 3 ] ;
if ( split < = 0xffff | | ! Engine : : isAddressReadable ( split ) ) { // skip modifying scenario thread
//role = Engine::ScenarioRole;
return true ;
} else {
split = * ( DWORD * ) split ;
switch ( split ) {
case 0x54 :
case 0x26 :
* role = Engine : : NameRole ;
}
}
//auto sig = Engine::hashThreadSignature(role, split);
std : : wstring oldText = std : : wstring ( text , arg - > size ) ; //,
2024-03-21 17:57:04 +08:00
write_string_overwrite ( data , len , oldText ) ;
2024-02-07 20:59:24 +08:00
return true ;
// newText = EngineController::instance()->dispatchTextWSTD(oldText, role, sig);
}
void hookafter2 ( hook_stack * s , void * data , size_t len ) {
auto arg = ( TextUnionW * ) s - > stack [ 0 ] ;
arg_ = arg ;
argValue_ = * arg ;
static std : : wstring text_ ;
auto newText = std : : wstring ( ( LPWSTR ) data , len / 2 ) ;
text_ = newText ;
arg - > setLongText ( text_ ) ;
}
ULONG search ( ULONG startAddress , ULONG stopAddress )
{
const uint8_t bytes [ ] = {
0xc7 , 0x47 , 0x14 , 0x07 , 0x00 , 0x00 , 0x00 , // 0042cf20 c747 14 07000000 mov dword ptr ds:[edi+0x14],0x7
0xc7 , 0x47 , 0x10 , 0x00 , 0x00 , 0x00 , 0x00 , // 0042cf27 c747 10 00000000 mov dword ptr ds:[edi+0x10],0x0
0x66 , 0x89 , 0x0f , // 0042cf2e 66:890f mov word ptr ds:[edi],cx
0x8b , 0xcf , // 0042cf31 8bcf mov ecx,edi
0x50 , // 0042cf33 50 push eax
0xe8 //XX4 // 0042cf34 e8 e725f6ff call .0038f520 ; jichi: hook here
} ;
enum { addr_offset = sizeof ( bytes ) - 1 } ; // +4 for the call address
ULONG addr = MemDbg : : findBytes ( bytes , sizeof ( bytes ) , startAddress , stopAddress ) ;
if ( ! addr )
return 0 ;
return addr + addr_offset ;
}
} // namespace Private
bool attach ( ULONG startAddress , ULONG stopAddress )
{
ULONG addr = Private : : search ( startAddress , stopAddress ) ;
if ( addr = = 0 ) return false ;
HookParam hp ;
hp . address = addr ;
hp . type = EMBED_ABLE | CODEC_UTF16 ; // 0x41
hp . hook_before = Private : : hookBefore ;
hp . hook_after = Private : : hookafter2 ;
hp . hook_font = F_GetGlyphOutlineW ;
return NewHook ( hp , " EmbedSiglus " ) ;
}
} // namespace OtherHook
bool Siglus : : attach_function ( ) {
bool b3 = ScenarioHook : : attach ( processStartAddress , processStopAddress ) ;
if ( b3 ) OtherHook : : attach ( processStartAddress , processStopAddress ) ;
bool b1 = InsertSiglusHook ( ) ;
bool b2 = InsertSiglusHookZ ( ) ;
return b1 | | b2 | | b3 ;
}