Load­Library函数返回特殊值时,客户想知道它意味着什么0x10000000
嗯,这意味着LIB被加载进了0x10000000
好的,这里有一些更多的信息:“我们正在尝试调试一个加载DLL的应用程序,并试图在他们调用时挂钩他们的注册表访问Dll­Register­Server。看起来当从特殊句柄返回时Load­Library,注册表写入通过并绕过钩子。另一方面,当返回正常值时Load­Library,钩子起作用。“ 
值没有什么特别之处0x10000000。这是一个像任何其他地址一样的地址。
在这一点上,你的精神力量可能会开始刺痛。每个进行Win32编程的人都应该认识到这一点0x10000000是链接器分配的默认DLL基址。如果您未指定自定义基址,则链接器将以您为基础0x10000000
现在情况开始变得有意义了。被监视的DLL可能是使用默认的基址构建的。该值0x10000000是特殊的,不是因为它的数值,而是因为它匹配DLL的首选地址,这意味着没有发生变基。这反过来表明,如果DLL在其首选地址加载,则注册表挂钩中存在错误。
有问题的代码是从书中复制的,所以现在他们可以调试从书中复制的代码。
等等,我们还没完成。
您可能已经回答了客户的问题,但您还没有解决他们的问题

不支持挂钩和修补这样的DLL。但是,什么支持的是Reg­Override­Predef­Key功能。事实上,这Reg­Override­Predef­Key专门为解决这个问题而设计的:

该RegOverridePredefKey功能可用于软件安装程序。它允许它们重新映射预定义的密钥,加载将安装在系统上的DLL组件,调用DLL中的入口点,并检查组件尝试进行的注册表更改。

文档继续,解释了这样的安装程序如何使用该Reg­Override­Predef­Key函数来完成所需的任务。

A customer wanted to know what it means when the Load­Library 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 Dll­Register­Server. It looks like when the special handle is returned from Load­Library, the registry writes go through and bypass the hook. On the other hand, when a normal value is returned by Load­Library, 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 Reg­Override­Predef­Key function. In fact, the Reg­Override­Predef­Key was designed specifically to solve this very problem:

The Reg­Override­Predef­Key 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 Reg­Override­Predef­Key function to accomplish the desired task.

实例句柄0x10000000有什么特别之处?What is so special about the instance handle 0x10000000?的更多相关文章

  1. Lua语言的特别之处

    所谓特别,是相对的,是相对别的主流语言而言,有些也可能只是我个人看法. 1. 函数定义与调用,与代码位置的先后顺序有关,例如 calculate() function calculate() .... ...

  2. xx.exe 中的 0x7c92e4df 处最可能的异常: 0xC0000008: An invalid handle was specified

    今天遇到个超级奇怪的问题,昨天还好端端的程序,今天用VS打开后,在关闭主窗口的时候居然弹出错误提示:xx.exe 中的 0x7c92e4df 处最可能的异常: "0xC0000008: An ...

  3. 主函数特别之处:public static void main(String[] args)

    public static void main(String[] args) public class Test_java {//主函数特殊之处 public static void main(Str ...

  4. JDK8下的HashMap有什么特别之处?

    一.前言 上篇认真的分析了在JDK7下的HashMap, 如果还没看过的或者忘记了的可以先去回顾下,这样可以更好的了解JDK8下的HashMap基于JDK7做了什么改动.分析JDK8下的HashMap ...

  5. 【笨木头Lua专栏】基础补充02:函数的几个特别之处

    没想到距离上一篇基础补充已经过了1年多了,近期准备捡回Lua,把基础都补补,今天来聊聊Lua的函数吧~ 0.环境 我突然对Lua又大感兴趣的最主要原因是,Cocos Code IDE開始浮出水面了,它 ...

  6. main特别之处

    //package new_Object; public class Main{ public static void main(String[] args) { System.out.println ...

  7. 01:main特别之处

    有点意思的main 图解运行结果解释:[:数组L:长类型ava.lang:包名String:字符串类型元素@:分界符667262b6:哈希值主函数特殊之处:public static void mai ...

  8. Python中作用域的特别之处

    def a(): a = [] def aappend(): a.append(1) aappend() print a def b(): b = 1 def bchange(): b += 1 # ...

  9. Javascript里的if判断与逻辑运算符(||, &&)和比较运算符的特别之处

    写JS时不可避免要用到 if 与 逻辑运算符( ||, &&). 如果你经常阅读Js的第三方组件源码, 会发现有一种写法作为初始化变量的方法经常出现. var variable = v ...

随机推荐

  1. C++类库开发详解(转)

    前言:这是一篇总结性的文章,需要有一点C++和dll基本知识的基础,在网上查阅了很多资料感觉没有一篇详细.具体.全面的dll开发介绍,我这是根据最近项目和网上资料整理出来的,并附带实例的一个总结性的文 ...

  2. discuz x3.3后台admin.php防止直接恶意访问

    功能说明:admin.php是discuz默认的后台地址,正常情况下可以直接访问,为了防止某些恶意访问的情况,可以修改以下内容进行安全性能提升. 适用版本:Discuz!x1-x3.3 具体实施方案: ...

  3. 【PHP】系统部署

    1.MySql数据库,单独创建用户和数据库 使用MySql-Front导入,避免使用Navicat导入 2.httpd-vhosts.conf配置 文件位于:D:\Xampp\apache\conf\ ...

  4. 品优购项目 单表过程 乒乓过程 入口 MyBatis逆向工程 dubbo框架搭建 品牌表CRUD bug集锦

  5. 11.04Test

    11.04Test 查看请点个赞 转载请注明出处(~不然~) 题目 描述 做法 \(BSOJ5143\) 要求给\(M\)个通道染色,使得同色通道不能相交 转为矛盾模型,\(2-sat\)or二分图染 ...

  6. rhce备战笔记

    1)配置selinuxvim /etc/slinux/config    SELINUX=enforcingsetenforce 1getenforce两台都做 2)配置SSHvim /etc/ssh ...

  7. 四、执行Python的两种方式

    第一种 交互式 ,在cmd中运行 · jupyter对这一种进行了封装 优点: 直接输出结果 缺点: 无法保存 第二种 命令式,通过cmd中输入python3文本 txt文件可以,py文件也可以,命令 ...

  8. Xamarin.Forms之样式

    使用XAML样式设置Xamarin.Forms应用的样式Xamarin.Forms应用程序的样式传统上是通过使用Style类将一组属性值分组到一个对象中来完成的,然后可以将其应用于多个视觉元素实例. ...

  9. 【数论】[逆元,错排]P4071排列计数

    题目描述 求有多少种长度为n的系列A,满足以下条件: 1~n这n个数在序列中各出现一次:若第i个数a[i]的值为i,则称i是稳定的.序列恰有m个数是稳定的. 输出序列个数对1e9+7取模的结果. So ...

  10. lg4820 书堆

    题目链接 题意概述:n本书,在桌子边缘堆放,求最长长度. 首先……我们需要一点初中物理知识来推一下规律. 下图是一本书的情况,一本书时书伸出1/2处于临界状态,显然. 两本书时,把两本书看作整体,则有 ...