ShellExecute fails on startup with an elevated process and a browser other than the default settings set in Windows NT RTM

Install a non-default browser in Windows 7 RTM (Chrome, Firefox) and try to run the code as follows:

ShellExecute(NULL, "open", "http://stackoverflow.com", NULL, NULL, SW_SHOWNORMAL);

This is normal. But then change the manifest to require administrative privileges or simply "run as administrator".

The code will not work.

So, try to run any application using "run as administrator".

You will see the same result, links do not work.

Change default browser in IE -> everything works fine.

In previous versions of Windows 8, this behavior does not exist.

What's happening?

PS. It seems that Microsoft was experiencing the same problems in its own software :) Visual Studio 2012 Web Publishing in Windows 8 RTM terminates browser launch

+8
security winapi windows-8 shellexecute
source share
2 answers

I have seen the same behavior with Chrome until today. After spending some time trying to figure out whatโ€™s going on, and for a long time I couldnโ€™t get Chrome to come up with ShellExecute () with elevated rights. It was not possible to obtain elevated rights (for example, the UAC dialog or "Run as administrator") or even when turning off the UAC as a whole.

As a result, I uninstalled and reinstalled Chrome and actually fixed it.

I also saw the behavior with other browsers, however, after several attempts with FireFox, I went to the "Set default settings" settings from FireFox and EXPLICITLY (that is, on Windows) established associations for the .htm file and the HTTP protocol. It also helped.

So it looks like this is some kind of registration problem, not a problem in Windows. The first thing I would like to try is to explicitly establish associations in Windows (and not set the default browser in the browser). If this fails, reinstall the browser ...

+3
source share

@ Rick Strahl

You are wrong. This is not just registration. I tested using Photoshop CC and Windows 8. I created a launcher for Photoshop to make it portable: - with administrator privileges, shell integration does not work. - when run as a normal user, shell integration works as expected.

Tested on Windows 7. - Works with or without Administrative Rights.

I can confirm that the OP is correct.

0
source share

All Articles