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

TXF_LOG_RECORD_BASE

構造体
サイズx64: 8 バイト / x86: 8 バイトパッキング4

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

フィールド

フィールドサイズx64x86説明
VersionWORD2+0+0ログレコードのバージョン番号。
RecordTypeTXF_LOG_RECORD_TYPE2+2+2ログレコードの種類を示す値。
RecordLengthDWORD4+4+4ログレコード全体のバイト長。

各言語での定義

#include <windows.h>

// TXF_LOG_RECORD_BASE  (x64 8 / x86 8 バイト)
#pragma pack(push, 4)
typedef struct TXF_LOG_RECORD_BASE {
    WORD Version;
    TXF_LOG_RECORD_TYPE RecordType;
    DWORD RecordLength;
} TXF_LOG_RECORD_BASE;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
public struct TXF_LOG_RECORD_BASE
{
    public ushort Version;
    public ushort RecordType;
    public uint RecordLength;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Unicode)>
Public Structure TXF_LOG_RECORD_BASE
    Public Version As UShort
    Public RecordType As UShort
    Public RecordLength As UInteger
End Structure
import ctypes
from ctypes import wintypes

class TXF_LOG_RECORD_BASE(ctypes.Structure):
    _pack_ = 4
    _fields_ = [
        ("Version", ctypes.c_ushort),
        ("RecordType", ctypes.c_ushort),
        ("RecordLength", wintypes.DWORD),
    ]
#[repr(C, packed(4))]
pub struct TXF_LOG_RECORD_BASE {
    pub Version: u16,
    pub RecordType: u16,
    pub RecordLength: u32,
}
import "golang.org/x/sys/windows"

type TXF_LOG_RECORD_BASE struct {
	Version uint16
	RecordType uint16
	RecordLength uint32
}
type
  TXF_LOG_RECORD_BASE = packed record
    Version: Word;
    RecordType: Word;
    RecordLength: DWORD;
  end;
const TXF_LOG_RECORD_BASE = extern struct {
    Version: u16,
    RecordType: u16,
    RecordLength: u32,
};
type
  TXF_LOG_RECORD_BASE {.packed.} = object
    Version: uint16
    RecordType: uint16
    RecordLength: uint32
align(4)
struct TXF_LOG_RECORD_BASE
{
    ushort Version;
    ushort RecordType;
    uint RecordLength;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TXF_LOG_RECORD_BASE サイズ: 8 バイト(x64)
dim st, 2    ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; Version : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; RecordType : TXF_LOG_RECORD_TYPE (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; RecordLength : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global TXF_LOG_RECORD_BASE, pack=4
    #field short Version
    #field short RecordType
    #field int RecordLength
#endstruct

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