- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 LoadLibrary 和 GetProcAddress 加载 dll。 LoadLibrary 返回一个有效的句柄,但我对 GetProcAddress 的调用返回 NULL。调用 GetLastError 返回 87,即 ERROR_INVALID_PARAMETER。我验证了我传递给 GetProcAddress 的函数名称与运行时返回的相同 dumpbin /exports
在 dll 上。不幸的是,这是为了工作,所以我不能包含实际的代码。但这里有一个经过编辑的版本,可以让您了解我在做什么。
HINSTANCE hDLL = NULL;
hDLL = LoadLibrary(L"<PATH TO DLL>");
if (hDLL == NULL)
{
// error handling code
}
g_var1 = (VAR1_TYPE) GetProcAddress(hDLL, L"Function1Name");
g_var2 = (VAR2_TYPE) GetProcAddress(hDLL, L"Function2Name");
if (!g_var1 ||
!g_var2 )
{
// error handling code
}
dumpbin
相同显示我不认为这是我的问题。有任何想法吗?
When Windows CE loads a DLL, all path information is ignored when determining if the DLL is already loaded. This means that a DLL with the same name but a different path can only be loaded once. In addition, a module ending with the extension .cpl is treated as if the extension is .dll.
最佳答案
是的,这是一个常见的陷阱。如果您没有提供 DLL 的完整路径,LoadLibrary 将返回一个已加载的同名 DLL 的句柄。
来自 MSDN :
If lpFileName does not include a path and there is more than one loaded module with the same base name and extension, the function returns a handle to the module that was loaded first.
关于dll - GetProcAddress 返回 NULL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24289101/
当我通过 win32api 调用 GetProcAddress() 时,我成功获得了句柄,但 ctypes 没有。 代码是: from ctypes import windll import win3
我使用名为“render()”的函数创建了一个 DLL,我想将它动态加载到我的应用程序中,但 GetProcAddress 找不到它。这是 DLL .h: #ifdef D3D_API_EXPORTS
这个问题在这里已经有了答案: Exporting functions from a DLL with dllexport (4 个答案) 关闭 5 年前。 我在动态库中有一个函数,如下所示: nam
正如我们所知,我们可以使用 GetProcAddress 从 DLL 句柄获取函数指针,例如在 DLL 中定义的方法 foo: int foo(long) 对于 foo 函数,我们可以得到这样的函数指
我得到了 MyDll.dll 及其函数定义如下 void pascal Myfunction(BOOL); 当我试图在另一个项目中使用该函数时,我无法使用 GetProcAddress() 获取该函数
我需要在 C++ 中动态加载一个 dll。 我已遵循本教程 http://msdn.microsoft.com/en-us/library/ms235636.aspx创建 dll,一切正常。 然后我关
我有一个游戏的 DLL,我正在导入到 Windows32 应用程序中,我已经成功加载它并调用了很多函数。但是我遇到了一个问题,我需要使用的某个函数需要传递给它的结构。 当我反汇编 DLL 时,我似乎可
这个问题在这里已经有了答案: GetProcAddress cannot find my functions (2 个答案) 关闭 9 年前。 我尝试使用 LoadLibrary 和 GetProc
有人解释下为什么下一段代码会在 ntdll.dll 中返回一个指针吗? GetProcAddress(LoadLibraryA("kernel32.dll"), "EncodePointer"); G
我尝试使用 getprocaddress 查找变量地址。但是我在这方面遇到了问题。问题是我将变量名称一个一个地存储在 char buff[100] 中,就像在循环中一样。那个时候我不知道变量的类型。那
我正在学习如何在 Windows 7 上使用 ctypes 在 python 中创建一个简单的调试器。我的问题是下面给出的代码似乎返回了一个无效地址(这是我对问题的猜测),但我可以弄清楚为什么。我想这
出于某种原因,每当我的 C# .NET 2.0 应用程序调用 GetProcAddress 时,它总是返回零。 public class MyClass { internal static c
使用 dlopen,您可以提供 NULL 作为库名称,并获得一个句柄,允许您在 任何 加载的库中找到一个符号库: If filename is a NULL pointer, then the ret
我正在尝试通过 Firemonkey 框架使用 Delphi XE2 来制作一个插件系统。问题是我收到错误 GetProcAddress 是未声明的标识符。当我尝试在 VCL 项目中使用 GetPro
我必须使用 DLL 中的一个简单函数;我能够加载库,但 GetProcAddress 返回 NULL。我想我了解名称修改,但也许我做错了什么。谢谢(代码如下,我会尽快添加所需的其他信息): mydll
我正在尝试使用 LoadLibrary 和 GetProcAddress 加载 dll。 LoadLibrary 返回一个有效的句柄,但我对 GetProcAddress 的调用返回 NULL。调用
这是我的代码。这看起来很简单,但不知何故它就是行不通。对该函数的最终调用总是因访问错误而失败。 extern "C" { typedef const char* (*Init_fptr_t)(
这个问题几乎可以归结为“我可以安全地将函数指针转换为参数可转换为这些类型的函数指针吗?”,但如果没有实际示例,这听起来非常可疑。 我制作了一个小的实用函数来从 DLL 中调用某些东西,给定 DLL 名
在我的例子中,我通过有效导出函数名称的 GetProcAddress 获得了一个函数指针,一旦我的应用程序调用导出函数,它就会在显示输出后崩溃。如果我从函数和 typdef 中删除参数并直接将 193
我目前在访问 dll 文件中的方法时遇到问题。我尝试访问的方法属于该类型。 int dstoch (float,float,float,float,float,float,float,float,fl
我是一名优秀的程序员,十分优秀!