Inheritance: IRegistrationServices
コード例 #1
0
 /// <summary>
 /// When overridden in a derived class, performs the installation.
 /// </summary>
 /// <param name="stateSaver">An <see cref="T:System.Collections.IDictionary"/> used to save information needed to perform a commit, rollback, or uninstall operation.</param>
 public override void Install(IDictionary stateSaver)
 {
     base.Install(stateSaver);
     RegistrationServices regServices = new RegistrationServices();
     if (!regServices.RegisterAssembly(GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase))
         throw new InstallException("Error during registration of " + GetType().Assembly.FullName);
 }
コード例 #2
0
ファイル: WMIKatz.cs プロジェクト: subTee/Troopers2016
        public override void Install(IDictionary stateSaver)
        {

            new System.EnterpriseServices.Internal.Publish().GacInstall("WMIKatz.dll");
            base.Install(stateSaver);
            System.Runtime.InteropServices.RegistrationServices RS = new System.Runtime.InteropServices.RegistrationServices();
        }
コード例 #3
0
		public static void UnregisterSelf()
		{
			RegistrationServices aRS = new RegistrationServices();
			Assembly thisAssembly = Assembly.GetExecutingAssembly();
			if (thisAssembly != null)
				aRS.UnregisterAssembly(thisAssembly);
		}
コード例 #4
0
        static void Main(string[] args)
        {
            Debug.WriteLine("M:{0}/U:{1} - Main()", Thread.CurrentThread.ManagedThreadId, PInvoke.GetCurrentThreadId());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //if (args.Length > 0)
            //    MessageBox.Show(args[0]);

            if (args.Length == 1 && args[0] == "-Embedding")
            {
                MessageBox.Show(args[0]);
                return;
            }

            RegistrationServices rs = new RegistrationServices();
            int cookie = rs.RegisterTypeForComClients(typeof(Class1), RegistrationClassContext.LocalServer, RegistrationConnectionType.MultipleUse);

            try
            {
                Application.Run(new Form1());
            }
            catch
            {
            }

            rs.UnregisterTypeForComClients(cookie);
        }
コード例 #5
0
        public static void Install()
        {
            Assembly objAssembly = Assembly.GetExecutingAssembly();
            RegistrationServices objRegServices = new RegistrationServices();

            try
            {
                objRegServices.RegisterAssembly(objAssembly, AssemblyRegistrationFlags.SetCodeBase);

                RegistryKey objRK = Registry.CurrentUser.OpenSubKey(PATH_EXPLORER, true);
                objRK.SetValue("DesktopProcess", 1);
                objRK.Close();

                objRK = Registry.LocalMachine.OpenSubKey(PATH_APPROVED, true);
                objRK.SetValue(BuildHandler.CLSID, "RBuild");
                objRK.Close();

                objRK = Registry.ClassesRoot.CreateSubKey(PATH_RBUILD);
                objRK.SetValue(string.Empty, BuildHandler.CLSID);
                objRK.Close();
            }//try
            catch (Exception Ex)
            {
                Console.WriteLine(Ex.Message);
            }//catch
        }
