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

SetupPrepareQueueForRestoreA

関数
バックアップからの復元用にファイルキューを準備する。
DLLSETUPAPI.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

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

BOOL SetupPrepareQueueForRestoreA(
    void* QueueHandle,
    LPCSTR BackupPath,
    DWORD RestoreFlags
);

パラメーター

名前方向
QueueHandlevoid*in
BackupPathLPCSTRin
RestoreFlagsDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SetupPrepareQueueForRestoreA(
    void* QueueHandle,
    LPCSTR BackupPath,
    DWORD RestoreFlags
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool SetupPrepareQueueForRestoreA(
    IntPtr QueueHandle,   // void*
    [MarshalAs(UnmanagedType.LPStr)] string BackupPath,   // LPCSTR
    uint RestoreFlags   // DWORD
);
<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function SetupPrepareQueueForRestoreA(
    QueueHandle As IntPtr,   ' void*
    <MarshalAs(UnmanagedType.LPStr)> BackupPath As String,   ' LPCSTR
    RestoreFlags As UInteger   ' DWORD
) As Boolean
End Function
' QueueHandle : void*
' BackupPath : LPCSTR
' RestoreFlags : DWORD
Declare PtrSafe Function SetupPrepareQueueForRestoreA Lib "setupapi" ( _
    ByVal QueueHandle As LongPtr, _
    ByVal BackupPath As String, _
    ByVal RestoreFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetupPrepareQueueForRestoreA = ctypes.windll.setupapi.SetupPrepareQueueForRestoreA
SetupPrepareQueueForRestoreA.restype = wintypes.BOOL
SetupPrepareQueueForRestoreA.argtypes = [
    ctypes.POINTER(None),  # QueueHandle : void*
    wintypes.LPCSTR,  # BackupPath : LPCSTR
    wintypes.DWORD,  # RestoreFlags : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SETUPAPI.dll')
SetupPrepareQueueForRestoreA = Fiddle::Function.new(
  lib['SetupPrepareQueueForRestoreA'],
  [
    Fiddle::TYPE_VOIDP,  # QueueHandle : void*
    Fiddle::TYPE_VOIDP,  # BackupPath : LPCSTR
    -Fiddle::TYPE_INT,  # RestoreFlags : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "setupapi")]
extern "system" {
    fn SetupPrepareQueueForRestoreA(
        QueueHandle: *mut (),  // void*
        BackupPath: *const u8,  // LPCSTR
        RestoreFlags: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi)]
public static extern bool SetupPrepareQueueForRestoreA(IntPtr QueueHandle, [MarshalAs(UnmanagedType.LPStr)] string BackupPath, uint RestoreFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupPrepareQueueForRestoreA' -Namespace Win32 -PassThru
# $api::SetupPrepareQueueForRestoreA(QueueHandle, BackupPath, RestoreFlags)
#uselib "SETUPAPI.dll"
#func global SetupPrepareQueueForRestoreA "SetupPrepareQueueForRestoreA" sptr, sptr, sptr
; SetupPrepareQueueForRestoreA QueueHandle, BackupPath, RestoreFlags   ; 戻り値は stat
; QueueHandle : void* -> "sptr"
; BackupPath : LPCSTR -> "sptr"
; RestoreFlags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SETUPAPI.dll"
#cfunc global SetupPrepareQueueForRestoreA "SetupPrepareQueueForRestoreA" sptr, str, int
; res = SetupPrepareQueueForRestoreA(QueueHandle, BackupPath, RestoreFlags)
; QueueHandle : void* -> "sptr"
; BackupPath : LPCSTR -> "str"
; RestoreFlags : DWORD -> "int"
; BOOL SetupPrepareQueueForRestoreA(void* QueueHandle, LPCSTR BackupPath, DWORD RestoreFlags)
#uselib "SETUPAPI.dll"
#cfunc global SetupPrepareQueueForRestoreA "SetupPrepareQueueForRestoreA" intptr, str, int
; res = SetupPrepareQueueForRestoreA(QueueHandle, BackupPath, RestoreFlags)
; QueueHandle : void* -> "intptr"
; BackupPath : LPCSTR -> "str"
; RestoreFlags : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupPrepareQueueForRestoreA = setupapi.NewProc("SetupPrepareQueueForRestoreA")
)

// QueueHandle (void*), BackupPath (LPCSTR), RestoreFlags (DWORD)
r1, _, err := procSetupPrepareQueueForRestoreA.Call(
	uintptr(QueueHandle),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(BackupPath))),
	uintptr(RestoreFlags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetupPrepareQueueForRestoreA(
  QueueHandle: Pointer;   // void*
  BackupPath: PAnsiChar;   // LPCSTR
  RestoreFlags: DWORD   // DWORD
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupPrepareQueueForRestoreA';
result := DllCall("SETUPAPI\SetupPrepareQueueForRestoreA"
    , "Ptr", QueueHandle   ; void*
    , "AStr", BackupPath   ; LPCSTR
    , "UInt", RestoreFlags   ; DWORD
    , "Int")   ; return: BOOL
●SetupPrepareQueueForRestoreA(QueueHandle, BackupPath, RestoreFlags) = DLL("SETUPAPI.dll", "bool SetupPrepareQueueForRestoreA(void*, char*, dword)")
# 呼び出し: SetupPrepareQueueForRestoreA(QueueHandle, BackupPath, RestoreFlags)
# QueueHandle : void* -> "void*"
# BackupPath : LPCSTR -> "char*"
# RestoreFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。