ホーム › Storage.FileSystem › FlushLogBuffers
FlushLogBuffers
関数CLFSログのバッファをディスクへフラッシュする。
シグネチャ
// clfsw32.dll
#include <windows.h>
BOOL FlushLogBuffers(
void* pvMarshal,
OVERLAPPED* pOverlapped // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pvMarshal | void* | in |
| pOverlapped | OVERLAPPED* | inoutoptional |
戻り値の型: BOOL
各言語での呼び出し定義
// clfsw32.dll
#include <windows.h>
BOOL FlushLogBuffers(
void* pvMarshal,
OVERLAPPED* pOverlapped // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("clfsw32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool FlushLogBuffers(
IntPtr pvMarshal, // void*
IntPtr pOverlapped // OVERLAPPED* optional, in/out
);<DllImport("clfsw32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FlushLogBuffers(
pvMarshal As IntPtr, ' void*
pOverlapped As IntPtr ' OVERLAPPED* optional, in/out
) As Boolean
End Function' pvMarshal : void*
' pOverlapped : OVERLAPPED* optional, in/out
Declare PtrSafe Function FlushLogBuffers Lib "clfsw32" ( _
ByVal pvMarshal As LongPtr, _
ByVal pOverlapped As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FlushLogBuffers = ctypes.windll.clfsw32.FlushLogBuffers
FlushLogBuffers.restype = wintypes.BOOL
FlushLogBuffers.argtypes = [
ctypes.POINTER(None), # pvMarshal : void*
ctypes.c_void_p, # pOverlapped : OVERLAPPED* optional, in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('clfsw32.dll')
FlushLogBuffers = Fiddle::Function.new(
lib['FlushLogBuffers'],
[
Fiddle::TYPE_VOIDP, # pvMarshal : void*
Fiddle::TYPE_VOIDP, # pOverlapped : OVERLAPPED* optional, in/out
],
Fiddle::TYPE_INT)#[link(name = "clfsw32")]
extern "system" {
fn FlushLogBuffers(
pvMarshal: *mut (), // void*
pOverlapped: *mut OVERLAPPED // OVERLAPPED* optional, in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("clfsw32.dll", SetLastError = true)]
public static extern bool FlushLogBuffers(IntPtr pvMarshal, IntPtr pOverlapped);
"@
$api = Add-Type -MemberDefinition $sig -Name 'clfsw32_FlushLogBuffers' -Namespace Win32 -PassThru
# $api::FlushLogBuffers(pvMarshal, pOverlapped)#uselib "clfsw32.dll"
#func global FlushLogBuffers "FlushLogBuffers" sptr, sptr
; FlushLogBuffers pvMarshal, varptr(pOverlapped) ; 戻り値は stat
; pvMarshal : void* -> "sptr"
; pOverlapped : OVERLAPPED* optional, in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "clfsw32.dll" #cfunc global FlushLogBuffers "FlushLogBuffers" sptr, var ; res = FlushLogBuffers(pvMarshal, pOverlapped) ; pvMarshal : void* -> "sptr" ; pOverlapped : OVERLAPPED* optional, in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "clfsw32.dll" #cfunc global FlushLogBuffers "FlushLogBuffers" sptr, sptr ; res = FlushLogBuffers(pvMarshal, varptr(pOverlapped)) ; pvMarshal : void* -> "sptr" ; pOverlapped : OVERLAPPED* optional, in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL FlushLogBuffers(void* pvMarshal, OVERLAPPED* pOverlapped) #uselib "clfsw32.dll" #cfunc global FlushLogBuffers "FlushLogBuffers" intptr, var ; res = FlushLogBuffers(pvMarshal, pOverlapped) ; pvMarshal : void* -> "intptr" ; pOverlapped : OVERLAPPED* optional, in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL FlushLogBuffers(void* pvMarshal, OVERLAPPED* pOverlapped) #uselib "clfsw32.dll" #cfunc global FlushLogBuffers "FlushLogBuffers" intptr, intptr ; res = FlushLogBuffers(pvMarshal, varptr(pOverlapped)) ; pvMarshal : void* -> "intptr" ; pOverlapped : OVERLAPPED* optional, in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clfsw32 = windows.NewLazySystemDLL("clfsw32.dll")
procFlushLogBuffers = clfsw32.NewProc("FlushLogBuffers")
)
// pvMarshal (void*), pOverlapped (OVERLAPPED* optional, in/out)
r1, _, err := procFlushLogBuffers.Call(
uintptr(pvMarshal),
uintptr(pOverlapped),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction FlushLogBuffers(
pvMarshal: Pointer; // void*
pOverlapped: Pointer // OVERLAPPED* optional, in/out
): BOOL; stdcall;
external 'clfsw32.dll' name 'FlushLogBuffers';result := DllCall("clfsw32\FlushLogBuffers"
, "Ptr", pvMarshal ; void*
, "Ptr", pOverlapped ; OVERLAPPED* optional, in/out
, "Int") ; return: BOOL●FlushLogBuffers(pvMarshal, pOverlapped) = DLL("clfsw32.dll", "bool FlushLogBuffers(void*, void*)")
# 呼び出し: FlushLogBuffers(pvMarshal, pOverlapped)
# pvMarshal : void* -> "void*"
# pOverlapped : OVERLAPPED* optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。