Win32 API 日本語リファレンス
ホームDevices.DeviceAndDriverInstallation › SP_INF_INFORMATION

SP_INF_INFORMATION

構造体
サイズx64: 9 バイト / x86: 9 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
InfStyleINF_STYLE4+0+0INFのスタイルを示す値(INF_STYLE_OLDNT/WIN4など)。
InfCountDWORD4+4+4結合されたINFファイルの数。付加INFを含む総数。
VersionDataBYTE1+8+8各INFのバージョン情報を格納する可変長バイト配列の先頭。

各言語での定義

#include <windows.h>

// SP_INF_INFORMATION  (x64 9 / x86 9 バイト)
#pragma pack(push, 1)
typedef struct SP_INF_INFORMATION {
    INF_STYLE InfStyle;
    DWORD InfCount;
    BYTE VersionData[1];
} SP_INF_INFORMATION;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct SP_INF_INFORMATION
{
    public uint InfStyle;
    public uint InfCount;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] VersionData;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure SP_INF_INFORMATION
    Public InfStyle As UInteger
    Public InfCount As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public VersionData() As Byte
End Structure
import ctypes
from ctypes import wintypes

class SP_INF_INFORMATION(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("InfStyle", wintypes.DWORD),
        ("InfCount", wintypes.DWORD),
        ("VersionData", ctypes.c_ubyte * 1),
    ]
#[repr(C, packed(1))]
pub struct SP_INF_INFORMATION {
    pub InfStyle: u32,
    pub InfCount: u32,
    pub VersionData: [u8; 1],
}
import "golang.org/x/sys/windows"

type SP_INF_INFORMATION struct {
	InfStyle uint32
	InfCount uint32
	VersionData [1]byte
}
type
  SP_INF_INFORMATION = packed record
    InfStyle: DWORD;
    InfCount: DWORD;
    VersionData: array[0..0] of Byte;
  end;
const SP_INF_INFORMATION = extern struct {
    InfStyle: u32,
    InfCount: u32,
    VersionData: [1]u8,
};
type
  SP_INF_INFORMATION {.packed.} = object
    InfStyle: uint32
    InfCount: uint32
    VersionData: array[1, uint8]
align(1)
struct SP_INF_INFORMATION
{
    uint InfStyle;
    uint InfCount;
    ubyte[1] VersionData;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SP_INF_INFORMATION サイズ: 9 バイト(x64)
dim st, 3    ; 4byte整数×3(構造体サイズ 9 / 4 切り上げ)
; InfStyle : INF_STYLE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; InfCount : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; VersionData : BYTE (+8, 1byte)  varptr(st)+8 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SP_INF_INFORMATION, pack=1
    #field int InfStyle
    #field int InfCount
    #field byte VersionData 1
#endstruct

stdim st, SP_INF_INFORMATION        ; NSTRUCT 変数を確保
st->InfStyle = 100
mes "InfStyle=" + st->InfStyle