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

SetupQueryInfVersionInformationW

関数
INFのバージョン情報セクションから指定キーの値を取得する(Unicode)。
DLLSETUPAPI.dll文字セットUnicode (-W)呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

// SETUPAPI.dll  (Unicode / -W)
#include <windows.h>

BOOL SetupQueryInfVersionInformationW(
    SP_INF_INFORMATION* InfInformation,
    DWORD InfIndex,
    LPCWSTR Key,   // optional
    LPWSTR ReturnBuffer,   // optional
    DWORD ReturnBufferSize,
    DWORD* RequiredSize   // optional
);

パラメーター

名前方向説明
InfInformationSP_INF_INFORMATION*in対象のSP_INF_INFORMATION構造体へのポインタ。
InfIndexDWORDin問い合わせる構成INFのインデックス(0起点)。
KeyLPCWSTRinoptional取得するバージョン情報のキー名(Unicode)。Versionセクションのキーを指定する。
ReturnBufferLPWSTRoutoptionalキーに対応する値を受け取る文字列バッファ(Unicode)。NULLでサイズ取得のみ可。
ReturnBufferSizeDWORDinReturnBufferのサイズ(文字数)。
RequiredSizeDWORD*outoptional必要なバッファサイズを受け取る出力ポインタ。NULL可。

戻り値の型: BOOL

各言語での呼び出し定義

// SETUPAPI.dll  (Unicode / -W)
#include <windows.h>

