Win32 API 日本語リファレンス
ホームSecurity.Cryptography › CertFreeCRLContext

CertFreeCRLContext

関数
CRLコンテキストを解放する。
DLLCRYPT32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

BOOL CertFreeCRLContext(
    CRL_CONTEXT* pCrlContext   // optional
);

パラメーター

名前方向説明
pCrlContextCRL_CONTEXT*inoptional解放する CRL_CONTEXT へのポインターです。

戻り値の型: BOOL

公式ドキュメント

参照カウントをデクリメントすることにより、証明書失効リスト (CRL) コンテキストを解放します。

戻り値

この関数は常に TRUE を返します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

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

CertFreeCRLContext = ctypes.windll.crypt32.CertFreeCRLContext
CertFreeCRLContext.restype = wintypes.BOOL
CertFreeCRLContext.argtypes = [
    ctypes.c_void_p,  # pCrlContext : CRL_CONTEXT* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CRYPT32.dll')
CertFreeCRLContext = Fiddle::Function.new(
  lib['CertFreeCRLContext'],
  [
    Fiddle::TYPE_VOIDP,  # pCrlContext : CRL_CONTEXT* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "crypt32")]
extern "system" {
    fn CertFreeCRLContext(
        pCrlContext: *mut CRL_CONTEXT  // CRL_CONTEXT* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll")]
public static extern bool CertFreeCRLContext(IntPtr pCrlContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CertFreeCRLContext' -Namespace Win32 -PassThru
# $api::CertFreeCRLContext(pCrlContext)
#uselib "CRYPT32.dll"
#func global CertFreeCRLContext "CertFreeCRLContext" sptr
; CertFreeCRLContext varptr(pCrlContext)   ; 戻り値は stat
; pCrlContext : CRL_CONTEXT* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "CRYPT32.dll"
#cfunc global CertFreeCRLContext "CertFreeCRLContext" var
; res = CertFreeCRLContext(pCrlContext)
; pCrlContext : CRL_CONTEXT* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL CertFreeCRLContext(CRL_CONTEXT* pCrlContext)
#uselib "CRYPT32.dll"
#cfunc global CertFreeCRLContext "CertFreeCRLContext" var
; res = CertFreeCRLContext(pCrlContext)
; pCrlContext : CRL_CONTEXT* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
	procCertFreeCRLContext = crypt32.NewProc("CertFreeCRLContext")
)

// pCrlContext (CRL_CONTEXT* optional)
r1, _, err := procCertFreeCRLContext.Call(
	uintptr(pCrlContext),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function CertFreeCRLContext(
  pCrlContext: Pointer   // CRL_CONTEXT* optional
): BOOL; stdcall;
  external 'CRYPT32.dll' name 'CertFreeCRLContext';
result := DllCall("CRYPT32\CertFreeCRLContext"
    , "Ptr", pCrlContext   ; CRL_CONTEXT* optional
    , "Int")   ; return: BOOL
●CertFreeCRLContext(pCrlContext) = DLL("CRYPT32.dll", "bool CertFreeCRLContext(void*)")
# 呼び出し: CertFreeCRLContext(pCrlContext)
# pCrlContext : CRL_CONTEXT* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "crypt32" fn CertFreeCRLContext(
    pCrlContext: [*c]CRL_CONTEXT // CRL_CONTEXT* optional
) callconv(std.os.windows.WINAPI) i32;
proc CertFreeCRLContext(
    pCrlContext: ptr CRL_CONTEXT  # CRL_CONTEXT* optional
): int32 {.importc: "CertFreeCRLContext", stdcall, dynlib: "CRYPT32.dll".}
pragma(lib, "crypt32");
extern(Windows)
int CertFreeCRLContext(
    CRL_CONTEXT* pCrlContext   // CRL_CONTEXT* optional
);
ccall((:CertFreeCRLContext, "CRYPT32.dll"), stdcall, Int32,
      (Ptr{CRL_CONTEXT},),
      pCrlContext)
# pCrlContext : CRL_CONTEXT* optional -> Ptr{CRL_CONTEXT}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t CertFreeCRLContext(
    void* pCrlContext);
]]
local crypt32 = ffi.load("crypt32")
-- crypt32.CertFreeCRLContext(pCrlContext)
-- pCrlContext : CRL_CONTEXT* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('CRYPT32.dll');
const CertFreeCRLContext = lib.func('__stdcall', 'CertFreeCRLContext', 'int32_t', ['void *']);
// CertFreeCRLContext(pCrlContext)
// pCrlContext : CRL_CONTEXT* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("CRYPT32.dll", {
  CertFreeCRLContext: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.CertFreeCRLContext(pCrlContext)
// pCrlContext : CRL_CONTEXT* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t CertFreeCRLContext(
    void* pCrlContext);
C, "CRYPT32.dll");
// $ffi->CertFreeCRLContext(pCrlContext);
// pCrlContext : CRL_CONTEXT* optional
// 構造体/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 Crypt32 extends StdCallLibrary {
    Crypt32 INSTANCE = Native.load("crypt32", Crypt32.class);
    boolean CertFreeCRLContext(
        Pointer pCrlContext   // CRL_CONTEXT* optional
    );
}
@[Link("crypt32")]
lib LibCRYPT32
  fun CertFreeCRLContext = CertFreeCRLContext(
    pCrlContext : CRL_CONTEXT*   # CRL_CONTEXT* optional
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef CertFreeCRLContextNative = Int32 Function(Pointer<Void>);
typedef CertFreeCRLContextDart = int Function(Pointer<Void>);
final CertFreeCRLContext = DynamicLibrary.open('CRYPT32.dll')
    .lookupFunction<CertFreeCRLContextNative, CertFreeCRLContextDart>('CertFreeCRLContext');
// pCrlContext : CRL_CONTEXT* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function CertFreeCRLContext(
  pCrlContext: Pointer   // CRL_CONTEXT* optional
): BOOL; stdcall;
  external 'CRYPT32.dll' name 'CertFreeCRLContext';
import Foreign
import Foreign.C.Types
import Foreign.C.String

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

let certfreecrlcontext =
  foreign "CertFreeCRLContext"
    ((ptr void) @-> returning int32_t)
(* pCrlContext : CRL_CONTEXT* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library crypt32 (t "CRYPT32.dll"))
(cffi:use-foreign-library crypt32)

(cffi:defcfun ("CertFreeCRLContext" cert-free-crlcontext :convention :stdcall) :int32
  (p-crl-context :pointer))   ; CRL_CONTEXT* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CertFreeCRLContext = Win32::API::More->new('CRYPT32',
    'BOOL CertFreeCRLContext(LPVOID pCrlContext)');
# my $ret = $CertFreeCRLContext->Call($pCrlContext);
# pCrlContext : CRL_CONTEXT* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目
使用する型