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

SetupCommitFileQueueA

関数
キューに登録された全ファイル操作を実行する(ANSI)。
DLLSETUPAPI.dll文字セットANSI (-A)呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL SetupCommitFileQueueA(
    HWND Owner,   // optional
    void* QueueHandle,
    PSP_FILE_CALLBACK_A MsgHandler,
    void* Context
);

パラメーター

名前方向説明
OwnerHWNDinoptional進捗ダイアログの親となるウィンドウハンドル。NULL可。
QueueHandlevoid*in登録済み操作を実行するファイルキューのハンドル。
MsgHandlerPSP_FILE_CALLBACK_Ainコピー進捗通知を受け取るコールバック関数(ANSI)。
Contextvoid*inコールバックへ渡すユーザー定義のコンテキストポインタ。

戻り値の型: BOOL

各言語での呼び出し定義

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

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

SetupCommitFileQueueA = ctypes.windll.setupapi.SetupCommitFileQueueA
SetupCommitFileQueueA.restype = wintypes.BOOL
SetupCommitFileQueueA.argtypes = [
    wintypes.HANDLE,  # Owner : HWND optional
    ctypes.POINTER(None),  # QueueHandle : void*
    ctypes.c_void_p,  # MsgHandler : PSP_FILE_CALLBACK_A
    ctypes.POINTER(None),  # Context : void*
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupCommitFileQueueA = setupapi.NewProc("SetupCommitFileQueueA")
)

