Home
%3CLINGO-SUB%20id%3D%22lingo-sub-723757%22%20slang%3D%22en-US%22%3EThe%20Case%20of%20the%20Phantom%20Desktop%20Files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-723757%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20TechNet%20on%20Dec%2028%2C%202008%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3EA%20few%20weeks%20ago%2C%20my%20wife%20mentioned%20that%20she%20sometimes%20saw%20files%20in%20her%20desktop%20folder%20that%20didn%E2%80%99t%20appear%20on%20the%20actual%20desktop.%20She%20brought%20it%20up%20not%20only%20because%20she%20was%20confused%20by%20the%20discrepancy%2C%20but%20because%20she%20wanted%20to%20move%20some%20of%20these%20phantom%20files%20to%20other%20folders%20and%20wanted%20to%20delete%20others.%20I%20had%20no%20idea%20what%20she%20was%20talking%20about%20(which%20was%20usually%20the%20case%20when%20she%20described%20her%20computer%20troubles)%2C%20so%20I%20told%20her%20that%20the%20next%20time%20she%20saw%20these%20mysterious%20files%2C%20to%20call%20me%20to%20look%20at%20it.%3C%2FP%3E%0A%20%20%3CP%3EA%20few%20days%20later%20I%20got%20home%20from%20work%20and%20she%20greeted%20me%20excitedly%20at%20the%20door%20and%20explained%20that%20the%20problem%20reoccurred%20and%20that%20she%20had%20left%20a%20window%20open%20showing%20the%20elusive%20files.%20I%20rushed%20to%20the%20kitchen%20computer%20with%20anticipation%2C%20not%20even%20bothering%20to%20greet%20the%20dogs%20on%20the%20way%2C%20and%20surveyed%20the%20situation.%20She%20had%20a%20maximized%20IE%20window%20open%20with%20a%20full%20row%20of%20tabs%20for%20her%20open%20emails%20(I%20don%E2%80%99t%20think%20she%20ever%20closes%20an%20email%20window).%20An%20IE%20%E2%80%9CChoose%20a%20File%E2%80%9D%20dialog%20box%20was%20in%20the%20foreground%20listing%20the%20files%20in%20her%20desktop%20folder%2C%20which%20she%20had%20opened%20by%20clicking%20the%20attachment%20button%20in%20the%20email%20editor.%20The%20dialog%20looked%20like%20this%3A%3C%2FP%3E%0A%20%20%3CP%3E%3CIMG%20alt%3D%22image%22%20border%3D%220%22%20height%3D%22245%22%20original-url%3D%22http%3A%2F%2Fblogs.technet.com%2Fblogfiles%2Fmarkrussinovich%2FWindowsLiveWriter%2FTheCaseofthePhantomDesktopFiles_4A85%2Fimage_thumb_4.png%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121090i7240C35E79A22D02%22%20style%3D%22border-right-width%3A%200px%3B%20display%3A%20inline%3B%20border-top-width%3A%200px%3B%20border-bottom-width%3A%200px%3B%20border-left-width%3A%200px%22%20title%3D%22image%22%20width%3D%22420%22%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3EI%20minimized%20IE%20to%20view%20the%20desktop%20background%20and%20sure%20enough%2C%20several%20of%20the%20files%20visible%20in%20the%20dialog%2C%20such%20as%20the%20%E2%80%9CMaui%20Feb.%2008%E2%80%9D%20folder%20and%20the%20CIMG13xx%20JPG%20files%2C%20were%20missing.%20I%20opened%20an%20Explorer%20window%20and%20navigated%20to%20her%20desktop%20folder%20to%20see%20if%20the%20files%20would%20show%20up%20there%2C%20but%20they%20were%20missing%20there%20as%20well%3A%3C%2FP%3E%0A%20%20%3CP%3E%3CIMG%20alt%3D%22image%22%20border%3D%220%22%20height%3D%22265%22%20original-url%3D%22http%3A%2F%2Fblogs.technet.com%2Fblogfiles%2Fmarkrussinovich%2FWindowsLiveWriter%2FTheCaseofthePhantomDesktopFiles_4A85%2Fimage_thumb_2.png%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121091i502F6EF25A625CBA%22%20style%3D%22border-right-width%3A%200px%3B%20display%3A%20inline%3B%20border-top-width%3A%200px%3B%20border-bottom-width%3A%200px%3B%20border-left-width%3A%200px%22%20title%3D%22image%22%20width%3D%22422%22%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3EI%E2%80%99d%20never%20seen%20that%20behavior%20before.%20I%20knew%20this%20was%20a%20job%20for%20%3CA%20href%3D%22http%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Fsysinternals%2Fbb896645.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EProcess%20Monitor%20%3C%2FA%3E.%20Since%20my%20wife%20doesn%E2%80%99t%20keep%20the%20Sysinternals%20tools%20on%20her%20system%20(sad%2C%20but%20true)%2C%20I%20ran%20it%20directly%20from%20the%20network%20using%20the%20Sysinternals%20Live%20address%2C%20%3CA%20target%3D%22_blank%22%3E%5C%5Clive.sysinternals.com%5Ctools%5Cprocmon.exe%20%3C%2FA%3E.%20With%20Process%20Monitor%20recording%20activity%2C%20I%20closed%20and%20reopened%20the%20Choose%20File%20dialog%20from%20the%20email%20editor%20and%20then%20I%20search%20for%20%E2%80%9CCIMG%E2%80%9D%2C%20a%20portion%20of%20the%20file%20name%20for%20many%20of%20the%20files%20present%20in%20the%20Choose%20File%20dialog%2C%20but%20not%20in%20the%20Explorer%20view%20of%20the%20desktop.%20The%20first%20hit%20was%20a%20directory%20enumeration%20operation%20with%20the%20file%20names%20showing%20as%20results%20in%20the%20Details%20column%20on%20the%20far%20right%3A%3C%2FP%3E%0A%20%20%3CP%3E%3CIMG%20alt%3D%22image%22%20border%3D%220%22%20height%3D%2272%22%20original-url%3D%22http%3A%2F%2Fblogs.technet.com%2Fblogfiles%2Fmarkrussinovich%2FWindowsLiveWriter%2FTheCaseofthePhantomDesktopFiles_4A85%2Fimage_thumb_12.png%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121092i2DED37C31D135176%22%20style%3D%22border-right-width%3A%200px%3B%20display%3A%20inline%3B%20border-top-width%3A%200px%3B%20border-bottom-width%3A%200px%3B%20border-left-width%3A%200px%22%20title%3D%22image%22%20width%3D%22554%22%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3EThe%20files%20were%20located%20in%20her%20profile%20under%20%5CAppdata%5CLocal%5CMicrosoft%5CWindows%5CTemporary%20Internet%20Files%5CVirtualized%5CC%5CUsers%5CDaryl%5CDesktop.%20This%20Virtualized%20is%20directory%20created%20by%20IE7%20when%20run%20in%20Protected%20Mode%20(PMIE)%2C%20which%20is%20the%20default%20mode%20on%20Windows%20Vista%20and%20Windows%20Server%202008.%3C%2FP%3E%0A%20%20%3CP%3EPMIE%20uses%20Integrity%20Levels%2C%20introduced%20in%20Vista%20and%20Server%202008%2C%20to%20limit%20the%20file%20system%20and%20registry%20locations%20to%20which%20code%20running%20in%20IE%20can%20modify%20to%20a%20subset%20of%20those%20writeable%20by%20the%20user%20account%20in%20which%20IE%20executes.%20As%20I%20described%20in%20an%20%3CA%20href%3D%22http%3A%2F%2Fblogs.technet.com%2Fmarkrussinovich%2Farchive%2F2007%2F02%2F12%2F638372.aspx%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eearlier%20blog%20post%20%3C%2FA%3E%2C%20the%20sandbox%20defined%20by%20locations%20labeled%20with%20Low%20Integrity%2C%20the%20level%20at%20which%20PMIE%20executes%20and%20of%20the%20objects%20that%20PMIE%20can%20modify%2C%20allow%20PMIE%20to%20save%20favorites%20and%20temporary%20files%2C%20like%20the%20IE%20cache%20and%20browsing%20history.%20However%2C%20PMIE%20cannot%20modify%20other%20locations%20in%20a%20user%E2%80%99s%20account%2C%20like%20documents%20folders%20and%20per-user%20autostart%20locations%20in%20the%20registry%20and%20file%20system%2C%20because%20they%20have%20an%20integrity%20level%20of%20Medium.%20That%20prevents%20drive-by-download%20malware%20that%20might%20infect%20the%20IE%20process%20from%20establishing%20a%20persistent%20presence.%3C%2FP%3E%0A%20%20%3CP%3EIn%20order%20to%20preserve%20backward%20compatibility%20with%20legacy%20code%2C%20such%20as%20ActiveX%20controls%20and%20Browser%20Helper%20Objects%2C%20that%20might%20be%20coded%20to%20write%20to%20locations%20outside%20of%20the%20sandbox%2C%20PMIE%20implements%20%3CEM%3Eshims%20%3C%2FEM%3Ethat%20intercepts%20file%20and%20registry%20operations%20and%20redirects%20ones%20that%20got%20outside%20the%20sandbox%20to%20the%20Virtualized%20directory%20within%20it.%3C%2FP%3E%0A%20%20%3CP%3ETo%20see%20if%20that%20was%20what%20was%20happening%20here%2C%20I%20examined%20the%20stack%20trace%20of%20the%20virtualized%20operation%20highlighted%20above%20by%20right-clicking%20on%20the%20line%20and%20choosing%20Stack.%20The%20stack%20showed%20that%20Acredir.dll%20was%20intercepting%20the%20operation%20and%20executing%20redirection%20functions%3A%3C%2FP%3E%0A%20%20%3CP%3E%3CIMG%20alt%3D%22image%22%20border%3D%220%22%20height%3D%22198%22%20original-url%3D%22http%3A%2F%2Fblogs.technet.com%2Fblogfiles%2Fmarkrussinovich%2FWindowsLiveWriter%2FTheCaseofthePhantomDesktopFiles_4A85%2Fimage_thumb_10.png%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121093i9CBB0BABB341C6B0%22%20style%3D%22border-right-width%3A%200px%3B%20display%3A%20inline%3B%20border-top-width%3A%200px%3B%20border-bottom-width%3A%200px%3B%20border-left-width%3A%200px%22%20title%3D%22image%22%20width%3D%22391%22%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3EDouble-clicking%20on%20the%20line%20in%20the%20stack%20trace%20opens%20the%20module%20properties%20dialog%2C%20which%20shows%20that%20the%20DLL%20is%20the%20%E2%80%9CWindows%20Compatibility%20DLL%E2%80%9D%2C%20thus%20confirming%20this%20was%20part%20of%20PMIE%E2%80%99s%20sandbox%20implementation%3A%3C%2FP%3E%0A%20%20%3CP%3E%3CIMG%20alt%3D%22image%22%20border%3D%220%22%20height%3D%22140%22%20original-url%3D%22http%3A%2F%2Fblogs.technet.com%2Fblogfiles%2Fmarkrussinovich%2FWindowsLiveWriter%2FTheCaseofthePhantomDesktopFiles_4A85%2Fimage_thumb_13.png%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121094i089876EBC5E1858C%22%20style%3D%22border-right-width%3A%200px%3B%20display%3A%20inline%3B%20border-top-width%3A%200px%3B%20border-bottom-width%3A%200px%3B%20border-left-width%3A%200px%22%20title%3D%22image%22%20width%3D%22244%22%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3EI%20had%20been%20familiar%20with%20PMIE%E2%80%99s%20virtualization%2C%20but%20I%E2%80%99d%20never%20seen%20files%20virtualized%20on%20the%20desktop%2C%20so%20it%20had%20not%20been%20obvious%20to%20me%20that%20was%20what%20was%20causing%20the%20discrepancy.%20Process%20Monitor%20revealed%20the%20cause%2C%20so%20now%20all%20I%20was%20left%20with%20was%20cleaning%20up%20the%20virtualized%20files.%20Most%20users%20don%E2%80%99t%20realize%20that%20you%20can%20move%20and%20delete%20files%20from%20within%20a%20file%20browse%20dialog%2C%20so%20I%20took%20the%20opportunity%20to%20show%20my%20wife%20how%20she%20can%20manage%20virtualized%20files%20from%20the%20email%20editor%E2%80%99s%20attachment%20dialog%20if%20she%20came%20across%20them%20again.%20We%20deleted%20the%20files%20she%20didn%E2%80%99t%20want%20and%20moved%20the%20pictures%20out%20to%20her%20photo%20library%20folders.%3C%2FP%3E%0A%20%20%3CP%3EThe%20case%20was%20closed.%20As%20a%20bonus%2C%20my%20wife%20was%20impressed%20at%20the%20ease%20with%20which%20I%E2%80%99d%20figured%20out%20the%20source%20of%20the%20phantom%20files%20and%20even%20more%20impressed%20that%20I%20wrote%20the%20tool%20I%20used%20to%20solve%20it.%20She%E2%80%99d%20also%20gotten%20an%20in%20depth%20look%20at%20PMIE%E2%80%99s%20virtualization%20and%20integrity%20levels%2C%20but%20I%20think%20in%20the%20end%20my%20lecturing%20on%20those%20subjects%20actually%20subtracted%20points.%3C%2FP%3E%0A%20%20%3CP%3EIncidentally%2C%20you%E2%80%99ll%20almost%20certainly%20see%20files%20and%20directories%20if%20you%20look%20at%20the%20PMIE%20Virtualized%20folder%20in%20your%20profile%2C%20because%20even%20routine%20operations%20within%20IE%20result%20in%20redirection.%20Here%20you%20can%20see%20thumbnail%20cache%20files%20that%20the%20shell%E2%80%99s%20file%20browsing%20dialog%20creates%20when%20you%20use%20it%20from%20within%20IE.%20Normally%2C%20the%20shell%20stores%20thumbnail%20cache%20files%20in%20your%20profile%2C%20but%20PMIE%20can%E2%80%99t%20write%20to%20that%20location%20so%20the%20shim%20virtualizes%20it%3A%3C%2FP%3E%0A%20%20%3CP%3E%3CIMG%20alt%3D%22image%22%20border%3D%220%22%20height%3D%22246%22%20original-url%3D%22http%3A%2F%2Fblogs.technet.com%2Fblogfiles%2Fmarkrussinovich%2FWindowsLiveWriter%2FTheCaseofthePhantomDesktopFiles_4A85%2Fimage_thumb_9.png%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121095iDB695A46D4C70C81%22%20style%3D%22border-right-width%3A%200px%3B%20display%3A%20inline%3B%20border-top-width%3A%200px%3B%20border-bottom-width%3A%200px%3B%20border-left-width%3A%200px%22%20title%3D%22image%22%20width%3D%22443%22%20%2F%3E%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-723757%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20TechNet%20on%20Dec%2028%2C%202008%20A%20few%20weeks%20ago%2C%20my%20wife%20mentioned%20that%20she%20sometimes%20saw%20files%20in%20her%20desktop%20folder%20that%20didn%E2%80%99t%20appear%20on%20the%20actual%20desktop.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-723757%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMark%20Russinovich%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft
First published on TechNet on Dec 28, 2008

