Win32 API 日本語リファレンス
ホームDevices.DeviceAndDriverInstallation › SetupQueueCopyA

SetupQueueCopyA

関数
ファイルキューにコピー操作を追加する(ANSI)。
DLLSETUPAPI.dll文字セットANSI (-A)呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

// SETUPAPI.dll  (ANSI / -A)
#include <windows.h>

BOOL SetupQueueCopyA(
    void* QueueHandle,
    LPCSTR SourceRootPath,   // optional
    LPCSTR SourcePath,   // optional
    LPCSTR SourceFilename,
    LPCSTR SourceDescription,   // optional
    LPCSTR SourceTagfile,   // optional
    LPCSTR TargetDirectory,
    LPCSTR TargetFilename,   // optional
    DWORD CopyStyle
);

パラメーター

名前方向
QueueHandlevoid*in
SourceRootPathLPCSTRinoptional
SourcePathLPCSTRinoptional
SourceFilenameLPCSTRin
SourceDescriptionLPCSTRinoptional
SourceTagfileLPCSTRinoptional
TargetDirectoryLPCSTRin
TargetFilenameLPCSTRinoptional
CopyStyleDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

// SETUPAPI.dll  (ANSI / -A)
#include <windows.h>

BOOL SetupQueueCopyA(
    void* QueueHandle,
    LPCSTR SourceRootPath,   // optional
    LPCSTR SourcePath,   // optional
    LPCSTR SourceFilename,
    LPCSTR SourceDescription,   // optional
    LPCSTR SourceTagfile,   // optional
    LPCSTR TargetDirectory,
    LPCSTR TargetFilename,   // optional
    DWORD CopyStyle
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool SetupQueueCopyA(
    IntPtr QueueHandle,   // void*
    [MarshalAs(UnmanagedType.LPStr)] string SourceRootPath,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string SourcePath,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string SourceFilename,   // LPCSTR
    [MarshalAs(UnmanagedType.LPStr)] string SourceDescription,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string SourceTagfile,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string TargetDirectory,   // LPCSTR
    [MarshalAs(UnmanagedType.LPStr)] string TargetFilename,   // LPCSTR optional
    uint CopyStyle   // DWORD
);
<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupQueueCopyA(
    QueueHandle As IntPtr,   ' void*
    <MarshalAs(UnmanagedType.LPStr)> SourceRootPath As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> SourcePath As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> SourceFilename As String,   ' LPCSTR
    <MarshalAs(UnmanagedType.LPStr)> SourceDescription As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> SourceTagfile As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> TargetDirectory As String,   ' LPCSTR
    <MarshalAs(UnmanagedType.LPStr)> TargetFilename As String,   ' LPCSTR optional
    CopyStyle As UInteger   ' DWORD
) As Boolean
End Function
' QueueHandle : void*
' SourceRootPath : LPCSTR optional
' SourcePath : LPCSTR optional
' SourceFilename : LPCSTR
' SourceDescription : LPCSTR optional
' SourceTagfile : LPCSTR optional
' TargetDirectory : LPCSTR
' TargetFilename : LPCSTR optional
' CopyStyle : DWORD
Declare PtrSafe Function SetupQueueCopyA Lib "setupapi" ( _
    ByVal QueueHandle As LongPtr, _
    ByVal SourceRootPath As String, _
    ByVal SourcePath As String, _
    ByVal SourceFilename As String, _
    ByVal SourceDescription As String, _
    ByVal SourceTagfile As String, _
    ByVal TargetDirectory As String, _
    ByVal TargetFilename 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

SetupQueueCopyA = ctypes.windll.setupapi.SetupQueueCopyA
SetupQueueCopyA.restype = wintypes.BOOL
SetupQueueCopyA.argtypes = [
    ctypes.POINTER(None),  # QueueHandle : void*
    wintypes.LPCSTR,  # SourceRootPath : LPCSTR optional
    wintypes.LPCSTR,  # SourcePath : LPCSTR optional
    wintypes.LPCSTR,  # SourceFilename : LPCSTR
    wintypes.LPCSTR,  # SourceDescription : LPCSTR optional
    wintypes.LPCSTR,  # SourceTagfile : LPCSTR optional
    wintypes.LPCSTR,  # TargetDirectory : LPCSTR
    wintypes.LPCSTR,  # TargetFilename : LPCSTR optional
    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')
SetupQueueCopyA = Fiddle::Function.new(
  lib['SetupQueueCopyA'],
  [
    Fiddle::TYPE_VOIDP,  # QueueHandle : void*
    Fiddle::TYPE_VOIDP,  # SourceRootPath : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # SourcePath : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # SourceFilename : LPCSTR
    Fiddle::TYPE_VOIDP,  # SourceDescription : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # SourceTagfile : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # TargetDirectory : LPCSTR
    Fiddle::TYPE_VOIDP,  # TargetFilename : LPCSTR optional
    -Fiddle::TYPE_INT,  # CopyStyle : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "setupapi")]
extern "system" {
    fn SetupQueueCopyA(
        QueueHandle: *mut (),  // void*
        SourceRootPath: *const u8,  // LPCSTR optional
        SourcePath: *const u8,  // LPCSTR optional
        SourceFilename: *const u8,  // LPCSTR
        SourceDescription: *const u8,  // LPCSTR optional
        SourceTagfile: *const u8,  // LPCSTR optional
        TargetDirectory: *const u8,  // LPCSTR
        TargetFilename: *const u8,  // LPCSTR optional
        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 SetupQueueCopyA(IntPtr QueueHandle, [MarshalAs(UnmanagedType.LPStr)] string SourceRootPath, [MarshalAs(UnmanagedType.LPStr)] string SourcePath, [MarshalAs(UnmanagedType.LPStr)] string SourceFilename, [MarshalAs(UnmanagedType.LPStr)] string SourceDescription, [MarshalAs(UnmanagedType.LPStr)] string SourceTagfile, [MarshalAs(UnmanagedType.LPStr)] string TargetDirectory, [MarshalAs(UnmanagedType.LPStr)] string TargetFilename, uint CopyStyle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupQueueCopyA' -Namespace Win32 -PassThru
# $api::SetupQueueCopyA(QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle)
#uselib "SETUPAPI.dll"
#func global SetupQueueCopyA "SetupQueueCopyA" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; SetupQueueCopyA QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle   ; 戻り値は stat
; QueueHandle : void* -> "sptr"
; SourceRootPath : LPCSTR optional -> "sptr"
; SourcePath : LPCSTR optional -> "sptr"
; SourceFilename : LPCSTR -> "sptr"
; SourceDescription : LPCSTR optional -> "sptr"
; SourceTagfile : LPCSTR optional -> "sptr"
; TargetDirectory : LPCSTR -> "sptr"
; TargetFilename : LPCSTR optional -> "sptr"
; CopyStyle : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SETUPAPI.dll"
#cfunc global SetupQueueCopyA "SetupQueueCopyA" sptr, str, str, str, str, str, str, str, int
; res = SetupQueueCopyA(QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle)
; QueueHandle : void* -> "sptr"
; SourceRootPath : LPCSTR optional -> "str"
; SourcePath : LPCSTR optional -> "str"
; SourceFilename : LPCSTR -> "str"
; SourceDescription : LPCSTR optional -> "str"
; SourceTagfile : LPCSTR optional -> "str"
; TargetDirectory : LPCSTR -> "str"
; TargetFilename : LPCSTR optional -> "str"
; CopyStyle : DWORD -> "int"
; BOOL SetupQueueCopyA(void* QueueHandle, LPCSTR SourceRootPath, LPCSTR SourcePath, LPCSTR SourceFilename, LPCSTR SourceDescription, LPCSTR SourceTagfile, LPCSTR TargetDirectory, LPCSTR TargetFilename, DWORD CopyStyle)
#uselib "SETUPAPI.dll"
#cfunc global SetupQueueCopyA "SetupQueueCopyA" intptr, str, str, str, str, str, str, str, int
; res = SetupQueueCopyA(QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle)
; QueueHandle : void* -> "intptr"
; SourceRootPath : LPCSTR optional -> "str"
; SourcePath : LPCSTR optional -> "str"
; SourceFilename : LPCSTR -> "str"
; SourceDescription : LPCSTR optional -> "str"
; SourceTagfile : LPCSTR optional -> "str"
; TargetDirectory : LPCSTR -> "str"
; TargetFilename : LPCSTR optional -> "str"
; CopyStyle : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupQueueCopyA = setupapi.NewProc("SetupQueueCopyA")
)

// QueueHandle (void*), SourceRootPath (LPCSTR optional), SourcePath (LPCSTR optional), SourceFilename (LPCSTR), SourceDescription (LPCSTR optional), SourceTagfile (LPCSTR optional), TargetDirectory (LPCSTR), TargetFilename (LPCSTR optional), CopyStyle (DWORD)
r1, _, err := procSetupQueueCopyA.Call(
	uintptr(QueueHandle),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(SourceRootPath))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(SourcePath))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(SourceFilename))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(SourceDescription))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(SourceTagfile))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(TargetDirectory))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(TargetFilename))),
	uintptr(CopyStyle),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetupQueueCopyA(
  QueueHandle: Pointer;   // void*
  SourceRootPath: PAnsiChar;   // LPCSTR optional
  SourcePath: PAnsiChar;   // LPCSTR optional
  SourceFilename: PAnsiChar;   // LPCSTR
  SourceDescription: PAnsiChar;   // LPCSTR optional
  SourceTagfile: PAnsiChar;   // LPCSTR optional
  TargetDirectory: PAnsiChar;   // LPCSTR
  TargetFilename: PAnsiChar;   // LPCSTR optional
  CopyStyle: DWORD   // DWORD
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupQueueCopyA';
result := DllCall("SETUPAPI\SetupQueueCopyA"
    , "Ptr", QueueHandle   ; void*
    , "AStr", SourceRootPath   ; LPCSTR optional
    , "AStr", SourcePath   ; LPCSTR optional
    , "AStr", SourceFilename   ; LPCSTR
    , "AStr", SourceDescription   ; LPCSTR optional
    , "AStr", SourceTagfile   ; LPCSTR optional
    , "AStr", TargetDirectory   ; LPCSTR
    , "AStr", TargetFilename   ; LPCSTR optional
    , "UInt", CopyStyle   ; DWORD
    , "Int")   ; return: BOOL
●SetupQueueCopyA(QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle) = DLL("SETUPAPI.dll", "bool SetupQueueCopyA(void*, char*, char*, char*, char*, char*, char*, char*, dword)")
# 呼び出し: SetupQueueCopyA(QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle)
# QueueHandle : void* -> "void*"
# SourceRootPath : LPCSTR optional -> "char*"
# SourcePath : LPCSTR optional -> "char*"
# SourceFilename : LPCSTR -> "char*"
# SourceDescription : LPCSTR optional -> "char*"
# SourceTagfile : LPCSTR optional -> "char*"
# TargetDirectory : LPCSTR -> "char*"
# TargetFilename : LPCSTR optional -> "char*"
# CopyStyle : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。