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