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