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