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

MsiApplyMultiplePatchesW

関数
複数のパッチを一括して製品に適用する(Unicode版)。
DLLmsi.dll文字セットUnicode (-W)呼出規約winapi対応OSwindows8.0

シグネチャ

// msi.dll  (Unicode / -W)
#include <windows.h>

DWORD MsiApplyMultiplePatchesW(
    LPCWSTR szPatchPackages,
    LPCWSTR szProductCode,   // optional
    LPCWSTR szPropertiesList   // optional
);

パラメーター

名前方向
szPatchPackagesLPCWSTRin
szProductCodeLPCWSTRinoptional
szPropertiesListLPCWSTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

// msi.dll  (Unicode / -W)
#include <windows.h>

DWORD MsiApplyMultiplePatchesW(
    LPCWSTR szPatchPackages,
    LPCWSTR szProductCode,   // optional
    LPCWSTR szPropertiesList   // optional
);
[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiApplyMultiplePatchesW(
    [MarshalAs(UnmanagedType.LPWStr)] string szPatchPackages,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string szProductCode,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string szPropertiesList   // LPCWSTR optional
);
<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiApplyMultiplePatchesW(
    <MarshalAs(UnmanagedType.LPWStr)> szPatchPackages As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> szProductCode As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> szPropertiesList As String   ' LPCWSTR optional
) As UInteger
End Function
' szPatchPackages : LPCWSTR
' szProductCode : LPCWSTR optional
' szPropertiesList : LPCWSTR optional
Declare PtrSafe Function MsiApplyMultiplePatchesW Lib "msi" ( _
    ByVal szPatchPackages As LongPtr, _
    ByVal szProductCode As LongPtr, _
    ByVal szPropertiesList As LongPtr) 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

MsiApplyMultiplePatchesW = ctypes.windll.msi.MsiApplyMultiplePatchesW
MsiApplyMultiplePatchesW.restype = wintypes.DWORD
MsiApplyMultiplePatchesW.argtypes = [
    wintypes.LPCWSTR,  # szPatchPackages : LPCWSTR
    wintypes.LPCWSTR,  # szProductCode : LPCWSTR optional
    wintypes.LPCWSTR,  # szPropertiesList : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiApplyMultiplePatchesW = Fiddle::Function.new(
  lib['MsiApplyMultiplePatchesW'],
  [
    Fiddle::TYPE_VOIDP,  # szPatchPackages : LPCWSTR
    Fiddle::TYPE_VOIDP,  # szProductCode : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # szPropertiesList : LPCWSTR optional
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "msi")]
extern "system" {
    fn MsiApplyMultiplePatchesW(
        szPatchPackages: *const u16,  // LPCWSTR
        szProductCode: *const u16,  // LPCWSTR optional
        szPropertiesList: *const u16  // LPCWSTR optional
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
public static extern uint MsiApplyMultiplePatchesW([MarshalAs(UnmanagedType.LPWStr)] string szPatchPackages, [MarshalAs(UnmanagedType.LPWStr)] string szProductCode, [MarshalAs(UnmanagedType.LPWStr)] string szPropertiesList);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiApplyMultiplePatchesW' -Namespace Win32 -PassThru
# $api::MsiApplyMultiplePatchesW(szPatchPackages, szProductCode, szPropertiesList)
#uselib "msi.dll"
#func global MsiApplyMultiplePatchesW "MsiApplyMultiplePatchesW" wptr, wptr, wptr
; MsiApplyMultiplePatchesW szPatchPackages, szProductCode, szPropertiesList   ; 戻り値は stat
; szPatchPackages : LPCWSTR -> "wptr"
; szProductCode : LPCWSTR optional -> "wptr"
; szPropertiesList : LPCWSTR optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiApplyMultiplePatchesW "MsiApplyMultiplePatchesW" wstr, wstr, wstr
; res = MsiApplyMultiplePatchesW(szPatchPackages, szProductCode, szPropertiesList)
; szPatchPackages : LPCWSTR -> "wstr"
; szProductCode : LPCWSTR optional -> "wstr"
; szPropertiesList : LPCWSTR optional -> "wstr"
; DWORD MsiApplyMultiplePatchesW(LPCWSTR szPatchPackages, LPCWSTR szProductCode, LPCWSTR szPropertiesList)
#uselib "msi.dll"
#cfunc global MsiApplyMultiplePatchesW "MsiApplyMultiplePatchesW" wstr, wstr, wstr
; res = MsiApplyMultiplePatchesW(szPatchPackages, szProductCode, szPropertiesList)
; szPatchPackages : LPCWSTR -> "wstr"
; szProductCode : LPCWSTR optional -> "wstr"
; szPropertiesList : LPCWSTR optional -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiApplyMultiplePatchesW = msi.NewProc("MsiApplyMultiplePatchesW")
)

// szPatchPackages (LPCWSTR), szProductCode (LPCWSTR optional), szPropertiesList (LPCWSTR optional)
r1, _, err := procMsiApplyMultiplePatchesW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szPatchPackages))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szProductCode))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szPropertiesList))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiApplyMultiplePatchesW(
  szPatchPackages: PWideChar;   // LPCWSTR
  szProductCode: PWideChar;   // LPCWSTR optional
  szPropertiesList: PWideChar   // LPCWSTR optional
): DWORD; stdcall;
  external 'msi.dll' name 'MsiApplyMultiplePatchesW';
result := DllCall("msi\MsiApplyMultiplePatchesW"
    , "WStr", szPatchPackages   ; LPCWSTR
    , "WStr", szProductCode   ; LPCWSTR optional
    , "WStr", szPropertiesList   ; LPCWSTR optional
    , "UInt")   ; return: DWORD
●MsiApplyMultiplePatchesW(szPatchPackages, szProductCode, szPropertiesList) = DLL("msi.dll", "dword MsiApplyMultiplePatchesW(char*, char*, char*)")
# 呼び出し: MsiApplyMultiplePatchesW(szPatchPackages, szProductCode, szPropertiesList)
# szPatchPackages : LPCWSTR -> "char*"
# szProductCode : LPCWSTR optional -> "char*"
# szPropertiesList : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。