早些年用纯汇编写的一个自用的《征途》外挂(二)

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 获取目标信息
;        Result:        eax(TRUE, 成功;FALSE, 失败)
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GetObjectInfo         proc         uses  ebx  edi  esi
                
                 invoke        RtlZeroMemory,  addr g_ObjectName, 32
                 mov         ebx, g_ObjectAddr
                 add         ebx, 04H
                 invoke        ReadProcessMemory, g_ZTProcess,  ebxaddr g_ObjectName, 32, NULL
                 test         eaxeax
                 jz        _get_object_info_err
                
                 mov         ebx, g_ObjectAddr
                 add         ebx, 40H
                 invoke        ReadProcessMemory, g_ZTProcess,  ebxaddr g_ObjectCurLife, 4, NULL
                 test         eaxeax
                 jz        _get_object_info_err
                
                 mov         ebx, g_ObjectAddr
                 add         ebx, 44H
                 invoke        ReadProcessMemory, g_ZTProcess,  ebxaddr g_ObjectMaxLife, 4, NULL
                 test         eaxeax
                 jz        _get_object_info_err
                
                 mov         ebx, g_ObjectAddr
                 add         ebx, 48H
                 invoke        ReadProcessMemory, g_ZTProcess,  ebxaddr g_ObjectCurMagic, 4, NULL
                 test         eaxeax
                 jz        _get_object_info_err
                
                 mov         ebx, g_ObjectAddr
                 add         ebx, 4CH
                 invoke        ReadProcessMemory, g_ZTProcess,  ebxaddr g_ObjectMaxMagic, 4, NULL
                 test         eaxeax
                 jz        _get_object_info_err
                
                 mov         ebx, g_ObjectAddr
                 add         ebx, 2CH
                 invoke        ReadProcessMemory, g_ZTProcess,  ebxaddr g_ObjectPosX, 4, NULL
                 test         eaxeax
                 jz        _get_object_info_err
                
                 mov         ebx, g_ObjectAddr
                 add         ebx, 30H
                 invoke        ReadProcessMemory, g_ZTProcess,  ebxaddr g_ObjectPosY, 4, NULL
                 test         eaxeax
                 jz        _get_object_info_err
                
                 mov         eaxTRUE
                 ret
                
        _get_object_info_err:
                 invoke        RtlZeroMemory,  addr g_ObjectName, 32
                 mov        g_ObjectCurLife, 0
                 mov        g_ObjectMaxLife, 0
                 mov        g_ObjectCurMagic, 0
                 mov        g_ObjectMaxMagic, 0
                 mov        g_ObjectPosX, 0
                 mov        g_ObjectPosY, 0
                 xor         eaxeax
                 ret
                
                
GetObjectInfo         endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 获取角色是否打坐
;        参数:        fairyOffsetAddr        角色的偏移地址
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GetSitState         proc         uses  ebx  edi  esi lpBaseAddr: DWORD
                 ;g_FairySitState_DOWN
                 local        _sitstateVal: DWORD
                
                 cmp        lpBaseAddr, NULL
                 jne        _get_sit_state_start
                
                 push        g_FairyAddr
                 pop        lpBaseAddr
                
        _get_sit_state_start:
;                
;                invoke        ReadProcessMemory, g_ZTProcess, fairyOffsetAddr, \
;                        addr _sitstateAddr, 4, NULL
;                test        eax, eax
;                jz        _not_get_sitstate
                 mov         ebx, lpBaseAddr
                 add         ebx, 0464H
                 invoke        ReadProcessMemory, g_ZTProcess,  ebx, \
                         addr _sitstateVal, 4, NULL
                 test         eaxeax
                 jz        _not_get_sitstate
                
                 mov         eax, _sitstateVal
                 .if         al == 02H         ;打坐
                         ;invoke        SetWindowText, g_MainWnd, addr  g_FairySitState_DOWN
                         mov         eax, g_SitState
                         cmp         eax, SIT_STATE_DOWN
                         je        _set_sit_state_down
                         invoke        LoadBitmap, g_InstanceHandle, BMP_SIT_DOWN
                         invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_SIT_STATE, STM_SETIMAGE, IMAGE_BITMAP,  eax
                         mov        g_SitState, SIT_STATE_DOWN
                _set_sit_state_down:
                         mov         eaxTRUE
                 .elseif         al == 00H         ;站立
                         ;invoke        SetWindowText, g_MainWnd, addr  g_FairySitState_UP
                         mov         eax, g_SitState
                         cmp         eax, SIT_STATE_UP
                         je        _set_sit_state_up
                         invoke        LoadBitmap, g_InstanceHandle, BMP_SIT_UP
                         invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_SIT_STATE, STM_SETIMAGE, IMAGE_BITMAP,  eax
                         mov        g_SitState, SIT_STATE_UP
                _set_sit_state_up:
                         mov         eaxFALSE
                 .endif
        _not_get_sitstate:
        
                 ret
        
