实例句柄0x10000000有什么特别之处?What is so special about the instance handle 0x10000000?
当LoadLibrary函数返回特殊值时,客户想知道它意味着什么0x10000000。
嗯,这意味着LIB被加载进了0x10000000?
好的,这里有一些更多的信息:“我们正在尝试调试一个加载DLL的应用程序,并试图在他们调用时挂钩他们的注册表访问DllRegisterServer。看起来当从特殊句柄返回时LoadLibrary,注册表写入通过并绕过钩子。另一方面,当返回正常值时LoadLibrary,钩子起作用。“
值没有什么特别之处0x10000000。这是一个像任何其他地址一样的地址。
在这一点上,你的精神力量可能会开始刺痛。每个进行Win32编程的人都应该认识到这一点0x10000000是链接器分配的默认DLL基址。如果您未指定自定义基址,则链接器将以您为基础0x10000000。
现在情况开始变得有意义了。被监视的DLL可能是使用默认的基址构建的。该值0x10000000是特殊的,不是因为它的数值,而是因为它匹配DLL的首选地址,这意味着没有发生变基。这反过来表明,如果DLL在其首选地址加载,则注册表挂钩中存在错误。
有问题的代码是从书中复制的,所以现在他们可以调试从书中复制的代码。
等等,我们还没完成。
您可能已经回答了客户的问题,但您还没有解决他们的问题。
不支持挂钩和修补这样的DLL。但是,什么是支持的是RegOverridePredefKey功能。事实上,这RegOverridePredefKey是专门为解决这个问题而设计的:
该RegOverridePredefKey功能可用于软件安装程序。它允许它们重新映射预定义的密钥,加载将安装在系统上的DLL组件,调用DLL中的入口点,并检查组件尝试进行的注册表更改。
文档继续,解释了这样的安装程序如何使用该RegOverridePredefKey函数来完成所需的任务。
A customer wanted to know what it means when the LoadLibrary function returns the special value 0x10000000.
Um, it means that the library was loaded at 0x10000000?
Okay, here’s some more information: “We’re trying to debug an application which loads DLLs and attempts to hook their registry accesses when they call DllRegisterServer. It looks like when the special handle is returned from LoadLibrary, the registry writes go through and bypass the hook. On the other hand, when a normal value is returned by LoadLibrary, the hook works.”
There is nothing special about the value 0x10000000. It’s an address like any other address.
At this point, your psychic powers might start tingling. Everybody who does Win32 programming should recognize that 0x10000000 is the default DLL base address assigned by the linker. If you don’t specify a custom base address, the linker will base you at 0x10000000.
Now things are starting to make sense. The DLL being monitored was probably built with the default base address. The value 0x10000000 is special not because of its numeric value, but because it matches the DLL’s preferred address, which means that no rebasing has occurred. And this in turn suggests that there’s a bug in the registry hooks if the DLL is loaded at its preferred address.
The code in question was copied from a book, so now they get to debug code copied from a book.
Wait, we’re not finished yet.
You may have answered the customer’s question, but you haven’t solved their problem.
Hooking and patching DLLs like this is not supported. But what is supported is the RegOverridePredefKey function. In fact, the RegOverridePredefKey was designed specifically to solve this very problem:
The RegOverridePredefKey function is intended for software installation programs. It allows them to remap a predefined key, load a DLL component that will be installed on the system, call an entry point in the DLL, and examine the changes to the registry that the component attempted to make.
The documentation continues, explaining how such an installation program might use the RegOverridePredefKey function to accomplish the desired task.
实例句柄0x10000000有什么特别之处?What is so special about the instance handle 0x10000000?的更多相关文章
- Lua语言的特别之处
所谓特别,是相对的,是相对别的主流语言而言,有些也可能只是我个人看法. 1. 函数定义与调用,与代码位置的先后顺序有关,例如 calculate() function calculate() .... ...
- xx.exe 中的 0x7c92e4df 处最可能的异常: 0xC0000008: An invalid handle was specified
今天遇到个超级奇怪的问题,昨天还好端端的程序,今天用VS打开后,在关闭主窗口的时候居然弹出错误提示:xx.exe 中的 0x7c92e4df 处最可能的异常: "0xC0000008: An ...
- 主函数特别之处:public static void main(String[] args)
public static void main(String[] args) public class Test_java {//主函数特殊之处 public static void main(Str ...
- JDK8下的HashMap有什么特别之处?
一.前言 上篇认真的分析了在JDK7下的HashMap, 如果还没看过的或者忘记了的可以先去回顾下,这样可以更好的了解JDK8下的HashMap基于JDK7做了什么改动.分析JDK8下的HashMap ...
- 【笨木头Lua专栏】基础补充02:函数的几个特别之处
没想到距离上一篇基础补充已经过了1年多了,近期准备捡回Lua,把基础都补补,今天来聊聊Lua的函数吧~ 0.环境 我突然对Lua又大感兴趣的最主要原因是,Cocos Code IDE開始浮出水面了,它 ...
- main特别之处
//package new_Object; public class Main{ public static void main(String[] args) { System.out.println ...
- 01:main特别之处
有点意思的main 图解运行结果解释:[:数组L:长类型ava.lang:包名String:字符串类型元素@:分界符667262b6:哈希值主函数特殊之处:public static void mai ...
- Python中作用域的特别之处
def a(): a = [] def aappend(): a.append(1) aappend() print a def b(): b = 1 def bchange(): b += 1 # ...
- Javascript里的if判断与逻辑运算符(||, &&)和比较运算符的特别之处
写JS时不可避免要用到 if 与 逻辑运算符( ||, &&). 如果你经常阅读Js的第三方组件源码, 会发现有一种写法作为初始化变量的方法经常出现. var variable = v ...
随机推荐
- 一些坑 Java 执行命令行命令 Spring Boot 打包为jar ResourceUtils.getFile 等出现的问题
Java 执行命令行命令 这个没技术含量的东西耗费了我半个多小时 String command = ....; Process process = Runtime.getRuntime().exec( ...
- php怎么识别真实ip
PHP 里用来获取客户端 IP 的变量有这些: $_SERVER['HTTP_CLIENT_IP'] 这个头是有的,但是很少,不一定服务器都实现了.客户端可以伪造.(推荐学习:PHP编程从入门到精通) ...
- python2和python3共存方法
拿到安装包,安装python3 centos: sudo yum install python36 ubuntu: sudo add-apt-repository ppa:deadsnakes/ppa ...
- 基于原型的js语言
基于原型编程首先要考虑的问题:原型与对象的关系: 使用原型概念建立基于复用目的的联系链,以供运行时系统使用. 一.原型系统原理 封装.原型.多态 vs 封装.继承.多态 引用原型 vs 复制原型 机制 ...
- 项目(二) esp32-cam 网页图像人脸
https://randomnerdtutorials.com/esp32-cam-video-streaming-face-recognition-arduino-ide/ ESP32-CAM Pi ...
- 013_matlab读取ecxel(脚本读取)
MATLAB读取ecxel文件数据 视频教程:https://v.qq.com/x/page/b3039we542o.html 资料下载:https://download.csdn.net/downl ...
- 在服务器搭建git仓库
使用root登录服务器 添加一个新用户(git仓库的所有者) useradd gituser # gituser---> 用户名字 设置密码 passwd gituser 配置sshd服务参数 ...
- yugabyte与cockroachdb 的几个区别
下图是来自官方文档 说明 今天打算尝试使用yugabyte做为hasura graphql-engine 的pg 引擎,发现比较完美,仔细看官方文档,原来yugabyte 底层实现直接是基于原生pg ...
- JVM相关内容简介(转)
JAVA堆内存管理是影响性能主要因素之一.堆内存溢出是JAVA项目非常常见的故障,在解决该问题之前,必须先了解下JAVA堆内存是怎么工作的. 先看下JAVA堆内存是如何划分的,如图: JVM内存划分为 ...
- GoCN每日新闻(2019-10-27)
GoCN每日新闻(2019-10-27) 1. Golab(意大利GopherCon)2019见闻 http://fedepaol.github.io/blog/2019/10/23/golab-20 ...