 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
sgs_ How do I cheat?
Reputation: 0
Joined: 12 Mar 2014 Posts: 4
|
Posted: Wed Mar 12, 2014 12:47 am Post subject: [Help] Delphi to C # |
|
|
I'm trying to pass this code to C #
It is a WrittenProcessMemory writing a string.
Sorry my English (Google Translate) e.e
| Code: | | WriteProcessMemory(hProc,Ptr(NickChange),PChar(str+#0),Length(str)+1,Writen); |
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Mar 12, 2014 3:00 pm Post subject: |
|
|
You will need to import the API call:
http://www.pinvoke.net/default.aspx/kernel32.writeprocessmemory
After that, to write data, C# uses byte arrays. So you will need to convert the string to a byte array using the Encoding class. After that you should be good to go. _________________
- Retired. |
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Wed Mar 12, 2014 3:10 pm Post subject: |
|
|
WriteProcessMemory Prototype in C#
| Code: |
using System.Runtime.InteropServices;
//
// etc
//
[DllImport("Kernel32.dll")]
public static extern bool WriteProcessMemory( IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, Int32 nSize, out Int32 lpNumberOfBytesWritten );
|
_________________
Stylo |
|
| Back to top |
|
 |
sgs_ How do I cheat?
Reputation: 0
Joined: 12 Mar 2014 Posts: 4
|
Posted: Thu Mar 13, 2014 2:11 pm Post subject: |
|
|
Sorry think esprecei me wrong, what I'm trying to do is write it in memory like mentioned above I'm using this:
| Code: | public static void WriteString(string EXENAME, int Address, string Value)
{
checked
{
try
{
Process[] Proc = Process.GetProcessesByName(EXENAME);
if (Proc.Length != 0)
{
char st = Convert.ToChar(Value + "\0");
int Bytes = 0;
int Handle = OpenProcess(PROCESS_ALL_ACCESS, 0, Proc[0].Id);
if (Handle != 0)
{
WriteProcessMemoryString(Handle, Address, ref st, Value.Length + 1, ref Bytes);
}
CloseHandle(Handle);
}
}
catch
{ }
}
} |
However no avail. |
|
| Back to top |
|
 |
Matze500 Expert Cheater
Reputation: 8
Joined: 25 Jan 2012 Posts: 241 Location: Germany
|
Posted: Thu Mar 13, 2014 6:04 pm Post subject: |
|
|
it should be this in C# and then you can write a value to an address.
| Code: |
using System.Runtime.InteropServices;
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool WriteProcessMemory(IntPtr hProcess, int lpBaseAddress, byte[] lpBuffer, int nSize, int lpNumberOfBytesWritten);
public void WriteProcessMemory(IntPtr processId,IntPtr address, byte[] value)
{
WriteProcessMemory(processId, address.ToInt32(), value, value.Length, 0);
}
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|