GetSitState         endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 显示鼠标所在位置
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GetMousePos         proc
         local        _stPT:POINT
         local        _buf[32]: BYTE
        
         invoke        RtlZeroMemory,  addr _buf, 32
         invoke        GetCursorPos,  addr _stPT
         invoke        WindowFromPoint, _stPT.x, _stPT.y
         .if         eax == g_ZTCurWnd
                 invoke        ScreenToClient, g_ZTCurWnd,  addr _stPT
         .endif
         invoke        wsprintf,  addr _buf, _T( "X=%ld, Y=%ld"), _stPT.x, _stPT.y
         invoke        SendDlgItemMessage, g_MainWnd, IDC_STATUSBAR, SB_SETTEXT, \
                0,  addr _buf
         xor         eaxeax
         ret
GetMousePos         endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 显示角色信息
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ShowSelfInfo         proc         uses  edx  edi  esi lpBaseAddr: DWORD
                 local        _buf[255]: BYTE
                 local        _curExp: DWORD, _maxExp: DWORD
                 local        _exp: DWORD
                
                 mov        lpBaseAddr, NULL

                 call        GetSelfMapInfo
                 invoke        RtlZeroMemory,  addr _buf, 255
                 invoke        wsprintf,  addr _buf, _T('(%ld, %ld)'), g_SelfPosX, g_SelfPosY
                 invoke        lstrcmp,  addr g_OldSelfPosXY,  addr _buf
                 test         eaxeax
                 jz        _show_self_map_name
                
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_5, WM_SETTEXT, 0,  addr _buf
                 invoke        lstrcpy,  addr g_OldSelfPosXY,  addr _buf
        _show_self_map_name:
                 invoke        lstrcmp,  addr g_OldSelfMapName,  addr g_SelfMapName
                 test         eaxeax
                 jz        _show_self_name
                
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_6, WM_SETTEXT, 0,  addr g_SelfMapName
                 invoke        lstrcpy,  addr g_OldSelfMapName,  addr g_SelfMapName
        _show_self_name:
                 invoke        GetSelfName, lpBaseAddr
                 invoke        RtlZeroMemory,  addr _buf, 255
                 invoke        wsprintf,  addr _buf, _T('%s◆%s'),  addr g_SelfName,  addr g_SelfCountryName
                 invoke        lstrcmp,  addr g_OldSelfName,  addr _buf
                 test         eaxeax
                 jz        _show_self_life_info
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_FAIRY_INFO, WM_SETTEXT, 0,  addr _buf
                 invoke        lstrcpy,  addr g_OldSelfName,  addr _buf
                
        _show_self_life_info:
                 invoke        GetSelfLifeInfo, lpBaseAddr
;                mov        eax, g_OldSelfMaxLife
;                cmp        eax, g_SelfMaxLife
;                je        _show_self_magic_info
                
                 mov         eax, g_OldSelfCurLife
                 cmp         eax, g_SelfCurLife
                 je        _show_self_magic_info
                
                 invoke        CreateBarGround, IDC_STATIC_LIFE_BAR
                 invoke        DrawBar, g_SelfCurLife, g_SelfMaxLife, IDC_STATIC_LIFE_BAR, BMP_LIFE
                 push        g_SelfCurLife
;                push        g_SelfMaxLife
;                pop        g_OldSelfMaxLife
                 pop        g_OldSelfCurLife
                
        _show_self_magic_info:
                 invoke        GetSelfMagicInfo, lpBaseAddr
;                mov        eax, g_OldSelfMaxMagic
;                cmp        eax, g_SelfMaxMagic
;                je        _show_self_exp_info
                
                 mov         eax, g_OldSelfCurMagic
                 cmp         eax, g_SelfCurMagic
                 je        _show_self_exp_info
                
                 invoke        CreateBarGround, IDC_STATIC_MAGIC_BAR
                 invoke        DrawBar, g_SelfCurMagic, g_SelfMaxMagic, IDC_STATIC_MAGIC_BAR, BMP_MAGIC
                 push        g_SelfCurMagic
