3.2.4.43 R_DhcpQueryDnsRegCredentials (Opnum 42)

The R_DhcpQueryDnsRegCredentials method retrieves the currently set Domain Name System (DNS) credentials, which are the user name and domain. These credentials are used by the DHCP server for DNS dynamic registration for DHCP clients.

 DWORD R_DhcpQueryDnsRegCredentials(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in, range(0,1024)] ULONG UnameSize,
   [out, size_is(UnameSize)] wchar_t* Uname,
   [in, range(0,1024)] ULONG DomainSize,
   [out, size_is(DomainSize)] wchar_t* Domain
 );

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

UnameSize: This is of type ULONG, containing the length of the buffer pointed to by Uname. The buffer length is defined at the RPC client and passed as an argument to the RPC server.

Uname:  A pointer to a null-terminated Unicode string in which the DHCP server returns the user name for the DNS. The memory is allocated at the RPC client and passed to the RPC server.

DomainSize: This is of type ULONG, containing the length of the buffer pointed to by Domain. The buffer length is defined at the RPC client and passed as an argument to the RPC server.

Domain:  A pointer to a null-terminated Unicode string in which the DHCP server returns the domain name for the DNS. The memory is allocated at the RPC client and passed to the RPC server.

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 42.

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

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

  • Retrieve the server ADM elements DHCPServerDnsRegCredentials.Uname and DHCPServerDnsRegCredentials.Domain and set the Uname and Domain fields respectively if the buffers provided in UnameSize and DomainSize are sufficient. If any of the buffers is not sufficient, return ERROR_INSUFFICIENT_BUFFER. Set the corresponding variable, that is,  UnameSize or DomainSize to the actual buffer size required to retrieve the data.

  • Even if the DHCP server fails to retrieve the user name or domain name, return ERROR_SUCCESS.

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