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*inSLOpenで取得したSLCハンドル。
pAppIDGUID*inoptional対象アプリケーションを識別するGUIDへのポインタ。
pProductSkuIdGUID*inoptional対象製品SKUを識別するGUIDへのポインタ。NULLで全SKU対象。
pwszRightNameLPCWSTRinoptional対象とする権利の名前を指すUnicode文字列。NULL可。
pnStatusCountDWORD*outppLicensingStatus配列の要素数を受け取るDWORDへのポインタ。
ppLicensingStatusSL_LICENSING_STATUS**outライセンス状態の配列SL_LICENSING_STATUSを受け取るポインタ。解放が必要。

戻り値の型: 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)。
const std = @import("std");

extern "slc" fn SLGetLicensingStatusInformation(
    hSLC: ?*anyopaque, // void*
    pAppID: [*c]GUID, // GUID* optional
    pProductSkuId: [*c]GUID, // GUID* optional
    pwszRightName: [*c]const u16, // LPCWSTR optional
    pnStatusCount: [*c]u32, // DWORD* out
    ppLicensingStatus: [*c][*c]SL_LICENSING_STATUS // SL_LICENSING_STATUS** out
) callconv(std.os.windows.WINAPI) i32;
proc SLGetLicensingStatusInformation(
    hSLC: pointer,  # void*
    pAppID: ptr GUID,  # GUID* optional
    pProductSkuId: ptr GUID,  # GUID* optional
    pwszRightName: WideCString,  # LPCWSTR optional
    pnStatusCount: ptr uint32,  # DWORD* out
    ppLicensingStatus: ptr SL_LICENSING_STATUS  # SL_LICENSING_STATUS** out
): int32 {.importc: "SLGetLicensingStatusInformation", stdcall, dynlib: "SLC.dll".}
pragma(lib, "slc");
extern(Windows)
int SLGetLicensingStatusInformation(
    void* hSLC,   // void*
    GUID* pAppID,   // GUID* optional
    GUID* pProductSkuId,   // GUID* optional
    const(wchar)* pwszRightName,   // LPCWSTR optional
    uint* pnStatusCount,   // DWORD* out
    SL_LICENSING_STATUS** ppLicensingStatus   // SL_LICENSING_STATUS** out
);
ccall((:SLGetLicensingStatusInformation, "SLC.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{GUID}, Ptr{GUID}, Cwstring, Ptr{UInt32}, Ptr{SL_LICENSING_STATUS}),
      hSLC, pAppID, pProductSkuId, pwszRightName, pnStatusCount, ppLicensingStatus)
# hSLC : void* -> Ptr{Cvoid}
# pAppID : GUID* optional -> Ptr{GUID}
# pProductSkuId : GUID* optional -> Ptr{GUID}
# pwszRightName : LPCWSTR optional -> Cwstring
# pnStatusCount : DWORD* out -> Ptr{UInt32}
# ppLicensingStatus : SL_LICENSING_STATUS** out -> Ptr{SL_LICENSING_STATUS}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t SLGetLicensingStatusInformation(
    void* hSLC,
    void* pAppID,
    void* pProductSkuId,
    const uint16_t* pwszRightName,
    uint32_t* pnStatusCount,
    void* ppLicensingStatus);
]]
local slc = ffi.load("slc")
-- slc.SLGetLicensingStatusInformation(hSLC, pAppID, pProductSkuId, pwszRightName, pnStatusCount, ppLicensingStatus)
-- hSLC : void*
-- pAppID : GUID* optional
-- pProductSkuId : GUID* optional
-- pwszRightName : LPCWSTR optional
-- pnStatusCount : DWORD* out
-- ppLicensingStatus : SL_LICENSING_STATUS** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('SLC.dll');
const SLGetLicensingStatusInformation = lib.func('__stdcall', 'SLGetLicensingStatusInformation', 'int32_t', ['void *', 'void *', 'void *', 'str16', 'uint32_t *', 'void *']);
// SLGetLicensingStatusInformation(hSLC, pAppID, pProductSkuId, pwszRightName, pnStatusCount, ppLicensingStatus)
// hSLC : void* -> 'void *'
// pAppID : GUID* optional -> 'void *'
// pProductSkuId : GUID* optional -> 'void *'
// pwszRightName : LPCWSTR optional -> 'str16'
// pnStatusCount : DWORD* out -> 'uint32_t *'
// ppLicensingStatus : SL_LICENSING_STATUS** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("SLC.dll", {
  SLGetLicensingStatusInformation: { parameters: ["pointer", "pointer", "pointer", "buffer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.SLGetLicensingStatusInformation(hSLC, pAppID, pProductSkuId, pwszRightName, pnStatusCount, ppLicensingStatus)
// hSLC : void* -> "pointer"
// pAppID : GUID* optional -> "pointer"
// pProductSkuId : GUID* optional -> "pointer"
// pwszRightName : LPCWSTR optional -> "buffer"
// pnStatusCount : DWORD* out -> "pointer"
// ppLicensingStatus : SL_LICENSING_STATUS** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t SLGetLicensingStatusInformation(
    void* hSLC,
    void* pAppID,
    void* pProductSkuId,
    const uint16_t* pwszRightName,
    uint32_t* pnStatusCount,
    void* ppLicensingStatus);
C, "SLC.dll");
// $ffi->SLGetLicensingStatusInformation(hSLC, pAppID, pProductSkuId, pwszRightName, pnStatusCount, ppLicensingStatus);
// hSLC : void*
// pAppID : GUID* optional
// pProductSkuId : GUID* optional
// pwszRightName : LPCWSTR optional
// pnStatusCount : DWORD* out
// ppLicensingStatus : SL_LICENSING_STATUS** 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 Slc extends StdCallLibrary {
    Slc INSTANCE = Native.load("slc", Slc.class);
    int SLGetLicensingStatusInformation(
        Pointer hSLC,   // void*
        Pointer pAppID,   // GUID* optional
        Pointer pProductSkuId,   // GUID* optional
        WString pwszRightName,   // LPCWSTR optional
        IntByReference pnStatusCount,   // DWORD* out
        Pointer ppLicensingStatus   // SL_LICENSING_STATUS** out
    );
}
@[Link("slc")]
lib LibSLC
  fun SLGetLicensingStatusInformation = SLGetLicensingStatusInformation(
    hSLC : Void*,   # void*
    pAppID : GUID*,   # GUID* optional
    pProductSkuId : GUID*,   # GUID* optional
    pwszRightName : UInt16*,   # LPCWSTR optional
    pnStatusCount : UInt32*,   # DWORD* out
    ppLicensingStatus : SL_LICENSING_STATUS**   # SL_LICENSING_STATUS** out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef SLGetLicensingStatusInformationNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Utf16>, Pointer<Uint32>, Pointer<Void>);
typedef SLGetLicensingStatusInformationDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Utf16>, Pointer<Uint32>, Pointer<Void>);
final SLGetLicensingStatusInformation = DynamicLibrary.open('SLC.dll')
    .lookupFunction<SLGetLicensingStatusInformationNative, SLGetLicensingStatusInformationDart>('SLGetLicensingStatusInformation');
