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

DRT_SEARCH_INFO

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のサイズをバイト単位で示す値。
fIterativeBOOL4+4+4反復検索を行うかを示すBOOL値。
fAllowCurrentInstanceMatchBOOL4+8+8自インスタンスとの一致を許可するかを示すBOOL値。
fAnyMatchInRangeBOOL4+12+12範囲内の任意一致を許容するかを示すBOOL値。
cMaxEndpointsDWORD4+16+16返す最大エンドポイント数。
pMaximumKeyDRT_DATA*8/4+24+20検索範囲の上限キーを示すDRT_DATAへのポインタ。
pMinimumKeyDRT_DATA*8/4+32+24検索範囲の下限キーを示すDRT_DATAへのポインタ。

各言語での定義

#include <windows.h>

// DRT_SEARCH_INFO  (x64 40 / x86 28 バイト)
typedef struct DRT_SEARCH_INFO {
    DWORD dwSize;
    BOOL fIterative;
    BOOL fAllowCurrentInstanceMatch;
    BOOL fAnyMatchInRange;
    DWORD cMaxEndpoints;
    DRT_DATA* pMaximumKey;
    DRT_DATA* pMinimumKey;
} DRT_SEARCH_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DRT_SEARCH_INFO
{
    public uint dwSize;
    [MarshalAs(UnmanagedType.Bool)] public bool fIterative;
    [MarshalAs(UnmanagedType.Bool)] public bool fAllowCurrentInstanceMatch;
    [MarshalAs(UnmanagedType.Bool)] public bool fAnyMatchInRange;
    public uint cMaxEndpoints;
    public IntPtr pMaximumKey;
    public IntPtr pMinimumKey;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DRT_SEARCH_INFO
    Public dwSize As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public fIterative As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fAllowCurrentInstanceMatch As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fAnyMatchInRange As Boolean
    Public cMaxEndpoints As UInteger
    Public pMaximumKey As IntPtr
    Public pMinimumKey As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DRT_SEARCH_INFO(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("fIterative", wintypes.BOOL),
        ("fAllowCurrentInstanceMatch", wintypes.BOOL),
        ("fAnyMatchInRange", wintypes.BOOL),
        ("cMaxEndpoints", wintypes.DWORD),
        ("pMaximumKey", ctypes.c_void_p),
        ("pMinimumKey", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DRT_SEARCH_INFO {
    pub dwSize: u32,
    pub fIterative: i32,
    pub fAllowCurrentInstanceMatch: i32,
    pub fAnyMatchInRange: i32,
    pub cMaxEndpoints: u32,
    pub pMaximumKey: *mut core::ffi::c_void,
    pub pMinimumKey: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DRT_SEARCH_INFO struct {
	dwSize uint32
	fIterative int32
	fAllowCurrentInstanceMatch int32
	fAnyMatchInRange int32
	cMaxEndpoints uint32
	pMaximumKey uintptr
	pMinimumKey uintptr
}
type
  DRT_SEARCH_INFO = record
    dwSize: DWORD;
    fIterative: BOOL;
    fAllowCurrentInstanceMatch: BOOL;
    fAnyMatchInRange: BOOL;
    cMaxEndpoints: DWORD;
    pMaximumKey: Pointer;
    pMinimumKey: Pointer;
  end;
const DRT_SEARCH_INFO = extern struct {
    dwSize: u32,
    fIterative: i32,
    fAllowCurrentInstanceMatch: i32,
    fAnyMatchInRange: i32,
    cMaxEndpoints: u32,
    pMaximumKey: ?*anyopaque,
    pMinimumKey: ?*anyopaque,
};
type
  DRT_SEARCH_INFO {.bycopy.} = object
    dwSize: uint32
    fIterative: int32
    fAllowCurrentInstanceMatch: int32
    fAnyMatchInRange: int32
    cMaxEndpoints: uint32
    pMaximumKey: pointer
    pMinimumKey: pointer
struct DRT_SEARCH_INFO
{
    uint dwSize;
    int fIterative;
    int fAllowCurrentInstanceMatch;
    int fAnyMatchInRange;
    uint cMaxEndpoints;
    void* pMaximumKey;
    void* pMinimumKey;
}

HSP用 定義

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

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

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