ホーム › Storage.FileSystem › RecoverEnlistment
RecoverEnlistment
関数KTMエンリストメントを回復する。
シグネチャ
// ktmw32.dll
#include <windows.h>
BOOL RecoverEnlistment(
HANDLE EnlistmentHandle,
void* EnlistmentKey
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| EnlistmentHandle | HANDLE | in | エンリストメントへのハンドル。 |
| EnlistmentKey | void* | inout | 回復するエンリストメントのキー。 |
戻り値の型: BOOL
公式ドキュメント
エンリストメントの状態を回復します。
戻り値
関数が成功した場合、戻り値は 0 以外の値になります。
関数が失敗した場合、戻り値は 0 になります。拡張エラー情報を取得するには、GetLastError 関数を呼び出します。
次の一覧に、考えられるエラーコードを示します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// 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 <MarshalAs(UnmanagedType.Bool)> 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 // BOOLfunction 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)。const std = @import("std");
extern "ktmw32" fn RecoverEnlistment(
EnlistmentHandle: ?*anyopaque, // HANDLE
EnlistmentKey: ?*anyopaque // void* in/out
) callconv(std.os.windows.WINAPI) i32;proc RecoverEnlistment(
EnlistmentHandle: pointer, # HANDLE
EnlistmentKey: pointer # void* in/out
): int32 {.importc: "RecoverEnlistment", stdcall, dynlib: "ktmw32.dll".}pragma(lib, "ktmw32");
extern(Windows)
int RecoverEnlistment(
void* EnlistmentHandle, // HANDLE
void* EnlistmentKey // void* in/out
);ccall((:RecoverEnlistment, "ktmw32.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{Cvoid}),
EnlistmentHandle, EnlistmentKey)
# EnlistmentHandle : HANDLE -> Ptr{Cvoid}
# EnlistmentKey : void* in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t RecoverEnlistment(
void* EnlistmentHandle,
void* EnlistmentKey);
]]
local ktmw32 = ffi.load("ktmw32")
-- ktmw32.RecoverEnlistment(EnlistmentHandle, EnlistmentKey)
-- EnlistmentHandle : HANDLE
-- EnlistmentKey : void* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('ktmw32.dll');
const RecoverEnlistment = lib.func('__stdcall', 'RecoverEnlistment', 'int32_t', ['void *', 'void *']);
// RecoverEnlistment(EnlistmentHandle, EnlistmentKey)
// EnlistmentHandle : HANDLE -> 'void *'
// EnlistmentKey : void* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ktmw32.dll", {
RecoverEnlistment: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.RecoverEnlistment(EnlistmentHandle, EnlistmentKey)
// EnlistmentHandle : HANDLE -> "pointer"
// EnlistmentKey : void* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t RecoverEnlistment(
void* EnlistmentHandle,
void* EnlistmentKey);
C, "ktmw32.dll");
// $ffi->RecoverEnlistment(EnlistmentHandle, EnlistmentKey);
// EnlistmentHandle : HANDLE
// EnlistmentKey : void* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Ktmw32 extends StdCallLibrary {
Ktmw32 INSTANCE = Native.load("ktmw32", Ktmw32.class);
boolean RecoverEnlistment(
Pointer EnlistmentHandle, // HANDLE
Pointer EnlistmentKey // void* in/out
);
}@[Link("ktmw32")]
lib Libktmw32
fun RecoverEnlistment = RecoverEnlistment(
EnlistmentHandle : Void*, # HANDLE
EnlistmentKey : Void* # void* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RecoverEnlistmentNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef RecoverEnlistmentDart = int Function(Pointer<Void>, Pointer<Void>);
final RecoverEnlistment = DynamicLibrary.open('ktmw32.dll')
.lookupFunction<RecoverEnlistmentNative, RecoverEnlistmentDart>('RecoverEnlistment');
// EnlistmentHandle : HANDLE -> Pointer<Void>
// EnlistmentKey : void* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RecoverEnlistment(
EnlistmentHandle: THandle; // HANDLE
EnlistmentKey: Pointer // void* in/out
): BOOL; stdcall;
external 'ktmw32.dll' name 'RecoverEnlistment';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RecoverEnlistment"
c_RecoverEnlistment :: Ptr () -> Ptr () -> IO CInt
-- EnlistmentHandle : HANDLE -> Ptr ()
-- EnlistmentKey : void* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let recoverenlistment =
foreign "RecoverEnlistment"
((ptr void) @-> (ptr void) @-> returning int32_t)
(* EnlistmentHandle : HANDLE -> (ptr void) *)
(* EnlistmentKey : void* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library ktmw32 (t "ktmw32.dll"))
(cffi:use-foreign-library ktmw32)
(cffi:defcfun ("RecoverEnlistment" recover-enlistment :convention :stdcall) :int32
(enlistment-handle :pointer) ; HANDLE
(enlistment-key :pointer)) ; void* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RecoverEnlistment = Win32::API::More->new('ktmw32',
'BOOL RecoverEnlistment(HANDLE EnlistmentHandle, LPVOID EnlistmentKey)');
# my $ret = $RecoverEnlistment->Call($EnlistmentHandle, $EnlistmentKey);
# EnlistmentHandle : HANDLE -> HANDLE
# EnlistmentKey : void* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。