Enable Preview Pane for Downloaded Files
Lets the File Explorer preview pane show selected file types (PDF by default) that are marked as downloaded from the Internet, without removing the mark
Author: javierpetrucci
Files saved from a browser, an email client or a chat app usually get a
Zone.Identifier NTFS alternate data stream, known as the Mark of the Web
(MOTW), which places them in the Internet security zone. File Explorer refuses
to show such files in the preview pane: "The file you are attempting to preview
could harm your computer."
This mod lets the preview pane show files in the Internet zone for the file
extensions you choose. By default only pdf is affected.
Before, a PDF with the Mark of the Web shows the warning:

After, the same PDF is previewed:

The Mark of the Web is not removed or modified. Files keep their
Zone.Identifier stream, so SmartScreen, Office Protected View, Microsoft
Defender and every other program that checks the mark behave as before.
How it works
Before the preview pane loads a preview handler, File Explorer asks the URL
security manager (IInternetSecurityManager::ProcessUrlAction) whether the
URLACTION_SHELL_PREVIEW action is allowed for the file. In the Internet zone
the answer is "disallow", and the warning is shown instead of the preview.
The mod hooks that method inside explorer.exe. When the original answer is
not "allow", the answer is changed to "allow" only if all of these are true:
- The action is
URLACTION_SHELL_PREVIEW. No other security action is changed.
- The file is on a local fixed, removable or RAM drive (
C:\...). Network
shares (\\server\...) and mapped network drives are never exempted.
- The path has no alternate data stream, the file itself is not a symbolic
link or another type of reparse point, and no folder in the path is a
directory symbolic link. Cloud placeholder files, such as OneDrive files,
and directory junctions are allowed.
- The extension is in the list from the settings.
- The security manager maps the file to the Internet zone (zone 3). Files in
the Restricted Sites zone, or in any other zone, are left alone.
Settings
- Extensions: comma-separated list without the dot, for example
pdf, txt, png. A leading dot is accepted too. Matching is not case
sensitive.
- Only when the path contains (optional): only exempt files whose path
contains this text, not case sensitive. For example
\Downloads\.
Types that are never exempted
The following extensions are ignored even if they are listed in the settings:
- Executables, libraries and installers:
exe, com, scr, pif, cpl,
dll, ocx, sys, drv, efi, msi, msp, mst, msu, appx,
appxbundle, msix, msixbundle, appinstaller, application,
appref-ms, xbap, gadget, jar, msc.
- Scripts and command files:
bat, cmd, ps1, psm1, psd1, ps1xml,
pssc, psc1, vb, vbs, vbe, js, jse, ws, wsf, wsc, wsh,
hta, sct, inf, ins, isp, reg, scf, shb, shs, mof, hlp,
chm, diagcab, diagcfg, diagpkg, rdp, py, pyw.
- Shortcuts and shell links:
lnk, url, website, library-ms,
search-ms, searchconnector-ms, settingcontent-ms.
- Office files with macros, including legacy formats that can carry VBA:
docm, dotm, xlsm, xltm, xlsb, xlam, pptm, potm, ppsm,
ppam, sldm, doc, dot, xls, xlt, xla, ppt, pot, pps,
ppa, mdb, mde, accdb, accde, ade, adp, xll, wll, one.
- Archives:
zip, 7z, rar, cab, tar, gz, tgz, bz2, tbz2, xz,
txz, zst, lzh, lha, arj, z, wim.
- Disk images:
iso, img, vhd, vhdx, vmdk.
This list is a safety net, not a complete security policy. Only add file types
that you are comfortable previewing from untrusted sources.
Notes and limitations
- Windows blocks these previews because they can leak credentials. A file
that refers to a remote resource (
\\server\...) can make the preview
handler connect to that server and send it the user's NTLM hash. PDFs can
do this, and pdf is the default. See Microsoft's
note on the change. With the
mod, previewing a listed file can leak the hash this way, just like opening
it would.
- The preview handler registered for the type (for example the PDF previewer
of Microsoft Edge, Adobe Acrobat or SumatraPDF) also parses the file, so a
vulnerable preview handler can be exploited by a malicious file.
- A preview handler can opt in to previewing untrusted files with the
AutomaticallyPreviewUntrustedFiles value on its CLSID key. Windows then
shows the preview without this mod. The PDF previewer of Microsoft Edge does
this. The PDF preview handlers of Adobe Acrobat Reader and SumatraPDF don't,
so they need the mod.
- Tested by the author on Windows 11 build 26300 with the PDF preview handlers
of SumatraPDF, Adobe Acrobat Reader and Microsoft Edge.
- Only the File Explorer preview pane in
explorer.exe is covered. The preview
pane in the Open and Save dialogs of other programs runs inside those
programs. To cover one, add it under Details -> Advanced ->
Custom process inclusion list. This was tested with the Open dialog of a
program added to that list.
- Files reached through a directory symbolic link are never exempted, because
the link can point to a network share. Directory junctions can only point to
local folders, so they are allowed. Hard links are the same file. File
Explorer doesn't preview file symbolic links at all, with or without the
mod.
- The mod overrides the "disallow" answer for the listed types even when it
comes from a Group Policy setting for the Internet zone.
- This targets the standard URL security manager of Windows (
urlmon.dll). If
a Windows update makes the preview pane use a different check, the mod has no
effect and the warning is shown as usual.
- Disable the mod to restore the default behavior. Nothing on disk or in the
registry is modified.