On Fri Jan 6 14:40:59 2023 +0000, Gabriel Ivăncescu wrote:
I think straight parsing only handles GUIDs for the special virtual folders. You can try straight parsing first of course, since it's a shortcut in most cases, but I recall I had to enumerate the contents of the IShellFolder and check each one for a match in such case… If you do this, make sure to skip filesystem or network shell folders, because enumerating/comparing there would be too slow (and straight parsing there works). Something like:
if (SUCCEEDED(IShellFolder_QueryInterface(sf, &IID_IPersist, (void**)&persist))) { CLSID clsid; hres = IPersist_GetClassID(persist, &clsid); IPersist_Release(persist); if (SUCCEEDED(hres) && (IsEqualCLSID(&clsid, &CLSID_ShellFSFolder) || IsEqualCLSID(&clsid, &CLSID_NetworkPlaces))) return FALSE; }
assuming a FALSE return means "not found". Otherwise use something like `IShellFolder_EnumObjects(sf, NULL, SHCONTF_FOLDERS | SHCONTF_INCLUDEHIDDEN | SHCONTF_INCLUDESUPERHIDDEN, &eidl)` to enumerate and then compare, I think.
If we really have to do something special for known folders, then that part can probably be saved for later?