/// <summary>
 /// Get a list of accessible desktop objects.
 /// </summary>
 /// <param name="desired_access">The desired access for the desktops.</param>
 /// <returns>The list of desktops.</returns>
 public IEnumerable <NtDesktop> GetAccessibleDesktops(DesktopAccessRights desired_access)
 {
     foreach (string desktop in Desktops)
     {
         using (ObjectAttributes obj_attr = new ObjectAttributes(desktop, AttributeFlags.CaseInsensitive, this))
         {
             var result = NtDesktop.Open(obj_attr, 0, desired_access, false);
             if (result.IsSuccess)
             {
                 yield return(result.Result);
             }
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Get a list of accessible desktop objects.
 /// </summary>
 /// <param name="desired_access">The desired access for the desktops.</param>
 /// <returns>The list of desktops.</returns>
 public IEnumerable <NtDesktop> GetAccessibleDesktops(DesktopAccessRights desired_access)
 {
     using (var list = new DisposableList <NtDesktop>()) {
         foreach (string desktop in Desktops)
         {
             using (ObjectAttributes obj_attr = new ObjectAttributes(desktop, AttributeFlags.CaseInsensitive, this)) {
                 var result = NtDesktop.Open(obj_attr, 0, desired_access, false);
                 if (result.IsSuccess)
                 {
                     list.Add(result.Result);
                 }
             }
         }
         return(list.ToArrayAndClear());
     }
 }
Esempio n. 3
0
 protected override sealed NtResult <NtDesktop> OpenInternal(ObjectAttributes obj_attributes,
                                                             DesktopAccessRights desired_access, bool throw_on_error)
 {
     return(NtDesktop.Open(obj_attributes, CreateDesktopFlags.None, desired_access, throw_on_error));
 }