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