ホーム › NetworkManagement.Dns › DNS_SERVICE_BROWSE_REQUEST
DNS_SERVICE_BROWSE_REQUEST
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | 構造体のバージョン番号を示す。 |
| InterfaceIndex | DWORD | 4 | +4 | +4 | 参照に使用するネットワークインターフェースのインデックス。0で全て。 |
| QueryName | LPWSTR | 8/4 | +8 | +8 | 参照対象のサービス種別名を表すワイド文字列ポインタ。 |
| Anonymous | _Anonymous_e__Union | 8/4 | +16 | +12 | 参照結果を受け取るコールバック関数を保持する無名共用体。 |
| pQueryContext | void* | 8/4 | +24 | +16 | コールバックに渡されるユーザ定義コンテキストポインタ。NULL可。 |
共用体: _Anonymous_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| pBrowseCallback | PDNS_SERVICE_BROWSE_CALLBACK | 8/4 | +0 | +0 |
| pBrowseCallbackV2 | PDNS_QUERY_COMPLETION_ROUTINE | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// DNS_SERVICE_BROWSE_REQUEST (x64 32 / x86 20 バイト)
typedef struct DNS_SERVICE_BROWSE_REQUEST {
DWORD Version;
DWORD InterfaceIndex;
LPWSTR QueryName;
_Anonymous_e__Union Anonymous;
void* pQueryContext;
} DNS_SERVICE_BROWSE_REQUEST;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DNS_SERVICE_BROWSE_REQUEST
{
public uint Version;
public uint InterfaceIndex;
public IntPtr QueryName;
public _Anonymous_e__Union Anonymous;
public IntPtr pQueryContext;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DNS_SERVICE_BROWSE_REQUEST
Public Version As UInteger
Public InterfaceIndex As UInteger
Public QueryName As IntPtr
Public Anonymous As _Anonymous_e__Union
Public pQueryContext As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class DNS_SERVICE_BROWSE_REQUEST(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("InterfaceIndex", wintypes.DWORD),
("QueryName", ctypes.c_void_p),
("Anonymous", _Anonymous_e__Union),
("pQueryContext", ctypes.c_void_p),
]#[repr(C)]
pub struct DNS_SERVICE_BROWSE_REQUEST {
pub Version: u32,
pub InterfaceIndex: u32,
pub QueryName: *mut core::ffi::c_void,
pub Anonymous: _Anonymous_e__Union,
pub pQueryContext: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type DNS_SERVICE_BROWSE_REQUEST struct {
Version uint32
InterfaceIndex uint32
QueryName uintptr
Anonymous _Anonymous_e__Union
pQueryContext uintptr
}type
DNS_SERVICE_BROWSE_REQUEST = record
Version: DWORD;
InterfaceIndex: DWORD;
QueryName: Pointer;
Anonymous: _Anonymous_e__Union;
pQueryContext: Pointer;
end;const DNS_SERVICE_BROWSE_REQUEST = extern struct {
Version: u32,
InterfaceIndex: u32,
QueryName: ?*anyopaque,
Anonymous: _Anonymous_e__Union,
pQueryContext: ?*anyopaque,
};type
DNS_SERVICE_BROWSE_REQUEST {.bycopy.} = object
Version: uint32
InterfaceIndex: uint32
QueryName: pointer
Anonymous: _Anonymous_e__Union
pQueryContext: pointerstruct DNS_SERVICE_BROWSE_REQUEST
{
uint Version;
uint InterfaceIndex;
void* QueryName;
_Anonymous_e__Union Anonymous;
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_BROWSE_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 も可)
; Anonymous : _Anonymous_e__Union (+12, 4byte) varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; 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_BROWSE_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,上位
; Anonymous : _Anonymous_e__Union (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; 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_BROWSE_REQUEST
#field int Version
#field int InterfaceIndex
#field intptr QueryName
#field byte Anonymous 8
#field intptr pQueryContext
#endstruct
stdim st, DNS_SERVICE_BROWSE_REQUEST ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。