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 9 - Black Ops 2 (BO2) Hacks & Cheats › Call of Duty Black Ops 2 Coding, Programming & Source Code › BO2 Memory Class [VB]

BO2 Memory Class [VB]

Posts 1–15 of 25 · Page 1 of 2
Jorndel
Jorndel
BO2 Memory Class [VB]
So, since there was an "ask/beg" for this:
Code:
Class BO2_MemoryClass
    Private GameProc As String = ""
    Private Function OpenGame() As IntPtr
        If System.Diagnostics.Process.GetProcessesByName(GameProc).Length = 1 Then
            Return System.Diagnostics.Process.GetProcessesByName(GameProc)(0).Handle
        End If
        Return New IntPtr(0)
    End Function
    Public Enum ProcessAccessFlags As UInteger
        All = &H1F0FFF
        Terminate = &H1
        CreateThread = &H2
        Operation = &H8
        Read = &H10
        Write = &H20
        DupHandle = &H40
        SetInformation = &H200
        QueryInformation = &H400
        Synchronize = &H100000
    End Enum
    <Runtime.InteropServices.DllImport("kernel32.dll")> _
    Private Shared Function OpenProcess(dwDesiredAccess As ProcessAccessFlags, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.Bool)> bInheritHandle As Boolean, dwProcessId As Integer) As IntPtr
    End Function
    <Runtime.InteropServices.DllImport("kernel32.dll")> _
    Private Shared Function CloseHandle(hObject As IntPtr) As Boolean
    End Function
    <Runtime.InteropServices.DllImport("kernel32.dll")> _
    Private Shared Function ReadProcessMemory(hProcess As IntPtr, lpBaseAddress As IntPtr, <Runtime.InteropServices.In, Runtime.InteropServices.Out> buffer As Byte(), size As UInt32, ByRef lpNumberOfBytesWritten As IntPtr) As Int32
    End Function
    <Runtime.InteropServices.DllImport("kernel32.dll")> _
    Private Shared Function WriteProcessMemory(hProcess As IntPtr, lpBaseAddress As IntPtr, <Runtime.InteropServices.In, Runtime.InteropServices.Out> buffer As Byte(), size As UInt32, ByRef lpNumberOfBytesWritten As IntPtr) As Int32
    End Function


    Public Function Process_Handle(ProcessName As String) As Boolean
        GameProc = ProcessName
        If System.Diagnostics.Process.GetProcessesByName(ProcessName).Length = 1 Then
            Return True
        End If
        Return False
    End Function
#Region "Write Stuff"
    Public Sub WriteString(Address As Integer, Text As String, Optional Length As Integer = -1)
        If Length = -1 Then
            Length = Text.Length
        End If
        Dim Buffer As Byte() = New System.Text.ASCIIEncoding().GetBytes(Text)
        Dim Zero As IntPtr = IntPtr.Zero
        WriteProcessMemory(OpenGame(), New IntPtr(Address), Buffer, CUInt(Length), Zero)
    End Sub
    Public Sub WriteInt(Address As Integer, Value As Integer)
        Dim buffer As Byte() = BitConverter.GetBytes(Value)
        Dim R As IntPtr
        WriteProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
    End Sub
    Public Sub WriteUInt(Address As UInteger, Value As UInteger)
        Dim buffer As Byte() = BitConverter.GetBytes(Value)
        Dim R As IntPtr
        WriteProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
    End Sub
    Public Sub WriteFloat(Address As Integer, Value As Single)
        Dim buffer As Byte() = BitConverter.GetBytes(Value)
        Dim R As IntPtr
        WriteProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
    End Sub
    Public Sub WriteBytes(Address As Integer, ByteArray As Byte())
        Dim buffer As Byte() = ByteArray
        Dim R As IntPtr
        WriteProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(buffer.Length), R)
    End Sub