A few weeks ago, my wife mentioned that she sometimes saw files in her desktop folder that didn’t appear on the actual desktop. She brought it up not only because she was confused by the discrepancy, but because she wanted to move some of these phantom files to other folders and wanted to delete others. I had no idea what she was talking about (which was usually the case when she described her computer troubles), so I told her that the next time she saw these mysterious files, to call me to look at it.

A few days later I got home from work and she greeted me excitedly at the door and explained that the problem reoccurred and that she had left a window open showing the elusive files. I rushed to the kitchen computer with anticipation, not even bothering to greet the dogs on the way, and surveyed the situation. She had a maximized IE window open with a full row of tabs for her open emails (I don’t think she ever closes an email window). An IE “Choose a File” dialog box was in the foreground listing the files in her desktop folder, which she had opened by clicking the attachment button in the email editor. The dialog looked like this:

image

I minimized IE to view the desktop background and sure enough, several of the files visible in the dialog, such as the “Maui Feb. 08” folder and the CIMG13xx JPG files, were missing. I opened an Explorer window and navigated to her desktop folder to see if the files would show up there, but they were missing there as well:

image

I’d never seen that behavior before. I knew this was a job for Process Monitor . Since my wife doesn’t keep the Sysinternals tools on her system (sad, but true), I ran it directly from the network using the Sysinternals Live address, \\live.sysinternals.com\tools\procmon.exe . With Process Monitor recording activity, I closed and reopened the Choose File dialog from the email editor and then I search for “CIMG”, a portion of the file name for many of the files present in the Choose File dialog, but not in the Explorer view of the desktop. The first hit was a directory enumeration operation with the file names showing as results in the Details column on the far right:

