0
votes

I have two applications - A and B. B has 'requireAdminstrator' manifest and I would like to invoke it from application A which is in standard token. UAC is 'Never-Notify'.

Is it really possible?

I have already tried CreateProcess and CreateProcessWithLogonW and both return FALSE and GetLastError shows 740 (The requested operation requires elevation. )

1

1 Answers

0
votes

Following code can be used for this:

  SHELLEXECUTEINFO shExecInfo;
  shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
  shExecInfo.fMask = NULL;
  shExecInfo.hwnd = NULL;
  shExecInfo.lpVerb = L”runas“;
  shExecInfo.lpFile = L”notepad.exe”;
  shExecInfo.lpParameters = NULL;
  shExecInfo.lpDirectory = NULL;
  shExecInfo.nShow = SW_MAXIMIZE;
  shExecInfo.hInstApp = NULL;
  ShellExecuteEx(&shExecInfo);

Reference:

https://blogs.msdn.microsoft.com/vistacompatteam/2006/09/25/elevate-through-shellexecute/