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

FCIDestroy

関数
FCIコンテキストを破棄しリソースを解放する。
DLLCabinet.dll呼出規約cdecl

シグネチャ

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

BOOL FCIDestroy(
    void* hfci
);

パラメーター

名前方向説明
hfcivoid*in破棄するFCIコンテキストハンドル。確保された資源を解放する。

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL FCIDestroy(
    void* hfci
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Cabinet.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern bool FCIDestroy(
    IntPtr hfci   // void*
);
<DllImport("Cabinet.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function FCIDestroy(
    hfci As IntPtr   ' void*
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' hfci : void*
Declare PtrSafe Function FCIDestroy Lib "cabinet" ( _
    ByVal hfci As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FCIDestroy = ctypes.cdll.cabinet.FCIDestroy
FCIDestroy.restype = wintypes.BOOL
FCIDestroy.argtypes = [
    ctypes.POINTER(None),  # hfci : void*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('Cabinet.dll')
FCIDestroy = Fiddle::Function.new(
  lib['FCIDestroy'],
  [
    Fiddle::TYPE_VOIDP,  # hfci : void*
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "cabinet")]
extern "C" {
    fn FCIDestroy(
        hfci: *mut ()  // void*
    ) -> 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 FCIDestroy(IntPtr hfci);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Cabinet_FCIDestroy' -Namespace Win32 -PassThru
# $api::FCIDestroy(hfci)
#uselib "Cabinet.dll"
#func global FCIDestroy "FCIDestroy" sptr
; FCIDestroy hfci   ; 戻り値は stat
; hfci : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "Cabinet.dll"
#cfunc global FCIDestroy "FCIDestroy" sptr
; res = FCIDestroy(hfci)
; hfci : void* -> "sptr"
; BOOL FCIDestroy(void* hfci)
#uselib "Cabinet.dll"
#cfunc global FCIDestroy "FCIDestroy" intptr
; res = FCIDestroy(hfci)
; hfci : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	cabinet = windows.NewLazySystemDLL("Cabinet.dll")
	procFCIDestroy = cabinet.NewProc("FCIDestroy")
)

// hfci (void*)
r1, _, err := procFCIDestroy.Call(
	uintptr(hfci),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function FCIDestroy(
  hfci: Pointer   // void*
): BOOL; cdecl;
  external 'Cabinet.dll' name 'FCIDestroy';
result := DllCall("Cabinet\FCIDestroy"
    , "Ptr", hfci   ; void*
    , "Cdecl Int")   ; return: BOOL
●FCIDestroy(hfci) = DLL("Cabinet.dll", "bool FCIDestroy(void*)")
# 呼び出し: FCIDestroy(hfci)
# hfci : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。
const std = @import("std");

extern "cabinet" fn FCIDestroy(
    hfci: ?*anyopaque // void*
) callconv(.c) i32;
proc FCIDestroy(
    hfci: pointer  # void*
): int32 {.importc: "FCIDestroy", cdecl, dynlib: "Cabinet.dll".}
pragma(lib, "cabinet");
extern(C)
int FCIDestroy(
    void* hfci   // void*
);
ccall((:FCIDestroy, "Cabinet.dll"), Int32,
      (Ptr{Cvoid},),
      hfci)
# hfci : void* -> Ptr{Cvoid}
local ffi = require("ffi")
ffi.cdef[[
int32_t FCIDestroy(
    void* hfci);
]]
local cabinet = ffi.load("cabinet")
-- cabinet.FCIDestroy(hfci)
-- hfci : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('Cabinet.dll');
const FCIDestroy = lib.func('__cdecl', 'FCIDestroy', 'int32_t', ['void *']);
// FCIDestroy(hfci)
// hfci : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("Cabinet.dll", {
  FCIDestroy: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.FCIDestroy(hfci)
// hfci : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t FCIDestroy(
    void* hfci);
C, "Cabinet.dll");
// $ffi->FCIDestroy(hfci);
// hfci : void*
// 構造体/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 FCIDestroy(
        Pointer hfci   // void*
    );
}
@[Link("cabinet")]
lib LibCabinet
  fun FCIDestroy = FCIDestroy(
    hfci : Void*   # void*
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef FCIDestroyNative = Int32 Function(Pointer<Void>);
typedef FCIDestroyDart = int Function(Pointer<Void>);
final FCIDestroy = DynamicLibrary.open('Cabinet.dll')
    .lookupFunction<FCIDestroyNative, FCIDestroyDart>('FCIDestroy');
// hfci : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function FCIDestroy(
  hfci: Pointer   // void*
): BOOL; cdecl;
  external 'Cabinet.dll' name 'FCIDestroy';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "FCIDestroy"
  c_FCIDestroy :: Ptr () -> IO CInt
-- hfci : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let fcidestroy =
  foreign "FCIDestroy"
    ((ptr void) @-> returning int32_t)
(* hfci : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library cabinet (t "Cabinet.dll"))
(cffi:use-foreign-library cabinet)

(cffi:defcfun ("FCIDestroy" fcidestroy :convention :cdecl) :int32
  (hfci :pointer))   ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $FCIDestroy = Win32::API::More->new('Cabinet',
    'BOOL FCIDestroy(LPVOID hfci)');
# my $ret = $FCIDestroy->Call($hfci);
# hfci : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。