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