C
C#2y ago
Barvier

reusable constantly updating int from memory (VAMEMORY)

Hello folks! I am learning C# for few months and I am completely stuck.. I have done a lot of researches about the issue that I am facing but none of them helped so here I am. What I am trying to do in general? I am trying to make all the time updated (constantly updating) int by reading from process memory (using VMEMORY). I would like to use updated int in other part of my code (in different methods, basically in the entire code) Example: public static int xxxxxxxxx = 0x2B58DF0; // base_address public static int zzzzzzzzzz = 0xA8; // pointer while(true) { VAMemory vam = new VAMemory("processname"); int 12345= vam.ReadInt32((IntPtr)xxxxxxxxx); int 67890 = 12345 + zzzzzzzzzz ; // dont ask me why I read memory using so many integers - it just otherwise will not point to the correct address REUSABLE_INTEGER = vam.ReadInt32((IntPtr)(67890)); } Now it will keep updating at all time - how do I reuse the updated value (REUSABLE_INTEGER) in other parts of the code? Other methods etc.
23 Replies
phaseshift
phaseshift2y ago
dont ask me why I read memory using so many integers - it just otherwise will not point to the correct address
"red flag" ⛔ 🚫
Barvier
BarvierOP2y ago
I could not find any solution for that as well - I am open for suggestions. vam.ReadInt32((IntPtr)0x2B58DF0 + 0xA8); gives completly different value then it should
phaseshift
phaseshift2y ago
This is the kind of stuff that is typical in nefarious code, so you will likely have to satisfy people that what you're trying to do does not break any TOS
Barvier
BarvierOP2y ago
Shit, so hard to put this altogether in English since its my not native language. I do have another console that I use for training purposes. I build other consoles to read from its memory using different scenarios. Since the training console was shared exactly for this purpose - somewhere from YouTube video long time ago I do not see breaking any TOS. Anyway, if anyone could help me with this loop and reausing updated int - I would be more then grateful since ChatGPT is giving up on that and failing as well. Terrible creature btw.
Relevant
Relevant2y ago
This is some pretty hardcore stuff for someone who's new to C#. What are you trying to accomplish? There are multiple issues with the code you posted, but need to get a better idea of what your intent is.
Barvier
BarvierOP2y ago
It was a code written on discord to show what I am trying to do, sorry. I got a (Program1) console that generates random values under this address for an example: 1 1 1 1 0 0 0 1 1 1 I am making another (Program2) console that will read from this address and I wanted to always have on top updated value under an integer that I can use anywhere in the code. To print for console, use in conditional loops etc. This one reads at all times the value: while(true) { VAMemory vam = new VAMemory("processname"); int 12345= vam.ReadInt32((IntPtr)xxxxxxxxx); int 67890 = 12345 + zzzzzzzzzz REUSABLE_INTEGER = vam.ReadInt32((IntPtr)(67890)); } Sometimes I use print to debug if I am reading correct value and I compare both Programs. Console.WriteLine(REUSABLE_INTEGER); everything is fine as long as I use it under same method. if I want to create multiple loops I am not able to reuse this integer cause its not accessible. for an example: while(REUSABLE_INTEGER == 0) { Console.WriteLine = "Test Line" } Another while loop will not reach the int REUSABLE_INTEGER. I tried to use Timers as well but it is same scenario. Finished writing 🙂
C#

using System;
using System.Diagnostics.Eventing.Reader;
using System.Runtime.InteropServices;
using System.Threading;
using System.Timers;

class Program
{
public static int XXXXXX = 0x2B58DF0;
public static int YYYYYY = 0x4C;

void Refresh(string[] args)
{
VAMemory vam = new VAMemory("PROCESS");
while (true)
{
int LocalAddress = vam.ReadInt32((IntPtr)XXXXXX);
int LocalAddressCheck = vam.ReadInt32((IntPtr)(LocalAddress + YYYYYY));
int REUSABLE_INTEGER = LocalAddressCheck;
Console.WriteLine(REUSABLE_INTEGER);
}
}
static void Main(string[] args)
{
while (REUSABLE_INTEGER = 0)
{
//REST OF THE CODE

}



}

}
C#

using System;
using System.Diagnostics.Eventing.Reader;
using System.Runtime.InteropServices;
using System.Threading;
using System.Timers;

