Win32 API 日本語リファレンス
ホームSystem.DistributedTransactionCoordinator › XACTTRANSINFO

XACTTRANSINFO

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

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

フィールド

フィールドサイズx64x86説明
uowBOID16+0+0トランザクションの作業単位を識別するBOID。
isoLevelINT4+16+16トランザクションの分離レベル。
isoFlagsDWORD4+20+20分離フラグ(ISOFLAG_*)。
grfTCSupportedDWORD4+24+24トランザクションコーディネータがサポートする機能フラグ。
grfRMSupportedDWORD4+28+28リソースマネージャがサポートする機能フラグ。
grfTCSupportedRetainingDWORD4+32+32コミット保持時にTCがサポートする機能フラグ。
grfRMSupportedRetainingDWORD4+36+36コミット保持時にRMがサポートする機能フラグ。

各言語での定義

#include <windows.h>

// BOID  (x64 16 / x86 16 バイト)
typedef struct BOID {
    BYTE rgb[16];
} BOID;

// XACTTRANSINFO  (x64 40 / x86 40 バイト)
typedef struct XACTTRANSINFO {
    BOID uow;
    INT isoLevel;
    DWORD isoFlags;
    DWORD grfTCSupported;
    DWORD grfRMSupported;
    DWORD grfTCSupportedRetaining;
    DWORD grfRMSupportedRetaining;
} XACTTRANSINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BOID
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] rgb;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XACTTRANSINFO
{
    public BOID uow;
    public int isoLevel;
    public uint isoFlags;
    public uint grfTCSupported;
    public uint grfRMSupported;
    public uint grfTCSupportedRetaining;
    public uint grfRMSupportedRetaining;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BOID
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public rgb() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XACTTRANSINFO
    Public uow As BOID
    Public isoLevel As Integer
    Public isoFlags As UInteger
    Public grfTCSupported As UInteger
    Public grfRMSupported As UInteger
    Public grfTCSupportedRetaining As UInteger
    Public grfRMSupportedRetaining As UInteger
End Structure
import ctypes
from ctypes import wintypes

class BOID(ctypes.Structure):
    _fields_ = [
        ("rgb", ctypes.c_ubyte * 16),
    ]

class XACTTRANSINFO(ctypes.Structure):
    _fields_ = [
        ("uow", BOID),
        ("isoLevel", ctypes.c_int),
        ("isoFlags", wintypes.DWORD),
        ("grfTCSupported", wintypes.DWORD),
        ("grfRMSupported", wintypes.DWORD),
        ("grfTCSupportedRetaining", wintypes.DWORD),
        ("grfRMSupportedRetaining", wintypes.DWORD),
    ]
#[repr(C)]
pub struct BOID {
    pub rgb: [u8; 16],
}

#[repr(C)]
pub struct XACTTRANSINFO {
    pub uow: BOID,
    pub isoLevel: i32,
    pub isoFlags: u32,
    pub grfTCSupported: u32,
    pub grfRMSupported: u32,
    pub grfTCSupportedRetaining: u32,
    pub grfRMSupportedRetaining: u32,
}
import "golang.org/x/sys/windows"

type BOID struct {
	rgb [16]byte
}

type XACTTRANSINFO struct {
	uow BOID
	isoLevel int32
	isoFlags uint32
	grfTCSupported uint32
	grfRMSupported uint32
	grfTCSupportedRetaining uint32
	grfRMSupportedRetaining uint32
}
type
  BOID = record
    rgb: array[0..15] of Byte;
  end;

  XACTTRANSINFO = record
    uow: BOID;
    isoLevel: Integer;
    isoFlags: DWORD;
    grfTCSupported: DWORD;
    grfRMSupported: DWORD;
    grfTCSupportedRetaining: DWORD;
    grfRMSupportedRetaining: DWORD;
  end;
const BOID = extern struct {
    rgb: [16]u8,
};

const XACTTRANSINFO = extern struct {
    uow: BOID,
    isoLevel: i32,
    isoFlags: u32,
    grfTCSupported: u32,
    grfRMSupported: u32,
    grfTCSupportedRetaining: u32,
    grfRMSupportedRetaining: u32,
};
type
  BOID {.bycopy.} = object
    rgb: array[16, uint8]

  XACTTRANSINFO {.bycopy.} = object
    uow: BOID
    isoLevel: int32
    isoFlags: uint32
    grfTCSupported: uint32
    grfRMSupported: uint32
    grfTCSupportedRetaining: uint32
    grfRMSupportedRetaining: uint32
struct BOID
{
    ubyte[16] rgb;
}

struct XACTTRANSINFO
{
    BOID uow;
    int isoLevel;
    uint isoFlags;
    uint grfTCSupported;
    uint grfRMSupported;
    uint grfTCSupportedRetaining;
    uint grfRMSupportedRetaining;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; XACTTRANSINFO サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; uow : BOID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; isoLevel : INT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; isoFlags : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; grfTCSupported : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; grfRMSupported : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; grfTCSupportedRetaining : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; grfRMSupportedRetaining : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global BOID
    #field byte rgb 16
#endstruct

#defstruct global XACTTRANSINFO
    #field BOID uow
    #field int isoLevel
    #field int isoFlags
    #field int grfTCSupported
    #field int grfRMSupported
    #field int grfTCSupportedRetaining
    #field int grfRMSupportedRetaining
#endstruct

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