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