ホーム › Storage.Cabinets › FCIFlushCabinet
FCIFlushCabinet
関数FCIで現在のキャビネットを書き出し確定する。
シグネチャ
// Cabinet.dll
#include <windows.h>
BOOL FCIFlushCabinet(
void* hfci,
BOOL fGetNextCab,
PFNFCIGETNEXTCABINET pfnfcignc,
PFNFCISTATUS pfnfcis
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hfci | void* | in | FCICreateで取得したFCIコンテキストハンドル。 |
| fGetNextCab | BOOL | in | 次のキャビネット情報を取得するかどうかのフラグ。TRUEで分割継続を促す。 |
| pfnfcignc | PFNFCIGETNEXTCABINET | in | 次のキャビネットを取得するためのコールバック関数ポインタ。 |
| pfnfcis | PFNFCISTATUS | in | 進捗状況を通知するステータスコールバック関数ポインタ。 |
戻り値の型: BOOL
各言語での呼び出し定義
// Cabinet.dll
#include <windows.h>
BOOL FCIFlushCabinet(
void* hfci,
BOOL fGetNextCab,
PFNFCIGETNEXTCABINET pfnfcignc,
PFNFCISTATUS pfnfcis
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Cabinet.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern bool FCIFlushCabinet(
IntPtr hfci, // void*
bool fGetNextCab, // BOOL
IntPtr pfnfcignc, // PFNFCIGETNEXTCABINET
IntPtr pfnfcis // PFNFCISTATUS
);<DllImport("Cabinet.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function FCIFlushCabinet(
hfci As IntPtr, ' void*
fGetNextCab As Boolean, ' BOOL
pfnfcignc As IntPtr, ' PFNFCIGETNEXTCABINET
pfnfcis As IntPtr ' PFNFCISTATUS
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hfci : void*
' fGetNextCab : BOOL
' pfnfcignc : PFNFCIGETNEXTCABINET
' pfnfcis : PFNFCISTATUS
Declare PtrSafe Function FCIFlushCabinet Lib "cabinet" ( _
ByVal hfci As LongPtr, _
ByVal fGetNextCab As Long, _
ByVal pfnfcignc As LongPtr, _
ByVal pfnfcis As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FCIFlushCabinet = ctypes.cdll.cabinet.FCIFlushCabinet
FCIFlushCabinet.restype = wintypes.BOOL
FCIFlushCabinet.argtypes = [
ctypes.POINTER(None), # hfci : void*
wintypes.BOOL, # fGetNextCab : BOOL
ctypes.c_void_p, # pfnfcignc : PFNFCIGETNEXTCABINET
ctypes.c_void_p, # pfnfcis : PFNFCISTATUS
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('Cabinet.dll')
FCIFlushCabinet = Fiddle::Function.new(
lib['FCIFlushCabinet'],
[
Fiddle::TYPE_VOIDP, # hfci : void*
Fiddle::TYPE_INT, # fGetNextCab : BOOL
Fiddle::TYPE_VOIDP, # pfnfcignc : PFNFCIGETNEXTCABINET
Fiddle::TYPE_VOIDP, # pfnfcis : PFNFCISTATUS
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "cabinet")]
extern "C" {
fn FCIFlushCabinet(
hfci: *mut (), // void*
fGetNextCab: i32, // BOOL
pfnfcignc: *const core::ffi::c_void, // PFNFCIGETNEXTCABINET
pfnfcis: *const core::ffi::c_void // PFNFCISTATUS
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Cabinet.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool FCIFlushCabinet(IntPtr hfci, bool fGetNextCab, IntPtr pfnfcignc, IntPtr pfnfcis);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Cabinet_FCIFlushCabinet' -Namespace Win32 -PassThru
# $api::FCIFlushCabinet(hfci, fGetNextCab, pfnfcignc, pfnfcis)#uselib "Cabinet.dll"
#func global FCIFlushCabinet "FCIFlushCabinet" sptr, sptr, sptr, sptr
; FCIFlushCabinet hfci, fGetNextCab, pfnfcignc, pfnfcis ; 戻り値は stat
; hfci : void* -> "sptr"
; fGetNextCab : BOOL -> "sptr"
; pfnfcignc : PFNFCIGETNEXTCABINET -> "sptr"
; pfnfcis : PFNFCISTATUS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "Cabinet.dll"
#cfunc global FCIFlushCabinet "FCIFlushCabinet" sptr, int, sptr, sptr
; res = FCIFlushCabinet(hfci, fGetNextCab, pfnfcignc, pfnfcis)
; hfci : void* -> "sptr"
; fGetNextCab : BOOL -> "int"
; pfnfcignc : PFNFCIGETNEXTCABINET -> "sptr"
; pfnfcis : PFNFCISTATUS -> "sptr"; BOOL FCIFlushCabinet(void* hfci, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
#uselib "Cabinet.dll"
#cfunc global FCIFlushCabinet "FCIFlushCabinet" intptr, int, intptr, intptr
; res = FCIFlushCabinet(hfci, fGetNextCab, pfnfcignc, pfnfcis)
; hfci : void* -> "intptr"
; fGetNextCab : BOOL -> "int"
; pfnfcignc : PFNFCIGETNEXTCABINET -> "intptr"
; pfnfcis : PFNFCISTATUS -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
cabinet = windows.NewLazySystemDLL("Cabinet.dll")
procFCIFlushCabinet = cabinet.NewProc("FCIFlushCabinet")
)
// hfci (void*), fGetNextCab (BOOL), pfnfcignc (PFNFCIGETNEXTCABINET), pfnfcis (PFNFCISTATUS)
r1, _, err := procFCIFlushCabinet.Call(
uintptr(hfci),
uintptr(fGetNextCab),
uintptr(pfnfcignc),
uintptr(pfnfcis),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction FCIFlushCabinet(
hfci: Pointer; // void*
fGetNextCab: BOOL; // BOOL
pfnfcignc: Pointer; // PFNFCIGETNEXTCABINET
pfnfcis: Pointer // PFNFCISTATUS
): BOOL; cdecl;
external 'Cabinet.dll' name 'FCIFlushCabinet';result := DllCall("Cabinet\FCIFlushCabinet"
, "Ptr", hfci ; void*
, "Int", fGetNextCab ; BOOL
, "Ptr", pfnfcignc ; PFNFCIGETNEXTCABINET
, "Ptr", pfnfcis ; PFNFCISTATUS
, "Cdecl Int") ; return: BOOL●FCIFlushCabinet(hfci, fGetNextCab, pfnfcignc, pfnfcis) = DLL("Cabinet.dll", "bool FCIFlushCabinet(void*, bool, void*, void*)")
# 呼び出し: FCIFlushCabinet(hfci, fGetNextCab, pfnfcignc, pfnfcis)
# hfci : void* -> "void*"
# fGetNextCab : BOOL -> "bool"
# pfnfcignc : PFNFCIGETNEXTCABINET -> "void*"
# pfnfcis : PFNFCISTATUS -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "cabinet" fn FCIFlushCabinet(
hfci: ?*anyopaque, // void*
fGetNextCab: i32, // BOOL
pfnfcignc: ?*anyopaque, // PFNFCIGETNEXTCABINET
pfnfcis: ?*anyopaque // PFNFCISTATUS
) callconv(.c) i32;proc FCIFlushCabinet(
hfci: pointer, # void*
fGetNextCab: int32, # BOOL
pfnfcignc: pointer, # PFNFCIGETNEXTCABINET
pfnfcis: pointer # PFNFCISTATUS
): int32 {.importc: "FCIFlushCabinet", cdecl, dynlib: "Cabinet.dll".}pragma(lib, "cabinet");
extern(C)
int FCIFlushCabinet(
void* hfci, // void*
int fGetNextCab, // BOOL
void* pfnfcignc, // PFNFCIGETNEXTCABINET
void* pfnfcis // PFNFCISTATUS
);ccall((:FCIFlushCabinet, "Cabinet.dll"), Int32,
(Ptr{Cvoid}, Int32, Ptr{Cvoid}, Ptr{Cvoid}),
hfci, fGetNextCab, pfnfcignc, pfnfcis)
# hfci : void* -> Ptr{Cvoid}
# fGetNextCab : BOOL -> Int32
# pfnfcignc : PFNFCIGETNEXTCABINET -> Ptr{Cvoid}
# pfnfcis : PFNFCISTATUS -> Ptr{Cvoid}local ffi = require("ffi")
ffi.cdef[[
int32_t FCIFlushCabinet(
void* hfci,
int32_t fGetNextCab,
void* pfnfcignc,
void* pfnfcis);
]]
local cabinet = ffi.load("cabinet")
-- cabinet.FCIFlushCabinet(hfci, fGetNextCab, pfnfcignc, pfnfcis)
-- hfci : void*
-- fGetNextCab : BOOL
-- pfnfcignc : PFNFCIGETNEXTCABINET
-- pfnfcis : PFNFCISTATUS
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('Cabinet.dll');
const FCIFlushCabinet = lib.func('__cdecl', 'FCIFlushCabinet', 'int32_t', ['void *', 'int32_t', 'void *', 'void *']);
// FCIFlushCabinet(hfci, fGetNextCab, pfnfcignc, pfnfcis)
// hfci : void* -> 'void *'
// fGetNextCab : BOOL -> 'int32_t'
// pfnfcignc : PFNFCIGETNEXTCABINET -> 'void *'
// pfnfcis : PFNFCISTATUS -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("Cabinet.dll", {
FCIFlushCabinet: { parameters: ["pointer", "i32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.FCIFlushCabinet(hfci, fGetNextCab, pfnfcignc, pfnfcis)
// hfci : void* -> "pointer"
// fGetNextCab : BOOL -> "i32"
// pfnfcignc : PFNFCIGETNEXTCABINET -> "pointer"
// pfnfcis : PFNFCISTATUS -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t FCIFlushCabinet(
void* hfci,
int32_t fGetNextCab,
void* pfnfcignc,
void* pfnfcis);
C, "Cabinet.dll");
// $ffi->FCIFlushCabinet(hfci, fGetNextCab, pfnfcignc, pfnfcis);
// hfci : void*
// fGetNextCab : BOOL
// pfnfcignc : PFNFCIGETNEXTCABINET
// pfnfcis : PFNFCISTATUS
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Cabinet extends Library {
Cabinet INSTANCE = Native.load("cabinet", Cabinet.class);
boolean FCIFlushCabinet(
Pointer hfci, // void*
boolean fGetNextCab, // BOOL
Callback pfnfcignc, // PFNFCIGETNEXTCABINET
Callback pfnfcis // PFNFCISTATUS
);
}@[Link("cabinet")]
lib LibCabinet
fun FCIFlushCabinet = FCIFlushCabinet(
hfci : Void*, # void*
fGetNextCab : Int32, # BOOL
pfnfcignc : Void*, # PFNFCIGETNEXTCABINET
pfnfcis : Void* # PFNFCISTATUS
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef FCIFlushCabinetNative = Int32 Function(Pointer<Void>, Int32, Pointer<Void>, Pointer<Void>);
typedef FCIFlushCabinetDart = int Function(Pointer<Void>, int, Pointer<Void>, Pointer<Void>);
final FCIFlushCabinet = DynamicLibrary.open('Cabinet.dll')
.lookupFunction<FCIFlushCabinetNative, FCIFlushCabinetDart>('FCIFlushCabinet');
// hfci : void* -> Pointer<Void>
// fGetNextCab : BOOL -> Int32
// pfnfcignc : PFNFCIGETNEXTCABINET -> Pointer<Void>
// pfnfcis : PFNFCISTATUS -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function FCIFlushCabinet(
hfci: Pointer; // void*
fGetNextCab: BOOL; // BOOL
pfnfcignc: Pointer; // PFNFCIGETNEXTCABINET
pfnfcis: Pointer // PFNFCISTATUS
): BOOL; cdecl;
external 'Cabinet.dll' name 'FCIFlushCabinet';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "FCIFlushCabinet"
c_FCIFlushCabinet :: Ptr () -> CInt -> Ptr () -> Ptr () -> IO CInt
-- hfci : void* -> Ptr ()
-- fGetNextCab : BOOL -> CInt
-- pfnfcignc : PFNFCIGETNEXTCABINET -> Ptr ()
-- pfnfcis : PFNFCISTATUS -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let fciflushcabinet =
foreign "FCIFlushCabinet"
((ptr void) @-> int32_t @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* hfci : void* -> (ptr void) *)
(* fGetNextCab : BOOL -> int32_t *)
(* pfnfcignc : PFNFCIGETNEXTCABINET -> (ptr void) *)
(* pfnfcis : PFNFCISTATUS -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library cabinet (t "Cabinet.dll"))
(cffi:use-foreign-library cabinet)
(cffi:defcfun ("FCIFlushCabinet" fciflush-cabinet :convention :cdecl) :int32
(hfci :pointer) ; void*
(f-get-next-cab :int32) ; BOOL
(pfnfcignc :pointer) ; PFNFCIGETNEXTCABINET
(pfnfcis :pointer)) ; PFNFCISTATUS
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $FCIFlushCabinet = Win32::API::More->new('Cabinet',
'BOOL FCIFlushCabinet(LPVOID hfci, BOOL fGetNextCab, LPVOID pfnfcignc, LPVOID pfnfcis)');
# my $ret = $FCIFlushCabinet->Call($hfci, $fGetNextCab, $pfnfcignc, $pfnfcis);
# hfci : void* -> LPVOID
# fGetNextCab : BOOL -> BOOL
# pfnfcignc : PFNFCIGETNEXTCABINET -> LPVOID
# pfnfcis : PFNFCISTATUS -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。