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