Win32 API 日本語リファレンス
ホームSecurity.Authentication.Identity › SLGetLicensingStatusInformation

SLGetLicensingStatusInformation

関数
アプリや製品SKUのライセンス供与状態情報を取得する。
DLLSLC.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// SLC.dll
#include <windows.h>

HRESULT SLGetLicensingStatusInformation(
    void* hSLC,
    const GUID* pAppID,   // optional
    const GUID* pProductSkuId,   // optional
    LPCWSTR pwszRightName,   // optional
    DWORD* pnStatusCount,
    SL_LICENSING_STATUS** ppLicensingStatus
);

パラメーター

名前方向
hSLCvoid*in
pAppIDGUID*inoptional
pProductSkuIdGUID*inoptional
pwszRightNameLPCWSTRinoptional
pnStatusCountDWORD*out
ppLicensingStatusSL_LICENSING_STATUS**out

戻り値の型: HRESULT

各言語での呼び出し定義

// SLC.dll
#include <windows.h>

HRESULT SLGetLicensingStatusInformation(
    void* hSLC,
    const GUID* pAppID,   // optional
    const GUID* pProductSkuId,   // optional
    LPCWSTR pwszRightName,   // optional
    DWORD* pnStatusCount,
    SL_LICENSING_STATUS** ppLicensingStatus
);
[DllImport("SLC.dll", ExactSpelling = true)]
static extern int SLGetLicensingStatusInformation(
    IntPtr hSLC,   // void*
    IntPtr pAppID,   // GUID* optional
    IntPtr pProductSkuId,   // GUID* optional
    [MarshalAs(UnmanagedType.LPWStr)] string pwszRightName,   // LPCWSTR optional
    out uint pnStatusCount,   // DWORD* out
    IntPtr ppLicensingStatus   // SL_LICENSING_STATUS** out
);
<DllImport("SLC.dll", ExactSpelling:=True)>
Public Shared Function SLGetLicensingStatusInformation(
    hSLC As IntPtr,   ' void*
    pAppID As IntPtr,   ' GUID* optional
    pProductSkuId As IntPtr,   ' GUID* optional
    <MarshalAs(UnmanagedType.LPWStr)> pwszRightName As String,   ' LPCWSTR optional
    <Out> ByRef pnStatusCount As UInteger,   ' DWORD* out
    ppLicensingStatus As IntPtr   ' SL_LICENSING_STATUS** out
) As Integer
End Function
' hSLC : void*
' pAppID : GUID* optional
' pProductSkuId : GUID* optional
' pwszRightName : LPCWSTR optional
' pnStatusCount : DWORD* out
' ppLicensingStatus : SL_LICENSING_STATUS** out
Declare PtrSafe Function SLGetLicensingStatusInformation Lib "slc" ( _
    ByVal hSLC As LongPtr, _
    ByVal pAppID As LongPtr, _
    ByVal pProductSkuId As LongPtr, _
    ByVal pwszRightName As LongPtr, _
    ByRef pnStatusCount As Long, _
    ByVal ppLicensingStatus As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SLGetLicensingStatusInformation = ctypes.windll.slc.SLGetLicensingStatusInformation
SLGetLicensingStatusInformation.restype = ctypes.c_int
SLGetLicensingStatusInformation.argtypes = [
    ctypes.POINTER(None),  # hSLC : void*
    ctypes.c_void_p,  # pAppID : GUID* optional
    ctypes.c_void_p,  # pProductSkuId : GUID* optional
    wintypes.LPCWSTR,  # pwszRightName : LPCWSTR optional
    ctypes.POINTER(wintypes.DWORD),  # pnStatusCount : DWORD* out
    ctypes.c_void_p,  # ppLicensingStatus : SL_LICENSING_STATUS** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SLC.dll')
SLGetLicensingStatusInformation = Fiddle::Function.new(
  lib['SLGetLicensingStatusInformation'],
  [
    Fiddle::TYPE_VOIDP,  # hSLC : void*
    Fiddle::TYPE_VOIDP,  # pAppID : GUID* optional
    Fiddle::TYPE_VOIDP,  # pProductSkuId : GUID* optional
    Fiddle::TYPE_VOIDP,  # pwszRightName : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # pnStatusCount : DWORD* out
    Fiddle::TYPE_VOIDP,  # ppLicensingStatus : SL_LICENSING_STATUS** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "slc")]
extern "system" {
    fn SLGetLicensingStatusInformation(
        hSLC: *mut (),  // void*
        pAppID: *const GUID,  // GUID* optional
        pProductSkuId: *const GUID,  // GUID* optional
        pwszRightName: *const u16,  // LPCWSTR optional
        pnStatusCount: *mut u32,  // DWORD* out
        ppLicensingStatus: *mut *mut SL_LICENSING_STATUS  // SL_LICENSING_STATUS** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SLC.dll")]
public static extern int SLGetLicensingStatusInformation(IntPtr hSLC, IntPtr pAppID, IntPtr pProductSkuId, [MarshalAs(UnmanagedType.LPWStr)] string pwszRightName, out uint pnStatusCount, IntPtr ppLicensingStatus);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SLC_SLGetLicensingStatusInformation' -Namespace Win32 -PassThru
# $api::SLGetLicensingStatusInformation(hSLC, pAppID, pProductSkuId, pwszRightName, pnStatusCount, ppLicensingStatus)
#uselib "SLC.dll"
#func global SLGetLicensingStatusInformation "SLGetLicensingStatusInformation" sptr, sptr, sptr, sptr, sptr, sptr
; SLGetLicensingStatusInformation hSLC, varptr(pAppID), varptr(pProductSkuId), pwszRightName, varptr(pnStatusCount), varptr(ppLicensingStatus)   ; 戻り値は stat
; hSLC : void* -> "sptr"
; pAppID : GUID* optional -> "sptr"
; pProductSkuId : GUID* optional -> "sptr"
; pwszRightName : LPCWSTR optional -> "sptr"
; pnStatusCount : DWORD* out -> "sptr"
; ppLicensingStatus : SL_LICENSING_STATUS** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SLC.dll"
#cfunc global SLGetLicensingStatusInformation "SLGetLicensingStatusInformation" sptr, var, var, wstr, var, var
; res = SLGetLicensingStatusInformation(hSLC, pAppID, pProductSkuId, pwszRightName, pnStatusCount, ppLicensingStatus)
; hSLC : void* -> "sptr"
; pAppID : GUID* optional -> "var"
; pProductSkuId : GUID* optional -> "var"
; pwszRightName : LPCWSTR optional -> "wstr"
; pnStatusCount : DWORD* out -> "var"
; ppLicensingStatus : SL_LICENSING_STATUS** out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT SLGetLicensingStatusInformation(void* hSLC, GUID* pAppID, GUID* pProductSkuId, LPCWSTR pwszRightName, DWORD* pnStatusCount, SL_LICENSING_STATUS** ppLicensingStatus)
#uselib "SLC.dll"
#cfunc global SLGetLicensingStatusInformation "SLGetLicensingStatusInformation" intptr, var, var, wstr, var, var
; res = SLGetLicensingStatusInformation(hSLC, pAppID, pProductSkuId, pwszRightName, pnStatusCount, ppLicensingStatus)
; hSLC : void* -> "intptr"
; pAppID : GUID* optional -> "var"
; pProductSkuId : GUID* optional -> "var"
; pwszRightName : LPCWSTR optional -> "wstr"
; pnStatusCount : DWORD* out -> "var"
; ppLicensingStatus : SL_LICENSING_STATUS** out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	slc = windows.NewLazySystemDLL("SLC.dll")
	procSLGetLicensingStatusInformation = slc.NewProc("SLGetLicensingStatusInformation")
)

// hSLC (void*), pAppID (GUID* optional), pProductSkuId (GUID* optional), pwszRightName (LPCWSTR optional), pnStatusCount (DWORD* out), ppLicensingStatus (SL_LICENSING_STATUS** out)
r1, _, err := procSLGetLicensingStatusInformation.Call(
	uintptr(hSLC),
	uintptr(pAppID),
	uintptr(pProductSkuId),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszRightName))),
	uintptr(pnStatusCount),
	uintptr(ppLicensingStatus),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function SLGetLicensingStatusInformation(
  hSLC: Pointer;   // void*
  pAppID: PGUID;   // GUID* optional
  pProductSkuId: PGUID;   // GUID* optional
  pwszRightName: PWideChar;   // LPCWSTR optional
  pnStatusCount: Pointer;   // DWORD* out
  ppLicensingStatus: Pointer   // SL_LICENSING_STATUS** out
): Integer; stdcall;
  external 'SLC.dll' name 'SLGetLicensingStatusInformation';
result := DllCall("SLC\SLGetLicensingStatusInformation"
    , "Ptr", hSLC   ; void*
    , "Ptr", pAppID   ; GUID* optional
    , "Ptr", pProductSkuId   ; GUID* optional
    , "WStr", pwszRightName   ; LPCWSTR optional
    , "Ptr", pnStatusCount   ; DWORD* out
    , "Ptr", ppLicensingStatus   ; SL_LICENSING_STATUS** out
    , "Int")   ; return: HRESULT
●SLGetLicensingStatusInformation(hSLC, pAppID, pProductSkuId, pwszRightName, pnStatusCount, ppLicensingStatus) = DLL("SLC.dll", "int SLGetLicensingStatusInformation(void*, void*, void*, char*, void*, void*)")
# 呼び出し: SLGetLicensingStatusInformation(hSLC, pAppID, pProductSkuId, pwszRightName, pnStatusCount, ppLicensingStatus)
# hSLC : void* -> "void*"
# pAppID : GUID* optional -> "void*"
# pProductSkuId : GUID* optional -> "void*"
# pwszRightName : LPCWSTR optional -> "char*"
# pnStatusCount : DWORD* out -> "void*"
# ppLicensingStatus : SL_LICENSING_STATUS** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。