kwnav How do I cheat?
Reputation: 0
Joined: 27 May 2016 Posts: 1 Location: Korea
|
Posted: Fri May 27, 2016 1:00 am Post subject: C# how to set Value to using a CT file? |
|
|
Hello. Here is my ct file.
| Code: |
<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="20">
<CheatEntries>
<CheatEntry>
<ID>16</ID>
<Description>"MPLobbyLANGame"</Description>
<VariableType>String</VariableType>
<Length>14</Length>
<Unicode>0</Unicode>
<ZeroTerminate>1</ZeroTerminate>
<Address>BlackOps3.exe+12B32B5C</Address>
</CheatEntry>
<CheatEntry>
<ID>17</ID>
<Description>"FRLobbyLANGame"</Description>
<VariableType>String</VariableType>
<Length>14</Length>
<Unicode>0</Unicode>
<ZeroTerminate>1</ZeroTerminate>
<Address>16356EA38</Address>
</CheatEntry>
<CheatEntry>
<ID>18</ID>
<Description>"멀티"</Description>
<VariableType>String</VariableType>
<Length>14</Length>
<Unicode>0</Unicode>
<ZeroTerminate>1</ZeroTerminate>
<Address>16363A3DB</Address>
</CheatEntry>
</CheatEntries>
<CheatCodes>
<CodeEntry>
<Description>Change of inc edx</Description>
<Address>147621428</Address>
<ModuleName>blackops3.exe</ModuleName>
<ModuleNameOffset>7621428</ModuleNameOffset>
<Before>
<Byte>00</Byte>
<Byte>00</Byte>
<Byte>00</Byte>
<Byte>00</Byte>
<Byte>00</Byte>
</Before>
<Actual>
<Byte>40</Byte>
<Byte>42</Byte>
</Actual>
<After>
<Byte>0F</Byte>
<Byte>00</Byte>
<Byte>00</Byte>
<Byte>00</Byte>
<Byte>00</Byte>
</After>
</CodeEntry>
</CheatCodes>
<UserdefinedSymbols/>
</CheatTable>
|
In c#, I want to set value of id16~18 to MPLobbyLANGame.
When I use Generate generic trainer lua script, it works well.
But, if I code this in C#, nothing..
| Code: |
static memory m = new memory();
static void Main(string[] args)
{
m.Process_Handle("BlackOps3");
var s = m.ReadString(0x12B32B5C, 14);
Console.WriteLine("test : " + s);//NOTHING..
}
|
here is memory class
| Code: |
#region Basic Stuff
[DllImport("kernel32.dll")]
private static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
[DllImport("kernel32.dll")]
private static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
IntPtr pHandel;
public bool Process_Handle(string ProcessName)
{
try
{
Process[] ProcList = Process.GetProcessesByName(ProcessName);
if (ProcList.Length == 0)
return false;
else
{
pHandel = ProcList[0].Handle;
return true;
}
}
catch (Exception ex)
{ Console.Beep(); Console.WriteLine("Process_Handle - " + ex.Message); return false; }
}
private byte[] Read(int Address, int Length)
{
byte[] Buffer = new byte[Length];
IntPtr Zero = IntPtr.Zero;
ReadProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
return Buffer;
}
private void Write(int Address, int Value)
{
byte[] Buffer = BitConverter.GetBytes(Value);
IntPtr Zero = IntPtr.Zero;
WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
}
#endregion
//This is the part you want to edit
#region Write Functions (Integer & String)
public void WriteInteger(int Address, int Value)
{
Write(Address, Value);
}
public void WriteString(int Address, string Text)
{
byte[] Buffer = new ASCIIEncoding().GetBytes(Text);
IntPtr Zero = IntPtr.Zero;
WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
}
public void WriteBytes(int Address, byte[] Bytes)
{
IntPtr Zero = IntPtr.Zero;
WriteProcessMemory(pHandel, (IntPtr)Address, Bytes, (uint)Bytes.Length, out Zero);
}
public void WriteNOP(int Address)
{
byte[] Buffer = new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90 };
IntPtr Zero = IntPtr.Zero;
WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
}
#endregion
#region Read Functions (Integer & String)
public int ReadInteger(int Address, int Length = 4)
{
return BitConverter.ToInt32(Read(Address, Length), 0);
}
public string ReadString(int Address, int Length = 4)
{
return new ASCIIEncoding().GetString(Read(Address, Length));
}
public byte[] ReadBytes(int Address, int Length)
{
return Read(Address, Length);
}
#endregion
|
| Description: |
|
 Download |
| Filename: |
BlackOps3.CT |
| Filesize: |
3.5 KB |
| Downloaded: |
572 Time(s) |
_________________
Hello |
|