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

NTMS_LMIDINFORMATION

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

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

フィールド

フィールドサイズx64x86説明
MediaPoolGUID16+0+0論理メディアが属するメディアプールのGUID。
dwNumberOfPartitionsDWORD4+16+16論理メディアを構成するパーティション数。

各言語での定義

#include <windows.h>

// NTMS_LMIDINFORMATION  (x64 20 / x86 20 バイト)
typedef struct NTMS_LMIDINFORMATION {
    GUID MediaPool;
    DWORD dwNumberOfPartitions;
} NTMS_LMIDINFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NTMS_LMIDINFORMATION
{
    public Guid MediaPool;
    public uint dwNumberOfPartitions;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NTMS_LMIDINFORMATION
    Public MediaPool As Guid
    Public dwNumberOfPartitions As UInteger
End Structure
import ctypes
from ctypes import wintypes

class NTMS_LMIDINFORMATION(ctypes.Structure):
    _fields_ = [
        ("MediaPool", GUID),
        ("dwNumberOfPartitions", wintypes.DWORD),
    ]
#[repr(C)]
pub struct NTMS_LMIDINFORMATION {
    pub MediaPool: GUID,
    pub dwNumberOfPartitions: u32,
}
import "golang.org/x/sys/windows"

type NTMS_LMIDINFORMATION struct {
	MediaPool windows.GUID
	dwNumberOfPartitions uint32
}
type
  NTMS_LMIDINFORMATION = record
    MediaPool: TGUID;
    dwNumberOfPartitions: DWORD;
  end;
const NTMS_LMIDINFORMATION = extern struct {
    MediaPool: GUID,
    dwNumberOfPartitions: u32,
};
type
  NTMS_LMIDINFORMATION {.bycopy.} = object
    MediaPool: GUID
    dwNumberOfPartitions: uint32
struct NTMS_LMIDINFORMATION
{
    GUID MediaPool;
    uint dwNumberOfPartitions;
}

HSP用 定義

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

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

#defstruct global NTMS_LMIDINFORMATION
    #field GUID MediaPool
    #field int dwNumberOfPartitions
#endstruct

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