ホーム › Security.Cryptography.Certificates › CertSrvBackupClose
CertSrvBackupClose
関数バックアップ中に開いていたファイルを閉じる。
シグネチャ
// certadm.dll
#include <windows.h>
HRESULT CertSrvBackupClose(
void* hbc
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hbc | void* | inout | CertSrvBackupOpenFileWで開いたファイルを閉じるバックアップコンテキストハンドル。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// certadm.dll
#include <windows.h>
HRESULT CertSrvBackupClose(
void* hbc
);[DllImport("certadm.dll", ExactSpelling = true)]
static extern int CertSrvBackupClose(
IntPtr hbc // void* in/out
);<DllImport("certadm.dll", ExactSpelling:=True)>
Public Shared Function CertSrvBackupClose(
hbc As IntPtr ' void* in/out
) As Integer
End Function' hbc : void* in/out
Declare PtrSafe Function CertSrvBackupClose Lib "certadm" ( _
ByVal hbc As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CertSrvBackupClose = ctypes.windll.certadm.CertSrvBackupClose
CertSrvBackupClose.restype = ctypes.c_int
CertSrvBackupClose.argtypes = [
ctypes.POINTER(None), # hbc : void* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('certadm.dll')
CertSrvBackupClose = Fiddle::Function.new(
lib['CertSrvBackupClose'],
[
Fiddle::TYPE_VOIDP, # hbc : void* in/out
],
Fiddle::TYPE_INT)#[link(name = "certadm")]
extern "system" {
fn CertSrvBackupClose(
hbc: *mut () // void* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("certadm.dll")]
public static extern int CertSrvBackupClose(IntPtr hbc);
"@
$api = Add-Type -MemberDefinition $sig -Name 'certadm_CertSrvBackupClose' -Namespace Win32 -PassThru
# $api::CertSrvBackupClose(hbc)#uselib "certadm.dll"
#func global CertSrvBackupClose "CertSrvBackupClose" sptr
; CertSrvBackupClose hbc ; 戻り値は stat
; hbc : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "certadm.dll"
#cfunc global CertSrvBackupClose "CertSrvBackupClose" sptr
; res = CertSrvBackupClose(hbc)
; hbc : void* in/out -> "sptr"; HRESULT CertSrvBackupClose(void* hbc)
#uselib "certadm.dll"
#cfunc global CertSrvBackupClose "CertSrvBackupClose" intptr
; res = CertSrvBackupClose(hbc)
; hbc : void* in/out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
certadm = windows.NewLazySystemDLL("certadm.dll")
procCertSrvBackupClose = certadm.NewProc("CertSrvBackupClose")
)
// hbc (void* in/out)
r1, _, err := procCertSrvBackupClose.Call(
uintptr(hbc),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CertSrvBackupClose(
hbc: Pointer // void* in/out
): Integer; stdcall;
external 'certadm.dll' name 'CertSrvBackupClose';result := DllCall("certadm\CertSrvBackupClose"
, "Ptr", hbc ; void* in/out
, "Int") ; return: HRESULT●CertSrvBackupClose(hbc) = DLL("certadm.dll", "int CertSrvBackupClose(void*)")
# 呼び出し: CertSrvBackupClose(hbc)
# hbc : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "certadm" fn CertSrvBackupClose(
hbc: ?*anyopaque // void* in/out
) callconv(std.os.windows.WINAPI) i32;proc CertSrvBackupClose(
hbc: pointer # void* in/out
): int32 {.importc: "CertSrvBackupClose", stdcall, dynlib: "certadm.dll".}pragma(lib, "certadm");
extern(Windows)
int CertSrvBackupClose(
void* hbc // void* in/out
);ccall((:CertSrvBackupClose, "certadm.dll"), stdcall, Int32,
(Ptr{Cvoid},),
hbc)
# hbc : void* in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CertSrvBackupClose(
void* hbc);
]]
local certadm = ffi.load("certadm")
-- certadm.CertSrvBackupClose(hbc)
-- hbc : void* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('certadm.dll');
const CertSrvBackupClose = lib.func('__stdcall', 'CertSrvBackupClose', 'int32_t', ['void *']);
// CertSrvBackupClose(hbc)
// hbc : void* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("certadm.dll", {
CertSrvBackupClose: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.CertSrvBackupClose(hbc)
// hbc : void* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CertSrvBackupClose(
void* hbc);
C, "certadm.dll");
// $ffi->CertSrvBackupClose(hbc);
// hbc : void* in/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 Certadm extends StdCallLibrary {
Certadm INSTANCE = Native.load("certadm", Certadm.class);
int CertSrvBackupClose(
Pointer hbc // void* in/out
);
}@[Link("certadm")]
lib Libcertadm
fun CertSrvBackupClose = CertSrvBackupClose(
hbc : Void* # void* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CertSrvBackupCloseNative = Int32 Function(Pointer<Void>);
typedef CertSrvBackupCloseDart = int Function(Pointer<Void>);
final CertSrvBackupClose = DynamicLibrary.open('certadm.dll')
.lookupFunction<CertSrvBackupCloseNative, CertSrvBackupCloseDart>('CertSrvBackupClose');
// hbc : void* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CertSrvBackupClose(
hbc: Pointer // void* in/out
): Integer; stdcall;
external 'certadm.dll' name 'CertSrvBackupClose';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CertSrvBackupClose"
c_CertSrvBackupClose :: Ptr () -> IO Int32
-- hbc : void* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let certsrvbackupclose =
foreign "CertSrvBackupClose"
((ptr void) @-> returning int32_t)
(* hbc : void* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library certadm (t "certadm.dll"))
(cffi:use-foreign-library certadm)
(cffi:defcfun ("CertSrvBackupClose" cert-srv-backup-close :convention :stdcall) :int32
(hbc :pointer)) ; void* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CertSrvBackupClose = Win32::API::More->new('certadm',
'int CertSrvBackupClose(LPVOID hbc)');
# my $ret = $CertSrvBackupClose->Call($hbc);
# hbc : void* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。