Ejemplo n.º 1
0
 /// <summary>
 ///  The SamrLookupIdsInDomain method translates a set of
 ///  RIDs into account names. Opnum: 18 
 /// </summary>
 /// <param name="DomainHandle">
 ///  An RPC context handle, as specified in section , representing
 ///  a domain object.
 /// </param>
 /// <param name="Count">
 ///  The number of elements in RelativeIds. The maximum value
 ///  of 1,000 is chosen to limit the amount of memory that
 ///  the client can force the server to allocate.
 /// </param>
 /// <param name="RelativeIds">
 ///  An array of RIDs that are to be mapped to account names.
 /// </param>
 /// <param name="Names">
 ///  A structure containing an array of account names that
 ///  correspond to the elements in RelativeIds.
 /// </param>
 /// <param name="Use">
 ///  A structure containing an array of SID_NAME_USE enumeration
 ///  values that describe the type of account for each entry
 ///  in RelativeIds.
 /// </param>
 /// <returns>
 /// status of the function call, for example: 0 indicates STATUS_SUCCESS
 /// </returns>
 public int SamrLookupIdsInDomain(System.IntPtr DomainHandle,
     uint Count,
     //[Length("Count")] [Size("1000")]
     uint[] RelativeIds,
     out _SAMPR_RETURNED_USTRING_ARRAY Names,
     out _SAMPR_ULONG_ARRAY Use)
 {
     return rpc.SamrLookupIdsInDomain(DomainHandle, Count, RelativeIds, out Names, out Use);
 }
        /// <summary>
        ///  The SamrLookupIdsInDomain method translates a set of
        ///  RIDs into account names. Opnum: 18 
        /// </summary>
        /// <param name="DomainHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  a domain object.
        /// </param>
        /// <param name="Count">
        ///  The number of elements in RelativeIds. The maximum value
        ///  of 1,000 is chosen to limit the amount of memory that
        ///  the client can force the server to allocate.
        /// </param>
        /// <param name="RelativeIds">
        ///  An array of RIDs that are to be mapped to account names.
        /// </param>
        /// <param name="Names">
        ///  A structure containing an array of account names that
        ///  correspond to the elements in RelativeIds.
        /// </param>
        /// <param name="Use">
        ///  A structure containing an array of SID_NAME_USE enumeration
        ///  values that describe the type of account for each entry
        ///  in RelativeIds.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// thrown when the RelativeIds is null.
        /// </exception>
        /// <returns>
        /// status of the function call, for example: 0 indicates STATUS_SUCCESS
        /// </returns>
        public int SamrLookupIdsInDomain(
            IntPtr DomainHandle,
            uint Count,
            uint[] RelativeIds,
            out _SAMPR_RETURNED_USTRING_ARRAY Names,
            out _SAMPR_ULONG_ARRAY Use)
        {
            const ushort opnum = 18;
            Int3264[] paramList;
            int retVal = 0;

            if (RelativeIds == null)
            {
                throw new ArgumentNullException("RelativeIds");
            }

            SafeIntPtr pRelativeIds = TypeMarshal.ToIntPtr(RelativeIds);

            paramList = new Int3264[] {
                DomainHandle,
                Count,
                Marshal.ReadIntPtr(pRelativeIds),
                IntPtr.Zero,
                IntPtr.Zero,
                IntPtr.Zero
            };

            try
            {
                using (RpceInt3264Collection outParamList = RpceCall(paramList, opnum))
                {
                    Names = TypeMarshal.ToStruct<_SAMPR_RETURNED_USTRING_ARRAY>(outParamList[3]);
                    Use = TypeMarshal.ToStruct<_SAMPR_ULONG_ARRAY>(outParamList[4]);
                    retVal = outParamList[5].ToInt32();
                }
            }
            finally
            {
                pRelativeIds.Dispose();
            }

            return retVal;
        }