0

Team America / Sony Playstation 3

Posted by lorenb on May 17, 2005 in general

Picked up a copy of Team America - World Police on DVD today. Probably won’t get a chance to watch it until the weekend though.

Noticed details and pictures of the Sony PlayStation 3 are starting to appear. I wonder what the price of this and the XBox 360 are going to be? Reading the specs of both systems tells me it likely won’t be cheap.

 
0

Windows Registry / System.DirectoryServices

Posted by lorenb on May 17, 2005 in gnome, projects

Working on the OVAL tests for Windows again today. I’ve written code for the file and registry tests.

I have a problem with the file test at the moment. In the OVAL definitions each file_test has two components for the file path. The first one is reference to a registry key and the second is a relative path.

The data looks something like this:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRoot
\system32\msjet40.dll

The problem I have is that there doesn’t seem to be a way in C# to query the registry with that whole string. Instead you have to do something like this:

using Microsoft.Win32;

RegistryKey hiveKey = Registry.LocalMachine;
RegistryKey rk = hiveKey.OpenSubKey
   (@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");

if (rk == null)
{
   // key doesn't exist
}
else
{
   try
   {
      Console.WriteLine ("VALUE: {0}",
         (string)rk.GetValue("SystemRoot"));
   }
   catch (Exception e)
   {
      Console.WriteLine ("ERROR: {0}", e.Message);
   }
}

Looks like I’ll be having more fun with string parsing trying to break the OVAL registry string into something I can work with :(

Oddly enough, in OVAL registry_tests they break out data in separate fields (hive, key, name) which leads itself to the .NET API.

The other tests I need to write are for ActiveDirectory and the IIS Metabase. That means I need to start learning more about System.DirectoryServices.

Copyright © 2009 Loren Bandiera’s weblog All rights reserved. Theme by Laptop Geek.