Win32 API 日本語リファレンス
ホームSystem.Diagnostics.Debug.Extensions › KDEXT_FILELOCK_OWNER

KDEXT_FILELOCK_OWNER

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

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

フィールド

フィールドサイズx64x86説明
SizeofstructDWORD4+0+0この構造体のバイトサイズ。呼び出し前に設定する。
FileObjectULONGLONG8+8+8ロック対象のファイルオブジェクトのアドレス。
OwnerThreadULONGLONG8+16+16ロックを所有するスレッドのアドレス。
WaitIrpULONGLONG8+24+24ロック待機中のIRPのアドレス。
DeviceObjectULONGLONG8+32+32ファイルに関連するデバイスオブジェクトのアドレス。
BlockingDirverCHAR32+40+40ブロックしているドライバ名(ASCII、原語のtypo)。

各言語での定義

#include <windows.h>

// KDEXT_FILELOCK_OWNER  (x64 72 / x86 72 バイト)
typedef struct KDEXT_FILELOCK_OWNER {
    DWORD Sizeofstruct;
    ULONGLONG FileObject;
    ULONGLONG OwnerThread;
    ULONGLONG WaitIrp;
    ULONGLONG DeviceObject;
    CHAR BlockingDirver[32];
} KDEXT_FILELOCK_OWNER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KDEXT_FILELOCK_OWNER
{
    public uint Sizeofstruct;
    public ulong FileObject;
    public ulong OwnerThread;
    public ulong WaitIrp;
    public ulong DeviceObject;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public sbyte[] BlockingDirver;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KDEXT_FILELOCK_OWNER
    Public Sizeofstruct As UInteger
    Public FileObject As ULong
    Public OwnerThread As ULong
    Public WaitIrp As ULong
    Public DeviceObject As ULong
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public BlockingDirver() As SByte
End Structure
import ctypes
from ctypes import wintypes

class KDEXT_FILELOCK_OWNER(ctypes.Structure):
    _fields_ = [
        ("Sizeofstruct", wintypes.DWORD),
        ("FileObject", ctypes.c_ulonglong),
        ("OwnerThread", ctypes.c_ulonglong),
        ("WaitIrp", ctypes.c_ulonglong),
        ("DeviceObject", ctypes.c_ulonglong),
        ("BlockingDirver", ctypes.c_byte * 32),
    ]
#[repr(C)]
pub struct KDEXT_FILELOCK_OWNER {
    pub Sizeofstruct: u32,
    pub FileObject: u64,
    pub OwnerThread: u64,
    pub WaitIrp: u64,
    pub DeviceObject: u64,
    pub BlockingDirver: [i8; 32],
}
import "golang.org/x/sys/windows"

type KDEXT_FILELOCK_OWNER struct {
	Sizeofstruct uint32
	FileObject uint64
	OwnerThread uint64
	WaitIrp uint64
	DeviceObject uint64
	BlockingDirver [32]int8
}
type
  KDEXT_FILELOCK_OWNER = record
    Sizeofstruct: DWORD;
    FileObject: UInt64;
    OwnerThread: UInt64;
    WaitIrp: UInt64;
    DeviceObject: UInt64;
    BlockingDirver: array[0..31] of Shortint;
  end;
const KDEXT_FILELOCK_OWNER = extern struct {
    Sizeofstruct: u32,
    FileObject: u64,
    OwnerThread: u64,
    WaitIrp: u64,
    DeviceObject: u64,
    BlockingDirver: [32]i8,
};
type
  KDEXT_FILELOCK_OWNER {.bycopy.} = object
    Sizeofstruct: uint32
    FileObject: uint64
    OwnerThread: uint64
    WaitIrp: uint64
    DeviceObject: uint64
    BlockingDirver: array[32, int8]
struct KDEXT_FILELOCK_OWNER
{
    uint Sizeofstruct;
    ulong FileObject;
    ulong OwnerThread;
    ulong WaitIrp;
    ulong DeviceObject;
    byte[32] BlockingDirver;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KDEXT_FILELOCK_OWNER サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; Sizeofstruct : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; FileObject : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; OwnerThread : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; WaitIrp : ULONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; DeviceObject : ULONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; BlockingDirver : CHAR (+40, 32byte)  varptr(st)+40 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global KDEXT_FILELOCK_OWNER
    #field int Sizeofstruct
    #field int64 FileObject
    #field int64 OwnerThread
    #field int64 WaitIrp
    #field int64 DeviceObject
    #field byte BlockingDirver 32
#endstruct

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