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

AdvanceLogBase

関数
CLFSログのベースLSNを指定位置まで前進させる。
DLLclfsw32.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

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

BOOL AdvanceLogBase(
    void* pvMarshal,
    CLS_LSN* plsnBase,
    DWORD fFlags,
    OVERLAPPED* pOverlapped
);

パラメーター

名前方向説明
pvMarshalvoid*inoutCreateLogMarshallingArea の呼び出しが成功したときに返されるマーシャリング コンテキストへのポインターです。
plsnBaseCLS_LSN*inout

pvMarshal で指定したログの新しいベース LSN です。

この LSN は、ログの現在のベース LSN から最後の LSN までの範囲 (両端を含む) になければなりません。

fFlagsDWORDinこのパラメーターは現時点では実装されておらず、ゼロでなければなりません。
pOverlappedOVERLAPPED*inout

非同期操作に必要な OVERLAPPED 構造体へのポインターです。

非同期操作を使用しない場合、このパラメーターは NULL にできます。

戻り値の型: BOOL

公式ドキュメント

ログ ストリームのベース ログ シーケンス番号 (LSN) を、指定した LSN まで進めます。

戻り値

関数が成功した場合、戻り値は 0 以外になります。

関数が失敗した場合、戻り値は 0 になります。詳細なエラー情報を取得するには、 GetLastError を呼び出します。

次の一覧に、発生し得るエラー コードを示します。

解説(Remarks)

AdvanceLogBase は、呼び出されたときにデータおよびメタデータをフラッシュする場合があります。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

