Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


some problem to hook a __usercall function

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
marco0999
Cheater
Reputation: 0

Joined: 28 Jun 2020
Posts: 29
Location: Italy

PostPosted: Mon Nov 23, 2020 12:41 pm    Post subject: some problem to hook a __usercall function Reply with quote

Hi,

I have some problem with a __usercall function:

IDA pseudocode:

Code:
int __usercall sub_4F3CE4@<eax>(char *Src@<ecx>, int a2@<edx>, int a3, int a4, int a5)


Asm code:

Code:
.text:004F3B65 ; =============== S U B R O U T I N E =======================================
.text:004F3B65
.text:004F3B65 ; Attributes: bp-based frame
.text:004F3B65
.text:004F3B65 ; int __usercall sub_4F3B65@<eax>(char *Src@<ecx>, int, int, int, int)
.text:004F3B65 sub_4F3B65      proc near               ; CODE XREF: StartAudio3D(char const * const,int,DLLAudioCategory,bool,bool)+A3↑p
.text:004F3B65                                         ; StartSoundEffect(char const *,int)+6F↑p ...
.text:004F3B65
.text:004F3B65 var_14          = dword ptr -14h
.text:004F3B65 var_10          = dword ptr -10h
.text:004F3B65 var_C           = dword ptr -0Ch
.text:004F3B65 var_8           = dword ptr -8
.text:004F3B65 var_4           = dword ptr -4
.text:004F3B65 arg_0           = dword ptr  8
.text:004F3B65 arg_4           = dword ptr  0Ch
.text:004F3B65 arg_8           = dword ptr  10h
.text:004F3B65 arg_C           = dword ptr  14h
.text:004F3B65
.text:004F3B65                 push    ebp
.text:004F3B66                 mov     ebp, esp
.text:004F3B68                 sub     esp, 14h
.text:004F3B6B                 push    ebx
.text:004F3B6C                 push    esi
.text:004F3B6D                 mov     esi, [ebp+arg_4]
.text:004F3B70                 mov     eax, edx
.text:004F3B72                 mov     edx, dword_897628
.text:004F3B78                 mov     [ebp+var_8], eax
.text:004F3B7B                 push    edi
.text:004F3B7C                 mov     edi, ecx
.text:004F3B7E                 mov     ecx, [ebp+arg_0]
.text:004F3B81                 mov     [ebp+var_4], ecx
.text:004F3B84                 mov     ecx, [ebp+arg_8]
.text:004F3B87                 mov     [ebp+var_10], ecx
.text:004F3B8A                 test    edx, edx
.text:004F3B8C                 jz      short loc_4F3BB5
.text:004F3B8E                 test    edi, edi
.text:004F3B90                 jz      short loc_4F3BB5
.text:004F3B92                 cmp     byte ptr [edi], 0
.text:004F3B95                 jz      short loc_4F3BB5
.text:004F3B97                 xor     ebx, ebx
.text:004F3B99                 mov     ecx, ebx
.text:004F3B9B                 test    esi, esi
.text:004F3B9D                 jz      short loc_4F3BBC
.text:004F3B9F                 test    byte ptr [esi+58h], 4
.text:004F3BA3                 mov     ecx, [esi+5Ch]
.text:004F3BA6                 jnz     short loc_4F3BAD
.text:004F3BA8                 cmp     ecx, 2
.text:004F3BAB                 jnz     short loc_4F3BBC
.text:004F3BAD
.text:004F3BAD loc_4F3BAD:                             ; CODE XREF: sub_4F3B65+41↑j
.text:004F3BAD                 cmp     dword_86A730, ebx
.text:004F3BB3                 jz      short loc_4F3BCC
.text:004F3BB5
.text:004F3BB5 loc_4F3BB5:                             ; CODE XREF: sub_4F3B65+27↑j
.text:004F3BB5                                         ; sub_4F3B65+2B↑j ...
.text:004F3BB5                 xor     eax, eax
.text:004F3BB7
.text:004F3BB7 loc_4F3BB7:                             ; CODE XREF: sub_4F3B65+17A↓j
.text:004F3BB7                 pop     edi
.text:004F3BB8                 pop     esi
.text:004F3BB9                 pop     ebx
.text:004F3BBA                 leave
.text:004F3BBB                 retn
.text:004F3BBC ; ---------------------------------------------------------------------------
.text:004F3BBC
.text:004F3BBC loc_4F3BBC:                             ; CODE XREF: sub_4F3B65+38↑j
.text:004F3BBC                                         ; sub_4F3B65+46↑j
.text:004F3BBC                 mov     eax, dword_86A730
.text:004F3BC1                 cmp     eax, dword_86A744
.text:004F3BC7                 jnz     short loc_4F3BB5
.text:004F3BC9                 mov     eax, [ebp+var_8]
.text:004F3BCC
.text:004F3BCC loc_4F3BCC:                             ; CODE XREF: sub_4F3B65+4E↑j
.text:004F3BCC                 movss   xmm1, dword ptr [edx+8]
.text:004F3BD1                 movss   [ebp+var_C], xmm1
.text:004F3BD6                 test    esi, esi
.text:004F3BD8                 jz      short loc_4F3C1C
.text:004F3BDA                 cmp     ecx, 1
.text:004F3BDD                 jz      short loc_4F3BFA
.text:004F3BDF                 cmp     ecx, 2
.text:004F3BE2                 jz      short loc_4F3BFA
.text:004F3BE4                 test    byte ptr [esi+58h], 4
.text:004F3BE8                 jnz     short loc_4F3BFA
.text:004F3BEA                 test    dword ptr [esi+58h], 40000h
.text:004F3BF1                 jz      short loc_4F3C08
.text:004F3BF3                 movss   xmm1, dword ptr [edx+10h]
.text:004F3BF8                 jmp     short loc_4F3C03
.text:004F3BFA ; ---------------------------------------------------------------------------
.text:004F3BFA
.text:004F3BFA loc_4F3BFA:                             ; CODE XREF: sub_4F3B65+78↑j
.text:004F3BFA                                         ; sub_4F3B65+7D↑j ...
.text:004F3BFA                 or      dword ptr [esi+58h], 4
.text:004F3BFE                 movss   xmm1, dword ptr [edx+0Ch]
.text:004F3C03
.text:004F3C03 loc_4F3C03:                             ; CODE XREF: sub_4F3B65+93↑j
.text:004F3C03                 movss   [ebp+var_C], xmm1
.text:004F3C08
.text:004F3C08 loc_4F3C08:                             ; CODE XREF: sub_4F3B65+8C↑j
.text:004F3C08                 cmp     eax, 584B1E4Ah
.text:004F3C0D                 jz      short loc_4F3C1C
.text:004F3C0F                 movss   xmm0, ds:dword_82A2D8
.text:004F3C17                 comiss  xmm0, xmm1
.text:004F3C1A                 ja      short loc_4F3BB5
.text:004F3C1C
.text:004F3C1C loc_4F3C1C:                             ; CODE XREF: sub_4F3B65+73↑j
.text:004F3C1C                                         ; sub_4F3B65+A8↑j
.text:004F3C1C                 push    [ebp+var_10]
.text:004F3C1F                 mov     edx, [ebp+var_4]
.text:004F3C22                 mov     ecx, eax
.text:004F3C24                 push    esi
.text:004F3C25                 call    sub_4F34F8
.text:004F3C2A                 pop     ecx
.text:004F3C2B                 pop     ecx
.text:004F3C2C                 mov     ecx, eax
.text:004F3C2E                 mov     [ebp+var_14], eax
.text:004F3C31                 call    sub_4F349C
.text:004F3C36                 test    al, al
.text:004F3C38                 jz      loc_4F3BB5
.text:004F3C3E                 push    [ebp+arg_C]
.text:004F3C41                 mov     edx, [ebp+var_4]
.text:004F3C44                 mov     ecx, [ebp+var_8]
.text:004F3C47                 call    sub_4F1E5F
.text:004F3C4C                 pop     ecx
.text:004F3C4D                 test    al, al
.text:004F3C4F                 jnz     loc_4F3BB5
.text:004F3C55                 mov     edx, [ebp+var_8]
.text:004F3C58                 mov     ecx, edi        ; Src
.text:004F3C5A                 push    esi             ; int
.text:004F3C5B                 push    [ebp+var_4]     ; int
.text:004F3C5E                 call    sub_4F1BBB
.text:004F3C63                 mov     esi, eax
.text:004F3C65                 pop     ecx
.text:004F3C66                 pop     ecx
.text:004F3C67                 test    esi, esi
.text:004F3C69                 jz      loc_4F3BB5
.text:004F3C6F                 cmp     dword_897628, ebx
.text:004F3C75                 jz      short loc_4F3C83
.text:004F3C77                 mov     edx, [ebp+var_10]
.text:004F3C7A                 mov     ecx, esi
.text:004F3C7C                 call    sub_4F11D7
.text:004F3C81                 mov     bl, al
.text:004F3C83
.text:004F3C83 loc_4F3C83:                             ; CODE XREF: sub_4F3B65+110↑j
.text:004F3C83                 test    bl, bl
.text:004F3C85                 jnz     short loc_4F3C93
.text:004F3C87                 mov     ecx, esi
.text:004F3C89                 call    sub_4F3A95
.text:004F3C8E                 jmp     loc_4F3BB5
.text:004F3C93 ; ---------------------------------------------------------------------------
.text:004F3C93
.text:004F3C93 loc_4F3C93:                             ; CODE XREF: sub_4F3B65+120↑j
.text:004F3C93                 mov     eax, [ebp+var_14]
.text:004F3C96                 push    offset sub_4F37D5 ; PtFuncCompare
.text:004F3C9B                 push    4               ; SizeOfElements
.text:004F3C9D                 push    dword_897634    ; NumOfElements
.text:004F3CA3                 mov     [esi+14h], eax
.text:004F3CA6                 push    offset dword_897650 ; Base
.text:004F3CAB                 call    ds:qsort
.text:004F3CB1                 movss   xmm0, [ebp+var_C]
.text:004F3CB6                 add     esp, 10h
.text:004F3CB9                 maxss   xmm0, ds:dword_82A218
.text:004F3CC1                 or      dword ptr [esi+7Ch], 40h
.text:004F3CC5                 minss   xmm0, ds:dword_82A46C
.text:004F3CCD                 movss   dword ptr [esi+94h], xmm0
.text:004F3CD5                 movss   dword ptr [esi+90h], xmm0
.text:004F3CDD                 mov     eax, [esi]
.text:004F3CDF                 jmp     loc_4F3BB7
.text:004F3CDF sub_4F3B65      endp

