ホーム › Media.Audio.DirectMusic › DLSID
DLSID
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ulData1 | DWORD | 4 | +0 | +0 | DLS識別子の最初の32ビット部分。 |
| usData2 | WORD | 2 | +4 | +4 | DLS識別子の2番目の16ビット部分。 |
| usData3 | WORD | 2 | +6 | +6 | DLS識別子の3番目の16ビット部分。 |
| abData4 | BYTE | 8 | +8 | +8 | DLS識別子の残り8バイトを保持するバイト配列。 |
各言語での定義
#include <windows.h>
// DLSID (x64 16 / x86 16 バイト)
typedef struct DLSID {
DWORD ulData1;
WORD usData2;
WORD usData3;
BYTE abData4[8];
} DLSID;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DLSID
{
public uint ulData1;
public ushort usData2;
public ushort usData3;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] abData4;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DLSID
Public ulData1 As UInteger
Public usData2 As UShort
Public usData3 As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public abData4() As Byte
End Structureimport ctypes
from ctypes import wintypes
class DLSID(ctypes.Structure):
_fields_ = [
("ulData1", wintypes.DWORD),
("usData2", ctypes.c_ushort),
("usData3", ctypes.c_ushort),
("abData4", ctypes.c_ubyte * 8),
]#[repr(C)]
pub struct DLSID {
pub ulData1: u32,
pub usData2: u16,
pub usData3: u16,
pub abData4: [u8; 8],
}import "golang.org/x/sys/windows"
type DLSID struct {
ulData1 uint32
usData2 uint16
usData3 uint16
abData4 [8]byte
}type
DLSID = record
ulData1: DWORD;
usData2: Word;
usData3: Word;
abData4: array[0..7] of Byte;
end;const DLSID = extern struct {
ulData1: u32,
usData2: u16,
usData3: u16,
abData4: [8]u8,
};type
DLSID {.bycopy.} = object
ulData1: uint32
usData2: uint16
usData3: uint16
abData4: array[8, uint8]struct DLSID
{
uint ulData1;
ushort usData2;
ushort usData3;
ubyte[8] abData4;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DLSID サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; ulData1 : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; usData2 : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; usData3 : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; abData4 : BYTE (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DLSID
#field int ulData1
#field short usData2
#field short usData3
#field byte abData4 8
#endstruct
stdim st, DLSID ; NSTRUCT 変数を確保
st->ulData1 = 100
mes "ulData1=" + st->ulData1