众所周知的虚拟文件夹 GUID 是什么?

发布于 2024-08-19 10:20:13 字数 1021 浏览 3 评论 0原文

似乎有一些虚拟文件夹具有与其关联的 GUID(控制面板、桌面) -

::{00021400-0000-0000-c000-000000000046} // 桌面

这些火焰是在哪里定义的?它们什么时候使用?

我想要的是一种没有任何歧义的代表虚拟文件夹的字符串的方法。

例如,如果我要为桌面创建一个 PIDL,则显示名称将返回为“C:\Users\Steve\Desktop”。

嗯,目前确实如此 - 但它并不是真正正确的文件夹。我可以在资源管理器中导航到该文件夹​​,它包含我桌面上的部分文件,而不是整个桌面。

我想要的是一种将该位置编码为字符串的方法,该字符串将始终导航到虚拟桌面文件夹(包含所有内容的文件夹,而不仅仅是一些内容)。

有谁知道此类 GUID 的明确列表吗?或者我如何将给定的 PIDL 转换为 PIDL?

我尝试过 SHGetDisplayName(pidl, SHGDN_*) - 桌面 pidl 的每个版本都会给我一个简短的“桌面”或“C:\Users\Steve\Desktop”。 (显然,我是用“steve”帐户登录的)。

想法/评论/指示?

编辑:看来我可以使用下面给出的答案来获得已知文件夹 GUId 的列表。但是有谁知道如何以编程方式从 PIDL 进行转换 ->已知文件夹 GUID?我假设我可以 ParseDisplayName("::{guid}") 来获取 PIDL,但是有没有办法获取 GUID?

EDIT2:我仍然找不到以编程方式获取 GUID 的方法。但是,出于我的目的,我记录了最初用于创建对象的 CSIDL_xxx,并将其写出并保存在该对象中。稍后恢复它,然后通过 CSIDL 创建一个 PIDL,它保留其正确的身份(即,它不会降级为“C:\Users\\Desktop”,而是生成一个真正指向虚拟桌面的 PIDL ,

诀窍是始终使用 CSIDL->PIDL,永远不要使用 CSIDL->PIDL->string->PIDL = 退化为非虚拟路径。

对我来说 - 我会继续寻找是否有人发现更多有关该主题的信息并将其发布,我会很感兴趣;)

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! ;)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柠檬心 2024-08-26 10:20:13

如果我理解正确,您正在寻找 CSIDLs(Vista 之前版本,包括 Shlobj.h)或 KNOWNFOLDERID(>= Vista、Knownfolders.h)。

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

初与友歌 2024-08-26 10:20:13

我认为这些 GUID 没有正式记录。您可以使用 SHGetPathFromIDList() 获取 GUID。它将指示失败,但如果您查看 pszPath 参数,您将看到它填充有 GUID(但是,第一个字符设置为 NULL)。除此之外,您还可以找到其他人发现的各种 GUID 列表。

编辑:我发现了一些有趣的链接;看来您可以通过搜索注册表来发现这些 GUID。

有关 shell GUID 的论坛帖子

控制面板 GUID

如何安装 shell 命名空间

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文