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


相关推荐

  • JAVA Applet小应用程序入门

    JAVA Applet小应用程序入门1.Applet如何运行不同于java应用程序,运行applet需要在对应html文件通过<applet>指定applet程序名,即可在浏览器中运行.2.Applet如何编写我的工具是eclipse。新建一个类该类必须是public且继承Applet。文件名与类名一样3.Applet类中方法的执行顺序与生命周期先执行构造方法 再执行init()进行一些数…

    2022年7月8日
    24
  • nessus8.15_nessus使用教程

    nessus8.15_nessus使用教程1、 打开浏览器输入IP加端口8834登录Nessus2、 输入账号密码,均为admin3、 登录成功后,进入到首页4、 点击侧边栏policies,显示策略界面5、 点击newpolicy,显示策略模板6、 选择advancedscan,填写策略名称7、 点击permission,选择canuse,设置所有人可用8、 单击Plugins标签,该界面显示了所有插件程…

    2022年10月19日
    1
  • 罗马字符的读音「建议收藏」

    罗马字符的读音「建议收藏」Αα阿尔法alfaΒβ贝塔bitaΓγ伽马gamaΔδ德耳塔dêltaΕε艾普西龙êpsilonΖζ度截塔zitaΗη艾塔yitaΘθ西塔sitaΙι约塔yotaΚκ卡帕kapa∧λ兰布达lamdaΜμ米尤miuΝν纽niuΞξ克西ksaiΟο奥密克戎oumikelong∏π派paiΡρ版若rou…

    2022年9月30日
    3
  • button.addactionlistener(this)_input button

    button.addactionlistener(this)_input button//首先要在PageLoad()事件中注册属性   protectedvoidPage_Load(objectsender,EventArgse)   {       if(!IsPostBack)       {           Button1.Attributes.Add(“onclick”,”returncheckSame()”);//为Button1添加onc

    2022年9月26日
    4
  • 26524中位数第二人生_计数原理与排列组合是选修几

    26524中位数第二人生_计数原理与排列组合是选修几洛谷P2606 [ZJOI2010]排列计数(组合数 dp)

    2022年4月20日
    114
  • @jsonIgnore不生效

    @jsonIgnore不生效本人使用的是 alibaba 的 fastjson 但是 JsonIgnore 不是 fastjson 的 所以不生效 将注解改为 JSONField serialize false JSONField 来自 com alibaba fastjson annotation 包的 然后序列化的时候就生效了 成功忽略了属性

    2025年6月17日
    3

发表回复

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

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