Win32 API 日本語リファレンス
ホームNetworking.Clustering › ClusterPrepareSharedVolumeForBackup

ClusterPrepareSharedVolumeForBackup

関数
クラスタ共有ボリュームをバックアップ用に準備する。
DLLRESUTILS.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD ClusterPrepareSharedVolumeForBackup(
    LPCWSTR lpszFileName,
    LPWSTR lpszVolumePathName,
    DWORD* lpcchVolumePathName,
    LPWSTR lpszVolumeName,
    DWORD* lpcchVolumeName
);

パラメーター

名前方向
lpszFileNameLPCWSTRin
lpszVolumePathNameLPWSTRout
lpcchVolumePathNameDWORD*inout
lpszVolumeNameLPWSTRout
lpcchVolumeNameDWORD*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD ClusterPrepareSharedVolumeForBackup(
    LPCWSTR lpszFileName,
    LPWSTR lpszVolumePathName,
    DWORD* lpcchVolumePathName,
    LPWSTR lpszVolumeName,
    DWORD* lpcchVolumeName
);
[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ClusterPrepareSharedVolumeForBackup(
    [MarshalAs(UnmanagedType.LPWStr)] string lpszFileName,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszVolumePathName,   // LPWSTR out
    ref uint lpcchVolumePathName,   // DWORD* in/out
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszVolumeName,   // LPWSTR out
    ref uint lpcchVolumeName   // DWORD* in/out
);
<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ClusterPrepareSharedVolumeForBackup(
    <MarshalAs(UnmanagedType.LPWStr)> lpszFileName As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> lpszVolumePathName As System.Text.StringBuilder,   ' LPWSTR out
    ByRef lpcchVolumePathName As UInteger,   ' DWORD* in/out
    <MarshalAs(UnmanagedType.LPWStr)> lpszVolumeName As System.Text.StringBuilder,   ' LPWSTR out
    ByRef lpcchVolumeName As UInteger   ' DWORD* in/out
) As UInteger
End Function
' lpszFileName : LPCWSTR
' lpszVolumePathName : LPWSTR out
' lpcchVolumePathName : DWORD* in/out
' lpszVolumeName : LPWSTR out
' lpcchVolumeName : DWORD* in/out
Declare PtrSafe Function ClusterPrepareSharedVolumeForBackup Lib "resutils" ( _
    ByVal lpszFileName As LongPtr, _
    ByVal lpszVolumePathName As LongPtr, _
    ByRef lpcchVolumePathName As Long, _
    ByVal lpszVolumeName As LongPtr, _
    ByRef lpcchVolumeName As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ClusterPrepareSharedVolumeForBackup = ctypes.windll.resutils.ClusterPrepareSharedVolumeForBackup
ClusterPrepareSharedVolumeForBackup.restype = wintypes.DWORD
ClusterPrepareSharedVolumeForBackup.argtypes = [
    wintypes.LPCWSTR,  # lpszFileName : LPCWSTR
    wintypes.LPWSTR,  # lpszVolumePathName : LPWSTR out
    ctypes.POINTER(wintypes.DWORD),  # lpcchVolumePathName : DWORD* in/out
    wintypes.LPWSTR,  # lpszVolumeName : LPWSTR out
    ctypes.POINTER(wintypes.DWORD),  # lpcchVolumeName : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RESUTILS.dll')
ClusterPrepareSharedVolumeForBackup = Fiddle::Function.new(
  lib['ClusterPrepareSharedVolumeForBackup'],
  [
    Fiddle::TYPE_VOIDP,  # lpszFileName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # lpszVolumePathName : LPWSTR out
    Fiddle::TYPE_VOIDP,  # lpcchVolumePathName : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # lpszVolumeName : LPWSTR out
    Fiddle::TYPE_VOIDP,  # lpcchVolumeName : DWORD* in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "resutils")]
extern "system" {
    fn ClusterPrepareSharedVolumeForBackup(
        lpszFileName: *const u16,  // LPCWSTR
        lpszVolumePathName: *mut u16,  // LPWSTR out
        lpcchVolumePathName: *mut u32,  // DWORD* in/out
        lpszVolumeName: *mut u16,  // LPWSTR out
        lpcchVolumeName: *mut u32  // DWORD* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RESUTILS.dll")]
public static extern uint ClusterPrepareSharedVolumeForBackup([MarshalAs(UnmanagedType.LPWStr)] string lpszFileName, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszVolumePathName, ref uint lpcchVolumePathName, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszVolumeName, ref uint lpcchVolumeName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ClusterPrepareSharedVolumeForBackup' -Namespace Win32 -PassThru
# $api::ClusterPrepareSharedVolumeForBackup(lpszFileName, lpszVolumePathName, lpcchVolumePathName, lpszVolumeName, lpcchVolumeName)
#uselib "RESUTILS.dll"
#func global ClusterPrepareSharedVolumeForBackup "ClusterPrepareSharedVolumeForBackup" sptr, sptr, sptr, sptr, sptr
; ClusterPrepareSharedVolumeForBackup lpszFileName, varptr(lpszVolumePathName), varptr(lpcchVolumePathName), varptr(lpszVolumeName), varptr(lpcchVolumeName)   ; 戻り値は stat
; lpszFileName : LPCWSTR -> "sptr"
; lpszVolumePathName : LPWSTR out -> "sptr"
; lpcchVolumePathName : DWORD* in/out -> "sptr"
; lpszVolumeName : LPWSTR out -> "sptr"
; lpcchVolumeName : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RESUTILS.dll"
#cfunc global ClusterPrepareSharedVolumeForBackup "ClusterPrepareSharedVolumeForBackup" wstr, var, var, var, var
; res = ClusterPrepareSharedVolumeForBackup(lpszFileName, lpszVolumePathName, lpcchVolumePathName, lpszVolumeName, lpcchVolumeName)
; lpszFileName : LPCWSTR -> "wstr"
; lpszVolumePathName : LPWSTR out -> "var"
; lpcchVolumePathName : DWORD* in/out -> "var"
; lpszVolumeName : LPWSTR out -> "var"
; lpcchVolumeName : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD ClusterPrepareSharedVolumeForBackup(LPCWSTR lpszFileName, LPWSTR lpszVolumePathName, DWORD* lpcchVolumePathName, LPWSTR lpszVolumeName, DWORD* lpcchVolumeName)
#uselib "RESUTILS.dll"
#cfunc global ClusterPrepareSharedVolumeForBackup "ClusterPrepareSharedVolumeForBackup" wstr, var, var, var, var
; res = ClusterPrepareSharedVolumeForBackup(lpszFileName, lpszVolumePathName, lpcchVolumePathName, lpszVolumeName, lpcchVolumeName)
; lpszFileName : LPCWSTR -> "wstr"
; lpszVolumePathName : LPWSTR out -> "var"
; lpcchVolumePathName : DWORD* in/out -> "var"
; lpszVolumeName : LPWSTR out -> "var"
; lpcchVolumeName : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	resutils = windows.NewLazySystemDLL("RESUTILS.dll")
	procClusterPrepareSharedVolumeForBackup = resutils.NewProc("ClusterPrepareSharedVolumeForBackup")
)

// lpszFileName (LPCWSTR), lpszVolumePathName (LPWSTR out), lpcchVolumePathName (DWORD* in/out), lpszVolumeName (LPWSTR out), lpcchVolumeName (DWORD* in/out)
r1, _, err := procClusterPrepareSharedVolumeForBackup.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszFileName))),
	uintptr(lpszVolumePathName),
	uintptr(lpcchVolumePathName),
	uintptr(lpszVolumeName),
	uintptr(lpcchVolumeName),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ClusterPrepareSharedVolumeForBackup(
  lpszFileName: PWideChar;   // LPCWSTR
  lpszVolumePathName: PWideChar;   // LPWSTR out
  lpcchVolumePathName: Pointer;   // DWORD* in/out
  lpszVolumeName: PWideChar;   // LPWSTR out
  lpcchVolumeName: Pointer   // DWORD* in/out
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ClusterPrepareSharedVolumeForBackup';
result := DllCall("RESUTILS\ClusterPrepareSharedVolumeForBackup"
    , "WStr", lpszFileName   ; LPCWSTR
    , "Ptr", lpszVolumePathName   ; LPWSTR out
    , "Ptr", lpcchVolumePathName   ; DWORD* in/out
    , "Ptr", lpszVolumeName   ; LPWSTR out
    , "Ptr", lpcchVolumeName   ; DWORD* in/out
    , "UInt")   ; return: DWORD
●ClusterPrepareSharedVolumeForBackup(lpszFileName, lpszVolumePathName, lpcchVolumePathName, lpszVolumeName, lpcchVolumeName) = DLL("RESUTILS.dll", "dword ClusterPrepareSharedVolumeForBackup(char*, char*, void*, char*, void*)")
# 呼び出し: ClusterPrepareSharedVolumeForBackup(lpszFileName, lpszVolumePathName, lpcchVolumePathName, lpszVolumeName, lpcchVolumeName)
# lpszFileName : LPCWSTR -> "char*"
# lpszVolumePathName : LPWSTR out -> "char*"
# lpcchVolumePathName : DWORD* in/out -> "void*"
# lpszVolumeName : LPWSTR out -> "char*"
# lpcchVolumeName : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。