private void LoadFromKey(RegistryKey key) { RunAs = key.GetValue("RunAs") as string; string name = key.GetValue(null) as string; if (!String.IsNullOrWhiteSpace(name)) { Name = name.ToString(); } else { Name = AppId.FormatGuidDefault(); } AccessPermission = COMSecurity.GetStringSDForSD(key.GetValue("AccessPermission") as byte[]); LaunchPermission = COMSecurity.GetStringSDForSD(key.GetValue("LaunchPermission") as byte[]); DllSurrogate = key.GetValue("DllSurrogate") as string; if (DllSurrogate != null) { if (String.IsNullOrWhiteSpace(DllSurrogate)) { DllSurrogate = "dllhost.exe"; } else { string dllexe = key.GetValue("DllSurrogateExecutable") as string; if (!String.IsNullOrWhiteSpace(dllexe)) { DllSurrogate = dllexe; } } } else { DllSurrogate = String.Empty; } object flags = key.GetValue("AppIDFlags"); if (flags != null) { Flags = (COMAppIDFlags)flags; } string local_service = key.GetValue("LocalService") as string; if (!String.IsNullOrWhiteSpace(local_service)) { try { using (RegistryKey serviceKey = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\Services\" + local_service)) { using (ServiceController service = new ServiceController(local_service)) { LocalService = new COMAppIDServiceEntry(serviceKey, service); } } } catch { } } if (String.IsNullOrWhiteSpace(RunAs)) { RunAs = String.Empty; } object rotflags = key.GetValue("ROTFlags"); if (rotflags != null && rotflags is int) { RotFlags = (COMAppIDRotFlags)rotflags; } }