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

CryptMsgDuplicate

関数
暗号メッセージハンドルを複製して参照を増やす。
DLLCRYPT32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

void* CryptMsgDuplicate(
    void* hCryptMsg   // optional
);

パラメーター

名前方向
hCryptMsgvoid*inoptional

戻り値の型: void*

各言語での呼び出し定義

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

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

CryptMsgDuplicate = ctypes.windll.crypt32.CryptMsgDuplicate
CryptMsgDuplicate.restype = ctypes.c_void_p
CryptMsgDuplicate.argtypes = [
    ctypes.POINTER(None),  # hCryptMsg : void* optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
	procCryptMsgDuplicate = crypt32.NewProc("CryptMsgDuplicate")
)

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