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

MsiGetPatchFileListW

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

シグネチャ

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

DWORD MsiGetPatchFileListW(
    LPCWSTR szProductCode,
    LPCWSTR szPatchPackages,
    DWORD* pcFiles,
    MSIHANDLE** pphFileRecords
);

パラメーター

名前方向
szProductCodeLPCWSTRin
szPatchPackagesLPCWSTRin
pcFilesDWORD*out
pphFileRecordsMSIHANDLE**out

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD MsiGetPatchFileListW(
    LPCWSTR szProductCode,
    LPCWSTR szPatchPackages,
    DWORD* pcFiles,
    MSIHANDLE** pphFileRecords
);
[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiGetPatchFileListW(
    [MarshalAs(UnmanagedType.LPWStr)] string szProductCode,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string szPatchPackages,   // LPCWSTR
    out uint pcFiles,   // DWORD* out
    IntPtr pphFileRecords   // MSIHANDLE** out
);
<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiGetPatchFileListW(
    <MarshalAs(UnmanagedType.LPWStr)> szProductCode As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> szPatchPackages As String,   ' LPCWSTR
    <Out> ByRef pcFiles As UInteger,   ' DWORD* out
    pphFileRecords As IntPtr   ' MSIHANDLE** out
) As UInteger
End Function
' szProductCode : LPCWSTR
' szPatchPackages : LPCWSTR
' pcFiles : DWORD* out
' pphFileRecords : MSIHANDLE** out
Declare PtrSafe Function MsiGetPatchFileListW Lib "msi" ( _
    ByVal szProductCode As LongPtr, _
    ByVal szPatchPackages As LongPtr, _
    ByRef pcFiles As Long, _
    ByVal pphFileRecords 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

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

lib = Fiddle.dlopen('msi.dll')
MsiGetPatchFileListW = Fiddle::Function.new(
  lib['MsiGetPatchFileListW'],
  [
    Fiddle::TYPE_VOIDP,  # szProductCode : LPCWSTR
    Fiddle::TYPE_VOIDP,  # szPatchPackages : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pcFiles : DWORD* out
    Fiddle::TYPE_VOIDP,  # pphFileRecords : MSIHANDLE** out
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "msi")]
extern "system" {
    fn MsiGetPatchFileListW(
        szProductCode: *const u16,  // LPCWSTR
        szPatchPackages: *const u16,  // LPCWSTR
        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.Unicode)]
public static extern uint MsiGetPatchFileListW([MarshalAs(UnmanagedType.LPWStr)] string szProductCode, [MarshalAs(UnmanagedType.LPWStr)] string szPatchPackages, out uint pcFiles, IntPtr pphFileRecords);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiGetPatchFileListW' -Namespace Win32 -PassThru
# $api::MsiGetPatchFileListW(szProductCode, szPatchPackages, pcFiles, pphFileRecords)
#uselib "msi.dll"
#func global MsiGetPatchFileListW "MsiGetPatchFileListW" wptr, wptr, wptr, wptr
; MsiGetPatchFileListW szProductCode, szPatchPackages, varptr(pcFiles), pphFileRecords   ; 戻り値は stat
; szProductCode : LPCWSTR -> "wptr"
; szPatchPackages : LPCWSTR -> "wptr"
; pcFiles : DWORD* out -> "wptr"
; pphFileRecords : MSIHANDLE** out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "msi.dll"
#cfunc global MsiGetPatchFileListW "MsiGetPatchFileListW" wstr, wstr, var, int
; res = MsiGetPatchFileListW(szProductCode, szPatchPackages, pcFiles, pphFileRecords)
; szProductCode : LPCWSTR -> "wstr"
; szPatchPackages : LPCWSTR -> "wstr"
; pcFiles : DWORD* out -> "var"
; pphFileRecords : MSIHANDLE** out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD MsiGetPatchFileListW(LPCWSTR szProductCode, LPCWSTR szPatchPackages, DWORD* pcFiles, MSIHANDLE** pphFileRecords)
#uselib "msi.dll"
#cfunc global MsiGetPatchFileListW "MsiGetPatchFileListW" wstr, wstr, var, int
; res = MsiGetPatchFileListW(szProductCode, szPatchPackages, pcFiles, pphFileRecords)
; szProductCode : LPCWSTR -> "wstr"
; szPatchPackages : LPCWSTR -> "wstr"
; pcFiles : DWORD* out -> "var"
; pphFileRecords : MSIHANDLE** out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiGetPatchFileListW = msi.NewProc("MsiGetPatchFileListW")
)

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