Reputation: 13
I'm trying to call a function from another dll, know her exact address and parameters.
In IDA:
int __userpurge sub_104CC1A0<eax>(int a1<ecx>, double a2<st0>, int a3)
I found a similar answer on stackoverflow.com, but I get the error:
struct typechat
{
unsigned int a;
unsigned int b;
unsigned int type;
};
typechat * point;
DWORD callAddress = 0x4CC1A0 + baseaddr;
__declspec(naked) int SendMsg(char * text, double time, typechat * a3)
{
__asm{
push ebp
mov ebp, esp
push ebx
push a3
mov st0, time // error C2415: invalid operand type
mov ecx, text
call[callAddress]
pop ebx
leave
ret
}
}
error C2415: invalid operand type
switch ( *(_DWORD *)(a3 + 8) )//chat type ,[code from IDA]
{
}
UPDATE:
_
//int __userpurge sub_104CC1A0<eax>(int a1<ecx>, double a2<st0>, int a3)
declspec(naked) int SendMsg(char * text, double nTime, typechat * nType)
{
__asm{
push ebp
mov ebp, esp
push nType
fld nTime
push ecx
mov ecx, text
move eax, [callAddress]
call eax
pop ecx
leave
ret
}
}
This function too does not work! : (Not called callAddress)
Upvotes: 1
Views: 1783
Reputation: 598299
AFAIK, you cannot MOV
a value into the ST0
register, you must use FLD
instead, eg:
fld time
Upvotes: 1