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

BCryptDestroyHash

関数
CNGのハッシュオブジェクトを破棄する。
DLLbcrypt.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

NTSTATUS BCryptDestroyHash(
    BCRYPT_HASH_HANDLE hHash
);

パラメーター

名前方向
hHashBCRYPT_HASH_HANDLEinout

戻り値の型: NTSTATUS

各言語での呼び出し定義

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

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

BCryptDestroyHash = ctypes.windll.bcrypt.BCryptDestroyHash
BCryptDestroyHash.restype = ctypes.c_int
BCryptDestroyHash.argtypes = [
    wintypes.HANDLE,  # hHash : BCRYPT_HASH_HANDLE in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	bcrypt = windows.NewLazySystemDLL("bcrypt.dll")
	procBCryptDestroyHash = bcrypt.NewProc("BCryptDestroyHash")
)

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