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