3.1.4.19 R_DhcpGetClientInfo (Opnum 18)

The R_DhcpGetClientInfo method retrieves DHCPv4 client lease record information from the DHCPv4 server database. The caller of this function can free the memory pointed to by the ClientInfo parameter by calling the function midl_user_free (section 3).

 DWORD R_DhcpGetClientInfo(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in, ref] LPDHCP_SEARCH_INFO SearchInfo,
   [out] LPDHCP_CLIENT_INFO* ClientInfo
 );

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

SearchInfo: This is a pointer of type DHCP_SEARCH_INFO (section 2.2.1.2.18) structure that defines the key to be used to search the DHCPv4 client lease record on the DHCPv4 server. In case the SearchType member is DhcpClientName and there are multiple lease records with the same ClientName, the server will return client information for the client having the lowest numerical IP address.

ClientInfo: This is a pointer of type LPDHCP_CLIENT_INFO that points to the location in which specific DHCPv4 client lease record information is retrieved. The ClientHardwareAddress member represents a DHCPv4 client unique ID (section 2.2.1.2.5.2)

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.

0x00004E2D

ERROR_DHCP_JET_ERROR

An error occurred while accessing the DHCP server database, or the client entry is not present in the database.

The opnum field value for this method is 18.

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

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

  • Iterate through the DHCPv4ClientsList ADM element of all the DHCPv4Scope ADM element entries in the server ADM element DHCPv4ScopesList, and retrieve the first DHCPv4Client ADM element entry corresponding to the ClientIpAddress member, ClientHardwareAddress member, or ClientName member as specified by the SearchType member in the SearchInfo parameter (section 2.2.1.2.18). If the DHCPv4Client ADM element entry is not found, return ERROR_DHCP_JET_ERROR.

  • Allocate memory for the out parameter ClientInfo (section 2.2.1.2.12), copy the information in the DHCPv4Client ADM element entry in ClientInfo, and return ERROR_SUCCESS (0x00000000). The HostName member in DHCP_HOST_INFO (section 2.2.1.2.7) is unused.

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