TC官方合作论坛

标题: TC如何读取8字节的内存地址? [打印本页]

作者: jianxitt    时间: 2015-1-13 16:48
标题: TC如何读取8字节的内存地址?
RT...请问如何才能读取内存地址中8字节数据.或者有什么插件能做到这点吗?
TC中只有4字节,而在大漠帮助文档中看到的一段代码,菜鸟表示完全看不懂,一头雾水~~~
//--------------------------------------------大漠文档分割线-------------------------------------------//
对于如何读取长整数类型(64位的整数),方法如下(这里只是提供思路,各个平台有各个平台的写法)
用两次ReadInt读取高低各32位 然后组合成64位整数. 比如
high = dm.ReadInt(hwnd,"10101014",0)
low  = dm.ReadInt(hwnd,"10101010",0)
value_64 = ((INT64)(DWORD)high) << 32 + (DWORD)low



这里贴一段用vbs如何读取64位整数的代码.
// 64位整数 高32位是低地址 低32位是高地址
high = dm.ReadInt(hwnd,"10101014",0)
low  = dm.ReadInt(hwnd,"10101010",0)

TracePrint ConvertToLongInt(high,low)

function ConvertToLongInt(high,low)
   dim temp1,temp2,temp,low_length,i
   temp1 = cstr(hex(high))
   temp2 = cstr(hex(low))
   low_length = len(temp2)
   low_length = 8 – low_length
   for i = 1 to low_length
      temp2 = "0"&temp2
   next
   temp = "&H" & temp1 & temp2
   ConvertToLongInt = cdbl(temp)
end Function

作者: sam7894604    时间: 2015-1-13 19:53
本帖最后由 sam7894604 于 2015-1-13 19:55 编辑

high = dm.ReadInt(hwnd,"10101014",0)     //读地址+4位置整数,为高位
low  = dm.ReadInt(hwnd,"10101010",0)     //读地址位置整数,为低位

TracePrint ConvertToLongInt(high,low)       //调试输出 十六进制长整数

function ConvertToLongInt(high,low)
   dim temp1,temp2,temp,low_length,i       //声名变量
   temp1 = cstr(hex(high))                          //将参数 high 转为十六进制文本型
   temp2 = cstr(hex(low))                           //将参数 low 转为十六进制文本型
   low_length = len(temp2)                        //计算 low 文本型字数
   low_length = 8 – low_length                  //计算需补多少零
   for i = 1 to low_length                           //此处遍历都是在补 low 的零
      temp2 = "0"&temp2
   next
   temp = "&H" & temp1 & temp2             //结合高位与低位为十六进制文本形式
   ConvertToLongInt = cdbl(temp)            //转换 十六进制文本 到 双精度浮点型
end Function




作者: jianxitt    时间: 2015-1-13 21:39
sam7894604 发表于 2015-1-13 19:53
high = dm.ReadInt(hwnd,"10101014",0)     //读地址+4位置整数,为高位
low  = dm.ReadInt(hwnd,"10101010" ...

先生大才,请受小弟一拜
作者: rainshine    时间: 2015-1-13 21:55
value_64 = ((INT64)(DWORD)high) << 32 + (DWORD)low
这表达式都写的很明白了- - 高位乘以int的最大值+低位就是了- -。。用得着这么麻烦




欢迎光临 TC官方合作论坛 (http://bbs.52tc.co/) Powered by Discuz! X3.1