Win32 API 日本語リファレンス
ホームNetworking.Clustering › ResUtilSetPrivatePropertyList

ResUtilSetPrivatePropertyList

関数
クラスタキーにプライベートプロパティリストを設定する。
DLLRESUTILS.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

// RESUTILS.dll
#include <windows.h>

DWORD ResUtilSetPrivatePropertyList(
    HKEY hkeyClusterKey,
    const void* pInPropertyList,
    DWORD cbInPropertyListSize
);

パラメーター

名前方向説明
hkeyClusterKeyHKEYinプライベートプロパティを設定する対象のクラスターレジストリキー。
pInPropertyListvoid*in設定する入力プロパティリストへのポインタ。
cbInPropertyListSizeDWORDinpInPropertyListのサイズ(バイト)。

戻り値の型: DWORD

各言語での呼び出し定義

// RESUTILS.dll
#include <windows.h>

DWORD ResUtilSetPrivatePropertyList(
    HKEY hkeyClusterKey,
    const void* pInPropertyList,
    DWORD cbInPropertyListSize
);
[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ResUtilSetPrivatePropertyList(
    IntPtr hkeyClusterKey,   // HKEY
    IntPtr pInPropertyList,   // void*
    uint cbInPropertyListSize   // DWORD
);
<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilSetPrivatePropertyList(
    hkeyClusterKey As IntPtr,   ' HKEY
    pInPropertyList As IntPtr,   ' void*
    cbInPropertyListSize As UInteger   ' DWORD
) As UInteger
End Function
' hkeyClusterKey : HKEY
' pInPropertyList : void*
' cbInPropertyListSize : DWORD
Declare PtrSafe Function ResUtilSetPrivatePropertyList Lib "resutils" ( _
    ByVal hkeyClusterKey As LongPtr, _
    ByVal pInPropertyList As LongPtr, _
    ByVal cbInPropertyListSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ResUtilSetPrivatePropertyList = ctypes.windll.resutils.ResUtilSetPrivatePropertyList
ResUtilSetPrivatePropertyList.restype = wintypes.DWORD
ResUtilSetPrivatePropertyList.argtypes = [
    wintypes.HANDLE,  # hkeyClusterKey : HKEY
    ctypes.POINTER(None),  # pInPropertyList : void*
    wintypes.DWORD,  # cbInPropertyListSize : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RESUTILS.dll')
ResUtilSetPrivatePropertyList = Fiddle::Function.new(
  lib['ResUtilSetPrivatePropertyList'],
  [
    Fiddle::TYPE_VOIDP,  # hkeyClusterKey : HKEY
    Fiddle::TYPE_VOIDP,  # pInPropertyList : void*
    -Fiddle::TYPE_INT,  # cbInPropertyListSize : DWORD
  ],
  -Fiddle::TYPE_INT)
#[link(name = "resutils")]
extern "system" {
    fn ResUtilSetPrivatePropertyList(
        hkeyClusterKey: *mut core::ffi::c_void,  // HKEY
        pInPropertyList: *const (),  // void*
        cbInPropertyListSize: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RESUTILS.dll")]
public static extern uint ResUtilSetPrivatePropertyList(IntPtr hkeyClusterKey, IntPtr pInPropertyList, uint cbInPropertyListSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ResUtilSetPrivatePropertyList' -Namespace Win32 -PassThru
# $api::ResUtilSetPrivatePropertyList(hkeyClusterKey, pInPropertyList, cbInPropertyListSize)
#uselib "RESUTILS.dll"
#func global ResUtilSetPrivatePropertyList "ResUtilSetPrivatePropertyList" sptr, sptr, sptr
; ResUtilSetPrivatePropertyList hkeyClusterKey, pInPropertyList, cbInPropertyListSize   ; 戻り値は stat
; hkeyClusterKey : HKEY -> "sptr"
; pInPropertyList : void* -> "sptr"
; cbInPropertyListSize : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "RESUTILS.dll"
#cfunc global ResUtilSetPrivatePropertyList "ResUtilSetPrivatePropertyList" sptr, sptr, int
; res = ResUtilSetPrivatePropertyList(hkeyClusterKey, pInPropertyList, cbInPropertyListSize)
; hkeyClusterKey : HKEY -> "sptr"
; pInPropertyList : void* -> "sptr"
; cbInPropertyListSize : DWORD -> "int"
; DWORD ResUtilSetPrivatePropertyList(HKEY hkeyClusterKey, void* pInPropertyList, DWORD cbInPropertyListSize)
#uselib "RESUTILS.dll"
#cfunc global ResUtilSetPrivatePropertyList "ResUtilSetPrivatePropertyList" intptr, intptr, int
; res = ResUtilSetPrivatePropertyList(hkeyClusterKey, pInPropertyList, cbInPropertyListSize)
; hkeyClusterKey : HKEY -> "intptr"
; pInPropertyList : void* -> "intptr"
; cbInPropertyListSize : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	resutils = windows.NewLazySystemDLL("RESUTILS.dll")
	procResUtilSetPrivatePropertyList = resutils.NewProc("ResUtilSetPrivatePropertyList")
)

// hkeyClusterKey (HKEY), pInPropertyList (void*), cbInPropertyListSize (DWORD)
r1, _, err := procResUtilSetPrivatePropertyList.Call(
	uintptr(hkeyClusterKey),
	uintptr(pInPropertyList),
	uintptr(cbInPropertyListSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ResUtilSetPrivatePropertyList(
  hkeyClusterKey: THandle;   // HKEY
  pInPropertyList: Pointer;   // void*
  cbInPropertyListSize: DWORD   // DWORD
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ResUtilSetPrivatePropertyList';
result := DllCall("RESUTILS\ResUtilSetPrivatePropertyList"
    , "Ptr", hkeyClusterKey   ; HKEY
    , "Ptr", pInPropertyList   ; void*
    , "UInt", cbInPropertyListSize   ; DWORD
    , "UInt")   ; return: DWORD
●ResUtilSetPrivatePropertyList(hkeyClusterKey, pInPropertyList, cbInPropertyListSize) = DLL("RESUTILS.dll", "dword ResUtilSetPrivatePropertyList(void*, void*, dword)")
# 呼び出し: ResUtilSetPrivatePropertyList(hkeyClusterKey, pInPropertyList, cbInPropertyListSize)
# hkeyClusterKey : HKEY -> "void*"
# pInPropertyList : void* -> "void*"
# cbInPropertyListSize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "resutils" fn ResUtilSetPrivatePropertyList(
    hkeyClusterKey: ?*anyopaque, // HKEY
    pInPropertyList: ?*anyopaque, // void*
    cbInPropertyListSize: u32 // DWORD
) callconv(std.os.windows.WINAPI) u32;
proc ResUtilSetPrivatePropertyList(
    hkeyClusterKey: pointer,  # HKEY
    pInPropertyList: pointer,  # void*
    cbInPropertyListSize: uint32  # DWORD
): uint32 {.importc: "ResUtilSetPrivatePropertyList", stdcall, dynlib: "RESUTILS.dll".}
pragma(lib, "resutils");
extern(Windows)
uint ResUtilSetPrivatePropertyList(
    void* hkeyClusterKey,   // HKEY
    void* pInPropertyList,   // void*
    uint cbInPropertyListSize   // DWORD
);
ccall((:ResUtilSetPrivatePropertyList, "RESUTILS.dll"), stdcall, UInt32,
      (Ptr{Cvoid}, Ptr{Cvoid}, UInt32),
      hkeyClusterKey, pInPropertyList, cbInPropertyListSize)
# hkeyClusterKey : HKEY -> Ptr{Cvoid}
# pInPropertyList : void* -> Ptr{Cvoid}
# cbInPropertyListSize : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t ResUtilSetPrivatePropertyList(
    void* hkeyClusterKey,
    void* pInPropertyList,
    uint32_t cbInPropertyListSize);
]]
local resutils = ffi.load("resutils")
-- resutils.ResUtilSetPrivatePropertyList(hkeyClusterKey, pInPropertyList, cbInPropertyListSize)
-- hkeyClusterKey : HKEY
-- pInPropertyList : void*
-- cbInPropertyListSize : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('RESUTILS.dll');
const ResUtilSetPrivatePropertyList = lib.func('__stdcall', 'ResUtilSetPrivatePropertyList', 'uint32_t', ['void *', 'void *', 'uint32_t']);
// ResUtilSetPrivatePropertyList(hkeyClusterKey, pInPropertyList, cbInPropertyListSize)
// hkeyClusterKey : HKEY -> 'void *'
// pInPropertyList : void* -> 'void *'
// cbInPropertyListSize : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("RESUTILS.dll", {
  ResUtilSetPrivatePropertyList: { parameters: ["pointer", "pointer", "u32"], result: "u32" },
});
// lib.symbols.ResUtilSetPrivatePropertyList(hkeyClusterKey, pInPropertyList, cbInPropertyListSize)
// hkeyClusterKey : HKEY -> "pointer"
// pInPropertyList : void* -> "pointer"
// cbInPropertyListSize : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ResUtilSetPrivatePropertyList(
    void* hkeyClusterKey,
    void* pInPropertyList,
    uint32_t cbInPropertyListSize);
C, "RESUTILS.dll");
// $ffi->ResUtilSetPrivatePropertyList(hkeyClusterKey, pInPropertyList, cbInPropertyListSize);
// hkeyClusterKey : HKEY
// pInPropertyList : void*
// cbInPropertyListSize : DWORD
// 構造体/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 ResUtilSetPrivatePropertyList(
        Pointer hkeyClusterKey,   // HKEY
        Pointer pInPropertyList,   // void*
        int cbInPropertyListSize   // DWORD
    );
}
@[Link("resutils")]
lib LibRESUTILS
  fun ResUtilSetPrivatePropertyList = ResUtilSetPrivatePropertyList(
    hkeyClusterKey : Void*,   # HKEY
    pInPropertyList : Void*,   # void*
    cbInPropertyListSize : UInt32   # DWORD
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ResUtilSetPrivatePropertyListNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Uint32);
typedef ResUtilSetPrivatePropertyListDart = int Function(Pointer<Void>, Pointer<Void>, int);
final ResUtilSetPrivatePropertyList = DynamicLibrary.open('RESUTILS.dll')
    .lookupFunction<ResUtilSetPrivatePropertyListNative, ResUtilSetPrivatePropertyListDart>('ResUtilSetPrivatePropertyList');
