Registry access problem for Windows 7 using IE add-on...

Add-in Express™ Support Service
That's what is more important than anything else

Registry access problem for Windows 7 using IE add-on...
Pratibha Pandey

Posts: 33
Joined: 2010-06-30
Hello Tim,

I have been trying to disable Javascript using my Add-on toolbar for which I have to access Registry,..

I got this error on Windows 7 but not on Windows XP:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Security.SecurityException: Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at InFocusToolbar_IE8.InFocusIEBar.getCurrentJavaScriptValue()
at InFocusToolbar_IE8.InFocusIEBar.menuPreviewModes_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
The Zone of the assembly that failed was:

Can you please tell the work around of this error...
Its very urgent..
Posted 25 Sep, 2010 03:45:48 Top
Andrei Smolin

Add-in Express team

Posts: 14976
Joined: 2006-05-11
Hi Pratibha,

Please make sure that the issue can be solved by turning Protected Mode off. If it can, then you need to use the ProtectedModeApi class to get a writable registry branch:

AddinExpress.IE.ADXIEProtectedModeAPI protectedMode = new AddinExpress.IE.ADXIEProtectedModeAPI();
string anHKCUKey = protectedMode.GetWriteableHKCU();

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Sep, 2010 06:08:02 Top