Win32 API 日本語リファレンス
ホームDevices.Dvd › DVD_RAM_MEDIUM_STATUS

DVD_RAM_MEDIUM_STATUS

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

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

フィールド

フィールドサイズx64x86説明
_bitfieldBYTE1+0+0ディスク種別や書き込み禁止状態等を格納するビットフィールド。
DiscTypeIdentificationBYTE1+1+1ディスク種別の識別コードを示す1バイト値。
Reserved2BYTE1+2+2予約領域。将来の拡張用で通常は0。
MediaSpecificWriteInhibitInformationBYTE1+3+3メディア固有の書き込み禁止情報を示す1バイト値。

各言語での定義

#include <windows.h>

// DVD_RAM_MEDIUM_STATUS  (x64 4 / x86 4 バイト)
typedef struct DVD_RAM_MEDIUM_STATUS {
    BYTE _bitfield;
    BYTE DiscTypeIdentification;
    BYTE Reserved2;
    BYTE MediaSpecificWriteInhibitInformation;
} DVD_RAM_MEDIUM_STATUS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DVD_RAM_MEDIUM_STATUS
{
    public byte _bitfield;
    public byte DiscTypeIdentification;
    public byte Reserved2;
    public byte MediaSpecificWriteInhibitInformation;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DVD_RAM_MEDIUM_STATUS
    Public _bitfield As Byte
    Public DiscTypeIdentification As Byte
    Public Reserved2 As Byte
    Public MediaSpecificWriteInhibitInformation As Byte
End Structure
import ctypes
from ctypes import wintypes

class DVD_RAM_MEDIUM_STATUS(ctypes.Structure):
    _fields_ = [
        ("_bitfield", ctypes.c_ubyte),
        ("DiscTypeIdentification", ctypes.c_ubyte),
        ("Reserved2", ctypes.c_ubyte),
        ("MediaSpecificWriteInhibitInformation", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct DVD_RAM_MEDIUM_STATUS {
    pub _bitfield: u8,
    pub DiscTypeIdentification: u8,
    pub Reserved2: u8,
    pub MediaSpecificWriteInhibitInformation: u8,
}
import "golang.org/x/sys/windows"

type DVD_RAM_MEDIUM_STATUS struct {
	_bitfield byte
	DiscTypeIdentification byte
	Reserved2 byte
	MediaSpecificWriteInhibitInformation byte
}
type
  DVD_RAM_MEDIUM_STATUS = record
    _bitfield: Byte;
    DiscTypeIdentification: Byte;
    Reserved2: Byte;
    MediaSpecificWriteInhibitInformation: Byte;
  end;
const DVD_RAM_MEDIUM_STATUS = extern struct {
    _bitfield: u8,
    DiscTypeIdentification: u8,
    Reserved2: u8,
    MediaSpecificWriteInhibitInformation: u8,
};
type
  DVD_RAM_MEDIUM_STATUS {.bycopy.} = object
    _bitfield: uint8
    DiscTypeIdentification: uint8
    Reserved2: uint8
    MediaSpecificWriteInhibitInformation: uint8
struct DVD_RAM_MEDIUM_STATUS
{
    ubyte _bitfield;
    ubyte DiscTypeIdentification;
    ubyte Reserved2;
    ubyte MediaSpecificWriteInhibitInformation;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DVD_RAM_MEDIUM_STATUS サイズ: 4 バイト(x64)
dim st, 1    ; 4byte整数×1(構造体サイズ 4 / 4 切り上げ)
; _bitfield : BYTE (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; DiscTypeIdentification : BYTE (+1, 1byte)  poke st,1,値  /  値 = peek(st,1)
; Reserved2 : BYTE (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; MediaSpecificWriteInhibitInformation : BYTE (+3, 1byte)  poke st,3,値  /  値 = peek(st,3)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DVD_RAM_MEDIUM_STATUS
    #field byte _bitfield
    #field byte DiscTypeIdentification
    #field byte Reserved2
    #field byte MediaSpecificWriteInhibitInformation
#endstruct

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