// hSLC : void* -> Pointer<Void>
// pAppID : GUID* optional -> Pointer<Void>
// pProductSkuId : GUID* optional -> Pointer<Void>
// pwszRightName : LPCWSTR optional -> Pointer<Utf16>
// pnStatusCount : DWORD* out -> Pointer<Uint32>
// ppLicensingStatus : SL_LICENSING_STATUS** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
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';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "SLGetLicensingStatusInformation"
  c_SLGetLicensingStatusInformation :: Ptr () -> Ptr () -> Ptr () -> CWString -> Ptr Word32 -> Ptr () -> IO Int32
-- hSLC : void* -> Ptr ()
-- pAppID : GUID* optional -> Ptr ()
-- pProductSkuId : GUID* optional -> Ptr ()
-- pwszRightName : LPCWSTR optional -> CWString
-- pnStatusCount : DWORD* out -> Ptr Word32
-- ppLicensingStatus : SL_LICENSING_STATUS** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let slgetlicensingstatusinformation =
  foreign "SLGetLicensingStatusInformation"
    ((ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr uint16_t) @-> (ptr uint32_t) @-> (ptr void) @-> returning int32_t)
(* hSLC : void* -> (ptr void) *)
(* pAppID : GUID* optional -> (ptr void) *)
(* pProductSkuId : GUID* optional -> (ptr void) *)
(* pwszRightName : LPCWSTR optional -> (ptr uint16_t) *)
(* pnStatusCount : DWORD* out -> (ptr uint32_t) *)
(* ppLicensingStatus : SL_LICENSING_STATUS** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library slc (t "SLC.dll"))
(cffi:use-foreign-library slc)

(cffi:defcfun ("SLGetLicensingStatusInformation" slget-licensing-status-information :convention :stdcall) :int32
  (h-slc :pointer)   ; void*
  (p-app-id :pointer)   ; GUID* optional
  (p-product-sku-id :pointer)   ; GUID* optional
  (pwsz-right-name (:string :encoding :utf-16le))   ; LPCWSTR optional
  (pn-status-count :pointer)   ; DWORD* out
  (pp-licensing-status :pointer))   ; SL_LICENSING_STATUS** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $SLGetLicensingStatusInformation = Win32::API::More->new('SLC',
    'int SLGetLicensingStatusInformation(LPVOID hSLC, LPVOID pAppID, LPVOID pProductSkuId, LPCWSTR pwszRightName, LPVOID pnStatusCount, LPVOID ppLicensingStatus)');
# my $ret = $SLGetLicensingStatusInformation->Call($hSLC, $pAppID, $pProductSkuId, $pwszRightName, $pnStatusCount, $ppLicensingStatus);
# hSLC : void* -> LPVOID
# pAppID : GUID* optional -> LPVOID
# pProductSkuId : GUID* optional -> LPVOID
# pwszRightName : LPCWSTR optional -> LPCWSTR
# pnStatusCount : DWORD* out -> LPVOID
# ppLicensingStatus : SL_LICENSING_STATUS** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型