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

SetupQueueCopyW

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

シグネチャ

// SETUPAPI.dll  (Unicode / -W)
#include <windows.h>

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

パラメーター

名前方向
QueueHandlevoid*in
SourceRootPathLPCWSTRinoptional
SourcePathLPCWSTRinoptional
SourceFilenameLPCWSTRin
SourceDescriptionLPCWSTRinoptional
SourceTagfileLPCWSTRinoptional
TargetDirectoryLPCWSTRin
TargetFilenameLPCWSTRinoptional
CopyStyleDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

// SETUPAPI.dll  (Unicode / -W)
#include <windows.h>

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

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

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupQueueCopyW = setupapi.NewProc("SetupQueueCopyW")
)

// QueueHandle (void*), SourceRootPath (LPCWSTR optional), SourcePath (LPCWSTR optional), SourceFilename (LPCWSTR), SourceDescription (LPCWSTR optional), SourceTagfile (LPCWSTR optional), TargetDirectory (LPCWSTR), TargetFilename (LPCWSTR optional), CopyStyle (DWORD)
r1, _, err := procSetupQueueCopyW.Call(
	uintptr(QueueHandle),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(SourceRootPath))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(SourcePath))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(SourceFilename))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(SourceDescription))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(SourceTagfile))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(TargetDirectory))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(TargetFilename))),
	uintptr(CopyStyle),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetupQueueCopyW(
  QueueHandle: Pointer;   // void*
  SourceRootPath: PWideChar;   // LPCWSTR optional
  SourcePath: PWideChar;   // LPCWSTR optional
  SourceFilename: PWideChar;   // LPCWSTR
  SourceDescription: PWideChar;   // LPCWSTR optional
  SourceTagfile: PWideChar;   // LPCWSTR optional
  TargetDirectory: PWideChar;   // LPCWSTR
  TargetFilename: PWideChar;   // LPCWSTR optional
  CopyStyle: DWORD   // DWORD
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupQueueCopyW';
result := DllCall("SETUPAPI\SetupQueueCopyW"
    , "Ptr", QueueHandle   ; void*
    , "WStr", SourceRootPath   ; LPCWSTR optional
    , "WStr", SourcePath   ; LPCWSTR optional
    , "WStr", SourceFilename   ; LPCWSTR
    , "WStr", SourceDescription   ; LPCWSTR optional
    , "WStr", SourceTagfile   ; LPCWSTR optional
    , "WStr", TargetDirectory   ; LPCWSTR
    , "WStr", TargetFilename   ; LPCWSTR optional
    , "UInt", CopyStyle   ; DWORD
    , "Int")   ; return: BOOL
●SetupQueueCopyW(QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle) = DLL("SETUPAPI.dll", "bool SetupQueueCopyW(void*, char*, char*, char*, char*, char*, char*, char*, dword)")
# 呼び出し: SetupQueueCopyW(QueueHandle, SourceRootPath, SourcePath, SourceFilename, SourceDescription, SourceTagfile, TargetDirectory, TargetFilename, CopyStyle)
# QueueHandle : void* -> "void*"
# SourceRootPath : LPCWSTR optional -> "char*"
# SourcePath : LPCWSTR optional -> "char*"
# SourceFilename : LPCWSTR -> "char*"
# SourceDescription : LPCWSTR optional -> "char*"
# SourceTagfile : LPCWSTR optional -> "char*"
# TargetDirectory : LPCWSTR -> "char*"
# TargetFilename : LPCWSTR optional -> "char*"
# CopyStyle : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。