Windows Vista Forums
Vista Forums Home Join Vista Forums Tech Publications Windows 7 Forum Vista Tutorials Webcasts Tags

Welcome to Vista Forums we are your forum for Windows Vista help and discussion. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Vista Newsgroups > Vista security

security problem when writing to windows application log

Update your Vista Drivers
Reply
 
Thread Tools Display Modes
Old 06-16-2006   #1 (permalink)
Rob Latour
Guest


 

security problem when writing to windows application log

The following (vb.net code) works great on 2000 and XP but not on Vista:


Dim ev As New EventLog("Application", System.Environment.MachineName,
"MyProgramName")

Dim LogText As String = "Hello world"

Dim EntryType As System.Diagnostics.EventLogEntryType =
EventLogEntryType.Information

ev.WriteEntry(LogText, EntryType, LogEventID)

ev.Close()



The following excpetion is thrown on Vista:



System.Security.SecurityException: The source was not found, but some or
all event logs could not be searched. Inaccessible logs: Security.
at System.Diagnostics.EventLog.FindSourceRegistration(String source,
String machineName, Boolean readOnly)
at System.Diagnostics.EventLog.SourceExists(String source, String
machineName)
at System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName,
String currentMachineName)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID)



Any ideas on what extra is needed for Vista?

Thanks in advance, Rob



My System SpecsSystem Spec
Old 06-20-2006   #2 (permalink)
Yuriy Shkolnikov [MSFT]
Guest


 

Re: security problem when writing to windows application log

Did you try running this elevated (as elevated admininstrator) ?

--
Regards,
Yuriy

This posting is provided "AS IS" with no warranties, and confers no rights.
"Rob Latour" <roblatour@rogers.com> wrote in message
news:%23UeHjqSkGHA.896@TK2MSFTNGP04.phx.gbl...
> The following (vb.net code) works great on 2000 and XP but not on Vista:
>
>
> Dim ev As New EventLog("Application", System.Environment.MachineName,
> "MyProgramName")
>
> Dim LogText As String = "Hello world"
>
> Dim EntryType As System.Diagnostics.EventLogEntryType =
> EventLogEntryType.Information
>
> ev.WriteEntry(LogText, EntryType, LogEventID)
>
> ev.Close()
>
>
>
> The following excpetion is thrown on Vista:
>
>
>
> System.Security.SecurityException: The source was not found, but some or
> all event logs could not be searched. Inaccessible logs: Security.
> at System.Diagnostics.EventLog.FindSourceRegistration(String source,
> String machineName, Boolean readOnly)
> at System.Diagnostics.EventLog.SourceExists(String source, String
> machineName)
> at System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName,
> String currentMachineName)
> at System.Diagnostics.EventLog.WriteEntry(String message,
> EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
> at System.Diagnostics.EventLog.WriteEntry(String message,
> EventLogEntryType type, Int32 eventID)
>
>
>
> Any ideas on what extra is needed for Vista?
>
> Thanks in advance, Rob
>
>



My System SpecsSystem Spec
Old 07-09-2006   #3 (permalink)
Rob Latour
Guest


 

Re: security problem when writing to windows application log

Turns out I had to add an 'event log source'; this was not required in 2000
or xp but appears to be required in vista.

thanks, Rob

"Yuriy Shkolnikov [MSFT]" <yuriys@online.microsoft.com> wrote in message
news:%23%23lS4LDlGHA.1320@TK2MSFTNGP04.phx.gbl...
> Did you try running this elevated (as elevated admininstrator) ?
>
> --
> Regards,
> Yuriy
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> "Rob Latour" <roblatour@rogers.com> wrote in message
> news:%23UeHjqSkGHA.896@TK2MSFTNGP04.phx.gbl...
>> The following (vb.net code) works great on 2000 and XP but not on Vista:
>>
>>
>> Dim ev As New EventLog("Application", System.Environment.MachineName,
>> "MyProgramName")
>>
>> Dim LogText As String = "Hello world"
>>
>> Dim EntryType As System.Diagnostics.EventLogEntryType =
>> EventLogEntryType.Information
>>
>> ev.WriteEntry(LogText, EntryType, LogEventID)
>>
>> ev.Close()
>>
>>
>>
>> The following excpetion is thrown on Vista:
>>
>>
>>
>> System.Security.SecurityException: The source was not found, but some
>> or
>> all event logs could not be searched. Inaccessible logs: Security.
>> at System.Diagnostics.EventLog.FindSourceRegistration(String source,
>> String machineName, Boolean readOnly)
>> at System.Diagnostics.EventLog.SourceExists(String source, String
>> machineName)
>> at System.Diagnostics.EventLog.VerifyAndCreateSource(String
>> sourceName,
>> String currentMachineName)
>> at System.Diagnostics.EventLog.WriteEntry(String message,
>> EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
>> at System.Diagnostics.EventLog.WriteEntry(String message,
>> EventLogEntryType type, Int32 eventID)
>>
>>
>>
>> Any ideas on what extra is needed for Vista?
>>
>> Thanks in advance, Rob
>>
>>

>
>



My System SpecsSystem Spec
Reply
Update your Vista Drivers

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Writing file to CD cjamps .NET General 1 08-18-2008 11:26 PM
writing problem timmjann Vista security 2 10-29-2007 08:54 PM
Problem writing ID3 tags Extracampine Vista General 8 02-24-2007 11:31 AM
Problem writing ID3 tags Extracampine Vista file management 8 02-24-2007 11:31 AM
removing associated Norton files form windows security as it still appears in security centre after removing from registry, application common folders etc Billy Vista security 1 02-04-2007 12:28 PM


Complimentary Industry Resources

Vista Forums has joined forces with TradePub.com to offer you a new, exciting, and entirely free professional resource. Visit http://vistax64.tradepub.com today to browse our selection of complimentary Industry magazines, white papers, webinars, podcasts, and more across 34 industry sectors. No credit cards, coupons, or promo codes required. Try it today!




Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

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