// hkeyClusterKey : HKEY -> Pointer<Void>
// pInPropertyList : void* -> Pointer<Void>
// cbInPropertyListSize : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ResUtilSetPrivatePropertyList(
  hkeyClusterKey: THandle;   // HKEY
  pInPropertyList: Pointer;   // void*
  cbInPropertyListSize: DWORD   // DWORD
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ResUtilSetPrivatePropertyList';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ResUtilSetPrivatePropertyList"
  c_ResUtilSetPrivatePropertyList :: Ptr () -> Ptr () -> Word32 -> IO Word32
-- hkeyClusterKey : HKEY -> Ptr ()
-- pInPropertyList : void* -> Ptr ()
-- cbInPropertyListSize : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let resutilsetprivatepropertylist =
  foreign "ResUtilSetPrivatePropertyList"
    ((ptr void) @-> (ptr void) @-> uint32_t @-> returning uint32_t)
(* hkeyClusterKey : HKEY -> (ptr void) *)
(* pInPropertyList : void* -> (ptr void) *)
(* cbInPropertyListSize : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library resutils (t "RESUTILS.dll"))
(cffi:use-foreign-library resutils)

(cffi:defcfun ("ResUtilSetPrivatePropertyList" res-util-set-private-property-list :convention :stdcall) :uint32
  (hkey-cluster-key :pointer)   ; HKEY
  (p-in-property-list :pointer)   ; void*
  (cb-in-property-list-size :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ResUtilSetPrivatePropertyList = Win32::API::More->new('RESUTILS',
    'DWORD ResUtilSetPrivatePropertyList(HANDLE hkeyClusterKey, LPVOID pInPropertyList, DWORD cbInPropertyListSize)');
# my $ret = $ResUtilSetPrivatePropertyList->Call($hkeyClusterKey, $pInPropertyList, $cbInPropertyListSize);
# hkeyClusterKey : HKEY -> HANDLE
# pInPropertyList : void* -> LPVOID
# cbInPropertyListSize : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。