Вот функция:
Код: Выделить всё
; void __cdecl write_to_console(char *Format, char ArgList)
write_to_console proc near ; CODE XREF: sub_4069C0+34↑p
; sub_4069C0+10A↑p ...
Format = dword ptr 4
ArgList = byte ptr 8
push esi
push 1
call sub_67D4F0
mov ecx, [eax+1000h]
lea edx, [ecx+1]
and edx, 80000003h
jns short loc_57CDEE
dec edx
or edx, 0FFFFFFFCh
inc edx
loc_57CDEE: ; CODE XREF: write_to_console+17↑j
shl ecx, 0Ah
add ecx, eax
mov [eax+1000h], edx
mov esi, ecx
mov ecx, [esp+8+Format]
lea eax, [esp+8+ArgList]
push eax ; ArgList
push ecx ; Format
push 400h ; BufferCount
push esi ; Buffer
call __vsnprintf
xor ecx, ecx
add esp, 14h
cmp eax, ecx
mov [esi+3FFh], cl
jl short loc_57CE26
cmp eax, 400h
jl short loc_57CE3C
loc_57CE26: ; CODE XREF: write_to_console+4D↑j
push esi ; ArgList
push offset byte_9EE7FC ; Format
push 1 ; int
mov [esi+3FFh], cl
call sub_651D90
add esp, 0Ch
loc_57CE3C: ; CODE XREF: write_to_console+54↑j
mov eax, esi
pop esi
retn
write_to_console endp
Вот как оно называется:
Код: Выделить всё
push eax
push 65h ; 'e' ; ArgList
push offset aCS ; "%c \"%s\""
call write_to_console
push eax
sub esi, offset unk_1A796F8
mov eax, 4DA637Dh
теперь внутри моего C++ я попытался вызвать функцию следующим образом:
Код: Выделить всё
typedef void(__cdecl* setup)(const char*, ...);
setup write_to_console= reinterpret_cast(0x0057CDD0);
void MainThread()
{
while (true)
{
if (GetAsyncKeyState('N') & 0x8000)
{
write_to_console("The Function Call worked");
}
Sleep(50);
}
}
Подробнее здесь: https://stackoverflow.com/questions/787 ... om-a-c-dll