BOOL AdvanceLogBase(
    void* pvMarshal,
    CLS_LSN* plsnBase,
    DWORD fFlags,
    OVERLAPPED* pOverlapped
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("clfsw32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool AdvanceLogBase(
    IntPtr pvMarshal,   // void* in/out
    IntPtr plsnBase,   // CLS_LSN* in/out
    uint fFlags,   // DWORD
    IntPtr pOverlapped   // OVERLAPPED* in/out
);
<DllImport("clfsw32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function AdvanceLogBase(
    pvMarshal As IntPtr,   ' void* in/out
    plsnBase As IntPtr,   ' CLS_LSN* in/out
    fFlags As UInteger,   ' DWORD
    pOverlapped As IntPtr   ' OVERLAPPED* in/out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' pvMarshal : void* in/out
' plsnBase : CLS_LSN* in/out
' fFlags : DWORD
' pOverlapped : OVERLAPPED* in/out
Declare PtrSafe Function AdvanceLogBase Lib "clfsw32" ( _
    ByVal pvMarshal As LongPtr, _
    ByVal plsnBase As LongPtr, _
    ByVal fFlags As Long, _
    ByVal pOverlapped As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

AdvanceLogBase = ctypes.windll.clfsw32.AdvanceLogBase
AdvanceLogBase.restype = wintypes.BOOL
AdvanceLogBase.argtypes = [
    ctypes.POINTER(None),  # pvMarshal : void* in/out
    ctypes.c_void_p,  # plsnBase : CLS_LSN* in/out
    wintypes.DWORD,  # fFlags : DWORD
    ctypes.c_void_p,  # pOverlapped : OVERLAPPED* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('clfsw32.dll')
AdvanceLogBase = Fiddle::Function.new(
  lib['AdvanceLogBase'],
  [
    Fiddle::TYPE_VOIDP,  # pvMarshal : void* in/out
    Fiddle::TYPE_VOIDP,  # plsnBase : CLS_LSN* in/out
    -Fiddle::TYPE_INT,  # fFlags : DWORD
    Fiddle::TYPE_VOIDP,  # pOverlapped : OVERLAPPED* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "clfsw32")]
extern "system" {
    fn AdvanceLogBase(
        pvMarshal: *mut (),  // void* in/out
        plsnBase: *mut CLS_LSN,  // CLS_LSN* in/out
        fFlags: u32,  // DWORD
        pOverlapped: *mut OVERLAPPED  // OVERLAPPED* 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 AdvanceLogBase(IntPtr pvMarshal, IntPtr plsnBase, uint fFlags, IntPtr pOverlapped);
"@
$api = Add-Type -MemberDefinition $sig -Name 'clfsw32_AdvanceLogBase' -Namespace Win32 -PassThru
# $api::AdvanceLogBase(pvMarshal, plsnBase, fFlags, pOverlapped)
#uselib "clfsw32.dll"
#func global AdvanceLogBase "AdvanceLogBase" sptr, sptr, sptr, sptr
; AdvanceLogBase pvMarshal, varptr(plsnBase), fFlags, varptr(pOverlapped)   ; 戻り値は stat
; pvMarshal : void* in/out -> "sptr"
; plsnBase : CLS_LSN* in/out -> "sptr"
; fFlags : DWORD -> "sptr"
; pOverlapped : OVERLAPPED* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "clfsw32.dll"
#cfunc global AdvanceLogBase "AdvanceLogBase" sptr, var, int, var
; res = AdvanceLogBase(pvMarshal, plsnBase, fFlags, pOverlapped)
; pvMarshal : void* in/out -> "sptr"
; plsnBase : CLS_LSN* in/out -> "var"
; fFlags : DWORD -> "int"
; pOverlapped : OVERLAPPED* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL AdvanceLogBase(void* pvMarshal, CLS_LSN* plsnBase, DWORD fFlags, OVERLAPPED* pOverlapped)
#uselib "clfsw32.dll"
#cfunc global AdvanceLogBase "AdvanceLogBase" intptr, var, int, var
; res = AdvanceLogBase(pvMarshal, plsnBase, fFlags, pOverlapped)
; pvMarshal : void* in/out -> "intptr"
; plsnBase : CLS_LSN* in/out -> "var"
; fFlags : DWORD -> "int"
; pOverlapped : OVERLAPPED* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clfsw32 = windows.NewLazySystemDLL("clfsw32.dll")
	procAdvanceLogBase = clfsw32.NewProc("AdvanceLogBase")
)

// pvMarshal (void* in/out), plsnBase (CLS_LSN* in/out), fFlags (DWORD), pOverlapped (OVERLAPPED* in/out)
r1, _, err := procAdvanceLogBase.Call(
	uintptr(pvMarshal),
	uintptr(plsnBase),
	uintptr(fFlags),
	uintptr(pOverlapped),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function AdvanceLogBase(
  pvMarshal: Pointer;   // void* in/out
  plsnBase: Pointer;   // CLS_LSN* in/out
  fFlags: DWORD;   // DWORD
  pOverlapped: Pointer   // OVERLAPPED* in/out
): BOOL; stdcall;
  external 'clfsw32.dll' name 'AdvanceLogBase';
result := DllCall("clfsw32\AdvanceLogBase"
    , "Ptr", pvMarshal   ; void* in/out
    , "Ptr", plsnBase   ; CLS_LSN* in/out
    , "UInt", fFlags   ; DWORD
    , "Ptr", pOverlapped   ; OVERLAPPED* in/out
    , "Int")   ; return: BOOL
●AdvanceLogBase(pvMarshal, plsnBase, fFlags, pOverlapped) = DLL("clfsw32.dll", "bool AdvanceLogBase(void*, void*, dword, void*)")
# 呼び出し: AdvanceLogBase(pvMarshal, plsnBase, fFlags, pOverlapped)
# pvMarshal : void* in/out -> "void*"
# plsnBase : CLS_LSN* in/out -> "void*"
# fFlags : DWORD -> "dword"
# pOverlapped : OVERLAPPED* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "clfsw32" fn AdvanceLogBase(
    pvMarshal: ?*anyopaque, // void* in/out
    plsnBase: [*c]CLS_LSN, // CLS_LSN* in/out
    fFlags: u32, // DWORD
    pOverlapped: [*c]OVERLAPPED // OVERLAPPED* in/out
) callconv(std.os.windows.WINAPI) i32;
proc AdvanceLogBase(
    pvMarshal: pointer,  # void* in/out
    plsnBase: ptr CLS_LSN,  # CLS_LSN* in/out
    fFlags: uint32,  # DWORD
    pOverlapped: ptr OVERLAPPED  # OVERLAPPED* in/out
): int32 {.importc: "AdvanceLogBase", stdcall, dynlib: "clfsw32.dll".}
pragma(lib, "clfsw32");
extern(Windows)
int AdvanceLogBase(
    void* pvMarshal,   // void* in/out
    CLS_LSN* plsnBase,   // CLS_LSN* in/out
    uint fFlags,   // DWORD
    OVERLAPPED* pOverlapped   // OVERLAPPED* in/out
);
ccall((:AdvanceLogBase, "clfsw32.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{CLS_LSN}, UInt32, Ptr{OVERLAPPED}),
      pvMarshal, plsnBase, fFlags, pOverlapped)
# pvMarshal : void* in/out -> Ptr{Cvoid}
# plsnBase : CLS_LSN* in/out -> Ptr{CLS_LSN}
# fFlags : DWORD -> UInt32
# pOverlapped : OVERLAPPED* in/out -> Ptr{OVERLAPPED}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t AdvanceLogBase(
    void* pvMarshal,
    void* plsnBase,
    uint32_t fFlags,
    void* pOverlapped);
]]
local clfsw32 = ffi.load("clfsw32")
-- clfsw32.AdvanceLogBase(pvMarshal, plsnBase, fFlags, pOverlapped)
-- pvMarshal : void* in/out
-- plsnBase : CLS_LSN* in/out
-- fFlags : DWORD
-- pOverlapped : OVERLAPPED* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('clfsw32.dll');
const AdvanceLogBase = lib.func('__stdcall', 'AdvanceLogBase', 'int32_t', ['void *', 'void *', 'uint32_t', 'void *']);
// AdvanceLogBase(pvMarshal, plsnBase, fFlags, pOverlapped)
// pvMarshal : void* in/out -> 'void *'
// plsnBase : CLS_LSN* in/out -> 'void *'
// fFlags : DWORD -> 'uint32_t'
// pOverlapped : OVERLAPPED* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("clfsw32.dll", {
  AdvanceLogBase: { parameters: ["pointer", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.AdvanceLogBase(pvMarshal, plsnBase, fFlags, pOverlapped)
// pvMarshal : void* in/out -> "pointer"
// plsnBase : CLS_LSN* in/out -> "pointer"
// fFlags : DWORD -> "u32"
// pOverlapped : OVERLAPPED* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t AdvanceLogBase(
    void* pvMarshal,
    void* plsnBase,
    uint32_t fFlags,
    void* pOverlapped);
C, "clfsw32.dll");
// $ffi->AdvanceLogBase(pvMarshal, plsnBase, fFlags, pOverlapped);
// pvMarshal : void* in/out
// plsnBase : CLS_LSN* in/out
// fFlags : DWORD
// pOverlapped : OVERLAPPED* in/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 Clfsw32 extends StdCallLibrary {
    Clfsw32 INSTANCE = Native.load("clfsw32", Clfsw32.class);
    boolean AdvanceLogBase(
        Pointer pvMarshal,   // void* in/out
        Pointer plsnBase,   // CLS_LSN* in/out
        int fFlags,   // DWORD
        Pointer pOverlapped   // OVERLAPPED* in/out
    );
}
@[Link("clfsw32")]
lib Libclfsw32
  fun AdvanceLogBase = AdvanceLogBase(
    pvMarshal : Void*,   # void* in/out
    plsnBase : CLS_LSN*,   # CLS_LSN* in/out
    fFlags : UInt32,   # DWORD
    pOverlapped : OVERLAPPED*   # OVERLAPPED* in/out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef AdvanceLogBaseNative = Int32 Function(Pointer<Void>, Pointer<Void>, Uint32, Pointer<Void>);
typedef AdvanceLogBaseDart = int Function(Pointer<Void>, Pointer<Void>, int, Pointer<Void>);
final AdvanceLogBase = DynamicLibrary.open('clfsw32.dll')
    .lookupFunction<AdvanceLogBaseNative, AdvanceLogBaseDart>('AdvanceLogBase');
// pvMarshal : void* in/out -> Pointer<Void>
// plsnBase : CLS_LSN* in/out -> Pointer<Void>
// fFlags : DWORD -> Uint32
// pOverlapped : OVERLAPPED* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function AdvanceLogBase(
  pvMarshal: Pointer;   // void* in/out
  plsnBase: Pointer;   // CLS_LSN* in/out
  fFlags: DWORD;   // DWORD
  pOverlapped: Pointer   // OVERLAPPED* in/out
): BOOL; stdcall;
  external 'clfsw32.dll' name 'AdvanceLogBase';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "AdvanceLogBase"
  c_AdvanceLogBase :: Ptr () -> Ptr () -> Word32 -> Ptr () -> IO CInt
-- pvMarshal : void* in/out -> Ptr ()
-- plsnBase : CLS_LSN* in/out -> Ptr ()
-- fFlags : DWORD -> Word32
-- pOverlapped : OVERLAPPED* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let advancelogbase =
  foreign "AdvanceLogBase"
    ((ptr void) @-> (ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* pvMarshal : void* in/out -> (ptr void) *)
(* plsnBase : CLS_LSN* in/out -> (ptr void) *)
(* fFlags : DWORD -> uint32_t *)
(* pOverlapped : OVERLAPPED* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library clfsw32 (t "clfsw32.dll"))
(cffi:use-foreign-library clfsw32)

(cffi:defcfun ("AdvanceLogBase" advance-log-base :convention :stdcall) :int32
  (pv-marshal :pointer)   ; void* in/out
  (plsn-base :pointer)   ; CLS_LSN* in/out
  (f-flags :uint32)   ; DWORD
  (p-overlapped :pointer))   ; OVERLAPPED* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $AdvanceLogBase = Win32::API::More->new('clfsw32',
    'BOOL AdvanceLogBase(LPVOID pvMarshal, LPVOID plsnBase, DWORD fFlags, LPVOID pOverlapped)');
# my $ret = $AdvanceLogBase->Call($pvMarshal, $plsnBase, $fFlags, $pOverlapped);
# pvMarshal : void* in/out -> LPVOID
# plsnBase : CLS_LSN* in/out -> LPVOID
# fFlags : DWORD -> DWORD
# pOverlapped : OVERLAPPED* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型