title: missing keys in HKEY_Classes_root when running as a service
body: <p>I am developing a c# .net 3.5 windows service on Windows 8 x64.</p>
  
  <p>I need to see if a specific package id is under the node HKEY_CLASSES_ROOT\ActivatableClasses\Package.</p>
  
  <p>This is the code</p>
  
  <pre><code>internal static bool IsPackageInstalled
      {
          get
          {
              try
              {
                  var packageKey = Registry.ClassesRoot.OpenSubKey(@"ActivatableClasses\Package");
                  if (packageKey != null)
                  {
                      return packageKey.GetSubKeyNames().Any(key =&gt; key.StartsWith(MyPackageName, StringComparison.InvariantCultureIgnoreCase));
                  }                                                                
              }
              catch (Exception ex)
              {
  
  
              }
  
              return false;
          }
      }
  </code></pre>
  
  <p>When running this code in a console application it works ok and returns true.</p>
  
  <p>But when running the code within a Windows service, I am getting false. I tried to debug it and I saw that in a service the list of subkeys names contains only 2 keys, while there are actually 21 sub keys.</p>
  
  <p>what could have caused this behavior?</p>
  
  <p><strong>UPDATE:</strong>
  The problem is that the service is running under a different user, and therefore every package that appears only under HKEY_CURRENT_USER won't appear when the service queries the registry.</p>
  
  <p>Is there a way for the service to check another user registry (even if the user is not currently logged in)?</p>