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

CryptInstallCancelRetrieval

関数
オブジェクト取得をキャンセルするコールバックをインストールする。
DLLCRYPTNET.dll呼出規約winapi

シグネチャ

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

BOOL CryptInstallCancelRetrieval(
    PFN_CRYPT_CANCEL_RETRIEVAL pfnCancel,
    const void* pvArg,   // optional
    DWORD dwFlags,
    void* pvReserved   // optional
);

パラメーター

名前方向
pfnCancelPFN_CRYPT_CANCEL_RETRIEVALin
pvArgvoid*inoptional
dwFlagsDWORDin
pvReservedvoid*optional

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL CryptInstallCancelRetrieval(
    PFN_CRYPT_CANCEL_RETRIEVAL pfnCancel,
    const void* pvArg,   // optional
    DWORD dwFlags,
    void* pvReserved   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPTNET.dll", ExactSpelling = true)]
static extern bool CryptInstallCancelRetrieval(
    IntPtr pfnCancel,   // PFN_CRYPT_CANCEL_RETRIEVAL
    IntPtr pvArg,   // void* optional
    uint dwFlags,   // DWORD
    IntPtr pvReserved   // void* optional
);
<DllImport("CRYPTNET.dll", ExactSpelling:=True)>
Public Shared Function CryptInstallCancelRetrieval(
    pfnCancel As IntPtr,   ' PFN_CRYPT_CANCEL_RETRIEVAL
    pvArg As IntPtr,   ' void* optional
    dwFlags As UInteger,   ' DWORD
    pvReserved As IntPtr   ' void* optional
) As Boolean
End Function
' pfnCancel : PFN_CRYPT_CANCEL_RETRIEVAL
' pvArg : void* optional
' dwFlags : DWORD
' pvReserved : void* optional
Declare PtrSafe Function CryptInstallCancelRetrieval Lib "cryptnet" ( _
    ByVal pfnCancel As LongPtr, _
    ByVal pvArg As LongPtr, _
    ByVal dwFlags As Long, _
    ByVal pvReserved As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CryptInstallCancelRetrieval = ctypes.windll.cryptnet.CryptInstallCancelRetrieval
CryptInstallCancelRetrieval.restype = wintypes.BOOL
CryptInstallCancelRetrieval.argtypes = [
    ctypes.c_void_p,  # pfnCancel : PFN_CRYPT_CANCEL_RETRIEVAL
    ctypes.POINTER(None),  # pvArg : void* optional
    wintypes.DWORD,  # dwFlags : DWORD
    ctypes.POINTER(None),  # pvReserved : void* optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	cryptnet = windows.NewLazySystemDLL("CRYPTNET.dll")
	procCryptInstallCancelRetrieval = cryptnet.NewProc("CryptInstallCancelRetrieval")
)

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