Win32 API 日本語リファレンス
ホームMedia.Multimedia › MCI_OPEN_DRIVER_PARMS

MCI_OPEN_DRIVER_PARMS

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

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

フィールド

フィールドサイズx64x86説明
wDeviceIDDWORD4+0+0MCIによって割り当てられたデバイスID。
lpstrParamsLPWSTR8/4+4+4ドライバへ渡すパラメータ文字列へのポインタ。
wCustomCommandTableDWORD4+12+8ドライバ独自のコマンドテーブルのハンドル(識別子)。
wTypeDWORD4+16+12MCIデバイスの種類を示す。

各言語での定義

#include <windows.h>

// MCI_OPEN_DRIVER_PARMS  (x64 20 / x86 16 バイト)
#pragma pack(push, 1)
typedef struct MCI_OPEN_DRIVER_PARMS {
    DWORD wDeviceID;
    LPWSTR lpstrParams;
    DWORD wCustomCommandTable;
    DWORD wType;
} MCI_OPEN_DRIVER_PARMS;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MCI_OPEN_DRIVER_PARMS
{
    public uint wDeviceID;
    public IntPtr lpstrParams;
    public uint wCustomCommandTable;
    public uint wType;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure MCI_OPEN_DRIVER_PARMS
    Public wDeviceID As UInteger
    Public lpstrParams As IntPtr
    Public wCustomCommandTable As UInteger
    Public wType As UInteger
End Structure
import ctypes
from ctypes import wintypes

class MCI_OPEN_DRIVER_PARMS(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("wDeviceID", wintypes.DWORD),
        ("lpstrParams", ctypes.c_void_p),
        ("wCustomCommandTable", wintypes.DWORD),
        ("wType", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct MCI_OPEN_DRIVER_PARMS {
    pub wDeviceID: u32,
    pub lpstrParams: *mut core::ffi::c_void,
    pub wCustomCommandTable: u32,
    pub wType: u32,
}
import "golang.org/x/sys/windows"

type MCI_OPEN_DRIVER_PARMS struct {
	wDeviceID uint32
	lpstrParams uintptr
	wCustomCommandTable uint32
	wType uint32
}
type
  MCI_OPEN_DRIVER_PARMS = packed record
    wDeviceID: DWORD;
    lpstrParams: Pointer;
    wCustomCommandTable: DWORD;
    wType: DWORD;
  end;
const MCI_OPEN_DRIVER_PARMS = extern struct {
    wDeviceID: u32,
    lpstrParams: ?*anyopaque,
    wCustomCommandTable: u32,
    wType: u32,
};
type
  MCI_OPEN_DRIVER_PARMS {.packed.} = object
    wDeviceID: uint32
    lpstrParams: pointer
    wCustomCommandTable: uint32
    wType: uint32
align(1)
struct MCI_OPEN_DRIVER_PARMS
{
    uint wDeviceID;
    void* lpstrParams;
    uint wCustomCommandTable;
    uint wType;
}

HSP用 定義

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

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

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