Visual Basic 2013读取内存

时间:2014-07-16 04:51:14

标签: vb.net memory

为什么我只得到" 0"背部?我的代码:

Dim GeldAdresse As String = "811768"
Dim offsets(1) As Integer
offsets = {&H28, &H2C}
Dim ergebniss As Integer = Memory.ReadPointerInteger("eurotrucks2", 811768, offsets)

模块"记忆":

Public Function ReadPointerInteger(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal ParamArray Offset As Integer()) As Integer
        Dim Value As Integer
        If Process.GetProcessesByName(EXENAME).Length <> 0 Then
            Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle
            If Handle <> 0 Then
                For Each I As Integer In Offset
                    ReadMemoryInteger(Handle, Pointer, Pointer)
                    Pointer += I
                Next
                ReadMemoryInteger(Handle, Pointer, Value)
            End If
        End If
        Return Value
    End Function

在示例中:

'       Me.Text = ReadPointerInteger("gta_sa", &HB71A38,&H540,&H544).ToString()

我必须在整数中转换0x2C吗?

2 个答案:

答案 0 :(得分:0)

    Dim Value As Integer
    ...
    Return Value

您正在返回Value但从未为其分配实际值。您似乎需要将代码更改为:

Dim Value As Integer
...
Value = ReadMemoryInteger(...
...
Return Value

答案 1 :(得分:0)

班级坏了。我用另一个。