ホーム › Networking.Clustering › ResUtilGetQwordValue
ResUtilGetQwordValue
関数クラスタキーからQWORD値を既定値付きで取得する。
シグネチャ
// RESUTILS.dll
#include <windows.h>
DWORD ResUtilGetQwordValue(
HKEY hkeyClusterKey,
LPCWSTR pszValueName,
ULONGLONG* pqwOutValue,
ULONGLONG qwDefaultValue
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hkeyClusterKey | HKEY | in |
| pszValueName | LPCWSTR | in |
| pqwOutValue | ULONGLONG* | out |
| qwDefaultValue | ULONGLONG | in |
戻り値の型: DWORD
各言語での呼び出し定義
// RESUTILS.dll
#include <windows.h>
DWORD ResUtilGetQwordValue(
HKEY hkeyClusterKey,
LPCWSTR pszValueName,
ULONGLONG* pqwOutValue,
ULONGLONG qwDefaultValue
);[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ResUtilGetQwordValue(
IntPtr hkeyClusterKey, // HKEY
[MarshalAs(UnmanagedType.LPWStr)] string pszValueName, // LPCWSTR
out ulong pqwOutValue, // ULONGLONG* out
ulong qwDefaultValue // ULONGLONG
);<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilGetQwordValue(
hkeyClusterKey As IntPtr, ' HKEY
<MarshalAs(UnmanagedType.LPWStr)> pszValueName As String, ' LPCWSTR
<Out> ByRef pqwOutValue As ULong, ' ULONGLONG* out
qwDefaultValue As ULong ' ULONGLONG
) As UInteger
End Function' hkeyClusterKey : HKEY
' pszValueName : LPCWSTR
' pqwOutValue : ULONGLONG* out
' qwDefaultValue : ULONGLONG
Declare PtrSafe Function ResUtilGetQwordValue Lib "resutils" ( _
ByVal hkeyClusterKey As LongPtr, _
ByVal pszValueName As LongPtr, _
ByRef pqwOutValue As LongLong, _
ByVal qwDefaultValue As LongLong) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ResUtilGetQwordValue = ctypes.windll.resutils.ResUtilGetQwordValue
ResUtilGetQwordValue.restype = wintypes.DWORD
ResUtilGetQwordValue.argtypes = [
wintypes.HANDLE, # hkeyClusterKey : HKEY
wintypes.LPCWSTR, # pszValueName : LPCWSTR
ctypes.POINTER(ctypes.c_ulonglong), # pqwOutValue : ULONGLONG* out
ctypes.c_ulonglong, # qwDefaultValue : ULONGLONG
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RESUTILS.dll')
ResUtilGetQwordValue = Fiddle::Function.new(
lib['ResUtilGetQwordValue'],
[
Fiddle::TYPE_VOIDP, # hkeyClusterKey : HKEY
Fiddle::TYPE_VOIDP, # pszValueName : LPCWSTR
Fiddle::TYPE_VOIDP, # pqwOutValue : ULONGLONG* out
-Fiddle::TYPE_LONG_LONG, # qwDefaultValue : ULONGLONG
],
-Fiddle::TYPE_INT)#[link(name = "resutils")]
extern "system" {
fn ResUtilGetQwordValue(
hkeyClusterKey: *mut core::ffi::c_void, // HKEY
pszValueName: *const u16, // LPCWSTR
pqwOutValue: *mut u64, // ULONGLONG* out
qwDefaultValue: u64 // ULONGLONG
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RESUTILS.dll")]
public static extern uint ResUtilGetQwordValue(IntPtr hkeyClusterKey, [MarshalAs(UnmanagedType.LPWStr)] string pszValueName, out ulong pqwOutValue, ulong qwDefaultValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ResUtilGetQwordValue' -Namespace Win32 -PassThru
# $api::ResUtilGetQwordValue(hkeyClusterKey, pszValueName, pqwOutValue, qwDefaultValue)#uselib "RESUTILS.dll"
#func global ResUtilGetQwordValue "ResUtilGetQwordValue" sptr, sptr, sptr, sptr
; ResUtilGetQwordValue hkeyClusterKey, pszValueName, varptr(pqwOutValue), qwDefaultValue ; 戻り値は stat
; hkeyClusterKey : HKEY -> "sptr"
; pszValueName : LPCWSTR -> "sptr"
; pqwOutValue : ULONGLONG* out -> "sptr"
; qwDefaultValue : ULONGLONG -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RESUTILS.dll" #cfunc global ResUtilGetQwordValue "ResUtilGetQwordValue" sptr, wstr, var, int64 ; res = ResUtilGetQwordValue(hkeyClusterKey, pszValueName, pqwOutValue, qwDefaultValue) ; hkeyClusterKey : HKEY -> "sptr" ; pszValueName : LPCWSTR -> "wstr" ; pqwOutValue : ULONGLONG* out -> "var" ; qwDefaultValue : ULONGLONG -> "int64" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。#uselib "RESUTILS.dll" #cfunc global ResUtilGetQwordValue "ResUtilGetQwordValue" sptr, wstr, sptr, int64 ; res = ResUtilGetQwordValue(hkeyClusterKey, pszValueName, varptr(pqwOutValue), qwDefaultValue) ; hkeyClusterKey : HKEY -> "sptr" ; pszValueName : LPCWSTR -> "wstr" ; pqwOutValue : ULONGLONG* out -> "sptr" ; qwDefaultValue : ULONGLONG -> "int64" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; DWORD ResUtilGetQwordValue(HKEY hkeyClusterKey, LPCWSTR pszValueName, ULONGLONG* pqwOutValue, ULONGLONG qwDefaultValue) #uselib "RESUTILS.dll" #cfunc global ResUtilGetQwordValue "ResUtilGetQwordValue" intptr, wstr, var, int64 ; res = ResUtilGetQwordValue(hkeyClusterKey, pszValueName, pqwOutValue, qwDefaultValue) ; hkeyClusterKey : HKEY -> "intptr" ; pszValueName : LPCWSTR -> "wstr" ; pqwOutValue : ULONGLONG* out -> "var" ; qwDefaultValue : ULONGLONG -> "int64" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD ResUtilGetQwordValue(HKEY hkeyClusterKey, LPCWSTR pszValueName, ULONGLONG* pqwOutValue, ULONGLONG qwDefaultValue) #uselib "RESUTILS.dll" #cfunc global ResUtilGetQwordValue "ResUtilGetQwordValue" intptr, wstr, intptr, int64 ; res = ResUtilGetQwordValue(hkeyClusterKey, pszValueName, varptr(pqwOutValue), qwDefaultValue) ; hkeyClusterKey : HKEY -> "intptr" ; pszValueName : LPCWSTR -> "wstr" ; pqwOutValue : ULONGLONG* out -> "intptr" ; qwDefaultValue : ULONGLONG -> "int64" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
resutils = windows.NewLazySystemDLL("RESUTILS.dll")
procResUtilGetQwordValue = resutils.NewProc("ResUtilGetQwordValue")
)
// hkeyClusterKey (HKEY), pszValueName (LPCWSTR), pqwOutValue (ULONGLONG* out), qwDefaultValue (ULONGLONG)
r1, _, err := procResUtilGetQwordValue.Call(
uintptr(hkeyClusterKey),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszValueName))),
uintptr(pqwOutValue),
uintptr(qwDefaultValue),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction ResUtilGetQwordValue(
hkeyClusterKey: THandle; // HKEY
pszValueName: PWideChar; // LPCWSTR
pqwOutValue: Pointer; // ULONGLONG* out
qwDefaultValue: UInt64 // ULONGLONG
): DWORD; stdcall;
external 'RESUTILS.dll' name 'ResUtilGetQwordValue';result := DllCall("RESUTILS\ResUtilGetQwordValue"
, "Ptr", hkeyClusterKey ; HKEY
, "WStr", pszValueName ; LPCWSTR
, "Ptr", pqwOutValue ; ULONGLONG* out
, "Int64", qwDefaultValue ; ULONGLONG
, "UInt") ; return: DWORD●ResUtilGetQwordValue(hkeyClusterKey, pszValueName, pqwOutValue, qwDefaultValue) = DLL("RESUTILS.dll", "dword ResUtilGetQwordValue(void*, char*, void*, qword)")
# 呼び出し: ResUtilGetQwordValue(hkeyClusterKey, pszValueName, pqwOutValue, qwDefaultValue)
# hkeyClusterKey : HKEY -> "void*"
# pszValueName : LPCWSTR -> "char*"
# pqwOutValue : ULONGLONG* out -> "void*"
# qwDefaultValue : ULONGLONG -> "qword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。