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