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