Solved How to Write and Read Memory Please Help

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

VDV777

Jr.Coder
Full Member
Nobleman
Mar 31, 2013
87
437
1
There is array of bytes 11 05 AB FF FF FF (for example).
Need:
You must create a cycle. Which will find all the addresses on the array of bytes. And add an offset "+ 20" (once) to the found addresses. And then found addresses with offset "+ 20". Constantly (cycle) equate to the value 0х1452AB address. (For example).
It can be done?

Please Help.

I used this write\read code.
C++:
template<class T> T ReadMemory (DWORD address)
{
	static char buffer [1024];
	HANDLE proc_handle = OpenProcess (PROCESS_ALL_ACCESS , false , pID);
	if (!ReadProcessMemory(proc_handle , (LPCVOID)address , &buffer , sizeof(buffer), NULL))
	CloseHandle (proc_handle);
	return reinterpret_cast<T> (buffer);
}
C++:
template<class T> void WriteMemory (DWORD address , T value)
{
	HANDLE proc_handle = OpenProcess (PROCESS_ALL_ACCESS , false , pID);
	if (!WriteProcessMemory(proc_handle , (LPVOID)address , &value , sizeof(value), NULL))
	CloseHandle (proc_handle);
	
}
Please Help with source code
 

VDV777

Jr.Coder
Full Member
Nobleman
Mar 31, 2013
87
437
1
#
Sorry I dont know what you mean. If you have a static ptr with an offet you'll first have to read the value in the ptr itself, then add your offset and read that value again to get the value..
sory , i bad know English.
I meen:
View attachment 1826
search array of bytes " 03 00 00 11 FF FF FF FF" - found 10 addresses (for example in CE ) - in c++ "Cycle, constantly finds addresses on the array."

then add offsets to found addresses(once):
address 1 + 20 , addreess 2 +20 , address 3 +20 , address 4 +20 , etc.

then
value of "address 1 with offsets 20" = value of address address 0x1234567 (for example) , value of "address 2 with offsets 20" = value of address address 0x1234567 , value of "address 3 with offsets 20" = value of address address 0x1234567 , ets....

For example on 1 address:
search array of bytes 03 00 00 11 FF FF FF FF(cycle)
found address 0x1234567(cycle)
to address 0x134567 add offset "+20"(once) = address "0x1234567+20"
address "0x1234567+20" = address 0x7777777 (cycle)
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
sory , i bad know English.
I meen:
View attachment 1826
search array of bytes " 03 00 00 11 FF FF FF FF" - found 10 addresses (for example in CE ) - in c++ "Cycle, constantly finds addresses on the array."

then add offsets to found addresses(once):
address 1 + 20 , addreess 2 +20 , address 3 +20 , address 4 +20 , etc.

then
value of "address 1 with offsets 20" = value of address address 0x1234567 (for example) , value of "address 2 with offsets 20" = value of address address 0x1234567 , value of "address 3 with offsets 20" = value of address address 0x1234567 , ets....

For example on 1 address:
search array of bytes 03 00 00 11 FF FF FF FF(cycle)
found address 0x1234567(cycle)
to address 0x134567 add offset "+20"(once) = address "0x1234567+20"
address "0x1234567+20" = address 0x7777777 (cycle)
You mean to scan process with C++? To find a byte array which isnt static?
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
Yes it can be done, but I advise not to use ReadProcessMemory with it, it will be quite slow.
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
What if you could advise and help with the source code?
Wow I think scanning that whole process is a bit much and I dont think that it is easy.. Mh and you can't find a pointer? Or did I missunterstood your intention?
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
He's trying to scan for a pattern externally with ReadProcessMemory. Probably he could find a pointer but just wants the whole process to be dynamic rather than hardcoded
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
He's trying to scan for a pattern externally with ReadProcessMemory. Probably he could find a pointer but just wants the whole process to be dynamic rather than hardcoded
Mh okay. Static pointer would be much easier then, wouldn't it?

Ah - he wants to find AOBs in other versions, too, not only in 1 ?! So that he finds where the code is?
 

VDV777

Jr.Coder
Full Member
Nobleman
Mar 31, 2013
87
437
1
Mh okay. Static pointer would be much easier then, wouldn't it?

