Barvier
Barvier
CC#
Created by Barvier on 3/8/2023 in #help
❔ Converting String to an integer with a Hexadecimal Value
Hello Folks, I got a process with a prefered imagebase equal to 002E0000. I would like to store that value assigned to an integer since its a hexadecimal value which can be stored as it. What is more I would like the value to be have a prefix "0x" so in full format the integer should look like this
C#
public static int PROCESSBASEADRESS_INT = 0x002E0000
C#
public static int PROCESSBASEADRESS_INT = 0x002E0000
I have a following code that gets the value from process and saves it as an integer however here is my issues: - it does not store it in hexadecimal value - I need it stored as an hexadecimal integer value with pre-fix "0x"
C#

Process process = Process.GetProcessesByName(testprocess)[0];
ProcessModule mainModule = process.MainModule;
int baseAddressInt = int.Parse(mainModule.BaseAddress.ToString("X"), NumberStyles.HexNumber);
PROCESSBASEADRESS_INT = baseAddressInt;
Console.WriteLine(PROCESSBASEADRESS_INT);
C#

Process process = Process.GetProcessesByName(testprocess)[0];
ProcessModule mainModule = process.MainModule;
int baseAddressInt = int.Parse(mainModule.BaseAddress.ToString("X"), NumberStyles.HexNumber);
PROCESSBASEADRESS_INT = baseAddressInt;
Console.WriteLine(PROCESSBASEADRESS_INT);
It prints it out as a INT32 value. I need to print out hexadecimal value with a prefix "0x" I tried converting it to string and adding "0x" but after that I cant convert it back to hexadecimal integer that represent exactly what string was showing.
13 replies
CC#
Created by Barvier on 3/8/2023 in #help
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.
42 replies