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

DHCPDS_SERVER

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0サーバーエントリの構造体バージョンを示す。
ServerNameLPWSTR8/4+8+4DHCPサーバーの名前を示すワイド文字列。NULL可。
ServerAddressDWORD4+16+8DHCPサーバーのIPアドレスをDWORDで示す。
FlagsDWORD4+20+12サーバーエントリの属性を示すフラグ。
StateDWORD4+24+16サーバーの状態を示す値。
DsLocationLPWSTR8/4+32+20ディレクトリサービス上の位置(DN)を示すワイド文字列。NULL可。
DsLocTypeDWORD4+40+24DsLocationの種別を示す値。

各言語での定義

#include <windows.h>

// DHCPDS_SERVER  (x64 48 / x86 28 バイト)
typedef struct DHCPDS_SERVER {
    DWORD Version;
    LPWSTR ServerName;
    DWORD ServerAddress;
    DWORD Flags;
    DWORD State;
    LPWSTR DsLocation;
    DWORD DsLocType;
} DHCPDS_SERVER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DHCPDS_SERVER
{
    public uint Version;
    public IntPtr ServerName;
    public uint ServerAddress;
    public uint Flags;
    public uint State;
    public IntPtr DsLocation;
    public uint DsLocType;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DHCPDS_SERVER
    Public Version As UInteger
    Public ServerName As IntPtr
    Public ServerAddress As UInteger
    Public Flags As UInteger
    Public State As UInteger
    Public DsLocation As IntPtr
    Public DsLocType As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DHCPDS_SERVER(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("ServerName", ctypes.c_void_p),
        ("ServerAddress", wintypes.DWORD),
        ("Flags", wintypes.DWORD),
        ("State", wintypes.DWORD),
        ("DsLocation", ctypes.c_void_p),
        ("DsLocType", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DHCPDS_SERVER {
    pub Version: u32,
    pub ServerName: *mut core::ffi::c_void,
    pub ServerAddress: u32,
    pub Flags: u32,
    pub State: u32,
    pub DsLocation: *mut core::ffi::c_void,
    pub DsLocType: u32,
}
import "golang.org/x/sys/windows"

type DHCPDS_SERVER struct {
	Version uint32
	ServerName uintptr
	ServerAddress uint32
	Flags uint32
	State uint32
	DsLocation uintptr
	DsLocType uint32
}
type
  DHCPDS_SERVER = record
    Version: DWORD;
    ServerName: Pointer;
    ServerAddress: DWORD;
    Flags: DWORD;
    State: DWORD;
    DsLocation: Pointer;
    DsLocType: DWORD;
  end;
const DHCPDS_SERVER = extern struct {
    Version: u32,
    ServerName: ?*anyopaque,
    ServerAddress: u32,
    Flags: u32,
    State: u32,
    DsLocation: ?*anyopaque,
    DsLocType: u32,
};
type
  DHCPDS_SERVER {.bycopy.} = object
    Version: uint32
    ServerName: pointer
    ServerAddress: uint32
    Flags: uint32
    State: uint32
    DsLocation: pointer
    DsLocType: uint32
struct DHCPDS_SERVER
{
    uint Version;
    void* ServerName;
    uint ServerAddress;
    uint Flags;
    uint State;
    void* DsLocation;
    uint DsLocType;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DHCPDS_SERVER サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ServerName : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ServerAddress : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Flags : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; State : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; DsLocation : LPWSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; DsLocType : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DHCPDS_SERVER サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ServerName : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ServerAddress : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Flags : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; State : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; DsLocation : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; DsLocType : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DHCPDS_SERVER
    #field int Version
    #field intptr ServerName
    #field int ServerAddress
    #field int Flags
    #field int State
    #field intptr DsLocation
    #field int DsLocType
#endstruct

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