private bool ShowDialog(IViewAware owner, DsopScopeInitInfo scope, string targetServer, out List <SecurityIdentifier> sids)
        {
            sids = null;

            var results = NativeMethods.ShowObjectPickerDialog(owner.GetHandle(), targetServer, DsopDialogInitializationOptions.DSOP_FLAG_MULTISELECT, scope, "objectClass", "objectSid");

            if (results == null)
            {
                return(false);
            }

            sids = new List <SecurityIdentifier>();

            foreach (var result in results)
            {
                byte[] sidraw = result?.Attributes["objectSid"] as byte[];

                if (sidraw != null)
                {
                    sids.Add(new SecurityIdentifier(sidraw, 0));
                }
            }

            return(true);
        }
        private bool ShowDialog(IViewAware owner, DsopScopeInitInfo scope, string targetServer, out SecurityIdentifier sid)
        {
            sid = null;

            DsopResult result = NativeMethods.ShowObjectPickerDialog(owner.GetHandle(), targetServer, DsopDialogInitializationOptions.DSOP_NONE, scope, "objectClass", "objectSid").FirstOrDefault();

            byte[] sidraw = result?.Attributes["objectSid"] as byte[];

            if (sidraw == null)
            {
                return(false);
            }

            sid = new SecurityIdentifier(sidraw, 0);

            return(true);
        }
        public bool SelectContainer(IViewAware owner, string dialogTitle, string treeViewTitle, string baseContainer, string selectedContainer, out string container)
        {
            container = NativeMethods.ShowContainerDialog(owner.GetHandle(), "Select OU", "Select computer OU", baseContainer, selectedContainer);

            return(container != null);
        }