ホーム › Devices.Cdrom › CDROM_EXCLUSIVE_LOCK
CDROM_EXCLUSIVE_LOCK
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Access | CDROM_EXCLUSIVE_ACCESS | 8 | +0 | +0 | 排他アクセス要求の内容を保持するCDROM_EXCLUSIVE_ACCESS。 |
| CallerName | BYTE | 64 | +8 | +8 | ロックを要求した呼び出し元の名前を保持するバイト配列。診断用。 |
各言語での定義
#include <windows.h>
// CDROM_EXCLUSIVE_ACCESS (x64 8 / x86 8 バイト)
typedef struct CDROM_EXCLUSIVE_ACCESS {
EXCLUSIVE_ACCESS_REQUEST_TYPE RequestType;
DWORD Flags;
} CDROM_EXCLUSIVE_ACCESS;
// CDROM_EXCLUSIVE_LOCK (x64 72 / x86 72 バイト)
typedef struct CDROM_EXCLUSIVE_LOCK {
CDROM_EXCLUSIVE_ACCESS Access;
BYTE CallerName[64];
} CDROM_EXCLUSIVE_LOCK;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CDROM_EXCLUSIVE_ACCESS
{
public int RequestType;
public uint Flags;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CDROM_EXCLUSIVE_LOCK
{
public CDROM_EXCLUSIVE_ACCESS Access;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] CallerName;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CDROM_EXCLUSIVE_ACCESS
Public RequestType As Integer
Public Flags As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CDROM_EXCLUSIVE_LOCK
Public Access As CDROM_EXCLUSIVE_ACCESS
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> Public CallerName() As Byte
End Structureimport ctypes
from ctypes import wintypes
class CDROM_EXCLUSIVE_ACCESS(ctypes.Structure):
_fields_ = [
("RequestType", ctypes.c_int),
("Flags", wintypes.DWORD),
]
class CDROM_EXCLUSIVE_LOCK(ctypes.Structure):
_fields_ = [
("Access", CDROM_EXCLUSIVE_ACCESS),
("CallerName", ctypes.c_ubyte * 64),
]#[repr(C)]
pub struct CDROM_EXCLUSIVE_ACCESS {
pub RequestType: i32,
pub Flags: u32,
}
#[repr(C)]
pub struct CDROM_EXCLUSIVE_LOCK {
pub Access: CDROM_EXCLUSIVE_ACCESS,
pub CallerName: [u8; 64],
}import "golang.org/x/sys/windows"
type CDROM_EXCLUSIVE_ACCESS struct {
RequestType int32
Flags uint32
}
type CDROM_EXCLUSIVE_LOCK struct {
Access CDROM_EXCLUSIVE_ACCESS
CallerName [64]byte
}type
CDROM_EXCLUSIVE_ACCESS = record
RequestType: Integer;
Flags: DWORD;
end;
CDROM_EXCLUSIVE_LOCK = record
Access: CDROM_EXCLUSIVE_ACCESS;
CallerName: array[0..63] of Byte;
end;const CDROM_EXCLUSIVE_ACCESS = extern struct {
RequestType: i32,
Flags: u32,
};
const CDROM_EXCLUSIVE_LOCK = extern struct {
Access: CDROM_EXCLUSIVE_ACCESS,
CallerName: [64]u8,
};type
CDROM_EXCLUSIVE_ACCESS {.bycopy.} = object
RequestType: int32
Flags: uint32
CDROM_EXCLUSIVE_LOCK {.bycopy.} = object
Access: CDROM_EXCLUSIVE_ACCESS
CallerName: array[64, uint8]struct CDROM_EXCLUSIVE_ACCESS
{
int RequestType;
uint Flags;
}
struct CDROM_EXCLUSIVE_LOCK
{
CDROM_EXCLUSIVE_ACCESS Access;
ubyte[64] CallerName;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CDROM_EXCLUSIVE_LOCK サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; Access : CDROM_EXCLUSIVE_ACCESS (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; CallerName : BYTE (+8, 64byte) varptr(st)+8 を基点に操作(64byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global CDROM_EXCLUSIVE_ACCESS
#field int RequestType
#field int Flags
#endstruct
#defstruct global CDROM_EXCLUSIVE_LOCK
#field CDROM_EXCLUSIVE_ACCESS Access
#field byte CallerName 64
#endstruct
stdim st, CDROM_EXCLUSIVE_LOCK ; NSTRUCT 変数を確保