Пример #1
0
 protected void registerInterface(RegistryKey classes, ComInterfaceInfo reg)
 {
     using (classes)
     {
         using (RegistryKey infKey = classes.CreateSubKey(INTERFACE))
         {
             registerInterfaceGuid(infKey, reg);
         }
     }
 }
Пример #2
0
 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);
             }
         }
     }
 }
Пример #3
0
        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;
        }
Пример #4
0
        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);
                }
            }
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
                        }
                    }
        }
Пример #7
0
 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);
         }
     }
 }
Пример #8
0
 protected void registerInterface(RegistryKey classes, ComInterfaceInfo reg)
 {
     using (classes)
     {
         using (RegistryKey infKey = classes.CreateSubKey(INTERFACE))
         {
             registerInterfaceGuid(infKey,reg);
         }
     }
 }