ホーム › Security.Cryptography › CertAddCRLContextToStore
CertAddCRLContextToStore
関数CRLコンテキストをストアに追加する。
シグネチャ
// CRYPT32.dll
#include <windows.h>
BOOL CertAddCRLContextToStore(
HCERTSTORE hCertStore, // optional
CRL_CONTEXT* pCrlContext,
DWORD dwAddDisposition,
CRL_CONTEXT** ppStoreContext // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hCertStore | HCERTSTORE | inoptional |
| pCrlContext | CRL_CONTEXT* | in |
| dwAddDisposition | DWORD | in |
| ppStoreContext | CRL_CONTEXT** | outoptional |
戻り値の型: BOOL
各言語での呼び出し定義
// CRYPT32.dll
#include <windows.h>
BOOL CertAddCRLContextToStore(
HCERTSTORE hCertStore, // optional
CRL_CONTEXT* pCrlContext,
DWORD dwAddDisposition,
CRL_CONTEXT** ppStoreContext // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool CertAddCRLContextToStore(
IntPtr hCertStore, // HCERTSTORE optional
IntPtr pCrlContext, // CRL_CONTEXT*
uint dwAddDisposition, // DWORD
IntPtr ppStoreContext // CRL_CONTEXT** optional, out
);<DllImport("CRYPT32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CertAddCRLContextToStore(
hCertStore As IntPtr, ' HCERTSTORE optional
pCrlContext As IntPtr, ' CRL_CONTEXT*
dwAddDisposition As UInteger, ' DWORD
ppStoreContext As IntPtr ' CRL_CONTEXT** optional, out
) As Boolean
End Function' hCertStore : HCERTSTORE optional
' pCrlContext : CRL_CONTEXT*
' dwAddDisposition : DWORD
' ppStoreContext : CRL_CONTEXT** optional, out
Declare PtrSafe Function CertAddCRLContextToStore Lib "crypt32" ( _
ByVal hCertStore As LongPtr, _
ByVal pCrlContext As LongPtr, _
ByVal dwAddDisposition As Long, _
ByVal ppStoreContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CertAddCRLContextToStore = ctypes.windll.crypt32.CertAddCRLContextToStore
CertAddCRLContextToStore.restype = wintypes.BOOL
CertAddCRLContextToStore.argtypes = [
wintypes.HANDLE, # hCertStore : HCERTSTORE optional
ctypes.c_void_p, # pCrlContext : CRL_CONTEXT*
wintypes.DWORD, # dwAddDisposition : DWORD
ctypes.c_void_p, # ppStoreContext : CRL_CONTEXT** optional, out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CRYPT32.dll')
CertAddCRLContextToStore = Fiddle::Function.new(
lib['CertAddCRLContextToStore'],
[
Fiddle::TYPE_VOIDP, # hCertStore : HCERTSTORE optional
Fiddle::TYPE_VOIDP, # pCrlContext : CRL_CONTEXT*
-Fiddle::TYPE_INT, # dwAddDisposition : DWORD
Fiddle::TYPE_VOIDP, # ppStoreContext : CRL_CONTEXT** optional, out
],
Fiddle::TYPE_INT)#[link(name = "crypt32")]
extern "system" {
fn CertAddCRLContextToStore(
hCertStore: *mut core::ffi::c_void, // HCERTSTORE optional
pCrlContext: *mut CRL_CONTEXT, // CRL_CONTEXT*
dwAddDisposition: u32, // DWORD
ppStoreContext: *mut *mut CRL_CONTEXT // CRL_CONTEXT** optional, out
) -> 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 CertAddCRLContextToStore(IntPtr hCertStore, IntPtr pCrlContext, uint dwAddDisposition, IntPtr ppStoreContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CertAddCRLContextToStore' -Namespace Win32 -PassThru
# $api::CertAddCRLContextToStore(hCertStore, pCrlContext, dwAddDisposition, ppStoreContext)#uselib "CRYPT32.dll"
#func global CertAddCRLContextToStore "CertAddCRLContextToStore" sptr, sptr, sptr, sptr
; CertAddCRLContextToStore hCertStore, varptr(pCrlContext), dwAddDisposition, varptr(ppStoreContext) ; 戻り値は stat
; hCertStore : HCERTSTORE optional -> "sptr"
; pCrlContext : CRL_CONTEXT* -> "sptr"
; dwAddDisposition : DWORD -> "sptr"
; ppStoreContext : CRL_CONTEXT** optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CRYPT32.dll" #cfunc global CertAddCRLContextToStore "CertAddCRLContextToStore" sptr, var, int, var ; res = CertAddCRLContextToStore(hCertStore, pCrlContext, dwAddDisposition, ppStoreContext) ; hCertStore : HCERTSTORE optional -> "sptr" ; pCrlContext : CRL_CONTEXT* -> "var" ; dwAddDisposition : DWORD -> "int" ; ppStoreContext : CRL_CONTEXT** optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CRYPT32.dll" #cfunc global CertAddCRLContextToStore "CertAddCRLContextToStore" sptr, sptr, int, sptr ; res = CertAddCRLContextToStore(hCertStore, varptr(pCrlContext), dwAddDisposition, varptr(ppStoreContext)) ; hCertStore : HCERTSTORE optional -> "sptr" ; pCrlContext : CRL_CONTEXT* -> "sptr" ; dwAddDisposition : DWORD -> "int" ; ppStoreContext : CRL_CONTEXT** optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL CertAddCRLContextToStore(HCERTSTORE hCertStore, CRL_CONTEXT* pCrlContext, DWORD dwAddDisposition, CRL_CONTEXT** ppStoreContext) #uselib "CRYPT32.dll" #cfunc global CertAddCRLContextToStore "CertAddCRLContextToStore" intptr, var, int, var ; res = CertAddCRLContextToStore(hCertStore, pCrlContext, dwAddDisposition, ppStoreContext) ; hCertStore : HCERTSTORE optional -> "intptr" ; pCrlContext : CRL_CONTEXT* -> "var" ; dwAddDisposition : DWORD -> "int" ; ppStoreContext : CRL_CONTEXT** optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CertAddCRLContextToStore(HCERTSTORE hCertStore, CRL_CONTEXT* pCrlContext, DWORD dwAddDisposition, CRL_CONTEXT** ppStoreContext) #uselib "CRYPT32.dll" #cfunc global CertAddCRLContextToStore "CertAddCRLContextToStore" intptr, intptr, int, intptr ; res = CertAddCRLContextToStore(hCertStore, varptr(pCrlContext), dwAddDisposition, varptr(ppStoreContext)) ; hCertStore : HCERTSTORE optional -> "intptr" ; pCrlContext : CRL_CONTEXT* -> "intptr" ; dwAddDisposition : DWORD -> "int" ; ppStoreContext : CRL_CONTEXT** optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
procCertAddCRLContextToStore = crypt32.NewProc("CertAddCRLContextToStore")
)
// hCertStore (HCERTSTORE optional), pCrlContext (CRL_CONTEXT*), dwAddDisposition (DWORD), ppStoreContext (CRL_CONTEXT** optional, out)
r1, _, err := procCertAddCRLContextToStore.Call(
uintptr(hCertStore),
uintptr(pCrlContext),
uintptr(dwAddDisposition),
uintptr(ppStoreContext),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CertAddCRLContextToStore(
hCertStore: THandle; // HCERTSTORE optional
pCrlContext: Pointer; // CRL_CONTEXT*
dwAddDisposition: DWORD; // DWORD
ppStoreContext: Pointer // CRL_CONTEXT** optional, out
): BOOL; stdcall;
external 'CRYPT32.dll' name 'CertAddCRLContextToStore';result := DllCall("CRYPT32\CertAddCRLContextToStore"
, "Ptr", hCertStore ; HCERTSTORE optional
, "Ptr", pCrlContext ; CRL_CONTEXT*
, "UInt", dwAddDisposition ; DWORD
, "Ptr", ppStoreContext ; CRL_CONTEXT** optional, out
, "Int") ; return: BOOL●CertAddCRLContextToStore(hCertStore, pCrlContext, dwAddDisposition, ppStoreContext) = DLL("CRYPT32.dll", "bool CertAddCRLContextToStore(void*, void*, dword, void*)")
# 呼び出し: CertAddCRLContextToStore(hCertStore, pCrlContext, dwAddDisposition, ppStoreContext)
# hCertStore : HCERTSTORE optional -> "void*"
# pCrlContext : CRL_CONTEXT* -> "void*"
# dwAddDisposition : DWORD -> "dword"
# ppStoreContext : CRL_CONTEXT** optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。