; Autohotkey RadarHack - csgo的雷达黑客
; 通过更改游戏内存中的一个字节来实现简单的雷达破解。按 F1 键启用/禁用。
; 像 Annecy 32 位一样运行。
; https://yougame.biz/threads/217832/
#NoEnv

$F1::
t := !t
(t = 1) ? n := 2 : n := 0

Data := n
Size = 1

VarSetCapacity(Buf, Size, 0)
NumPut(Data, Buf, "UInt")

PROCESS_VM_WRITE = 0x20
PROCESS_VM_OPERATION = 0x8

Process, Exist, csgo.exe

If(!ErrorLevel) {
  MsgBox, Process not found.
}

PID := ErrorLevel

base := GetDllBase("client.dll", ErrorLevel)
Address := base + 1990811
;msgbox % Address

hProcess := DllCall("OpenProcess", "UInt", PROCESS_VM_WRITE | PROCESS_VM_OPERATION
                                 , "Int",  False
                                 , "UInt", PID)
If(!hProcess) {
   MsgBox, Failed to open process.
}

Ret := DllCall("WriteProcessMemory", "UInt", hProcess
                                   , "UInt", Address
                                   , "UInt", &Buf
                                   , "UInt", Size
                                   , "UInt", 0)


DllCall("CloseHandle", "UInt", hProcess)

If(!Ret) {
  MsgBox, Failed to write.
}
return


GetDllBase(DllName, PID = 0)
{
   TH32CS_SNAPMODULE := 0x00000008
    INVALID_HANDLE_VALUE = -1
    VarSetCapacity(me32, 548, 0)
    NumPut(548, me32, "Uint")
    snapMod := DllCall("CreateToolhelp32Snapshot", "Uint", TH32CS_SNAPMODULE
                                                 , "Uint", PID)
    If (snapMod = INVALID_HANDLE_VALUE) {
        Return 0
    }
    If (DllCall("Module32First", "Uint", snapMod, "Uint", &me32)){
        while(DllCall("Module32Next", "Uint", snapMod, "UInt", &me32)) {
            If !DllCall("lstrcmpi", "Str", DllName, "UInt", &me32 + 32) {
                DllCall("CloseHandle", "UInt", snapMod)
                Return NumGet(&me32 + 20)
            }
        }
    }
    DllCall("CloseHandle", "Uint", snapMod)
    Return 0
}

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。