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

FCIAddFile

関数
FCIでキャビネットに圧縮対象ファイルを追加する。
DLLCabinet.dll呼出規約cdecl

シグネチャ

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

BOOL FCIAddFile(
    void* hfci,
    LPSTR pszSourceFile,
    LPSTR pszFileName,
    BOOL fExecute,
    PFNFCIGETNEXTCABINET pfnfcignc,
    PFNFCISTATUS pfnfcis,
    PFNFCIGETOPENINFO pfnfcigoi,
    WORD typeCompress
);

パラメーター

名前方向説明
hfcivoid*inFCICreateで取得したFCIコンテキストハンドル。圧縮処理対象を識別する。
pszSourceFileLPSTRin圧縮元となる実ファイルのパスを示すASCII文字列。
pszFileNameLPSTRinキャビネット内に格納する際のファイル名を示すASCII文字列。
fExecuteBOOLin格納ファイルに実行属性を付与するかどうかのフラグ。TRUEで実行可能を示す。
pfnfcigncPFNFCIGETNEXTCABINETin次のキャビネットを取得するためのコールバック関数ポインタ。分割時に呼ばれる。
pfnfcisPFNFCISTATUSin進捗状況を通知するステータスコールバック関数ポインタ。
pfnfcigoiPFNFCIGETOPENINFOin格納ファイルのオープン情報を取得するコールバック関数ポインタ。
typeCompressWORDin使用する圧縮方式を示すWORD値。tcompTYPE_NONEやtcompTYPE_MSZIP等を指定する。

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL FCIAddFile(
    void* hfci,
    LPSTR pszSourceFile,
    LPSTR pszFileName,
    BOOL fExecute,
    PFNFCIGETNEXTCABINET pfnfcignc,
    PFNFCISTATUS pfnfcis,
    PFNFCIGETOPENINFO pfnfcigoi,
    WORD typeCompress
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Cabinet.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern bool FCIAddFile(
    IntPtr hfci,   // void*
    [MarshalAs(UnmanagedType.LPStr)] string pszSourceFile,   // LPSTR
    [MarshalAs(UnmanagedType.LPStr)] string pszFileName,   // LPSTR
    bool fExecute,   // BOOL
    IntPtr pfnfcignc,   // PFNFCIGETNEXTCABINET
    IntPtr pfnfcis,   // PFNFCISTATUS
    IntPtr pfnfcigoi,   // PFNFCIGETOPENINFO
    ushort typeCompress   // WORD
);
<DllImport("Cabinet.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function FCIAddFile(
    hfci As IntPtr,   ' void*
    <MarshalAs(UnmanagedType.LPStr)> pszSourceFile As String,   ' LPSTR
    <MarshalAs(UnmanagedType.LPStr)> pszFileName As String,   ' LPSTR
    fExecute As Boolean,   ' BOOL
    pfnfcignc As IntPtr,   ' PFNFCIGETNEXTCABINET
    pfnfcis As IntPtr,   ' PFNFCISTATUS
    pfnfcigoi As IntPtr,   ' PFNFCIGETOPENINFO
    typeCompress As UShort   ' WORD
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' hfci : void*
' pszSourceFile : LPSTR
' pszFileName : LPSTR
' fExecute : BOOL
' pfnfcignc : PFNFCIGETNEXTCABINET
' pfnfcis : PFNFCISTATUS
' pfnfcigoi : PFNFCIGETOPENINFO
' typeCompress : WORD
Declare PtrSafe Function FCIAddFile Lib "cabinet" ( _
    ByVal hfci As LongPtr, _
    ByVal pszSourceFile As String, _
    ByVal pszFileName As String, _
    ByVal fExecute As Long, _
    ByVal pfnfcignc As LongPtr, _
    ByVal pfnfcis As LongPtr, _
    ByVal pfnfcigoi As LongPtr, _
    ByVal typeCompress As Integer) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FCIAddFile = ctypes.cdll.cabinet.FCIAddFile
FCIAddFile.restype = wintypes.BOOL
FCIAddFile.argtypes = [
    ctypes.POINTER(None),  # hfci : void*
    wintypes.LPCSTR,  # pszSourceFile : LPSTR
    wintypes.LPCSTR,  # pszFileName : LPSTR
    wintypes.BOOL,  # fExecute : BOOL
    ctypes.c_void_p,  # pfnfcignc : PFNFCIGETNEXTCABINET
    ctypes.c_void_p,  # pfnfcis : PFNFCISTATUS
    ctypes.c_void_p,  # pfnfcigoi : PFNFCIGETOPENINFO
    ctypes.c_ushort,  # typeCompress : WORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('Cabinet.dll')
FCIAddFile = Fiddle::Function.new(
  lib['FCIAddFile'],
  [
    Fiddle::TYPE_VOIDP,  # hfci : void*
    Fiddle::TYPE_VOIDP,  # pszSourceFile : LPSTR
    Fiddle::TYPE_VOIDP,  # pszFileName : LPSTR
    Fiddle::TYPE_INT,  # fExecute : BOOL
    Fiddle::TYPE_VOIDP,  # pfnfcignc : PFNFCIGETNEXTCABINET
    Fiddle::TYPE_VOIDP,  # pfnfcis : PFNFCISTATUS
    Fiddle::TYPE_VOIDP,  # pfnfcigoi : PFNFCIGETOPENINFO
    -Fiddle::TYPE_SHORT,  # typeCompress : WORD
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "cabinet")]
extern "C" {
    fn FCIAddFile(
        hfci: *mut (),  // void*
        pszSourceFile: *mut u8,  // LPSTR
        pszFileName: *mut u8,  // LPSTR
        fExecute: i32,  // BOOL
        pfnfcignc: *const core::ffi::c_void,  // PFNFCIGETNEXTCABINET
        pfnfcis: *const core::ffi::c_void,  // PFNFCISTATUS
        pfnfcigoi: *const core::ffi::c_void,  // PFNFCIGETOPENINFO
        typeCompress: u16  // WORD
    ) -> 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 FCIAddFile(IntPtr hfci, [MarshalAs(UnmanagedType.LPStr)] string pszSourceFile, [MarshalAs(UnmanagedType.LPStr)] string pszFileName, bool fExecute, IntPtr pfnfcignc, IntPtr pfnfcis, IntPtr pfnfcigoi, ushort typeCompress);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Cabinet_FCIAddFile' -Namespace Win32 -PassThru
# $api::FCIAddFile(hfci, pszSourceFile, pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress)
#uselib "Cabinet.dll"
#func global FCIAddFile "FCIAddFile" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; FCIAddFile hfci, pszSourceFile, pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress   ; 戻り値は stat
; hfci : void* -> "sptr"
; pszSourceFile : LPSTR -> "sptr"
; pszFileName : LPSTR -> "sptr"
; fExecute : BOOL -> "sptr"
; pfnfcignc : PFNFCIGETNEXTCABINET -> "sptr"
; pfnfcis : PFNFCISTATUS -> "sptr"
; pfnfcigoi : PFNFCIGETOPENINFO -> "sptr"
; typeCompress : WORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "Cabinet.dll"
#cfunc global FCIAddFile "FCIAddFile" sptr, str, str, int, sptr, sptr, sptr, int
; res = FCIAddFile(hfci, pszSourceFile, pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress)
; hfci : void* -> "sptr"
; pszSourceFile : LPSTR -> "str"
; pszFileName : LPSTR -> "str"
; fExecute : BOOL -> "int"
; pfnfcignc : PFNFCIGETNEXTCABINET -> "sptr"
; pfnfcis : PFNFCISTATUS -> "sptr"
; pfnfcigoi : PFNFCIGETOPENINFO -> "sptr"
; typeCompress : WORD -> "int"
; BOOL FCIAddFile(void* hfci, LPSTR pszSourceFile, LPSTR pszFileName, BOOL fExecute, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis, PFNFCIGETOPENINFO pfnfcigoi, WORD typeCompress)
#uselib "Cabinet.dll"
#cfunc global FCIAddFile "FCIAddFile" intptr, str, str, int, intptr, intptr, intptr, int
; res = FCIAddFile(hfci, pszSourceFile, pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress)
; hfci : void* -> "intptr"
; pszSourceFile : LPSTR -> "str"
; pszFileName : LPSTR -> "str"
; fExecute : BOOL -> "int"
; pfnfcignc : PFNFCIGETNEXTCABINET -> "intptr"
; pfnfcis : PFNFCISTATUS -> "intptr"
; pfnfcigoi : PFNFCIGETOPENINFO -> "intptr"
; typeCompress : WORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	cabinet = windows.NewLazySystemDLL("Cabinet.dll")
	procFCIAddFile = cabinet.NewProc("FCIAddFile")
)

// hfci (void*), pszSourceFile (LPSTR), pszFileName (LPSTR), fExecute (BOOL), pfnfcignc (PFNFCIGETNEXTCABINET), pfnfcis (PFNFCISTATUS), pfnfcigoi (PFNFCIGETOPENINFO), typeCompress (WORD)
r1, _, err := procFCIAddFile.Call(
	uintptr(hfci),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(pszSourceFile))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(pszFileName))),
	uintptr(fExecute),
	uintptr(pfnfcignc),
	uintptr(pfnfcis),
	uintptr(pfnfcigoi),
	uintptr(typeCompress),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function FCIAddFile(
  hfci: Pointer;   // void*
  pszSourceFile: PAnsiChar;   // LPSTR
  pszFileName: PAnsiChar;   // LPSTR
  fExecute: BOOL;   // BOOL
  pfnfcignc: Pointer;   // PFNFCIGETNEXTCABINET
  pfnfcis: Pointer;   // PFNFCISTATUS
  pfnfcigoi: Pointer;   // PFNFCIGETOPENINFO
  typeCompress: Word   // WORD
): BOOL; cdecl;
  external 'Cabinet.dll' name 'FCIAddFile';
result := DllCall("Cabinet\FCIAddFile"
    , "Ptr", hfci   ; void*
    , "AStr", pszSourceFile   ; LPSTR
    , "AStr", pszFileName   ; LPSTR
    , "Int", fExecute   ; BOOL
    , "Ptr", pfnfcignc   ; PFNFCIGETNEXTCABINET
    , "Ptr", pfnfcis   ; PFNFCISTATUS
    , "Ptr", pfnfcigoi   ; PFNFCIGETOPENINFO
    , "UShort", typeCompress   ; WORD
    , "Cdecl Int")   ; return: BOOL
●FCIAddFile(hfci, pszSourceFile, pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress) = DLL("Cabinet.dll", "bool FCIAddFile(void*, char*, char*, bool, void*, void*, void*, int)")
# 呼び出し: FCIAddFile(hfci, pszSourceFile, pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress)
# hfci : void* -> "void*"
# pszSourceFile : LPSTR -> "char*"
# pszFileName : LPSTR -> "char*"
# fExecute : BOOL -> "bool"
# pfnfcignc : PFNFCIGETNEXTCABINET -> "void*"
# pfnfcis : PFNFCISTATUS -> "void*"
# pfnfcigoi : PFNFCIGETOPENINFO -> "void*"
# typeCompress : WORD -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。
const std = @import("std");

extern "cabinet" fn FCIAddFile(
    hfci: ?*anyopaque, // void*
    pszSourceFile: [*c]const u8, // LPSTR
    pszFileName: [*c]const u8, // LPSTR
    fExecute: i32, // BOOL
    pfnfcignc: ?*anyopaque, // PFNFCIGETNEXTCABINET
    pfnfcis: ?*anyopaque, // PFNFCISTATUS
    pfnfcigoi: ?*anyopaque, // PFNFCIGETOPENINFO
    typeCompress: u16 // WORD
) callconv(.c) i32;
proc FCIAddFile(
    hfci: pointer,  # void*
    pszSourceFile: cstring,  # LPSTR
    pszFileName: cstring,  # LPSTR
    fExecute: int32,  # BOOL
    pfnfcignc: pointer,  # PFNFCIGETNEXTCABINET
    pfnfcis: pointer,  # PFNFCISTATUS
    pfnfcigoi: pointer,  # PFNFCIGETOPENINFO
    typeCompress: uint16  # WORD
): int32 {.importc: "FCIAddFile", cdecl, dynlib: "Cabinet.dll".}
pragma(lib, "cabinet");
extern(C)
int FCIAddFile(
    void* hfci,   // void*
    const(char)* pszSourceFile,   // LPSTR
    const(char)* pszFileName,   // LPSTR
    int fExecute,   // BOOL
    void* pfnfcignc,   // PFNFCIGETNEXTCABINET
    void* pfnfcis,   // PFNFCISTATUS
    void* pfnfcigoi,   // PFNFCIGETOPENINFO
    ushort typeCompress   // WORD
);
ccall((:FCIAddFile, "Cabinet.dll"), Int32,
      (Ptr{Cvoid}, Cstring, Cstring, Int32, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, UInt16),
      hfci, pszSourceFile, pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress)
# hfci : void* -> Ptr{Cvoid}
# pszSourceFile : LPSTR -> Cstring
# pszFileName : LPSTR -> Cstring
# fExecute : BOOL -> Int32
# pfnfcignc : PFNFCIGETNEXTCABINET -> Ptr{Cvoid}
# pfnfcis : PFNFCISTATUS -> Ptr{Cvoid}
# pfnfcigoi : PFNFCIGETOPENINFO -> Ptr{Cvoid}
# typeCompress : WORD -> UInt16
local ffi = require("ffi")
ffi.cdef[[
int32_t FCIAddFile(
    void* hfci,
    const char* pszSourceFile,
    const char* pszFileName,
    int32_t fExecute,
    void* pfnfcignc,
    void* pfnfcis,
    void* pfnfcigoi,
    uint16_t typeCompress);
]]
local cabinet = ffi.load("cabinet")
-- cabinet.FCIAddFile(hfci, pszSourceFile, pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress)
-- hfci : void*
-- pszSourceFile : LPSTR
-- pszFileName : LPSTR
-- fExecute : BOOL
-- pfnfcignc : PFNFCIGETNEXTCABINET
-- pfnfcis : PFNFCISTATUS
-- pfnfcigoi : PFNFCIGETOPENINFO
-- typeCompress : WORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('Cabinet.dll');
const FCIAddFile = lib.func('__cdecl', 'FCIAddFile', 'int32_t', ['void *', 'str', 'str', 'int32_t', 'void *', 'void *', 'void *', 'uint16_t']);
// FCIAddFile(hfci, pszSourceFile, pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress)
// hfci : void* -> 'void *'
// pszSourceFile : LPSTR -> 'str'
// pszFileName : LPSTR -> 'str'
// fExecute : BOOL -> 'int32_t'
// pfnfcignc : PFNFCIGETNEXTCABINET -> 'void *'
// pfnfcis : PFNFCISTATUS -> 'void *'
// pfnfcigoi : PFNFCIGETOPENINFO -> 'void *'
// typeCompress : WORD -> 'uint16_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。
const lib = Deno.dlopen("Cabinet.dll", {
  FCIAddFile: { parameters: ["pointer", "buffer", "buffer", "i32", "pointer", "pointer", "pointer", "u16"], result: "i32" },
});
// lib.symbols.FCIAddFile(hfci, pszSourceFile, pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress)
// hfci : void* -> "pointer"
// pszSourceFile : LPSTR -> "buffer"
// pszFileName : LPSTR -> "buffer"
// fExecute : BOOL -> "i32"
// pfnfcignc : PFNFCIGETNEXTCABINET -> "pointer"
// pfnfcis : PFNFCISTATUS -> "pointer"
// pfnfcigoi : PFNFCIGETOPENINFO -> "pointer"
// typeCompress : WORD -> "u16"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t FCIAddFile(
    void* hfci,
    const char* pszSourceFile,
    const char* pszFileName,
    int32_t fExecute,
    void* pfnfcignc,
    void* pfnfcis,
    void* pfnfcigoi,
    uint16_t typeCompress);