class Program
{
public static int XXXXXX = 0x2B58DF0;
public static int YYYYYY = 0x4C;

void Refresh(string[] args)
{
VAMemory vam = new VAMemory("PROCESS");
while (true)
{
int LocalAddress = vam.ReadInt32((IntPtr)XXXXXX);
int LocalAddressCheck = vam.ReadInt32((IntPtr)(LocalAddress + YYYYYY));
int REUSABLE_INTEGER = LocalAddressCheck;
Console.WriteLine(REUSABLE_INTEGER);
}
}
static void Main(string[] args)
{
while (REUSABLE_INTEGER = 0)
{
//REST OF THE CODE

}



}

}
@Relevant
phaseshift
phaseshift2y ago
You're training something for what? VAMemory's top Google hits are all related to cheats/bots/hacks
Barvier
BarvierOP2y ago
I could use just standard process memory and get handles by using windows API but I find this method more efficient without useless code and playing with handles. I just enjoy learning C# this way. Building complex calculators and other stuff is not really my thing. I have build some small projects. I practised with Windows API first, still a lot to learn, mostly things for automation. Now I found out other way that I want to learn and practice. I am aware that this is used in cheat development but I also find this a great practice for developing the opposite things. In other words I need help to use integer value which is a result of one while loop to to any other new while loop and keep the value from previous loop. To me it sounds like a pretty basic stuff that I cannot solve as a beginner.
phaseshift
phaseshift2y ago
Integers get copied. What do you mean 'result of while loop'?
Barvier
BarvierOP2y ago
As you can see in the code that I posted I try to use another new loop while (REUSABLE_INTEGER = 0) and it says that this integer is not reachable cause its in other method / loop.
phaseshift
phaseshift2y ago
Yeah, you defined it within the loop. Just define it earlier $scopes
MODiX
MODiX2y ago
scope A {
thing a;
scope B {
thing b;
}
}
scope A {
thing a;
scope B {
thing b;
}
}
thing a is available in scope A and scope B thing b is available only in scope B
Barvier
BarvierOP2y ago
if I make public static int = REUSABLE_INTEGER; ((loop that gives a REUSABLE_INTEGER a new value for an example 1)) ((loop that reads value of REUSABLE INTEGER) it will still read 0 from the public int definied earlier instead of a value that got updated in previous loop
phaseshift
phaseshift2y ago
No it won't
Barvier
BarvierOP2y ago
Alright, let me test it out again. I have the results! I can use this inside the while loop, but I can't use it as a condition for another loop and this is what I am trying to do. or maybe the issue is different
C#

using System;
using System.Diagnostics.Eventing.Reader;
using System.Runtime.InteropServices;
using System.Threading;
using System.Timers;

class NewClass
{
public static int REUSABLE_INTEGER;
public static int XXXXXX = 0x2B58DF0;
public static int YYYYYY = 0x4C;

void Main(string[] args)
{
VAMemory vam = new VAMemory("process");
while (true)
{
int LocalAddress = vam.ReadInt32((IntPtr)XXXXXX);
int LocalAddressCheck = vam.ReadInt32((IntPtr)(LocalAddress + YYYYYY));
int REUSABLE_INTEGER = LocalAddressCheck;
Console.WriteLine(REUSABLE_INTEGER);
}

while (true)
{


}


}

}
C#

using System;
using System.Diagnostics.Eventing.Reader;
using System.Runtime.InteropServices;
using System.Threading;
using System.Timers;

class NewClass
{
public static int REUSABLE_INTEGER;
public static int XXXXXX = 0x2B58DF0;
public static int YYYYYY = 0x4C;

void Main(string[] args)
{
VAMemory vam = new VAMemory("process");
while (true)
{
int LocalAddress = vam.ReadInt32((IntPtr)XXXXXX);
int LocalAddressCheck = vam.ReadInt32((IntPtr)(LocalAddress + YYYYYY));
int REUSABLE_INTEGER = LocalAddressCheck;
Console.WriteLine(REUSABLE_INTEGER);
}

while (true)
{


}


}

}
phaseshift
phaseshift2y ago
Yeah, you still make the new int variable inside the loop There's no need for any of that static stuff either You're just going to confuse yourself with static int x =5; x=10; // NOT int x = 10 That's how you reassign an existing variable
Barvier
BarvierOP2y ago
C#

using System;
using System.Diagnostics.Eventing.Reader;
using System.Runtime.InteropServices;
using System.Threading;
using System.Timers;

class NewClass
{
public static int REUSABLE_INTEGER;
public static int XXXXXX = 0x2B58DF0;
public static int YYYYYY = 0x4C;

public static void Main(string[] args)
{
VAMemory vam = new VAMemory("process");
while (true)
{
int LocalAddress = vam.ReadInt32((IntPtr)XXXXXX);
int LocalAddressCheck = vam.ReadInt32((IntPtr)(LocalAddress + YYYYYY));
int REUSABLE_INTEGER = LocalAddressCheck;
Console.WriteLine(REUSABLE_INTEGER);
}

while (true)
{
Console.WriteLine(REUSABLE_INTEGER);

}


}

}
C#

using System;
using System.Diagnostics.Eventing.Reader;
using System.Runtime.InteropServices;
using System.Threading;
using System.Timers;

class NewClass
{
public static int REUSABLE_INTEGER;
public static int XXXXXX = 0x2B58DF0;
public static int YYYYYY = 0x4C;

public static void Main(string[] args)
{
VAMemory vam = new VAMemory("process");
while (true)
{
int LocalAddress = vam.ReadInt32((IntPtr)XXXXXX);
int LocalAddressCheck = vam.ReadInt32((IntPtr)(LocalAddress + YYYYYY));
int REUSABLE_INTEGER = LocalAddressCheck;
Console.WriteLine(REUSABLE_INTEGER);
}

while (true)
{
Console.WriteLine(REUSABLE_INTEGER);

}


}

}
it still says at line 24 (new while loop) unreachable code detected.
phaseshift
phaseshift2y ago
Well you've got two infinite loops and no breaks
Barvier
BarvierOP2y ago
LMAO I need one of these loops to be running at all time while other will be running a code repeatedly. Is there any way to work this around?
phaseshift
phaseshift2y ago
Yes, threads.
Barvier
BarvierOP2y ago
Perfect! I have created two threads for each of the functions.
C#

using System;
using System.Diagnostics.Eventing.Reader;
using System.Runtime.InteropServices;
using System.Threading;
using System.Timers;

class NewClass
{
public static int REUSABLE_INTEGER;
public static int XXXXXX = 0x2B58DF0;
public static int YYYYYY = 0x4C;

public static void Main(string[] args)
{
Thread t1 = new Thread(Loop1);
t1.Start();
Thread t2 = new Thread(Loop2);
t2.Start();
}

public static void Loop1()
{
VAMemory vam = new VAMemory("process");
while (true)
{
int LocalAddress = vam.ReadInt32((IntPtr)XXXXXX);
int LocalAddressCheck = vam.ReadInt32((IntPtr)(LocalAddress + YYYYYY));
int REUSABLE_INTEGER = LocalAddressCheck;
}
}

public static void Loop2()
{
while (true)
{
Console.WriteLine(REUSABLE_INTEGER);
}
}
}
C#

using System;
using System.Diagnostics.Eventing.Reader;
using System.Runtime.InteropServices;
using System.Threading;
using System.Timers;

class NewClass
{
public static int REUSABLE_INTEGER;
public static int XXXXXX = 0x2B58DF0;
public static int YYYYYY = 0x4C;

public static void Main(string[] args)
{
Thread t1 = new Thread(Loop1);
t1.Start();
Thread t2 = new Thread(Loop2);
t2.Start();
}

public static void Loop1()
{
VAMemory vam = new VAMemory("process");
while (true)
{
int LocalAddress = vam.ReadInt32((IntPtr)XXXXXX);
int LocalAddressCheck = vam.ReadInt32((IntPtr)(LocalAddress + YYYYYY));
int REUSABLE_INTEGER = LocalAddressCheck;
}
}

public static void Loop2()
{
while (true)
{
Console.WriteLine(REUSABLE_INTEGER);
}
}
}
it prints 0 0 0 0 0 0 0 0 0 0 and its not updating the integer which should be already changed to 1 1 1 1 1 1 as I see it in other program. Unnecessary assignment of a value to 'REUSABLE_INTEGER' at level: int REUSABLE_INTEGER = LocalAddressCheck; so its not writing to the public int
phaseshift
phaseshift2y ago
Yes... This
Barvier
BarvierOP2y ago
❤️ Now I need to make a bool since I cant convert int into bool using while conditions. Perfect, thank you!
Want results from more Discord servers?
Add your server