AutoHotKey获取魔兽基址,魔兽版本

本文介绍如何利用AutoHotKey脚本获取魔兽世界的基址和版本信息,主要涉及dll路径的查找及FileGetVersion函数的应用。内容来源于2011年的一篇博客转载。
采用的是进程快照的方式获取,

GetGameDllBaseAndPath(ByRef BasePath);返回魔兽基址,BasePath返回dll的路径
{
    
   WinGet,pid,PID,ahk_class Warcraft III    ;得到魔兽进程pid
   GameBase :
= GetDLLBase(BasePath,"game.dll",pid)         ;获取game.dll基址
   
if(GameBase=0)
   {
      GameBase :
= 0x6f000000
   }
   
return %GameBase%
}

GetDllBase(ByRef BasePath,DllName, pid 
= 0)
{
   TH32CS_SNAPMODULE :
= 0x00000008
   INVALID_HANDLE_VALUE 
= -1
   VarSetCapacity(me32, 
5480)
   NumPut(
548, me32)
   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)) {
         text :
= StrGet(&me32 + 32"cp0")   ;再加256可能为dll路径
         ;
=StringLower, text, text
         
if(text =DllName)
         {
            BasePath :
=StrGet(&me32 + 32 +256"cp0")
            DllCall(
"CloseHandle""Uint", snapMod)
            Return NumGet(
&me32 + 20)
         }
     }
   }
   DllCall(
"CloseHandle""Uint", snapMod)
   Return 
0
}

  用上面的BasePath获取魔兽的版本

Version := GetWar3Version(BasePath)

GetWar3Version(BasePath)
{
   FileGetVersion, veeersion, 
%BasePath%  ;1.24.0.5841
   StringTrimRight,veeersion,veeersion,
5     ;1.24.0
   StringReplace,veeersion,veeersion,.,,All   ;
1240
   
return veeersion
}

  关键是获取dll路径和 FileGetVersion

转载于:https://www.cnblogs.com/jindaxia/archive/2011/07/14/2106063.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值