C, "Cabinet.dll");
// $ffi->FCIAddFile(hfci, pszSourceFile, pszFileName, fExecute, pfnfcignc, pfnfcis, pfnfcigoi, typeCompress);
// hfci : void*
// pszSourceFile : LPSTR
// pszFileName : LPSTR
// fExecute : BOOL
// pfnfcignc : PFNFCIGETNEXTCABINET
// pfnfcis : PFNFCISTATUS
// pfnfcigoi : PFNFCIGETOPENINFO
// typeCompress : WORD
// 構造体/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 FCIAddFile(
        Pointer hfci,   // void*
        String pszSourceFile,   // LPSTR
        String pszFileName,   // LPSTR
        boolean fExecute,   // BOOL
        Callback pfnfcignc,   // PFNFCIGETNEXTCABINET
        Callback pfnfcis,   // PFNFCISTATUS
        Callback pfnfcigoi,   // PFNFCIGETOPENINFO
        short typeCompress   // WORD
    );
}
@[Link("cabinet")]
lib LibCabinet
  fun FCIAddFile = FCIAddFile(
    hfci : Void*,   # void*
    pszSourceFile : UInt8*,   # LPSTR
    pszFileName : UInt8*,   # LPSTR
    fExecute : Int32,   # BOOL
    pfnfcignc : Void*,   # PFNFCIGETNEXTCABINET
    pfnfcis : Void*,   # PFNFCISTATUS
    pfnfcigoi : Void*,   # PFNFCIGETOPENINFO
    typeCompress : UInt16   # WORD
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef FCIAddFileNative = Int32 Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>, Int32, Pointer<Void>, Pointer<Void>, Pointer<Void>, Uint16);
typedef FCIAddFileDart = int Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>, int, Pointer<Void>, Pointer<Void>, Pointer<Void>, int);
final FCIAddFile = DynamicLibrary.open('Cabinet.dll')
    .lookupFunction<FCIAddFileNative, FCIAddFileDart>('FCIAddFile');
