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

CryptDestroyHash

関数
ハッシュオブジェクトを破棄する。
DLLADVAPI32.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL CryptDestroyHash(
    UINT_PTR hHash
);

パラメーター

名前方向
hHashUINT_PTRin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL CryptDestroyHash(
    UINT_PTR hHash
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ADVAPI32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool CryptDestroyHash(
    UIntPtr hHash   // UINT_PTR
);
<DllImport("ADVAPI32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CryptDestroyHash(
    hHash As UIntPtr   ' UINT_PTR
) As Boolean
End Function
' hHash : UINT_PTR
Declare PtrSafe Function CryptDestroyHash Lib "advapi32" ( _
    ByVal hHash As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CryptDestroyHash = ctypes.windll.advapi32.CryptDestroyHash
CryptDestroyHash.restype = wintypes.BOOL
CryptDestroyHash.argtypes = [
    ctypes.c_size_t,  # hHash : UINT_PTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ADVAPI32.dll')
CryptDestroyHash = Fiddle::Function.new(
  lib['CryptDestroyHash'],
  [
    Fiddle::TYPE_UINTPTR_T,  # hHash : UINT_PTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "advapi32")]
extern "system" {
    fn CryptDestroyHash(
        hHash: usize  // UINT_PTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ADVAPI32.dll", SetLastError = true)]
public static extern bool CryptDestroyHash(UIntPtr hHash);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_CryptDestroyHash' -Namespace Win32 -PassThru
# $api::CryptDestroyHash(hHash)
#uselib "ADVAPI32.dll"
#func global CryptDestroyHash "CryptDestroyHash" sptr
; CryptDestroyHash hHash   ; 戻り値は stat
; hHash : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ADVAPI32.dll"
#cfunc global CryptDestroyHash "CryptDestroyHash" sptr
; res = CryptDestroyHash(hHash)
; hHash : UINT_PTR -> "sptr"
; BOOL CryptDestroyHash(UINT_PTR hHash)
#uselib "ADVAPI32.dll"
#cfunc global CryptDestroyHash "CryptDestroyHash" intptr
; res = CryptDestroyHash(hHash)
; hHash : UINT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
	procCryptDestroyHash = advapi32.NewProc("CryptDestroyHash")
)

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