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

ResUtilGetLongProperty

関数
範囲チェック付きでLONGプロパティ値を取得する。
DLLRESUTILS.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD ResUtilGetLongProperty(
    INT* plOutValue,
    const CLUSPROP_LONG* pValueStruct,
    INT lOldValue,
    INT lMinimum,
    INT lMaximum,
    BYTE** ppPropertyList,
    DWORD* pcbPropertyListSize
);

パラメーター

名前方向説明
plOutValueINT*inout取得したLONG(符号付き32ビット)値を受け取る変数へのポインター。
pValueStructCLUSPROP_LONG*inプロパティリスト内のLONG値構造体(CLUSPROP_LONG)へのポインター。
lOldValueINTinプロパティが存在しない場合に用いる既定のLONG値。
lMinimumINTin許容される値の下限。これ未満は範囲外として扱われる。
lMaximumINTin許容される値の上限。これを超える値は範囲外として扱われる。
ppPropertyListBYTE**inout解析対象のプロパティリスト先頭へのポインターのアドレス。解析後に位置が進む。
pcbPropertyListSizeDWORD*inout残りプロパティリストのバイト数を受け取る変数へのポインター。解析に伴い減少する。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD ResUtilGetLongProperty(
    INT* plOutValue,
    const CLUSPROP_LONG* pValueStruct,
    INT lOldValue,
    INT lMinimum,
    INT lMaximum,
    BYTE** ppPropertyList,
    DWORD* pcbPropertyListSize
);
[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ResUtilGetLongProperty(
    ref int plOutValue,   // INT* in/out
    IntPtr pValueStruct,   // CLUSPROP_LONG*
    int lOldValue,   // INT
    int lMinimum,   // INT
    int lMaximum,   // INT
    IntPtr ppPropertyList,   // BYTE** in/out
    ref uint pcbPropertyListSize   // DWORD* in/out
);
<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilGetLongProperty(
    ByRef plOutValue As Integer,   ' INT* in/out
    pValueStruct As IntPtr,   ' CLUSPROP_LONG*
    lOldValue As Integer,   ' INT
    lMinimum As Integer,   ' INT
    lMaximum As Integer,   ' INT
    ppPropertyList As IntPtr,   ' BYTE** in/out
    ByRef pcbPropertyListSize As UInteger   ' DWORD* in/out
) As UInteger
End Function
' plOutValue : INT* in/out
' pValueStruct : CLUSPROP_LONG*
' lOldValue : INT
' lMinimum : INT
' lMaximum : INT
' ppPropertyList : BYTE** in/out
' pcbPropertyListSize : DWORD* in/out
Declare PtrSafe Function ResUtilGetLongProperty Lib "resutils" ( _
    ByRef plOutValue As Long, _
    ByVal pValueStruct As LongPtr, _
    ByVal lOldValue As Long, _
    ByVal lMinimum As Long, _
    ByVal lMaximum As Long, _
    ByVal ppPropertyList As LongPtr, _
    ByRef pcbPropertyListSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ResUtilGetLongProperty = ctypes.windll.resutils.ResUtilGetLongProperty
ResUtilGetLongProperty.restype = wintypes.DWORD
ResUtilGetLongProperty.argtypes = [
    ctypes.POINTER(ctypes.c_int),  # plOutValue : INT* in/out
    ctypes.c_void_p,  # pValueStruct : CLUSPROP_LONG*
    ctypes.c_int,  # lOldValue : INT
    ctypes.c_int,  # lMinimum : INT
    ctypes.c_int,  # lMaximum : INT
    ctypes.c_void_p,  # ppPropertyList : BYTE** in/out
    ctypes.POINTER(wintypes.DWORD),  # pcbPropertyListSize : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	resutils = windows.NewLazySystemDLL("RESUTILS.dll")
	procResUtilGetLongProperty = resutils.NewProc("ResUtilGetLongProperty")
)

// plOutValue (INT* in/out), pValueStruct (CLUSPROP_LONG*), lOldValue (INT), lMinimum (INT), lMaximum (INT), ppPropertyList (BYTE** in/out), pcbPropertyListSize (DWORD* in/out)
r1, _, err := procResUtilGetLongProperty.Call(
	uintptr(plOutValue),
	uintptr(pValueStruct),
	uintptr(lOldValue),
	uintptr(lMinimum),
	uintptr(lMaximum),
	uintptr(ppPropertyList),
	uintptr(pcbPropertyListSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ResUtilGetLongProperty(
  plOutValue: Pointer;   // INT* in/out
  pValueStruct: Pointer;   // CLUSPROP_LONG*
  lOldValue: Integer;   // INT
  lMinimum: Integer;   // INT
  lMaximum: Integer;   // INT
  ppPropertyList: Pointer;   // BYTE** in/out
  pcbPropertyListSize: Pointer   // DWORD* in/out
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ResUtilGetLongProperty';
result := DllCall("RESUTILS\ResUtilGetLongProperty"
    , "Ptr", plOutValue   ; INT* in/out
    , "Ptr", pValueStruct   ; CLUSPROP_LONG*
    , "Int", lOldValue   ; INT
    , "Int", lMinimum   ; INT
    , "Int", lMaximum   ; INT
    , "Ptr", ppPropertyList   ; BYTE** in/out
    , "Ptr", pcbPropertyListSize   ; DWORD* in/out
    , "UInt")   ; return: DWORD
●ResUtilGetLongProperty(plOutValue, pValueStruct, lOldValue, lMinimum, lMaximum, ppPropertyList, pcbPropertyListSize) = DLL("RESUTILS.dll", "dword ResUtilGetLongProperty(void*, void*, int, int, int, void*, void*)")
# 呼び出し: ResUtilGetLongProperty(plOutValue, pValueStruct, lOldValue, lMinimum, lMaximum, ppPropertyList, pcbPropertyListSize)
# plOutValue : INT* in/out -> "void*"
# pValueStruct : CLUSPROP_LONG* -> "void*"
# lOldValue : INT -> "int"
# lMinimum : INT -> "int"
# lMaximum : INT -> "int"
# ppPropertyList : BYTE** in/out -> "void*"
# pcbPropertyListSize : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef ResUtilGetLongPropertyNative = Uint32 Function(Pointer<Int32>, Pointer<Void>, Int32, Int32, Int32, Pointer<Uint8>, Pointer<Uint32>);
typedef ResUtilGetLongPropertyDart = int Function(Pointer<Int32>, Pointer<Void>, int, int, int, Pointer<Uint8>, Pointer<Uint32>);
final ResUtilGetLongProperty = DynamicLibrary.open('RESUTILS.dll')
    .lookupFunction<ResUtilGetLongPropertyNative, ResUtilGetLongPropertyDart>('ResUtilGetLongProperty');
// plOutValue : INT* in/out -> Pointer<Int32>
// pValueStruct : CLUSPROP_LONG* -> Pointer<Void>
// lOldValue : INT -> Int32
// lMinimum : INT -> Int32
// lMaximum : INT -> Int32
// ppPropertyList : BYTE** in/out -> Pointer<Uint8>
// pcbPropertyListSize : DWORD* in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ResUtilGetLongProperty(
  plOutValue: Pointer;   // INT* in/out
  pValueStruct: Pointer;   // CLUSPROP_LONG*
  lOldValue: Integer;   // INT
  lMinimum: Integer;   // INT
  lMaximum: Integer;   // INT
  ppPropertyList: Pointer;   // BYTE** in/out
  pcbPropertyListSize: Pointer   // DWORD* in/out
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ResUtilGetLongProperty';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ResUtilGetLongProperty"
  c_ResUtilGetLongProperty :: Ptr Int32 -> Ptr () -> Int32 -> Int32 -> Int32 -> Ptr Word8 -> Ptr Word32 -> IO Word32
-- plOutValue : INT* in/out -> Ptr Int32
-- pValueStruct : CLUSPROP_LONG* -> Ptr ()
-- lOldValue : INT -> Int32
-- lMinimum : INT -> Int32
-- lMaximum : INT -> Int32
-- ppPropertyList : BYTE** in/out -> Ptr Word8
-- pcbPropertyListSize : DWORD* in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let resutilgetlongproperty =
  foreign "ResUtilGetLongProperty"
    ((ptr int32_t) @-> (ptr void) @-> int32_t @-> int32_t @-> int32_t @-> (ptr uint8_t) @-> (ptr uint32_t) @-> returning uint32_t)
(* plOutValue : INT* in/out -> (ptr int32_t) *)
(* pValueStruct : CLUSPROP_LONG* -> (ptr void) *)
(* lOldValue : INT -> int32_t *)
(* lMinimum : INT -> int32_t *)
(* lMaximum : INT -> int32_t *)
(* ppPropertyList : BYTE** in/out -> (ptr uint8_t) *)
(* pcbPropertyListSize : DWORD* in/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 ("ResUtilGetLongProperty" res-util-get-long-property :convention :stdcall) :uint32
  (pl-out-value :pointer)   ; INT* in/out
  (p-value-struct :pointer)   ; CLUSPROP_LONG*
  (l-old-value :int32)   ; INT
  (l-minimum :int32)   ; INT
  (l-maximum :int32)   ; INT
  (pp-property-list :pointer)   ; BYTE** in/out
  (pcb-property-list-size :pointer))   ; DWORD* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ResUtilGetLongProperty = Win32::API::More->new('RESUTILS',
    'DWORD ResUtilGetLongProperty(LPVOID plOutValue, LPVOID pValueStruct, int lOldValue, int lMinimum, int lMaximum, LPVOID ppPropertyList, LPVOID pcbPropertyListSize)');
# my $ret = $ResUtilGetLongProperty->Call($plOutValue, $pValueStruct, $lOldValue, $lMinimum, $lMaximum, $ppPropertyList, $pcbPropertyListSize);
# plOutValue : INT* in/out -> LPVOID
# pValueStruct : CLUSPROP_LONG* -> LPVOID
# lOldValue : INT -> int
# lMinimum : INT -> int
# lMaximum : INT -> int
# ppPropertyList : BYTE** in/out -> LPVOID
# pcbPropertyListSize : DWORD* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型