• <bdo id='tEffi'></bdo><ul id='tEffi'></ul>

      <i id='tEffi'><tr id='tEffi'><dt id='tEffi'><q id='tEffi'><span id='tEffi'><b id='tEffi'><form id='tEffi'><ins id='tEffi'></ins><ul id='tEffi'></ul><sub id='tEffi'></sub></form><legend id='tEffi'></legend><bdo id='tEffi'><pre id='tEffi'><center id='tEffi'></center></pre></bdo></b><th id='tEffi'></th></span></q></dt></tr></i><div id='tEffi'><tfoot id='tEffi'></tfoot><dl id='tEffi'><fieldset id='tEffi'></fieldset></dl></div>

      <small id='tEffi'></small><noframes id='tEffi'>

      <legend id='tEffi'><style id='tEffi'><dir id='tEffi'><q id='tEffi'></q></dir></style></legend>

      <tfoot id='tEffi'></tfoot>
      1. 运行时检查失败 #0 从 kernel32.dll 加载 QueryFullPro

        时间:2023-08-01
        <i id='76flN'><tr id='76flN'><dt id='76flN'><q id='76flN'><span id='76flN'><b id='76flN'><form id='76flN'><ins id='76flN'></ins><ul id='76flN'></ul><sub id='76flN'></sub></form><legend id='76flN'></legend><bdo id='76flN'><pre id='76flN'><center id='76flN'></center></pre></bdo></b><th id='76flN'></th></span></q></dt></tr></i><div id='76flN'><tfoot id='76flN'></tfoot><dl id='76flN'><fieldset id='76flN'></fieldset></dl></div>
          <bdo id='76flN'></bdo><ul id='76flN'></ul>

              <tfoot id='76flN'></tfoot>
            1. <legend id='76flN'><style id='76flN'><dir id='76flN'><q id='76flN'></q></dir></style></legend>

                  <tbody id='76flN'></tbody>

                <small id='76flN'></small><noframes id='76flN'>

                • 本文介绍了运行时检查失败 #0 从 kernel32.dll 加载 QueryFullProcessImageName的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个应用程序需要在 WinXP 和 Vista64 上运行.我的程序需要 QueryFullProcessImageName() 才能在 Vista 上运行,但不能在 XP 上运行.

                  I have an application that needs to run both on WinXP and Vista64. My program requires QueryFullProcessImageName() to work on Vista but not on XP.

                  我尝试通过 kernel32.dll 加载 QueryFullProcessImageName()(而不是静态链接),以便相同的可执行文件可以在 WinXP 和 Vista 上运行.加载它的代码是:

                  I try to load QueryFullProcessImageName() (instead of linking statically) via the kernel32.dll so that the same executable can run on both WinXP and Vista. The code that loads it is:

                  //only gets called on vista
                  bool LoadQueryFullProcessImageName()
                  {
                    HMODULE hDLL = LoadLibrary("kernel32.dll");
                    if (!hDLL) return(0);
                  
                    //Now use pointer to get access to functions defined in DLL
                    fpQueryFullProcessImageName = (LPQueryFullProcessImageName)GetProcAddress(hDLL, "QueryFullProcessImageNameA"); //ANSI version
                    if (!fpQueryFullProcessImageName) 
                       return false;
                  
                    return true;
                  }
                  

                  typedef 是

                  typedef WINBASEAPI
                  BOOL (*LPQueryFullProcessImageName)(
                      __in HANDLE hProcess,
                      __in DWORD dwFlags,
                      __out_ecount_part(*lpdwSize, *lpdwSize) LPSTR lpExeName,
                      __inout PDWORD lpdwSize
                      );
                  

                  不幸的是,当函数指针被取消引用时,我在 Vista 上遇到运行时错误:

                  Unfortunately, I get a run time error on Vista when the function pointer is dereferenced:

                  运行时检查失败 #0 - ESP 的值未在函数调用中正确保存.这通常是由于使用一种调用约定声明的函数与使用不同调用约定声明的函数指针调用的结果.

                  Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

                  typedef 直接来自 .h 文件,所以我不明白为什么它搞砸了.有什么帮助吗?我已经尝试了大量的变体,但没有运气.

                  The typedef is straight from the .h file so I can't understand why it's messing up. Any help? I've tried tons of variants but no luck.

                  推荐答案

                  您应该将 typedef 更改为

                  You should change the typedef to

                  typedef BOOL (WINAPI *LPQueryFullProcessImageName)(
                       HANDLE hProcess, DWORD dwFlags, LPSTR lpExeName, PDWORD lpdwSize );
                  

                  WINBASEAPI 用于声明静态依赖项,它不指定 __stdcall 调用约定.您使用 GetProcAddress(),因此您对静态依赖项不感兴趣,但您仍然需要 __stdcall 以进行正确的调用.

                  WINBASEAPI is used for declaring static dependencies and it doesn't specify the __stdcall calling convention. You use GetProcAddress() and so the static dependency is of no interest to you, but you still need __stdcall for proper call invokation.

                  这篇关于运行时检查失败 #0 从 kernel32.dll 加载 QueryFullProcessImageName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用 ShellExecuteEx 并捕获标准输入/输出/错误 下一篇:使用 Windows API 获取用户的桌面文件夹?

                  相关文章

                  最新文章

                  <small id='87qMG'></small><noframes id='87qMG'>

                  • <bdo id='87qMG'></bdo><ul id='87qMG'></ul>
                      <legend id='87qMG'><style id='87qMG'><dir id='87qMG'><q id='87qMG'></q></dir></style></legend>

                      <i id='87qMG'><tr id='87qMG'><dt id='87qMG'><q id='87qMG'><span id='87qMG'><b id='87qMG'><form id='87qMG'><ins id='87qMG'></ins><ul id='87qMG'></ul><sub id='87qMG'></sub></form><legend id='87qMG'></legend><bdo id='87qMG'><pre id='87qMG'><center id='87qMG'></center></pre></bdo></b><th id='87qMG'></th></span></q></dt></tr></i><div id='87qMG'><tfoot id='87qMG'></tfoot><dl id='87qMG'><fieldset id='87qMG'></fieldset></dl></div>
                      <tfoot id='87qMG'></tfoot>