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

DNS_INTERFACE_SETTINGS4

構造体
サイズx64: 120 バイト / x86: 80 バイト

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0この構造体のバージョン番号を示す。
FlagsULONGLONG8+8+8どのフィールドが有効かを指定するビットフラグ(ULONGLONG)である。
DomainLPWSTR8/4+16+16接続固有のDNSドメイン名を指すワイド文字列ポインタである。
NameServerLPWSTR8/4+24+20DNSサーバーアドレス(カンマ区切り)を指すワイド文字列ポインタである。
SearchListLPWSTR8/4+32+24DNS検索リスト(カンマ区切り)を指すワイド文字列ポインタである。
RegistrationEnabledDWORD4+40+28DNS動的更新登録が有効かどうかを示す(0/非0)。
RegisterAdapterNameDWORD4+44+32アダプタ名をDNSに登録するかどうかを示す(0/非0)。
EnableLLMNRDWORD4+48+36LLMNRを有効にするかどうかを示す(0/非0)。
QueryAdapterNameDWORD4+52+40アダプタ名でクエリを行うかどうかを示す(0/非0)。
ProfileNameServerLPWSTR8/4+56+44プロファイル指定のDNSサーバーアドレスを指すワイド文字列ポインタである。
DisableUnconstrainedQueriesDWORD4+64+48制約なしクエリを無効にするかどうかを示す(0/非0)。
SupplementalSearchListLPWSTR8/4+72+52補助的なDNS検索リストを指すワイド文字列ポインタである。
cServerPropertiesDWORD4+80+56ServerProperties配列の要素数を示す。
ServerPropertiesDNS_SERVER_PROPERTY*8/4+88+60DNSサーバープロパティ(DNS_SERVER_PROPERTY)配列へのポインタである。
cProfileServerPropertiesDWORD4+96+64ProfileServerProperties配列の要素数を示す。
ProfileServerPropertiesDNS_SERVER_PROPERTY*8/4+104+68プロファイル用DNSサーバープロパティ配列へのポインタである。
EncryptedDnsAdapterFlagsDWORD4+112+72暗号化DNS(DoH/DoT)に関するアダプタフラグである。

各言語での定義

#include <windows.h>

