ホーム › Networking.Clustering › ResUtilFindFileTimeProperty
ResUtilFindFileTimeProperty
関数プロパティリストからFILETIMEプロパティを名前で検索する。
シグネチャ
// RESUTILS.dll
#include <windows.h>
DWORD ResUtilFindFileTimeProperty(
const void* pPropertyList,
DWORD cbPropertyListSize,
LPCWSTR pszPropertyName,
FILETIME* pftPropertyValue
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pPropertyList | void* | in | 検索対象のプロパティリストバッファーへのポインター。 |
| cbPropertyListSize | DWORD | in | プロパティリストの総バイト数。 |
| pszPropertyName | LPCWSTR | in | 検索するFILETIMEプロパティの名前。 |
| pftPropertyValue | FILETIME* | out | 見つかったFILETIME値を受け取る構造体へのポインター。 |
戻り値の型: DWORD
各言語での呼び出し定義
// RESUTILS.dll
#include <windows.h>
DWORD ResUtilFindFileTimeProperty(
const void* pPropertyList,
DWORD cbPropertyListSize,
LPCWSTR pszPropertyName,
FILETIME* pftPropertyValue
);[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ResUtilFindFileTimeProperty(
IntPtr pPropertyList, // void*
uint cbPropertyListSize, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName, // LPCWSTR
IntPtr pftPropertyValue // FILETIME* out
);<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilFindFileTimeProperty(
pPropertyList As IntPtr, ' void*
cbPropertyListSize As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> pszPropertyName As String, ' LPCWSTR
pftPropertyValue As IntPtr ' FILETIME* out
) As UInteger
End Function' pPropertyList : void*
' cbPropertyListSize : DWORD
' pszPropertyName : LPCWSTR
' pftPropertyValue : FILETIME* out
Declare PtrSafe Function ResUtilFindFileTimeProperty Lib "resutils" ( _
ByVal pPropertyList As LongPtr, _
ByVal cbPropertyListSize As Long, _
ByVal pszPropertyName As LongPtr, _
ByVal pftPropertyValue As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ResUtilFindFileTimeProperty = ctypes.windll.resutils.ResUtilFindFileTimeProperty
ResUtilFindFileTimeProperty.restype = wintypes.DWORD
ResUtilFindFileTimeProperty.argtypes = [
ctypes.POINTER(None), # pPropertyList : void*
wintypes.DWORD, # cbPropertyListSize : DWORD
wintypes.LPCWSTR, # pszPropertyName : LPCWSTR
ctypes.c_void_p, # pftPropertyValue : FILETIME* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RESUTILS.dll')
ResUtilFindFileTimeProperty = Fiddle::Function.new(
lib['ResUtilFindFileTimeProperty'],
[
Fiddle::TYPE_VOIDP, # pPropertyList : void*
-Fiddle::TYPE_INT, # cbPropertyListSize : DWORD
Fiddle::TYPE_VOIDP, # pszPropertyName : LPCWSTR
Fiddle::TYPE_VOIDP, # pftPropertyValue : FILETIME* out
],
-Fiddle::TYPE_INT)#[link(name = "resutils")]
extern "system" {
fn ResUtilFindFileTimeProperty(
pPropertyList: *const (), // void*
cbPropertyListSize: u32, // DWORD
pszPropertyName: *const u16, // LPCWSTR
pftPropertyValue: *mut FILETIME // FILETIME* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RESUTILS.dll")]
public static extern uint ResUtilFindFileTimeProperty(IntPtr pPropertyList, uint cbPropertyListSize, [MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName, IntPtr pftPropertyValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ResUtilFindFileTimeProperty' -Namespace Win32 -PassThru
# $api::ResUtilFindFileTimeProperty(pPropertyList, cbPropertyListSize, pszPropertyName, pftPropertyValue)#uselib "RESUTILS.dll"
#func global ResUtilFindFileTimeProperty "ResUtilFindFileTimeProperty" sptr, sptr, sptr, sptr
; ResUtilFindFileTimeProperty pPropertyList, cbPropertyListSize, pszPropertyName, varptr(pftPropertyValue) ; 戻り値は stat
; pPropertyList : void* -> "sptr"
; cbPropertyListSize : DWORD -> "sptr"
; pszPropertyName : LPCWSTR -> "sptr"
; pftPropertyValue : FILETIME* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RESUTILS.dll" #cfunc global ResUtilFindFileTimeProperty "ResUtilFindFileTimeProperty" sptr, int, wstr, var ; res = ResUtilFindFileTimeProperty(pPropertyList, cbPropertyListSize, pszPropertyName, pftPropertyValue) ; pPropertyList : void* -> "sptr" ; cbPropertyListSize : DWORD -> "int" ; pszPropertyName : LPCWSTR -> "wstr" ; pftPropertyValue : FILETIME* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RESUTILS.dll" #cfunc global ResUtilFindFileTimeProperty "ResUtilFindFileTimeProperty" sptr, int, wstr, sptr ; res = ResUtilFindFileTimeProperty(pPropertyList, cbPropertyListSize, pszPropertyName, varptr(pftPropertyValue)) ; pPropertyList : void* -> "sptr" ; cbPropertyListSize : DWORD -> "int" ; pszPropertyName : LPCWSTR -> "wstr" ; pftPropertyValue : FILETIME* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD ResUtilFindFileTimeProperty(void* pPropertyList, DWORD cbPropertyListSize, LPCWSTR pszPropertyName, FILETIME* pftPropertyValue) #uselib "RESUTILS.dll" #cfunc global ResUtilFindFileTimeProperty "ResUtilFindFileTimeProperty" intptr, int, wstr, var ; res = ResUtilFindFileTimeProperty(pPropertyList, cbPropertyListSize, pszPropertyName, pftPropertyValue) ; pPropertyList : void* -> "intptr" ; cbPropertyListSize : DWORD -> "int" ; pszPropertyName : LPCWSTR -> "wstr" ; pftPropertyValue : FILETIME* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD ResUtilFindFileTimeProperty(void* pPropertyList, DWORD cbPropertyListSize, LPCWSTR pszPropertyName, FILETIME* pftPropertyValue) #uselib "RESUTILS.dll" #cfunc global ResUtilFindFileTimeProperty "ResUtilFindFileTimeProperty" intptr, int, wstr, intptr ; res = ResUtilFindFileTimeProperty(pPropertyList, cbPropertyListSize, pszPropertyName, varptr(pftPropertyValue)) ; pPropertyList : void* -> "intptr" ; cbPropertyListSize : DWORD -> "int" ; pszPropertyName : LPCWSTR -> "wstr" ; pftPropertyValue : FILETIME* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
resutils = windows.NewLazySystemDLL("RESUTILS.dll")
procResUtilFindFileTimeProperty = resutils.NewProc("ResUtilFindFileTimeProperty")
)
// pPropertyList (void*), cbPropertyListSize (DWORD), pszPropertyName (LPCWSTR), pftPropertyValue (FILETIME* out)
r1, _, err := procResUtilFindFileTimeProperty.Call(
uintptr(pPropertyList),
uintptr(cbPropertyListSize),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPropertyName))),
uintptr(pftPropertyValue),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction ResUtilFindFileTimeProperty(
pPropertyList: Pointer; // void*
cbPropertyListSize: DWORD; // DWORD
pszPropertyName: PWideChar; // LPCWSTR
pftPropertyValue: Pointer // FILETIME* out
): DWORD; stdcall;
external 'RESUTILS.dll' name 'ResUtilFindFileTimeProperty';result := DllCall("RESUTILS\ResUtilFindFileTimeProperty"
, "Ptr", pPropertyList ; void*
, "UInt", cbPropertyListSize ; DWORD
, "WStr", pszPropertyName ; LPCWSTR
, "Ptr", pftPropertyValue ; FILETIME* out
, "UInt") ; return: DWORD●ResUtilFindFileTimeProperty(pPropertyList, cbPropertyListSize, pszPropertyName, pftPropertyValue) = DLL("RESUTILS.dll", "dword ResUtilFindFileTimeProperty(void*, dword, char*, void*)")
# 呼び出し: ResUtilFindFileTimeProperty(pPropertyList, cbPropertyListSize, pszPropertyName, pftPropertyValue)
# pPropertyList : void* -> "void*"
# cbPropertyListSize : DWORD -> "dword"
# pszPropertyName : LPCWSTR -> "char*"
# pftPropertyValue : FILETIME* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "resutils" fn ResUtilFindFileTimeProperty(
pPropertyList: ?*anyopaque, // void*
cbPropertyListSize: u32, // DWORD
pszPropertyName: [*c]const u16, // LPCWSTR
pftPropertyValue: [*c]FILETIME // FILETIME* out
) callconv(std.os.windows.WINAPI) u32;proc ResUtilFindFileTimeProperty(
pPropertyList: pointer, # void*
cbPropertyListSize: uint32, # DWORD
pszPropertyName: WideCString, # LPCWSTR
pftPropertyValue: ptr FILETIME # FILETIME* out
): uint32 {.importc: "ResUtilFindFileTimeProperty", stdcall, dynlib: "RESUTILS.dll".}pragma(lib, "resutils");
extern(Windows)
uint ResUtilFindFileTimeProperty(
void* pPropertyList, // void*
uint cbPropertyListSize, // DWORD
const(wchar)* pszPropertyName, // LPCWSTR
FILETIME* pftPropertyValue // FILETIME* out
);ccall((:ResUtilFindFileTimeProperty, "RESUTILS.dll"), stdcall, UInt32,
(Ptr{Cvoid}, UInt32, Cwstring, Ptr{FILETIME}),
pPropertyList, cbPropertyListSize, pszPropertyName, pftPropertyValue)
# pPropertyList : void* -> Ptr{Cvoid}
# cbPropertyListSize : DWORD -> UInt32
# pszPropertyName : LPCWSTR -> Cwstring
# pftPropertyValue : FILETIME* out -> Ptr{FILETIME}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t ResUtilFindFileTimeProperty(
void* pPropertyList,
uint32_t cbPropertyListSize,
const uint16_t* pszPropertyName,
void* pftPropertyValue);
]]
local resutils = ffi.load("resutils")
-- resutils.ResUtilFindFileTimeProperty(pPropertyList, cbPropertyListSize, pszPropertyName, pftPropertyValue)
-- pPropertyList : void*
-- cbPropertyListSize : DWORD
-- pszPropertyName : LPCWSTR
-- pftPropertyValue : FILETIME* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('RESUTILS.dll');
const ResUtilFindFileTimeProperty = lib.func('__stdcall', 'ResUtilFindFileTimeProperty', 'uint32_t', ['void *', 'uint32_t', 'str16', 'void *']);
// ResUtilFindFileTimeProperty(pPropertyList, cbPropertyListSize, pszPropertyName, pftPropertyValue)
// pPropertyList : void* -> 'void *'
// cbPropertyListSize : DWORD -> 'uint32_t'
// pszPropertyName : LPCWSTR -> 'str16'
// pftPropertyValue : FILETIME* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RESUTILS.dll", {
ResUtilFindFileTimeProperty: { parameters: ["pointer", "u32", "buffer", "pointer"], result: "u32" },
});
// lib.symbols.ResUtilFindFileTimeProperty(pPropertyList, cbPropertyListSize, pszPropertyName, pftPropertyValue)
// pPropertyList : void* -> "pointer"
// cbPropertyListSize : DWORD -> "u32"
// pszPropertyName : LPCWSTR -> "buffer"
// pftPropertyValue : FILETIME* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t ResUtilFindFileTimeProperty(
void* pPropertyList,
uint32_t cbPropertyListSize,
const uint16_t* pszPropertyName,
void* pftPropertyValue);
C, "RESUTILS.dll");
// $ffi->ResUtilFindFileTimeProperty(pPropertyList, cbPropertyListSize, pszPropertyName, pftPropertyValue);
// pPropertyList : void*
// cbPropertyListSize : DWORD
// pszPropertyName : LPCWSTR
// pftPropertyValue : FILETIME* 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 ResUtilFindFileTimeProperty(
Pointer pPropertyList, // void*
int cbPropertyListSize, // DWORD
WString pszPropertyName, // LPCWSTR
Pointer pftPropertyValue // FILETIME* out
);
}@[Link("resutils")]
lib LibRESUTILS
fun ResUtilFindFileTimeProperty = ResUtilFindFileTimeProperty(
pPropertyList : Void*, # void*
cbPropertyListSize : UInt32, # DWORD
pszPropertyName : UInt16*, # LPCWSTR
pftPropertyValue : FILETIME* # FILETIME* out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ResUtilFindFileTimePropertyNative = Uint32 Function(Pointer<Void>, Uint32, Pointer<Utf16>, Pointer<Void>);
typedef ResUtilFindFileTimePropertyDart = int Function(Pointer<Void>, int, Pointer<Utf16>, Pointer<Void>);
final ResUtilFindFileTimeProperty = DynamicLibrary.open('RESUTILS.dll')
.lookupFunction<ResUtilFindFileTimePropertyNative, ResUtilFindFileTimePropertyDart>('ResUtilFindFileTimeProperty');
// pPropertyList : void* -> Pointer<Void>
// cbPropertyListSize : DWORD -> Uint32
// pszPropertyName : LPCWSTR -> Pointer<Utf16>
// pftPropertyValue : FILETIME* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ResUtilFindFileTimeProperty(
pPropertyList: Pointer; // void*
cbPropertyListSize: DWORD; // DWORD
pszPropertyName: PWideChar; // LPCWSTR
pftPropertyValue: Pointer // FILETIME* out
): DWORD; stdcall;
external 'RESUTILS.dll' name 'ResUtilFindFileTimeProperty';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ResUtilFindFileTimeProperty"
c_ResUtilFindFileTimeProperty :: Ptr () -> Word32 -> CWString -> Ptr () -> IO Word32
-- pPropertyList : void* -> Ptr ()
-- cbPropertyListSize : DWORD -> Word32
-- pszPropertyName : LPCWSTR -> CWString
-- pftPropertyValue : FILETIME* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let resutilfindfiletimeproperty =
foreign "ResUtilFindFileTimeProperty"
((ptr void) @-> uint32_t @-> (ptr uint16_t) @-> (ptr void) @-> returning uint32_t)
(* pPropertyList : void* -> (ptr void) *)
(* cbPropertyListSize : DWORD -> uint32_t *)
(* pszPropertyName : LPCWSTR -> (ptr uint16_t) *)
(* pftPropertyValue : FILETIME* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library resutils (t "RESUTILS.dll"))
(cffi:use-foreign-library resutils)
(cffi:defcfun ("ResUtilFindFileTimeProperty" res-util-find-file-time-property :convention :stdcall) :uint32
(p-property-list :pointer) ; void*
(cb-property-list-size :uint32) ; DWORD
(psz-property-name (:string :encoding :utf-16le)) ; LPCWSTR
(pft-property-value :pointer)) ; FILETIME* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ResUtilFindFileTimeProperty = Win32::API::More->new('RESUTILS',
'DWORD ResUtilFindFileTimeProperty(LPVOID pPropertyList, DWORD cbPropertyListSize, LPCWSTR pszPropertyName, LPVOID pftPropertyValue)');
# my $ret = $ResUtilFindFileTimeProperty->Call($pPropertyList, $cbPropertyListSize, $pszPropertyName, $pftPropertyValue);
# pPropertyList : void* -> LPVOID
# cbPropertyListSize : DWORD -> DWORD
# pszPropertyName : LPCWSTR -> LPCWSTR
# pftPropertyValue : FILETIME* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型