views:

112

answers:

2

What is the correct way to create a file extension (and maybe a MIME type) that will run from your local file system without prompt, but if you browsed to that file through Internet Explorer or Firefox you would get prompted (warned)? What is the exact mechanism in the windows registry that controls this?

+3  A: 

This mechanism is not controlled by the registry. What IE does is add a NTFS stream to downloaded files, specifcying which zone it was downloaded from.

For example, I just downloaded notepad++, and performed the following command to show the alternate stream:

c:\Downloads>more <npp.5.4.5.installer.exe:Zone.Identifier

Which outputted:

  [ZoneTransfer]
  ZoneId=3

Windows explorer / ShellExecute uses this alternate stream as a means to trigger the "unsafe" warning.

Chris Becke
Just did some testing. IE seems to handle this the way I would expect. Firefox makes you download the file (then open) with prompt - and disables the checkbox option to make the prompt go away. interesting. +1 thanks for the insight
tyndall
+2  A: 

Check IZoneIdentifier and IAttachmentExecute on MSDN for info about the documented way to handle this stuff without messing with NTFS alternative data streams

Anders
+1 Good to know this stuff is available. How would I manipulate these without a browser plug-in or my own app?
tyndall