ホーム › Devices.DeviceAndDriverInstallation › SetupQueueDeleteA
SetupQueueDeleteA
関数ファイルキューに削除操作を追加する(ANSI)。
シグネチャ
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupQueueDeleteA(
void* QueueHandle,
LPCSTR PathPart1,
LPCSTR PathPart2 // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| QueueHandle | void* | in | 削除操作を登録するファイルキューのハンドル。 |
| PathPart1 | LPCSTR | in | 削除対象パスの前半部分(ANSI)。PathPart2と連結される。 |
| PathPart2 | LPCSTR | inoptional | 削除対象パスの後半部分(ANSI)。NULL可。 |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupQueueDeleteA(
void* QueueHandle,
LPCSTR PathPart1,
LPCSTR PathPart2 // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool SetupQueueDeleteA(
IntPtr QueueHandle, // void*
[MarshalAs(UnmanagedType.LPStr)] string PathPart1, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string PathPart2 // LPCSTR optional
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupQueueDeleteA(
QueueHandle As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPStr)> PathPart1 As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> PathPart2 As String ' LPCSTR optional
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' QueueHandle : void*
' PathPart1 : LPCSTR
' PathPart2 : LPCSTR optional
Declare PtrSafe Function SetupQueueDeleteA Lib "setupapi" ( _
ByVal QueueHandle As LongPtr, _
ByVal PathPart1 As String, _
ByVal PathPart2 As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetupQueueDeleteA = ctypes.windll.setupapi.SetupQueueDeleteA
SetupQueueDeleteA.restype = wintypes.BOOL
SetupQueueDeleteA.argtypes = [
ctypes.POINTER(None), # QueueHandle : void*
wintypes.LPCSTR, # PathPart1 : LPCSTR
wintypes.LPCSTR, # PathPart2 : LPCSTR optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupQueueDeleteA = Fiddle::Function.new(
lib['SetupQueueDeleteA'],
[
Fiddle::TYPE_VOIDP, # QueueHandle : void*
Fiddle::TYPE_VOIDP, # PathPart1 : LPCSTR
Fiddle::TYPE_VOIDP, # PathPart2 : LPCSTR optional
],
Fiddle::TYPE_INT)#[link(name = "setupapi")]
extern "system" {
fn SetupQueueDeleteA(
QueueHandle: *mut (), // void*
PathPart1: *const u8, // LPCSTR
PathPart2: *const u8 // LPCSTR optional
) -> 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 SetupQueueDeleteA(IntPtr QueueHandle, [MarshalAs(UnmanagedType.LPStr)] string PathPart1, [MarshalAs(UnmanagedType.LPStr)] string PathPart2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupQueueDeleteA' -Namespace Win32 -PassThru
# $api::SetupQueueDeleteA(QueueHandle, PathPart1, PathPart2)#uselib "SETUPAPI.dll"
#func global SetupQueueDeleteA "SetupQueueDeleteA" sptr, sptr, sptr
; SetupQueueDeleteA QueueHandle, PathPart1, PathPart2 ; 戻り値は stat
; QueueHandle : void* -> "sptr"
; PathPart1 : LPCSTR -> "sptr"
; PathPart2 : LPCSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SETUPAPI.dll"
#cfunc global SetupQueueDeleteA "SetupQueueDeleteA" sptr, str, str
; res = SetupQueueDeleteA(QueueHandle, PathPart1, PathPart2)
; QueueHandle : void* -> "sptr"
; PathPart1 : LPCSTR -> "str"
; PathPart2 : LPCSTR optional -> "str"; BOOL SetupQueueDeleteA(void* QueueHandle, LPCSTR PathPart1, LPCSTR PathPart2)
#uselib "SETUPAPI.dll"
#cfunc global SetupQueueDeleteA "SetupQueueDeleteA" intptr, str, str
; res = SetupQueueDeleteA(QueueHandle, PathPart1, PathPart2)
; QueueHandle : void* -> "intptr"
; PathPart1 : LPCSTR -> "str"
; PathPart2 : LPCSTR optional -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupQueueDeleteA = setupapi.NewProc("SetupQueueDeleteA")
)
// QueueHandle (void*), PathPart1 (LPCSTR), PathPart2 (LPCSTR optional)
r1, _, err := procSetupQueueDeleteA.Call(
uintptr(QueueHandle),
uintptr(unsafe.Pointer(windows.BytePtrFromString(PathPart1))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(PathPart2))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupQueueDeleteA(
QueueHandle: Pointer; // void*
PathPart1: PAnsiChar; // LPCSTR
PathPart2: PAnsiChar // LPCSTR optional
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupQueueDeleteA';result := DllCall("SETUPAPI\SetupQueueDeleteA"
, "Ptr", QueueHandle ; void*
, "AStr", PathPart1 ; LPCSTR
, "AStr", PathPart2 ; LPCSTR optional
, "Int") ; return: BOOL●SetupQueueDeleteA(QueueHandle, PathPart1, PathPart2) = DLL("SETUPAPI.dll", "bool SetupQueueDeleteA(void*, char*, char*)")
# 呼び出し: SetupQueueDeleteA(QueueHandle, PathPart1, PathPart2)
# QueueHandle : void* -> "void*"
# PathPart1 : LPCSTR -> "char*"
# PathPart2 : LPCSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "setupapi" fn SetupQueueDeleteA(
QueueHandle: ?*anyopaque, // void*
PathPart1: [*c]const u8, // LPCSTR
PathPart2: [*c]const u8 // LPCSTR optional
) callconv(std.os.windows.WINAPI) i32;proc SetupQueueDeleteA(
QueueHandle: pointer, # void*
PathPart1: cstring, # LPCSTR
PathPart2: cstring # LPCSTR optional
): int32 {.importc: "SetupQueueDeleteA", stdcall, dynlib: "SETUPAPI.dll".}pragma(lib, "setupapi");
extern(Windows)
int SetupQueueDeleteA(
void* QueueHandle, // void*
const(char)* PathPart1, // LPCSTR
const(char)* PathPart2 // LPCSTR optional
);ccall((:SetupQueueDeleteA, "SETUPAPI.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cstring, Cstring),
QueueHandle, PathPart1, PathPart2)
# QueueHandle : void* -> Ptr{Cvoid}
# PathPart1 : LPCSTR -> Cstring
# PathPart2 : LPCSTR optional -> Cstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t SetupQueueDeleteA(
void* QueueHandle,
const char* PathPart1,
const char* PathPart2);
]]
local setupapi = ffi.load("setupapi")
-- setupapi.SetupQueueDeleteA(QueueHandle, PathPart1, PathPart2)
-- QueueHandle : void*
-- PathPart1 : LPCSTR
-- PathPart2 : LPCSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('SETUPAPI.dll');
const SetupQueueDeleteA = lib.func('__stdcall', 'SetupQueueDeleteA', 'int32_t', ['void *', 'str', 'str']);
// SetupQueueDeleteA(QueueHandle, PathPart1, PathPart2)
// QueueHandle : void* -> 'void *'
// PathPart1 : LPCSTR -> 'str'
// PathPart2 : LPCSTR optional -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SETUPAPI.dll", {
SetupQueueDeleteA: { parameters: ["pointer", "buffer", "buffer"], result: "i32" },
});
// lib.symbols.SetupQueueDeleteA(QueueHandle, PathPart1, PathPart2)
// QueueHandle : void* -> "pointer"
// PathPart1 : LPCSTR -> "buffer"
// PathPart2 : LPCSTR optional -> "buffer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SetupQueueDeleteA(
void* QueueHandle,
const char* PathPart1,
const char* PathPart2);
C, "SETUPAPI.dll");
// $ffi->SetupQueueDeleteA(QueueHandle, PathPart1, PathPart2);
// QueueHandle : void*
// PathPart1 : LPCSTR
// PathPart2 : LPCSTR optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Setupapi extends StdCallLibrary {
Setupapi INSTANCE = Native.load("setupapi", Setupapi.class, W32APIOptions.ASCII_OPTIONS);
boolean SetupQueueDeleteA(
Pointer QueueHandle, // void*
String PathPart1, // LPCSTR
String PathPart2 // LPCSTR optional
);
}@[Link("setupapi")]
lib LibSETUPAPI
fun SetupQueueDeleteA = SetupQueueDeleteA(
QueueHandle : Void*, # void*
PathPart1 : UInt8*, # LPCSTR
PathPart2 : UInt8* # LPCSTR optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SetupQueueDeleteANative = Int32 Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>);
typedef SetupQueueDeleteADart = int Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>);
final SetupQueueDeleteA = DynamicLibrary.open('SETUPAPI.dll')
.lookupFunction<SetupQueueDeleteANative, SetupQueueDeleteADart>('SetupQueueDeleteA');
// QueueHandle : void* -> Pointer<Void>
// PathPart1 : LPCSTR -> Pointer<Utf8>
// PathPart2 : LPCSTR optional -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SetupQueueDeleteA(
QueueHandle: Pointer; // void*
PathPart1: PAnsiChar; // LPCSTR
PathPart2: PAnsiChar // LPCSTR optional
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupQueueDeleteA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SetupQueueDeleteA"
c_SetupQueueDeleteA :: Ptr () -> CString -> CString -> IO CInt
-- QueueHandle : void* -> Ptr ()
-- PathPart1 : LPCSTR -> CString
-- PathPart2 : LPCSTR optional -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let setupqueuedeletea =
foreign "SetupQueueDeleteA"
((ptr void) @-> string @-> string @-> returning int32_t)
(* QueueHandle : void* -> (ptr void) *)
(* PathPart1 : LPCSTR -> string *)
(* PathPart2 : LPCSTR optional -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library setupapi (t "SETUPAPI.dll"))
(cffi:use-foreign-library setupapi)
(cffi:defcfun ("SetupQueueDeleteA" setup-queue-delete-a :convention :stdcall) :int32
(queue-handle :pointer) ; void*
(path-part1 :string) ; LPCSTR
(path-part2 :string)) ; LPCSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SetupQueueDeleteA = Win32::API::More->new('SETUPAPI',
'BOOL SetupQueueDeleteA(LPVOID QueueHandle, LPCSTR PathPart1, LPCSTR PathPart2)');
# my $ret = $SetupQueueDeleteA->Call($QueueHandle, $PathPart1, $PathPart2);
# QueueHandle : void* -> LPVOID
# PathPart1 : LPCSTR -> LPCSTR
# PathPart2 : LPCSTR optional -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f SetupQueueDeleteW (Unicode版) — ファイルキューに削除操作を追加する(Unicode)。