// hfci : void* -> Pointer<Void>
// pszSourceFile : LPSTR -> Pointer<Utf8>
// pszFileName : LPSTR -> Pointer<Utf8>
// fExecute : BOOL -> Int32
// pfnfcignc : PFNFCIGETNEXTCABINET -> Pointer<Void>
// pfnfcis : PFNFCISTATUS -> Pointer<Void>
// pfnfcigoi : PFNFCIGETOPENINFO -> Pointer<Void>
// typeCompress : WORD -> Uint16
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function FCIAddFile(
  hfci: Pointer;   // void*
  pszSourceFile: PAnsiChar;   // LPSTR
  pszFileName: PAnsiChar;   // LPSTR
  fExecute: BOOL;   // BOOL
  pfnfcignc: Pointer;   // PFNFCIGETNEXTCABINET
  pfnfcis: Pointer;   // PFNFCISTATUS
  pfnfcigoi: Pointer;   // PFNFCIGETOPENINFO
  typeCompress: Word   // WORD
): BOOL; cdecl;
  external 'Cabinet.dll' name 'FCIAddFile';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "FCIAddFile"
  c_FCIAddFile :: Ptr () -> CString -> CString -> CInt -> Ptr () -> Ptr () -> Ptr () -> Word16 -> IO CInt