コード例 #6
0
        /// <summary>
        /// Deinstallation
        /// </summary>
        /// <param name="savedState"></param>
        public override void Uninstall(System.Collections.IDictionary savedState)
        {
            base.Uninstall(savedState);

            Assembly asm = Assembly.GetExecutingAssembly();

            string fullName = asm.GetModules()[0].FullyQualifiedName;
            string dataFolder = Toolbar.AppFolder;

            //try
            //{
            //    Directory.Delete(dataFolder, true);
            //}
            //catch (Exception)
            //{
            //    throw new InstallException("Failed to delete folder");
            //}

            //try
            //{
            //    Registry.LocalMachine.DeleteSubKeyTree(IEToolbarEngine.AppKey);
            //    Registry.CurrentUser.DeleteSubKeyTree(IEToolbarEngine.AppKey);
            //}
            //catch (Exception)
            //{
            //}

            RegistrationServices regsrv = new RegistrationServices();

            if (!regsrv.UnregisterAssembly(this.GetType().Assembly))
            {
                throw new InstallException("Failed To Unregister for COM");
            }
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: tmbx/Ted
        static void Main(string[] args)
        {
            bool unregisterMode = false;
            bool debugMode = false;
            List<string> dllList = new List<string>();

            if (args.Length == 0)
            {
                Console.Error.WriteLine("Ted has nothing to do. Press any key.");
                Console.ReadLine();
                Environment.Exit(1);
            }

            // Make sure all file exists.
            foreach (string dll in args)
            {
                // This is the unregister mode switch.
                if (dll.Equals("-u"))
                {
                    unregisterMode = true;
                    continue;
                }
                // This is the debug mode switch.
                if (dll.Equals("-d"))
                {
                    debugMode = true;
                    continue;
                }

                // Make sure each file we are going to register exists.
                if (File.Exists(dll)) dllList.Add(dll);
                else
                {
                    Console.Error.WriteLine("Error: File " + dll + " does not exists. Press any key.");
                    Console.ReadLine();
                    Environment.Exit(1);
                }
            }

            // Iterate over all DLLs and register each of them.
            foreach (string dll in dllList)
            {
                try
                {
                    string dllFullPath = Path.GetFullPath(dll);
                    Assembly assemblyDll = Assembly.LoadFile(dllFullPath);
                    RegistrationServices regSrv = new RegistrationServices();

                    if (!unregisterMode)
                        regSrv.RegisterAssembly(assemblyDll, AssemblyRegistrationFlags.SetCodeBase);
                    else
                        regSrv.UnregisterAssembly(assemblyDll);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Error registering " + dll + ".");
                    if (debugMode) Console.Error.WriteLine(ex);
                }
            }
        }
コード例 #8
0
ファイル: Installer1.cs プロジェクト: Geoneer/pdok-extensie
 public override void Install(System.Collections.IDictionary stateSaver)
 {
     base.Install(stateSaver);
     RegistrationServices regSrv = new RegistrationServices();
     regSrv.RegisterAssembly(base.GetType().Assembly,
         AssemblyRegistrationFlags.SetCodeBase);
 }
コード例 #9
0
        public override void Uninstall(IDictionary savedState)
        {
            base.Uninstall(savedState);

            Assembly asm = Assembly.GetExecutingAssembly();
            RegistrationServices reg = new RegistrationServices();
            reg.UnregisterAssembly(asm);
        }
コード例 #10
0
 public override void Uninstall(System.Collections.IDictionary savedState)
 {
     base.Uninstall(savedState);
     RegistrationServices regsrv = new RegistrationServices();
     if (!regsrv.UnregisterAssembly(this.GetType().Assembly))
     {
         throw new InstallException("libron�c�[���o�[�̓o�^����Ɏ��s���܂���");
     }
 }
コード例 #11
0
		public static void RegisterServer( Assembly assemblyToRegister )
		{
			if ( ComRegister != null )
			{
				RegistrationServices reg = new RegistrationServices();
				reg.RegisterAssembly( assemblyToRegister, AssemblyRegistrationFlags.SetCodeBase );
				ComRegister();
			}
		}
コード例 #12
0
        public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);

            // Call RegistrationServices.RegisterAssembly to register the classes in 
            // the current managed assembly to enable creation from COM.
            var regService = new RegistrationServices();
            regService.RegisterAssembly(GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase);
        }
コード例 #13
0
		public static void UnregisterServer( Assembly assemblyToRegister )
		{
			if ( ComUnregister != null )
			{
				RegistrationServices reg = new RegistrationServices();
				reg.UnregisterAssembly( assemblyToRegister );
				ComUnregister();
			}
		}
コード例 #14
0
ファイル: NotaFiscal.cs プロジェクト: reyx/Rcky.Nfe
 /// <summary>
 /// 
 /// </summary>
 /// <param name="stateSaver"></param>
 public override void Install(System.Collections.IDictionary stateSaver)
 {
     base.Install(stateSaver);
     RegistrationServices regsrv = new RegistrationServices();
     if (!regsrv.RegisterAssembly(this.GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase))
     {
         throw new InstallException("Failed To Register for COM Interop");
     }
 }
