ホーム › Devices.DeviceAndDriverInstallation › SetupQueueCopySectionA
SetupQueueCopySectionA
関数INFセクションのファイル群をコピー操作としてキューに追加する(ANSI)。
シグネチャ
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupQueueCopySectionA(
void* QueueHandle,
LPCSTR SourceRootPath, // optional
void* InfHandle,
void* ListInfHandle, // optional
LPCSTR Section,
DWORD CopyStyle
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| QueueHandle | void* | in |
| SourceRootPath | LPCSTR | inoptional |
| InfHandle | void* | in |
| ListInfHandle | void* | inoptional |
| Section | LPCSTR | in |
| CopyStyle | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupQueueCopySectionA(
void* QueueHandle,
LPCSTR SourceRootPath, // optional
void* InfHandle,
void* ListInfHandle, // optional
LPCSTR Section,
DWORD CopyStyle
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool SetupQueueCopySectionA(
IntPtr QueueHandle, // void*
[MarshalAs(UnmanagedType.LPStr)] string SourceRootPath, // LPCSTR optional
IntPtr InfHandle, // void*
IntPtr ListInfHandle, // void* optional
[MarshalAs(UnmanagedType.LPStr)] string Section, // LPCSTR
uint CopyStyle // DWORD
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupQueueCopySectionA(
QueueHandle As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPStr)> SourceRootPath As String, ' LPCSTR optional
InfHandle As IntPtr, ' void*
ListInfHandle As IntPtr, ' void* optional
<MarshalAs(UnmanagedType.LPStr)> Section As String, ' LPCSTR
CopyStyle As UInteger ' DWORD
) As Boolean
End Function' QueueHandle : void*
' SourceRootPath : LPCSTR optional
' InfHandle : void*
' ListInfHandle : void* optional
' Section : LPCSTR
' CopyStyle : DWORD
Declare PtrSafe Function SetupQueueCopySectionA Lib "setupapi" ( _
ByVal QueueHandle As LongPtr, _
ByVal SourceRootPath As String, _
ByVal InfHandle As LongPtr, _
ByVal ListInfHandle As LongPtr, _
ByVal Section As String, _
ByVal CopyStyle As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetupQueueCopySectionA = ctypes.windll.setupapi.SetupQueueCopySectionA
SetupQueueCopySectionA.restype = wintypes.BOOL
SetupQueueCopySectionA.argtypes = [
ctypes.POINTER(None), # QueueHandle : void*
wintypes.LPCSTR, # SourceRootPath : LPCSTR optional
ctypes.POINTER(None), # InfHandle : void*
ctypes.POINTER(None), # ListInfHandle : void* optional
wintypes.LPCSTR, # Section : LPCSTR
wintypes.DWORD, # CopyStyle : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupQueueCopySectionA = Fiddle::Function.new(
lib['SetupQueueCopySectionA'],
[
Fiddle::TYPE_VOIDP, # QueueHandle : void*
Fiddle::TYPE_VOIDP, # SourceRootPath : LPCSTR optional
Fiddle::TYPE_VOIDP, # InfHandle : void*
Fiddle::TYPE_VOIDP, # ListInfHandle : void* optional
Fiddle::TYPE_VOIDP, # Section : LPCSTR
-Fiddle::TYPE_INT, # CopyStyle : DWORD
],
Fiddle::TYPE_INT)#[link(name = "setupapi")]
extern "system" {
fn SetupQueueCopySectionA(
QueueHandle: *mut (), // void*
SourceRootPath: *const u8, // LPCSTR optional
InfHandle: *mut (), // void*
ListInfHandle: *mut (), // void* optional
Section: *const u8, // LPCSTR
CopyStyle: u32 // DWORD
) -> 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 SetupQueueCopySectionA(IntPtr QueueHandle, [MarshalAs(UnmanagedType.LPStr)] string SourceRootPath, IntPtr InfHandle, IntPtr ListInfHandle, [MarshalAs(UnmanagedType.LPStr)] string Section, uint CopyStyle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupQueueCopySectionA' -Namespace Win32 -PassThru
# $api::SetupQueueCopySectionA(QueueHandle, SourceRootPath, InfHandle, ListInfHandle, Section, CopyStyle)#uselib "SETUPAPI.dll"
#func global SetupQueueCopySectionA "SetupQueueCopySectionA" sptr, sptr, sptr, sptr, sptr, sptr
; SetupQueueCopySectionA QueueHandle, SourceRootPath, InfHandle, ListInfHandle, Section, CopyStyle ; 戻り値は stat
; QueueHandle : void* -> "sptr"
; SourceRootPath : LPCSTR optional -> "sptr"
; InfHandle : void* -> "sptr"
; ListInfHandle : void* optional -> "sptr"
; Section : LPCSTR -> "sptr"
; CopyStyle : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SETUPAPI.dll"
#cfunc global SetupQueueCopySectionA "SetupQueueCopySectionA" sptr, str, sptr, sptr, str, int
; res = SetupQueueCopySectionA(QueueHandle, SourceRootPath, InfHandle, ListInfHandle, Section, CopyStyle)
; QueueHandle : void* -> "sptr"
; SourceRootPath : LPCSTR optional -> "str"
; InfHandle : void* -> "sptr"
; ListInfHandle : void* optional -> "sptr"
; Section : LPCSTR -> "str"
; CopyStyle : DWORD -> "int"; BOOL SetupQueueCopySectionA(void* QueueHandle, LPCSTR SourceRootPath, void* InfHandle, void* ListInfHandle, LPCSTR Section, DWORD CopyStyle)
#uselib "SETUPAPI.dll"
#cfunc global SetupQueueCopySectionA "SetupQueueCopySectionA" intptr, str, intptr, intptr, str, int
; res = SetupQueueCopySectionA(QueueHandle, SourceRootPath, InfHandle, ListInfHandle, Section, CopyStyle)
; QueueHandle : void* -> "intptr"
; SourceRootPath : LPCSTR optional -> "str"
; InfHandle : void* -> "intptr"
; ListInfHandle : void* optional -> "intptr"
; Section : LPCSTR -> "str"
; CopyStyle : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupQueueCopySectionA = setupapi.NewProc("SetupQueueCopySectionA")
)
// QueueHandle (void*), SourceRootPath (LPCSTR optional), InfHandle (void*), ListInfHandle (void* optional), Section (LPCSTR), CopyStyle (DWORD)
r1, _, err := procSetupQueueCopySectionA.Call(
uintptr(QueueHandle),
uintptr(unsafe.Pointer(windows.BytePtrFromString(SourceRootPath))),
uintptr(InfHandle),
uintptr(ListInfHandle),
uintptr(unsafe.Pointer(windows.BytePtrFromString(Section))),
uintptr(CopyStyle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupQueueCopySectionA(
QueueHandle: Pointer; // void*
SourceRootPath: PAnsiChar; // LPCSTR optional
InfHandle: Pointer; // void*
ListInfHandle: Pointer; // void* optional
Section: PAnsiChar; // LPCSTR
CopyStyle: DWORD // DWORD
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupQueueCopySectionA';result := DllCall("SETUPAPI\SetupQueueCopySectionA"
, "Ptr", QueueHandle ; void*
, "AStr", SourceRootPath ; LPCSTR optional
, "Ptr", InfHandle ; void*
, "Ptr", ListInfHandle ; void* optional
, "AStr", Section ; LPCSTR
, "UInt", CopyStyle ; DWORD
, "Int") ; return: BOOL●SetupQueueCopySectionA(QueueHandle, SourceRootPath, InfHandle, ListInfHandle, Section, CopyStyle) = DLL("SETUPAPI.dll", "bool SetupQueueCopySectionA(void*, char*, void*, void*, char*, dword)")
# 呼び出し: SetupQueueCopySectionA(QueueHandle, SourceRootPath, InfHandle, ListInfHandle, Section, CopyStyle)
# QueueHandle : void* -> "void*"
# SourceRootPath : LPCSTR optional -> "char*"
# InfHandle : void* -> "void*"
# ListInfHandle : void* optional -> "void*"
# Section : LPCSTR -> "char*"
# CopyStyle : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。