- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我刚刚偶然发现执行此操作 GetModuleHandle("ntdll.dll")
无需事先调用 LoadLibrary("ntdll.dll")
.
这意味着 ntdll.dll
已经加载到我的进程中。
是否可以安全地假设 ntdll.dll
将始终加载到 Win32 应用程序中,从而不需要调用 LoadLibrary
?
最佳答案
来自 MSDN on LoadLibrary() (强调我的):
The system maintains a per-process reference count on all loadedmodules. Calling LoadLibrary increments the reference count. Callingthe FreeLibrary or FreeLibraryAndExitThread function decrements thereference count. The system unloads a module when its reference countreaches zero or when the process terminates (regardless of thereference count).
换句话说,继续调用 LoadLibrary() 并确保您获得 ntdll.dll
的句柄是安全的——但系统几乎肯定会增加引用计数,因为它应该已经这样了被加载。
至于“真的总是加载吗?”,参见Windows Internals on the Image Loader (简短的回答是肯定的,ntdll.dll
是加载程序本身的一部分,并且始终存在)。
相关段落是:
The image loader lives in the user-mode system DLL Ntdll.dll and not in the kernel library. Therefore, it behaves just like standard code that is part of a DLL, and it is subject to the same restrictions in terms of memory access and security rights. What makes this code special is the guaranty that it will always be present in the running process (Ntdll.dll is always loaded) and that it is the first piece of code to run in user mode as part of a new application. (When the system builds the initial context, the program counter, or instruction pointer is set to an initialization function inside Ntdll.dll.)
关于windows - Win32 应用程序是否自动链接到 ntdll.dll?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43617617/
我最近在研究私有(private) API。我尝试在运行时使用 LoadLibrary 和 GetProcAddress 调用 ntdll.dll 中的 NtOpenFile 等函数。幸运的是,它成功
几个星期以来,我遇到了这种情况,这让我非常沮丧, 我的程序调试得很好,没有错误,当我运行程序时,它会执行工作,几秒钟后它终止于“中断继续”选项,当我查看调用堆栈时,事实证明它是来自 ntdll.dll
我链接到 ntdll.lib 以使用 ZwQueryInformationProcess 并使用多线程运行时库。 ntdll 似乎定义了一些crt 函数。因此,当我链接它并使用运行时库时,我会遇到链接
当 ntdll.dll 映射到新进程时,以及任何 ntdll 的进程初始化运行之前,我想使用以下命令闯入 WinDBG。 sxe ld ntdll.dll ;g 然而,这个技巧根本不起作用, ModL
我在调用 Ntdll.dll 的导出方法时遇到了一些问题 在 VS2012 的 Debug模式下,我得到: Run-Time Check Failure #0 - The value of ESP w
我的程序在执行结束时崩溃,甚至看不到堆栈展开信息。我只能看到这个“ntdll!kifastsystemcallret”,有些人可以透露一些信息吗? 最佳答案 KiFastSystemCallRet 表
知道我为什么会收到此错误吗? 这是完整的错误: First-chance exception at 0x77202282 (ntdll.dll) in Test.exe 0xC0000005: Acc
我正在使用带有 boost v1.52.0 的 Visual Studio 2011 C++ 刚刚添加了在子目录中搜索文件的方法,并开始在程序关闭时出现此错误: Unhandled exception
是否有仅使用 ntdll.dll 的 API 调用或任何其他类似方式在堆栈上分配内存? 我知道 alloca() 会这样做,但我不能使用它,因为我只能使用 ntdll.dll 中的函数。 谢谢! 最佳
我正在尝试从 Windows Server 2003 SP2 x86 上的完全转储内存文件转储堆信息。转储是为在 Windows Server 2003 SP2 x64 计算机上运行的 32 位混合(
我正在调试崩溃转储,该转储出现访问冲突异常 (0xC0000005)。 AVE 来自跳转到不属于进程中任何 2 个加载模块的地址: 什么会导致这个过程这么早发生? 该进程似乎正在映射内存 (_ZwCr
当我尝试运行我的程序时,它从未进入 main() 函数,而是挂起。但是,我的程序在多次调用 ntdll.dll 之后,作为堆栈中的第一个调用,我的程序在我的一个类中抛出了异常。异常似乎是导致我的程序因
我正在研究一个小的刚体模拟。我使用 Irrlicht 引擎进行显示,并使用 openMesh 处理网格。 现在我使用 VerySleepy 分析了我的应用程序,发现大部分时间花在了以下函数中(不包括花
我刚刚偶然发现执行此操作 GetModuleHandle("ntdll.dll") 无需事先调用 LoadLibrary("ntdll.dll") . 这意味着 ntdll.dll 已经加载到我的进程
我有一个我编写的应用程序间歇性崩溃,但我无法在应用程序层捕获异常。我总是在事件日志中得到一个条目,但没有给我太多信息: Faulting application name: BCS-UI.exe, v
我目前正致力于通过 dll 注入(inject) Hook ntdll.dll 调用。首先,我通过 CreateRemoteThread() 在现有进程中创建线程然后我通过 LoadLibrary 加
我有以下代码,其中数组在函数中动态声明。以下程序在 Visual Studio 2013 中完美编译。但是,在运行时,代码在打印数组时中断,错误代码如下: 检测到严重错误 c0000374WaveEq
我做了一个非常简单的程序,它为我自动化了一些事情。我用 C++ 编写了它,它在 Windows 上运行。在 Codeblocks IDE 内部使用 GDB 对其进行调试时,我突然得到了许多断点。我不知
我使用 Delphi Sampling Profiler 分析了我的应用程序的一部分. Like most people ,我看到大部分时间都花在了里面 ntdll.dll . Note: i tur
我试图了解 Windows API 如何创建进程,以便我可以创建一个程序来确定无效的 exe 失败的位置。我有一个调用 kernel32.CreateProcessA 的程序。在 OllyDbg 中,
我是一名优秀的程序员,十分优秀!