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