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

CertDuplicateCRLContext

関数
CRLコンテキストを複製して参照を増やす。
DLLCRYPT32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

CRL_CONTEXT* CertDuplicateCRLContext(
    CRL_CONTEXT* pCrlContext   // optional
);

パラメーター

名前方向
pCrlContextCRL_CONTEXT*inoptional

戻り値の型: CRL_CONTEXT*

各言語での呼び出し定義

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

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

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

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

var (
	crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
	procCertDuplicateCRLContext = crypt32.NewProc("CertDuplicateCRLContext")
)

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