Code:
/* Preprocessor directives : */
#include <stdio.h>
#include <stdlib.h>
#define WIN32_LEAN_AND_MEAN /* Trims all the lard from windows */
#include <windows.h>
#include <tlhelp32.h>
#include <tchar.h>
/* -------------------------------------------------------------------------------------------------- */
/* Contants : */
/* check if a Win32 API virtual-key is pressed */
#define VKEY_IS_PRESSED(vk) ( GetAsyncKeyState(vk) & 0x8000 )
/* Win32 API virtual-keys to be handled:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx
*/
enum VKey {
VKEY_EXIT = VK_ESCAPE,
VKEY_PG_UP = VK_PRIOR,
VKEY_PG_DN = VK_NEXT
};
/* -------------------------------------------------------------------------------------------------- */
/* Struct for use in this small debugger */
typedef struct MEMORY_ADDRESSES
{
void * Address1;
void * Address2;
void * Address3;
void * Address4;
void * Address5;
void * Address6;
void * Address7;
void * Address8;
void * Address9;
void * Address10;
} ProcessMem;
ProcessMem MyProcess[1] = {};
/* -------------------------------------------------------------------------------------------------- */
/* Function Prototypes : */
HANDLE GetRobloxProcess( );
static void DebuggerInit( HANDLE Roblox, ProcessMem * WriteToStruct, ProcessMem ReadStructInfo );
static void PearnetLogo( );
static void cls( HANDLE hConsole );
/* -------------------------------------------------------------------------------------------------- */
/* Main entry point */
int main( )
{
/* -------------------------------*/
/* Displays my logo on the screen */
PearnetLogo();
/* -------------------------------*/
/* Finds the roblox game */
HANDLE Roblox;
do
{
if ( ( Roblox = GetRobloxProcess() ) != NULL ) { break; }
Sleep(1000);
} while (1);
/* -------------------------------*/
/* Initializes the information we need in our struct */
DebuggerInit( Roblox, &MyProcess[0], MyProcess[0] );
/* -------------------------------*/
/* Close the process handle to avoid nasty memory leaks */
CloseHandle( Roblox );
/* -------------------------------*/
/* Exit the proccess with 0, as required by the function declaration */
return 0;
}
/* -------------------------------------------------------------------------------------------------- */
HANDLE GetRobloxProcess( )
{
HANDLE hProcessSnap;
HANDLE hProcess;
HANDLE DummyHandle = NULL;
PROCESSENTRY32 pe32;
/* Take a snapshot of all processes in the system. */
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
if( hProcessSnap == INVALID_HANDLE_VALUE )
{
return DummyHandle;
}
/* Set the size of the structure before using it. */
pe32.dwSize = sizeof( PROCESSENTRY32 );
if( !Process32First( hProcessSnap, &pe32 ) )
{
CloseHandle( hProcessSnap );
exit(EXIT_FAILURE);
}
/* Walk through the snapshot, and return roblox when
found. */
do
{
if (strcmp(pe32.szExeFile, "RobloxPlayer.exe") == 0)
{
CloseHandle( hProcessSnap );
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID );
return hProcess;
}
} while( Process32Next( hProcessSnap, &pe32 ) );
CloseHandle( hProcessSnap );
return DummyHandle;
}
/* -------------------------------------------------------------------------------------------------- */
static void DebuggerInit( HANDLE Roblox, ProcessMem * WriteToStruct, ProcessMem ReadStructInfo )
{
/* -------------------------------*/
/* Get roblox's base address */
void * BaseAddress = ( void * ) Roblox;
/* -------------------------------*/
/* Stores 10 bytes from Roblox's process in tempStorage */
BYTE tempStorage[10];
if ( !ReadProcessMemory( Roblox, BaseAddress, tempStorage, 10, NULL ) )
{
fprintf( stderr, _strerror(NULL) );
exit(EXIT_FAILURE);
}
/* -------------------------------*/
/* Fills the structure with the starting addresses */
WriteToStruct->Address1 = BaseAddress + 0; /* 1 */
WriteToStruct->Address2 = BaseAddress + (sizeof(BYTE)); /* 2 */
WriteToStruct->Address3 = BaseAddress + (sizeof(BYTE) * 2); /* 3 */
WriteToStruct->Address4 = BaseAddress + (sizeof(BYTE) * 3); /* 4 */
WriteToStruct->Address5 = BaseAddress + (sizeof(BYTE) * 4); /* 5 */
WriteToStruct->Address6 = BaseAddress + (sizeof(BYTE) * 5); /* 6 */
WriteToStruct->Address7 = BaseAddress + (sizeof(BYTE) * 6); /* 7 */
WriteToStruct->Address8 = BaseAddress + (sizeof(BYTE) * 7); /* 8 */
WriteToStruct->Address9 = BaseAddress + (sizeof(BYTE) * 8); /* 9 */
WriteToStruct->Address10 = BaseAddress + (sizeof(BYTE) * 9); /* 10 */
/* -------------------------------*/
/* Print out the starting information, then return to main */
fprintf(stdout, "\t %p = %2X \n", &ReadStructInfo.Address1 , tempStorage[0] );
fprintf(stdout, "\t %p = %2X \n", &ReadStructInfo.Address2 , tempStorage[0 + 1] );
fprintf(stdout, "\t %p = %2X \n", &ReadStructInfo.Address3 , tempStorage[0 + 2] );
fprintf(stdout, "\t %p = %2X \n", &ReadStructInfo.Address4 , tempStorage[0 + 3] );
fprintf(stdout, "\t %p = %2X \n", &ReadStructInfo.Address5 , tempStorage[0 + 4] );
fprintf(stdout, "\t %p = %2X \n", &ReadStructInfo.Address6 , tempStorage[0 + 5] );
fprintf(stdout, "\t %p = %2X \n", &ReadStructInfo.Address7 , tempStorage[0 + 6] );
fprintf(stdout, "\t %p = %2X \n", &ReadStructInfo.Address8 , tempStorage[0 + 7] );
fprintf(stdout, "\t %p = %2X \n", &ReadStructInfo.Address9 , tempStorage[0 + 8] );
fprintf(stdout, "\t %p = %2X \n", &ReadStructInfo.Address10 , tempStorage[0 + 9] );
return;
}
/* -------------------------------------------------------------------------------------------------- */
static void PearnetLogo( )
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
/*
* First save the current color information
*/
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
/*
* Set the new color information
*/
SetConsoleTextAttribute ( h, FOREGROUND_GREEN );
putchar('\n');
puts(" /");
puts(" ±±");
puts(" ±±±±");
puts(" ±±±±±±");
puts(" ±±±±±±±±");
puts(" ±±±±±±±±±±");
puts(" ±±±±±±±±±±±±");
puts(" ±±±±±±±±±±±±");
puts(" ±±±±±±±±±±");
putchar('\n');
putchar('\n');
puts(" ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛ Û ÛÛÛÛÛÛÛÛ ÛÛÛ Û ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛ");
puts(" Û Û Û Û Û Û Û Û Û Û Û Û");
puts(" Û Û Û Û Û Û Û Û Û Û Û Û");
puts(" ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛ Û Û Û ÛÛÛÛÛÛÛÛ Û");
puts(" Û Û Û Û Û Û Û Û Û Û Û");
puts(" Û Û Û Û Û Û Û Û Û Û Û");
puts(" Û ÛÛÛÛÛÛÛ Û Û Û Û Û ÛÛ ÛÛÛÛÛÛÛÛ Û");
putchar('\n');
putchar('\n');
putchar('\n');
puts("\t\t\t [TRAINER FOR ROBLOX]");
Sleep(1000);
HANDLE hStdout;
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
cls(hStdout);
/*
* Restore the original colors
*/
SetConsoleTextAttribute ( h, wOldColorAttrs);
return;
}
/* -------------------------------------------------------------------------------------------------- */
/* Credit for this function goes to Microsoft's website's help section here: */
/* http://msdn.microsoft.com/en-us/library/windows/desktop/ms682022%28v=vs.85%29.aspx */
static void cls( HANDLE hConsole )
{
COORD coordScreen = { 0, 0 }; /* home for the cursor */
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
/* Get the number of character cells in the current buffer. */
if ( !GetConsoleScreenBufferInfo(hConsole, &csbi) )
{
return;
}
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
/* Fill the entire screen with blanks. */
if (
!FillConsoleOutputCharacter(
hConsole, /* Handle to console screen buffer */
(TCHAR) ' ', /* Character to write to the buffer */
dwConSize, /* Number of cells to write */
coordScreen, /* Coordinates of first cell */
&cCharsWritten ) /* Receive number of characters written */
){
return;
}
/* Get the current text attribute. */
if ( !GetConsoleScreenBufferInfo(hConsole, &csbi) )
{
return;
}
/* Set the buffer's attributes accordingly. */
if (
!FillConsoleOutputAttribute(
hConsole, /* Handle to console screen buffer */
csbi.wAttributes, /* Character attributes to use */
dwConSize, /* Number of cells to set attribute */
coordScreen, /* Coordinates of first cell */
&cCharsWritten ) /* Receive number of characters written */
){
return;
}
/* Put the cursor at its home coordinates. */
SetConsoleCursorPosition( hConsole, coordScreen );
}
/* -------------------------------------------------------------------------------------------------- */