Hello @Mustapha Ben ,
I saw your question and wanted to suggest an architectural pattern that might help you achieve this. You could consider the Out-of-Process Pattern with IPC, which keeps your main app at standard privileges and only elevates a secondary background process when requested by the user.
Consider following these steps to implement this approach:
1. Enable Elevation in Package Manifest
You'll need to declare the allowElevation restricted capability in your app's manifest. This unlocks the ability to use the runas verb inside the MSIX container, without forcing a UAC prompt when the primary app initially opens.
Documentation reference: App capability declarations - restricted capabilities
2. Launch the Secondary Process on Demand
Extract your MFT scanning logic into a separate console application or background task. When the user initiates a fast scan, launch this secondary application using your language's standard Process invoking API (like ProcessStartInfo in .NET) while explicitly specifying the runas verb. This triggers the UAC prompt only for that specific background process. You can then catch any cancellation exceptions to calmly fall back to your normal standard scan.
3. Send Data Back via IPC (Named Pipes)
Since the background process runs elevated and the main app runs standard, they can communicate via Named Pipes. The crucial part in this step is that the elevated process must explicitly set a Security Descriptor (using PipeSecurity and adding an Access Rule for the WorldSid) to allow standard users to read from the pipe. If you skip the Access Control List configuration, your main app will likely get an Access Denied error.
When submitting to the Store, I suggest adding a note in your certification instructions explaining why the allowElevation capability is needed (for example, to run an optional on-demand process for faster low-level disk scanning).
I hope this points you in the right direction! If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.
Thank you.