ホーム › Storage.FileSystem › TxfLogRecordGetGenericType
TxfLogRecordGetGenericType
関数TxFログレコードの汎用種別と仮想クロックを取得する。
シグネチャ
// txfw32.dll
#include <windows.h>
BOOL TxfLogRecordGetGenericType(
void* RecordBuffer,
DWORD RecordBufferLengthInBytes,
DWORD* GenericType,
LONGLONG* VirtualClock // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| RecordBuffer | void* | in | 解析対象のTxFログレコードを格納したバッファポインタ。 |
| RecordBufferLengthInBytes | DWORD | in | RecordBufferのサイズをバイト単位で示す値。 |
| GenericType | DWORD* | out | レコードの汎用種別を受け取る出力ポインタ。 |
| VirtualClock | LONGLONG* | outoptional | レコードの仮想クロック値を受け取る出力ポインタ。 |
戻り値の型: BOOL
各言語での呼び出し定義
// txfw32.dll
#include <windows.h>
BOOL TxfLogRecordGetGenericType(
void* RecordBuffer,
DWORD RecordBufferLengthInBytes,
DWORD* GenericType,
LONGLONG* VirtualClock // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("txfw32.dll", ExactSpelling = true)]
static extern bool TxfLogRecordGetGenericType(
IntPtr RecordBuffer, // void*
uint RecordBufferLengthInBytes, // DWORD
out uint GenericType, // DWORD* out
IntPtr VirtualClock // LONGLONG* optional, out
);<DllImport("txfw32.dll", ExactSpelling:=True)>
Public Shared Function TxfLogRecordGetGenericType(
RecordBuffer As IntPtr, ' void*
RecordBufferLengthInBytes As UInteger, ' DWORD
<Out> ByRef GenericType As UInteger, ' DWORD* out
VirtualClock As IntPtr ' LONGLONG* optional, out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' RecordBuffer : void*
' RecordBufferLengthInBytes : DWORD
' GenericType : DWORD* out
' VirtualClock : LONGLONG* optional, out
Declare PtrSafe Function TxfLogRecordGetGenericType Lib "txfw32" ( _
ByVal RecordBuffer As LongPtr, _
ByVal RecordBufferLengthInBytes As Long, _
ByRef GenericType As Long, _
ByVal VirtualClock As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
TxfLogRecordGetGenericType = ctypes.windll.txfw32.TxfLogRecordGetGenericType
TxfLogRecordGetGenericType.restype = wintypes.BOOL
TxfLogRecordGetGenericType.argtypes = [
ctypes.POINTER(None), # RecordBuffer : void*
wintypes.DWORD, # RecordBufferLengthInBytes : DWORD
ctypes.POINTER(wintypes.DWORD), # GenericType : DWORD* out
ctypes.POINTER(ctypes.c_longlong), # VirtualClock : LONGLONG* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('txfw32.dll')
TxfLogRecordGetGenericType = Fiddle::Function.new(
lib['TxfLogRecordGetGenericType'],
[
Fiddle::TYPE_VOIDP, # RecordBuffer : void*
-Fiddle::TYPE_INT, # RecordBufferLengthInBytes : DWORD
Fiddle::TYPE_VOIDP, # GenericType : DWORD* out
Fiddle::TYPE_VOIDP, # VirtualClock : LONGLONG* optional, out
],
Fiddle::TYPE_INT)#[link(name = "txfw32")]
extern "system" {
fn TxfLogRecordGetGenericType(
RecordBuffer: *mut (), // void*
RecordBufferLengthInBytes: u32, // DWORD
GenericType: *mut u32, // DWORD* out
VirtualClock: *mut i64 // LONGLONG* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("txfw32.dll")]
public static extern bool TxfLogRecordGetGenericType(IntPtr RecordBuffer, uint RecordBufferLengthInBytes, out uint GenericType, IntPtr VirtualClock);
"@
$api = Add-Type -MemberDefinition $sig -Name 'txfw32_TxfLogRecordGetGenericType' -Namespace Win32 -PassThru
# $api::TxfLogRecordGetGenericType(RecordBuffer, RecordBufferLengthInBytes, GenericType, VirtualClock)#uselib "txfw32.dll"
#func global TxfLogRecordGetGenericType "TxfLogRecordGetGenericType" sptr, sptr, sptr, sptr
; TxfLogRecordGetGenericType RecordBuffer, RecordBufferLengthInBytes, varptr(GenericType), varptr(VirtualClock) ; 戻り値は stat
; RecordBuffer : void* -> "sptr"
; RecordBufferLengthInBytes : DWORD -> "sptr"
; GenericType : DWORD* out -> "sptr"
; VirtualClock : LONGLONG* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "txfw32.dll" #cfunc global TxfLogRecordGetGenericType "TxfLogRecordGetGenericType" sptr, int, var, var ; res = TxfLogRecordGetGenericType(RecordBuffer, RecordBufferLengthInBytes, GenericType, VirtualClock) ; RecordBuffer : void* -> "sptr" ; RecordBufferLengthInBytes : DWORD -> "int" ; GenericType : DWORD* out -> "var" ; VirtualClock : LONGLONG* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "txfw32.dll" #cfunc global TxfLogRecordGetGenericType "TxfLogRecordGetGenericType" sptr, int, sptr, sptr ; res = TxfLogRecordGetGenericType(RecordBuffer, RecordBufferLengthInBytes, varptr(GenericType), varptr(VirtualClock)) ; RecordBuffer : void* -> "sptr" ; RecordBufferLengthInBytes : DWORD -> "int" ; GenericType : DWORD* out -> "sptr" ; VirtualClock : LONGLONG* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL TxfLogRecordGetGenericType(void* RecordBuffer, DWORD RecordBufferLengthInBytes, DWORD* GenericType, LONGLONG* VirtualClock) #uselib "txfw32.dll" #cfunc global TxfLogRecordGetGenericType "TxfLogRecordGetGenericType" intptr, int, var, var ; res = TxfLogRecordGetGenericType(RecordBuffer, RecordBufferLengthInBytes, GenericType, VirtualClock) ; RecordBuffer : void* -> "intptr" ; RecordBufferLengthInBytes : DWORD -> "int" ; GenericType : DWORD* out -> "var" ; VirtualClock : LONGLONG* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL TxfLogRecordGetGenericType(void* RecordBuffer, DWORD RecordBufferLengthInBytes, DWORD* GenericType, LONGLONG* VirtualClock) #uselib "txfw32.dll" #cfunc global TxfLogRecordGetGenericType "TxfLogRecordGetGenericType" intptr, int, intptr, intptr ; res = TxfLogRecordGetGenericType(RecordBuffer, RecordBufferLengthInBytes, varptr(GenericType), varptr(VirtualClock)) ; RecordBuffer : void* -> "intptr" ; RecordBufferLengthInBytes : DWORD -> "int" ; GenericType : DWORD* out -> "intptr" ; VirtualClock : LONGLONG* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
txfw32 = windows.NewLazySystemDLL("txfw32.dll")
procTxfLogRecordGetGenericType = txfw32.NewProc("TxfLogRecordGetGenericType")
)
// RecordBuffer (void*), RecordBufferLengthInBytes (DWORD), GenericType (DWORD* out), VirtualClock (LONGLONG* optional, out)
r1, _, err := procTxfLogRecordGetGenericType.Call(
uintptr(RecordBuffer),
uintptr(RecordBufferLengthInBytes),
uintptr(GenericType),
uintptr(VirtualClock),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction TxfLogRecordGetGenericType(
RecordBuffer: Pointer; // void*
RecordBufferLengthInBytes: DWORD; // DWORD
GenericType: Pointer; // DWORD* out
VirtualClock: Pointer // LONGLONG* optional, out
): BOOL; stdcall;
external 'txfw32.dll' name 'TxfLogRecordGetGenericType';result := DllCall("txfw32\TxfLogRecordGetGenericType"
, "Ptr", RecordBuffer ; void*
, "UInt", RecordBufferLengthInBytes ; DWORD
, "Ptr", GenericType ; DWORD* out
, "Ptr", VirtualClock ; LONGLONG* optional, out
, "Int") ; return: BOOL●TxfLogRecordGetGenericType(RecordBuffer, RecordBufferLengthInBytes, GenericType, VirtualClock) = DLL("txfw32.dll", "bool TxfLogRecordGetGenericType(void*, dword, void*, void*)")
# 呼び出し: TxfLogRecordGetGenericType(RecordBuffer, RecordBufferLengthInBytes, GenericType, VirtualClock)
# RecordBuffer : void* -> "void*"
# RecordBufferLengthInBytes : DWORD -> "dword"
# GenericType : DWORD* out -> "void*"
# VirtualClock : LONGLONG* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "txfw32" fn TxfLogRecordGetGenericType(
RecordBuffer: ?*anyopaque, // void*
RecordBufferLengthInBytes: u32, // DWORD
GenericType: [*c]u32, // DWORD* out
VirtualClock: [*c]i64 // LONGLONG* optional, out
) callconv(std.os.windows.WINAPI) i32;proc TxfLogRecordGetGenericType(
RecordBuffer: pointer, # void*
RecordBufferLengthInBytes: uint32, # DWORD
GenericType: ptr uint32, # DWORD* out
VirtualClock: ptr int64 # LONGLONG* optional, out
): int32 {.importc: "TxfLogRecordGetGenericType", stdcall, dynlib: "txfw32.dll".}pragma(lib, "txfw32");
extern(Windows)
int TxfLogRecordGetGenericType(
void* RecordBuffer, // void*
uint RecordBufferLengthInBytes, // DWORD
uint* GenericType, // DWORD* out
long* VirtualClock // LONGLONG* optional, out
);ccall((:TxfLogRecordGetGenericType, "txfw32.dll"), stdcall, Int32,
(Ptr{Cvoid}, UInt32, Ptr{UInt32}, Ptr{Int64}),
RecordBuffer, RecordBufferLengthInBytes, GenericType, VirtualClock)
# RecordBuffer : void* -> Ptr{Cvoid}
# RecordBufferLengthInBytes : DWORD -> UInt32
# GenericType : DWORD* out -> Ptr{UInt32}
# VirtualClock : LONGLONG* optional, out -> Ptr{Int64}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t TxfLogRecordGetGenericType(
void* RecordBuffer,
uint32_t RecordBufferLengthInBytes,
uint32_t* GenericType,
int64_t* VirtualClock);
]]
local txfw32 = ffi.load("txfw32")
-- txfw32.TxfLogRecordGetGenericType(RecordBuffer, RecordBufferLengthInBytes, GenericType, VirtualClock)
-- RecordBuffer : void*
-- RecordBufferLengthInBytes : DWORD
-- GenericType : DWORD* out
-- VirtualClock : LONGLONG* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('txfw32.dll');
const TxfLogRecordGetGenericType = lib.func('__stdcall', 'TxfLogRecordGetGenericType', 'int32_t', ['void *', 'uint32_t', 'uint32_t *', 'int64_t *']);
// TxfLogRecordGetGenericType(RecordBuffer, RecordBufferLengthInBytes, GenericType, VirtualClock)
// RecordBuffer : void* -> 'void *'
// RecordBufferLengthInBytes : DWORD -> 'uint32_t'
// GenericType : DWORD* out -> 'uint32_t *'
// VirtualClock : LONGLONG* optional, out -> 'int64_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("txfw32.dll", {
TxfLogRecordGetGenericType: { parameters: ["pointer", "u32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.TxfLogRecordGetGenericType(RecordBuffer, RecordBufferLengthInBytes, GenericType, VirtualClock)
// RecordBuffer : void* -> "pointer"
// RecordBufferLengthInBytes : DWORD -> "u32"
// GenericType : DWORD* out -> "pointer"
// VirtualClock : LONGLONG* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t TxfLogRecordGetGenericType(
void* RecordBuffer,
uint32_t RecordBufferLengthInBytes,
uint32_t* GenericType,
int64_t* VirtualClock);
C, "txfw32.dll");
// $ffi->TxfLogRecordGetGenericType(RecordBuffer, RecordBufferLengthInBytes, GenericType, VirtualClock);
// RecordBuffer : void*
// RecordBufferLengthInBytes : DWORD
// GenericType : DWORD* out
// VirtualClock : LONGLONG* optional, out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Txfw32 extends StdCallLibrary {
Txfw32 INSTANCE = Native.load("txfw32", Txfw32.class);
boolean TxfLogRecordGetGenericType(
Pointer RecordBuffer, // void*
int RecordBufferLengthInBytes, // DWORD
IntByReference GenericType, // DWORD* out
LongByReference VirtualClock // LONGLONG* optional, out
);
}@[Link("txfw32")]
lib Libtxfw32
fun TxfLogRecordGetGenericType = TxfLogRecordGetGenericType(
RecordBuffer : Void*, # void*
RecordBufferLengthInBytes : UInt32, # DWORD
GenericType : UInt32*, # DWORD* out
VirtualClock : Int64* # LONGLONG* optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef TxfLogRecordGetGenericTypeNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Uint32>, Pointer<Int64>);
typedef TxfLogRecordGetGenericTypeDart = int Function(Pointer<Void>, int, Pointer<Uint32>, Pointer<Int64>);
final TxfLogRecordGetGenericType = DynamicLibrary.open('txfw32.dll')
.lookupFunction<TxfLogRecordGetGenericTypeNative, TxfLogRecordGetGenericTypeDart>('TxfLogRecordGetGenericType');
// RecordBuffer : void* -> Pointer<Void>
// RecordBufferLengthInBytes : DWORD -> Uint32
// GenericType : DWORD* out -> Pointer<Uint32>
// VirtualClock : LONGLONG* optional, out -> Pointer<Int64>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function TxfLogRecordGetGenericType(
RecordBuffer: Pointer; // void*
RecordBufferLengthInBytes: DWORD; // DWORD
GenericType: Pointer; // DWORD* out
VirtualClock: Pointer // LONGLONG* optional, out
): BOOL; stdcall;
external 'txfw32.dll' name 'TxfLogRecordGetGenericType';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "TxfLogRecordGetGenericType"
c_TxfLogRecordGetGenericType :: Ptr () -> Word32 -> Ptr Word32 -> Ptr Int64 -> IO CInt
-- RecordBuffer : void* -> Ptr ()
-- RecordBufferLengthInBytes : DWORD -> Word32
-- GenericType : DWORD* out -> Ptr Word32
-- VirtualClock : LONGLONG* optional, out -> Ptr Int64
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let txflogrecordgetgenerictype =
foreign "TxfLogRecordGetGenericType"
((ptr void) @-> uint32_t @-> (ptr uint32_t) @-> (ptr int64_t) @-> returning int32_t)
(* RecordBuffer : void* -> (ptr void) *)
(* RecordBufferLengthInBytes : DWORD -> uint32_t *)
(* GenericType : DWORD* out -> (ptr uint32_t) *)
(* VirtualClock : LONGLONG* optional, out -> (ptr int64_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library txfw32 (t "txfw32.dll"))
(cffi:use-foreign-library txfw32)
(cffi:defcfun ("TxfLogRecordGetGenericType" txf-log-record-get-generic-type :convention :stdcall) :int32
(record-buffer :pointer) ; void*
(record-buffer-length-in-bytes :uint32) ; DWORD
(generic-type :pointer) ; DWORD* out
(virtual-clock :pointer)) ; LONGLONG* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $TxfLogRecordGetGenericType = Win32::API::More->new('txfw32',
'BOOL TxfLogRecordGetGenericType(LPVOID RecordBuffer, DWORD RecordBufferLengthInBytes, LPVOID GenericType, LPVOID VirtualClock)');
# my $ret = $TxfLogRecordGetGenericType->Call($RecordBuffer, $RecordBufferLengthInBytes, $GenericType, $VirtualClock);
# RecordBuffer : void* -> LPVOID
# RecordBufferLengthInBytes : DWORD -> DWORD
# GenericType : DWORD* out -> LPVOID
# VirtualClock : LONGLONG* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。