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

ResUtilFindULargeIntegerProperty

関数
プロパティリストから符号なし64ビット整数プロパティを検索する。
DLLRESUTILS.dll呼出規約winapi対応OSwindowsserver2016

シグネチャ

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

DWORD ResUtilFindULargeIntegerProperty(
    const void* pPropertyList,
    DWORD cbPropertyListSize,
    LPCWSTR pszPropertyName,
    ULONGLONG* plPropertyValue
);

パラメーター

名前方向説明
pPropertyListvoid*in検索対象のプロパティリストバッファーへのポインター。
cbPropertyListSizeDWORDinプロパティリストの総バイト数。
pszPropertyNameLPCWSTRin検索する符号なし64ビット整数プロパティの名前。
plPropertyValueULONGLONG*out見つかったULONGLONG値を受け取る変数へのポインター。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD ResUtilFindULargeIntegerProperty(
    const void* pPropertyList,
    DWORD cbPropertyListSize,
    LPCWSTR pszPropertyName,
    ULONGLONG* plPropertyValue
);
[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ResUtilFindULargeIntegerProperty(
    IntPtr pPropertyList,   // void*
    uint cbPropertyListSize,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName,   // LPCWSTR
    out ulong plPropertyValue   // ULONGLONG* out
);
<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilFindULargeIntegerProperty(
    pPropertyList As IntPtr,   ' void*
    cbPropertyListSize As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> pszPropertyName As String,   ' LPCWSTR
    <Out> ByRef plPropertyValue As ULong   ' ULONGLONG* out
) As UInteger
End Function
' pPropertyList : void*
' cbPropertyListSize : DWORD
' pszPropertyName : LPCWSTR
' plPropertyValue : ULONGLONG* out
Declare PtrSafe Function ResUtilFindULargeIntegerProperty Lib "resutils" ( _
    ByVal pPropertyList As LongPtr, _
    ByVal cbPropertyListSize As Long, _
    ByVal pszPropertyName As LongPtr, _
    ByRef plPropertyValue As LongLong) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ResUtilFindULargeIntegerProperty = ctypes.windll.resutils.ResUtilFindULargeIntegerProperty
ResUtilFindULargeIntegerProperty.restype = wintypes.DWORD
ResUtilFindULargeIntegerProperty.argtypes = [
    ctypes.POINTER(None),  # pPropertyList : void*
    wintypes.DWORD,  # cbPropertyListSize : DWORD
    wintypes.LPCWSTR,  # pszPropertyName : LPCWSTR
    ctypes.POINTER(ctypes.c_ulonglong),  # plPropertyValue : ULONGLONG* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	resutils = windows.NewLazySystemDLL("RESUTILS.dll")
	procResUtilFindULargeIntegerProperty = resutils.NewProc("ResUtilFindULargeIntegerProperty")
)

// pPropertyList (void*), cbPropertyListSize (DWORD), pszPropertyName (LPCWSTR), plPropertyValue (ULONGLONG* out)
r1, _, err := procResUtilFindULargeIntegerProperty.Call(
	uintptr(pPropertyList),
	uintptr(cbPropertyListSize),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPropertyName))),
	uintptr(plPropertyValue),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ResUtilFindULargeIntegerProperty(
  pPropertyList: Pointer;   // void*
  cbPropertyListSize: DWORD;   // DWORD
  pszPropertyName: PWideChar;   // LPCWSTR
  plPropertyValue: Pointer   // ULONGLONG* out
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ResUtilFindULargeIntegerProperty';
result := DllCall("RESUTILS\ResUtilFindULargeIntegerProperty"
    , "Ptr", pPropertyList   ; void*
    , "UInt", cbPropertyListSize   ; DWORD
    , "WStr", pszPropertyName   ; LPCWSTR
    , "Ptr", plPropertyValue   ; ULONGLONG* out
    , "UInt")   ; return: DWORD
●ResUtilFindULargeIntegerProperty(pPropertyList, cbPropertyListSize, pszPropertyName, plPropertyValue) = DLL("RESUTILS.dll", "dword ResUtilFindULargeIntegerProperty(void*, dword, char*, void*)")
# 呼び出し: ResUtilFindULargeIntegerProperty(pPropertyList, cbPropertyListSize, pszPropertyName, plPropertyValue)
# pPropertyList : void* -> "void*"
# cbPropertyListSize : DWORD -> "dword"
# pszPropertyName : LPCWSTR -> "char*"
# plPropertyValue : ULONGLONG* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef ResUtilFindULargeIntegerPropertyNative = Uint32 Function(Pointer<Void>, Uint32, Pointer<Utf16>, Pointer<Uint64>);
typedef ResUtilFindULargeIntegerPropertyDart = int Function(Pointer<Void>, int, Pointer<Utf16>, Pointer<Uint64>);
final ResUtilFindULargeIntegerProperty = DynamicLibrary.open('RESUTILS.dll')
    .lookupFunction<ResUtilFindULargeIntegerPropertyNative, ResUtilFindULargeIntegerPropertyDart>('ResUtilFindULargeIntegerProperty');
// pPropertyList : void* -> Pointer<Void>
// cbPropertyListSize : DWORD -> Uint32
// pszPropertyName : LPCWSTR -> Pointer<Utf16>
// plPropertyValue : ULONGLONG* out -> Pointer<Uint64>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ResUtilFindULargeIntegerProperty(
  pPropertyList: Pointer;   // void*
  cbPropertyListSize: DWORD;   // DWORD
  pszPropertyName: PWideChar;   // LPCWSTR
  plPropertyValue: Pointer   // ULONGLONG* out
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ResUtilFindULargeIntegerProperty';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ResUtilFindULargeIntegerProperty"
  c_ResUtilFindULargeIntegerProperty :: Ptr () -> Word32 -> CWString -> Ptr Word64 -> IO Word32
-- pPropertyList : void* -> Ptr ()
-- cbPropertyListSize : DWORD -> Word32
-- pszPropertyName : LPCWSTR -> CWString
-- plPropertyValue : ULONGLONG* out -> Ptr Word64
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let resutilfindulargeintegerproperty =
  foreign "ResUtilFindULargeIntegerProperty"
    ((ptr void) @-> uint32_t @-> (ptr uint16_t) @-> (ptr uint64_t) @-> returning uint32_t)
(* pPropertyList : void* -> (ptr void) *)
(* cbPropertyListSize : DWORD -> uint32_t *)
(* pszPropertyName : LPCWSTR -> (ptr uint16_t) *)
(* plPropertyValue : ULONGLONG* out -> (ptr uint64_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library resutils (t "RESUTILS.dll"))
(cffi:use-foreign-library resutils)

(cffi:defcfun ("ResUtilFindULargeIntegerProperty" res-util-find-ularge-integer-property :convention :stdcall) :uint32
  (p-property-list :pointer)   ; void*
  (cb-property-list-size :uint32)   ; DWORD
  (psz-property-name (:string :encoding :utf-16le))   ; LPCWSTR
  (pl-property-value :pointer))   ; ULONGLONG* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ResUtilFindULargeIntegerProperty = Win32::API::More->new('RESUTILS',
    'DWORD ResUtilFindULargeIntegerProperty(LPVOID pPropertyList, DWORD cbPropertyListSize, LPCWSTR pszPropertyName, LPVOID plPropertyValue)');
# my $ret = $ResUtilFindULargeIntegerProperty->Call($pPropertyList, $cbPropertyListSize, $pszPropertyName, $plPropertyValue);
# pPropertyList : void* -> LPVOID
# cbPropertyListSize : DWORD -> DWORD
# pszPropertyName : LPCWSTR -> LPCWSTR
# plPropertyValue : ULONGLONG* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。