ホーム › Data.RightsManagement › DRMGetSignedIssuanceLicense
DRMGetSignedIssuanceLicense
関数署名済みの発行ライセンスを取得する。
シグネチャ
// msdrm.dll
#include <windows.h>
HRESULT DRMGetSignedIssuanceLicense(
DWORD hEnv,
DWORD hIssuanceLicense,
DWORD uFlags,
BYTE* pbSymKey,
DWORD cbSymKey,
LPWSTR wszSymKeyType, // optional
LPWSTR wszClientLicensorCertificate, // optional
DRMCALLBACK pfnCallback,
LPWSTR wszURL, // optional
void* pvContext
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hEnv | DWORD | in | 対象の環境ハンドル。 |
| hIssuanceLicense | DWORD | in | 署名する発行ライセンスのハンドル。 |
| uFlags | DWORD | in | 署名動作を制御するフラグ。オンライン/オフラインなどを指定する。 |
| pbSymKey | BYTE* | inout | コンテンツ暗号化用の対称鍵データへのポインタ。 |
| cbSymKey | DWORD | in | pbSymKeyのバイト長。 |
| wszSymKeyType | LPWSTR | inoptional | 対称鍵の種別を示すUnicode文字列。AES等を指定する。 |
| wszClientLicensorCertificate | LPWSTR | inoptional | クライアントライセンサー証明書を示すUnicode文字列。 |
| pfnCallback | DRMCALLBACK | in | 署名処理の進行を通知するコールバック関数DRMCALLBACK。 |
| wszURL | LPWSTR | inoptional | 署名サーバーのURLを示すUnicode文字列。NULL可。 |
| pvContext | void* | inout | コールバックに渡されるユーザー定義コンテキスト。NULL可。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// msdrm.dll
#include <windows.h>
HRESULT DRMGetSignedIssuanceLicense(
DWORD hEnv,
DWORD hIssuanceLicense,
DWORD uFlags,
BYTE* pbSymKey,
DWORD cbSymKey,
LPWSTR wszSymKeyType, // optional
LPWSTR wszClientLicensorCertificate, // optional
DRMCALLBACK pfnCallback,
LPWSTR wszURL, // optional
void* pvContext
);[DllImport("msdrm.dll", ExactSpelling = true)]
static extern int DRMGetSignedIssuanceLicense(
uint hEnv, // DWORD
uint hIssuanceLicense, // DWORD
uint uFlags, // DWORD
IntPtr pbSymKey, // BYTE* in/out
uint cbSymKey, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string wszSymKeyType, // LPWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string wszClientLicensorCertificate, // LPWSTR optional
IntPtr pfnCallback, // DRMCALLBACK
[MarshalAs(UnmanagedType.LPWStr)] string wszURL, // LPWSTR optional
IntPtr pvContext // void* in/out
);<DllImport("msdrm.dll", ExactSpelling:=True)>
Public Shared Function DRMGetSignedIssuanceLicense(
hEnv As UInteger, ' DWORD
hIssuanceLicense As UInteger, ' DWORD
uFlags As UInteger, ' DWORD
pbSymKey As IntPtr, ' BYTE* in/out
cbSymKey As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> wszSymKeyType As String, ' LPWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> wszClientLicensorCertificate As String, ' LPWSTR optional
pfnCallback As IntPtr, ' DRMCALLBACK
<MarshalAs(UnmanagedType.LPWStr)> wszURL As String, ' LPWSTR optional
pvContext As IntPtr ' void* in/out
) As Integer
End Function' hEnv : DWORD
' hIssuanceLicense : DWORD
' uFlags : DWORD
' pbSymKey : BYTE* in/out
' cbSymKey : DWORD
' wszSymKeyType : LPWSTR optional
' wszClientLicensorCertificate : LPWSTR optional
' pfnCallback : DRMCALLBACK
' wszURL : LPWSTR optional
' pvContext : void* in/out
Declare PtrSafe Function DRMGetSignedIssuanceLicense Lib "msdrm" ( _
ByVal hEnv As Long, _
ByVal hIssuanceLicense As Long, _
ByVal uFlags As Long, _
ByVal pbSymKey As LongPtr, _
ByVal cbSymKey As Long, _
ByVal wszSymKeyType As LongPtr, _
ByVal wszClientLicensorCertificate As LongPtr, _
ByVal pfnCallback As LongPtr, _
ByVal wszURL As LongPtr, _
ByVal pvContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DRMGetSignedIssuanceLicense = ctypes.windll.msdrm.DRMGetSignedIssuanceLicense
DRMGetSignedIssuanceLicense.restype = ctypes.c_int
DRMGetSignedIssuanceLicense.argtypes = [
wintypes.DWORD, # hEnv : DWORD
wintypes.DWORD, # hIssuanceLicense : DWORD
wintypes.DWORD, # uFlags : DWORD
ctypes.POINTER(ctypes.c_ubyte), # pbSymKey : BYTE* in/out
wintypes.DWORD, # cbSymKey : DWORD
wintypes.LPCWSTR, # wszSymKeyType : LPWSTR optional
wintypes.LPCWSTR, # wszClientLicensorCertificate : LPWSTR optional
ctypes.c_void_p, # pfnCallback : DRMCALLBACK
wintypes.LPCWSTR, # wszURL : LPWSTR optional
ctypes.POINTER(None), # pvContext : void* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msdrm.dll')
DRMGetSignedIssuanceLicense = Fiddle::Function.new(
lib['DRMGetSignedIssuanceLicense'],
[
-Fiddle::TYPE_INT, # hEnv : DWORD
-Fiddle::TYPE_INT, # hIssuanceLicense : DWORD
-Fiddle::TYPE_INT, # uFlags : DWORD
Fiddle::TYPE_VOIDP, # pbSymKey : BYTE* in/out
-Fiddle::TYPE_INT, # cbSymKey : DWORD
Fiddle::TYPE_VOIDP, # wszSymKeyType : LPWSTR optional
Fiddle::TYPE_VOIDP, # wszClientLicensorCertificate : LPWSTR optional
Fiddle::TYPE_VOIDP, # pfnCallback : DRMCALLBACK
Fiddle::TYPE_VOIDP, # wszURL : LPWSTR optional
Fiddle::TYPE_VOIDP, # pvContext : void* in/out
],
Fiddle::TYPE_INT)#[link(name = "msdrm")]
extern "system" {
fn DRMGetSignedIssuanceLicense(
hEnv: u32, // DWORD
hIssuanceLicense: u32, // DWORD
uFlags: u32, // DWORD
pbSymKey: *mut u8, // BYTE* in/out
cbSymKey: u32, // DWORD
wszSymKeyType: *mut u16, // LPWSTR optional
wszClientLicensorCertificate: *mut u16, // LPWSTR optional
pfnCallback: *const core::ffi::c_void, // DRMCALLBACK
wszURL: *mut u16, // LPWSTR optional
pvContext: *mut () // void* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msdrm.dll")]
public static extern int DRMGetSignedIssuanceLicense(uint hEnv, uint hIssuanceLicense, uint uFlags, IntPtr pbSymKey, uint cbSymKey, [MarshalAs(UnmanagedType.LPWStr)] string wszSymKeyType, [MarshalAs(UnmanagedType.LPWStr)] string wszClientLicensorCertificate, IntPtr pfnCallback, [MarshalAs(UnmanagedType.LPWStr)] string wszURL, IntPtr pvContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msdrm_DRMGetSignedIssuanceLicense' -Namespace Win32 -PassThru
# $api::DRMGetSignedIssuanceLicense(hEnv, hIssuanceLicense, uFlags, pbSymKey, cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext)#uselib "msdrm.dll"
#func global DRMGetSignedIssuanceLicense "DRMGetSignedIssuanceLicense" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; DRMGetSignedIssuanceLicense hEnv, hIssuanceLicense, uFlags, varptr(pbSymKey), cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext ; 戻り値は stat
; hEnv : DWORD -> "sptr"
; hIssuanceLicense : DWORD -> "sptr"
; uFlags : DWORD -> "sptr"
; pbSymKey : BYTE* in/out -> "sptr"
; cbSymKey : DWORD -> "sptr"
; wszSymKeyType : LPWSTR optional -> "sptr"
; wszClientLicensorCertificate : LPWSTR optional -> "sptr"
; pfnCallback : DRMCALLBACK -> "sptr"
; wszURL : LPWSTR optional -> "sptr"
; pvContext : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "msdrm.dll" #cfunc global DRMGetSignedIssuanceLicense "DRMGetSignedIssuanceLicense" int, int, int, var, int, wstr, wstr, sptr, wstr, sptr ; res = DRMGetSignedIssuanceLicense(hEnv, hIssuanceLicense, uFlags, pbSymKey, cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext) ; hEnv : DWORD -> "int" ; hIssuanceLicense : DWORD -> "int" ; uFlags : DWORD -> "int" ; pbSymKey : BYTE* in/out -> "var" ; cbSymKey : DWORD -> "int" ; wszSymKeyType : LPWSTR optional -> "wstr" ; wszClientLicensorCertificate : LPWSTR optional -> "wstr" ; pfnCallback : DRMCALLBACK -> "sptr" ; wszURL : LPWSTR optional -> "wstr" ; pvContext : void* in/out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "msdrm.dll" #cfunc global DRMGetSignedIssuanceLicense "DRMGetSignedIssuanceLicense" int, int, int, sptr, int, wstr, wstr, sptr, wstr, sptr ; res = DRMGetSignedIssuanceLicense(hEnv, hIssuanceLicense, uFlags, varptr(pbSymKey), cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext) ; hEnv : DWORD -> "int" ; hIssuanceLicense : DWORD -> "int" ; uFlags : DWORD -> "int" ; pbSymKey : BYTE* in/out -> "sptr" ; cbSymKey : DWORD -> "int" ; wszSymKeyType : LPWSTR optional -> "wstr" ; wszClientLicensorCertificate : LPWSTR optional -> "wstr" ; pfnCallback : DRMCALLBACK -> "sptr" ; wszURL : LPWSTR optional -> "wstr" ; pvContext : void* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DRMGetSignedIssuanceLicense(DWORD hEnv, DWORD hIssuanceLicense, DWORD uFlags, BYTE* pbSymKey, DWORD cbSymKey, LPWSTR wszSymKeyType, LPWSTR wszClientLicensorCertificate, DRMCALLBACK pfnCallback, LPWSTR wszURL, void* pvContext) #uselib "msdrm.dll" #cfunc global DRMGetSignedIssuanceLicense "DRMGetSignedIssuanceLicense" int, int, int, var, int, wstr, wstr, intptr, wstr, intptr ; res = DRMGetSignedIssuanceLicense(hEnv, hIssuanceLicense, uFlags, pbSymKey, cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext) ; hEnv : DWORD -> "int" ; hIssuanceLicense : DWORD -> "int" ; uFlags : DWORD -> "int" ; pbSymKey : BYTE* in/out -> "var" ; cbSymKey : DWORD -> "int" ; wszSymKeyType : LPWSTR optional -> "wstr" ; wszClientLicensorCertificate : LPWSTR optional -> "wstr" ; pfnCallback : DRMCALLBACK -> "intptr" ; wszURL : LPWSTR optional -> "wstr" ; pvContext : void* in/out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DRMGetSignedIssuanceLicense(DWORD hEnv, DWORD hIssuanceLicense, DWORD uFlags, BYTE* pbSymKey, DWORD cbSymKey, LPWSTR wszSymKeyType, LPWSTR wszClientLicensorCertificate, DRMCALLBACK pfnCallback, LPWSTR wszURL, void* pvContext) #uselib "msdrm.dll" #cfunc global DRMGetSignedIssuanceLicense "DRMGetSignedIssuanceLicense" int, int, int, intptr, int, wstr, wstr, intptr, wstr, intptr ; res = DRMGetSignedIssuanceLicense(hEnv, hIssuanceLicense, uFlags, varptr(pbSymKey), cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext) ; hEnv : DWORD -> "int" ; hIssuanceLicense : DWORD -> "int" ; uFlags : DWORD -> "int" ; pbSymKey : BYTE* in/out -> "intptr" ; cbSymKey : DWORD -> "int" ; wszSymKeyType : LPWSTR optional -> "wstr" ; wszClientLicensorCertificate : LPWSTR optional -> "wstr" ; pfnCallback : DRMCALLBACK -> "intptr" ; wszURL : LPWSTR optional -> "wstr" ; pvContext : void* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msdrm = windows.NewLazySystemDLL("msdrm.dll")
procDRMGetSignedIssuanceLicense = msdrm.NewProc("DRMGetSignedIssuanceLicense")
)
// hEnv (DWORD), hIssuanceLicense (DWORD), uFlags (DWORD), pbSymKey (BYTE* in/out), cbSymKey (DWORD), wszSymKeyType (LPWSTR optional), wszClientLicensorCertificate (LPWSTR optional), pfnCallback (DRMCALLBACK), wszURL (LPWSTR optional), pvContext (void* in/out)
r1, _, err := procDRMGetSignedIssuanceLicense.Call(
uintptr(hEnv),
uintptr(hIssuanceLicense),
uintptr(uFlags),
uintptr(pbSymKey),
uintptr(cbSymKey),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(wszSymKeyType))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(wszClientLicensorCertificate))),
uintptr(pfnCallback),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(wszURL))),
uintptr(pvContext),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DRMGetSignedIssuanceLicense(
hEnv: DWORD; // DWORD
hIssuanceLicense: DWORD; // DWORD
uFlags: DWORD; // DWORD
pbSymKey: Pointer; // BYTE* in/out
cbSymKey: DWORD; // DWORD
wszSymKeyType: PWideChar; // LPWSTR optional
wszClientLicensorCertificate: PWideChar; // LPWSTR optional
pfnCallback: Pointer; // DRMCALLBACK
wszURL: PWideChar; // LPWSTR optional
pvContext: Pointer // void* in/out
): Integer; stdcall;
external 'msdrm.dll' name 'DRMGetSignedIssuanceLicense';result := DllCall("msdrm\DRMGetSignedIssuanceLicense"
, "UInt", hEnv ; DWORD
, "UInt", hIssuanceLicense ; DWORD
, "UInt", uFlags ; DWORD
, "Ptr", pbSymKey ; BYTE* in/out
, "UInt", cbSymKey ; DWORD
, "WStr", wszSymKeyType ; LPWSTR optional
, "WStr", wszClientLicensorCertificate ; LPWSTR optional
, "Ptr", pfnCallback ; DRMCALLBACK
, "WStr", wszURL ; LPWSTR optional
, "Ptr", pvContext ; void* in/out
, "Int") ; return: HRESULT●DRMGetSignedIssuanceLicense(hEnv, hIssuanceLicense, uFlags, pbSymKey, cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext) = DLL("msdrm.dll", "int DRMGetSignedIssuanceLicense(dword, dword, dword, void*, dword, char*, char*, void*, char*, void*)")
# 呼び出し: DRMGetSignedIssuanceLicense(hEnv, hIssuanceLicense, uFlags, pbSymKey, cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext)
# hEnv : DWORD -> "dword"
# hIssuanceLicense : DWORD -> "dword"
# uFlags : DWORD -> "dword"
# pbSymKey : BYTE* in/out -> "void*"
# cbSymKey : DWORD -> "dword"
# wszSymKeyType : LPWSTR optional -> "char*"
# wszClientLicensorCertificate : LPWSTR optional -> "char*"
# pfnCallback : DRMCALLBACK -> "void*"
# wszURL : LPWSTR optional -> "char*"
# pvContext : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msdrm" fn DRMGetSignedIssuanceLicense(
hEnv: u32, // DWORD
hIssuanceLicense: u32, // DWORD
uFlags: u32, // DWORD
pbSymKey: [*c]u8, // BYTE* in/out
cbSymKey: u32, // DWORD
wszSymKeyType: [*c]const u16, // LPWSTR optional
wszClientLicensorCertificate: [*c]const u16, // LPWSTR optional
pfnCallback: ?*anyopaque, // DRMCALLBACK
wszURL: [*c]const u16, // LPWSTR optional
pvContext: ?*anyopaque // void* in/out
) callconv(std.os.windows.WINAPI) i32;proc DRMGetSignedIssuanceLicense(
hEnv: uint32, # DWORD
hIssuanceLicense: uint32, # DWORD
uFlags: uint32, # DWORD
pbSymKey: ptr uint8, # BYTE* in/out
cbSymKey: uint32, # DWORD
wszSymKeyType: WideCString, # LPWSTR optional
wszClientLicensorCertificate: WideCString, # LPWSTR optional
pfnCallback: pointer, # DRMCALLBACK
wszURL: WideCString, # LPWSTR optional
pvContext: pointer # void* in/out
): int32 {.importc: "DRMGetSignedIssuanceLicense", stdcall, dynlib: "msdrm.dll".}pragma(lib, "msdrm");
extern(Windows)
int DRMGetSignedIssuanceLicense(
uint hEnv, // DWORD
uint hIssuanceLicense, // DWORD
uint uFlags, // DWORD
ubyte* pbSymKey, // BYTE* in/out
uint cbSymKey, // DWORD
const(wchar)* wszSymKeyType, // LPWSTR optional
const(wchar)* wszClientLicensorCertificate, // LPWSTR optional
void* pfnCallback, // DRMCALLBACK
const(wchar)* wszURL, // LPWSTR optional
void* pvContext // void* in/out
);ccall((:DRMGetSignedIssuanceLicense, "msdrm.dll"), stdcall, Int32,
(UInt32, UInt32, UInt32, Ptr{UInt8}, UInt32, Cwstring, Cwstring, Ptr{Cvoid}, Cwstring, Ptr{Cvoid}),
hEnv, hIssuanceLicense, uFlags, pbSymKey, cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext)
# hEnv : DWORD -> UInt32
# hIssuanceLicense : DWORD -> UInt32
# uFlags : DWORD -> UInt32
# pbSymKey : BYTE* in/out -> Ptr{UInt8}
# cbSymKey : DWORD -> UInt32
# wszSymKeyType : LPWSTR optional -> Cwstring
# wszClientLicensorCertificate : LPWSTR optional -> Cwstring
# pfnCallback : DRMCALLBACK -> Ptr{Cvoid}
# wszURL : LPWSTR optional -> Cwstring
# pvContext : void* in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DRMGetSignedIssuanceLicense(
uint32_t hEnv,
uint32_t hIssuanceLicense,
uint32_t uFlags,
uint8_t* pbSymKey,
uint32_t cbSymKey,
const uint16_t* wszSymKeyType,
const uint16_t* wszClientLicensorCertificate,
void* pfnCallback,
const uint16_t* wszURL,
void* pvContext);
]]
local msdrm = ffi.load("msdrm")
-- msdrm.DRMGetSignedIssuanceLicense(hEnv, hIssuanceLicense, uFlags, pbSymKey, cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext)
-- hEnv : DWORD
-- hIssuanceLicense : DWORD
-- uFlags : DWORD
-- pbSymKey : BYTE* in/out
-- cbSymKey : DWORD
-- wszSymKeyType : LPWSTR optional
-- wszClientLicensorCertificate : LPWSTR optional
-- pfnCallback : DRMCALLBACK
-- wszURL : LPWSTR optional
-- pvContext : void* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('msdrm.dll');
const DRMGetSignedIssuanceLicense = lib.func('__stdcall', 'DRMGetSignedIssuanceLicense', 'int32_t', ['uint32_t', 'uint32_t', 'uint32_t', 'uint8_t *', 'uint32_t', 'str16', 'str16', 'void *', 'str16', 'void *']);
// DRMGetSignedIssuanceLicense(hEnv, hIssuanceLicense, uFlags, pbSymKey, cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext)
// hEnv : DWORD -> 'uint32_t'
// hIssuanceLicense : DWORD -> 'uint32_t'
// uFlags : DWORD -> 'uint32_t'
// pbSymKey : BYTE* in/out -> 'uint8_t *'
// cbSymKey : DWORD -> 'uint32_t'
// wszSymKeyType : LPWSTR optional -> 'str16'
// wszClientLicensorCertificate : LPWSTR optional -> 'str16'
// pfnCallback : DRMCALLBACK -> 'void *'
// wszURL : LPWSTR optional -> 'str16'
// pvContext : void* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("msdrm.dll", {
DRMGetSignedIssuanceLicense: { parameters: ["u32", "u32", "u32", "pointer", "u32", "buffer", "buffer", "pointer", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.DRMGetSignedIssuanceLicense(hEnv, hIssuanceLicense, uFlags, pbSymKey, cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext)
// hEnv : DWORD -> "u32"
// hIssuanceLicense : DWORD -> "u32"
// uFlags : DWORD -> "u32"
// pbSymKey : BYTE* in/out -> "pointer"
// cbSymKey : DWORD -> "u32"
// wszSymKeyType : LPWSTR optional -> "buffer"
// wszClientLicensorCertificate : LPWSTR optional -> "buffer"
// pfnCallback : DRMCALLBACK -> "pointer"
// wszURL : LPWSTR optional -> "buffer"
// pvContext : void* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DRMGetSignedIssuanceLicense(
uint32_t hEnv,
uint32_t hIssuanceLicense,
uint32_t uFlags,
uint8_t* pbSymKey,
uint32_t cbSymKey,
const uint16_t* wszSymKeyType,
const uint16_t* wszClientLicensorCertificate,
void* pfnCallback,
const uint16_t* wszURL,
void* pvContext);
C, "msdrm.dll");
// $ffi->DRMGetSignedIssuanceLicense(hEnv, hIssuanceLicense, uFlags, pbSymKey, cbSymKey, wszSymKeyType, wszClientLicensorCertificate, pfnCallback, wszURL, pvContext);
// hEnv : DWORD
// hIssuanceLicense : DWORD
// uFlags : DWORD
// pbSymKey : BYTE* in/out
// cbSymKey : DWORD
// wszSymKeyType : LPWSTR optional
// wszClientLicensorCertificate : LPWSTR optional
// pfnCallback : DRMCALLBACK
// wszURL : LPWSTR optional
// pvContext : void* 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 Msdrm extends StdCallLibrary {
Msdrm INSTANCE = Native.load("msdrm", Msdrm.class);
int DRMGetSignedIssuanceLicense(
int hEnv, // DWORD
int hIssuanceLicense, // DWORD
int uFlags, // DWORD
byte[] pbSymKey, // BYTE* in/out
int cbSymKey, // DWORD
WString wszSymKeyType, // LPWSTR optional
WString wszClientLicensorCertificate, // LPWSTR optional
Callback pfnCallback, // DRMCALLBACK
WString wszURL, // LPWSTR optional
Pointer pvContext // void* in/out
);
}@[Link("msdrm")]
lib Libmsdrm
fun DRMGetSignedIssuanceLicense = DRMGetSignedIssuanceLicense(
hEnv : UInt32, # DWORD
hIssuanceLicense : UInt32, # DWORD
uFlags : UInt32, # DWORD
pbSymKey : UInt8*, # BYTE* in/out
cbSymKey : UInt32, # DWORD
wszSymKeyType : UInt16*, # LPWSTR optional
wszClientLicensorCertificate : UInt16*, # LPWSTR optional
pfnCallback : Void*, # DRMCALLBACK
wszURL : UInt16*, # LPWSTR optional
pvContext : Void* # void* 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 DRMGetSignedIssuanceLicenseNative = Int32 Function(Uint32, Uint32, Uint32, Pointer<Uint8>, Uint32, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, Pointer<Utf16>, Pointer<Void>);
typedef DRMGetSignedIssuanceLicenseDart = int Function(int, int, int, Pointer<Uint8>, int, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, Pointer<Utf16>, Pointer<Void>);
final DRMGetSignedIssuanceLicense = DynamicLibrary.open('msdrm.dll')
.lookupFunction<DRMGetSignedIssuanceLicenseNative, DRMGetSignedIssuanceLicenseDart>('DRMGetSignedIssuanceLicense');
// hEnv : DWORD -> Uint32
// hIssuanceLicense : DWORD -> Uint32
// uFlags : DWORD -> Uint32
// pbSymKey : BYTE* in/out -> Pointer<Uint8>
// cbSymKey : DWORD -> Uint32
// wszSymKeyType : LPWSTR optional -> Pointer<Utf16>
// wszClientLicensorCertificate : LPWSTR optional -> Pointer<Utf16>
// pfnCallback : DRMCALLBACK -> Pointer<Void>
// wszURL : LPWSTR optional -> Pointer<Utf16>
// pvContext : void* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DRMGetSignedIssuanceLicense(
hEnv: DWORD; // DWORD
hIssuanceLicense: DWORD; // DWORD
uFlags: DWORD; // DWORD
pbSymKey: Pointer; // BYTE* in/out
cbSymKey: DWORD; // DWORD
wszSymKeyType: PWideChar; // LPWSTR optional
wszClientLicensorCertificate: PWideChar; // LPWSTR optional
pfnCallback: Pointer; // DRMCALLBACK
wszURL: PWideChar; // LPWSTR optional
pvContext: Pointer // void* in/out
): Integer; stdcall;
external 'msdrm.dll' name 'DRMGetSignedIssuanceLicense';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DRMGetSignedIssuanceLicense"
c_DRMGetSignedIssuanceLicense :: Word32 -> Word32 -> Word32 -> Ptr Word8 -> Word32 -> CWString -> CWString -> Ptr () -> CWString -> Ptr () -> IO Int32
-- hEnv : DWORD -> Word32
-- hIssuanceLicense : DWORD -> Word32
-- uFlags : DWORD -> Word32
-- pbSymKey : BYTE* in/out -> Ptr Word8
-- cbSymKey : DWORD -> Word32
-- wszSymKeyType : LPWSTR optional -> CWString
-- wszClientLicensorCertificate : LPWSTR optional -> CWString
-- pfnCallback : DRMCALLBACK -> Ptr ()
-- wszURL : LPWSTR optional -> CWString
-- pvContext : void* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let drmgetsignedissuancelicense =
foreign "DRMGetSignedIssuanceLicense"
(uint32_t @-> uint32_t @-> uint32_t @-> (ptr uint8_t) @-> uint32_t @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr void) @-> (ptr uint16_t) @-> (ptr void) @-> returning int32_t)
(* hEnv : DWORD -> uint32_t *)
(* hIssuanceLicense : DWORD -> uint32_t *)
(* uFlags : DWORD -> uint32_t *)
(* pbSymKey : BYTE* in/out -> (ptr uint8_t) *)
(* cbSymKey : DWORD -> uint32_t *)
(* wszSymKeyType : LPWSTR optional -> (ptr uint16_t) *)
(* wszClientLicensorCertificate : LPWSTR optional -> (ptr uint16_t) *)
(* pfnCallback : DRMCALLBACK -> (ptr void) *)
(* wszURL : LPWSTR optional -> (ptr uint16_t) *)
(* pvContext : void* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msdrm (t "msdrm.dll"))
(cffi:use-foreign-library msdrm)
(cffi:defcfun ("DRMGetSignedIssuanceLicense" drmget-signed-issuance-license :convention :stdcall) :int32
(h-env :uint32) ; DWORD
(h-issuance-license :uint32) ; DWORD
(u-flags :uint32) ; DWORD
(pb-sym-key :pointer) ; BYTE* in/out
(cb-sym-key :uint32) ; DWORD
(wsz-sym-key-type (:string :encoding :utf-16le)) ; LPWSTR optional
(wsz-client-licensor-certificate (:string :encoding :utf-16le)) ; LPWSTR optional
(pfn-callback :pointer) ; DRMCALLBACK
(wsz-url (:string :encoding :utf-16le)) ; LPWSTR optional
(pv-context :pointer)) ; void* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DRMGetSignedIssuanceLicense = Win32::API::More->new('msdrm',
'int DRMGetSignedIssuanceLicense(DWORD hEnv, DWORD hIssuanceLicense, DWORD uFlags, LPVOID pbSymKey, DWORD cbSymKey, LPCWSTR wszSymKeyType, LPCWSTR wszClientLicensorCertificate, LPVOID pfnCallback, LPCWSTR wszURL, LPVOID pvContext)');
# my $ret = $DRMGetSignedIssuanceLicense->Call($hEnv, $hIssuanceLicense, $uFlags, $pbSymKey, $cbSymKey, $wszSymKeyType, $wszClientLicensorCertificate, $pfnCallback, $wszURL, $pvContext);
# hEnv : DWORD -> DWORD
# hIssuanceLicense : DWORD -> DWORD
# uFlags : DWORD -> DWORD
# pbSymKey : BYTE* in/out -> LPVOID
# cbSymKey : DWORD -> DWORD
# wszSymKeyType : LPWSTR optional -> LPCWSTR
# wszClientLicensorCertificate : LPWSTR optional -> LPCWSTR
# pfnCallback : DRMCALLBACK -> LPVOID
# wszURL : LPWSTR optional -> LPCWSTR
# pvContext : void* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。関連項目
類似 API
- f DRMGetSignedIssuanceLicenseEx — 拡張オプション付きで署名済み発行ライセンスを取得する。
使用する型