ホーム › System.Diagnostics.Debug.Extensions › DBGKD_GET_VERSION64
DBGKD_GET_VERSION64
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| MajorVersion | WORD | 2 | +0 | +0 | OSのメジャーバージョン番号。 |
| MinorVersion | WORD | 2 | +2 | +2 | OSのマイナーバージョン番号(ビルド番号)。 |
| ProtocolVersion | BYTE | 1 | +4 | +4 | カーネルデバッグプロトコルのバージョン。 |
| KdSecondaryVersion | BYTE | 1 | +5 | +5 | カーネルデバッグの副次バージョン番号。 |
| Flags | WORD | 2 | +6 | +6 | バージョン情報のフラグ(64ビット対応等)。 |
| MachineType | WORD | 2 | +8 | +8 | 対象マシンのアーキテクチャ種別。 |
| MaxPacketType | BYTE | 1 | +10 | +10 | サポートする最大パケット種別番号。 |
| MaxStateChange | BYTE | 1 | +11 | +11 | サポートする最大状態変化種別番号。 |
| MaxManipulate | BYTE | 1 | +12 | +12 | サポートする最大操作種別番号。 |
| Simulation | BYTE | 1 | +13 | +13 | シミュレーション環境かを示す値。 |
| Unused | WORD | 2 | +14 | +14 | 未使用の予約フィールド。 |
| KernBase | ULONGLONG | 8 | +16 | +16 | カーネルイメージの基底アドレス(64ビット)。 |
| PsLoadedModuleList | ULONGLONG | 8 | +24 | +24 | 読み込み済みモジュールリストのアドレス(64ビット)。 |
| DebuggerDataList | ULONGLONG | 8 | +32 | +32 | デバッガデータブロックリストのアドレス(64ビット)。 |
各言語での定義
#include <windows.h>
// DBGKD_GET_VERSION64 (x64 40 / x86 40 バイト)
typedef struct DBGKD_GET_VERSION64 {
WORD MajorVersion;
WORD MinorVersion;
BYTE ProtocolVersion;
BYTE KdSecondaryVersion;
WORD Flags;
WORD MachineType;
BYTE MaxPacketType;
BYTE MaxStateChange;
BYTE MaxManipulate;
BYTE Simulation;
WORD Unused[1];
ULONGLONG KernBase;
ULONGLONG PsLoadedModuleList;
ULONGLONG DebuggerDataList;
} DBGKD_GET_VERSION64;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DBGKD_GET_VERSION64
{
public ushort MajorVersion;
public ushort MinorVersion;
public byte ProtocolVersion;
public byte KdSecondaryVersion;
public ushort Flags;
public ushort MachineType;
public byte MaxPacketType;
public byte MaxStateChange;
public byte MaxManipulate;
public byte Simulation;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public ushort[] Unused;
public ulong KernBase;
public ulong PsLoadedModuleList;
public ulong DebuggerDataList;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DBGKD_GET_VERSION64
Public MajorVersion As UShort
Public MinorVersion As UShort
Public ProtocolVersion As Byte
Public KdSecondaryVersion As Byte
Public Flags As UShort
Public MachineType As UShort
Public MaxPacketType As Byte
Public MaxStateChange As Byte
Public MaxManipulate As Byte
Public Simulation As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Unused() As UShort
Public KernBase As ULong
Public PsLoadedModuleList As ULong
Public DebuggerDataList As ULong
End Structureimport ctypes
from ctypes import wintypes
class DBGKD_GET_VERSION64(ctypes.Structure):
_fields_ = [
("MajorVersion", ctypes.c_ushort),
("MinorVersion", ctypes.c_ushort),
("ProtocolVersion", ctypes.c_ubyte),
("KdSecondaryVersion", ctypes.c_ubyte),
("Flags", ctypes.c_ushort),
("MachineType", ctypes.c_ushort),
("MaxPacketType", ctypes.c_ubyte),
("MaxStateChange", ctypes.c_ubyte),
("MaxManipulate", ctypes.c_ubyte),
("Simulation", ctypes.c_ubyte),
("Unused", ctypes.c_ushort * 1),
("KernBase", ctypes.c_ulonglong),
("PsLoadedModuleList", ctypes.c_ulonglong),
("DebuggerDataList", ctypes.c_ulonglong),
]#[repr(C)]
pub struct DBGKD_GET_VERSION64 {
pub MajorVersion: u16,
pub MinorVersion: u16,
pub ProtocolVersion: u8,
pub KdSecondaryVersion: u8,
pub Flags: u16,
pub MachineType: u16,
pub MaxPacketType: u8,
pub MaxStateChange: u8,
pub MaxManipulate: u8,
pub Simulation: u8,
pub Unused: [u16; 1],
pub KernBase: u64,
pub PsLoadedModuleList: u64,
pub DebuggerDataList: u64,
}import "golang.org/x/sys/windows"
type DBGKD_GET_VERSION64 struct {
MajorVersion uint16
MinorVersion uint16
ProtocolVersion byte
KdSecondaryVersion byte
Flags uint16
MachineType uint16
MaxPacketType byte
MaxStateChange byte
MaxManipulate byte
Simulation byte
Unused [1]uint16
KernBase uint64
PsLoadedModuleList uint64
DebuggerDataList uint64
}type
DBGKD_GET_VERSION64 = record
MajorVersion: Word;
MinorVersion: Word;
ProtocolVersion: Byte;
KdSecondaryVersion: Byte;
Flags: Word;
MachineType: Word;
MaxPacketType: Byte;
MaxStateChange: Byte;
MaxManipulate: Byte;
Simulation: Byte;
Unused: array[0..0] of Word;
KernBase: UInt64;
PsLoadedModuleList: UInt64;
DebuggerDataList: UInt64;
end;const DBGKD_GET_VERSION64 = extern struct {
MajorVersion: u16,
MinorVersion: u16,
ProtocolVersion: u8,
KdSecondaryVersion: u8,
Flags: u16,
MachineType: u16,
MaxPacketType: u8,
MaxStateChange: u8,
MaxManipulate: u8,
Simulation: u8,
Unused: [1]u16,
KernBase: u64,
PsLoadedModuleList: u64,
DebuggerDataList: u64,
};type
DBGKD_GET_VERSION64 {.bycopy.} = object
MajorVersion: uint16
MinorVersion: uint16
ProtocolVersion: uint8
KdSecondaryVersion: uint8
Flags: uint16
MachineType: uint16
MaxPacketType: uint8
MaxStateChange: uint8
MaxManipulate: uint8
Simulation: uint8
Unused: array[1, uint16]
KernBase: uint64
PsLoadedModuleList: uint64
DebuggerDataList: uint64struct DBGKD_GET_VERSION64
{
ushort MajorVersion;
ushort MinorVersion;
ubyte ProtocolVersion;
ubyte KdSecondaryVersion;
ushort Flags;
ushort MachineType;
ubyte MaxPacketType;
ubyte MaxStateChange;
ubyte MaxManipulate;
ubyte Simulation;
ushort[1] Unused;
ulong KernBase;
ulong PsLoadedModuleList;
ulong DebuggerDataList;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DBGKD_GET_VERSION64 サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; MajorVersion : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; MinorVersion : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; ProtocolVersion : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; KdSecondaryVersion : BYTE (+5, 1byte) poke st,5,値 / 値 = peek(st,5)
; Flags : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; MachineType : WORD (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; MaxPacketType : BYTE (+10, 1byte) poke st,10,値 / 値 = peek(st,10)
; MaxStateChange : BYTE (+11, 1byte) poke st,11,値 / 値 = peek(st,11)
; MaxManipulate : BYTE (+12, 1byte) poke st,12,値 / 値 = peek(st,12)
; Simulation : BYTE (+13, 1byte) poke st,13,値 / 値 = peek(st,13)
; Unused : WORD (+14, 2byte) varptr(st)+14 を基点に操作(2byte:入れ子/配列)
; KernBase : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; PsLoadedModuleList : ULONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; DebuggerDataList : 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 DBGKD_GET_VERSION64
#field short MajorVersion
#field short MinorVersion
#field byte ProtocolVersion
#field byte KdSecondaryVersion
#field short Flags
#field short MachineType
#field byte MaxPacketType
#field byte MaxStateChange
#field byte MaxManipulate
#field byte Simulation
#field short Unused 1
#field int64 KernBase
#field int64 PsLoadedModuleList
#field int64 DebuggerDataList
#endstruct
stdim st, DBGKD_GET_VERSION64 ; NSTRUCT 変数を確保
st->MajorVersion = 100
mes "MajorVersion=" + st->MajorVersion