[ Read from Lineage II Memory using the ( ReadProcessMemory function ) ]
Why do this? well maybe make an status bar to display health,mana, etc or
maybe you want to write data to the process, But in this article I show how to read.
First of all you need to inculde some files:
#include <Tlhelp32.h> to have access to:
PROCESSENTRY32
CreateToolhelp32Snapshot
Process32First
Process32Next
#incude <windows.h> to have access to:
ReadProcessMemory / WriteProcessMemory
Well lets begin.
#define PROCESS_NAME "L2.exe" //Lineage II Exe.
HANDLE pLineageProcess; //Lineage II Process.
Now you have defined the process name to search for( l2.exe ) and made an handle named ( pLineageProcess ) to hold the Lineage II Process.
Now to the function ( GetProcess( PROCESS_NAME ) to return the process.
Code:
int GetProcess( char *pName )
{
int pCount=0;
PROCESSENTRY32 pEntry = { 0 };
pEntry.dwSize = sizeof(PROCESSENTRY32);
HANDLE pSnapShot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); //Create an 32SnapShot.
if(Process32First( pSnapShot, &pEntry ))
{
while( Process32Next( pSnapShot, &pEntry ) && pCount < MAX_PROCESS-1 ) //Loop through all processes.
{
HANDLE hProcess = OpenProcess( PROCESS_ALL_ACCESS,FALSE, pEntry.th32ProcessID ); //Open the current Process.
if(!strcmpi( pEntry.szExeFile, PROCESS_NAME ) ) //Check if the current process is the PROCESS_NAME ( "l2.exe " )
{
pLineageProcess = hProcess; //Lineage II Process found! Copy it to your pLineageProcess.
pCount++; //useless just count the number of processes.
}
}
}
CloseHandle( pSnapShot ); //Close the SnapShot.
return pCount;
}
Now you can use it like this.
Code:
int main()
{
int pCount = GetProcess( PROCESS_NAME );
int pHealth=0;
DWORD address = Address for health;
ReadProcessMemory( pLineageProcess, (LPVOID)offset, &pHealth, sizeof( pHealth ), NULL);
char pString[ 32 ];
sprintf( pString, "Health: %i\n", pHealth );
printf( pString );
}
Well I hope anyone understood what I wrote, Im not that good at english
Good luck and cheers!






