ホーム › Devices.DeviceAndDriverInstallation › SetupQueryInfOriginalFileInformationW
SetupQueryInfOriginalFileInformationW
関数INFの元のファイル名と場所の情報を照会する(Unicode)。
シグネチャ
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupQueryInfOriginalFileInformationW(
SP_INF_INFORMATION* InfInformation,
DWORD InfIndex,
SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, // optional
SP_ORIGINAL_FILE_INFO_W* OriginalFileInfo
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| InfInformation | SP_INF_INFORMATION* | in | 対象のSP_INF_INFORMATION構造体へのポインタ。 |
| InfIndex | DWORD | in | 問い合わせる構成INFのインデックス(0起点)。 |
| AlternatePlatformInfo | SP_ALTPLATFORM_INFO_V2* | inoptional | 代替プラットフォーム情報を指すSP_ALTPLATFORM_INFO_V2へのポインタ。NULL可。 |
| OriginalFileInfo | SP_ORIGINAL_FILE_INFO_W* | out | 元のINFファイル名とカタログ情報を受け取るSP_ORIGINAL_FILE_INFO_W構造体へのポインタ。 |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupQueryInfOriginalFileInformationW(
SP_INF_INFORMATION* InfInformation,
DWORD InfIndex,
SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, // optional
SP_ORIGINAL_FILE_INFO_W* OriginalFileInfo
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SetupQueryInfOriginalFileInformationW(
IntPtr InfInformation, // SP_INF_INFORMATION*
uint InfIndex, // DWORD
IntPtr AlternatePlatformInfo, // SP_ALTPLATFORM_INFO_V2* optional
IntPtr OriginalFileInfo // SP_ORIGINAL_FILE_INFO_W* out
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupQueryInfOriginalFileInformationW(
InfInformation As IntPtr, ' SP_INF_INFORMATION*
InfIndex As UInteger, ' DWORD
AlternatePlatformInfo As IntPtr, ' SP_ALTPLATFORM_INFO_V2* optional
OriginalFileInfo As IntPtr ' SP_ORIGINAL_FILE_INFO_W* out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' InfInformation : SP_INF_INFORMATION*
' InfIndex : DWORD
' AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
' OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out
Declare PtrSafe Function SetupQueryInfOriginalFileInformationW Lib "setupapi" ( _
ByVal InfInformation As LongPtr, _
ByVal InfIndex As Long, _
ByVal AlternatePlatformInfo As LongPtr, _
ByVal OriginalFileInfo 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
SetupQueryInfOriginalFileInformationW = ctypes.windll.setupapi.SetupQueryInfOriginalFileInformationW
SetupQueryInfOriginalFileInformationW.restype = wintypes.BOOL
SetupQueryInfOriginalFileInformationW.argtypes = [
ctypes.c_void_p, # InfInformation : SP_INF_INFORMATION*
wintypes.DWORD, # InfIndex : DWORD
ctypes.c_void_p, # AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
ctypes.c_void_p, # OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupQueryInfOriginalFileInformationW = Fiddle::Function.new(
lib['SetupQueryInfOriginalFileInformationW'],
[
Fiddle::TYPE_VOIDP, # InfInformation : SP_INF_INFORMATION*
-Fiddle::TYPE_INT, # InfIndex : DWORD
Fiddle::TYPE_VOIDP, # AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
Fiddle::TYPE_VOIDP, # OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "setupapi")]
extern "system" {
fn SetupQueryInfOriginalFileInformationW(
InfInformation: *mut SP_INF_INFORMATION, // SP_INF_INFORMATION*
InfIndex: u32, // DWORD
AlternatePlatformInfo: *mut SP_ALTPLATFORM_INFO_V2, // SP_ALTPLATFORM_INFO_V2* optional
OriginalFileInfo: *mut SP_ORIGINAL_FILE_INFO_W // SP_ORIGINAL_FILE_INFO_W* 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 SetupQueryInfOriginalFileInformationW(IntPtr InfInformation, uint InfIndex, IntPtr AlternatePlatformInfo, IntPtr OriginalFileInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupQueryInfOriginalFileInformationW' -Namespace Win32 -PassThru
# $api::SetupQueryInfOriginalFileInformationW(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo)#uselib "SETUPAPI.dll"
#func global SetupQueryInfOriginalFileInformationW "SetupQueryInfOriginalFileInformationW" wptr, wptr, wptr, wptr
; SetupQueryInfOriginalFileInformationW varptr(InfInformation), InfIndex, varptr(AlternatePlatformInfo), varptr(OriginalFileInfo) ; 戻り値は stat
; InfInformation : SP_INF_INFORMATION* -> "wptr"
; InfIndex : DWORD -> "wptr"
; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "wptr"
; OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SETUPAPI.dll" #cfunc global SetupQueryInfOriginalFileInformationW "SetupQueryInfOriginalFileInformationW" var, int, var, var ; res = SetupQueryInfOriginalFileInformationW(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo) ; InfInformation : SP_INF_INFORMATION* -> "var" ; InfIndex : DWORD -> "int" ; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "var" ; OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SETUPAPI.dll" #cfunc global SetupQueryInfOriginalFileInformationW "SetupQueryInfOriginalFileInformationW" sptr, int, sptr, sptr ; res = SetupQueryInfOriginalFileInformationW(varptr(InfInformation), InfIndex, varptr(AlternatePlatformInfo), varptr(OriginalFileInfo)) ; InfInformation : SP_INF_INFORMATION* -> "sptr" ; InfIndex : DWORD -> "int" ; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "sptr" ; OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL SetupQueryInfOriginalFileInformationW(SP_INF_INFORMATION* InfInformation, DWORD InfIndex, SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, SP_ORIGINAL_FILE_INFO_W* OriginalFileInfo) #uselib "SETUPAPI.dll" #cfunc global SetupQueryInfOriginalFileInformationW "SetupQueryInfOriginalFileInformationW" var, int, var, var ; res = SetupQueryInfOriginalFileInformationW(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo) ; InfInformation : SP_INF_INFORMATION* -> "var" ; InfIndex : DWORD -> "int" ; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "var" ; OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL SetupQueryInfOriginalFileInformationW(SP_INF_INFORMATION* InfInformation, DWORD InfIndex, SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, SP_ORIGINAL_FILE_INFO_W* OriginalFileInfo) #uselib "SETUPAPI.dll" #cfunc global SetupQueryInfOriginalFileInformationW "SetupQueryInfOriginalFileInformationW" intptr, int, intptr, intptr ; res = SetupQueryInfOriginalFileInformationW(varptr(InfInformation), InfIndex, varptr(AlternatePlatformInfo), varptr(OriginalFileInfo)) ; InfInformation : SP_INF_INFORMATION* -> "intptr" ; InfIndex : DWORD -> "int" ; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "intptr" ; OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupQueryInfOriginalFileInformationW = setupapi.NewProc("SetupQueryInfOriginalFileInformationW")
)
// InfInformation (SP_INF_INFORMATION*), InfIndex (DWORD), AlternatePlatformInfo (SP_ALTPLATFORM_INFO_V2* optional), OriginalFileInfo (SP_ORIGINAL_FILE_INFO_W* out)
r1, _, err := procSetupQueryInfOriginalFileInformationW.Call(
uintptr(InfInformation),
uintptr(InfIndex),
uintptr(AlternatePlatformInfo),
uintptr(OriginalFileInfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupQueryInfOriginalFileInformationW(
InfInformation: Pointer; // SP_INF_INFORMATION*
InfIndex: DWORD; // DWORD
AlternatePlatformInfo: Pointer; // SP_ALTPLATFORM_INFO_V2* optional
OriginalFileInfo: Pointer // SP_ORIGINAL_FILE_INFO_W* out
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupQueryInfOriginalFileInformationW';result := DllCall("SETUPAPI\SetupQueryInfOriginalFileInformationW"
, "Ptr", InfInformation ; SP_INF_INFORMATION*
, "UInt", InfIndex ; DWORD
, "Ptr", AlternatePlatformInfo ; SP_ALTPLATFORM_INFO_V2* optional
, "Ptr", OriginalFileInfo ; SP_ORIGINAL_FILE_INFO_W* out
, "Int") ; return: BOOL●SetupQueryInfOriginalFileInformationW(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo) = DLL("SETUPAPI.dll", "bool SetupQueryInfOriginalFileInformationW(void*, dword, void*, void*)")
# 呼び出し: SetupQueryInfOriginalFileInformationW(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo)
# InfInformation : SP_INF_INFORMATION* -> "void*"
# InfIndex : DWORD -> "dword"
# AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "void*"
# OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "setupapi" fn SetupQueryInfOriginalFileInformationW(
InfInformation: [*c]SP_INF_INFORMATION, // SP_INF_INFORMATION*
InfIndex: u32, // DWORD
AlternatePlatformInfo: [*c]SP_ALTPLATFORM_INFO_V2, // SP_ALTPLATFORM_INFO_V2* optional
OriginalFileInfo: [*c]SP_ORIGINAL_FILE_INFO_W // SP_ORIGINAL_FILE_INFO_W* out
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc SetupQueryInfOriginalFileInformationW(
InfInformation: ptr SP_INF_INFORMATION, # SP_INF_INFORMATION*
InfIndex: uint32, # DWORD
AlternatePlatformInfo: ptr SP_ALTPLATFORM_INFO_V2, # SP_ALTPLATFORM_INFO_V2* optional
OriginalFileInfo: ptr SP_ORIGINAL_FILE_INFO_W # SP_ORIGINAL_FILE_INFO_W* out
): int32 {.importc: "SetupQueryInfOriginalFileInformationW", stdcall, dynlib: "SETUPAPI.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "setupapi");
extern(Windows)
int SetupQueryInfOriginalFileInformationW(
SP_INF_INFORMATION* InfInformation, // SP_INF_INFORMATION*
uint InfIndex, // DWORD
SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, // SP_ALTPLATFORM_INFO_V2* optional
SP_ORIGINAL_FILE_INFO_W* OriginalFileInfo // SP_ORIGINAL_FILE_INFO_W* out
);ccall((:SetupQueryInfOriginalFileInformationW, "SETUPAPI.dll"), stdcall, Int32,
(Ptr{SP_INF_INFORMATION}, UInt32, Ptr{SP_ALTPLATFORM_INFO_V2}, Ptr{SP_ORIGINAL_FILE_INFO_W}),
InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo)
# InfInformation : SP_INF_INFORMATION* -> Ptr{SP_INF_INFORMATION}
# InfIndex : DWORD -> UInt32
# AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> Ptr{SP_ALTPLATFORM_INFO_V2}
# OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> Ptr{SP_ORIGINAL_FILE_INFO_W}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
int32_t SetupQueryInfOriginalFileInformationW(
void* InfInformation,
uint32_t InfIndex,
void* AlternatePlatformInfo,
void* OriginalFileInfo);
]]
local setupapi = ffi.load("setupapi")
-- setupapi.SetupQueryInfOriginalFileInformationW(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo)
-- InfInformation : SP_INF_INFORMATION*
-- InfIndex : DWORD
-- AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
-- OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* 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 SetupQueryInfOriginalFileInformationW = lib.func('__stdcall', 'SetupQueryInfOriginalFileInformationW', 'int32_t', ['void *', 'uint32_t', 'void *', 'void *']);
// SetupQueryInfOriginalFileInformationW(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo)
// InfInformation : SP_INF_INFORMATION* -> 'void *'
// InfIndex : DWORD -> 'uint32_t'
// AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> 'void *'
// OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SETUPAPI.dll", {
SetupQueryInfOriginalFileInformationW: { parameters: ["pointer", "u32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.SetupQueryInfOriginalFileInformationW(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo)
// InfInformation : SP_INF_INFORMATION* -> "pointer"
// InfIndex : DWORD -> "u32"
// AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "pointer"
// OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SetupQueryInfOriginalFileInformationW(
void* InfInformation,
uint32_t InfIndex,
void* AlternatePlatformInfo,
void* OriginalFileInfo);
C, "SETUPAPI.dll");
// $ffi->SetupQueryInfOriginalFileInformationW(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo);
// InfInformation : SP_INF_INFORMATION*
// InfIndex : DWORD
// AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
// OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* 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 SetupQueryInfOriginalFileInformationW(
Pointer InfInformation, // SP_INF_INFORMATION*
int InfIndex, // DWORD
Pointer AlternatePlatformInfo, // SP_ALTPLATFORM_INFO_V2* optional
Pointer OriginalFileInfo // SP_ORIGINAL_FILE_INFO_W* out
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("setupapi")]
lib LibSETUPAPI
fun SetupQueryInfOriginalFileInformationW = SetupQueryInfOriginalFileInformationW(
InfInformation : SP_INF_INFORMATION*, # SP_INF_INFORMATION*
InfIndex : UInt32, # DWORD
AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2*, # SP_ALTPLATFORM_INFO_V2* optional
OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* # SP_ORIGINAL_FILE_INFO_W* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SetupQueryInfOriginalFileInformationWNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>, Pointer<Void>);
typedef SetupQueryInfOriginalFileInformationWDart = int Function(Pointer<Void>, int, Pointer<Void>, Pointer<Void>);
final SetupQueryInfOriginalFileInformationW = DynamicLibrary.open('SETUPAPI.dll')
.lookupFunction<SetupQueryInfOriginalFileInformationWNative, SetupQueryInfOriginalFileInformationWDart>('SetupQueryInfOriginalFileInformationW');
// InfInformation : SP_INF_INFORMATION* -> Pointer<Void>
// InfIndex : DWORD -> Uint32
// AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> Pointer<Void>
// OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SetupQueryInfOriginalFileInformationW(
InfInformation: Pointer; // SP_INF_INFORMATION*
InfIndex: DWORD; // DWORD
AlternatePlatformInfo: Pointer; // SP_ALTPLATFORM_INFO_V2* optional
OriginalFileInfo: Pointer // SP_ORIGINAL_FILE_INFO_W* out
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupQueryInfOriginalFileInformationW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SetupQueryInfOriginalFileInformationW"
c_SetupQueryInfOriginalFileInformationW :: Ptr () -> Word32 -> Ptr () -> Ptr () -> IO CInt
-- InfInformation : SP_INF_INFORMATION* -> Ptr ()
-- InfIndex : DWORD -> Word32
-- AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> Ptr ()
-- OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let setupqueryinforiginalfileinformationw =
foreign "SetupQueryInfOriginalFileInformationW"
((ptr void) @-> uint32_t @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* InfInformation : SP_INF_INFORMATION* -> (ptr void) *)
(* InfIndex : DWORD -> uint32_t *)
(* AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> (ptr void) *)
(* OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library setupapi (t "SETUPAPI.dll"))
(cffi:use-foreign-library setupapi)
(cffi:defcfun ("SetupQueryInfOriginalFileInformationW" setup-query-inf-original-file-information-w :convention :stdcall) :int32
(inf-information :pointer) ; SP_INF_INFORMATION*
(inf-index :uint32) ; DWORD
(alternate-platform-info :pointer) ; SP_ALTPLATFORM_INFO_V2* optional
(original-file-info :pointer)) ; SP_ORIGINAL_FILE_INFO_W* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SetupQueryInfOriginalFileInformationW = Win32::API::More->new('SETUPAPI',
'BOOL SetupQueryInfOriginalFileInformationW(LPVOID InfInformation, DWORD InfIndex, LPVOID AlternatePlatformInfo, LPVOID OriginalFileInfo)');
# my $ret = $SetupQueryInfOriginalFileInformationW->Call($InfInformation, $InfIndex, $AlternatePlatformInfo, $OriginalFileInfo);
# InfInformation : SP_INF_INFORMATION* -> LPVOID
# InfIndex : DWORD -> DWORD
# AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> LPVOID
# OriginalFileInfo : SP_ORIGINAL_FILE_INFO_W* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f SetupQueryInfOriginalFileInformationA (ANSI版) — INFの元のファイル名と場所の情報を照会する(ANSI)。