ホーム › System.Diagnostics.Debug.Extensions › DEBUG_IRP_STACK_INFO
DEBUG_IRP_STACK_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Major | BYTE | 1 | +0 | +0 | IRPスタック位置のメジャー機能コード(IRP_MJ_*)。 |
| Minor | BYTE | 1 | +1 | +1 | IRPスタック位置のマイナー機能コード(IRP_MN_*)。 |
| DeviceObject | ULONGLONG | 8 | +8 | +8 | このスタック位置に対応するデバイスオブジェクトのアドレス。 |
| FileObject | ULONGLONG | 8 | +16 | +16 | 関連するファイルオブジェクトのアドレス。 |
| CompletionRoutine | ULONGLONG | 8 | +24 | +24 | 設定された完了ルーチンのアドレス。なければ0。 |
| StackAddress | ULONGLONG | 8 | +32 | +32 | この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;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;
}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 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),
]#[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,
}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_STACK_INFO = record
Major: Byte;
Minor: Byte;
DeviceObject: UInt64;
FileObject: UInt64;
CompletionRoutine: UInt64;
StackAddress: UInt64;
end;const DEBUG_IRP_STACK_INFO = extern struct {
Major: u8,
Minor: u8,
DeviceObject: u64,
FileObject: u64,
CompletionRoutine: u64,
StackAddress: u64,
};type
DEBUG_IRP_STACK_INFO {.bycopy.} = object
Major: uint8
Minor: uint8
DeviceObject: uint64
FileObject: uint64
CompletionRoutine: uint64
StackAddress: uint64struct DEBUG_IRP_STACK_INFO
{
ubyte Major;
ubyte Minor;
ulong DeviceObject;
ulong FileObject;
ulong CompletionRoutine;
ulong StackAddress;
}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_STACK_INFO サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Major : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; Minor : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; DeviceObject : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; FileObject : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; CompletionRoutine : ULONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; StackAddress : ULONGLONG (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#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
stdim st, DEBUG_IRP_STACK_INFO ; NSTRUCT 変数を確保
st->Major = 100
mes "Major=" + st->Major