ホーム › Devices.DeviceAndDriverInstallation › SetupScanFileQueueA
SetupScanFileQueueA
関数ファイルキュー内のファイルを検査する(ANSI)。
シグネチャ
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupScanFileQueueA(
void* FileQueue,
SETUPSCANFILEQUEUE_FLAGS Flags,
HWND Window, // optional
PSP_FILE_CALLBACK_A CallbackRoutine, // optional
void* CallbackContext, // optional
DWORD* Result
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| FileQueue | void* | in |
| Flags | SETUPSCANFILEQUEUE_FLAGS | in |
| Window | HWND | inoptional |
| CallbackRoutine | PSP_FILE_CALLBACK_A | inoptional |
| CallbackContext | void* | inoptional |
| Result | DWORD* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupScanFileQueueA(
void* FileQueue,
SETUPSCANFILEQUEUE_FLAGS Flags,
HWND Window, // optional
PSP_FILE_CALLBACK_A CallbackRoutine, // optional
void* CallbackContext, // optional
DWORD* Result
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool SetupScanFileQueueA(
IntPtr FileQueue, // void*
uint Flags, // SETUPSCANFILEQUEUE_FLAGS
IntPtr Window, // HWND optional
IntPtr CallbackRoutine, // PSP_FILE_CALLBACK_A optional
IntPtr CallbackContext, // void* optional
out uint Result // DWORD* out
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupScanFileQueueA(
FileQueue As IntPtr, ' void*
Flags As UInteger, ' SETUPSCANFILEQUEUE_FLAGS
Window As IntPtr, ' HWND optional
CallbackRoutine As IntPtr, ' PSP_FILE_CALLBACK_A optional
CallbackContext As IntPtr, ' void* optional
<Out> ByRef Result As UInteger ' DWORD* out
) As Boolean
End Function' FileQueue : void*
' Flags : SETUPSCANFILEQUEUE_FLAGS
' Window : HWND optional
' CallbackRoutine : PSP_FILE_CALLBACK_A optional
' CallbackContext : void* optional
' Result : DWORD* out
Declare PtrSafe Function SetupScanFileQueueA Lib "setupapi" ( _
ByVal FileQueue As LongPtr, _
ByVal Flags As Long, _
ByVal Window As LongPtr, _
ByVal CallbackRoutine As LongPtr, _
ByVal CallbackContext As LongPtr, _
ByRef Result As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetupScanFileQueueA = ctypes.windll.setupapi.SetupScanFileQueueA
SetupScanFileQueueA.restype = wintypes.BOOL
SetupScanFileQueueA.argtypes = [
ctypes.POINTER(None), # FileQueue : void*
wintypes.DWORD, # Flags : SETUPSCANFILEQUEUE_FLAGS
wintypes.HANDLE, # Window : HWND optional
ctypes.c_void_p, # CallbackRoutine : PSP_FILE_CALLBACK_A optional
ctypes.POINTER(None), # CallbackContext : void* optional
ctypes.POINTER(wintypes.DWORD), # Result : DWORD* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupScanFileQueueA = Fiddle::Function.new(
lib['SetupScanFileQueueA'],
[
Fiddle::TYPE_VOIDP, # FileQueue : void*
-Fiddle::TYPE_INT, # Flags : SETUPSCANFILEQUEUE_FLAGS
Fiddle::TYPE_VOIDP, # Window : HWND optional
Fiddle::TYPE_VOIDP, # CallbackRoutine : PSP_FILE_CALLBACK_A optional
Fiddle::TYPE_VOIDP, # CallbackContext : void* optional
Fiddle::TYPE_VOIDP, # Result : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "setupapi")]
extern "system" {
fn SetupScanFileQueueA(
FileQueue: *mut (), // void*
Flags: u32, // SETUPSCANFILEQUEUE_FLAGS
Window: *mut core::ffi::c_void, // HWND optional
CallbackRoutine: *const core::ffi::c_void, // PSP_FILE_CALLBACK_A optional
CallbackContext: *mut (), // void* optional
Result: *mut u32 // DWORD* out
) -> 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 SetupScanFileQueueA(IntPtr FileQueue, uint Flags, IntPtr Window, IntPtr CallbackRoutine, IntPtr CallbackContext, out uint Result);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupScanFileQueueA' -Namespace Win32 -PassThru
# $api::SetupScanFileQueueA(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, Result)#uselib "SETUPAPI.dll"
#func global SetupScanFileQueueA "SetupScanFileQueueA" sptr, sptr, sptr, sptr, sptr, sptr
; SetupScanFileQueueA FileQueue, Flags, Window, CallbackRoutine, CallbackContext, varptr(Result) ; 戻り値は stat
; FileQueue : void* -> "sptr"
; Flags : SETUPSCANFILEQUEUE_FLAGS -> "sptr"
; Window : HWND optional -> "sptr"
; CallbackRoutine : PSP_FILE_CALLBACK_A optional -> "sptr"
; CallbackContext : void* optional -> "sptr"
; Result : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SETUPAPI.dll" #cfunc global SetupScanFileQueueA "SetupScanFileQueueA" sptr, int, sptr, sptr, sptr, var ; res = SetupScanFileQueueA(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, Result) ; FileQueue : void* -> "sptr" ; Flags : SETUPSCANFILEQUEUE_FLAGS -> "int" ; Window : HWND optional -> "sptr" ; CallbackRoutine : PSP_FILE_CALLBACK_A optional -> "sptr" ; CallbackContext : void* optional -> "sptr" ; Result : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SETUPAPI.dll" #cfunc global SetupScanFileQueueA "SetupScanFileQueueA" sptr, int, sptr, sptr, sptr, sptr ; res = SetupScanFileQueueA(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, varptr(Result)) ; FileQueue : void* -> "sptr" ; Flags : SETUPSCANFILEQUEUE_FLAGS -> "int" ; Window : HWND optional -> "sptr" ; CallbackRoutine : PSP_FILE_CALLBACK_A optional -> "sptr" ; CallbackContext : void* optional -> "sptr" ; Result : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL SetupScanFileQueueA(void* FileQueue, SETUPSCANFILEQUEUE_FLAGS Flags, HWND Window, PSP_FILE_CALLBACK_A CallbackRoutine, void* CallbackContext, DWORD* Result) #uselib "SETUPAPI.dll" #cfunc global SetupScanFileQueueA "SetupScanFileQueueA" intptr, int, intptr, intptr, intptr, var ; res = SetupScanFileQueueA(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, Result) ; FileQueue : void* -> "intptr" ; Flags : SETUPSCANFILEQUEUE_FLAGS -> "int" ; Window : HWND optional -> "intptr" ; CallbackRoutine : PSP_FILE_CALLBACK_A optional -> "intptr" ; CallbackContext : void* optional -> "intptr" ; Result : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL SetupScanFileQueueA(void* FileQueue, SETUPSCANFILEQUEUE_FLAGS Flags, HWND Window, PSP_FILE_CALLBACK_A CallbackRoutine, void* CallbackContext, DWORD* Result) #uselib "SETUPAPI.dll" #cfunc global SetupScanFileQueueA "SetupScanFileQueueA" intptr, int, intptr, intptr, intptr, intptr ; res = SetupScanFileQueueA(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, varptr(Result)) ; FileQueue : void* -> "intptr" ; Flags : SETUPSCANFILEQUEUE_FLAGS -> "int" ; Window : HWND optional -> "intptr" ; CallbackRoutine : PSP_FILE_CALLBACK_A optional -> "intptr" ; CallbackContext : void* optional -> "intptr" ; Result : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupScanFileQueueA = setupapi.NewProc("SetupScanFileQueueA")
)
// FileQueue (void*), Flags (SETUPSCANFILEQUEUE_FLAGS), Window (HWND optional), CallbackRoutine (PSP_FILE_CALLBACK_A optional), CallbackContext (void* optional), Result (DWORD* out)
r1, _, err := procSetupScanFileQueueA.Call(
uintptr(FileQueue),
uintptr(Flags),
uintptr(Window),
uintptr(CallbackRoutine),
uintptr(CallbackContext),
uintptr(Result),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupScanFileQueueA(
FileQueue: Pointer; // void*
Flags: DWORD; // SETUPSCANFILEQUEUE_FLAGS
Window: THandle; // HWND optional
CallbackRoutine: Pointer; // PSP_FILE_CALLBACK_A optional
CallbackContext: Pointer; // void* optional
Result: Pointer // DWORD* out
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupScanFileQueueA';result := DllCall("SETUPAPI\SetupScanFileQueueA"
, "Ptr", FileQueue ; void*
, "UInt", Flags ; SETUPSCANFILEQUEUE_FLAGS
, "Ptr", Window ; HWND optional
, "Ptr", CallbackRoutine ; PSP_FILE_CALLBACK_A optional
, "Ptr", CallbackContext ; void* optional
, "Ptr", Result ; DWORD* out
, "Int") ; return: BOOL●SetupScanFileQueueA(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, Result) = DLL("SETUPAPI.dll", "bool SetupScanFileQueueA(void*, dword, void*, void*, void*, void*)")
# 呼び出し: SetupScanFileQueueA(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, Result)
# FileQueue : void* -> "void*"
# Flags : SETUPSCANFILEQUEUE_FLAGS -> "dword"
# Window : HWND optional -> "void*"
# CallbackRoutine : PSP_FILE_CALLBACK_A optional -> "void*"
# CallbackContext : void* optional -> "void*"
# Result : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。