Win32 API 日本語リファレンス
ホームNetworking.Clustering › CLUSPROP_WORD

CLUSPROP_WORD

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

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

フィールド

フィールドサイズx64x86説明
BaseCLUSPROP_VALUE8+0+0値ヘッダ(構文とデータ長)を表すCLUSPROP_VALUE。
wWORD2+8+816ビットワード(WORD)型の値本体。

各言語での定義

#include <windows.h>

// CLUSPROP_SYNTAX  (x64 4 / x86 4 バイト)
typedef struct CLUSPROP_SYNTAX {
    DWORD dw;
    _Anonymous_e__Struct Anonymous;
} CLUSPROP_SYNTAX;

// CLUSPROP_VALUE  (x64 8 / x86 8 バイト)
typedef struct CLUSPROP_VALUE {
    CLUSPROP_SYNTAX Syntax;
    DWORD cbLength;
} CLUSPROP_VALUE;

// CLUSPROP_WORD  (x64 12 / x86 12 バイト)
typedef struct CLUSPROP_WORD {
    CLUSPROP_VALUE Base;
    WORD w;
} CLUSPROP_WORD;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLUSPROP_SYNTAX
{
    public uint dw;
    public _Anonymous_e__Struct Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLUSPROP_VALUE
{
    public CLUSPROP_SYNTAX Syntax;
    public uint cbLength;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLUSPROP_WORD
{
    public CLUSPROP_VALUE Base;
    public ushort w;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLUSPROP_SYNTAX
    Public dw As UInteger
    Public Anonymous As _Anonymous_e__Struct
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLUSPROP_VALUE
    Public Syntax As CLUSPROP_SYNTAX
    Public cbLength As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLUSPROP_WORD
    Public Base As CLUSPROP_VALUE
    Public w As UShort
End Structure
import ctypes
from ctypes import wintypes

class CLUSPROP_SYNTAX(ctypes.Structure):
    _fields_ = [
        ("dw", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Struct),
    ]

class CLUSPROP_VALUE(ctypes.Structure):
    _fields_ = [
        ("Syntax", CLUSPROP_SYNTAX),
        ("cbLength", wintypes.DWORD),
    ]

class CLUSPROP_WORD(ctypes.Structure):
    _fields_ = [
        ("Base", CLUSPROP_VALUE),
        ("w", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct CLUSPROP_SYNTAX {
    pub dw: u32,
    pub Anonymous: _Anonymous_e__Struct,
}

#[repr(C)]
pub struct CLUSPROP_VALUE {
    pub Syntax: CLUSPROP_SYNTAX,
    pub cbLength: u32,
}

#[repr(C)]
pub struct CLUSPROP_WORD {
    pub Base: CLUSPROP_VALUE,
    pub w: u16,
}
import "golang.org/x/sys/windows"

type CLUSPROP_SYNTAX struct {
	dw uint32
	Anonymous _Anonymous_e__Struct
}

type CLUSPROP_VALUE struct {
	Syntax CLUSPROP_SYNTAX
	cbLength uint32
}

type CLUSPROP_WORD struct {
	Base CLUSPROP_VALUE
	w uint16
}
type
  CLUSPROP_SYNTAX = record
    dw: DWORD;
    Anonymous: _Anonymous_e__Struct;
  end;

  CLUSPROP_VALUE = record
    Syntax: CLUSPROP_SYNTAX;
    cbLength: DWORD;
  end;

  CLUSPROP_WORD = record
    Base: CLUSPROP_VALUE;
    w: Word;
  end;
const CLUSPROP_SYNTAX = extern struct {
    dw: u32,
    Anonymous: _Anonymous_e__Struct,
};

const CLUSPROP_VALUE = extern struct {
    Syntax: CLUSPROP_SYNTAX,
    cbLength: u32,
};

const CLUSPROP_WORD = extern struct {
    Base: CLUSPROP_VALUE,
    w: u16,
};
type
  CLUSPROP_SYNTAX {.bycopy.} = object
    dw: uint32
    Anonymous: _Anonymous_e__Struct

  CLUSPROP_VALUE {.bycopy.} = object
    Syntax: CLUSPROP_SYNTAX
    cbLength: uint32

  CLUSPROP_WORD {.bycopy.} = object
    Base: CLUSPROP_VALUE
    w: uint16
struct CLUSPROP_SYNTAX
{
    uint dw;
    _Anonymous_e__Struct Anonymous;
}

struct CLUSPROP_VALUE
{
    CLUSPROP_SYNTAX Syntax;
    uint cbLength;
}

struct CLUSPROP_WORD
{
    CLUSPROP_VALUE Base;
    ushort w;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CLUSPROP_WORD サイズ: 12 バイト(x64)
dim st, 3    ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; Base : CLUSPROP_VALUE (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; w : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global CLUSPROP_VALUE
    #field byte Syntax 4
    #field int cbLength
#endstruct

#defstruct global CLUSPROP_WORD
    #field CLUSPROP_VALUE Base
    #field short w
#endstruct

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