ホーム › Devices.DeviceAndDriverInstallation › SetupRemoveFileLogEntryA
SetupRemoveFileLogEntryA
関数指定ファイルのエントリをセットアップファイルログから削除する。
シグネチャ
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupRemoveFileLogEntryA(
void* FileLogHandle,
LPCSTR LogSectionName, // optional
LPCSTR TargetFilename // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| FileLogHandle | void* | in | エントリを削除するファイルログのハンドル。 |
| LogSectionName | LPCSTR | inoptional | 対象エントリが属するセクション名(ANSI)。NULL可。 |
| TargetFilename | LPCSTR | inoptional | 削除する対象のターゲットファイル名(ANSI)。NULLでセクション全体を削除。 |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupRemoveFileLogEntryA(
void* FileLogHandle,
LPCSTR LogSectionName, // optional
LPCSTR TargetFilename // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool SetupRemoveFileLogEntryA(
IntPtr FileLogHandle, // void*
[MarshalAs(UnmanagedType.LPStr)] string LogSectionName, // LPCSTR optional
[MarshalAs(UnmanagedType.LPStr)] string TargetFilename // LPCSTR optional
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupRemoveFileLogEntryA(
FileLogHandle As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPStr)> LogSectionName As String, ' LPCSTR optional
<MarshalAs(UnmanagedType.LPStr)> TargetFilename As String ' LPCSTR optional
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' FileLogHandle : void*
' LogSectionName : LPCSTR optional
' TargetFilename : LPCSTR optional
Declare PtrSafe Function SetupRemoveFileLogEntryA Lib "setupapi" ( _
ByVal FileLogHandle As LongPtr, _
ByVal LogSectionName As String, _
ByVal TargetFilename As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetupRemoveFileLogEntryA = ctypes.windll.setupapi.SetupRemoveFileLogEntryA
SetupRemoveFileLogEntryA.restype = wintypes.BOOL
SetupRemoveFileLogEntryA.argtypes = [
ctypes.POINTER(None), # FileLogHandle : void*
wintypes.LPCSTR, # LogSectionName : LPCSTR optional
wintypes.LPCSTR, # TargetFilename : LPCSTR optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupRemoveFileLogEntryA = Fiddle::Function.new(
lib['SetupRemoveFileLogEntryA'],
[
Fiddle::TYPE_VOIDP, # FileLogHandle : void*
Fiddle::TYPE_VOIDP, # LogSectionName : LPCSTR optional
Fiddle::TYPE_VOIDP, # TargetFilename : LPCSTR optional
],
Fiddle::TYPE_INT)#[link(name = "setupapi")]
extern "system" {
fn SetupRemoveFileLogEntryA(
FileLogHandle: *mut (), // void*
LogSectionName: *const u8, // LPCSTR optional
TargetFilename: *const u8 // LPCSTR optional
) -> 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 SetupRemoveFileLogEntryA(IntPtr FileLogHandle, [MarshalAs(UnmanagedType.LPStr)] string LogSectionName, [MarshalAs(UnmanagedType.LPStr)] string TargetFilename);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupRemoveFileLogEntryA' -Namespace Win32 -PassThru
# $api::SetupRemoveFileLogEntryA(FileLogHandle, LogSectionName, TargetFilename)#uselib "SETUPAPI.dll"
#func global SetupRemoveFileLogEntryA "SetupRemoveFileLogEntryA" sptr, sptr, sptr
; SetupRemoveFileLogEntryA FileLogHandle, LogSectionName, TargetFilename ; 戻り値は stat
; FileLogHandle : void* -> "sptr"
; LogSectionName : LPCSTR optional -> "sptr"
; TargetFilename : LPCSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SETUPAPI.dll"
#cfunc global SetupRemoveFileLogEntryA "SetupRemoveFileLogEntryA" sptr, str, str
; res = SetupRemoveFileLogEntryA(FileLogHandle, LogSectionName, TargetFilename)
; FileLogHandle : void* -> "sptr"
; LogSectionName : LPCSTR optional -> "str"
; TargetFilename : LPCSTR optional -> "str"; BOOL SetupRemoveFileLogEntryA(void* FileLogHandle, LPCSTR LogSectionName, LPCSTR TargetFilename)
#uselib "SETUPAPI.dll"
#cfunc global SetupRemoveFileLogEntryA "SetupRemoveFileLogEntryA" intptr, str, str
; res = SetupRemoveFileLogEntryA(FileLogHandle, LogSectionName, TargetFilename)
; FileLogHandle : void* -> "intptr"
; LogSectionName : LPCSTR optional -> "str"
; TargetFilename : LPCSTR optional -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupRemoveFileLogEntryA = setupapi.NewProc("SetupRemoveFileLogEntryA")
)
// FileLogHandle (void*), LogSectionName (LPCSTR optional), TargetFilename (LPCSTR optional)
r1, _, err := procSetupRemoveFileLogEntryA.Call(
uintptr(FileLogHandle),
uintptr(unsafe.Pointer(windows.BytePtrFromString(LogSectionName))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(TargetFilename))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupRemoveFileLogEntryA(
FileLogHandle: Pointer; // void*
LogSectionName: PAnsiChar; // LPCSTR optional
TargetFilename: PAnsiChar // LPCSTR optional
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupRemoveFileLogEntryA';result := DllCall("SETUPAPI\SetupRemoveFileLogEntryA"
, "Ptr", FileLogHandle ; void*
, "AStr", LogSectionName ; LPCSTR optional
, "AStr", TargetFilename ; LPCSTR optional
, "Int") ; return: BOOL●SetupRemoveFileLogEntryA(FileLogHandle, LogSectionName, TargetFilename) = DLL("SETUPAPI.dll", "bool SetupRemoveFileLogEntryA(void*, char*, char*)")
# 呼び出し: SetupRemoveFileLogEntryA(FileLogHandle, LogSectionName, TargetFilename)
# FileLogHandle : void* -> "void*"
# LogSectionName : LPCSTR optional -> "char*"
# TargetFilename : LPCSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "setupapi" fn SetupRemoveFileLogEntryA(
FileLogHandle: ?*anyopaque, // void*
LogSectionName: [*c]const u8, // LPCSTR optional
TargetFilename: [*c]const u8 // LPCSTR optional
) callconv(std.os.windows.WINAPI) i32;proc SetupRemoveFileLogEntryA(
FileLogHandle: pointer, # void*
LogSectionName: cstring, # LPCSTR optional
TargetFilename: cstring # LPCSTR optional
): int32 {.importc: "SetupRemoveFileLogEntryA", stdcall, dynlib: "SETUPAPI.dll".}pragma(lib, "setupapi");
extern(Windows)
int SetupRemoveFileLogEntryA(
void* FileLogHandle, // void*
const(char)* LogSectionName, // LPCSTR optional
const(char)* TargetFilename // LPCSTR optional
);ccall((:SetupRemoveFileLogEntryA, "SETUPAPI.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cstring, Cstring),
FileLogHandle, LogSectionName, TargetFilename)
# FileLogHandle : void* -> Ptr{Cvoid}
# LogSectionName : LPCSTR optional -> Cstring
# TargetFilename : LPCSTR optional -> Cstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t SetupRemoveFileLogEntryA(
void* FileLogHandle,
const char* LogSectionName,
const char* TargetFilename);
]]
local setupapi = ffi.load("setupapi")
-- setupapi.SetupRemoveFileLogEntryA(FileLogHandle, LogSectionName, TargetFilename)
-- FileLogHandle : void*
-- LogSectionName : LPCSTR optional
-- TargetFilename : LPCSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('SETUPAPI.dll');
const SetupRemoveFileLogEntryA = lib.func('__stdcall', 'SetupRemoveFileLogEntryA', 'int32_t', ['void *', 'str', 'str']);
// SetupRemoveFileLogEntryA(FileLogHandle, LogSectionName, TargetFilename)
// FileLogHandle : void* -> 'void *'
// LogSectionName : LPCSTR optional -> 'str'
// TargetFilename : LPCSTR optional -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SETUPAPI.dll", {
SetupRemoveFileLogEntryA: { parameters: ["pointer", "buffer", "buffer"], result: "i32" },
});
// lib.symbols.SetupRemoveFileLogEntryA(FileLogHandle, LogSectionName, TargetFilename)
// FileLogHandle : void* -> "pointer"
// LogSectionName : LPCSTR optional -> "buffer"
// TargetFilename : LPCSTR optional -> "buffer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SetupRemoveFileLogEntryA(
void* FileLogHandle,
const char* LogSectionName,
const char* TargetFilename);
C, "SETUPAPI.dll");
// $ffi->SetupRemoveFileLogEntryA(FileLogHandle, LogSectionName, TargetFilename);
// FileLogHandle : void*
// LogSectionName : LPCSTR optional
// TargetFilename : LPCSTR optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Setupapi extends StdCallLibrary {
Setupapi INSTANCE = Native.load("setupapi", Setupapi.class, W32APIOptions.ASCII_OPTIONS);
boolean SetupRemoveFileLogEntryA(
Pointer FileLogHandle, // void*
String LogSectionName, // LPCSTR optional
String TargetFilename // LPCSTR optional
);
}@[Link("setupapi")]
lib LibSETUPAPI
fun SetupRemoveFileLogEntryA = SetupRemoveFileLogEntryA(
FileLogHandle : Void*, # void*
LogSectionName : UInt8*, # LPCSTR optional
TargetFilename : UInt8* # LPCSTR optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SetupRemoveFileLogEntryANative = Int32 Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>);
typedef SetupRemoveFileLogEntryADart = int Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>);
final SetupRemoveFileLogEntryA = DynamicLibrary.open('SETUPAPI.dll')
.lookupFunction<SetupRemoveFileLogEntryANative, SetupRemoveFileLogEntryADart>('SetupRemoveFileLogEntryA');
// FileLogHandle : void* -> Pointer<Void>
// LogSectionName : LPCSTR optional -> Pointer<Utf8>
// TargetFilename : LPCSTR optional -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SetupRemoveFileLogEntryA(
FileLogHandle: Pointer; // void*
LogSectionName: PAnsiChar; // LPCSTR optional
TargetFilename: PAnsiChar // LPCSTR optional
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupRemoveFileLogEntryA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SetupRemoveFileLogEntryA"
c_SetupRemoveFileLogEntryA :: Ptr () -> CString -> CString -> IO CInt
-- FileLogHandle : void* -> Ptr ()
-- LogSectionName : LPCSTR optional -> CString
-- TargetFilename : LPCSTR optional -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let setupremovefilelogentrya =
foreign "SetupRemoveFileLogEntryA"
((ptr void) @-> string @-> string @-> returning int32_t)
(* FileLogHandle : void* -> (ptr void) *)
(* LogSectionName : LPCSTR optional -> string *)
(* TargetFilename : LPCSTR optional -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library setupapi (t "SETUPAPI.dll"))
(cffi:use-foreign-library setupapi)
(cffi:defcfun ("SetupRemoveFileLogEntryA" setup-remove-file-log-entry-a :convention :stdcall) :int32
(file-log-handle :pointer) ; void*
(log-section-name :string) ; LPCSTR optional
(target-filename :string)) ; LPCSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SetupRemoveFileLogEntryA = Win32::API::More->new('SETUPAPI',
'BOOL SetupRemoveFileLogEntryA(LPVOID FileLogHandle, LPCSTR LogSectionName, LPCSTR TargetFilename)');
# my $ret = $SetupRemoveFileLogEntryA->Call($FileLogHandle, $LogSectionName, $TargetFilename);
# FileLogHandle : void* -> LPVOID
# LogSectionName : LPCSTR optional -> LPCSTR
# TargetFilename : LPCSTR optional -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f SetupRemoveFileLogEntryW (Unicode版) — 指定ファイルのエントリをセットアップファイルログから削除する。