ホーム › Security.Cryptography › CertDeleteCRLFromStore
CertDeleteCRLFromStore
関数CRLをストアから削除する。
シグネチャ
// CRYPT32.dll
#include <windows.h>
BOOL CertDeleteCRLFromStore(
CRL_CONTEXT* pCrlContext
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pCrlContext | CRL_CONTEXT* | in | 削除する CRL_CONTEXT 構造体へのポインターです。 |
戻り値の型: BOOL
公式ドキュメント
CertDeleteCRLFromStore 関数は、指定された証明書失効リスト (CRL) コンテキストを証明書ストアから削除します。
戻り値
関数が成功した場合、戻り値は TRUE です。
関数が失敗した場合、戻り値は FALSE です。拡張エラー情報を取得するには、 GetLastError を呼び出します。考えられるエラーコードの 1 つを次に示します。
| 戻り値 | 説明 |
|---|---|
| ストアが読み取り専用で開かれており、削除操作が許可されていません。 |
解説(Remarks)
このストア内の CRL に対する以降のすべての取得 (get) または検索 (find) 操作は失敗します。ただし、CRL に割り当てられたメモリは、複製されたすべてのコンテキストも解放されるまで解放されません。
pCrlContext パラメーターは、エラーの場合でも、 CertFreeCRLContext を使用してこの関数によって常に解放されます。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// CRYPT32.dll
#include <windows.h>
BOOL CertDeleteCRLFromStore(
CRL_CONTEXT* pCrlContext
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool CertDeleteCRLFromStore(
IntPtr pCrlContext // CRL_CONTEXT*
);<DllImport("CRYPT32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CertDeleteCRLFromStore(
pCrlContext As IntPtr ' CRL_CONTEXT*
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' pCrlContext : CRL_CONTEXT*
Declare PtrSafe Function CertDeleteCRLFromStore 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
CertDeleteCRLFromStore = ctypes.windll.crypt32.CertDeleteCRLFromStore
CertDeleteCRLFromStore.restype = wintypes.BOOL
CertDeleteCRLFromStore.argtypes = [
ctypes.c_void_p, # pCrlContext : CRL_CONTEXT*
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CRYPT32.dll')
CertDeleteCRLFromStore = Fiddle::Function.new(
lib['CertDeleteCRLFromStore'],
[
Fiddle::TYPE_VOIDP, # pCrlContext : CRL_CONTEXT*
],
Fiddle::TYPE_INT)#[link(name = "crypt32")]
extern "system" {
fn CertDeleteCRLFromStore(
pCrlContext: *mut CRL_CONTEXT // CRL_CONTEXT*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", SetLastError = true)]
public static extern bool CertDeleteCRLFromStore(IntPtr pCrlContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CertDeleteCRLFromStore' -Namespace Win32 -PassThru
# $api::CertDeleteCRLFromStore(pCrlContext)#uselib "CRYPT32.dll"
#func global CertDeleteCRLFromStore "CertDeleteCRLFromStore" sptr
; CertDeleteCRLFromStore varptr(pCrlContext) ; 戻り値は stat
; pCrlContext : CRL_CONTEXT* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CRYPT32.dll" #cfunc global CertDeleteCRLFromStore "CertDeleteCRLFromStore" var ; res = CertDeleteCRLFromStore(pCrlContext) ; pCrlContext : CRL_CONTEXT* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CRYPT32.dll" #cfunc global CertDeleteCRLFromStore "CertDeleteCRLFromStore" sptr ; res = CertDeleteCRLFromStore(varptr(pCrlContext)) ; pCrlContext : CRL_CONTEXT* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL CertDeleteCRLFromStore(CRL_CONTEXT* pCrlContext) #uselib "CRYPT32.dll" #cfunc global CertDeleteCRLFromStore "CertDeleteCRLFromStore" var ; res = CertDeleteCRLFromStore(pCrlContext) ; pCrlContext : CRL_CONTEXT* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CertDeleteCRLFromStore(CRL_CONTEXT* pCrlContext) #uselib "CRYPT32.dll" #cfunc global CertDeleteCRLFromStore "CertDeleteCRLFromStore" intptr ; res = CertDeleteCRLFromStore(varptr(pCrlContext)) ; pCrlContext : CRL_CONTEXT* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
procCertDeleteCRLFromStore = crypt32.NewProc("CertDeleteCRLFromStore")
)
// pCrlContext (CRL_CONTEXT*)
r1, _, err := procCertDeleteCRLFromStore.Call(
uintptr(pCrlContext),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CertDeleteCRLFromStore(
pCrlContext: Pointer // CRL_CONTEXT*
): BOOL; stdcall;
external 'CRYPT32.dll' name 'CertDeleteCRLFromStore';result := DllCall("CRYPT32\CertDeleteCRLFromStore"
, "Ptr", pCrlContext ; CRL_CONTEXT*
, "Int") ; return: BOOL●CertDeleteCRLFromStore(pCrlContext) = DLL("CRYPT32.dll", "bool CertDeleteCRLFromStore(void*)")
# 呼び出し: CertDeleteCRLFromStore(pCrlContext)
# pCrlContext : CRL_CONTEXT* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "crypt32" fn CertDeleteCRLFromStore(
pCrlContext: [*c]CRL_CONTEXT // CRL_CONTEXT*
) callconv(std.os.windows.WINAPI) i32;proc CertDeleteCRLFromStore(
pCrlContext: ptr CRL_CONTEXT # CRL_CONTEXT*
): int32 {.importc: "CertDeleteCRLFromStore", stdcall, dynlib: "CRYPT32.dll".}pragma(lib, "crypt32");
extern(Windows)
int CertDeleteCRLFromStore(
CRL_CONTEXT* pCrlContext // CRL_CONTEXT*
);ccall((:CertDeleteCRLFromStore, "CRYPT32.dll"), stdcall, Int32,
(Ptr{CRL_CONTEXT},),
pCrlContext)
# pCrlContext : CRL_CONTEXT* -> Ptr{CRL_CONTEXT}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CertDeleteCRLFromStore(
void* pCrlContext);
]]
local crypt32 = ffi.load("crypt32")
-- crypt32.CertDeleteCRLFromStore(pCrlContext)
-- pCrlContext : CRL_CONTEXT*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('CRYPT32.dll');
const CertDeleteCRLFromStore = lib.func('__stdcall', 'CertDeleteCRLFromStore', 'int32_t', ['void *']);
// CertDeleteCRLFromStore(pCrlContext)
// pCrlContext : CRL_CONTEXT* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("CRYPT32.dll", {
CertDeleteCRLFromStore: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.CertDeleteCRLFromStore(pCrlContext)
// pCrlContext : CRL_CONTEXT* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CertDeleteCRLFromStore(
void* pCrlContext);
C, "CRYPT32.dll");
// $ffi->CertDeleteCRLFromStore(pCrlContext);
// pCrlContext : CRL_CONTEXT*
// 構造体/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 CertDeleteCRLFromStore(
Pointer pCrlContext // CRL_CONTEXT*
);
}@[Link("crypt32")]
lib LibCRYPT32
fun CertDeleteCRLFromStore = CertDeleteCRLFromStore(
pCrlContext : CRL_CONTEXT* # CRL_CONTEXT*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CertDeleteCRLFromStoreNative = Int32 Function(Pointer<Void>);
typedef CertDeleteCRLFromStoreDart = int Function(Pointer<Void>);
final CertDeleteCRLFromStore = DynamicLibrary.open('CRYPT32.dll')
.lookupFunction<CertDeleteCRLFromStoreNative, CertDeleteCRLFromStoreDart>('CertDeleteCRLFromStore');
// pCrlContext : CRL_CONTEXT* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CertDeleteCRLFromStore(
pCrlContext: Pointer // CRL_CONTEXT*
): BOOL; stdcall;
external 'CRYPT32.dll' name 'CertDeleteCRLFromStore';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CertDeleteCRLFromStore"
c_CertDeleteCRLFromStore :: Ptr () -> IO CInt
-- pCrlContext : CRL_CONTEXT* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let certdeletecrlfromstore =
foreign "CertDeleteCRLFromStore"
((ptr void) @-> returning int32_t)
(* pCrlContext : CRL_CONTEXT* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library crypt32 (t "CRYPT32.dll"))
(cffi:use-foreign-library crypt32)
(cffi:defcfun ("CertDeleteCRLFromStore" cert-delete-crlfrom-store :convention :stdcall) :int32
(p-crl-context :pointer)) ; CRL_CONTEXT*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CertDeleteCRLFromStore = Win32::API::More->new('CRYPT32',
'BOOL CertDeleteCRLFromStore(LPVOID pCrlContext)');
# my $ret = $CertDeleteCRLFromStore->Call($pCrlContext);
# pCrlContext : CRL_CONTEXT* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f CertFreeCRLContext — CRLコンテキストを解放する。
使用する型