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

SetupPromptReboot

関数
ファイルキューの操作完了後に再起動の要否を確認し促す。
DLLSETUPAPI.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

// SETUPAPI.dll
#include <windows.h>

INT SetupPromptReboot(
    void* FileQueue,   // optional
    HWND Owner,   // optional
    BOOL ScanOnly
);

パラメーター

名前方向説明
FileQueuevoid*inoptional再起動要否を判定するファイルキューのハンドル。NULL可。
OwnerHWNDinoptionalプロンプトダイアログの親ウィンドウハンドル。NULL可。
ScanOnlyBOOLinTRUEなら再起動要否の判定のみ行いプロンプトを表示しない。

戻り値の型: INT

各言語での呼び出し定義

// SETUPAPI.dll
#include <windows.h>

INT SetupPromptReboot(
    void* FileQueue,   // optional
    HWND Owner,   // optional
    BOOL ScanOnly
);
[DllImport("SETUPAPI.dll", SetLastError = true, ExactSpelling = true)]
static extern int SetupPromptReboot(
    IntPtr FileQueue,   // void* optional
    IntPtr Owner,   // HWND optional
    bool ScanOnly   // BOOL
);
<DllImport("SETUPAPI.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupPromptReboot(
    FileQueue As IntPtr,   ' void* optional
    Owner As IntPtr,   ' HWND optional
    ScanOnly As Boolean   ' BOOL
) As Integer
End Function
' FileQueue : void* optional
' Owner : HWND optional
' ScanOnly : BOOL
Declare PtrSafe Function SetupPromptReboot Lib "setupapi" ( _
    ByVal FileQueue As LongPtr, _
    ByVal Owner As LongPtr, _
    ByVal ScanOnly As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetupPromptReboot = ctypes.windll.setupapi.SetupPromptReboot
SetupPromptReboot.restype = ctypes.c_int
SetupPromptReboot.argtypes = [
    ctypes.POINTER(None),  # FileQueue : void* optional
    wintypes.HANDLE,  # Owner : HWND optional
    wintypes.BOOL,  # ScanOnly : BOOL
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SETUPAPI.dll')
SetupPromptReboot = Fiddle::Function.new(
  lib['SetupPromptReboot'],
  [
    Fiddle::TYPE_VOIDP,  # FileQueue : void* optional
    Fiddle::TYPE_VOIDP,  # Owner : HWND optional
    Fiddle::TYPE_INT,  # ScanOnly : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "setupapi")]
extern "system" {
    fn SetupPromptReboot(
        FileQueue: *mut (),  // void* optional
        Owner: *mut core::ffi::c_void,  // HWND optional
        ScanOnly: i32  // BOOL
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SETUPAPI.dll", SetLastError = true)]
public static extern int SetupPromptReboot(IntPtr FileQueue, IntPtr Owner, bool ScanOnly);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupPromptReboot' -Namespace Win32 -PassThru
# $api::SetupPromptReboot(FileQueue, Owner, ScanOnly)
#uselib "SETUPAPI.dll"
#func global SetupPromptReboot "SetupPromptReboot" sptr, sptr, sptr
; SetupPromptReboot FileQueue, Owner, ScanOnly   ; 戻り値は stat
; FileQueue : void* optional -> "sptr"
; Owner : HWND optional -> "sptr"
; ScanOnly : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SETUPAPI.dll"
#cfunc global SetupPromptReboot "SetupPromptReboot" sptr, sptr, int
; res = SetupPromptReboot(FileQueue, Owner, ScanOnly)
; FileQueue : void* optional -> "sptr"
; Owner : HWND optional -> "sptr"
; ScanOnly : BOOL -> "int"
; INT SetupPromptReboot(void* FileQueue, HWND Owner, BOOL ScanOnly)
#uselib "SETUPAPI.dll"
#cfunc global SetupPromptReboot "SetupPromptReboot" intptr, intptr, int
; res = SetupPromptReboot(FileQueue, Owner, ScanOnly)
; FileQueue : void* optional -> "intptr"
; Owner : HWND optional -> "intptr"
; ScanOnly : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupPromptReboot = setupapi.NewProc("SetupPromptReboot")
)

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