2

CHM files that are downloaded are often tagged as potentially malicious by Windows, which effectively blocks all the html pages inside of it. There's an easy fix (just unblock the file after you download it), but I was wondering if there's a better way to provide unblocked chm files.

What if I were to download the chm file (as a byte stream) from our server inside the application, then write all the data to a file on the disk. Would it still be blocked?

Is there another/better way still?


Edit: Yes, downloading the file using a System.Net.WebClient does solve the problem. But, is there still a better way?

4 Answers 4

3

Right Click the .chm file -> Properties and and then click the "Unblock" button and you are ready to go!

3

Technically what happens is that when IE downloads a file, it uses a little-known feature of Windows file system where you can have additional streams of data attached to a file. IE adds :Zone.Identifier stream where they write ini-style data in the form of:

[ZoneTransfer]
ZoneId=$id

The $id identifies trust zone for that file and it's set to URLZONE_INTRANET (http://msdn.microsoft.com/en-us/library/ms537175(v=vs.85).aspx).

One way to fix it is to change the $id to URLZONE_LOCAL_MACHINE. Another is to simply delete this stream.

You can see how I did it in C++ for my Sumatra PDF viewer when we added CHM support: http://code.google.com/p/sumatrapdf/source/detail?r=4639 and http://www.google.com/codesearch#8WOCRDPt-u8/trunk/src/utils/FileUtil.cpp&q=SetZoneIdentifier%20package:http://sumatrapdf%5C.googlecode%5C.com&l=340

I'm not sure if you would consider it a better solution that downloading the file yourself.

2

Typical MSFT, first introduce such a crap as .chm is and later have to block it to make their ship with million holes safer. All ok, but why does it not show a proper error message with explaination what is going on when the user sees nothing in the chm file.

0

This is a guess, but are you sure it's Windows that tags it? Could it not be internet explorer, in which case just use another browser?

2
  • 1
    no, it's still the same with Firefox - download a CHM with it and it's also tagged an "unsafe" and won't display until you manually unblock it...
    – marc_s
    Apr 11, 2010 at 11:35
  • 1
    Same with Chrome, downloaded files get tagged.
    – David Rutten
    Apr 11, 2010 at 12:05

You must log in to answer this question.