哪个DLL具有PathCchAppend? [英] Which DLL has PathCchAppend?

查看:48
本文介绍了哪个DLL具有PathCchAppend?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图有条件地使用(如果可用)功能 PathCchAppend 。我从头文件 pathcch.h 获得了功能签名。但是,当我尝试从 SHLWAPI.DLL 获取函数的地址时,它将失败:

I'm trying to conditionally use (if available) the function PathCchAppend. I have got the function signature from header pathcch.h. However, when I try to get the address of function from SHLWAPI.DLL, it fails:

auto pca = GetProcAddress(GetModuleHandle(L"shlwapi.dll"), "PathCchAppend");

使用Depends,我发现此DLL中不存在此功能(我在Windows 10上)。没有任何 pathcch.dll ,因此也无法加载它。

Using Depends, I saw that this function does not exist in this DLL (I'm on Windows 10). There doesn't exist any pathcch.dll and hence cannot load it either.

此函数在哪个DLL中

编辑:
多亏了答案。在这里,我找到了以下答案中提到的DLL名称:

Thanks to the answers. Here I found the names of DLL as is mentioned in the answers below:

> https://docs.microsoft.com/zh-cn/windows/win32/apiindex/windows-81-api-sets

推荐答案

您可以使用 DUMPBIN 工具从.lib文件中提取此信息:

You can use the DUMPBIN tool to extract this information from the .lib file:

dumpbin /headers /path/to/pathcch.lib

然后,您需要在输出中进行筛选以查找有问题的函数。例如,这是lib文件的x64版本的输出:

You then need to sift through the output to find the function in question. For instance, this is the output for an x64 version of the lib file:


  Version      : 0
  Machine      : 8664 (x64)
  TimeDateStamp: FFFFFFFF Sun Feb 07 06:28:15 2106
  SizeOfData   : 0000002E
  DLL name     : api-ms-win-core-path-l1-1-0.dll
  Symbol name  : PathCchAppend
  Type         : code
  Name type    : name
  Hint         : 5
  Name         : PathCchAppend






关于对向后兼容和向前兼容的注释,对此DLL名称进行硬编码,.lib文件对DLL名称进行硬编码。因此,如果使用.lib文件链接到该函数,则您正在对该DLL的依赖项进行硬编码。这将Microsoft约束在合同中,以便在Windows的将来版本中继续从此DLL导出此功能。因此,使用 LoadLibrary / GetProcAddress 显式链接要比使用SDK中的.lib文件隐式链接要安全得多。


Regarding the comments about backwards and forwards compatibility of hard coding this DLL name, the .lib file hard codes the DLL name. So if you link to the function using the .lib file, then you are hard coding a dependency to that DLL. This binds Microsoft into a contract to continue exporting this function from this DLL in future releases of Windows. And so it is no more or less safe to link explicitly using LoadLibrary/GetProcAddress than it is to link implicitly using the .lib file from the SDK.

这篇关于哪个DLL具有PathCchAppend?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