ホーム › Devices.DeviceAndDriverInstallation › SP_DRVINFO_DATA_V2_A
SP_DRVINFO_DATA_V2_A
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のバイト単位サイズ。V2版識別のため正しく設定する。 |
| DriverType | DWORD | 4 | +4 | +4 | ドライバの種類を示す値(SPDIT_*)。 |
| Reserved | UINT_PTR | 8/4 | +8 | +8 | システム内部利用の予約領域。参照・変更してはならない。 |
| Description | CHAR | 256 | +16 | +12 | ドライバの説明文字列(ANSI)。固定長バッファ。 |
| MfgName | CHAR | 256 | +272 | +268 | 製造元名(ANSI)。INF記載のメーカー名を格納する固定長バッファ。 |
| ProviderName | CHAR | 256 | +528 | +524 | ドライバ提供元名(ANSI)。INFのプロバイダ名に対応する。 |
| DriverDate | FILETIME | 8 | +784 | +780 | ドライバの日付(FILETIME)。INF記載のドライバ日付に対応する。 |
| DriverVersion | ULONGLONG | 8 | +792 | +788 | ドライバのバージョン番号(64ビット値)。比較に利用する。 |
各言語での定義
#include <windows.h>
// FILETIME (x64 8 / x86 8 バイト)
typedef struct FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
// SP_DRVINFO_DATA_V2_A (x64 800 / x86 796 バイト)
#pragma pack(push, 1)
typedef struct SP_DRVINFO_DATA_V2_A {
DWORD cbSize;
DWORD DriverType;
UINT_PTR Reserved;
CHAR Description[256];
CHAR MfgName[256];
CHAR ProviderName[256];
FILETIME DriverDate;
ULONGLONG DriverVersion;
} SP_DRVINFO_DATA_V2_A;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILETIME
{
public uint dwLowDateTime;
public uint dwHighDateTime;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct SP_DRVINFO_DATA_V2_A
{
public uint cbSize;
public uint DriverType;
public UIntPtr Reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public sbyte[] Description;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public sbyte[] MfgName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public sbyte[] ProviderName;
public FILETIME DriverDate;
public ulong DriverVersion;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILETIME
Public dwLowDateTime As UInteger
Public dwHighDateTime As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure SP_DRVINFO_DATA_V2_A
Public cbSize As UInteger
Public DriverType As UInteger
Public Reserved As UIntPtr
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public Description() As SByte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public MfgName() As SByte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public ProviderName() As SByte
Public DriverDate As FILETIME
Public DriverVersion As ULong
End Structureimport ctypes
from ctypes import wintypes
class FILETIME(ctypes.Structure):
_fields_ = [
("dwLowDateTime", wintypes.DWORD),
("dwHighDateTime", wintypes.DWORD),
]
class SP_DRVINFO_DATA_V2_A(ctypes.Structure):
_pack_ = 1
_fields_ = [
("cbSize", wintypes.DWORD),
("DriverType", wintypes.DWORD),
("Reserved", ctypes.c_size_t),
("Description", ctypes.c_byte * 256),
("MfgName", ctypes.c_byte * 256),
("ProviderName", ctypes.c_byte * 256),
("DriverDate", FILETIME),
("DriverVersion", ctypes.c_ulonglong),
]#[repr(C)]
pub struct FILETIME {
pub dwLowDateTime: u32,
pub dwHighDateTime: u32,
}
#[repr(C, packed(1))]
pub struct SP_DRVINFO_DATA_V2_A {
pub cbSize: u32,
pub DriverType: u32,
pub Reserved: usize,
pub Description: [i8; 256],
pub MfgName: [i8; 256],
pub ProviderName: [i8; 256],
pub DriverDate: FILETIME,
pub DriverVersion: u64,
}import "golang.org/x/sys/windows"
type FILETIME struct {
dwLowDateTime uint32
dwHighDateTime uint32
}
type SP_DRVINFO_DATA_V2_A struct {
cbSize uint32
DriverType uint32
Reserved uintptr
Description [256]int8
MfgName [256]int8
ProviderName [256]int8
DriverDate FILETIME
DriverVersion uint64
}type
FILETIME = record
dwLowDateTime: DWORD;
dwHighDateTime: DWORD;
end;
SP_DRVINFO_DATA_V2_A = packed record
cbSize: DWORD;
DriverType: DWORD;
Reserved: NativeUInt;
Description: array[0..255] of Shortint;
MfgName: array[0..255] of Shortint;
ProviderName: array[0..255] of Shortint;
DriverDate: FILETIME;
DriverVersion: UInt64;
end;const FILETIME = extern struct {
dwLowDateTime: u32,
dwHighDateTime: u32,
};
const SP_DRVINFO_DATA_V2_A = extern struct {
cbSize: u32,
DriverType: u32,
Reserved: usize,
Description: [256]i8,
MfgName: [256]i8,
ProviderName: [256]i8,
DriverDate: FILETIME,
DriverVersion: u64,
};type
FILETIME {.bycopy.} = object
dwLowDateTime: uint32
dwHighDateTime: uint32
SP_DRVINFO_DATA_V2_A {.packed.} = object
cbSize: uint32
DriverType: uint32
Reserved: uint
Description: array[256, int8]
MfgName: array[256, int8]
ProviderName: array[256, int8]
DriverDate: FILETIME
DriverVersion: uint64struct FILETIME
{
uint dwLowDateTime;
uint dwHighDateTime;
}
align(1)
struct SP_DRVINFO_DATA_V2_A
{
uint cbSize;
uint DriverType;
size_t Reserved;
byte[256] Description;
byte[256] MfgName;
byte[256] ProviderName;
FILETIME DriverDate;
ulong DriverVersion;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SP_DRVINFO_DATA_V2_A サイズ: 796 バイト(x86)
dim st, 199 ; 4byte整数×199(構造体サイズ 796 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; DriverType : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Reserved : UINT_PTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Description : CHAR (+12, 256byte) varptr(st)+12 を基点に操作(256byte:入れ子/配列)
; MfgName : CHAR (+268, 256byte) varptr(st)+268 を基点に操作(256byte:入れ子/配列)
; ProviderName : CHAR (+524, 256byte) varptr(st)+524 を基点に操作(256byte:入れ子/配列)
; DriverDate : FILETIME (+780, 8byte) varptr(st)+780 を基点に操作(8byte:入れ子/配列)
; DriverVersion : ULONGLONG (+788, 8byte) qpoke st,788,値 / qpeek(st,788) ※IronHSPのみ。3.7/3.8は lpoke st,788,下位 : lpoke st,792,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SP_DRVINFO_DATA_V2_A サイズ: 800 バイト(x64)
dim st, 200 ; 4byte整数×200(構造体サイズ 800 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; DriverType : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Reserved : UINT_PTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Description : CHAR (+16, 256byte) varptr(st)+16 を基点に操作(256byte:入れ子/配列)
; MfgName : CHAR (+272, 256byte) varptr(st)+272 を基点に操作(256byte:入れ子/配列)
; ProviderName : CHAR (+528, 256byte) varptr(st)+528 を基点に操作(256byte:入れ子/配列)
; DriverDate : FILETIME (+784, 8byte) varptr(st)+784 を基点に操作(8byte:入れ子/配列)
; DriverVersion : ULONGLONG (+792, 8byte) qpoke st,792,値 / qpeek(st,792) ※IronHSPのみ。3.7/3.8は lpoke st,792,下位 : lpoke st,796,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global FILETIME
#field int dwLowDateTime
#field int dwHighDateTime
#endstruct
#defstruct global SP_DRVINFO_DATA_V2_A, pack=1
#field int cbSize
#field int DriverType
#field intptr Reserved
#field byte Description 256
#field byte MfgName 256
#field byte ProviderName 256
#field FILETIME DriverDate
#field int64 DriverVersion
#endstruct
stdim st, SP_DRVINFO_DATA_V2_A ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize