user2120666 user2120666 - 2 months ago 6
C Question

Why is SHGetPathFromIDList function exported three times

Good day.

Until now, I thinks that standard Shell32.dll in my Win XP exported two types of function - ANSI and UNICODE. (For sake of simplicity I am talking only about functions that contains CHAR*/WCHAR* argument.)

Example

ANSI version:

ShellMessageBoxA


and

UNICODE version:
ShellMessageBoxW


ShellMessageBox is in header defined as macro:

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


So
ShellMessageBox
not exists as function, so that is not exported from Shell32.dll.

But now I discovered that SHGetPathFromIDList is exported three times:


  • ORDINAL 312 - SHGetPathFromIDList

  • ORDINAL 313 - SHGetPathFromIDListA

  • ORDINAL 314 - SHGetPathFromIDListW



Question: What is purpose of this?

Answer

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.

Comments