Richard,
>At the moment I'm just trying to find out information about an existing
>reservation but I'm getting stuck. I read the newsgroup article
>'P/Invoke with DHCP management API' which got me started but the last
>comment made on 2006-01-01 didn't make sense to me and I can't get the
>damn thing to work, in my test console app.
What he's saying is that you have to change the method signature to
public static extern UInt32 DhcpGetClientInfo(String ServerIpAddress,
ref DHCP_SEARCH_INFO SearchInfo, out IntPtr ClientInfo);
and then make the calling code
IntPtr pClientInfo;
DHCPResult = DhcpApi.DhcpGetClientInfo(ServerIpAddress, ref
searchInfo, out pClientInfo);
if (DHCPResult == 0 && pClientInfo != IntPtr.Zero)
{
DHCP_CLIENT_INFO clientInfo =
(DHCP_CLIENT_INFO)Marshal.PtrToStructure(pClientInfo,
typeof(DHCP_CLIENT_INFO));
...
}
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ |
http://www.dotnetinterop.com
Please reply only to the newsgroup.