ホーム › System.ApplicationInstallationAndServicing › MsiEnableLogW
MsiEnableLogW
関数インストーラのログ出力を有効化する(Unicode版)。
シグネチャ
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiEnableLogW(
DWORD dwLogMode,
LPCWSTR szLogFile, // optional
DWORD dwLogAttributes
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dwLogMode | DWORD | in |
| szLogFile | LPCWSTR | inoptional |
| dwLogAttributes | DWORD | in |
戻り値の型: DWORD
各言語での呼び出し定義
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiEnableLogW(
DWORD dwLogMode,
LPCWSTR szLogFile, // optional
DWORD dwLogAttributes
);[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiEnableLogW(
uint dwLogMode, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string szLogFile, // LPCWSTR optional
uint dwLogAttributes // DWORD
);<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiEnableLogW(
dwLogMode As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> szLogFile As String, ' LPCWSTR optional
dwLogAttributes As UInteger ' DWORD
) As UInteger
End Function' dwLogMode : DWORD
' szLogFile : LPCWSTR optional
' dwLogAttributes : DWORD
Declare PtrSafe Function MsiEnableLogW Lib "msi" ( _
ByVal dwLogMode As Long, _
ByVal szLogFile As LongPtr, _
ByVal dwLogAttributes As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MsiEnableLogW = ctypes.windll.msi.MsiEnableLogW
MsiEnableLogW.restype = wintypes.DWORD
MsiEnableLogW.argtypes = [
wintypes.DWORD, # dwLogMode : DWORD
wintypes.LPCWSTR, # szLogFile : LPCWSTR optional
wintypes.DWORD, # dwLogAttributes : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiEnableLogW = Fiddle::Function.new(
lib['MsiEnableLogW'],
[
-Fiddle::TYPE_INT, # dwLogMode : DWORD
Fiddle::TYPE_VOIDP, # szLogFile : LPCWSTR optional
-Fiddle::TYPE_INT, # dwLogAttributes : DWORD
],
-Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "msi")]
extern "system" {
fn MsiEnableLogW(
dwLogMode: u32, // DWORD
szLogFile: *const u16, // LPCWSTR optional
dwLogAttributes: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
public static extern uint MsiEnableLogW(uint dwLogMode, [MarshalAs(UnmanagedType.LPWStr)] string szLogFile, uint dwLogAttributes);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiEnableLogW' -Namespace Win32 -PassThru
# $api::MsiEnableLogW(dwLogMode, szLogFile, dwLogAttributes)#uselib "msi.dll"
#func global MsiEnableLogW "MsiEnableLogW" wptr, wptr, wptr
; MsiEnableLogW dwLogMode, szLogFile, dwLogAttributes ; 戻り値は stat
; dwLogMode : DWORD -> "wptr"
; szLogFile : LPCWSTR optional -> "wptr"
; dwLogAttributes : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "msi.dll"
#cfunc global MsiEnableLogW "MsiEnableLogW" int, wstr, int
; res = MsiEnableLogW(dwLogMode, szLogFile, dwLogAttributes)
; dwLogMode : DWORD -> "int"
; szLogFile : LPCWSTR optional -> "wstr"
; dwLogAttributes : DWORD -> "int"; DWORD MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, DWORD dwLogAttributes)
#uselib "msi.dll"
#cfunc global MsiEnableLogW "MsiEnableLogW" int, wstr, int
; res = MsiEnableLogW(dwLogMode, szLogFile, dwLogAttributes)
; dwLogMode : DWORD -> "int"
; szLogFile : LPCWSTR optional -> "wstr"
; dwLogAttributes : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiEnableLogW = msi.NewProc("MsiEnableLogW")
)
// dwLogMode (DWORD), szLogFile (LPCWSTR optional), dwLogAttributes (DWORD)
r1, _, err := procMsiEnableLogW.Call(
uintptr(dwLogMode),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szLogFile))),
uintptr(dwLogAttributes),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiEnableLogW(
dwLogMode: DWORD; // DWORD
szLogFile: PWideChar; // LPCWSTR optional
dwLogAttributes: DWORD // DWORD
): DWORD; stdcall;
external 'msi.dll' name 'MsiEnableLogW';result := DllCall("msi\MsiEnableLogW"
, "UInt", dwLogMode ; DWORD
, "WStr", szLogFile ; LPCWSTR optional
, "UInt", dwLogAttributes ; DWORD
, "UInt") ; return: DWORD●MsiEnableLogW(dwLogMode, szLogFile, dwLogAttributes) = DLL("msi.dll", "dword MsiEnableLogW(dword, char*, dword)")
# 呼び出し: MsiEnableLogW(dwLogMode, szLogFile, dwLogAttributes)
# dwLogMode : DWORD -> "dword"
# szLogFile : LPCWSTR optional -> "char*"
# dwLogAttributes : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。