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

MsiReinstallProductA

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

シグネチャ

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

DWORD MsiReinstallProductA(
    LPCSTR szProduct,
    DWORD szReinstallMode
);

パラメーター

名前方向
szProductLPCSTRin
szReinstallModeDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

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

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

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiReinstallProductA = msi.NewProc("MsiReinstallProductA")
)

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