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