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

AddDelBackupEntryA

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

シグネチャ

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

HRESULT AddDelBackupEntryA(
    LPCSTR lpcszFileList,   // optional
    LPCSTR lpcszBackupDir,   // optional
    LPCSTR lpcszBaseName,   // optional
    DWORD dwFlags
);

パラメーター

名前方向
lpcszFileListLPCSTRinoptional
lpcszBackupDirLPCSTRinoptional
lpcszBaseNameLPCSTRinoptional
dwFlagsDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT AddDelBackupEntryA(
    LPCSTR lpcszFileList,   // optional
    LPCSTR lpcszBackupDir,   // optional
    LPCSTR lpcszBaseName,   // optional
    DWORD dwFlags
);
[DllImport("ADVPACK.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int AddDelBackupEntryA(
    [MarshalAs(UnmanagedType.LPStr)] string lpcszFileList,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string lpcszBackupDir,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string lpcszBaseName,   // LPCSTR optional
    uint dwFlags   // DWORD
);
<DllImport("ADVPACK.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function AddDelBackupEntryA(
    <MarshalAs(UnmanagedType.LPStr)> lpcszFileList As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> lpcszBackupDir As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> lpcszBaseName As String,   ' LPCSTR optional
    dwFlags As UInteger   ' DWORD
) As Integer
End Function
' lpcszFileList : LPCSTR optional
' lpcszBackupDir : LPCSTR optional
' lpcszBaseName : LPCSTR optional
' dwFlags : DWORD
Declare PtrSafe Function AddDelBackupEntryA Lib "advpack" ( _
    ByVal lpcszFileList As String, _
    ByVal lpcszBackupDir As String, _
    ByVal lpcszBaseName As String, _
    ByVal dwFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	advpack = windows.NewLazySystemDLL("ADVPACK.dll")
	procAddDelBackupEntryA = advpack.NewProc("AddDelBackupEntryA")
)

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