DhcpEnumSubnetElementsV5
C# Signature:
[DllImport("dhcpsapi.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint DhcpEnumSubnetElementsV5(
string ServerIpAddress,
uint SubnetAddress,
DHCP_SUBNET_ELEMENT_TYPE EnumElementType,
ref uint ResumeHandle,
uint PreferredMaximum,
ref IntPtr EnumElementInfo,
ref uint ElementsRead,
ref uint ElementsTotal);User-Defined Types:
const uint ERROR_SUCCESS = 0;
const uint ERROR_MORE_DATA = 234;
const uint ERROR_NO_MORE_ITEMS = 259;
[StructLayout(LayoutKind.Sequential)]
struct DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5 {
public uint NumElements;
public IntPtr Elements;
}
[StructLayout(LayoutKind.Sequential)]
struct DHCP_SUBNET_ELEMENT_DATA_V5 {
public DHCP_SUBNET_ELEMENT_TYPE ElementType;
public IntPtr ElementValue;
}
[StructLayout(LayoutKind.Sequential)]
struct DHCP_IP_RANGE {
public uint StartAddress;
public uint EndAddress;
}
enum DHCP_SUBNET_ELEMENT_TYPE : uint {
DhcpIpRanges,
DhcpSecondaryHosts,
DhcpReservedIps,
DhcpExcludedIpRanges,
DhcpIpRangesDhcpOnly,
DhcpIpRangesDhcpBootp,
DhcpIpRangesBootpOnly
}Sample Code:
Última actualización