예제 #1
0
        public void Destroy()
        {
            if (!this.isLocked)
            {
                throw new InvalidOperationException("This prison is not locked.");
            }

            Logger.Debug("Destroying prison {0}", this.ID);

            foreach (var cell in prisonCells)
            {
                cell.Destroy(this);
            }

            this.jobObject.TerminateProcesses(-1);

            this.jobObject.Dispose();
            this.jobObject = null;

            // TODO: Should destroy delete the home directory???
            // Directory.CreateDirectory(prisonRules.PrisonHomePath);

            this.TryStopGuard();
            this.UnloadUserProfileUntilReleased();
            this.DeleteUserProfile();
            this.user.Delete();

            SystemVirtualAddressSpaceQuotas.RemoveQuotas(new SecurityIdentifier(this.user.UserSID));

            this.DeletePersistedPrirson();
        }
예제 #2
0
        private void InitializeSystemVirtualAddressSpaceQuotas()
        {
            if (this.Rules.TotalPrivateMemoryLimitBytes > 0)
            {
                SystemVirtualAddressSpaceQuotas.SetPagedPoolQuota
                    (this.Rules.TotalPrivateMemoryLimitBytes, new SecurityIdentifier(this.user.UserSID));

                SystemVirtualAddressSpaceQuotas.SetNonPagedPoolQuota
                    (this.Rules.TotalPrivateMemoryLimitBytes, new SecurityIdentifier(this.user.UserSID));

                SystemVirtualAddressSpaceQuotas.SetPagingFileQuota
                    (this.Rules.TotalPrivateMemoryLimitBytes, new SecurityIdentifier(this.user.UserSID));

                SystemVirtualAddressSpaceQuotas.SetWorkingSetPagesQuota
                    (this.Rules.TotalPrivateMemoryLimitBytes, new SecurityIdentifier(this.user.UserSID));
            }
        }
예제 #3
0
 private void SystemRemoveQuota()
 {
     SystemVirtualAddressSpaceQuotas.RemoveQuotas(new SecurityIdentifier(this.user.UserSID));
 }