views:

24

answers:

0

In a BHO running within Internet Explorer on Windows 7 with Protected Mode On, I'm trying to write to the windows event log. I'm writing to a source that already exists, and it's in the Application Log so I don't see why this would be blocked. However, my call to System.Diagnostics.EventLog.WriteEntry("MySource", "Some message") fails with an InvalidOperationException, with message "Cannot open log for source 'XXX'. You may not have write access.". The stack trace indicates it's at EventLog.OpenForWrite(String currentMachineName).

Turning Protected Mode Off makes it work fine.

Any reason this would not be allowed within Protected Mode, and any way I can register my BHO as being allowed to write to the event log, or otherwise make it work?

According to this post the call to OpenForWrite() results in a call to UnsafeNativeMethods.RegisterEventSource(this.machineName, this.sourceName);, but the docs for that didn't get me any further.

I'm using .net 2.0

thanks.

Cross-posted here: http://social.msdn.microsoft.com/Forums/en-US/ieextensiondevelopment/thread/8befe683-cd46-4446-8571-8569d9d34941