ホーム › System.Ioctl › CHANGER_ELEMENT_STATUS_EX
CHANGER_ELEMENT_STATUS_EX
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Element | CHANGER_ELEMENT | 8 | +0 | +0 | 状態を表す対象要素。CHANGER_ELEMENT構造体。 |
| SrcElementAddress | CHANGER_ELEMENT | 8 | +8 | +8 | メディアの元位置を示す要素アドレス。 |
| Flags | CHANGER_ELEMENT_STATUS_FLAGS | 4 | +16 | +16 | 要素の状態を示すフラグのビットマスク。 |
| ExceptionCode | DWORD | 4 | +20 | +20 | 要素に関する例外コード。 |
| TargetId | BYTE | 1 | +24 | +24 | メディア搬送中の場合のSCSIターゲットID。 |
| Lun | BYTE | 1 | +25 | +25 | メディア搬送中の場合のSCSI論理ユニット番号。 |
| Reserved | WORD | 2 | +26 | +26 | 予約領域。ゼロを設定する。 |
| PrimaryVolumeID | BYTE | 36 | +28 | +28 | 主ボリューム識別子(バーコードなど)。 |
| AlternateVolumeID | BYTE | 36 | +64 | +64 | 代替ボリューム識別子。 |
| VendorIdentification | BYTE | 8 | +100 | +100 | 要素内デバイスのベンダ識別文字列。 |
| ProductIdentification | BYTE | 16 | +108 | +108 | 要素内デバイスの製品識別文字列。 |
| SerialNumber | BYTE | 32 | +124 | +124 | 要素内デバイスのシリアル番号文字列。 |
各言語での定義
#include <windows.h>
// CHANGER_ELEMENT (x64 8 / x86 8 バイト)
typedef struct CHANGER_ELEMENT {
ELEMENT_TYPE ElementType;
DWORD ElementAddress;
} CHANGER_ELEMENT;
// CHANGER_ELEMENT_STATUS_EX (x64 156 / x86 156 バイト)
typedef struct CHANGER_ELEMENT_STATUS_EX {
CHANGER_ELEMENT Element;
CHANGER_ELEMENT SrcElementAddress;
CHANGER_ELEMENT_STATUS_FLAGS Flags;
DWORD ExceptionCode;
BYTE TargetId;
BYTE Lun;
WORD Reserved;
BYTE PrimaryVolumeID[36];
BYTE AlternateVolumeID[36];
BYTE VendorIdentification[8];
BYTE ProductIdentification[16];
BYTE SerialNumber[32];
} CHANGER_ELEMENT_STATUS_EX;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CHANGER_ELEMENT
{
public int ElementType;
public uint ElementAddress;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CHANGER_ELEMENT_STATUS_EX
{
public CHANGER_ELEMENT Element;
public CHANGER_ELEMENT SrcElementAddress;
public uint Flags;
public uint ExceptionCode;
public byte TargetId;
public byte Lun;
public ushort Reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 36)] public byte[] PrimaryVolumeID;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 36)] public byte[] AlternateVolumeID;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] VendorIdentification;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] ProductIdentification;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] SerialNumber;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CHANGER_ELEMENT
Public ElementType As Integer
Public ElementAddress As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CHANGER_ELEMENT_STATUS_EX
Public Element As CHANGER_ELEMENT
Public SrcElementAddress As CHANGER_ELEMENT
Public Flags As UInteger
Public ExceptionCode As UInteger
Public TargetId As Byte
Public Lun As Byte
Public Reserved As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=36)> Public PrimaryVolumeID() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=36)> Public AlternateVolumeID() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public VendorIdentification() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public ProductIdentification() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public SerialNumber() As Byte
End Structureimport ctypes
from ctypes import wintypes
class CHANGER_ELEMENT(ctypes.Structure):
_fields_ = [
("ElementType", ctypes.c_int),
("ElementAddress", wintypes.DWORD),
]
class CHANGER_ELEMENT_STATUS_EX(ctypes.Structure):
_fields_ = [
("Element", CHANGER_ELEMENT),
("SrcElementAddress", CHANGER_ELEMENT),
("Flags", wintypes.DWORD),
("ExceptionCode", wintypes.DWORD),
("TargetId", ctypes.c_ubyte),
("Lun", ctypes.c_ubyte),
("Reserved", ctypes.c_ushort),
("PrimaryVolumeID", ctypes.c_ubyte * 36),
("AlternateVolumeID", ctypes.c_ubyte * 36),
("VendorIdentification", ctypes.c_ubyte * 8),
("ProductIdentification", ctypes.c_ubyte * 16),
("SerialNumber", ctypes.c_ubyte * 32),
]#[repr(C)]
pub struct CHANGER_ELEMENT {
pub ElementType: i32,
pub ElementAddress: u32,
}
#[repr(C)]
pub struct CHANGER_ELEMENT_STATUS_EX {
pub Element: CHANGER_ELEMENT,
pub SrcElementAddress: CHANGER_ELEMENT,
pub Flags: u32,
pub ExceptionCode: u32,
pub TargetId: u8,
pub Lun: u8,
pub Reserved: u16,
pub PrimaryVolumeID: [u8; 36],
pub AlternateVolumeID: [u8; 36],
pub VendorIdentification: [u8; 8],
pub ProductIdentification: [u8; 16],
pub SerialNumber: [u8; 32],
}import "golang.org/x/sys/windows"
type CHANGER_ELEMENT struct {
ElementType int32
ElementAddress uint32
}
type CHANGER_ELEMENT_STATUS_EX struct {
Element CHANGER_ELEMENT
SrcElementAddress CHANGER_ELEMENT
Flags uint32
ExceptionCode uint32
TargetId byte
Lun byte
Reserved uint16
PrimaryVolumeID [36]byte
AlternateVolumeID [36]byte
VendorIdentification [8]byte
ProductIdentification [16]byte
SerialNumber [32]byte
}type
CHANGER_ELEMENT = record
ElementType: Integer;
ElementAddress: DWORD;
end;
CHANGER_ELEMENT_STATUS_EX = record
Element: CHANGER_ELEMENT;
SrcElementAddress: CHANGER_ELEMENT;
Flags: DWORD;
ExceptionCode: DWORD;
TargetId: Byte;
Lun: Byte;
Reserved: Word;
PrimaryVolumeID: array[0..35] of Byte;
AlternateVolumeID: array[0..35] of Byte;
VendorIdentification: array[0..7] of Byte;
ProductIdentification: array[0..15] of Byte;
SerialNumber: array[0..31] of Byte;
end;const CHANGER_ELEMENT = extern struct {
ElementType: i32,
ElementAddress: u32,
};
const CHANGER_ELEMENT_STATUS_EX = extern struct {
Element: CHANGER_ELEMENT,
SrcElementAddress: CHANGER_ELEMENT,
Flags: u32,
ExceptionCode: u32,
TargetId: u8,
Lun: u8,
Reserved: u16,
PrimaryVolumeID: [36]u8,
AlternateVolumeID: [36]u8,
VendorIdentification: [8]u8,
ProductIdentification: [16]u8,
SerialNumber: [32]u8,
};type
CHANGER_ELEMENT {.bycopy.} = object
ElementType: int32
ElementAddress: uint32
CHANGER_ELEMENT_STATUS_EX {.bycopy.} = object
Element: CHANGER_ELEMENT
SrcElementAddress: CHANGER_ELEMENT
Flags: uint32
ExceptionCode: uint32
TargetId: uint8
Lun: uint8
Reserved: uint16
PrimaryVolumeID: array[36, uint8]
AlternateVolumeID: array[36, uint8]
VendorIdentification: array[8, uint8]
ProductIdentification: array[16, uint8]
SerialNumber: array[32, uint8]struct CHANGER_ELEMENT
{
int ElementType;
uint ElementAddress;
}
struct CHANGER_ELEMENT_STATUS_EX
{
CHANGER_ELEMENT Element;
CHANGER_ELEMENT SrcElementAddress;
uint Flags;
uint ExceptionCode;
ubyte TargetId;
ubyte Lun;
ushort Reserved;
ubyte[36] PrimaryVolumeID;
ubyte[36] AlternateVolumeID;
ubyte[8] VendorIdentification;
ubyte[16] ProductIdentification;
ubyte[32] SerialNumber;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CHANGER_ELEMENT_STATUS_EX サイズ: 156 バイト(x64)
dim st, 39 ; 4byte整数×39(構造体サイズ 156 / 4 切り上げ)
; Element : CHANGER_ELEMENT (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; SrcElementAddress : CHANGER_ELEMENT (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; Flags : CHANGER_ELEMENT_STATUS_FLAGS (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ExceptionCode : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; TargetId : BYTE (+24, 1byte) poke st,24,値 / 値 = peek(st,24)
; Lun : BYTE (+25, 1byte) poke st,25,値 / 値 = peek(st,25)
; Reserved : WORD (+26, 2byte) wpoke st,26,値 / 値 = wpeek(st,26)
; PrimaryVolumeID : BYTE (+28, 36byte) varptr(st)+28 を基点に操作(36byte:入れ子/配列)
; AlternateVolumeID : BYTE (+64, 36byte) varptr(st)+64 を基点に操作(36byte:入れ子/配列)
; VendorIdentification : BYTE (+100, 8byte) varptr(st)+100 を基点に操作(8byte:入れ子/配列)
; ProductIdentification : BYTE (+108, 16byte) varptr(st)+108 を基点に操作(16byte:入れ子/配列)
; SerialNumber : BYTE (+124, 32byte) varptr(st)+124 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global CHANGER_ELEMENT
#field int ElementType
#field int ElementAddress
#endstruct
#defstruct global CHANGER_ELEMENT_STATUS_EX
#field CHANGER_ELEMENT Element
#field CHANGER_ELEMENT SrcElementAddress
#field int Flags
#field int ExceptionCode
#field byte TargetId
#field byte Lun
#field short Reserved
#field byte PrimaryVolumeID 36
#field byte AlternateVolumeID 36
#field byte VendorIdentification 8
#field byte ProductIdentification 16
#field byte SerialNumber 32
#endstruct
stdim st, CHANGER_ELEMENT_STATUS_EX ; NSTRUCT 変数を確保
st->Flags = 100
mes "Flags=" + st->Flags