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

DVD_READ_STRUCTURE

構造体
サイズx64: 17 バイト / x86: 17 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
BlockByteOffsetLONGLONG8+0+0読み取り対象のブロックバイトオフセットを示す64ビット値。
FormatDVD_STRUCTURE_FORMAT4+8+8読み取るDVD構造のフォーマットを示すDVD_STRUCTURE_FORMAT列挙値。
SessionIdDWORD4+12+12認証セッションを識別するDWORD。
LayerNumberBYTE1+16+16読み取り対象のレイヤ番号を示す1バイト値。

各言語での定義

#include <windows.h>

// DVD_READ_STRUCTURE  (x64 17 / x86 17 バイト)
#pragma pack(push, 1)
typedef struct DVD_READ_STRUCTURE {
    LONGLONG BlockByteOffset;
    DVD_STRUCTURE_FORMAT Format;
    DWORD SessionId;
    BYTE LayerNumber;
} DVD_READ_STRUCTURE;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DVD_READ_STRUCTURE
{
    public long BlockByteOffset;
    public int Format;
    public uint SessionId;
    public byte LayerNumber;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DVD_READ_STRUCTURE
    Public BlockByteOffset As Long
    Public Format As Integer
    Public SessionId As UInteger
    Public LayerNumber As Byte
End Structure
import ctypes
from ctypes import wintypes

class DVD_READ_STRUCTURE(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("BlockByteOffset", ctypes.c_longlong),
        ("Format", ctypes.c_int),
        ("SessionId", wintypes.DWORD),
        ("LayerNumber", ctypes.c_ubyte),
    ]
#[repr(C, packed(1))]
pub struct DVD_READ_STRUCTURE {
    pub BlockByteOffset: i64,
    pub Format: i32,
    pub SessionId: u32,
    pub LayerNumber: u8,
}
import "golang.org/x/sys/windows"

type DVD_READ_STRUCTURE struct {
	BlockByteOffset int64
	Format int32
	SessionId uint32
	LayerNumber byte
}
type
  DVD_READ_STRUCTURE = packed record
    BlockByteOffset: Int64;
    Format: Integer;
    SessionId: DWORD;
    LayerNumber: Byte;
  end;
const DVD_READ_STRUCTURE = extern struct {
    BlockByteOffset: i64,
    Format: i32,
    SessionId: u32,
    LayerNumber: u8,
};
type
  DVD_READ_STRUCTURE {.packed.} = object
    BlockByteOffset: int64
    Format: int32
    SessionId: uint32
    LayerNumber: uint8
align(1)
struct DVD_READ_STRUCTURE
{
    long BlockByteOffset;
    int Format;
    uint SessionId;
    ubyte LayerNumber;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DVD_READ_STRUCTURE サイズ: 17 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 17 / 4 切り上げ)
; BlockByteOffset : LONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Format : DVD_STRUCTURE_FORMAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; SessionId : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; LayerNumber : BYTE (+16, 1byte)  poke st,16,値  /  値 = peek(st,16)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DVD_READ_STRUCTURE, pack=1
    #field int64 BlockByteOffset
    #field int Format
    #field int SessionId
    #field byte LayerNumber
#endstruct

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