.

here some href of this function:

Code:
-------------------------------------------------------------------------------------------

sub_4EE3E5

.text:004EE400                 xor     eax, eax
.text:004EE402                 push    eax             ; int
.text:004EE403                 push    eax             ; int
.text:004EE404                 push    eax             ; int
.text:004EE405                 push    eax             ; int
.text:004EE406                 call    sub_4F3B65               <------------------------------------------------------------
.text:004EE40B                 add     esp, 10h
.text:004EE40E                 retn


---------------------------------------------------------------------------------------------------------------------------------------------

sub_4EE4D0

.text:004EE4FA                 test    eax, eax
.text:004EE4FC                 jz      short loc_4EE50F
.text:004EE4FE
.text:004EE4FE loc_4EE4FE:                             ; CODE XREF: sub_4EE4D0+23↑j
.text:004EE4FE                 push    0               ; int
.text:004EE500                 push    0               ; int
.text:004EE502                 push    0               ; int
.text:004EE504                 push    eax             ; int
.text:004EE505                 call    sub_4F3B65               <------------------------------------------------------------
.text:004EE50A                 add     esp, 10h
.text:004EE50D                 pop     ebp
.text:004EE50E                 retn






and this is my code:


Code:
char *mySrc;
int pedx;
int par6;
int par5;
int par4;
int par3;

