Win32 API 日本語リファレンス
ホームStorage.VirtualDiskService › VDS_STORAGE_DEVICE_ID_DESCRIPTOR

VDS_STORAGE_DEVICE_ID_DESCRIPTOR

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

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

フィールド

フィールドサイズx64x86説明
m_versionDWORD4+0+0デバイスID記述子のバージョン(Version)を表す32ビット値である。
m_cIdentifiersDWORD4+4+4記述子に含まれるストレージ識別子の数(Count)を表す32ビット値である。
m_rgIdentifiersVDS_STORAGE_IDENTIFIER*8/4+8+8ストレージ識別子配列を指すVDS_STORAGE_IDENTIFIERポインタである。

各言語での定義

#include <windows.h>

// VDS_STORAGE_DEVICE_ID_DESCRIPTOR  (x64 16 / x86 12 バイト)
typedef struct VDS_STORAGE_DEVICE_ID_DESCRIPTOR {
    DWORD m_version;
    DWORD m_cIdentifiers;
    VDS_STORAGE_IDENTIFIER* m_rgIdentifiers;
} VDS_STORAGE_DEVICE_ID_DESCRIPTOR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_STORAGE_DEVICE_ID_DESCRIPTOR
{
    public uint m_version;
    public uint m_cIdentifiers;
    public IntPtr m_rgIdentifiers;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_STORAGE_DEVICE_ID_DESCRIPTOR
    Public m_version As UInteger
    Public m_cIdentifiers As UInteger
    Public m_rgIdentifiers As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class VDS_STORAGE_DEVICE_ID_DESCRIPTOR(ctypes.Structure):
    _fields_ = [
        ("m_version", wintypes.DWORD),
        ("m_cIdentifiers", wintypes.DWORD),
        ("m_rgIdentifiers", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct VDS_STORAGE_DEVICE_ID_DESCRIPTOR {
    pub m_version: u32,
    pub m_cIdentifiers: u32,
    pub m_rgIdentifiers: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type VDS_STORAGE_DEVICE_ID_DESCRIPTOR struct {
	m_version uint32
	m_cIdentifiers uint32
	m_rgIdentifiers uintptr
}
type
  VDS_STORAGE_DEVICE_ID_DESCRIPTOR = record
    m_version: DWORD;
    m_cIdentifiers: DWORD;
    m_rgIdentifiers: Pointer;
  end;
const VDS_STORAGE_DEVICE_ID_DESCRIPTOR = extern struct {
    m_version: u32,
    m_cIdentifiers: u32,
    m_rgIdentifiers: ?*anyopaque,
};
type
  VDS_STORAGE_DEVICE_ID_DESCRIPTOR {.bycopy.} = object
    m_version: uint32
    m_cIdentifiers: uint32
    m_rgIdentifiers: pointer
struct VDS_STORAGE_DEVICE_ID_DESCRIPTOR
{
    uint m_version;
    uint m_cIdentifiers;
    void* m_rgIdentifiers;
}

HSP用 定義

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

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

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