Hi,
I am trying to execute “elevate.exe” (my custom application) from another application, using ShellExecute () API. In this “elevate.exe”, I am usingCStdioFile::open() API to open a system file ( %windir%\System32\drivers\etc) in write mode (CFile::modeWrite), with below OS settings:
Log on User: Stduser (non admin user)
User Account Control settings : Default
Project settings (elevate.exe)->linker->Manifest File-> UAC execution level->requireAdministrator
With above scenario OS ask for admin credentials (popup dialog of “User Account Control”).
CString l_csPath =_T("C:\\TESTAPP\\elevate\\Release\\elevate.exe"); HANDLE child = ShellExecute( NULL,_T("runas"),l_csPath,NULL,NULL,SW_SHOWNORMAL);
Please help to elevate user rights for avoiding popup dialog of “User Account Control” OR can we pass admin credentials programmatically to execute above code snippet? OR is there any other way to elevate user rights for changing OS settings ?