#End Region
#Region "Read Stuff"
    Public Function ReadString(Address As Integer, Length As Integer) As String
        Dim buffer As Byte() = New Byte(Length - 1) {}
        Dim R As IntPtr
        ReadProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(buffer.Length), R)
        Return New System.Text.ASCIIEncoding().GetString(buffer, 0, Length)
    End Function
    Public Function ReadInt(Address As Integer) As Integer
        Dim buffer As Byte() = New Byte(3) {}
        Dim R As IntPtr
        ReadProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
        Return BitConverter.ToInt32(buffer, 0)
    End Function
    Public Function ReadUInt(Address As UInteger) As UInteger
        Dim buffer As Byte() = New Byte(3) {}
        Dim R As IntPtr
        ReadProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
        Return BitConverter.ToUInt32(buffer, 0)
    End Function
    Public Function ReadFloat(Address As UInteger) As Single
        Dim buffer As Byte() = New Byte(7) {}
        Dim R As IntPtr
        ReadProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
        Return BitConverter.ToSingle(buffer, 0)
    End Function
    Public Function ReadBytes(Address As Integer, BytesLength As Integer) As Byte()
        Dim buffer As Byte() = New Byte(BytesLength - 1) {}
        Dim R As IntPtr
        ReadProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(buffer.Length), R)
        Return buffer
    End Function
#End Region
#Region "Pointers"
    Public Function BaseAddress(Module_Name As String) As Integer
        Try
            If System.Diagnostics.Process.GetProcessesByName(GameProc).Length <> 0 Then
                For Each [Mod] As System.Diagnostics.ProcessModule In System.Diagnostics.Process.GetProcessesByName(GameProc)(0).Modules
                    If [Mod].ModuleName = Module_Name Then
                        Return [Mod].BaseAddress.ToInt32()
                    End If
                Next
                Return 0
            Else
                Return 0
            End If
        Catch
            Console.WriteLine("Base Address Error")
            Return 0
        End Try
    End Function
    Public Function Pointers([Module] As String, PointersX As Integer()) As Integer
        Dim Base As Integer = BaseAddress([Module]) + PointersX(0)
        Dim Runner As Integer = ReadInt(Base) + PointersX(1)
        Dim i As Integer = 2
        While i <> PointersX.Length - 2
            Runner = ReadInt(Runner) + PointersX(i)
            i += 1
        End While

        Return Runner
    End Function
#End Region
End Class
#1 · 13y ago
Coper
Coper
Quote Originally Posted by Jorndel View Post
So, since there was an "ask/beg" for this:
Code:
Class BO2_MemoryClass
    Private GameProc As String = ""
    Private Function OpenGame() As IntPtr
        If System.Diagnostics.Process.GetProcessesByName(GameProc).Length = 1 Then
            Return System.Diagnostics.Process.GetProcessesByName(GameProc)(0).Handle
        End If
        Return New IntPtr(0)
    End Function
    Public Enum ProcessAccessFlags As UInteger
        All = &H1F0FFF
        Terminate = &H1
        CreateThread = &H2
        Operation = &H8
        Read = &H10
        Write = &H20
        DupHandle = &H40
        SetInformation = &H200
        QueryInformation = &H400
        Synchronize = &H100000
    End Enum
    <Runtime.InteropServices.DllImport("kernel32.dll")> _
    Private Shared Function OpenProcess(dwDesiredAccess As ProcessAccessFlags, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.Bool)> bInheritHandle As Boolean, dwProcessId As Integer) As IntPtr
    End Function
    <Runtime.InteropServices.DllImport("kernel32.dll")> _
    Private Shared Function CloseHandle(hObject As IntPtr) As Boolean
    End Function
    <Runtime.InteropServices.DllImport("kernel32.dll")> _
    Private Shared Function ReadProcessMemory(hProcess As IntPtr, lpBaseAddress As IntPtr, <Runtime.InteropServices.In, Runtime.InteropServices.Out> buffer As Byte(), size As UInt32, ByRef lpNumberOfBytesWritten As IntPtr) As Int32
    End Function
    <Runtime.InteropServices.DllImport("kernel32.dll")> _
    Private Shared Function WriteProcessMemory(hProcess As IntPtr, lpBaseAddress As IntPtr, <Runtime.InteropServices.In, Runtime.InteropServices.Out> buffer As Byte(), size As UInt32, ByRef lpNumberOfBytesWritten As IntPtr) As Int32
    End Function


    Public Function Process_Handle(ProcessName As String) As Boolean
        GameProc = ProcessName
        If System.Diagnostics.Process.GetProcessesByName(ProcessName).Length = 1 Then
            Return True
        End If
        Return False
    End Function
