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