Hey Community,
today i decided to Release the whole Source of my Position Logger
Ähm? yh here you go:
Code:
#include <windows.h>
#include <stdio.h>
#include "Log.h"
#define Playerpointer 0xC62388
#define X 0x000102D4
#define Y 0x000102DC
#define Z 0x000102D8
float fX_1;
float fY_1;
float fZ_1;
char cX_1[32];
char cY_1[32];
char cZ_1[32];
VOID LogPosition(VOID)
{
Writelog("//------------------------------------------//");
Writelog("///Position Logger by BlacK_Data///");
Writelog("//------------------------------------------//");
for(;;)
{
DWORD Player = *(DWORD*)Playerpointer;
if(GetAsyncKeyState(VK_NUMPAD0)&1)
{
fX_1 = *(float*)(Player+X);
fY_1 = *(float*)(Player+Y);
fZ_1 = *(float*)(Player+Z);
sprintf_s(cX_1,"X: %f",fX_1);
sprintf_s(cY_1,"Y: %f",fY_1);
sprintf_s(cZ_1,"Z: %f",fZ_1);
Writelog(cX_1);
Writelog(cY_1);
Writelog(cZ_1);
Writelog("");
}
}
}
BOOL __stdcall DllMain( HMODULE hDll , DWORD Reason , LPVOID lpReserved )
{
if(Reason==DLL_PROCESS_ATTACH)
{
logging(hDll);
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)LogPosition, NULL, NULL, NULL);
}
return TRUE;
}
Log.cpp:
Code:
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <stdio.h>
#pragma warning(disable:4996)
using namespace std;
ofstream ofile;
char dlldirectory[320];
char *GetDirectoryFile(char *filename)
{
static char path[320];
strcpy(path, dlldirectory);
strcat(path, filename);
return path;
}
void __cdecl Writelog(const char *fmt, ...)
{
if(ofile != NULL)
{
if(!fmt) { return; }
va_list va_alist;
char logbuf[256] = {0};
va_start (va_alist, fmt);
_vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist);
va_end (va_alist);
ofile << logbuf << endl;
}}
void logging(HMODULE hDll){
DisableThreadLibraryCalls(hDll);
GetModuleFileName(hDll, dlldirectory, 512);
for(int i = strlen(dlldirectory); i > 0; i--) { if(dlldirectory[i] == '\\') { dlldirectory[i+1] = 0; break; } }
ofile.open(GetDirectoryFile("Positions.txt"), ios::app);
}
Log.h:
Code:
char *GetDirectoryFile(char *filename);
void __cdecl Writelog (const char * fmt, ...);
void logging(HMODULE hDll);
Credits:
BlacK_Data
Pheron (log)