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

MsiSummaryInfoGetPropertyA

関数
サマリ情報の指定プロパティの型と値を取得する。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiSummaryInfoGetPropertyA(
    MSIHANDLE hSummaryInfo,
    DWORD uiProperty,
    DWORD* puiDataType,
    INT* piValue,
    FILETIME* pftValue,   // optional
    LPSTR szValueBuf,   // optional
    DWORD* pcchValueBuf   // optional
);

パラメーター

名前方向説明
hSummaryInfoMSIHANDLEin概要情報へのハンドルです。
uiPropertyDWORDin概要プロパティのプロパティ ID を指定します。このパラメーターには、Summary Information Stream Property Set に列挙されているプロパティ ID を指定できます。この関数は、PID_DICTIONARY プロパティおよび PID_THUMBNAIL プロパティの値は返しません。
puiDataTypeDWORD*out返されるプロパティの型を受け取ります。このパラメーターには、 Summary Information Stream Property Set に列挙されている型を指定できます。
piValueINT*out返される整数プロパティのデータを受け取ります。
pftValueFILETIME*outoptionalファイル値へのポインターです。
szValueBufLPSTRoutoptionalnull で終わる概要情報プロパティ値を受け取るバッファーへのポインターです。szValueBuf に null(value=0)を渡してバッファーのサイズを判定しようとしないでください。バッファーのサイズは、空の文字列(例: "")を渡すことで取得できます。その場合、関数は ERROR_MORE_DATA を返し、pcchValueBuf に必要なバッファーサイズが終端の null 文字を含まない TCHAR 単位で格納されます。ERROR_SUCCESS が返された場合、pcchValueBuf にはバッファーへ書き込まれた TCHAR の数が終端の null 文字を含まずに格納されます。このパラメーターは、エラーがなければ空の文字列になります。
pcchValueBufDWORD*inoutoptional変数 szValueBuf が指すバッファーのサイズを TCHAR 単位で指定する変数へのポインターです。関数が ERROR_SUCCESS を返す場合、この変数には szValueBuf へコピーされたデータのサイズが終端の null 文字を含まずに格納されます。szValueBuf のサイズが十分でない場合、関数は ERROR_MORE_DATA を返し、必要なサイズを終端の null 文字を含まずに pcchValueBuf が指す変数に格納します。

戻り値の型: DWORD

公式ドキュメント

MsiSummaryInfoGetProperty 関数は、概要情報ストリームから単一のプロパティを取得します。(ANSI)

戻り値

MsiSummaryInfoGetProperty 関数は、次のいずれかの値を返します。

解説(Remarks)

ERROR_MORE_DATA が返された場合、ポインターであるパラメーターには文字列を格納するために必要なバッファーのサイズが示されます。ERROR_SUCCESS が返された場合は、文字列バッファーへ書き込まれた文字数が示されます。したがって、バッファーを指定するパラメーターに空の文字列(例: "")を渡すことで、バッファーのサイズを取得できます。null(value=0)を渡してバッファーのサイズを判定しようとしないでください。

ユーザーが指定したメモリ位置にデータを返す Windows Installer 関数は、ポインターの値として null を指定して呼び出してはいけません。これらの関数は文字列を返すか、整数ポインターとしてデータを返しますが、出力引数の値として null を渡すと一貫性のない値を返します。詳細については、 Passing Null as the Argument of Windows Installer Functions を参照してください。

MsiSummaryInfoGetProperty 関数が返すプロパティ情報は、puiDataType パラメーターで指定されたプロパティ値の型に応じて、piValuepftValue、または szValueBuf パラメーターで受け取られます。

メモ

msiquery.h ヘッダーは、MsiSummaryInfoGetProperty を、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)

各言語での呼び出し定義

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

