A C# Trainer Source Code

Discussion in 'XIAN' started by klklkl, Jun 26, 2007.

Discuss A C# Trainer Source Code in the XIAN area at Nyit-Nyit.Net

Thread Status:
Not open for further replies.
  1. klklkl Pra TK Level 1

    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    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);
    }
    }
    }
     

    Gunakan jasa Rekber N3 untuk menjamin jual beli anda atau menghindari penipuan dengan meng klik disini
  2. bencana TK 0 Besar Level 1

    Messages:
    172
    Likes Received:
    0
    Trophy Points:
    16
    WAW KEREN2
     
  3. bugzy TK 0 Kecil Level 1

    Messages:
    93
    Likes Received:
    7
    Trophy Points:
    33
    ^
    ^
    ^
    sori ngrepotin kk, msi nopis bgt ni soal bginian...
    ni bwt apaan yah,
    kali aja bs nambah2 ilmu...

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

Share This Page