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