protected void registerInterface(RegistryKey classes, ComInterfaceInfo reg) { using (classes) { using (RegistryKey infKey = classes.CreateSubKey(INTERFACE)) { registerInterfaceGuid(infKey, reg); } } }
protected void unregisterInterface(RegistryKey classes, ComInterfaceInfo reg) { using (classes) { using (RegistryKey interfaceKey = classes.OpenSubKeyDeletion(INTERFACE)) { if (interfaceKey != null) //NOTE: to be safe if can happen clean machine without any user specific installation { interfaceKey.DeleteSubKeyTree(reg.Guid, false); } } } }
public static ComInterfaceInfo CreateInterface(Type t) { raiseErrorOnBadInterfaceType(t); var attrs = CustomAttributeData.GetCustomAttributes(t);// t.GetCustomAttributes() is not usable against reflection only assemblies, so getting data if (!IsComVisible(attrs)) throw new ArgumentException("The CLR type must be COM visible.", "t"); var reg = new ComInterfaceInfo(); reg.TypeLib = new TypeLib(t.Assembly); reg.Guid = t.GUID.ToString("B").ToUpper(); return reg; }
private void registerInterfaceGuid(RegistryKey infKey, ComInterfaceInfo reg) { using (RegistryKey guidKey = infKey.CreateSubKey(reg.Guid)) { //some PSDispatch oleaut32 value needed using (RegistryKey ps32 = guidKey.CreateSubKey(ProxyStubClsid32Key)) { ps32.SetValue("", "{00020420-0000-0000-C000-000000000046}"); } using (RegistryKey typeLibKey = guidKey.CreateSubKey(TYPE_LIB)) { typeLibKey.SetValue("", reg.TypeLib.Guid.ToString("B")); //with curly braces typeLibKey.SetValue("Version", reg.TypeLib.Version); } } }
public static ComInterfaceInfo CreateInterface(Type t) { raiseErrorOnBadInterfaceType(t); var attrs = CustomAttributeData.GetCustomAttributes(t);// t.GetCustomAttributes() is not usable against reflection only assemblies, so getting data if (!IsComVisible(attrs)) { throw new ArgumentException("The CLR type must be COM visible.", "t"); } var reg = new ComInterfaceInfo(); reg.TypeLib = new TypeLib(t.Assembly); reg.Guid = t.GUID.ToString("B").ToUpper(); return(reg); }
private void registerInterfaceGuid(RegistryKey infKey,ComInterfaceInfo reg) { using (RegistryKey guidKey = infKey.CreateSubKey(reg.Guid)) { //some PSDispatch oleaut32 value needed using (RegistryKey ps32 = guidKey.CreateSubKey(ProxyStubClsid32Key)) { ps32.SetValue("", "{00020420-0000-0000-C000-000000000046}"); } using (RegistryKey typeLibKey = guidKey.CreateSubKey(TYPE_LIB)) { typeLibKey.SetValue("", reg.TypeLib.Guid.ToString("B"));//with curly braces typeLibKey.SetValue("Version", reg.TypeLib.Version); } } }
protected void unregisterInterface(RegistryKey classes, ComInterfaceInfo reg) { using (classes) { using (RegistryKey interfaceKey = classes.OpenSubKeyDeletion(INTERFACE)) { if (interfaceKey != null) //NOTE: to be safe if can happen clean machine without any user specific installation interfaceKey.DeleteSubKeyTree(reg.Guid, false); } } }
protected void registerInterface(RegistryKey classes, ComInterfaceInfo reg) { using (classes) { using (RegistryKey infKey = classes.CreateSubKey(INTERFACE)) { registerInterfaceGuid(infKey,reg); } } }