ホーム › Data.RightsManagement › DRMConstructCertificateChain
DRMConstructCertificateChain
関数複数の証明書から証明書チェーンを構築する。
シグネチャ
// msdrm.dll
#include <windows.h>
HRESULT DRMConstructCertificateChain(
DWORD cCertificates,
LPWSTR* rgwszCertificates,
DWORD* pcChain,
LPWSTR wszChain // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| cCertificates | DWORD | in |
| rgwszCertificates | LPWSTR* | in |
| pcChain | DWORD* | inout |
| wszChain | LPWSTR | outoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// msdrm.dll
#include <windows.h>
HRESULT DRMConstructCertificateChain(
DWORD cCertificates,
LPWSTR* rgwszCertificates,
DWORD* pcChain,
LPWSTR wszChain // optional
);[DllImport("msdrm.dll", ExactSpelling = true)]
static extern int DRMConstructCertificateChain(
uint cCertificates, // DWORD
IntPtr rgwszCertificates, // LPWSTR*
ref uint pcChain, // DWORD* in/out
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder wszChain // LPWSTR optional, out
);<DllImport("msdrm.dll", ExactSpelling:=True)>
Public Shared Function DRMConstructCertificateChain(
cCertificates As UInteger, ' DWORD
rgwszCertificates As IntPtr, ' LPWSTR*
ByRef pcChain As UInteger, ' DWORD* in/out
<MarshalAs(UnmanagedType.LPWStr)> wszChain As System.Text.StringBuilder ' LPWSTR optional, out
) As Integer
End Function' cCertificates : DWORD
' rgwszCertificates : LPWSTR*
' pcChain : DWORD* in/out
' wszChain : LPWSTR optional, out
Declare PtrSafe Function DRMConstructCertificateChain Lib "msdrm" ( _
ByVal cCertificates As Long, _
ByVal rgwszCertificates As LongPtr, _
ByRef pcChain As Long, _
ByVal wszChain As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DRMConstructCertificateChain = ctypes.windll.msdrm.DRMConstructCertificateChain
DRMConstructCertificateChain.restype = ctypes.c_int
DRMConstructCertificateChain.argtypes = [
wintypes.DWORD, # cCertificates : DWORD
ctypes.c_void_p, # rgwszCertificates : LPWSTR*
ctypes.POINTER(wintypes.DWORD), # pcChain : DWORD* in/out
wintypes.LPWSTR, # wszChain : LPWSTR optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msdrm.dll')
DRMConstructCertificateChain = Fiddle::Function.new(
lib['DRMConstructCertificateChain'],
[
-Fiddle::TYPE_INT, # cCertificates : DWORD
Fiddle::TYPE_VOIDP, # rgwszCertificates : LPWSTR*
Fiddle::TYPE_VOIDP, # pcChain : DWORD* in/out
Fiddle::TYPE_VOIDP, # wszChain : LPWSTR optional, out
],
Fiddle::TYPE_INT)#[link(name = "msdrm")]
extern "system" {
fn DRMConstructCertificateChain(
cCertificates: u32, // DWORD
rgwszCertificates: *mut *mut u16, // LPWSTR*
pcChain: *mut u32, // DWORD* in/out
wszChain: *mut u16 // LPWSTR optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msdrm.dll")]
public static extern int DRMConstructCertificateChain(uint cCertificates, IntPtr rgwszCertificates, ref uint pcChain, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder wszChain);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msdrm_DRMConstructCertificateChain' -Namespace Win32 -PassThru
# $api::DRMConstructCertificateChain(cCertificates, rgwszCertificates, pcChain, wszChain)#uselib "msdrm.dll"
#func global DRMConstructCertificateChain "DRMConstructCertificateChain" sptr, sptr, sptr, sptr
; DRMConstructCertificateChain cCertificates, varptr(rgwszCertificates), varptr(pcChain), varptr(wszChain) ; 戻り値は stat
; cCertificates : DWORD -> "sptr"
; rgwszCertificates : LPWSTR* -> "sptr"
; pcChain : DWORD* in/out -> "sptr"
; wszChain : LPWSTR optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "msdrm.dll" #cfunc global DRMConstructCertificateChain "DRMConstructCertificateChain" int, var, var, var ; res = DRMConstructCertificateChain(cCertificates, rgwszCertificates, pcChain, wszChain) ; cCertificates : DWORD -> "int" ; rgwszCertificates : LPWSTR* -> "var" ; pcChain : DWORD* in/out -> "var" ; wszChain : LPWSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "msdrm.dll" #cfunc global DRMConstructCertificateChain "DRMConstructCertificateChain" int, sptr, sptr, sptr ; res = DRMConstructCertificateChain(cCertificates, varptr(rgwszCertificates), varptr(pcChain), varptr(wszChain)) ; cCertificates : DWORD -> "int" ; rgwszCertificates : LPWSTR* -> "sptr" ; pcChain : DWORD* in/out -> "sptr" ; wszChain : LPWSTR optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DRMConstructCertificateChain(DWORD cCertificates, LPWSTR* rgwszCertificates, DWORD* pcChain, LPWSTR wszChain) #uselib "msdrm.dll" #cfunc global DRMConstructCertificateChain "DRMConstructCertificateChain" int, var, var, var ; res = DRMConstructCertificateChain(cCertificates, rgwszCertificates, pcChain, wszChain) ; cCertificates : DWORD -> "int" ; rgwszCertificates : LPWSTR* -> "var" ; pcChain : DWORD* in/out -> "var" ; wszChain : LPWSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DRMConstructCertificateChain(DWORD cCertificates, LPWSTR* rgwszCertificates, DWORD* pcChain, LPWSTR wszChain) #uselib "msdrm.dll" #cfunc global DRMConstructCertificateChain "DRMConstructCertificateChain" int, intptr, intptr, intptr ; res = DRMConstructCertificateChain(cCertificates, varptr(rgwszCertificates), varptr(pcChain), varptr(wszChain)) ; cCertificates : DWORD -> "int" ; rgwszCertificates : LPWSTR* -> "intptr" ; pcChain : DWORD* in/out -> "intptr" ; wszChain : LPWSTR optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msdrm = windows.NewLazySystemDLL("msdrm.dll")
procDRMConstructCertificateChain = msdrm.NewProc("DRMConstructCertificateChain")
)
// cCertificates (DWORD), rgwszCertificates (LPWSTR*), pcChain (DWORD* in/out), wszChain (LPWSTR optional, out)
r1, _, err := procDRMConstructCertificateChain.Call(
uintptr(cCertificates),
uintptr(rgwszCertificates),
uintptr(pcChain),
uintptr(wszChain),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DRMConstructCertificateChain(
cCertificates: DWORD; // DWORD
rgwszCertificates: PPWideChar; // LPWSTR*
pcChain: Pointer; // DWORD* in/out
wszChain: PWideChar // LPWSTR optional, out
): Integer; stdcall;
external 'msdrm.dll' name 'DRMConstructCertificateChain';result := DllCall("msdrm\DRMConstructCertificateChain"
, "UInt", cCertificates ; DWORD
, "Ptr", rgwszCertificates ; LPWSTR*
, "Ptr", pcChain ; DWORD* in/out
, "Ptr", wszChain ; LPWSTR optional, out
, "Int") ; return: HRESULT●DRMConstructCertificateChain(cCertificates, rgwszCertificates, pcChain, wszChain) = DLL("msdrm.dll", "int DRMConstructCertificateChain(dword, void*, void*, char*)")
# 呼び出し: DRMConstructCertificateChain(cCertificates, rgwszCertificates, pcChain, wszChain)
# cCertificates : DWORD -> "dword"
# rgwszCertificates : LPWSTR* -> "void*"
# pcChain : DWORD* in/out -> "void*"
# wszChain : LPWSTR optional, out -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。