UI theme not applied
First, thanks for sharing this project! It's one of only a few available Windows "run as" implementations online.
I've managed to use RunAs.exe to authenticate and start processes using both the CreateProcessAsUserW, CreateProcessWithTokenW and CreateProcessWithLogonW implementation on Win11, although the CreateProcessAsUserW implementation seemed to require System account privileges obtained with PsExec.exe -i -s cmd.exe (documentation update request: #21).
One notable problem though is that the UI theme (skinning) does not seem to be applied to the created process (related to #16). This makes the applications look out of sync with the rest of the system. This limitation is not unique to this project though, and also affect the Starting an Interactive Client Process in C++ sample from Microsoft. Still, it would be interesting to understand why this problem occurs, and what can be done to address it.
regedit UI theme example
Expected UI appearance on Win11:
Observed UI appearance with RunAsCs.exeon Win11:
The same UI theme problem is observed both with --function 0, --function 1, and --function 2. Passing --force_profile does not help.
Steps to reproduce
- Create a regular
TestUseraccount with a password - Start an administrative command prompt
- Run
RunasCs.exe TestUser <password> c:\Windows\regedit.exe --force_profile --function 1(or with (--function 2) - Observe that
RegEditis started with incorrect UI theme