;                push        g_SelfMaxMagic
;                pop        g_OldSelfMaxMagic
                 pop        g_OldSelfCurMagic

        _show_self_exp_info:
                 invoke        GetSelfExpInfo, lpBaseAddr
                
                
                 mov         eaxDWORD  ptr g_SelfCurExp
                 mov        _curExp,  eax
                 mov         eaxDWORD  ptr g_SelfMaxExp
                 mov        _maxExp,  eax
                
;                mov        eax, g_OldSelfMaxExp
;                cmp        eax, _maxExp
;                je        _show_notifyicon
                
                 mov         eax, g_OldSelfCurExp
                 cmp         eax, _curExp
                 je        _show_notifyicon
                
                 invoke        CreateBarGround, IDC_STATIC_EXP_BAR
                 invoke        DrawBar, _curExp, _maxExp, IDC_STATIC_EXP_BAR, BMP_EXP

                 push        _curExp
;                push        _maxExp
;                pop        g_OldSelfMaxExp
                 pop        g_OldSelfCurExp
                
        _show_notifyicon:
                 invoke        IsDlgButtonChecked, g_MainWnd, IDC_CHECK_CLOSE_TRAYINFO
                 cmp         eax, BST_CHECKED
                 je        _calc_exp_speed
                 invoke        RtlZeroMemory,  addr _buf, 255
                 invoke        GetWindowLong, g_MainWnd, GWL_STYLE
                 and         eax, WS_MINIMIZE
                 JZ        _calc_exp_speed
                 and         eax, WS_VISIBLE
                 JNZ        _calc_exp_speed
                
                 invoke        GetTickCount
                 mov         ecx, 1000
                 xor         edxedx
                 div         ecx
                 .if        g_ShowTrayInfoLastTime == 0
                         mov        g_ShowTrayInfoLastTime,  eax
                 .endif
                 cmp         eax, g_ShowTrayInfoLastTime
                 jbe        _calc_exp_speed
                
                 mov        g_ShowTrayInfoLastTime, 0
                        
        
                 mov        g_stNIF.dwInfoFlags, NIIF_INFO
                 mov        g_stNIF.uTimeout, 3000
                 invoke        lstrcpy,  addr g_stNIF.szTip,  addr g_SelfName
                 ;'%s', 0DH, 0AH, '经验:%ld/%ld', 0DH, 0AH, '生命:%ld/%ld', 0DH, 0AH, '法力:%ld/%ld', 0DH, 0AH,'位置:%s', 0DH,0AH '坐标:(%ld,%ld)',0
                 invoke        wsprintf,  addr _buf,  addr g_ShowTrayInfo, \
                         addr g_SelfName,  DWORD  ptr g_SelfCurExp,  DWORD  ptr g_SelfMaxExp, \
                        g_SelfCurLife, g_SelfMaxLife, g_SelfCurMagic, g_SelfMaxMagic, \
                         addr g_SelfMapName, g_SelfPosX, g_SelfPosY, g_ExpSpeed, g_ExpUpdateTimeI, \
                        g_ExpUpdateTimeF,  addr g_ObjectName
                
                 invoke        lstrcpy,  addr g_stNIF.szInfo,  addr _buf
                 ;invoke        ShowWindow, g_MainWnd, SW_HIDE
                 .if        lpShell_NotifyIcon != NULL
                         invoke        lpShell_NotifyIcon, NIM_MODIFY,  addr g_stNIF
                 .endif        
         ;计算经验速率
         ;**************************************************************
         ;经验速率计算方法,(当前经验-开始经验) * (60 / 流逝时间)
         ;开始经验计算方法:如果当前的获取的经验连续10次都处在递增状态,并且每次间隔小于5秒
         ;流逝时间:当前时刻 - 开始经验的起始时刻
        _calc_exp_speed:
                 cmp        g_ExpIncCount, 10
                 jb        _calc_exp_start
                 mov         eax, _curExp
                 sub         eax, g_StartExp
                 mov        _exp,  eax
                 invoke        GetTickCount
                 sub         eax, g_LastPointTime
                 xor         edxedx
                 mov         ebx, 1000                         ;转换成秒
                 div         ebx
                 cmp         eax, 10                                 ;10秒
                 jb        _calc_exp_inc_time
        
                 mov         ecxeax
                 mov         eax, 3600                         ;3600秒
                 xor         edxedx
                 div         ecx
                 mul        _exp
                 mov        g_ExpSpeed,  eax
                 invoke        RtlZeroMemory,  addr _buf, 255
                 invoke        wsprintf,  addr _buf, _T('升级速率:约%ld/小时'), g_ExpSpeed
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATUSBAR, SB_SETTEXT, \
                        2,  addr _buf
                 invoke        RtlZeroMemory,  addr _buf, 255
                 mov         eax, _maxExp
                 sub         eax, _curExp
                 xor         edxedx
                 .if        g_ExpSpeed > 0
                         div        g_ExpSpeed
                 .else
                         xor         eaxeax
                 .endif
                
                 mov        g_ExpUpdateTimeI,  eax
                 mov         ebx, 100
                 mov         eaxedx
                 mul         ebx
                 xor         edxedx
                 .if        g_ExpSpeed > 0
                         div        g_ExpSpeed
                 .else
                         xor         eaxeax
                 .endif
                 mov        g_ExpUpdateTimeF,  eax
                 invoke        wsprintf,  addr _buf, _T('升下一级时间预计在 %ld.%ld 小时之后'), \
                        g_ExpUpdateTimeI, g_ExpUpdateTimeF
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATUSBAR, SB_SETTEXT, \
                        3,  addr _buf
                 mov        g_ExpIncCount, 0
                
        _calc_exp_start:
                 mov         eax, _curExp
                 sub         eax, g_StartExp
                 cmp         eax, 0
                 jbe        _calc_exp_inc_time
                
                 push        _curExp
                 pop        g_StartExp
                 inc        g_ExpIncCount
                 invoke        GetTickCount
                 mov        g_LastPointTime,  eax
                 jmp        _show_self_info_exit
        _calc_exp_inc_time:
                 invoke        GetTickCount
                 sub         eax, g_LastPointTime
                 cmp         eax, 15000
                 ja        _clear_calc_exp_inc_count
                 jmp        _show_self_info_exit
        _clear_calc_exp_inc_count:
                 mov        g_ExpIncCount, 0
                 mov        g_LastPointTime, 0
                 mov        g_ExpUpdateTimeI, 0
                 mov        g_ExpUpdateTimeF, 0
                 mov        g_ExpSpeed, 0

        _show_self_info_exit:
                
                 xor         eaxeax
                 ret
                
