[Release] GR Autolooter

10/01/2013 21:12 dOntsayDAT#196
Thx
10/01/2013 22:01 thu468#197
does not work with 13CAF93 also when i try to add the address into CE it shows the value as 827744628
10/02/2013 00:45 Ploxasarus#198
Because they are using it CE style..

If your going to post it you would post it as Gw2.exe+13CAF93 and not just 13caf93 or you can put 017caf93 :)
10/02/2013 06:05 thu468#199
has anyone tested if this works on window 8?
or if this works with the gw2 Immersive Combat Mode?
Also if this works with sweetfx?
Oh does it matter which program you need to start up first? Gw2 or autolooter?

this is the new address correct 017cafd3??

this is correct right? i changed the address
Code:
Global $TITLE = "Guild Wars 2"
Global $HWND = WinGetHandle($TITLE)
Global $LOOTKEY = "e"
#region _Memory
Func _MEMORYOPEN($IV_PID, $IV_DESIREDACCESS = 2035711, $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 _MEMORYWRITE($IV_ADDRESS, $AH_HANDLE, $V_DATA, $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
	Else
		DllStructSetData($V_BUFFER, 1, $V_DATA)
		If @error Then
			SetError(6)
			Return 0
		EndIf
	EndIf
	DllCall($AH_HANDLE[0], "int", "WriteProcessMemory", "int", $AH_HANDLE[1], "int", $IV_ADDRESS, "ptr", DllStructGetPtr($V_BUFFER), "int", DllStructGetSize($V_BUFFER), "int", "")
	If Not @error Then
		Return 1
	Else
		SetError(7)
		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 = 32
	Const $MY_TOKEN_QUERY = 8
	Const $MY_SE_PRIVILEGE_ENABLED = 2
	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
#endregion _Memory
$IV_PID = ProcessExists("Gw2.exe")
$MEMORYOPEN = _MEMORYOPEN($IV_PID)
While 1
	$MEM_READ = _MEMORYREAD("0x" & "017cafd3", $MEMORYOPEN)
	Sleep(50)
	If $MEM_READ = 64 Then
			ControlSend($HWND, "", "", $LOOTKEY)
		EndIf
WEnd
_MEMORYCLOSE($MEMORYOPEN)
Ok so did some test with the code here
Code:
ControlSend($HWND, "", "", $LOOTKEY)
and i think this is the error. can someone help me with this?

i Finally fix it had to change
Code:
Global $TITLE = "Guild Wars 2"
to
Code:
Global $TITLE = "Guild Wars 2 Game Client"
xoraxax is it possible if you can give me the source for your program? or compile another one with the Global $TITLE = "Guild Wars 2 Game Client" so that it works for people that has window 8? I like what you added with the f9 thing to disable.
10/02/2013 14:04 Ploxasarus#200
If it was compiled in autoit just go look for myAutToExe an decompile it and you have the source :)

And no the address changed due to the WvW fix/update.
10/02/2013 14:47 xoraxax#201
#RequireAdmin
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <NomadMemory.au3>
#Region ### START Koda GUI section ### Form=
$Autolooter = GUICreate("Autolooter", 188, 64, 254, 196, $GUI_SS_DEFAULT_GUI)
$btn = GUICtrlCreateButton("Turn On", 40, 8, 113, 33)
GUICtrlCreateLabel("Hotkey: F9", 40, 45)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

SetPrivilege("SeDebugPrivilege", 1)
$pid=WinGetProcess("Guild Wars 2")
$k=iniRead ( "autolooter.ini", "main", "key", "f" )
$a=iniRead ( "autolooter.ini", "main", "addr", "" )
if $a="" Then Exit
$open = _MemoryOpen($pid)
$base=dec("00400000")
$Offset = dec($a)
$finalADDR = "0x" & Hex($base + $Offset)
$enabled=False
HotKeySet("{f9}","flip")
func flip()
$enabled= not $enabled
If $enabled Then
GUICtrlSetData($btn,"Turn Off")
Else
GUICtrlSetData($btn,"Turn On")
EndIf
EndFunc

While 1
if $enabled Then
$r=_MemoryRead($finalADDR,$open)
if $r=64 Then
Send($k)
Sleep(50)
EndIf
EndIf

$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $btn
flip()



EndSwitch
WEnd


_memoryclose($open)

13CAFD3
10/03/2013 00:58 thu468#202
whats the #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <NomadMemory.au3>
??? dont have those file

ok i think i made it work for me, i change
Code:
$pid = WinGetProcess("Guild Wars 2")
to
Code:
$pid = ProcessExists("Gw2.exe")
how to you make it so that when you alt+tab out it does not spam the key? so that it only push the key in the window? or when i push enter in the gw2 chat that it does not spam there?

Is it possible to make it disable the program by push the enter button? or when i alt+tab out?
10/03/2013 08:26 Venlik#203
Quote:
Originally Posted by thu468 View Post
how to you make it so that when you alt+tab out it does not spam the key? so that it only push the key in the window? or when i push enter in the gw2 chat that it does not spam there?

Is it possible to make it disable the program by push the enter button? or when i alt+tab out?
This is pseudo-ish code, you'll have to impliment it properly...
Using WinGetTitle function from AutoIT you can get the current active window's title...
Code:
If WinGetTitle("") = "Guild Wars 2" then
  //Do stuff?
  MsgBox(0, "Title of active Window: ", WinGetTitle(""))
  Else
  //Do something else?
EndIf
10/03/2013 08:55 thu468#204
how would you add that in exactly?
10/03/2013 12:31 Venlik#205
Quote:
Originally Posted by thu468 View Post
how would you add that in exactly?
Take what i put below, think about it and figure it out, there will be better / cleaner ways to code this btw. This only addresses your issue with Alt+tabbing, if you read back in this thread somewhere there is info about finding a memory value/address for when the chatbox in game is toggled i think.

Something along the lines of...

Code:
While 1
IF $enabled THEN
  IF WinGetTitle("") = "Guild Wars 2" THEN
    $r = _MemoryRead($finalADDR,$open)
    IF $r = 64 THEN
      Send($k)
      Sleep(50)
    ENDIF
  ENDIF
ENDIF
10/03/2013 16:40 thu468#206
OK so i found this code for the chatbox
Code:
If _memoryread(23697460, $open, "dword") == 0 Then
how would you find the address 23697460?? because im assuming that it changed
and you would added it in like this correct?
Code:
While 1
	If $enabled Then
	  IF WinGetTitle("") = "Guild Wars 2 Game Client" THEN
		$r = _memoryread($finaladdr, $open)
		If $r = 64 Then
		   If _memoryread(23697460, $memoryopen, "dword") == 0 Then
			Send($k)
			Sleep(50)
		   EndIf
		 EndIf
	  EndIf
	EndIf
10/03/2013 19:15 xoraxax#207
it is here 1732924
10/03/2013 19:57 thu468#208
how did you get that?

ok i got it working so that it does not spam when i alt+tab out or when im in the chat window.
Code:
$pid = ProcessExists("Gw2.exe")
$k = IniRead("autolooter.ini", "main", "key", "f")
$a = IniRead("autolooter.ini", "main", "addr", "")
$ca = IniRead("autolooter.ini", "main", "chataddr", "")
If $a = "" Then Exit 
$open = _memoryopen($pid)
$base = Dec("00400000")
$offset = Dec($a)
$chatoffset = Dec($ca)
$finaladdr = "0x" & Hex($base + $offset)
$finalchataddr = "0x" & Hex($base + $chatoffset)

While 1
	If $enabled Then
		$r = _memoryread($finaladdr, $open)
		$c = _memoryread($finalchataddr, $open)
		If $c = 0 Then
		   If $r = 64 Then
			ControlSend("Guild Wars 2", "", "", $k)
			Sleep(50)
		   EndIf
		EndIf
	EndIf
and then the config file would go like this

[main]
key=e
addr=13cafd3
chataddr=1332924
10/04/2013 07:49 Venlik#209
Well done, i would now use CE (Or Ollydbg) and teach yourself how to find and update those 2 addresses after a patch.
10/04/2013 08:19 thu468#210
thanks <3