ホーム › Devices.DeviceAndDriverInstallation › SP_DRVINFO_DATA_V1_W
SP_DRVINFO_DATA_V1_W
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のバイト単位サイズ。呼び出し前に設定し、APIのバージョン判定に用いる。 |
| DriverType | DWORD | 4 | +4 | +4 | ドライバの種類を示す値。SPDIT_CLASSDRIVER等の定数で分類区分を表す。 |
| Reserved | UINT_PTR | 8/4 | +8 | +8 | システム内部利用の予約領域。アプリ側で参照・変更してはならない。 |
| Description | WCHAR | 512 | +16 | +12 | ドライバの説明文字列(Unicode)。INFのドライバ説明欄に対応する固定長バッファ。 |
| MfgName | WCHAR | 512 | +528 | +524 | 製造元名を表すUnicode文字列。INF記載のメーカー名を格納する固定長バッファ。 |
| ProviderName | WCHAR | 512 | +1040 | +1036 | ドライバ提供元名のUnicode文字列。INFのプロバイダ名に対応する。 |
各言語での定義
#include <windows.h>
// SP_DRVINFO_DATA_V1_W (x64 1552 / x86 1548 バイト)
#pragma pack(push, 1)
typedef struct SP_DRVINFO_DATA_V1_W {
DWORD cbSize;
DWORD DriverType;
UINT_PTR Reserved;
WCHAR Description[256];
WCHAR MfgName[256];
WCHAR ProviderName[256];
} SP_DRVINFO_DATA_V1_W;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct SP_DRVINFO_DATA_V1_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;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure SP_DRVINFO_DATA_V1_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
End Structureimport ctypes
from ctypes import wintypes
class SP_DRVINFO_DATA_V1_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),
]#[repr(C, packed(1))]
pub struct SP_DRVINFO_DATA_V1_W {
pub cbSize: u32,
pub DriverType: u32,
pub Reserved: usize,
pub Description: [u16; 256],
pub MfgName: [u16; 256],
pub ProviderName: [u16; 256],
}import "golang.org/x/sys/windows"
type SP_DRVINFO_DATA_V1_W struct {
cbSize uint32
DriverType uint32
Reserved uintptr
Description [256]uint16
MfgName [256]uint16
ProviderName [256]uint16
}type
SP_DRVINFO_DATA_V1_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;
end;const SP_DRVINFO_DATA_V1_W = extern struct {
cbSize: u32,
DriverType: u32,
Reserved: usize,
Description: [256]u16,
MfgName: [256]u16,
ProviderName: [256]u16,
};type
SP_DRVINFO_DATA_V1_W {.packed.} = object
cbSize: uint32
DriverType: uint32
Reserved: uint
Description: array[256, uint16]
MfgName: array[256, uint16]
ProviderName: array[256, uint16]align(1)
struct SP_DRVINFO_DATA_V1_W
{
uint cbSize;
uint DriverType;
size_t Reserved;
wchar[256] Description;
wchar[256] MfgName;
wchar[256] ProviderName;
}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_V1_W サイズ: 1548 バイト(x86)
dim st, 387 ; 4byte整数×387(構造体サイズ 1548 / 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:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SP_DRVINFO_DATA_V1_W サイズ: 1552 バイト(x64)
dim st, 388 ; 4byte整数×388(構造体サイズ 1552 / 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:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SP_DRVINFO_DATA_V1_W, pack=1
#field int cbSize
#field int DriverType
#field intptr Reserved
#field wchar Description 256
#field wchar MfgName 256
#field wchar ProviderName 256
#endstruct
stdim st, SP_DRVINFO_DATA_V1_W ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize