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

CDROM_SET_SPEED

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

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

フィールド

フィールドサイズx64x86説明
RequestTypeCDROM_SPEED_REQUEST4+0+0速度設定要求の種類を示す列挙値。CdromSetSpeed等を表す。
ReadSpeedWORD2+4+4設定する読み取り速度をKB/秒単位で示す。
WriteSpeedWORD2+6+6設定する書き込み速度をKB/秒単位で示す。
RotationControlWRITE_ROTATION4+8+8ディスク回転制御方式を示す列挙値。CAVやCLVを表す。

各言語での定義

#include <windows.h>

// CDROM_SET_SPEED  (x64 12 / x86 12 バイト)
typedef struct CDROM_SET_SPEED {
    CDROM_SPEED_REQUEST RequestType;
    WORD ReadSpeed;
    WORD WriteSpeed;
    WRITE_ROTATION RotationControl;
} CDROM_SET_SPEED;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CDROM_SET_SPEED
{
    public int RequestType;
    public ushort ReadSpeed;
    public ushort WriteSpeed;
    public int RotationControl;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CDROM_SET_SPEED
    Public RequestType As Integer
    Public ReadSpeed As UShort
    Public WriteSpeed As UShort
    Public RotationControl As Integer
End Structure
import ctypes
from ctypes import wintypes

class CDROM_SET_SPEED(ctypes.Structure):
    _fields_ = [
        ("RequestType", ctypes.c_int),
        ("ReadSpeed", ctypes.c_ushort),
        ("WriteSpeed", ctypes.c_ushort),
        ("RotationControl", ctypes.c_int),
    ]
#[repr(C)]
pub struct CDROM_SET_SPEED {
    pub RequestType: i32,
    pub ReadSpeed: u16,
    pub WriteSpeed: u16,
    pub RotationControl: i32,
}
import "golang.org/x/sys/windows"

type CDROM_SET_SPEED struct {
	RequestType int32
	ReadSpeed uint16
	WriteSpeed uint16
	RotationControl int32
}
type
  CDROM_SET_SPEED = record
    RequestType: Integer;
    ReadSpeed: Word;
    WriteSpeed: Word;
    RotationControl: Integer;
  end;
const CDROM_SET_SPEED = extern struct {
    RequestType: i32,
    ReadSpeed: u16,
    WriteSpeed: u16,
    RotationControl: i32,
};
type
  CDROM_SET_SPEED {.bycopy.} = object
    RequestType: int32
    ReadSpeed: uint16
    WriteSpeed: uint16
    RotationControl: int32
struct CDROM_SET_SPEED
{
    int RequestType;
    ushort ReadSpeed;
    ushort WriteSpeed;
    int RotationControl;
}

HSP用 定義

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

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

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