App-V 5 HF5 PVAD vs VFS Tokenization of File, Registry, and Shortcuts
It appears the way file and registry keys are converted into tokens is accomplished differently and may lead to an issue. Below is a reproducer of the problem experienced.
Overview:
If a package PVAD is set to a path that contains the partial name of a different folder; registry keys (including dll registration) will save incorrectly and in turn show incorrectly when translated on the client PC.
Example:
Sequence a new package with PVAD set to C:\Program Files (x86)\ABC.
Create an empty text file called ABC_File.txt in this directory.
Create an HKCU key with this Path
Created folders
C:\Program Files (x86)\ABCDE
C:\Program Files (x86)\BC
C:\Program Files (x86)\C
Create an empty text file called foldername.txt (ABCDE_File.txt) in the directory.
Create an HKCU key with this Path information
Create shortcuts to each file
Screenshots: I used AVE to create screenshots, but did not create or save the package with it
Registry
As you can see, even though the folder \ABCDE should not be part of PVAD and should be under VFS, the token path is reflecting Root, seemingly because C:\Program Files (x86)\ABCDE contains C:\Program Files (x86)\ABC.
This is how this looks expanded to the client:
files
In the registry, the path should point to ABCDE_File.txt should look just like the above for BC(below), but instead is has the strange path of
C:\ProgramData\App-V\D776D4EB-EDFD-40B8-B672-1BED2DD91EE2\BE1D8431-6A0C-4344-8EAC-62637534CA10\rootDE\ABCDE_File.txt
Oddly enough, the shortcuts created in the package are wrong just like the registry:
The above can be seen in the Registry.dat and AppxManifest.xml. The FilesystemMetadata.xml, just like the filesystem has the correct values.
I would be very interested to see if others can reproduce this issue. In a real life scenario, we have an issue with an application because of this, and are forced to correct the registry entries via a script.
If there is interest I will attach a link to download the package, its only about 50KB.