Win32 API 日本語リファレンス
ホームNetworkManagement.Dns › DNS_QUERY_RESULT

DNS_QUERY_RESULT

構造体
サイズx64: 32 バイト / x86: 24 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0構造体のバージョン番号を示す。DNS_QUERY_REQUEST_VERSION1等を指定する。
QueryStatusINT4+4+4問い合わせの結果ステータスをDNS_STATUSで示す。0は成功。
QueryOptionsULONGLONG8+8+8問い合わせに適用されたオプションフラグを保持する。
pQueryRecordsDNS_RECORDA*8/4+16+16解決結果のDNSレコード連結リストを指すポインタ。要DnsRecordListFree。
Reservedvoid*8/4+24+20予約フィールド。NULLを指定する。

各言語での定義

#include <windows.h>

// DNS_QUERY_RESULT  (x64 32 / x86 24 バイト)
typedef struct DNS_QUERY_RESULT {
    DWORD Version;
    INT QueryStatus;
    ULONGLONG QueryOptions;
    DNS_RECORDA* pQueryRecords;
    void* Reserved;
} DNS_QUERY_RESULT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DNS_QUERY_RESULT
{
    public uint Version;
    public int QueryStatus;
    public ulong QueryOptions;
    public IntPtr pQueryRecords;
    public IntPtr Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DNS_QUERY_RESULT
    Public Version As UInteger
    Public QueryStatus As Integer
    Public QueryOptions As ULong
    Public pQueryRecords As IntPtr
    Public Reserved As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DNS_QUERY_RESULT(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("QueryStatus", ctypes.c_int),
        ("QueryOptions", ctypes.c_ulonglong),
        ("pQueryRecords", ctypes.c_void_p),
        ("Reserved", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DNS_QUERY_RESULT {
    pub Version: u32,
    pub QueryStatus: i32,
    pub QueryOptions: u64,
    pub pQueryRecords: *mut core::ffi::c_void,
    pub Reserved: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DNS_QUERY_RESULT struct {
	Version uint32
	QueryStatus int32
	QueryOptions uint64
	pQueryRecords uintptr
	Reserved uintptr
}
type
  DNS_QUERY_RESULT = record
    Version: DWORD;
    QueryStatus: Integer;
    QueryOptions: UInt64;
    pQueryRecords: Pointer;
    Reserved: Pointer;
  end;
const DNS_QUERY_RESULT = extern struct {
    Version: u32,
    QueryStatus: i32,
    QueryOptions: u64,
    pQueryRecords: ?*anyopaque,
    Reserved: ?*anyopaque,
};
type
  DNS_QUERY_RESULT {.bycopy.} = object
    Version: uint32
    QueryStatus: int32
    QueryOptions: uint64
    pQueryRecords: pointer
    Reserved: pointer
struct DNS_QUERY_RESULT
{
    uint Version;
    int QueryStatus;
    ulong QueryOptions;
    void* pQueryRecords;
    void* Reserved;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DNS_QUERY_RESULT サイズ: 24 バイト(x86)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; QueryStatus : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; QueryOptions : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pQueryRecords : DNS_RECORDA* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; Reserved : void* (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DNS_QUERY_RESULT サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; QueryStatus : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; QueryOptions : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pQueryRecords : DNS_RECORDA* (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; Reserved : void* (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DNS_QUERY_RESULT
    #field int Version
    #field int QueryStatus
    #field int64 QueryOptions
    #field intptr pQueryRecords
    #field intptr Reserved
#endstruct

stdim st, DNS_QUERY_RESULT        ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version