ホーム › Security.Cryptography.Catalog › CryptCATPutMemberInfo
CryptCATPutMemberInfo
関数カタログにメンバー(ファイル)情報を追加または設定する。
シグネチャ
// WINTRUST.dll
#include <windows.h>
CRYPTCATMEMBER* CryptCATPutMemberInfo(
HANDLE hCatalog,
LPWSTR pwszFileName, // optional
LPWSTR pwszReferenceTag,
GUID* pgSubjectType,
DWORD dwCertVersion,
DWORD cbSIPIndirectData,
BYTE* pbSIPIndirectData
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hCatalog | HANDLE | in | メンバ情報を追加する対象のカタログハンドル。 |
| pwszFileName | LPWSTR | inoptional | メンバに対応するファイル名。NULL終端のワイド文字列で指定する。NULL可。 |
| pwszReferenceTag | LPWSTR | in | メンバを識別する参照タグ。NULL終端のワイド文字列で指定する。 |
| pgSubjectType | GUID* | inout | メンバのサブジェクト種別を示すGUIDへのポインタ。 |
| dwCertVersion | DWORD | in | 証明書のバージョン番号。 |
| cbSIPIndirectData | DWORD | in | pbSIPIndirectDataの間接データバイト長。 |
| pbSIPIndirectData | BYTE* | inout | SIPが生成したハッシュ等の間接署名データを格納したバッファ。 |
戻り値の型: CRYPTCATMEMBER*
各言語での呼び出し定義
// WINTRUST.dll
#include <windows.h>
CRYPTCATMEMBER* CryptCATPutMemberInfo(
HANDLE hCatalog,
LPWSTR pwszFileName, // optional
LPWSTR pwszReferenceTag,
GUID* pgSubjectType,
DWORD dwCertVersion,
DWORD cbSIPIndirectData,
BYTE* pbSIPIndirectData
);[DllImport("WINTRUST.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr CryptCATPutMemberInfo(
IntPtr hCatalog, // HANDLE
[MarshalAs(UnmanagedType.LPWStr)] string pwszFileName, // LPWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string pwszReferenceTag, // LPWSTR
ref Guid pgSubjectType, // GUID* in/out
uint dwCertVersion, // DWORD
uint cbSIPIndirectData, // DWORD
IntPtr pbSIPIndirectData // BYTE* in/out
);<DllImport("WINTRUST.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CryptCATPutMemberInfo(
hCatalog As IntPtr, ' HANDLE
<MarshalAs(UnmanagedType.LPWStr)> pwszFileName As String, ' LPWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> pwszReferenceTag As String, ' LPWSTR
ByRef pgSubjectType As Guid, ' GUID* in/out
dwCertVersion As UInteger, ' DWORD
cbSIPIndirectData As UInteger, ' DWORD
pbSIPIndirectData As IntPtr ' BYTE* in/out
) As IntPtr
End Function' hCatalog : HANDLE
' pwszFileName : LPWSTR optional
' pwszReferenceTag : LPWSTR
' pgSubjectType : GUID* in/out
' dwCertVersion : DWORD
' cbSIPIndirectData : DWORD
' pbSIPIndirectData : BYTE* in/out
Declare PtrSafe Function CryptCATPutMemberInfo Lib "wintrust" ( _
ByVal hCatalog As LongPtr, _
ByVal pwszFileName As LongPtr, _
ByVal pwszReferenceTag As LongPtr, _
ByVal pgSubjectType As LongPtr, _
ByVal dwCertVersion As Long, _
ByVal cbSIPIndirectData As Long, _
ByVal pbSIPIndirectData As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CryptCATPutMemberInfo = ctypes.windll.wintrust.CryptCATPutMemberInfo
CryptCATPutMemberInfo.restype = ctypes.c_void_p
CryptCATPutMemberInfo.argtypes = [
wintypes.HANDLE, # hCatalog : HANDLE
wintypes.LPCWSTR, # pwszFileName : LPWSTR optional
wintypes.LPCWSTR, # pwszReferenceTag : LPWSTR
ctypes.c_void_p, # pgSubjectType : GUID* in/out
wintypes.DWORD, # dwCertVersion : DWORD
wintypes.DWORD, # cbSIPIndirectData : DWORD
ctypes.POINTER(ctypes.c_ubyte), # pbSIPIndirectData : BYTE* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WINTRUST.dll')
CryptCATPutMemberInfo = Fiddle::Function.new(
lib['CryptCATPutMemberInfo'],
[
Fiddle::TYPE_VOIDP, # hCatalog : HANDLE
Fiddle::TYPE_VOIDP, # pwszFileName : LPWSTR optional
Fiddle::TYPE_VOIDP, # pwszReferenceTag : LPWSTR
Fiddle::TYPE_VOIDP, # pgSubjectType : GUID* in/out
-Fiddle::TYPE_INT, # dwCertVersion : DWORD
-Fiddle::TYPE_INT, # cbSIPIndirectData : DWORD
Fiddle::TYPE_VOIDP, # pbSIPIndirectData : BYTE* in/out
],
Fiddle::TYPE_VOIDP)#[link(name = "wintrust")]
extern "system" {
fn CryptCATPutMemberInfo(
hCatalog: *mut core::ffi::c_void, // HANDLE
pwszFileName: *mut u16, // LPWSTR optional
pwszReferenceTag: *mut u16, // LPWSTR
pgSubjectType: *mut GUID, // GUID* in/out
dwCertVersion: u32, // DWORD
cbSIPIndirectData: u32, // DWORD
pbSIPIndirectData: *mut u8 // BYTE* in/out
) -> *mut CRYPTCATMEMBER;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WINTRUST.dll", SetLastError = true)]
public static extern IntPtr CryptCATPutMemberInfo(IntPtr hCatalog, [MarshalAs(UnmanagedType.LPWStr)] string pwszFileName, [MarshalAs(UnmanagedType.LPWStr)] string pwszReferenceTag, ref Guid pgSubjectType, uint dwCertVersion, uint cbSIPIndirectData, IntPtr pbSIPIndirectData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINTRUST_CryptCATPutMemberInfo' -Namespace Win32 -PassThru
# $api::CryptCATPutMemberInfo(hCatalog, pwszFileName, pwszReferenceTag, pgSubjectType, dwCertVersion, cbSIPIndirectData, pbSIPIndirectData)#uselib "WINTRUST.dll"
#func global CryptCATPutMemberInfo "CryptCATPutMemberInfo" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; CryptCATPutMemberInfo hCatalog, pwszFileName, pwszReferenceTag, varptr(pgSubjectType), dwCertVersion, cbSIPIndirectData, varptr(pbSIPIndirectData) ; 戻り値は stat
; hCatalog : HANDLE -> "sptr"
; pwszFileName : LPWSTR optional -> "sptr"
; pwszReferenceTag : LPWSTR -> "sptr"
; pgSubjectType : GUID* in/out -> "sptr"
; dwCertVersion : DWORD -> "sptr"
; cbSIPIndirectData : DWORD -> "sptr"
; pbSIPIndirectData : BYTE* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WINTRUST.dll" #cfunc global CryptCATPutMemberInfo "CryptCATPutMemberInfo" sptr, wstr, wstr, var, int, int, var ; res = CryptCATPutMemberInfo(hCatalog, pwszFileName, pwszReferenceTag, pgSubjectType, dwCertVersion, cbSIPIndirectData, pbSIPIndirectData) ; hCatalog : HANDLE -> "sptr" ; pwszFileName : LPWSTR optional -> "wstr" ; pwszReferenceTag : LPWSTR -> "wstr" ; pgSubjectType : GUID* in/out -> "var" ; dwCertVersion : DWORD -> "int" ; cbSIPIndirectData : DWORD -> "int" ; pbSIPIndirectData : BYTE* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WINTRUST.dll" #cfunc global CryptCATPutMemberInfo "CryptCATPutMemberInfo" sptr, wstr, wstr, sptr, int, int, sptr ; res = CryptCATPutMemberInfo(hCatalog, pwszFileName, pwszReferenceTag, varptr(pgSubjectType), dwCertVersion, cbSIPIndirectData, varptr(pbSIPIndirectData)) ; hCatalog : HANDLE -> "sptr" ; pwszFileName : LPWSTR optional -> "wstr" ; pwszReferenceTag : LPWSTR -> "wstr" ; pgSubjectType : GUID* in/out -> "sptr" ; dwCertVersion : DWORD -> "int" ; cbSIPIndirectData : DWORD -> "int" ; pbSIPIndirectData : BYTE* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; CRYPTCATMEMBER* CryptCATPutMemberInfo(HANDLE hCatalog, LPWSTR pwszFileName, LPWSTR pwszReferenceTag, GUID* pgSubjectType, DWORD dwCertVersion, DWORD cbSIPIndirectData, BYTE* pbSIPIndirectData) #uselib "WINTRUST.dll" #cfunc global CryptCATPutMemberInfo "CryptCATPutMemberInfo" intptr, wstr, wstr, var, int, int, var ; res = CryptCATPutMemberInfo(hCatalog, pwszFileName, pwszReferenceTag, pgSubjectType, dwCertVersion, cbSIPIndirectData, pbSIPIndirectData) ; hCatalog : HANDLE -> "intptr" ; pwszFileName : LPWSTR optional -> "wstr" ; pwszReferenceTag : LPWSTR -> "wstr" ; pgSubjectType : GUID* in/out -> "var" ; dwCertVersion : DWORD -> "int" ; cbSIPIndirectData : DWORD -> "int" ; pbSIPIndirectData : BYTE* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; CRYPTCATMEMBER* CryptCATPutMemberInfo(HANDLE hCatalog, LPWSTR pwszFileName, LPWSTR pwszReferenceTag, GUID* pgSubjectType, DWORD dwCertVersion, DWORD cbSIPIndirectData, BYTE* pbSIPIndirectData) #uselib "WINTRUST.dll" #cfunc global CryptCATPutMemberInfo "CryptCATPutMemberInfo" intptr, wstr, wstr, intptr, int, int, intptr ; res = CryptCATPutMemberInfo(hCatalog, pwszFileName, pwszReferenceTag, varptr(pgSubjectType), dwCertVersion, cbSIPIndirectData, varptr(pbSIPIndirectData)) ; hCatalog : HANDLE -> "intptr" ; pwszFileName : LPWSTR optional -> "wstr" ; pwszReferenceTag : LPWSTR -> "wstr" ; pgSubjectType : GUID* in/out -> "intptr" ; dwCertVersion : DWORD -> "int" ; cbSIPIndirectData : DWORD -> "int" ; pbSIPIndirectData : BYTE* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wintrust = windows.NewLazySystemDLL("WINTRUST.dll")
procCryptCATPutMemberInfo = wintrust.NewProc("CryptCATPutMemberInfo")
)
// hCatalog (HANDLE), pwszFileName (LPWSTR optional), pwszReferenceTag (LPWSTR), pgSubjectType (GUID* in/out), dwCertVersion (DWORD), cbSIPIndirectData (DWORD), pbSIPIndirectData (BYTE* in/out)
r1, _, err := procCryptCATPutMemberInfo.Call(
uintptr(hCatalog),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszFileName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszReferenceTag))),
uintptr(pgSubjectType),
uintptr(dwCertVersion),
uintptr(cbSIPIndirectData),
uintptr(pbSIPIndirectData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // CRYPTCATMEMBER*function CryptCATPutMemberInfo(
hCatalog: THandle; // HANDLE
pwszFileName: PWideChar; // LPWSTR optional
pwszReferenceTag: PWideChar; // LPWSTR
pgSubjectType: PGUID; // GUID* in/out
dwCertVersion: DWORD; // DWORD
cbSIPIndirectData: DWORD; // DWORD
pbSIPIndirectData: Pointer // BYTE* in/out
): Pointer; stdcall;
external 'WINTRUST.dll' name 'CryptCATPutMemberInfo';result := DllCall("WINTRUST\CryptCATPutMemberInfo"
, "Ptr", hCatalog ; HANDLE
, "WStr", pwszFileName ; LPWSTR optional
, "WStr", pwszReferenceTag ; LPWSTR
, "Ptr", pgSubjectType ; GUID* in/out
, "UInt", dwCertVersion ; DWORD
, "UInt", cbSIPIndirectData ; DWORD
, "Ptr", pbSIPIndirectData ; BYTE* in/out
, "Ptr") ; return: CRYPTCATMEMBER*●CryptCATPutMemberInfo(hCatalog, pwszFileName, pwszReferenceTag, pgSubjectType, dwCertVersion, cbSIPIndirectData, pbSIPIndirectData) = DLL("WINTRUST.dll", "void* CryptCATPutMemberInfo(void*, char*, char*, void*, dword, dword, void*)")
# 呼び出し: CryptCATPutMemberInfo(hCatalog, pwszFileName, pwszReferenceTag, pgSubjectType, dwCertVersion, cbSIPIndirectData, pbSIPIndirectData)
# hCatalog : HANDLE -> "void*"
# pwszFileName : LPWSTR optional -> "char*"
# pwszReferenceTag : LPWSTR -> "char*"
# pgSubjectType : GUID* in/out -> "void*"
# dwCertVersion : DWORD -> "dword"
# cbSIPIndirectData : DWORD -> "dword"
# pbSIPIndirectData : BYTE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "wintrust" fn CryptCATPutMemberInfo(
hCatalog: ?*anyopaque, // HANDLE
pwszFileName: [*c]const u16, // LPWSTR optional
pwszReferenceTag: [*c]const u16, // LPWSTR
pgSubjectType: [*c]GUID, // GUID* in/out
dwCertVersion: u32, // DWORD
cbSIPIndirectData: u32, // DWORD
pbSIPIndirectData: [*c]u8 // BYTE* in/out
) callconv(std.os.windows.WINAPI) [*c]CRYPTCATMEMBER;proc CryptCATPutMemberInfo(
hCatalog: pointer, # HANDLE
pwszFileName: WideCString, # LPWSTR optional
pwszReferenceTag: WideCString, # LPWSTR
pgSubjectType: ptr GUID, # GUID* in/out
dwCertVersion: uint32, # DWORD
cbSIPIndirectData: uint32, # DWORD
pbSIPIndirectData: ptr uint8 # BYTE* in/out
): ptr CRYPTCATMEMBER {.importc: "CryptCATPutMemberInfo", stdcall, dynlib: "WINTRUST.dll".}pragma(lib, "wintrust");
extern(Windows)
CRYPTCATMEMBER* CryptCATPutMemberInfo(
void* hCatalog, // HANDLE
const(wchar)* pwszFileName, // LPWSTR optional
const(wchar)* pwszReferenceTag, // LPWSTR
GUID* pgSubjectType, // GUID* in/out
uint dwCertVersion, // DWORD
uint cbSIPIndirectData, // DWORD
ubyte* pbSIPIndirectData // BYTE* in/out
);ccall((:CryptCATPutMemberInfo, "WINTRUST.dll"), stdcall, Ptr{CRYPTCATMEMBER},
(Ptr{Cvoid}, Cwstring, Cwstring, Ptr{GUID}, UInt32, UInt32, Ptr{UInt8}),
hCatalog, pwszFileName, pwszReferenceTag, pgSubjectType, dwCertVersion, cbSIPIndirectData, pbSIPIndirectData)
# hCatalog : HANDLE -> Ptr{Cvoid}
# pwszFileName : LPWSTR optional -> Cwstring
# pwszReferenceTag : LPWSTR -> Cwstring
# pgSubjectType : GUID* in/out -> Ptr{GUID}
# dwCertVersion : DWORD -> UInt32
# cbSIPIndirectData : DWORD -> UInt32
# pbSIPIndirectData : BYTE* in/out -> Ptr{UInt8}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void* CryptCATPutMemberInfo(
void* hCatalog,
const uint16_t* pwszFileName,
const uint16_t* pwszReferenceTag,
void* pgSubjectType,
uint32_t dwCertVersion,
uint32_t cbSIPIndirectData,
uint8_t* pbSIPIndirectData);
]]
local wintrust = ffi.load("wintrust")
-- wintrust.CryptCATPutMemberInfo(hCatalog, pwszFileName, pwszReferenceTag, pgSubjectType, dwCertVersion, cbSIPIndirectData, pbSIPIndirectData)
-- hCatalog : HANDLE
-- pwszFileName : LPWSTR optional
-- pwszReferenceTag : LPWSTR
-- pgSubjectType : GUID* in/out
-- dwCertVersion : DWORD
-- cbSIPIndirectData : DWORD
-- pbSIPIndirectData : BYTE* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WINTRUST.dll');
const CryptCATPutMemberInfo = lib.func('__stdcall', 'CryptCATPutMemberInfo', 'void *', ['void *', 'str16', 'str16', 'void *', 'uint32_t', 'uint32_t', 'uint8_t *']);
// CryptCATPutMemberInfo(hCatalog, pwszFileName, pwszReferenceTag, pgSubjectType, dwCertVersion, cbSIPIndirectData, pbSIPIndirectData)
// hCatalog : HANDLE -> 'void *'
// pwszFileName : LPWSTR optional -> 'str16'
// pwszReferenceTag : LPWSTR -> 'str16'
// pgSubjectType : GUID* in/out -> 'void *'
// dwCertVersion : DWORD -> 'uint32_t'
// cbSIPIndirectData : DWORD -> 'uint32_t'
// pbSIPIndirectData : BYTE* in/out -> 'uint8_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WINTRUST.dll", {
CryptCATPutMemberInfo: { parameters: ["pointer", "buffer", "buffer", "pointer", "u32", "u32", "pointer"], result: "pointer" },
});
// lib.symbols.CryptCATPutMemberInfo(hCatalog, pwszFileName, pwszReferenceTag, pgSubjectType, dwCertVersion, cbSIPIndirectData, pbSIPIndirectData)
// hCatalog : HANDLE -> "pointer"
// pwszFileName : LPWSTR optional -> "buffer"
// pwszReferenceTag : LPWSTR -> "buffer"
// pgSubjectType : GUID* in/out -> "pointer"
// dwCertVersion : DWORD -> "u32"
// cbSIPIndirectData : DWORD -> "u32"
// pbSIPIndirectData : BYTE* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* CryptCATPutMemberInfo(
void* hCatalog,
const uint16_t* pwszFileName,
const uint16_t* pwszReferenceTag,
void* pgSubjectType,
uint32_t dwCertVersion,
uint32_t cbSIPIndirectData,
uint8_t* pbSIPIndirectData);
C, "WINTRUST.dll");
// $ffi->CryptCATPutMemberInfo(hCatalog, pwszFileName, pwszReferenceTag, pgSubjectType, dwCertVersion, cbSIPIndirectData, pbSIPIndirectData);
// hCatalog : HANDLE
// pwszFileName : LPWSTR optional
// pwszReferenceTag : LPWSTR
// pgSubjectType : GUID* in/out
// dwCertVersion : DWORD
// cbSIPIndirectData : DWORD
// pbSIPIndirectData : 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);
Pointer CryptCATPutMemberInfo(
Pointer hCatalog, // HANDLE
WString pwszFileName, // LPWSTR optional
WString pwszReferenceTag, // LPWSTR
Pointer pgSubjectType, // GUID* in/out
int dwCertVersion, // DWORD
int cbSIPIndirectData, // DWORD
byte[] pbSIPIndirectData // BYTE* in/out
);
}@[Link("wintrust")]
lib LibWINTRUST
fun CryptCATPutMemberInfo = CryptCATPutMemberInfo(
hCatalog : Void*, # HANDLE
pwszFileName : UInt16*, # LPWSTR optional
pwszReferenceTag : UInt16*, # LPWSTR
pgSubjectType : GUID*, # GUID* in/out
dwCertVersion : UInt32, # DWORD
cbSIPIndirectData : UInt32, # DWORD
pbSIPIndirectData : UInt8* # BYTE* in/out
) : CRYPTCATMEMBER*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CryptCATPutMemberInfoNative = Pointer<Void> Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, Uint32, Uint32, Pointer<Uint8>);
typedef CryptCATPutMemberInfoDart = Pointer<Void> Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, int, int, Pointer<Uint8>);
final CryptCATPutMemberInfo = DynamicLibrary.open('WINTRUST.dll')
.lookupFunction<CryptCATPutMemberInfoNative, CryptCATPutMemberInfoDart>('CryptCATPutMemberInfo');
// hCatalog : HANDLE -> Pointer<Void>
// pwszFileName : LPWSTR optional -> Pointer<Utf16>
// pwszReferenceTag : LPWSTR -> Pointer<Utf16>
// pgSubjectType : GUID* in/out -> Pointer<Void>
// dwCertVersion : DWORD -> Uint32
// cbSIPIndirectData : DWORD -> Uint32
// pbSIPIndirectData : BYTE* in/out -> Pointer<Uint8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CryptCATPutMemberInfo(
hCatalog: THandle; // HANDLE
pwszFileName: PWideChar; // LPWSTR optional
pwszReferenceTag: PWideChar; // LPWSTR
pgSubjectType: PGUID; // GUID* in/out
dwCertVersion: DWORD; // DWORD
cbSIPIndirectData: DWORD; // DWORD
pbSIPIndirectData: Pointer // BYTE* in/out
): Pointer; stdcall;
external 'WINTRUST.dll' name 'CryptCATPutMemberInfo';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CryptCATPutMemberInfo"
c_CryptCATPutMemberInfo :: Ptr () -> CWString -> CWString -> Ptr () -> Word32 -> Word32 -> Ptr Word8 -> IO (Ptr ())
-- hCatalog : HANDLE -> Ptr ()
-- pwszFileName : LPWSTR optional -> CWString
-- pwszReferenceTag : LPWSTR -> CWString
-- pgSubjectType : GUID* in/out -> Ptr ()
-- dwCertVersion : DWORD -> Word32
-- cbSIPIndirectData : DWORD -> Word32
-- pbSIPIndirectData : BYTE* in/out -> Ptr Word8
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let cryptcatputmemberinfo =
foreign "CryptCATPutMemberInfo"
((ptr void) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr void) @-> uint32_t @-> uint32_t @-> (ptr uint8_t) @-> returning (ptr void))
(* hCatalog : HANDLE -> (ptr void) *)
(* pwszFileName : LPWSTR optional -> (ptr uint16_t) *)
(* pwszReferenceTag : LPWSTR -> (ptr uint16_t) *)
(* pgSubjectType : GUID* in/out -> (ptr void) *)
(* dwCertVersion : DWORD -> uint32_t *)
(* cbSIPIndirectData : DWORD -> uint32_t *)
(* pbSIPIndirectData : 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 ("CryptCATPutMemberInfo" crypt-catput-member-info :convention :stdcall) :pointer
(h-catalog :pointer) ; HANDLE
(pwsz-file-name (:string :encoding :utf-16le)) ; LPWSTR optional
(pwsz-reference-tag (:string :encoding :utf-16le)) ; LPWSTR
(pg-subject-type :pointer) ; GUID* in/out
(dw-cert-version :uint32) ; DWORD
(cb-sipindirect-data :uint32) ; DWORD
(pb-sipindirect-data :pointer)) ; BYTE* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CryptCATPutMemberInfo = Win32::API::More->new('WINTRUST',
'LPVOID CryptCATPutMemberInfo(HANDLE hCatalog, LPCWSTR pwszFileName, LPCWSTR pwszReferenceTag, LPVOID pgSubjectType, DWORD dwCertVersion, DWORD cbSIPIndirectData, LPVOID pbSIPIndirectData)');
# my $ret = $CryptCATPutMemberInfo->Call($hCatalog, $pwszFileName, $pwszReferenceTag, $pgSubjectType, $dwCertVersion, $cbSIPIndirectData, $pbSIPIndirectData);
# hCatalog : HANDLE -> HANDLE
# pwszFileName : LPWSTR optional -> LPCWSTR
# pwszReferenceTag : LPWSTR -> LPCWSTR
# pgSubjectType : GUID* in/out -> LPVOID
# dwCertVersion : DWORD -> DWORD
# cbSIPIndirectData : DWORD -> DWORD
# pbSIPIndirectData : BYTE* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型