/// <summary>
 ///  The SamrQueryDisplayInformation3 method obtains a listing
 ///  of accounts in name-sorted order, starting at a specified
 ///  index. Opnum: 51 
 /// </summary>
 /// <param name="DomainHandle">
 ///  An RPC context handle, as specified in section , representing
 ///  a domain object.
 /// </param>
 /// <param name="DisplayInformationClass">
 ///  An enumeration (see section) that indicates the type
 ///  of accounts, as well as the type of attributes on the
 ///  accounts, to return via the Buffer parameter.
 /// </param>
 /// <param name="Index">
 ///  A cursor into an account-namesorted list of accounts.
 /// </param>
 /// <param name="EntryCount">
 ///  The number of accounts that the client is requesting
 ///  on output.
 /// </param>
 /// <param name="PreferredMaximumLength">
 ///  The requested maximum number of bytes to return in Buffer;
 ///  this value overrides EntryCount if this value is reached
 ///  before EntryCount is reached.
 /// </param>
 /// <param name="TotalAvailable">
 ///  The number of bytes required to see a complete listing
 ///  of accounts specified by the DisplayInformationClass
 ///  parameter.
 /// </param>
 /// <param name="TotalReturned">
 ///  The number of bytes returned. This value is estimated
 ///  and is not accurate.  clients do not rely on the accuracy
 ///  of this value.
 /// </param>
 /// <param name="Buffer">
 ///  The accounts that are returned.
 /// </param>
 /// <returns>
 /// status of the function call, for example: 0 indicates STATUS_SUCCESS
 /// </returns>
 public int SamrQueryDisplayInformation3(System.IntPtr DomainHandle,
     _DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
     uint Index,
     uint EntryCount,
     uint PreferredMaximumLength,
     out System.UInt32 TotalAvailable,
     out System.UInt32 TotalReturned,
     //[Switch("DisplayInformationClass")]
     out _SAMPR_DISPLAY_INFO_BUFFER Buffer)
 {
     return rpc.SamrQueryDisplayInformation3(DomainHandle, DisplayInformationClass, Index,
         EntryCount, PreferredMaximumLength, out TotalAvailable, out TotalReturned, out Buffer);
 }
        /// <summary>
        ///  The SamrQueryDisplayInformation3 method obtains a listing
        ///  of accounts in name-sorted order, starting at a specified
        ///  index. Opnum: 51 
        /// </summary>
        /// <param name="DomainHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  a domain object.
        /// </param>
        /// <param name="DisplayInformationClass">
        ///  An enumeration (see section) that indicates the type
        ///  of accounts, as well as the type of attributes on the
        ///  accounts, to return via the Buffer parameter.
        /// </param>
        /// <param name="Index">
        ///  A cursor into an account-namesorted list of accounts.
        /// </param>
        /// <param name="EntryCount">
        ///  The number of accounts that the client is requesting
        ///  on output.
        /// </param>
        /// <param name="PreferredMaximumLength">
        ///  The requested maximum number of bytes to return in Buffer;
        ///  this value overrides EntryCount if this value is reached
        ///  before EntryCount is reached.
        /// </param>
        /// <param name="TotalAvailable">
        ///  The number of bytes required to see a complete listing
        ///  of accounts specified by the DisplayInformationClass
        ///  parameter.
        /// </param>
        /// <param name="TotalReturned">
        ///  The number of bytes returned. This value is estimated
        ///  and is not accurate.  clients do not rely on the accuracy
        ///  of this value.
        /// </param>
        /// <param name="Buffer">
        ///  The accounts that are returned.
        /// </param>
        /// <returns>
        /// status of the function call, for example: 0 indicates STATUS_SUCCESS
        /// </returns>
        public int SamrQueryDisplayInformation3(
            IntPtr DomainHandle,
            _DOMAIN_DISPLAY_INFORMATION DisplayInformationClass,
            uint Index,
            uint EntryCount,
            uint PreferredMaximumLength,
            out uint TotalAvailable,
            out uint TotalReturned,
            out _SAMPR_DISPLAY_INFO_BUFFER Buffer)
        {
            const ushort opnum = 51;
            Int3264[] paramList;
            int retVal = 0;

            paramList = new Int3264[] {
                DomainHandle,
                (int)DisplayInformationClass,
                Index,
                EntryCount,
                PreferredMaximumLength,
                IntPtr.Zero,
                IntPtr.Zero,
                IntPtr.Zero,
                IntPtr.Zero
            };

            using (RpceInt3264Collection outParamList = RpceCall(paramList, opnum))
            {
                TotalAvailable = TypeMarshal.ToStruct<uint>(outParamList[5]);
                TotalReturned = TypeMarshal.ToStruct<uint>(outParamList[6]);
                Buffer = TypeMarshal.ToStruct<_SAMPR_DISPLAY_INFO_BUFFER>(
                    outParamList[7], DisplayInformationClass, null, null);
                retVal = outParamList[8].ToInt32();
            }

            return retVal;
        }