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

SLGetServiceInformation

関数
ライセンスサービスに関する情報の値を取得する。
DLLSLC.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT SLGetServiceInformation(
    void* hSLC,
    LPCWSTR pwszValueName,
    SLDATATYPE* peDataType,   // optional
    DWORD* pcbValue,
    BYTE** ppbValue
);

パラメーター

名前方向
hSLCvoid*in
pwszValueNameLPCWSTRin
peDataTypeSLDATATYPE*outoptional
pcbValueDWORD*out
ppbValueBYTE**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT SLGetServiceInformation(
    void* hSLC,
    LPCWSTR pwszValueName,
    SLDATATYPE* peDataType,   // optional
    DWORD* pcbValue,
    BYTE** ppbValue
);
[DllImport("SLC.dll", ExactSpelling = true)]
static extern int SLGetServiceInformation(
    IntPtr hSLC,   // void*
    [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 SLGetServiceInformation(
    hSLC As IntPtr,   ' void*
    <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*
' pwszValueName : LPCWSTR
' peDataType : SLDATATYPE* optional, out
' pcbValue : DWORD* out
' ppbValue : BYTE** out
Declare PtrSafe Function SLGetServiceInformation Lib "slc" ( _
    ByVal hSLC 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

SLGetServiceInformation = ctypes.windll.slc.SLGetServiceInformation
SLGetServiceInformation.restype = ctypes.c_int
SLGetServiceInformation.argtypes = [
    ctypes.POINTER(None),  # hSLC : void*
    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')
SLGetServiceInformation = Fiddle::Function.new(
  lib['SLGetServiceInformation'],
  [
    Fiddle::TYPE_VOIDP,  # hSLC : void*
    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 SLGetServiceInformation(
        hSLC: *mut (),  // void*
        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 SLGetServiceInformation(IntPtr hSLC, [MarshalAs(UnmanagedType.LPWStr)] string pwszValueName, IntPtr peDataType, out uint pcbValue, IntPtr ppbValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SLC_SLGetServiceInformation' -Namespace Win32 -PassThru
# $api::SLGetServiceInformation(hSLC, pwszValueName, peDataType, pcbValue, ppbValue)
#uselib "SLC.dll"
#func global SLGetServiceInformation "SLGetServiceInformation" sptr, sptr, sptr, sptr, sptr
; SLGetServiceInformation hSLC, pwszValueName, peDataType, varptr(pcbValue), varptr(ppbValue)   ; 戻り値は stat
; hSLC : void* -> "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 SLGetServiceInformation "SLGetServiceInformation" sptr, wstr, int, var, var
; res = SLGetServiceInformation(hSLC, pwszValueName, peDataType, pcbValue, ppbValue)
; hSLC : void* -> "sptr"
; pwszValueName : LPCWSTR -> "wstr"
; peDataType : SLDATATYPE* optional, out -> "int"
; pcbValue : DWORD* out -> "var"
; ppbValue : BYTE** out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT SLGetServiceInformation(void* hSLC, LPCWSTR pwszValueName, SLDATATYPE* peDataType, DWORD* pcbValue, BYTE** ppbValue)
#uselib "SLC.dll"
#cfunc global SLGetServiceInformation "SLGetServiceInformation" intptr, wstr, int, var, var
; res = SLGetServiceInformation(hSLC, pwszValueName, peDataType, pcbValue, ppbValue)
; hSLC : void* -> "intptr"
; pwszValueName : LPCWSTR -> "wstr"
; peDataType : SLDATATYPE* optional, out -> "int"
; pcbValue : DWORD* out -> "var"
; ppbValue : BYTE** out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	slc = windows.NewLazySystemDLL("SLC.dll")
	procSLGetServiceInformation = slc.NewProc("SLGetServiceInformation")
)

// hSLC (void*), pwszValueName (LPCWSTR), peDataType (SLDATATYPE* optional, out), pcbValue (DWORD* out), ppbValue (BYTE** out)
r1, _, err := procSLGetServiceInformation.Call(
	uintptr(hSLC),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszValueName))),
	uintptr(peDataType),
	uintptr(pcbValue),
	uintptr(ppbValue),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function SLGetServiceInformation(
  hSLC: Pointer;   // void*
  pwszValueName: PWideChar;   // LPCWSTR
  peDataType: Pointer;   // SLDATATYPE* optional, out
  pcbValue: Pointer;   // DWORD* out
  ppbValue: Pointer   // BYTE** out
): Integer; stdcall;
  external 'SLC.dll' name 'SLGetServiceInformation';
result := DllCall("SLC\SLGetServiceInformation"
    , "Ptr", hSLC   ; void*
    , "WStr", pwszValueName   ; LPCWSTR
    , "Ptr", peDataType   ; SLDATATYPE* optional, out
    , "Ptr", pcbValue   ; DWORD* out
    , "Ptr", ppbValue   ; BYTE** out
    , "Int")   ; return: HRESULT
●SLGetServiceInformation(hSLC, pwszValueName, peDataType, pcbValue, ppbValue) = DLL("SLC.dll", "int SLGetServiceInformation(void*, char*, void*, void*, void*)")
# 呼び出し: SLGetServiceInformation(hSLC, pwszValueName, peDataType, pcbValue, ppbValue)
# hSLC : void* -> "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)。