* UnixRegistryApi.cs: Consider HKLM\SYSTEM\CurrentControlSet\Services\
authorGert Driesen <drieseng@users.sourceforge.net>
Fri, 11 Aug 2006 09:59:06 +0000 (09:59 -0000)
committerGert Driesen <drieseng@users.sourceforge.net>
Fri, 11 Aug 2006 09:59:06 +0000 (09:59 -0000)
EventLog a wellknown key. Required for new EventLog implementation.
Added RegistryStore property.

svn path=/trunk/mcs/; revision=63632

mcs/class/corlib/Microsoft.Win32/ChangeLog
mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs

index 2c17429e2fa4fb33930d0f053be329827a59ec4a..73840923acc79dd18d77dc2fa199ded3248be7fa 100644 (file)
@@ -1,3 +1,9 @@
+2006-08-11  Gert Driesen  <drieseng@users.sourceforge.net>
+
+       * UnixRegistryApi.cs: Consider HKLM\SYSTEM\CurrentControlSet\Services\
+       EventLog a wellknown key. Required for new EventLog implementation. 
+       Added RegistryStore property.
+
 2006-06-06  Miguel de Icaza  <miguel@novell.com>
 
        * UnixRegistryApi.cs: Do not crash if there are no values stored.
index 588d592740e782aa6725d7bfbb768f17ef456d4c..6cde8ec93e0be0118c26fd93b691caad4c63670c 100644 (file)
@@ -190,11 +190,8 @@ namespace Microsoft.Win32 {
                                case RegistryHive.LocalMachine:
                                case RegistryHive.PerformanceData:
                                case RegistryHive.Users:
-                                       string d = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), ".mono/registry");
-                                       d = Path.Combine (d, x.ToString ());
-                                       
+                                       string d = Path.Combine (RegistryStore, x.ToString ());
                                        k = new KeyHandler (rkey, d);
-                                       key_to_handler [rkey] = k;
                                        break;
                                default:
                                        throw new Exception ("Unknown RegistryHive");
@@ -264,7 +261,7 @@ namespace Microsoft.Win32 {
                {
                        if (!File.Exists (file) && values.Count == 0)
                                return;
-                       
+
                        SecurityElement se = new SecurityElement ("values");
                        
                        foreach (DictionaryEntry de in values){
@@ -304,6 +301,14 @@ namespace Microsoft.Win32 {
                                Console.Error.WriteLine ("When saving {0} got {1}", file, e);
                        }
                }
+
+               public static string RegistryStore {
+                       get {
+                               return Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal),
+                                       ".mono/registry");
+                       }
+               }
+
        }
        
        internal class UnixRegistryApi : IRegistryApi {
@@ -317,10 +322,13 @@ namespace Microsoft.Win32 {
 
                static bool IsWellKnownKey (string parentKeyName, string keyname)
                {
-                       // FIXME: Add more keys if needed
-                       if (parentKeyName == Registry.CurrentUser.Name ||
-                               parentKeyName == Registry.LocalMachine.Name)
-                               return (0 == String.Compare ("software", keyname, true, CultureInfo.InvariantCulture));
+                       if (string.Compare ("software", keyname, true, CultureInfo.InvariantCulture) == 0)
+                               return (parentKeyName == Registry.CurrentUser.Name ||
+                                       parentKeyName == Registry.LocalMachine.Name);
+
+                       // required for event log support
+                       if (string.Compare (@"SYSTEM\CurrentControlSet\Services\EventLog", keyname, true, CultureInfo.InvariantCulture) == 0)
+                               return (parentKeyName == Registry.LocalMachine.Name);
 
                        return false;
                }