コード例 #15
0
        public static void Initialize()
        {
            regService = new RegistrationServices();

            cookie = regService.RegisterTypeForComClients(
                typeof(NotificationActivator),
                RegistrationClassContext.LocalServer,
                RegistrationConnectionType.MultipleUse);
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: hivie7510/csharptest-net
		public static void Register()
		{
			try
			{
				RegistrationServices svc = new RegistrationServices();
				svc.RegisterAssembly(typeof (Program).Assembly, AssemblyRegistrationFlags.SetCodeBase);
			}
			catch (Exception e) { throw new ApplicationException(e.Message, e); }
		}
コード例 #17
0
ファイル: ProjectInstaller.cs プロジェクト: mtcatto/openop
        public override void Uninstall(IDictionary savedState)
        {
            base.Uninstall(savedState);

            // Call RegistrationServices.UnregisterAssembly to unregister the classes 
            // in the current managed assembly.
            RegistrationServices regService = new RegistrationServices();
            regService.UnregisterAssembly(this.GetType().Assembly);
        }
コード例 #18
0
ファイル: Registrar.cs プロジェクト: neemask/meta-core
        public void DLLRegisterServer(int regMode)
        {
            //register dll 
            //same as:
            //post build event: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe $(TargetPath) /codebase

            RegistrationServices regAsm = new RegistrationServices();
            bool bResult = regAsm.RegisterAssembly(ComponentConfig.typeToRegister.Assembly, AssemblyRegistrationFlags.SetCodeBase);
        }
コード例 #19
0
ファイル: Installer.cs プロジェクト: gtk2k/Libron-IE-Toolbar
 public override void Uninstall(System.Collections.IDictionary savedState)
 {
     base.Uninstall(savedState);
     RegistrationServices regsrv = new RegistrationServices();
     if (!regsrv.UnregisterAssembly(this.GetType().Assembly))
     {
         throw new InstallException("libronツールバーの登録解除に失敗しました");
     }
 }
コード例 #20
0
ファイル: BHOInstaller.cs プロジェクト: htsign/cs-drag4ie9
 /// <summary>
 /// This is called when installer's custom action executes and
 /// registers the toolbar which is extending a bandobject, as COM server.
 /// </summary>
 /// <param name="stateSaver"></param>     
 public override void Uninstall(System.Collections.IDictionary savedState)
 {
     base.Uninstall(savedState);
     RegistrationServices regsrv = new RegistrationServices();
     if (!regsrv.UnregisterAssembly(this.GetType().Assembly))
     {
         throw new InstallException("Failed To Unregister for COM");
     }
 }
コード例 #21
0
 public override void Install(System.Collections.IDictionary stateSaver)
 {
     System.Windows.Forms.MessageBox.Show("��ʼִ�а�װ���Զ������...");
     base.Install(stateSaver);
     RegistrationServices regsrv = new RegistrationServices();
     if (!regsrv.RegisterAssembly(this.GetType().Assembly,AssemblyRegistrationFlags.SetCodeBase))
     {
         throw new InstallException("Failed To Register for COM");
     }
 }
コード例 #22
0
ファイル: Installer.cs プロジェクト: gtk2k/Libron-IE-Toolbar
 public override void Install(System.Collections.IDictionary stateSaver)
 {
     base.Install(stateSaver);
     RegistrationServices regsrv = new RegistrationServices();
     if (!regsrv.RegisterAssembly(this.GetType().Assembly,
     AssemblyRegistrationFlags.SetCodeBase))
     {
         throw new InstallException("Libronツールバーの登録に失敗しました");
     }
 }
コード例 #23
0
        public override void Uninstall(System.Collections.IDictionary savedState)
        {
            System.Windows.Forms.MessageBox.Show("��ʼִ��uninstall���Զ������...");

            base.Uninstall(savedState);
            RegistrationServices regsrv = new RegistrationServices();
            if (!regsrv.UnregisterAssembly(this.GetType().Assembly))
            {
                throw new InstallException("Failed To Unregister for COM");
            }
        }
コード例 #24
0
ファイル: MSInstaller.cs プロジェクト: aachyee/desktopgadgets
        public override void Install(System.Collections.IDictionary stateSaver)
        {
            base.Install(stateSaver);

            RegistrationServices regsrv = new System.Runtime.InteropServices.RegistrationServices();

            if (!regsrv.RegisterAssembly(this.GetType().Assembly, System.Runtime.InteropServices.AssemblyRegistrationFlags.SetCodeBase))
            {
                throw new System.Exception("Failed to register object");
            }
        }
コード例 #25
0
		/// <summary>
		/// Register the assembly for COM interop
		/// </summary>
		/// <param name="stateSaver">An IDictionary used to save information 
		/// needed to perform a commit, rollback, or uninstall operation.
		/// </param>
		public override void Install(IDictionary stateSaver)
		{
			base.Install (stateSaver);

			RegistrationServices regSrv = new RegistrationServices();

			System.Reflection.Assembly assembly = base.GetType().Assembly;

			AssemblyRegistrationFlags flags = AssemblyRegistrationFlags.SetCodeBase;

			regSrv.RegisterAssembly(assembly, flags);
		}
コード例 #26
0
ファイル: Barramento.cs プロジェクト: reyx/Rcky.Nfe
 /// <summary>
 /// Custom Install Action that performs custom registration steps as well as
 /// registering for COM Interop.
 /// </summary>
 /// <param name="stateSaver">Not used<see cref="Installer"/></param>
 public override void Install(System.Collections.IDictionary stateSaver)
 {
     Trace.WriteLine("Install custom action - Starting registration for COM Interop");
     base.Install(stateSaver);
     RegistrationServices regsrv = new RegistrationServices();
     if (!regsrv.RegisterAssembly(this.GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase))
     {
         Trace.WriteLine("COM registration failed");
         throw new InstallException("Failed To Register for COM Interop");
     }
     Trace.WriteLine("Completed registration for COM Interop");
 }
コード例 #27
0
 private void EnsureManagedCategoryExists()
 {
     if (RegistrationServices.ManagedCategoryExists())
     {
         return;
     }
     using (RegistryKey subKey1 = Registry.ClassesRoot.CreateSubKey("Component Categories"))
     {
         using (RegistryKey subKey2 = subKey1.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}"))
             subKey2.SetValue("0", (object)".NET Category");
     }
 }
コード例 #28
0
		public void UnRegister()
		{
			Assembly[] assemblies = m_regData.GetAssemblies();
			RegistrationServices regServ = new RegistrationServices();
			foreach( Assembly assembly in assemblies )
			{
				Write( "Registering .NET/COM Components: "+assembly.Location+"..." );
				bool success = regServ.UnregisterAssembly(assembly);
				WriteLine( success ? "Done." : "COM unregistration failed." );
			}
			Write("Disconnecting registered components from Microsoft Office...");
		}
コード例 #29
0
ファイル: regsvrnet.cs プロジェクト: aachyee/desktopgadgets
        static void Main(string[] args)
        {
            //System.Console.Out.WriteLine("arguments: "+args.Length);

            try
            {
                if (args.Length == 2)
                {
                    Publish p = new Publish();
                    if (args[0] == "install")
                    {
                        System.Console.Out.WriteLine("Registering {0} into GAC", args[1]);
                        p.GacInstall(args[1]);
                    }
                    else if (args[0] == "remove")
                    {
                        System.Console.Out.WriteLine("Removing {0} from GAC", args[1]);
                        p.GacRemove(args[1]);
                    }
                    else if (args[0] == "installasm")
                    {
                        System.Console.Out.WriteLine("Registering Assembly {0}", args[1]);
                        RegistrationServices regsrv = new System.Runtime.InteropServices.RegistrationServices();
                        Assembly ass = Assembly.LoadFrom(args[1]);
                        regsrv.RegisterAssembly( ass,
                            System.Runtime.InteropServices.AssemblyRegistrationFlags.SetCodeBase);
                        //p.RegisterAssembly(args[1]);
                    }
                    else if (args[0] == "removeasm")
                    {
                        System.Console.Out.WriteLine("Removing Assembly {0}", args[1]);
                        RegistrationServices regsrv = new System.Runtime.InteropServices.RegistrationServices();
                        Assembly ass = Assembly.LoadFrom(args[1]);
                        regsrv.UnregisterAssembly( ass );
                        //p.UnRegisterAssembly(args[1]);
                    }
                    else
                    {
                        displayUsage();
                    }
                }
                else
                {
                    displayUsage();
                }
            }
            catch (Exception E) {
                String s = "Error "+E.Source+" while "+args[0]+" "+args[1]+": "+E.Message;
                s = DateTime.Now.ToString()+" "+s;
                System.Console.Out.WriteLine(s);
            }
        }
コード例 #30
0
ファイル: regsvrnet.cs プロジェクト: aachyee/desktopgadgets
        static void Main(string[] args)
        {
            //System.Console.Out.WriteLine("arguments: "+args.Length);

            try
            {
                if (args.Length == 2)
                {
                    Publish p = new Publish();
                    if (args[0] == "install")
                    {
                        System.Console.Out.WriteLine("Registering {0} into GAC", args[1]);
                        p.GacInstall(args[1]);
                    }
                    else if (args[0] == "remove")
                    {
                        System.Console.Out.WriteLine("Removing {0} from GAC", args[1]);
                        p.GacRemove(args[1]);
                    }
                    else if (args[0] == "installasm")
                    {
                        System.Console.Out.WriteLine("Registering Assembly {0}", args[1]);
                        RegistrationServices regsrv = new System.Runtime.InteropServices.RegistrationServices();
                        Assembly             ass    = Assembly.LoadFrom(args[1]);
                        regsrv.RegisterAssembly(ass,
                                                System.Runtime.InteropServices.AssemblyRegistrationFlags.SetCodeBase);
                        //p.RegisterAssembly(args[1]);
                    }
                    else if (args[0] == "removeasm")
                    {
                        System.Console.Out.WriteLine("Removing Assembly {0}", args[1]);
                        RegistrationServices regsrv = new System.Runtime.InteropServices.RegistrationServices();
                        Assembly             ass    = Assembly.LoadFrom(args[1]);
                        regsrv.UnregisterAssembly(ass);
                        //p.UnRegisterAssembly(args[1]);
                    }
                    else
                    {
                        displayUsage();
                    }
                }
                else
                {
                    displayUsage();
                }
            }
            catch (Exception E) {
                String s = "Error " + E.Source + " while " + args[0] + " " + args[1] + ": " + E.Message;
                s = DateTime.Now.ToString() + " " + s;
                System.Console.Out.WriteLine(s);
            }
        }
コード例 #31
0
ファイル: MSInstaller.cs プロジェクト: aachyee/desktopgadgets
        public override void Install(System.Collections.IDictionary stateSaver)
        {
            base.Install (stateSaver);

            RegistrationServices regsrv = new System.Runtime.InteropServices.RegistrationServices();

            if(!regsrv.RegisterAssembly(this.GetType().Assembly,System.Runtime.InteropServices.AssemblyRegistrationFlags.SetCodeBase))
            {

                throw new System.Exception("Failed to register object");

            }
        }
コード例 #32
0
 /// <summary>
 /// When overridden in a derived class, restores the pre-installation state of the computer.
 /// </summary>
 /// <param name="savedState">An <see cref="T:System.Collections.IDictionary"/> that contains the pre-installation state of the computer.</param>
 public override void Rollback(IDictionary savedState)
 {
     try
     {
         RegistrationServices regServices = new RegistrationServices();
         regServices.UnregisterAssembly(GetType().Assembly);
     }
     catch (Exception) { }
     finally
     {
         base.Rollback(savedState);
     }
 }
コード例 #33
0
        public override void Uninstall(IDictionary savedState)
        {
            base.Uninstall(savedState);

            Assembly regAssembly = base.GetType().Assembly;
            string tlbPath = Path.Combine(Path.GetDirectoryName(regAssembly.Location),
                Path.GetFileNameWithoutExtension(regAssembly.Location) + ".tlb");

            RegistrationServices regSrv = new RegistrationServices();
            regSrv.UnregisterAssembly(regAssembly);

            EsriRegasm(false);
            if (File.Exists(tlbPath)) Regasm(false, regAssembly.Location);
        }
コード例 #34
0
 public virtual int RegisterTypeForComClients(Type type, RegistrationClassContext classContext, RegistrationConnectionType flags)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     if (type as RuntimeType == null)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), "type");
     }
     if (!this.TypeRequiresRegistration(type))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_TypeMustBeComCreatable"), "type");
     }
     return(RegistrationServices.RegisterTypeForComClientsExNative(type, classContext, flags));
 }
