Hello everyone!
I'm new to the scene and i come with a problem:
My first try of writing a HP showing tool, it only returns "0"...
First of all I decided to write a small Bot in Java(I know most peolpe suggest doing it in c#, but i want to try something different^^°)
Well, first i Got my special method where i try to grab the players HP:
Code:
public void run() throws NativeException, IllegalAccessException
{
int playeradress = 0x010BD5F4;
int puffer,buffer,playerbase;
puffer=Get.getData(playeradress);
puffer=puffer+0x34;
puffer=Get.getData(puffer);
puffer = puffer+0x24;
playerbase=Get.getData(puffer);
int base=playerbase+0x8;
base=Get.getData(base);
base=base+0x260*4;
buffer=Get.getData(base);
output.setText(Integer.toString(buffer));
}
Then I Got my special Offset grab method in the class Get:
Code:
public static int getData(int hex) throws NativeException, IllegalAccessException
{
WindowsUtils.setSeDebugPrivilege();
int pid = 4128;
HANDLE processHandle = Kernel32.OpenProcess(Kernel32.PROCESS_QUERY_INFORMATION | Kernel32.PROCESS_ALL_ACCESS, false, pid); // pid: process id
JNative readProcessMemory = new JNative("Kernel32.dll", "ReadProcessMemory");
if (processHandle.equals(null))
System.out.println("NULL");
int b = 128; // buffer size
Pointer p = new Pointer(MemoryBlockFactory.createMemoryBlock(b));
int base=hex;
readProcessMemory.setRetVal(Type.INT);
readProcessMemory.setParameter(0,processHandle.getValue().intValue());
readProcessMemory.setParameter(1,base);
readProcessMemory.setParameter(2,p);
readProcessMemory.setParameter(3, b);
readProcessMemory.invoke();
int val = readProcessMemory.getRetValAsInt();
Kernel32.CloseHandle(processHandle);
return p.getAsInt(val);
}
Well the grab methodic works, so i could grab the players name in 3.0 with this structure...
Even if this is in Java i thinks its kind of similar to c#, so i think you will be able to give me advise how to make this work...
I would appreciate Help and Tipps from you^^°
greets kmJeepers