ホーム › Devices.DeviceAndDriverInstallation › SP_DRVINFO_DATA_V2_W
SP_DRVINFO_DATA_V2_W
構造体サイズ=各フィールドのバイト数(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 | WCHAR | 512 | +16 | +12 | ドライバの説明文字列(Unicode)。固定長バッファ。 |
| MfgName | WCHAR | 512 | +528 | +524 | 製造元名(Unicode)。INF記載のメーカー名を格納する固定長バッファ。 |
| ProviderName | WCHAR | 512 | +1040 | +1036 | ドライバ提供元名(Unicode)。INFのプロバイダ名に対応する。 |
| DriverDate | FILETIME | 8 | +1552 | +1548 | ドライバの日付(FILETIME)。INF記載のドライバ日付に対応する。 |
| DriverVersion | ULONGLONG | 8 | +1560 | +1556 | ドライバのバージョン番号(64ビット値)。比較に利用する。 |
各言語での定義
#include <windows.h>
// FILETIME (x64 8 / x86 8 バイト)
typedef struct FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
// SP_DRVINFO_DATA_V2_W (x64 1568 / x86 1564 バイト)
#pragma pack(push, 1)
typedef struct SP_DRVINFO_DATA_V2_W {
DWORD cbSize;
DWORD DriverType;
UINT_PTR Reserved;
WCHAR Description[256];
WCHAR MfgName[256];
WCHAR ProviderName[256];
FILETIME DriverDate;
ULONGLONG DriverVersion;
} SP_DRVINFO_DATA_V2_W;
#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_W
{
public uint cbSize;
public uint DriverType;
public UIntPtr Reserved;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string Description;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string MfgName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string 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_W
Public cbSize As UInteger
Public DriverType As UInteger
Public Reserved As UIntPtr
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public Description As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public MfgName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public ProviderName As String
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_W(ctypes.Structure):
_pack_ = 1
_fields_ = [
("cbSize", wintypes.DWORD),
("DriverType", wintypes.DWORD),
("Reserved", ctypes.c_size_t),
("Description", ctypes.c_wchar * 256),
("MfgName", ctypes.c_wchar * 256),
("ProviderName", ctypes.c_wchar * 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_W {
pub cbSize: u32,
pub DriverType: u32,
pub Reserved: usize,
pub Description: [u16; 256],
pub MfgName: [u16; 256],
pub ProviderName: [u16; 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_W struct {
cbSize uint32
DriverType uint32
Reserved uintptr
Description [256]uint16
MfgName [256]uint16
ProviderName [256]uint16
DriverDate FILETIME
DriverVersion uint64
}type
FILETIME = record
dwLowDateTime: DWORD;
dwHighDateTime: DWORD;
end;
SP_DRVINFO_DATA_V2_W = packed record
cbSize: DWORD;
DriverType: DWORD;
Reserved: NativeUInt;
Description: array[0..255] of WideChar;
MfgName: array[0..255] of WideChar;
ProviderName: array[0..255] of WideChar;
DriverDate: FILETIME;
DriverVersion: UInt64;
end;const FILETIME = extern struct {
dwLowDateTime: u32,
dwHighDateTime: u32,
};
const SP_DRVINFO_DATA_V2_W = extern struct {
cbSize: u32,
DriverType: u32,
Reserved: usize,
Description: [256]u16,
MfgName: [256]u16,
ProviderName: [256]u16,
DriverDate: FILETIME,
DriverVersion: u64,
};type
FILETIME {.bycopy.} = object
dwLowDateTime: uint32
dwHighDateTime: uint32
SP_DRVINFO_DATA_V2_W {.packed.} = object
cbSize: uint32
DriverType: uint32
Reserved: uint
Description: array[256, uint16]
MfgName: array[256, uint16]
ProviderName: array[256, uint16]
DriverDate: FILETIME
DriverVersion: uint64struct FILETIME
{
uint dwLowDateTime;
uint dwHighDateTime;
}
align(1)
struct SP_DRVINFO_DATA_V2_W
{
uint cbSize;
uint DriverType;
size_t Reserved;
wchar[256] Description;
wchar[256] MfgName;
wchar[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_W サイズ: 1564 バイト(x86)
dim st, 391 ; 4byte整数×391(構造体サイズ 1564 / 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 : WCHAR (+12, 512byte) varptr(st)+12 を基点に操作(512byte:入れ子/配列)
; MfgName : WCHAR (+524, 512byte) varptr(st)+524 を基点に操作(512byte:入れ子/配列)
; ProviderName : WCHAR (+1036, 512byte) varptr(st)+1036 を基点に操作(512byte:入れ子/配列)
; DriverDate : FILETIME (+1548, 8byte) varptr(st)+1548 を基点に操作(8byte:入れ子/配列)
; DriverVersion : ULONGLONG (+1556, 8byte) qpoke st,1556,値 / qpeek(st,1556) ※IronHSPのみ。3.7/3.8は lpoke st,1556,下位 : lpoke st,1560,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SP_DRVINFO_DATA_V2_W サイズ: 1568 バイト(x64)
dim st, 392 ; 4byte整数×392(構造体サイズ 1568 / 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 : WCHAR (+16, 512byte) varptr(st)+16 を基点に操作(512byte:入れ子/配列)
; MfgName : WCHAR (+528, 512byte) varptr(st)+528 を基点に操作(512byte:入れ子/配列)
; ProviderName : WCHAR (+1040, 512byte) varptr(st)+1040 を基点に操作(512byte:入れ子/配列)
; DriverDate : FILETIME (+1552, 8byte) varptr(st)+1552 を基点に操作(8byte:入れ子/配列)
; DriverVersion : ULONGLONG (+1560, 8byte) qpoke st,1560,値 / qpeek(st,1560) ※IronHSPのみ。3.7/3.8は lpoke st,1560,下位 : lpoke st,1564,上位
; ※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_W, pack=1
#field int cbSize
#field int DriverType
#field intptr Reserved
#field wchar Description 256
#field wchar MfgName 256
#field wchar ProviderName 256
#field FILETIME DriverDate
#field int64 DriverVersion
#endstruct
stdim st, SP_DRVINFO_DATA_V2_W ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize