|
/add
Ok well here is what I put together so far, Hopefully someone with some C++ knowledge can help to perfect it/and or confirm weather it would work correctly or not:
CODE:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windows.h>
#include <iostream>
#include <time.h>
HANDLE iSRO = GetCurrentProcess();
#define FILELOCATION "C:\\SRO_log.txt"
void __cdecl add_log(const char * fmt, ...)
{
#ifndef _NO_ADD
va_list va_alist;
char logbuf[256];
FILE * fp;
struct tm * current_tm;
time_t current_time;
time (¤t_time);
current_tm = localtime (¤t_time);
sprintf (logbuf, "[%02d:%02d:%02d] ", current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec);
va_start (va_alist, fmt);
_vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist);
va_end (va_alist);
if ( (fp = fopen ( FILELOCATION , "a")) != NULL )
{
fprintf ( fp, "%s\n", logbuf );
fclose (fp);
}
#endif _NO_ADD
}
BOOL WINAPI DllMain (HINSTANCE hModule, DWORD dwAttached, LPVOID lpvReserved)
{
if (dwAttached == DLL_PROCESS_ATTACH)
{
add_log("DLL Attatched to SRO Client");
DWORD dwBytesread;
DWORD dwCurHealth;
DWORD dwPlayerBase;
ReadProcessMemory(iSRO, (void*)(0xCEBB4C), &dwPlayerBase, sizeof(dwPlayerBase), &dwBytesread);
ReadProcessMemory(iSRO, (void*)(dwPlayerBase+0x450), &dwCurHealth, sizeof(dwCurHealth), &dwBytesread);
add_log("CurrentHealth = 0x%.8x", (DWORD)dwCurHealth);
}
return 1;
}
Assuming everything is done correctly the variable dwCurHealth should hold the value of the current health of my character? At least that is what I am going for anyways. At this point however I am unsure how to test it as I don't know how to set it up the log the Value of my Variable dwCurHealth. Can anybody help me here and also confirm my addresses by chance. Thanks
|