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(); }
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)); } }
private void SystemRemoveQuota() { SystemVirtualAddressSpaceQuotas.RemoveQuotas(new SecurityIdentifier(this.user.UserSID)); }