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

CertSrvRestoreRegisterComplete

関数
証明書サービスの復元登録処理を完了させる。
DLLcertadm.dll呼出規約winapi対応OSwindowsserver2003

シグネチャ

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

HRESULT CertSrvRestoreRegisterComplete(
    void* hbc,
    HRESULT hrRestoreState
);

パラメーター

名前方向説明
hbcvoid*inoutCertSrvRestorePrepareWで取得したリストアコンテキストハンドル。
hrRestoreStateHRESULTinリストア処理の最終結果を示すHRESULT。成功はS_OKを指定する。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT CertSrvRestoreRegisterComplete(
    void* hbc,
    HRESULT hrRestoreState
);
[DllImport("certadm.dll", ExactSpelling = true)]
static extern int CertSrvRestoreRegisterComplete(
    IntPtr hbc,   // void* in/out
    int hrRestoreState   // HRESULT
);
<DllImport("certadm.dll", ExactSpelling:=True)>
Public Shared Function CertSrvRestoreRegisterComplete(
    hbc As IntPtr,   ' void* in/out
    hrRestoreState As Integer   ' HRESULT
) As Integer
End Function
' hbc : void* in/out
' hrRestoreState : HRESULT
Declare PtrSafe Function CertSrvRestoreRegisterComplete Lib "certadm" ( _
    ByVal hbc As LongPtr, _
    ByVal hrRestoreState As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CertSrvRestoreRegisterComplete = ctypes.windll.certadm.CertSrvRestoreRegisterComplete
CertSrvRestoreRegisterComplete.restype = ctypes.c_int
CertSrvRestoreRegisterComplete.argtypes = [
    ctypes.POINTER(None),  # hbc : void* in/out
    ctypes.c_int,  # hrRestoreState : HRESULT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	certadm = windows.NewLazySystemDLL("certadm.dll")
	procCertSrvRestoreRegisterComplete = certadm.NewProc("CertSrvRestoreRegisterComplete")
)

// hbc (void* in/out), hrRestoreState (HRESULT)
r1, _, err := procCertSrvRestoreRegisterComplete.Call(
	uintptr(hbc),
	uintptr(hrRestoreState),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function CertSrvRestoreRegisterComplete(
  hbc: Pointer;   // void* in/out
  hrRestoreState: Integer   // HRESULT
): Integer; stdcall;
  external 'certadm.dll' name 'CertSrvRestoreRegisterComplete';
result := DllCall("certadm\CertSrvRestoreRegisterComplete"
    , "Ptr", hbc   ; void* in/out
    , "Int", hrRestoreState   ; HRESULT
    , "Int")   ; return: HRESULT
●CertSrvRestoreRegisterComplete(hbc, hrRestoreState) = DLL("certadm.dll", "int CertSrvRestoreRegisterComplete(void*, int)")
# 呼び出し: CertSrvRestoreRegisterComplete(hbc, hrRestoreState)
# hbc : void* in/out -> "void*"
# hrRestoreState : HRESULT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。