Forum Discussion
Shimming apps that start other processes in the package.
I'm not sure if the PSF is designed to handle the need to shim child processes of the shortcut app.
For example, FileZilla.exe will start fzftp.exe as a child process. I can put PsfShimLauncher in as the shortcut to launch FileZilla.exe with shims, but how would I get the shims into the child processes? Will PsfShimLauncher also notice these as long as configured in the json? If not, how would we do this?
10 Replies
- Vladimir PostelBrass Contributor
if FileZilla.exe launches fzftp.exe via CreateProcess the fixup will apply to both, assuming both processes are in the package of course.
Vlad
- Bogdan MitracheIron Contributor
It seems like something changed in 1809 regarding child process. On a machine pre-1809 the fixup is applied to the child process too but that does not happen anymore on machined with the 1809 update installed.
I attached a simple test app (just rename the extension from zip to appx, it failed to upload it otherwise) we use internally. After you install it select "Launch second" to launch a child process and then "Write". On the pre-1809 machine this works, while on 1809 it crashes (i.e. the fixup does not get inherited from the parent process).
jvintzelconscious or accidental change in the OS?
- Vladimir PostelBrass Contributor
Hi Bogdan,
The custom Launcher in the sample calls the System.Diagnostics.Process.Start .NET function that in turn calls to Shell Execute. When calling Shell execute the process creation escapes out of the calling process and the fixup won’t apply, we are not supporting this scenario today.
Is there a specific reason why you are using it? Can you try using the official psfLauncher to achieve it.
Vlad
- Bogdan MitracheIron Contributor
Hi Vlad, John,
Thanks for the quick reply.
We just used the standard documentation from .NET to launch the process, we didn't write the code specifically to call ShellExecute or CreateProcess. Actually, we left the default value (true) for the property UseShellExecute when we initially wrote the code. If we set it to false, then indeed the child process inherits the fixup.
However, the point here is that the default for this property (UseShellExecute) in .NET changed over the 1809 update and this could affect other user apps too, not just our sample. Apps for which users might not be able to change the code.
This is what we were trying to understand, if this change was intended or accidental?
Regarding your question, we are using our customer launcher because it provides additional functionality (migrating user shortcuts, pins, appdata, etc.. from the old msi version of the app) while also including the PSF support you guys published. It is something we have in Advanced Installer long before PSF was announced.
Also, as I said above, is we set UseShellExecute to false then the fixup is inherited, so there isn't a problem with our launcher, it behaves just as yours.
From our tests, if you have the x86 and x64 executables called PsfRunDll<arch>.exe xchen@lantostechnologies.com, and their corresponding dlls, next to the PSF runtimemanager then the fixups are correctly inherited by the processes, when launching a process for an app with a different bitness.
It seems to me that we have a general flaw regarding child processes and shims. I think that in the end, the config.json would have to have both x86 and x64 shims listed, and the logic that imports them into the process would have to look at the process and decide which one to import.
Any other solution will fail if a x86 app launches a child x64 app or visa versa.
- jvintzelBronze Contributor
I'll check into it and get back to you.
John.