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

TxfLogCreateFileReadContext

関数
TxFログから特定ファイルのレコード読み取りコンテキストを作成する。
DLLtxfw32.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

// txfw32.dll
#include <windows.h>

BOOL TxfLogCreateFileReadContext(
    LPCWSTR LogPath,
    CLS_LSN BeginningLsn,
    CLS_LSN EndingLsn,
    TXF_ID* TxfFileId,
    void** TxfLogContext
);

パラメーター

名前方向
LogPathLPCWSTRin
BeginningLsnCLS_LSNin
EndingLsnCLS_LSNin
TxfFileIdTXF_ID*in
TxfLogContextvoid**out

戻り値の型: BOOL

各言語での呼び出し定義

// txfw32.dll
#include <windows.h>

BOOL TxfLogCreateFileReadContext(
    LPCWSTR LogPath,
    CLS_LSN BeginningLsn,
    CLS_LSN EndingLsn,
    TXF_ID* TxfFileId,
    void** TxfLogContext
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("txfw32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool TxfLogCreateFileReadContext(
    [MarshalAs(UnmanagedType.LPWStr)] string LogPath,   // LPCWSTR
    CLS_LSN BeginningLsn,   // CLS_LSN
    CLS_LSN EndingLsn,   // CLS_LSN
    IntPtr TxfFileId,   // TXF_ID*
    IntPtr TxfLogContext   // void** out
);
<DllImport("txfw32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function TxfLogCreateFileReadContext(
    <MarshalAs(UnmanagedType.LPWStr)> LogPath As String,   ' LPCWSTR
    BeginningLsn As CLS_LSN,   ' CLS_LSN
    EndingLsn As CLS_LSN,   ' CLS_LSN
    TxfFileId As IntPtr,   ' TXF_ID*
    TxfLogContext As IntPtr   ' void** out
) As Boolean
End Function
' LogPath : LPCWSTR
' BeginningLsn : CLS_LSN
' EndingLsn : CLS_LSN
' TxfFileId : TXF_ID*
' TxfLogContext : void** out
Declare PtrSafe Function TxfLogCreateFileReadContext Lib "txfw32" ( _
    ByVal LogPath As LongPtr, _
    ByVal BeginningLsn As LongPtr, _
    ByVal EndingLsn As LongPtr, _
    ByVal TxfFileId As LongPtr, _
    ByVal TxfLogContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

TxfLogCreateFileReadContext = ctypes.windll.txfw32.TxfLogCreateFileReadContext
TxfLogCreateFileReadContext.restype = wintypes.BOOL
TxfLogCreateFileReadContext.argtypes = [
    wintypes.LPCWSTR,  # LogPath : LPCWSTR
    CLS_LSN,  # BeginningLsn : CLS_LSN
    CLS_LSN,  # EndingLsn : CLS_LSN
    ctypes.c_void_p,  # TxfFileId : TXF_ID*
    ctypes.c_void_p,  # TxfLogContext : void** out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('txfw32.dll')
TxfLogCreateFileReadContext = Fiddle::Function.new(
  lib['TxfLogCreateFileReadContext'],
  [
    Fiddle::TYPE_VOIDP,  # LogPath : LPCWSTR
    Fiddle::TYPE_VOIDP,  # BeginningLsn : CLS_LSN
    Fiddle::TYPE_VOIDP,  # EndingLsn : CLS_LSN
    Fiddle::TYPE_VOIDP,  # TxfFileId : TXF_ID*
    Fiddle::TYPE_VOIDP,  # TxfLogContext : void** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "txfw32")]
extern "system" {
    fn TxfLogCreateFileReadContext(
        LogPath: *const u16,  // LPCWSTR
        BeginningLsn: CLS_LSN,  // CLS_LSN
        EndingLsn: CLS_LSN,  // CLS_LSN
        TxfFileId: *mut TXF_ID,  // TXF_ID*
        TxfLogContext: *mut *mut ()  // void** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("txfw32.dll", SetLastError = true)]
public static extern bool TxfLogCreateFileReadContext([MarshalAs(UnmanagedType.LPWStr)] string LogPath, CLS_LSN BeginningLsn, CLS_LSN EndingLsn, IntPtr TxfFileId, IntPtr TxfLogContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'txfw32_TxfLogCreateFileReadContext' -Namespace Win32 -PassThru
# $api::TxfLogCreateFileReadContext(LogPath, BeginningLsn, EndingLsn, TxfFileId, TxfLogContext)
#uselib "txfw32.dll"
#func global TxfLogCreateFileReadContext "TxfLogCreateFileReadContext" sptr, sptr, sptr, sptr, sptr
; TxfLogCreateFileReadContext LogPath, BeginningLsn, EndingLsn, varptr(TxfFileId), TxfLogContext   ; 戻り値は stat
; LogPath : LPCWSTR -> "sptr"
; BeginningLsn : CLS_LSN -> "sptr"
; EndingLsn : CLS_LSN -> "sptr"
; TxfFileId : TXF_ID* -> "sptr"
; TxfLogContext : void** out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "txfw32.dll"
#cfunc global TxfLogCreateFileReadContext "TxfLogCreateFileReadContext" wstr, int, int, var, sptr
; res = TxfLogCreateFileReadContext(LogPath, BeginningLsn, EndingLsn, TxfFileId, TxfLogContext)
; LogPath : LPCWSTR -> "wstr"
; BeginningLsn : CLS_LSN -> "int"
; EndingLsn : CLS_LSN -> "int"
; TxfFileId : TXF_ID* -> "var"
; TxfLogContext : void** out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL TxfLogCreateFileReadContext(LPCWSTR LogPath, CLS_LSN BeginningLsn, CLS_LSN EndingLsn, TXF_ID* TxfFileId, void** TxfLogContext)
#uselib "txfw32.dll"
#cfunc global TxfLogCreateFileReadContext "TxfLogCreateFileReadContext" wstr, int, int, var, intptr
; res = TxfLogCreateFileReadContext(LogPath, BeginningLsn, EndingLsn, TxfFileId, TxfLogContext)
; LogPath : LPCWSTR -> "wstr"
; BeginningLsn : CLS_LSN -> "int"
; EndingLsn : CLS_LSN -> "int"
; TxfFileId : TXF_ID* -> "var"
; TxfLogContext : void** out -> "intptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	txfw32 = windows.NewLazySystemDLL("txfw32.dll")
	procTxfLogCreateFileReadContext = txfw32.NewProc("TxfLogCreateFileReadContext")
)

// LogPath (LPCWSTR), BeginningLsn (CLS_LSN), EndingLsn (CLS_LSN), TxfFileId (TXF_ID*), TxfLogContext (void** out)
r1, _, err := procTxfLogCreateFileReadContext.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(LogPath))),
	uintptr(BeginningLsn),
	uintptr(EndingLsn),
	uintptr(TxfFileId),
	uintptr(TxfLogContext),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function TxfLogCreateFileReadContext(
  LogPath: PWideChar;   // LPCWSTR
  BeginningLsn: CLS_LSN;   // CLS_LSN
  EndingLsn: CLS_LSN;   // CLS_LSN
  TxfFileId: Pointer;   // TXF_ID*
  TxfLogContext: Pointer   // void** out
): BOOL; stdcall;
  external 'txfw32.dll' name 'TxfLogCreateFileReadContext';
result := DllCall("txfw32\TxfLogCreateFileReadContext"
    , "WStr", LogPath   ; LPCWSTR
    , "Ptr", BeginningLsn   ; CLS_LSN
    , "Ptr", EndingLsn   ; CLS_LSN
    , "Ptr", TxfFileId   ; TXF_ID*
    , "Ptr", TxfLogContext   ; void** out
    , "Int")   ; return: BOOL
●TxfLogCreateFileReadContext(LogPath, BeginningLsn, EndingLsn, TxfFileId, TxfLogContext) = DLL("txfw32.dll", "bool TxfLogCreateFileReadContext(char*, void*, void*, void*, void*)")
# 呼び出し: TxfLogCreateFileReadContext(LogPath, BeginningLsn, EndingLsn, TxfFileId, TxfLogContext)
# LogPath : LPCWSTR -> "char*"
# BeginningLsn : CLS_LSN -> "void*"
# EndingLsn : CLS_LSN -> "void*"
# TxfFileId : TXF_ID* -> "void*"
# TxfLogContext : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。