예제 #1
0
 void IManagedObject.GetSerializedBuffer(ref string s)
 {
     throw new NotSupportedException(Resource.GetString("Err_IManagedObjectGetSerializedBuffer"));
 }
예제 #2
0
        internal static void UninstallUtilityApplication(Type t)
        {
            DBG.Info(DBG.Registration, "Starting utility uninstallation:");

            try
            {
                if (Platform.IsLessThan(Platform.W2K))
                {
                    return;
                }

                ICatalog           cat  = null;
                ICatalogCollection apps = null;
                ICatalogObject     app  = null;
                int appidx = 0;

                cat = (ICatalog)(new xCatalog());

                if (!Platform.IsLessThan(Platform.Whistler))
                {
                    // AS/URT 97116:  Keep this from failing the install if
                    // we're on a Beta2 Whistler machine, which has a different
                    // GUID for ICatalog2.
                    ICatalog2 cat2 = cat as ICatalog2;
                    if (cat2 != null)
                    {
                        cat2.CurrentPartition(cat2.GlobalPartitionID());
                    }
                }

                apps = (ICatalogCollection)(cat.GetCollection("Applications"));
                RegistrationDriver.Populate(apps);

                app = FindApplication(apps, _appid, ref appidx);
                if (app != null)
                {
                    // Make sure that we can change this puppy:
                    app.SetValue("Changeable", true);
                    app.SetValue("Deleteable", true);
                    apps.SaveChanges();

                    DBG.Info(DBG.Registration, "Found application!");
                    int  idx = 0, compcount = 0;
                    Guid clsid = Marshal.GenerateGuidForType(typeof(RegistrationHelperTx));
                    ICatalogCollection comps = (ICatalogCollection)(apps.GetCollection("Components", app.Key()));
                    ICatalogObject     comp  = FindComponent(comps, clsid, ref idx);
                    // Store count here, if it is 1, we can delete the app later.
                    compcount = comps.Count();
                    if (comp != null)
                    {
                        DBG.Info(DBG.Registration, "Found component at " + idx);
                        comps.Remove(idx);
                        comps.SaveChanges();
                    }

                    if (comp != null && compcount == 1)
                    {
                        DBG.Info(DBG.Registration, "Removing .NET Utilities application.");
                        // we removed the last component, kill the app
                        apps.Remove(appidx);
                        apps.SaveChanges();
                    }
                    else
                    {
                        // Make sure that we can't change the app:
                        app.SetValue("Changeable", false);
                        app.SetValue("Deleteable", false);
                        apps.SaveChanges();
                    }
                }
            }
            catch (Exception e)
            {
                // Log a failure in some acceptable manner.
                try
                {
                    EventLog appLog = new EventLog();
                    appLog.Source = "System.EnterpriseServices";
                    String errMsg = String.Format(Resource.FormatString("Reg_ErrUninstSysEnt"), e);
                    appLog.WriteEntry(errMsg, EventLogEntryType.Error);
                }
                catch
                {}

                // We threw an exception?  What do we do here?
                //DBG.Assert(false,
                //           "Installation of System.EnterpriseServices threw an exception!",
                //           "Exception: " + e);
                DBG.Info(DBG.Registration, "Caught exception: " + e);
            }
        }
예제 #3
0
 void IManagedObject.GetObjectIdentity(ref string s, ref int AppDomainID, ref int ccw)
 {
     throw new NotSupportedException(Resource.GetString("Err_IManagedObjectGetObjectIdentity"));
 }
