ホーム › Security.Cryptography.Sip › CryptSIPGetSignedDataMsg
CryptSIPGetSignedDataMsg
関数件名から署名済みデータメッセージを取得する。
シグネチャ
// WINTRUST.dll
#include <windows.h>
BOOL CryptSIPGetSignedDataMsg(
SIP_SUBJECTINFO* pSubjectInfo,
CERT_QUERY_ENCODING_TYPE* pdwEncodingType,
DWORD dwIndex,
DWORD* pcbSignedDataMsg,
BYTE* pbSignedDataMsg
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pSubjectInfo | SIP_SUBJECTINFO* | inout | 署名対象を記述するSIP_SUBJECTINFO構造体。 |
| pdwEncodingType | CERT_QUERY_ENCODING_TYPE* | inout | 取得した署名済みメッセージの符号化種別CERT_QUERY_ENCODING_TYPEを受け取る出力先。 |
| dwIndex | DWORD | in | 取得する署名のインデックス(0起点)。 |
| pcbSignedDataMsg | DWORD* | inout | 署名済みメッセージのバイト数。入力で容量、出力で必要/書込量を表す。 |
| pbSignedDataMsg | BYTE* | inout | 取得した署名済みメッセージを書き込む出力バッファ。NULLでサイズ問い合わせ。 |
戻り値の型: BOOL
各言語での呼び出し定義
// WINTRUST.dll
#include <windows.h>
BOOL CryptSIPGetSignedDataMsg(
SIP_SUBJECTINFO* pSubjectInfo,
CERT_QUERY_ENCODING_TYPE* pdwEncodingType,
DWORD dwIndex,
DWORD* pcbSignedDataMsg,
BYTE* pbSignedDataMsg
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WINTRUST.dll", SetLastError = true, ExactSpelling = true)]
static extern bool CryptSIPGetSignedDataMsg(
IntPtr pSubjectInfo, // SIP_SUBJECTINFO* in/out
ref uint pdwEncodingType, // CERT_QUERY_ENCODING_TYPE* in/out
uint dwIndex, // DWORD
ref uint pcbSignedDataMsg, // DWORD* in/out
IntPtr pbSignedDataMsg // BYTE* in/out
);<DllImport("WINTRUST.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CryptSIPGetSignedDataMsg(
pSubjectInfo As IntPtr, ' SIP_SUBJECTINFO* in/out
ByRef pdwEncodingType As UInteger, ' CERT_QUERY_ENCODING_TYPE* in/out
dwIndex As UInteger, ' DWORD
ByRef pcbSignedDataMsg As UInteger, ' DWORD* in/out
pbSignedDataMsg As IntPtr ' BYTE* in/out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' pSubjectInfo : SIP_SUBJECTINFO* in/out
' pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out
' dwIndex : DWORD
' pcbSignedDataMsg : DWORD* in/out
' pbSignedDataMsg : BYTE* in/out
Declare PtrSafe Function CryptSIPGetSignedDataMsg Lib "wintrust" ( _
ByVal pSubjectInfo As LongPtr, _
ByRef pdwEncodingType As Long, _
ByVal dwIndex As Long, _
ByRef pcbSignedDataMsg As Long, _
ByVal pbSignedDataMsg As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CryptSIPGetSignedDataMsg = ctypes.windll.wintrust.CryptSIPGetSignedDataMsg
CryptSIPGetSignedDataMsg.restype = wintypes.BOOL
CryptSIPGetSignedDataMsg.argtypes = [
ctypes.c_void_p, # pSubjectInfo : SIP_SUBJECTINFO* in/out
ctypes.c_void_p, # pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out
wintypes.DWORD, # dwIndex : DWORD
ctypes.POINTER(wintypes.DWORD), # pcbSignedDataMsg : DWORD* in/out
ctypes.POINTER(ctypes.c_ubyte), # pbSignedDataMsg : BYTE* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WINTRUST.dll')
CryptSIPGetSignedDataMsg = Fiddle::Function.new(
lib['CryptSIPGetSignedDataMsg'],
[
Fiddle::TYPE_VOIDP, # pSubjectInfo : SIP_SUBJECTINFO* in/out
Fiddle::TYPE_VOIDP, # pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out
-Fiddle::TYPE_INT, # dwIndex : DWORD
Fiddle::TYPE_VOIDP, # pcbSignedDataMsg : DWORD* in/out
Fiddle::TYPE_VOIDP, # pbSignedDataMsg : BYTE* in/out
],
Fiddle::TYPE_INT)#[link(name = "wintrust")]
extern "system" {
fn CryptSIPGetSignedDataMsg(
pSubjectInfo: *mut SIP_SUBJECTINFO, // SIP_SUBJECTINFO* in/out
pdwEncodingType: *mut u32, // CERT_QUERY_ENCODING_TYPE* in/out
dwIndex: u32, // DWORD
pcbSignedDataMsg: *mut u32, // DWORD* in/out
pbSignedDataMsg: *mut u8 // BYTE* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WINTRUST.dll", SetLastError = true)]
public static extern bool CryptSIPGetSignedDataMsg(IntPtr pSubjectInfo, ref uint pdwEncodingType, uint dwIndex, ref uint pcbSignedDataMsg, IntPtr pbSignedDataMsg);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINTRUST_CryptSIPGetSignedDataMsg' -Namespace Win32 -PassThru
# $api::CryptSIPGetSignedDataMsg(pSubjectInfo, pdwEncodingType, dwIndex, pcbSignedDataMsg, pbSignedDataMsg)#uselib "WINTRUST.dll"
#func global CryptSIPGetSignedDataMsg "CryptSIPGetSignedDataMsg" sptr, sptr, sptr, sptr, sptr
; CryptSIPGetSignedDataMsg varptr(pSubjectInfo), varptr(pdwEncodingType), dwIndex, varptr(pcbSignedDataMsg), varptr(pbSignedDataMsg) ; 戻り値は stat
; pSubjectInfo : SIP_SUBJECTINFO* in/out -> "sptr"
; pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> "sptr"
; dwIndex : DWORD -> "sptr"
; pcbSignedDataMsg : DWORD* in/out -> "sptr"
; pbSignedDataMsg : BYTE* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WINTRUST.dll" #cfunc global CryptSIPGetSignedDataMsg "CryptSIPGetSignedDataMsg" var, var, int, var, var ; res = CryptSIPGetSignedDataMsg(pSubjectInfo, pdwEncodingType, dwIndex, pcbSignedDataMsg, pbSignedDataMsg) ; pSubjectInfo : SIP_SUBJECTINFO* in/out -> "var" ; pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> "var" ; dwIndex : DWORD -> "int" ; pcbSignedDataMsg : DWORD* in/out -> "var" ; pbSignedDataMsg : BYTE* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WINTRUST.dll" #cfunc global CryptSIPGetSignedDataMsg "CryptSIPGetSignedDataMsg" sptr, sptr, int, sptr, sptr ; res = CryptSIPGetSignedDataMsg(varptr(pSubjectInfo), varptr(pdwEncodingType), dwIndex, varptr(pcbSignedDataMsg), varptr(pbSignedDataMsg)) ; pSubjectInfo : SIP_SUBJECTINFO* in/out -> "sptr" ; pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> "sptr" ; dwIndex : DWORD -> "int" ; pcbSignedDataMsg : DWORD* in/out -> "sptr" ; pbSignedDataMsg : BYTE* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, CERT_QUERY_ENCODING_TYPE* pdwEncodingType, DWORD dwIndex, DWORD* pcbSignedDataMsg, BYTE* pbSignedDataMsg) #uselib "WINTRUST.dll" #cfunc global CryptSIPGetSignedDataMsg "CryptSIPGetSignedDataMsg" var, var, int, var, var ; res = CryptSIPGetSignedDataMsg(pSubjectInfo, pdwEncodingType, dwIndex, pcbSignedDataMsg, pbSignedDataMsg) ; pSubjectInfo : SIP_SUBJECTINFO* in/out -> "var" ; pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> "var" ; dwIndex : DWORD -> "int" ; pcbSignedDataMsg : DWORD* in/out -> "var" ; pbSignedDataMsg : BYTE* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, CERT_QUERY_ENCODING_TYPE* pdwEncodingType, DWORD dwIndex, DWORD* pcbSignedDataMsg, BYTE* pbSignedDataMsg) #uselib "WINTRUST.dll" #cfunc global CryptSIPGetSignedDataMsg "CryptSIPGetSignedDataMsg" intptr, intptr, int, intptr, intptr ; res = CryptSIPGetSignedDataMsg(varptr(pSubjectInfo), varptr(pdwEncodingType), dwIndex, varptr(pcbSignedDataMsg), varptr(pbSignedDataMsg)) ; pSubjectInfo : SIP_SUBJECTINFO* in/out -> "intptr" ; pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> "intptr" ; dwIndex : DWORD -> "int" ; pcbSignedDataMsg : DWORD* in/out -> "intptr" ; pbSignedDataMsg : BYTE* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wintrust = windows.NewLazySystemDLL("WINTRUST.dll")
procCryptSIPGetSignedDataMsg = wintrust.NewProc("CryptSIPGetSignedDataMsg")
)
// pSubjectInfo (SIP_SUBJECTINFO* in/out), pdwEncodingType (CERT_QUERY_ENCODING_TYPE* in/out), dwIndex (DWORD), pcbSignedDataMsg (DWORD* in/out), pbSignedDataMsg (BYTE* in/out)
r1, _, err := procCryptSIPGetSignedDataMsg.Call(
uintptr(pSubjectInfo),
uintptr(pdwEncodingType),
uintptr(dwIndex),
uintptr(pcbSignedDataMsg),
uintptr(pbSignedDataMsg),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CryptSIPGetSignedDataMsg(
pSubjectInfo: Pointer; // SIP_SUBJECTINFO* in/out
pdwEncodingType: Pointer; // CERT_QUERY_ENCODING_TYPE* in/out
dwIndex: DWORD; // DWORD
pcbSignedDataMsg: Pointer; // DWORD* in/out
pbSignedDataMsg: Pointer // BYTE* in/out
): BOOL; stdcall;
external 'WINTRUST.dll' name 'CryptSIPGetSignedDataMsg';result := DllCall("WINTRUST\CryptSIPGetSignedDataMsg"
, "Ptr", pSubjectInfo ; SIP_SUBJECTINFO* in/out
, "Ptr", pdwEncodingType ; CERT_QUERY_ENCODING_TYPE* in/out
, "UInt", dwIndex ; DWORD
, "Ptr", pcbSignedDataMsg ; DWORD* in/out
, "Ptr", pbSignedDataMsg ; BYTE* in/out
, "Int") ; return: BOOL●CryptSIPGetSignedDataMsg(pSubjectInfo, pdwEncodingType, dwIndex, pcbSignedDataMsg, pbSignedDataMsg) = DLL("WINTRUST.dll", "bool CryptSIPGetSignedDataMsg(void*, void*, dword, void*, void*)")
# 呼び出し: CryptSIPGetSignedDataMsg(pSubjectInfo, pdwEncodingType, dwIndex, pcbSignedDataMsg, pbSignedDataMsg)
# pSubjectInfo : SIP_SUBJECTINFO* in/out -> "void*"
# pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> "void*"
# dwIndex : DWORD -> "dword"
# pcbSignedDataMsg : DWORD* in/out -> "void*"
# pbSignedDataMsg : BYTE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "wintrust" fn CryptSIPGetSignedDataMsg(
pSubjectInfo: [*c]SIP_SUBJECTINFO, // SIP_SUBJECTINFO* in/out
pdwEncodingType: [*c]u32, // CERT_QUERY_ENCODING_TYPE* in/out
dwIndex: u32, // DWORD
pcbSignedDataMsg: [*c]u32, // DWORD* in/out
pbSignedDataMsg: [*c]u8 // BYTE* in/out
) callconv(std.os.windows.WINAPI) i32;proc CryptSIPGetSignedDataMsg(
pSubjectInfo: ptr SIP_SUBJECTINFO, # SIP_SUBJECTINFO* in/out
pdwEncodingType: ptr uint32, # CERT_QUERY_ENCODING_TYPE* in/out
dwIndex: uint32, # DWORD
pcbSignedDataMsg: ptr uint32, # DWORD* in/out
pbSignedDataMsg: ptr uint8 # BYTE* in/out
): int32 {.importc: "CryptSIPGetSignedDataMsg", stdcall, dynlib: "WINTRUST.dll".}pragma(lib, "wintrust");
extern(Windows)
int CryptSIPGetSignedDataMsg(
SIP_SUBJECTINFO* pSubjectInfo, // SIP_SUBJECTINFO* in/out
uint* pdwEncodingType, // CERT_QUERY_ENCODING_TYPE* in/out
uint dwIndex, // DWORD
uint* pcbSignedDataMsg, // DWORD* in/out
ubyte* pbSignedDataMsg // BYTE* in/out
);ccall((:CryptSIPGetSignedDataMsg, "WINTRUST.dll"), stdcall, Int32,
(Ptr{SIP_SUBJECTINFO}, Ptr{UInt32}, UInt32, Ptr{UInt32}, Ptr{UInt8}),
pSubjectInfo, pdwEncodingType, dwIndex, pcbSignedDataMsg, pbSignedDataMsg)
# pSubjectInfo : SIP_SUBJECTINFO* in/out -> Ptr{SIP_SUBJECTINFO}
# pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> Ptr{UInt32}
# dwIndex : DWORD -> UInt32
# pcbSignedDataMsg : DWORD* in/out -> Ptr{UInt32}
# pbSignedDataMsg : BYTE* in/out -> Ptr{UInt8}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CryptSIPGetSignedDataMsg(
void* pSubjectInfo,
uint32_t* pdwEncodingType,
uint32_t dwIndex,
uint32_t* pcbSignedDataMsg,
uint8_t* pbSignedDataMsg);
]]
local wintrust = ffi.load("wintrust")
-- wintrust.CryptSIPGetSignedDataMsg(pSubjectInfo, pdwEncodingType, dwIndex, pcbSignedDataMsg, pbSignedDataMsg)
-- pSubjectInfo : SIP_SUBJECTINFO* in/out
-- pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out
-- dwIndex : DWORD
-- pcbSignedDataMsg : DWORD* in/out
-- pbSignedDataMsg : BYTE* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WINTRUST.dll');
const CryptSIPGetSignedDataMsg = lib.func('__stdcall', 'CryptSIPGetSignedDataMsg', 'int32_t', ['void *', 'uint32_t *', 'uint32_t', 'uint32_t *', 'uint8_t *']);
// CryptSIPGetSignedDataMsg(pSubjectInfo, pdwEncodingType, dwIndex, pcbSignedDataMsg, pbSignedDataMsg)
// pSubjectInfo : SIP_SUBJECTINFO* in/out -> 'void *'
// pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> 'uint32_t *'
// dwIndex : DWORD -> 'uint32_t'
// pcbSignedDataMsg : DWORD* in/out -> 'uint32_t *'
// pbSignedDataMsg : BYTE* in/out -> 'uint8_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WINTRUST.dll", {
CryptSIPGetSignedDataMsg: { parameters: ["pointer", "pointer", "u32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.CryptSIPGetSignedDataMsg(pSubjectInfo, pdwEncodingType, dwIndex, pcbSignedDataMsg, pbSignedDataMsg)
// pSubjectInfo : SIP_SUBJECTINFO* in/out -> "pointer"
// pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> "pointer"
// dwIndex : DWORD -> "u32"
// pcbSignedDataMsg : DWORD* in/out -> "pointer"
// pbSignedDataMsg : BYTE* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CryptSIPGetSignedDataMsg(
void* pSubjectInfo,
uint32_t* pdwEncodingType,
uint32_t dwIndex,
uint32_t* pcbSignedDataMsg,
uint8_t* pbSignedDataMsg);
C, "WINTRUST.dll");
// $ffi->CryptSIPGetSignedDataMsg(pSubjectInfo, pdwEncodingType, dwIndex, pcbSignedDataMsg, pbSignedDataMsg);
// pSubjectInfo : SIP_SUBJECTINFO* in/out
// pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out
// dwIndex : DWORD
// pcbSignedDataMsg : DWORD* in/out
// pbSignedDataMsg : BYTE* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Wintrust extends StdCallLibrary {
Wintrust INSTANCE = Native.load("wintrust", Wintrust.class);
boolean CryptSIPGetSignedDataMsg(
Pointer pSubjectInfo, // SIP_SUBJECTINFO* in/out
IntByReference pdwEncodingType, // CERT_QUERY_ENCODING_TYPE* in/out
int dwIndex, // DWORD
IntByReference pcbSignedDataMsg, // DWORD* in/out
byte[] pbSignedDataMsg // BYTE* in/out
);
}@[Link("wintrust")]
lib LibWINTRUST
fun CryptSIPGetSignedDataMsg = CryptSIPGetSignedDataMsg(
pSubjectInfo : SIP_SUBJECTINFO*, # SIP_SUBJECTINFO* in/out
pdwEncodingType : UInt32*, # CERT_QUERY_ENCODING_TYPE* in/out
dwIndex : UInt32, # DWORD
pcbSignedDataMsg : UInt32*, # DWORD* in/out
pbSignedDataMsg : UInt8* # BYTE* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CryptSIPGetSignedDataMsgNative = Int32 Function(Pointer<Void>, Pointer<Uint32>, Uint32, Pointer<Uint32>, Pointer<Uint8>);
typedef CryptSIPGetSignedDataMsgDart = int Function(Pointer<Void>, Pointer<Uint32>, int, Pointer<Uint32>, Pointer<Uint8>);
final CryptSIPGetSignedDataMsg = DynamicLibrary.open('WINTRUST.dll')
.lookupFunction<CryptSIPGetSignedDataMsgNative, CryptSIPGetSignedDataMsgDart>('CryptSIPGetSignedDataMsg');
// pSubjectInfo : SIP_SUBJECTINFO* in/out -> Pointer<Void>
// pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> Pointer<Uint32>
// dwIndex : DWORD -> Uint32
// pcbSignedDataMsg : DWORD* in/out -> Pointer<Uint32>
// pbSignedDataMsg : BYTE* in/out -> Pointer<Uint8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CryptSIPGetSignedDataMsg(
pSubjectInfo: Pointer; // SIP_SUBJECTINFO* in/out
pdwEncodingType: Pointer; // CERT_QUERY_ENCODING_TYPE* in/out
dwIndex: DWORD; // DWORD
pcbSignedDataMsg: Pointer; // DWORD* in/out
pbSignedDataMsg: Pointer // BYTE* in/out
): BOOL; stdcall;
external 'WINTRUST.dll' name 'CryptSIPGetSignedDataMsg';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CryptSIPGetSignedDataMsg"
c_CryptSIPGetSignedDataMsg :: Ptr () -> Ptr Word32 -> Word32 -> Ptr Word32 -> Ptr Word8 -> IO CInt
-- pSubjectInfo : SIP_SUBJECTINFO* in/out -> Ptr ()
-- pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> Ptr Word32
-- dwIndex : DWORD -> Word32
-- pcbSignedDataMsg : DWORD* in/out -> Ptr Word32
-- pbSignedDataMsg : BYTE* in/out -> Ptr Word8
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let cryptsipgetsigneddatamsg =
foreign "CryptSIPGetSignedDataMsg"
((ptr void) @-> (ptr uint32_t) @-> uint32_t @-> (ptr uint32_t) @-> (ptr uint8_t) @-> returning int32_t)
(* pSubjectInfo : SIP_SUBJECTINFO* in/out -> (ptr void) *)
(* pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> (ptr uint32_t) *)
(* dwIndex : DWORD -> uint32_t *)
(* pcbSignedDataMsg : DWORD* in/out -> (ptr uint32_t) *)
(* pbSignedDataMsg : BYTE* in/out -> (ptr uint8_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wintrust (t "WINTRUST.dll"))
(cffi:use-foreign-library wintrust)
(cffi:defcfun ("CryptSIPGetSignedDataMsg" crypt-sipget-signed-data-msg :convention :stdcall) :int32
(p-subject-info :pointer) ; SIP_SUBJECTINFO* in/out
(pdw-encoding-type :pointer) ; CERT_QUERY_ENCODING_TYPE* in/out
(dw-index :uint32) ; DWORD
(pcb-signed-data-msg :pointer) ; DWORD* in/out
(pb-signed-data-msg :pointer)) ; BYTE* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CryptSIPGetSignedDataMsg = Win32::API::More->new('WINTRUST',
'BOOL CryptSIPGetSignedDataMsg(LPVOID pSubjectInfo, LPVOID pdwEncodingType, DWORD dwIndex, LPVOID pcbSignedDataMsg, LPVOID pbSignedDataMsg)');
# my $ret = $CryptSIPGetSignedDataMsg->Call($pSubjectInfo, $pdwEncodingType, $dwIndex, $pcbSignedDataMsg, $pbSignedDataMsg);
# pSubjectInfo : SIP_SUBJECTINFO* in/out -> LPVOID
# pdwEncodingType : CERT_QUERY_ENCODING_TYPE* in/out -> LPVOID
# dwIndex : DWORD -> DWORD
# pcbSignedDataMsg : DWORD* in/out -> LPVOID
# pbSignedDataMsg : BYTE* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。