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

ResUtilGetPropertiesToParameterBlock

関数
プロパティ値を読み取りパラメータブロックに格納する。
DLLRESUTILS.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD ResUtilGetPropertiesToParameterBlock(
    HKEY hkeyClusterKey,
    const RESUTIL_PROPERTY_ITEM* pPropertyTable,
    BYTE* pOutParams,
    BOOL bCheckForRequiredProperties,
    LPWSTR* pszNameOfPropInError
);

パラメーター

名前方向説明
hkeyClusterKeyHKEYinプロパティを読み出す対象のクラスターレジストリキー。
pPropertyTableRESUTIL_PROPERTY_ITEM*in読み出すプロパティ定義を記述したRESUTIL_PROPERTY_ITEM配列。
pOutParamsBYTE*inout読み出した値を格納するパラメーターブロックバッファ。
bCheckForRequiredPropertiesBOOLinTRUEで必須プロパティの存在を検査する。
pszNameOfPropInErrorLPWSTR*outエラーとなったプロパティ名を受け取るワイド文字列ポインタ。NULL可。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD ResUtilGetPropertiesToParameterBlock(
    HKEY hkeyClusterKey,
    const RESUTIL_PROPERTY_ITEM* pPropertyTable,
    BYTE* pOutParams,
    BOOL bCheckForRequiredProperties,
    LPWSTR* pszNameOfPropInError
);
[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ResUtilGetPropertiesToParameterBlock(
    IntPtr hkeyClusterKey,   // HKEY
    IntPtr pPropertyTable,   // RESUTIL_PROPERTY_ITEM*
    IntPtr pOutParams,   // BYTE* in/out
    bool bCheckForRequiredProperties,   // BOOL
    IntPtr pszNameOfPropInError   // LPWSTR* out
);
<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilGetPropertiesToParameterBlock(
    hkeyClusterKey As IntPtr,   ' HKEY
    pPropertyTable As IntPtr,   ' RESUTIL_PROPERTY_ITEM*
    pOutParams As IntPtr,   ' BYTE* in/out
    bCheckForRequiredProperties As Boolean,   ' BOOL
    pszNameOfPropInError As IntPtr   ' LPWSTR* out
) As UInteger
End Function
' hkeyClusterKey : HKEY
' pPropertyTable : RESUTIL_PROPERTY_ITEM*
' pOutParams : BYTE* in/out
' bCheckForRequiredProperties : BOOL
' pszNameOfPropInError : LPWSTR* out
Declare PtrSafe Function ResUtilGetPropertiesToParameterBlock Lib "resutils" ( _
    ByVal hkeyClusterKey As LongPtr, _
    ByVal pPropertyTable As LongPtr, _
    ByVal pOutParams As LongPtr, _
    ByVal bCheckForRequiredProperties As Long, _
    ByVal pszNameOfPropInError As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ResUtilGetPropertiesToParameterBlock = ctypes.windll.resutils.ResUtilGetPropertiesToParameterBlock
ResUtilGetPropertiesToParameterBlock.restype = wintypes.DWORD
ResUtilGetPropertiesToParameterBlock.argtypes = [
    wintypes.HANDLE,  # hkeyClusterKey : HKEY
    ctypes.c_void_p,  # pPropertyTable : RESUTIL_PROPERTY_ITEM*
    ctypes.POINTER(ctypes.c_ubyte),  # pOutParams : BYTE* in/out
    wintypes.BOOL,  # bCheckForRequiredProperties : BOOL
    ctypes.c_void_p,  # pszNameOfPropInError : LPWSTR* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RESUTILS.dll')
ResUtilGetPropertiesToParameterBlock = Fiddle::Function.new(
  lib['ResUtilGetPropertiesToParameterBlock'],
  [
    Fiddle::TYPE_VOIDP,  # hkeyClusterKey : HKEY
    Fiddle::TYPE_VOIDP,  # pPropertyTable : RESUTIL_PROPERTY_ITEM*
    Fiddle::TYPE_VOIDP,  # pOutParams : BYTE* in/out
    Fiddle::TYPE_INT,  # bCheckForRequiredProperties : BOOL
    Fiddle::TYPE_VOIDP,  # pszNameOfPropInError : LPWSTR* out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "resutils")]
extern "system" {
    fn ResUtilGetPropertiesToParameterBlock(
        hkeyClusterKey: *mut core::ffi::c_void,  // HKEY
        pPropertyTable: *const RESUTIL_PROPERTY_ITEM,  // RESUTIL_PROPERTY_ITEM*
        pOutParams: *mut u8,  // BYTE* in/out
        bCheckForRequiredProperties: i32,  // BOOL
        pszNameOfPropInError: *mut *mut u16  // LPWSTR* out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RESUTILS.dll")]
public static extern uint ResUtilGetPropertiesToParameterBlock(IntPtr hkeyClusterKey, IntPtr pPropertyTable, IntPtr pOutParams, bool bCheckForRequiredProperties, IntPtr pszNameOfPropInError);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ResUtilGetPropertiesToParameterBlock' -Namespace Win32 -PassThru
# $api::ResUtilGetPropertiesToParameterBlock(hkeyClusterKey, pPropertyTable, pOutParams, bCheckForRequiredProperties, pszNameOfPropInError)
#uselib "RESUTILS.dll"
#func global ResUtilGetPropertiesToParameterBlock "ResUtilGetPropertiesToParameterBlock" sptr, sptr, sptr, sptr, sptr
; ResUtilGetPropertiesToParameterBlock hkeyClusterKey, varptr(pPropertyTable), varptr(pOutParams), bCheckForRequiredProperties, varptr(pszNameOfPropInError)   ; 戻り値は stat
; hkeyClusterKey : HKEY -> "sptr"
; pPropertyTable : RESUTIL_PROPERTY_ITEM* -> "sptr"
; pOutParams : BYTE* in/out -> "sptr"
; bCheckForRequiredProperties : BOOL -> "sptr"
; pszNameOfPropInError : LPWSTR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RESUTILS.dll"
#cfunc global ResUtilGetPropertiesToParameterBlock "ResUtilGetPropertiesToParameterBlock" sptr, var, var, int, var
; res = ResUtilGetPropertiesToParameterBlock(hkeyClusterKey, pPropertyTable, pOutParams, bCheckForRequiredProperties, pszNameOfPropInError)
; hkeyClusterKey : HKEY -> "sptr"
; pPropertyTable : RESUTIL_PROPERTY_ITEM* -> "var"
; pOutParams : BYTE* in/out -> "var"
; bCheckForRequiredProperties : BOOL -> "int"
; pszNameOfPropInError : LPWSTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD ResUtilGetPropertiesToParameterBlock(HKEY hkeyClusterKey, RESUTIL_PROPERTY_ITEM* pPropertyTable, BYTE* pOutParams, BOOL bCheckForRequiredProperties, LPWSTR* pszNameOfPropInError)
#uselib "RESUTILS.dll"
#cfunc global ResUtilGetPropertiesToParameterBlock "ResUtilGetPropertiesToParameterBlock" intptr, var, var, int, var
; res = ResUtilGetPropertiesToParameterBlock(hkeyClusterKey, pPropertyTable, pOutParams, bCheckForRequiredProperties, pszNameOfPropInError)
; hkeyClusterKey : HKEY -> "intptr"
; pPropertyTable : RESUTIL_PROPERTY_ITEM* -> "var"
; pOutParams : BYTE* in/out -> "var"
; bCheckForRequiredProperties : BOOL -> "int"
; pszNameOfPropInError : LPWSTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	resutils = windows.NewLazySystemDLL("RESUTILS.dll")
	procResUtilGetPropertiesToParameterBlock = resutils.NewProc("ResUtilGetPropertiesToParameterBlock")
)

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

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

typedef ResUtilGetPropertiesToParameterBlockNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Pointer<Uint8>, Int32, Pointer<Pointer<Utf16>>);
typedef ResUtilGetPropertiesToParameterBlockDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Uint8>, int, Pointer<Pointer<Utf16>>);
final ResUtilGetPropertiesToParameterBlock = DynamicLibrary.open('RESUTILS.dll')
    .lookupFunction<ResUtilGetPropertiesToParameterBlockNative, ResUtilGetPropertiesToParameterBlockDart>('ResUtilGetPropertiesToParameterBlock');
// hkeyClusterKey : HKEY -> Pointer<Void>
// pPropertyTable : RESUTIL_PROPERTY_ITEM* -> Pointer<Void>
// pOutParams : BYTE* in/out -> Pointer<Uint8>
// bCheckForRequiredProperties : BOOL -> Int32
// pszNameOfPropInError : LPWSTR* out -> Pointer<Pointer<Utf16>>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ResUtilGetPropertiesToParameterBlock(
  hkeyClusterKey: THandle;   // HKEY
  pPropertyTable: Pointer;   // RESUTIL_PROPERTY_ITEM*
  pOutParams: Pointer;   // BYTE* in/out
  bCheckForRequiredProperties: BOOL;   // BOOL
  pszNameOfPropInError: PPWideChar   // LPWSTR* out
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ResUtilGetPropertiesToParameterBlock';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ResUtilGetPropertiesToParameterBlock"
  c_ResUtilGetPropertiesToParameterBlock :: Ptr () -> Ptr () -> Ptr Word8 -> CInt -> Ptr CWString -> IO Word32
-- hkeyClusterKey : HKEY -> Ptr ()
-- pPropertyTable : RESUTIL_PROPERTY_ITEM* -> Ptr ()
-- pOutParams : BYTE* in/out -> Ptr Word8
-- bCheckForRequiredProperties : BOOL -> CInt
-- pszNameOfPropInError : LPWSTR* out -> Ptr CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let resutilgetpropertiestoparameterblock =
  foreign "ResUtilGetPropertiesToParameterBlock"
    ((ptr void) @-> (ptr void) @-> (ptr uint8_t) @-> int32_t @-> (ptr (ptr uint16_t)) @-> returning uint32_t)
(* hkeyClusterKey : HKEY -> (ptr void) *)
(* pPropertyTable : RESUTIL_PROPERTY_ITEM* -> (ptr void) *)
(* pOutParams : BYTE* in/out -> (ptr uint8_t) *)
(* bCheckForRequiredProperties : BOOL -> int32_t *)
(* pszNameOfPropInError : LPWSTR* out -> (ptr (ptr uint16_t)) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library resutils (t "RESUTILS.dll"))
(cffi:use-foreign-library resutils)

(cffi:defcfun ("ResUtilGetPropertiesToParameterBlock" res-util-get-properties-to-parameter-block :convention :stdcall) :uint32
  (hkey-cluster-key :pointer)   ; HKEY
  (p-property-table :pointer)   ; RESUTIL_PROPERTY_ITEM*
  (p-out-params :pointer)   ; BYTE* in/out
  (b-check-for-required-properties :int32)   ; BOOL
  (psz-name-of-prop-in-error :pointer))   ; LPWSTR* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ResUtilGetPropertiesToParameterBlock = Win32::API::More->new('RESUTILS',
    'DWORD ResUtilGetPropertiesToParameterBlock(HANDLE hkeyClusterKey, LPVOID pPropertyTable, LPVOID pOutParams, BOOL bCheckForRequiredProperties, LPVOID pszNameOfPropInError)');
# my $ret = $ResUtilGetPropertiesToParameterBlock->Call($hkeyClusterKey, $pPropertyTable, $pOutParams, $bCheckForRequiredProperties, $pszNameOfPropInError);
# hkeyClusterKey : HKEY -> HANDLE
# pPropertyTable : RESUTIL_PROPERTY_ITEM* -> LPVOID
# pOutParams : BYTE* in/out -> LPVOID
# bCheckForRequiredProperties : BOOL -> BOOL
# pszNameOfPropInError : LPWSTR* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型