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

CertGetServerOcspResponseContext

関数
サーバーOCSP応答から応答コンテキストを取得する。
DLLCRYPT32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

CERT_SERVER_OCSP_RESPONSE_CONTEXT* CertGetServerOcspResponseContext(
    void* hServerOcspResponse,
    DWORD dwFlags,
    void* pvReserved   // optional
);

パラメーター

名前方向
hServerOcspResponsevoid*in
dwFlagsDWORDin
pvReservedvoid*optional

戻り値の型: CERT_SERVER_OCSP_RESPONSE_CONTEXT*

各言語での呼び出し定義

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

CERT_SERVER_OCSP_RESPONSE_CONTEXT* CertGetServerOcspResponseContext(
    void* hServerOcspResponse,
    DWORD dwFlags,
    void* pvReserved   // optional
);
[DllImport("CRYPT32.dll", ExactSpelling = true)]
static extern IntPtr CertGetServerOcspResponseContext(
    IntPtr hServerOcspResponse,   // void*
    uint dwFlags,   // DWORD
    IntPtr pvReserved   // void* optional
);
<DllImport("CRYPT32.dll", ExactSpelling:=True)>
Public Shared Function CertGetServerOcspResponseContext(
    hServerOcspResponse As IntPtr,   ' void*
    dwFlags As UInteger,   ' DWORD
    pvReserved As IntPtr   ' void* optional
) As IntPtr
End Function
' hServerOcspResponse : void*
' dwFlags : DWORD
' pvReserved : void* optional
Declare PtrSafe Function CertGetServerOcspResponseContext Lib "crypt32" ( _
    ByVal hServerOcspResponse As LongPtr, _
    ByVal dwFlags As Long, _
    ByVal pvReserved As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CertGetServerOcspResponseContext = ctypes.windll.crypt32.CertGetServerOcspResponseContext
CertGetServerOcspResponseContext.restype = ctypes.c_void_p
CertGetServerOcspResponseContext.argtypes = [
    ctypes.POINTER(None),  # hServerOcspResponse : void*
    wintypes.DWORD,  # dwFlags : DWORD
    ctypes.POINTER(None),  # pvReserved : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CRYPT32.dll')
CertGetServerOcspResponseContext = Fiddle::Function.new(
  lib['CertGetServerOcspResponseContext'],
  [
    Fiddle::TYPE_VOIDP,  # hServerOcspResponse : void*
    -Fiddle::TYPE_INT,  # dwFlags : DWORD
    Fiddle::TYPE_VOIDP,  # pvReserved : void* optional
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "crypt32")]
extern "system" {
    fn CertGetServerOcspResponseContext(
        hServerOcspResponse: *mut (),  // void*
        dwFlags: u32,  // DWORD
        pvReserved: *mut ()  // void* optional
    ) -> *mut CERT_SERVER_OCSP_RESPONSE_CONTEXT;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CRYPT32.dll")]
public static extern IntPtr CertGetServerOcspResponseContext(IntPtr hServerOcspResponse, uint dwFlags, IntPtr pvReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CertGetServerOcspResponseContext' -Namespace Win32 -PassThru
# $api::CertGetServerOcspResponseContext(hServerOcspResponse, dwFlags, pvReserved)
#uselib "CRYPT32.dll"
#func global CertGetServerOcspResponseContext "CertGetServerOcspResponseContext" sptr, sptr, sptr
; CertGetServerOcspResponseContext hServerOcspResponse, dwFlags, pvReserved   ; 戻り値は stat
; hServerOcspResponse : void* -> "sptr"
; dwFlags : DWORD -> "sptr"
; pvReserved : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "CRYPT32.dll"
#cfunc global CertGetServerOcspResponseContext "CertGetServerOcspResponseContext" sptr, int, sptr
; res = CertGetServerOcspResponseContext(hServerOcspResponse, dwFlags, pvReserved)
; hServerOcspResponse : void* -> "sptr"
; dwFlags : DWORD -> "int"
; pvReserved : void* optional -> "sptr"
; CERT_SERVER_OCSP_RESPONSE_CONTEXT* CertGetServerOcspResponseContext(void* hServerOcspResponse, DWORD dwFlags, void* pvReserved)
#uselib "CRYPT32.dll"
#cfunc global CertGetServerOcspResponseContext "CertGetServerOcspResponseContext" intptr, int, intptr
; res = CertGetServerOcspResponseContext(hServerOcspResponse, dwFlags, pvReserved)
; hServerOcspResponse : void* -> "intptr"
; dwFlags : DWORD -> "int"
; pvReserved : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
	procCertGetServerOcspResponseContext = crypt32.NewProc("CertGetServerOcspResponseContext")
)

// hServerOcspResponse (void*), dwFlags (DWORD), pvReserved (void* optional)
r1, _, err := procCertGetServerOcspResponseContext.Call(
	uintptr(hServerOcspResponse),
	uintptr(dwFlags),
	uintptr(pvReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // CERT_SERVER_OCSP_RESPONSE_CONTEXT*
function CertGetServerOcspResponseContext(
  hServerOcspResponse: Pointer;   // void*
  dwFlags: DWORD;   // DWORD
  pvReserved: Pointer   // void* optional
): Pointer; stdcall;
  external 'CRYPT32.dll' name 'CertGetServerOcspResponseContext';
result := DllCall("CRYPT32\CertGetServerOcspResponseContext"
    , "Ptr", hServerOcspResponse   ; void*
    , "UInt", dwFlags   ; DWORD
    , "Ptr", pvReserved   ; void* optional
    , "Ptr")   ; return: CERT_SERVER_OCSP_RESPONSE_CONTEXT*
●CertGetServerOcspResponseContext(hServerOcspResponse, dwFlags, pvReserved) = DLL("CRYPT32.dll", "void* CertGetServerOcspResponseContext(void*, dword, void*)")
# 呼び出し: CertGetServerOcspResponseContext(hServerOcspResponse, dwFlags, pvReserved)
# hServerOcspResponse : void* -> "void*"
# dwFlags : DWORD -> "dword"
# pvReserved : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。