DhcpEnumClasses function (dhcpsapi.h)

The DhcpEnumClasses function enumerates the user or vendor classes configured for the DHCP server.

Syntax

DWORD DhcpEnumClasses(
  [in]      LPWSTR                  ServerIpAddress,
  [in]      DWORD                   ReservedMustBeZero,
  [in, out] DHCP_RESUME_HANDLE      *ResumeHandle,
  [in]      DWORD                   PreferredMaximum,
  [out]     LPDHCP_CLASS_INFO_ARRAY *ClassInfoArray,
  [out]     DWORD                   *nRead,
  [out]     DWORD                   *nTotal
);

Parameters

[in] ServerIpAddress

Pointer to a Unicode string that specifies the IP address or hostname of the DHCP server.

[in] ReservedMustBeZero

Reserved. This field must be set to zero.

[in, out] ResumeHandle

Pointer to a DHCP_RESUME_HANDLE value that identifies the enumeration operation. Initially, this value should be zero, with a successful call returning the handle value used for subsequent enumeration requests. For example, if PreferredMaximum is set to 100 classes, and 200 classes are stored on the server, the resume handle can be used after the first 100 classes are retrieved to obtain the next 100 on a subsequent call, and so forth.

[in] PreferredMaximum

Specifies the preferred maximum number of classes to return. If the number of remaining unenumerated classes is less than this value, then that amount will be returned. To retrieve all classes available on the DHCP server, set this parameter to 0xFFFFFFFF.

[out] ClassInfoArray

Pointer to a DHCP_CLASS_INFO_ARRAY structure that contains the returned classes. If there are no classes available on the DHCP server, this parameter will return null.

[out] nRead

Pointer to a DWORD value that specifies the number of classes returned in ClassInfoArray.

[out] nTotal

Pointer to a DWORD value that specifies the total number of classes stored on the DHCP server.

Return value

This function returns ERROR_SUCCESS upon a successful call. Otherwise, it returns one of the DHCP Server Management API Error Codes.

Return code Description
ERROR_ACCESS_DENIED
This call was performed by a client who is not a member of the "DHCP Administrators" security group.
ERROR_DHCP_JET_ERROR
An error occurred while accessing the DHCP server's database.

Requirements

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

See also

DHCP_CLASS_INFO_ARRAY

DhcpCreateClass

DhcpDeleteClass