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

SetupQueueRenameSectionA

関数
INFセクションのファイル群を名前変更操作としてキューに追加する(ANSI)。
DLLSETUPAPI.dll文字セットANSI (-A)呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL SetupQueueRenameSectionA(
    void* QueueHandle,
    void* InfHandle,
    void* ListInfHandle,   // optional
    LPCSTR Section
);

パラメーター

名前方向説明
QueueHandlevoid*in名前変更操作を登録するファイルキューのハンドル。
InfHandlevoid*in名前変更対象を記述したINFファイルのハンドル。
ListInfHandlevoid*inoptional追加情報を持つレイアウトINFのハンドル。NULL可。
SectionLPCSTRin名前変更対象を列挙したINFのセクション名(ANSI)。

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SetupQueueRenameSectionA(
    void* QueueHandle,
    void* InfHandle,
    void* ListInfHandle,   // optional
    LPCSTR Section
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool SetupQueueRenameSectionA(
    IntPtr QueueHandle,   // void*
    IntPtr InfHandle,   // void*
    IntPtr ListInfHandle,   // void* optional
    [MarshalAs(UnmanagedType.LPStr)] string Section   // LPCSTR
);
<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupQueueRenameSectionA(
    QueueHandle As IntPtr,   ' void*
    InfHandle As IntPtr,   ' void*
    ListInfHandle As IntPtr,   ' void* optional
    <MarshalAs(UnmanagedType.LPStr)> Section As String   ' LPCSTR
) As Boolean
End Function
' QueueHandle : void*
' InfHandle : void*
' ListInfHandle : void* optional
' Section : LPCSTR
Declare PtrSafe Function SetupQueueRenameSectionA Lib "setupapi" ( _
    ByVal QueueHandle As LongPtr, _
    ByVal InfHandle As LongPtr, _
    ByVal ListInfHandle As LongPtr, _
    ByVal Section As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetupQueueRenameSectionA = ctypes.windll.setupapi.SetupQueueRenameSectionA
SetupQueueRenameSectionA.restype = wintypes.BOOL
SetupQueueRenameSectionA.argtypes = [
    ctypes.POINTER(None),  # QueueHandle : void*
    ctypes.POINTER(None),  # InfHandle : void*
    ctypes.POINTER(None),  # ListInfHandle : void* optional
    wintypes.LPCSTR,  # Section : LPCSTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SETUPAPI.dll')
SetupQueueRenameSectionA = Fiddle::Function.new(
  lib['SetupQueueRenameSectionA'],
  [
    Fiddle::TYPE_VOIDP,  # QueueHandle : void*
    Fiddle::TYPE_VOIDP,  # InfHandle : void*
    Fiddle::TYPE_VOIDP,  # ListInfHandle : void* optional
    Fiddle::TYPE_VOIDP,  # Section : LPCSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "setupapi")]
extern "system" {
    fn SetupQueueRenameSectionA(
        QueueHandle: *mut (),  // void*
        InfHandle: *mut (),  // void*
        ListInfHandle: *mut (),  // void* optional
        Section: *const u8  // LPCSTR
    ) -> 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 SetupQueueRenameSectionA(IntPtr QueueHandle, IntPtr InfHandle, IntPtr ListInfHandle, [MarshalAs(UnmanagedType.LPStr)] string Section);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupQueueRenameSectionA' -Namespace Win32 -PassThru
# $api::SetupQueueRenameSectionA(QueueHandle, InfHandle, ListInfHandle, Section)
#uselib "SETUPAPI.dll"
#func global SetupQueueRenameSectionA "SetupQueueRenameSectionA" sptr, sptr, sptr, sptr
; SetupQueueRenameSectionA QueueHandle, InfHandle, ListInfHandle, Section   ; 戻り値は stat
; QueueHandle : void* -> "sptr"
; InfHandle : void* -> "sptr"
; ListInfHandle : void* optional -> "sptr"
; Section : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SETUPAPI.dll"
#cfunc global SetupQueueRenameSectionA "SetupQueueRenameSectionA" sptr, sptr, sptr, str
; res = SetupQueueRenameSectionA(QueueHandle, InfHandle, ListInfHandle, Section)
; QueueHandle : void* -> "sptr"
; InfHandle : void* -> "sptr"
; ListInfHandle : void* optional -> "sptr"
; Section : LPCSTR -> "str"
; BOOL SetupQueueRenameSectionA(void* QueueHandle, void* InfHandle, void* ListInfHandle, LPCSTR Section)
#uselib "SETUPAPI.dll"
#cfunc global SetupQueueRenameSectionA "SetupQueueRenameSectionA" intptr, intptr, intptr, str
; res = SetupQueueRenameSectionA(QueueHandle, InfHandle, ListInfHandle, Section)
; QueueHandle : void* -> "intptr"
; InfHandle : void* -> "intptr"
; ListInfHandle : void* optional -> "intptr"
; Section : LPCSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupQueueRenameSectionA = setupapi.NewProc("SetupQueueRenameSectionA")
)

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