/// <summary>
        ///  The SamrSetSecurityObject method sets the access control
        ///  on a server, domain, user, group, or alias object.
        ///  Opnum: 2 
        /// </summary>
        /// <param name="ObjectHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  a server, domain, user, group, or alias object.
        /// </param>
        /// <param name="SecurityInformation">
        ///  A bit field that indicates the fields of SecurityDescriptor
        ///  that are requested to be set. The SECURITY_INFORMATION
        ///  type is defined in [MS-DTYP] section. The following
        ///  bits are valid; all other bits MUST be zero on send
        ///  and ignored on receipt.
        /// </param>
        /// <param name="SecurityDescriptor">
        ///  A security descriptor expressing access that is specific
        ///  to the ObjectHandle.
        /// </param>
        /// <returns>
        /// status of the function call, for example: 0 indicates STATUS_SUCCESS
        /// </returns>
        public int SamrSetSecurityObject(
            IntPtr ObjectHandle,
            SecurityInformation_Values SecurityInformation,
            _SAMPR_SR_SECURITY_DESCRIPTOR? SecurityDescriptor)
        {
            const ushort opnum = 2;
            Int3264[] paramList;
            int retVal = 0;

            SafeIntPtr pSecurityDescriptor = TypeMarshal.ToIntPtr(SecurityDescriptor);

            paramList = new Int3264[] {
                ObjectHandle,
                (uint)SecurityInformation,
                pSecurityDescriptor,
                IntPtr.Zero
            };

            try
            {
                using (RpceInt3264Collection outParamList = RpceCall(paramList, opnum))
                {
                    retVal = outParamList[3].ToInt32();
                }
            }
            finally
            {
                pSecurityDescriptor.Dispose();
            }

            return retVal;
        }
 /// <summary>
 ///  The SamrSetSecurityObject method sets the access control
 ///  on a server, domain, user, group, or alias object.
 ///  Opnum: 2 
 /// </summary>
 /// <param name="ObjectHandle">
 ///  An RPC context handle, as specified in section , representing
 ///  a server, domain, user, group, or alias object.
 /// </param>
 /// <param name="SecurityInformation">
 ///  A bit field that indicates the fields of SecurityDescriptor
 ///  that are requested to be set. The SECURITY_INFORMATION
 ///  type is defined in [MS-DTYP] section. The following
 ///  bits are valid; all other bits MUST be zero on send
 ///  and ignored on receipt.
 /// </param>
 /// <param name="SecurityDescriptor">
 ///  A security descriptor expressing access that is specific
 ///  to the ObjectHandle.
 /// </param>
 /// <returns>
 /// status of the function call, for example: 0 indicates STATUS_SUCCESS
 /// </returns>
 public int SamrSetSecurityObject(System.IntPtr ObjectHandle,
     SecurityInformation_Values SecurityInformation,
     _SAMPR_SR_SECURITY_DESCRIPTOR? SecurityDescriptor)
 {
     return rpc.SamrSetSecurityObject(ObjectHandle,
                 SecurityInformation,
                 SecurityDescriptor);
 }
        /// <summary>
        ///  The SamrQuerySecurityObject method queries the access
        ///  control on a server, domain, user, group, or alias
        ///  object. Opnum: 3 
        /// </summary>
        /// <param name="ObjectHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  a server, domain, user, group, or alias object.
        /// </param>
        /// <param name="SecurityInformation">
        ///  A bit field that specifies which fields of SecurityDescriptor
        ///  the client is requesting to be returned. The SECURITY_INFORMATION
        ///  type is defined in [MS-DTYP] section. The following
        ///  bits are valid; all other bits MUST be zero on send
        ///  and ignored on receipt.
        /// </param>
        /// <param name="SecurityDescriptor">
        ///  A security descriptor expressing accesses that are specific
        ///  to the ObjectHandle and the owner and group of the
        ///  object. [MS-DTYP] section  contains the specification
        ///  for a valid security descriptor.
        /// </param>
        /// <returns>
        /// status of the function call, for example: 0 indicates STATUS_SUCCESS
        /// </returns>
        public int SamrQuerySecurityObject(
            IntPtr ObjectHandle,
            SamrQuerySecurityObject_SecurityInformation_Values SecurityInformation,
            out _SAMPR_SR_SECURITY_DESCRIPTOR? SecurityDescriptor)
        {
            const ushort opnum = 3;
            Int3264[] paramList;
            int retVal = 0;

            paramList = new Int3264[] {
                ObjectHandle,
                (int)SecurityInformation,
                IntPtr.Zero,
                IntPtr.Zero
            };

            using (RpceInt3264Collection outParamList = RpceCall(paramList, opnum))
            {
                IntPtr pSecurityDescriptor = Marshal.ReadIntPtr(outParamList[2]);
                SecurityDescriptor = TypeMarshal.ToNullableStruct<_SAMPR_SR_SECURITY_DESCRIPTOR>(
                    pSecurityDescriptor);
                retVal = outParamList[3].ToInt32();
            }

            return retVal;
        }