Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › MultiPlayer Game Hacks & Cheats › Call of Duty Hacks & Cheats › Call of Duty 10 - Ghosts Hacks & Cheats › Call of Duty Ghosts Coding & Resources › VB.NET Memory Module v2 by master131 [x86/x64 Compatible]

VB.NET Memory Module v2 by master131 [x86/x64 Compatible]

Posts 1–15 of 125 · Page 1 of 9
…
master131
[MPGH]master131
VB.NET Memory Module v2 by master131 [x86/x64 Compatible]
Because so many people seem to have so much trouble finding a 32-bit and 64-bit compatible memory module since the most commonly used one is just downright wrong, I'm posting this which is based off v1 with fixes/updates based on user suggestion/response.

It supports ANY 'primitive' value type, the most common one you guys will be using is probably: Integer, Single (Float) and String (string is not a primitive type but it's still supported). You can also read Byte() too (byte array), make sure to indicate how many bytes you want to read though.

Here's a full list if you're interested: Boolean, Byte, SByte, Int16 (Short), UInt16 (UShort), Int32 (Integer), UInt32 (UInteger), Int64 (Long), UInt64 (ULong), IntPtr, UIntPtr, Char, Double, and Single (Float).

Here's the code:
Code:
Option Strict On

Imports System.Runtime.InteropServices
Imports System.Text

Module MemoryModule
    <DllImport("kernel32.dll")> _
    Private Function OpenProcess(ByVal dwDesiredAccess As UInteger, <MarshalAs(UnmanagedType.Bool)> ByVal bInheritHandle As Boolean, ByVal dwProcessId As Integer) As IntPtr
    End Function

    <DllImport("kernel32.dll", SetLastError:=True)> _
    Private Function WriteProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As Byte(), ByVal nSize As IntPtr, <Out()> ByRef lpNumberOfBytesWritten As IntPtr) As Boolean
    End Function

    <DllImport("kernel32.dll", SetLastError:=True)> _
    Private Function ReadProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, <Out()> ByVal lpBuffer() As Byte, ByVal dwSize As IntPtr, ByRef lpNumberOfBytesRead As IntPtr) As Boolean
    End Function

    <DllImport("kernel32.dll", SetLastError:=True)>
    Private Function CloseHandle(ByVal hObject As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
    End Function

    Private Const PROCESS_VM_WRITE As UInteger = &H20
    Private Const PROCESS_VM_READ As UInteger = &H10
    Private Const PROCESS_VM_OPERATION As UInteger = &H8
    Private TargetProcess As String = "iw6mp64_ship"
    Private ProcessHandle As IntPtr = IntPtr.Zero
    Private LastKnownPID As Integer = -1

    Private Function ProcessIDExists(ByVal pID As Integer) As Boolean
        For Each p As Process In Process.GetProcessesByName(TargetProcess)
            If p.ID = pID Then Return True
        Next
        Return False
    End Function

    Public Sub SetProcessName(ByVal processName As String)
        TargetProcess = processName
        If ProcessHandle <> IntPtr.Zero Then CloseHandle(ProcessHandle)
        LastKnownPID = -1
        ProcessHandle = IntPtr.Zero
    End Sub

    Public Function GetCurrentProcessName() As String
        Return TargetProcess
    End Function

    Public Function UpdateProcessHandle() As Boolean
        If LastKnownPID = -1 OrElse Not ProcessIDExists(LastKnownPID) Then
            If ProcessHandle <> IntPtr.Zero Then CloseHandle(ProcessHandle)
            Dim p() As Process = Process.GetProcessesByName(TargetProcess)
            If p.Length = 0 Then Return False
            LastKnownPID = p(0).Id
            ProcessHandle = OpenProcess(PROCESS_VM_READ Or PROCESS_VM_WRITE Or PROCESS_VM_OPERATION, False, p(0).Id)
            If ProcessHandle = IntPtr.Zero Then Return False
        End If
        Return True
    End Function

    Public Function ReadMemory(Of T)(ByVal address As Object) As T
        Return ReadMemory(Of T)(CLng(address))
    End Function

    Public Function ReadMemory(Of T)(ByVal address As Integer) As T
        Return ReadMemory(Of T)(New IntPtr(address), 0, False)
    End Function

    Public Function ReadMemory(Of T)(ByVal address As Long) As T
        Return ReadMemory(Of T)(New IntPtr(address), 0, False)
    End Function

    Public Function ReadMemory(Of T)(ByVal address As IntPtr) As T
        Return ReadMemory(Of T)(address, 0, False)
    End Function

    Public Function ReadMemory(ByVal address As IntPtr, ByVal length As Integer) As Byte()
        Return ReadMemory(Of Byte())(address, length, False)
    End Function

    Public Function ReadMemory(ByVal address As Integer, ByVal length As Integer) As Byte()
        Return ReadMemory(Of Byte())(New IntPtr(address), length, False)
    End Function

    Public Function ReadMemory(ByVal address As Long, ByVal length As Integer) As Byte()
        Return ReadMemory(Of Byte())(New IntPtr(address), length, False)
    End Function

    Public Function ReadMemory(Of T)(ByVal address As IntPtr, ByVal length As Integer, ByVal unicodeString As Boolean) As T
        Dim buffer() As Byte
        If GetType(T) Is GetType(String) Then
            If unicodeString Then buffer = New Byte(length * 2 - 1) {} Else buffer = New Byte(length - 1) {}
        ElseIf GetType(T) Is GetType(Byte()) Then
            buffer = New Byte(length - 1) {}
        Else
            buffer = New Byte(Marshal.SizeOf(GetType(T)) - 1) {}
        End If
        If Not UpdateProcessHandle() Then Return Nothing
        Dim success As Boolean = ReadProcessMemory(ProcessHandle, address, buffer, New IntPtr(buffer.Length), IntPtr.Zero)
        If Not success Then Return Nothing
        If GetType(T) Is GetType(Byte()) Then Return CType(CType(buffer, Object), T)
        If GetType(T) Is GetType(String) Then
            If unicodeString Then Return CType(CType(Encoding.Unicode.GetString(buffer), Object), T)
            Return CType(CType(Encoding.ASCII.GetString(buffer), Object), T)
        End If
        Dim gcHandle As GCHandle = gcHandle.Alloc(buffer, GCHandleType.Pinned)
        Dim returnObject As T = CType(Marshal.PtrToStructure(gcHandle.AddrOfPinnedObject, GetType(T)), T)
        gcHandle.Free()
        Return returnObject
    End Function

    Private Function GetObjectBytes(ByVal value As Object) As Byte()
        If value.GetType() Is GetType(Byte()) Then Return CType(value, Byte())
        Dim buffer(Marshal.SizeOf(value) - 1) As Byte
        Dim ptr As IntPtr = Marshal.AllocHGlobal(buffer.Length)
        Marshal.StructureToPtr(value, ptr, True)
        Marshal.Copy(ptr, buffer, 0, buffer.Length)
        Marshal.FreeHGlobal(ptr)
        Return buffer
    End Function

    Public Function WriteMemory(Of T)(ByVal address As Object, ByVal value As T) As Boolean
        Return WriteMemory(CLng(address), value)
    End Function

    Public Function WriteMemory(Of T)(ByVal address As Object, ByVal value As Object) As Boolean
        Return WriteMemory(CLng(address), CType(value, T))
    End Function

    Public Function WriteMemory(Of T)(ByVal address As Integer, ByVal value As T) As Boolean
        Return WriteMemory(New IntPtr(address), value)
    End Function

    Public Function WriteMemory(Of T)(ByVal address As Integer, ByVal value As Object) As Boolean
        Return WriteMemory(address, CType(value, T))
    End Function

    Public Function WriteMemory(Of T)(ByVal address As Long, ByVal value As T) As Boolean
        Return WriteMemory(New IntPtr(address), value)
    End Function

    Public Function WriteMemory(Of T)(ByVal address As Long, ByVal value As Object) As Boolean
        Return WriteMemory(address, CType(value, T))
    End Function

    Public Function WriteMemory(Of T)(ByVal address As IntPtr, ByVal value As T) As Boolean
        Return WriteMemory(address, value, False)
    End Function

    Public Function WriteMemory(Of T)(ByVal address As IntPtr, ByVal value As Object) As Boolean
        Return WriteMemory(address, CType(value, T), False)
    End Function

    Public Function WriteMemory(Of T)(ByVal address As Object, ByVal value As T, ByVal unicode As Boolean) As Boolean
        Return WriteMemory(CLng(address), value, unicode)
    End Function

    Public Function WriteMemory(Of T)(ByVal address As Integer, ByVal value As T, ByVal unicode As Boolean) As Boolean
        Return WriteMemory(New IntPtr(address), value, unicode)
    End Function

    Public Function WriteMemory(Of T)(ByVal address As Long, ByVal value As T, ByVal unicode As Boolean) As Boolean
        Return WriteMemory(New IntPtr(address), value, unicode)
    End Function

    Public Function WriteMemory(Of T)(ByVal address As IntPtr, ByVal value As T, ByVal unicode As Boolean) As Boolean
        If Not UpdateProcessHandle() Then Return False
        Dim buffer() As Byte
        If TypeOf value Is String Then
            If unicode Then buffer = Encoding.Unicode.GetBytes(value.ToString()) Else buffer = Encoding.ASCII.GetBytes(value.ToString())
        Else
            buffer = GetObjectBytes(value)
        End If
        Dim result As Boolean = WriteProcessMemory(ProcessHandle, address, buffer, New IntPtr(buffer.Length), IntPtr.Zero)
        Return result
    End Function
End Module
How do I use the code?
Right-click on your project and Add > Module. Call it MemoryModule.vb or whatever you like. Then copy the code above and paste it into the new module (replace everything). If you want to use this module on another process, replace "iw6mp64_ship" with whatever you want next to 'TargetProcess'.

How do you change the process during runtime?
I've added a function called "SetProcessName" which allows you to do that.

Example:
Code:
SetProcessName("iw6sp64_ship")
How do you know what the current process is set to?
Use the "GetCurrentProcessName" function.

How do I know if the process/game is open?
There's a function called "UpdateProcessHandle" which returns a boolean saying if the game is active or not.

Example (in a timer):
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If UpdateProcessHandle() Then ' Check if the game is running
' Do stuff here, like writing/reading memory or telling a user in a Label the game is open.
End If
End Sub

How do I read or write memory?
Version 1 of the memory module made things a little complicated for writing memory but this version tries to fix that. To read or write memory, you use the "ReadMemory" or "WriteMemory" functions.

' Reads the value from 0x12345678 as an Integer
Dim myIntValue As Integer = ReadMemory(Of Integer)(&H12345678)

' Reads the value from 0x12345678 as a Single (remember that Single is the same as Float)
Dim myFloatValue As Single = ReadMemory(Of Single)(&H12345678)

' Reads 10 characters at 0x12345678 as an ASCII String
Dim myASCIIStringValue As String = ReadMemory(Of String)(&H12345678, 10, False)

' Reads 10 characters at 0x12345678 as a Unicode String
Dim myUnicodeStringValue As String = ReadMemory(Of String)(&H12345678, 10, True)

' Reads 12 bytes from 0x12345678
Dim myByteData() As Byte = ReadMemory(&H12345678, 12)

' Writes 10 as an Integer to 0x12345678
WriteMemory(Of Integer)(&H12345678, 10)

' Writes 0.5 as a Single/Float to 0x12345678
WriteMemory(Of Single)(&H12345678, 0.5)

' Writes Hello World as an ASCII string to 0x12345678 (the + vbNullChar erases the rest of the old string)
WriteMemory(Of String)(&H12345678, "Hello World" + vbNullChar, False)

' Writes Hello World as a Unicode string to 0x12345678 (the + vbNullChar erases the rest of the old string)
WriteMemory(Of String)(&H12345678, "Hello World" + vbNullChar, True)

' Writes '0x90, 0x90, 0x90, 0x90' as a byte array to 0x12345678
WriteMemory(&H12345678, New Byte() { &H90, &H90, &H90, &H90 })


How do I read or write a number into memory if I'm going to get it from a textbox or a string?
Since VB.NET (by default) doesn't care much about types (they are converted automatically), you should be able to get away with this:

' Reads the integer from the address inside TextBox1 (warning: the string must start with &H if its an address/hex value)
Dim myIntValue As Integer = ReadMemory(Of Integer)("&H" + TextBox1.Text)

' Writes the value from TextBox1 into 0x12345678 as an integer
WriteMemory(Of Integer)(&H12345678, TextBox1.Text)

' Writes the value from TextBox1 into 0x12345678 as a single/float
WriteMemory(Of Single)(&H12345678, TextBox1.Text)

' Writes 10 into the address inside TextBox1 as an integer (warning: the string must start with &H if its an address/hex value)
WriteMemory(Of Integer)("&H" + TextBox1.Text, 10)


What's the difference between a ASCII and Unicode string?
Unicode strings use 2 bytes for every letter it uses and ASCII only uses 1 byte for every letter. If you find a string in memory with Cheat Engine with the Unicode box unticked then it's a ASCII string. If the Unicode box is ticked then it's a Unicode string.
#1 · edited 12y ago · 12y ago
uhZylon
uhZylon
If only this was here before i made my current hack. Would've been so much easier!
Great release as always!
#2 · 12y ago
BL
Blakesito
Does anyone know if the ghost external ESP v1.1.1 keeps working aftef they added regular snd? The game version hasn't changed but i had to update :S
#3 · 12y ago
uhZylon
uhZylon
Quote Originally Posted by Blakesito View Post
Does anyone know if the ghost external ESP v1.1.1 keeps working aftef they added regular snd? The game version hasn't changed but i had to update :S
Because it was just a playlist update. Not a patch
#4 · 12y ago
distiny
distiny
It'll help a lot of people starting. good job
#5 · 12y ago
GT
gteuk
Good release master now everyone will be writing in VB

I am still using my old one with 2 function updates but good to see your method as it offers users more
#6 · 12y ago
master131
[MPGH]master131
Quote Originally Posted by gteuk View Post
Good release master now everyone will be writing in VB

I am still using my old one with 2 function updates but good to see your method as it offers users more
I'm still going to stick to C# though.
#7 · 12y ago
LO
lordxchris
I cant get this to work :C do you think you could upload a small sample code that does something simple like god mode and ill learn from that id love you forever <3
#8 · 12y ago
LO
Lovroman
Quote Originally Posted by lordxchris View Post
I cant get this to work :C do you think you could upload a small sample code that does something simple like god mode and ill learn from that id love you forever <3
IMO, master gave enough examples:

Can you show us errors/problems so we can help you ?
#9 · 12y ago
LO
lordxchris
Ok i actually got it to work i had it set to onload not on click but how could i make a set and freeze function ?
#10 · 12y ago
LO
lordxchris
Ok so i made a trainer that worked on another game just to test but when i change the process back to ghosts and change the memory adress for the thing im trying to change i get this error

System.OverflowException was unhandled
Message=Arithmetic operation resulted in an overflow.
Source=mscorlib
StackTrace:
at System.IntPtr..ctor(Int64 value)
at WindowsApplication1.MemoryModule.WriteMemory[T](Int64 address, T value) in C:\Users\Vinyl Scratch\AppData\Local\Temporary Projects\WindowsApplication1\Module1.vb:line 138
at WindowsApplication1.MemoryModule.WriteMemory[T](Int64 address, Object value) in C:\Users\Vinyl Scratch\AppData\Local\Temporary Projects\WindowsApplication1\Module1.vb:line 142
at WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e) in C:\Users\Vinyl Scratch\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb:line 4
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
#11 · 12y ago
LO
Lovroman
Quote Originally Posted by lordxchris View Post
Ok so i made a trainer that worked on another game just to test but when i change the process back to ghosts and change the memory adress for the thing im trying to change i get this error

