ホーム › NetworkManagement.Dhcp › DHCP_ATTRIB
DHCP_ATTRIB
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| DhcpAttribId | DWORD | 4 | +0 | +0 | 属性の識別子を示す。 |
| DhcpAttribType | DWORD | 4 | +4 | +4 | 属性値の型(ブール/ULONG等)を示す。 |
| Anonymous | _Anonymous_e__Union | 4 | +8 | +8 | DhcpAttribTypeに応じた属性値を保持する無名共用体。 |
共用体: _Anonymous_e__Union x64 4B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| DhcpAttribBool | BOOL | 4 | +0 | +0 |
| DhcpAttribUlong | DWORD | 4 | +0 | +0 |
各言語での定義
#include <windows.h>
// DHCP_ATTRIB (x64 12 / x86 12 バイト)
typedef struct DHCP_ATTRIB {
DWORD DhcpAttribId;
DWORD DhcpAttribType;
_Anonymous_e__Union Anonymous;
} DHCP_ATTRIB;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DHCP_ATTRIB
{
public uint DhcpAttribId;
public uint DhcpAttribType;
public _Anonymous_e__Union Anonymous;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DHCP_ATTRIB
Public DhcpAttribId As UInteger
Public DhcpAttribType As UInteger
Public Anonymous As _Anonymous_e__Union
End Structureimport ctypes
from ctypes import wintypes
class DHCP_ATTRIB(ctypes.Structure):
_fields_ = [
("DhcpAttribId", wintypes.DWORD),
("DhcpAttribType", wintypes.DWORD),
("Anonymous", _Anonymous_e__Union),
]#[repr(C)]
pub struct DHCP_ATTRIB {
pub DhcpAttribId: u32,
pub DhcpAttribType: u32,
pub Anonymous: _Anonymous_e__Union,
}import "golang.org/x/sys/windows"
type DHCP_ATTRIB struct {
DhcpAttribId uint32
DhcpAttribType uint32
Anonymous _Anonymous_e__Union
}type
DHCP_ATTRIB = record
DhcpAttribId: DWORD;
DhcpAttribType: DWORD;
Anonymous: _Anonymous_e__Union;
end;const DHCP_ATTRIB = extern struct {
DhcpAttribId: u32,
DhcpAttribType: u32,
Anonymous: _Anonymous_e__Union,
};type
DHCP_ATTRIB {.bycopy.} = object
DhcpAttribId: uint32
DhcpAttribType: uint32
Anonymous: _Anonymous_e__Unionstruct DHCP_ATTRIB
{
uint DhcpAttribId;
uint DhcpAttribType;
_Anonymous_e__Union Anonymous;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DHCP_ATTRIB サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; DhcpAttribId : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; DhcpAttribType : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DHCP_ATTRIB
#field int DhcpAttribId
#field int DhcpAttribType
#field byte Anonymous 4
#endstruct
stdim st, DHCP_ATTRIB ; NSTRUCT 変数を確保
st->DhcpAttribId = 100
mes "DhcpAttribId=" + st->DhcpAttribId
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。