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

RecoverEnlistment

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

シグネチャ

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

BOOL RecoverEnlistment(
    HANDLE EnlistmentHandle,
    void* EnlistmentKey
);

パラメーター

名前方向
EnlistmentHandleHANDLEin
EnlistmentKeyvoid*inout

戻り値の型: BOOL

各言語での呼び出し定義

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

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

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

lib = Fiddle.dlopen('ktmw32.dll')
RecoverEnlistment = Fiddle::Function.new(
  lib['RecoverEnlistment'],
  [
    Fiddle::TYPE_VOIDP,  # EnlistmentHandle : HANDLE
    Fiddle::TYPE_VOIDP,  # EnlistmentKey : void* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "ktmw32")]
extern "system" {
    fn RecoverEnlistment(
        EnlistmentHandle: *mut core::ffi::c_void,  // HANDLE
        EnlistmentKey: *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 RecoverEnlistment(IntPtr EnlistmentHandle, IntPtr EnlistmentKey);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ktmw32_RecoverEnlistment' -Namespace Win32 -PassThru
# $api::RecoverEnlistment(EnlistmentHandle, EnlistmentKey)
#uselib "ktmw32.dll"
#func global RecoverEnlistment "RecoverEnlistment" sptr, sptr
; RecoverEnlistment EnlistmentHandle, EnlistmentKey   ; 戻り値は stat
; EnlistmentHandle : HANDLE -> "sptr"
; EnlistmentKey : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ktmw32.dll"
#cfunc global RecoverEnlistment "RecoverEnlistment" sptr, sptr
; res = RecoverEnlistment(EnlistmentHandle, EnlistmentKey)
; EnlistmentHandle : HANDLE -> "sptr"
; EnlistmentKey : void* in/out -> "sptr"
; BOOL RecoverEnlistment(HANDLE EnlistmentHandle, void* EnlistmentKey)
#uselib "ktmw32.dll"
#cfunc global RecoverEnlistment "RecoverEnlistment" intptr, intptr
; res = RecoverEnlistment(EnlistmentHandle, EnlistmentKey)
; EnlistmentHandle : HANDLE -> "intptr"
; EnlistmentKey : void* in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ktmw32 = windows.NewLazySystemDLL("ktmw32.dll")
	procRecoverEnlistment = ktmw32.NewProc("RecoverEnlistment")
)

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