Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6899553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:26:09+00:00 2026-05-27T07:26:09+00:00

I am not all that familiar with unmanaged code but have been using some

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:26:10+00:00Added an answer on May 27, 2026 at 7:26 am

    The difficult part of this Win32 API is the SOCKADDR structure. On PINVOKE.NET there is an implementation of the SOCKADDR structure. The following example is based on this implementation:

    [DllImport("Dnsapi.dll")]
    private static extern int  DnsValidateServerStatus(IntPtr sockaddr, string queryName, ref uint serverStatus);
    
    WinsockSockAddr addr = new WinsockSockAddr(IPAddress.Parse("127.0.0.1"), 0);
    uint serverStatus = 0;
    int status = DnsValidateServerStatus(addr.PinnedSockAddr, "fqdn server name", ref serverStatus);
    
    Console.Out.WriteLine(status);
    Console.Out.WriteLine(serverStatus);
    

    Hope, this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, I'm not all that familiar with cookies but I know how they
I kind of not familiar with all that JS stuff and everything but today
I'm not all that familiar with jquery so I'm not quite sure how to
After using PHP for a while now, I've noticed that not all built-in PHP
I noticed that almost all email messages I get do not embed images, but
I have heard that GTK covers all controls so that developers do not care
I am trying to get all the rows that exist in allData but not
Not all that familiar with XSD, I wonder if it is possible to do
I have been noticing that some software engineering jobs are asking for .NET developers,
In the company I work for, we have the policy that all code should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.