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