Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › AddDelBackupEntryW

AddDelBackupEntryW

関数
バックアップ一覧へのエントリ追加・削除を行う(Unicode版)。
DLLADVPACK.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// ADVPACK.dll  (Unicode / -W)
#include <windows.h>

HRESULT AddDelBackupEntryW(
    LPCWSTR lpcszFileList,   // optional
    LPCWSTR lpcszBackupDir,   // optional
    LPCWSTR lpcszBaseName,   // optional
    DWORD dwFlags
);

パラメーター

名前方向
lpcszFileListLPCWSTRinoptional
lpcszBackupDirLPCWSTRinoptional
lpcszBaseNameLPCWSTRinoptional
dwFlagsDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

// ADVPACK.dll  (Unicode / -W)
#include <windows.h>

HRESULT AddDelBackupEntryW(
    LPCWSTR lpcszFileList,   // optional
    LPCWSTR lpcszBackupDir,   // optional
    LPCWSTR lpcszBaseName,   // optional
    DWORD dwFlags
);
[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int AddDelBackupEntryW(
    [MarshalAs(UnmanagedType.LPWStr)] string lpcszFileList,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string lpcszBackupDir,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string lpcszBaseName,   // LPCWSTR optional
    uint dwFlags   // DWORD
);
<DllImport("ADVPACK.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function AddDelBackupEntryW(
    <MarshalAs(UnmanagedType.LPWStr)> lpcszFileList As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> lpcszBackupDir As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> lpcszBaseName As String,   ' LPCWSTR optional
    dwFlags As UInteger   ' DWORD
) As Integer
End Function
' lpcszFileList : LPCWSTR optional
' lpcszBackupDir : LPCWSTR optional
' lpcszBaseName : LPCWSTR optional
' dwFlags : DWORD
Declare PtrSafe Function AddDelBackupEntryW Lib "advpack" ( _
    ByVal lpcszFileList As LongPtr, _
    ByVal lpcszBackupDir As LongPtr, _
    ByVal lpcszBaseName As LongPtr, _
    ByVal dwFlags 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

AddDelBackupEntryW = ctypes.windll.advpack.AddDelBackupEntryW
AddDelBackupEntryW.restype = ctypes.c_int
AddDelBackupEntryW.argtypes = [
    wintypes.LPCWSTR,  # lpcszFileList : LPCWSTR optional
    wintypes.LPCWSTR,  # lpcszBackupDir : LPCWSTR optional
    wintypes.LPCWSTR,  # lpcszBaseName : LPCWSTR optional
    wintypes.DWORD,  # dwFlags : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ADVPACK.dll')
AddDelBackupEntryW = Fiddle::Function.new(
  lib['AddDelBackupEntryW'],
  [
    Fiddle::TYPE_VOIDP,  # lpcszFileList : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # lpcszBackupDir : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # lpcszBaseName : LPCWSTR optional
    -Fiddle::TYPE_INT,  # dwFlags : DWORD
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "advpack")]
extern "system" {
    fn AddDelBackupEntryW(
        lpcszFileList: *const u16,  // LPCWSTR optional
        lpcszBackupDir: *const u16,  // LPCWSTR optional
        lpcszBaseName: *const u16,  // LPCWSTR optional
        dwFlags: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode)]
public static extern int AddDelBackupEntryW([MarshalAs(UnmanagedType.LPWStr)] string lpcszFileList, [MarshalAs(UnmanagedType.LPWStr)] string lpcszBackupDir, [MarshalAs(UnmanagedType.LPWStr)] string lpcszBaseName, uint dwFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVPACK_AddDelBackupEntryW' -Namespace Win32 -PassThru
# $api::AddDelBackupEntryW(lpcszFileList, lpcszBackupDir, lpcszBaseName, dwFlags)
#uselib "ADVPACK.dll"
#func global AddDelBackupEntryW "AddDelBackupEntryW" wptr, wptr, wptr, wptr
; AddDelBackupEntryW lpcszFileList, lpcszBackupDir, lpcszBaseName, dwFlags   ; 戻り値は stat
; lpcszFileList : LPCWSTR optional -> "wptr"
; lpcszBackupDir : LPCWSTR optional -> "wptr"
; lpcszBaseName : LPCWSTR optional -> "wptr"
; dwFlags : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ADVPACK.dll"
#cfunc global AddDelBackupEntryW "AddDelBackupEntryW" wstr, wstr, wstr, int
; res = AddDelBackupEntryW(lpcszFileList, lpcszBackupDir, lpcszBaseName, dwFlags)
; lpcszFileList : LPCWSTR optional -> "wstr"
; lpcszBackupDir : LPCWSTR optional -> "wstr"
; lpcszBaseName : LPCWSTR optional -> "wstr"
; dwFlags : DWORD -> "int"
; HRESULT AddDelBackupEntryW(LPCWSTR lpcszFileList, LPCWSTR lpcszBackupDir, LPCWSTR lpcszBaseName, DWORD dwFlags)
#uselib "ADVPACK.dll"
#cfunc global AddDelBackupEntryW "AddDelBackupEntryW" wstr, wstr, wstr, int
; res = AddDelBackupEntryW(lpcszFileList, lpcszBackupDir, lpcszBaseName, dwFlags)
; lpcszFileList : LPCWSTR optional -> "wstr"
; lpcszBackupDir : LPCWSTR optional -> "wstr"
; lpcszBaseName : LPCWSTR optional -> "wstr"
; dwFlags : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	advpack = windows.NewLazySystemDLL("ADVPACK.dll")
	procAddDelBackupEntryW = advpack.NewProc("AddDelBackupEntryW")
)

// lpcszFileList (LPCWSTR optional), lpcszBackupDir (LPCWSTR optional), lpcszBaseName (LPCWSTR optional), dwFlags (DWORD)
r1, _, err := procAddDelBackupEntryW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpcszFileList))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpcszBackupDir))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpcszBaseName))),
	uintptr(dwFlags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function AddDelBackupEntryW(
  lpcszFileList: PWideChar;   // LPCWSTR optional
  lpcszBackupDir: PWideChar;   // LPCWSTR optional
  lpcszBaseName: PWideChar;   // LPCWSTR optional
  dwFlags: DWORD   // DWORD
): Integer; stdcall;
  external 'ADVPACK.dll' name 'AddDelBackupEntryW';
result := DllCall("ADVPACK\AddDelBackupEntryW"
    , "WStr", lpcszFileList   ; LPCWSTR optional
    , "WStr", lpcszBackupDir   ; LPCWSTR optional
    , "WStr", lpcszBaseName   ; LPCWSTR optional
    , "UInt", dwFlags   ; DWORD
    , "Int")   ; return: HRESULT
●AddDelBackupEntryW(lpcszFileList, lpcszBackupDir, lpcszBaseName, dwFlags) = DLL("ADVPACK.dll", "int AddDelBackupEntryW(char*, char*, char*, dword)")
# 呼び出し: AddDelBackupEntryW(lpcszFileList, lpcszBackupDir, lpcszBaseName, dwFlags)
# lpcszFileList : LPCWSTR optional -> "char*"
# lpcszBackupDir : LPCWSTR optional -> "char*"
# lpcszBaseName : LPCWSTR optional -> "char*"
# dwFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。