问题
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");
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.
In which DLL this function is placed?
EDIT: Thanks to the answers. Here I found the names of DLL as is mentioned in the answers below:
https://docs.microsoft.com/en-us/windows/win32/apiindex/windows-81-api-sets
回答1:
You can use the DUMPBIN tool to extract this information from the .lib file:
dumpbin /headers /path/to/pathcch.lib
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
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.
来源:https://stackoverflow.com/questions/57354840/which-dll-has-pathcchappend