ホーム › 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 |
| InfIndex | DWORD | in |
| AlternatePlatformInfo | SP_ALTPLATFORM_INFO_V2* | inoptional |
| OriginalFileInfo | SP_ORIGINAL_FILE_INFO_W* | out |
戻り値の型: 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 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 版の利用を推奨。