private string GetSecurityDescriptor(RegistryKey key, string name, string default_sd) { byte[] sd = key.GetValue(name) as byte[]; if (sd == null) { return(default_sd); } return(COMSecurity.GetStringSDForSD(sd)); }
private void LoadFromKey(RegistryKey key) { Clsid = COMUtilities.ReadGuidFromKey(key, null, "CLSID"); ActivationType = (ActivationType)COMUtilities.ReadIntFromKey(key, null, "ActivationType"); TrustLevel = (TrustLevel)COMUtilities.ReadIntFromKey(key, null, "TrustLevel"); Threading = COMUtilities.ReadIntFromKey(key, null, "Threading"); DllPath = COMUtilities.ReadStringFromKey(key, null, "DllPath"); Server = COMUtilities.ReadStringFromKey(key, null, "Server"); Permissions = string.Empty; byte[] permissions = key.GetValue("Permissions", new byte[0]) as byte[]; Permissions = COMSecurity.GetStringSDForSD(permissions); }
private void LoadFromKey(RegistryKey key) { IdentityType = (IdentityType)COMUtilities.ReadInt(key, null, "IdentityType"); ServerType = (ServerType)COMUtilities.ReadInt(key, null, "ServerType"); InstancingType = (InstancingType)COMUtilities.ReadInt(key, null, "InstancingType"); Identity = COMUtilities.ReadString(key, null, "Identity"); ServiceName = COMUtilities.ReadString(key, null, "ServiceName"); ExePath = COMUtilities.ReadString(key, null, "ExePath"); Permissions = string.Empty; byte[] permissions = key.GetValue("Permissions", new byte[0]) as byte[]; Permissions = COMSecurity.GetStringSDForSD(permissions); }
private static string ConvertSD(byte[] sd) { if (sd != null && sd.Length > 0) { try { return(COMSecurity.GetStringSDForSD(sd)); } catch (Win32Exception) { } } return(String.Empty); }
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; } }