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