image

The files were located in her profile under \Appdata\Local\Microsoft\Windows\Temporary Internet Files\Virtualized\C\Users\Daryl\Desktop. This Virtualized is directory created by IE7 when run in Protected Mode (PMIE), which is the default mode on Windows Vista and Windows Server 2008.

PMIE uses Integrity Levels, introduced in Vista and Server 2008, to limit the file system and registry locations to which code running in IE can modify to a subset of those writeable by the user account in which IE executes. As I described in an earlier blog post , the sandbox defined by locations labeled with Low Integrity, the level at which PMIE executes and of the objects that PMIE can modify, allow PMIE to save favorites and temporary files, like the IE cache and browsing history. However, PMIE cannot modify other locations in a user’s account, like documents folders and per-user autostart locations in the registry and file system, because they have an integrity level of Medium. That prevents drive-by-download malware that might infect the IE process from establishing a persistent presence.

In order to preserve backward compatibility with legacy code, such as ActiveX controls and Browser Helper Objects, that might be coded to write to locations outside of the sandbox, PMIE implements shims that intercepts file and registry operations and redirects ones that got outside the sandbox to the Virtualized directory within it.

To see if that was what was happening here, I examined the stack trace of the virtualized operation highlighted above by right-clicking on the line and choosing Stack. The stack showed that Acredir.dll was intercepting the operation and executing redirection functions:

