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