ホーム › Storage.FileSystem › GetTransactionInformation
GetTransactionInformation
関数KTMトランザクションの結果や分離レベル等の情報を取得する。
シグネチャ
// ktmw32.dll
#include <windows.h>
BOOL GetTransactionInformation(
HANDLE TransactionHandle,
DWORD* Outcome,
DWORD* IsolationLevel,
DWORD* IsolationFlags,
DWORD* Timeout,
DWORD BufferLength,
LPWSTR Description // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| TransactionHandle | HANDLE | in | トランザクションへのハンドル。情報を取得するには、このハンドルに TRANSACTION_QUERY_INFORMATION 権限が必要です。 |
| Outcome | DWORD* | inout | トランザクションの現在の結果を受け取るバッファーへのポインター。GetTransactionInformation 関数の呼び出しが成功した場合、この値は TRANSACTION_OUTCOME 列挙体の値のいずれかになります。 |
| IsolationLevel | DWORD* | inout | 予約されています。 |
| IsolationFlags | DWORD* | inout | 予約されています。 |
| Timeout | DWORD* | inout | このトランザクションのタイムアウト値(ミリ秒単位)を受け取る変数へのポインター。 |
| BufferLength | DWORD | in | Description パラメーターのサイズ(バイト単位)。バッファー長の値は MAX_TRANSACTION_DESCRIPTION_LENGTH の値を超えることはできません。 |
| Description | LPWSTR | outoptional | トランザクションのユーザー定義の説明を受け取るバッファーへのポインター。 |
戻り値の型: 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 GetTransactionInformation(
HANDLE TransactionHandle,
DWORD* Outcome,
DWORD* IsolationLevel,
DWORD* IsolationFlags,
DWORD* Timeout,
DWORD BufferLength,
LPWSTR Description // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ktmw32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool GetTransactionInformation(
IntPtr TransactionHandle, // HANDLE
ref uint Outcome, // DWORD* in/out
ref uint IsolationLevel, // DWORD* in/out
ref uint IsolationFlags, // DWORD* in/out
ref uint Timeout, // DWORD* in/out
uint BufferLength, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder Description // LPWSTR optional, out
);<DllImport("ktmw32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetTransactionInformation(
TransactionHandle As IntPtr, ' HANDLE
ByRef Outcome As UInteger, ' DWORD* in/out
ByRef IsolationLevel As UInteger, ' DWORD* in/out
ByRef IsolationFlags As UInteger, ' DWORD* in/out
ByRef Timeout As UInteger, ' DWORD* in/out
BufferLength As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> Description As System.Text.StringBuilder ' LPWSTR optional, out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' TransactionHandle : HANDLE
' Outcome : DWORD* in/out
' IsolationLevel : DWORD* in/out
' IsolationFlags : DWORD* in/out
' Timeout : DWORD* in/out
' BufferLength : DWORD
' Description : LPWSTR optional, out
Declare PtrSafe Function GetTransactionInformation Lib "ktmw32" ( _
ByVal TransactionHandle As LongPtr, _
ByRef Outcome As Long, _
ByRef IsolationLevel As Long, _
ByRef IsolationFlags As Long, _
ByRef Timeout As Long, _
ByVal BufferLength As Long, _
ByVal Description As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetTransactionInformation = ctypes.windll.ktmw32.GetTransactionInformation
GetTransactionInformation.restype = wintypes.BOOL
GetTransactionInformation.argtypes = [
wintypes.HANDLE, # TransactionHandle : HANDLE
ctypes.POINTER(wintypes.DWORD), # Outcome : DWORD* in/out
ctypes.POINTER(wintypes.DWORD), # IsolationLevel : DWORD* in/out
ctypes.POINTER(wintypes.DWORD), # IsolationFlags : DWORD* in/out
ctypes.POINTER(wintypes.DWORD), # Timeout : DWORD* in/out
wintypes.DWORD, # BufferLength : DWORD
wintypes.LPWSTR, # Description : LPWSTR optional, out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ktmw32.dll')
GetTransactionInformation = Fiddle::Function.new(
lib['GetTransactionInformation'],
[
Fiddle::TYPE_VOIDP, # TransactionHandle : HANDLE
Fiddle::TYPE_VOIDP, # Outcome : DWORD* in/out
Fiddle::TYPE_VOIDP, # IsolationLevel : DWORD* in/out
Fiddle::TYPE_VOIDP, # IsolationFlags : DWORD* in/out
Fiddle::TYPE_VOIDP, # Timeout : DWORD* in/out
-Fiddle::TYPE_INT, # BufferLength : DWORD
Fiddle::TYPE_VOIDP, # Description : LPWSTR optional, out
],
Fiddle::TYPE_INT)#[link(name = "ktmw32")]
extern "system" {
fn GetTransactionInformation(
TransactionHandle: *mut core::ffi::c_void, // HANDLE
Outcome: *mut u32, // DWORD* in/out
IsolationLevel: *mut u32, // DWORD* in/out
IsolationFlags: *mut u32, // DWORD* in/out
Timeout: *mut u32, // DWORD* in/out
BufferLength: u32, // DWORD
Description: *mut u16 // LPWSTR optional, 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 GetTransactionInformation(IntPtr TransactionHandle, ref uint Outcome, ref uint IsolationLevel, ref uint IsolationFlags, ref uint Timeout, uint BufferLength, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder Description);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ktmw32_GetTransactionInformation' -Namespace Win32 -PassThru
# $api::GetTransactionInformation(TransactionHandle, Outcome, IsolationLevel, IsolationFlags, Timeout, BufferLength, Description)#uselib "ktmw32.dll"
#func global GetTransactionInformation "GetTransactionInformation" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; GetTransactionInformation TransactionHandle, varptr(Outcome), varptr(IsolationLevel), varptr(IsolationFlags), varptr(Timeout), BufferLength, varptr(Description) ; 戻り値は stat
; TransactionHandle : HANDLE -> "sptr"
; Outcome : DWORD* in/out -> "sptr"
; IsolationLevel : DWORD* in/out -> "sptr"
; IsolationFlags : DWORD* in/out -> "sptr"
; Timeout : DWORD* in/out -> "sptr"
; BufferLength : DWORD -> "sptr"
; Description : LPWSTR optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ktmw32.dll" #cfunc global GetTransactionInformation "GetTransactionInformation" sptr, var, var, var, var, int, var ; res = GetTransactionInformation(TransactionHandle, Outcome, IsolationLevel, IsolationFlags, Timeout, BufferLength, Description) ; TransactionHandle : HANDLE -> "sptr" ; Outcome : DWORD* in/out -> "var" ; IsolationLevel : DWORD* in/out -> "var" ; IsolationFlags : DWORD* in/out -> "var" ; Timeout : DWORD* in/out -> "var" ; BufferLength : DWORD -> "int" ; Description : LPWSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ktmw32.dll" #cfunc global GetTransactionInformation "GetTransactionInformation" sptr, sptr, sptr, sptr, sptr, int, sptr ; res = GetTransactionInformation(TransactionHandle, varptr(Outcome), varptr(IsolationLevel), varptr(IsolationFlags), varptr(Timeout), BufferLength, varptr(Description)) ; TransactionHandle : HANDLE -> "sptr" ; Outcome : DWORD* in/out -> "sptr" ; IsolationLevel : DWORD* in/out -> "sptr" ; IsolationFlags : DWORD* in/out -> "sptr" ; Timeout : DWORD* in/out -> "sptr" ; BufferLength : DWORD -> "int" ; Description : LPWSTR optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetTransactionInformation(HANDLE TransactionHandle, DWORD* Outcome, DWORD* IsolationLevel, DWORD* IsolationFlags, DWORD* Timeout, DWORD BufferLength, LPWSTR Description) #uselib "ktmw32.dll" #cfunc global GetTransactionInformation "GetTransactionInformation" intptr, var, var, var, var, int, var ; res = GetTransactionInformation(TransactionHandle, Outcome, IsolationLevel, IsolationFlags, Timeout, BufferLength, Description) ; TransactionHandle : HANDLE -> "intptr" ; Outcome : DWORD* in/out -> "var" ; IsolationLevel : DWORD* in/out -> "var" ; IsolationFlags : DWORD* in/out -> "var" ; Timeout : DWORD* in/out -> "var" ; BufferLength : DWORD -> "int" ; Description : LPWSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetTransactionInformation(HANDLE TransactionHandle, DWORD* Outcome, DWORD* IsolationLevel, DWORD* IsolationFlags, DWORD* Timeout, DWORD BufferLength, LPWSTR Description) #uselib "ktmw32.dll" #cfunc global GetTransactionInformation "GetTransactionInformation" intptr, intptr, intptr, intptr, intptr, int, intptr ; res = GetTransactionInformation(TransactionHandle, varptr(Outcome), varptr(IsolationLevel), varptr(IsolationFlags), varptr(Timeout), BufferLength, varptr(Description)) ; TransactionHandle : HANDLE -> "intptr" ; Outcome : DWORD* in/out -> "intptr" ; IsolationLevel : DWORD* in/out -> "intptr" ; IsolationFlags : DWORD* in/out -> "intptr" ; Timeout : DWORD* in/out -> "intptr" ; BufferLength : DWORD -> "int" ; Description : LPWSTR optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ktmw32 = windows.NewLazySystemDLL("ktmw32.dll")
procGetTransactionInformation = ktmw32.NewProc("GetTransactionInformation")
)
// TransactionHandle (HANDLE), Outcome (DWORD* in/out), IsolationLevel (DWORD* in/out), IsolationFlags (DWORD* in/out), Timeout (DWORD* in/out), BufferLength (DWORD), Description (LPWSTR optional, out)
r1, _, err := procGetTransactionInformation.Call(
uintptr(TransactionHandle),
uintptr(Outcome),
uintptr(IsolationLevel),
uintptr(IsolationFlags),
uintptr(Timeout),
uintptr(BufferLength),
uintptr(Description),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetTransactionInformation(
TransactionHandle: THandle; // HANDLE
Outcome: Pointer; // DWORD* in/out
IsolationLevel: Pointer; // DWORD* in/out
IsolationFlags: Pointer; // DWORD* in/out
Timeout: Pointer; // DWORD* in/out
BufferLength: DWORD; // DWORD
Description: PWideChar // LPWSTR optional, out
): BOOL; stdcall;
external 'ktmw32.dll' name 'GetTransactionInformation';result := DllCall("ktmw32\GetTransactionInformation"
, "Ptr", TransactionHandle ; HANDLE
, "Ptr", Outcome ; DWORD* in/out
, "Ptr", IsolationLevel ; DWORD* in/out
, "Ptr", IsolationFlags ; DWORD* in/out
, "Ptr", Timeout ; DWORD* in/out
, "UInt", BufferLength ; DWORD
, "Ptr", Description ; LPWSTR optional, out
, "Int") ; return: BOOL●GetTransactionInformation(TransactionHandle, Outcome, IsolationLevel, IsolationFlags, Timeout, BufferLength, Description) = DLL("ktmw32.dll", "bool GetTransactionInformation(void*, void*, void*, void*, void*, dword, char*)")
# 呼び出し: GetTransactionInformation(TransactionHandle, Outcome, IsolationLevel, IsolationFlags, Timeout, BufferLength, Description)
# TransactionHandle : HANDLE -> "void*"
# Outcome : DWORD* in/out -> "void*"
# IsolationLevel : DWORD* in/out -> "void*"
# IsolationFlags : DWORD* in/out -> "void*"
# Timeout : DWORD* in/out -> "void*"
# BufferLength : DWORD -> "dword"
# Description : LPWSTR optional, out -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "ktmw32" fn GetTransactionInformation(
TransactionHandle: ?*anyopaque, // HANDLE
Outcome: [*c]u32, // DWORD* in/out
IsolationLevel: [*c]u32, // DWORD* in/out
IsolationFlags: [*c]u32, // DWORD* in/out
Timeout: [*c]u32, // DWORD* in/out
BufferLength: u32, // DWORD
Description: [*c]u16 // LPWSTR optional, out
) callconv(std.os.windows.WINAPI) i32;proc GetTransactionInformation(
TransactionHandle: pointer, # HANDLE
Outcome: ptr uint32, # DWORD* in/out
IsolationLevel: ptr uint32, # DWORD* in/out
IsolationFlags: ptr uint32, # DWORD* in/out
Timeout: ptr uint32, # DWORD* in/out
BufferLength: uint32, # DWORD
Description: ptr uint16 # LPWSTR optional, out
): int32 {.importc: "GetTransactionInformation", stdcall, dynlib: "ktmw32.dll".}pragma(lib, "ktmw32");
extern(Windows)
int GetTransactionInformation(
void* TransactionHandle, // HANDLE
uint* Outcome, // DWORD* in/out
uint* IsolationLevel, // DWORD* in/out
uint* IsolationFlags, // DWORD* in/out
uint* Timeout, // DWORD* in/out
uint BufferLength, // DWORD
wchar* Description // LPWSTR optional, out
);ccall((:GetTransactionInformation, "ktmw32.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}, UInt32, Ptr{UInt16}),
TransactionHandle, Outcome, IsolationLevel, IsolationFlags, Timeout, BufferLength, Description)
# TransactionHandle : HANDLE -> Ptr{Cvoid}
# Outcome : DWORD* in/out -> Ptr{UInt32}
# IsolationLevel : DWORD* in/out -> Ptr{UInt32}
# IsolationFlags : DWORD* in/out -> Ptr{UInt32}
# Timeout : DWORD* in/out -> Ptr{UInt32}
# BufferLength : DWORD -> UInt32
# Description : LPWSTR optional, out -> Ptr{UInt16}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GetTransactionInformation(
void* TransactionHandle,
uint32_t* Outcome,
uint32_t* IsolationLevel,
uint32_t* IsolationFlags,
uint32_t* Timeout,
uint32_t BufferLength,
uint16_t* Description);
]]
local ktmw32 = ffi.load("ktmw32")
-- ktmw32.GetTransactionInformation(TransactionHandle, Outcome, IsolationLevel, IsolationFlags, Timeout, BufferLength, Description)
-- TransactionHandle : HANDLE
-- Outcome : DWORD* in/out
-- IsolationLevel : DWORD* in/out
-- IsolationFlags : DWORD* in/out
-- Timeout : DWORD* in/out
-- BufferLength : DWORD
-- Description : LPWSTR optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('ktmw32.dll');
const GetTransactionInformation = lib.func('__stdcall', 'GetTransactionInformation', 'int32_t', ['void *', 'uint32_t *', 'uint32_t *', 'uint32_t *', 'uint32_t *', 'uint32_t', 'uint16_t *']);
// GetTransactionInformation(TransactionHandle, Outcome, IsolationLevel, IsolationFlags, Timeout, BufferLength, Description)
// TransactionHandle : HANDLE -> 'void *'
// Outcome : DWORD* in/out -> 'uint32_t *'
// IsolationLevel : DWORD* in/out -> 'uint32_t *'
// IsolationFlags : DWORD* in/out -> 'uint32_t *'
// Timeout : DWORD* in/out -> 'uint32_t *'
// BufferLength : DWORD -> 'uint32_t'
// Description : LPWSTR optional, out -> 'uint16_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ktmw32.dll", {
GetTransactionInformation: { parameters: ["pointer", "pointer", "pointer", "pointer", "pointer", "u32", "buffer"], result: "i32" },
});
// lib.symbols.GetTransactionInformation(TransactionHandle, Outcome, IsolationLevel, IsolationFlags, Timeout, BufferLength, Description)
// TransactionHandle : HANDLE -> "pointer"
// Outcome : DWORD* in/out -> "pointer"
// IsolationLevel : DWORD* in/out -> "pointer"
// IsolationFlags : DWORD* in/out -> "pointer"
// Timeout : DWORD* in/out -> "pointer"
// BufferLength : DWORD -> "u32"
// Description : LPWSTR optional, out -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GetTransactionInformation(
void* TransactionHandle,
uint32_t* Outcome,
uint32_t* IsolationLevel,
uint32_t* IsolationFlags,
uint32_t* Timeout,
uint32_t BufferLength,
uint16_t* Description);
C, "ktmw32.dll");
// $ffi->GetTransactionInformation(TransactionHandle, Outcome, IsolationLevel, IsolationFlags, Timeout, BufferLength, Description);
// TransactionHandle : HANDLE
// Outcome : DWORD* in/out
// IsolationLevel : DWORD* in/out
// IsolationFlags : DWORD* in/out
// Timeout : DWORD* in/out
// BufferLength : DWORD
// Description : LPWSTR optional, 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 GetTransactionInformation(
Pointer TransactionHandle, // HANDLE
IntByReference Outcome, // DWORD* in/out
IntByReference IsolationLevel, // DWORD* in/out
IntByReference IsolationFlags, // DWORD* in/out
IntByReference Timeout, // DWORD* in/out
int BufferLength, // DWORD
char[] Description // LPWSTR optional, out
);
}@[Link("ktmw32")]
lib Libktmw32
fun GetTransactionInformation = GetTransactionInformation(
TransactionHandle : Void*, # HANDLE
Outcome : UInt32*, # DWORD* in/out
IsolationLevel : UInt32*, # DWORD* in/out
IsolationFlags : UInt32*, # DWORD* in/out
Timeout : UInt32*, # DWORD* in/out
BufferLength : UInt32, # DWORD
Description : UInt16* # LPWSTR optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GetTransactionInformationNative = Int32 Function(Pointer<Void>, Pointer<Uint32>, Pointer<Uint32>, Pointer<Uint32>, Pointer<Uint32>, Uint32, Pointer<Utf16>);
typedef GetTransactionInformationDart = int Function(Pointer<Void>, Pointer<Uint32>, Pointer<Uint32>, Pointer<Uint32>, Pointer<Uint32>, int, Pointer<Utf16>);
final GetTransactionInformation = DynamicLibrary.open('ktmw32.dll')
.lookupFunction<GetTransactionInformationNative, GetTransactionInformationDart>('GetTransactionInformation');
// TransactionHandle : HANDLE -> Pointer<Void>
// Outcome : DWORD* in/out -> Pointer<Uint32>
// IsolationLevel : DWORD* in/out -> Pointer<Uint32>
// IsolationFlags : DWORD* in/out -> Pointer<Uint32>
// Timeout : DWORD* in/out -> Pointer<Uint32>
// BufferLength : DWORD -> Uint32
// Description : LPWSTR optional, out -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GetTransactionInformation(
TransactionHandle: THandle; // HANDLE
Outcome: Pointer; // DWORD* in/out
IsolationLevel: Pointer; // DWORD* in/out
IsolationFlags: Pointer; // DWORD* in/out
Timeout: Pointer; // DWORD* in/out
BufferLength: DWORD; // DWORD
Description: PWideChar // LPWSTR optional, out
): BOOL; stdcall;
external 'ktmw32.dll' name 'GetTransactionInformation';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GetTransactionInformation"
c_GetTransactionInformation :: Ptr () -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> Word32 -> CWString -> IO CInt
-- TransactionHandle : HANDLE -> Ptr ()
-- Outcome : DWORD* in/out -> Ptr Word32
-- IsolationLevel : DWORD* in/out -> Ptr Word32
-- IsolationFlags : DWORD* in/out -> Ptr Word32
-- Timeout : DWORD* in/out -> Ptr Word32
-- BufferLength : DWORD -> Word32
-- Description : LPWSTR optional, out -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gettransactioninformation =
foreign "GetTransactionInformation"
((ptr void) @-> (ptr uint32_t) @-> (ptr uint32_t) @-> (ptr uint32_t) @-> (ptr uint32_t) @-> uint32_t @-> (ptr uint16_t) @-> returning int32_t)
(* TransactionHandle : HANDLE -> (ptr void) *)
(* Outcome : DWORD* in/out -> (ptr uint32_t) *)
(* IsolationLevel : DWORD* in/out -> (ptr uint32_t) *)
(* IsolationFlags : DWORD* in/out -> (ptr uint32_t) *)
(* Timeout : DWORD* in/out -> (ptr uint32_t) *)
(* BufferLength : DWORD -> uint32_t *)
(* Description : LPWSTR optional, out -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library ktmw32 (t "ktmw32.dll"))
(cffi:use-foreign-library ktmw32)
(cffi:defcfun ("GetTransactionInformation" get-transaction-information :convention :stdcall) :int32
(transaction-handle :pointer) ; HANDLE
(outcome :pointer) ; DWORD* in/out
(isolation-level :pointer) ; DWORD* in/out
(isolation-flags :pointer) ; DWORD* in/out
(timeout :pointer) ; DWORD* in/out
(buffer-length :uint32) ; DWORD
(description :pointer)) ; LPWSTR optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GetTransactionInformation = Win32::API::More->new('ktmw32',
'BOOL GetTransactionInformation(HANDLE TransactionHandle, LPVOID Outcome, LPVOID IsolationLevel, LPVOID IsolationFlags, LPVOID Timeout, DWORD BufferLength, LPWSTR Description)');
# my $ret = $GetTransactionInformation->Call($TransactionHandle, $Outcome, $IsolationLevel, $IsolationFlags, $Timeout, $BufferLength, $Description);
# TransactionHandle : HANDLE -> HANDLE
# Outcome : DWORD* in/out -> LPVOID
# IsolationLevel : DWORD* in/out -> LPVOID
# IsolationFlags : DWORD* in/out -> LPVOID
# Timeout : DWORD* in/out -> LPVOID
# BufferLength : DWORD -> DWORD
# Description : LPWSTR optional, out -> LPWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f CreateTransaction — KTMのトランザクションを新規作成する。
- f SetTransactionInformation — KTMトランザクションの分離レベルやタイムアウトを設定する。