#Region "Write Stuff"
    Public Sub WriteString(Address As Integer, Text As String, Optional Length As Integer = -1)
        If Length = -1 Then
            Length = Text.Length
        End If
        Dim Buffer As Byte() = New System.Text.ASCIIEncoding().GetBytes(Text)
        Dim Zero As IntPtr = IntPtr.Zero
        WriteProcessMemory(OpenGame(), New IntPtr(Address), Buffer, CUInt(Length), Zero)
    End Sub
    Public Sub WriteInt(Address As Integer, Value As Integer)
        Dim buffer As Byte() = BitConverter.GetBytes(Value)
        Dim R As IntPtr
        WriteProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
    End Sub
    Public Sub WriteUInt(Address As UInteger, Value As UInteger)
        Dim buffer As Byte() = BitConverter.GetBytes(Value)
        Dim R As IntPtr
        WriteProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
    End Sub
    Public Sub WriteFloat(Address As Integer, Value As Single)
        Dim buffer As Byte() = BitConverter.GetBytes(Value)
        Dim R As IntPtr
        WriteProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
    End Sub
    Public Sub WriteBytes(Address As Integer, ByteArray As Byte())
        Dim buffer As Byte() = ByteArray
        Dim R As IntPtr
        WriteProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(buffer.Length), R)
    End Sub
#End Region
#Region "Read Stuff"
    Public Function ReadString(Address As Integer, Length As Integer) As String
        Dim buffer As Byte() = New Byte(Length - 1) {}
        Dim R As IntPtr
        ReadProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(buffer.Length), R)
        Return New System.Text.ASCIIEncoding().GetString(buffer, 0, Length)
    End Function
    Public Function ReadInt(Address As Integer) As Integer
        Dim buffer As Byte() = New Byte(3) {}
        Dim R As IntPtr
        ReadProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
        Return BitConverter.ToInt32(buffer, 0)
    End Function
    Public Function ReadUInt(Address As UInteger) As UInteger
        Dim buffer As Byte() = New Byte(3) {}
        Dim R As IntPtr
        ReadProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
        Return BitConverter.ToUInt32(buffer, 0)
    End Function
    Public Function ReadFloat(Address As UInteger) As Single
        Dim buffer As Byte() = New Byte(7) {}
        Dim R As IntPtr
        ReadProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(4), R)
        Return BitConverter.ToSingle(buffer, 0)
    End Function
    Public Function ReadBytes(Address As Integer, BytesLength As Integer) As Byte()
        Dim buffer As Byte() = New Byte(BytesLength - 1) {}
        Dim R As IntPtr
        ReadProcessMemory(OpenGame(), New IntPtr(Address), buffer, CUInt(buffer.Length), R)
        Return buffer
    End Function
#End Region
#Region "Pointers"
    Public Function BaseAddress(Module_Name As String) As Integer
        Try
            If System.Diagnostics.Process.GetProcessesByName(GameProc).Length <> 0 Then
                For Each [Mod] As System.Diagnostics.ProcessModule In System.Diagnostics.Process.GetProcessesByName(GameProc)(0).Modules
                    If [Mod].ModuleName = Module_Name Then
                        Return [Mod].BaseAddress.ToInt32()
                    End If
                Next
                Return 0
            Else
                Return 0
            End If
        Catch
            Console.WriteLine("Base Address Error")
            Return 0
        End Try
    End Function
    Public Function Pointers([Module] As String, PointersX As Integer()) As Integer
        Dim Base As Integer = BaseAddress([Module]) + PointersX(0)
        Dim Runner As Integer = ReadInt(Base) + PointersX(1)
        Dim i As Integer = 2
        While i <> PointersX.Length - 2
            Runner = ReadInt(Runner) + PointersX(i)
            i += 1
        End While

        Return Runner
    End Function
