LoadLibrary失败的原因「建议收藏」

LoadLibrary失败的原因「建议收藏」今天使用LoadLibrary时,失败,于是翻了一下MSDN:LoadLibraryTheLoadLibraryfunctionmapsthespecifiedexecutablemoduleintotheaddressspaceofthecallingprocess. Foradditionalloadoptions,usetheLo

大家好,又见面了,我是你们的朋友全栈君。

今天使用LoadLibrary时,失败,于是翻了一下MSDN:

LoadLibrary
The LoadLibrary function maps the specified executable module into the address space of the calling process. 

For additional load options, use the LoadLibraryEx function. 

HMODULE LoadLibrary(
  LPCTSTR lpFileName   // file name of module
);
Parameters
lpFileName 
[in] Pointer to a null-terminated string that names the executable module (either a .dll or .exe file). The name specified is the file name of the module and is not related to the name stored in the library module itself, as specified by the LIBRARY keyword in the module-definition (.def) file. 
If the string specifies a path but the file does not exist in the specified directory, the function fails. When specifying a path, be sure to use backslashes (\), not forward slashes (/). 

If the string does not specify a path, the function uses a standard search strategy to find the file. See the Remarks for more information. 

Return Values
If the function succeeds, the return value is a handle to the module.

If the function fails, the return value is NULL. To get extended error information, call GetLastError. 

Windows 95: If you are using LoadLibrary to load a module that contains a resource whose numeric identifier is greater than 0x7FFF, LoadLibrary fails. If you are attempting to load a 16-bit DLL directly from 32-bit code, LoadLibrary fails. If you are attempting to load a DLL whose subsystem version is greater than 4.0, LoadLibrary fails. If your DllMain function tries to call the Unicode version of a Win32 function, LoadLibrary fails. 

—————————————————————————————————————————————————————————————-

注意上面红色的文字,如果我们在dll的入口函数DllMain()中调用Unicode版本的系统API,则

LoadLibrary加载我们的dll文件时会失败,这就是我这次加载dll失败的原因,将API改为A版本的就

正常了,如GetModuleFileNameA

———————————————————————————————————————————————————————————–

LoadLibrary失败的原因「建议收藏」

您的十分满意是我追求的宗旨。

您的一点建议是我后续的动力。


版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/158361.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • echarts柱状图显示值_echarts tooltip

    echarts柱状图显示值_echarts tooltip犯罪嫌疑人Xhttp://echarts.baidu.com/opti…sunburst没有提供tooltip显示item的name属性,name在data中,所以可以在sunburst.data.emphasis设置vardata=[{name:’Grandpa’,emphasis:{itemStyle:{color:’r…

    2022年9月26日
    4
  • Java二维数组排序

    Java二维数组排序Java二维数组排序

    2022年4月29日
    48
  • pycharm2019.3.3激活成功教程_pycharm界面

    pycharm2019.3.3激活成功教程_pycharm界面PyCharm是由著名的JetBrains公司所打造的一款功能强大的PythonIDE,它具有一般IDE都具备的功能,并且使用起来非常方便好用。最近需求PyCharm激活码的网友非常多,小编就在这里给大家分享一下PyCharm2019最新可用的激活注册码。激活Pycharm专业版的方法有很多,小编在这里主要给大家分享最有效的两种,一种是使用最新可用的注册激活码,一种是使用激活成功教程补丁的方法,这种方法…

    2022年8月27日
    3
  • Mbus主机常用发送命令解析[通俗易懂]

    Mbus主机常用发送命令解析[通俗易懂]在进行Mbus通信时,一些常见的命令会有混淆或者不清楚,下面进行一些总结。Mbus通信的命令格式有几种,分别如下图:其中“SingleCharacter”主要是用于从机回复“确认”信息,一般是一个“E5”作为回复。“ShortFrame”是短命令,也叫一级地址命令,我们经常使用的“10 5B FE 59 16”就是这种命令。“ControlFrame”为控制命令,

    2022年10月15日
    2
  • gimp中文版教程_GIMP中详细教程.pdf「建议收藏」

    gimp中文版教程_GIMP中详细教程.pdf「建议收藏」GIMP中详细教程GIMP实用系列教程1文件的打开和存储概述打开GIMP软件其初始界面如下:左边是工具,工具箱中每选择一种工具后,通常在其下部会出现一个与其相配的选项栏一起使用的。因此每选好一种工具,首先要把选项栏中的有关选项根据需要选定以后才开始使用。例如:图中选择了画笔,则画笔的选项栏可以选择其不透明度、画笔的笔尖形状、画笔的大小等选项。右边通常可以放置一个图层对话框,如未出现可以在下拉…

    2022年4月19日
    94
  • rocketmq原理与实战解析_rocketmq底层原理

    rocketmq原理与实战解析_rocketmq底层原理broker1.broker的启动brker的启动Broker向namesrv注册Topic在broker文件上的存储json格式Namesrv接收Broker注册的topic信息,na

    2022年8月1日
    5

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号