DWORD MsiSummaryInfoGetPropertyA(
    MSIHANDLE hSummaryInfo,
    DWORD uiProperty,
    DWORD* puiDataType,
    INT* piValue,
    FILETIME* pftValue,   // optional
    LPSTR szValueBuf,   // optional
    DWORD* pcchValueBuf   // optional
);
[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiSummaryInfoGetPropertyA(
    uint hSummaryInfo,   // MSIHANDLE
    uint uiProperty,   // DWORD
    out uint puiDataType,   // DWORD* out
    out int piValue,   // INT* out
    IntPtr pftValue,   // FILETIME* optional, out
    [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder szValueBuf,   // LPSTR optional, out
    IntPtr pcchValueBuf   // DWORD* optional, in/out
);
<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiSummaryInfoGetPropertyA(
    hSummaryInfo As UInteger,   ' MSIHANDLE
    uiProperty As UInteger,   ' DWORD
    <Out> ByRef puiDataType As UInteger,   ' DWORD* out
    <Out> ByRef piValue As Integer,   ' INT* out
    pftValue As IntPtr,   ' FILETIME* optional, out
    <MarshalAs(UnmanagedType.LPStr)> szValueBuf As System.Text.StringBuilder,   ' LPSTR optional, out
    pcchValueBuf As IntPtr   ' DWORD* optional, in/out
) As UInteger
End Function
' hSummaryInfo : MSIHANDLE
' uiProperty : DWORD
' puiDataType : DWORD* out
' piValue : INT* out
' pftValue : FILETIME* optional, out
' szValueBuf : LPSTR optional, out
' pcchValueBuf : DWORD* optional, in/out
Declare PtrSafe Function MsiSummaryInfoGetPropertyA Lib "msi" ( _
    ByVal hSummaryInfo As Long, _
    ByVal uiProperty As Long, _
    ByRef puiDataType As Long, _
    ByRef piValue As Long, _
    ByVal pftValue As LongPtr, _
    ByVal szValueBuf As String, _
    ByVal pcchValueBuf As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiSummaryInfoGetPropertyA = ctypes.windll.msi.MsiSummaryInfoGetPropertyA
MsiSummaryInfoGetPropertyA.restype = wintypes.DWORD
MsiSummaryInfoGetPropertyA.argtypes = [
    wintypes.DWORD,  # hSummaryInfo : MSIHANDLE
    wintypes.DWORD,  # uiProperty : DWORD
    ctypes.POINTER(wintypes.DWORD),  # puiDataType : DWORD* out
    ctypes.POINTER(ctypes.c_int),  # piValue : INT* out
    ctypes.c_void_p,  # pftValue : FILETIME* optional, out
    wintypes.LPSTR,  # szValueBuf : LPSTR optional, out
    ctypes.POINTER(wintypes.DWORD),  # pcchValueBuf : DWORD* optional, in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiSummaryInfoGetPropertyA = msi.NewProc("MsiSummaryInfoGetPropertyA")
)

// hSummaryInfo (MSIHANDLE), uiProperty (DWORD), puiDataType (DWORD* out), piValue (INT* out), pftValue (FILETIME* optional, out), szValueBuf (LPSTR optional, out), pcchValueBuf (DWORD* optional, in/out)
r1, _, err := procMsiSummaryInfoGetPropertyA.Call(
	uintptr(hSummaryInfo),
	uintptr(uiProperty),
	uintptr(puiDataType),
	uintptr(piValue),
	uintptr(pftValue),
	uintptr(szValueBuf),
	uintptr(pcchValueBuf),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiSummaryInfoGetPropertyA(
  hSummaryInfo: DWORD;   // MSIHANDLE
  uiProperty: DWORD;   // DWORD
  puiDataType: Pointer;   // DWORD* out
  piValue: Pointer;   // INT* out
  pftValue: Pointer;   // FILETIME* optional, out
  szValueBuf: PAnsiChar;   // LPSTR optional, out
  pcchValueBuf: Pointer   // DWORD* optional, in/out
): DWORD; stdcall;
  external 'msi.dll' name 'MsiSummaryInfoGetPropertyA';
result := DllCall("msi\MsiSummaryInfoGetPropertyA"
    , "UInt", hSummaryInfo   ; MSIHANDLE
    , "UInt", uiProperty   ; DWORD
    , "Ptr", puiDataType   ; DWORD* out
    , "Ptr", piValue   ; INT* out
    , "Ptr", pftValue   ; FILETIME* optional, out
    , "Ptr", szValueBuf   ; LPSTR optional, out
    , "Ptr", pcchValueBuf   ; DWORD* optional, in/out
    , "UInt")   ; return: DWORD
●MsiSummaryInfoGetPropertyA(hSummaryInfo, uiProperty, puiDataType, piValue, pftValue, szValueBuf, pcchValueBuf) = DLL("msi.dll", "dword MsiSummaryInfoGetPropertyA(dword, dword, void*, void*, void*, char*, void*)")
# 呼び出し: MsiSummaryInfoGetPropertyA(hSummaryInfo, uiProperty, puiDataType, piValue, pftValue, szValueBuf, pcchValueBuf)
# hSummaryInfo : MSIHANDLE -> "dword"
# uiProperty : DWORD -> "dword"
# puiDataType : DWORD* out -> "void*"
# piValue : INT* out -> "void*"
# pftValue : FILETIME* optional, out -> "void*"
# szValueBuf : LPSTR optional, out -> "char*"
# pcchValueBuf : DWORD* optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "msi" fn MsiSummaryInfoGetPropertyA(
    hSummaryInfo: u32, // MSIHANDLE
    uiProperty: u32, // DWORD
    puiDataType: [*c]u32, // DWORD* out
    piValue: [*c]i32, // INT* out
    pftValue: [*c]FILETIME, // FILETIME* optional, out
    szValueBuf: [*c]u8, // LPSTR optional, out
    pcchValueBuf: [*c]u32 // DWORD* optional, in/out
) callconv(std.os.windows.WINAPI) u32;
proc MsiSummaryInfoGetPropertyA(
    hSummaryInfo: uint32,  # MSIHANDLE
    uiProperty: uint32,  # DWORD
    puiDataType: ptr uint32,  # DWORD* out
    piValue: ptr int32,  # INT* out
    pftValue: ptr FILETIME,  # FILETIME* optional, out
    szValueBuf: ptr char,  # LPSTR optional, out
    pcchValueBuf: ptr uint32  # DWORD* optional, in/out
): uint32 {.importc: "MsiSummaryInfoGetPropertyA", stdcall, dynlib: "msi.dll".}
pragma(lib, "msi");
extern(Windows)
uint MsiSummaryInfoGetPropertyA(
    uint hSummaryInfo,   // MSIHANDLE
    uint uiProperty,   // DWORD
    uint* puiDataType,   // DWORD* out
    int* piValue,   // INT* out
    FILETIME* pftValue,   // FILETIME* optional, out
    char* szValueBuf,   // LPSTR optional, out
    uint* pcchValueBuf   // DWORD* optional, in/out
);
ccall((:MsiSummaryInfoGetPropertyA, "msi.dll"), stdcall, UInt32,
      (UInt32, UInt32, Ptr{UInt32}, Ptr{Int32}, Ptr{FILETIME}, Ptr{UInt8}, Ptr{UInt32}),
      hSummaryInfo, uiProperty, puiDataType, piValue, pftValue, szValueBuf, pcchValueBuf)
# hSummaryInfo : MSIHANDLE -> UInt32
# uiProperty : DWORD -> UInt32
# puiDataType : DWORD* out -> Ptr{UInt32}
# piValue : INT* out -> Ptr{Int32}
# pftValue : FILETIME* optional, out -> Ptr{FILETIME}
# szValueBuf : LPSTR optional, out -> Ptr{UInt8}
# pcchValueBuf : DWORD* optional, in/out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t MsiSummaryInfoGetPropertyA(
    uint32_t hSummaryInfo,
    uint32_t uiProperty,
    uint32_t* puiDataType,
    int32_t* piValue,
    void* pftValue,
    char* szValueBuf,
    uint32_t* pcchValueBuf);
]]
local msi = ffi.load("msi")
-- msi.MsiSummaryInfoGetPropertyA(hSummaryInfo, uiProperty, puiDataType, piValue, pftValue, szValueBuf, pcchValueBuf)
-- hSummaryInfo : MSIHANDLE
-- uiProperty : DWORD
-- puiDataType : DWORD* out
-- piValue : INT* out
-- pftValue : FILETIME* optional, out
-- szValueBuf : LPSTR optional, out
-- pcchValueBuf : DWORD* optional, in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('msi.dll');
const MsiSummaryInfoGetPropertyA = lib.func('__stdcall', 'MsiSummaryInfoGetPropertyA', 'uint32_t', ['uint32_t', 'uint32_t', 'uint32_t *', 'int32_t *', 'void *', 'char *', 'uint32_t *']);
// MsiSummaryInfoGetPropertyA(hSummaryInfo, uiProperty, puiDataType, piValue, pftValue, szValueBuf, pcchValueBuf)
// hSummaryInfo : MSIHANDLE -> 'uint32_t'
// uiProperty : DWORD -> 'uint32_t'
// puiDataType : DWORD* out -> 'uint32_t *'
// piValue : INT* out -> 'int32_t *'
// pftValue : FILETIME* optional, out -> 'void *'
// szValueBuf : LPSTR optional, out -> 'char *'
// pcchValueBuf : DWORD* optional, in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("msi.dll", {
  MsiSummaryInfoGetPropertyA: { parameters: ["u32", "u32", "pointer", "pointer", "pointer", "buffer", "pointer"], result: "u32" },
});
// lib.symbols.MsiSummaryInfoGetPropertyA(hSummaryInfo, uiProperty, puiDataType, piValue, pftValue, szValueBuf, pcchValueBuf)
// hSummaryInfo : MSIHANDLE -> "u32"
// uiProperty : DWORD -> "u32"
// puiDataType : DWORD* out -> "pointer"
// piValue : INT* out -> "pointer"
// pftValue : FILETIME* optional, out -> "pointer"
// szValueBuf : LPSTR optional, out -> "buffer"
// pcchValueBuf : DWORD* optional, in/out -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t MsiSummaryInfoGetPropertyA(
    uint32_t hSummaryInfo,
    uint32_t uiProperty,
    uint32_t* puiDataType,
    int32_t* piValue,
    void* pftValue,
    char* szValueBuf,
    uint32_t* pcchValueBuf);
