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

CLUSPROP_LIST

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

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

フィールド

フィールドサイズx64x86説明
nPropertyCountDWORD4+0+0プロパティリストに含まれるプロパティの個数である。
PropertyNameCLUSPROP_SZ12+4+4先頭プロパティの名前(CLUSPROP_SZ)である。以降に値が連続するプロパティリスト本体が続く。

各言語での定義

#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_SZ  (x64 12 / x86 12 バイト)
typedef struct CLUSPROP_SZ {
    CLUSPROP_VALUE Base;
    WCHAR sz[1];
} CLUSPROP_SZ;

// CLUSPROP_LIST  (x64 16 / x86 16 バイト)
typedef struct CLUSPROP_LIST {
    DWORD nPropertyCount;
    CLUSPROP_SZ PropertyName;
} CLUSPROP_LIST;
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_SZ
{
    public CLUSPROP_VALUE Base;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string sz;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLUSPROP_LIST
{
    public uint nPropertyCount;
    public CLUSPROP_SZ PropertyName;
}
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_SZ
    Public Base As CLUSPROP_VALUE
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public sz As String
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLUSPROP_LIST
    Public nPropertyCount As UInteger
    Public PropertyName As CLUSPROP_SZ
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_SZ(ctypes.Structure):
    _fields_ = [
        ("Base", CLUSPROP_VALUE),
        ("sz", ctypes.c_wchar * 1),
    ]

class CLUSPROP_LIST(ctypes.Structure):
    _fields_ = [
        ("nPropertyCount", wintypes.DWORD),
        ("PropertyName", CLUSPROP_SZ),
    ]
#[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_SZ {
    pub Base: CLUSPROP_VALUE,
    pub sz: [u16; 1],
}

#[repr(C)]
pub struct CLUSPROP_LIST {
    pub nPropertyCount: u32,
    pub PropertyName: CLUSPROP_SZ,
}
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_SZ struct {
	Base CLUSPROP_VALUE
	sz [1]uint16
}

type CLUSPROP_LIST struct {
	nPropertyCount uint32
	PropertyName CLUSPROP_SZ
}
type
  CLUSPROP_SYNTAX = record
    dw: DWORD;
    Anonymous: _Anonymous_e__Struct;
  end;

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

  CLUSPROP_SZ = record
    Base: CLUSPROP_VALUE;
    sz: array[0..0] of WideChar;
  end;

  CLUSPROP_LIST = record
    nPropertyCount: DWORD;
    PropertyName: CLUSPROP_SZ;
  end;
const CLUSPROP_SYNTAX = extern struct {
    dw: u32,
    Anonymous: _Anonymous_e__Struct,
};

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

const CLUSPROP_SZ = extern struct {
    Base: CLUSPROP_VALUE,
    sz: [1]u16,
};

const CLUSPROP_LIST = extern struct {
    nPropertyCount: u32,
    PropertyName: CLUSPROP_SZ,
};
type
  CLUSPROP_SYNTAX {.bycopy.} = object
    dw: uint32
    Anonymous: _Anonymous_e__Struct

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

  CLUSPROP_SZ {.bycopy.} = object
    Base: CLUSPROP_VALUE
    sz: array[1, uint16]

  CLUSPROP_LIST {.bycopy.} = object
    nPropertyCount: uint32
    PropertyName: CLUSPROP_SZ
struct CLUSPROP_SYNTAX
{
    uint dw;
    _Anonymous_e__Struct Anonymous;
}

struct CLUSPROP_VALUE
{
    CLUSPROP_SYNTAX Syntax;
    uint cbLength;
}

struct CLUSPROP_SZ
{
    CLUSPROP_VALUE Base;
    wchar[1] sz;
}

struct CLUSPROP_LIST
{
    uint nPropertyCount;
    CLUSPROP_SZ PropertyName;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CLUSPROP_LIST サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; nPropertyCount : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; PropertyName : CLUSPROP_SZ (+4, 12byte)  varptr(st)+4 を基点に操作(12byte:入れ子/配列)
; ※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_SZ
    #field CLUSPROP_VALUE Base
    #field wchar sz 1
#endstruct

#defstruct global CLUSPROP_LIST
    #field int nPropertyCount
    #field CLUSPROP_SZ PropertyName
#endstruct

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