ホーム › System.ApplicationInstallationAndServicing › MsiApplyPatchA
MsiApplyPatchA
関数製品にパッチパッケージを適用する(ANSI版)。
シグネチャ
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiApplyPatchA(
LPCSTR szPatchPackage,
LPCSTR szInstallPackage, // optional
INSTALLTYPE eInstallType,
LPCSTR szCommandLine // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| szPatchPackage | LPCSTR | in |
| szInstallPackage | LPCSTR | inoptional |
| eInstallType | INSTALLTYPE | in |
| szCommandLine | LPCSTR | inoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiApplyPatchA(
LPCSTR szPatchPackage,
LPCSTR szInstallPackage, // optional
INSTALLTYPE eInstallType,
LPCSTR szCommandLine // optional
);[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiApplyPatchA(
[MarshalAs(UnmanagedType.LPStr)] string szPatchPackage, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string szInstallPackage, // LPCSTR optional
int eInstallType, // INSTALLTYPE
[MarshalAs(UnmanagedType.LPStr)] string szCommandLine // LPCSTR optional
);<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiApplyPatchA(
<MarshalAs(UnmanagedType.LPStr)> szPatchPackage As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> szInstallPackage As String, ' LPCSTR optional
eInstallType As Integer, ' INSTALLTYPE
<MarshalAs(UnmanagedType.LPStr)> szCommandLine As String ' LPCSTR optional
) As UInteger
End Function' szPatchPackage : LPCSTR
' szInstallPackage : LPCSTR optional
' eInstallType : INSTALLTYPE
' szCommandLine : LPCSTR optional
Declare PtrSafe Function MsiApplyPatchA Lib "msi" ( _
ByVal szPatchPackage As String, _
ByVal szInstallPackage As String, _
ByVal eInstallType As Long, _
ByVal szCommandLine As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MsiApplyPatchA = ctypes.windll.msi.MsiApplyPatchA
MsiApplyPatchA.restype = wintypes.DWORD
MsiApplyPatchA.argtypes = [
wintypes.LPCSTR, # szPatchPackage : LPCSTR
wintypes.LPCSTR, # szInstallPackage : LPCSTR optional
ctypes.c_int, # eInstallType : INSTALLTYPE
wintypes.LPCSTR, # szCommandLine : LPCSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiApplyPatchA = Fiddle::Function.new(
lib['MsiApplyPatchA'],
[
Fiddle::TYPE_VOIDP, # szPatchPackage : LPCSTR
Fiddle::TYPE_VOIDP, # szInstallPackage : LPCSTR optional
Fiddle::TYPE_INT, # eInstallType : INSTALLTYPE
Fiddle::TYPE_VOIDP, # szCommandLine : LPCSTR optional
],
-Fiddle::TYPE_INT)#[link(name = "msi")]
extern "system" {
fn MsiApplyPatchA(
szPatchPackage: *const u8, // LPCSTR
szInstallPackage: *const u8, // LPCSTR optional
eInstallType: i32, // INSTALLTYPE
szCommandLine: *const u8 // LPCSTR optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiApplyPatchA([MarshalAs(UnmanagedType.LPStr)] string szPatchPackage, [MarshalAs(UnmanagedType.LPStr)] string szInstallPackage, int eInstallType, [MarshalAs(UnmanagedType.LPStr)] string szCommandLine);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiApplyPatchA' -Namespace Win32 -PassThru
# $api::MsiApplyPatchA(szPatchPackage, szInstallPackage, eInstallType, szCommandLine)#uselib "msi.dll"
#func global MsiApplyPatchA "MsiApplyPatchA" sptr, sptr, sptr, sptr
; MsiApplyPatchA szPatchPackage, szInstallPackage, eInstallType, szCommandLine ; 戻り値は stat
; szPatchPackage : LPCSTR -> "sptr"
; szInstallPackage : LPCSTR optional -> "sptr"
; eInstallType : INSTALLTYPE -> "sptr"
; szCommandLine : LPCSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "msi.dll"
#cfunc global MsiApplyPatchA "MsiApplyPatchA" str, str, int, str
; res = MsiApplyPatchA(szPatchPackage, szInstallPackage, eInstallType, szCommandLine)
; szPatchPackage : LPCSTR -> "str"
; szInstallPackage : LPCSTR optional -> "str"
; eInstallType : INSTALLTYPE -> "int"
; szCommandLine : LPCSTR optional -> "str"; DWORD MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage, INSTALLTYPE eInstallType, LPCSTR szCommandLine)
#uselib "msi.dll"
#cfunc global MsiApplyPatchA "MsiApplyPatchA" str, str, int, str
; res = MsiApplyPatchA(szPatchPackage, szInstallPackage, eInstallType, szCommandLine)
; szPatchPackage : LPCSTR -> "str"
; szInstallPackage : LPCSTR optional -> "str"
; eInstallType : INSTALLTYPE -> "int"
; szCommandLine : LPCSTR optional -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiApplyPatchA = msi.NewProc("MsiApplyPatchA")
)
// szPatchPackage (LPCSTR), szInstallPackage (LPCSTR optional), eInstallType (INSTALLTYPE), szCommandLine (LPCSTR optional)
r1, _, err := procMsiApplyPatchA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(szPatchPackage))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szInstallPackage))),
uintptr(eInstallType),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szCommandLine))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiApplyPatchA(
szPatchPackage: PAnsiChar; // LPCSTR
szInstallPackage: PAnsiChar; // LPCSTR optional
eInstallType: Integer; // INSTALLTYPE
szCommandLine: PAnsiChar // LPCSTR optional
): DWORD; stdcall;
external 'msi.dll' name 'MsiApplyPatchA';result := DllCall("msi\MsiApplyPatchA"
, "AStr", szPatchPackage ; LPCSTR
, "AStr", szInstallPackage ; LPCSTR optional
, "Int", eInstallType ; INSTALLTYPE
, "AStr", szCommandLine ; LPCSTR optional
, "UInt") ; return: DWORD●MsiApplyPatchA(szPatchPackage, szInstallPackage, eInstallType, szCommandLine) = DLL("msi.dll", "dword MsiApplyPatchA(char*, char*, int, char*)")
# 呼び出し: MsiApplyPatchA(szPatchPackage, szInstallPackage, eInstallType, szCommandLine)
# szPatchPackage : LPCSTR -> "char*"
# szInstallPackage : LPCSTR optional -> "char*"
# eInstallType : INSTALLTYPE -> "int"
# szCommandLine : LPCSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。