• Silahkan bergabung dengan chat kami di Telegram group kami di N3Forum - https://t.me/n3forum
  • Welcome to the Nyit-Nyit.Net - N3 forum! This is a forum where offline-online gamers, programmers and reverser community can share, learn, communicate and interact, offer services, sell and buy game mods, hacks, cracks and cheats related, including for iOS and Android.

    If you're a pro-gamer or a programmer or a reverser, we would like to invite you to Sign Up and Log In on our website. Make sure to read the rules and abide by it, to ensure a fair and enjoyable user experience for everyone.

A C# Trainer Source Code

Status
Not open for further replies.

klklkl

PAUD
Level 1
Source code untuk class
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Forms;

namespace GameTrainer1
{
public class TulisMemoryCls
{
public TulisMemoryCls()
{
}

public string strProc;

//API Declarations
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
public static extern bool WriteProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int nSize, int lpNumberOfBytesWritten);
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
public static extern bool WriteProcessMemory(int hProcess, int lpBaseAddress, byte lpBuffer, int nSize, int lpNumberOfBytesWritten);	

private bool WriteToMemory(byte[] bytBuffer, int iAddress)
{
bool fSuccess = WriteProcessMemory(InitProc(strProc), iAddress, bytBuffer, bytBuffer.Length, 0);
//Grab the return value of WriteProcessMemory and set the
//return value of this function to it.
if(fSuccess == true)
{
return true;
}
else
{
return false;
}
}//End WriteToMemory

public void DynamicNop(int iNumNops, int iAddress)
{
byte[] bytNop = new byte[iNumNops];

for (int intWrite = 0; intWrite < iNumNops; intWrite++) 
{
bytNop[intWrite] = 0x90;
}
WriteToMemory(bytNop, iAddress);
}

public void WritePoke(int[] intPoke)
{
int intAddress = 0;
byte[] bytNopBuffer = null;
//Parse the poke
ParsePoke(intPoke, ref intAddress, ref bytNopBuffer);
//Write the info
WriteToMemory(bytNopBuffer, intAddress);
}//End Write Poke

public void WritePoke(string strPoke)
{
int intAddress = 0;
byte[] bytNopBuffer = null;
//Parse the poke
ParsePoke(strPoke, ref intAddress, ref bytNopBuffer);
//Write the info
WriteToMemory(bytNopBuffer, intAddress);
}//End Write Poke

public int InitProc(string strProcess)
{
//Obtain the pID
System.Diagnostics.Process[] prcProcess = System.Diagnostics.Process.GetProcessesByName(strProcess);
int intTemp = 0;
try
{
intTemp = prcProcess[0].Handle.ToInt32();
}
catch (IndexOutOfRangeException)
{
MessageBox.Show("Anda Harus Menjalankan Game Terlebih dahulu", "Jalankan Game", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);	
}//End Try
return intTemp;
}//End InitProc

public void ParsePoke(int[] intPoke, ref int iAddress, ref byte[] bytBuffer)
{	
//First element is address and everything else
//are opcodes if they poke is written correctly
iAddress = intPoke[0];
//Fetch the opcodes
bytBuffer = new byte[intPoke.Length - 1];
for (int i = 1; i <= bytBuffer.Length; i++)
bytBuffer[i - 1] = System.Convert.ToByte(intPoke[i]);
}//End Parse Poke

public void ParsePoke(string strPoke, ref int iAddress, ref byte[] bytBuffer)
{
string[] strEditArray;
//Split the string and add each element to an
//element in the edit array.
strEditArray = strPoke.Split(new Char[] {'|'});
//Set the first array element to the address.
//Assuming the poke is properly written the address will be
//the first element and everything else after that is an
//opcode. You will know when you have a bad poke when
//your game crashes;).
iAddress = System.Convert.ToInt32(strEditArray[0]);
string[] strTemp = new string[strEditArray.Length];
//Fetch the opcodes
for (int i = 1; i < strTemp.Length; i++)
strTemp[i - 1] = strEditArray[i];
bytBuffer = new byte[strTemp.Length - 1];
for (int i = 0; i < bytBuffer.Length; i++)
bytBuffer[i] = System.Convert.ToByte(strTemp[i]);
}//End ParsePoke
}
}
Source Code untuk Form

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace GameTrainer1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnspeed_Click(object sender, EventArgs e)
{
TulisMemoryCls tulis1 = new TulisMemoryCls(); //deklarasi objek baru tulis1

tulis1.strProc = "winmine"; // Proses winmine atau minesweeper
int[] intPoke = { 0x1002FF5, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }; // poke nop di 1002ff5
tulis1.WritePoke(intPoke);
tulis1.DynamicNop(6, 0x100346E);
}
}
}
 

bugzy

TK A
Level 1
^
^
^
sori ngrepotin kk, msi nopis bgt ni soal bginian...
ni bwt apaan yah,
kali aja bs nambah2 ilmu...

thxns b4... :grin:
 
Status
Not open for further replies.
Top