I have Windows UWP application which will run only on Windows 10 IOT core. I am the owner of every machine on which it will ever run (so I can make any modification to machine)
The application need to download and run Win32 application. Solution to run Win32 application is to use ProcessLauncher::RunToCompletionAsync. Before I add exe to allow list:
reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\EmbeddedMode\ProcessLauncher" /v AllowedExecutableFilesList /t REG_MULTI_SZ /d "c:\PATH TO FILE"
This works, Win32 application process is launched properly. However, this executable is uploaded to Windows 10 IOT core device using Windows Device Portal. The problem rises, when Windows UWP application need to update this Win32 executable. It works this way: Sometimes Windows UWP app downloads new executable from internet, cancels async task (turns off process) returned by RunToCompletionAsync, and saves new file to the same executable path (from allow list). The problem is that, the exe cannot run. It seems that exe can run when it is saved on machine using Windows Device Portal, but when UWP app saves this on machine itself, then it cannot run.
I came up with other solution, I made intermediary Win32 program, it works like this now:
Windows UWP app launcher launches Win32 intermediary program from path in allow list (this program is uploaded using Windows Device Portal once, and it never changes). Win32 intermediary program has functionality to download executable from internet and save it on disk, then it runs this executable using Win32 API CreateProcess. It works, exe is launched. However, the problem is that the new process cannot save any file to disk (Why?).
What is the solution? How can I download Win32 executable using Windows UWP app, and run it?