ホーム › Devices.Sensors › PropVariantGetInformation
PropVariantGetInformation
関数PROPVARIANTの型やサイズ、データ位置などの情報を取得する。
シグネチャ
// SensorsUtilsV2.dll
#include <windows.h>
NTSTATUS PropVariantGetInformation(
const PROPVARIANT* PropVariantValue,
DWORD* PropVariantOffset, // optional
DWORD* PropVariantSize, // optional
void** PropVariantPointer, // optional
DEVPROPTYPE* RemappedType // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| PropVariantValue | PROPVARIANT* | in |
| PropVariantOffset | DWORD* | outoptional |
| PropVariantSize | DWORD* | outoptional |
| PropVariantPointer | void** | outoptional |
| RemappedType | DEVPROPTYPE* | outoptional |
戻り値の型: NTSTATUS
各言語での呼び出し定義
// SensorsUtilsV2.dll
#include <windows.h>
NTSTATUS PropVariantGetInformation(
const PROPVARIANT* PropVariantValue,
DWORD* PropVariantOffset, // optional
DWORD* PropVariantSize, // optional
void** PropVariantPointer, // optional
DEVPROPTYPE* RemappedType // optional
);[DllImport("SensorsUtilsV2.dll", ExactSpelling = true)]
static extern int PropVariantGetInformation(
IntPtr PropVariantValue, // PROPVARIANT*
IntPtr PropVariantOffset, // DWORD* optional, out
IntPtr PropVariantSize, // DWORD* optional, out
IntPtr PropVariantPointer, // void** optional, out
IntPtr RemappedType // DEVPROPTYPE* optional, out
);<DllImport("SensorsUtilsV2.dll", ExactSpelling:=True)>
Public Shared Function PropVariantGetInformation(
PropVariantValue As IntPtr, ' PROPVARIANT*
PropVariantOffset As IntPtr, ' DWORD* optional, out
PropVariantSize As IntPtr, ' DWORD* optional, out
PropVariantPointer As IntPtr, ' void** optional, out
RemappedType As IntPtr ' DEVPROPTYPE* optional, out
) As Integer
End Function' PropVariantValue : PROPVARIANT*
' PropVariantOffset : DWORD* optional, out
' PropVariantSize : DWORD* optional, out
' PropVariantPointer : void** optional, out
' RemappedType : DEVPROPTYPE* optional, out
Declare PtrSafe Function PropVariantGetInformation Lib "sensorsutilsv2" ( _
ByVal PropVariantValue As LongPtr, _
ByVal PropVariantOffset As LongPtr, _
ByVal PropVariantSize As LongPtr, _
ByVal PropVariantPointer As LongPtr, _
ByVal RemappedType As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PropVariantGetInformation = ctypes.windll.sensorsutilsv2.PropVariantGetInformation
PropVariantGetInformation.restype = ctypes.c_int
PropVariantGetInformation.argtypes = [
ctypes.c_void_p, # PropVariantValue : PROPVARIANT*
ctypes.POINTER(wintypes.DWORD), # PropVariantOffset : DWORD* optional, out
ctypes.POINTER(wintypes.DWORD), # PropVariantSize : DWORD* optional, out
ctypes.c_void_p, # PropVariantPointer : void** optional, out
ctypes.c_void_p, # RemappedType : DEVPROPTYPE* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SensorsUtilsV2.dll')
PropVariantGetInformation = Fiddle::Function.new(
lib['PropVariantGetInformation'],
[
Fiddle::TYPE_VOIDP, # PropVariantValue : PROPVARIANT*
Fiddle::TYPE_VOIDP, # PropVariantOffset : DWORD* optional, out
Fiddle::TYPE_VOIDP, # PropVariantSize : DWORD* optional, out
Fiddle::TYPE_VOIDP, # PropVariantPointer : void** optional, out
Fiddle::TYPE_VOIDP, # RemappedType : DEVPROPTYPE* optional, out
],
Fiddle::TYPE_INT)#[link(name = "sensorsutilsv2")]
extern "system" {
fn PropVariantGetInformation(
PropVariantValue: *const PROPVARIANT, // PROPVARIANT*
PropVariantOffset: *mut u32, // DWORD* optional, out
PropVariantSize: *mut u32, // DWORD* optional, out
PropVariantPointer: *mut *mut (), // void** optional, out
RemappedType: *mut u32 // DEVPROPTYPE* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SensorsUtilsV2.dll")]
public static extern int PropVariantGetInformation(IntPtr PropVariantValue, IntPtr PropVariantOffset, IntPtr PropVariantSize, IntPtr PropVariantPointer, IntPtr RemappedType);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SensorsUtilsV2_PropVariantGetInformation' -Namespace Win32 -PassThru
# $api::PropVariantGetInformation(PropVariantValue, PropVariantOffset, PropVariantSize, PropVariantPointer, RemappedType)#uselib "SensorsUtilsV2.dll"
#func global PropVariantGetInformation "PropVariantGetInformation" sptr, sptr, sptr, sptr, sptr
; PropVariantGetInformation varptr(PropVariantValue), varptr(PropVariantOffset), varptr(PropVariantSize), PropVariantPointer, RemappedType ; 戻り値は stat
; PropVariantValue : PROPVARIANT* -> "sptr"
; PropVariantOffset : DWORD* optional, out -> "sptr"
; PropVariantSize : DWORD* optional, out -> "sptr"
; PropVariantPointer : void** optional, out -> "sptr"
; RemappedType : DEVPROPTYPE* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SensorsUtilsV2.dll" #cfunc global PropVariantGetInformation "PropVariantGetInformation" var, var, var, sptr, int ; res = PropVariantGetInformation(PropVariantValue, PropVariantOffset, PropVariantSize, PropVariantPointer, RemappedType) ; PropVariantValue : PROPVARIANT* -> "var" ; PropVariantOffset : DWORD* optional, out -> "var" ; PropVariantSize : DWORD* optional, out -> "var" ; PropVariantPointer : void** optional, out -> "sptr" ; RemappedType : DEVPROPTYPE* optional, out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SensorsUtilsV2.dll" #cfunc global PropVariantGetInformation "PropVariantGetInformation" sptr, sptr, sptr, sptr, int ; res = PropVariantGetInformation(varptr(PropVariantValue), varptr(PropVariantOffset), varptr(PropVariantSize), PropVariantPointer, RemappedType) ; PropVariantValue : PROPVARIANT* -> "sptr" ; PropVariantOffset : DWORD* optional, out -> "sptr" ; PropVariantSize : DWORD* optional, out -> "sptr" ; PropVariantPointer : void** optional, out -> "sptr" ; RemappedType : DEVPROPTYPE* optional, out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; NTSTATUS PropVariantGetInformation(PROPVARIANT* PropVariantValue, DWORD* PropVariantOffset, DWORD* PropVariantSize, void** PropVariantPointer, DEVPROPTYPE* RemappedType) #uselib "SensorsUtilsV2.dll" #cfunc global PropVariantGetInformation "PropVariantGetInformation" var, var, var, intptr, int ; res = PropVariantGetInformation(PropVariantValue, PropVariantOffset, PropVariantSize, PropVariantPointer, RemappedType) ; PropVariantValue : PROPVARIANT* -> "var" ; PropVariantOffset : DWORD* optional, out -> "var" ; PropVariantSize : DWORD* optional, out -> "var" ; PropVariantPointer : void** optional, out -> "intptr" ; RemappedType : DEVPROPTYPE* optional, out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; NTSTATUS PropVariantGetInformation(PROPVARIANT* PropVariantValue, DWORD* PropVariantOffset, DWORD* PropVariantSize, void** PropVariantPointer, DEVPROPTYPE* RemappedType) #uselib "SensorsUtilsV2.dll" #cfunc global PropVariantGetInformation "PropVariantGetInformation" intptr, intptr, intptr, intptr, int ; res = PropVariantGetInformation(varptr(PropVariantValue), varptr(PropVariantOffset), varptr(PropVariantSize), PropVariantPointer, RemappedType) ; PropVariantValue : PROPVARIANT* -> "intptr" ; PropVariantOffset : DWORD* optional, out -> "intptr" ; PropVariantSize : DWORD* optional, out -> "intptr" ; PropVariantPointer : void** optional, out -> "intptr" ; RemappedType : DEVPROPTYPE* optional, out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
sensorsutilsv2 = windows.NewLazySystemDLL("SensorsUtilsV2.dll")
procPropVariantGetInformation = sensorsutilsv2.NewProc("PropVariantGetInformation")
)
// PropVariantValue (PROPVARIANT*), PropVariantOffset (DWORD* optional, out), PropVariantSize (DWORD* optional, out), PropVariantPointer (void** optional, out), RemappedType (DEVPROPTYPE* optional, out)
r1, _, err := procPropVariantGetInformation.Call(
uintptr(PropVariantValue),
uintptr(PropVariantOffset),
uintptr(PropVariantSize),
uintptr(PropVariantPointer),
uintptr(RemappedType),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // NTSTATUSfunction PropVariantGetInformation(
PropVariantValue: Pointer; // PROPVARIANT*
PropVariantOffset: Pointer; // DWORD* optional, out
PropVariantSize: Pointer; // DWORD* optional, out
PropVariantPointer: Pointer; // void** optional, out
RemappedType: Pointer // DEVPROPTYPE* optional, out
): Integer; stdcall;
external 'SensorsUtilsV2.dll' name 'PropVariantGetInformation';result := DllCall("SensorsUtilsV2\PropVariantGetInformation"
, "Ptr", PropVariantValue ; PROPVARIANT*
, "Ptr", PropVariantOffset ; DWORD* optional, out
, "Ptr", PropVariantSize ; DWORD* optional, out
, "Ptr", PropVariantPointer ; void** optional, out
, "Ptr", RemappedType ; DEVPROPTYPE* optional, out
, "Int") ; return: NTSTATUS●PropVariantGetInformation(PropVariantValue, PropVariantOffset, PropVariantSize, PropVariantPointer, RemappedType) = DLL("SensorsUtilsV2.dll", "int PropVariantGetInformation(void*, void*, void*, void*, void*)")
# 呼び出し: PropVariantGetInformation(PropVariantValue, PropVariantOffset, PropVariantSize, PropVariantPointer, RemappedType)
# PropVariantValue : PROPVARIANT* -> "void*"
# PropVariantOffset : DWORD* optional, out -> "void*"
# PropVariantSize : DWORD* optional, out -> "void*"
# PropVariantPointer : void** optional, out -> "void*"
# RemappedType : DEVPROPTYPE* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。