DHCP Server Management API - DhcpEnumSubnetClients
From: MichaelDH (MichaelDH_at_discussions.microsoft.com)
Date: 10/01/04
- Next message: Arkady Frankel: "Re: list network cards"
- Previous message: BELUCHIN: "Re: Conditional Accept and Overlapped I/O Question"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 1 Oct 2004 04:09:03 -0700
Hello,
I'm about to script web page using .NET to manage DHCP servers.
Everything works fine so far as I'm using the dhcpobjs.dll.
The point is that I need to dump the current leases from a scope.
As this is not possible by the dhcpobjs.dll I used a netsh command and
querying the stdout.
However, this is very slow so I want to use the DHCP Management APIs.
As I need to "MarshalAs" all the data for .NET I'm loking for a sample souce
code C/C++ or whatever as reference.
Could someone provide such a sample or the valid .NET declaration of the
DHCP Server Management API Structures?
Now I'm using this:
Private Structure DHCPClientInfoArray
Dim NumElements As System.UInt32
Dim DHCPClientInfo As DHCPClientInfo
End Structure
Private Structure DHCPClientInfo
Dim IPAddress
Dim IPMask
Dim ClientMAC
Dim ClientName As String
Dim ClientComment As String
Dim ClientLeaseExpires As DateTime
Dim HostInfo As DHCPHostInfo
End Structure
Private Structure DHCPHostInfo
Dim IpAddress As System.UInt32
Dim NetBiosName As String
Dim HostName As String
End Structure
Private Declare Function DhcpEnumSubnetClients Lib "dhcpsapi.dll" Alias
"DhcpEnumSubnetClients" ( _
<MarshalAs(UnmanagedType.AnsiBStr)> ByVal ServerIP As String, _
ByVal SubnetAddress As Integer, _
ByVal ResumeHandle As Integer, _
ByVal PreferdMax As System.UInt32, _
<MarshalAs(UnmanagedType.LPArray)> ByVal ClientInfoArray() As
DHCPClientInfoArray, _
ByVal ClientsRead As System.UInt32, _
ByVal ClientsTotal As System.UInt32 _
) As System.UInt32
Thanks in advanced!!
Michael
- Next message: Arkady Frankel: "Re: list network cards"
- Previous message: BELUCHIN: "Re: Conditional Accept and Overlapped I/O Question"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|