25.12.2014 Views

Analysis and Evaluation of the Windows Event Log - Bill Buchanan

Analysis and Evaluation of the Windows Event Log - Bill Buchanan

Analysis and Evaluation of the Windows Event Log - Bill Buchanan

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CO42019 – Project 4<br />

Displaying <strong>the</strong> registry value<br />

The following code will display <strong>the</strong> current start-up settings for <strong>the</strong> event log.<br />

using System;<br />

using System.Collections.Generic;<br />

using System.Text;<br />

using Micros<strong>of</strong>t.Win32;<br />

namespace ConsoleApplication2<br />

{<br />

class Program<br />

{<br />

static void Main(string[] args)<br />

{<br />

RegistryKey key =<br />

Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Services\\<strong>Event</strong><strong>Log</strong>");<br />

if (key.GetValue("Start") != null)<br />

{<br />

// The value exists;<br />

Console.WriteLine((int)key.GetValue("Start"));<br />

}<br />

Console.ReadLine();<br />

}<br />

}<br />

}<br />

The registry value has <strong>the</strong> following 3 meanings:<br />

2 = Automatic<br />

3 = Manual<br />

4 = Disabled<br />

Project – Week 5.doc Page 6 <strong>of</strong> 9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!