Question about C# Writing in Memory

Posts 1–15 of 33 · Page 1 of 3
Question about C# Writing in Memory
Hi,
i hope i´m right in this forum.
Is there a way to change values in Memory like this?
WriteMemory(adress,value);
because the ways, i saw are too complicated.
Can you please give me tipps how i can make that?
I dont want to make thausands of functions, just a programm that sets the ammo to 100.(without loop i´ll make that myself)
Please help me!
your first step it to learn how to spell 'address' correctly.
closer to: WriteMemory(processHandle, address, value);

processHandle = OpenProcess(PROCESS_ALL_ACCESS,false,someProcessID )

should get you started. Or ask a specific question : )
ok but i saw that many people take C++ for hacks.
So my code:
#include <iostream>
#include <Windows.h>
#include <string>
#include <ctime>

void WriteToMemory(HANDLE hProcHandle);
DWORD FindAdd(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress);

bool AmmoStatus = true;
BYTE AmmoValue[] = {0xA3,0x1C,0x0,0x0};
DWORD AmmoBaseAddress = {0x004DF73C};
DWORD AmmoOffsets[] = {0x378, 0x14, 0x0}; //3 LEVEL pointer

bool HealthStatus = true;
BYTE HealthValue[] ={0x39,0x5,0x0,0x0};
DWORD HealthBaseAddress = {0x004DF73C};
DWORD HealthOffsets[] = {0xF4};

HWND hGameWindow = NULL;
DWORD dwProcId = NULL;
HANDLE hProcHandle = NULL;
std::string sAmmoStatus;
std::string sHealthStatus;

int main()
{
hGameWindow = FindWindow( NULL, L"AssaultCube");

if(hGameWindow)
{
GetWindowThreadProcessId( hGameWindow, &dwProcId );
if( dwProcId != 0 )
{
// Get Process Handle
hProcHandle = OpenProcess( PROCESS_ALL_ACCESS, FALSE, dwProcId );
if( hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL )
{
WriteToMemory(hProcHandle);
}
}
else{
std::cout << "AssaultCube not found!" << std::endl;
}
}

DWORD FindAdd(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress){

//DECLARE BASE ADDRESS
DWORD pointer = BaseAddress; // Declare a pointer of DWORD
//USED TO output the contents in the pointer
DWORD pTemp;

DWORD pointerAddr;
for(int i = 0; i < PointerLevel; i ++)
{
if(i == 0)
{
ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &pTemp, 4, NULL);
}
//add first offset to that address
pointerAddr = pTemp + Offsets[i]; // Set p1 to content of p + offset

//Read memory one more time and exit the loop
ReadProcessMemory(hProcHandle, (LPCVOID)pointerAddr, &pTemp, 4, NULL);
}
return pointerAddr;
}

void WriteToMemory(HANDLE hProcHandle)
{
if(AmmoStatus)
{
DWORD AmmoAddressToWrite = FindDmaAddy(3, hProcHandle, AmmoOffsets, AmmoBaseAddress);
WriteProcessMemory( hProcHandle, (BYTE*)AmmoAddressToWrite, &AmmoValue, sizeof(AmmoValue), NULL);
}

if(HealthStatus)
{
//because health address is only one pointer in we send only to FindDmaAddy
DWORD HealthAddressToWrite = FindDmaAddy(1, hProcHandle, HealthOffsets, HealthBaseAddress);
WriteProcessMemory( hProcHandle, (BYTE*)HealthAddressToWrite, &HealthValue, sizeof(HealthValue), NULL);
}
}
so the intellisence means, that behind FindAdd should come a ; but there shouldnt, i know that, because i have the code from fleephacks. I just copied his code.
Someon can find my mistake?
I think I found it: you copied someone else's code. ; )


Read a little, and understand what it's doing. You can't be a programmer without learning how to program. Period.
i know i understand it but why it doesnt work?
I haven't bothered to look : )

edit: and won't *
please i have no one to ask in school or family
Read a book on general programming practices. And don't pick C++ just because you think it's "POWERFUL" .....how powerful is it when you can't even get it to compile?

edit: Didn't go to bed last night, thought I was in C section Either way, you should probably learn the language better.
I can programm and i just want to find my mistake (but thx for your tipps)
your mistake? you copied someone else's code...why are you saying "my" ?


--If you haven't figured it out in 2 days, send me a PM and I'll devote an hour to actually trying to help. Getting offline soon.
You know what i mean. I dont want to dispute with you. Please help me.
Posts 1–15 of 33 · Page 1 of 3

Post a Reply

Similar Threads

Talk with us