Exemple #1
0
        public override void Rollback(IDictionary savedState)
        {
            // make sure the connection string isn't in the LSA
            LSAUtil lsa = new LSAUtil();

            try
            {
                lsa.DeletePrivateKey();
                AMUser.DeleteUser();
                // continue rollback
                base.Rollback(savedState);
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.EventLog.WriteEntry("AMInstall", ex.ToString(), System.Diagnostics.EventLogEntryType.Error);
            }

            try
            {
                // Remove the message queue, if it exists
                if (System.Messaging.MessageQueue.Exists(ACTION_QUEUE_PATH))
                {
                    System.Messaging.MessageQueue.Delete(ACTION_QUEUE_PATH);
                }
            }
            catch (Exception)
            {
                // Eat the exception.  We should not fail if we cannot remove the queue.
            }
        }
Exemple #2
0
        public static unsafe bool DeleteUser()
        {
            string serverName = null;             // local machine.
            string userName   = AM_USER_NAME;
            int    returnCode = Win32.NetUserDel(serverName, userName);

            LSAUtil lsaUtil = new LSAUtil(LSA_PASSWORD_KEY);

            lsaUtil.DeletePrivateKey();

            return(returnCode == Win32.NERR_Success);
        }
Exemple #3
0
        public override void Uninstall(IDictionary savedState)
        {
            System.Diagnostics.EventLog.WriteEntry("AMInstall", "Begin Uninstall");

            LSAUtil lsa = new LSAUtil();

            try
            {
                // remove the connection string stored in the LSA
                lsa.DeletePrivateKey();

                // remove the SSL Flag from the IIS Vdir if it was set
                if (Convert.ToBoolean(savedState[SSLEnabled]))
                {
                    Process          p;
                    string           filePath = savedState[installPath].ToString() + "Assignment Manager\\Setup";
                    ProcessStartInfo si       = new System.Diagnostics.ProcessStartInfo("\"" + filePath + "\\RemoveSSLFlag.vbs\"", "\"" + savedState[webName].ToString() + "\"");
                    si.WindowStyle = ProcessWindowStyle.Hidden;
                    try
                    {
                        p = Process.Start(si);
                        p.WaitForExit();
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.EventLog.WriteEntry("AMInstall", "Process Exception", System.Diagnostics.EventLogEntryType.Information);
                        throw new InstallException(e.Message);
                    }
                }
                AMUser.DeleteUser();                                                    //Also deletes the password stored in LSA

                try
                {
                    // if the Queue exists, then remove it.
                    if (System.Messaging.MessageQueue.Exists(ACTION_QUEUE_PATH))
                    {
                        System.Messaging.MessageQueue.Delete(ACTION_QUEUE_PATH);
                    }
                }
                catch (Exception)
                {
                    // Eat the exception.  We should not fail if we cannot remove the queue.
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.EventLog.WriteEntry("AMInstall", ex.ToString(), System.Diagnostics.EventLogEntryType.Error);
            }

            // continue uninstall
            base.Uninstall(savedState);
        }
Exemple #4
0
        public static unsafe bool CreateUser()
        {
            int    returnCode = 0, errorCode = 0;
            string serverName = null;             // local machine.

            Win32.USER_INFO_1 amUser = new Win32.USER_INFO_1();
            CreateUserLevel1(ref amUser);
            LSAUtil lsaUtil = new LSAUtil(LSA_PASSWORD_KEY);

            lsaUtil.StoreEncryptedString(amUser.usri1_password);
            returnCode = Win32.NetUserAdd(serverName, 1, ref amUser, errorCode);
            return(returnCode == Win32.NERR_Success);
        }
Exemple #5
0
        private bool storeConnectString(string[] installArgs)
        {
            string  connectString = buildConnectString(installArgs, false, true);
            LSAUtil lsa           = new LSAUtil();

            try
            {
                lsa.StoreEncryptedString(connectString);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }

            return(true);
        }