memory read

  

$Hwnd=WinGetHandle("Cheat")
 $CurProcID=WinGetProcess($Hwnd)
  $ClientHandle=_MemoryOpen($CurProcID)
  ;  $ClientAddress=_MemoryRead("0x"&Hex("0x"&GUICtrlRead($Input1)),$ClientHandle)
 ; $ncnm=_MemoryRead("0x"&Hex($ClientAddress+Dec(00000000)),$ClientHandle,"ushort")
;  MsgBox(0,"",$ClientAddress)
  ; $ncnm=_MemoryRead("0x"&Hex($ClientAddress+Dec(GUICtrlRead($Input2))),$ClientHandle,"String")
   ;$float=_MemoryRead("0x"&Hex($ClientAddress+Dec(GUICtrlRead($Input2))),$ClientHandle,"float")
  ; $zijie=_MemoryRead("0x"&Hex($ClientAddress+Dec(GUICtrlRead($Input2))),$ClientHandle,"byte[10]")
  While 1
    $ClientAddress=_MemoryRead(0x009640E4,$ClientHandle,"dword");基础地址
   TrayTip("",$ClientAddress,6,1)
   Sleep(500)
   WEnd
 
 #cs
 $Player_Name = ""
  $vbp=""
  For $NameCount = 0 To 32
   $tmpName = _MemoryRead("0x" & Hex($CurPeopleLevel + $NameCount * 2), $ClientHandle, "ushort")
   $Player_Name &= Unicode2Asc(BinaryToString($tmpName))
;   $vbp&=($tmpName&" ")
   if $tmpName = 0 Then
    ExitLoop
   EndIf
  Next
  #ce
 ;-------------------------------------------------------------------------------------------------------------------定义4种内存函数
  Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $if_InheritHandle = 1)
    If Not ProcessExists($iv_Pid) Then
        SetError(1)
      Return 0
    EndIf
    Local $ah_Handle[2] = [DllOpen('kernel32.dll')]
    If @Error Then
        SetError(2)
        Return 0
    EndIf
    Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', $iv_DesiredAccess, 'int', $if_InheritHandle, 'int', $iv_Pid)
    If @Error Then
        DllClose($ah_Handle[0])
        SetError(3)
        Return 0
    EndIf
    $ah_Handle[1] = $av_OpenProcess[0]
    Return $ah_Handle
EndFunc


Func _MemoryRead($iv_Address, $ah_Handle, $sv_Type = 'dword')
    If Not IsArray($ah_Handle) Then
        SetError(1)
        Return 0
    EndIf
    Local $v_Buffer = DllStructCreate($sv_Type)
    If @Error Then
        SetError(@Error + 1)
        Return 0
    EndIf
    DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
    If Not @Error Then
        Local $v_Value = DllStructGetData($v_Buffer, 1)
        Return $v_Value
    Else
        SetError(6)
        Return 0
    EndIf
EndFunc

 

Func _MemoryClose($ah_Handle)
    If Not IsArray($ah_Handle) Then
        SetError(1)
        Return 0
    EndIf
    DllCall($ah_Handle[0], 'int', 'CloseHandle', 'int', $ah_Handle[1])
    If Not @Error Then
        DllClose($ah_Handle[0])
        Return 1
    Else
        DllClose($ah_Handle[0])
        SetError(2)
        Return 0
    EndIf
EndFunc


Func Unicode2Asc($UniString)
    If Not BinarytoString($UniString) Then
        SetError(1)
        Return $UniString
    EndIf
    Local $BufferLen = StringLen($UniString)
    Local $Input = DllStructCreate("byte[" & $BufferLen & "]")
    Local $Output = DllStructCreate("char[" & $BufferLen & "]")
    DllStructSetData($Input, 1, $UniString)
    Local $Return = DllCall("kernel32.dll", "int", "WideCharToMultiByte", _
        "int", 0, _
        "int", 0, _
        "ptr", DllStructGetPtr($Input), _
        "int", $BufferLen / 2, _
        "ptr", DllStructGetPtr($Output), _
        "int", $BufferLen, _
        "int", 0, _
        "int", 0) 
    Local $AscString = DllStructGetData($Output, 1)
    $Output = 0
    $Input = 0
    Return $AscString
EndFunc

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值