I have a strange problem that only manifests itself occasionally on some machines. So far I have seen this happen on one or two machines on Windows 10. The same thing, however, works fine on *other* machines that are also on Windows 10.
So I don't think looking at my code is going to be particularly helpful although I will post some snippets below. I have tried several things without much joy.
Here is the basic scenario:
ProgramA.exe is our main piece of software. It runs simply under the user's own privileges. Nothing special. But the user can click a button which will launch ProgramB.exe which needs to run with elevated privileges.
ProgramB.exe's manifest contains the following:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
I have tried various things:
- Simply use Process.Start to directly launch ProgramB.exe
- Use a ProcessStartInfo with UseShellExecute set to False, or with UseShellExecute set to True - setting appears to make no difference
- Use a ProcessStartInfo with verb set to "runas" - setting appears to make no difference
On some machines, Windows 8.1, Windows 10, this works perfectly fine. ProgramB does what it needs to do, with elevated privileges, and all is well.
But on one or two Windows 10 machines I find it looks like either ProgramB does nothing or it doesn't even get launched.
Here is the really weird thing. If I go to one of those machines and I run ProgramB.exe manually by simply double clicking on it in Windows Explorer, it works fine.
If I raise the User Access Control level and I launch ProgramB.exe manually, it does exactly what it should do: it prompts me whether I want to allow the program to make changes. If I click "Yes" it works perfectly.
So what I need is some sort of a hint as to what might be going on here? And what I could possibly do about it?
Pino Carafa