ShowSelfInfo         endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 显示目标信息
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ShowObjectInfo         proc         uses  edx  edi  esi lpBaseAddr: DWORD
                 local        _buf[255]: BYTE

                 invoke        GetObjectAddr
                 ;invoke        wsprintf, addr _buf, _T('目标基地址:0x%08X'), g_ObjectAddr
                 ;invoke        SetWindowText, g_MainWnd, addr _buf
         ; 判断目标地址是否存在
                 mov         eax, g_ObjectAddr
                 or         eaxeax
                 jz        _object_was_died
                
         ; 判断目标是否在角色控制范围
                 invoke        GetObjectInfo
                 mov         eax, g_SelfPosX
                 sub         eax, g_ObjectPosX
                 invoke        ABS_32Bit,  eax
                 cmp         eax, 09H
                 ja        _object_is_not_in_rangle
                
                 mov         eax, g_SelfPosY
                 sub         eax, g_ObjectPosY
                 invoke        ABS_32Bit,  eax
                 cmp         eax, 09H
                 ja        _object_is_not_in_rangle
                
         ; 目标处在角色控制范围
                 mov        g_ObjectNotInRangle,  TRUE
        
         ; 显示目标信息
        _show_object_name_info:
                 mov         eax, g_ObjectCurMagic
                 .if         eax >= g_ObjectMaxMagic
                         push        g_ObjectCurMagic
                         pop        g_ObjectMaxMagic
                 .endif
                
                 invoke        lstrcmp,  addr g_OldObjectName,  addr g_ObjectName
                 test         eaxeax
                 jz        _show_object_life_info
                 ; 判断目标是否改变
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_7, WM_SETTEXT, 0,  addr g_ObjectName
                 invoke        lstrcpy,  addr g_OldObjectName,  addr g_ObjectName

        _show_object_life_info:
                 invoke        RtlZeroMemory,  addr _buf, 255
                 invoke        wsprintf,  addr _buf, _T('%ld/%ld'), g_ObjectCurLife, g_ObjectMaxLife
                 invoke        lstrcmp,  addr g_OldObjectLifeInfo,  addr _buf
                 test         eaxeax
                 jz        _show_object_magic_info
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_8, WM_SETTEXT, 0,  addr _buf
                 invoke        lstrcpy,  addr g_OldObjectLifeInfo,  addr _buf
                
        _show_object_magic_info:
                 .if        g_ObjectMaxMagic > 10
                         mov        g_ObjectIsPlayer,  TRUE
                 .else
                         mov        g_ObjectIsPlayer,  FALSE
                 .endif
                 invoke        RtlZeroMemory,  addr _buf, 255
                 invoke        wsprintf,  addr _buf, _T('%ld/%ld'), g_ObjectCurMagic, g_ObjectMaxMagic
                 invoke        lstrcmp,  addr g_OldObjectMagicInfo,  addr _buf
                 test         eaxeax
                 jz        _show_object_pos_info
