Win32 API 日本語リファレンス
ホームDevices.DeviceAndDriverInstallation › SetupLogFileA

SetupLogFileA

関数
コピーしたファイルの情報をセットアップファイルログに記録する。
DLLSETUPAPI.dll文字セットANSI (-A)呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

// SETUPAPI.dll  (ANSI / -A)
#include <windows.h>

BOOL SetupLogFileA(
    void* FileLogHandle,
    LPCSTR LogSectionName,   // optional
    LPCSTR SourceFilename,
    LPCSTR TargetFilename,
    DWORD Checksum,
    LPCSTR DiskTagfile,   // optional
    LPCSTR DiskDescription,   // optional
    LPCSTR OtherInfo,   // optional
    DWORD Flags
);

パラメーター

名前方向
FileLogHandlevoid*in
LogSectionNameLPCSTRinoptional
SourceFilenameLPCSTRin
TargetFilenameLPCSTRin
ChecksumDWORDin
DiskTagfileLPCSTRinoptional
DiskDescriptionLPCSTRinoptional
OtherInfoLPCSTRinoptional
FlagsDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

// SETUPAPI.dll  (ANSI / -A)
#include <windows.h>

BOOL SetupLogFileA(
    void* FileLogHandle,
    LPCSTR LogSectionName,   // optional
    LPCSTR SourceFilename,
    LPCSTR TargetFilename,
    DWORD Checksum,
    LPCSTR DiskTagfile,   // optional
    LPCSTR DiskDescription,   // optional
    LPCSTR OtherInfo,   // optional
    DWORD Flags
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool SetupLogFileA(
    IntPtr FileLogHandle,   // void*
    [MarshalAs(UnmanagedType.LPStr)] string LogSectionName,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string SourceFilename,   // LPCSTR
    [MarshalAs(UnmanagedType.LPStr)] string TargetFilename,   // LPCSTR
    uint Checksum,   // DWORD
    [MarshalAs(UnmanagedType.LPStr)] string DiskTagfile,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string DiskDescription,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string OtherInfo,   // LPCSTR optional
    uint Flags   // DWORD
);
<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupLogFileA(
    FileLogHandle As IntPtr,   ' void*
    <MarshalAs(UnmanagedType.LPStr)> LogSectionName As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> SourceFilename As String,   ' LPCSTR
    <MarshalAs(UnmanagedType.LPStr)> TargetFilename As String,   ' LPCSTR
    Checksum As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPStr)> DiskTagfile As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> DiskDescription As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> OtherInfo As String,   ' LPCSTR optional
    Flags As UInteger   ' DWORD
) As Boolean
End Function
' FileLogHandle : void*
' LogSectionName : LPCSTR optional
' SourceFilename : LPCSTR
' TargetFilename : LPCSTR
' Checksum : DWORD
' DiskTagfile : LPCSTR optional
' DiskDescription : LPCSTR optional
' OtherInfo : LPCSTR optional
' Flags : DWORD
Declare PtrSafe Function SetupLogFileA Lib "setupapi" ( _
    ByVal FileLogHandle As LongPtr, _
    ByVal LogSectionName As String, _
    ByVal SourceFilename As String, _
    ByVal TargetFilename As String, _
    ByVal Checksum As Long, _
    ByVal DiskTagfile As String, _
    ByVal DiskDescription As String, _
    ByVal OtherInfo As String, _
    ByVal Flags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetupLogFileA = ctypes.windll.setupapi.SetupLogFileA
SetupLogFileA.restype = wintypes.BOOL
SetupLogFileA.argtypes = [
    ctypes.POINTER(None),  # FileLogHandle : void*
    wintypes.LPCSTR,  # LogSectionName : LPCSTR optional
    wintypes.LPCSTR,  # SourceFilename : LPCSTR
    wintypes.LPCSTR,  # TargetFilename : LPCSTR
    wintypes.DWORD,  # Checksum : DWORD
    wintypes.LPCSTR,  # DiskTagfile : LPCSTR optional
    wintypes.LPCSTR,  # DiskDescription : LPCSTR optional
    wintypes.LPCSTR,  # OtherInfo : LPCSTR optional
    wintypes.DWORD,  # Flags : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SETUPAPI.dll')
SetupLogFileA = Fiddle::Function.new(
  lib['SetupLogFileA'],
  [
    Fiddle::TYPE_VOIDP,  # FileLogHandle : void*
    Fiddle::TYPE_VOIDP,  # LogSectionName : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # SourceFilename : LPCSTR
    Fiddle::TYPE_VOIDP,  # TargetFilename : LPCSTR
    -Fiddle::TYPE_INT,  # Checksum : DWORD
    Fiddle::TYPE_VOIDP,  # DiskTagfile : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # DiskDescription : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # OtherInfo : LPCSTR optional
    -Fiddle::TYPE_INT,  # Flags : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "setupapi")]
extern "system" {
    fn SetupLogFileA(
        FileLogHandle: *mut (),  // void*
        LogSectionName: *const u8,  // LPCSTR optional
        SourceFilename: *const u8,  // LPCSTR
        TargetFilename: *const u8,  // LPCSTR
        Checksum: u32,  // DWORD
        DiskTagfile: *const u8,  // LPCSTR optional
        DiskDescription: *const u8,  // LPCSTR optional
        OtherInfo: *const u8,  // LPCSTR optional
        Flags: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool SetupLogFileA(IntPtr FileLogHandle, [MarshalAs(UnmanagedType.LPStr)] string LogSectionName, [MarshalAs(UnmanagedType.LPStr)] string SourceFilename, [MarshalAs(UnmanagedType.LPStr)] string TargetFilename, uint Checksum, [MarshalAs(UnmanagedType.LPStr)] string DiskTagfile, [MarshalAs(UnmanagedType.LPStr)] string DiskDescription, [MarshalAs(UnmanagedType.LPStr)] string OtherInfo, uint Flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupLogFileA' -Namespace Win32 -PassThru
# $api::SetupLogFileA(FileLogHandle, LogSectionName, SourceFilename, TargetFilename, Checksum, DiskTagfile, DiskDescription, OtherInfo, Flags)
#uselib "SETUPAPI.dll"
#func global SetupLogFileA "SetupLogFileA" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; SetupLogFileA FileLogHandle, LogSectionName, SourceFilename, TargetFilename, Checksum, DiskTagfile, DiskDescription, OtherInfo, Flags   ; 戻り値は stat
; FileLogHandle : void* -> "sptr"
; LogSectionName : LPCSTR optional -> "sptr"
; SourceFilename : LPCSTR -> "sptr"
; TargetFilename : LPCSTR -> "sptr"
; Checksum : DWORD -> "sptr"
; DiskTagfile : LPCSTR optional -> "sptr"
; DiskDescription : LPCSTR optional -> "sptr"
; OtherInfo : LPCSTR optional -> "sptr"
; Flags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SETUPAPI.dll"
#cfunc global SetupLogFileA "SetupLogFileA" sptr, str, str, str, int, str, str, str, int
; res = SetupLogFileA(FileLogHandle, LogSectionName, SourceFilename, TargetFilename, Checksum, DiskTagfile, DiskDescription, OtherInfo, Flags)
; FileLogHandle : void* -> "sptr"
; LogSectionName : LPCSTR optional -> "str"
; SourceFilename : LPCSTR -> "str"
; TargetFilename : LPCSTR -> "str"
; Checksum : DWORD -> "int"
; DiskTagfile : LPCSTR optional -> "str"
; DiskDescription : LPCSTR optional -> "str"
; OtherInfo : LPCSTR optional -> "str"
; Flags : DWORD -> "int"
; BOOL SetupLogFileA(void* FileLogHandle, LPCSTR LogSectionName, LPCSTR SourceFilename, LPCSTR TargetFilename, DWORD Checksum, LPCSTR DiskTagfile, LPCSTR DiskDescription, LPCSTR OtherInfo, DWORD Flags)
#uselib "SETUPAPI.dll"
#cfunc global SetupLogFileA "SetupLogFileA" intptr, str, str, str, int, str, str, str, int
; res = SetupLogFileA(FileLogHandle, LogSectionName, SourceFilename, TargetFilename, Checksum, DiskTagfile, DiskDescription, OtherInfo, Flags)
; FileLogHandle : void* -> "intptr"
; LogSectionName : LPCSTR optional -> "str"
; SourceFilename : LPCSTR -> "str"
; TargetFilename : LPCSTR -> "str"
; Checksum : DWORD -> "int"
; DiskTagfile : LPCSTR optional -> "str"
; DiskDescription : LPCSTR optional -> "str"
; OtherInfo : LPCSTR optional -> "str"
; Flags : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupLogFileA = setupapi.NewProc("SetupLogFileA")
)

// FileLogHandle (void*), LogSectionName (LPCSTR optional), SourceFilename (LPCSTR), TargetFilename (LPCSTR), Checksum (DWORD), DiskTagfile (LPCSTR optional), DiskDescription (LPCSTR optional), OtherInfo (LPCSTR optional), Flags (DWORD)
r1, _, err := procSetupLogFileA.Call(
	uintptr(FileLogHandle),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(LogSectionName))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(SourceFilename))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(TargetFilename))),
	uintptr(Checksum),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(DiskTagfile))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(DiskDescription))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(OtherInfo))),
	uintptr(Flags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetupLogFileA(
  FileLogHandle: Pointer;   // void*
  LogSectionName: PAnsiChar;   // LPCSTR optional
  SourceFilename: PAnsiChar;   // LPCSTR
  TargetFilename: PAnsiChar;   // LPCSTR
  Checksum: DWORD;   // DWORD
  DiskTagfile: PAnsiChar;   // LPCSTR optional
  DiskDescription: PAnsiChar;   // LPCSTR optional
  OtherInfo: PAnsiChar;   // LPCSTR optional
  Flags: DWORD   // DWORD
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupLogFileA';
result := DllCall("SETUPAPI\SetupLogFileA"
    , "Ptr", FileLogHandle   ; void*
    , "AStr", LogSectionName   ; LPCSTR optional
    , "AStr", SourceFilename   ; LPCSTR
    , "AStr", TargetFilename   ; LPCSTR
    , "UInt", Checksum   ; DWORD
    , "AStr", DiskTagfile   ; LPCSTR optional
    , "AStr", DiskDescription   ; LPCSTR optional
    , "AStr", OtherInfo   ; LPCSTR optional
    , "UInt", Flags   ; DWORD
    , "Int")   ; return: BOOL
●SetupLogFileA(FileLogHandle, LogSectionName, SourceFilename, TargetFilename, Checksum, DiskTagfile, DiskDescription, OtherInfo, Flags) = DLL("SETUPAPI.dll", "bool SetupLogFileA(void*, char*, char*, char*, dword, char*, char*, char*, dword)")
# 呼び出し: SetupLogFileA(FileLogHandle, LogSectionName, SourceFilename, TargetFilename, Checksum, DiskTagfile, DiskDescription, OtherInfo, Flags)
# FileLogHandle : void* -> "void*"
# LogSectionName : LPCSTR optional -> "char*"
# SourceFilename : LPCSTR -> "char*"
# TargetFilename : LPCSTR -> "char*"
# Checksum : DWORD -> "dword"
# DiskTagfile : LPCSTR optional -> "char*"
# DiskDescription : LPCSTR optional -> "char*"
# OtherInfo : LPCSTR optional -> "char*"
# Flags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。