ホーム › Devices.DeviceAndDriverInstallation › SetupPrepareQueueForRestoreW
SetupPrepareQueueForRestoreW
関数バックアップからの復元用にファイルキューを準備する。
シグネチャ
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupPrepareQueueForRestoreW(
void* QueueHandle,
LPCWSTR BackupPath,
DWORD RestoreFlags
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| QueueHandle | void* | in | 復元用に準備するファイルキューのハンドル。 |
| BackupPath | LPCWSTR | in | 復元元となるバックアップディレクトリのパス(Unicode)。 |
| RestoreFlags | DWORD | in | 復元動作を制御するフラグ。通常は0。 |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupPrepareQueueForRestoreW(
void* QueueHandle,
LPCWSTR BackupPath,
DWORD RestoreFlags
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool SetupPrepareQueueForRestoreW(
IntPtr QueueHandle, // void*
[MarshalAs(UnmanagedType.LPWStr)] string BackupPath, // LPCWSTR
uint RestoreFlags // DWORD
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function SetupPrepareQueueForRestoreW(
QueueHandle As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPWStr)> BackupPath As String, ' LPCWSTR
RestoreFlags As UInteger ' DWORD
) As Boolean
End Function' QueueHandle : void*
' BackupPath : LPCWSTR
' RestoreFlags : DWORD
Declare PtrSafe Function SetupPrepareQueueForRestoreW Lib "setupapi" ( _
ByVal QueueHandle As LongPtr, _
ByVal BackupPath As LongPtr, _
ByVal RestoreFlags 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
SetupPrepareQueueForRestoreW = ctypes.windll.setupapi.SetupPrepareQueueForRestoreW
SetupPrepareQueueForRestoreW.restype = wintypes.BOOL
SetupPrepareQueueForRestoreW.argtypes = [
ctypes.POINTER(None), # QueueHandle : void*
wintypes.LPCWSTR, # BackupPath : LPCWSTR
wintypes.DWORD, # RestoreFlags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupPrepareQueueForRestoreW = Fiddle::Function.new(
lib['SetupPrepareQueueForRestoreW'],
[
Fiddle::TYPE_VOIDP, # QueueHandle : void*
Fiddle::TYPE_VOIDP, # BackupPath : LPCWSTR
-Fiddle::TYPE_INT, # RestoreFlags : DWORD
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "setupapi")]
extern "system" {
fn SetupPrepareQueueForRestoreW(
QueueHandle: *mut (), // void*
BackupPath: *const u16, // LPCWSTR
RestoreFlags: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode)]
public static extern bool SetupPrepareQueueForRestoreW(IntPtr QueueHandle, [MarshalAs(UnmanagedType.LPWStr)] string BackupPath, uint RestoreFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupPrepareQueueForRestoreW' -Namespace Win32 -PassThru
# $api::SetupPrepareQueueForRestoreW(QueueHandle, BackupPath, RestoreFlags)#uselib "SETUPAPI.dll"
#func global SetupPrepareQueueForRestoreW "SetupPrepareQueueForRestoreW" wptr, wptr, wptr
; SetupPrepareQueueForRestoreW QueueHandle, BackupPath, RestoreFlags ; 戻り値は stat
; QueueHandle : void* -> "wptr"
; BackupPath : LPCWSTR -> "wptr"
; RestoreFlags : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SETUPAPI.dll"
#cfunc global SetupPrepareQueueForRestoreW "SetupPrepareQueueForRestoreW" sptr, wstr, int
; res = SetupPrepareQueueForRestoreW(QueueHandle, BackupPath, RestoreFlags)
; QueueHandle : void* -> "sptr"
; BackupPath : LPCWSTR -> "wstr"
; RestoreFlags : DWORD -> "int"; BOOL SetupPrepareQueueForRestoreW(void* QueueHandle, LPCWSTR BackupPath, DWORD RestoreFlags)
#uselib "SETUPAPI.dll"
#cfunc global SetupPrepareQueueForRestoreW "SetupPrepareQueueForRestoreW" intptr, wstr, int
; res = SetupPrepareQueueForRestoreW(QueueHandle, BackupPath, RestoreFlags)
; QueueHandle : void* -> "intptr"
; BackupPath : LPCWSTR -> "wstr"
; RestoreFlags : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupPrepareQueueForRestoreW = setupapi.NewProc("SetupPrepareQueueForRestoreW")
)
// QueueHandle (void*), BackupPath (LPCWSTR), RestoreFlags (DWORD)
r1, _, err := procSetupPrepareQueueForRestoreW.Call(
uintptr(QueueHandle),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(BackupPath))),
uintptr(RestoreFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupPrepareQueueForRestoreW(
QueueHandle: Pointer; // void*
BackupPath: PWideChar; // LPCWSTR
RestoreFlags: DWORD // DWORD
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupPrepareQueueForRestoreW';result := DllCall("SETUPAPI\SetupPrepareQueueForRestoreW"
, "Ptr", QueueHandle ; void*
, "WStr", BackupPath ; LPCWSTR
, "UInt", RestoreFlags ; DWORD
, "Int") ; return: BOOL●SetupPrepareQueueForRestoreW(QueueHandle, BackupPath, RestoreFlags) = DLL("SETUPAPI.dll", "bool SetupPrepareQueueForRestoreW(void*, char*, dword)")
# 呼び出し: SetupPrepareQueueForRestoreW(QueueHandle, BackupPath, RestoreFlags)
# QueueHandle : void* -> "void*"
# BackupPath : LPCWSTR -> "char*"
# RestoreFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。