public void SetBasicUiRestrictions(BasicUiRestrictions uiRestrictions) { var length = Marshal.SizeOf(typeof(BasicUiRestrictions)); var uiRestrictionsInfoPointer = Marshal.AllocHGlobal(length); Marshal.StructureToPtr(uiRestrictions, uiRestrictionsInfoPointer, false); if (!NativeMethods.SetInformationJobObject(this.handle, InfoClass.BasicUiRestrictions, uiRestrictionsInfoPointer, (uint)length)) { throw new Win32Exception(); } }
public static BasicUiRestrictions GetUiRestrictions() { var restrictions = new BasicUiRestrictions { UIRestrictionsClass = (int)(UiRestrictionFlags.JOB_OBJECT_UILIMIT_DESKTOP | UiRestrictionFlags.JOB_OBJECT_UILIMIT_DISPLAYSETTINGS | UiRestrictionFlags.JOB_OBJECT_UILIMIT_EXITWINDOWS | UiRestrictionFlags.JOB_OBJECT_UILIMIT_GLOBALATOMS | UiRestrictionFlags.JOB_OBJECT_UILIMIT_HANDLES | UiRestrictionFlags.JOB_OBJECT_UILIMIT_READCLIPBOARD | UiRestrictionFlags.JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS | UiRestrictionFlags.JOB_OBJECT_UILIMIT_WRITECLIPBOARD) }; return(restrictions); }