ホーム › Data.RightsManagement › DRMGetNameAndDescription
DRMGetNameAndDescription
関数発行ライセンスの名前と説明を取得する。
シグネチャ
// msdrm.dll
#include <windows.h>
HRESULT DRMGetNameAndDescription(
DWORD hIssuanceLicense,
DWORD uIndex,
DWORD* pulcid,
DWORD* puNameLength,
LPWSTR wszName, // optional
DWORD* puDescriptionLength,
LPWSTR wszDescription // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hIssuanceLicense | DWORD | in | 対象の発行ライセンスハンドル。 |
| uIndex | DWORD | in | 取得するエントリの0始まりのインデックス。 |
| pulcid | DWORD* | inout | 名前・説明のロケールIDを受け取るポインタ。 |
| puNameLength | DWORD* | inout | 入力時に名前バッファ長、出力時に必要長を示すポインタ。 |
| wszName | LPWSTR | outoptional | ライセンス名を受け取る出力バッファ。NULLでサイズ問い合わせ可。 |
| puDescriptionLength | DWORD* | inout | 入力時に説明バッファ長、出力時に必要長を示すポインタ。 |
| wszDescription | LPWSTR | outoptional | ライセンス説明を受け取る出力バッファ。NULLでサイズ問い合わせ可。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// msdrm.dll
#include <windows.h>
HRESULT DRMGetNameAndDescription(
DWORD hIssuanceLicense,
DWORD uIndex,
DWORD* pulcid,
DWORD* puNameLength,
LPWSTR wszName, // optional
DWORD* puDescriptionLength,
LPWSTR wszDescription // optional
);[DllImport("msdrm.dll", ExactSpelling = true)]
static extern int DRMGetNameAndDescription(
uint hIssuanceLicense, // DWORD
uint uIndex, // DWORD
ref uint pulcid, // DWORD* in/out
ref uint puNameLength, // DWORD* in/out
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder wszName, // LPWSTR optional, out
ref uint puDescriptionLength, // DWORD* in/out
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder wszDescription // LPWSTR optional, out
);<DllImport("msdrm.dll", ExactSpelling:=True)>
Public Shared Function DRMGetNameAndDescription(
hIssuanceLicense As UInteger, ' DWORD
uIndex As UInteger, ' DWORD
ByRef pulcid As UInteger, ' DWORD* in/out
ByRef puNameLength As UInteger, ' DWORD* in/out
<MarshalAs(UnmanagedType.LPWStr)> wszName As System.Text.StringBuilder, ' LPWSTR optional, out
ByRef puDescriptionLength As UInteger, ' DWORD* in/out
<MarshalAs(UnmanagedType.LPWStr)> wszDescription As System.Text.StringBuilder ' LPWSTR optional, out
) As Integer
End Function' hIssuanceLicense : DWORD
' uIndex : DWORD
' pulcid : DWORD* in/out
' puNameLength : DWORD* in/out
' wszName : LPWSTR optional, out
' puDescriptionLength : DWORD* in/out
' wszDescription : LPWSTR optional, out
Declare PtrSafe Function DRMGetNameAndDescription Lib "msdrm" ( _
ByVal hIssuanceLicense As Long, _
ByVal uIndex As Long, _
ByRef pulcid As Long, _
ByRef puNameLength As Long, _
ByVal wszName As LongPtr, _
ByRef puDescriptionLength As Long, _
ByVal wszDescription As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DRMGetNameAndDescription = ctypes.windll.msdrm.DRMGetNameAndDescription
DRMGetNameAndDescription.restype = ctypes.c_int
DRMGetNameAndDescription.argtypes = [
wintypes.DWORD, # hIssuanceLicense : DWORD
wintypes.DWORD, # uIndex : DWORD
ctypes.POINTER(wintypes.DWORD), # pulcid : DWORD* in/out
ctypes.POINTER(wintypes.DWORD), # puNameLength : DWORD* in/out
wintypes.LPWSTR, # wszName : LPWSTR optional, out
ctypes.POINTER(wintypes.DWORD), # puDescriptionLength : DWORD* in/out
wintypes.LPWSTR, # wszDescription : LPWSTR optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msdrm.dll')
DRMGetNameAndDescription = Fiddle::Function.new(
lib['DRMGetNameAndDescription'],
[
-Fiddle::TYPE_INT, # hIssuanceLicense : DWORD
-Fiddle::TYPE_INT, # uIndex : DWORD
Fiddle::TYPE_VOIDP, # pulcid : DWORD* in/out
Fiddle::TYPE_VOIDP, # puNameLength : DWORD* in/out
Fiddle::TYPE_VOIDP, # wszName : LPWSTR optional, out
Fiddle::TYPE_VOIDP, # puDescriptionLength : DWORD* in/out
Fiddle::TYPE_VOIDP, # wszDescription : LPWSTR optional, out
],
Fiddle::TYPE_INT)#[link(name = "msdrm")]
extern "system" {
fn DRMGetNameAndDescription(
hIssuanceLicense: u32, // DWORD
uIndex: u32, // DWORD
pulcid: *mut u32, // DWORD* in/out
puNameLength: *mut u32, // DWORD* in/out
wszName: *mut u16, // LPWSTR optional, out
puDescriptionLength: *mut u32, // DWORD* in/out
wszDescription: *mut u16 // LPWSTR optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msdrm.dll")]
public static extern int DRMGetNameAndDescription(uint hIssuanceLicense, uint uIndex, ref uint pulcid, ref uint puNameLength, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder wszName, ref uint puDescriptionLength, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder wszDescription);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msdrm_DRMGetNameAndDescription' -Namespace Win32 -PassThru
# $api::DRMGetNameAndDescription(hIssuanceLicense, uIndex, pulcid, puNameLength, wszName, puDescriptionLength, wszDescription)#uselib "msdrm.dll"
#func global DRMGetNameAndDescription "DRMGetNameAndDescription" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; DRMGetNameAndDescription hIssuanceLicense, uIndex, varptr(pulcid), varptr(puNameLength), varptr(wszName), varptr(puDescriptionLength), varptr(wszDescription) ; 戻り値は stat
; hIssuanceLicense : DWORD -> "sptr"
; uIndex : DWORD -> "sptr"
; pulcid : DWORD* in/out -> "sptr"
; puNameLength : DWORD* in/out -> "sptr"
; wszName : LPWSTR optional, out -> "sptr"
; puDescriptionLength : DWORD* in/out -> "sptr"
; wszDescription : LPWSTR optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "msdrm.dll" #cfunc global DRMGetNameAndDescription "DRMGetNameAndDescription" int, int, var, var, var, var, var ; res = DRMGetNameAndDescription(hIssuanceLicense, uIndex, pulcid, puNameLength, wszName, puDescriptionLength, wszDescription) ; hIssuanceLicense : DWORD -> "int" ; uIndex : DWORD -> "int" ; pulcid : DWORD* in/out -> "var" ; puNameLength : DWORD* in/out -> "var" ; wszName : LPWSTR optional, out -> "var" ; puDescriptionLength : DWORD* in/out -> "var" ; wszDescription : LPWSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "msdrm.dll" #cfunc global DRMGetNameAndDescription "DRMGetNameAndDescription" int, int, sptr, sptr, sptr, sptr, sptr ; res = DRMGetNameAndDescription(hIssuanceLicense, uIndex, varptr(pulcid), varptr(puNameLength), varptr(wszName), varptr(puDescriptionLength), varptr(wszDescription)) ; hIssuanceLicense : DWORD -> "int" ; uIndex : DWORD -> "int" ; pulcid : DWORD* in/out -> "sptr" ; puNameLength : DWORD* in/out -> "sptr" ; wszName : LPWSTR optional, out -> "sptr" ; puDescriptionLength : DWORD* in/out -> "sptr" ; wszDescription : LPWSTR optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DRMGetNameAndDescription(DWORD hIssuanceLicense, DWORD uIndex, DWORD* pulcid, DWORD* puNameLength, LPWSTR wszName, DWORD* puDescriptionLength, LPWSTR wszDescription) #uselib "msdrm.dll" #cfunc global DRMGetNameAndDescription "DRMGetNameAndDescription" int, int, var, var, var, var, var ; res = DRMGetNameAndDescription(hIssuanceLicense, uIndex, pulcid, puNameLength, wszName, puDescriptionLength, wszDescription) ; hIssuanceLicense : DWORD -> "int" ; uIndex : DWORD -> "int" ; pulcid : DWORD* in/out -> "var" ; puNameLength : DWORD* in/out -> "var" ; wszName : LPWSTR optional, out -> "var" ; puDescriptionLength : DWORD* in/out -> "var" ; wszDescription : LPWSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DRMGetNameAndDescription(DWORD hIssuanceLicense, DWORD uIndex, DWORD* pulcid, DWORD* puNameLength, LPWSTR wszName, DWORD* puDescriptionLength, LPWSTR wszDescription) #uselib "msdrm.dll" #cfunc global DRMGetNameAndDescription "DRMGetNameAndDescription" int, int, intptr, intptr, intptr, intptr, intptr ; res = DRMGetNameAndDescription(hIssuanceLicense, uIndex, varptr(pulcid), varptr(puNameLength), varptr(wszName), varptr(puDescriptionLength), varptr(wszDescription)) ; hIssuanceLicense : DWORD -> "int" ; uIndex : DWORD -> "int" ; pulcid : DWORD* in/out -> "intptr" ; puNameLength : DWORD* in/out -> "intptr" ; wszName : LPWSTR optional, out -> "intptr" ; puDescriptionLength : DWORD* in/out -> "intptr" ; wszDescription : LPWSTR optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msdrm = windows.NewLazySystemDLL("msdrm.dll")
procDRMGetNameAndDescription = msdrm.NewProc("DRMGetNameAndDescription")
)
// hIssuanceLicense (DWORD), uIndex (DWORD), pulcid (DWORD* in/out), puNameLength (DWORD* in/out), wszName (LPWSTR optional, out), puDescriptionLength (DWORD* in/out), wszDescription (LPWSTR optional, out)
r1, _, err := procDRMGetNameAndDescription.Call(
uintptr(hIssuanceLicense),
uintptr(uIndex),
uintptr(pulcid),
uintptr(puNameLength),
uintptr(wszName),
uintptr(puDescriptionLength),
uintptr(wszDescription),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DRMGetNameAndDescription(
hIssuanceLicense: DWORD; // DWORD
uIndex: DWORD; // DWORD
pulcid: Pointer; // DWORD* in/out
puNameLength: Pointer; // DWORD* in/out
wszName: PWideChar; // LPWSTR optional, out
puDescriptionLength: Pointer; // DWORD* in/out
wszDescription: PWideChar // LPWSTR optional, out
): Integer; stdcall;
external 'msdrm.dll' name 'DRMGetNameAndDescription';result := DllCall("msdrm\DRMGetNameAndDescription"
, "UInt", hIssuanceLicense ; DWORD
, "UInt", uIndex ; DWORD
, "Ptr", pulcid ; DWORD* in/out
, "Ptr", puNameLength ; DWORD* in/out
, "Ptr", wszName ; LPWSTR optional, out
, "Ptr", puDescriptionLength ; DWORD* in/out
, "Ptr", wszDescription ; LPWSTR optional, out
, "Int") ; return: HRESULT●DRMGetNameAndDescription(hIssuanceLicense, uIndex, pulcid, puNameLength, wszName, puDescriptionLength, wszDescription) = DLL("msdrm.dll", "int DRMGetNameAndDescription(dword, dword, void*, void*, char*, void*, char*)")
# 呼び出し: DRMGetNameAndDescription(hIssuanceLicense, uIndex, pulcid, puNameLength, wszName, puDescriptionLength, wszDescription)
# hIssuanceLicense : DWORD -> "dword"
# uIndex : DWORD -> "dword"
# pulcid : DWORD* in/out -> "void*"
# puNameLength : DWORD* in/out -> "void*"
# wszName : LPWSTR optional, out -> "char*"
# puDescriptionLength : DWORD* in/out -> "void*"
# wszDescription : LPWSTR optional, out -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msdrm" fn DRMGetNameAndDescription(
hIssuanceLicense: u32, // DWORD
uIndex: u32, // DWORD
pulcid: [*c]u32, // DWORD* in/out
puNameLength: [*c]u32, // DWORD* in/out
wszName: [*c]u16, // LPWSTR optional, out
puDescriptionLength: [*c]u32, // DWORD* in/out
wszDescription: [*c]u16 // LPWSTR optional, out
) callconv(std.os.windows.WINAPI) i32;proc DRMGetNameAndDescription(
hIssuanceLicense: uint32, # DWORD
uIndex: uint32, # DWORD
pulcid: ptr uint32, # DWORD* in/out
puNameLength: ptr uint32, # DWORD* in/out
wszName: ptr uint16, # LPWSTR optional, out
puDescriptionLength: ptr uint32, # DWORD* in/out
wszDescription: ptr uint16 # LPWSTR optional, out
): int32 {.importc: "DRMGetNameAndDescription", stdcall, dynlib: "msdrm.dll".}pragma(lib, "msdrm");
extern(Windows)
int DRMGetNameAndDescription(
uint hIssuanceLicense, // DWORD
uint uIndex, // DWORD
uint* pulcid, // DWORD* in/out
uint* puNameLength, // DWORD* in/out
wchar* wszName, // LPWSTR optional, out
uint* puDescriptionLength, // DWORD* in/out
wchar* wszDescription // LPWSTR optional, out
);ccall((:DRMGetNameAndDescription, "msdrm.dll"), stdcall, Int32,
(UInt32, UInt32, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt16}, Ptr{UInt32}, Ptr{UInt16}),
hIssuanceLicense, uIndex, pulcid, puNameLength, wszName, puDescriptionLength, wszDescription)
# hIssuanceLicense : DWORD -> UInt32
# uIndex : DWORD -> UInt32
# pulcid : DWORD* in/out -> Ptr{UInt32}
# puNameLength : DWORD* in/out -> Ptr{UInt32}
# wszName : LPWSTR optional, out -> Ptr{UInt16}
# puDescriptionLength : DWORD* in/out -> Ptr{UInt32}
# wszDescription : LPWSTR optional, out -> Ptr{UInt16}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DRMGetNameAndDescription(
uint32_t hIssuanceLicense,
uint32_t uIndex,
uint32_t* pulcid,
uint32_t* puNameLength,
uint16_t* wszName,
uint32_t* puDescriptionLength,
uint16_t* wszDescription);
]]
local msdrm = ffi.load("msdrm")
-- msdrm.DRMGetNameAndDescription(hIssuanceLicense, uIndex, pulcid, puNameLength, wszName, puDescriptionLength, wszDescription)
-- hIssuanceLicense : DWORD
-- uIndex : DWORD
-- pulcid : DWORD* in/out
-- puNameLength : DWORD* in/out
-- wszName : LPWSTR optional, out
-- puDescriptionLength : DWORD* in/out
-- wszDescription : LPWSTR optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('msdrm.dll');
const DRMGetNameAndDescription = lib.func('__stdcall', 'DRMGetNameAndDescription', 'int32_t', ['uint32_t', 'uint32_t', 'uint32_t *', 'uint32_t *', 'uint16_t *', 'uint32_t *', 'uint16_t *']);
// DRMGetNameAndDescription(hIssuanceLicense, uIndex, pulcid, puNameLength, wszName, puDescriptionLength, wszDescription)
// hIssuanceLicense : DWORD -> 'uint32_t'
// uIndex : DWORD -> 'uint32_t'
// pulcid : DWORD* in/out -> 'uint32_t *'
// puNameLength : DWORD* in/out -> 'uint32_t *'
// wszName : LPWSTR optional, out -> 'uint16_t *'
// puDescriptionLength : DWORD* in/out -> 'uint32_t *'
// wszDescription : LPWSTR optional, out -> 'uint16_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("msdrm.dll", {
DRMGetNameAndDescription: { parameters: ["u32", "u32", "pointer", "pointer", "buffer", "pointer", "buffer"], result: "i32" },
});
// lib.symbols.DRMGetNameAndDescription(hIssuanceLicense, uIndex, pulcid, puNameLength, wszName, puDescriptionLength, wszDescription)
// hIssuanceLicense : DWORD -> "u32"
// uIndex : DWORD -> "u32"
// pulcid : DWORD* in/out -> "pointer"
// puNameLength : DWORD* in/out -> "pointer"
// wszName : LPWSTR optional, out -> "buffer"
// puDescriptionLength : DWORD* in/out -> "pointer"
// wszDescription : LPWSTR optional, out -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DRMGetNameAndDescription(
uint32_t hIssuanceLicense,
uint32_t uIndex,
uint32_t* pulcid,
uint32_t* puNameLength,
uint16_t* wszName,
uint32_t* puDescriptionLength,
uint16_t* wszDescription);
C, "msdrm.dll");
// $ffi->DRMGetNameAndDescription(hIssuanceLicense, uIndex, pulcid, puNameLength, wszName, puDescriptionLength, wszDescription);
// hIssuanceLicense : DWORD
// uIndex : DWORD
// pulcid : DWORD* in/out
// puNameLength : DWORD* in/out
// wszName : LPWSTR optional, out
// puDescriptionLength : DWORD* in/out
// wszDescription : LPWSTR optional, out
// 構造体/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 DRMGetNameAndDescription(
int hIssuanceLicense, // DWORD
int uIndex, // DWORD
IntByReference pulcid, // DWORD* in/out
IntByReference puNameLength, // DWORD* in/out
char[] wszName, // LPWSTR optional, out
IntByReference puDescriptionLength, // DWORD* in/out
char[] wszDescription // LPWSTR optional, out
);
}@[Link("msdrm")]
lib Libmsdrm
fun DRMGetNameAndDescription = DRMGetNameAndDescription(
hIssuanceLicense : UInt32, # DWORD
uIndex : UInt32, # DWORD
pulcid : UInt32*, # DWORD* in/out
puNameLength : UInt32*, # DWORD* in/out
wszName : UInt16*, # LPWSTR optional, out
puDescriptionLength : UInt32*, # DWORD* in/out
wszDescription : UInt16* # LPWSTR optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DRMGetNameAndDescriptionNative = Int32 Function(Uint32, Uint32, Pointer<Uint32>, Pointer<Uint32>, Pointer<Utf16>, Pointer<Uint32>, Pointer<Utf16>);
typedef DRMGetNameAndDescriptionDart = int Function(int, int, Pointer<Uint32>, Pointer<Uint32>, Pointer<Utf16>, Pointer<Uint32>, Pointer<Utf16>);
final DRMGetNameAndDescription = DynamicLibrary.open('msdrm.dll')
.lookupFunction<DRMGetNameAndDescriptionNative, DRMGetNameAndDescriptionDart>('DRMGetNameAndDescription');
// hIssuanceLicense : DWORD -> Uint32
// uIndex : DWORD -> Uint32
// pulcid : DWORD* in/out -> Pointer<Uint32>
// puNameLength : DWORD* in/out -> Pointer<Uint32>
// wszName : LPWSTR optional, out -> Pointer<Utf16>
// puDescriptionLength : DWORD* in/out -> Pointer<Uint32>
// wszDescription : LPWSTR optional, out -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DRMGetNameAndDescription(
hIssuanceLicense: DWORD; // DWORD
uIndex: DWORD; // DWORD
pulcid: Pointer; // DWORD* in/out
puNameLength: Pointer; // DWORD* in/out
wszName: PWideChar; // LPWSTR optional, out
puDescriptionLength: Pointer; // DWORD* in/out
wszDescription: PWideChar // LPWSTR optional, out
): Integer; stdcall;
external 'msdrm.dll' name 'DRMGetNameAndDescription';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DRMGetNameAndDescription"
c_DRMGetNameAndDescription :: Word32 -> Word32 -> Ptr Word32 -> Ptr Word32 -> CWString -> Ptr Word32 -> CWString -> IO Int32
-- hIssuanceLicense : DWORD -> Word32
-- uIndex : DWORD -> Word32
-- pulcid : DWORD* in/out -> Ptr Word32
-- puNameLength : DWORD* in/out -> Ptr Word32
-- wszName : LPWSTR optional, out -> CWString
-- puDescriptionLength : DWORD* in/out -> Ptr Word32
-- wszDescription : LPWSTR optional, out -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let drmgetnameanddescription =
foreign "DRMGetNameAndDescription"
(uint32_t @-> uint32_t @-> (ptr uint32_t) @-> (ptr uint32_t) @-> (ptr uint16_t) @-> (ptr uint32_t) @-> (ptr uint16_t) @-> returning int32_t)
(* hIssuanceLicense : DWORD -> uint32_t *)
(* uIndex : DWORD -> uint32_t *)
(* pulcid : DWORD* in/out -> (ptr uint32_t) *)
(* puNameLength : DWORD* in/out -> (ptr uint32_t) *)
(* wszName : LPWSTR optional, out -> (ptr uint16_t) *)
(* puDescriptionLength : DWORD* in/out -> (ptr uint32_t) *)
(* wszDescription : LPWSTR optional, out -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msdrm (t "msdrm.dll"))
(cffi:use-foreign-library msdrm)
(cffi:defcfun ("DRMGetNameAndDescription" drmget-name-and-description :convention :stdcall) :int32
(h-issuance-license :uint32) ; DWORD
(u-index :uint32) ; DWORD
(pulcid :pointer) ; DWORD* in/out
(pu-name-length :pointer) ; DWORD* in/out
(wsz-name :pointer) ; LPWSTR optional, out
(pu-description-length :pointer) ; DWORD* in/out
(wsz-description :pointer)) ; LPWSTR optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DRMGetNameAndDescription = Win32::API::More->new('msdrm',
'int DRMGetNameAndDescription(DWORD hIssuanceLicense, DWORD uIndex, LPVOID pulcid, LPVOID puNameLength, LPWSTR wszName, LPVOID puDescriptionLength, LPWSTR wszDescription)');
# my $ret = $DRMGetNameAndDescription->Call($hIssuanceLicense, $uIndex, $pulcid, $puNameLength, $wszName, $puDescriptionLength, $wszDescription);
# hIssuanceLicense : DWORD -> DWORD
# uIndex : DWORD -> DWORD
# pulcid : DWORD* in/out -> LPVOID
# puNameLength : DWORD* in/out -> LPVOID
# wszName : LPWSTR optional, out -> LPWSTR
# puDescriptionLength : DWORD* in/out -> LPVOID
# wszDescription : LPWSTR optional, out -> LPWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。