DhcpV4GetClientInfo function (dhcpsapi.h)

The DhcpV4GetClientInfo function retrieves DHCP client lease record information from the DHCP server database.

Syntax

DWORD DHCP_API_FUNCTION DhcpV4GetClientInfo(
  [in, optional] DHCP_CONST WCHAR            *ServerIpAddress,
  [in]           DHCP_CONST DHCP_SEARCH_INFO *SearchInfo,
  [out]          LPDHCP_CLIENT_INFO_PB       *ClientInfo
);

Parameters

[in, optional] ServerIpAddress

Pointer to a null-terminated Unicode string that represents the IP address or hostname of the DHCP server.

[in] SearchInfo

Pointer to a DHCP_SEARCH_INFO structure that defines the key used to search for the client lease record on the DHCP server.

[out] ClientInfo

Pointer to a DHCP_CLIENT_INFO_PB structure that returns the DHCP client lease record information.

Return value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, it returns one of the following or an error code from DHCP Server Management API Error Codes.

Value Meaning
ERROR_INVALID_PARAMETER
Invalid or NULL SearchInfo was passed to the function.
ERROR_ACCESS_DENIED
This call was performed by a client that is not a member of the DHCP Users or DHCP Administrators security groups.
ERROR_DHCP_INVALID_DHCP_CLIENT
The DHCP client is not valid. In this case, the search information passed had no corresponding IPv4 lease records.

Remarks

If the SearchType member of the structure passed to SearchInfo is DhcpClientName and there are multiple lease records with the same client hostnames, the lease record returned is indeterminate.

ClientInfo should be free using DhcpRpcFreeMemory.

Requirements

Requirement Value
Minimum supported client None supported
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header dhcpsapi.h
Library Dhcpsapi.lib
DLL Dhcpsapi.dll

See also

DhcpV4CreateClientInfo

DhcpV4GetClientInfo

DhcpV6CreateClientInfo