;                mov        eax, g_ObjectMaxMagic
;                .if        eax > 10
;                        mov        _magicExist, TRUE
;                .endif
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_9, WM_SETTEXT, 0,  addr _buf
                 invoke        lstrcpy,  addr g_OldObjectMagicInfo,  addr _buf
                
        _show_object_pos_info:
                 invoke        RtlZeroMemory,  addr _buf, 255
                 invoke        wsprintf,  addr _buf, _T('(%ld, %ld)'), g_ObjectPosX, g_ObjectPosY
                 invoke        lstrcmp,  addr g_OldObjectPosInfo,  addr _buf
                 test         eaxeax
                 jz        _show_object_info_over
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_10, WM_SETTEXT, 0,  addr _buf
                 invoke        lstrcpy,  addr g_OldObjectPosInfo,  addr _buf
                 jmp        _show_object_info_over
                
        _object_was_died:
                 mov        g_ObjectNotInRangle,  FALSE
                 mov        g_ObjectCurLife, 0
                 mov        g_ObjectMaxLife, 0
                 mov        g_ObjectCurMagic, 0
                 mov        g_ObjectMaxMagic, 0
                 invoke        lstrcpy,  addr g_ObjectName, _T('目标死亡或者不在九屏内')
                 invoke        lstrcmp,  addr g_OldObjectName,  addr g_ObjectName
                 test         eaxeax
                 jz        _show_object_info_over
                
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_7, WM_SETTEXT, 0,  addr g_ObjectName
                 invoke        lstrcpy,  addr g_OldObjectName,  addr g_ObjectName
                 jmp        _clear_object_info
                
        _object_is_not_in_rangle:
                 mov        g_ObjectNotInRangle,  FALSE
                 invoke        lstrcpy,  addr g_ObjectName, _T('目标超出控制范围')
                 invoke        lstrcmp,  addr g_OldObjectName,  addr g_ObjectName
                 test         eaxeax
                 jz        _show_object_info_over        
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_7, WM_SETTEXT, 0,  addr g_ObjectName
                 invoke        lstrcpy,  addr g_OldObjectName,  addr g_ObjectName
                
        _clear_object_info:
;                invoke        RtlZeroMemory, addr g_OldObjectLifeInfo, 32
;                invoke        RtlZeroMemory, addr g_OldObjectMagicInfo, 32
;                invoke        RtlZeroMemory, addr g_OldObjectPosInfo, 32
                
                
                 invoke        RtlZeroMemory,  addr _buf, 255
                 invoke        wsprintf,  addr _buf, _T('%ld/%ld'), 0, 0
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_8, WM_SETTEXT, 0,  addr _buf
                 invoke        RtlZeroMemory,  addr _buf, 255
                 invoke        wsprintf,  addr _buf, _T('%ld/%ld'), 0, 0
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_9, WM_SETTEXT, 0,  addr _buf
                 invoke        RtlZeroMemory,  addr _buf, 255
                 invoke        wsprintf,  addr _buf, _T('(%ld, %ld)'), 0, 0
                 invoke        SendDlgItemMessage, g_MainWnd, IDC_STATIC_10, WM_SETTEXT, 0,  addr _buf
        _show_object_info_over:
                 xor         eaxeax
                 ret
                
                
                
ShowObjectInfo         endp
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值