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

CertRemoveStoreFromCollection

関数
コレクションストアから兄弟ストアを除外する。
DLLCRYPT32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

void CertRemoveStoreFromCollection(
    HCERTSTORE hCollectionStore,
    HCERTSTORE hSiblingStore
);

パラメーター

名前方向
hCollectionStoreHCERTSTOREin
hSiblingStoreHCERTSTOREin

戻り値の型: void

各言語での呼び出し定義

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

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

CertRemoveStoreFromCollection = ctypes.windll.crypt32.CertRemoveStoreFromCollection
CertRemoveStoreFromCollection.restype = None
CertRemoveStoreFromCollection.argtypes = [
    wintypes.HANDLE,  # hCollectionStore : HCERTSTORE
    wintypes.HANDLE,  # hSiblingStore : HCERTSTORE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CRYPT32.dll')
CertRemoveStoreFromCollection = Fiddle::Function.new(
  lib['CertRemoveStoreFromCollection'],
  [
    Fiddle::TYPE_VOIDP,  # hCollectionStore : HCERTSTORE
    Fiddle::TYPE_VOIDP,  # hSiblingStore : HCERTSTORE
  ],
  Fiddle::TYPE_VOID)
#[link(name = "crypt32")]
extern "system" {
    fn CertRemoveStoreFromCollection(
        hCollectionStore: *mut core::ffi::c_void,  // HCERTSTORE
        hSiblingStore: *mut core::ffi::c_void  // HCERTSTORE
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CRYPT32.dll")]
public static extern void CertRemoveStoreFromCollection(IntPtr hCollectionStore, IntPtr hSiblingStore);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CertRemoveStoreFromCollection' -Namespace Win32 -PassThru
# $api::CertRemoveStoreFromCollection(hCollectionStore, hSiblingStore)
#uselib "CRYPT32.dll"
#func global CertRemoveStoreFromCollection "CertRemoveStoreFromCollection" sptr, sptr
; CertRemoveStoreFromCollection hCollectionStore, hSiblingStore
; hCollectionStore : HCERTSTORE -> "sptr"
; hSiblingStore : HCERTSTORE -> "sptr"
#uselib "CRYPT32.dll"
#func global CertRemoveStoreFromCollection "CertRemoveStoreFromCollection" sptr, sptr
; CertRemoveStoreFromCollection hCollectionStore, hSiblingStore
; hCollectionStore : HCERTSTORE -> "sptr"
; hSiblingStore : HCERTSTORE -> "sptr"
; void CertRemoveStoreFromCollection(HCERTSTORE hCollectionStore, HCERTSTORE hSiblingStore)
#uselib "CRYPT32.dll"
#func global CertRemoveStoreFromCollection "CertRemoveStoreFromCollection" intptr, intptr
; CertRemoveStoreFromCollection hCollectionStore, hSiblingStore
; hCollectionStore : HCERTSTORE -> "intptr"
; hSiblingStore : HCERTSTORE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
	procCertRemoveStoreFromCollection = crypt32.NewProc("CertRemoveStoreFromCollection")
)

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