ホーム › Storage.Cabinets › FCIAddFile
FCIAddFile
関数FCIでキャビネットに圧縮対象ファイルを追加する。
シグネチャ
// Cabinet.dll
#include <windows.h>
BOOL FCIAddFile(
void* hfci,
LPSTR pszSourceFile,
LPSTR pszFileName,
BOOL fExecute,
PFNFCIGETNEXTCABINET pfnfcignc,
PFNFCISTATUS pfnfcis,
PFNFCIGETOPENINFO pfnfcigoi,
WORD typeCompress
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hfci | void* | in |
| pszSourceFile | LPSTR | in |
| pszFileName | LPSTR | in |
| fExecute | BOOL | in |
| pfnfcignc | PFNFCIGETNEXTCABINET | in |
| pfnfcis | PFNFCISTATUS | in |
| pfnfcigoi | PFNFCIGETOPENINFO | in |
| typeCompress | WORD | in |
戻り値の型: 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 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 // BOOLfunction 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`,…) を使用。