System.OverflowException was unhandled
Message=Arithmetic operation resulted in an overflow.
Is your project set to x64 ?
#12 · 12y ago
LO
Lovroman
Quote Originally Posted by lordxchris View Post
Ok i actually got it to work i had it set to onload not on click but how could i make a set and freeze function ?
Use Timer(find it on toolbox).
#13 · 12y ago
LO
lordxchris
Thanks i have to get a diffrent version of vb to set it to x64 so that should do it
#14 · 12y ago
LO
Lovroman
Quote Originally Posted by lordxchris View Post
Thanks i have to get a diffrent version of vb to set it to x64 so that should do it
Why ? :O
Can't you just do this:
Go to the Build Menu->then click Configuration Manager->under Active solution platform->click New->add one with x64 as the platform. Use this platform to compile for x64.
If Config Manager isn't enabled do this:
Tools->Options->Projects and Solutions->General->Show advanced build configurations
#15 · 12y ago
Posts 1–15 of 125 · Page 1 of 9
…

Post a Reply

Similar Threads

  • VB.NET Memory Module (by master131)By master131 in Call of Duty Modern Warfare 3 Coding, Programming & Source Code
    6Last post 13y ago
  • VB.NET Memory Module [by master131] helpBy zxpwds in Call of Duty Modern Warfare 3 Coding, Programming & Source Code
    3Last post 12y ago
  • [VB.NET] Memory Hacking using themaster131 Memory ModuleBy elmasmalo1 in Visual Basic Programming
    0Last post 11y ago
  • [Release] VB.Net Undetected Module Maker by PheNixBy PheNix in Visual Basic Programming
    20Last post 16y ago
  • vb.net (vb2005) module maker or tutorialBy FrancYescO in Visual Basic Programming
    0Last post 18y ago

Tags for this Thread

None