DNS_INTERFACE_SETTINGS3
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | DNS_INTERFACE_SETTINGS_VERSION3 に設定しなければなりません。 |
| Flags | ULONGLONG | 8 | +8 | +8 | 次のオプションのビットマップです。 DNS_SETTING_IPV6 (0x0001)。インターフェイス設定を IPv6 ネットワーク スタックに対してのみ構成します。このオプションを設定した場合、NameServer メンバーまたは ProfileNameServer メンバーに指定する IP アドレスは IPv6 アドレスでなければなりません。既定では、この構造体に指定した DNS インターフェイス設定は IPv4 ネットワーク スタックにのみ適用されます。 DNS_SETTING_NAMESERVER (0x0002)。NameServer メンバーを介して、指定したインターフェイスに静的なアダプター DNS サーバーを構成します。 DNS_SETTING_SEARCHLIST (0x0004)。SearchList メンバーを介して、指定したアダプターの接続固有の DNS サフィックス検索リストを構成します。 DNS_SETTING_REGISTRATION_ENABLED (0x0008)。指定したアダプターの動的 DNS 登録を有効または無効にします。これは既定でシステムにより有効になっています。 DNS_SETTING_DOMAIN (0x0020)。Domain メンバーを介して、指定したアダプターの接続固有の DNS サフィックスを構成します。 DNS_SETTINGS_ENABLE_LLMNR (0x0080)。指定したアダプターでの LLMNR および mDNS による名前解決を有効または無効にします。これは既定でシステムにより有効になっています。 DNS_SETTINGS_QUERY_ADAPTER_NAME (0x0100)。DNS クエリのサフィックスとしてアダプター名を使用するかどうかを有効または無効にします。これは既定でシステムにより有効になっています。 DNS_SETTING_PROFILE_NAMESERVER (0x0200)。ProfileNameServer メンバーを介して、指定したインターフェイスに静的なプロファイル DNS サーバーを構成します。 DNS_SETTING_SUPPLEMENTAL_SEARCH_LIST (0x0800)。SupplementalSearchList メンバーを介して、指定したアダプターの接続固有の DNS 補助サフィックス検索リストを構成します。 DNS_SETTING_DOH (0x1000)。cServerProperties メンバーおよび ServerProperties メンバーを介して、指定したアダプターに DNS over HTTPS の設定を構成します。このオプションを設定した場合、NameServer メンバーは、スペースまたはカンマで区切られた一連の DNS サーバーを含む有効な文字列を指していなければなりません。 DNS_SETTING_DOH_PROFILE (0x2000)。cProfileServerProperties メンバーおよび ProfileServerProperties メンバーを介して、指定したアダプターにプロファイルの DNS over HTTPS の設定を構成します。このオプションを設定した場合、ProfileNameServer メンバーは、スペースまたはカンマで区切られた一連の DNS サーバーを含む有効な文字列を指していなければなりません。 |
| Domain | LPWSTR | 8/4 | +16 | +16 | アダプターのドメイン名を格納する、NULL で終わるワイド文字列です。 |
| NameServer | LPWSTR | 8/4 | +24 | +20 | カンマまたはスペースで区切られた一連の DNS サーバーを格納する、NULL で終わるワイド文字列です。たとえば L"1.1.1.1 8.8.8.8" や L"1.1.1.1,8.8.8.8" のように指定します。 DNS_SETTING_IPV6 フラグが指定されている場合、サーバーは IPv6 アドレスでなければなりません。たとえば L"2606:4700:4700::1001,2606:4700:4700::1111" のように指定します。 |
| SearchList | LPWSTR | 8/4 | +32 | +24 | カンマまたはスペースで区切られた一連の検索名を格納する、NULL で終わるワイド文字列です。たとえば L"contoso1.com contoso2.com" や L"contoso1.com, contoso2.com" のように指定します。 |
| RegistrationEnabled | DWORD | 4 | +40 | +28 | アダプターの動的登録を有効にする場合は TRUE、無効にする場合は FALSE を指定します。 |
| RegisterAdapterName | DWORD | 4 | +44 | +32 | アダプター名の登録を有効にする場合は TRUE、無効にする場合は FALSE を指定します。 |
| EnableLLMNR | DWORD | 4 | +48 | +36 | 指定したインターフェイスで mDNS と LLMNR を有効にする場合は TRUE、無効にする場合は FALSE を指定します。 |
| QueryAdapterName | DWORD | 4 | +52 | +40 | アダプター名を検索サフィックスとして使用する場合は TRUE、それ以外の場合は FALSE です。 |
| ProfileNameServer | LPWSTR | 8/4 | +56 | +44 | カンマまたはスペースで区切られた一連の DNS サーバーを格納する、NULL で終わるワイド文字列です。たとえば L"1.1.1.1 8.8.8.8" や L"1.1.1.1,8.8.8.8" のように指定します。 DNS_SETTING_IPV6 フラグが指定されている場合、サーバーは IPv6 アドレスでなければなりません。たとえば L"2606:4700:4700::1001,2606:4700:4700::1111" のように指定します。 |
| DisableUnconstrainedQueries | DWORD | 4 | +64 | +48 | 予約済みです。 |
| SupplementalSearchList | LPWSTR | 8/4 | +72 | +52 | カンマまたはスペースで区切られた一連の検索名を格納する、NULL で終わるワイド文字列です。たとえば L"contoso1.com contoso2.com" や L"contoso1.com, contoso2.com" のように指定します。 |
| cServerProperties | DWORD | 4 | +80 | +56 | ServerProperties メンバーに指定されたサーバー プロパティの数です。これが 0 の場合、"ServerProperties" メンバーは NULL でなければなりません。 |
| ServerProperties | DNS_SERVER_PROPERTY* | 8/4 | +88 | +60 | cServerProperties 個の要素を持つ DNS_SERVER_PROPERTY 構造体の配列です。cServerProperties が 0 の場合、これは NULL でなければなりません。 サポートされるのは DNS over HTTPS のプロパティのみであり、さらに NameServer メンバーに指定した各サーバーにつき最大 1 個のプロパティという制限があります。 DNS_SERVER_PROPERTY::Version メンバーは DNS_SERVER_PROPERTY_VERSION1 に、::Type は DNS_SERVER_PROPERTY_TYPE::DnsServerDohProperty に設定しなければなりません。また、Property.DohSettings は有効な DNS_DOH_SERVER_SETTINGS オブジェクトを指していなければなりません。 DNS_SERVER_PROPERTY の ServerIndex メンバーには、NameServer メンバー内の対応する DNS サーバーのインデックスを設定しなければなりません。 たとえば、NameServer メンバーが L"1.1.1.1, 8.8.8.8, 9.9.9.9" に設定されている場合、サーバー 1.1.1.1 に対するプロパティでは ServerIndex メンバーを 0 に設定します。同様に、8.8.8.8 では ServerIndex を 1 に、9.9.9.9 では ServerIndex メンバーを 2 に設定する必要があります。 |
| cProfileServerProperties | DWORD | 4 | +96 | +64 | ProfileServerProperties メンバーに指定されたサーバー プロパティの数です。これが 0 の場合、ProfileServerProperties メンバーは NULL でなければなりません。 |
| ProfileServerProperties | DNS_SERVER_PROPERTY* | 8/4 | +104 | +68 | cProfileServerProperties 個の要素を持つ DNS_SERVER_PROPERTY 構造体の配列です。cProfileServerProperties が 0 の場合、これは NULL でなければなりません。 サポートされるのは DNS over HTTPS のプロパティのみであり、さらに ProfileNameServer メンバーに指定した各サーバーにつき最大 1 個のプロパティという制限があります。 DNS_SERVER_PROPERTY::Version メンバーは DNS_SERVER_PROPERTY_VERSION1 に、::Type は DNS_SERVER_PROPERTY_TYPE::DnsServerDohProperty に設定しなければなりません。また、Property.DohSettings は有効な DNS_DOH_SERVER_SETTINGS オブジェクトを指していなければなりません。 DNS_SERVER_PROPERTY の ServerIndex メンバーには、ProfileNameServer メンバー内の対応する DNS サーバーのインデックスを設定しなければなりません。 たとえば、ProfileNameServer メンバーが L"1.1.1.1, 8.8.8.8, 9.9.9.9" に設定されている場合、サーバー 1.1.1.1 に対するプロパティでは ServerIndex メンバーを 0 に設定します。同様に、8.8.8.8 では ServerIndex を 1 に、9.9.9.9 では ServerIndex メンバーを 2 に設定する必要があります。 |
公式ドキュメント
SetInterfaceDnsSettings 関数を呼び出して特定のインターフェイスに構成できる、または GetInterfaceDnsSettings 関数を呼び出して特定のインターフェイスについて取得できる DNS 設定を表します。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// DNS_INTERFACE_SETTINGS3 (x64 112 / x86 72 バイト)
typedef struct DNS_INTERFACE_SETTINGS3 {
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;
} DNS_INTERFACE_SETTINGS3;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DNS_INTERFACE_SETTINGS3
{
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;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DNS_INTERFACE_SETTINGS3
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
End Structureimport ctypes
from ctypes import wintypes
class DNS_INTERFACE_SETTINGS3(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),
]#[repr(C)]
pub struct DNS_INTERFACE_SETTINGS3 {
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,
}import "golang.org/x/sys/windows"
type DNS_INTERFACE_SETTINGS3 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
}type
DNS_INTERFACE_SETTINGS3 = 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;
end;const DNS_INTERFACE_SETTINGS3 = 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,
};type
DNS_INTERFACE_SETTINGS3 {.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: pointerstruct DNS_INTERFACE_SETTINGS3
{
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;
}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_SETTINGS3 サイズ: 72 バイト(x86)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 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:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DNS_INTERFACE_SETTINGS3 サイズ: 112 バイト(x64)
dim st, 28 ; 4byte整数×28(構造体サイズ 112 / 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:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DNS_INTERFACE_SETTINGS3
#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
#endstruct
stdim st, DNS_INTERFACE_SETTINGS3 ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version