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

MsiCreateTransformSummaryInfoW

関数
トランスフォームのサマリ情報を生成して検証条件を設定する。
DLLmsi.dll文字セットUnicode (-W)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiCreateTransformSummaryInfoW(
    MSIHANDLE hDatabase,
    MSIHANDLE hDatabaseReference,
    LPCWSTR szTransformFile,
    MSITRANSFORM_ERROR iErrorConditions,
    MSITRANSFORM_VALIDATE iValidation
);

パラメーター

名前方向説明
hDatabaseMSIHANDLEin新しいデータベースのサマリー情報を含むデータベースへのハンドル。
hDatabaseReferenceMSIHANDLEin元のサマリー情報を含むデータベースへのハンドル。
szTransformFileLPCWSTRinサマリー情報を追加する対象のトランスフォームの名前。
iErrorConditionsMSITRANSFORM_ERRORin

トランスフォームの適用時に抑制するエラー条件。次の値のうち 1 つ以上を使用します。

エラー条件 意味
none
0x00000000
以下の条件のいずれにも該当しません。
MSITRANSFORM_ERROR_ADDEXISTINGROW
0x00000001
既に存在する行の追加。
MSITRANSFORM_ERROR_DELMISSINGROW
0x00000002
存在しない行の削除。
MSITRANSFORM_ERROR_ADDEXISTINGTABLE
0x00000004
既に存在するテーブルの追加。
MSITRANSFORM_ERROR_DELMISSINGTABLE
0x00000008
存在しないテーブルの削除。
MSITRANSFORM_ERROR_UPDATEMISSINGROW
0x00000010
存在しない行の更新。
MSITRANSFORM_ERROR_CHANGECODEPAGE
0x00000020
トランスフォームとデータベースのコードページが一致せず、かつそれらのコードページがニュートラルである。
iValidationMSITRANSFORM_VALIDATEin

トランスフォームをデータベースに適用できることを検証するために、検証するプロパティを指定します。このパラメーターには次の値のうち 1 つ以上を指定できます。

検証フラグ 意味
none
0x00000000
プロパティを検証しません。
MSITRANSFORM_VALIDATE_LANGUAGE
0x00000001
既定の言語がベースデータベースと一致する必要があります。
MSITRANSFORM_VALIDATE_PRODUCT
0x00000002
製品がベースデータベースと一致する必要があります。

製品バージョンの検証フラグ。

検証フラグ 意味
MSITRANSFORM_VALIDATE_MAJORVERSION
0x00000008
メジャーバージョンのみをチェックします。
MSITRANSFORM_VALIDATE_MINORVERSION
0x00000010
メジャーバージョンとマイナーバージョンのみをチェックします。
MSITRANSFORM_VALIDATE_UPDATEVERSION
0x00000020
メジャー、マイナー、および更新バージョンをチェックします。

製品バージョンの関係フラグ。次の表において、インストール済みバージョンはトランスフォームの対象となるパッケージのバージョンであり、ベースバージョンはトランスフォームの作成に使用されたパッケージのバージョンです。

検証フラグ 意味
MSITRANSFORM_VALIDATE_NEWLESSBASEVERSION
0x00000040
インストール済みバージョン < ベースバージョン。
MSITRANSFORM_VALIDATE_NEWLESSEQUALBASEVERSION
0x00000080
インストール済みバージョン <= ベースバージョン。
MSITRANSFORM_VALIDATE_NEWEQUALBASEVERSION
0x00000100
インストール済みバージョン = ベースバージョン。
MSITRANSFORM_VALIDATE_NEWGREATEREQUALBASEVERSION
0x00000200
インストール済みバージョン >= ベースバージョン。
MSITRANSFORM_VALIDATE_NEWGREATERBASEVERSION
0x00000400
インストール済みバージョン > ベースバージョン。

アップグレードコードの検証フラグ。

検証フラグ 意味
MSITRANSFORM_VALIDATE_UPGRADECODE
0x00000800
UpgradeCode がベースデータベースと一致する必要があります。

