3

我知道 shell32.dll 导出两种类型的函数——ANSI 和 UNICODE。(为简单起见,我只讨论接受 CHAR*/WCHAR* 参数的函数。)

例如,ShellMessageBoxA是 ANSI 版本,ShellMessageBoxW而是 Unicode 版本。ShellMessageBox是头文件中定义的宏:

#ifdef UNICODE
#define ShellMessageBox  ShellMessageBoxW
#else
#define ShellMessageBox  ShellMessageBoxA
#endif // !UNICODE

所以ShellMessageBox不作为从 Shell32.dll 导出的函数存在。

但是现在我发现SHGetPathFromIDList导出了三遍:

  • 序数 312 -SHGetPathFromIDList
  • 序数 313 -SHGetPathFromIDListA
  • 序数 314 -SHGetPathFromIDListW

这样做的目的是什么?

4

1 回答 1

4

SHGetPathFromIDList适用于最初针对旧版本的 Windows 的遗留程序,因为它不支持 Unicode,所以没有A和导出。W此导出是 ANSI 版本。

SHGetPathFromIDListA并且SHGetPathFromIDListW是 ANSI 和 Unicode 版本。

如果您使用dumpbin或 Dependency Walker 检查入口点,您将看到 for 的入口点与 for 的入口点SHGetPathFromIDList相同SHGetPathFromIDListA

现代 SDK 将链接到SHGetPathFromIDListASHGetPathFromIDListW,但永远不会链接到SHGetPathFromIDList.

于 2016-09-05T18:00:30.560 回答