Solved WriteProcessMemroy , Restore what was written editing multiple pointer offsets

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Praxeus

Jr.Coder
Full Member
Nobleman
Sep 12, 2012
48
408
1
Have a question , lets say my recoil values are offset 130 = 0.7894 , offset 134 = 0.442241 all the way to 144 and i want to write process memory all addresses at once from 130 up to 144 ,
so it should be WriteProcessMemory( hProcessHandle, (LPVOID)0xRecoil + 0x130, &RecoilZero, 24 (Change bytes to edit here from 130 up to 140 ), NULL ); but its not editing all values correctly.


And how would i restore values i write to like restore the original values for recoil after i set to 0 , so i can only set it in game when health is greater then 0 otherwise restore original recoil and do not write to the address?
 

mambda

headass
Escobar Tier VIP
Trump Tier Donator
Jun 25, 2014
2,298
37,938
269
Didn't you say they were floats....?

Reading a float into an int is a bad idea, you will definitely not get the right result, also your RPM is wrong it needs to be sizeof( float ) (which is 4 ) * number of floats to read, which is also 4.

so 4 * 4 = 16, or just sizeof(float/int/any four byte type) * number of type to read
 

Praxeus

Jr.Coder
Full Member
Nobleman
Sep 12, 2012
48
408
1
Will test when i get home cannot believe i was so silly lol , but how would you restore the values to original state after writing ?
 

Alex

Sober linux neb
Dank Tier Donator
Nobleman
Nov 26, 2015
150
828
1
Will test when i get home cannot believe i was so silly lol , but how would you restore the values to original state after writing ?
Just change the value-to-write to the original value, commonsense :p
 

Praxeus

Jr.Coder
Full Member
Nobleman
Sep 12, 2012
48
408
1
Sample ? .......................

so like example

if (Ammo > 1)
{
float newVars = 0;
Wpm(handle, Addy, &newVars, sizeof(float) * 0x144, NULL)

}

else

restore values to normal , values which you do not know
 
Last edited:

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
Sample ? .......................

so like example

if (Ammo > 1)
{
float newVars = 0;
Wpm(handle, Addy, &newVars, sizeof(float) * 0x144, NULL)

}

else

restore values to normal , values which you do not know
"do not know"? Just read the original values before overwriting them...
 

Praxeus

Jr.Coder
Full Member
Nobleman
Sep 12, 2012
48
408
1
C++:
for (;;)
{
float OriginalVal;
float newVal = 0;
rpm (read value into original value)
if (Ammo > 1)
{
wpm (Write to address and add newVal here)
}
else 
 (Write OriginalVal which was stored back into the address we wrote to)

}
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
We need more code. How do you check wether the recoil should be on or off? What addresses are you reading from? How many values do you want to change?
 
Last edited:

mambda

headass
Escobar Tier VIP
Trump Tier Donator
Jun 25, 2014
2,298
37,938
269
Didnt you say you're reading an array? You aren't reading the array into a single float are you? Instead of a float array/pointer?

float * toStore = (float*)malloc(sizeof(float)*lengthHere);

Rpm( xxxx, xxxxs, xxxx, toStore, sizeof(float)*lengthHere, ... )
 

Praxeus

Jr.Coder
Full Member
Nobleman
Sep 12, 2012
48
408
1
Didnt you say you're reading an array? You aren't reading the array into a single float are you? Instead of a float array/pointer?

float * toStore = (float*)malloc(sizeof(float)*lengthHere);

Rpm( xxxx, xxxxs, xxxx, toStore, sizeof(float)*lengthHere, ... )
C++:
	int * AmmoOrign= (int*)malloc(sizeof(int)*4);
			int InfAmmo= 30;

			ReadProcessMemory(hHandle, (LPVOID)(Base + 0x48), &AmmoOrign, 4, NULL);

			if (GetAsyncKeyState(VK_LBUTTON) )
			{
				WriteProcessMemory(hHandle, (LPVOID)(Base + 0x2E8), &InfAmmo, sizeof(InfAmmo), NULL);
			}

			else if (!GetAsyncKeyState(VK_LBUTTON) )
			{

				WriteProcessMemory(hHandle, (LPVOID)(Base + 0x48), &AmmoOrign, sizeof(AmmoOrign), NULL);

			}
this is more or less how i am doing it but instead
 

Solaire

Respected Hacker
Dank Tier VIP
Dec 15, 2013
1,051
16,353
62
If it starts at 134, and ends at 144, that means you have (0x144 - 0x134) / sizeof(float) recoil values. This means 4 recoil values.

C++:
bool recoilHackOn = false;
float newValues[4] = { 0.0f, 0.0f, 0.0f, 0.0f };

if (GetAsyncKeyState(VK_Whatever) & 1) recoilHackOn = !recoilHackOn;

if (recoilHackOn) {
    WriteProcessMemory(handle, address, &newValues, sizeof(float) * 4, NULL);
}
That is literally all you have to do.

If you're wanting to read them out, same process, just use rpm and put them into the newValues array. I'm honestly confused as to what your goal is.
 

Praxeus

Jr.Coder
Full Member
Nobleman
Sep 12, 2012
48
408
1
mambda that is an example quick test i got the multiple offsets to work , but now i want to reset it to its default values once i write 0 to all of them so once left click is held then set to 0 if it is not held restore original values but i am testing this with default single int ammo values for now.so say my ammo in the gun was 31 and i set it to 50 i want to read 31 as the default value ? so like if its the pistol etc it will know.


Solaire that works well and dandy but it still toggles once and i cannot toggle back to default values , for example like patching array of bytes you can 0x90 values then reset it to 0xF4 for example as off , what I am trying to achieve here is similar but by not patching bytes.

Hope i am making sense lol
 

Solaire

Respected Hacker
Dank Tier VIP
Dec 15, 2013
1,051
16,353
62
@mambda that is an example quick test i got the multiple offsets to work , but now i want to reset it to its default values once i write 0 to all of them so once left click is held then set to 0 if it is not held restore original values but i am testing this with default single int ammo values for now.so say my ammo in the gun was 31 and i set it to 50 i want to read 31 as the default value ? so like if its the pistol etc it will know.


@Solaire that works well and dandy but it still toggles once and i cannot toggle back to default values , for example like patching array of bytes you can 0x90 values then reset it to 0xF4 for example as off , what I am trying to achieve here is similar but by not patching bytes.

Hope i am making sense lol
If the 4 values are just floats and not asm, then the toggle will work fine as the spot is no longer written to. That means the game will then continue to write to the spot and add recoil.

If those are what are added to create recoil, then just save them in another variable.
 

Praxeus

Jr.Coder
Full Member
Nobleman
Sep 12, 2012
48
408
1
If the 4 values are just floats and not asm, then the toggle will work fine as the spot is no longer written to. That means the game will then continue to write to the spot and add recoil.

If those are what are added to create recoil, then just save them in another variable.
it does in somewhat way work when i tried it a while back but takes forever for the default values to set back after the toggle?
 
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