microsoft / MSIX-PackageSupportFramework

The Package Support Framework (PSF) is a kit for applying compatibility fixes to packaged desktop applications.
MIT License
114 stars 57 forks source link

Process launching #166

Closed TimMangan closed 2 years ago

TimMangan commented 3 years ago

I believe that we will need a new fixup to control process launching. The scenario to support if apps that drop files temporarily into the user's temp folder and then try to run an executable external to the package against the file. Under the newer OS's this file is automatically redirected under the writablepackageroot (by the RUNTIME, not by the FileRedirectionFixup) and when the external program is launched (notepad.exe, for example), the external process starts outside of the container and the path given is not valid.

Adding an intercept to the launch that can be controlled via conf.json settings to indicate if the new process should be contained would solve this. To be determined if this is a new fixup or a mod to the intercept in place by PsfRuntime.

aniketbanerji commented 2 years ago

Can you please share the package, or the repro steps?

TimMangan commented 2 years ago

I am afraid that I cannot find my notes on what that app was.

aniketbanerji commented 2 years ago

Hi Tim, We tried reproducing the scenario (by dropping files temporarily into user's temp folder and then run an external executable to the package against the file) but could not find any issue.
Please feel free to re-open the issue when the app details and reproduction steps are available.

TimMangan commented 2 years ago

That's fine.

For historical context (in case I ever run into this again) I believe the issue was the dropped in file was an exe (embedded in a package executable and copied to the temp folder), then it ran the exe with a command line argument pointing in the package which the app couldn't see since it was given the argument using native pathing, but the dropped exe is running outside the container and doesn't get the advantage of layering.

ravishroshanms commented 2 years ago

I think we saw this issue with Twitch App. We applied FileRedirection Fixup for the TwitchStudio.exe but this application created a copy TwitchStudio.exe itself in the temp location and tried to launch it as a new process. Now this newly launched process is not getting intercepted by PSFLauncher and PSFRuntime.dll and hence no fixup is applied to the process. I think we can modify the CreateProcessHook in the PSFRuntime to intercept such processes as well. @TimMangan, do you think that you had same issue? If yes, then we can reopen this issue else I will create a new one.

TimMangan commented 2 years ago

Yes. Different app but is the same issue. The new process needed to be in the container to get FRF support to see a file in a command line argument.

I was planning to introduce another launcher option to the json file to convince the StartProcess intercept to make this process start inside the container.

I started the issue against my fork to get it on the list for me to do, but unfortunately those appear on the Microsoft fork issue list. It isn't a high priority.

Get Outlook for Androidhttps://aka.ms/ghei36


From: ravishroshanms @.> Sent: Wednesday, August 3, 2022 3:39:41 PM To: microsoft/MSIX-PackageSupportFramework @.> Cc: TIMOTHY MANGAN @.>; Mention @.> Subject: Re: [microsoft/MSIX-PackageSupportFramework] Process launching (#166)

I think we saw this issue with Twitch App. We applied FileRedirection Fixup for the TwitchStudio.exe but this application created a copy TwitchStudio.exe itself in the temp location and tried to launch it as a new process. Now this newly launched process is not getting intercepted by PSFLauncher and PSFRuntime.dll and hence no fixup is applied to the process. I think we can modify the CreateProcessHook in the PSFRuntime to intercept such processes as well. @TimManganhttps://github.com/TimMangan, do you think that you had same issue? If yes, then we can reopen this issue else I will create a new one.

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/MSIX-PackageSupportFramework/issues/166#issuecomment-1204395595, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEVBJFIKL5UG3HIS63USGGTVXLDH3ANCNFSM4V5WGWKA. You are receiving this because you were mentioned.Message ID: @.***>