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