Ah - he wants to find AOBs in other versions, too, not only in 1 ?! So that he finds where the code is?
All of these addresses, which will Scanner - apply the offset "20." Then all addresses. Address values​​. Which scanner found. With already added offsets "+20". = Address value 0x1234567 (for example)
Sorry for my english ....
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
All of these addresses, which will Scanner - apply the offset "20." Then all addresses. Address values​​. Which scanner found. With already added offsets "+20". = Address value 0x1234567 (for example)
Sorry for my english ....
Okay, I understood. But sorry, I don't know how to do it since a memory scanner is really hard to code.
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
C++:
bool VerifyAddress(HANDLE hProcess, DWORD dwAddress, PBYTE bMask, char *szMask)
{
    PBYTE *pTemp = { 0 };

    for ( int i = 0; *szMask; ++szMask, ++bMask, ++i )
    {
        if ( !ReadProcessMemory( hProcess, reinterpret_cast<LPCVOID>(dwAddress + i), &pTemp, 2048, 0 ) )
            return false;

        if ( *szMask == 'x' && reinterpret_cast<char*>(pTemp) != reinterpret_cast<char*>(*bMask))
            return false;
    }

    return true;
}

DWORD ForzaExternalFindPattern( HANDLE hProcess, PBYTE bMask, char *szMask )
{
    for ( DWORD dwCurrentAddress = 0x401000; dwCurrentAddress < 0x7FFFFFF; dwCurrentAddress++ )
        if ( VerifyAddress( hProcess, dwCurrentAddress, bMask, szMask ) )
            return dwCurrentAddress;

    return -1;
}
External FindPattern by Forza from UC.. as I warned you: Very slow.. optimize the addresses it searches through if possible.

Use it like that:
C++:
DWORD address = 0;
address = ForzaExternalFindPattern(yourprocesshandle, (BYTE*)"\xA1\xA2\xA3", "xxx") + 0x20;
Where \xA1\xA2\xA3 etc, is your pattern and "xxx" will be the matching wildcards
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
C++:
bool VerifyAddress(HANDLE hProcess, DWORD dwAddress, PBYTE bMask, char *szMask)
{
    PBYTE *pTemp = { 0 };

    for ( int i = 0; *szMask; ++szMask, ++bMask, ++i )
    {
        if ( !ReadProcessMemory( hProcess, reinterpret_cast<LPCVOID>(dwAddress + i), &pTemp, 2048, 0 ) )
            return false;

        if ( *szMask == 'x' && reinterpret_cast<char*>(pTemp) != reinterpret_cast<char*>(*bMask))
            return false;
    }

    return true;
}

DWORD ForzaExternalFindPattern( HANDLE hProcess, PBYTE bMask, char *szMask )
{
    for ( DWORD dwCurrentAddress = 0x401000; dwCurrentAddress < 0x7FFFFFF; dwCurrentAddress++ )
        if ( VerifyAddress( hProcess, dwCurrentAddress, bMask, szMask ) )
            return dwCurrentAddress;

    return -1;
}
External FindPattern by Forza from UC.. as I warned you: Very slow.. optimize the addresses it searches through if possible.

Use it like that:
C++:
DWORD address = 0;
address = ForzaExternalFindPattern(yourprocesshandle, (BYTE*)"\xA1\xA2\xA3", "xxx") + 0x20;
Where \xA1\xA2\xA3 etc, is your pattern and "xxx" will be the matching wildcards
Mh but it's made with RPM, I thought it would be slow?
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
Mh but it's made with RPM, I thought it would be slow?
It will be, I've stated that before already, and is stated in the post you replied to...

Judging by his first post I thought it would be external due to the usage of ReadProcessMemory.
 

VDV777

Jr.Coder
Full Member
Nobleman
Mar 31, 2013
87
437
1
C++:
bool VerifyAddress(HANDLE hProcess, DWORD dwAddress, PBYTE bMask, char *szMask)
{
    PBYTE *pTemp = { 0 };

    for ( int i = 0; *szMask; ++szMask, ++bMask, ++i )
    {
        if ( !ReadProcessMemory( hProcess, reinterpret_cast<LPCVOID>(dwAddress + i), &pTemp, 2048, 0 ) )
            return false;

        if ( *szMask == 'x' && reinterpret_cast<char*>(pTemp) != reinterpret_cast<char*>(*bMask))
            return false;
    }

    return true;
}

DWORD ForzaExternalFindPattern( HANDLE hProcess, PBYTE bMask, char *szMask )
{
    for ( DWORD dwCurrentAddress = 0x401000; dwCurrentAddress < 0x7FFFFFF; dwCurrentAddress++ )
        if ( VerifyAddress( hProcess, dwCurrentAddress, bMask, szMask ) )
            return dwCurrentAddress;

    return -1;
}
External FindPattern by Forza from UC.. as I warned you: Very slow.. optimize the addresses it searches through if possible.

Use it like that:
C++:
DWORD address = 0;
address = ForzaExternalFindPattern(yourprocesshandle, (BYTE*)"\xA1\xA2\xA3", "xxx") + 0x20;
Where \xA1\xA2\xA3 etc, is your pattern and "xxx" will be the matching wildcards
good job! Thank a lot!!!!
 

