Inheritance: System.Runtime.InteropServices.SafeBuffer
Exemplo n.º 1
1
 internal static extern uint LsaLookupSids(
     SafeLsaPolicyHandle handle,
     int count,
     IntPtr[] sids,
     ref SafeLsaMemoryHandle referencedDomains,
     ref SafeLsaMemoryHandle names
     );
Exemplo n.º 2
0
 internal static extern uint LsaLookupNames2(
     SafeLsaPolicyHandle handle,
     int flags,
     int count,
     UNICODE_STRING[] names,
     ref SafeLsaMemoryHandle referencedDomains,
     ref SafeLsaMemoryHandle sids
     );
Exemplo n.º 3
0
        [System.Security.SecurityCritical]  // auto-generated
        internal static void InitializeReferencedDomainsPointer(SafeLsaMemoryHandle referencedDomains) 
        {
            Contract.Assert(referencedDomains != null, "referencedDomains != null"); 
 
            // We don't know the real size of the referenced domains yet, so we need to set an initial
            // size based on the LSA_REFERENCED_DOMAIN_LIST structure, then resize it to include all of 
            // the domains.
            referencedDomains.Initialize((uint)Marshal.SizeOf(typeof(Win32Native.LSA_REFERENCED_DOMAIN_LIST)));
            Win32Native.LSA_REFERENCED_DOMAIN_LIST domainList = referencedDomains.Read<Win32Native.LSA_REFERENCED_DOMAIN_LIST>(0);
 
            unsafe
            { 
                byte* pRdl = null; 
                RuntimeHelpers.PrepareConstrainedRegions();
                try 
                {
                    referencedDomains.AcquirePointer(ref pRdl);

                    // If there is a trust information list, then the buffer size is the end of that list minus 
                    // the beginning of the domain list. Otherwise, then the buffer is just the size of the
                    // referenced domain list structure, which is what we defaulted to. 
                    if (!domainList.Domains.IsNull()) 
                    {
                        Win32Native.LSA_TRUST_INFORMATION* pTrustInformation = (Win32Native.LSA_TRUST_INFORMATION*)domainList.Domains; 
                        pTrustInformation = pTrustInformation + domainList.Entries;

                        long bufferSize = (byte*)pTrustInformation - pRdl;
                        Contract.Assert(bufferSize > 0, "bufferSize > 0"); 
                        referencedDomains.Initialize((ulong)bufferSize);
                    } 
                } 
                finally
                { 
                    if (pRdl != null)
                        referencedDomains.ReleasePointer();
                }
            } 
        }
 internal static unsafe void InitializeReferencedDomainsPointer(SafeLsaMemoryHandle referencedDomains)
 {
     referencedDomains.Initialize((ulong) Marshal.SizeOf(typeof(Win32Native.LSA_REFERENCED_DOMAIN_LIST)));
     Win32Native.LSA_REFERENCED_DOMAIN_LIST lsa_referenced_domain_list = referencedDomains.Read<Win32Native.LSA_REFERENCED_DOMAIN_LIST>(0L);
     byte* pointer = null;
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
         referencedDomains.AcquirePointer(ref pointer);
         if (!lsa_referenced_domain_list.Domains.IsNull())
         {
             Win32Native.LSA_TRUST_INFORMATION* domains = (Win32Native.LSA_TRUST_INFORMATION*) lsa_referenced_domain_list.Domains;
             domains += lsa_referenced_domain_list.Entries;
             long num = (long) ((domains - pointer) / 1);
             referencedDomains.Initialize((ulong) num);
         }
     }
     finally
     {
         if (pointer != null)
         {
             referencedDomains.ReleasePointer();
         }
     }
 }
Exemplo n.º 5
0
 internal static uint LsaLookupNames(SafeLsaPolicyHandle handle, int count, Win32Native.UNICODE_STRING[] names, ref SafeLsaMemoryHandle referencedDomains, ref SafeLsaMemoryHandle sids);