ホーム › 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 |
| Outcome | DWORD* | inout |
| IsolationLevel | DWORD* | inout |
| IsolationFlags | DWORD* | inout |
| Timeout | DWORD* | inout |
| BufferLength | DWORD | in |
| Description | LPWSTR | outoptional |
戻り値の型: BOOL
各言語での呼び出し定義
// 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 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)。