Win32 API 日本語リファレンス
ホームSystem.TpmBaseServices › Tbsi_GetDeviceInfo

Tbsi_GetDeviceInfo

関数
TPMデバイスの情報を取得する。
DLLtbs.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD Tbsi_GetDeviceInfo(
    DWORD Size,
    void* Info
);

パラメーター

名前方向
SizeDWORDin
Infovoid*out

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD Tbsi_GetDeviceInfo(
    DWORD Size,
    void* Info
);
[DllImport("tbs.dll", ExactSpelling = true)]
static extern uint Tbsi_GetDeviceInfo(
    uint Size,   // DWORD
    IntPtr Info   // void* out
);
<DllImport("tbs.dll", ExactSpelling:=True)>
Public Shared Function Tbsi_GetDeviceInfo(
    Size As UInteger,   ' DWORD
    Info As IntPtr   ' void* out
) As UInteger
End Function
' Size : DWORD
' Info : void* out
Declare PtrSafe Function Tbsi_GetDeviceInfo Lib "tbs" ( _
    ByVal Size As Long, _
    ByVal Info As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

Tbsi_GetDeviceInfo = ctypes.windll.tbs.Tbsi_GetDeviceInfo
Tbsi_GetDeviceInfo.restype = wintypes.DWORD
Tbsi_GetDeviceInfo.argtypes = [
    wintypes.DWORD,  # Size : DWORD
    ctypes.POINTER(None),  # Info : void* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('tbs.dll')
Tbsi_GetDeviceInfo = Fiddle::Function.new(
  lib['Tbsi_GetDeviceInfo'],
  [
    -Fiddle::TYPE_INT,  # Size : DWORD
    Fiddle::TYPE_VOIDP,  # Info : void* out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "tbs")]
extern "system" {
    fn Tbsi_GetDeviceInfo(
        Size: u32,  // DWORD
        Info: *mut ()  // void* out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("tbs.dll")]
public static extern uint Tbsi_GetDeviceInfo(uint Size, IntPtr Info);
"@
$api = Add-Type -MemberDefinition $sig -Name 'tbs_Tbsi_GetDeviceInfo' -Namespace Win32 -PassThru
# $api::Tbsi_GetDeviceInfo(Size, Info)
#uselib "tbs.dll"
#func global Tbsi_GetDeviceInfo "Tbsi_GetDeviceInfo" sptr, sptr
; Tbsi_GetDeviceInfo Size, Info   ; 戻り値は stat
; Size : DWORD -> "sptr"
; Info : void* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "tbs.dll"
#cfunc global Tbsi_GetDeviceInfo "Tbsi_GetDeviceInfo" int, sptr
; res = Tbsi_GetDeviceInfo(Size, Info)
; Size : DWORD -> "int"
; Info : void* out -> "sptr"
; DWORD Tbsi_GetDeviceInfo(DWORD Size, void* Info)
#uselib "tbs.dll"
#cfunc global Tbsi_GetDeviceInfo "Tbsi_GetDeviceInfo" int, intptr
; res = Tbsi_GetDeviceInfo(Size, Info)
; Size : DWORD -> "int"
; Info : void* out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	tbs = windows.NewLazySystemDLL("tbs.dll")
	procTbsi_GetDeviceInfo = tbs.NewProc("Tbsi_GetDeviceInfo")
)

// Size (DWORD), Info (void* out)
r1, _, err := procTbsi_GetDeviceInfo.Call(
	uintptr(Size),
	uintptr(Info),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function Tbsi_GetDeviceInfo(
  Size: DWORD;   // DWORD
  Info: Pointer   // void* out
): DWORD; stdcall;
  external 'tbs.dll' name 'Tbsi_GetDeviceInfo';
result := DllCall("tbs\Tbsi_GetDeviceInfo"
    , "UInt", Size   ; DWORD
    , "Ptr", Info   ; void* out
    , "UInt")   ; return: DWORD
●Tbsi_GetDeviceInfo(Size, Info) = DLL("tbs.dll", "dword Tbsi_GetDeviceInfo(dword, void*)")
# 呼び出し: Tbsi_GetDeviceInfo(Size, Info)
# Size : DWORD -> "dword"
# Info : void* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。