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

SetupQueueDeleteSectionA

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

シグネチャ

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

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

パラメーター

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

戻り値の型: BOOL

各言語での呼び出し定義

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

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

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

// QueueHandle (void*), InfHandle (void*), ListInfHandle (void* optional), Section (LPCSTR)
r1, _, err := procSetupQueueDeleteSectionA.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 SetupQueueDeleteSectionA(
  QueueHandle: Pointer;   // void*
  InfHandle: Pointer;   // void*
  ListInfHandle: Pointer;   // void* optional
  Section: PAnsiChar   // LPCSTR
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupQueueDeleteSectionA';
result := DllCall("SETUPAPI\SetupQueueDeleteSectionA"
    , "Ptr", QueueHandle   ; void*
    , "Ptr", InfHandle   ; void*
    , "Ptr", ListInfHandle   ; void* optional
    , "AStr", Section   ; LPCSTR
    , "Int")   ; return: BOOL
●SetupQueueDeleteSectionA(QueueHandle, InfHandle, ListInfHandle, Section) = DLL("SETUPAPI.dll", "bool SetupQueueDeleteSectionA(void*, void*, void*, char*)")
# 呼び出し: SetupQueueDeleteSectionA(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)。