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

SetupOpenLog

関数
セットアップのテキストログファイルを開く。
DLLSETUPAPI.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL SetupOpenLog(
    BOOL Erase
);

パラメーター

名前方向
EraseBOOLin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SetupOpenLog(
    BOOL Erase
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", SetLastError = true, ExactSpelling = true)]
static extern bool SetupOpenLog(
    bool Erase   // BOOL
);
<DllImport("SETUPAPI.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupOpenLog(
    [Erase] As Boolean   ' BOOL
) As Boolean
End Function
' Erase : BOOL
Declare PtrSafe Function SetupOpenLog Lib "setupapi" ( _
    ByVal Erase As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetupOpenLog = ctypes.windll.setupapi.SetupOpenLog
SetupOpenLog.restype = wintypes.BOOL
SetupOpenLog.argtypes = [
    wintypes.BOOL,  # Erase : BOOL
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SETUPAPI.dll')
SetupOpenLog = Fiddle::Function.new(
  lib['SetupOpenLog'],
  [
    Fiddle::TYPE_INT,  # Erase : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "setupapi")]
extern "system" {
    fn SetupOpenLog(
        Erase: i32  // BOOL
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", SetLastError = true)]
public static extern bool SetupOpenLog(bool Erase);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupOpenLog' -Namespace Win32 -PassThru
# $api::SetupOpenLog(Erase)
#uselib "SETUPAPI.dll"
#func global SetupOpenLog "SetupOpenLog" sptr
; SetupOpenLog Erase   ; 戻り値は stat
; Erase : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SETUPAPI.dll"
#cfunc global SetupOpenLog "SetupOpenLog" int
; res = SetupOpenLog(Erase)
; Erase : BOOL -> "int"
; BOOL SetupOpenLog(BOOL Erase)
#uselib "SETUPAPI.dll"
#cfunc global SetupOpenLog "SetupOpenLog" int
; res = SetupOpenLog(Erase)
; Erase : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupOpenLog = setupapi.NewProc("SetupOpenLog")
)

// Erase (BOOL)
r1, _, err := procSetupOpenLog.Call(
	uintptr(Erase),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetupOpenLog(
  Erase: BOOL   // BOOL
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupOpenLog';
result := DllCall("SETUPAPI\SetupOpenLog"
    , "Int", Erase   ; BOOL
    , "Int")   ; return: BOOL
●SetupOpenLog(Erase) = DLL("SETUPAPI.dll", "bool SetupOpenLog(bool)")
# 呼び出し: SetupOpenLog(Erase)
# Erase : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。