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