ホーム › Storage.FileSystem › NTMS_MEDIATYPEINFORMATION
NTMS_MEDIATYPEINFORMATION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| MediaType | DWORD | 4 | +0 | +0 | メディアタイプを示す値。 |
| NumberOfSides | DWORD | 4 | +4 | +4 | メディアのサイド数。片面/両面。 |
| ReadWriteCharacteristics | DWORD | 4 | +8 | +8 | 読み書き特性を示す値。読み取り専用/書き換え可等。 |
| DeviceType | FILE_DEVICE_TYPE | 4 | +12 | +12 | メディアに対応するデバイス種別。FILE_DEVICE_*。 |
各言語での定義
#include <windows.h>
// NTMS_MEDIATYPEINFORMATION (x64 16 / x86 16 バイト)
typedef struct NTMS_MEDIATYPEINFORMATION {
DWORD MediaType;
DWORD NumberOfSides;
DWORD ReadWriteCharacteristics;
FILE_DEVICE_TYPE DeviceType;
} NTMS_MEDIATYPEINFORMATION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NTMS_MEDIATYPEINFORMATION
{
public uint MediaType;
public uint NumberOfSides;
public uint ReadWriteCharacteristics;
public uint DeviceType;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NTMS_MEDIATYPEINFORMATION
Public MediaType As UInteger
Public NumberOfSides As UInteger
Public ReadWriteCharacteristics As UInteger
Public DeviceType As UInteger
End Structureimport ctypes
from ctypes import wintypes
class NTMS_MEDIATYPEINFORMATION(ctypes.Structure):
_fields_ = [
("MediaType", wintypes.DWORD),
("NumberOfSides", wintypes.DWORD),
("ReadWriteCharacteristics", wintypes.DWORD),
("DeviceType", wintypes.DWORD),
]#[repr(C)]
pub struct NTMS_MEDIATYPEINFORMATION {
pub MediaType: u32,
pub NumberOfSides: u32,
pub ReadWriteCharacteristics: u32,
pub DeviceType: u32,
}import "golang.org/x/sys/windows"
type NTMS_MEDIATYPEINFORMATION struct {
MediaType uint32
NumberOfSides uint32
ReadWriteCharacteristics uint32
DeviceType uint32
}type
NTMS_MEDIATYPEINFORMATION = record
MediaType: DWORD;
NumberOfSides: DWORD;
ReadWriteCharacteristics: DWORD;
DeviceType: DWORD;
end;const NTMS_MEDIATYPEINFORMATION = extern struct {
MediaType: u32,
NumberOfSides: u32,
ReadWriteCharacteristics: u32,
DeviceType: u32,
};type
NTMS_MEDIATYPEINFORMATION {.bycopy.} = object
MediaType: uint32
NumberOfSides: uint32
ReadWriteCharacteristics: uint32
DeviceType: uint32struct NTMS_MEDIATYPEINFORMATION
{
uint MediaType;
uint NumberOfSides;
uint ReadWriteCharacteristics;
uint DeviceType;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NTMS_MEDIATYPEINFORMATION サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; MediaType : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; NumberOfSides : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ReadWriteCharacteristics : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; DeviceType : FILE_DEVICE_TYPE (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NTMS_MEDIATYPEINFORMATION
#field int MediaType
#field int NumberOfSides
#field int ReadWriteCharacteristics
#field int DeviceType
#endstruct
stdim st, NTMS_MEDIATYPEINFORMATION ; NSTRUCT 変数を確保
st->MediaType = 100
mes "MediaType=" + st->MediaType