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