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