Win32 API 日本語リファレンス
ホームData.RightsManagement › DRMParseUnboundLicense

DRMParseUnboundLicense

関数
未バインドのライセンスを解析しクエリハンドルを得る。
DLLmsdrm.dll呼出規約winapi

シグネチャ

// msdrm.dll
#include <windows.h>

HRESULT DRMParseUnboundLicense(
    LPWSTR wszCertificate,
    DWORD* phQueryRoot
);

パラメーター

名前方向
wszCertificateLPWSTRin
phQueryRootDWORD*inout

戻り値の型: HRESULT

各言語での呼び出し定義

// msdrm.dll
#include <windows.h>

HRESULT DRMParseUnboundLicense(
    LPWSTR wszCertificate,
    DWORD* phQueryRoot
);
[DllImport("msdrm.dll", ExactSpelling = true)]
static extern int DRMParseUnboundLicense(
    [MarshalAs(UnmanagedType.LPWStr)] string wszCertificate,   // LPWSTR
    ref uint phQueryRoot   // DWORD* in/out
);
<DllImport("msdrm.dll", ExactSpelling:=True)>
Public Shared Function DRMParseUnboundLicense(
    <MarshalAs(UnmanagedType.LPWStr)> wszCertificate As String,   ' LPWSTR
    ByRef phQueryRoot As UInteger   ' DWORD* in/out
) As Integer
End Function
' wszCertificate : LPWSTR
' phQueryRoot : DWORD* in/out
Declare PtrSafe Function DRMParseUnboundLicense Lib "msdrm" ( _
    ByVal wszCertificate As LongPtr, _
    ByRef phQueryRoot As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DRMParseUnboundLicense = ctypes.windll.msdrm.DRMParseUnboundLicense
DRMParseUnboundLicense.restype = ctypes.c_int
DRMParseUnboundLicense.argtypes = [
    wintypes.LPCWSTR,  # wszCertificate : LPWSTR
    ctypes.POINTER(wintypes.DWORD),  # phQueryRoot : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msdrm.dll')
DRMParseUnboundLicense = Fiddle::Function.new(
  lib['DRMParseUnboundLicense'],
  [
    Fiddle::TYPE_VOIDP,  # wszCertificate : LPWSTR
    Fiddle::TYPE_VOIDP,  # phQueryRoot : DWORD* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "msdrm")]
extern "system" {
    fn DRMParseUnboundLicense(
        wszCertificate: *mut u16,  // LPWSTR
        phQueryRoot: *mut u32  // DWORD* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msdrm.dll")]
public static extern int DRMParseUnboundLicense([MarshalAs(UnmanagedType.LPWStr)] string wszCertificate, ref uint phQueryRoot);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msdrm_DRMParseUnboundLicense' -Namespace Win32 -PassThru
# $api::DRMParseUnboundLicense(wszCertificate, phQueryRoot)
#uselib "msdrm.dll"
#func global DRMParseUnboundLicense "DRMParseUnboundLicense" sptr, sptr
; DRMParseUnboundLicense wszCertificate, varptr(phQueryRoot)   ; 戻り値は stat
; wszCertificate : LPWSTR -> "sptr"
; phQueryRoot : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "msdrm.dll"
#cfunc global DRMParseUnboundLicense "DRMParseUnboundLicense" wstr, var
; res = DRMParseUnboundLicense(wszCertificate, phQueryRoot)
; wszCertificate : LPWSTR -> "wstr"
; phQueryRoot : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT DRMParseUnboundLicense(LPWSTR wszCertificate, DWORD* phQueryRoot)
#uselib "msdrm.dll"
#cfunc global DRMParseUnboundLicense "DRMParseUnboundLicense" wstr, var
; res = DRMParseUnboundLicense(wszCertificate, phQueryRoot)
; wszCertificate : LPWSTR -> "wstr"
; phQueryRoot : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msdrm = windows.NewLazySystemDLL("msdrm.dll")
	procDRMParseUnboundLicense = msdrm.NewProc("DRMParseUnboundLicense")
)

// wszCertificate (LPWSTR), phQueryRoot (DWORD* in/out)
r1, _, err := procDRMParseUnboundLicense.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(wszCertificate))),
	uintptr(phQueryRoot),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function DRMParseUnboundLicense(
  wszCertificate: PWideChar;   // LPWSTR
  phQueryRoot: Pointer   // DWORD* in/out
): Integer; stdcall;
  external 'msdrm.dll' name 'DRMParseUnboundLicense';
result := DllCall("msdrm\DRMParseUnboundLicense"
    , "WStr", wszCertificate   ; LPWSTR
    , "Ptr", phQueryRoot   ; DWORD* in/out
    , "Int")   ; return: HRESULT
●DRMParseUnboundLicense(wszCertificate, phQueryRoot) = DLL("msdrm.dll", "int DRMParseUnboundLicense(char*, void*)")
# 呼び出し: DRMParseUnboundLicense(wszCertificate, phQueryRoot)
# wszCertificate : LPWSTR -> "char*"
# phQueryRoot : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。