Win32 API 日本語リファレンス
ホームStorage.IscsiDisc › DUMP_DRIVER_EX

DUMP_DRIVER_EX

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

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

フィールド

フィールドサイズx64x86説明
DumpDriverListvoid*8/4+0+0次のダンプドライバ記述子への連結ポインタ。リスト末尾はNULLになる。
DriverNameWCHAR30+8+4ダンプ経路で読み込むドライバのファイル名を保持する固定長WCHAR配列。
BaseNameWCHAR30+38+34ドライバのベース名(拡張子を除いた名前)を保持する固定長WCHAR配列。
DriverFullPathNTSCSI_UNICODE_STRING16/8+72+64ドライバの完全パスを表すNTSCSI_UNICODE_STRING構造体。

各言語での定義

#include <windows.h>

// NTSCSI_UNICODE_STRING  (x64 16 / x86 8 バイト)
typedef struct NTSCSI_UNICODE_STRING {
    WORD Length;
    WORD MaximumLength;
    LPWSTR Buffer;
} NTSCSI_UNICODE_STRING;

// DUMP_DRIVER_EX  (x64 88 / x86 72 バイト)
typedef struct DUMP_DRIVER_EX {
    void* DumpDriverList;
    WCHAR DriverName[15];
    WCHAR BaseName[15];
    NTSCSI_UNICODE_STRING DriverFullPath;
} DUMP_DRIVER_EX;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NTSCSI_UNICODE_STRING
{
    public ushort Length;
    public ushort MaximumLength;
    public IntPtr Buffer;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DUMP_DRIVER_EX
{
    public IntPtr DumpDriverList;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 15)] public string DriverName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 15)] public string BaseName;
    public NTSCSI_UNICODE_STRING DriverFullPath;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NTSCSI_UNICODE_STRING
    Public Length As UShort
    Public MaximumLength As UShort
    Public Buffer As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DUMP_DRIVER_EX
    Public DumpDriverList As IntPtr
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=15)> Public DriverName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=15)> Public BaseName As String
    Public DriverFullPath As NTSCSI_UNICODE_STRING
End Structure
import ctypes
from ctypes import wintypes

class NTSCSI_UNICODE_STRING(ctypes.Structure):
    _fields_ = [
        ("Length", ctypes.c_ushort),
        ("MaximumLength", ctypes.c_ushort),
        ("Buffer", ctypes.c_void_p),
    ]

class DUMP_DRIVER_EX(ctypes.Structure):
    _fields_ = [
        ("DumpDriverList", ctypes.c_void_p),
        ("DriverName", ctypes.c_wchar * 15),
        ("BaseName", ctypes.c_wchar * 15),
        ("DriverFullPath", NTSCSI_UNICODE_STRING),
    ]
#[repr(C)]
pub struct NTSCSI_UNICODE_STRING {
    pub Length: u16,
    pub MaximumLength: u16,
    pub Buffer: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct DUMP_DRIVER_EX {
    pub DumpDriverList: *mut core::ffi::c_void,
    pub DriverName: [u16; 15],
    pub BaseName: [u16; 15],
    pub DriverFullPath: NTSCSI_UNICODE_STRING,
}
import "golang.org/x/sys/windows"

type NTSCSI_UNICODE_STRING struct {
	Length uint16
	MaximumLength uint16
	Buffer uintptr
}

type DUMP_DRIVER_EX struct {
	DumpDriverList uintptr
	DriverName [15]uint16
	BaseName [15]uint16
	DriverFullPath NTSCSI_UNICODE_STRING
}
type
  NTSCSI_UNICODE_STRING = record
    Length: Word;
    MaximumLength: Word;
    Buffer: Pointer;
  end;

  DUMP_DRIVER_EX = record
    DumpDriverList: Pointer;
    DriverName: array[0..14] of WideChar;
    BaseName: array[0..14] of WideChar;
    DriverFullPath: NTSCSI_UNICODE_STRING;
  end;
const NTSCSI_UNICODE_STRING = extern struct {
    Length: u16,
    MaximumLength: u16,
    Buffer: ?*anyopaque,
};

const DUMP_DRIVER_EX = extern struct {
    DumpDriverList: ?*anyopaque,
    DriverName: [15]u16,
    BaseName: [15]u16,
    DriverFullPath: NTSCSI_UNICODE_STRING,
};
type
  NTSCSI_UNICODE_STRING {.bycopy.} = object
    Length: uint16
    MaximumLength: uint16
    Buffer: pointer

  DUMP_DRIVER_EX {.bycopy.} = object
    DumpDriverList: pointer
    DriverName: array[15, uint16]
    BaseName: array[15, uint16]
    DriverFullPath: NTSCSI_UNICODE_STRING
struct NTSCSI_UNICODE_STRING
{
    ushort Length;
    ushort MaximumLength;
    void* Buffer;
}

struct DUMP_DRIVER_EX
{
    void* DumpDriverList;
    wchar[15] DriverName;
    wchar[15] BaseName;
    NTSCSI_UNICODE_STRING DriverFullPath;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DUMP_DRIVER_EX サイズ: 72 バイト(x86)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; DumpDriverList : void* (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; DriverName : WCHAR (+4, 30byte)  varptr(st)+4 を基点に操作(30byte:入れ子/配列)
; BaseName : WCHAR (+34, 30byte)  varptr(st)+34 を基点に操作(30byte:入れ子/配列)
; DriverFullPath : NTSCSI_UNICODE_STRING (+64, 8byte)  varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DUMP_DRIVER_EX サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; DumpDriverList : void* (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; DriverName : WCHAR (+8, 30byte)  varptr(st)+8 を基点に操作(30byte:入れ子/配列)
; BaseName : WCHAR (+38, 30byte)  varptr(st)+38 を基点に操作(30byte:入れ子/配列)
; DriverFullPath : NTSCSI_UNICODE_STRING (+72, 16byte)  varptr(st)+72 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NTSCSI_UNICODE_STRING
    #field short Length
    #field short MaximumLength
    #field intptr Buffer
#endstruct

#defstruct global DUMP_DRIVER_EX
    #field intptr DumpDriverList
    #field wchar DriverName 15
    #field wchar BaseName 15
    #field NTSCSI_UNICODE_STRING DriverFullPath
#endstruct

stdim st, DUMP_DRIVER_EX        ; NSTRUCT 変数を確保