Answered reading memory address

  • 1 mai 2012 12:50
     
     
    How is this possible? For example, the following address: "00775BD7" shows how HP has a player in the game Counter Strike 1.6
    So how do I get the value?

    If it is not clear;
    I want to read only

Toate mesajele

  • 1 mai 2012 14:43
     
     

    ..net isn't really a good platform for this task, since the platform uses a virtual compiler to manage all memory uses (thats what makes .net type-safe). you need to use "unmanaged code" to read a block of memory raw.

    This may get you started, but the code is Ms vC++.

    http://tpforums.org/forum/thread-8373.html

    note that you may be able to do this in a .net langague, but it will involve importing a windows API library, just like the sample above.

  • 1 mai 2012 18:35
     
     Răspuns Are cod

    ..net isn't really a good platform for this task, since the platform uses a virtual compiler to manage all memory uses (thats what makes .net type-safe). you need to use "unmanaged code" to read a block of memory raw.

    This may get you started, but the code is Ms vC++.

    http://tpforums.org/forum/thread-8373.html

    note that you may be able to do this in a .net langague, but it will involve importing a windows API library, just like the sample above.

    I found an example(works well):

    Imports System.Runtime.InteropServices
    
    Public Class Form1
        Private Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
        Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Integer) As Integer
        Private Declare Function OpenProcess Lib "kernel32" Alias "OpenProcess" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
        Public Function ReadLong(ByVal ProcessN As String, ByVal Address As Integer, ByVal ByteL As Byte) As Long
            Dim value As Long
            Dim proc As Process = Process.GetProcessesByName(ProcessN)(0)
            Dim winhandle As IntPtr = OpenProcess(&H1F0FFF, True, proc.Id)
    
            If ReadProcessMemory(winhandle, Address, value, ByteL, 0) = 0 Then Return -1
            CloseHandle(winhandle)
            MsgBox(value)
    
            Return value
        End Function
    
    
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            ReadLong("hl", &H3D53394, 4)
        End Sub
    End Class

    So that's my main problem has been resolved, but then another problem arose.

    Now,I searched for some text:

    The result I get is wrong(in my code, not on Chat Engine), of course, because the type should be text and not Byte.

    So I need get type "text", and not "Byte" to solve it...

    What can I do?

     

  • 1 mai 2012 18:47
     
     Răspuns

    text info is stored in binary or hex, without any encoding. in order to turn it into text, you need to encode it with whatever scheme the data was originally in (ASCII and Unicode are the two most common text encoding types. )

    this should get you started with en/decoding text stored in binary:

    http://msdn.microsoft.com/en-us/library/kdcak6ye.aspx