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

DHCP_SUBNET_INFO_VQ

構造体
サイズx64: 80 バイト / x86: 64 バイト

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

フィールド

フィールドサイズx64x86説明
SubnetAddressDWORD4+0+0サブネットのネットワークアドレスをDWORDで示す。
SubnetMaskDWORD4+4+4サブネットマスクをDWORDで示す。
SubnetNameLPWSTR8/4+8+8サブネットの表示名を示すワイド文字列。NULL可。
SubnetCommentLPWSTR8/4+16+12サブネットの説明コメントを示すワイド文字列。NULL可。
PrimaryHostDHCP_HOST_INFO24/12+24+16このサブネットを管理する主DHCPサーバーの情報を保持する。
SubnetStateDHCP_SUBNET_STATE4+48+28サブネットの状態を示すDHCP_SUBNET_STATE列挙値。
QuarantineOnDWORD4+52+32ネットワークアクセス保護(検疫)が有効かを示す。0以外で有効。
Reserved1DWORD4+56+36将来の使用のための予約フィールド。通常0。
Reserved2DWORD4+60+40将来の使用のための予約フィールド。通常0。
Reserved3LONGLONG8+64+48将来の使用のための予約フィールド(64ビット)。通常0。
Reserved4LONGLONG8+72+56将来の使用のための予約フィールド(64ビット)。通常0。

各言語での定義

#include <windows.h>

// DHCP_HOST_INFO  (x64 24 / x86 12 バイト)
typedef struct DHCP_HOST_INFO {
    DWORD IpAddress;
    LPWSTR NetBiosName;
    LPWSTR HostName;
} DHCP_HOST_INFO;

