ホーム › Security.Authentication.Identity › SLGetLicenseInformation
SLGetLicenseInformation
関数指定ライセンスに関する情報の値を取得する。
シグネチャ
// SLC.dll
#include <windows.h>
HRESULT SLGetLicenseInformation(
void* hSLC,
const GUID* pSLLicenseId,
LPCWSTR pwszValueName,
SLDATATYPE* peDataType, // optional
DWORD* pcbValue,
BYTE** ppbValue
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hSLC | void* | in |
| pSLLicenseId | GUID* | in |
| pwszValueName | LPCWSTR | in |
| peDataType | SLDATATYPE* | outoptional |
| pcbValue | DWORD* | out |
| ppbValue | BYTE** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// SLC.dll
#include <windows.h>
HRESULT SLGetLicenseInformation(
void* hSLC,
const GUID* pSLLicenseId,
LPCWSTR pwszValueName,
SLDATATYPE* peDataType, // optional
DWORD* pcbValue,
BYTE** ppbValue
);[DllImport("SLC.dll", ExactSpelling = true)]
static extern int SLGetLicenseInformation(
IntPtr hSLC, // void*
ref Guid pSLLicenseId, // GUID*
[MarshalAs(UnmanagedType.LPWStr)] string pwszValueName, // LPCWSTR
IntPtr peDataType, // SLDATATYPE* optional, out
out uint pcbValue, // DWORD* out
IntPtr ppbValue // BYTE** out
);<DllImport("SLC.dll", ExactSpelling:=True)>
Public Shared Function SLGetLicenseInformation(
hSLC As IntPtr, ' void*
ByRef pSLLicenseId As Guid, ' GUID*
<MarshalAs(UnmanagedType.LPWStr)> pwszValueName As String, ' LPCWSTR
peDataType As IntPtr, ' SLDATATYPE* optional, out
<Out> ByRef pcbValue As UInteger, ' DWORD* out
ppbValue As IntPtr ' BYTE** out
) As Integer
End Function' hSLC : void*
' pSLLicenseId : GUID*
' pwszValueName : LPCWSTR
' peDataType : SLDATATYPE* optional, out
' pcbValue : DWORD* out
' ppbValue : BYTE** out
Declare PtrSafe Function SLGetLicenseInformation Lib "slc" ( _
ByVal hSLC As LongPtr, _
ByVal pSLLicenseId As LongPtr, _
ByVal pwszValueName As LongPtr, _
ByVal peDataType As LongPtr, _
ByRef pcbValue As Long, _
ByVal ppbValue As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SLGetLicenseInformation = ctypes.windll.slc.SLGetLicenseInformation
SLGetLicenseInformation.restype = ctypes.c_int
SLGetLicenseInformation.argtypes = [
ctypes.POINTER(None), # hSLC : void*
ctypes.c_void_p, # pSLLicenseId : GUID*
wintypes.LPCWSTR, # pwszValueName : LPCWSTR
ctypes.c_void_p, # peDataType : SLDATATYPE* optional, out
ctypes.POINTER(wintypes.DWORD), # pcbValue : DWORD* out
ctypes.c_void_p, # ppbValue : BYTE** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SLC.dll')
SLGetLicenseInformation = Fiddle::Function.new(
lib['SLGetLicenseInformation'],
[
Fiddle::TYPE_VOIDP, # hSLC : void*
Fiddle::TYPE_VOIDP, # pSLLicenseId : GUID*
Fiddle::TYPE_VOIDP, # pwszValueName : LPCWSTR
Fiddle::TYPE_VOIDP, # peDataType : SLDATATYPE* optional, out
Fiddle::TYPE_VOIDP, # pcbValue : DWORD* out
Fiddle::TYPE_VOIDP, # ppbValue : BYTE** out
],
Fiddle::TYPE_INT)#[link(name = "slc")]
extern "system" {
fn SLGetLicenseInformation(
hSLC: *mut (), // void*
pSLLicenseId: *const GUID, // GUID*
pwszValueName: *const u16, // LPCWSTR
peDataType: *mut u32, // SLDATATYPE* optional, out
pcbValue: *mut u32, // DWORD* out
ppbValue: *mut *mut u8 // BYTE** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SLC.dll")]
public static extern int SLGetLicenseInformation(IntPtr hSLC, ref Guid pSLLicenseId, [MarshalAs(UnmanagedType.LPWStr)] string pwszValueName, IntPtr peDataType, out uint pcbValue, IntPtr ppbValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SLC_SLGetLicenseInformation' -Namespace Win32 -PassThru
# $api::SLGetLicenseInformation(hSLC, pSLLicenseId, pwszValueName, peDataType, pcbValue, ppbValue)#uselib "SLC.dll"
#func global SLGetLicenseInformation "SLGetLicenseInformation" sptr, sptr, sptr, sptr, sptr, sptr
; SLGetLicenseInformation hSLC, varptr(pSLLicenseId), pwszValueName, peDataType, varptr(pcbValue), varptr(ppbValue) ; 戻り値は stat
; hSLC : void* -> "sptr"
; pSLLicenseId : GUID* -> "sptr"
; pwszValueName : LPCWSTR -> "sptr"
; peDataType : SLDATATYPE* optional, out -> "sptr"
; pcbValue : DWORD* out -> "sptr"
; ppbValue : BYTE** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SLC.dll" #cfunc global SLGetLicenseInformation "SLGetLicenseInformation" sptr, var, wstr, int, var, var ; res = SLGetLicenseInformation(hSLC, pSLLicenseId, pwszValueName, peDataType, pcbValue, ppbValue) ; hSLC : void* -> "sptr" ; pSLLicenseId : GUID* -> "var" ; pwszValueName : LPCWSTR -> "wstr" ; peDataType : SLDATATYPE* optional, out -> "int" ; pcbValue : DWORD* out -> "var" ; ppbValue : BYTE** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SLC.dll" #cfunc global SLGetLicenseInformation "SLGetLicenseInformation" sptr, sptr, wstr, int, sptr, sptr ; res = SLGetLicenseInformation(hSLC, varptr(pSLLicenseId), pwszValueName, peDataType, varptr(pcbValue), varptr(ppbValue)) ; hSLC : void* -> "sptr" ; pSLLicenseId : GUID* -> "sptr" ; pwszValueName : LPCWSTR -> "wstr" ; peDataType : SLDATATYPE* optional, out -> "int" ; pcbValue : DWORD* out -> "sptr" ; ppbValue : BYTE** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT SLGetLicenseInformation(void* hSLC, GUID* pSLLicenseId, LPCWSTR pwszValueName, SLDATATYPE* peDataType, DWORD* pcbValue, BYTE** ppbValue) #uselib "SLC.dll" #cfunc global SLGetLicenseInformation "SLGetLicenseInformation" intptr, var, wstr, int, var, var ; res = SLGetLicenseInformation(hSLC, pSLLicenseId, pwszValueName, peDataType, pcbValue, ppbValue) ; hSLC : void* -> "intptr" ; pSLLicenseId : GUID* -> "var" ; pwszValueName : LPCWSTR -> "wstr" ; peDataType : SLDATATYPE* optional, out -> "int" ; pcbValue : DWORD* out -> "var" ; ppbValue : BYTE** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT SLGetLicenseInformation(void* hSLC, GUID* pSLLicenseId, LPCWSTR pwszValueName, SLDATATYPE* peDataType, DWORD* pcbValue, BYTE** ppbValue) #uselib "SLC.dll" #cfunc global SLGetLicenseInformation "SLGetLicenseInformation" intptr, intptr, wstr, int, intptr, intptr ; res = SLGetLicenseInformation(hSLC, varptr(pSLLicenseId), pwszValueName, peDataType, varptr(pcbValue), varptr(ppbValue)) ; hSLC : void* -> "intptr" ; pSLLicenseId : GUID* -> "intptr" ; pwszValueName : LPCWSTR -> "wstr" ; peDataType : SLDATATYPE* optional, out -> "int" ; pcbValue : DWORD* out -> "intptr" ; ppbValue : BYTE** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
slc = windows.NewLazySystemDLL("SLC.dll")
procSLGetLicenseInformation = slc.NewProc("SLGetLicenseInformation")
)
// hSLC (void*), pSLLicenseId (GUID*), pwszValueName (LPCWSTR), peDataType (SLDATATYPE* optional, out), pcbValue (DWORD* out), ppbValue (BYTE** out)
r1, _, err := procSLGetLicenseInformation.Call(
uintptr(hSLC),
uintptr(pSLLicenseId),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszValueName))),
uintptr(peDataType),
uintptr(pcbValue),
uintptr(ppbValue),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SLGetLicenseInformation(
hSLC: Pointer; // void*
pSLLicenseId: PGUID; // GUID*
pwszValueName: PWideChar; // LPCWSTR
peDataType: Pointer; // SLDATATYPE* optional, out
pcbValue: Pointer; // DWORD* out
ppbValue: Pointer // BYTE** out
): Integer; stdcall;
external 'SLC.dll' name 'SLGetLicenseInformation';result := DllCall("SLC\SLGetLicenseInformation"
, "Ptr", hSLC ; void*
, "Ptr", pSLLicenseId ; GUID*
, "WStr", pwszValueName ; LPCWSTR
, "Ptr", peDataType ; SLDATATYPE* optional, out
, "Ptr", pcbValue ; DWORD* out
, "Ptr", ppbValue ; BYTE** out
, "Int") ; return: HRESULT●SLGetLicenseInformation(hSLC, pSLLicenseId, pwszValueName, peDataType, pcbValue, ppbValue) = DLL("SLC.dll", "int SLGetLicenseInformation(void*, void*, char*, void*, void*, void*)")
# 呼び出し: SLGetLicenseInformation(hSLC, pSLLicenseId, pwszValueName, peDataType, pcbValue, ppbValue)
# hSLC : void* -> "void*"
# pSLLicenseId : GUID* -> "void*"
# pwszValueName : LPCWSTR -> "char*"
# peDataType : SLDATATYPE* optional, out -> "void*"
# pcbValue : DWORD* out -> "void*"
# ppbValue : BYTE** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。