// Owner (HWND optional), QueueHandle (void*), MsgHandler (PSP_FILE_CALLBACK_A), Context (void*)
r1, _, err := procSetupCommitFileQueueA.Call(
	uintptr(Owner),
	uintptr(QueueHandle),
	uintptr(MsgHandler),
	uintptr(Context),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetupCommitFileQueueA(
  Owner: THandle;   // HWND optional
  QueueHandle: Pointer;   // void*
  MsgHandler: Pointer;   // PSP_FILE_CALLBACK_A
  Context: Pointer   // void*
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupCommitFileQueueA';
result := DllCall("SETUPAPI\SetupCommitFileQueueA"
    , "Ptr", Owner   ; HWND optional
    , "Ptr", QueueHandle   ; void*
    , "Ptr", MsgHandler   ; PSP_FILE_CALLBACK_A
    , "Ptr", Context   ; void*
    , "Int")   ; return: BOOL
●SetupCommitFileQueueA(Owner, QueueHandle, MsgHandler, Context) = DLL("SETUPAPI.dll", "bool SetupCommitFileQueueA(void*, void*, void*, void*)")
# 呼び出し: SetupCommitFileQueueA(Owner, QueueHandle, MsgHandler, Context)
# Owner : HWND optional -> "void*"
# QueueHandle : void* -> "void*"
# MsgHandler : PSP_FILE_CALLBACK_A -> "void*"
# Context : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "setupapi" fn SetupCommitFileQueueA(
    Owner: ?*anyopaque, // HWND optional
    QueueHandle: ?*anyopaque, // void*
    MsgHandler: ?*anyopaque, // PSP_FILE_CALLBACK_A
    Context: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) i32;
proc SetupCommitFileQueueA(
    Owner: pointer,  # HWND optional
    QueueHandle: pointer,  # void*
    MsgHandler: pointer,  # PSP_FILE_CALLBACK_A
    Context: pointer  # void*
): int32 {.importc: "SetupCommitFileQueueA", stdcall, dynlib: "SETUPAPI.dll".}
pragma(lib, "setupapi");
extern(Windows)
int SetupCommitFileQueueA(
    void* Owner,   // HWND optional
    void* QueueHandle,   // void*
    void* MsgHandler,   // PSP_FILE_CALLBACK_A
    void* Context   // void*
);
ccall((:SetupCommitFileQueueA, "SETUPAPI.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
      Owner, QueueHandle, MsgHandler, Context)
# Owner : HWND optional -> Ptr{Cvoid}
# QueueHandle : void* -> Ptr{Cvoid}
# MsgHandler : PSP_FILE_CALLBACK_A -> Ptr{Cvoid}
# Context : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t SetupCommitFileQueueA(
    void* Owner,
    void* QueueHandle,
    void* MsgHandler,
    void* Context);
]]
local setupapi = ffi.load("setupapi")
-- setupapi.SetupCommitFileQueueA(Owner, QueueHandle, MsgHandler, Context)
-- Owner : HWND optional
-- QueueHandle : void*
-- MsgHandler : PSP_FILE_CALLBACK_A
-- Context : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('SETUPAPI.dll');
const SetupCommitFileQueueA = lib.func('__stdcall', 'SetupCommitFileQueueA', 'int32_t', ['void *', 'void *', 'void *', 'void *']);
// SetupCommitFileQueueA(Owner, QueueHandle, MsgHandler, Context)
// Owner : HWND optional -> 'void *'
// QueueHandle : void* -> 'void *'
// MsgHandler : PSP_FILE_CALLBACK_A -> 'void *'
// Context : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。
const lib = Deno.dlopen("SETUPAPI.dll", {
  SetupCommitFileQueueA: { parameters: ["pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.SetupCommitFileQueueA(Owner, QueueHandle, MsgHandler, Context)
// Owner : HWND optional -> "pointer"
// QueueHandle : void* -> "pointer"
// MsgHandler : PSP_FILE_CALLBACK_A -> "pointer"
// Context : void* -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t SetupCommitFileQueueA(
    void* Owner,
    void* QueueHandle,
    void* MsgHandler,
    void* Context);
C, "SETUPAPI.dll");
// $ffi->SetupCommitFileQueueA(Owner, QueueHandle, MsgHandler, Context);
// Owner : HWND optional
// QueueHandle : void*
// MsgHandler : PSP_FILE_CALLBACK_A
// Context : void*
// 構造体/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 SetupCommitFileQueueA(
        Pointer Owner,   // HWND optional
        Pointer QueueHandle,   // void*
        Callback MsgHandler,   // PSP_FILE_CALLBACK_A
        Pointer Context   // void*
    );
}
@[Link("setupapi")]
lib LibSETUPAPI
  fun SetupCommitFileQueueA = SetupCommitFileQueueA(
    Owner : Void*,   # HWND optional
    QueueHandle : Void*,   # void*
    MsgHandler : Void*,   # PSP_FILE_CALLBACK_A
    Context : Void*   # void*
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef SetupCommitFileQueueANative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef SetupCommitFileQueueADart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
final SetupCommitFileQueueA = DynamicLibrary.open('SETUPAPI.dll')
    .lookupFunction<SetupCommitFileQueueANative, SetupCommitFileQueueADart>('SetupCommitFileQueueA');
// Owner : HWND optional -> Pointer<Void>
// QueueHandle : void* -> Pointer<Void>
// MsgHandler : PSP_FILE_CALLBACK_A -> Pointer<Void>
// Context : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function SetupCommitFileQueueA(
  Owner: THandle;   // HWND optional
  QueueHandle: Pointer;   // void*
  MsgHandler: Pointer;   // PSP_FILE_CALLBACK_A
  Context: Pointer   // void*
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupCommitFileQueueA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "SetupCommitFileQueueA"
  c_SetupCommitFileQueueA :: Ptr () -> Ptr () -> Ptr () -> Ptr () -> IO CInt
-- Owner : HWND optional -> Ptr ()
-- QueueHandle : void* -> Ptr ()
-- MsgHandler : PSP_FILE_CALLBACK_A -> Ptr ()
-- Context : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let setupcommitfilequeuea =
  foreign "SetupCommitFileQueueA"
    ((ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* Owner : HWND optional -> (ptr void) *)
(* QueueHandle : void* -> (ptr void) *)
(* MsgHandler : PSP_FILE_CALLBACK_A -> (ptr void) *)
(* Context : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library setupapi (t "SETUPAPI.dll"))
(cffi:use-foreign-library setupapi)

(cffi:defcfun ("SetupCommitFileQueueA" setup-commit-file-queue-a :convention :stdcall) :int32
  (owner :pointer)   ; HWND optional
  (queue-handle :pointer)   ; void*
  (msg-handler :pointer)   ; PSP_FILE_CALLBACK_A
  (context :pointer))   ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $SetupCommitFileQueueA = Win32::API::More->new('SETUPAPI',
    'BOOL SetupCommitFileQueueA(HANDLE Owner, LPVOID QueueHandle, LPVOID MsgHandler, LPVOID Context)');
# my $ret = $SetupCommitFileQueueA->Call($Owner, $QueueHandle, $MsgHandler, $Context);
# Owner : HWND optional -> HANDLE
# QueueHandle : void* -> LPVOID
# MsgHandler : PSP_FILE_CALLBACK_A -> LPVOID
# Context : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。

関連項目

文字セット違い
使用する型