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