C, "msi.dll");
// $ffi->MsiSummaryInfoGetPropertyA(hSummaryInfo, uiProperty, puiDataType, piValue, pftValue, szValueBuf, pcchValueBuf);
// hSummaryInfo : MSIHANDLE
// uiProperty : DWORD
// puiDataType : DWORD* out
// piValue : INT* out
// pftValue : FILETIME* optional, out
// szValueBuf : LPSTR optional, out
// pcchValueBuf : DWORD* optional, 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.ASCII_OPTIONS);
    int MsiSummaryInfoGetPropertyA(
        int hSummaryInfo,   // MSIHANDLE
        int uiProperty,   // DWORD
        IntByReference puiDataType,   // DWORD* out
        IntByReference piValue,   // INT* out
        Pointer pftValue,   // FILETIME* optional, out
        byte[] szValueBuf,   // LPSTR optional, out
        IntByReference pcchValueBuf   // DWORD* optional, in/out
    );
}
@[Link("msi")]
lib Libmsi
  fun MsiSummaryInfoGetPropertyA = MsiSummaryInfoGetPropertyA(
    hSummaryInfo : UInt32,   # MSIHANDLE
    uiProperty : UInt32,   # DWORD
    puiDataType : UInt32*,   # DWORD* out
    piValue : Int32*,   # INT* out
    pftValue : FILETIME*,   # FILETIME* optional, out
    szValueBuf : UInt8*,   # LPSTR optional, out
    pcchValueBuf : UInt32*   # DWORD* optional, 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 MsiSummaryInfoGetPropertyANative = Uint32 Function(Uint32, Uint32, Pointer<Uint32>, Pointer<Int32>, Pointer<Void>, Pointer<Utf8>, Pointer<Uint32>);
typedef MsiSummaryInfoGetPropertyADart = int Function(int, int, Pointer<Uint32>, Pointer<Int32>, Pointer<Void>, Pointer<Utf8>, Pointer<Uint32>);
final MsiSummaryInfoGetPropertyA = DynamicLibrary.open('msi.dll')
    .lookupFunction<MsiSummaryInfoGetPropertyANative, MsiSummaryInfoGetPropertyADart>('MsiSummaryInfoGetPropertyA');
// hSummaryInfo : MSIHANDLE -> Uint32
// uiProperty : DWORD -> Uint32
// puiDataType : DWORD* out -> Pointer<Uint32>
// piValue : INT* out -> Pointer<Int32>
// pftValue : FILETIME* optional, out -> Pointer<Void>
// szValueBuf : LPSTR optional, out -> Pointer<Utf8>
// pcchValueBuf : DWORD* optional, in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MsiSummaryInfoGetPropertyA(
  hSummaryInfo: DWORD;   // MSIHANDLE
  uiProperty: DWORD;   // DWORD
  puiDataType: Pointer;   // DWORD* out
  piValue: Pointer;   // INT* out
  pftValue: Pointer;   // FILETIME* optional, out
  szValueBuf: PAnsiChar;   // LPSTR optional, out
  pcchValueBuf: Pointer   // DWORD* optional, in/out
): DWORD; stdcall;
  external 'msi.dll' name 'MsiSummaryInfoGetPropertyA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MsiSummaryInfoGetPropertyA"
  c_MsiSummaryInfoGetPropertyA :: Word32 -> Word32 -> Ptr Word32 -> Ptr Int32 -> Ptr () -> CString -> Ptr Word32 -> IO Word32
