You are not logged in.
Pages: 1
1) Свойства конфигурации -> С/С++ -> Создание кода -> Библиотека времени выполнения: Многопоточная (/MT).
Теперь dll не будет требовать MSVCRXX.dll и MSVCPXX.dll
2)После #include добавь:
#pragma comment(linker, "/ENTRY:DllMain")
Свойства конфигурации -> Компоновщик -> Файл манифеста -> Создавать Манифест: Нет (/MANIFEST:NO).
Пара полезных ссылок:
http://www.wasm.ru/forum/viewtopic.php?id=22942
http://forum.antichat.ru/thread270620.html
#include <Windows.h>
#include <CPatch.h>
#define gGameVersion (*(unsigned int *)0x601048)
#define GTA_VC_1_0 0x53FF1B8B
#define GTA_VC_STEAM 0xF04F883
#define GTA_VC_1_1 0x783EE8
int gVersion;
unsigned int gLastTimeKeyPressed;
unsigned int *gTimer;
int gInitPerFrame;
int gFunc;
DWORD *pMoney;
void Thread()
{
switch(gGameVersion)
{
case GTA_VC_1_0:
gVersion = 0;
break;
case GTA_VC_1_1:
gVersion = 1;
break;
case GTA_VC_STEAM:
gVersion = 2;
break;
}
if (gVersion == 0)
{
gTimer = (unsigned int *)0x974B2C;
gInitPerFrame = (int)0x4A5D91;
gFunc = (int)0x5522B0;
pMoney = (DWORD*)0x94ADC8;
}
else if (gVersion == 1)
{
gTimer = (unsigned int *)0x974B34;
gInitPerFrame = (int)0x4A5DB1;
gFunc = (int)0x5522D0;
pMoney = (DWORD*)0x94ADD0;
}
}
void OurFunc();
BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved)
{
if(reason == DLL_PROCESS_ATTACH)
{
Thread();
CPatch::RedirectCall(gInitPerFrame, OurFunc);
// Обнуляем таймер
gLastTimeKeyPressed = 0;
}
return TRUE;
}
void OurFunc()
{
// Проверяем нажатие клавиши "M" и таймер (если прошлa 1 секундa после последнего нажатия клавиши)
if(HIBYTE(GetKeyState(0x4D)) == 0xFF && *gTimer - gLastTimeKeyPressed > 1000)
{
//Добавляем денег игроку
*pMoney += 1000;
// Устанавливаем новое время последнего нажатия клавиши
gLastTimeKeyPressed = *gTimer;
}
// Вызываем стандартную функцию игры (0x5522B0)
((void (__cdecl *)())gFunc)();
}
Работу с ini частично можно реализовать и на старом CLEO.
(версия для GTA 3)
{$CLEO .cs}
const
dll = 0@
LoadLibrary = 4@
FreeLibrary = 5@
GetProcAddress = 6@
GetPrivateProfileInt = 7@
Hour = 8@
Minute = 9@
end
05E0: LoadLibrary = read_memory 0x61D458 size 4 virtual_protect 0
05E0: FreeLibrary = read_memory 0x61D460 size 4 virtual_protect 0
05E0: GetProcAddress = read_memory 0x61D45C size 4 virtual_protect 0
05F5: call_scm_func @getLabelOffset 1 label @KERNEL32 store_to 1@ // DllName
05E2: call_function LoadLibrary num_params 1 pop 0 file_mame 1@ ret_to dll
if
dll <> 0
then
05F5: call_scm_func @getLabelOffset 1 label @GETPRIVATEPROFILEINTA store_to 1@ // ProcName
05E2: call_function GetProcAddress num_params 2 pop 0 proc_mame 1@ h_module dll ret_to GetPrivateProfileInt
if
GetPrivateProfileInt <> 0
then
05F5: call_scm_func @getLabelOffset 1 label @MAIN store_to 1@ // AppName
05F5: call_scm_func @getLabelOffset 1 label @HOUR store_to 2@ // KeyName
05F5: call_scm_func @getLabelOffset 1 label @FILE store_to 3@ // FileName
05E2: call_function GetPrivateProfileInt num_params 4 pop 0 file_mame 3@ n_default 0 key_mame 2@ app_name 1@ ret_to Hour
05F5: call_scm_func @getLabelOffset 1 label @MINUTE store_to 2@ // KeyName
05E2: call_function GetPrivateProfileInt num_params 4 pop 0 file_mame 3@ n_default 0 key_mame 2@ app_name 1@ ret_to Minute
end
05E1: call FreeLibrary num_params 1 pop 1 h_module dll
end
while true
0001: wait 500 ms
00C0: set_current_time Hour Minute
end
05DC: end_custom_thread
:KERNEL32
hex
"kernel32.dll" 00
end
:GETPRIVATEPROFILEINTA
hex
"GetPrivateProfileIntA" 00
end
:MAIN
hex
"MAIN" 00
end
:HOUR
hex
"Hour" 00
end
:MINUTE
hex
"Minute" 00
end
:FILE
hex
".\CLEO\ReadIni.ini" 00
end
:getLabelOffset // Thanks to ThirteenAG
{ Example:
05F5: call_scm_func @getLabelOffset 1 label @lbl store_to 0@
}
if
0@ <> 0
then
05EC: 1@ = current_thread_pointer
1@ += 0x98
05E0: 1@ = read_memory 1@ size 4 virtual_protect 0
000C: 1@ -= 0@
else
1@ = 0
end
05F6: ret 1 1@
Есть miss2 из юбилейной андроидовской vice city, но заставить его что нибудь скомпилировать нелегко...
http://img593.imageshack.us/img593/2365/jzb1.jpg
Pages: 1