image

Double-clicking on the line in the stack trace opens the module properties dialog, which shows that the DLL is the “Windows Compatibility DLL”, thus confirming this was part of PMIE’s sandbox implementation:

image

I had been familiar with PMIE’s virtualization, but I’d never seen files virtualized on the desktop, so it had not been obvious to me that was what was causing the discrepancy. Process Monitor revealed the cause, so now all I was left with was cleaning up the virtualized files. Most users don’t realize that you can move and delete files from within a file browse dialog, so I took the opportunity to show my wife how she can manage virtualized files from the email editor’s attachment dialog if she came across them again. We deleted the files she didn’t want and moved the pictures out to her photo library folders.

The case was closed. As a bonus, my wife was impressed at the ease with which I’d figured out the source of the phantom files and even more impressed that I wrote the tool I used to solve it. She’d also gotten an in depth look at PMIE’s virtualization and integrity levels, but I think in the end my lecturing on those subjects actually subtracted points.

Incidentally, you’ll almost certainly see files and directories if you look at the PMIE Virtualized folder in your profile, because even routine operations within IE result in redirection. Here you can see thumbnail cache files that the shell’s file browsing dialog creates when you use it from within IE. Normally, the shell stores thumbnail cache files in your profile, but PMIE can’t write to that location so the shim virtualizes it:

image