ホーム › System.Diagnostics.Debug.Extensions › DEBUG_IRP_INFO
DEBUG_IRP_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SizeOfStruct | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。呼び出し前に設定する。 |
| IrpAddress | ULONGLONG | 8 | +8 | +8 | IRP本体のアドレス。 |
| IoStatus | DWORD | 4 | +16 | +16 | IRPのI/Oステータス値。 |
| StackCount | DWORD | 4 | +20 | +20 | IRPが持つスタック位置の数。 |
| CurrentLocation | DWORD | 4 | +24 | +24 | 現在のIRPスタック位置のインデックス。 |
| MdlAddress | ULONGLONG | 8 | +32 | +32 | 関連するMDL(メモリ記述子リスト)のアドレス。 |
| Thread | ULONGLONG | 8 | +40 | +40 | IRPを発行したスレッドのアドレス。 |
| CancelRoutine | ULONGLONG | 8 | +48 | +48 | 設定されたキャンセルルーチンのアドレス。なければ0。 |
| CurrentStack | DEBUG_IRP_STACK_INFO | 40 | +56 | +56 | 現在のIRPスタック位置情報(DEBUG_IRP_STACK_INFO)。 |
| Stack | DEBUG_IRP_STACK_INFO | 400 | +96 | +96 | 全IRPスタック位置情報の配列の先頭。 |
各言語での定義
#include <windows.h>
// DEBUG_IRP_STACK_INFO (x64 40 / x86 40 バイト)
typedef struct DEBUG_IRP_STACK_INFO {
BYTE Major;
BYTE Minor;
ULONGLONG DeviceObject;
ULONGLONG FileObject;
ULONGLONG CompletionRoutine;
ULONGLONG StackAddress;
} DEBUG_IRP_STACK_INFO;
// DEBUG_IRP_INFO (x64 496 / x86 496 バイト)
typedef struct DEBUG_IRP_INFO {
DWORD SizeOfStruct;
ULONGLONG IrpAddress;
DWORD IoStatus;
DWORD StackCount;
DWORD CurrentLocation;
ULONGLONG MdlAddress;
ULONGLONG Thread;
ULONGLONG CancelRoutine;
DEBUG_IRP_STACK_INFO CurrentStack;
DEBUG_IRP_STACK_INFO Stack[10];
} DEBUG_IRP_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEBUG_IRP_STACK_INFO
{
public byte Major;
public byte Minor;
public ulong DeviceObject;
public ulong FileObject;
public ulong CompletionRoutine;
public ulong StackAddress;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEBUG_IRP_INFO
{
public uint SizeOfStruct;
public ulong IrpAddress;
public uint IoStatus;
public uint StackCount;
public uint CurrentLocation;
public ulong MdlAddress;
public ulong Thread;
public ulong CancelRoutine;
public DEBUG_IRP_STACK_INFO CurrentStack;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public DEBUG_IRP_STACK_INFO[] Stack;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEBUG_IRP_STACK_INFO
Public Major As Byte
Public Minor As Byte
Public DeviceObject As ULong
Public FileObject As ULong
Public CompletionRoutine As ULong
Public StackAddress As ULong
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEBUG_IRP_INFO
Public SizeOfStruct As UInteger
Public IrpAddress As ULong
Public IoStatus As UInteger
Public StackCount As UInteger
Public CurrentLocation As UInteger
Public MdlAddress As ULong
Public Thread As ULong
Public CancelRoutine As ULong
Public CurrentStack As DEBUG_IRP_STACK_INFO
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Public Stack() As DEBUG_IRP_STACK_INFO
End Structureimport ctypes
from ctypes import wintypes
class DEBUG_IRP_STACK_INFO(ctypes.Structure):
_fields_ = [
("Major", ctypes.c_ubyte),
("Minor", ctypes.c_ubyte),
("DeviceObject", ctypes.c_ulonglong),
("FileObject", ctypes.c_ulonglong),
("CompletionRoutine", ctypes.c_ulonglong),
("StackAddress", ctypes.c_ulonglong),
]
class DEBUG_IRP_INFO(ctypes.Structure):
_fields_ = [
("SizeOfStruct", wintypes.DWORD),
("IrpAddress", ctypes.c_ulonglong),
("IoStatus", wintypes.DWORD),
("StackCount", wintypes.DWORD),
("CurrentLocation", wintypes.DWORD),
("MdlAddress", ctypes.c_ulonglong),
("Thread", ctypes.c_ulonglong),
("CancelRoutine", ctypes.c_ulonglong),
("CurrentStack", DEBUG_IRP_STACK_INFO),
("Stack", DEBUG_IRP_STACK_INFO * 10),
]#[repr(C)]
pub struct DEBUG_IRP_STACK_INFO {
pub Major: u8,
pub Minor: u8,
pub DeviceObject: u64,
pub FileObject: u64,
pub CompletionRoutine: u64,
pub StackAddress: u64,
}
#[repr(C)]
pub struct DEBUG_IRP_INFO {
pub SizeOfStruct: u32,
pub IrpAddress: u64,
pub IoStatus: u32,
pub StackCount: u32,
pub CurrentLocation: u32,
pub MdlAddress: u64,
pub Thread: u64,
pub CancelRoutine: u64,
pub CurrentStack: DEBUG_IRP_STACK_INFO,
pub Stack: [DEBUG_IRP_STACK_INFO; 10],
}import "golang.org/x/sys/windows"
type DEBUG_IRP_STACK_INFO struct {
Major byte
Minor byte
DeviceObject uint64
FileObject uint64
CompletionRoutine uint64
StackAddress uint64
}
type DEBUG_IRP_INFO struct {
SizeOfStruct uint32
IrpAddress uint64
IoStatus uint32
StackCount uint32
CurrentLocation uint32
MdlAddress uint64
Thread uint64
CancelRoutine uint64
CurrentStack DEBUG_IRP_STACK_INFO
Stack [10]DEBUG_IRP_STACK_INFO
}type
DEBUG_IRP_STACK_INFO = record
Major: Byte;
Minor: Byte;
DeviceObject: UInt64;
FileObject: UInt64;
CompletionRoutine: UInt64;
StackAddress: UInt64;
end;
DEBUG_IRP_INFO = record
SizeOfStruct: DWORD;
IrpAddress: UInt64;
IoStatus: DWORD;
StackCount: DWORD;
CurrentLocation: DWORD;
MdlAddress: UInt64;
Thread: UInt64;
CancelRoutine: UInt64;
CurrentStack: DEBUG_IRP_STACK_INFO;
Stack: array[0..9] of DEBUG_IRP_STACK_INFO;
end;const DEBUG_IRP_STACK_INFO = extern struct {
Major: u8,
Minor: u8,
DeviceObject: u64,
FileObject: u64,
CompletionRoutine: u64,
StackAddress: u64,
};
const DEBUG_IRP_INFO = extern struct {
SizeOfStruct: u32,
IrpAddress: u64,
IoStatus: u32,
StackCount: u32,
CurrentLocation: u32,
MdlAddress: u64,
Thread: u64,
CancelRoutine: u64,
CurrentStack: DEBUG_IRP_STACK_INFO,
Stack: [10]DEBUG_IRP_STACK_INFO,
};type
DEBUG_IRP_STACK_INFO {.bycopy.} = object
Major: uint8
Minor: uint8
DeviceObject: uint64
FileObject: uint64
CompletionRoutine: uint64
StackAddress: uint64
DEBUG_IRP_INFO {.bycopy.} = object
SizeOfStruct: uint32
IrpAddress: uint64
IoStatus: uint32
StackCount: uint32
CurrentLocation: uint32
MdlAddress: uint64
Thread: uint64
CancelRoutine: uint64
CurrentStack: DEBUG_IRP_STACK_INFO
Stack: array[10, DEBUG_IRP_STACK_INFO]struct DEBUG_IRP_STACK_INFO
{
ubyte Major;
ubyte Minor;
ulong DeviceObject;
ulong FileObject;
ulong CompletionRoutine;
ulong StackAddress;
}
struct DEBUG_IRP_INFO
{
uint SizeOfStruct;
ulong IrpAddress;
uint IoStatus;
uint StackCount;
uint CurrentLocation;
ulong MdlAddress;
ulong Thread;
ulong CancelRoutine;
DEBUG_IRP_STACK_INFO CurrentStack;
DEBUG_IRP_STACK_INFO[10] Stack;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEBUG_IRP_INFO サイズ: 496 バイト(x64)
dim st, 124 ; 4byte整数×124(構造体サイズ 496 / 4 切り上げ)
; SizeOfStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; IrpAddress : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; IoStatus : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; StackCount : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; CurrentLocation : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; MdlAddress : ULONGLONG (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; Thread : ULONGLONG (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; CancelRoutine : ULONGLONG (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; CurrentStack : DEBUG_IRP_STACK_INFO (+56, 40byte) varptr(st)+56 を基点に操作(40byte:入れ子/配列)
; Stack : DEBUG_IRP_STACK_INFO (+96, 400byte) varptr(st)+96 を基点に操作(400byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DEBUG_IRP_STACK_INFO
#field byte Major
#field byte Minor
#field int64 DeviceObject
#field int64 FileObject
#field int64 CompletionRoutine
#field int64 StackAddress
#endstruct
#defstruct global DEBUG_IRP_INFO
#field int SizeOfStruct
#field int64 IrpAddress
#field int IoStatus
#field int StackCount
#field int CurrentLocation
#field int64 MdlAddress
#field int64 Thread
#field int64 CancelRoutine
#field DEBUG_IRP_STACK_INFO CurrentStack
#field DEBUG_IRP_STACK_INFO Stack 10
#endstruct
stdim st, DEBUG_IRP_INFO ; NSTRUCT 変数を確保
st->SizeOfStruct = 100
mes "SizeOfStruct=" + st->SizeOfStruct