ホーム › NetworkManagement.Dhcp › DHCP_BIND_ELEMENT
DHCP_BIND_ELEMENT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Flags | DWORD | 4 | +0 | +0 | バインド要素の属性を示すフラグ。 |
| fBoundToDHCPServer | BOOL | 4 | +4 | +4 | このエンドポイントがDHCPサーバーにバインドされているかを示すブール値。 |
| AdapterPrimaryAddress | DWORD | 4 | +8 | +8 | アダプターのプライマリIPアドレスをDWORDで示す。 |
| AdapterSubnetAddress | DWORD | 4 | +12 | +12 | アダプターが属するサブネットアドレスをDWORDで示す。 |
| IfDescription | LPWSTR | 8/4 | +16 | +16 | ネットワークインターフェイスの説明を示すワイド文字列。NULL可。 |
| IfIdSize | DWORD | 4 | +24 | +20 | IfIdのバイト数を示す。 |
| IfId | BYTE* | 8/4 | +32 | +24 | インターフェイス識別子のバイト列を指すポインタ。NULL可。 |
各言語での定義
#include <windows.h>
// DHCP_BIND_ELEMENT (x64 40 / x86 28 バイト)
typedef struct DHCP_BIND_ELEMENT {
DWORD Flags;
BOOL fBoundToDHCPServer;
DWORD AdapterPrimaryAddress;
DWORD AdapterSubnetAddress;
LPWSTR IfDescription;
DWORD IfIdSize;
BYTE* IfId;
} DHCP_BIND_ELEMENT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DHCP_BIND_ELEMENT
{
public uint Flags;
[MarshalAs(UnmanagedType.Bool)] public bool fBoundToDHCPServer;
public uint AdapterPrimaryAddress;
public uint AdapterSubnetAddress;
public IntPtr IfDescription;
public uint IfIdSize;
public IntPtr IfId;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DHCP_BIND_ELEMENT
Public Flags As UInteger
<MarshalAs(UnmanagedType.Bool)> Public fBoundToDHCPServer As Boolean
Public AdapterPrimaryAddress As UInteger
Public AdapterSubnetAddress As UInteger
Public IfDescription As IntPtr
Public IfIdSize As UInteger
Public IfId As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class DHCP_BIND_ELEMENT(ctypes.Structure):
_fields_ = [
("Flags", wintypes.DWORD),
("fBoundToDHCPServer", wintypes.BOOL),
("AdapterPrimaryAddress", wintypes.DWORD),
("AdapterSubnetAddress", wintypes.DWORD),
("IfDescription", ctypes.c_void_p),
("IfIdSize", wintypes.DWORD),
("IfId", ctypes.c_void_p),
]#[repr(C)]
pub struct DHCP_BIND_ELEMENT {
pub Flags: u32,
pub fBoundToDHCPServer: i32,
pub AdapterPrimaryAddress: u32,
pub AdapterSubnetAddress: u32,
pub IfDescription: *mut core::ffi::c_void,
pub IfIdSize: u32,
pub IfId: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type DHCP_BIND_ELEMENT struct {
Flags uint32
fBoundToDHCPServer int32
AdapterPrimaryAddress uint32
AdapterSubnetAddress uint32
IfDescription uintptr
IfIdSize uint32
IfId uintptr
}type
DHCP_BIND_ELEMENT = record
Flags: DWORD;
fBoundToDHCPServer: BOOL;
AdapterPrimaryAddress: DWORD;
AdapterSubnetAddress: DWORD;
IfDescription: Pointer;
IfIdSize: DWORD;
IfId: Pointer;
end;const DHCP_BIND_ELEMENT = extern struct {
Flags: u32,
fBoundToDHCPServer: i32,
AdapterPrimaryAddress: u32,
AdapterSubnetAddress: u32,
IfDescription: ?*anyopaque,
IfIdSize: u32,
IfId: ?*anyopaque,
};type
DHCP_BIND_ELEMENT {.bycopy.} = object
Flags: uint32
fBoundToDHCPServer: int32
AdapterPrimaryAddress: uint32
AdapterSubnetAddress: uint32
IfDescription: pointer
IfIdSize: uint32
IfId: pointerstruct DHCP_BIND_ELEMENT
{
uint Flags;
int fBoundToDHCPServer;
uint AdapterPrimaryAddress;
uint AdapterSubnetAddress;
void* IfDescription;
uint IfIdSize;
void* IfId;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DHCP_BIND_ELEMENT サイズ: 28 バイト(x86)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; Flags : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fBoundToDHCPServer : BOOL (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; AdapterPrimaryAddress : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; AdapterSubnetAddress : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; IfDescription : LPWSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; IfIdSize : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; IfId : BYTE* (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DHCP_BIND_ELEMENT サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Flags : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fBoundToDHCPServer : BOOL (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; AdapterPrimaryAddress : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; AdapterSubnetAddress : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; IfDescription : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; IfIdSize : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; IfId : BYTE* (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DHCP_BIND_ELEMENT
#field int Flags
#field bool fBoundToDHCPServer
#field int AdapterPrimaryAddress
#field int AdapterSubnetAddress
#field intptr IfDescription
#field int IfIdSize
#field intptr IfId
#endstruct
stdim st, DHCP_BIND_ELEMENT ; NSTRUCT 変数を確保
st->Flags = 100
mes "Flags=" + st->Flags