コード例 #35
0
 public virtual void RegisterTypeForComClients(Type type, ref Guid g)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     if (type as RuntimeType == null)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), "type");
     }
     if (!this.TypeRequiresRegistration(type))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_TypeMustBeComCreatable"), "type");
     }
     RegistrationServices.RegisterTypeForComClientsNative(type, ref g);
 }
コード例 #36
0
        public override void Install(IDictionary stateSaver)
        {
            //This effectively does what gacutil does.
            //TODO: Make Path a Parameter for InstallUtil

            /*
             * To pass parameters using InstallUtil, the following is an example of passing the ServiceName:
             * InstallUtil /ServiceName="My Custom Service Name" MyCustomService.exe
             * To access this in the ProjectInstaller / ServiceInstaller, you can simply use the following code:
             * Context.Parameters["ServiceName"]
             *
             */

            new System.EnterpriseServices.Internal.Publish().GacInstall("EvilWMIProvider.dll");

            base.Install(stateSaver);
            System.Runtime.InteropServices.RegistrationServices RS = new System.Runtime.InteropServices.RegistrationServices();
        }
コード例 #37
0
 public override void Install(IDictionary stateSaver)
 {
     new System.EnterpriseServices.Internal.Publish().GacInstall("EvilWMIProvider.dll");
     base.Install(stateSaver);
     System.Runtime.InteropServices.RegistrationServices RS = new System.Runtime.InteropServices.RegistrationServices();
 }
コード例 #38
0
 public virtual bool TypeRequiresRegistration(Type type)
 {
     return(RegistrationServices.TypeRequiresRegistrationHelper(type));
 }
コード例 #39
0
 public virtual void UnregisterTypeForComClients(int cookie)
 {
     RegistrationServices.CoRevokeClassObject(cookie);
 }