3.2.4.110 R_DhcpV4GetPolicy (Opnum 109)
The R_DhcpV4GetPolicy method returns the specified policy. The memory for the Policy structure is allocated by this method and can be freed by the caller by using the function midl_user_free (section 3).
-
DWORD R_DhcpV4GetPolicy( [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress, [in] BOOL ServerPolicy, [in] DHCP_IP_ADDRESS SubnetAddress, [in, unique, string] LPWSTR PolicyName, [out] LPDHCP_POLICY* Policy );
ServerIpAddress: The IP address/host name of the DHCP server. This parameter is unused.
ServerPolicy: This is of type BOOL and indicates whether the server level policy or scope level policy is being requested.
SubnetAddress: This is of type DHCP_IP_ADDRESS (section 2.2.1.2.1) and identifies the IPv4 subnet from which the policy is being requested.
PolicyName: A pointer to a null-terminated Unicode string that contains the name of the policy requested.
Policy: This out parameter is a pointer of type LPDHCP_POLICY that contains the policy data for the requested policy.
Return Values: A 32-bit unsigned integer value that indicates return status. A return value of ERROR_SUCCESS (0x00000000) indicates operation was completed successfully. Otherwise, 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.
0x00004E25
ERROR_DHCP_SUBNET_NOT_PRESENT
The specified IPv4 subnet does not exist.
The opnum field value for this method is 109.
When processing this call, the DHCP server MUST do the following:
If the ServerPolicy parameter is TRUE and SubnetAddress parameter is not NULL, return ERROR_INVALID_PARAMETER.
If the ServerPolicy parameter is FALSE and SubnetAddress parameter is NULL, return the ERROR_INVALID_PARAMETER.
If the PolicyName parameter is NULL or if the Policy parameter is NULL, return ERROR_INVALID_PARAMETER.
Validate whether this method is authorized for read access as specified in section 3.5.4. If not, return ERROR_ACCESS_DENIED.
If the ServerPolicy parameter is TRUE, retrieve the DHCPv4ServerPolicyList ADM element and get the DHCPv4Policy ADM element from the DHCPv4ServerPolicyList ADM element for the specified PolicyName parameter. Allocate memory for the Policy parameter and populate the Policy parameter data structure with the ADM elements in DHCPv4Policy ADM element and return ERROR_SUCCESS.
If the ServerPolicy parameter is FALSE, retrieve the DHCPv4ScopesList ADM element and get the DHCPv4Scope ADM element from DHCPv4ScopesList ADM element where the SubnetAddress ADM element member in DHCPv4Scope ADM element matches the specified SubnetAddress parameter. If there is no DHCPv4Scope ADM element matching the specified SubnetAddress parameter, return ERROR_DHCP_SUBNET_NOT_PRESENT. Retrieve the DHCPv4Scope.DHCPv4ScopePolicyList ADM element and get the DHCPv4Policy ADM element from the DHCPv4Scope.DHCPv4ScopePolicyList ADM element which has the name same as the specified PolicyName parameter. Populate the Policy parameter data structure with the ADM elements in DHCPv4Policy ADM element.
Return ERROR_SUCCESS.
Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying RPC protocol specified in [MS-RPCE].