-
Notifications
You must be signed in to change notification settings - Fork 9
/
InternetExplorer.cs
53 lines (42 loc) · 1.88 KB
/
InternetExplorer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.Win32;
namespace FreenetTray.Browsers
{
class InternetExplorer: Browser
{
private static string IERegistryKey = @"Software\Microsoft\Internet Explorer";
private static readonly string[] Locations = {
@"%PROGRAMFILES%\internet explorer",
@"%PROGRAMFILES(X86)%\internet explorer",
};
public InternetExplorer()
{
// See https://support.microsoft.com/kb/969393
// NOTE: this is intentionally looking for the 32bit version, because it's very rare
// for anyone to launch IE 64-bit on purpose. However, since we're running it in
// private browsing mode and don't need plugins anyway, should we always prefer it?
RegistryKey hive = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
RegistryKey key = hive.OpenSubKey(IERegistryKey);
if (key != null) {
var value = key.GetValue("version") as string;
if (value != null) {
_version = new Version(value);
}
}
_path = Locations
.Select(location => Environment.ExpandEnvironmentVariables(location) + @"\iexplore.exe")
.Where(File.Exists)
.FirstOrDefault();
_isInstalled = _path != null;
// See https://en.wikipedia.org/wiki/Internet_Explorer_8#InPrivate
_isUsable = _version >= new Version(8, 0);
// See http://msdn.microsoft.com/en-us/library/ie/hh826025%28v=vs.85%29.aspx
_args = "-private ";
_path = "iexplore.exe";
_name = "Internet Explorer";
}
}
}