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

MsiConfigureFeatureA

関数
機能のインストール状態を構成変更する(ANSI版)。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiConfigureFeatureA(
    LPCSTR szProduct,
    LPCSTR szFeature,
    INSTALLSTATE eInstallState
);

パラメーター

名前方向
szProductLPCSTRin
szFeatureLPCSTRin
eInstallStateINSTALLSTATEin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

MsiConfigureFeatureA = ctypes.windll.msi.MsiConfigureFeatureA
MsiConfigureFeatureA.restype = wintypes.DWORD
MsiConfigureFeatureA.argtypes = [
    wintypes.LPCSTR,  # szProduct : LPCSTR
    wintypes.LPCSTR,  # szFeature : LPCSTR
    ctypes.c_int,  # eInstallState : INSTALLSTATE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiConfigureFeatureA = Fiddle::Function.new(
  lib['MsiConfigureFeatureA'],
  [
    Fiddle::TYPE_VOIDP,  # szProduct : LPCSTR
    Fiddle::TYPE_VOIDP,  # szFeature : LPCSTR
    Fiddle::TYPE_INT,  # eInstallState : INSTALLSTATE
  ],
  -Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiConfigureFeatureA(
        szProduct: *const u8,  // LPCSTR
        szFeature: *const u8,  // LPCSTR
        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 MsiConfigureFeatureA([MarshalAs(UnmanagedType.LPStr)] string szProduct, [MarshalAs(UnmanagedType.LPStr)] string szFeature, int eInstallState);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiConfigureFeatureA' -Namespace Win32 -PassThru
# $api::MsiConfigureFeatureA(szProduct, szFeature, eInstallState)
#uselib "msi.dll"
#func global MsiConfigureFeatureA "MsiConfigureFeatureA" sptr, sptr, sptr
; MsiConfigureFeatureA szProduct, szFeature, eInstallState   ; 戻り値は stat
; szProduct : LPCSTR -> "sptr"
; szFeature : LPCSTR -> "sptr"
; eInstallState : INSTALLSTATE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiConfigureFeatureA "MsiConfigureFeatureA" str, str, int
; res = MsiConfigureFeatureA(szProduct, szFeature, eInstallState)
; szProduct : LPCSTR -> "str"
; szFeature : LPCSTR -> "str"
; eInstallState : INSTALLSTATE -> "int"
; DWORD MsiConfigureFeatureA(LPCSTR szProduct, LPCSTR szFeature, INSTALLSTATE eInstallState)
#uselib "msi.dll"
#cfunc global MsiConfigureFeatureA "MsiConfigureFeatureA" str, str, int
; res = MsiConfigureFeatureA(szProduct, szFeature, eInstallState)
; szProduct : LPCSTR -> "str"
; szFeature : LPCSTR -> "str"
; eInstallState : INSTALLSTATE -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiConfigureFeatureA = msi.NewProc("MsiConfigureFeatureA")
)

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