I want a way in Delphi which I can run an exe file as a different user in order to gain different permissions. I do not want elevation of permissions. Screenshot:
I want from delphi code to start an application as a different user as depicted in the picture.
Use Run As to start a program as another userLocate the program that you want to start in Windows Explorer, the Microsoft Management Console (MMC), or Control Panel. Press and hold down the SHIFT key while you right-click the .exe file or icon for the program, and then click Run as. Click The following user.
Run as different user from the taskbar context menuPress and hold the Shift key. While holding Shift , right-click the app name in the context menu to see extra menu items. Release the Shift key and click Run as different user. Finally, provide the user account data to run a new instance of the app from.
The API function that you are looking for is CredUIPromptForCredentials
. This returns a username and password that you can pass to CreateProcessWithLogonW
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With