ホーム › Security.Cryptography › CertDuplicateStore
CertDuplicateStore
関数証明書ストアのハンドルを複製して参照を増やす。
シグネチャ
// CRYPT32.dll
#include <windows.h>
HCERTSTORE CertDuplicateStore(
HCERTSTORE hCertStore
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hCertStore | HCERTSTORE | in |
戻り値の型: HCERTSTORE
各言語での呼び出し定義
// CRYPT32.dll
#include <windows.h>
HCERTSTORE CertDuplicateStore(
HCERTSTORE hCertStore
);[DllImport("CRYPT32.dll", ExactSpelling = true)]
static extern IntPtr CertDuplicateStore(
IntPtr hCertStore // HCERTSTORE
);<DllImport("CRYPT32.dll", ExactSpelling:=True)>
Public Shared Function CertDuplicateStore(
hCertStore As IntPtr ' HCERTSTORE
) As IntPtr
End Function' hCertStore : HCERTSTORE
Declare PtrSafe Function CertDuplicateStore Lib "crypt32" ( _
ByVal hCertStore As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CertDuplicateStore = ctypes.windll.crypt32.CertDuplicateStore
CertDuplicateStore.restype = ctypes.c_void_p
CertDuplicateStore.argtypes = [
wintypes.HANDLE, # hCertStore : HCERTSTORE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CRYPT32.dll')
CertDuplicateStore = Fiddle::Function.new(
lib['CertDuplicateStore'],
[
Fiddle::TYPE_VOIDP, # hCertStore : HCERTSTORE
],
Fiddle::TYPE_VOIDP)#[link(name = "crypt32")]
extern "system" {
fn CertDuplicateStore(
hCertStore: *mut core::ffi::c_void // HCERTSTORE
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CRYPT32.dll")]
public static extern IntPtr CertDuplicateStore(IntPtr hCertStore);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CertDuplicateStore' -Namespace Win32 -PassThru
# $api::CertDuplicateStore(hCertStore)#uselib "CRYPT32.dll"
#func global CertDuplicateStore "CertDuplicateStore" sptr
; CertDuplicateStore hCertStore ; 戻り値は stat
; hCertStore : HCERTSTORE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CRYPT32.dll"
#cfunc global CertDuplicateStore "CertDuplicateStore" sptr
; res = CertDuplicateStore(hCertStore)
; hCertStore : HCERTSTORE -> "sptr"; HCERTSTORE CertDuplicateStore(HCERTSTORE hCertStore)
#uselib "CRYPT32.dll"
#cfunc global CertDuplicateStore "CertDuplicateStore" intptr
; res = CertDuplicateStore(hCertStore)
; hCertStore : HCERTSTORE -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
procCertDuplicateStore = crypt32.NewProc("CertDuplicateStore")
)
// hCertStore (HCERTSTORE)
r1, _, err := procCertDuplicateStore.Call(
uintptr(hCertStore),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HCERTSTOREfunction CertDuplicateStore(
hCertStore: THandle // HCERTSTORE
): THandle; stdcall;
external 'CRYPT32.dll' name 'CertDuplicateStore';result := DllCall("CRYPT32\CertDuplicateStore"
, "Ptr", hCertStore ; HCERTSTORE
, "Ptr") ; return: HCERTSTORE●CertDuplicateStore(hCertStore) = DLL("CRYPT32.dll", "void* CertDuplicateStore(void*)")
# 呼び出し: CertDuplicateStore(hCertStore)
# hCertStore : HCERTSTORE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。