ホーム › Devices.DeviceAndDriverInstallation › SetupWriteTextLogInfLine
SetupWriteTextLogInfLine
関数INFファイルの該当行内容をテキストログに書き込む。
シグネチャ
// SETUPAPI.dll
#include <windows.h>
void SetupWriteTextLogInfLine(
ULONGLONG LogToken,
DWORD Flags,
void* InfHandle,
INFCONTEXT* Context
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| LogToken | ULONGLONG | in |
| Flags | DWORD | in |
| InfHandle | void* | in |
| Context | INFCONTEXT* | in |
戻り値の型: void
各言語での呼び出し定義
// SETUPAPI.dll
#include <windows.h>
void SetupWriteTextLogInfLine(
ULONGLONG LogToken,
DWORD Flags,
void* InfHandle,
INFCONTEXT* Context
);[DllImport("SETUPAPI.dll", ExactSpelling = true)]
static extern void SetupWriteTextLogInfLine(
ulong LogToken, // ULONGLONG
uint Flags, // DWORD
IntPtr InfHandle, // void*
IntPtr Context // INFCONTEXT*
);<DllImport("SETUPAPI.dll", ExactSpelling:=True)>
Public Shared Sub SetupWriteTextLogInfLine(
LogToken As ULong, ' ULONGLONG
Flags As UInteger, ' DWORD
InfHandle As IntPtr, ' void*
Context As IntPtr ' INFCONTEXT*
)
End Sub' LogToken : ULONGLONG
' Flags : DWORD
' InfHandle : void*
' Context : INFCONTEXT*
Declare PtrSafe Sub SetupWriteTextLogInfLine Lib "setupapi" ( _
ByVal LogToken As LongLong, _
ByVal Flags As Long, _
ByVal InfHandle As LongPtr, _
ByVal Context As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetupWriteTextLogInfLine = ctypes.windll.setupapi.SetupWriteTextLogInfLine
SetupWriteTextLogInfLine.restype = None
SetupWriteTextLogInfLine.argtypes = [
ctypes.c_ulonglong, # LogToken : ULONGLONG
wintypes.DWORD, # Flags : DWORD
ctypes.POINTER(None), # InfHandle : void*
ctypes.c_void_p, # Context : INFCONTEXT*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupWriteTextLogInfLine = Fiddle::Function.new(
lib['SetupWriteTextLogInfLine'],
[
-Fiddle::TYPE_LONG_LONG, # LogToken : ULONGLONG
-Fiddle::TYPE_INT, # Flags : DWORD
Fiddle::TYPE_VOIDP, # InfHandle : void*
Fiddle::TYPE_VOIDP, # Context : INFCONTEXT*
],
Fiddle::TYPE_VOID)#[link(name = "setupapi")]
extern "system" {
fn SetupWriteTextLogInfLine(
LogToken: u64, // ULONGLONG
Flags: u32, // DWORD
InfHandle: *mut (), // void*
Context: *mut INFCONTEXT // INFCONTEXT*
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SETUPAPI.dll")]
public static extern void SetupWriteTextLogInfLine(ulong LogToken, uint Flags, IntPtr InfHandle, IntPtr Context);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupWriteTextLogInfLine' -Namespace Win32 -PassThru
# $api::SetupWriteTextLogInfLine(LogToken, Flags, InfHandle, Context)#uselib "SETUPAPI.dll"
#func global SetupWriteTextLogInfLine "SetupWriteTextLogInfLine" sptr, sptr, sptr, sptr
; SetupWriteTextLogInfLine LogToken, Flags, InfHandle, varptr(Context)
; LogToken : ULONGLONG -> "sptr"
; Flags : DWORD -> "sptr"
; InfHandle : void* -> "sptr"
; Context : INFCONTEXT* -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。出力引数:
#uselib "SETUPAPI.dll" #func global SetupWriteTextLogInfLine "SetupWriteTextLogInfLine" int64, int, sptr, var ; SetupWriteTextLogInfLine LogToken, Flags, InfHandle, Context ; LogToken : ULONGLONG -> "int64" ; Flags : DWORD -> "int" ; InfHandle : void* -> "sptr" ; Context : INFCONTEXT* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。#uselib "SETUPAPI.dll" #func global SetupWriteTextLogInfLine "SetupWriteTextLogInfLine" int64, int, sptr, sptr ; SetupWriteTextLogInfLine LogToken, Flags, InfHandle, varptr(Context) ; LogToken : ULONGLONG -> "int64" ; Flags : DWORD -> "int" ; InfHandle : void* -> "sptr" ; Context : INFCONTEXT* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; void SetupWriteTextLogInfLine(ULONGLONG LogToken, DWORD Flags, void* InfHandle, INFCONTEXT* Context) #uselib "SETUPAPI.dll" #func global SetupWriteTextLogInfLine "SetupWriteTextLogInfLine" int64, int, intptr, var ; SetupWriteTextLogInfLine LogToken, Flags, InfHandle, Context ; LogToken : ULONGLONG -> "int64" ; Flags : DWORD -> "int" ; InfHandle : void* -> "intptr" ; Context : INFCONTEXT* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void SetupWriteTextLogInfLine(ULONGLONG LogToken, DWORD Flags, void* InfHandle, INFCONTEXT* Context) #uselib "SETUPAPI.dll" #func global SetupWriteTextLogInfLine "SetupWriteTextLogInfLine" int64, int, intptr, intptr ; SetupWriteTextLogInfLine LogToken, Flags, InfHandle, varptr(Context) ; LogToken : ULONGLONG -> "int64" ; Flags : DWORD -> "int" ; InfHandle : void* -> "intptr" ; Context : INFCONTEXT* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupWriteTextLogInfLine = setupapi.NewProc("SetupWriteTextLogInfLine")
)
// LogToken (ULONGLONG), Flags (DWORD), InfHandle (void*), Context (INFCONTEXT*)
r1, _, err := procSetupWriteTextLogInfLine.Call(
uintptr(LogToken),
uintptr(Flags),
uintptr(InfHandle),
uintptr(Context),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure SetupWriteTextLogInfLine(
LogToken: UInt64; // ULONGLONG
Flags: DWORD; // DWORD
InfHandle: Pointer; // void*
Context: Pointer // INFCONTEXT*
); stdcall;
external 'SETUPAPI.dll' name 'SetupWriteTextLogInfLine';result := DllCall("SETUPAPI\SetupWriteTextLogInfLine"
, "Int64", LogToken ; ULONGLONG
, "UInt", Flags ; DWORD
, "Ptr", InfHandle ; void*
, "Ptr", Context ; INFCONTEXT*
, "Int") ; return: void●SetupWriteTextLogInfLine(LogToken, Flags, InfHandle, Context) = DLL("SETUPAPI.dll", "int SetupWriteTextLogInfLine(qword, dword, void*, void*)")
# 呼び出し: SetupWriteTextLogInfLine(LogToken, Flags, InfHandle, Context)
# LogToken : ULONGLONG -> "qword"
# Flags : DWORD -> "dword"
# InfHandle : void* -> "void*"
# Context : INFCONTEXT* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。