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

DNS_SERVICE_REGISTER_REQUEST

構造体
サイズx64: 48 バイト / x86: 28 バイト

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0構造体のバージョン番号を示す。
InterfaceIndexDWORD4+4+4登録に使用するネットワークインターフェースのインデックス。
pServiceInstanceDNS_SERVICE_INSTANCE*8/4+8+8登録するサービスインスタンス情報を指すポインタ。
pRegisterCompletionCallbackPDNS_SERVICE_REGISTER_COMPLETE8/4+16+12登録完了時に呼ばれるコールバック関数のポインタ。
pQueryContextvoid*8/4+24+16コールバックに渡されるユーザ定義コンテキストポインタ。NULL可。
hCredentialsHANDLE8/4+32+20登録に使用する資格情報のハンドル。NULL可。
unicastEnabledBOOL4+40+24ユニキャストDNSでの登録を有効にするか否かを示す真偽値。

各言語での定義

#include <windows.h>

// DNS_SERVICE_REGISTER_REQUEST  (x64 48 / x86 28 バイト)
typedef struct DNS_SERVICE_REGISTER_REQUEST {
    DWORD Version;
    DWORD InterfaceIndex;
    DNS_SERVICE_INSTANCE* pServiceInstance;
    PDNS_SERVICE_REGISTER_COMPLETE pRegisterCompletionCallback;
    void* pQueryContext;
    HANDLE hCredentials;
    BOOL unicastEnabled;
} DNS_SERVICE_REGISTER_REQUEST;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DNS_SERVICE_REGISTER_REQUEST
{
    public uint Version;
    public uint InterfaceIndex;
    public IntPtr pServiceInstance;
    public IntPtr pRegisterCompletionCallback;
    public IntPtr pQueryContext;
    public IntPtr hCredentials;
    [MarshalAs(UnmanagedType.Bool)] public bool unicastEnabled;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DNS_SERVICE_REGISTER_REQUEST
    Public Version As UInteger
    Public InterfaceIndex As UInteger
    Public pServiceInstance As IntPtr
    Public pRegisterCompletionCallback As IntPtr
    Public pQueryContext As IntPtr
    Public hCredentials As IntPtr
    <MarshalAs(UnmanagedType.Bool)> Public unicastEnabled As Boolean
End Structure
import ctypes
from ctypes import wintypes

class DNS_SERVICE_REGISTER_REQUEST(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("InterfaceIndex", wintypes.DWORD),
        ("pServiceInstance", ctypes.c_void_p),
        ("pRegisterCompletionCallback", ctypes.c_void_p),
        ("pQueryContext", ctypes.c_void_p),
        ("hCredentials", ctypes.c_void_p),
        ("unicastEnabled", wintypes.BOOL),
    ]
#[repr(C)]
pub struct DNS_SERVICE_REGISTER_REQUEST {
    pub Version: u32,
    pub InterfaceIndex: u32,
    pub pServiceInstance: *mut core::ffi::c_void,
    pub pRegisterCompletionCallback: *mut core::ffi::c_void,
    pub pQueryContext: *mut core::ffi::c_void,
    pub hCredentials: *mut core::ffi::c_void,
    pub unicastEnabled: i32,
}
import "golang.org/x/sys/windows"

type DNS_SERVICE_REGISTER_REQUEST struct {
	Version uint32
	InterfaceIndex uint32
	pServiceInstance uintptr
	pRegisterCompletionCallback uintptr
	pQueryContext uintptr
	hCredentials uintptr
	unicastEnabled int32
}
type
  DNS_SERVICE_REGISTER_REQUEST = record
    Version: DWORD;
    InterfaceIndex: DWORD;
    pServiceInstance: Pointer;
    pRegisterCompletionCallback: Pointer;
    pQueryContext: Pointer;
    hCredentials: Pointer;
    unicastEnabled: BOOL;
  end;
const DNS_SERVICE_REGISTER_REQUEST = extern struct {
    Version: u32,
    InterfaceIndex: u32,
    pServiceInstance: ?*anyopaque,
    pRegisterCompletionCallback: ?*anyopaque,
    pQueryContext: ?*anyopaque,
    hCredentials: ?*anyopaque,
    unicastEnabled: i32,
};
type
  DNS_SERVICE_REGISTER_REQUEST {.bycopy.} = object
    Version: uint32
    InterfaceIndex: uint32
    pServiceInstance: pointer
    pRegisterCompletionCallback: pointer
    pQueryContext: pointer
    hCredentials: pointer
    unicastEnabled: int32
struct DNS_SERVICE_REGISTER_REQUEST
{
    uint Version;
    uint InterfaceIndex;
    void* pServiceInstance;
    void* pRegisterCompletionCallback;
    void* pQueryContext;
    void* hCredentials;
    int unicastEnabled;
}

HSP用 定義

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

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

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