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

SetupQueueDeleteSectionW

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

シグネチャ

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

BOOL SetupQueueDeleteSectionW(
    void* QueueHandle,
    void* InfHandle,
    void* ListInfHandle,   // optional
    LPCWSTR Section
);

パラメーター

名前方向
QueueHandlevoid*in
InfHandlevoid*in
ListInfHandlevoid*inoptional
SectionLPCWSTRin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SetupQueueDeleteSectionW(
    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 SetupQueueDeleteSectionW(
    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 SetupQueueDeleteSectionW(
    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 SetupQueueDeleteSectionW 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

SetupQueueDeleteSectionW = ctypes.windll.setupapi.SetupQueueDeleteSectionW
SetupQueueDeleteSectionW.restype = wintypes.BOOL
SetupQueueDeleteSectionW.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')
SetupQueueDeleteSectionW = Fiddle::Function.new(
  lib['SetupQueueDeleteSectionW'],
  [
    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 SetupQueueDeleteSectionW(
        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 SetupQueueDeleteSectionW(IntPtr QueueHandle, IntPtr InfHandle, IntPtr ListInfHandle, [MarshalAs(UnmanagedType.LPWStr)] string Section);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupQueueDeleteSectionW' -Namespace Win32 -PassThru
# $api::SetupQueueDeleteSectionW(QueueHandle, InfHandle, ListInfHandle, Section)
#uselib "SETUPAPI.dll"
#func global SetupQueueDeleteSectionW "SetupQueueDeleteSectionW" wptr, wptr, wptr, wptr
; SetupQueueDeleteSectionW 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 SetupQueueDeleteSectionW "SetupQueueDeleteSectionW" sptr, sptr, sptr, wstr
; res = SetupQueueDeleteSectionW(QueueHandle, InfHandle, ListInfHandle, Section)
; QueueHandle : void* -> "sptr"
; InfHandle : void* -> "sptr"
; ListInfHandle : void* optional -> "sptr"
; Section : LPCWSTR -> "wstr"
; BOOL SetupQueueDeleteSectionW(void* QueueHandle, void* InfHandle, void* ListInfHandle, LPCWSTR Section)
#uselib "SETUPAPI.dll"
#cfunc global SetupQueueDeleteSectionW "SetupQueueDeleteSectionW" intptr, intptr, intptr, wstr
; res = SetupQueueDeleteSectionW(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")
	procSetupQueueDeleteSectionW = setupapi.NewProc("SetupQueueDeleteSectionW")
)

// QueueHandle (void*), InfHandle (void*), ListInfHandle (void* optional), Section (LPCWSTR)
r1, _, err := procSetupQueueDeleteSectionW.Call(
	uintptr(QueueHandle),
	uintptr(InfHandle),
	uintptr(ListInfHandle),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Section))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetupQueueDeleteSectionW(
  QueueHandle: Pointer;   // void*
  InfHandle: Pointer;   // void*
  ListInfHandle: Pointer;   // void* optional
  Section: PWideChar   // LPCWSTR
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupQueueDeleteSectionW';
result := DllCall("SETUPAPI\SetupQueueDeleteSectionW"
    , "Ptr", QueueHandle   ; void*
    , "Ptr", InfHandle   ; void*
    , "Ptr", ListInfHandle   ; void* optional
    , "WStr", Section   ; LPCWSTR
    , "Int")   ; return: BOOL
●SetupQueueDeleteSectionW(QueueHandle, InfHandle, ListInfHandle, Section) = DLL("SETUPAPI.dll", "bool SetupQueueDeleteSectionW(void*, void*, void*, char*)")
# 呼び出し: SetupQueueDeleteSectionW(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 版の利用を推奨。