VDV777

Jr.Coder
Full Member
Nobleman
Mar 31, 2013
87
437
1
C++:
bool VerifyAddress(HANDLE hProcess, DWORD dwAddress, PBYTE bMask, char *szMask)
{
    PBYTE *pTemp = { 0 };

    for ( int i = 0; *szMask; ++szMask, ++bMask, ++i )
    {
        if ( !ReadProcessMemory( hProcess, reinterpret_cast<LPCVOID>(dwAddress + i), &pTemp, 2048, 0 ) )
            return false;

        if ( *szMask == 'x' && reinterpret_cast<char*>(pTemp) != reinterpret_cast<char*>(*bMask))
            return false;
    }

    return true;
}

DWORD ForzaExternalFindPattern( HANDLE hProcess, PBYTE bMask, char *szMask )
{
    for ( DWORD dwCurrentAddress = 0x401000; dwCurrentAddress < 0x7FFFFFF; dwCurrentAddress++ )
        if ( VerifyAddress( hProcess, dwCurrentAddress, bMask, szMask ) )
            return dwCurrentAddress;

    return -1;
}
External FindPattern by Forza from UC.. as I warned you: Very slow.. optimize the addresses it searches through if possible.

Use it like that:
C++:
DWORD address = 0;
address = ForzaExternalFindPattern(yourprocesshandle, (BYTE*)"\xA1\xA2\xA3", "xxx") + 0x20;
Where \xA1\xA2\xA3 etc, is your pattern and "xxx" will be the matching wildcards
Here's what happened:
C++:
void find_Enemy()
{
DWORD address = 0;
DWORD address2 = 0;
DWORD address3 = 0;
address = ForzaExternalFindPattern("Game.exe", (BYTE*)"\x03\x00\x00\x11\FF\FF\FF\FF", "xxxxxxxx") + 0x14;
address2 = ForzaExternalFindPattern("Game.exe", (BYTE*)"\x03\x00\x00\x11\FF\FF\FF\FF", "xxxxxxxx") + 0x18;
address3 = ForzaExternalFindPattern("Game.exe", (BYTE*)"\x03\x00\x00\x11\FF\FF\FF\FF", "xxxxxxxx") + 0x1C;
                DWORD coordx = 0;
                byte* coordxBytes = ReadMemory (0x0165D800 , sizeof(DWORD) , pID);
                memcpy(&coordx , coordxBytes , sizeof(DWORD));
				DWORD coordy = 0;
                byte* coordyBytes = ReadMemory (0x0165D804 , sizeof(DWORD) , pID);
                memcpy(&coordy , coordyBytes , sizeof(DWORD));
				DWORD coordz = 0;
                byte* coordzBytes = ReadMemory (0x0165D808 , sizeof(DWORD) , pID);
                memcpy(&coordz , coordzBytes , sizeof(DWORD));
				for
				 (address == coordx;
				 address2 == coordy;
				 address3 == coordz);}
But it not work ....advise something
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
ForzaExternalFindPattern, first parameter is a HANDLE to the process OpenProcess returns to you, you are just passing the name of the process.

And what is this supposed to be?
C++:
for
 (address == coordx;
 address2 == coordy;
 address3 == coordz);}
 

VDV777

Jr.Coder
Full Member
Nobleman
Mar 31, 2013
87
437
1
ForzaExternalFindPattern, first parameter is a HANDLE to the process OpenProcess returns to you, you are just passing the name of the process.

And what is this supposed to be?
C++:
for
 (address == coordx;
 address2 == coordy;
 address3 == coordz);}
value of address always equally value of coordx , value of address2 always equally value of coordy , value of address3 always equally value of coordz


it is my handle , it is right?
DWORD GetProcessByName (char*pName)
{
DWORD pID = 0;
HANDLE snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS,0);
PROCESSENTRY32 pInfo;
pInfo.dwSize = sizeof (PROCESSENTRY32);

if (Process32First(snapshot,&pInfo))
{
while (Process32Next(snapshot,&pInfo))

if (_stricmp(pName,pInfo.szExeFile)==0)
{
pID = pInfo.th32ProcessID;
CloseHandle(snapshot);
break;

}
}

CloseHandle(snapshot);
return pID;
}

DWORD pID = GetProcessByName("Game.exe");
 
Last edited:

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
No it's not. To get the handle you call that function and then call OpenProcess with the PID your GetProcessByName returned, eg
C++:
HANDLE thisisyourhandle = OpenProcess(access, inherithandle, processID);
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods