ホーム › System.ApplicationInstallationAndServicing › MsiEnumPatchesW
MsiEnumPatchesW
関数製品に適用されたパッチを列挙する(Unicode版)。
シグネチャ
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiEnumPatchesW(
LPCWSTR szProduct,
DWORD iPatchIndex,
LPWSTR lpPatchBuf,
LPWSTR lpTransformsBuf,
DWORD* pcchTransformsBuf
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| szProduct | LPCWSTR | in | パッチを列挙する対象製品の製品コードを指定します。 |
| iPatchIndex | DWORD | in | 取得するパッチのインデックスを指定します。このパラメーターは、 MsiEnumPatches 関数の最初の呼び出しでは 0 にし、以降の呼び出しごとにインクリメントしてください。 |
| lpPatchBuf | LPWSTR | out | パッチの GUID を受け取るバッファーへのポインターです。この引数は必須です。 |
| lpTransformsBuf | LPWSTR | out | パッチに含まれ、製品に適用可能な変換 (トランスフォーム) のリストを受け取るバッファーへのポインターです。この引数は必須であり、Null にできません。 |
| pcchTransformsBuf | DWORD* | inout | 関数が失敗して返った場合に、lpTransformsBuf にコピーされた文字数が設定されます。成功して返った場合には設定されません。入力時には、終端の null 文字分を含むバッファー全体のサイズを指定します。渡されたバッファーが小さすぎる場合、返される文字数には終端の null 文字は含まれません。 |
戻り値の型: DWORD
公式ドキュメント
MsiEnumPatches 関数は、製品に適用されているすべてのパッチを列挙します。(Unicode)
戻り値
| Value | Meaning |
|---|---|
| 構成データが破損しています。 | |
| 無効なパラメーターが関数に渡されました。 | |
| 返すべきパッチがありません。 | |
| 値が列挙されました。 | |
| バッファーが小さすぎて、要求されたデータを保持できません。 |
解説(Remarks)
パッチを列挙するには、アプリケーションはまず iPatchIndex パラメーターを 0 に設定して MsiEnumPatches 関数を呼び出します。続いて、製品がなくなるまで (関数が ERROR_NO_MORE_ITEMS を返すまで) iPatchIndex パラメーターをインクリメントしながら MsiEnumPatches を呼び出します。
バッファーが小さすぎて要求されたデータを保持できない場合、 MsiEnumPatches は ERROR_MORE_DATA を返し、pcchTransformsBuf には Null 文字を数えずに lpTransformsBuf へコピーされた文字数が格納されます。
メモ
msi.h ヘッダーは MsiEnumPatches を、UNICODE プリプロセッサ定数の定義に応じてこの関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして定義しています。このエンコーディング中立のエイリアスを、エンコーディング中立でないコードと混在させて使用すると、不一致が生じてコンパイルエラーや実行時エラーの原因となることがあります。詳細については、Conventions for Function Prototypes を参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiEnumPatchesW(
LPCWSTR szProduct,
DWORD iPatchIndex,
LPWSTR lpPatchBuf,
LPWSTR lpTransformsBuf,
DWORD* pcchTransformsBuf
);[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiEnumPatchesW(
[MarshalAs(UnmanagedType.LPWStr)] string szProduct, // LPCWSTR
uint iPatchIndex, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpPatchBuf, // LPWSTR out
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpTransformsBuf, // LPWSTR out
ref uint pcchTransformsBuf // DWORD* in/out
);<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiEnumPatchesW(
<MarshalAs(UnmanagedType.LPWStr)> szProduct As String, ' LPCWSTR
iPatchIndex As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> lpPatchBuf As System.Text.StringBuilder, ' LPWSTR out
<MarshalAs(UnmanagedType.LPWStr)> lpTransformsBuf As System.Text.StringBuilder, ' LPWSTR out
ByRef pcchTransformsBuf As UInteger ' DWORD* in/out
) As UInteger
End Function' szProduct : LPCWSTR
' iPatchIndex : DWORD
' lpPatchBuf : LPWSTR out
' lpTransformsBuf : LPWSTR out
' pcchTransformsBuf : DWORD* in/out
Declare PtrSafe Function MsiEnumPatchesW Lib "msi" ( _
ByVal szProduct As LongPtr, _
ByVal iPatchIndex As Long, _
ByVal lpPatchBuf As LongPtr, _
ByVal lpTransformsBuf As LongPtr, _
ByRef pcchTransformsBuf As Long) 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
MsiEnumPatchesW = ctypes.windll.msi.MsiEnumPatchesW
MsiEnumPatchesW.restype = wintypes.DWORD
MsiEnumPatchesW.argtypes = [
wintypes.LPCWSTR, # szProduct : LPCWSTR
wintypes.DWORD, # iPatchIndex : DWORD
wintypes.LPWSTR, # lpPatchBuf : LPWSTR out
wintypes.LPWSTR, # lpTransformsBuf : LPWSTR out
ctypes.POINTER(wintypes.DWORD), # pcchTransformsBuf : DWORD* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiEnumPatchesW = Fiddle::Function.new(
lib['MsiEnumPatchesW'],
[
Fiddle::TYPE_VOIDP, # szProduct : LPCWSTR
-Fiddle::TYPE_INT, # iPatchIndex : DWORD
Fiddle::TYPE_VOIDP, # lpPatchBuf : LPWSTR out
Fiddle::TYPE_VOIDP, # lpTransformsBuf : LPWSTR out
Fiddle::TYPE_VOIDP, # pcchTransformsBuf : DWORD* in/out
],
-Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "msi")]
extern "system" {
fn MsiEnumPatchesW(
szProduct: *const u16, // LPCWSTR
iPatchIndex: u32, // DWORD
lpPatchBuf: *mut u16, // LPWSTR out
lpTransformsBuf: *mut u16, // LPWSTR out
pcchTransformsBuf: *mut u32 // DWORD* in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
public static extern uint MsiEnumPatchesW([MarshalAs(UnmanagedType.LPWStr)] string szProduct, uint iPatchIndex, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpPatchBuf, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpTransformsBuf, ref uint pcchTransformsBuf);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiEnumPatchesW' -Namespace Win32 -PassThru
# $api::MsiEnumPatchesW(szProduct, iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf)#uselib "msi.dll"
#func global MsiEnumPatchesW "MsiEnumPatchesW" wptr, wptr, wptr, wptr, wptr
; MsiEnumPatchesW szProduct, iPatchIndex, varptr(lpPatchBuf), varptr(lpTransformsBuf), varptr(pcchTransformsBuf) ; 戻り値は stat
; szProduct : LPCWSTR -> "wptr"
; iPatchIndex : DWORD -> "wptr"
; lpPatchBuf : LPWSTR out -> "wptr"
; lpTransformsBuf : LPWSTR out -> "wptr"
; pcchTransformsBuf : DWORD* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "msi.dll" #cfunc global MsiEnumPatchesW "MsiEnumPatchesW" wstr, int, var, var, var ; res = MsiEnumPatchesW(szProduct, iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf) ; szProduct : LPCWSTR -> "wstr" ; iPatchIndex : DWORD -> "int" ; lpPatchBuf : LPWSTR out -> "var" ; lpTransformsBuf : LPWSTR out -> "var" ; pcchTransformsBuf : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "msi.dll" #cfunc global MsiEnumPatchesW "MsiEnumPatchesW" wstr, int, sptr, sptr, sptr ; res = MsiEnumPatchesW(szProduct, iPatchIndex, varptr(lpPatchBuf), varptr(lpTransformsBuf), varptr(pcchTransformsBuf)) ; szProduct : LPCWSTR -> "wstr" ; iPatchIndex : DWORD -> "int" ; lpPatchBuf : LPWSTR out -> "sptr" ; lpTransformsBuf : LPWSTR out -> "sptr" ; pcchTransformsBuf : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD MsiEnumPatchesW(LPCWSTR szProduct, DWORD iPatchIndex, LPWSTR lpPatchBuf, LPWSTR lpTransformsBuf, DWORD* pcchTransformsBuf) #uselib "msi.dll" #cfunc global MsiEnumPatchesW "MsiEnumPatchesW" wstr, int, var, var, var ; res = MsiEnumPatchesW(szProduct, iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf) ; szProduct : LPCWSTR -> "wstr" ; iPatchIndex : DWORD -> "int" ; lpPatchBuf : LPWSTR out -> "var" ; lpTransformsBuf : LPWSTR out -> "var" ; pcchTransformsBuf : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD MsiEnumPatchesW(LPCWSTR szProduct, DWORD iPatchIndex, LPWSTR lpPatchBuf, LPWSTR lpTransformsBuf, DWORD* pcchTransformsBuf) #uselib "msi.dll" #cfunc global MsiEnumPatchesW "MsiEnumPatchesW" wstr, int, intptr, intptr, intptr ; res = MsiEnumPatchesW(szProduct, iPatchIndex, varptr(lpPatchBuf), varptr(lpTransformsBuf), varptr(pcchTransformsBuf)) ; szProduct : LPCWSTR -> "wstr" ; iPatchIndex : DWORD -> "int" ; lpPatchBuf : LPWSTR out -> "intptr" ; lpTransformsBuf : LPWSTR out -> "intptr" ; pcchTransformsBuf : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiEnumPatchesW = msi.NewProc("MsiEnumPatchesW")
)
// szProduct (LPCWSTR), iPatchIndex (DWORD), lpPatchBuf (LPWSTR out), lpTransformsBuf (LPWSTR out), pcchTransformsBuf (DWORD* in/out)
r1, _, err := procMsiEnumPatchesW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szProduct))),
uintptr(iPatchIndex),
uintptr(lpPatchBuf),
uintptr(lpTransformsBuf),
uintptr(pcchTransformsBuf),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiEnumPatchesW(
szProduct: PWideChar; // LPCWSTR
iPatchIndex: DWORD; // DWORD
lpPatchBuf: PWideChar; // LPWSTR out
lpTransformsBuf: PWideChar; // LPWSTR out
pcchTransformsBuf: Pointer // DWORD* in/out
): DWORD; stdcall;
external 'msi.dll' name 'MsiEnumPatchesW';result := DllCall("msi\MsiEnumPatchesW"
, "WStr", szProduct ; LPCWSTR
, "UInt", iPatchIndex ; DWORD
, "Ptr", lpPatchBuf ; LPWSTR out
, "Ptr", lpTransformsBuf ; LPWSTR out
, "Ptr", pcchTransformsBuf ; DWORD* in/out
, "UInt") ; return: DWORD●MsiEnumPatchesW(szProduct, iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf) = DLL("msi.dll", "dword MsiEnumPatchesW(char*, dword, char*, char*, void*)")
# 呼び出し: MsiEnumPatchesW(szProduct, iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf)
# szProduct : LPCWSTR -> "char*"
# iPatchIndex : DWORD -> "dword"
# lpPatchBuf : LPWSTR out -> "char*"
# lpTransformsBuf : LPWSTR out -> "char*"
# pcchTransformsBuf : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "msi" fn MsiEnumPatchesW(
szProduct: [*c]const u16, // LPCWSTR
iPatchIndex: u32, // DWORD
lpPatchBuf: [*c]u16, // LPWSTR out
lpTransformsBuf: [*c]u16, // LPWSTR out
pcchTransformsBuf: [*c]u32 // DWORD* in/out
) callconv(std.os.windows.WINAPI) u32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc MsiEnumPatchesW(
szProduct: WideCString, # LPCWSTR
iPatchIndex: uint32, # DWORD
lpPatchBuf: ptr uint16, # LPWSTR out
lpTransformsBuf: ptr uint16, # LPWSTR out
pcchTransformsBuf: ptr uint32 # DWORD* in/out
): uint32 {.importc: "MsiEnumPatchesW", stdcall, dynlib: "msi.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "msi");
extern(Windows)
uint MsiEnumPatchesW(
const(wchar)* szProduct, // LPCWSTR
uint iPatchIndex, // DWORD
wchar* lpPatchBuf, // LPWSTR out
wchar* lpTransformsBuf, // LPWSTR out
uint* pcchTransformsBuf // DWORD* in/out
);ccall((:MsiEnumPatchesW, "msi.dll"), stdcall, UInt32,
(Cwstring, UInt32, Ptr{UInt16}, Ptr{UInt16}, Ptr{UInt32}),
szProduct, iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf)
# szProduct : LPCWSTR -> Cwstring
# iPatchIndex : DWORD -> UInt32
# lpPatchBuf : LPWSTR out -> Ptr{UInt16}
# lpTransformsBuf : LPWSTR out -> Ptr{UInt16}
# pcchTransformsBuf : DWORD* in/out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
uint32_t MsiEnumPatchesW(
const uint16_t* szProduct,
uint32_t iPatchIndex,
uint16_t* lpPatchBuf,
uint16_t* lpTransformsBuf,
uint32_t* pcchTransformsBuf);
]]
local msi = ffi.load("msi")
-- msi.MsiEnumPatchesW(szProduct, iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf)
-- szProduct : LPCWSTR
-- iPatchIndex : DWORD
-- lpPatchBuf : LPWSTR out
-- lpTransformsBuf : LPWSTR out
-- pcchTransformsBuf : DWORD* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('msi.dll');
const MsiEnumPatchesW = lib.func('__stdcall', 'MsiEnumPatchesW', 'uint32_t', ['str16', 'uint32_t', 'uint16_t *', 'uint16_t *', 'uint32_t *']);
// MsiEnumPatchesW(szProduct, iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf)
// szProduct : LPCWSTR -> 'str16'
// iPatchIndex : DWORD -> 'uint32_t'
// lpPatchBuf : LPWSTR out -> 'uint16_t *'
// lpTransformsBuf : LPWSTR out -> 'uint16_t *'
// pcchTransformsBuf : DWORD* in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("msi.dll", {
MsiEnumPatchesW: { parameters: ["buffer", "u32", "buffer", "buffer", "pointer"], result: "u32" },
});
// lib.symbols.MsiEnumPatchesW(szProduct, iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf)
// szProduct : LPCWSTR -> "buffer"
// iPatchIndex : DWORD -> "u32"
// lpPatchBuf : LPWSTR out -> "buffer"
// lpTransformsBuf : LPWSTR out -> "buffer"
// pcchTransformsBuf : DWORD* in/out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t MsiEnumPatchesW(
const uint16_t* szProduct,
uint32_t iPatchIndex,
uint16_t* lpPatchBuf,
uint16_t* lpTransformsBuf,
uint32_t* pcchTransformsBuf);
C, "msi.dll");
// $ffi->MsiEnumPatchesW(szProduct, iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf);
// szProduct : LPCWSTR
// iPatchIndex : DWORD
// lpPatchBuf : LPWSTR out
// lpTransformsBuf : LPWSTR out
// pcchTransformsBuf : DWORD* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Msi extends StdCallLibrary {
Msi INSTANCE = Native.load("msi", Msi.class, W32APIOptions.UNICODE_OPTIONS);
int MsiEnumPatchesW(
WString szProduct, // LPCWSTR
int iPatchIndex, // DWORD
char[] lpPatchBuf, // LPWSTR out
char[] lpTransformsBuf, // LPWSTR out
IntByReference pcchTransformsBuf // DWORD* in/out
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("msi")]
lib Libmsi
fun MsiEnumPatchesW = MsiEnumPatchesW(
szProduct : UInt16*, # LPCWSTR
iPatchIndex : UInt32, # DWORD
lpPatchBuf : UInt16*, # LPWSTR out
lpTransformsBuf : UInt16*, # LPWSTR out
pcchTransformsBuf : UInt32* # DWORD* in/out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MsiEnumPatchesWNative = Uint32 Function(Pointer<Utf16>, Uint32, Pointer<Utf16>, Pointer<Utf16>, Pointer<Uint32>);
typedef MsiEnumPatchesWDart = int Function(Pointer<Utf16>, int, Pointer<Utf16>, Pointer<Utf16>, Pointer<Uint32>);
final MsiEnumPatchesW = DynamicLibrary.open('msi.dll')
.lookupFunction<MsiEnumPatchesWNative, MsiEnumPatchesWDart>('MsiEnumPatchesW');
// szProduct : LPCWSTR -> Pointer<Utf16>
// iPatchIndex : DWORD -> Uint32
// lpPatchBuf : LPWSTR out -> Pointer<Utf16>
// lpTransformsBuf : LPWSTR out -> Pointer<Utf16>
// pcchTransformsBuf : DWORD* in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MsiEnumPatchesW(
szProduct: PWideChar; // LPCWSTR
iPatchIndex: DWORD; // DWORD
lpPatchBuf: PWideChar; // LPWSTR out
lpTransformsBuf: PWideChar; // LPWSTR out
pcchTransformsBuf: Pointer // DWORD* in/out
): DWORD; stdcall;
external 'msi.dll' name 'MsiEnumPatchesW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MsiEnumPatchesW"
c_MsiEnumPatchesW :: CWString -> Word32 -> CWString -> CWString -> Ptr Word32 -> IO Word32
-- szProduct : LPCWSTR -> CWString
-- iPatchIndex : DWORD -> Word32
-- lpPatchBuf : LPWSTR out -> CWString
-- lpTransformsBuf : LPWSTR out -> CWString
-- pcchTransformsBuf : DWORD* in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let msienumpatchesw =
foreign "MsiEnumPatchesW"
((ptr uint16_t) @-> uint32_t @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint32_t) @-> returning uint32_t)
(* szProduct : LPCWSTR -> (ptr uint16_t) *)
(* iPatchIndex : DWORD -> uint32_t *)
(* lpPatchBuf : LPWSTR out -> (ptr uint16_t) *)
(* lpTransformsBuf : LPWSTR out -> (ptr uint16_t) *)
(* pcchTransformsBuf : DWORD* in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msi (t "msi.dll"))
(cffi:use-foreign-library msi)
(cffi:defcfun ("MsiEnumPatchesW" msi-enum-patches-w :convention :stdcall) :uint32
(sz-product (:string :encoding :utf-16le)) ; LPCWSTR
(i-patch-index :uint32) ; DWORD
(lp-patch-buf :pointer) ; LPWSTR out
(lp-transforms-buf :pointer) ; LPWSTR out
(pcch-transforms-buf :pointer)) ; DWORD* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MsiEnumPatchesW = Win32::API::More->new('msi',
'DWORD MsiEnumPatchesW(LPCWSTR szProduct, DWORD iPatchIndex, LPWSTR lpPatchBuf, LPWSTR lpTransformsBuf, LPVOID pcchTransformsBuf)');
# my $ret = $MsiEnumPatchesW->Call($szProduct, $iPatchIndex, $lpPatchBuf, $lpTransformsBuf, $pcchTransformsBuf);
# szProduct : LPCWSTR -> LPCWSTR
# iPatchIndex : DWORD -> DWORD
# lpPatchBuf : LPWSTR out -> LPWSTR
# lpTransformsBuf : LPWSTR out -> LPWSTR
# pcchTransformsBuf : DWORD* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f MsiEnumPatchesA (ANSI版) — 製品に適用されたパッチを列挙する(ANSI版)。
類似 API
- f MsiEnumPatchesExW — コンテキストやフィルタを指定してパッチを列挙する(Unicode版)。