BOOL SetupQueryInfVersionInformationW(
    SP_INF_INFORMATION* InfInformation,
    DWORD InfIndex,
    LPCWSTR Key,   // optional
    LPWSTR ReturnBuffer,   // optional
    DWORD ReturnBufferSize,
    DWORD* RequiredSize   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SetupQueryInfVersionInformationW(
    IntPtr InfInformation,   // SP_INF_INFORMATION*
    uint InfIndex,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string Key,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder ReturnBuffer,   // LPWSTR optional, out
    uint ReturnBufferSize,   // DWORD
    IntPtr RequiredSize   // DWORD* optional, out
);
<DllImport("SETUPAPI.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupQueryInfVersionInformationW(
    InfInformation As IntPtr,   ' SP_INF_INFORMATION*
    InfIndex As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> Key As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> ReturnBuffer As System.Text.StringBuilder,   ' LPWSTR optional, out
    ReturnBufferSize As UInteger,   ' DWORD
    RequiredSize As IntPtr   ' DWORD* optional, out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' InfInformation : SP_INF_INFORMATION*
' InfIndex : DWORD
' Key : LPCWSTR optional
' ReturnBuffer : LPWSTR optional, out
' ReturnBufferSize : DWORD
' RequiredSize : DWORD* optional, out
Declare PtrSafe Function SetupQueryInfVersionInformationW Lib "setupapi" ( _
    ByVal InfInformation As LongPtr, _
    ByVal InfIndex As Long, _
    ByVal Key As LongPtr, _
    ByVal ReturnBuffer As LongPtr, _
    ByVal ReturnBufferSize As Long, _
    ByVal RequiredSize As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetupQueryInfVersionInformationW = ctypes.windll.setupapi.SetupQueryInfVersionInformationW
SetupQueryInfVersionInformationW.restype = wintypes.BOOL
SetupQueryInfVersionInformationW.argtypes = [
    ctypes.c_void_p,  # InfInformation : SP_INF_INFORMATION*
    wintypes.DWORD,  # InfIndex : DWORD
    wintypes.LPCWSTR,  # Key : LPCWSTR optional
    wintypes.LPWSTR,  # ReturnBuffer : LPWSTR optional, out
    wintypes.DWORD,  # ReturnBufferSize : DWORD
    ctypes.POINTER(wintypes.DWORD),  # RequiredSize : DWORD* optional, out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SETUPAPI.dll')
SetupQueryInfVersionInformationW = Fiddle::Function.new(
  lib['SetupQueryInfVersionInformationW'],
  [
    Fiddle::TYPE_VOIDP,  # InfInformation : SP_INF_INFORMATION*
    -Fiddle::TYPE_INT,  # InfIndex : DWORD
    Fiddle::TYPE_VOIDP,  # Key : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # ReturnBuffer : LPWSTR optional, out
    -Fiddle::TYPE_INT,  # ReturnBufferSize : DWORD
    Fiddle::TYPE_VOIDP,  # RequiredSize : DWORD* optional, out
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "setupapi")]
extern "system" {
    fn SetupQueryInfVersionInformationW(
        InfInformation: *mut SP_INF_INFORMATION,  // SP_INF_INFORMATION*
        InfIndex: u32,  // DWORD
        Key: *const u16,  // LPCWSTR optional
        ReturnBuffer: *mut u16,  // LPWSTR optional, out
        ReturnBufferSize: u32,  // DWORD
        RequiredSize: *mut u32  // DWORD* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool SetupQueryInfVersionInformationW(IntPtr InfInformation, uint InfIndex, [MarshalAs(UnmanagedType.LPWStr)] string Key, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder ReturnBuffer, uint ReturnBufferSize, IntPtr RequiredSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupQueryInfVersionInformationW' -Namespace Win32 -PassThru
# $api::SetupQueryInfVersionInformationW(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
#uselib "SETUPAPI.dll"
#func global SetupQueryInfVersionInformationW "SetupQueryInfVersionInformationW" wptr, wptr, wptr, wptr, wptr, wptr
; SetupQueryInfVersionInformationW varptr(InfInformation), InfIndex, Key, varptr(ReturnBuffer), ReturnBufferSize, varptr(RequiredSize)   ; 戻り値は stat
; InfInformation : SP_INF_INFORMATION* -> "wptr"
; InfIndex : DWORD -> "wptr"
; Key : LPCWSTR optional -> "wptr"
; ReturnBuffer : LPWSTR optional, out -> "wptr"
; ReturnBufferSize : DWORD -> "wptr"
; RequiredSize : DWORD* optional, out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SETUPAPI.dll"
#cfunc global SetupQueryInfVersionInformationW "SetupQueryInfVersionInformationW" var, int, wstr, var, int, var
; res = SetupQueryInfVersionInformationW(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
; InfInformation : SP_INF_INFORMATION* -> "var"
; InfIndex : DWORD -> "int"
; Key : LPCWSTR optional -> "wstr"
; ReturnBuffer : LPWSTR optional, out -> "var"
; ReturnBufferSize : DWORD -> "int"
; RequiredSize : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL SetupQueryInfVersionInformationW(SP_INF_INFORMATION* InfInformation, DWORD InfIndex, LPCWSTR Key, LPWSTR ReturnBuffer, DWORD ReturnBufferSize, DWORD* RequiredSize)
#uselib "SETUPAPI.dll"
#cfunc global SetupQueryInfVersionInformationW "SetupQueryInfVersionInformationW" var, int, wstr, var, int, var
; res = SetupQueryInfVersionInformationW(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
; InfInformation : SP_INF_INFORMATION* -> "var"
; InfIndex : DWORD -> "int"
; Key : LPCWSTR optional -> "wstr"
; ReturnBuffer : LPWSTR optional, out -> "var"
; ReturnBufferSize : DWORD -> "int"
; RequiredSize : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupQueryInfVersionInformationW = setupapi.NewProc("SetupQueryInfVersionInformationW")
)

// InfInformation (SP_INF_INFORMATION*), InfIndex (DWORD), Key (LPCWSTR optional), ReturnBuffer (LPWSTR optional, out), ReturnBufferSize (DWORD), RequiredSize (DWORD* optional, out)
r1, _, err := procSetupQueryInfVersionInformationW.Call(
	uintptr(InfInformation),
	uintptr(InfIndex),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Key))),
	uintptr(ReturnBuffer),
	uintptr(ReturnBufferSize),
	uintptr(RequiredSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetupQueryInfVersionInformationW(
  InfInformation: Pointer;   // SP_INF_INFORMATION*
  InfIndex: DWORD;   // DWORD
  Key: PWideChar;   // LPCWSTR optional
  ReturnBuffer: PWideChar;   // LPWSTR optional, out
  ReturnBufferSize: DWORD;   // DWORD
  RequiredSize: Pointer   // DWORD* optional, out
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupQueryInfVersionInformationW';
result := DllCall("SETUPAPI\SetupQueryInfVersionInformationW"
    , "Ptr", InfInformation   ; SP_INF_INFORMATION*
    , "UInt", InfIndex   ; DWORD
    , "WStr", Key   ; LPCWSTR optional
    , "Ptr", ReturnBuffer   ; LPWSTR optional, out
    , "UInt", ReturnBufferSize   ; DWORD
    , "Ptr", RequiredSize   ; DWORD* optional, out
    , "Int")   ; return: BOOL
●SetupQueryInfVersionInformationW(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize) = DLL("SETUPAPI.dll", "bool SetupQueryInfVersionInformationW(void*, dword, char*, char*, dword, void*)")
# 呼び出し: SetupQueryInfVersionInformationW(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
# InfInformation : SP_INF_INFORMATION* -> "void*"
# InfIndex : DWORD -> "dword"
# Key : LPCWSTR optional -> "char*"
# ReturnBuffer : LPWSTR optional, out -> "char*"
# ReturnBufferSize : DWORD -> "dword"
# RequiredSize : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
const std = @import("std");

extern "setupapi" fn SetupQueryInfVersionInformationW(
    InfInformation: [*c]SP_INF_INFORMATION, // SP_INF_INFORMATION*
    InfIndex: u32, // DWORD
    Key: [*c]const u16, // LPCWSTR optional
    ReturnBuffer: [*c]u16, // LPWSTR optional, out
    ReturnBufferSize: u32, // DWORD
    RequiredSize: [*c]u32 // DWORD* optional, out
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc SetupQueryInfVersionInformationW(
    InfInformation: ptr SP_INF_INFORMATION,  # SP_INF_INFORMATION*
    InfIndex: uint32,  # DWORD
    Key: WideCString,  # LPCWSTR optional
    ReturnBuffer: ptr uint16,  # LPWSTR optional, out
    ReturnBufferSize: uint32,  # DWORD
    RequiredSize: ptr uint32  # DWORD* optional, out
): int32 {.importc: "SetupQueryInfVersionInformationW", stdcall, dynlib: "SETUPAPI.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "setupapi");
extern(Windows)
int SetupQueryInfVersionInformationW(
    SP_INF_INFORMATION* InfInformation,   // SP_INF_INFORMATION*
    uint InfIndex,   // DWORD
    const(wchar)* Key,   // LPCWSTR optional
    wchar* ReturnBuffer,   // LPWSTR optional, out
    uint ReturnBufferSize,   // DWORD
    uint* RequiredSize   // DWORD* optional, out
);
ccall((:SetupQueryInfVersionInformationW, "SETUPAPI.dll"), stdcall, Int32,
      (Ptr{SP_INF_INFORMATION}, UInt32, Cwstring, Ptr{UInt16}, UInt32, Ptr{UInt32}),
      InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
# InfInformation : SP_INF_INFORMATION* -> Ptr{SP_INF_INFORMATION}
# InfIndex : DWORD -> UInt32
# Key : LPCWSTR optional -> Cwstring
# ReturnBuffer : LPWSTR optional, out -> Ptr{UInt16}
# ReturnBufferSize : DWORD -> UInt32
# RequiredSize : DWORD* optional, out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
int32_t SetupQueryInfVersionInformationW(
    void* InfInformation,
    uint32_t InfIndex,
    const uint16_t* Key,
    uint16_t* ReturnBuffer,
    uint32_t ReturnBufferSize,
    uint32_t* RequiredSize);
]]
local setupapi = ffi.load("setupapi")
-- setupapi.SetupQueryInfVersionInformationW(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
-- InfInformation : SP_INF_INFORMATION*
-- InfIndex : DWORD
-- Key : LPCWSTR optional
-- ReturnBuffer : LPWSTR optional, out
-- ReturnBufferSize : DWORD
-- RequiredSize : DWORD* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。
const koffi = require('koffi');
const lib = koffi.load('SETUPAPI.dll');
const SetupQueryInfVersionInformationW = lib.func('__stdcall', 'SetupQueryInfVersionInformationW', 'int32_t', ['void *', 'uint32_t', 'str16', 'uint16_t *', 'uint32_t', 'uint32_t *']);
// SetupQueryInfVersionInformationW(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
// InfInformation : SP_INF_INFORMATION* -> 'void *'
// InfIndex : DWORD -> 'uint32_t'
// Key : LPCWSTR optional -> 'str16'
// ReturnBuffer : LPWSTR optional, out -> 'uint16_t *'
// ReturnBufferSize : DWORD -> 'uint32_t'
// RequiredSize : DWORD* optional, out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("SETUPAPI.dll", {
  SetupQueryInfVersionInformationW: { parameters: ["pointer", "u32", "buffer", "buffer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.SetupQueryInfVersionInformationW(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize)
// InfInformation : SP_INF_INFORMATION* -> "pointer"
// InfIndex : DWORD -> "u32"
// Key : LPCWSTR optional -> "buffer"
// ReturnBuffer : LPWSTR optional, out -> "buffer"
// ReturnBufferSize : DWORD -> "u32"
// RequiredSize : DWORD* optional, out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t SetupQueryInfVersionInformationW(
    void* InfInformation,
    uint32_t InfIndex,
    const uint16_t* Key,
    uint16_t* ReturnBuffer,
    uint32_t ReturnBufferSize,
    uint32_t* RequiredSize);
C, "SETUPAPI.dll");
// $ffi->SetupQueryInfVersionInformationW(InfInformation, InfIndex, Key, ReturnBuffer, ReturnBufferSize, RequiredSize);
// InfInformation : SP_INF_INFORMATION*
// InfIndex : DWORD
// Key : LPCWSTR optional
// ReturnBuffer : LPWSTR optional, out
// ReturnBufferSize : DWORD
// RequiredSize : DWORD* optional, out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Setupapi extends StdCallLibrary {
    Setupapi INSTANCE = Native.load("setupapi", Setupapi.class, W32APIOptions.UNICODE_OPTIONS);
    boolean SetupQueryInfVersionInformationW(
        Pointer InfInformation,   // SP_INF_INFORMATION*
        int InfIndex,   // DWORD
        WString Key,   // LPCWSTR optional
        char[] ReturnBuffer,   // LPWSTR optional, out
        int ReturnBufferSize,   // DWORD
        IntByReference RequiredSize   // DWORD* optional, out
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("setupapi")]
lib LibSETUPAPI
  fun SetupQueryInfVersionInformationW = SetupQueryInfVersionInformationW(
    InfInformation : SP_INF_INFORMATION*,   # SP_INF_INFORMATION*
    InfIndex : UInt32,   # DWORD
    Key : UInt16*,   # LPCWSTR optional
    ReturnBuffer : UInt16*,   # LPWSTR optional, out
    ReturnBufferSize : UInt32,   # DWORD
    RequiredSize : UInt32*   # DWORD* optional, out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef SetupQueryInfVersionInformationWNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Utf16>, Pointer<Utf16>, Uint32, Pointer<Uint32>);
typedef SetupQueryInfVersionInformationWDart = int Function(Pointer<Void>, int, Pointer<Utf16>, Pointer<Utf16>, int, Pointer<Uint32>);
final SetupQueryInfVersionInformationW = DynamicLibrary.open('SETUPAPI.dll')
    .lookupFunction<SetupQueryInfVersionInformationWNative, SetupQueryInfVersionInformationWDart>('SetupQueryInfVersionInformationW');
// InfInformation : SP_INF_INFORMATION* -> Pointer<Void>
// InfIndex : DWORD -> Uint32
// Key : LPCWSTR optional -> Pointer<Utf16>
// ReturnBuffer : LPWSTR optional, out -> Pointer<Utf16>
// ReturnBufferSize : DWORD -> Uint32
// RequiredSize : DWORD* optional, out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function SetupQueryInfVersionInformationW(
  InfInformation: Pointer;   // SP_INF_INFORMATION*
  InfIndex: DWORD;   // DWORD
  Key: PWideChar;   // LPCWSTR optional
  ReturnBuffer: PWideChar;   // LPWSTR optional, out
  ReturnBufferSize: DWORD;   // DWORD
  RequiredSize: Pointer   // DWORD* optional, out
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupQueryInfVersionInformationW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "SetupQueryInfVersionInformationW"
  c_SetupQueryInfVersionInformationW :: Ptr () -> Word32 -> CWString -> CWString -> Word32 -> Ptr Word32 -> IO CInt
-- InfInformation : SP_INF_INFORMATION* -> Ptr ()
-- InfIndex : DWORD -> Word32
-- Key : LPCWSTR optional -> CWString
-- ReturnBuffer : LPWSTR optional, out -> CWString
-- ReturnBufferSize : DWORD -> Word32
-- RequiredSize : DWORD* optional, out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let setupqueryinfversioninformationw =
  foreign "SetupQueryInfVersionInformationW"
    ((ptr void) @-> uint32_t @-> (ptr uint16_t) @-> (ptr uint16_t) @-> uint32_t @-> (ptr uint32_t) @-> returning int32_t)
(* InfInformation : SP_INF_INFORMATION* -> (ptr void) *)
(* InfIndex : DWORD -> uint32_t *)
(* Key : LPCWSTR optional -> (ptr uint16_t) *)
(* ReturnBuffer : LPWSTR optional, out -> (ptr uint16_t) *)
(* ReturnBufferSize : DWORD -> uint32_t *)
(* RequiredSize : DWORD* optional, out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library setupapi (t "SETUPAPI.dll"))
(cffi:use-foreign-library setupapi)

(cffi:defcfun ("SetupQueryInfVersionInformationW" setup-query-inf-version-information-w :convention :stdcall) :int32
  (inf-information :pointer)   ; SP_INF_INFORMATION*
  (inf-index :uint32)   ; DWORD
  (key (:string :encoding :utf-16le))   ; LPCWSTR optional
  (return-buffer :pointer)   ; LPWSTR optional, out
  (return-buffer-size :uint32)   ; DWORD
  (required-size :pointer))   ; DWORD* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $SetupQueryInfVersionInformationW = Win32::API::More->new('SETUPAPI',
    'BOOL SetupQueryInfVersionInformationW(LPVOID InfInformation, DWORD InfIndex, LPCWSTR Key, LPWSTR ReturnBuffer, DWORD ReturnBufferSize, LPVOID RequiredSize)');
# my $ret = $SetupQueryInfVersionInformationW->Call($InfInformation, $InfIndex, $Key, $ReturnBuffer, $ReturnBufferSize, $RequiredSize);
# InfInformation : SP_INF_INFORMATION* -> LPVOID
# InfIndex : DWORD -> DWORD
# Key : LPCWSTR optional -> LPCWSTR
# ReturnBuffer : LPWSTR optional, out -> LPWSTR
# ReturnBufferSize : DWORD -> DWORD
# RequiredSize : DWORD* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い
使用する型