Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    wolfguardiann's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    112
    Reputation
    9
    Thanks
    1
    My Mood
    Happy

    Open process memory [read/wirte to it]

    well , how do i do that in vb ?

    i know how to do in C++ , but , how do i do that in vb?? can someone put a simple snippet or , a simple program/lines or w/e for like , hmmm... idk , reading values from pinball , or , w/e?


    tyvm!! happy hacking , ty for suppport;
    1) You are on the internet
    2) You are visiting MPGH
    3) You are reading my signature
    5) You didn't noticed that point 4 is missing
    6) You just checked for point 4
    7) You are smiling

    Respect List:
    aanthonyz < you will forever belong on my list!

  2. #2
    willrulz188's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Ohio?
    Posts
    1,786
    Reputation
    35
    Thanks
    231
    My Mood
    Amazed
    Quote Originally Posted by NovaSynth View Post
    This is my memory editing snippet. Just place this code inside a module and use it in your programs if you wish Unfortunatly, i had coded this module in vb6, so not every command will work with vb.net. You may translate if you wish, i just ask that you re-post for others to use.


    ~~~~~Declarations~~~~~
    [highlight=vbnet] Public Const PROCESS_ALL_ACCESS = &H1F0FFF
    Dim f1holder As Integer
    Dim timer_pos As Long
    Dim hProcess As Long

    Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal SomeValueIsStoredHere As Long, ByVal lpdwProcessId As Long) As Long
    Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
    Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Object, ByVal lpBuffer As Object, ByVal nSize As Long, ByVal lpNumberOfBytesWritten As Long) As Long
    Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
    Public Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer
    Public Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Object, ByRef lpBuffer As Object, ByVal nSize As Long, ByVal lpNumberOfBytesWritten As Long) As Long[/highlight]


    ~~~~~Module~~~~~
    [highlight=vbnet] Public Function WriteALong(ByVal TheGame As String, ByVal TheAddress As Long, ByVal ThisIsTheValue As Long)
    Dim SomeValueIsStoredHere As Long
    Dim SomeValueIsStoredHereToo As Long
    Dim SomeValue As Long
    SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
    GetWindowThreadProcessId(SomeValueIsStoredHere, SomeValueIsStoredHereToo)
    SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
    If (SomeValue = 0) Then
    Exit Function
    End If
    WriteProcessMemory(SomeValue, TheAddress, ThisIsTheValue, 4, 0&)
    CloseHandle(hProcess)
    End Function[/highlight]
    [highlight=vbnet] Public Function ReadALong(ByVal TheGame As String, ByVal TheAddress As Long, ByVal TheValue As Long)
    Dim SomeValueIsStoredHere As Long
    Dim SomeValueIsStoredHereToo As Long
    Dim SomeValue As Long
    SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
    GetWindowThreadProcessId(SomeValueIsStoredHere, SomeValueIsStoredHereToo)
    SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
    If (SomeValue = 0) Then
    Exit Function
    End If
    ReadProcessMem(SomeValue, TheAddress, TheValue, 4, 0&)
    CloseHandle(hProcess)
    End Function[/highlight]
    [highlight=vbnet] Public Function ReadAFloat(ByVal TheGame As String, ByVal TheAddress As Long, ByVal TheValue As Single)
    Dim SomeValueIsStoredHere As Long
    Dim SomeValueIsStoredHereToo As Long
    Dim SomeValue As Long
    SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
    GetWindowThreadProcessId(SomeValueIsStoredHere, SomeValueIsStoredHereToo)
    SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
    If (SomeValue = 0) Then
    Exit Function
    End If
    ReadProcessMem(SomeValue, TheAddress, TheValue, 4, 0&)
    CloseHandle(hProcess)
    End Function[/highlight]
    [highlight=vbnet] Public Function WriteAFloat(ByVal TheGame As String, ByVal TheAddress As Long, ByVal ThisIsTheValue As Single)
    Dim SomeValueIsStoredHere As Long
    Dim SomeValueIsStoredHereToo As Long
    Dim SomeValue As Long
    SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
    GetWindowThreadProcessId(SomeValueIsStoredHere, SomeValueIsStoredHereToo)
    SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
    If (SomeValue = 0) Then
    Exit Function
    End If
    WriteProcessMemory(SomeValue, TheAddress, ThisIsTheValue, 4, 0&)
    CloseHandle(hProcess)
    End Function[/highlight]


    ~~~~~Instructions~~~~~
    Alright. In order for this to work, im gonna show you a quick example using that cheezy little Pinball game that comes with Windows XP.

    lets say we turned the game on and made a button that we set the button command to this: [highlight=vbnet]
    Private Sub Command1_Click()
    Call WriteALong("3D Pinball for Windows, Space Cadet", &HA12EF4, 999999)
    Call WriteALong("3D Pinball for Windows, Space Cadet", &HB8AEBA, 999999)
    End Sub
    [/highlight]

    Basically what the code means, is that i Called the function "WriteALong" from the module that is just above. "3D Pinball for Windows, Space Cadet" is the window title, &HB8AEBA is the address. "999999" is the value you set that specific address to.

    *Note: Add &H instead of the 2 00 (two zero's), Here's an example: Your address is 00L1FD4. You need to replace the 00 (two zero's) with an &H , then you would get this: &HL1FD4. If there is only 1 0 at the beginning then just replace it with an &. If there are no zero's at the beginning then this rule does not apply.


    And thats it!

    oh and p.s. This is basically how people use VB and make trainers for games and such.
    Here

    //short
    Question ALL statements! ?
    You're in denial that you're in denial. ?
    [img]https://i360.photobucke*****m/albums/oo45/blood188/Untitled-3.jpg?t=1284590977[/img]

  3. The Following User Says Thank You to willrulz188 For This Useful Post:

    wolfguardiann (06-28-2011)

  4. #3
    wolfguardiann's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    112
    Reputation
    9
    Thanks
    1
    My Mood
    Happy
    tyvm , willruz , ill take a look whenever i can , im busy on job now lol , Thanked.


    Edit: can i use that on vb 2008 ? cuz its 2006 , jut saw :P
    Last edited by wolfguardiann; 06-28-2011 at 09:51 AM.
    1) You are on the internet
    2) You are visiting MPGH
    3) You are reading my signature
    5) You didn't noticed that point 4 is missing
    6) You just checked for point 4
    7) You are smiling

    Respect List:
    aanthonyz < you will forever belong on my list!

  5. #4
    'Bruno's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Portugal
    Posts
    2,883
    Reputation
    290
    Thanks
    1,036
    My Mood
    Busy
    spoonfeed party
    Light travels faster than sound. That's why most people seem bright until you hear them speak.

  6. #5
    willrulz188's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Ohio?
    Posts
    1,786
    Reputation
    35
    Thanks
    231
    My Mood
    Amazed
    Quote Originally Posted by Brinuz View Post
    spoonfeed party
    quoting isn't a hard job when you know where it is plus he needs to edit it
    ____

    but next time google it like
    Code:
    site:mpgh.net Memory editing in visual basic
    its not hard at all

    Close?
    Last edited by willrulz188; 06-28-2011 at 10:53 AM.
    Question ALL statements! ?
    You're in denial that you're in denial. ?
    [img]https://i360.photobucke*****m/albums/oo45/blood188/Untitled-3.jpg?t=1284590977[/img]

  7. #6
    'Bruno's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Portugal
    Posts
    2,883
    Reputation
    290
    Thanks
    1,036
    My Mood
    Busy
    Quote Originally Posted by willrulz188 View Post
    quoting isn't a hard job when you know where it is plus he needs to edit it
    ____

    but next time google it like
    Code:
    site:mpgh.net Memory editing in visual basic
    its not hard at all

    Close?
    i google it? I wont for sure...
    Mainly because the OP should be the ONE googling it, second because i already know it.. but yea sure.. :X
    Light travels faster than sound. That's why most people seem bright until you hear them speak.

  8. #7
    wolfguardiann's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    112
    Reputation
    9
    Thanks
    1
    My Mood
    Happy
    yep , ive tryed usigg

    site:mpgh.net Memory editing in visual basic

    that was another help thread, but , i just didntget it , i get lots of errors , i need imports , and sheet , idk , it gives me errors


    EDit: yeah , thats vb 2006 unfortunatelly , i need to vb 2008 :/ , vb 2006 is like old , but , to vb 2008 , what does change?
    Last edited by wolfguardiann; 06-28-2011 at 12:11 PM.
    1) You are on the internet
    2) You are visiting MPGH
    3) You are reading my signature
    5) You didn't noticed that point 4 is missing
    6) You just checked for point 4
    7) You are smiling

    Respect List:
    aanthonyz < you will forever belong on my list!

  9. #8
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by wolfguardiann View Post
    yep , ive tryed usigg

    site:mpgh.net Memory editing in visual basic

    that was another help thread, but , i just didntget it , i get lots of errors , i need imports , and sheet , idk , it gives me errors


    EDit: yeah , thats vb 2006 unfortunatelly , i need to vb 2008 :/ , vb 2006 is like old , but , to vb 2008 , what does change?
    Lol VB2006? no such thing.

    VS 2005 was still VB.NET, albeit around .NET2.0 or some shit.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  10. #9
    willrulz188's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Ohio?
    Posts
    1,786
    Reputation
    35
    Thanks
    231
    My Mood
    Amazed
    Quote Originally Posted by Brinuz View Post
    i google it? I wont for sure...
    Mainly because the OP should be the ONE googling it, second because i already know it.. but yea sure.. :X
    lol only this was too you..the rest was too the op

    Quote Originally Posted by willrulz188 View Post
    quoting isn't a hard job when you know where it is plus he needs to edit it
    Question ALL statements! ?
    You're in denial that you're in denial. ?
    [img]https://i360.photobucke*****m/albums/oo45/blood188/Untitled-3.jpg?t=1284590977[/img]

  11. #10
    wolfguardiann's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    112
    Reputation
    9
    Thanks
    1
    My Mood
    Happy
    Originally Posted by NovaSynth View Post
    This is my memory editing snippet. Just place this code inside a module and use it in your programs if you wish Unfortunatly, i had coded this module in vb6, so not every command will work with vb.net. You may translate if you wish, i just ask that you re-post for others to use.


    see its vb 2006 :P , and i tryed searching on google , but didnt found anything. i need an vb 2008 example :/
    1) You are on the internet
    2) You are visiting MPGH
    3) You are reading my signature
    5) You didn't noticed that point 4 is missing
    6) You just checked for point 4
    7) You are smiling

    Respect List:
    aanthonyz < you will forever belong on my list!

  12. #11
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by wolfguardiann View Post
    Originally Posted by NovaSynth View Post
    This is my memory editing snippet. Just place this code inside a module and use it in your programs if you wish Unfortunatly, i had coded this module in vb6, so not every command will work with vb.net. You may translate if you wish, i just ask that you re-post for others to use.


    see its vb 2006 :P , and i tryed searching on google , but didnt found anything. i need an vb 2008 example :/
    VB6 is Visual Basic 6.0, which is pre-2002.

    I'll write a VB.NET example tomorrow, it's 4am now.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  13. #12
    wolfguardiann's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    112
    Reputation
    9
    Thanks
    1
    My Mood
    Happy
    ok ty , just ofr u know , im using " Visual Basic 2008 Express edition "
    1) You are on the internet
    2) You are visiting MPGH
    3) You are reading my signature
    5) You didn't noticed that point 4 is missing
    6) You just checked for point 4
    7) You are smiling

    Respect List:
    aanthonyz < you will forever belong on my list!

  14. #13
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    First import the InteropServices namespace
    [highlight=vb.net]
    Imports System.Runtime.InteropServices
    [/highlight]

    Next come the imports and functions
    [highlight=vb.net]
    <DllImport("kernel32.dll", SetLastError:=True)> _
    Public Shared Function WriteProcessMemory(ByVal hProcess As Int32, ByVal lpBaseAddress As UInt32, ByVal lpBuffer As Byte(), ByVal nSize As Int32, Optional ByRef lpNumberOfBytesWritten As Integer = 0) As Boolean
    End Function

    <DllImport("kernel32.dll", SetLastError:=True)> _
    Public Shared Function ReadProcessMemory(ByVal hProcess As Int32, ByVal lpBaseAddress As UInt32, <Out()> ByVal lpBuffer As Byte(), ByVal iSize As Int32, Optional ByRef lpNumberOfBytesRead As Integer = 0) As Boolean
    End Function

    <DllImport("kernel32.dll")> _
    Private Shared Function OpenProcess(ByVal dwDesiredAccess As Int32, ByVal bInheritHandle As Int16, ByVal dwProcessId As Int32) As Int32
    End Function

    Private Const PROCESS_ALL_ACCESS As Int32 = &H1F0FFF
    Private Const PROCESS_VM_READ As Int32 = &H10
    Private Const PROCESS_VM_WRITE As Int32 = &H20
    Private Const PROCESS_QUERY_INFORMATION As Int32 = &H400

    Private Function GetProcessHandle(ByVal processName As String, Optional ByVal creationFlags As Int32 = (PROCESS_VM_READ Or PROCESS_VM_WRITE Or PROCESS_QUERY_INFORMATION)) As Int32
    Dim namedProcesses As Process() = Process.GetProcessesByName(processName) 'get all the processes running with the given name
    If (namedProcesses.Length > 0) Then 'if the process is running
    Dim tempHandle As Int32 = OpenProcess(creationFlags, 1, namedProcesses(0).Id) 'try opening the process (first one in the array)
    If tempHandle > 0 Then Return tempHandle 'valid handle, return it
    End If
    Return -1 'something went wrong, illustrate that to the caller.
    End Function

    Private Function ReadMemory(Of T)(ByVal hProcess As Int32, ByVal address As UInt32) As T
    'YAYAYAYAYAYAYA GENERICS AGAIN.
    Dim sizeToRead As Integer = Marshal.SizeOf(GetType(T)) 'find how big (in bytes) the structure we're reading will be. (int is 4 bytes...etc)
    Dim buffer(sizeToRead - 1) As Byte 'it's sizeToRead - 1 because VB is shit with arrays.
    ReadProcessMemory(hProcess, address, buffer, sizeToRead) 'read the memory into the buffer.
    Dim tempHwnd As GCHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned) 'temporarily pin the bytes into unmanaged memory so we can marshal them into a structure
    Dim foundStruct As T = CType(Marshal.PtrToStructure(tempHwnd.AddrOfPinned Object(), GetType(T)), T) 'marshal the unmanaged bytes to a structure
    tempHwnd.Free() 'free the temporary handle, very important so we don't have random chunks of data floating around unmanaged memory and clogging up space
    Return foundStruct 'return our structure, yay.
    End Function
    [/highlight]

    Now to use it...
    [highlight=vb.net]
    Dim procHwnd As Int32 = GetProcessHandle("pinball")
    Dim randomValue As Integer = ReadMemory(Of Integer)(procHwnd, &HDEADBEEF)
    '...just change the "of integer" to "of whatevertypeyouwanttoread", don't use strings or arrays though, unless you want to manually write the functionality.
    [/highlight]

    End.
    Last edited by Jason; 06-30-2011 at 12:09 AM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  15. The Following 2 Users Say Thank You to Jason For This Useful Post:

    Lonely Tedy Bear (06-29-2011),wolfguardiann (06-29-2011)

  16. #14
    wolfguardiann's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    112
    Reputation
    9
    Thanks
    1
    My Mood
    Happy
    tyvm , ill try to use it , its 01:04 now, and ill test this later , but , tyvm till now , and for evrything till now!!!!
    thanked

    EDIT:ahh forget it , lol , i tried now , and is reading the values from the game i want , nice , how do i Write to it then ? all the codes up there make it able to Read, ok , and to wirte? its lots of things? if im asking too much u can say but, can u post what else i need in orden to Write now? tyvm for evrything ure doing, ill thank u once again , and if u solve this for me , ill give 2 thanks !! tyvmfor support till now!!
    Last edited by wolfguardiann; 06-29-2011 at 10:34 PM.
    1) You are on the internet
    2) You are visiting MPGH
    3) You are reading my signature
    5) You didn't noticed that point 4 is missing
    6) You just checked for point 4
    7) You are smiling

    Respect List:
    aanthonyz < you will forever belong on my list!

  17. #15
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Alright off the top of my head, write it like this:

    [highlight=vb.net]
    Private Function WriteMemory(Of T)(ByVal hProc As Int32, ByVal pAddress As UInt32, ByVal [object] As T) As Boolean
    Dim sizeof As Integer = Marshal.SizeOf(GetType(T)) 'first thing we're going to do is convert the object to a byte array.
    Dim tempHandle As GCHandle = GCHandle.Alloc([object], GCHandleType.Pinned) 'allocate it to memory
    Dim tempBytes As Byte() = ReadUnmanagedBytes(tempHandle.AddrOfPinnedObject() , sizeof) 'read the bytes into an array
    tempHandle.Free() 'free the handle
    Return WriteProcessMemory(hProc, pAddress, tempBytes, tempBytes.Length) <> 0
    End Function

    Private Function ReadUnmanagedBytes(ByVal startAddr As IntPtr, ByVal dwSize As Int32) As Byte()
    Dim output(dwSize - 1) As Byte
    For i As integer = 0 to dwSize - 1
    output(i) = Marshal.ReadByte(startAddr, i)
    Next
    return output
    End Function
    [/highlight]

    Sorry if there is any syntax errors, CBF opening VB.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  18. The Following User Says Thank You to Jason For This Useful Post:

    wolfguardiann (06-30-2011)

Page 1 of 2 12 LastLast