ホーム › System.Diagnostics.Debug.Extensions › KDEXTS_LOCK_INFO
KDEXTS_LOCK_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SizeOfStruct | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。呼び出し前に設定する。 |
| Address | ULONGLONG | 8 | +8 | +8 | ロックオブジェクトのアドレス。 |
| OwningThread | ULONGLONG | 8 | +16 | +16 | ロックを所有するスレッドのアドレス。 |
| ExclusiveOwned | BOOL | 4 | +24 | +24 | 排他的に所有されているかを示すブール値。 |
| NumOwners | DWORD | 4 | +28 | +28 | 現在の所有者数。 |
| ContentionCount | DWORD | 4 | +32 | +32 | ロックの競合発生回数。 |
| NumExclusiveWaiters | DWORD | 4 | +36 | +36 | 排他取得を待機しているスレッド数。 |
| NumSharedWaiters | DWORD | 4 | +40 | +40 | 共有取得を待機しているスレッド数。 |
| pOwnerThreads | ULONGLONG* | 8/4 | +48 | +44 | 所有スレッドのアドレス配列へのポインタ。 |
| pWaiterThreads | ULONGLONG* | 8/4 | +56 | +48 | 待機スレッドのアドレス配列へのポインタ。 |
各言語での定義
#include <windows.h>
// KDEXTS_LOCK_INFO (x64 64 / x86 56 バイト)
typedef struct KDEXTS_LOCK_INFO {
DWORD SizeOfStruct;
ULONGLONG Address;
ULONGLONG OwningThread;
BOOL ExclusiveOwned;
DWORD NumOwners;
DWORD ContentionCount;
DWORD NumExclusiveWaiters;
DWORD NumSharedWaiters;
ULONGLONG* pOwnerThreads;
ULONGLONG* pWaiterThreads;
} KDEXTS_LOCK_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KDEXTS_LOCK_INFO
{
public uint SizeOfStruct;
public ulong Address;
public ulong OwningThread;
[MarshalAs(UnmanagedType.Bool)] public bool ExclusiveOwned;
public uint NumOwners;
public uint ContentionCount;
public uint NumExclusiveWaiters;
public uint NumSharedWaiters;
public IntPtr pOwnerThreads;
public IntPtr pWaiterThreads;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KDEXTS_LOCK_INFO
Public SizeOfStruct As UInteger
Public Address As ULong
Public OwningThread As ULong
<MarshalAs(UnmanagedType.Bool)> Public ExclusiveOwned As Boolean
Public NumOwners As UInteger
Public ContentionCount As UInteger
Public NumExclusiveWaiters As UInteger
Public NumSharedWaiters As UInteger
Public pOwnerThreads As IntPtr
Public pWaiterThreads As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class KDEXTS_LOCK_INFO(ctypes.Structure):
_fields_ = [
("SizeOfStruct", wintypes.DWORD),
("Address", ctypes.c_ulonglong),
("OwningThread", ctypes.c_ulonglong),
("ExclusiveOwned", wintypes.BOOL),
("NumOwners", wintypes.DWORD),
("ContentionCount", wintypes.DWORD),
("NumExclusiveWaiters", wintypes.DWORD),
("NumSharedWaiters", wintypes.DWORD),
("pOwnerThreads", ctypes.c_void_p),
("pWaiterThreads", ctypes.c_void_p),
]#[repr(C)]
pub struct KDEXTS_LOCK_INFO {
pub SizeOfStruct: u32,
pub Address: u64,
pub OwningThread: u64,
pub ExclusiveOwned: i32,
pub NumOwners: u32,
pub ContentionCount: u32,
pub NumExclusiveWaiters: u32,
pub NumSharedWaiters: u32,
pub pOwnerThreads: *mut core::ffi::c_void,
pub pWaiterThreads: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type KDEXTS_LOCK_INFO struct {
SizeOfStruct uint32
Address uint64
OwningThread uint64
ExclusiveOwned int32
NumOwners uint32
ContentionCount uint32
NumExclusiveWaiters uint32
NumSharedWaiters uint32
pOwnerThreads uintptr
pWaiterThreads uintptr
}type
KDEXTS_LOCK_INFO = record
SizeOfStruct: DWORD;
Address: UInt64;
OwningThread: UInt64;
ExclusiveOwned: BOOL;
NumOwners: DWORD;
ContentionCount: DWORD;
NumExclusiveWaiters: DWORD;
NumSharedWaiters: DWORD;
pOwnerThreads: Pointer;
pWaiterThreads: Pointer;
end;const KDEXTS_LOCK_INFO = extern struct {
SizeOfStruct: u32,
Address: u64,
OwningThread: u64,
ExclusiveOwned: i32,
NumOwners: u32,
ContentionCount: u32,
NumExclusiveWaiters: u32,
NumSharedWaiters: u32,
pOwnerThreads: ?*anyopaque,
pWaiterThreads: ?*anyopaque,
};type
KDEXTS_LOCK_INFO {.bycopy.} = object
SizeOfStruct: uint32
Address: uint64
OwningThread: uint64
ExclusiveOwned: int32
NumOwners: uint32
ContentionCount: uint32
NumExclusiveWaiters: uint32
NumSharedWaiters: uint32
pOwnerThreads: pointer
pWaiterThreads: pointerstruct KDEXTS_LOCK_INFO
{
uint SizeOfStruct;
ulong Address;
ulong OwningThread;
int ExclusiveOwned;
uint NumOwners;
uint ContentionCount;
uint NumExclusiveWaiters;
uint NumSharedWaiters;
void* pOwnerThreads;
void* pWaiterThreads;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; KDEXTS_LOCK_INFO サイズ: 56 バイト(x86)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; SizeOfStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Address : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; OwningThread : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; ExclusiveOwned : BOOL (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; NumOwners : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ContentionCount : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; NumExclusiveWaiters : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; NumSharedWaiters : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; pOwnerThreads : ULONGLONG* (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; pWaiterThreads : ULONGLONG* (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KDEXTS_LOCK_INFO サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; SizeOfStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Address : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; OwningThread : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; ExclusiveOwned : BOOL (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; NumOwners : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ContentionCount : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; NumExclusiveWaiters : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; NumSharedWaiters : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; pOwnerThreads : ULONGLONG* (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; pWaiterThreads : ULONGLONG* (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global KDEXTS_LOCK_INFO
#field int SizeOfStruct
#field int64 Address
#field int64 OwningThread
#field bool ExclusiveOwned
#field int NumOwners
#field int ContentionCount
#field int NumExclusiveWaiters
#field int NumSharedWaiters
#field intptr pOwnerThreads
#field intptr pWaiterThreads
#endstruct
stdim st, KDEXTS_LOCK_INFO ; NSTRUCT 変数を確保
st->SizeOfStruct = 100
mes "SizeOfStruct=" + st->SizeOfStruct