Win32 API 日本語リファレンス
ホームStorage.FileSystem › SetEnlistmentRecoveryInformation

SetEnlistmentRecoveryInformation

関数
KTMエンリストメントに回復情報を設定する。
DLLktmw32.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

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

BOOL SetEnlistmentRecoveryInformation(
    HANDLE EnlistmentHandle,
    DWORD BufferSize,
    void* Buffer
);

パラメーター

名前方向
EnlistmentHandleHANDLEin
BufferSizeDWORDin
Buffervoid*inout

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SetEnlistmentRecoveryInformation(
    HANDLE EnlistmentHandle,
    DWORD BufferSize,
    void* Buffer
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ktmw32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool SetEnlistmentRecoveryInformation(
    IntPtr EnlistmentHandle,   // HANDLE
    uint BufferSize,   // DWORD
    IntPtr Buffer   // void* in/out
);
<DllImport("ktmw32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetEnlistmentRecoveryInformation(
    EnlistmentHandle As IntPtr,   ' HANDLE
    BufferSize As UInteger,   ' DWORD
    Buffer As IntPtr   ' void* in/out
) As Boolean
End Function
' EnlistmentHandle : HANDLE
' BufferSize : DWORD
' Buffer : void* in/out
Declare PtrSafe Function SetEnlistmentRecoveryInformation Lib "ktmw32" ( _
    ByVal EnlistmentHandle As LongPtr, _
    ByVal BufferSize As Long, _
    ByVal Buffer As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetEnlistmentRecoveryInformation = ctypes.windll.ktmw32.SetEnlistmentRecoveryInformation
SetEnlistmentRecoveryInformation.restype = wintypes.BOOL
SetEnlistmentRecoveryInformation.argtypes = [
    wintypes.HANDLE,  # EnlistmentHandle : HANDLE
    wintypes.DWORD,  # BufferSize : DWORD
    ctypes.POINTER(None),  # Buffer : void* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ktmw32.dll')
SetEnlistmentRecoveryInformation = Fiddle::Function.new(
  lib['SetEnlistmentRecoveryInformation'],
  [
    Fiddle::TYPE_VOIDP,  # EnlistmentHandle : HANDLE
    -Fiddle::TYPE_INT,  # BufferSize : DWORD
    Fiddle::TYPE_VOIDP,  # Buffer : void* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "ktmw32")]
extern "system" {
    fn SetEnlistmentRecoveryInformation(
        EnlistmentHandle: *mut core::ffi::c_void,  // HANDLE
        BufferSize: u32,  // DWORD
        Buffer: *mut ()  // void* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ktmw32.dll", SetLastError = true)]
public static extern bool SetEnlistmentRecoveryInformation(IntPtr EnlistmentHandle, uint BufferSize, IntPtr Buffer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ktmw32_SetEnlistmentRecoveryInformation' -Namespace Win32 -PassThru
# $api::SetEnlistmentRecoveryInformation(EnlistmentHandle, BufferSize, Buffer)
#uselib "ktmw32.dll"
#func global SetEnlistmentRecoveryInformation "SetEnlistmentRecoveryInformation" sptr, sptr, sptr
; SetEnlistmentRecoveryInformation EnlistmentHandle, BufferSize, Buffer   ; 戻り値は stat
; EnlistmentHandle : HANDLE -> "sptr"
; BufferSize : DWORD -> "sptr"
; Buffer : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ktmw32.dll"
#cfunc global SetEnlistmentRecoveryInformation "SetEnlistmentRecoveryInformation" sptr, int, sptr
; res = SetEnlistmentRecoveryInformation(EnlistmentHandle, BufferSize, Buffer)
; EnlistmentHandle : HANDLE -> "sptr"
; BufferSize : DWORD -> "int"
; Buffer : void* in/out -> "sptr"
; BOOL SetEnlistmentRecoveryInformation(HANDLE EnlistmentHandle, DWORD BufferSize, void* Buffer)
#uselib "ktmw32.dll"
#cfunc global SetEnlistmentRecoveryInformation "SetEnlistmentRecoveryInformation" intptr, int, intptr
; res = SetEnlistmentRecoveryInformation(EnlistmentHandle, BufferSize, Buffer)
; EnlistmentHandle : HANDLE -> "intptr"
; BufferSize : DWORD -> "int"
; Buffer : void* in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ktmw32 = windows.NewLazySystemDLL("ktmw32.dll")
	procSetEnlistmentRecoveryInformation = ktmw32.NewProc("SetEnlistmentRecoveryInformation")
)

// EnlistmentHandle (HANDLE), BufferSize (DWORD), Buffer (void* in/out)
r1, _, err := procSetEnlistmentRecoveryInformation.Call(
	uintptr(EnlistmentHandle),
	uintptr(BufferSize),
	uintptr(Buffer),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetEnlistmentRecoveryInformation(
  EnlistmentHandle: THandle;   // HANDLE
  BufferSize: DWORD;   // DWORD
  Buffer: Pointer   // void* in/out
): BOOL; stdcall;
  external 'ktmw32.dll' name 'SetEnlistmentRecoveryInformation';
result := DllCall("ktmw32\SetEnlistmentRecoveryInformation"
    , "Ptr", EnlistmentHandle   ; HANDLE
    , "UInt", BufferSize   ; DWORD
    , "Ptr", Buffer   ; void* in/out
    , "Int")   ; return: BOOL
●SetEnlistmentRecoveryInformation(EnlistmentHandle, BufferSize, Buffer) = DLL("ktmw32.dll", "bool SetEnlistmentRecoveryInformation(void*, dword, void*)")
# 呼び出し: SetEnlistmentRecoveryInformation(EnlistmentHandle, BufferSize, Buffer)
# EnlistmentHandle : HANDLE -> "void*"
# BufferSize : DWORD -> "dword"
# Buffer : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。