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