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


相关推荐

  • 史上最好听的十首纯音乐推荐[通俗易懂]

    史上最好听的十首纯音乐推荐[通俗易懂]天然去雕饰,清水出芙蓉。不需要歌词我们就能感受到那或美丽忧伤,或轻灵欢快,或激昂艰辛的情绪。思绪随着旋律而起伏,心中莫名就有一种感动,无法用词语表达,无言却胜过万语千言。一、《LuvLetter》

    2022年8月4日
    3
  • “狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作

    “狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作一、垃圾文字生成器介绍最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。他的文风可能是这样的:你发现,…

    2022年5月22日
    43
  • java localdatetime转date_java编码格式转换

    java localdatetime转date_java编码格式转换上篇文章介绍了Java8和Java8之前的时间处理的相关类,但是在日常开发中难免会遇到Java8和之前的旧对象互转的需求。我整理了一下之前的内容,做了一个工具类,如下:publicclassDateUtils{/***@Author:zhuoli*@Description:判断unix当前unix时间是否为0点*@paramu…

    2022年10月3日
    0
  • LTE-FDD和LTE-TDD的区别

    LTE-FDD和LTE-TDD的区别注:本篇大部分内容源自“再见理想”的博客园,详细链接:https://www.cnblogs.com/exmyth/p/4572934.html1.什么叫LET4G故名思议就是第四代移动电话行动通信标准,其中包括TD-LTE(国外称作LTE-TDD,叫法不同,意思是一样的)和FDD-LTE两种制式。而中移动使用的就是TD-LTE,中联通与中电信则是使用TD-LTE与FDD-LTE…

    2022年6月5日
    35
  • phpstorm激活码2021最新破解方法

    phpstorm激活码2021最新破解方法,https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月15日
    32
  • 2022年面试必问的Python面试题&答案

    2022年面试必问的Python面试题&答案Python新手在谋求一份Python编程工作前,必须熟知Python的基础知识。这里我为大家准备了一份2022年最常见Python面试题合集,既有基本的Python面试题,也有高阶版试题来指导你准备面试,试题均附有答案。面试题内容包括编码、数据结构、脚本撰写等话题。

    2025年5月28日
    0

发表回复

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

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