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