Code:
; This script simply scans WoW for player X,Y,Z,Rotation
; Credits: Nomad for the memory functions
; Larry for the SETPRIVILEGE function
; Static-X for the original teleporter script
; The Memory Editing folks at www.mmowned.com
; for the memory locations and great examples
SETPRIVILEGE("SeDebugPrivilege", 1)
; Some Constants so I dont have to "include" them
Global Const $WS_EX_TOPMOST = 8
Global Const $GUI_EVENT_CLOSE = -3
; Variable Declarations
Global $UPDATE = False
Global $Process, $WoWProcess
Global $PlayerBase ; [[[0x012BEDB8]+0x34]+0x24]
; Set Process ID from WoW Window title
If WinExists("World of Warcraft") Then
$Process = WinGetProcess("World of Warcraft")
$WoWProcess = _MemoryOpen($Process)
ElseIf WinExists("WORLD OF WARCRAFT") Then
$Process = WinGetProcess("WORLD OF WARCRAFT")
$WoWProcess = _MemoryOpen($Process)
Else
MsgBox(4096, "Error", "Unable to find WoW!")
Exit
EndIf
; set player base
$PlayerBase = _MemoryRead(_MemoryRead(_MemoryRead(0x012BEDB8, $WoWProcess, 'ptr') + 0x34, $WoWProcess, 'ptr') + 0x24, $WoWProcess, 'ptr')
GUICreate("XYZR Info", 190, 120, -1, -1, -1, $WS_EX_TOPMOST)
GUICtrlCreateLabel("X:", 5, 5, 15, 15)
$LBL_X = GUICtrlCreateLabel("----", 25, 5, 160, 15)
GUICtrlCreateLabel("Y:", 5, 25, 15, 15)
$LBL_Y = GUICtrlCreateLabel("----", 25, 25, 160, 15)
GUICtrlCreateLabel("Z:", 5, 45, 15, 15)
$LBL_Z = GUICtrlCreateLabel("----", 25, 45, 160, 15)
GUICtrlCreateLabel("R:", 5, 65, 15, 15)
$LBL_R = GUICtrlCreateLabel("----", 25, 65, 160, 15)
$BTN_GO = GUICtrlCreateButton("Start", 5, 90, 180, 25)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
_MemoryClose($Process)
Exit
Case $BTN_GO
If $UPDATE = False Then
$UPDATE = True
GUICtrlSetData($BTN_GO, "Stop")
Else
$UPDATE = False
GUICtrlSetData($BTN_GO, "Start")
EndIf
EndSwitch
UPDATE()
WEnd
Func UPDATE()
If $UPDATE = True Then
; Set X data
GUICtrlSetData($LBL_X, _MemoryRead($PlayerBase + 0x798, $WoWProcess, "float"))
; Set Y data
GUICtrlSetData($LBL_Y, _MemoryRead($PlayerBase + 0x79C, $WoWProcess, "float"))
; Set Z data
GUICtrlSetData($LBL_Z, _MemoryRead($PlayerBase + 0x7A0, $WoWProcess, "float"))
; Set Rotation data
GUICtrlSetData($LBL_R, _MemoryRead($PlayerBase + 0x7A8, $WoWProcess, "float"))
EndIf
EndFunc
#Region - Memory
Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $iv_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', $iv_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 SetPrivilege( $privilege, $bEnable )
Const $MY_TOKEN_ADJUST_PRIVILEGES = 0x0020
Const $MY_TOKEN_QUERY = 0x0008
Const $MY_SE_PRIVILEGE_ENABLED = 0x0002
Local $hToken, $SP_auxret, $SP_ret, $hCurrProcess, $nTokens, $nTokenIndex, $priv
$nTokens = 1
$LUID = DLLStructCreate("dword;int")
If IsArray($privilege) Then $nTokens = UBound($privilege)
$TOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
$NEWTOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
$hCurrProcess = DLLCall("kernel32.dll","hwnd","GetCurrentProcess")
$SP_auxret = DLLCall("advapi32.dll","int","OpenProcessToken","hwnd",$hCurrProcess[0], _
"int",BitOR($MY_TOKEN_ADJUST_PRIVILEGES,$MY_TOKEN_QUERY),"int*",0)
If $SP_auxret[0] Then
$hToken = $SP_auxret[3]
DLLStructSetData($TOKEN_PRIVILEGES,1,1)
$nTokenIndex = 1
While $nTokenIndex <= $nTokens
If IsArray($privilege) Then
$priv = $privilege[$nTokenIndex-1]
Else
$priv = $privilege
EndIf
$ret = DLLCall("advapi32.dll","int","LookupPrivilegeValue","str","","str",$priv, _
"ptr",DLLStructGetPtr($LUID))
If $ret[0] Then
If $bEnable Then
DLLStructSetData($TOKEN_PRIVILEGES,2,$MY_SE_PRIVILEGE_ENABLED,(3 * $nTokenIndex))
Else
DLLStructSetData($TOKEN_PRIVILEGES,2,0,(3 * $nTokenIndex))
EndIf
DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetData($LUID,1),(3 * ($nTokenIndex-1)) + 1)
DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetData($LUID,2),(3 * ($nTokenIndex-1)) + 2)
DLLStructSetData($LUID,1,0)
DLLStructSetData($LUID,2,0)
EndIf
$nTokenIndex += 1
WEnd
$ret = DLLCall("advapi32.dll","int","AdjustTokenPrivileges","hwnd",$hToken,"int",0, _
"ptr",DllStructGetPtr($TOKEN_PRIVILEGES),"int",DllStructGetSize($NEWTOKEN_PRIVILEGES), _
"ptr",DllStructGetPtr($NEWTOKEN_PRIVILEGES),"int*",0)
$f = DLLCall("kernel32.dll","int","GetLastError")
EndIf
$NEWTOKEN_PRIVILEGES=0
$TOKEN_PRIVILEGES=0
$LUID=0
If $SP_auxret[0] = 0 Then Return 0
$SP_auxret = DLLCall("kernel32.dll","int","CloseHandle","hwnd",$hToken)
If Not $ret[0] And Not $SP_auxret[0] Then Return 0
return $ret[0]
EndFunc ;==>SetPrivilege
#endregion