Jump to content

URLs invoked in Paint.NET should open in default broswer


mkidd
 Share

Recommended Posts

URLs invoked in Paint.NET should open in the default browser to comply with expected Windows application behavior. In Paint .NET 3.10 and earlier, menu items such as Help --> Help Topics and Help --> Paint.NET Website always open in IE even if the default browser is different, e.g. Firefox.

Link to comment
Share on other sites

Currently this has to do with the way your installation of Firefox has registered itself. For some reason, some systems do not get this registration set up correctly and so Windows still launches the URL through IE. It is not something we are intentionally doing, but are looking to improve in upcoming releases.

The code for launching URL's changed in v3.10 for some security related reasons, and this is just a byproduct of it. Not all systems exhibit this behavior; in fact, only a small minority do.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

URLs invoked in Paint.NET should open in the default browser to comply with expected Windows application behavior. In Paint .NET 3.10 and earlier, menu items such as Help --> Help Topics and Help --> Paint.NET Website always open in IE even if the default browser is different, e.g. Firefox.

By any chance, did you happen to install any of the Firefox 3 alpha versions on top of, w/o getting rid of FF 2? They might be related...

Link to comment
Share on other sites

  • 1 month later...

I'm having the same issue, Paint.Net opens URLs on IE instead of the default browser (Firefox).

Some time ago i installed firefox 3 alpha, but even so all the other apps on my system runs Firefox instead of IE.

I tried to download your source, looking for something weird and hopefully send you a path, however the download page doesn't have the link. It would be nice if you guys made public a svn repository or something alike.

Anyway, because i was unable to see your code i searched my system looking for something suspicious. So i ran:

System.Diagnostics.Process.Start("http://google.com");

And it worked fine, the url was handled by Firefox instead of IE.

So, is there some reason to do whatever you guys are doing to detect the default browser instead of delegating that task to the shell?

Link to comment
Share on other sites

Well, i'm not Rick, but this is on my registry:

[HKEY_CLASSES_ROOT\htmlfile\shell\open\command]

@="\"C:\\Archivos de programa\\Internet Explorer\\IEXPLORE.EXE\" -nohome"

So, it's IE, but, anyway, that shouldn't be used to open the browser, since every other application on my system uses Firefox instead.

So, now i'm confused, it looks like IE should handle html files, but it doesn't apart from paint.net

UPDATE:

I searched on the registry looking for the key that pointed to Firefox and i found it:

[HKEY_CLASSES_ROOT\HTTP\shell\open\command]

@="C:\\ARCHIV~1\\MOZILL~1\\FIREFOX.EXE -requestPending -osint -url \"%1\""

Since even the shell uses that, wouldn't be correct use the HTTP entry instead of the HTML ?

Link to comment
Share on other sites

Please trust me when I say that launching a URL is the most precarious thing you can attempt to do. Every browser finds some say to mess up the registration, or files get locked at weird times, or registry keys are stored in different formats, or documentation points you in 5 different directions, and there are new security considerations in Windows Vista (NEVER launch the browser elevated).

On another project I have a large block of code that handles all the weird cases we've found over the years for launching URL's correctly. It is over 2,000 lines of code that I wrote all of -- clearly this is a problem that is very near and dear to my heart (so to speak). You cannot just do a Process.Start(url) and assume that it will use what the user considers to be the "default browser," nor that it will even work, nor that it will launch with the correct privileges (it won't). You cannot just say, "Oh it's the operating system's responsibility, let's blame Windows and go eat lunch" because that still doesn't make it work on your customer's systems.

Anyway I obviously can't just copy that code in to Paint.NET because I do not own the IP (intellectual property). For now this is a low priority bug because 1) it does launch the URL, 2) it doesn't use the "non-default" browser on all systems (only some systems exhibit this), and 3) the security context is set up properly (never launches as admin on Vista).

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Who said I was using the HTTP entry? Like I said, this isn't something with a simple solution. You can brainstorm 50 different ways to do it, and I've implemented them all. (Not necessarily in Paint.NET)

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Well, it was a supposition, sorry if it was wrong.

I wanted to look at the current implementation to see how it's working but since the current sources haven't been uploaded i looked at a older version, a copy made from the mono guys as base to the mono port.

So i looked at http://paint-mono.googlecode.com/svn/ve ... rc_3_0/src which seems to be from 3.0 and it uses ShellExecuteExW.

I downloaded and build that source, and it opens the URL on Firefox correctly.

Just to let you know it worked before, i know it's not a priority bug, but i hope it helps, maybe i could take a look once the 3.20 source are uploaded.

Greets

Link to comment
Share on other sites

Yeah the code changed in 3.10 to ensure URL's were not launched with admin privilege in Vista. IIRC, all code paths end up launching explorer.exe with the URL as a parameter. So it's actually Windows that is launching it "wrong". :x

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

You're right (obviously), running explorer.exe "http://google.com" opens IE.

The weird thing is that if you type the url on the location bar on explorer.exe it does runs the correct browser.

So even explorer.exe isn't consistent with itself! :shock:

So:


  • [*:1yb3nrfm]explorer.exe URL: IE
    [*:1yb3nrfm]Typing URL on explorer.exe: Firefox
    [*:1yb3nrfm]explorer.exe htmlFileWithRedirect: IE
    [*:1yb3nrfm]Double clicking htmlFileWithRedirect on explorer.exe: Firefox

So, it looks like nothing can't be done if explorer.exe is used to launch URLs. Since i don't know how are you avoiding to launch the process without admin privileges i cannot be more helpful.

But i'll keep waiting for the source release to see how are you launching explorer without admin privileges (or does explorer.exe always runs as a not elevated user?)

Link to comment
Share on other sites

I'm using CreateProcessWithTokenW. The best way to do it is to either have your own little .exe that handles it ("launchurl.exe url_goes_here") which then does ShellExecuteEx or whatever, or bounce a call to a function that is exported from a DLL through rundll32.exe. But that is a very involved process, mostly because CreateProcessWithTokenW has a limit of 1024 characters for the command-line parameters (instead of 32,000 like all the other CreateProcess* functions). And because it has to be a C-style function, which you can't export from C#. So I likely will implement the full solution once I get around to adding a PaintDotNet.SystemLayer.Native.[x86 | x64].dll.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...