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

CryptMsgClose

関数
暗号メッセージハンドルを閉じて解放する。
DLLCRYPT32.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL CryptMsgClose(
    void* hCryptMsg   // optional
);

パラメーター

名前方向
hCryptMsgvoid*inoptional

戻り値の型: BOOL

各言語での呼び出し定義

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

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

CryptMsgClose = ctypes.windll.crypt32.CryptMsgClose
CryptMsgClose.restype = wintypes.BOOL
CryptMsgClose.argtypes = [
    ctypes.POINTER(None),  # hCryptMsg : void* optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
	procCryptMsgClose = crypt32.NewProc("CryptMsgClose")
)

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