ホーム › Security.Cryptography › CertCompareIntegerBlob
CertCompareIntegerBlob
関数2つの整数BLOBの値を符号付きで比較する。
シグネチャ
// CRYPT32.dll
#include <windows.h>
BOOL CertCompareIntegerBlob(
CRYPT_INTEGER_BLOB* pInt1,
CRYPT_INTEGER_BLOB* pInt2
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pInt1 | CRYPT_INTEGER_BLOB* | in |
| pInt2 | CRYPT_INTEGER_BLOB* | in |
戻り値の型: BOOL
各言語での呼び出し定義
// CRYPT32.dll
#include <windows.h>
BOOL CertCompareIntegerBlob(
CRYPT_INTEGER_BLOB* pInt1,
CRYPT_INTEGER_BLOB* pInt2
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool CertCompareIntegerBlob(
IntPtr pInt1, // CRYPT_INTEGER_BLOB*
IntPtr pInt2 // CRYPT_INTEGER_BLOB*
);<DllImport("CRYPT32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CertCompareIntegerBlob(
pInt1 As IntPtr, ' CRYPT_INTEGER_BLOB*
pInt2 As IntPtr ' CRYPT_INTEGER_BLOB*
) As Boolean
End Function' pInt1 : CRYPT_INTEGER_BLOB*
' pInt2 : CRYPT_INTEGER_BLOB*
Declare PtrSafe Function CertCompareIntegerBlob Lib "crypt32" ( _
ByVal pInt1 As LongPtr, _
ByVal pInt2 As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CertCompareIntegerBlob = ctypes.windll.crypt32.CertCompareIntegerBlob
CertCompareIntegerBlob.restype = wintypes.BOOL
CertCompareIntegerBlob.argtypes = [
ctypes.c_void_p, # pInt1 : CRYPT_INTEGER_BLOB*
ctypes.c_void_p, # pInt2 : CRYPT_INTEGER_BLOB*
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CRYPT32.dll')
CertCompareIntegerBlob = Fiddle::Function.new(
lib['CertCompareIntegerBlob'],
[
Fiddle::TYPE_VOIDP, # pInt1 : CRYPT_INTEGER_BLOB*
Fiddle::TYPE_VOIDP, # pInt2 : CRYPT_INTEGER_BLOB*
],
Fiddle::TYPE_INT)#[link(name = "crypt32")]
extern "system" {
fn CertCompareIntegerBlob(
pInt1: *mut CRYPT_INTEGER_BLOB, // CRYPT_INTEGER_BLOB*
pInt2: *mut CRYPT_INTEGER_BLOB // CRYPT_INTEGER_BLOB*
) -> 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 CertCompareIntegerBlob(IntPtr pInt1, IntPtr pInt2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CertCompareIntegerBlob' -Namespace Win32 -PassThru
# $api::CertCompareIntegerBlob(pInt1, pInt2)#uselib "CRYPT32.dll"
#func global CertCompareIntegerBlob "CertCompareIntegerBlob" sptr, sptr
; CertCompareIntegerBlob varptr(pInt1), varptr(pInt2) ; 戻り値は stat
; pInt1 : CRYPT_INTEGER_BLOB* -> "sptr"
; pInt2 : CRYPT_INTEGER_BLOB* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CRYPT32.dll" #cfunc global CertCompareIntegerBlob "CertCompareIntegerBlob" var, var ; res = CertCompareIntegerBlob(pInt1, pInt2) ; pInt1 : CRYPT_INTEGER_BLOB* -> "var" ; pInt2 : CRYPT_INTEGER_BLOB* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CRYPT32.dll" #cfunc global CertCompareIntegerBlob "CertCompareIntegerBlob" sptr, sptr ; res = CertCompareIntegerBlob(varptr(pInt1), varptr(pInt2)) ; pInt1 : CRYPT_INTEGER_BLOB* -> "sptr" ; pInt2 : CRYPT_INTEGER_BLOB* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL CertCompareIntegerBlob(CRYPT_INTEGER_BLOB* pInt1, CRYPT_INTEGER_BLOB* pInt2) #uselib "CRYPT32.dll" #cfunc global CertCompareIntegerBlob "CertCompareIntegerBlob" var, var ; res = CertCompareIntegerBlob(pInt1, pInt2) ; pInt1 : CRYPT_INTEGER_BLOB* -> "var" ; pInt2 : CRYPT_INTEGER_BLOB* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CertCompareIntegerBlob(CRYPT_INTEGER_BLOB* pInt1, CRYPT_INTEGER_BLOB* pInt2) #uselib "CRYPT32.dll" #cfunc global CertCompareIntegerBlob "CertCompareIntegerBlob" intptr, intptr ; res = CertCompareIntegerBlob(varptr(pInt1), varptr(pInt2)) ; pInt1 : CRYPT_INTEGER_BLOB* -> "intptr" ; pInt2 : CRYPT_INTEGER_BLOB* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
procCertCompareIntegerBlob = crypt32.NewProc("CertCompareIntegerBlob")
)
// pInt1 (CRYPT_INTEGER_BLOB*), pInt2 (CRYPT_INTEGER_BLOB*)
r1, _, err := procCertCompareIntegerBlob.Call(
uintptr(pInt1),
uintptr(pInt2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CertCompareIntegerBlob(
pInt1: Pointer; // CRYPT_INTEGER_BLOB*
pInt2: Pointer // CRYPT_INTEGER_BLOB*
): BOOL; stdcall;
external 'CRYPT32.dll' name 'CertCompareIntegerBlob';result := DllCall("CRYPT32\CertCompareIntegerBlob"
, "Ptr", pInt1 ; CRYPT_INTEGER_BLOB*
, "Ptr", pInt2 ; CRYPT_INTEGER_BLOB*
, "Int") ; return: BOOL●CertCompareIntegerBlob(pInt1, pInt2) = DLL("CRYPT32.dll", "bool CertCompareIntegerBlob(void*, void*)")
# 呼び出し: CertCompareIntegerBlob(pInt1, pInt2)
# pInt1 : CRYPT_INTEGER_BLOB* -> "void*"
# pInt2 : CRYPT_INTEGER_BLOB* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。