Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are all of the well-known virtual folder GUIDs?

There seem to be a few virtual folders which have GUIDs associated to them (control panel, desktop) -

::{00021400-0000-0000-c000-000000000046} // desktop

Where the blazes are these defined? When are they used?

What I want is a way to have a string which represents a virtual folder without any ambiguity.

If, for instance, I were to create a PIDL for the desktop, the display name comes back as "C:\Users\Steve\Desktop".

Well, that's true at the moment - but its not really the correct folder. I can navigate in Explorer to that folder, and it contains a portion of the files on my desktop, not the entire desktop.

What I want is a way to encode that location as a string that will always navigate to the virtual desktop folder (the one that has all of its contents, not just a few things).

Does anyone know of a definitive list of such GUIDs? Or how I might convert a given PIDL into one?

I tried SHGetDisplayName(pidl, SHGDN_*) - every version of that for the desktop pidl gives me either a short "Desktop" or "C:\Users\Steve\Desktop". (I'm logged in under the 'steve' account, obviously).

Ideas / comments / pointers?

EDIT: So it seems that I can use the given answers below to have a list of Known Folder GUIds. But does anyone know programatically how to convert from a PIDL -> known folder GUID? I assume that I can ParseDisplayName("::{guid}") to get the PIDL, but is there a way to get to the GUID?

EDIT2: I still cannot find a way to get to the GUID programatically. However, for my purposes, I am recording the CSIDL_xxx that I use to create the object initially, and write that out & restore it later, and then create a PIDL by way of the CSIDL, which retains its correct identity (ie. it doesn't degrade into "C:\Users\\Desktop" but rather generates a PIDL that really points to the virtual desktop.

The trick for me is to always use the CSIDL->PIDL, never going to a string in between. CSIDL->PIDL->string->PIDL = degeneration into non-virtual path.

Thanks everyone for the help - and I'll keep looking if anyone finds more on the subject and posts it, I'd be interested! ;)

like image 275
Mordachai Avatar asked Jan 21 '10 19:01

Mordachai


2 Answers

If i understand you correctly you are looking for the CSIDLs (pre-Vista, include Shlobj.h) or KNOWNFOLDERID (>= Vista, Knownfolders.h).

like image 73
Georg Fritzsche Avatar answered Sep 21 '22 02:09

Georg Fritzsche


I don't think these GUIDs are formally documented. You can use SHGetPathFromIDList() to get the GUIDs. It will indicate failure, but if you look at the pszPath parameter you will see it is filled in with a GUID (however, the first character is set to NULL). Aside from that, you can find various lists of GUIDS discovered by other people.

EDIT: I found a few interesting links; it seems you can discover these GUIDs by searching the registry.

A forum posting about shell GUIDs

Control Panel GUIDs

How shell namespaces are installed

like image 1
Luke Avatar answered Sep 21 '22 02:09

Luke