Exemple #1
0
 public WorkItem(ClrPermissions permissions,
                 AsyncCallback callback, Object state)
 {
     this.permissions  = permissions;
     this.userWorkItem = true;
     this.callback3    = callback;
     this.state        = state;
 }
Exemple #2
0
 public WorkItem(ClrPermissions permissions, WaitHandle waitObject,
                 WaitOrTimerCallback callback, Object state,
                 int millisecondsTimeOutInterval, bool executeOnlyOnce)
 {
     this.permissions  = permissions;
     this.userWorkItem = false;
     this.callback2    = callback;
     this.state        = state;
     this.timeout      = millisecondsTimeOutInterval;
     this.once         = executeOnlyOnce;
     this.registered   = true;
 }
	// Deny permissions to the caller.
	internal void Deny(int skipFrames)
			{
				// Add the permission to the denied permissions set.
				ClrPermissions current;
				current = ClrSecurity.GetPermissionsFrom(skipFrames);
				PermissionSet set = new PermissionSet(PermissionState.None);
				set.AddPermission(this.Copy());
				if(current == null)
				{
					// Initialize the permissions context to "allow
					// everything except this permission object".
					current = new ClrPermissions
						(new PermissionSet(PermissionState.Unrestricted),
						 set, null);
				}
				else
				{
					current = current.SetDenied(set.Union(current.denied));
				}
				ClrSecurity.SetPermissions(current, skipFrames);
			}
	// Set the caller's permissions to only this object.
	internal static void PermitOnly(PermissionSet set, int skipFrames)
			{
				// Make sure that we don't already have a "PermitOnly" value.
				ClrPermissions current;
				current = ClrSecurity.GetPermissionsFrom(skipFrames);
				if(current != null && current.permitOnly != null)
				{
					throw new SecurityException(_("Exception_PermitOnly"));
				}

				// Add the "PermitOnly" set to the call stack.
				if(current == null)
				{
					// Initialize the permissions context to "allow
					// only this permission object".
					current = new ClrPermissions
						(new PermissionSet(PermissionState.Unrestricted),
						 new PermissionSet(PermissionState.None),
						 set);
				}
				else
				{
					current = current.SetPermitOnly(set);
				}
				ClrSecurity.SetPermissions(current, skipFrames);
			}
		public WorkItem(ClrPermissions permissions, WaitHandle waitObject,
					    WaitOrTimerCallback callback, Object state,
						int millisecondsTimeOutInterval, bool executeOnlyOnce)
				{
					this.permissions = permissions;
					this.userWorkItem = false;
					this.callback2 = callback;
					this.state = state;
					this.timeout = millisecondsTimeOutInterval;
					this.once = executeOnlyOnce;
					this.registered = true;
				}
		public WorkItem(ClrPermissions permissions,
						AsyncCallback callback, Object state)
				{
					this.permissions = permissions;
					this.userWorkItem = true;
					this.callback3 = callback;
					this.state = state;
				}
	extern public static void SetPermissions
			(ClrPermissions perm, int skipFrames);