ホーム › Devices.DeviceAndDriverInstallation › SetupScanFileQueueW
SetupScanFileQueueW
関数ファイルキュー内のファイルを検査する(Unicode)。
シグネチャ
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupScanFileQueueW(
void* FileQueue,
SETUPSCANFILEQUEUE_FLAGS Flags,
HWND Window, // optional
PSP_FILE_CALLBACK_W CallbackRoutine, // optional
void* CallbackContext, // optional
DWORD* Result
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| FileQueue | void* | in |
| Flags | SETUPSCANFILEQUEUE_FLAGS | in |
| Window | HWND | inoptional |
| CallbackRoutine | PSP_FILE_CALLBACK_W | inoptional |
| CallbackContext | void* | inoptional |
| Result | DWORD* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupScanFileQueueW(
void* FileQueue,
SETUPSCANFILEQUEUE_FLAGS Flags,
HWND Window, // optional
PSP_FILE_CALLBACK_W CallbackRoutine, // optional
void* CallbackContext, // optional
DWORD* Result
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SetupScanFileQueueW(
IntPtr FileQueue, // void*
uint Flags, // SETUPSCANFILEQUEUE_FLAGS
IntPtr Window, // HWND optional
IntPtr CallbackRoutine, // PSP_FILE_CALLBACK_W optional
IntPtr CallbackContext, // void* optional
out uint Result // DWORD* out
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupScanFileQueueW(
FileQueue As IntPtr, ' void*
Flags As UInteger, ' SETUPSCANFILEQUEUE_FLAGS
Window As IntPtr, ' HWND optional
CallbackRoutine As IntPtr, ' PSP_FILE_CALLBACK_W 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_W optional
' CallbackContext : void* optional
' Result : DWORD* out
Declare PtrSafe Function SetupScanFileQueueW 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
' 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
SetupScanFileQueueW = ctypes.windll.setupapi.SetupScanFileQueueW
SetupScanFileQueueW.restype = wintypes.BOOL
SetupScanFileQueueW.argtypes = [
ctypes.POINTER(None), # FileQueue : void*
wintypes.DWORD, # Flags : SETUPSCANFILEQUEUE_FLAGS
wintypes.HANDLE, # Window : HWND optional
ctypes.c_void_p, # CallbackRoutine : PSP_FILE_CALLBACK_W 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')
SetupScanFileQueueW = Fiddle::Function.new(
lib['SetupScanFileQueueW'],
[
Fiddle::TYPE_VOIDP, # FileQueue : void*
-Fiddle::TYPE_INT, # Flags : SETUPSCANFILEQUEUE_FLAGS
Fiddle::TYPE_VOIDP, # Window : HWND optional
Fiddle::TYPE_VOIDP, # CallbackRoutine : PSP_FILE_CALLBACK_W optional
Fiddle::TYPE_VOIDP, # CallbackContext : void* optional
Fiddle::TYPE_VOIDP, # Result : DWORD* out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "setupapi")]
extern "system" {
fn SetupScanFileQueueW(
FileQueue: *mut (), // void*
Flags: u32, // SETUPSCANFILEQUEUE_FLAGS
Window: *mut core::ffi::c_void, // HWND optional
CallbackRoutine: *const core::ffi::c_void, // PSP_FILE_CALLBACK_W 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.Unicode, SetLastError = true)]
public static extern bool SetupScanFileQueueW(IntPtr FileQueue, uint Flags, IntPtr Window, IntPtr CallbackRoutine, IntPtr CallbackContext, out uint Result);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupScanFileQueueW' -Namespace Win32 -PassThru
# $api::SetupScanFileQueueW(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, Result)#uselib "SETUPAPI.dll"
#func global SetupScanFileQueueW "SetupScanFileQueueW" wptr, wptr, wptr, wptr, wptr, wptr
; SetupScanFileQueueW FileQueue, Flags, Window, CallbackRoutine, CallbackContext, varptr(Result) ; 戻り値は stat
; FileQueue : void* -> "wptr"
; Flags : SETUPSCANFILEQUEUE_FLAGS -> "wptr"
; Window : HWND optional -> "wptr"
; CallbackRoutine : PSP_FILE_CALLBACK_W optional -> "wptr"
; CallbackContext : void* optional -> "wptr"
; Result : DWORD* out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SETUPAPI.dll" #cfunc global SetupScanFileQueueW "SetupScanFileQueueW" sptr, int, sptr, sptr, sptr, var ; res = SetupScanFileQueueW(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, Result) ; FileQueue : void* -> "sptr" ; Flags : SETUPSCANFILEQUEUE_FLAGS -> "int" ; Window : HWND optional -> "sptr" ; CallbackRoutine : PSP_FILE_CALLBACK_W optional -> "sptr" ; CallbackContext : void* optional -> "sptr" ; Result : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SETUPAPI.dll" #cfunc global SetupScanFileQueueW "SetupScanFileQueueW" sptr, int, sptr, sptr, sptr, sptr ; res = SetupScanFileQueueW(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, varptr(Result)) ; FileQueue : void* -> "sptr" ; Flags : SETUPSCANFILEQUEUE_FLAGS -> "int" ; Window : HWND optional -> "sptr" ; CallbackRoutine : PSP_FILE_CALLBACK_W optional -> "sptr" ; CallbackContext : void* optional -> "sptr" ; Result : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL SetupScanFileQueueW(void* FileQueue, SETUPSCANFILEQUEUE_FLAGS Flags, HWND Window, PSP_FILE_CALLBACK_W CallbackRoutine, void* CallbackContext, DWORD* Result) #uselib "SETUPAPI.dll" #cfunc global SetupScanFileQueueW "SetupScanFileQueueW" intptr, int, intptr, intptr, intptr, var ; res = SetupScanFileQueueW(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, Result) ; FileQueue : void* -> "intptr" ; Flags : SETUPSCANFILEQUEUE_FLAGS -> "int" ; Window : HWND optional -> "intptr" ; CallbackRoutine : PSP_FILE_CALLBACK_W optional -> "intptr" ; CallbackContext : void* optional -> "intptr" ; Result : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL SetupScanFileQueueW(void* FileQueue, SETUPSCANFILEQUEUE_FLAGS Flags, HWND Window, PSP_FILE_CALLBACK_W CallbackRoutine, void* CallbackContext, DWORD* Result) #uselib "SETUPAPI.dll" #cfunc global SetupScanFileQueueW "SetupScanFileQueueW" intptr, int, intptr, intptr, intptr, intptr ; res = SetupScanFileQueueW(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, varptr(Result)) ; FileQueue : void* -> "intptr" ; Flags : SETUPSCANFILEQUEUE_FLAGS -> "int" ; Window : HWND optional -> "intptr" ; CallbackRoutine : PSP_FILE_CALLBACK_W 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")
procSetupScanFileQueueW = setupapi.NewProc("SetupScanFileQueueW")
)
// FileQueue (void*), Flags (SETUPSCANFILEQUEUE_FLAGS), Window (HWND optional), CallbackRoutine (PSP_FILE_CALLBACK_W optional), CallbackContext (void* optional), Result (DWORD* out)
r1, _, err := procSetupScanFileQueueW.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 SetupScanFileQueueW(
FileQueue: Pointer; // void*
Flags: DWORD; // SETUPSCANFILEQUEUE_FLAGS
Window: THandle; // HWND optional
CallbackRoutine: Pointer; // PSP_FILE_CALLBACK_W optional
CallbackContext: Pointer; // void* optional
Result: Pointer // DWORD* out
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupScanFileQueueW';result := DllCall("SETUPAPI\SetupScanFileQueueW"
, "Ptr", FileQueue ; void*
, "UInt", Flags ; SETUPSCANFILEQUEUE_FLAGS
, "Ptr", Window ; HWND optional
, "Ptr", CallbackRoutine ; PSP_FILE_CALLBACK_W optional
, "Ptr", CallbackContext ; void* optional
, "Ptr", Result ; DWORD* out
, "Int") ; return: BOOL●SetupScanFileQueueW(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, Result) = DLL("SETUPAPI.dll", "bool SetupScanFileQueueW(void*, dword, void*, void*, void*, void*)")
# 呼び出し: SetupScanFileQueueW(FileQueue, Flags, Window, CallbackRoutine, CallbackContext, Result)
# FileQueue : void* -> "void*"
# Flags : SETUPSCANFILEQUEUE_FLAGS -> "dword"
# Window : HWND optional -> "void*"
# CallbackRoutine : PSP_FILE_CALLBACK_W optional -> "void*"
# CallbackContext : void* optional -> "void*"
# Result : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。