Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than dnsapi, prefix the name with the module name and a period.
dnsquery (dnsapi)
.
C# Signature:
[DllImport("dnsapi", EntryPoint="DnsQuery_W", CharSet=CharSet.Unicode, SetLastError=true, ExactSpelling=true)]
private static extern int DnsQuery([MarshalAs(UnmanagedType.VBByRefStr)]ref string pszName, QueryTypes wType, QueryOptions options, int aipServers, ref IntPtr ppQueryResults, int pReserved);
[StructLayout(LayoutKind.Sequential)]
private struct MXRecord
{
public IntPtr pNext;
public string pName;
public short wType;
public short wDataLength;
public int flags;
public int dwTtl;
public int dwReserved;
public IntPtr pNameExchange;
public short wPreference;
public short Pad;
}
[StructLayout(LayoutKind.Sequential)]
private struct MXRecord
{
public IntPtr pNext;
public string pName;
public short wType;
public short wDataLength;
public int flags;
public int dwTtl;
public int dwReserved;
public IntPtr pNameExchange;
public short wPreference;
public short Pad;
}
}
Private Declare Unicode Function DnsQuery Lib "dnsapi" Alias "DnsQuery_W" (<MarshalAs(UnmanagedType.VBByRefStr)> _
ByRef pszName As String, ByVal wType As QueryTypes, ByVal options As QueryOptions, ByVal aipServers As Integer, ByRef ppQueryResults As IntPtr, ByVal pReserved As Integer) As Integer
<DllImport("dnsapi", CharSet := CharSet.Auto, SetLastError := True)> _
Private Shared Sub DnsRecordListFree(ByVal pRecordList As IntPtr, ByVal FreeType As Integer)
End Sub
Public Shared Function GetMXRecords(ByVal domain As String) As String()
Dim ptr1 As IntPtr = IntPtr.Zero
Dim ptr2 As IntPtr = IntPtr.Zero
Dim recMx As MXRecord
If Environment.OSVersion.Platform <> PlatformID.Win32NT Then
Throw New NotSupportedException()
End If
Dim list1 As New ArrayList()
Dim num1 As Integer = DnsMx.DnsQuery(domain, QueryTypes.DNS_TYPE_MX, QueryOptions.DNS_QUERY_BYPASS_CACHE, 0, ptr1, 0)
If num1 <> 0 Then
Throw New Win32Exception(num1)
End If
ptr2 = ptr1
While Not ptr2.Equals(IntPtr.Zero)
recMx = DirectCast(Marshal.PtrToStructure(ptr2, GetType(MXRecord)), MXRecord)
If recMx.wType = 15 Then
Dim text1 As String = Marshal.PtrToStringAuto(recMx.pNameExchange)
list1.Add(text1)
End If
ptr2 = recMx.pNext
End While
DnsMx.DnsRecordListFree(ptr1, 0)
Return DirectCast(list1.ToArray(GetType(String)), String())
End Function
<StructLayout(LayoutKind.Sequential)> _
Private Structure MXRecord
Public pNext As IntPtr
Public pName As String
Public wType As Short
Public wDataLength As Short
Public flags As Integer
Public dwTtl As Integer
Public dwReserved As Integer
Public pNameExchange As IntPtr
Public wPreference As Short
Public Pad As Short
End Structure
End Class
A generic query interface to the DNS namespace, implemented in multiple forms to facilitate different character encoding.
9/13/2019 1:26:08 PM - -62.20.95.98
ByRef is a VB keyword that specifies a variable to be passed as a parameter BY REFERENCE. In other words, the pointer to the variable is passed and any change to its value made within the function or sub will change its value outside the function/sub.
4/25/2007 3:19:29 AM - anonymous
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
ByRef is a VB keyword that specifies a variable to be passed as a parameter BY REFERENCE. In other words, the pointer to the variable is passed and any change to its value made within the function or sub will change its value outside the function/sub.
4/25/2007 3:19:29 AM - anonymous
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
Click to read this page
4/6/2008 7:23:14 AM - anonymous
Click to read this page
4/6/2008 7:23:14 AM - anonymous
The SetLastError API
1/26/2016 3:27:33 AM - -124.148.167.58
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).