-- hfci : void* -> Ptr ()
-- pszSourceFile : LPSTR -> CString
-- pszFileName : LPSTR -> CString
-- fExecute : BOOL -> CInt
-- pfnfcignc : PFNFCIGETNEXTCABINET -> Ptr ()
-- pfnfcis : PFNFCISTATUS -> Ptr ()
-- pfnfcigoi : PFNFCIGETOPENINFO -> Ptr ()
-- typeCompress : WORD -> Word16
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let fciaddfile =
  foreign "FCIAddFile"
    ((ptr void) @-> string @-> string @-> int32_t @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> uint16_t @-> returning int32_t)
(* hfci : void* -> (ptr void) *)
(* pszSourceFile : LPSTR -> string *)
(* pszFileName : LPSTR -> string *)
(* fExecute : BOOL -> int32_t *)
(* pfnfcignc : PFNFCIGETNEXTCABINET -> (ptr void) *)
(* pfnfcis : PFNFCISTATUS -> (ptr void) *)
(* pfnfcigoi : PFNFCIGETOPENINFO -> (ptr void) *)
(* typeCompress : WORD -> uint16_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library cabinet (t "Cabinet.dll"))
(cffi:use-foreign-library cabinet)

(cffi:defcfun ("FCIAddFile" fciadd-file :convention :cdecl) :int32
  (hfci :pointer)   ; void*
  (psz-source-file :string)   ; LPSTR
  (psz-file-name :string)   ; LPSTR
  (f-execute :int32)   ; BOOL
  (pfnfcignc :pointer)   ; PFNFCIGETNEXTCABINET
  (pfnfcis :pointer)   ; PFNFCISTATUS
  (pfnfcigoi :pointer)   ; PFNFCIGETOPENINFO
  (type-compress :uint16))   ; WORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $FCIAddFile = Win32::API::More->new('Cabinet',
    'BOOL FCIAddFile(LPVOID hfci, LPCSTR pszSourceFile, LPCSTR pszFileName, BOOL fExecute, LPVOID pfnfcignc, LPVOID pfnfcis, LPVOID pfnfcigoi, WORD typeCompress)');
# my $ret = $FCIAddFile->Call($hfci, $pszSourceFile, $pszFileName, $fExecute, $pfnfcignc, $pfnfcis, $pfnfcigoi, $typeCompress);
# hfci : void* -> LPVOID
# pszSourceFile : LPSTR -> LPCSTR
# pszFileName : LPSTR -> LPCSTR
# fExecute : BOOL -> BOOL
# pfnfcignc : PFNFCIGETNEXTCABINET -> LPVOID
# pfnfcis : PFNFCISTATUS -> LPVOID
# pfnfcigoi : PFNFCIGETOPENINFO -> LPVOID
# typeCompress : WORD -> WORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。

関連項目

使用する型