ホーム › 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 | REG_MULTI_SZ値を書き込む対象のクラスターレジストリキー。 |
| pszValueName | LPCWSTR | in | 書き込む値の名前を示すワイド文字列。 |
| pszNewValue | LPCWSTR | in | NUL区切りで連結した複数文字列値。末尾は二重NULで終端する。 |
| cbNewValueSize | DWORD | in | pszNewValueのサイズ(バイト)。 |
| ppszOutValue | LPWSTR* | outoptional | 書き込んだ値のコピーを受け取るポインタ。LocalFreeで解放する。NULL可。 |
| pcbOutValueSize | DWORD* | inoutoptional | 出力コピーのバイト数を受け取るDWORDポインタ。 |
戻り値の型: 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)。const std = @import("std");
extern "resutils" fn ResUtilSetMultiSzValue(
hkeyClusterKey: ?*anyopaque, // HKEY
pszValueName: [*c]const u16, // LPCWSTR
pszNewValue: [*c]const u16, // LPCWSTR
cbNewValueSize: u32, // DWORD
ppszOutValue: [*c][*c]u16, // LPWSTR* optional, out
pcbOutValueSize: [*c]u32 // DWORD* optional, in/out
) callconv(std.os.windows.WINAPI) u32;proc ResUtilSetMultiSzValue(
hkeyClusterKey: pointer, # HKEY
pszValueName: WideCString, # LPCWSTR
pszNewValue: WideCString, # LPCWSTR
cbNewValueSize: uint32, # DWORD
ppszOutValue: ptr WideCString, # LPWSTR* optional, out
pcbOutValueSize: ptr uint32 # DWORD* optional, in/out
): uint32 {.importc: "ResUtilSetMultiSzValue", stdcall, dynlib: "RESUTILS.dll".}pragma(lib, "resutils");
extern(Windows)
uint ResUtilSetMultiSzValue(
void* hkeyClusterKey, // HKEY
const(wchar)* pszValueName, // LPCWSTR
const(wchar)* pszNewValue, // LPCWSTR
uint cbNewValueSize, // DWORD
wchar** ppszOutValue, // LPWSTR* optional, out
uint* pcbOutValueSize // DWORD* optional, in/out
);ccall((:ResUtilSetMultiSzValue, "RESUTILS.dll"), stdcall, UInt32,
(Ptr{Cvoid}, Cwstring, Cwstring, UInt32, Ptr{Ptr{UInt16}}, Ptr{UInt32}),
hkeyClusterKey, pszValueName, pszNewValue, cbNewValueSize, ppszOutValue, pcbOutValueSize)
# hkeyClusterKey : HKEY -> Ptr{Cvoid}
# pszValueName : LPCWSTR -> Cwstring
# pszNewValue : LPCWSTR -> Cwstring
# cbNewValueSize : DWORD -> UInt32
# ppszOutValue : LPWSTR* optional, out -> Ptr{Ptr{UInt16}}
# pcbOutValueSize : DWORD* optional, in/out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t ResUtilSetMultiSzValue(
void* hkeyClusterKey,
const uint16_t* pszValueName,
const uint16_t* pszNewValue,
uint32_t cbNewValueSize,
uint16_t** ppszOutValue,
uint32_t* pcbOutValueSize);
]]
local resutils = ffi.load("resutils")
-- resutils.ResUtilSetMultiSzValue(hkeyClusterKey, pszValueName, pszNewValue, cbNewValueSize, ppszOutValue, pcbOutValueSize)
-- hkeyClusterKey : HKEY
-- pszValueName : LPCWSTR
-- pszNewValue : LPCWSTR
-- cbNewValueSize : DWORD
-- ppszOutValue : LPWSTR* optional, out
-- pcbOutValueSize : DWORD* optional, in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('RESUTILS.dll');
const ResUtilSetMultiSzValue = lib.func('__stdcall', 'ResUtilSetMultiSzValue', 'uint32_t', ['void *', 'str16', 'str16', 'uint32_t', 'void *', 'uint32_t *']);
// ResUtilSetMultiSzValue(hkeyClusterKey, pszValueName, pszNewValue, cbNewValueSize, ppszOutValue, pcbOutValueSize)
// hkeyClusterKey : HKEY -> 'void *'
// pszValueName : LPCWSTR -> 'str16'
// pszNewValue : LPCWSTR -> 'str16'
// cbNewValueSize : DWORD -> 'uint32_t'
// ppszOutValue : LPWSTR* optional, out -> 'void *'
// pcbOutValueSize : DWORD* optional, in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RESUTILS.dll", {
ResUtilSetMultiSzValue: { parameters: ["pointer", "buffer", "buffer", "u32", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.ResUtilSetMultiSzValue(hkeyClusterKey, pszValueName, pszNewValue, cbNewValueSize, ppszOutValue, pcbOutValueSize)
// hkeyClusterKey : HKEY -> "pointer"
// pszValueName : LPCWSTR -> "buffer"
// pszNewValue : LPCWSTR -> "buffer"
// cbNewValueSize : DWORD -> "u32"
// ppszOutValue : LPWSTR* optional, out -> "pointer"
// pcbOutValueSize : DWORD* optional, in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t ResUtilSetMultiSzValue(
void* hkeyClusterKey,
const uint16_t* pszValueName,
const uint16_t* pszNewValue,
uint32_t cbNewValueSize,
uint16_t** ppszOutValue,
uint32_t* pcbOutValueSize);
C, "RESUTILS.dll");
// $ffi->ResUtilSetMultiSzValue(hkeyClusterKey, pszValueName, pszNewValue, cbNewValueSize, ppszOutValue, pcbOutValueSize);
// hkeyClusterKey : HKEY
// pszValueName : LPCWSTR
// pszNewValue : LPCWSTR
// cbNewValueSize : DWORD
// ppszOutValue : LPWSTR* optional, out
// pcbOutValueSize : DWORD* optional, in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Resutils extends StdCallLibrary {
Resutils INSTANCE = Native.load("resutils", Resutils.class);
int ResUtilSetMultiSzValue(
Pointer hkeyClusterKey, // HKEY
WString pszValueName, // LPCWSTR
WString pszNewValue, // LPCWSTR
int cbNewValueSize, // DWORD
PointerByReference ppszOutValue, // LPWSTR* optional, out
IntByReference pcbOutValueSize // DWORD* optional, in/out
);
}@[Link("resutils")]
lib LibRESUTILS
fun ResUtilSetMultiSzValue = ResUtilSetMultiSzValue(
hkeyClusterKey : Void*, # HKEY
pszValueName : UInt16*, # LPCWSTR
pszNewValue : UInt16*, # LPCWSTR
cbNewValueSize : UInt32, # DWORD
ppszOutValue : UInt16**, # LPWSTR* optional, out
pcbOutValueSize : UInt32* # DWORD* optional, in/out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ResUtilSetMultiSzValueNative = Uint32 Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Uint32, Pointer<Pointer<Utf16>>, Pointer<Uint32>);
typedef ResUtilSetMultiSzValueDart = int Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, int, Pointer<Pointer<Utf16>>, Pointer<Uint32>);
final ResUtilSetMultiSzValue = DynamicLibrary.open('RESUTILS.dll')
.lookupFunction<ResUtilSetMultiSzValueNative, ResUtilSetMultiSzValueDart>('ResUtilSetMultiSzValue');
// hkeyClusterKey : HKEY -> Pointer<Void>
// pszValueName : LPCWSTR -> Pointer<Utf16>
// pszNewValue : LPCWSTR -> Pointer<Utf16>
// cbNewValueSize : DWORD -> Uint32
// ppszOutValue : LPWSTR* optional, out -> Pointer<Pointer<Utf16>>
// pcbOutValueSize : DWORD* optional, in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function 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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ResUtilSetMultiSzValue"
c_ResUtilSetMultiSzValue :: Ptr () -> CWString -> CWString -> Word32 -> Ptr CWString -> Ptr Word32 -> IO Word32
-- hkeyClusterKey : HKEY -> Ptr ()
-- pszValueName : LPCWSTR -> CWString
-- pszNewValue : LPCWSTR -> CWString
-- cbNewValueSize : DWORD -> Word32
-- ppszOutValue : LPWSTR* optional, out -> Ptr CWString
-- pcbOutValueSize : DWORD* optional, in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let resutilsetmultiszvalue =
foreign "ResUtilSetMultiSzValue"
((ptr void) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> uint32_t @-> (ptr (ptr uint16_t)) @-> (ptr uint32_t) @-> returning uint32_t)
(* hkeyClusterKey : HKEY -> (ptr void) *)
(* pszValueName : LPCWSTR -> (ptr uint16_t) *)
(* pszNewValue : LPCWSTR -> (ptr uint16_t) *)
(* cbNewValueSize : DWORD -> uint32_t *)
(* ppszOutValue : LPWSTR* optional, out -> (ptr (ptr uint16_t)) *)
(* pcbOutValueSize : DWORD* optional, in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library resutils (t "RESUTILS.dll"))
(cffi:use-foreign-library resutils)
(cffi:defcfun ("ResUtilSetMultiSzValue" res-util-set-multi-sz-value :convention :stdcall) :uint32
(hkey-cluster-key :pointer) ; HKEY
(psz-value-name (:string :encoding :utf-16le)) ; LPCWSTR
(psz-new-value (:string :encoding :utf-16le)) ; LPCWSTR
(cb-new-value-size :uint32) ; DWORD
(ppsz-out-value :pointer) ; LPWSTR* optional, out
(pcb-out-value-size :pointer)) ; DWORD* optional, in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ResUtilSetMultiSzValue = Win32::API::More->new('RESUTILS',
'DWORD ResUtilSetMultiSzValue(HANDLE hkeyClusterKey, LPCWSTR pszValueName, LPCWSTR pszNewValue, DWORD cbNewValueSize, LPVOID ppszOutValue, LPVOID pcbOutValueSize)');
# my $ret = $ResUtilSetMultiSzValue->Call($hkeyClusterKey, $pszValueName, $pszNewValue, $cbNewValueSize, $ppszOutValue, $pcbOutValueSize);
# hkeyClusterKey : HKEY -> HANDLE
# pszValueName : LPCWSTR -> LPCWSTR
# pszNewValue : LPCWSTR -> LPCWSTR
# cbNewValueSize : DWORD -> DWORD
# ppszOutValue : LPWSTR* optional, out -> LPVOID
# pcbOutValueSize : DWORD* optional, in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。