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

DNS_SERVICE_RESOLVE_REQUEST

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0構造体のバージョン番号を示す。
InterfaceIndexDWORD4+4+4解決に使用するネットワークインターフェースのインデックス。0で自動選択。
QueryNameLPWSTR8/4+8+8解決対象のサービスインスタンス名を表すワイド文字列ポインタ。
pResolveCompletionCallbackPDNS_SERVICE_RESOLVE_COMPLETE8/4+16+12解決完了時に呼ばれるコールバック関数のポインタ。
pQueryContextvoid*8/4+24+16コールバックに渡されるユーザ定義コンテキストポインタ。NULL可。

各言語での定義

#include <windows.h>

// DNS_SERVICE_RESOLVE_REQUEST  (x64 32 / x86 20 バイト)
typedef struct DNS_SERVICE_RESOLVE_REQUEST {
    DWORD Version;
    DWORD InterfaceIndex;
    LPWSTR QueryName;
    PDNS_SERVICE_RESOLVE_COMPLETE pResolveCompletionCallback;
    void* pQueryContext;
} DNS_SERVICE_RESOLVE_REQUEST;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DNS_SERVICE_RESOLVE_REQUEST
{
    public uint Version;
    public uint InterfaceIndex;
    public IntPtr QueryName;
    public IntPtr pResolveCompletionCallback;
    public IntPtr pQueryContext;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DNS_SERVICE_RESOLVE_REQUEST
    Public Version As UInteger
    Public InterfaceIndex As UInteger
    Public QueryName As IntPtr
    Public pResolveCompletionCallback As IntPtr
    Public pQueryContext As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DNS_SERVICE_RESOLVE_REQUEST(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("InterfaceIndex", wintypes.DWORD),
        ("QueryName", ctypes.c_void_p),
        ("pResolveCompletionCallback", ctypes.c_void_p),
        ("pQueryContext", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DNS_SERVICE_RESOLVE_REQUEST {
    pub Version: u32,
    pub InterfaceIndex: u32,
    pub QueryName: *mut core::ffi::c_void,
    pub pResolveCompletionCallback: *mut core::ffi::c_void,
    pub pQueryContext: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DNS_SERVICE_RESOLVE_REQUEST struct {
	Version uint32
	InterfaceIndex uint32
	QueryName uintptr
	pResolveCompletionCallback uintptr
	pQueryContext uintptr
}
type
  DNS_SERVICE_RESOLVE_REQUEST = record
    Version: DWORD;
    InterfaceIndex: DWORD;
    QueryName: Pointer;
    pResolveCompletionCallback: Pointer;
    pQueryContext: Pointer;
  end;
const DNS_SERVICE_RESOLVE_REQUEST = extern struct {
    Version: u32,
    InterfaceIndex: u32,
    QueryName: ?*anyopaque,
    pResolveCompletionCallback: ?*anyopaque,
    pQueryContext: ?*anyopaque,
};
type
  DNS_SERVICE_RESOLVE_REQUEST {.bycopy.} = object
    Version: uint32
    InterfaceIndex: uint32
    QueryName: pointer
    pResolveCompletionCallback: pointer
    pQueryContext: pointer
struct DNS_SERVICE_RESOLVE_REQUEST
{
    uint Version;
    uint InterfaceIndex;
    void* QueryName;
    void* pResolveCompletionCallback;
    void* pQueryContext;
}

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_RESOLVE_REQUEST サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; InterfaceIndex : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; QueryName : LPWSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pResolveCompletionCallback : PDNS_SERVICE_RESOLVE_COMPLETE (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pQueryContext : void* (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DNS_SERVICE_RESOLVE_REQUEST サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; InterfaceIndex : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; QueryName : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pResolveCompletionCallback : PDNS_SERVICE_RESOLVE_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,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DNS_SERVICE_RESOLVE_REQUEST
    #field int Version
    #field int InterfaceIndex
    #field intptr QueryName
    #field intptr pResolveCompletionCallback
    #field intptr pQueryContext
#endstruct

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