{"id":7783,"date":"2012-04-25T07:00:00","date_gmt":"2012-04-25T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2012\/04\/25\/how-do-i-prevent-users-from-opening-tif-files\/"},"modified":"2012-04-25T07:00:00","modified_gmt":"2012-04-25T07:00:00","slug":"how-do-i-prevent-users-from-opening-tif-files","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20120425-00\/?p=7783","title":{"rendered":"How do I prevent users from opening TIF files?"},"content":{"rendered":"<p>\nA customer had a question about their Windows&nbsp;XP installations.\n(This question was from several years ago, so the fine details\naren&#8217;t really relevant any more, but I&#8217;m actually telling this\nstory for a commentary opportunity.)\n<\/p>\n<p>\nThe customer wanted to disable all file associations for TIFF files.\nTheir first attempt was by deleting <code>HKEY_CLASSES_ROOT\\.tif<\/code>\nand\n<code>HKEY_CLASSES_ROOT\\.tiff<\/code>.\nThis successfully renders TIFF files with a generic document icon,\nbut when the user double-clicks the file, the registration is\nre-established and Windows Picture and\nFax Viewer opens the file.\n<\/p>\n<p>\nThe company had some\nstrange company security policy that says that TIFF files\nshould not have any file association. I don&#8217;t know the rationale\nbehind it, but they did say that they only needed to block\nthe default file association.\nIf the user explicitly creates a new association via the <i>Open With<\/i>\ndialog, then that is not covered by the policy.\n<\/p>\n<p>\nDeleting the registrations doesn&#8217;t work because Windows&nbsp;XP\nhas an autorepair feature for certain commonly-corrupted file\nassociations,\nand TIFF is one of them.\nIf the TIFF registration is corrupted and the user is a member\nof the Administrators group, then Windows&nbsp;XP will restore\nthe default association.\n(If the user is not a member of the Administrators group,\nthen the usual &#8220;Windows cannot open this file&#8221; dialog box appears.)\n<\/p>\n<p>\nTherefore, the solution to the customer&#8217;s odd problem is not to\ndelete the TIFF registrations (which causes them to be\n<a HREF=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2004\/06\/30\/169757.aspx\">\ndetected as corrupted<\/a>)\nbut rather to simply set a new default handler for TIFF files\nthat merely displays a message to the user.\nIf you&#8217;re willing to use the Windows Script Host,\nthen it&#8217;s a one-line program:\n<\/p>\n<pre>\nWScript.Echo(\"TIFF file associations are disabled.\")\n<\/pre>\n<p>\nIf you have been reading carefully,\nyou have already noticed a serious problem with the customer&#8217;s\nconfiguration:\nThe fact that they are seeing the TIFF autorepair code kicking in\nmeans that they are letting their employees run with Administrator\nprivileges,\nwhich means that their so-called &#8220;security requirement&#8221; is like\nworrying about employees being able to sneak into the building\nthrough a ventilation grating,\nwhen you give everybody a key to the front door.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer had a question about their Windows&nbsp;XP installations. (This question was from several years ago, so the fine details aren&#8217;t really relevant any more, but I&#8217;m actually telling this story for a commentary opportunity.) The customer wanted to disable all file associations for TIFF files. Their first attempt was by deleting HKEY_CLASSES_ROOT\\.tif and HKEY_CLASSES_ROOT\\.tiff. [&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-7783","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-tipssupport"],"acf":[],"blog_post_summary":"<p>A customer had a question about their Windows&nbsp;XP installations. (This question was from several years ago, so the fine details aren&#8217;t really relevant any more, but I&#8217;m actually telling this story for a commentary opportunity.) The customer wanted to disable all file associations for TIFF files. Their first attempt was by deleting HKEY_CLASSES_ROOT\\.tif and HKEY_CLASSES_ROOT\\.tiff. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/7783","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=7783"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/7783\/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=7783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=7783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=7783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}