ReadProcessMemory From Lineage II

12/27/2006 01:51 xsocom#1
Hello, This is my second thread, and I hope someone can have some benefit from it.

[ 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&#40; char *pName &#41; 
{
        int pCount=0;

        PROCESSENTRY32 pEntry = { 0 };

        pEntry.dwSize = sizeof&#40;PROCESSENTRY32&#41;;

        HANDLE pSnapShot = CreateToolhelp32Snapshot&#40; TH32CS_SNAPPROCESS, 0 &#41;; //Create an 32SnapShot.

        if&#40;Process32First&#40; pSnapShot, &pEntry &#41;&#41;
        {
                while&#40; Process32Next&#40; pSnapShot, &pEntry &#41; && pCount &#60; MAX_PROCESS-1 &#41; //Loop through all processes.
                {
                        HANDLE hProcess = OpenProcess&#40; PROCESS_ALL_ACCESS,FALSE, pEntry.th32ProcessID &#41;; //Open the current Process.

                        if&#40;!strcmpi&#40; pEntry.szExeFile, PROCESS_NAME &#41; &#41; //Check if the current process is the PROCESS_NAME &#40; &#34;l2.exe &#34; &#41;
                        {
                                pLineageProcess = hProcess; //Lineage II Process found! Copy it to your pLineageProcess.

                                pCount++; //useless just count the number of processes.
                        } 
                }
        }

        CloseHandle&#40; pSnapShot &#41;; //Close the SnapShot.
	
        return pCount; 
}
And thats it!

Now you can use it like this.

Code:
int main&#40;&#41;
{
    int pCount = GetProcess&#40; PROCESS_NAME &#41;;
 
    int pHealth=0;

    DWORD address = Address for health;

    ReadProcessMemory&#40; pLineageProcess, &#40;LPVOID&#41;offset, &pHealth, sizeof&#40; pHealth &#41;, NULL&#41;;

    char pString&#91; 32 &#93;;

    sprintf&#40; pString, &#34;Health&#58; %i&#092;n&#34;, pHealth &#41;;

    printf&#40; pString &#41;;
}

Well I hope anyone understood what I wrote, Im not that good at english :)

Good luck and cheers!
12/27/2006 11:12 dioladrone#2
thanks for the code ;)


Anyway we need to know some addresses too :P
12/27/2006 15:37 xsocom#3
I will post some pointers and offsets when I get some time.
02/08/2007 23:18 askimos#4
Great Post. Tank you very much :cool:
03/03/2007 04:52 Jadinho#5
Tutorial please ^^
04/24/2010 13:34 NOR3CA#6
provide lineage 2final offsets and codes to freeze thanks you
04/25/2010 00:25 MrBigg#7
Hey, I am building my own bot, I also have experience on memory reading from WoW, but, I cant seem to find any pointers and offsets that "stick", they work sometimes but not always.
04/27/2010 03:04 FoxFire#8
Ah, reminds me when I made a sniffer for L2Walker that uploaded their HP, MP and Exp to a website so I could watch my bots from work. And it graphed their exp gain.
03/03/2011 21:57 wongerlt#9
hi.
How i can find monster hp bar offset ? :D
i need real hp or hp in %.