x_maddog_x How do I cheat? Reputation: 0
Joined: 14 Feb 2017 Posts: 2
|
Posted: Tue Feb 14, 2017 9:09 am Post subject: string to long error |
|
|
i need help in this error:
Code: | MemoryWR.WriteLong("game.exe", 0x03338B40, I NEED PUT HEX HERE, 5); |
but i need creat Pointer!
my adress is = 0x03338B40
i need read VALUE in hex mode.
for put in my code
sample:
Code: | int Point;
Point= MemoryWR.ReadInteger("game.exe", 0x03338B40); |
//this read i get DECIMAL code:
928677808
and i convert this for HEX and i get 375A7FB0
//and write mode
Code: | MemoryWR.WriteLong("game.exe", 0x03338B40, Point, 5); |
This code would work if I wanted DECIMAL!
But I want to convert the decimal to hex! And put where the point is!
And when placing
Code: | Point.ToString("X8") |
get error:
Error 2 Argument '3': cannot convert from 'string' to 'long'
I'm going to post the WR code of reading and writing, maybe it's simple but I'm burning my head for two days
class MemoryWR
Code: | public static void WriteLong(string EXENAME, int Address, long Value, int zSize)
{
checked
{
try
{
Process[] Proc = Process.GetProcessesByName(EXENAME);
if (Proc.Length != 0)
{
int Bytes = 0;
int Handle = OpenProcess(PROCESS_ALL_ACCESS, 0, Proc[0].Id);
if (Handle != 0)
{
WriteProcessMemoryLong(Handle, Address, ref Value, zSize, ref Bytes);
}
CloseHandle(Handle);
}
}
catch
{ }
}
}
public static int ReadInteger(string EXENAME, int Address)
{
int Value = 0;
checked
{
try
{
Process[] Proc = Process.GetProcessesByName(EXENAME);
if (Proc.Length != 0)
{
int Bytes = 0;
int Handle = OpenProcess(PROCESS_ALL_ACCESS, 0, Proc[0].Id);
if (Handle != 0)
{
ReadProcessMemoryInteger(Handle, Address, ref Value, 4, ref Bytes);
CloseHandle(Handle);
}
}
}
catch
{ }
}
return Value;
} |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Thu Mar 02, 2017 3:45 am Post subject: |
|
|
You are converting a numeric value to a string when you use 'ToString' calls. The code you are using is expecting numeric values, not strings. Regardless if you pass the value as decimal or hex, it will work the same. You do not need to convert it to hex first to call the function.
_________________
- Retired. |
|