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