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