ホーム › Data.RightsManagement › DRMCreateEnablingBitsDecryptor
DRMCreateEnablingBitsDecryptor
関数バインドライセンスから復号用のビット処理器を作成する。
シグネチャ
// msdrm.dll
#include <windows.h>
HRESULT DRMCreateEnablingBitsDecryptor(
DWORD hBoundLicense,
LPWSTR wszRight, // optional
DWORD hAuxLib,
LPWSTR wszAuxPlug, // optional
DWORD* phDecryptor
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hBoundLicense | DWORD | in | 対象のバインドライセンスハンドル。 |
| wszRight | LPWSTR | inoptional | 復号に対応する権利名を示すUnicode文字列。 |
| hAuxLib | DWORD | in | 補助ライブラリのハンドル。不要ならNULL相当の0可。 |
| wszAuxPlug | LPWSTR | inoptional | 補助プラグインを示すUnicode文字列。NULL可。 |
| phDecryptor | DWORD* | inout | 生成された復号化器のハンドルを受け取る出力先。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// msdrm.dll
#include <windows.h>
HRESULT DRMCreateEnablingBitsDecryptor(
DWORD hBoundLicense,
LPWSTR wszRight, // optional
DWORD hAuxLib,
LPWSTR wszAuxPlug, // optional
DWORD* phDecryptor
);[DllImport("msdrm.dll", ExactSpelling = true)]
static extern int DRMCreateEnablingBitsDecryptor(
uint hBoundLicense, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string wszRight, // LPWSTR optional
uint hAuxLib, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string wszAuxPlug, // LPWSTR optional
ref uint phDecryptor // DWORD* in/out
);<DllImport("msdrm.dll", ExactSpelling:=True)>
Public Shared Function DRMCreateEnablingBitsDecryptor(
hBoundLicense As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> wszRight As String, ' LPWSTR optional
hAuxLib As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> wszAuxPlug As String, ' LPWSTR optional
ByRef phDecryptor As UInteger ' DWORD* in/out
) As Integer
End Function' hBoundLicense : DWORD
' wszRight : LPWSTR optional
' hAuxLib : DWORD
' wszAuxPlug : LPWSTR optional
' phDecryptor : DWORD* in/out
Declare PtrSafe Function DRMCreateEnablingBitsDecryptor Lib "msdrm" ( _
ByVal hBoundLicense As Long, _
ByVal wszRight As LongPtr, _
ByVal hAuxLib As Long, _
ByVal wszAuxPlug As LongPtr, _
ByRef phDecryptor As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DRMCreateEnablingBitsDecryptor = ctypes.windll.msdrm.DRMCreateEnablingBitsDecryptor
DRMCreateEnablingBitsDecryptor.restype = ctypes.c_int
DRMCreateEnablingBitsDecryptor.argtypes = [
wintypes.DWORD, # hBoundLicense : DWORD
wintypes.LPCWSTR, # wszRight : LPWSTR optional
wintypes.DWORD, # hAuxLib : DWORD
wintypes.LPCWSTR, # wszAuxPlug : LPWSTR optional
ctypes.POINTER(wintypes.DWORD), # phDecryptor : DWORD* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msdrm.dll')
DRMCreateEnablingBitsDecryptor = Fiddle::Function.new(
lib['DRMCreateEnablingBitsDecryptor'],
[
-Fiddle::TYPE_INT, # hBoundLicense : DWORD
Fiddle::TYPE_VOIDP, # wszRight : LPWSTR optional
-Fiddle::TYPE_INT, # hAuxLib : DWORD
Fiddle::TYPE_VOIDP, # wszAuxPlug : LPWSTR optional
Fiddle::TYPE_VOIDP, # phDecryptor : DWORD* in/out
],
Fiddle::TYPE_INT)#[link(name = "msdrm")]
extern "system" {
fn DRMCreateEnablingBitsDecryptor(
hBoundLicense: u32, // DWORD
wszRight: *mut u16, // LPWSTR optional
hAuxLib: u32, // DWORD
wszAuxPlug: *mut u16, // LPWSTR optional
phDecryptor: *mut u32 // DWORD* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msdrm.dll")]
public static extern int DRMCreateEnablingBitsDecryptor(uint hBoundLicense, [MarshalAs(UnmanagedType.LPWStr)] string wszRight, uint hAuxLib, [MarshalAs(UnmanagedType.LPWStr)] string wszAuxPlug, ref uint phDecryptor);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msdrm_DRMCreateEnablingBitsDecryptor' -Namespace Win32 -PassThru
# $api::DRMCreateEnablingBitsDecryptor(hBoundLicense, wszRight, hAuxLib, wszAuxPlug, phDecryptor)#uselib "msdrm.dll"
#func global DRMCreateEnablingBitsDecryptor "DRMCreateEnablingBitsDecryptor" sptr, sptr, sptr, sptr, sptr
; DRMCreateEnablingBitsDecryptor hBoundLicense, wszRight, hAuxLib, wszAuxPlug, varptr(phDecryptor) ; 戻り値は stat
; hBoundLicense : DWORD -> "sptr"
; wszRight : LPWSTR optional -> "sptr"
; hAuxLib : DWORD -> "sptr"
; wszAuxPlug : LPWSTR optional -> "sptr"
; phDecryptor : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "msdrm.dll" #cfunc global DRMCreateEnablingBitsDecryptor "DRMCreateEnablingBitsDecryptor" int, wstr, int, wstr, var ; res = DRMCreateEnablingBitsDecryptor(hBoundLicense, wszRight, hAuxLib, wszAuxPlug, phDecryptor) ; hBoundLicense : DWORD -> "int" ; wszRight : LPWSTR optional -> "wstr" ; hAuxLib : DWORD -> "int" ; wszAuxPlug : LPWSTR optional -> "wstr" ; phDecryptor : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "msdrm.dll" #cfunc global DRMCreateEnablingBitsDecryptor "DRMCreateEnablingBitsDecryptor" int, wstr, int, wstr, sptr ; res = DRMCreateEnablingBitsDecryptor(hBoundLicense, wszRight, hAuxLib, wszAuxPlug, varptr(phDecryptor)) ; hBoundLicense : DWORD -> "int" ; wszRight : LPWSTR optional -> "wstr" ; hAuxLib : DWORD -> "int" ; wszAuxPlug : LPWSTR optional -> "wstr" ; phDecryptor : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DRMCreateEnablingBitsDecryptor(DWORD hBoundLicense, LPWSTR wszRight, DWORD hAuxLib, LPWSTR wszAuxPlug, DWORD* phDecryptor) #uselib "msdrm.dll" #cfunc global DRMCreateEnablingBitsDecryptor "DRMCreateEnablingBitsDecryptor" int, wstr, int, wstr, var ; res = DRMCreateEnablingBitsDecryptor(hBoundLicense, wszRight, hAuxLib, wszAuxPlug, phDecryptor) ; hBoundLicense : DWORD -> "int" ; wszRight : LPWSTR optional -> "wstr" ; hAuxLib : DWORD -> "int" ; wszAuxPlug : LPWSTR optional -> "wstr" ; phDecryptor : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DRMCreateEnablingBitsDecryptor(DWORD hBoundLicense, LPWSTR wszRight, DWORD hAuxLib, LPWSTR wszAuxPlug, DWORD* phDecryptor) #uselib "msdrm.dll" #cfunc global DRMCreateEnablingBitsDecryptor "DRMCreateEnablingBitsDecryptor" int, wstr, int, wstr, intptr ; res = DRMCreateEnablingBitsDecryptor(hBoundLicense, wszRight, hAuxLib, wszAuxPlug, varptr(phDecryptor)) ; hBoundLicense : DWORD -> "int" ; wszRight : LPWSTR optional -> "wstr" ; hAuxLib : DWORD -> "int" ; wszAuxPlug : LPWSTR optional -> "wstr" ; phDecryptor : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msdrm = windows.NewLazySystemDLL("msdrm.dll")
procDRMCreateEnablingBitsDecryptor = msdrm.NewProc("DRMCreateEnablingBitsDecryptor")
)
// hBoundLicense (DWORD), wszRight (LPWSTR optional), hAuxLib (DWORD), wszAuxPlug (LPWSTR optional), phDecryptor (DWORD* in/out)
r1, _, err := procDRMCreateEnablingBitsDecryptor.Call(
uintptr(hBoundLicense),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(wszRight))),
uintptr(hAuxLib),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(wszAuxPlug))),
uintptr(phDecryptor),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DRMCreateEnablingBitsDecryptor(
hBoundLicense: DWORD; // DWORD
wszRight: PWideChar; // LPWSTR optional
hAuxLib: DWORD; // DWORD
wszAuxPlug: PWideChar; // LPWSTR optional
phDecryptor: Pointer // DWORD* in/out
): Integer; stdcall;
external 'msdrm.dll' name 'DRMCreateEnablingBitsDecryptor';result := DllCall("msdrm\DRMCreateEnablingBitsDecryptor"
, "UInt", hBoundLicense ; DWORD
, "WStr", wszRight ; LPWSTR optional
, "UInt", hAuxLib ; DWORD
, "WStr", wszAuxPlug ; LPWSTR optional
, "Ptr", phDecryptor ; DWORD* in/out
, "Int") ; return: HRESULT●DRMCreateEnablingBitsDecryptor(hBoundLicense, wszRight, hAuxLib, wszAuxPlug, phDecryptor) = DLL("msdrm.dll", "int DRMCreateEnablingBitsDecryptor(dword, char*, dword, char*, void*)")
# 呼び出し: DRMCreateEnablingBitsDecryptor(hBoundLicense, wszRight, hAuxLib, wszAuxPlug, phDecryptor)
# hBoundLicense : DWORD -> "dword"
# wszRight : LPWSTR optional -> "char*"
# hAuxLib : DWORD -> "dword"
# wszAuxPlug : LPWSTR optional -> "char*"
# phDecryptor : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msdrm" fn DRMCreateEnablingBitsDecryptor(
hBoundLicense: u32, // DWORD
wszRight: [*c]const u16, // LPWSTR optional
hAuxLib: u32, // DWORD
wszAuxPlug: [*c]const u16, // LPWSTR optional
phDecryptor: [*c]u32 // DWORD* in/out
) callconv(std.os.windows.WINAPI) i32;proc DRMCreateEnablingBitsDecryptor(
hBoundLicense: uint32, # DWORD
wszRight: WideCString, # LPWSTR optional
hAuxLib: uint32, # DWORD
wszAuxPlug: WideCString, # LPWSTR optional
phDecryptor: ptr uint32 # DWORD* in/out
): int32 {.importc: "DRMCreateEnablingBitsDecryptor", stdcall, dynlib: "msdrm.dll".}pragma(lib, "msdrm");
extern(Windows)
int DRMCreateEnablingBitsDecryptor(
uint hBoundLicense, // DWORD
const(wchar)* wszRight, // LPWSTR optional
uint hAuxLib, // DWORD
const(wchar)* wszAuxPlug, // LPWSTR optional
uint* phDecryptor // DWORD* in/out
);ccall((:DRMCreateEnablingBitsDecryptor, "msdrm.dll"), stdcall, Int32,
(UInt32, Cwstring, UInt32, Cwstring, Ptr{UInt32}),
hBoundLicense, wszRight, hAuxLib, wszAuxPlug, phDecryptor)
# hBoundLicense : DWORD -> UInt32
# wszRight : LPWSTR optional -> Cwstring
# hAuxLib : DWORD -> UInt32
# wszAuxPlug : LPWSTR optional -> Cwstring
# phDecryptor : DWORD* in/out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DRMCreateEnablingBitsDecryptor(
uint32_t hBoundLicense,
const uint16_t* wszRight,
uint32_t hAuxLib,
const uint16_t* wszAuxPlug,
uint32_t* phDecryptor);
]]
local msdrm = ffi.load("msdrm")
-- msdrm.DRMCreateEnablingBitsDecryptor(hBoundLicense, wszRight, hAuxLib, wszAuxPlug, phDecryptor)
-- hBoundLicense : DWORD
-- wszRight : LPWSTR optional
-- hAuxLib : DWORD
-- wszAuxPlug : LPWSTR optional
-- phDecryptor : DWORD* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('msdrm.dll');
const DRMCreateEnablingBitsDecryptor = lib.func('__stdcall', 'DRMCreateEnablingBitsDecryptor', 'int32_t', ['uint32_t', 'str16', 'uint32_t', 'str16', 'uint32_t *']);
// DRMCreateEnablingBitsDecryptor(hBoundLicense, wszRight, hAuxLib, wszAuxPlug, phDecryptor)
// hBoundLicense : DWORD -> 'uint32_t'
// wszRight : LPWSTR optional -> 'str16'
// hAuxLib : DWORD -> 'uint32_t'
// wszAuxPlug : LPWSTR optional -> 'str16'
// phDecryptor : DWORD* in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("msdrm.dll", {
DRMCreateEnablingBitsDecryptor: { parameters: ["u32", "buffer", "u32", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.DRMCreateEnablingBitsDecryptor(hBoundLicense, wszRight, hAuxLib, wszAuxPlug, phDecryptor)
// hBoundLicense : DWORD -> "u32"
// wszRight : LPWSTR optional -> "buffer"
// hAuxLib : DWORD -> "u32"
// wszAuxPlug : LPWSTR optional -> "buffer"
// phDecryptor : DWORD* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DRMCreateEnablingBitsDecryptor(
uint32_t hBoundLicense,
const uint16_t* wszRight,
uint32_t hAuxLib,
const uint16_t* wszAuxPlug,
uint32_t* phDecryptor);
C, "msdrm.dll");
// $ffi->DRMCreateEnablingBitsDecryptor(hBoundLicense, wszRight, hAuxLib, wszAuxPlug, phDecryptor);
// hBoundLicense : DWORD
// wszRight : LPWSTR optional
// hAuxLib : DWORD
// wszAuxPlug : LPWSTR optional
// phDecryptor : DWORD* 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 DRMCreateEnablingBitsDecryptor(
int hBoundLicense, // DWORD
WString wszRight, // LPWSTR optional
int hAuxLib, // DWORD
WString wszAuxPlug, // LPWSTR optional
IntByReference phDecryptor // DWORD* in/out
);
}@[Link("msdrm")]
lib Libmsdrm
fun DRMCreateEnablingBitsDecryptor = DRMCreateEnablingBitsDecryptor(
hBoundLicense : UInt32, # DWORD
wszRight : UInt16*, # LPWSTR optional
hAuxLib : UInt32, # DWORD
wszAuxPlug : UInt16*, # LPWSTR optional
phDecryptor : UInt32* # DWORD* 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 DRMCreateEnablingBitsDecryptorNative = Int32 Function(Uint32, Pointer<Utf16>, Uint32, Pointer<Utf16>, Pointer<Uint32>);
typedef DRMCreateEnablingBitsDecryptorDart = int Function(int, Pointer<Utf16>, int, Pointer<Utf16>, Pointer<Uint32>);
final DRMCreateEnablingBitsDecryptor = DynamicLibrary.open('msdrm.dll')
.lookupFunction<DRMCreateEnablingBitsDecryptorNative, DRMCreateEnablingBitsDecryptorDart>('DRMCreateEnablingBitsDecryptor');
// hBoundLicense : DWORD -> Uint32
// wszRight : LPWSTR optional -> Pointer<Utf16>
// hAuxLib : DWORD -> Uint32
// wszAuxPlug : LPWSTR optional -> Pointer<Utf16>
// phDecryptor : DWORD* in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DRMCreateEnablingBitsDecryptor(
hBoundLicense: DWORD; // DWORD
wszRight: PWideChar; // LPWSTR optional
hAuxLib: DWORD; // DWORD
wszAuxPlug: PWideChar; // LPWSTR optional
phDecryptor: Pointer // DWORD* in/out
): Integer; stdcall;
external 'msdrm.dll' name 'DRMCreateEnablingBitsDecryptor';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DRMCreateEnablingBitsDecryptor"
c_DRMCreateEnablingBitsDecryptor :: Word32 -> CWString -> Word32 -> CWString -> Ptr Word32 -> IO Int32
-- hBoundLicense : DWORD -> Word32
-- wszRight : LPWSTR optional -> CWString
-- hAuxLib : DWORD -> Word32
-- wszAuxPlug : LPWSTR optional -> CWString
-- phDecryptor : DWORD* in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let drmcreateenablingbitsdecryptor =
foreign "DRMCreateEnablingBitsDecryptor"
(uint32_t @-> (ptr uint16_t) @-> uint32_t @-> (ptr uint16_t) @-> (ptr uint32_t) @-> returning int32_t)
(* hBoundLicense : DWORD -> uint32_t *)
(* wszRight : LPWSTR optional -> (ptr uint16_t) *)
(* hAuxLib : DWORD -> uint32_t *)
(* wszAuxPlug : LPWSTR optional -> (ptr uint16_t) *)
(* phDecryptor : DWORD* in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msdrm (t "msdrm.dll"))
(cffi:use-foreign-library msdrm)
(cffi:defcfun ("DRMCreateEnablingBitsDecryptor" drmcreate-enabling-bits-decryptor :convention :stdcall) :int32
(h-bound-license :uint32) ; DWORD
(wsz-right (:string :encoding :utf-16le)) ; LPWSTR optional
(h-aux-lib :uint32) ; DWORD
(wsz-aux-plug (:string :encoding :utf-16le)) ; LPWSTR optional
(ph-decryptor :pointer)) ; DWORD* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DRMCreateEnablingBitsDecryptor = Win32::API::More->new('msdrm',
'int DRMCreateEnablingBitsDecryptor(DWORD hBoundLicense, LPCWSTR wszRight, DWORD hAuxLib, LPCWSTR wszAuxPlug, LPVOID phDecryptor)');
# my $ret = $DRMCreateEnablingBitsDecryptor->Call($hBoundLicense, $wszRight, $hAuxLib, $wszAuxPlug, $phDecryptor);
# hBoundLicense : DWORD -> DWORD
# wszRight : LPWSTR optional -> LPCWSTR
# hAuxLib : DWORD -> DWORD
# wszAuxPlug : LPWSTR optional -> LPCWSTR
# phDecryptor : DWORD* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。