// DHCP_SUBNET_INFO_VQ  (x64 80 / x86 64 バイト)
typedef struct DHCP_SUBNET_INFO_VQ {
    DWORD SubnetAddress;
    DWORD SubnetMask;
    LPWSTR SubnetName;
    LPWSTR SubnetComment;
    DHCP_HOST_INFO PrimaryHost;
    DHCP_SUBNET_STATE SubnetState;
    DWORD QuarantineOn;
    DWORD Reserved1;
    DWORD Reserved2;
    LONGLONG Reserved3;
    LONGLONG Reserved4;
} DHCP_SUBNET_INFO_VQ;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DHCP_HOST_INFO
{
    public uint IpAddress;
    public IntPtr NetBiosName;
    public IntPtr HostName;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DHCP_SUBNET_INFO_VQ
{
    public uint SubnetAddress;
    public uint SubnetMask;
    public IntPtr SubnetName;
    public IntPtr SubnetComment;
    public DHCP_HOST_INFO PrimaryHost;
    public int SubnetState;
    public uint QuarantineOn;
    public uint Reserved1;
    public uint Reserved2;
    public long Reserved3;
    public long Reserved4;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DHCP_HOST_INFO
    Public IpAddress As UInteger
    Public NetBiosName As IntPtr
    Public HostName As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DHCP_SUBNET_INFO_VQ
    Public SubnetAddress As UInteger
    Public SubnetMask As UInteger
    Public SubnetName As IntPtr
    Public SubnetComment As IntPtr
    Public PrimaryHost As DHCP_HOST_INFO
    Public SubnetState As Integer
    Public QuarantineOn As UInteger
    Public Reserved1 As UInteger
    Public Reserved2 As UInteger
    Public Reserved3 As Long
    Public Reserved4 As Long
End Structure
import ctypes
from ctypes import wintypes

class DHCP_HOST_INFO(ctypes.Structure):
    _fields_ = [
        ("IpAddress", wintypes.DWORD),
        ("NetBiosName", ctypes.c_void_p),
        ("HostName", ctypes.c_void_p),
    ]

class DHCP_SUBNET_INFO_VQ(ctypes.Structure):
    _fields_ = [
        ("SubnetAddress", wintypes.DWORD),
        ("SubnetMask", wintypes.DWORD),
        ("SubnetName", ctypes.c_void_p),
        ("SubnetComment", ctypes.c_void_p),
        ("PrimaryHost", DHCP_HOST_INFO),
        ("SubnetState", ctypes.c_int),
        ("QuarantineOn", wintypes.DWORD),
        ("Reserved1", wintypes.DWORD),
        ("Reserved2", wintypes.DWORD),
        ("Reserved3", ctypes.c_longlong),
        ("Reserved4", ctypes.c_longlong),
    ]
#[repr(C)]
pub struct DHCP_HOST_INFO {
    pub IpAddress: u32,
    pub NetBiosName: *mut core::ffi::c_void,
    pub HostName: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct DHCP_SUBNET_INFO_VQ {
    pub SubnetAddress: u32,
    pub SubnetMask: u32,
    pub SubnetName: *mut core::ffi::c_void,
    pub SubnetComment: *mut core::ffi::c_void,
    pub PrimaryHost: DHCP_HOST_INFO,
    pub SubnetState: i32,
    pub QuarantineOn: u32,
    pub Reserved1: u32,
    pub Reserved2: u32,
    pub Reserved3: i64,
    pub Reserved4: i64,
}
import "golang.org/x/sys/windows"

type DHCP_HOST_INFO struct {
	IpAddress uint32
	NetBiosName uintptr
	HostName uintptr
}

type DHCP_SUBNET_INFO_VQ struct {
	SubnetAddress uint32
	SubnetMask uint32
	SubnetName uintptr
	SubnetComment uintptr
	PrimaryHost DHCP_HOST_INFO
	SubnetState int32
	QuarantineOn uint32
	Reserved1 uint32
	Reserved2 uint32
	Reserved3 int64
	Reserved4 int64
}
type
  DHCP_HOST_INFO = record
    IpAddress: DWORD;
    NetBiosName: Pointer;
    HostName: Pointer;
  end;

  DHCP_SUBNET_INFO_VQ = record
    SubnetAddress: DWORD;
    SubnetMask: DWORD;
    SubnetName: Pointer;
    SubnetComment: Pointer;
    PrimaryHost: DHCP_HOST_INFO;
    SubnetState: Integer;
    QuarantineOn: DWORD;
    Reserved1: DWORD;
    Reserved2: DWORD;
    Reserved3: Int64;
    Reserved4: Int64;
  end;
const DHCP_HOST_INFO = extern struct {
    IpAddress: u32,
    NetBiosName: ?*anyopaque,
    HostName: ?*anyopaque,
};

const DHCP_SUBNET_INFO_VQ = extern struct {
    SubnetAddress: u32,
    SubnetMask: u32,
    SubnetName: ?*anyopaque,
    SubnetComment: ?*anyopaque,
    PrimaryHost: DHCP_HOST_INFO,
    SubnetState: i32,
    QuarantineOn: u32,
    Reserved1: u32,
    Reserved2: u32,
    Reserved3: i64,
    Reserved4: i64,
};
type
  DHCP_HOST_INFO {.bycopy.} = object
    IpAddress: uint32
    NetBiosName: pointer
    HostName: pointer

  DHCP_SUBNET_INFO_VQ {.bycopy.} = object
    SubnetAddress: uint32
    SubnetMask: uint32
    SubnetName: pointer
    SubnetComment: pointer
    PrimaryHost: DHCP_HOST_INFO
    SubnetState: int32
    QuarantineOn: uint32
    Reserved1: uint32
    Reserved2: uint32
    Reserved3: int64
    Reserved4: int64
struct DHCP_HOST_INFO
{
    uint IpAddress;
    void* NetBiosName;
    void* HostName;
}

struct DHCP_SUBNET_INFO_VQ
{
    uint SubnetAddress;
    uint SubnetMask;
    void* SubnetName;
    void* SubnetComment;
    DHCP_HOST_INFO PrimaryHost;
    int SubnetState;
    uint QuarantineOn;
    uint Reserved1;
    uint Reserved2;
    long Reserved3;
    long Reserved4;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DHCP_SUBNET_INFO_VQ サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; SubnetAddress : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; SubnetMask : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; SubnetName : LPWSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; SubnetComment : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; PrimaryHost : DHCP_HOST_INFO (+16, 12byte)  varptr(st)+16 を基点に操作(12byte:入れ子/配列)
; SubnetState : DHCP_SUBNET_STATE (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; QuarantineOn : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; Reserved1 : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; Reserved2 : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; Reserved3 : LONGLONG (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; Reserved4 : LONGLONG (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DHCP_SUBNET_INFO_VQ サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; SubnetAddress : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; SubnetMask : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; SubnetName : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; SubnetComment : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; PrimaryHost : DHCP_HOST_INFO (+24, 24byte)  varptr(st)+24 を基点に操作(24byte:入れ子/配列)
; SubnetState : DHCP_SUBNET_STATE (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; QuarantineOn : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; Reserved1 : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; Reserved2 : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; Reserved3 : LONGLONG (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; Reserved4 : LONGLONG (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DHCP_HOST_INFO
    #field int IpAddress
    #field intptr NetBiosName
    #field intptr HostName
#endstruct

#defstruct global DHCP_SUBNET_INFO_VQ
    #field int SubnetAddress
    #field int SubnetMask
    #field intptr SubnetName
    #field intptr SubnetComment
    #field DHCP_HOST_INFO PrimaryHost
    #field int SubnetState
    #field int QuarantineOn
    #field int Reserved1
    #field int Reserved2
    #field int64 Reserved3
    #field int64 Reserved4
#endstruct

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