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