public LsaNamesResult LookupNames2(string name, LsaLookupNamesFlags flags = LsaLookupNamesFlags.None)
 {
     using (var lsaString = new LsaUnicodeString(name))
     {
         var names = new[] { lsaString };
         LsaReferencedDomainsHandle referencedDomainsHandle = null;
         LsaTranslatedSidHandle     translatedSidHandle     = null;
         LsaChecked(() => NativeMethods.LsaLookupNames2(this, flags, 1, names, out referencedDomainsHandle, out translatedSidHandle));
         return(new LsaNamesResult(referencedDomainsHandle, translatedSidHandle));
     }
 }
Example #2
0
        public void AddRights(LsaTranslatedSidHandle translatedSidHandle, params string[] userRights)
        {
            var rights = new LsaUnicodeString[userRights.Length];
            for (int i = 0; i < userRights.Length; i++)
            {
                rights[i] = new LsaUnicodeString(userRights[i]);
            }

            try
            {
                LsaChecked(() => NativeMethods.LsaAddAccountRights(this, translatedSidHandle.Sid, rights, (uint)rights.Length));
            }
            finally
            {
                rights.DisposeAll();
            }
        }
        public void AddRights(LsaTranslatedSidHandle translatedSidHandle, params string[] userRights)
        {
            var rights = new LsaUnicodeString[userRights.Length];

            for (int i = 0; i < userRights.Length; i++)
            {
                rights[i] = new LsaUnicodeString(userRights[i]);
            }

            try
            {
                LsaChecked(() => NativeMethods.LsaAddAccountRights(this, translatedSidHandle.Sid, rights, (uint)rights.Length));
            }
            finally
            {
                rights.DisposeAll();
            }
        }
Example #4
0
 internal static extern LsaStatus LsaLookupNames2(LsaPolicyHandle policyHandle, LsaLookupNamesFlags flags, uint count, LsaUnicodeString[] names, out LsaReferencedDomainsHandle referencedReferencedDomains, out LsaTranslatedSidHandle translatedSid);
 public LsaNamesResult(LsaReferencedDomainsHandle referencedDomainsHandle, LsaTranslatedSidHandle translatedSidHandle)
 {
     ReferencedDomainsHandle = referencedDomainsHandle;
     TranslatedSidHandle     = translatedSidHandle;
 }
Example #6
0
 public LsaNamesResult(LsaReferencedDomainsHandle referencedDomainsHandle, LsaTranslatedSidHandle translatedSidHandle)
 {
     ReferencedDomainsHandle = referencedDomainsHandle;
     TranslatedSidHandle = translatedSidHandle;
 }
 internal static extern LsaStatus LsaLookupNames2(LsaPolicyHandle policyHandle, LsaLookupNamesFlags flags, uint count, LsaUnicodeString[] names, out LsaReferencedDomainsHandle referencedReferencedDomains, out LsaTranslatedSidHandle translatedSid);