In many cases the PackageRoot directory can be a reparsepoint in which case QueryFullProcessImageName will return a different value than the PackageRoot obtained by GetCurrentPackagePath*.
For example if an application is installed on a non-system drive D, GetCurrentPackagePath will return a path which is a junction C:\Program Files\WindowsApps\PackageFullName that points to the location on the other drive D:\WindowsApps\PackageFullName QueryFullProcessImageName resolves all intermediate reparse points and will return D:\WindowsApps\PackageFullName\Foo.exe. String comparison between C:\Program Files\WindowsApps\PackageFullName and the image path will fail and we will not inject PSF into the child process Foo.exe.
This change calculates the final path of the PackageRoot directory using GetFinalPathNameByHandle once per process and compares against that path when determining if PSF should be injected into a process.
In many cases the PackageRoot directory can be a reparsepoint in which case QueryFullProcessImageName will return a different value than the PackageRoot obtained by GetCurrentPackagePath*.
For example if an application is installed on a non-system drive D, GetCurrentPackagePath will return a path which is a junction C:\Program Files\WindowsApps\PackageFullName that points to the location on the other drive D:\WindowsApps\PackageFullName QueryFullProcessImageName resolves all intermediate reparse points and will return D:\WindowsApps\PackageFullName\Foo.exe. String comparison between C:\Program Files\WindowsApps\PackageFullName and the image path will fail and we will not inject PSF into the child process Foo.exe.
This change calculates the final path of the PackageRoot directory using GetFinalPathNameByHandle once per process and compares against that path when determining if PSF should be injected into a process.