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

MsiReinstallFeatureA

関数
指定モードで機能を再インストールする(ANSI版)。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiReinstallFeatureA(
    LPCSTR szProduct,
    LPCSTR szFeature,
    DWORD dwReinstallMode
);

パラメーター

名前方向
szProductLPCSTRin
szFeatureLPCSTRin
dwReinstallModeDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

MsiReinstallFeatureA = ctypes.windll.msi.MsiReinstallFeatureA
MsiReinstallFeatureA.restype = wintypes.DWORD
MsiReinstallFeatureA.argtypes = [
    wintypes.LPCSTR,  # szProduct : LPCSTR
    wintypes.LPCSTR,  # szFeature : LPCSTR
    wintypes.DWORD,  # dwReinstallMode : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiReinstallFeatureA = Fiddle::Function.new(
  lib['MsiReinstallFeatureA'],
  [
    Fiddle::TYPE_VOIDP,  # szProduct : LPCSTR
    Fiddle::TYPE_VOIDP,  # szFeature : LPCSTR
    -Fiddle::TYPE_INT,  # dwReinstallMode : DWORD
  ],
  -Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiReinstallFeatureA(
        szProduct: *const u8,  // LPCSTR
        szFeature: *const u8,  // LPCSTR
        dwReinstallMode: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiReinstallFeatureA([MarshalAs(UnmanagedType.LPStr)] string szProduct, [MarshalAs(UnmanagedType.LPStr)] string szFeature, uint dwReinstallMode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiReinstallFeatureA' -Namespace Win32 -PassThru
# $api::MsiReinstallFeatureA(szProduct, szFeature, dwReinstallMode)
#uselib "msi.dll"
#func global MsiReinstallFeatureA "MsiReinstallFeatureA" sptr, sptr, sptr
; MsiReinstallFeatureA szProduct, szFeature, dwReinstallMode   ; 戻り値は stat
; szProduct : LPCSTR -> "sptr"
; szFeature : LPCSTR -> "sptr"
; dwReinstallMode : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiReinstallFeatureA "MsiReinstallFeatureA" str, str, int
; res = MsiReinstallFeatureA(szProduct, szFeature, dwReinstallMode)
; szProduct : LPCSTR -> "str"
; szFeature : LPCSTR -> "str"
; dwReinstallMode : DWORD -> "int"
; DWORD MsiReinstallFeatureA(LPCSTR szProduct, LPCSTR szFeature, DWORD dwReinstallMode)
#uselib "msi.dll"
#cfunc global MsiReinstallFeatureA "MsiReinstallFeatureA" str, str, int
; res = MsiReinstallFeatureA(szProduct, szFeature, dwReinstallMode)
; szProduct : LPCSTR -> "str"
; szFeature : LPCSTR -> "str"
; dwReinstallMode : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiReinstallFeatureA = msi.NewProc("MsiReinstallFeatureA")
)

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