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

DNS_NAPTR_DATAW

構造体
サイズx64: 40 バイト / x86: 20 バイト

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

フィールド

フィールドサイズx64x86説明
wOrderWORD2+0+0複数NAPTRレコードの処理順序を示す。値が小さいほど先に処理される。
wPreferenceWORD2+2+2同順序内での優先度を示す。値が小さいほど優先される。
pFlagsLPWSTR8/4+8+4書き換え処理の制御フラグ文字列を表すワイド文字列ポインタ。
pServiceLPWSTR8/4+16+8提供されるサービス・プロトコルを表すワイド文字列ポインタ。
pRegularExpressionLPWSTR8/4+24+12名前書き換えに用いる正規表現を表すワイド文字列ポインタ。
pReplacementLPWSTR8/4+32+16次に照会する置換ドメイン名を表すワイド文字列ポインタ。

各言語での定義

#include <windows.h>

// DNS_NAPTR_DATAW  (x64 40 / x86 20 バイト)
typedef struct DNS_NAPTR_DATAW {
    WORD wOrder;
    WORD wPreference;
    LPWSTR pFlags;
    LPWSTR pService;
    LPWSTR pRegularExpression;
    LPWSTR pReplacement;
} DNS_NAPTR_DATAW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DNS_NAPTR_DATAW
{
    public ushort wOrder;
    public ushort wPreference;
    public IntPtr pFlags;
    public IntPtr pService;
    public IntPtr pRegularExpression;
    public IntPtr pReplacement;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DNS_NAPTR_DATAW
    Public wOrder As UShort
    Public wPreference As UShort
    Public pFlags As IntPtr
    Public pService As IntPtr
    Public pRegularExpression As IntPtr
    Public pReplacement As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DNS_NAPTR_DATAW(ctypes.Structure):
    _fields_ = [
        ("wOrder", ctypes.c_ushort),
        ("wPreference", ctypes.c_ushort),
        ("pFlags", ctypes.c_void_p),
        ("pService", ctypes.c_void_p),
        ("pRegularExpression", ctypes.c_void_p),
        ("pReplacement", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DNS_NAPTR_DATAW {
    pub wOrder: u16,
    pub wPreference: u16,
    pub pFlags: *mut core::ffi::c_void,
    pub pService: *mut core::ffi::c_void,
    pub pRegularExpression: *mut core::ffi::c_void,
    pub pReplacement: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DNS_NAPTR_DATAW struct {
	wOrder uint16
	wPreference uint16
	pFlags uintptr
	pService uintptr
	pRegularExpression uintptr
	pReplacement uintptr
}
type
  DNS_NAPTR_DATAW = record
    wOrder: Word;
    wPreference: Word;
    pFlags: Pointer;
    pService: Pointer;
    pRegularExpression: Pointer;
    pReplacement: Pointer;
  end;
const DNS_NAPTR_DATAW = extern struct {
    wOrder: u16,
    wPreference: u16,
    pFlags: ?*anyopaque,
    pService: ?*anyopaque,
    pRegularExpression: ?*anyopaque,
    pReplacement: ?*anyopaque,
};
type
  DNS_NAPTR_DATAW {.bycopy.} = object
    wOrder: uint16
    wPreference: uint16
    pFlags: pointer
    pService: pointer
    pRegularExpression: pointer
    pReplacement: pointer
struct DNS_NAPTR_DATAW
{
    ushort wOrder;
    ushort wPreference;
    void* pFlags;
    void* pService;
    void* pRegularExpression;
    void* pReplacement;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DNS_NAPTR_DATAW サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; wOrder : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; wPreference : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; pFlags : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; pService : LPWSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pRegularExpression : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pReplacement : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DNS_NAPTR_DATAW サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; wOrder : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; wPreference : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; pFlags : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pService : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pRegularExpression : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pReplacement : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DNS_NAPTR_DATAW
    #field short wOrder
    #field short wPreference
    #field intptr pFlags
    #field intptr pService
    #field intptr pRegularExpression
    #field intptr pReplacement
#endstruct

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