ホーム › 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 | UI表示に用いる言語ID。 |
| pActServInfo | DRM_ACTSERV_INFO* | inout | アクティブ化サーバー情報を示すDRM_ACTSERV_INFO構造体へのポインタ。NULL可。 |
| pvContext | void* | inout | 非同期コールバックに渡されるユーザー定義コンテキスト。NULL可。 |
| hParentWnd | HWND | in | UIの親ウィンドウハンドル。NULL可。 |
戻り値の型: 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)。const std = @import("std");
extern "msdrm" fn DRMActivate(
hClient: u32, // DWORD
uFlags: u32, // DWORD
uLangID: u32, // DWORD
pActServInfo: [*c]DRM_ACTSERV_INFO, // DRM_ACTSERV_INFO* in/out
pvContext: ?*anyopaque, // void* in/out
hParentWnd: ?*anyopaque // HWND
) callconv(std.os.windows.WINAPI) i32;proc DRMActivate(
hClient: uint32, # DWORD
uFlags: uint32, # DWORD
uLangID: uint32, # DWORD
pActServInfo: ptr DRM_ACTSERV_INFO, # DRM_ACTSERV_INFO* in/out
pvContext: pointer, # void* in/out
hParentWnd: pointer # HWND
): int32 {.importc: "DRMActivate", stdcall, dynlib: "msdrm.dll".}pragma(lib, "msdrm");
extern(Windows)
int DRMActivate(
uint hClient, // DWORD
uint uFlags, // DWORD
uint uLangID, // DWORD
DRM_ACTSERV_INFO* pActServInfo, // DRM_ACTSERV_INFO* in/out
void* pvContext, // void* in/out
void* hParentWnd // HWND
);ccall((:DRMActivate, "msdrm.dll"), stdcall, Int32,
(UInt32, UInt32, UInt32, Ptr{DRM_ACTSERV_INFO}, Ptr{Cvoid}, Ptr{Cvoid}),
hClient, uFlags, uLangID, pActServInfo, pvContext, hParentWnd)
# hClient : DWORD -> UInt32
# uFlags : DWORD -> UInt32
# uLangID : DWORD -> UInt32
# pActServInfo : DRM_ACTSERV_INFO* in/out -> Ptr{DRM_ACTSERV_INFO}
# pvContext : void* in/out -> Ptr{Cvoid}
# hParentWnd : HWND -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DRMActivate(
uint32_t hClient,
uint32_t uFlags,
uint32_t uLangID,
void* pActServInfo,
void* pvContext,
void* hParentWnd);
]]
local msdrm = ffi.load("msdrm")
-- msdrm.DRMActivate(hClient, uFlags, uLangID, pActServInfo, pvContext, hParentWnd)
-- hClient : DWORD
-- uFlags : DWORD
-- uLangID : DWORD
-- pActServInfo : DRM_ACTSERV_INFO* in/out
-- pvContext : void* in/out
-- hParentWnd : HWND
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('msdrm.dll');
const DRMActivate = lib.func('__stdcall', 'DRMActivate', 'int32_t', ['uint32_t', 'uint32_t', 'uint32_t', 'void *', 'void *', 'void *']);
// DRMActivate(hClient, uFlags, uLangID, pActServInfo, pvContext, hParentWnd)
// hClient : DWORD -> 'uint32_t'
// uFlags : DWORD -> 'uint32_t'
// uLangID : DWORD -> 'uint32_t'
// pActServInfo : DRM_ACTSERV_INFO* in/out -> 'void *'
// pvContext : void* in/out -> 'void *'
// hParentWnd : HWND -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("msdrm.dll", {
DRMActivate: { parameters: ["u32", "u32", "u32", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.DRMActivate(hClient, uFlags, uLangID, pActServInfo, pvContext, hParentWnd)
// hClient : DWORD -> "u32"
// uFlags : DWORD -> "u32"
// uLangID : DWORD -> "u32"
// pActServInfo : DRM_ACTSERV_INFO* in/out -> "pointer"
// pvContext : void* in/out -> "pointer"
// hParentWnd : HWND -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DRMActivate(
uint32_t hClient,
uint32_t uFlags,
uint32_t uLangID,
void* pActServInfo,
void* pvContext,
void* hParentWnd);
C, "msdrm.dll");
// $ffi->DRMActivate(hClient, uFlags, uLangID, pActServInfo, pvContext, hParentWnd);
// hClient : DWORD
// uFlags : DWORD
// uLangID : DWORD
// pActServInfo : DRM_ACTSERV_INFO* in/out
// pvContext : void* in/out
// hParentWnd : HWND
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Msdrm extends StdCallLibrary {
Msdrm INSTANCE = Native.load("msdrm", Msdrm.class);
int DRMActivate(
int hClient, // DWORD
int uFlags, // DWORD
int uLangID, // DWORD
Pointer pActServInfo, // DRM_ACTSERV_INFO* in/out
Pointer pvContext, // void* in/out
Pointer hParentWnd // HWND
);
}@[Link("msdrm")]
lib Libmsdrm
fun DRMActivate = DRMActivate(
hClient : UInt32, # DWORD
uFlags : UInt32, # DWORD
uLangID : UInt32, # DWORD
pActServInfo : DRM_ACTSERV_INFO*, # DRM_ACTSERV_INFO* in/out
pvContext : Void*, # void* in/out
hParentWnd : Void* # HWND
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DRMActivateNative = Int32 Function(Uint32, Uint32, Uint32, Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef DRMActivateDart = int Function(int, int, int, Pointer<Void>, Pointer<Void>, Pointer<Void>);
final DRMActivate = DynamicLibrary.open('msdrm.dll')
.lookupFunction<DRMActivateNative, DRMActivateDart>('DRMActivate');
// hClient : DWORD -> Uint32
// uFlags : DWORD -> Uint32
// uLangID : DWORD -> Uint32
// pActServInfo : DRM_ACTSERV_INFO* in/out -> Pointer<Void>
// pvContext : void* in/out -> Pointer<Void>
// hParentWnd : HWND -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function 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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DRMActivate"
c_DRMActivate :: Word32 -> Word32 -> Word32 -> Ptr () -> Ptr () -> Ptr () -> IO Int32
-- hClient : DWORD -> Word32
-- uFlags : DWORD -> Word32
-- uLangID : DWORD -> Word32
-- pActServInfo : DRM_ACTSERV_INFO* in/out -> Ptr ()
-- pvContext : void* in/out -> Ptr ()
-- hParentWnd : HWND -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let drmactivate =
foreign "DRMActivate"
(uint32_t @-> uint32_t @-> uint32_t @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* hClient : DWORD -> uint32_t *)
(* uFlags : DWORD -> uint32_t *)
(* uLangID : DWORD -> uint32_t *)
(* pActServInfo : DRM_ACTSERV_INFO* in/out -> (ptr void) *)
(* pvContext : void* in/out -> (ptr void) *)
(* hParentWnd : HWND -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msdrm (t "msdrm.dll"))
(cffi:use-foreign-library msdrm)
(cffi:defcfun ("DRMActivate" drmactivate :convention :stdcall) :int32
(h-client :uint32) ; DWORD
(u-flags :uint32) ; DWORD
(u-lang-id :uint32) ; DWORD
(p-act-serv-info :pointer) ; DRM_ACTSERV_INFO* in/out
(pv-context :pointer) ; void* in/out
(h-parent-wnd :pointer)) ; HWND
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DRMActivate = Win32::API::More->new('msdrm',
'int DRMActivate(DWORD hClient, DWORD uFlags, DWORD uLangID, LPVOID pActServInfo, LPVOID pvContext, HANDLE hParentWnd)');
# my $ret = $DRMActivate->Call($hClient, $uFlags, $uLangID, $pActServInfo, $pvContext, $hParentWnd);
# hClient : DWORD -> DWORD
# uFlags : DWORD -> DWORD
# uLangID : DWORD -> DWORD
# pActServInfo : DRM_ACTSERV_INFO* in/out -> LPVOID
# pvContext : void* in/out -> LPVOID
# hParentWnd : HWND -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型