3.2.4.36 R_DhcpServerQueryAttributes (Opnum 35)

The R_DhcpServerQueryAttributes method retrieves one or more attributes information from the DHCP server. The caller of this function can free the memory pointed to by pDhcpAttribArr and pDhcpAttribs by calling the function midl_user_free (section 3).

 DWORD R_DhcpServerQueryAttributes (
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] ULONG dwReserved,
   [in, range(0,6)] ULONG dwAttribCount,
   [in, size_is(dwAttribCount)] LPDHCP_ATTRIB_ID pDhcpAttribs,
   [out]    LPDHCP_ATTRIB_ARRAY *pDhcpAttribArr
 );

ServerIpAddress: The IP address/host name of the DHCP server. This parameter is unused.

dwReserved: This flag is not used and MUST be set to 0.

dwAttribCount: This is of type ULONG and contains the number of attributes queried.

pDhcpAttribs: This is a pointer to type DHCP_ATTRIB_ID (section 2.2.1.1.1) and points to an array of length dwAttribCount which contains the queried attribute.

pDhcpAttribArr: This is a pointer to type LPDHCP_ATTRIB_ARRAY that points to an array that contains attribute information for all of the valid attributes queried.

Return Values: A 32-bit unsigned integer value that indicates return status. A return value ERROR_SUCCESS (0x00000000) indicates that the operation was completed successfully, else it contains a Win32 error code, as specified in [MS-ERREF]. This error code value can correspond to a DHCP-specific failure, which takes a value between 20000 and 20099, or any generic failure.

Return value/code

Description

0x00000000

ERROR_SUCCESS

The call was successful.

The opnum field value for this method is 35.

When processing this call, the DHCP server MUST do the following:

  • Validate if this API is authorized for read access per section 3.5.4. If not, return the error ERROR_ACCESS_DENIED.

  • If dwReserved is not 0 or dwAttribCount is 0 or pDhcpAttribs is NULL or pDhcpAttribArr is NULL, return ERROR_INVALID_PARAMETER.

  • If none of the attributes queried are supported by the DHCP server, return ERROR_NOT_SUPPORTED.

  • If one or more attributes queried in pDhcpAttribs are supported by the DHCP server, then allocate the memory for the required number of DHCP_ATTRIB entries.

  • For each attribute in pDhcpAttribs supported by the DHCP server, perform one of the following actions:

    • If the pDhcpAttribs entry is DHCP_ATTRIB_BOOL_IS_ROGUE, DHCP_ATTRIB_BOOL_IS_DYNBOOTP, DHCP_ATTRIB_BOOL_IS_BINDING_AWARE or DHCP_ATTRIB_ULONG_RESTORE_STATUS, fill the pDhcpAttribArr entry with information from the corresponding field in the server ADM element DHCPv4ServerAttributes.

    • If the pDhcpAttribs entry is DHCP_ATTRIB_BOOL_IS_ADMIN, set the fields DhcpAttribId and DhcpAttribType of the pDhcpAttribArr (section 2.2.1.2.78) entry corresponding to DHCP_ATTRIB_BOOL_IS_ADMIN. If this API is authorized for read/write access as specified in section 3.5.5, set DhcpAttribBool to TRUE; otherwise, set it to FALSE.

    • If the pDhcpAttribs entry is DHCP_ATTRIB_BOOL_IS_PART_OF_DSDC, set the fields DhcpAttribId and DhcpAttribType of pDhcpAttribArr entry corresponding to DHCP_ATTRIB_BOOL_IS_PART_OF_DSDC. Check if the DHCP server belongs to a domain. If positive, set DhcpAttribBool to TRUE, otherwise set it to FALSE.

  • If all attributes queried in pDhcpAttribs are supported, return ERROR_SUCCESS; otherwise, return ERROR_NOT_SUPPORTED.

Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying RPC protocol [MS-RPCE].