Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is SHGetPathFromIDList function exported three times

I know that shell32.dll exports two types of functions—ANSI and UNICODE. (For the sake of simplicity, I am talking only about functions that take CHAR*/WCHAR* arguments.)

For example, ShellMessageBoxA is the ANSI version, while ShellMessageBoxW is the Unicode version. ShellMessageBox is a macro defined in the header file:

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

So ShellMessageBox does not exist as a function that is exported from Shell32.dll.

But now I discovered that SHGetPathFromIDList is exported three times:

  • ORDINAL 312 - SHGetPathFromIDList
  • ORDINAL 313 - SHGetPathFromIDListA
  • ORDINAL 314 - SHGetPathFromIDListW

What is purpose of this?

like image 688
user2120666 Avatar asked Apr 06 '26 22:04

user2120666


1 Answers

SHGetPathFromIDList is for legacy programs that originally targeted older versions of Windows that did not have the A and W exports because it did not support Unicode. This export is the ANSI version.

SHGetPathFromIDListA and SHGetPathFromIDListW are the ANSI and Unicode versions.

If you inspect the entry points with dumpbin or Dependency Walker you will see that the entry point for SHGetPathFromIDList is identical to that for SHGetPathFromIDListA.

Modern SDKs will link to either SHGetPathFromIDListA or SHGetPathFromIDListW, but never to SHGetPathFromIDList.

like image 91
David Heffernan Avatar answered Apr 08 '26 14:04

David Heffernan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!