// DNS_INTERFACE_SETTINGS4  (x64 120 / x86 80 バイト)
typedef struct DNS_INTERFACE_SETTINGS4 {
    DWORD Version;
    ULONGLONG Flags;
    LPWSTR Domain;
    LPWSTR NameServer;
    LPWSTR SearchList;
    DWORD RegistrationEnabled;
    DWORD RegisterAdapterName;
    DWORD EnableLLMNR;
    DWORD QueryAdapterName;
    LPWSTR ProfileNameServer;
    DWORD DisableUnconstrainedQueries;
    LPWSTR SupplementalSearchList;
    DWORD cServerProperties;
    DNS_SERVER_PROPERTY* ServerProperties;
    DWORD cProfileServerProperties;
    DNS_SERVER_PROPERTY* ProfileServerProperties;
    DWORD EncryptedDnsAdapterFlags;
} DNS_INTERFACE_SETTINGS4;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DNS_INTERFACE_SETTINGS4
{
    public uint Version;
    public ulong Flags;
    public IntPtr Domain;
    public IntPtr NameServer;
    public IntPtr SearchList;
    public uint RegistrationEnabled;
    public uint RegisterAdapterName;
    public uint EnableLLMNR;
    public uint QueryAdapterName;
    public IntPtr ProfileNameServer;
    public uint DisableUnconstrainedQueries;
    public IntPtr SupplementalSearchList;
    public uint cServerProperties;
    public IntPtr ServerProperties;
    public uint cProfileServerProperties;
    public IntPtr ProfileServerProperties;
    public uint EncryptedDnsAdapterFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DNS_INTERFACE_SETTINGS4
    Public Version As UInteger
    Public Flags As ULong
    Public Domain As IntPtr
    Public NameServer As IntPtr
    Public SearchList As IntPtr
    Public RegistrationEnabled As UInteger
    Public RegisterAdapterName As UInteger
    Public EnableLLMNR As UInteger
    Public QueryAdapterName As UInteger
    Public ProfileNameServer As IntPtr
    Public DisableUnconstrainedQueries As UInteger
    Public SupplementalSearchList As IntPtr
    Public cServerProperties As UInteger
    Public ServerProperties As IntPtr
    Public cProfileServerProperties As UInteger
    Public ProfileServerProperties As IntPtr
    Public EncryptedDnsAdapterFlags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DNS_INTERFACE_SETTINGS4(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Flags", ctypes.c_ulonglong),
        ("Domain", ctypes.c_void_p),
        ("NameServer", ctypes.c_void_p),
        ("SearchList", ctypes.c_void_p),
        ("RegistrationEnabled", wintypes.DWORD),
        ("RegisterAdapterName", wintypes.DWORD),
        ("EnableLLMNR", wintypes.DWORD),
        ("QueryAdapterName", wintypes.DWORD),
        ("ProfileNameServer", ctypes.c_void_p),
        ("DisableUnconstrainedQueries", wintypes.DWORD),
        ("SupplementalSearchList", ctypes.c_void_p),
        ("cServerProperties", wintypes.DWORD),
        ("ServerProperties", ctypes.c_void_p),
        ("cProfileServerProperties", wintypes.DWORD),
        ("ProfileServerProperties", ctypes.c_void_p),
        ("EncryptedDnsAdapterFlags", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DNS_INTERFACE_SETTINGS4 {
    pub Version: u32,
    pub Flags: u64,
    pub Domain: *mut core::ffi::c_void,
    pub NameServer: *mut core::ffi::c_void,
    pub SearchList: *mut core::ffi::c_void,
    pub RegistrationEnabled: u32,
    pub RegisterAdapterName: u32,
    pub EnableLLMNR: u32,
    pub QueryAdapterName: u32,
    pub ProfileNameServer: *mut core::ffi::c_void,
    pub DisableUnconstrainedQueries: u32,
    pub SupplementalSearchList: *mut core::ffi::c_void,
    pub cServerProperties: u32,
    pub ServerProperties: *mut core::ffi::c_void,
    pub cProfileServerProperties: u32,
    pub ProfileServerProperties: *mut core::ffi::c_void,
    pub EncryptedDnsAdapterFlags: u32,
}
import "golang.org/x/sys/windows"

type DNS_INTERFACE_SETTINGS4 struct {
	Version uint32
	Flags uint64
	Domain uintptr
	NameServer uintptr
	SearchList uintptr
	RegistrationEnabled uint32
	RegisterAdapterName uint32
	EnableLLMNR uint32
	QueryAdapterName uint32
	ProfileNameServer uintptr
	DisableUnconstrainedQueries uint32
	SupplementalSearchList uintptr
	cServerProperties uint32
	ServerProperties uintptr
	cProfileServerProperties uint32
	ProfileServerProperties uintptr
	EncryptedDnsAdapterFlags uint32
}
type
  DNS_INTERFACE_SETTINGS4 = record
    Version: DWORD;
    Flags: UInt64;
    Domain: Pointer;
    NameServer: Pointer;
    SearchList: Pointer;
    RegistrationEnabled: DWORD;
    RegisterAdapterName: DWORD;
    EnableLLMNR: DWORD;
    QueryAdapterName: DWORD;
    ProfileNameServer: Pointer;
    DisableUnconstrainedQueries: DWORD;
    SupplementalSearchList: Pointer;
    cServerProperties: DWORD;
    ServerProperties: Pointer;
    cProfileServerProperties: DWORD;
    ProfileServerProperties: Pointer;
    EncryptedDnsAdapterFlags: DWORD;
  end;
const DNS_INTERFACE_SETTINGS4 = extern struct {
    Version: u32,
    Flags: u64,
    Domain: ?*anyopaque,
    NameServer: ?*anyopaque,
    SearchList: ?*anyopaque,
    RegistrationEnabled: u32,
    RegisterAdapterName: u32,
    EnableLLMNR: u32,
    QueryAdapterName: u32,
    ProfileNameServer: ?*anyopaque,
    DisableUnconstrainedQueries: u32,
    SupplementalSearchList: ?*anyopaque,
    cServerProperties: u32,
    ServerProperties: ?*anyopaque,
    cProfileServerProperties: u32,
    ProfileServerProperties: ?*anyopaque,
    EncryptedDnsAdapterFlags: u32,
};
type
  DNS_INTERFACE_SETTINGS4 {.bycopy.} = object
    Version: uint32
    Flags: uint64
    Domain: pointer
    NameServer: pointer
    SearchList: pointer
    RegistrationEnabled: uint32
    RegisterAdapterName: uint32
    EnableLLMNR: uint32
    QueryAdapterName: uint32
    ProfileNameServer: pointer
    DisableUnconstrainedQueries: uint32
    SupplementalSearchList: pointer
    cServerProperties: uint32
    ServerProperties: pointer
    cProfileServerProperties: uint32
    ProfileServerProperties: pointer
    EncryptedDnsAdapterFlags: uint32
struct DNS_INTERFACE_SETTINGS4
{
    uint Version;
    ulong Flags;
    void* Domain;
    void* NameServer;
    void* SearchList;
    uint RegistrationEnabled;
    uint RegisterAdapterName;
    uint EnableLLMNR;
    uint QueryAdapterName;
    void* ProfileNameServer;
    uint DisableUnconstrainedQueries;
    void* SupplementalSearchList;
    uint cServerProperties;
    void* ServerProperties;
    uint cProfileServerProperties;
    void* ProfileServerProperties;
    uint EncryptedDnsAdapterFlags;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DNS_INTERFACE_SETTINGS4 サイズ: 80 バイト(x86)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Flags : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Domain : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; NameServer : LPWSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; SearchList : LPWSTR (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; RegistrationEnabled : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; RegisterAdapterName : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; EnableLLMNR : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; QueryAdapterName : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ProfileNameServer : LPWSTR (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; DisableUnconstrainedQueries : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; SupplementalSearchList : LPWSTR (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; cServerProperties : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ServerProperties : DNS_SERVER_PROPERTY* (+60, 4byte)  varptr(st)+60 を基点に操作(4byte:入れ子/配列)
; cProfileServerProperties : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; ProfileServerProperties : DNS_SERVER_PROPERTY* (+68, 4byte)  varptr(st)+68 を基点に操作(4byte:入れ子/配列)
; EncryptedDnsAdapterFlags : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DNS_INTERFACE_SETTINGS4 サイズ: 120 バイト(x64)
dim st, 30    ; 4byte整数×30(構造体サイズ 120 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Flags : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Domain : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; NameServer : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; SearchList : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; RegistrationEnabled : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; RegisterAdapterName : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; EnableLLMNR : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; QueryAdapterName : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; ProfileNameServer : LPWSTR (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; DisableUnconstrainedQueries : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; SupplementalSearchList : LPWSTR (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; cServerProperties : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; ServerProperties : DNS_SERVER_PROPERTY* (+88, 8byte)  varptr(st)+88 を基点に操作(8byte:入れ子/配列)
; cProfileServerProperties : DWORD (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; ProfileServerProperties : DNS_SERVER_PROPERTY* (+104, 8byte)  varptr(st)+104 を基点に操作(8byte:入れ子/配列)
; EncryptedDnsAdapterFlags : DWORD (+112, 4byte)  st.28 = 値  /  値 = st.28   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DNS_INTERFACE_SETTINGS4
    #field int Version
    #field int64 Flags
    #field intptr Domain
    #field intptr NameServer
    #field intptr SearchList
    #field int RegistrationEnabled
    #field int RegisterAdapterName
    #field int EnableLLMNR
    #field int QueryAdapterName
    #field intptr ProfileNameServer
    #field int DisableUnconstrainedQueries
    #field intptr SupplementalSearchList
    #field int cServerProperties
    #field intptr ServerProperties
    #field int cProfileServerProperties
    #field intptr ProfileServerProperties
    #field int EncryptedDnsAdapterFlags
#endstruct

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