#End Region
End Class
Thx jorndel now get ready for my new black ops 2 hack yea!!
#2 · 13y ago
HiMM4
HiMM4
wtf is this xd
#3 · 13y ago
Jorndel
Jorndel
Quote Originally Posted by HiMM4 View Post
wtf is this xd


If you don't know what this is, then you're in the wrong section mate

This is for coders/hackers.
This is a class that will allow coders to write hacks, and hack the game with memory editing.
#4 · 13y ago
HiMM4
HiMM4
looks very complicated
#5 · 13y ago
Jorndel
Jorndel
Quote Originally Posted by HiMM4 View Post
looks very complicated
That's why I did the "hardcore" work, and you can have fun :P

What you do now is just: WriteInteger(&H12345, 9999)
For 9999 ammo for your current weapon. (Fake address: Address = &H12345 )


---------- Post added at 07:59 PM ---------- Previous post was at 07:59 PM ----------

Quote Originally Posted by HiMM4 View Post
looks very complicated
If you want to learn: I'm able to help
#6 · 13y ago
MarkHC
MarkHC
Quote Originally Posted by Jorndel View Post

That's why I did the "hardcore" work, and you can have fun :P
Yeah cause WriteProcessMemory is so hardcore.
 
.
Just kidding, lub you


Quote Originally Posted by HiMM4 View Post
looks very complicated
It isn't after you learn the basics ^^
#7 · 13y ago
Jorndel
Jorndel
Quote Originally Posted by -InSaNe- View Post
Yeah cause WriteProcessMemory is so hardcore.
 
.
Just kidding, lub you



It isn't after you learn the basics ^^

Why I used: " "

#8 · 13y ago
MarkHC
MarkHC
Btw, just something I noticed, you're P/Invoking OpenProcess but not even using it Not that it'd make any difference to remove it but oh well.. I just wanted to point that out
#9 · 13y ago
Jorndel
Jorndel
Quote Originally Posted by -InSaNe- View Post
Btw, just something I noticed, you're P/Invoking OpenProcess but not even using it Not that it'd make any difference to remove it but oh well.. I just wanted to point that out
Hmmmzzzz
Fine then..

I'll do a new one then
#10 · 13y ago
HiMM4
HiMM4
ahah no ty dont want to learn it just want to use them
#11 · 13y ago
Horror
Horror
Quote Originally Posted by -InSaNe- View Post
Btw, just something I noticed, you're P/Invoking OpenProcess but not even using it Not that it'd make any difference to remove it but oh well.. I just wanted to point that out
*Using old memory class of jorni*
I saw it once, no idea what it does
#12 · 13y ago
Jorndel
Jorndel
Quote Originally Posted by Isaakske View Post

*Using old memory class of jorni*
I saw it once, no idea what it does
Wasn't I to update it for you?
Or you don't want that? :S
#13 · 13y ago
Horror
Horror
Quote Originally Posted by Jorndel View Post


Wasn't I to update it for you?
Or you don't want that? :S
Im fine with the old one
#14 · 13y ago
AB
abdulmailk
how to use ??
#15 · 13y ago
Posts 1–15 of 25 · Page 1 of 2

Post a Reply

Similar Threads

  • C# Memory Class (Writen by Jorndel)By Jorndel in Call of Duty Modern Warfare 3 Coding, Programming & Source Code
    12Last post 7y ago
  • VB.Net Memory Class (Writen by Jorndel)By Jorndel in Call of Duty Modern Warfare 3 Coding, Programming & Source Code
    25Last post 8y ago
  • c# memory classBy xXFleshpoundXx in C# Programming
    8Last post 13y ago
  • memory classBy Coper in Call of Duty Black Ops 2 Help
    5Last post 13y ago
  • Memory Hack base Using Classes Help I Don't Get ItBy kmanev073 in CrossFire Hack Coding / Programming / Source Code
    10Last post 14y ago

Tags for this Thread

None