My TestDirectory program shows more detail about sparse file, although it is more useful in the App-V
case as it also shows what parts of the file are present on disk. (See section at the end of this document
for more information on this tool).
Another thing to notice in the file list of the redirected area is that it did not include all files that were
present in the package folder. With App-V, the packaging publish process would pre-create all of the
placeholder files up front. In a large package this would significantly slow down this process making it
take seconds to minutes for the app to be ready. Even with ILV, the MSIX AppInstaller does not create
these placeholders. Instead, they are created whenever the package file is accessed. This matches our
test cases for std::filesystem::exists, Get/SetFileAttributes, and CreateFile. Furthermore, if you
specifically make one of those calls against the filesystem path in the redirection area, wcifs will also
trigger the creation of the placeholder. This also occurs if the application requested the native file path,
but another component (either PSF or the MSIX Runtime) redirected this into the package or redirection
equivalent.
Finally, in the file list of the redirected area, we normally would not have seen the file entry
‘testfiled.txt’. It was necessary to change the settings in explorer to show hidden and system files for
this entry to show. That is because test number 5 was run against the TestFileD.txt file of the program
folder. Without the ILV this call would have failed, but with the ILV the system puts a placeholder file in
the redirection folder (changing the name to lowercase for some reason) but it has no contents (both
file size and size on disk are 0), is not marked sparse, and is set with hidden and system attributes.
Attempts to test the file for existence of the file or read once deleted (in the package or redirected
pathing) will result in a FileNotFound return.
Applications will look for files by either Opening and querying a directory, or using something like the
FindFirstFile/FindNext file API. Ultimately a directory contains the list of files under it. The
FileRedirectionFixup and MfrFixup have extensive logic to layer local, package, and redirected folders
into a single list that it provides the apps. From the testing shown here, it appears that the ILV has
similar logic built into the mini-filter driver. So unlike the partial list of files we see in the explorer when
looking at the redirection area, the test calling FindXXFile shows the overlaid view of the redirection
area on top of the package files. Similarly, a FindXXFile call on the program folder will show the same
overlay. This includes new files that only exist in the redirected area.
If an application queries an application directly, it opens a directory handle and then queries that handle
for the files. With user mode provided redirections (such as used in the PSF) this means that the app will
only see the files in whichever copy of the directory was actually opened. This is the most common
source of remaining compatibility issues for MSIX. Unlike a user-mode component, a filter driver has the
possibility of solving this. This is commonly done in App-V and other layering solutions, however I have
not yet determined if or how this works with ILV.