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

MsiGetPatchFileListA

関数
パッチパッケージが変更するファイルの一覧をレコードとして取得する。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiGetPatchFileListA(
    LPCSTR szProductCode,
    LPCSTR szPatchPackages,
    DWORD* pcFiles,
    MSIHANDLE** pphFileRecords
);

パラメーター

名前方向
szProductCodeLPCSTRin
szPatchPackagesLPCSTRin
pcFilesDWORD*out
pphFileRecordsMSIHANDLE**out

戻り値の型: DWORD

各言語での呼び出し定義

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

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

MsiGetPatchFileListA = ctypes.windll.msi.MsiGetPatchFileListA
MsiGetPatchFileListA.restype = wintypes.DWORD
MsiGetPatchFileListA.argtypes = [
    wintypes.LPCSTR,  # szProductCode : LPCSTR
    wintypes.LPCSTR,  # szPatchPackages : LPCSTR
    ctypes.POINTER(wintypes.DWORD),  # pcFiles : DWORD* out
    ctypes.c_void_p,  # pphFileRecords : MSIHANDLE** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiGetPatchFileListA = msi.NewProc("MsiGetPatchFileListA")
)

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