here's a link to the API I'm trying to use:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dhcp/dhcp/dhcpcreateclientinfo.asp
Here's the structures and static api methods from my c# class:
//The DHCP_BINARY_DATA structure defines an opaque blob of binary data.
[StructLayout(LayoutKind.Sequential)]
public struct DHCP_BINARY_DATA
{
public UInt32 DataLength; //Specifies the size of Data, in bytes
public byte[] Data; //Pointer to an opaque blob of byte (binary)
data
}
//The DHCP_HOST_INFO structure defines information on a DHCP server
(host).
[StructLayout(LayoutKind.Sequential)]
public struct DHCP_HOST_INFO
{
public UInt32 IpAddress; //DHCP_IP_ADDRESS value that contains the
IP address of the DHCP server.
public StringBuilder NetBiosName; //Unicode string that contains the
Netbios name of the DHCP server.
public StringBuilder HostName; //Unicode string that contains the
network name of the DHCP server.
}
// The DATE_TIME structure defines a 64-bit integer value that
contains a date/time, expressed
// as the number of ticks (100-nanosecond increments) since 12:00
midnight, January 1, 1 C.E. in
// the Gregorian calendar.
[StructLayout(LayoutKind.Sequential)]
public struct DATE_TIME
{
public UInt32 dwLowDateTime; //Specifies the lower 32 bits of the
time value.
public UInt32 dwHighDateTime; //Specifies the upper 32 bits of the
time value
}
//The DHCP_CLIENT_INFO structure defines a client information record
used by the DHCP server.
[StructLayout(LayoutKind.Sequential)]
public struct DHCP_CLIENT_INFO
{
public UInt32 ClientIpAddress;
public UInt32 SubnetMask;
public DHCP_BINARY_DATA ClientHardwareAddress;
public StringBuilder ClientName;
public StringBuilder ClientComment;
public DATE_TIME ClientLeaseExpires;
public DHCP_HOST_INFO OwnerHost;
};
[DllImport("dhcpsapi.dll")]
static extern UInt32 CreateClientInfo(char[] ServerIpAddress,
DHCP_CLIENT_INFO ci);
[DllImport("dhcpsapi.dll")]
static extern UInt32 DeleteClientInfo(char[] ServerIpAddress,
DHCP_CLIENT_INFO ci);
#endregion