void __cdecl testdebug()
{
    __asm pushad

    std::string FileName;
    FileName = SC::To_String(mySrc);

     LF::Log_Update("Hooking sound file:" + FileName + " a6=" + SC::To_String(par6) + " a5=" + SC::To_String(par5) + " 4=" + SC::To_String(par4) + " a3=" + SC::To_String(par3));

      __asm popad
}


// AddressOfHookSoundFunction = 0x4EE4D0;

__declspec(naked) int HookSoundFileSub(char  *Src, int pedx, int a3, int a4, int a5, int a6)
{

    par6 = a6;
    par5 = a5;
    par4 = a4;
    par3 = a3;

    //__asm
    //{
    //   mov mySrc, ecx
    //   jmp testdebug
    //}

    //////

        __asm
        {

            push    a6
            push    a5
            push    a4
            push    a3
       
            call    AddressOfHookSoundFunction
            add     esp, 10h
            retn
        }


}

// DetourAttach(&(LPVOID&)AddressOfHookSoundFunction, &HookSoundFileSub);



here the log:


Code:
23/11/2020 15:13:32.109  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.114  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.118  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.123  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.146  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.152  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.156  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.160  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.170  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.175  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.180  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.184  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.197  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.201  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.206  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.211  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.221  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.226  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.231  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.235  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.248  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.252  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.257  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.261  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.272  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.276  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.281  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.286  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.297  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.302  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.306  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.311  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.321  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.327  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.331  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.336  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.347  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.352  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.356  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.361  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.372  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.376  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.381  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.386  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.398  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.403  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.407  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.412  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.422  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.426  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.431  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.436  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.448  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.452  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.457  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.462  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.472  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.477  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.482  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.486  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.497  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.502  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.506  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.511  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.523  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.528  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.533  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.538  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.548  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.553  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.558  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.563  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.573  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.579  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.583  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.588  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.600  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.605  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.609  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.614  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.625  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.630  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.635  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.641  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.652  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.657  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.661  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.666  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.677  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.681  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.686  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.691  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.702  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.707  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.712  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.717  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.729  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.734  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.739  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.743  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.754  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.759  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.764  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.768  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.781  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.786  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.791  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.795  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.806  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.811  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.816  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.821  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.833  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.838  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.843  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.848  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.858  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.863  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.868  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.873  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.885  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.890  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.894  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.899  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.910  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.915  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.920  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.925  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.937  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.942  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.946  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.951  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.962  Hooking sound file:(ecx):ieng01b.wav a6=193782984 a5=13923853 4=193782960 a3=194887024
23/11/2020 15:13:32.967  Hooking sound file:(ecx):itank01e.wav a6=193782852 a5=14095041 4=193782932 a3=662601840
23/11/2020 15:13:32.971  Hooking sound file:(ecx):ssent01j.wav a6=193782852 a5=13341425 4=193782820 a3=193782852
23/11/2020 15:13:32.977  Hooking sound file:(ecx):avrckte0.wav a6=193782852 a5=14095041 4=193782932 a3=673021504
23/11/2020 15:13:32.988  Hooking sound file:(ecx):blip01.wav a6=13035275 a5=193783032 4=1028443341 a3=76 <----------------- crash -----------------------



The problems with my code are two:

The function crash due overflow of the parameter a4/a5 as showed in the log. If I put a control like this:

Code:
cmp a4, 200000000
jl Less

push 0
push 0
push 0
push 0

jmp Both

Less :
push a6
push a5
push a4
push a3

Both :


The function not crash but the final result is not like the original function.

If I enable the debug with "jmp testdebug" the function HookSoundFileSub is called but don't do nothing. I need in some way the parameter ecx because contain the file name that is the only reason why I need to hook this function.
Can you please help me to bypass these problems ?

Thanks !
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites