找回密码
 点一下
查看: 1869|回复: 5

发现7个隐藏的CJ函数

[复制链接]
发表于 2009-4-15 17:35:13 | 显示全部楼层 |阅读模式
使用脚本提取出game.dll里面注册的所有CJ函数(注:没有管AI函数),然后解析出common.j里所有声明的函数,两者对比,发现有7个函数在game.dll里注册过,但是common.j里没有声明,它们是:

DialogSetAsync
SetStackedSoundRect
SetStackedSound
ClearStackedSound
ClearStackedSoundRect
GetPlayerStartLocationY
GetPlayerStartLocationX

注:
1. 尚未确认这些函数确实是隐藏或者废弃函数,而不是另一个已知函数的别名,今天晚上我写一个新的脚本验证一下,有结果就更新帖子
2. 魔兽版本是1.21b
3.最后两个函数BJ也有,估计这两个函数本来是CJ,后来被废弃了,换BJ了

晚上编辑:
已经验证这些函数不是其他函数的别名

附验证脚本(python):
  1. # coding: utf-8
  2. from __future__ import print_function
  3. import string
  4. import re
  5. from idaapi import *
  6. # 获取指令名称
  7. def get_op_name(opAddr):
  8.     result = re.split('\W+', GetDisasm(opAddr))
  9.     if result:
  10.         return result[0]
  11.     else:
  12.         return ""
  13. # 从指令中解析CJ函数的名称
  14. def get_cj_name(opAddr):
  15.     # 是mov edx, ????? 指令吗?
  16.     if get_op_name(opAddr) == "mov" and GetOperandValue(opAddr, 0) == 2:    # edx -> 2
  17.         # 字符串地址:第2个操作数
  18.         strAddr = GetOperandValue(opAddr, 1)
  19.         return GetString(strAddr, -1, GetStringType(strAddr))
  20.     else:
  21.         # 不是
  22.         return ""
  23.         
  24. # 从指令中解析CJ函数的地址
  25. def get_cj_addr(opAddr):
  26.     # 是mov ecx, ????? 指令吗?
  27.     if get_op_name(opAddr) == "mov" and GetOperandValue(opAddr, 0) == 1:    # ecx -> 1
  28.         # 函数地址
  29.         return GetOperandValue(opAddr, 1)
  30.     else:
  31.         # 不是
  32.         return 0
  33. startAddr = 0x6F2AB155    # 开始分析地址
  34. nextFuncAddr = NextFunction(startAddr)    # 搜索停止地址(下一个函数)
  35. # 当前指令
  36. curOp = startAddr
  37. # 7个隐藏函数名
  38. sensNameSet = set(["DialogSetAsync", "SetStackedSoundRect", "SetStackedSound", "ClearStackedSound","ClearStackedSoundRect", "GetPlayerStartLocationY", "GetPlayerStartLocationX"])
  39. sensFun = dict()
  40. otherFun = dict()
  41. while curOp < nextFuncAddr:
  42.     cjName = get_cj_name(curOp)
  43.     if cjName:
  44.         curOp = NextHead(curOp, nextFuncAddr)
  45.         cjAddr = get_cj_addr(curOp)
  46.         if cjName in sensNameSet:
  47.             sensFun[cjName] = cjAddr
  48.         else:
  49.             otherFun[cjName] = cjAddr
  50.     curOp = NextHead(curOp, nextFuncAddr)
  51.    
  52. with open(r"H:\TOBECR\cjextra.txt", "w") as f:
  53.     for key in sensFun:
  54.         print(key + " => " + hex(sensFun[key]), file = f)
  55. otherFunAddr = otherFun.values()
  56. for name in sensFun:
  57.     if sensFun[name] in otherFunAddr:
  58.         print("Address " + hex(sensFun[name]) + " already exists")
  59.     else:
  60.         print("Address " + hex(sensFun[name]) + " is unique")
  61.         
  62. print("Done")
复制代码

评分

参与人数 1威望 +12 收起 理由
kook + 12 good job~

查看全部评分

发表于 2009-4-15 18:03:58 | 显示全部楼层
参数如何?看起来最后两个还是有点用的- -!
回复

使用道具 举报

 楼主| 发表于 2009-4-15 19:39:28 | 显示全部楼层
引用第1楼小药于2009-04-15 18:03发表的  :
看起来最后两个还是有点用的- -!


不就是BJ函数么……
估计这两个函数本来是CJ,后来被废弃了,换BJ了
回复

使用道具 举报

发表于 2009-4-15 20:40:43 | 显示全部楼层
最后两个是bj
回复

使用道具 举报

 楼主| 发表于 2009-4-15 21:55:27 | 显示全部楼层
引用第3楼eff于2009-04-15 20:40发表的  :
最后两个是bj

的确是,不过在game.dll中有注册

GetPlayerStartLocationY => 0x6f2b1e70
GetPlayerStartLocationX => 0x6f2b1d50
(War3 1.21b)
回复

使用道具 举报

发表于 2009-4-15 22:01:09 | 显示全部楼层
但game.dll注册了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-5-2 13:09 , Processed in 0.051252 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表