I am not all that familiar with unmanaged code but have been using some of the methods in dnsapi.dll in my C# application. There are lots of examples on how to use DnsQuery, or DnsFlushResolverCache for example, but the method DnsValidateServerStatus seems to be new (requiring Win 7 or Server 2008 R2). I would like to use this method from my C# application but I can’t seem to get the Marshaling and structures to work correctly. The documentation for this method can be found at:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee837436(v=VS.85).aspx
Please help!
The difficult part of this Win32 API is the
SOCKADDRstructure. On PINVOKE.NET there is an implementation of theSOCKADDRstructure. The following example is based on this implementation:Hope, this helps.