Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[DLL] Memory Editor Class (last updated 24/04/2008)
Goto page 1, 2, 3  Next
 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Estx
Expert Cheater
Reputation: 0

Joined: 04 Mar 2008
Posts: 172

PostPosted: Thu Mar 13, 2008 6:55 am    Post subject: [DLL] Memory Editor Class (last updated 24/04/2008) Reply with quote

Alright, simple to use DLL for memory editing, works in all .NET compatible programming languages (C++, C#, VB, etc).

Update: Added a few more exports. Smile

Download Link (Binary DLL)
Download Link (Source C#)

So far exports are as follows:
Code:
Variables:
public string lastError
public Process netProcHandle

Structs:
MemoryRegion + 1 overload (for use with CopyMemory)
vmProtect (for use with VirtualMemoryProtect)

Process Handling:
public IntPtr mOpenProcess(string processName)
public Int32 mCloseProcess()

Module Handling:
public ProcessModuleCollection GetModuleCollection()
public ProcessModule GetModule(string moduleName)
public IntPtr GetModuleBaseAddress(string moduleName)
public IntPtr GetModuleEntryPoint(string moduleName)
public Int32 GetModuleMemSize(string moduleName)

Copy Memory:
public MemoryRegion memRegion32bit
public MemoryRegion memRegion16bit
public MemoryRegion memRegionAll
public byte[] CopyMemory(MemoryRegion memRegion) + 2 overloads

Read Memory:
public byte ReadMemoryByte(long address)
public short ReadMemoryShort(long address)
public int ReadMemoryInt(long address)
public long ReadMemoryLong(long address) + 1 overload
public float ReadMemoryFloat(long address)
public double ReadMemoryDouble(long address)
public string ReadMemoryString(long address, int stringLength)
public byte[] ReadMemoryAOB(long address, long length)

Write Memory:
public Int32 WriteMemory(long address, byte data)
public Int32 WriteMemory(long address, byte[] data) + 1 overload
public Int32 WriteMemory(long address, short data) + 1 overload
public Int32 WriteMemory(long address, int data) + 1 overload
public Int32 WriteMemory(long address, long data) + 1 overload
public Int32 WriteMemory(long address, float data) + 1 overload
public Int32 WriteMemory(long address, double data) + 1 overload
public Int32 WriteMemory(long address, string data, int stringLength)

Virtual Memory Protect:
public readonly vmProtect ExecReadCopy
public readonly vmProtect ExecReadWrite
public readonly vmProtect ExecRead
public bool VirtualMemoryProtect(IntPtr lpAddress, long dwLength, vmProtect vmAccess) + 3 overloads

ASM Functions:
public void NopAddressRange(long baseAddress, long dwLength)

Misc:
public byte[] ConstructAOB(string szBytes) + 1 overload
public byte[] ReverseByteArray(byte[] array)


To use this DLL, you must add a reference to the DLL (Project > Add Reference > Browse)

Example usage in C# below
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MEC;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        MemEdit myMemEditor = new MemEdit();

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            myMemEditor.mOpenProcess("winmine");
            this.Text = myMemEditor.ReadMemoryInt(0x0100579C).ToString();
            int tInt = myMemEditor.WriteMemory(0x0100579C, 911);
            // Now check minesweeper, lol.
            myMemEditor.mCloseProcess();
        }
    }
}


Example usage in VB.Net below:
Code:
Imports System
 Imports System.Collections.Generic
 Imports System.ComponentModel
 Imports System.Data
 Imports System.Drawing
 Imports System.Text
 Imports System.Windows.Forms
 Imports MEC

Namespace WindowsApplication1
     Public Partial Class Form1
         Inherits Form
         Private myMemEditor As New MemEdit()
       
         Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
             myMemEditor.mOpenProcess("winmine")
             Me.Text = myMemEditor.ReadMemoryInt(16799644).ToString()
             Dim tInt As Integer = myMemEditor.WriteMemory(16799644, 911)
             ' Now check minesweeper, lol.
             myMemEditor.mCloseProcess()
         End Sub
     End Class
End Namespace


Suggestions, questions, comments? Post please! Laughing


Last edited by Estx on Thu Apr 24, 2008 5:55 am; edited 9 times in total
Back to top
View user's profile Send private message
madmunky
Newbie cheater
Reputation: 0

Joined: 08 Mar 2008
Posts: 21

PostPosted: Thu Mar 13, 2008 10:27 am    Post subject: Reply with quote

Very nice! thanks.

Any chance in a VB example Wink
Back to top
View user's profile Send private message
OSIRIS
Grandmaster Cheater
Reputation: 0

Joined: 27 Aug 2006
Posts: 654

PostPosted: Thu Mar 13, 2008 10:36 am    Post subject: Reply with quote

madmunky wrote:
Very nice! thanks.

