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

MsiDetermineApplicablePatchesA

関数
製品に適用可能なパッチを判定する(ANSI版)。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

// msi.dll  (ANSI / -A)
#include <windows.h>

DWORD MsiDetermineApplicablePatchesA(
    LPCSTR szProductPackagePath,
    DWORD cPatchInfo,
    MSIPATCHSEQUENCEINFOA* pPatchInfo
);

パラメーター

名前方向
szProductPackagePathLPCSTRin
cPatchInfoDWORDin
pPatchInfoMSIPATCHSEQUENCEINFOA*inout

戻り値の型: DWORD

各言語での呼び出し定義

// msi.dll  (ANSI / -A)
#include <windows.h>

DWORD MsiDetermineApplicablePatchesA(
    LPCSTR szProductPackagePath,
    DWORD cPatchInfo,
    MSIPATCHSEQUENCEINFOA* pPatchInfo
);
[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiDetermineApplicablePatchesA(
    [MarshalAs(UnmanagedType.LPStr)] string szProductPackagePath,   // LPCSTR
    uint cPatchInfo,   // DWORD
    IntPtr pPatchInfo   // MSIPATCHSEQUENCEINFOA* in/out
);
<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiDetermineApplicablePatchesA(
    <MarshalAs(UnmanagedType.LPStr)> szProductPackagePath As String,   ' LPCSTR
    cPatchInfo As UInteger,   ' DWORD
    pPatchInfo As IntPtr   ' MSIPATCHSEQUENCEINFOA* in/out
) As UInteger
End Function
' szProductPackagePath : LPCSTR
' cPatchInfo : DWORD
' pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out
Declare PtrSafe Function MsiDetermineApplicablePatchesA Lib "msi" ( _
    ByVal szProductPackagePath As String, _
    ByVal cPatchInfo As Long, _
    ByVal pPatchInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiDetermineApplicablePatchesA = ctypes.windll.msi.MsiDetermineApplicablePatchesA
MsiDetermineApplicablePatchesA.restype = wintypes.DWORD
MsiDetermineApplicablePatchesA.argtypes = [
    wintypes.LPCSTR,  # szProductPackagePath : LPCSTR
    wintypes.DWORD,  # cPatchInfo : DWORD
    ctypes.c_void_p,  # pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiDetermineApplicablePatchesA = Fiddle::Function.new(
  lib['MsiDetermineApplicablePatchesA'],
  [
    Fiddle::TYPE_VOIDP,  # szProductPackagePath : LPCSTR
    -Fiddle::TYPE_INT,  # cPatchInfo : DWORD
    Fiddle::TYPE_VOIDP,  # pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiDetermineApplicablePatchesA(
        szProductPackagePath: *const u8,  // LPCSTR
        cPatchInfo: u32,  // DWORD
        pPatchInfo: *mut MSIPATCHSEQUENCEINFOA  // MSIPATCHSEQUENCEINFOA* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiDetermineApplicablePatchesA([MarshalAs(UnmanagedType.LPStr)] string szProductPackagePath, uint cPatchInfo, IntPtr pPatchInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiDetermineApplicablePatchesA' -Namespace Win32 -PassThru
# $api::MsiDetermineApplicablePatchesA(szProductPackagePath, cPatchInfo, pPatchInfo)
#uselib "msi.dll"
#func global MsiDetermineApplicablePatchesA "MsiDetermineApplicablePatchesA" sptr, sptr, sptr
; MsiDetermineApplicablePatchesA szProductPackagePath, cPatchInfo, varptr(pPatchInfo)   ; 戻り値は stat
; szProductPackagePath : LPCSTR -> "sptr"
; cPatchInfo : DWORD -> "sptr"
; pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "msi.dll"
#cfunc global MsiDetermineApplicablePatchesA "MsiDetermineApplicablePatchesA" str, int, var
; res = MsiDetermineApplicablePatchesA(szProductPackagePath, cPatchInfo, pPatchInfo)
; szProductPackagePath : LPCSTR -> "str"
; cPatchInfo : DWORD -> "int"
; pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD MsiDetermineApplicablePatchesA(LPCSTR szProductPackagePath, DWORD cPatchInfo, MSIPATCHSEQUENCEINFOA* pPatchInfo)
#uselib "msi.dll"
#cfunc global MsiDetermineApplicablePatchesA "MsiDetermineApplicablePatchesA" str, int, var
; res = MsiDetermineApplicablePatchesA(szProductPackagePath, cPatchInfo, pPatchInfo)
; szProductPackagePath : LPCSTR -> "str"
; cPatchInfo : DWORD -> "int"
; pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiDetermineApplicablePatchesA = msi.NewProc("MsiDetermineApplicablePatchesA")
)

// szProductPackagePath (LPCSTR), cPatchInfo (DWORD), pPatchInfo (MSIPATCHSEQUENCEINFOA* in/out)
r1, _, err := procMsiDetermineApplicablePatchesA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szProductPackagePath))),
	uintptr(cPatchInfo),
	uintptr(pPatchInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiDetermineApplicablePatchesA(
  szProductPackagePath: PAnsiChar;   // LPCSTR
  cPatchInfo: DWORD;   // DWORD
  pPatchInfo: Pointer   // MSIPATCHSEQUENCEINFOA* in/out
): DWORD; stdcall;
  external 'msi.dll' name 'MsiDetermineApplicablePatchesA';
result := DllCall("msi\MsiDetermineApplicablePatchesA"
    , "AStr", szProductPackagePath   ; LPCSTR
    , "UInt", cPatchInfo   ; DWORD
    , "Ptr", pPatchInfo   ; MSIPATCHSEQUENCEINFOA* in/out
    , "UInt")   ; return: DWORD
●MsiDetermineApplicablePatchesA(szProductPackagePath, cPatchInfo, pPatchInfo) = DLL("msi.dll", "dword MsiDetermineApplicablePatchesA(char*, dword, void*)")
# 呼び出し: MsiDetermineApplicablePatchesA(szProductPackagePath, cPatchInfo, pPatchInfo)
# szProductPackagePath : LPCSTR -> "char*"
# cPatchInfo : DWORD -> "dword"
# pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。