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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • session、cookie、token 详解

    发展史1、很久很久以前,Web基本上就是文档的浏览而已,既然是浏览,作为服务器,不需要记录谁在某一段时间里都浏览了什么文档,每次请求都是一个新的HTTP协议,就是请求加响应,尤其是我不用记住是谁刚刚发了HTTP请求,每个请求对我来说都是全新的。这段时间很嗨皮2、但是随着交互式Web应用的兴起,像在线购物网站,需要登录的网站等等,马上就面临一个问题,那就是要管理会话,…

    2022年4月6日
    53
  • JLink接口的SWD接法

    JLink接口的SWD接法下面为J-Link接口定义:仿真器端口连接目标板备注1.VCCMCU电源VCCVCC2.VCCMCU电源VCCVCC3.TRSTTRSTTestReSeT/pin4.GNDGND或悬空 5.TDITDITestDataInpin6.

    2022年5月27日
    121
  • 3. java缓存-线程内缓存guava cache

    3. java缓存-线程内缓存guava cacheguavacache的缓存结构常用的guavacache缓存根据上图中的缓存框架,我们常用的一些缓存实例有:LocalManualCache和LocalLoadingCache,两者唯一的区别就是LocalLoadingCacheextendsLocalManualCacheimplementsLoadingCache<K,V>接口。LocalManualCache…

    2022年10月4日
    2
  • 几种保持登录状态的方式

    几种保持登录状态的方式

    2021年11月6日
    49
  • java 命令 native2ascii_java native2ascii.exe命令

    java 命令 native2ascii_java native2ascii.exe命令native2ascii.exe是Java的一个文件转码工具native2ascii.exe的语法格式:native2ascii[-reverse][-encoding编码][输入文件[输出文件]]说明:-reverse:将Unicode编码转为本地编码。-reverse-encoding编码:将指定编码转为本地编码。-encoding编码:转换为指定编码。空:转换为Unic…

    2022年9月12日
    2
  • jsoup 1.5.2 发布,超棒的 HTML 解析器

    jsoup 1.5.2 发布,超棒的 HTML 解析器

    2021年8月10日
    61

发表回复

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

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