Any chance in a VB example Wink


A Visual Basic example would be very nice.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Mar 13, 2008 10:43 am    Post subject: Reply with quote

mageknight wrote:
madmunky wrote:
Very nice! thanks.

Any chance in a VB example Wink


A Visual Basic example would be very nice.


Hint: the 2 languages are so similar that you can use a converter.
Back to top
View user's profile Send private message
OSIRIS
Grandmaster Cheater
Reputation: 0

Joined: 27 Aug 2006
Posts: 654

PostPosted: Thu Mar 13, 2008 10:50 am    Post subject: Reply with quote

I just converted it and heres what I got.
Code:

# Imports System
# Imports System.Collections.Generic
# Imports System.ComponentModel
# Imports System.Data
# Imports System.Drawing
# Imports System.Text
# Imports System.Windows.Forms
# Imports MEC
#
# Namespace WindowsApplication1
#     Public Partial Class Form1
#         Inherits Form
#         Private myMemEditor As New MemEdit()
#       
#         Public Sub New()
#             InitializeComponent()
#         End Sub
#       
#         Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
#             myMemEditor.mOpenProcess("winmine")
#             Me.Text = myMemEditor.ReadMemoryInt(16799644).ToString()
#             Dim tInt As Integer = myMemEditor.WriteMemory(16799644, 911)
#             ' Now check minesweeper, lol.
#         End Sub
#     End Class
# End Namespace



But I done understand where I put this code?and the imports?
Back to top
View user's profile Send private message
Haxory'
Grandmaster Cheater Supreme
Reputation: 92

Joined: 30 Jul 2007
Posts: 1900

PostPosted: Thu Mar 13, 2008 11:54 am    Post subject: Reply with quote

export it as a .dll i think

use a .dll inector

_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel
Back to top
View user's profile Send private message
OSIRIS
Grandmaster Cheater
Reputation: 0

Joined: 27 Aug 2006
Posts: 654

PostPosted: Thu Mar 13, 2008 12:03 pm    Post subject: Reply with quote

haxory' wrote:
export it as a .dll i think

use a .dll inector


I think I know what to do with the other part of the code its just this part that is messed.

Code:

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports ME
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Mar 13, 2008 12:22 pm    Post subject: Reply with quote

mageknight wrote:
haxory' wrote:
export it as a .dll i think

use a .dll inector


I think I know what to do with the other part of the code its just this part that is messed.

Code:

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports ME


Estx wrote:
To use this DLL, you must add a reference to the DLL (Project > Add Reference > Browse)
Back to top
View user's profile Send private message
OSIRIS
Grandmaster Cheater
Reputation: 0

Joined: 27 Aug 2006
Posts: 654

PostPosted: Thu Mar 13, 2008 12:24 pm    Post subject: Reply with quote

Ya I did that...but where do I put this code.

Code:


Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports MEC
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Mar 13, 2008 2:03 pm    Post subject: Reply with quote

All the way at the top, it's even there to begin with, minus one line of course. Rolling Eyes
Back to top
View user's profile Send private message
OSIRIS
Grandmaster Cheater
Reputation: 0

Joined: 27 Aug 2006
Posts: 654

PostPosted: Thu Mar 13, 2008 2:41 pm    Post subject: Reply with quote



Why wont that blue line go away.
Back to top
View user's profile Send private message
Estx
Expert Cheater
Reputation: 0

Joined: 04 Mar 2008
Posts: 172

PostPosted: Thu Mar 13, 2008 7:20 pm    Post subject: Reply with quote

Lol, just get rid of Initialize Component, it's not needed in VB I think.

Other than that, the code there will work great. I'll add it to the main post so others can figure it out easily.

To use hex in VB, I think you still use &H.
So instead of: 16799644, you could use &H100579C

Also, haxory it's not to be injected in anything lol. It's for programmers to work with in their development environment (C++/VB6/C#/J++/ASP etc).
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Thu Mar 13, 2008 8:07 pm    Post subject: Reply with quote

1)

@Poster above me:

Who the fuck uses WPM from ASP?

2)

Wtf is a J++?

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
です
Newbie cheater
Reputation: 0

Joined: 09 Feb 2008
Posts: 20

PostPosted: Thu Mar 13, 2008 8:33 pm    Post subject: Reply with quote

J++, I think he means J#, which seems to be a .NET implementation of Java (at least from the sample code that I've seen, it seems like Java, and uses J as it's letter, so...).

Also, quick link: http://msdn2.microsoft.com/en-us/vjsharp/default.aspx
Back to top
View user's profile Send private message
OSIRIS
Grandmaster Cheater
Reputation: 0

Joined: 27 Aug 2006
Posts: 654

PostPosted: Thu Mar 13, 2008 8:48 pm    Post subject: Reply with quote

Im pretty sure there is a language called J++
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites