Win32 API 日本語リファレンス
ホームSystem.ApplicationInstallationAndServicing › MsiEnableLogA

MsiEnableLogA

関数
インストーラのログ出力を有効化する(ANSI版)。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiEnableLogA(
    DWORD dwLogMode,
    LPCSTR szLogFile,   // optional
    DWORD dwLogAttributes
);

パラメーター

名前方向
dwLogModeDWORDin
szLogFileLPCSTRinoptional
dwLogAttributesDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD MsiEnableLogA(
    DWORD dwLogMode,
    LPCSTR szLogFile,   // optional
    DWORD dwLogAttributes
);
[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiEnableLogA(
    uint dwLogMode,   // DWORD
    [MarshalAs(UnmanagedType.LPStr)] string szLogFile,   // LPCSTR optional
    uint dwLogAttributes   // DWORD
);
<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiEnableLogA(
    dwLogMode As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPStr)> szLogFile As String,   ' LPCSTR optional
    dwLogAttributes As UInteger   ' DWORD
) As UInteger
End Function
' dwLogMode : DWORD
' szLogFile : LPCSTR optional
' dwLogAttributes : DWORD
Declare PtrSafe Function MsiEnableLogA Lib "msi" ( _
    ByVal dwLogMode As Long, _
    ByVal szLogFile As String, _
    ByVal dwLogAttributes As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiEnableLogA = ctypes.windll.msi.MsiEnableLogA
MsiEnableLogA.restype = wintypes.DWORD
MsiEnableLogA.argtypes = [
    wintypes.DWORD,  # dwLogMode : DWORD
    wintypes.LPCSTR,  # szLogFile : LPCSTR optional
    wintypes.DWORD,  # dwLogAttributes : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiEnableLogA = Fiddle::Function.new(
  lib['MsiEnableLogA'],
  [
    -Fiddle::TYPE_INT,  # dwLogMode : DWORD
    Fiddle::TYPE_VOIDP,  # szLogFile : LPCSTR optional
    -Fiddle::TYPE_INT,  # dwLogAttributes : DWORD
  ],
  -Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiEnableLogA(
        dwLogMode: u32,  // DWORD
        szLogFile: *const u8,  // LPCSTR optional
        dwLogAttributes: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiEnableLogA(uint dwLogMode, [MarshalAs(UnmanagedType.LPStr)] string szLogFile, uint dwLogAttributes);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiEnableLogA' -Namespace Win32 -PassThru
# $api::MsiEnableLogA(dwLogMode, szLogFile, dwLogAttributes)
#uselib "msi.dll"
#func global MsiEnableLogA "MsiEnableLogA" sptr, sptr, sptr
; MsiEnableLogA dwLogMode, szLogFile, dwLogAttributes   ; 戻り値は stat
; dwLogMode : DWORD -> "sptr"
; szLogFile : LPCSTR optional -> "sptr"
; dwLogAttributes : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiEnableLogA "MsiEnableLogA" int, str, int
; res = MsiEnableLogA(dwLogMode, szLogFile, dwLogAttributes)
; dwLogMode : DWORD -> "int"
; szLogFile : LPCSTR optional -> "str"
; dwLogAttributes : DWORD -> "int"
; DWORD MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD dwLogAttributes)
#uselib "msi.dll"
#cfunc global MsiEnableLogA "MsiEnableLogA" int, str, int
; res = MsiEnableLogA(dwLogMode, szLogFile, dwLogAttributes)
; dwLogMode : DWORD -> "int"
; szLogFile : LPCSTR optional -> "str"
; dwLogAttributes : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiEnableLogA = msi.NewProc("MsiEnableLogA")
)

// dwLogMode (DWORD), szLogFile (LPCSTR optional), dwLogAttributes (DWORD)
r1, _, err := procMsiEnableLogA.Call(
	uintptr(dwLogMode),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szLogFile))),
	uintptr(dwLogAttributes),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiEnableLogA(
  dwLogMode: DWORD;   // DWORD
  szLogFile: PAnsiChar;   // LPCSTR optional
  dwLogAttributes: DWORD   // DWORD
): DWORD; stdcall;
  external 'msi.dll' name 'MsiEnableLogA';
result := DllCall("msi\MsiEnableLogA"
    , "UInt", dwLogMode   ; DWORD
    , "AStr", szLogFile   ; LPCSTR optional
    , "UInt", dwLogAttributes   ; DWORD
    , "UInt")   ; return: DWORD
●MsiEnableLogA(dwLogMode, szLogFile, dwLogAttributes) = DLL("msi.dll", "dword MsiEnableLogA(dword, char*, dword)")
# 呼び出し: MsiEnableLogA(dwLogMode, szLogFile, dwLogAttributes)
# dwLogMode : DWORD -> "dword"
# szLogFile : LPCSTR optional -> "char*"
# dwLogAttributes : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。