ホーム › Networking.Clustering › ResUtilSetUnknownProperties
ResUtilSetUnknownProperties
関数未知のプロパティをクラスタキーに設定する。
シグネチャ
// RESUTILS.dll
#include <windows.h>
DWORD ResUtilSetUnknownProperties(
HKEY hkeyClusterKey,
const RESUTIL_PROPERTY_ITEM* pPropertyTable,
const void* pInPropertyList,
DWORD cbInPropertyListSize
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hkeyClusterKey | HKEY | in | 未知プロパティを設定する対象のクラスターレジストリキー。 |
| pPropertyTable | RESUTIL_PROPERTY_ITEM* | in | 既知プロパティの定義を記述したRESUTIL_PROPERTY_ITEM配列。除外判定に使う。 |
| pInPropertyList | void* | in | 設定する入力プロパティリストへのポインタ。既知分は除外される。 |
| cbInPropertyListSize | DWORD | in | pInPropertyListのサイズ(バイト)。 |
戻り値の型: DWORD
各言語での呼び出し定義
// RESUTILS.dll
#include <windows.h>
DWORD ResUtilSetUnknownProperties(
HKEY hkeyClusterKey,
const RESUTIL_PROPERTY_ITEM* pPropertyTable,
const void* pInPropertyList,
DWORD cbInPropertyListSize
);[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ResUtilSetUnknownProperties(
IntPtr hkeyClusterKey, // HKEY
IntPtr pPropertyTable, // RESUTIL_PROPERTY_ITEM*
IntPtr pInPropertyList, // void*
uint cbInPropertyListSize // DWORD
);<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilSetUnknownProperties(
hkeyClusterKey As IntPtr, ' HKEY
pPropertyTable As IntPtr, ' RESUTIL_PROPERTY_ITEM*
pInPropertyList As IntPtr, ' void*
cbInPropertyListSize As UInteger ' DWORD
) As UInteger
End Function' hkeyClusterKey : HKEY
' pPropertyTable : RESUTIL_PROPERTY_ITEM*
' pInPropertyList : void*
' cbInPropertyListSize : DWORD
Declare PtrSafe Function ResUtilSetUnknownProperties Lib "resutils" ( _
ByVal hkeyClusterKey As LongPtr, _
ByVal pPropertyTable 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
ResUtilSetUnknownProperties = ctypes.windll.resutils.ResUtilSetUnknownProperties
ResUtilSetUnknownProperties.restype = wintypes.DWORD
ResUtilSetUnknownProperties.argtypes = [
wintypes.HANDLE, # hkeyClusterKey : HKEY
ctypes.c_void_p, # pPropertyTable : RESUTIL_PROPERTY_ITEM*
ctypes.POINTER(None), # pInPropertyList : void*
wintypes.DWORD, # cbInPropertyListSize : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RESUTILS.dll')
ResUtilSetUnknownProperties = Fiddle::Function.new(
lib['ResUtilSetUnknownProperties'],
[
Fiddle::TYPE_VOIDP, # hkeyClusterKey : HKEY
Fiddle::TYPE_VOIDP, # pPropertyTable : RESUTIL_PROPERTY_ITEM*
Fiddle::TYPE_VOIDP, # pInPropertyList : void*
-Fiddle::TYPE_INT, # cbInPropertyListSize : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "resutils")]
extern "system" {
fn ResUtilSetUnknownProperties(
hkeyClusterKey: *mut core::ffi::c_void, // HKEY
pPropertyTable: *const RESUTIL_PROPERTY_ITEM, // RESUTIL_PROPERTY_ITEM*
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 ResUtilSetUnknownProperties(IntPtr hkeyClusterKey, IntPtr pPropertyTable, IntPtr pInPropertyList, uint cbInPropertyListSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ResUtilSetUnknownProperties' -Namespace Win32 -PassThru
# $api::ResUtilSetUnknownProperties(hkeyClusterKey, pPropertyTable, pInPropertyList, cbInPropertyListSize)#uselib "RESUTILS.dll"
#func global ResUtilSetUnknownProperties "ResUtilSetUnknownProperties" sptr, sptr, sptr, sptr
; ResUtilSetUnknownProperties hkeyClusterKey, varptr(pPropertyTable), pInPropertyList, cbInPropertyListSize ; 戻り値は stat
; hkeyClusterKey : HKEY -> "sptr"
; pPropertyTable : RESUTIL_PROPERTY_ITEM* -> "sptr"
; pInPropertyList : void* -> "sptr"
; cbInPropertyListSize : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RESUTILS.dll" #cfunc global ResUtilSetUnknownProperties "ResUtilSetUnknownProperties" sptr, var, sptr, int ; res = ResUtilSetUnknownProperties(hkeyClusterKey, pPropertyTable, pInPropertyList, cbInPropertyListSize) ; hkeyClusterKey : HKEY -> "sptr" ; pPropertyTable : RESUTIL_PROPERTY_ITEM* -> "var" ; pInPropertyList : void* -> "sptr" ; cbInPropertyListSize : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RESUTILS.dll" #cfunc global ResUtilSetUnknownProperties "ResUtilSetUnknownProperties" sptr, sptr, sptr, int ; res = ResUtilSetUnknownProperties(hkeyClusterKey, varptr(pPropertyTable), pInPropertyList, cbInPropertyListSize) ; hkeyClusterKey : HKEY -> "sptr" ; pPropertyTable : RESUTIL_PROPERTY_ITEM* -> "sptr" ; pInPropertyList : void* -> "sptr" ; cbInPropertyListSize : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD ResUtilSetUnknownProperties(HKEY hkeyClusterKey, RESUTIL_PROPERTY_ITEM* pPropertyTable, void* pInPropertyList, DWORD cbInPropertyListSize) #uselib "RESUTILS.dll" #cfunc global ResUtilSetUnknownProperties "ResUtilSetUnknownProperties" intptr, var, intptr, int ; res = ResUtilSetUnknownProperties(hkeyClusterKey, pPropertyTable, pInPropertyList, cbInPropertyListSize) ; hkeyClusterKey : HKEY -> "intptr" ; pPropertyTable : RESUTIL_PROPERTY_ITEM* -> "var" ; pInPropertyList : void* -> "intptr" ; cbInPropertyListSize : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD ResUtilSetUnknownProperties(HKEY hkeyClusterKey, RESUTIL_PROPERTY_ITEM* pPropertyTable, void* pInPropertyList, DWORD cbInPropertyListSize) #uselib "RESUTILS.dll" #cfunc global ResUtilSetUnknownProperties "ResUtilSetUnknownProperties" intptr, intptr, intptr, int ; res = ResUtilSetUnknownProperties(hkeyClusterKey, varptr(pPropertyTable), pInPropertyList, cbInPropertyListSize) ; hkeyClusterKey : HKEY -> "intptr" ; pPropertyTable : RESUTIL_PROPERTY_ITEM* -> "intptr" ; pInPropertyList : void* -> "intptr" ; cbInPropertyListSize : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
resutils = windows.NewLazySystemDLL("RESUTILS.dll")
procResUtilSetUnknownProperties = resutils.NewProc("ResUtilSetUnknownProperties")
)
// hkeyClusterKey (HKEY), pPropertyTable (RESUTIL_PROPERTY_ITEM*), pInPropertyList (void*), cbInPropertyListSize (DWORD)
r1, _, err := procResUtilSetUnknownProperties.Call(
uintptr(hkeyClusterKey),
uintptr(pPropertyTable),
uintptr(pInPropertyList),
uintptr(cbInPropertyListSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction ResUtilSetUnknownProperties(
hkeyClusterKey: THandle; // HKEY
pPropertyTable: Pointer; // RESUTIL_PROPERTY_ITEM*
pInPropertyList: Pointer; // void*
cbInPropertyListSize: DWORD // DWORD
): DWORD; stdcall;
external 'RESUTILS.dll' name 'ResUtilSetUnknownProperties';result := DllCall("RESUTILS\ResUtilSetUnknownProperties"
, "Ptr", hkeyClusterKey ; HKEY
, "Ptr", pPropertyTable ; RESUTIL_PROPERTY_ITEM*
, "Ptr", pInPropertyList ; void*
, "UInt", cbInPropertyListSize ; DWORD
, "UInt") ; return: DWORD●ResUtilSetUnknownProperties(hkeyClusterKey, pPropertyTable, pInPropertyList, cbInPropertyListSize) = DLL("RESUTILS.dll", "dword ResUtilSetUnknownProperties(void*, void*, void*, dword)")
# 呼び出し: ResUtilSetUnknownProperties(hkeyClusterKey, pPropertyTable, pInPropertyList, cbInPropertyListSize)
# hkeyClusterKey : HKEY -> "void*"
# pPropertyTable : RESUTIL_PROPERTY_ITEM* -> "void*"
# pInPropertyList : void* -> "void*"
# cbInPropertyListSize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "resutils" fn ResUtilSetUnknownProperties(
hkeyClusterKey: ?*anyopaque, // HKEY
pPropertyTable: [*c]RESUTIL_PROPERTY_ITEM, // RESUTIL_PROPERTY_ITEM*
pInPropertyList: ?*anyopaque, // void*
cbInPropertyListSize: u32 // DWORD
) callconv(std.os.windows.WINAPI) u32;proc ResUtilSetUnknownProperties(
hkeyClusterKey: pointer, # HKEY
pPropertyTable: ptr RESUTIL_PROPERTY_ITEM, # RESUTIL_PROPERTY_ITEM*
pInPropertyList: pointer, # void*
cbInPropertyListSize: uint32 # DWORD
): uint32 {.importc: "ResUtilSetUnknownProperties", stdcall, dynlib: "RESUTILS.dll".}pragma(lib, "resutils");
extern(Windows)
uint ResUtilSetUnknownProperties(
void* hkeyClusterKey, // HKEY
RESUTIL_PROPERTY_ITEM* pPropertyTable, // RESUTIL_PROPERTY_ITEM*
void* pInPropertyList, // void*
uint cbInPropertyListSize // DWORD
);ccall((:ResUtilSetUnknownProperties, "RESUTILS.dll"), stdcall, UInt32,
(Ptr{Cvoid}, Ptr{RESUTIL_PROPERTY_ITEM}, Ptr{Cvoid}, UInt32),
hkeyClusterKey, pPropertyTable, pInPropertyList, cbInPropertyListSize)
# hkeyClusterKey : HKEY -> Ptr{Cvoid}
# pPropertyTable : RESUTIL_PROPERTY_ITEM* -> Ptr{RESUTIL_PROPERTY_ITEM}
# pInPropertyList : void* -> Ptr{Cvoid}
# cbInPropertyListSize : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t ResUtilSetUnknownProperties(
void* hkeyClusterKey,
void* pPropertyTable,
void* pInPropertyList,
uint32_t cbInPropertyListSize);
]]
local resutils = ffi.load("resutils")
-- resutils.ResUtilSetUnknownProperties(hkeyClusterKey, pPropertyTable, pInPropertyList, cbInPropertyListSize)
-- hkeyClusterKey : HKEY
-- pPropertyTable : RESUTIL_PROPERTY_ITEM*
-- pInPropertyList : void*
-- cbInPropertyListSize : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('RESUTILS.dll');
const ResUtilSetUnknownProperties = lib.func('__stdcall', 'ResUtilSetUnknownProperties', 'uint32_t', ['void *', 'void *', 'void *', 'uint32_t']);
// ResUtilSetUnknownProperties(hkeyClusterKey, pPropertyTable, pInPropertyList, cbInPropertyListSize)
// hkeyClusterKey : HKEY -> 'void *'
// pPropertyTable : RESUTIL_PROPERTY_ITEM* -> 'void *'
// pInPropertyList : void* -> 'void *'
// cbInPropertyListSize : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RESUTILS.dll", {
ResUtilSetUnknownProperties: { parameters: ["pointer", "pointer", "pointer", "u32"], result: "u32" },
});
// lib.symbols.ResUtilSetUnknownProperties(hkeyClusterKey, pPropertyTable, pInPropertyList, cbInPropertyListSize)
// hkeyClusterKey : HKEY -> "pointer"
// pPropertyTable : RESUTIL_PROPERTY_ITEM* -> "pointer"
// pInPropertyList : void* -> "pointer"
// cbInPropertyListSize : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t ResUtilSetUnknownProperties(
void* hkeyClusterKey,
void* pPropertyTable,
void* pInPropertyList,
uint32_t cbInPropertyListSize);
C, "RESUTILS.dll");
// $ffi->ResUtilSetUnknownProperties(hkeyClusterKey, pPropertyTable, pInPropertyList, cbInPropertyListSize);
// hkeyClusterKey : HKEY
// pPropertyTable : RESUTIL_PROPERTY_ITEM*
// 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 ResUtilSetUnknownProperties(
Pointer hkeyClusterKey, // HKEY
Pointer pPropertyTable, // RESUTIL_PROPERTY_ITEM*
Pointer pInPropertyList, // void*
int cbInPropertyListSize // DWORD
);
}@[Link("resutils")]
lib LibRESUTILS
fun ResUtilSetUnknownProperties = ResUtilSetUnknownProperties(
hkeyClusterKey : Void*, # HKEY
pPropertyTable : RESUTIL_PROPERTY_ITEM*, # RESUTIL_PROPERTY_ITEM*
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 ResUtilSetUnknownPropertiesNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Uint32);
typedef ResUtilSetUnknownPropertiesDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, int);
final ResUtilSetUnknownProperties = DynamicLibrary.open('RESUTILS.dll')
.lookupFunction<ResUtilSetUnknownPropertiesNative, ResUtilSetUnknownPropertiesDart>('ResUtilSetUnknownProperties');
// hkeyClusterKey : HKEY -> Pointer<Void>
// pPropertyTable : RESUTIL_PROPERTY_ITEM* -> Pointer<Void>
// pInPropertyList : void* -> Pointer<Void>
// cbInPropertyListSize : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ResUtilSetUnknownProperties(
hkeyClusterKey: THandle; // HKEY
pPropertyTable: Pointer; // RESUTIL_PROPERTY_ITEM*
pInPropertyList: Pointer; // void*
cbInPropertyListSize: DWORD // DWORD
): DWORD; stdcall;
external 'RESUTILS.dll' name 'ResUtilSetUnknownProperties';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ResUtilSetUnknownProperties"
c_ResUtilSetUnknownProperties :: Ptr () -> Ptr () -> Ptr () -> Word32 -> IO Word32
-- hkeyClusterKey : HKEY -> Ptr ()
-- pPropertyTable : RESUTIL_PROPERTY_ITEM* -> Ptr ()
-- pInPropertyList : void* -> Ptr ()
-- cbInPropertyListSize : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let resutilsetunknownproperties =
foreign "ResUtilSetUnknownProperties"
((ptr void) @-> (ptr void) @-> (ptr void) @-> uint32_t @-> returning uint32_t)
(* hkeyClusterKey : HKEY -> (ptr void) *)
(* pPropertyTable : RESUTIL_PROPERTY_ITEM* -> (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 ("ResUtilSetUnknownProperties" res-util-set-unknown-properties :convention :stdcall) :uint32
(hkey-cluster-key :pointer) ; HKEY
(p-property-table :pointer) ; RESUTIL_PROPERTY_ITEM*
(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 $ResUtilSetUnknownProperties = Win32::API::More->new('RESUTILS',
'DWORD ResUtilSetUnknownProperties(HANDLE hkeyClusterKey, LPVOID pPropertyTable, LPVOID pInPropertyList, DWORD cbInPropertyListSize)');
# my $ret = $ResUtilSetUnknownProperties->Call($hkeyClusterKey, $pPropertyTable, $pInPropertyList, $cbInPropertyListSize);
# hkeyClusterKey : HKEY -> HANDLE
# pPropertyTable : RESUTIL_PROPERTY_ITEM* -> LPVOID
# pInPropertyList : void* -> LPVOID
# cbInPropertyListSize : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。