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

  • Home
  • SEARCH
  • 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 3395592
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:18:29+00:00 2026-05-18T04:18:29+00:00

I am doing an MxRecordLookup. I am getting an error when calling the DnsRecordListFree

  • 0

I am doing an MxRecordLookup. I am getting an error when calling the DnsRecordListFree in the .NET Framework 4.0. I am using Windows 7. How do I get around it? Here is the error:

Faulting application name: MxRecordService.exe, version: 1.0.0.0, time stamp: 0x4ce25848
Faulting module name: ntdll.dll, version: 6.1.7600.16559, time stamp: 0x4ba9b802
Exception code: 0xc0000374
Fault offset: 0x00000000000c6df2
Faulting process id: 0x110c
Faulting application start time: 0x01cb85f46c1140da
Faulting application path: C:\vss\Web\MXRecordWS\MxRecordService\bin\Debug\MxRecordService.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: e8c9ecb6-f1e8-11df-8afe-0026b9777c1c

My code is:

[DllImport("dnsapi.dll", EntryPoint = "DnsQuery_W", CharSet = CharSet.Unicode, SetLastError = true)]
    public static extern UInt32 DnsQuery([MarshalAs(UnmanagedType.VBByRefStr)]ref string hostname, UInt16 iType, UInt32 iOptions, UInt32 aipServers, ref  IntPtr ppQueryResults, UInt32 pReserved);

    [DllImport("dnsapi.dll", EntryPoint = "DnsRecordListFree", CharSet = CharSet.Ansi, SetLastError = true)]
    public static extern void DnsRecordListFree(ref IntPtr pRecordList, UInt32 iFreeType);

I have tried the post How to get around DnsRecordListFree error in .NET Framework 4.0?

[Update]: Finally, fixed it. The solution is try to make sure the win32 struct and c# struct is bit(bit size) mapping. This can be achieved by using exact c# type for win32 type.

  • 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-18T04:18:30+00:00Added an answer on May 18, 2026 at 4:18 am

    Try to change the function DnsRecordListFree definition to:

      [DllImport("dnsapi.dll", EntryPoint = "DnsRecordListFree", CharSet = CharSet.Auto, SetLastError = true)]
        public static extern void DnsRecordListFree(ref IntPtr pRecordList, UInt32 iFreeType);
    

    Edit: I guess there is only one version of this function

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

Sidebar

Related Questions

I am doing an MxRecordLookup. I am getting an error when calling the DnsRecordListFree
Doing an expression I get an error, can someone show me the correct syntax
Doing a recent build, I ran Django's syncdb, and I'm getting the error: Traceback
When doing a cvs update , you get a nice summary of the state
When doing a simple performance measurement, I was astonished to see that calling String.IndexOf(char)
Doing some work on controlling printing via the System.Printing framework (main classes are PrintQueue,
Doing some SOAP calls to a 3rd party application. They provide this soap header
Doing cross platform development with 64bit. Using gcc/linux and msvc9/server 2008. Just recently deployed
While doing filing im stuck here.The condition of the while loop is not working.The
iam doing division of these two columns $row['col1']/$row['col2'] iam getting value as 0.0042553191489362 How

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.