Permalink
Browse files

Fix issue MR-594 - Crash on startup if write access is denied to the …

…IE browser emulation registry key
  • Loading branch information...
1 parent 39f22de commit 49d9887d0325e5232cf82b2e9d0b2a647f598198 @rmcardle rmcardle committed Nov 18, 2013
Showing with 18 additions and 13 deletions.
  1. +1 −0 CHANGELOG.TXT
  2. +17 −13 mRemoteV1/Tools/IeBrowserEmulation.vb
View
@@ -9,6 +9,7 @@
Made improvement MR-486 - Allow escaping of variable names for external tools
Made improvement MR-590 - Make panels docked to the edge of the window keep their size
Fixed issue MR-187 - F7 keyboard shortcut for New Folder conflicts with remote connections
+ Fixed issue MR-594 - Crash on startup if write access is denied to the IE browser emulation registry key
Fixed issue MR-603 - Some configuration options are still shown even when inheritance is enabled
Added "Reset" to config panel context menu to allow resetting some config settings to their default value.
Added and improved menu icons.
@@ -1,26 +1,29 @@
Imports System.IO
Imports Microsoft.Win32
+Imports mRemoteNG.App.Runtime
Namespace Tools
Public Class IeBrowserEmulation
Private Const BrowserEmulationKey As String = "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"
Private Shared _previousIeBrowserEmulationValue As Integer = 0
Public Shared Sub Register()
- Dim registryKey As RegistryKey = Registry.CurrentUser.OpenSubKey(BrowserEmulationKey, True)
- If registryKey Is Nothing Then
- Registry.CurrentUser.CreateSubKey(BrowserEmulationKey)
- registryKey = Registry.CurrentUser.OpenSubKey(BrowserEmulationKey, True)
- If registryKey Is Nothing Then Return
- End If
- Dim exeName As String = Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName)
- _previousIeBrowserEmulationValue = registryKey.GetValue(exeName, 0)
- registryKey.SetValue(exeName, 11000, RegistryValueKind.DWord)
+ Try
+ Dim registryKey As RegistryKey = Registry.CurrentUser.OpenSubKey(BrowserEmulationKey, True)
+ If registryKey Is Nothing Then
+ Registry.CurrentUser.CreateSubKey(BrowserEmulationKey)
+ registryKey = Registry.CurrentUser.OpenSubKey(BrowserEmulationKey, True)
+ If registryKey Is Nothing Then Return
+ End If
+ Dim exeName As String = Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName)
+ _previousIeBrowserEmulationValue = registryKey.GetValue(exeName, 0)
+ registryKey.SetValue(exeName, 11000, RegistryValueKind.DWord)
+ Catch ex As Exception
+ MessageCollector.AddExceptionMessage("IeBrowserEmulation.Register() failed.", ex, , True)
+ End Try
End Sub
Public Shared Sub Unregister()
-#If Not PORTABLE Then
- Return
-#Else
+#If PORTABLE Then
Try
Dim registryKey As RegistryKey = Registry.CurrentUser.OpenSubKey(BrowserEmulationKey, True)
If registryKey Is Nothing Then Return
@@ -30,7 +33,8 @@ Namespace Tools
Else
registryKey.SetValue(exeName, _previousIeBrowserEmulationValue, RegistryValueKind.DWord)
End If
- Catch
+ Catch ex As Exception
+ MessageCollector.AddExceptionMessage("IeBrowserEmulation.Unregister() failed.", ex, , True)
End Try
#End If
End Sub

0 comments on commit 49d9887

Please sign in to comment.