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

MsiRemovePatchesW

関数
製品から指定のパッチを削除する(Unicode版)。
DLLmsi.dll文字セットUnicode (-W)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiRemovePatchesW(
    LPCWSTR szPatchList,
    LPCWSTR szProductCode,
    INSTALLTYPE eUninstallType,
    LPCWSTR szPropertyList   // optional
);

パラメーター

名前方向
szPatchListLPCWSTRin
szProductCodeLPCWSTRin
eUninstallTypeINSTALLTYPEin
szPropertyListLPCWSTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

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

MsiRemovePatchesW = ctypes.windll.msi.MsiRemovePatchesW
MsiRemovePatchesW.restype = wintypes.DWORD
MsiRemovePatchesW.argtypes = [
    wintypes.LPCWSTR,  # szPatchList : LPCWSTR
    wintypes.LPCWSTR,  # szProductCode : LPCWSTR
    ctypes.c_int,  # eUninstallType : INSTALLTYPE
    wintypes.LPCWSTR,  # szPropertyList : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiRemovePatchesW = Fiddle::Function.new(
  lib['MsiRemovePatchesW'],
  [
    Fiddle::TYPE_VOIDP,  # szPatchList : LPCWSTR
    Fiddle::TYPE_VOIDP,  # szProductCode : LPCWSTR
    Fiddle::TYPE_INT,  # eUninstallType : INSTALLTYPE
    Fiddle::TYPE_VOIDP,  # szPropertyList : LPCWSTR optional
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "msi")]
extern "system" {
    fn MsiRemovePatchesW(
        szPatchList: *const u16,  // LPCWSTR
        szProductCode: *const u16,  // LPCWSTR
        eUninstallType: i32,  // INSTALLTYPE
        szPropertyList: *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 MsiRemovePatchesW([MarshalAs(UnmanagedType.LPWStr)] string szPatchList, [MarshalAs(UnmanagedType.LPWStr)] string szProductCode, int eUninstallType, [MarshalAs(UnmanagedType.LPWStr)] string szPropertyList);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiRemovePatchesW' -Namespace Win32 -PassThru
# $api::MsiRemovePatchesW(szPatchList, szProductCode, eUninstallType, szPropertyList)
#uselib "msi.dll"
#func global MsiRemovePatchesW "MsiRemovePatchesW" wptr, wptr, wptr, wptr
; MsiRemovePatchesW szPatchList, szProductCode, eUninstallType, szPropertyList   ; 戻り値は stat
; szPatchList : LPCWSTR -> "wptr"
; szProductCode : LPCWSTR -> "wptr"
; eUninstallType : INSTALLTYPE -> "wptr"
; szPropertyList : LPCWSTR optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiRemovePatchesW "MsiRemovePatchesW" wstr, wstr, int, wstr
; res = MsiRemovePatchesW(szPatchList, szProductCode, eUninstallType, szPropertyList)
; szPatchList : LPCWSTR -> "wstr"
; szProductCode : LPCWSTR -> "wstr"
; eUninstallType : INSTALLTYPE -> "int"
; szPropertyList : LPCWSTR optional -> "wstr"
; DWORD MsiRemovePatchesW(LPCWSTR szPatchList, LPCWSTR szProductCode, INSTALLTYPE eUninstallType, LPCWSTR szPropertyList)
#uselib "msi.dll"
#cfunc global MsiRemovePatchesW "MsiRemovePatchesW" wstr, wstr, int, wstr
; res = MsiRemovePatchesW(szPatchList, szProductCode, eUninstallType, szPropertyList)
; szPatchList : LPCWSTR -> "wstr"
; szProductCode : LPCWSTR -> "wstr"
; eUninstallType : INSTALLTYPE -> "int"
; szPropertyList : LPCWSTR optional -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiRemovePatchesW = msi.NewProc("MsiRemovePatchesW")
)

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