-- hSummaryInfo : MSIHANDLE -> Word32
-- uiProperty : DWORD -> Word32
-- puiDataType : DWORD* out -> Ptr Word32
-- piValue : INT* out -> Ptr Int32
-- pftValue : FILETIME* optional, out -> Ptr ()
-- szValueBuf : LPSTR optional, out -> CString
-- pcchValueBuf : DWORD* optional, in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let msisummaryinfogetpropertya =
  foreign "MsiSummaryInfoGetPropertyA"
    (uint32_t @-> uint32_t @-> (ptr uint32_t) @-> (ptr int32_t) @-> (ptr void) @-> string @-> (ptr uint32_t) @-> returning uint32_t)
(* hSummaryInfo : MSIHANDLE -> uint32_t *)
(* uiProperty : DWORD -> uint32_t *)
(* puiDataType : DWORD* out -> (ptr uint32_t) *)
(* piValue : INT* out -> (ptr int32_t) *)
(* pftValue : FILETIME* optional, out -> (ptr void) *)
(* szValueBuf : LPSTR optional, out -> string *)
(* pcchValueBuf : DWORD* optional, 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 ("MsiSummaryInfoGetPropertyA" msi-summary-info-get-property-a :convention :stdcall) :uint32
  (h-summary-info :uint32)   ; MSIHANDLE
  (ui-property :uint32)   ; DWORD
  (pui-data-type :pointer)   ; DWORD* out
  (pi-value :pointer)   ; INT* out
  (pft-value :pointer)   ; FILETIME* optional, out
  (sz-value-buf :pointer)   ; LPSTR optional, out
  (pcch-value-buf :pointer))   ; DWORD* optional, in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MsiSummaryInfoGetPropertyA = Win32::API::More->new('msi',
    'DWORD MsiSummaryInfoGetPropertyA(DWORD hSummaryInfo, DWORD uiProperty, LPVOID puiDataType, LPVOID piValue, LPVOID pftValue, LPSTR szValueBuf, LPVOID pcchValueBuf)');
# my $ret = $MsiSummaryInfoGetPropertyA->Call($hSummaryInfo, $uiProperty, $puiDataType, $piValue, $pftValue, $szValueBuf, $pcchValueBuf);
# hSummaryInfo : MSIHANDLE -> DWORD
# uiProperty : DWORD -> DWORD
# puiDataType : DWORD* out -> LPVOID
# piValue : INT* out -> LPVOID
# pftValue : FILETIME* optional, out -> LPVOID
# szValueBuf : LPSTR optional, out -> LPSTR
# pcchValueBuf : DWORD* optional, in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

文字セット違い
使用する型