找回密码
 加入
搜索
查看: 2094|回复: 2

[系统综合] 已获取WOW3.3.5的角色GUID,如何获取角色信息?

[复制链接]
发表于 2017-3-18 19:22:05 | 显示全部楼层 |阅读模式
本帖最后由 llztt 于 2017-3-21 08:30 编辑
;--------------------------------------------------------------------------------
;Getting My Player Health
;--------------------------------------------------------------------------------
#include <NomadMemory.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#RequireAdmin

;--------------------------------------------------------------------------------
; Offsets Object Manager                                                                                 
; Offset and Pointer for Wow 4.2.0 14333 (Rebase 06-28-2011)
;--------------------------------------------------------------------------------

;--------------------------------------------------------------------------------
;public enum Player
;--------------------------------------------------------------------------------
$playerName = 0x97DA88

;--------------------------------------------------------------------------------
;public enum UnitFields
;--------------------------------------------------------------------------------
$UNIT_FIELD_HEALTH = 0x68

;--------------------------------------------------------------------------------
; Offsets Object Manager
;--------------------------------------------------------------------------------
Global Const $ClientConnection = 0x97DA48                                                ;The first 2 are you create you manager from the baseaddress wow
Global Const $CurrMgrOffset = 0x463C 
Global Const $FirstObjectOffset = 0xB4                                                         ;The next one is to get the address of your first object ONLY
Global Const $NextObjectOffset = 0x3C                                                         ;To cycle through the object you need this offset
Global Const $localPlayerGUIDOffset = 0xB8 
Global Const $GameObjGUIDOffset = 0x30                                                        ;This next one is to find the objects type : 1 to 7
Global Const $GameObjTypeOffset = 0x14                                                        ;And this one is to find the objects GUID
Global Const $DescriptorOffset = 0x8

;Open WoW Process to enable Memory Reading and Get the WoW Base Address
$ProcessID = ProcessExists("wow.exe")
$WowProcess = _MemoryOpen($ProcessID)

;Getting WoWBase Address
$WowBase = GetWoWBaseAddress($ProcessID)

;1) Getting CurrentManager_Pre
$currMgr_pre = _MemoryRead("0x" & Hex($WowBase + $ClientConnection), $WowProcess , "dword")
;2) Getting CurrentManager
$currMgr = _MemoryRead("0x" & Hex($currMgr_pre + $CurrMgrOffset), $WowProcess , "dword")
;Getting My Player GUID
$pGUID = _MemoryRead("0x" & Hex($currMgr + $localPlayerGUIDOffset), $WowProcess , "UINT64") ;Player Guid
;Gettin My Player Address
$ObjectMemLoc = GetMemLocByGUID($pGUID)

MsgBox(4096,"Player Name", "PLAYER NAME ---> " & GetPlayerName() & @CRLF & _
        "PLAYER HEALTH ---> " & GetPlayerHealth())

Func GetPlayerName()
        return _memoryread($WowBase + $playerName, $WowProcess, "char[20]")
EndFunc

Func GetPlayerHealth()
        $pDescriptor = _MemoryRead("0x" & Hex($ObjectMemLoc + $DescriptorOffset), $WowProcess , "dword");<---essentially says that you want to use a descriptor (aka health)
        $pHealth = _MemoryRead("0x" & Hex($pDescriptor + $UNIT_FIELD_HEALTH), $WowProcess ,"dword");<---looks up your health
        return $pHealth
EndFunc


Func GetMemLocByGUID($guid)
        ;Read the first wow object by adding our current manager address and our first object offset together
        $NextObject = _MemoryRead("0x" & Hex($currMgr + $FirstObjectOffset), $WowProcess , "dword")        
        
        ;next get the object type buy adding our first object and our Objtype offset together  and reading that
        $ObjType = _MemoryRead("0x" & Hex($NextObject + $GameObjTypeOffset), $WowProcess , "dword")
        
        ;If the return of object type is less than or equal to 7 (which it should always be) and more than 0 in the case that we do have an object in the list than do a while loop. 
        
        while (($ObjType <= 7) And ($ObjType > 0))
                
                ;NOTE: if there is an object in the list, objType will have to be = 1 to 7
                ; If our object plus the GUIDoffset = the GUID we are looking for (example our localplayer GUID) …
            IF (_MemoryRead("0x" & Hex($NextObject + $GameObjGUIDOffset), $WowProcess , "UINT64") = $guid) Then ; …then return our object
                        Return $NextObject ;found what we wanted.
                EndIf


                ;if no return happens (stays in the function) then cycle through the objects using our next object offset on our next object (might also be called current object)
                $NextObject = _MemoryRead("0x" & Hex($NextObject + $NextObjectOffset), $WowProcess , "dword")

                 ;We will also need to see the type
                $ObjType = _MemoryRead("0x" & Hex($NextObject + $GameObjTypeOffset), $WowProcess , "dword")
                
        Wend

        ;if we find nothing Return 0 (address are probably wrong or you messed up code)
        Return 0;
EndFunc

Func GetWoWBaseAddress($ProcessID)
        
        $HSNAP = DllCall("Kernel32.dll", "HANDLE", "CreateToolhelp32Snapshot", "DWORD", 8, "DWORD", $ProcessID)
        $STMODULE = DllStructCreate("DWORD dwSize;DWORD th32ModuleID;DWORD th32ProcessID;" & "DWORD GlblcntUsage;DWORD ProccntUsage;ptr modBaseAddr;" & "DWORD modBaseSize;HANDLE hModule;WCHAR szModule[256];" & "WCHAR szExePath[260]")
        DllStructSetData($STMODULE, "dwSize", DllStructGetSize($STMODULE))
        $RET = DllCall("Kernel32.dll", "BOOLEAN", "Module32FirstW", "HANDLE", $HSNAP[0], "ptr", DllStructGetPtr($STMODULE))

        IF ($RET[0] = False) Then
                DllCall("Kernel32.dll", "BOOLEAN", "CloseHandle", "HANDLE", $HSNAP[0])
                Return 0
        Else
                $RET[0] = True
                Do
                        If DllStructGetData($STMODULE, "szModule") = "Wow.exe" Then

                                DllCall("Kernel32.dll", "BOOLEAN", "CloseHandle", "HANDLE", $HSNAP[0])

                                Return DllStructGetData($STMODULE, "modBaseAddr")
                        EndIf
                        $RET = DllCall("Kernel32.dll", "BOOLEAN", "Module32NextW", "HANDLE", $HSNAP[0], "ptr", DllStructGetPtr($STMODULE))
                Until $RET[0] = False
        EndIf
EndFunc
问题出在GetMemLocByGUID函数,总是获取0,不知道是firstobject偏移有问题,还是函数有问题,可有解决办法呢?
发表于 2017-3-18 20:13:47 | 显示全部楼层
不清楚,网络游戏的基址都找不到,好像是用数据包
 楼主| 发表于 2017-3-21 08:31:22 | 显示全部楼层
可有玩外挂的朋友看看
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-3-29 02:14 , Processed in 0.073674 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表