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

GetLogReservationInfo

関数
CLFSマーシャリング領域の予約情報を取得する。
DLLclfsw32.dll呼出規約winapi

シグネチャ

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

BOOL GetLogReservationInfo(
    void* pvMarshal,
    DWORD* pcbRecordNumber,
    LONGLONG* pcbUserReservation,
    LONGLONG* pcbCommitReservation
);

パラメーター

名前方向説明
pvMarshalvoid*in対象ログのマーシャリング領域コンテキストを指すポインタ。操作対象を示す。
pcbRecordNumberDWORD*out予約済みレコード数を受け取る出力ポインタ。
pcbUserReservationLONGLONG*outユーザー予約バイト数を受け取る出力ポインタ。
pcbCommitReservationLONGLONG*outコミット予約バイト数を受け取る出力ポインタ。

戻り値の型: BOOL

各言語での呼び出し定義

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

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

GetLogReservationInfo = ctypes.windll.clfsw32.GetLogReservationInfo
GetLogReservationInfo.restype = wintypes.BOOL
GetLogReservationInfo.argtypes = [
    ctypes.POINTER(None),  # pvMarshal : void*
    ctypes.POINTER(wintypes.DWORD),  # pcbRecordNumber : DWORD* out
    ctypes.POINTER(ctypes.c_longlong),  # pcbUserReservation : LONGLONG* out
    ctypes.POINTER(ctypes.c_longlong),  # pcbCommitReservation : LONGLONG* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('clfsw32.dll')
GetLogReservationInfo = Fiddle::Function.new(
  lib['GetLogReservationInfo'],
  [
    Fiddle::TYPE_VOIDP,  # pvMarshal : void*
    Fiddle::TYPE_VOIDP,  # pcbRecordNumber : DWORD* out
    Fiddle::TYPE_VOIDP,  # pcbUserReservation : LONGLONG* out
    Fiddle::TYPE_VOIDP,  # pcbCommitReservation : LONGLONG* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "clfsw32")]
extern "system" {
    fn GetLogReservationInfo(
        pvMarshal: *mut (),  // void*
        pcbRecordNumber: *mut u32,  // DWORD* out
        pcbUserReservation: *mut i64,  // LONGLONG* out
        pcbCommitReservation: *mut i64  // LONGLONG* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("clfsw32.dll")]
public static extern bool GetLogReservationInfo(IntPtr pvMarshal, out uint pcbRecordNumber, out long pcbUserReservation, out long pcbCommitReservation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'clfsw32_GetLogReservationInfo' -Namespace Win32 -PassThru
# $api::GetLogReservationInfo(pvMarshal, pcbRecordNumber, pcbUserReservation, pcbCommitReservation)
#uselib "clfsw32.dll"
#func global GetLogReservationInfo "GetLogReservationInfo" sptr, sptr, sptr, sptr
; GetLogReservationInfo pvMarshal, varptr(pcbRecordNumber), varptr(pcbUserReservation), varptr(pcbCommitReservation)   ; 戻り値は stat
; pvMarshal : void* -> "sptr"
; pcbRecordNumber : DWORD* out -> "sptr"
; pcbUserReservation : LONGLONG* out -> "sptr"
; pcbCommitReservation : LONGLONG* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "clfsw32.dll"
#cfunc global GetLogReservationInfo "GetLogReservationInfo" sptr, var, var, var
; res = GetLogReservationInfo(pvMarshal, pcbRecordNumber, pcbUserReservation, pcbCommitReservation)
; pvMarshal : void* -> "sptr"
; pcbRecordNumber : DWORD* out -> "var"
; pcbUserReservation : LONGLONG* out -> "var"
; pcbCommitReservation : LONGLONG* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL GetLogReservationInfo(void* pvMarshal, DWORD* pcbRecordNumber, LONGLONG* pcbUserReservation, LONGLONG* pcbCommitReservation)
#uselib "clfsw32.dll"
#cfunc global GetLogReservationInfo "GetLogReservationInfo" intptr, var, var, var
; res = GetLogReservationInfo(pvMarshal, pcbRecordNumber, pcbUserReservation, pcbCommitReservation)
; pvMarshal : void* -> "intptr"
; pcbRecordNumber : DWORD* out -> "var"
; pcbUserReservation : LONGLONG* out -> "var"
; pcbCommitReservation : LONGLONG* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clfsw32 = windows.NewLazySystemDLL("clfsw32.dll")
	procGetLogReservationInfo = clfsw32.NewProc("GetLogReservationInfo")
)

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

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

typedef GetLogReservationInfoNative = Int32 Function(Pointer<Void>, Pointer<Uint32>, Pointer<Int64>, Pointer<Int64>);
typedef GetLogReservationInfoDart = int Function(Pointer<Void>, Pointer<Uint32>, Pointer<Int64>, Pointer<Int64>);
final GetLogReservationInfo = DynamicLibrary.open('clfsw32.dll')
    .lookupFunction<GetLogReservationInfoNative, GetLogReservationInfoDart>('GetLogReservationInfo');
// pvMarshal : void* -> Pointer<Void>
// pcbRecordNumber : DWORD* out -> Pointer<Uint32>
// pcbUserReservation : LONGLONG* out -> Pointer<Int64>
// pcbCommitReservation : LONGLONG* out -> Pointer<Int64>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GetLogReservationInfo(
  pvMarshal: Pointer;   // void*
  pcbRecordNumber: Pointer;   // DWORD* out
  pcbUserReservation: Pointer;   // LONGLONG* out
  pcbCommitReservation: Pointer   // LONGLONG* out
): BOOL; stdcall;
  external 'clfsw32.dll' name 'GetLogReservationInfo';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GetLogReservationInfo"
  c_GetLogReservationInfo :: Ptr () -> Ptr Word32 -> Ptr Int64 -> Ptr Int64 -> IO CInt
-- pvMarshal : void* -> Ptr ()
-- pcbRecordNumber : DWORD* out -> Ptr Word32
-- pcbUserReservation : LONGLONG* out -> Ptr Int64
-- pcbCommitReservation : LONGLONG* out -> Ptr Int64
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let getlogreservationinfo =
  foreign "GetLogReservationInfo"
    ((ptr void) @-> (ptr uint32_t) @-> (ptr int64_t) @-> (ptr int64_t) @-> returning int32_t)
(* pvMarshal : void* -> (ptr void) *)
(* pcbRecordNumber : DWORD* out -> (ptr uint32_t) *)
(* pcbUserReservation : LONGLONG* out -> (ptr int64_t) *)
(* pcbCommitReservation : LONGLONG* out -> (ptr int64_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library clfsw32 (t "clfsw32.dll"))
(cffi:use-foreign-library clfsw32)

(cffi:defcfun ("GetLogReservationInfo" get-log-reservation-info :convention :stdcall) :int32
  (pv-marshal :pointer)   ; void*
  (pcb-record-number :pointer)   ; DWORD* out
  (pcb-user-reservation :pointer)   ; LONGLONG* out
  (pcb-commit-reservation :pointer))   ; LONGLONG* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GetLogReservationInfo = Win32::API::More->new('clfsw32',
    'BOOL GetLogReservationInfo(LPVOID pvMarshal, LPVOID pcbRecordNumber, LPVOID pcbUserReservation, LPVOID pcbCommitReservation)');
# my $ret = $GetLogReservationInfo->Call($pvMarshal, $pcbRecordNumber, $pcbUserReservation, $pcbCommitReservation);
# pvMarshal : void* -> LPVOID
# pcbRecordNumber : DWORD* out -> LPVOID
# pcbUserReservation : LONGLONG* out -> LPVOID
# pcbCommitReservation : LONGLONG* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。