使用Pointer&Offset计算内存地址

问题描述 投票:-2回答:1

我正在为我工​​作的商店进行库存自动化。我需要阅读一个地址并知道本周售出的商品数量。

我能够找到BaseAddress和Offset:0x0ac22c78 0x380

我正在使用自动代码来阅读。

但它只读取生成的地址,而不是使用BaseAddress读取。

如何找到生成的地址?代码是:

可以在C#或C ++中我只想找到生成的地址。

Local $iPid = WinGetProcess("Store")
Local $iAddress = 0x0AFDE298

If $iPid = -1 Then
    ConsoleWrite("+++ Failed to get process PID. Open good process or change parameter in WinGetProcess func." & @CRLF)
    Exit
EndIf

Local $hHandle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', 1, 'int', $iPid)

If @error Then
    ConsoleWrite("+++ Failed to open process memory for FULL_ACCESS. Error is " & @error & @CRLF)
    Exit
EndIf

Local $tagStruct = "struct;double var1;endstruct"

Local $sStruct = DllStructCreate($tagStruct)

If @error Then
    ConsoleWrite("+++ Failed to create $sStruct. Error is " & @error & @CRLF)
    Exit
EndIf

DllCall("kernel32.dll", 'int', 'ReadProcessMemory', 'int', $hHandle[0], 'int', $iAddress, 'ptr', DllStructGetPtr($sStruct), 'int', DllStructGetSize($sStruct), 'int', '')

If @error Then
    ConsoleWrite("+++ Failed to Read Process Memory. Error is " & @error & @CRLF)
    Exit
EndIf

Local $vRet = DllStructGetData($sStruct, "var1")

If @error Then
    ConsoleWrite("+++ Failed to Get data from $sStruct. Error is " & @error & @CRLF)
    Exit
EndIf

ConsoleWrite("++ Successfully read memory at addr 0x" & Hex($iAddress) & " value is " & $vRet & @CRLF)
autoit
1个回答
0
投票

你的问题是你没找到地址,你找到了一个指向地址的指针。

如何解决它真的很容易......

选项1:

  • 检查函数调用(右键单击地址 - >检查写入此地址的内容)。

选项2:

选项3:不推荐

  • 强制抵消。

如何使用Autoit读取内存:

https://www.autoitscript.com/forum/topic/55095-how-can-read-value-from-memory-address/

如何从指针读取值

读取指针值 - >指向值作为新地址 - >结果

© www.soinside.com 2019 - 2024. All rights reserved.