{"id":19703,"date":"2008-12-26T10:00:00","date_gmt":"2008-12-26T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2008\/12\/26\/why-are-all-computers-shown-with-a-printers-folder-even-if-printer-sharing-is-disabled\/"},"modified":"2008-12-26T10:00:00","modified_gmt":"2008-12-26T10:00:00","slug":"why-are-all-computers-shown-with-a-printers-folder-even-if-printer-sharing-is-disabled","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20081226-00\/?p=19703","title":{"rendered":"Why are all computers shown with a Printers folder even if printer sharing is disabled?"},"content":{"rendered":"<p>When you visited a computer on the network by typing <code>\\\\computername<\/code> into the address bar, Explorer showed you a Printers folder if the  computer had printer sharing enabled. But starting in Windows&nbsp;Vista, the Printers folder is shown regardless of whether the remote computer is sharing any printers. Why did this change?<\/p>\n<p> Communicating with the remote computer to ask it about its printers simply took too long. The <code>IShellFolder::EnumObjects<\/code> method returns an enumerator that produces a list of items in the folder. Think of it as the shell namespace version of <code>FindFirstFile<\/code>. When the <code>IEnumIDList::Next<\/code> method is called, it must produce the next item in the folder or return a code that means <i>Sorry, no more items<\/i>. There is no return code that means <i>Hey, deciding on the next item is going to take a while, so maybe you should go do something else for a while and check back later when I finally have an answer for you<\/i>. After all, <code>FindNextFile<\/code> doesn&#8217;t have such a return code either. It returns the next file or says <i>No more files<\/i>. (Yes, there are also other errors that can be returned, but they aren&#8217;t important here.) <\/p>\n<p> Now, Explorer does the enumeration of folder contents on a background thread, so the UI remains responsive while all this querying is going on to determine whether or not to show the Printers folder, but a responsive UI is scant consolation if it&#8217;s a responsive <i>Please Wait<\/i> message. If you went to a remote computer, the folder would show a flashlight while the background thread did its thing, and then two minutes later (or sometimes longer), it finally would show you what it found. That&#8217;s two minutes of your life you can&#8217;t get back. (I predict people will use that one sentence as an excuse to go off-topic.) <\/p>\n<p> As I&#8217;ve quipped before, the fastest code is the code that never runs. Instead of trying to figure out whether a remote computer is sharing any printers with you, just show a Printers folder icon. Users who are interested in seeing the printers can double-click the Printers folder icon, and then they won&#8217;t be too surprised to find that they have to wait a while for the remote computer to respond with its list of printers. Which might be empty. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you visited a computer on the network by typing \\\\computername into the address bar, Explorer showed you a Printers folder if the computer had printer sharing enabled. But starting in Windows&nbsp;Vista, the Printers folder is shown regardless of whether the remote computer is sharing any printers. Why did this change? Communicating with the remote [&hellip;]<\/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":[104],"class_list":["post-19703","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-tipssupport"],"acf":[],"blog_post_summary":"<p>When you visited a computer on the network by typing \\\\computername into the address bar, Explorer showed you a Printers folder if the computer had printer sharing enabled. But starting in Windows&nbsp;Vista, the Printers folder is shown regardless of whether the remote computer is sharing any printers. Why did this change? Communicating with the remote [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/19703","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=19703"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/19703\/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=19703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=19703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=19703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}