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

ResUtilGetPropertyFormats

関数
プロパティテーブルの書式情報リストを取得する。
DLLRESUTILS.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD ResUtilGetPropertyFormats(
    const RESUTIL_PROPERTY_ITEM* pPropertyTable,
    void* pOutPropertyFormatList,
    DWORD cbPropertyFormatListSize,
    DWORD* pcbBytesReturned,
    DWORD* pcbRequired
);

パラメーター

名前方向説明
pPropertyTableRESUTIL_PROPERTY_ITEM*inプロパティ定義テーブル(RESUTIL_PROPERTY_ITEM配列)へのポインター。
pOutPropertyFormatListvoid*out生成されたプロパティ書式リストを受け取る出力バッファー。
cbPropertyFormatListSizeDWORDin出力バッファーのバイト数。
pcbBytesReturnedDWORD*out実際に書き込まれたバイト数を受け取る変数へのポインター。
pcbRequiredDWORD*outバッファー不足時に必要なバイト数を受け取る変数へのポインター。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

ResUtilGetPropertyFormats = ctypes.windll.resutils.ResUtilGetPropertyFormats
ResUtilGetPropertyFormats.restype = wintypes.DWORD
ResUtilGetPropertyFormats.argtypes = [
    ctypes.c_void_p,  # pPropertyTable : RESUTIL_PROPERTY_ITEM*
    ctypes.POINTER(None),  # pOutPropertyFormatList : void* out
    wintypes.DWORD,  # cbPropertyFormatListSize : DWORD
    ctypes.POINTER(wintypes.DWORD),  # pcbBytesReturned : DWORD* out
    ctypes.POINTER(wintypes.DWORD),  # pcbRequired : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	resutils = windows.NewLazySystemDLL("RESUTILS.dll")
	procResUtilGetPropertyFormats = resutils.NewProc("ResUtilGetPropertyFormats")
)

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

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

typedef ResUtilGetPropertyFormatsNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Uint32, Pointer<Uint32>, Pointer<Uint32>);
typedef ResUtilGetPropertyFormatsDart = int Function(Pointer<Void>, Pointer<Void>, int, Pointer<Uint32>, Pointer<Uint32>);
final ResUtilGetPropertyFormats = DynamicLibrary.open('RESUTILS.dll')
    .lookupFunction<ResUtilGetPropertyFormatsNative, ResUtilGetPropertyFormatsDart>('ResUtilGetPropertyFormats');
// pPropertyTable : RESUTIL_PROPERTY_ITEM* -> Pointer<Void>
// pOutPropertyFormatList : void* out -> Pointer<Void>
// cbPropertyFormatListSize : DWORD -> Uint32
// pcbBytesReturned : DWORD* out -> Pointer<Uint32>
// pcbRequired : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ResUtilGetPropertyFormats(
  pPropertyTable: Pointer;   // RESUTIL_PROPERTY_ITEM*
  pOutPropertyFormatList: Pointer;   // void* out
  cbPropertyFormatListSize: DWORD;   // DWORD
  pcbBytesReturned: Pointer;   // DWORD* out
  pcbRequired: Pointer   // DWORD* out
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ResUtilGetPropertyFormats';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ResUtilGetPropertyFormats"
  c_ResUtilGetPropertyFormats :: Ptr () -> Ptr () -> Word32 -> Ptr Word32 -> Ptr Word32 -> IO Word32
-- pPropertyTable : RESUTIL_PROPERTY_ITEM* -> Ptr ()
-- pOutPropertyFormatList : void* out -> Ptr ()
-- cbPropertyFormatListSize : DWORD -> Word32
-- pcbBytesReturned : DWORD* out -> Ptr Word32
-- pcbRequired : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let resutilgetpropertyformats =
  foreign "ResUtilGetPropertyFormats"
    ((ptr void) @-> (ptr void) @-> uint32_t @-> (ptr uint32_t) @-> (ptr uint32_t) @-> returning uint32_t)
(* pPropertyTable : RESUTIL_PROPERTY_ITEM* -> (ptr void) *)
(* pOutPropertyFormatList : void* out -> (ptr void) *)
(* cbPropertyFormatListSize : DWORD -> uint32_t *)
(* pcbBytesReturned : DWORD* out -> (ptr uint32_t) *)
(* pcbRequired : DWORD* 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 ("ResUtilGetPropertyFormats" res-util-get-property-formats :convention :stdcall) :uint32
  (p-property-table :pointer)   ; RESUTIL_PROPERTY_ITEM*
  (p-out-property-format-list :pointer)   ; void* out
  (cb-property-format-list-size :uint32)   ; DWORD
  (pcb-bytes-returned :pointer)   ; DWORD* out
  (pcb-required :pointer))   ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ResUtilGetPropertyFormats = Win32::API::More->new('RESUTILS',
    'DWORD ResUtilGetPropertyFormats(LPVOID pPropertyTable, LPVOID pOutPropertyFormatList, DWORD cbPropertyFormatListSize, LPVOID pcbBytesReturned, LPVOID pcbRequired)');
# my $ret = $ResUtilGetPropertyFormats->Call($pPropertyTable, $pOutPropertyFormatList, $cbPropertyFormatListSize, $pcbBytesReturned, $pcbRequired);
# pPropertyTable : RESUTIL_PROPERTY_ITEM* -> LPVOID
# pOutPropertyFormatList : void* out -> LPVOID
# cbPropertyFormatListSize : DWORD -> DWORD
# pcbBytesReturned : DWORD* out -> LPVOID
# pcbRequired : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型