Code: Select all
IF NOT A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%"
ExitApp
}
setSeDebugPrivilege(enable := True)
#SingleInstance Force
; http://prntscr.com/i6s00z picture of working
ProcessName := "CS2D.exe"
hwnd := MemoryOpenFromName(ProcessName)
X = 0x08B582AC
Y = 0x08B582B0
FlagX =
FlagY =
Z::
ToolTip, Teleported To :X:%xx%`nY:%yy%,0,0
MemoryWrite(hwnd,X,xx,int)
MemoryWrite(hwnd,Y,yy,int)
return
X::
xx := % MemoryRead(hwnd,X,int,4)
yy := % MemoryRead(hwnd,Y,int,4)
ToolTip, Saved Location:X:%xx%`nY:%yy%,0,0
;MemoryWrite(hwnd,X,FlagX,int)
;MemoryWrite(hwnd,Y,FlagY,int)
return
~Esc::
ExitApp
return
MemoryOpenFromName(Name)
{
Process, Exist, %Name%
Return DllCall("OpenProcess", "Uint", 0x1F0FFF, "int", 0, "int", PID := ErrorLevel)
}
MemoryWrite(hwnd, address, writevalue, datatype="int", length=4, offset=0)
{
VarSetCapacity(finalvalue, length, 0)
NumPut(writevalue, finalvalue, 0, datatype)
return DllCall("WriteProcessMemory", "Uint", hwnd, "Uint", address+offset, "Uint", &finalvalue, "Uint", length, "Uint", 0)
}
MemoryRead(hwnd, address, datatype="int", length=4, offset=0)
{
VarSetCapacity(readvalue,length, 0)
DllCall("ReadProcessMemory","Uint",hwnd,"Uint",address+offset,"Str",readvalue,"Uint",length,"Uint *",0)
if (datatype = "Str")
finalvalue := StrGet(&readvalue, length, "UTF-16")
else
finalvalue := NumGet(readvalue, 0, datatype)
return finalvalue
}
setSeDebugPrivilege(enable := True)
{
h := DllCall("OpenProcess", "UInt", 0x0400, "Int", false, "UInt", DllCall("GetCurrentProcessId"), "Ptr")
; Open an adjustable access token with this process (TOKEN_ADJUST_PRIVILEGES = 32)
DllCall("Advapi32.dll\OpenProcessToken", "Ptr", h, "UInt", 32, "PtrP", t)
VarSetCapacity(ti, 16, 0) ; structure of privileges
NumPut(1, ti, 0, "UInt") ; one entry in the privileges array...
; Retrieves the locally unique identifier of the debug privilege:
DllCall("Advapi32.dll\LookupPrivilegeValue", "Ptr", 0, "Str", "SeDebugPrivilege", "Int64P", luid)
NumPut(luid, ti, 4, "Int64")
if enable
NumPut(2, ti, 12, "UInt") ; enable this privilege: SE_PRIVILEGE_ENABLED = 2
; Update the privileges of this process with the new access token:
r := DllCall("Advapi32.dll\AdjustTokenPrivileges", "Ptr", t, "Int", false, "Ptr", &ti, "UInt", 0, "Ptr", 0, "Ptr", 0)
DllCall("CloseHandle", "Ptr", t) ; close this access token handle to save memory
DllCall("CloseHandle", "Ptr", h) ; close this process handle to save memory
return r
}
^Esc::
ExitApp
return