Win32 API 日本語リファレンス
ホームSystem.Ioctl › STORAGE_PHYSICAL_NODE_DATA

STORAGE_PHYSICAL_NODE_DATA

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

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

フィールド

フィールドサイズx64x86説明
NodeIdDWORD4+0+0物理ノードの識別番号。
AdapterCountDWORD4+4+4このノードに属するアダプタの数。
AdapterDataLengthDWORD4+8+8アダプタデータ1件あたりのバイト長。
AdapterDataOffsetDWORD4+12+12アダプタデータ配列への本構造体先頭からのバイトオフセット。
DeviceCountDWORD4+16+16このノードに属するデバイスの数。
DeviceDataLengthDWORD4+20+20デバイスデータ1件あたりのバイト長。
DeviceDataOffsetDWORD4+24+24デバイスデータ配列への本構造体先頭からのバイトオフセット。
ReservedDWORD12+28+28将来の拡張のために予約された32ビット領域。

各言語での定義

#include <windows.h>

// STORAGE_PHYSICAL_NODE_DATA  (x64 40 / x86 40 バイト)
typedef struct STORAGE_PHYSICAL_NODE_DATA {
    DWORD NodeId;
    DWORD AdapterCount;
    DWORD AdapterDataLength;
    DWORD AdapterDataOffset;
    DWORD DeviceCount;
    DWORD DeviceDataLength;
    DWORD DeviceDataOffset;
    DWORD Reserved[3];
} STORAGE_PHYSICAL_NODE_DATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_PHYSICAL_NODE_DATA
{
    public uint NodeId;
    public uint AdapterCount;
    public uint AdapterDataLength;
    public uint AdapterDataOffset;
    public uint DeviceCount;
    public uint DeviceDataLength;
    public uint DeviceDataOffset;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_PHYSICAL_NODE_DATA
    Public NodeId As UInteger
    Public AdapterCount As UInteger
    Public AdapterDataLength As UInteger
    Public AdapterDataOffset As UInteger
    Public DeviceCount As UInteger
    Public DeviceDataLength As UInteger
    Public DeviceDataOffset As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved() As UInteger
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_PHYSICAL_NODE_DATA(ctypes.Structure):
    _fields_ = [
        ("NodeId", wintypes.DWORD),
        ("AdapterCount", wintypes.DWORD),
        ("AdapterDataLength", wintypes.DWORD),
        ("AdapterDataOffset", wintypes.DWORD),
        ("DeviceCount", wintypes.DWORD),
        ("DeviceDataLength", wintypes.DWORD),
        ("DeviceDataOffset", wintypes.DWORD),
        ("Reserved", wintypes.DWORD * 3),
    ]
#[repr(C)]
pub struct STORAGE_PHYSICAL_NODE_DATA {
    pub NodeId: u32,
    pub AdapterCount: u32,
    pub AdapterDataLength: u32,
    pub AdapterDataOffset: u32,
    pub DeviceCount: u32,
    pub DeviceDataLength: u32,
    pub DeviceDataOffset: u32,
    pub Reserved: [u32; 3],
}
import "golang.org/x/sys/windows"

type STORAGE_PHYSICAL_NODE_DATA struct {
	NodeId uint32
	AdapterCount uint32
	AdapterDataLength uint32
	AdapterDataOffset uint32
	DeviceCount uint32
	DeviceDataLength uint32
	DeviceDataOffset uint32
	Reserved [3]uint32
}
type
  STORAGE_PHYSICAL_NODE_DATA = record
    NodeId: DWORD;
    AdapterCount: DWORD;
    AdapterDataLength: DWORD;
    AdapterDataOffset: DWORD;
    DeviceCount: DWORD;
    DeviceDataLength: DWORD;
    DeviceDataOffset: DWORD;
    Reserved: array[0..2] of DWORD;
  end;
const STORAGE_PHYSICAL_NODE_DATA = extern struct {
    NodeId: u32,
    AdapterCount: u32,
    AdapterDataLength: u32,
    AdapterDataOffset: u32,
    DeviceCount: u32,
    DeviceDataLength: u32,
    DeviceDataOffset: u32,
    Reserved: [3]u32,
};
type
  STORAGE_PHYSICAL_NODE_DATA {.bycopy.} = object
    NodeId: uint32
    AdapterCount: uint32
    AdapterDataLength: uint32
    AdapterDataOffset: uint32
    DeviceCount: uint32
    DeviceDataLength: uint32
    DeviceDataOffset: uint32
    Reserved: array[3, uint32]
struct STORAGE_PHYSICAL_NODE_DATA
{
    uint NodeId;
    uint AdapterCount;
    uint AdapterDataLength;
    uint AdapterDataOffset;
    uint DeviceCount;
    uint DeviceDataLength;
    uint DeviceDataOffset;
    uint[3] Reserved;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_PHYSICAL_NODE_DATA サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; NodeId : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; AdapterCount : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; AdapterDataLength : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; AdapterDataOffset : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; DeviceCount : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; DeviceDataLength : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; DeviceDataOffset : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; Reserved : DWORD (+28, 12byte)  varptr(st)+28 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STORAGE_PHYSICAL_NODE_DATA
    #field int NodeId
    #field int AdapterCount
    #field int AdapterDataLength
    #field int AdapterDataOffset
    #field int DeviceCount
    #field int DeviceDataLength
    #field int DeviceDataOffset
    #field int Reserved 3
#endstruct

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