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