{"id":97325,"date":"2017-11-01T07:00:00","date_gmt":"2017-11-01T21:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=97325"},"modified":"2019-03-13T01:33:45","modified_gmt":"2019-03-13T08:33:45","slug":"20171101-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20171101-00\/?p=97325","title":{"rendered":"How can I detect that a shell item refers to a virtual folder, or to a file system inside a file?"},"content":{"rendered":"<p>Shell items have a bunch of attributes. For example, <code>SFGAO_<\/code><code>FOLDER<\/code> means that the item is a folder, and it will show up in the navigation pane as a folder. Since it&#8217;s a folder, you can bind to it and enumerate children. But what if you need more information about what kind of folder it is? <\/p>\n<p>The other attributes <code>SFGAO_<\/code><code>FILE&shy;SYSTEM<\/code>, <code>SFGAO_<\/code><code>FILE&shy;SYS&shy;ANCESTOR<\/code>, and <code>SFGAO_<\/code><code>STREAM<\/code> can help you distinguish the various scenarios. <\/p>\n<p>The <code>SFGAO_<\/code><code>FILE&shy;SYSTEM<\/code> attribute means that the item exists in the file system, and the parsing name for a <code>SFGAO_<\/code><code>FILE&shy;SYSTEM<\/code> object can be used to access the corresponding entity in the file system. <\/p>\n<p>The <code>SFGAO_<\/code><code>FILE&shy;SYS&shy;ANCESTOR<\/code> attribute means that the item <i>or one of its children<\/i> might have the <code>SFGAO_<\/code><code>FILE&shy;SYSTEM<\/code> attribute. This attribute is used by the File Open and File Save dialogs, for example, to decide whether to filter out the item. If it&#8217;s possible to reach the file system via the item, then the File Open and File Save dialogs will include the item. You may not be able to save directly to the item (such as <i>My Computer<\/i>), but it will let you navigate through it on the way to something you can save to. <\/p>\n<p>The <code>SFGAO_<\/code><code>STREAM<\/code> attribute means that the item can produce bytes of data. If combined with the <code>SFGAO_<\/code><code>FILE&shy;SYSTEM<\/code> attribute, it means that the underlying storage for the item is a file. Even though the underlying storage is a file system file, it may be exposed in the shell namespace as a folder. For example, ZIP files are file system files, but they show up in the shell namespace as a folder, so that you can open them up and drag files into or out of them. <\/p>\n<p>Let&#8217;s summarize this in a chart. <\/p>\n<table BORDER=\"0\" CELLPADDING=\"3\" CLASS=\"cp3\" STYLE=\"border-collapse: collapse\">\n<tr STYLE=\"border-top: solid 1px black\">\n<th><code>SFGAO_<\/code><code>FILE&shy;SYSTEM<\/code>?<\/th>\n<th><code>SFGAO_<\/code><code>FOLDER<\/code>?<\/th>\n<th><code>SFGAO_<\/code><code>STREAM<\/code>?<\/th>\n<th>Result<\/th>\n<th>Example<\/th>\n<\/tr>\n<tr STYLE=\"border-top: solid 1px black\">\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td>Virtual file with no data<\/td>\n<td>Dial-up networking connectoid<\/td>\n<\/tr>\n<tr STYLE=\"border-top: solid 1px black\">\n<td><\/td>\n<td><\/td>\n<td><code>SFGAO_<\/code><code>STREAM<\/code><\/td>\n<td>Virtual file with data<\/td>\n<td>File on an FTP site<\/td>\n<\/tr>\n<tr STYLE=\"border-top: solid 1px black\">\n<td><\/td>\n<td><code>SFGAO_<\/code><code>FOLDER &nbsp;<\/code><\/td>\n<td><\/td>\n<td>Virtual folder<\/td>\n<td>Control Panel<\/td>\n<\/tr>\n<tr STYLE=\"border-top: solid 1px black\">\n<td><\/td>\n<td><code>SFGAO_<\/code><code>FOLDER |<\/code><\/td>\n<td><code>SFGAO_<\/code><code>STREAM<\/code><\/td>\n<td>Virtual folder with data<\/td>\n<td>?<\/td>\n<\/tr>\n<tr STYLE=\"border-top: solid 1px black\">\n<td><code>SFGAO_<\/code><code>FILE&shy;SYSTEM &nbsp;<\/code><\/td>\n<td><\/td>\n<td><\/td>\n<td>File system file with no data<\/td>\n<td>Symbolic link<\/td>\n<\/tr>\n<tr STYLE=\"border-top: solid 1px black\">\n<td><code>SFGAO_<\/code><code>FILE&shy;SYSTEM |<\/code><\/td>\n<td><\/td>\n<td><code>SFGAO_<\/code><code>STREAM<\/code><\/td>\n<td>File system file with data<\/td>\n<td>Traditional file system file<\/td>\n<\/tr>\n<tr STYLE=\"border-top: solid 1px black\">\n<td><code>SFGAO_<\/code><code>FILE&shy;SYSTEM |<\/code><\/td>\n<td><code>SFGAO_<\/code><code>FOLDER &nbsp;<\/code><\/td>\n<td><\/td>\n<td>File system directory<\/td>\n<td>Traditional file system directory<\/td>\n<\/tr>\n<tr STYLE=\"border-top: solid 1px black\">\n<td><code>SFGAO_<\/code><code>FILE&shy;SYSTEM |<\/code><\/td>\n<td><code>SFGAO_<\/code><code>FOLDER |<\/code><\/td>\n<td><code>SFGAO_<\/code><code>STREAM<\/code><\/td>\n<td>Virtual directory inside a file system file<\/td>\n<td>ZIP file<\/td>\n<\/tr>\n<\/table>\n<p>I couldn&#8217;t think of an example of a virtual folder with data. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Unpacking the attributes.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-97325","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Unpacking the attributes.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/97325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=97325"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/97325\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=97325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=97325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=97325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}