ホーム › Devices.DeviceAndDriverInstallation › SetupInstallFilesFromInfSectionW
SetupInstallFilesFromInfSectionW
関数INFセクションが指定するファイルをキューに登録しコピーする。
シグネチャ
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupInstallFilesFromInfSectionW(
void* InfHandle,
void* LayoutInfHandle, // optional
void* FileQueue,
LPCWSTR SectionName,
LPCWSTR SourceRootPath, // optional
DWORD CopyFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| InfHandle | void* | in |
| LayoutInfHandle | void* | inoptional |
| FileQueue | void* | in |
| SectionName | LPCWSTR | in |
| SourceRootPath | LPCWSTR | inoptional |
| CopyFlags | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupInstallFilesFromInfSectionW(
void* InfHandle,
void* LayoutInfHandle, // optional
void* FileQueue,
LPCWSTR SectionName,
LPCWSTR SourceRootPath, // optional
DWORD CopyFlags
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SetupInstallFilesFromInfSectionW(
IntPtr InfHandle, // void*
IntPtr LayoutInfHandle, // void* optional
IntPtr FileQueue, // void*
[MarshalAs(UnmanagedType.LPWStr)] string SectionName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string SourceRootPath, // LPCWSTR optional
uint CopyFlags // DWORD
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupInstallFilesFromInfSectionW(
InfHandle As IntPtr, ' void*
LayoutInfHandle As IntPtr, ' void* optional
FileQueue As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPWStr)> SectionName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> SourceRootPath As String, ' LPCWSTR optional
CopyFlags As UInteger ' DWORD
) As Boolean
End Function' InfHandle : void*
' LayoutInfHandle : void* optional
' FileQueue : void*
' SectionName : LPCWSTR
' SourceRootPath : LPCWSTR optional
' CopyFlags : DWORD
Declare PtrSafe Function SetupInstallFilesFromInfSectionW Lib "setupapi" ( _
ByVal InfHandle As LongPtr, _
ByVal LayoutInfHandle As LongPtr, _
ByVal FileQueue As LongPtr, _
ByVal SectionName As LongPtr, _
ByVal SourceRootPath As LongPtr, _
ByVal CopyFlags As Long) 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
SetupInstallFilesFromInfSectionW = ctypes.windll.setupapi.SetupInstallFilesFromInfSectionW
SetupInstallFilesFromInfSectionW.restype = wintypes.BOOL
SetupInstallFilesFromInfSectionW.argtypes = [
ctypes.POINTER(None), # InfHandle : void*
ctypes.POINTER(None), # LayoutInfHandle : void* optional
ctypes.POINTER(None), # FileQueue : void*
wintypes.LPCWSTR, # SectionName : LPCWSTR
wintypes.LPCWSTR, # SourceRootPath : LPCWSTR optional
wintypes.DWORD, # CopyFlags : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupInstallFilesFromInfSectionW = Fiddle::Function.new(
lib['SetupInstallFilesFromInfSectionW'],
[
Fiddle::TYPE_VOIDP, # InfHandle : void*
Fiddle::TYPE_VOIDP, # LayoutInfHandle : void* optional
Fiddle::TYPE_VOIDP, # FileQueue : void*
Fiddle::TYPE_VOIDP, # SectionName : LPCWSTR
Fiddle::TYPE_VOIDP, # SourceRootPath : LPCWSTR optional
-Fiddle::TYPE_INT, # CopyFlags : DWORD
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "setupapi")]
extern "system" {
fn SetupInstallFilesFromInfSectionW(
InfHandle: *mut (), // void*
LayoutInfHandle: *mut (), // void* optional
FileQueue: *mut (), // void*
SectionName: *const u16, // LPCWSTR
SourceRootPath: *const u16, // LPCWSTR optional
CopyFlags: u32 // DWORD
) -> 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 SetupInstallFilesFromInfSectionW(IntPtr InfHandle, IntPtr LayoutInfHandle, IntPtr FileQueue, [MarshalAs(UnmanagedType.LPWStr)] string SectionName, [MarshalAs(UnmanagedType.LPWStr)] string SourceRootPath, uint CopyFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupInstallFilesFromInfSectionW' -Namespace Win32 -PassThru
# $api::SetupInstallFilesFromInfSectionW(InfHandle, LayoutInfHandle, FileQueue, SectionName, SourceRootPath, CopyFlags)#uselib "SETUPAPI.dll"
#func global SetupInstallFilesFromInfSectionW "SetupInstallFilesFromInfSectionW" wptr, wptr, wptr, wptr, wptr, wptr
; SetupInstallFilesFromInfSectionW InfHandle, LayoutInfHandle, FileQueue, SectionName, SourceRootPath, CopyFlags ; 戻り値は stat
; InfHandle : void* -> "wptr"
; LayoutInfHandle : void* optional -> "wptr"
; FileQueue : void* -> "wptr"
; SectionName : LPCWSTR -> "wptr"
; SourceRootPath : LPCWSTR optional -> "wptr"
; CopyFlags : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SETUPAPI.dll"
#cfunc global SetupInstallFilesFromInfSectionW "SetupInstallFilesFromInfSectionW" sptr, sptr, sptr, wstr, wstr, int
; res = SetupInstallFilesFromInfSectionW(InfHandle, LayoutInfHandle, FileQueue, SectionName, SourceRootPath, CopyFlags)
; InfHandle : void* -> "sptr"
; LayoutInfHandle : void* optional -> "sptr"
; FileQueue : void* -> "sptr"
; SectionName : LPCWSTR -> "wstr"
; SourceRootPath : LPCWSTR optional -> "wstr"
; CopyFlags : DWORD -> "int"; BOOL SetupInstallFilesFromInfSectionW(void* InfHandle, void* LayoutInfHandle, void* FileQueue, LPCWSTR SectionName, LPCWSTR SourceRootPath, DWORD CopyFlags)
#uselib "SETUPAPI.dll"
#cfunc global SetupInstallFilesFromInfSectionW "SetupInstallFilesFromInfSectionW" intptr, intptr, intptr, wstr, wstr, int
; res = SetupInstallFilesFromInfSectionW(InfHandle, LayoutInfHandle, FileQueue, SectionName, SourceRootPath, CopyFlags)
; InfHandle : void* -> "intptr"
; LayoutInfHandle : void* optional -> "intptr"
; FileQueue : void* -> "intptr"
; SectionName : LPCWSTR -> "wstr"
; SourceRootPath : LPCWSTR optional -> "wstr"
; CopyFlags : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupInstallFilesFromInfSectionW = setupapi.NewProc("SetupInstallFilesFromInfSectionW")
)
// InfHandle (void*), LayoutInfHandle (void* optional), FileQueue (void*), SectionName (LPCWSTR), SourceRootPath (LPCWSTR optional), CopyFlags (DWORD)
r1, _, err := procSetupInstallFilesFromInfSectionW.Call(
uintptr(InfHandle),
uintptr(LayoutInfHandle),
uintptr(FileQueue),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(SectionName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(SourceRootPath))),
uintptr(CopyFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupInstallFilesFromInfSectionW(
InfHandle: Pointer; // void*
LayoutInfHandle: Pointer; // void* optional
FileQueue: Pointer; // void*
SectionName: PWideChar; // LPCWSTR
SourceRootPath: PWideChar; // LPCWSTR optional
CopyFlags: DWORD // DWORD
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupInstallFilesFromInfSectionW';result := DllCall("SETUPAPI\SetupInstallFilesFromInfSectionW"
, "Ptr", InfHandle ; void*
, "Ptr", LayoutInfHandle ; void* optional
, "Ptr", FileQueue ; void*
, "WStr", SectionName ; LPCWSTR
, "WStr", SourceRootPath ; LPCWSTR optional
, "UInt", CopyFlags ; DWORD
, "Int") ; return: BOOL●SetupInstallFilesFromInfSectionW(InfHandle, LayoutInfHandle, FileQueue, SectionName, SourceRootPath, CopyFlags) = DLL("SETUPAPI.dll", "bool SetupInstallFilesFromInfSectionW(void*, void*, void*, char*, char*, dword)")
# 呼び出し: SetupInstallFilesFromInfSectionW(InfHandle, LayoutInfHandle, FileQueue, SectionName, SourceRootPath, CopyFlags)
# InfHandle : void* -> "void*"
# LayoutInfHandle : void* optional -> "void*"
# FileQueue : void* -> "void*"
# SectionName : LPCWSTR -> "char*"
# SourceRootPath : LPCWSTR optional -> "char*"
# CopyFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。