lundi 27 janvier 2014

[Help] Call a function from samp.dll topic




Hello UC,

currently I try to call a function from the "samp.dll" Library - the Lib is loaded in gta_sa.exe.

IDA shows me the following Address for the function "AddChatMessage":

Code:


.text:03C49990 ; int __cdecl AddChatMessage(int, int, char)

The pseudocode gives me the following function header:

Code:


int __cdecl AddChatMessage(int a1, int a2, char a3)

Here is an asm example how the function gets called:

Code:


.text:03C483EC                mov    ecx, dword_3DE2A24
.text:03C483F2                push    offset unk_3DCC818 ; char
.text:03C483F7                push    offset aAudioStreamS ; "Audio stream: %s"
.text:03C483FC                push    ecx            ; int
.text:03C483FD                call    AddChatMessage
.text:03C48402                add    esp, 0Ch


And here is how I try it:

Code:


typedef int (__cdecl* addchatmessage_t) (int a1, int a2, const char* a3);
addchatmessage_t pAddChatMessage;

DWORD dwSAMP = (DWORD) GetModuleHandleA("samp.dll");
DWORD dwFunc = dwSAMP + 0x79990;
char* message = "Test";

pAddChatMessage(0, 0, message);


But the client is crashing on the functioncall.

Do you see the problem?





Aucun commentaire:

Enregistrer un commentaire