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

CryptXmlGetReference

関数
XML署名のReference構造体情報を取得する。
DLLCRYPTXML.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT CryptXmlGetReference(
    void* hCryptXml,
    const CRYPT_XML_REFERENCE** ppStruct
);

パラメーター

名前方向
hCryptXmlvoid*in
ppStructCRYPT_XML_REFERENCE**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT CryptXmlGetReference(
    void* hCryptXml,
    const CRYPT_XML_REFERENCE** ppStruct
);
[DllImport("CRYPTXML.dll", ExactSpelling = true)]
static extern int CryptXmlGetReference(
    IntPtr hCryptXml,   // void*
    IntPtr ppStruct   // CRYPT_XML_REFERENCE** out
);
<DllImport("CRYPTXML.dll", ExactSpelling:=True)>
Public Shared Function CryptXmlGetReference(
    hCryptXml As IntPtr,   ' void*
    ppStruct As IntPtr   ' CRYPT_XML_REFERENCE** out
) As Integer
End Function
' hCryptXml : void*
' ppStruct : CRYPT_XML_REFERENCE** out
Declare PtrSafe Function CryptXmlGetReference Lib "cryptxml" ( _
    ByVal hCryptXml As LongPtr, _
    ByVal ppStruct As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CryptXmlGetReference = ctypes.windll.cryptxml.CryptXmlGetReference
CryptXmlGetReference.restype = ctypes.c_int
CryptXmlGetReference.argtypes = [
    ctypes.POINTER(None),  # hCryptXml : void*
    ctypes.c_void_p,  # ppStruct : CRYPT_XML_REFERENCE** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CRYPTXML.dll')
CryptXmlGetReference = Fiddle::Function.new(
  lib['CryptXmlGetReference'],
  [
    Fiddle::TYPE_VOIDP,  # hCryptXml : void*
    Fiddle::TYPE_VOIDP,  # ppStruct : CRYPT_XML_REFERENCE** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "cryptxml")]
extern "system" {
    fn CryptXmlGetReference(
        hCryptXml: *mut (),  // void*
        ppStruct: *const *const CRYPT_XML_REFERENCE  // CRYPT_XML_REFERENCE** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CRYPTXML.dll")]
public static extern int CryptXmlGetReference(IntPtr hCryptXml, IntPtr ppStruct);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPTXML_CryptXmlGetReference' -Namespace Win32 -PassThru
# $api::CryptXmlGetReference(hCryptXml, ppStruct)
#uselib "CRYPTXML.dll"
#func global CryptXmlGetReference "CryptXmlGetReference" sptr, sptr
; CryptXmlGetReference hCryptXml, varptr(ppStruct)   ; 戻り値は stat
; hCryptXml : void* -> "sptr"
; ppStruct : CRYPT_XML_REFERENCE** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "CRYPTXML.dll"
#cfunc global CryptXmlGetReference "CryptXmlGetReference" sptr, var
; res = CryptXmlGetReference(hCryptXml, ppStruct)
; hCryptXml : void* -> "sptr"
; ppStruct : CRYPT_XML_REFERENCE** out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT CryptXmlGetReference(void* hCryptXml, CRYPT_XML_REFERENCE** ppStruct)
#uselib "CRYPTXML.dll"
#cfunc global CryptXmlGetReference "CryptXmlGetReference" intptr, var
; res = CryptXmlGetReference(hCryptXml, ppStruct)
; hCryptXml : void* -> "intptr"
; ppStruct : CRYPT_XML_REFERENCE** out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	cryptxml = windows.NewLazySystemDLL("CRYPTXML.dll")
	procCryptXmlGetReference = cryptxml.NewProc("CryptXmlGetReference")
)

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