Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy

Search Results for "dnsquery" in [All]

dnsapi

.

    [DllImport("dnsapi", EntryPoint = "DnsQuery_W", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]

.

    public static extern int DnsQuery([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpstrName, DnsRecordTypes wType, DnsQueryOptions Options, IntPtr pExtra, ref IntPtr ppQueryResultsSet, IntPtr pReserved);

.

    /// Frees memory allocated for DNS records obtained by using the DnsQuery function

.

    public enum DnsQueryOptions

.

            var result = DnsQuery(ref domain, DnsRecordTypes.DNS_TYPE_MX, DnsQueryOptions.DNS_QUERY_BYPASS_CACHE,

.

        [DllImport("dnsapi", EntryPoint = "DnsQuery_W", CharSet = CharSet.Unicode, SetLastError = true,

.

        public static extern int DnsQuery([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpstrName, DnsRecordTypes wType,

.

        DnsQueryOptions Options, IntPtr pExtra, ref IntPtr ppQueryResultsSet, IntPtr pReserved);

.

        /// Frees memory allocated for DNS records obtained by using the DnsQuery function

.

        public enum DnsQueryOptions

.
Summary
DNSQueryEx (built off DNSQuery page)
.

Provides a more customisable query than DNSQuery - uses an Async callback

.

[DllImport("dnsapi", EntryPoint = "DnsQueryEx", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]

.

    private static extern int DnsQueryEx(IntPtr queryRequest, IntPtr queryResults, IntPtr cancelHandle);

.

    public class DNSQueryer

.

    private const int DNSQueryCancelSize = 32;

.

    private const uint DnsQueryRequestVersion1 = 1;

.

    private enum DnsQueryOptions

.

        DNSQueryResult queryResult = new DNSQueryResult();

.

        queryResult.Version = DnsQueryRequestVersion1;

.

        IntPtr result = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(DNSQueryResult)));

.

        IntPtr cancelBuffer = Marshal.AllocHGlobal(DNSQueryCancelSize);

.

        int resCode = DnsQueryEx(dnsRequest, result, cancelBuffer);

.

            queryResult = (DNSQueryResult)Marshal.PtrToStructure(result, typeof(DNSQueryResult));

.

        request.Version = DnsQueryRequestVersion1;

.

        request.QueryOptions = (ulong)DnsQueryOptions.DNS_QUERY_STANDARD;

.

        DNSQueryResult queryResult = (DNSQueryResult)Marshal.PtrToStructure(queryResults, typeof(DNSQueryResult));

.

    [DllImport("dnsapi", EntryPoint = "DnsQueryEx", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]

.

    private static extern int DnsQueryEx(IntPtr queryRequest, IntPtr queryResults, IntPtr cancelHandle);

.

    private struct DNSQueryResult

.
Documentation
[DnsQueryEx] on MSDN

 
Access PInvoke.net directly from VS: