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

KCRM_TRANSACTION_BLOB

構造体
サイズx64: 172 バイト / x86: 172 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
UOWGUID16+0+0トランザクションの作業単位を識別するGUID。
TmIdentityGUID16+16+16トランザクションマネージャの識別GUID。
IsolationLevelDWORD4+32+32トランザクションの分離レベルを示す値。
IsolationFlagsDWORD4+36+36分離動作に関する追加フラグ。
TimeoutDWORD4+40+40トランザクションのタイムアウト。ミリ秒単位。
DescriptionWCHAR128+44+44トランザクションの説明文字列。Unicode。

各言語での定義

#include <windows.h>

// KCRM_TRANSACTION_BLOB  (x64 172 / x86 172 バイト)
typedef struct KCRM_TRANSACTION_BLOB {
    GUID UOW;
    GUID TmIdentity;
    DWORD IsolationLevel;
    DWORD IsolationFlags;
    DWORD Timeout;
    WCHAR Description[64];
} KCRM_TRANSACTION_BLOB;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KCRM_TRANSACTION_BLOB
{
    public Guid UOW;
    public Guid TmIdentity;
    public uint IsolationLevel;
    public uint IsolationFlags;
    public uint Timeout;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string Description;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KCRM_TRANSACTION_BLOB
    Public UOW As Guid
    Public TmIdentity As Guid
    Public IsolationLevel As UInteger
    Public IsolationFlags As UInteger
    Public Timeout As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public Description As String
End Structure
import ctypes
from ctypes import wintypes

class KCRM_TRANSACTION_BLOB(ctypes.Structure):
    _fields_ = [
        ("UOW", GUID),
        ("TmIdentity", GUID),
        ("IsolationLevel", wintypes.DWORD),
        ("IsolationFlags", wintypes.DWORD),
        ("Timeout", wintypes.DWORD),
        ("Description", ctypes.c_wchar * 64),
    ]
#[repr(C)]
pub struct KCRM_TRANSACTION_BLOB {
    pub UOW: GUID,
    pub TmIdentity: GUID,
    pub IsolationLevel: u32,
    pub IsolationFlags: u32,
    pub Timeout: u32,
    pub Description: [u16; 64],
}
import "golang.org/x/sys/windows"

type KCRM_TRANSACTION_BLOB struct {
	UOW windows.GUID
	TmIdentity windows.GUID
	IsolationLevel uint32
	IsolationFlags uint32
	Timeout uint32
	Description [64]uint16
}
type
  KCRM_TRANSACTION_BLOB = record
    UOW: TGUID;
    TmIdentity: TGUID;
    IsolationLevel: DWORD;
    IsolationFlags: DWORD;
    Timeout: DWORD;
    Description: array[0..63] of WideChar;
  end;
const KCRM_TRANSACTION_BLOB = extern struct {
    UOW: GUID,
    TmIdentity: GUID,
    IsolationLevel: u32,
    IsolationFlags: u32,
    Timeout: u32,
    Description: [64]u16,
};
type
  KCRM_TRANSACTION_BLOB {.bycopy.} = object
    UOW: GUID
    TmIdentity: GUID
    IsolationLevel: uint32
    IsolationFlags: uint32
    Timeout: uint32
    Description: array[64, uint16]
struct KCRM_TRANSACTION_BLOB
{
    GUID UOW;
    GUID TmIdentity;
    uint IsolationLevel;
    uint IsolationFlags;
    uint Timeout;
    wchar[64] Description;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KCRM_TRANSACTION_BLOB サイズ: 172 バイト(x64)
dim st, 43    ; 4byte整数×43(構造体サイズ 172 / 4 切り上げ)
; UOW : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; TmIdentity : GUID (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; IsolationLevel : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; IsolationFlags : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; Timeout : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; Description : WCHAR (+44, 128byte)  varptr(st)+44 を基点に操作(128byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global KCRM_TRANSACTION_BLOB
    #field GUID UOW
    #field GUID TmIdentity
    #field int IsolationLevel
    #field int IsolationFlags
    #field int Timeout
    #field wchar Description 64
#endstruct

stdim st, KCRM_TRANSACTION_BLOB        ; NSTRUCT 変数を確保
st->IsolationLevel = 100
mes "IsolationLevel=" + st->IsolationLevel