戻り値の型: DWORD

公式ドキュメント

MsiCreateTransformSummaryInfo 関数は、検証条件およびエラー条件を含めるために、既存のトランスフォームのサマリー情報を作成します。この関数を実行するとエラーレコードが設定され、MsiGetLastErrorRecord を使用してアクセスできます。(Unicode)

戻り値

この関数は UINT を返します。

解説(Remarks)

ProductCode プロパティと ProductVersion プロパティは、ベースデータベースと参照データベースの両方の Property テーブル で定義されている必要があります。MSITRANSFORM_VALIDATE_UPGRADECODE を使用する場合は、両方のデータベースで UpgradeCode プロパティも定義されている必要があります。これらの条件が満たされない場合、 MsiCreateTransformSummaryInfoERROR_INSTALL_PACKAGE_INVALID を返します。

メモ

msiquery.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして MsiCreateTransformSummaryInfo を定義します。エンコーディングニュートラルなエイリアスの使用と、エンコーディングニュートラルでないコードを混在させると、不一致が生じ、コンパイルエラーやランタイムエラーを引き起こす可能性があります。詳細については、関数プロトタイプの規則 を参照してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

DWORD MsiCreateTransformSummaryInfoW(
    MSIHANDLE hDatabase,
    MSIHANDLE hDatabaseReference,
    LPCWSTR szTransformFile,
    MSITRANSFORM_ERROR iErrorConditions,
    MSITRANSFORM_VALIDATE iValidation
);
[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiCreateTransformSummaryInfoW(
    uint hDatabase,   // MSIHANDLE
    uint hDatabaseReference,   // MSIHANDLE
    [MarshalAs(UnmanagedType.LPWStr)] string szTransformFile,   // LPCWSTR
    int iErrorConditions,   // MSITRANSFORM_ERROR
    int iValidation   // MSITRANSFORM_VALIDATE
);
<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiCreateTransformSummaryInfoW(
    hDatabase As UInteger,   ' MSIHANDLE
    hDatabaseReference As UInteger,   ' MSIHANDLE
    <MarshalAs(UnmanagedType.LPWStr)> szTransformFile As String,   ' LPCWSTR
    iErrorConditions As Integer,   ' MSITRANSFORM_ERROR
    iValidation As Integer   ' MSITRANSFORM_VALIDATE
) As UInteger
End Function
' hDatabase : MSIHANDLE
' hDatabaseReference : MSIHANDLE
' szTransformFile : LPCWSTR
' iErrorConditions : MSITRANSFORM_ERROR
' iValidation : MSITRANSFORM_VALIDATE
Declare PtrSafe Function MsiCreateTransformSummaryInfoW Lib "msi" ( _
    ByVal hDatabase As Long, _
    ByVal hDatabaseReference As Long, _
    ByVal szTransformFile As LongPtr, _
    ByVal iErrorConditions As Long, _
    ByVal iValidation 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

MsiCreateTransformSummaryInfoW = ctypes.windll.msi.MsiCreateTransformSummaryInfoW
MsiCreateTransformSummaryInfoW.restype = wintypes.DWORD
MsiCreateTransformSummaryInfoW.argtypes = [
    wintypes.DWORD,  # hDatabase : MSIHANDLE
    wintypes.DWORD,  # hDatabaseReference : MSIHANDLE
    wintypes.LPCWSTR,  # szTransformFile : LPCWSTR
    ctypes.c_int,  # iErrorConditions : MSITRANSFORM_ERROR
    ctypes.c_int,  # iValidation : MSITRANSFORM_VALIDATE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiCreateTransformSummaryInfoW = Fiddle::Function.new(
  lib['MsiCreateTransformSummaryInfoW'],
  [
    -Fiddle::TYPE_INT,  # hDatabase : MSIHANDLE
    -Fiddle::TYPE_INT,  # hDatabaseReference : MSIHANDLE
    Fiddle::TYPE_VOIDP,  # szTransformFile : LPCWSTR
    Fiddle::TYPE_INT,  # iErrorConditions : MSITRANSFORM_ERROR
    Fiddle::TYPE_INT,  # iValidation : MSITRANSFORM_VALIDATE
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "msi")]
extern "system" {
    fn MsiCreateTransformSummaryInfoW(
        hDatabase: u32,  // MSIHANDLE
        hDatabaseReference: u32,  // MSIHANDLE
        szTransformFile: *const u16,  // LPCWSTR
        iErrorConditions: i32,  // MSITRANSFORM_ERROR
        iValidation: i32  // MSITRANSFORM_VALIDATE
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
public static extern uint MsiCreateTransformSummaryInfoW(uint hDatabase, uint hDatabaseReference, [MarshalAs(UnmanagedType.LPWStr)] string szTransformFile, int iErrorConditions, int iValidation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiCreateTransformSummaryInfoW' -Namespace Win32 -PassThru
# $api::MsiCreateTransformSummaryInfoW(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
#uselib "msi.dll"
#func global MsiCreateTransformSummaryInfoW "MsiCreateTransformSummaryInfoW" wptr, wptr, wptr, wptr, wptr
; MsiCreateTransformSummaryInfoW hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation   ; 戻り値は stat
; hDatabase : MSIHANDLE -> "wptr"
; hDatabaseReference : MSIHANDLE -> "wptr"
; szTransformFile : LPCWSTR -> "wptr"
; iErrorConditions : MSITRANSFORM_ERROR -> "wptr"
; iValidation : MSITRANSFORM_VALIDATE -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiCreateTransformSummaryInfoW "MsiCreateTransformSummaryInfoW" int, int, wstr, int, int
; res = MsiCreateTransformSummaryInfoW(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
; hDatabase : MSIHANDLE -> "int"
; hDatabaseReference : MSIHANDLE -> "int"
; szTransformFile : LPCWSTR -> "wstr"
; iErrorConditions : MSITRANSFORM_ERROR -> "int"
; iValidation : MSITRANSFORM_VALIDATE -> "int"
; DWORD MsiCreateTransformSummaryInfoW(MSIHANDLE hDatabase, MSIHANDLE hDatabaseReference, LPCWSTR szTransformFile, MSITRANSFORM_ERROR iErrorConditions, MSITRANSFORM_VALIDATE iValidation)
#uselib "msi.dll"
#cfunc global MsiCreateTransformSummaryInfoW "MsiCreateTransformSummaryInfoW" int, int, wstr, int, int
; res = MsiCreateTransformSummaryInfoW(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
; hDatabase : MSIHANDLE -> "int"
; hDatabaseReference : MSIHANDLE -> "int"
; szTransformFile : LPCWSTR -> "wstr"
; iErrorConditions : MSITRANSFORM_ERROR -> "int"
; iValidation : MSITRANSFORM_VALIDATE -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiCreateTransformSummaryInfoW = msi.NewProc("MsiCreateTransformSummaryInfoW")
)

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

extern "msi" fn MsiCreateTransformSummaryInfoW(
    hDatabase: u32, // MSIHANDLE
    hDatabaseReference: u32, // MSIHANDLE
    szTransformFile: [*c]const u16, // LPCWSTR
    iErrorConditions: i32, // MSITRANSFORM_ERROR
    iValidation: i32 // MSITRANSFORM_VALIDATE
) callconv(std.os.windows.WINAPI) u32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc MsiCreateTransformSummaryInfoW(
    hDatabase: uint32,  # MSIHANDLE
    hDatabaseReference: uint32,  # MSIHANDLE
    szTransformFile: WideCString,  # LPCWSTR
    iErrorConditions: int32,  # MSITRANSFORM_ERROR
    iValidation: int32  # MSITRANSFORM_VALIDATE
): uint32 {.importc: "MsiCreateTransformSummaryInfoW", stdcall, dynlib: "msi.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "msi");
extern(Windows)
uint MsiCreateTransformSummaryInfoW(
    uint hDatabase,   // MSIHANDLE
    uint hDatabaseReference,   // MSIHANDLE
    const(wchar)* szTransformFile,   // LPCWSTR
    int iErrorConditions,   // MSITRANSFORM_ERROR
    int iValidation   // MSITRANSFORM_VALIDATE
);
ccall((:MsiCreateTransformSummaryInfoW, "msi.dll"), stdcall, UInt32,
      (UInt32, UInt32, Cwstring, Int32, Int32),
      hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
# hDatabase : MSIHANDLE -> UInt32
# hDatabaseReference : MSIHANDLE -> UInt32
# szTransformFile : LPCWSTR -> Cwstring
# iErrorConditions : MSITRANSFORM_ERROR -> Int32
# iValidation : MSITRANSFORM_VALIDATE -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
uint32_t MsiCreateTransformSummaryInfoW(
    uint32_t hDatabase,
    uint32_t hDatabaseReference,
    const uint16_t* szTransformFile,
    int32_t iErrorConditions,
    int32_t iValidation);
]]
local msi = ffi.load("msi")
-- msi.MsiCreateTransformSummaryInfoW(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
-- hDatabase : MSIHANDLE
-- hDatabaseReference : MSIHANDLE
-- szTransformFile : LPCWSTR
-- iErrorConditions : MSITRANSFORM_ERROR
-- iValidation : MSITRANSFORM_VALIDATE
-- 構造体/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 MsiCreateTransformSummaryInfoW = lib.func('__stdcall', 'MsiCreateTransformSummaryInfoW', 'uint32_t', ['uint32_t', 'uint32_t', 'str16', 'int32_t', 'int32_t']);
// MsiCreateTransformSummaryInfoW(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
// hDatabase : MSIHANDLE -> 'uint32_t'
// hDatabaseReference : MSIHANDLE -> 'uint32_t'
// szTransformFile : LPCWSTR -> 'str16'
// iErrorConditions : MSITRANSFORM_ERROR -> 'int32_t'
// iValidation : MSITRANSFORM_VALIDATE -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("msi.dll", {
  MsiCreateTransformSummaryInfoW: { parameters: ["u32", "u32", "buffer", "i32", "i32"], result: "u32" },
});
// lib.symbols.MsiCreateTransformSummaryInfoW(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
// hDatabase : MSIHANDLE -> "u32"
// hDatabaseReference : MSIHANDLE -> "u32"
// szTransformFile : LPCWSTR -> "buffer"
// iErrorConditions : MSITRANSFORM_ERROR -> "i32"
// iValidation : MSITRANSFORM_VALIDATE -> "i32"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t MsiCreateTransformSummaryInfoW(
    uint32_t hDatabase,
    uint32_t hDatabaseReference,
    const uint16_t* szTransformFile,
    int32_t iErrorConditions,
    int32_t iValidation);
C, "msi.dll");
// $ffi->MsiCreateTransformSummaryInfoW(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation);
// hDatabase : MSIHANDLE
// hDatabaseReference : MSIHANDLE
// szTransformFile : LPCWSTR
// iErrorConditions : MSITRANSFORM_ERROR
// iValidation : MSITRANSFORM_VALIDATE
// 構造体/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 MsiCreateTransformSummaryInfoW(
        int hDatabase,   // MSIHANDLE
        int hDatabaseReference,   // MSIHANDLE
        WString szTransformFile,   // LPCWSTR
        int iErrorConditions,   // MSITRANSFORM_ERROR
        int iValidation   // MSITRANSFORM_VALIDATE
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("msi")]
lib Libmsi
  fun MsiCreateTransformSummaryInfoW = MsiCreateTransformSummaryInfoW(
    hDatabase : UInt32,   # MSIHANDLE
    hDatabaseReference : UInt32,   # MSIHANDLE
    szTransformFile : UInt16*,   # LPCWSTR
    iErrorConditions : Int32,   # MSITRANSFORM_ERROR
    iValidation : Int32   # MSITRANSFORM_VALIDATE
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MsiCreateTransformSummaryInfoWNative = Uint32 Function(Uint32, Uint32, Pointer<Utf16>, Int32, Int32);
typedef MsiCreateTransformSummaryInfoWDart = int Function(int, int, Pointer<Utf16>, int, int);
final MsiCreateTransformSummaryInfoW = DynamicLibrary.open('msi.dll')
    .lookupFunction<MsiCreateTransformSummaryInfoWNative, MsiCreateTransformSummaryInfoWDart>('MsiCreateTransformSummaryInfoW');
// hDatabase : MSIHANDLE -> Uint32
// hDatabaseReference : MSIHANDLE -> Uint32
// szTransformFile : LPCWSTR -> Pointer<Utf16>
// iErrorConditions : MSITRANSFORM_ERROR -> Int32
// iValidation : MSITRANSFORM_VALIDATE -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MsiCreateTransformSummaryInfoW(
  hDatabase: DWORD;   // MSIHANDLE
  hDatabaseReference: DWORD;   // MSIHANDLE
  szTransformFile: PWideChar;   // LPCWSTR
  iErrorConditions: Integer;   // MSITRANSFORM_ERROR
  iValidation: Integer   // MSITRANSFORM_VALIDATE
): DWORD; stdcall;
  external 'msi.dll' name 'MsiCreateTransformSummaryInfoW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MsiCreateTransformSummaryInfoW"
  c_MsiCreateTransformSummaryInfoW :: Word32 -> Word32 -> CWString -> Int32 -> Int32 -> IO Word32
-- hDatabase : MSIHANDLE -> Word32
-- hDatabaseReference : MSIHANDLE -> Word32
-- szTransformFile : LPCWSTR -> CWString
-- iErrorConditions : MSITRANSFORM_ERROR -> Int32
-- iValidation : MSITRANSFORM_VALIDATE -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let msicreatetransformsummaryinfow =
  foreign "MsiCreateTransformSummaryInfoW"
    (uint32_t @-> uint32_t @-> (ptr uint16_t) @-> int32_t @-> int32_t @-> returning uint32_t)
(* hDatabase : MSIHANDLE -> uint32_t *)
(* hDatabaseReference : MSIHANDLE -> uint32_t *)
(* szTransformFile : LPCWSTR -> (ptr uint16_t) *)
(* iErrorConditions : MSITRANSFORM_ERROR -> int32_t *)
(* iValidation : MSITRANSFORM_VALIDATE -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library msi (t "msi.dll"))
(cffi:use-foreign-library msi)

(cffi:defcfun ("MsiCreateTransformSummaryInfoW" msi-create-transform-summary-info-w :convention :stdcall) :uint32
  (h-database :uint32)   ; MSIHANDLE
  (h-database-reference :uint32)   ; MSIHANDLE
  (sz-transform-file (:string :encoding :utf-16le))   ; LPCWSTR
  (i-error-conditions :int32)   ; MSITRANSFORM_ERROR
  (i-validation :int32))   ; MSITRANSFORM_VALIDATE
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MsiCreateTransformSummaryInfoW = Win32::API::More->new('msi',
    'DWORD MsiCreateTransformSummaryInfoW(DWORD hDatabase, DWORD hDatabaseReference, LPCWSTR szTransformFile, int iErrorConditions, int iValidation)');
# my $ret = $MsiCreateTransformSummaryInfoW->Call($hDatabase, $hDatabaseReference, $szTransformFile, $iErrorConditions, $iValidation);
# hDatabase : MSIHANDLE -> DWORD
# hDatabaseReference : MSIHANDLE -> DWORD
# szTransformFile : LPCWSTR -> LPCWSTR
# iErrorConditions : MSITRANSFORM_ERROR -> int
# iValidation : MSITRANSFORM_VALIDATE -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

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