Platform SDK: Network Management |
The DhcpRequestParams function enables callers to synchronously, or synchronously and persistently obtain DHCP data from a DHCP Server.
DWORD APIENTRY DhcpRequestParams( DWORD dwFlags, LPVOID pReserved, LPWSTR pszAdapterName, LPDHCPCAPI_CLASSID pClassId, DHCPCAPI_PARAMS_ARRAY pSendParams, DHCPCAPI_PARAMS_ARRAY pRecdParams, LPBYTE pbBuffer, LPDWORD pdwSize, LPWSTR pszRequestIdStr );
[out] Required size of the buffer, if pbBuffer is insufficiently sized to hold the data, otherwise indicates size of the successfully filled pbBuffer.
DHCP clients store data obtained from a DHCP server in their local cache. If the DHCP client cache contains all data requested in the pRecdParams array of a DhcpRequestParams function call, the client returns data from its cache. If requested data is not available in the client cache, the client processes the DhcpRequestParams function call by submitting a DHCP-INFORM message to the DHCP server.
When the client submits a DHCP-INFORM message to the DHCP server, it includes any requests provided in the optional pSendParams parameter, and provides the Class ID specified in the pClassId parameter, if provided.
Clients can also specify that DHCP data be retrieved from the DHCP server each time the DHCP client boots, which is considered a persistent request. To enable persistent requests, the caller must specify the pszRequestIdStr parameter, and also specify the additional DHCPAPI_REQUEST_PERSISTENT flag in the dwFlags parameter. This persistent request capability is especially useful when clients need to automatically request application-critical information at each boot. To disable a persist request, clients must call the DhcpUndoRequestParams function.
For more information about DHCP INFORM messages, and other standards-based information about DHCP, consult DHCP Standards.
To see the DhcpRequestParams function in use, see DHCP Examples.
Returns ERROR_SUCCESS upon successful completion.
Upon return, pRecdParams is filled with pointers to requested data, with corresponding data placed in pbBuffer. If pdwSize indicates that pbBuffer has insufficient space to store returned data, the DhcpRequestParams function returns ERROR_MORE_DATA, and returns the required buffer size in pdwSize. Note that the required size of pbBuffer may increase during the time that elapses between the initial function call's return and a subsequent call; therefore, the required size of pbBuffer (indicated in pdwSize) provides an indication of the approximate size required of pbBuffer, rather than guaranteeing that subsequent calls will return successfully if pbBuffer is set to the size indicated in pdwSize.
Other errors return appropriate Win32 error codes.
Windows NT/2000: Requires Windows 2000.
Header: Declared in Dhcpcsdk.h.
Library: Use Dhcpcsvc.lib.
DHCP Overview, DHCP Functions, DhcpCApiInitialize, DhcpUndoRequestParams