One of the flags you can pass to the
IShellFolder::CompareIDs method is
SHCIDS_CANONICALONLY. This flag means that the method should determine whether the two pointers refer to the same underlying object, and if they do not, then it should determine which one should come first by whatever mechanism it wants. It doesn’t matter which one is declared as coming before the other one, as long as it is consistent.
I like to think of this as the moral equivalent of the Unicode ordinal comparison. In both cases, you use the comparison if you have two items that you wish to keep in sorted order, but you don’t care what the ordering rules are, as long as they are consistent. In fact, all you care about is consistency, and you’re perfectly happy to sacrifice readability for speed. The resulting sorted list won’t be displayed to the user; all you’re going to use it for is locating the item later.
You can think of this as the moral equivalent of the NTFS file name sorting algorithm. In both cases, the items are sorted not so that the user can find them, but so that the program can find them.