예제 #4
0
        internal static void InstallUtilityApplication(Type t)
        {
            DBG.Info(DBG.Registration, "Starting utility installation:");

            try
            {
                if (Platform.IsLessThan(Platform.W2K))
                {
                    return;
                }

                ICatalog           cat  = null;
                ICatalogCollection apps = null;
                ICatalogObject     app  = null;
                int junk = 0;

                cat = (ICatalog)(new xCatalog());

                if (!Platform.IsLessThan(Platform.Whistler))
                {
                    // AS/URT 97116:  Keep this from failing the install if
                    // we're on a Beta2 Whistler machine, which has a different
                    // GUID for ICatalog2.
                    ICatalog2 cat2 = cat as ICatalog2;

                    if (cat2 != null)
                    {
                        cat2.CurrentPartition(cat2.GlobalPartitionID());
                    }
                }

                apps = (ICatalogCollection)(cat.GetCollection("Applications"));
                RegistrationDriver.Populate(apps);

                app = FindApplication(apps, _appid, ref junk);
                if (app == null)
                {
                    DBG.Info(DBG.Registration, "Didn't find existing application...");
                    app = (ICatalogObject)(apps.Add());
                    app.SetValue("Name", _appname);
                    app.SetValue("Activation", ActivationOption.Library);
                    app.SetValue("ID", "{" + _appid.ToString() + "}");
                    if (!Platform.IsLessThan(Platform.Whistler))
                    {
                        // AS/URT 97116:  Keep this from failing the install if
                        // we're on a Beta2 Whistler machine, which has no Replicable property.
                        try
                        {
                            app.SetValue("Replicable", 0);
                        }
                        catch (Exception) {}
                    }
                    apps.SaveChanges();
                }
                else
                {
                    // Make sure that we can change this puppy:
                    app.SetValue("Changeable", true);
                    app.SetValue("Deleteable", true);
                    apps.SaveChanges();
                    app.SetValue("Name", _appname);
                    if (!Platform.IsLessThan(Platform.Whistler))
                    {
                        // AS/URT 97116:  Keep this from failing the install if
                        // we're on a Beta2 Whistler machine, which has no Replicable property.
                        try
                        {
                            app.SetValue("Replicable", 0);
                        }
                        catch (Exception) {}
                    }
                    apps.SaveChanges();
                }

                // Import ourselves into the application:
                Guid clsid = Marshal.GenerateGuidForType(typeof(RegistrationHelperTx));
                ICatalogCollection comps = (ICatalogCollection)(apps.GetCollection("Components", app.Key()));
                ICatalogObject     comp  = FindComponent(comps, clsid, ref junk);
                if (comp == null)
                {
                    cat.ImportComponent("{" + _appid + "}", "{" + clsid + "}");
                    comps = (ICatalogCollection)(apps.GetCollection("Components", app.Key()));
                    comp  = FindComponent(comps, clsid, ref junk);
                }
                DBG.Assert(comp != null, "Couldn't find imported component!");

                ConfigureComponent(comps, comp);

                // And finally, lock this guy down:
                app.SetValue("Changeable", false);
                app.SetValue("Deleteable", false);
                apps.SaveChanges();

                DBG.Info(DBG.Registration, "Registering Proxy/Stub dlls:");
                Thunk.Proxy.RegisterProxyStub();


                // HACK
                // This is a HACK to get Windows XP Client COM+ export/import functionallity to work.
                // Export code will try to export System.EnterpriseServices.Thunk.dll because its not in it's
                // list of non-redist dlls.
                // We should get rid of this once this name is in the harcoded list in the export code.
                RegistryPermission rp = new RegistryPermission(PermissionState.Unrestricted);
                rp.Demand();
                rp.Assert();

                RegistryKey rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\MICROSOFT\\OLE\\NONREDIST");
                rk.SetValue("System.EnterpriseServices.Thunk.dll", "");
                rk.Close();
                // END HACK
            }
            catch (Exception e)
            {
                // Log a failure in some acceptable manner.
                try
                {
                    EventLog appLog = new EventLog();
                    appLog.Source = "System.EnterpriseServices";
                    String errMsg = String.Format(Resource.FormatString("Reg_ErrInstSysEnt"), e);
                    appLog.WriteEntry(errMsg, EventLogEntryType.Error);
                }
                catch
                {}

                // We threw an exception?  What do we do here?
                //DBG.Assert(false,
                //           "Installation of System.EnterpriseServices threw an exception!",
                //           "Exception: " + e);
            }
        }