2

I'm trying to bring a Delphi/Win32 application to the Microsoft Store. In my application I have to download another app that needs to be executed. However, after installing this package (as MSIX) I get an ACCESS DENIED error on ShellExecute.

I found out that, in a UWP, it is (by default) not allowed to execute an arbitrary executable that is not included in your package. However, there is a workaround in C# using FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync. See UWP: how to start an exe file that is located in specific directory?

Are there ways to use FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync in Delphi? Or other ways to deploy my Win32 Delphi app through the appstore (I want to have the benefit of automatic updates)?

Laurens
  • 325
  • 2
  • 12

1 Answers1

0

I'm trying to bring a Delphi/Win32 application to the Microsoft Store. In my application I have to download another app that needs to be executed

As the document said, you can't execute another app with UWP directly, the target app should be registered in the package manifest file and launched by LaunchFullTrustProcessForCurrentAppAsync method in UWP platform by default.

However, you have other way to execute download app that invoke Process.Start in desktop extension. you just need get the download app's path, then pass it to stat method.

Process.Start(Path.Combine(ApplicationData.Current.LocalFolder.Path, "CoreAppTest.exe"));

For more detail, you could research stefan's blog UWP with Desktop Extension – Part 2 launch remote app.

Nico Zhu
  • 32,367
  • 2
  • 15
  • 36
  • Thanks for your explanation. Using a UWP in C# in managed to get it working, however I want to use `LaunchFullTrustProcessForCurrentAppAsync` in Delphi. If that doesn't work, do you think it is possible to create a C# DLL that executes that method? – Laurens Mar 29 '22 at 10:20
  • access denied exception is also thrown if a dll method is called in uwp platform. – Nico Zhu Mar 29 '22 at 14:53
  • Yeah, I know that, but the main issue is that there is no Delphi equivilant of `LaunchFullTrustProcessForCurrentAppAsync`. I have tried to call that method from my Delphi application (packaged as MSIX in the same way as my C# app) and in C# the call to `LaunchFullTrustProcessForCurrentAppAsync` works, but in my Delphi app the call does noting and just returns without any exception. – Laurens Mar 30 '22 at 09:48
  • LaunchFullTrustProcessForCurrentAppAsync method only work for register [package](https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.fulltrustprocesslauncher?view=winrt-22000#remarks). – Nico Zhu Mar 31 '22 at 06:33
  • I know, and in C# I have it working. However, the main issue is that I want it to work in Delphi :-) – Laurens Mar 31 '22 at 10:33
  • No, you can't it only works for UWP platform. *Activate the full-trust Win32 component of an application from a **Universal Windows app component** in the same application package.* – Nico Zhu Apr 01 '22 at 02:54