ホーム › NetworkManagement.Dhcp › DHCP_SUBNET_INFO
DHCP_SUBNET_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SubnetAddress | DWORD | 4 | +0 | +0 | サブネットのネットワークアドレスをDWORDで示す。 |
| SubnetMask | DWORD | 4 | +4 | +4 | サブネットマスクをDWORDで示す。 |
| SubnetName | LPWSTR | 8/4 | +8 | +8 | サブネットの表示名を示すワイド文字列。NULL可。 |
| SubnetComment | LPWSTR | 8/4 | +16 | +12 | サブネットの説明コメントを示すワイド文字列。NULL可。 |
| PrimaryHost | DHCP_HOST_INFO | 24/12 | +24 | +16 | このサブネットを管理する主DHCPサーバーの情報を保持する。 |
| SubnetState | DHCP_SUBNET_STATE | 4 | +48 | +28 | サブネットの状態を示すDHCP_SUBNET_STATE列挙値。有効/無効等を表す。 |
各言語での定義
#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 (x64 56 / x86 32 バイト)
typedef struct DHCP_SUBNET_INFO {
DWORD SubnetAddress;
DWORD SubnetMask;
LPWSTR SubnetName;
LPWSTR SubnetComment;
DHCP_HOST_INFO PrimaryHost;
DHCP_SUBNET_STATE SubnetState;
} DHCP_SUBNET_INFO;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
{
public uint SubnetAddress;
public uint SubnetMask;
public IntPtr SubnetName;
public IntPtr SubnetComment;
public DHCP_HOST_INFO PrimaryHost;
public int SubnetState;
}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
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
End Structureimport 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(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),
]#[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 {
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,
}import "golang.org/x/sys/windows"
type DHCP_HOST_INFO struct {
IpAddress uint32
NetBiosName uintptr
HostName uintptr
}
type DHCP_SUBNET_INFO struct {
SubnetAddress uint32
SubnetMask uint32
SubnetName uintptr
SubnetComment uintptr
PrimaryHost DHCP_HOST_INFO
SubnetState int32
}type
DHCP_HOST_INFO = record
IpAddress: DWORD;
NetBiosName: Pointer;
HostName: Pointer;
end;
DHCP_SUBNET_INFO = record
SubnetAddress: DWORD;
SubnetMask: DWORD;
SubnetName: Pointer;
SubnetComment: Pointer;
PrimaryHost: DHCP_HOST_INFO;
SubnetState: Integer;
end;const DHCP_HOST_INFO = extern struct {
IpAddress: u32,
NetBiosName: ?*anyopaque,
HostName: ?*anyopaque,
};
const DHCP_SUBNET_INFO = extern struct {
SubnetAddress: u32,
SubnetMask: u32,
SubnetName: ?*anyopaque,
SubnetComment: ?*anyopaque,
PrimaryHost: DHCP_HOST_INFO,
SubnetState: i32,
};type
DHCP_HOST_INFO {.bycopy.} = object
IpAddress: uint32
NetBiosName: pointer
HostName: pointer
DHCP_SUBNET_INFO {.bycopy.} = object
SubnetAddress: uint32
SubnetMask: uint32
SubnetName: pointer
SubnetComment: pointer
PrimaryHost: DHCP_HOST_INFO
SubnetState: int32struct DHCP_HOST_INFO
{
uint IpAddress;
void* NetBiosName;
void* HostName;
}
struct DHCP_SUBNET_INFO
{
uint SubnetAddress;
uint SubnetMask;
void* SubnetName;
void* SubnetComment;
DHCP_HOST_INFO PrimaryHost;
int SubnetState;
}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 サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 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 も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DHCP_SUBNET_INFO サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 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 も可)
; ※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
#field int SubnetAddress
#field int SubnetMask
#field intptr SubnetName
#field intptr SubnetComment
#field DHCP_HOST_INFO PrimaryHost
#field int SubnetState
#endstruct
stdim st, DHCP_SUBNET_INFO ; NSTRUCT 変数を確保
st->SubnetAddress = 100
mes "SubnetAddress=" + st->SubnetAddress