ホーム › Devices.DeviceAndDriverInstallation › SetupQueryInfOriginalFileInformationA
SetupQueryInfOriginalFileInformationA
関数INFの元のファイル名と場所の情報を照会する(ANSI)。
シグネチャ
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupQueryInfOriginalFileInformationA(
SP_INF_INFORMATION* InfInformation,
DWORD InfIndex,
SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, // optional
SP_ORIGINAL_FILE_INFO_A* OriginalFileInfo
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| InfInformation | SP_INF_INFORMATION* | in |
| InfIndex | DWORD | in |
| AlternatePlatformInfo | SP_ALTPLATFORM_INFO_V2* | inoptional |
| OriginalFileInfo | SP_ORIGINAL_FILE_INFO_A* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupQueryInfOriginalFileInformationA(
SP_INF_INFORMATION* InfInformation,
DWORD InfIndex,
SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, // optional
SP_ORIGINAL_FILE_INFO_A* OriginalFileInfo
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool SetupQueryInfOriginalFileInformationA(
IntPtr InfInformation, // SP_INF_INFORMATION*
uint InfIndex, // DWORD
IntPtr AlternatePlatformInfo, // SP_ALTPLATFORM_INFO_V2* optional
IntPtr OriginalFileInfo // SP_ORIGINAL_FILE_INFO_A* out
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupQueryInfOriginalFileInformationA(
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_A* out
) As Boolean
End Function' InfInformation : SP_INF_INFORMATION*
' InfIndex : DWORD
' AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
' OriginalFileInfo : SP_ORIGINAL_FILE_INFO_A* out
Declare PtrSafe Function SetupQueryInfOriginalFileInformationA Lib "setupapi" ( _
ByVal InfInformation As LongPtr, _
ByVal InfIndex As Long, _
ByVal AlternatePlatformInfo As LongPtr, _
ByVal OriginalFileInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetupQueryInfOriginalFileInformationA = ctypes.windll.setupapi.SetupQueryInfOriginalFileInformationA
SetupQueryInfOriginalFileInformationA.restype = wintypes.BOOL
SetupQueryInfOriginalFileInformationA.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_A* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupQueryInfOriginalFileInformationA = Fiddle::Function.new(
lib['SetupQueryInfOriginalFileInformationA'],
[
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_A* out
],
Fiddle::TYPE_INT)#[link(name = "setupapi")]
extern "system" {
fn SetupQueryInfOriginalFileInformationA(
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_A // SP_ORIGINAL_FILE_INFO_A* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool SetupQueryInfOriginalFileInformationA(IntPtr InfInformation, uint InfIndex, IntPtr AlternatePlatformInfo, IntPtr OriginalFileInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupQueryInfOriginalFileInformationA' -Namespace Win32 -PassThru
# $api::SetupQueryInfOriginalFileInformationA(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo)#uselib "SETUPAPI.dll"
#func global SetupQueryInfOriginalFileInformationA "SetupQueryInfOriginalFileInformationA" sptr, sptr, sptr, sptr
; SetupQueryInfOriginalFileInformationA varptr(InfInformation), InfIndex, varptr(AlternatePlatformInfo), varptr(OriginalFileInfo) ; 戻り値は stat
; InfInformation : SP_INF_INFORMATION* -> "sptr"
; InfIndex : DWORD -> "sptr"
; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "sptr"
; OriginalFileInfo : SP_ORIGINAL_FILE_INFO_A* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SETUPAPI.dll" #cfunc global SetupQueryInfOriginalFileInformationA "SetupQueryInfOriginalFileInformationA" var, int, var, var ; res = SetupQueryInfOriginalFileInformationA(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo) ; InfInformation : SP_INF_INFORMATION* -> "var" ; InfIndex : DWORD -> "int" ; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "var" ; OriginalFileInfo : SP_ORIGINAL_FILE_INFO_A* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SETUPAPI.dll" #cfunc global SetupQueryInfOriginalFileInformationA "SetupQueryInfOriginalFileInformationA" sptr, int, sptr, sptr ; res = SetupQueryInfOriginalFileInformationA(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_A* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL SetupQueryInfOriginalFileInformationA(SP_INF_INFORMATION* InfInformation, DWORD InfIndex, SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, SP_ORIGINAL_FILE_INFO_A* OriginalFileInfo) #uselib "SETUPAPI.dll" #cfunc global SetupQueryInfOriginalFileInformationA "SetupQueryInfOriginalFileInformationA" var, int, var, var ; res = SetupQueryInfOriginalFileInformationA(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo) ; InfInformation : SP_INF_INFORMATION* -> "var" ; InfIndex : DWORD -> "int" ; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "var" ; OriginalFileInfo : SP_ORIGINAL_FILE_INFO_A* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL SetupQueryInfOriginalFileInformationA(SP_INF_INFORMATION* InfInformation, DWORD InfIndex, SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, SP_ORIGINAL_FILE_INFO_A* OriginalFileInfo) #uselib "SETUPAPI.dll" #cfunc global SetupQueryInfOriginalFileInformationA "SetupQueryInfOriginalFileInformationA" intptr, int, intptr, intptr ; res = SetupQueryInfOriginalFileInformationA(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_A* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupQueryInfOriginalFileInformationA = setupapi.NewProc("SetupQueryInfOriginalFileInformationA")
)
// InfInformation (SP_INF_INFORMATION*), InfIndex (DWORD), AlternatePlatformInfo (SP_ALTPLATFORM_INFO_V2* optional), OriginalFileInfo (SP_ORIGINAL_FILE_INFO_A* out)
r1, _, err := procSetupQueryInfOriginalFileInformationA.Call(
uintptr(InfInformation),
uintptr(InfIndex),
uintptr(AlternatePlatformInfo),
uintptr(OriginalFileInfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupQueryInfOriginalFileInformationA(
InfInformation: Pointer; // SP_INF_INFORMATION*
InfIndex: DWORD; // DWORD
AlternatePlatformInfo: Pointer; // SP_ALTPLATFORM_INFO_V2* optional
OriginalFileInfo: Pointer // SP_ORIGINAL_FILE_INFO_A* out
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupQueryInfOriginalFileInformationA';result := DllCall("SETUPAPI\SetupQueryInfOriginalFileInformationA"
, "Ptr", InfInformation ; SP_INF_INFORMATION*
, "UInt", InfIndex ; DWORD
, "Ptr", AlternatePlatformInfo ; SP_ALTPLATFORM_INFO_V2* optional
, "Ptr", OriginalFileInfo ; SP_ORIGINAL_FILE_INFO_A* out
, "Int") ; return: BOOL●SetupQueryInfOriginalFileInformationA(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo) = DLL("SETUPAPI.dll", "bool SetupQueryInfOriginalFileInformationA(void*, dword, void*, void*)")
# 呼び出し: SetupQueryInfOriginalFileInformationA(InfInformation, InfIndex, AlternatePlatformInfo, OriginalFileInfo)
# InfInformation : SP_INF_INFORMATION* -> "void*"
# InfIndex : DWORD -> "dword"
# AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "void*"
# OriginalFileInfo : SP_ORIGINAL_FILE_INFO_A* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。