MsiCreateTransformSummaryInfoA
関数シグネチャ
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiCreateTransformSummaryInfoA(
MSIHANDLE hDatabase,
MSIHANDLE hDatabaseReference,
LPCSTR szTransformFile,
MSITRANSFORM_ERROR iErrorConditions,
MSITRANSFORM_VALIDATE iValidation
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| hDatabase | MSIHANDLE | in | 新しいデータベースの要約情報を含むデータベースへのハンドル。 | ||||||||||||||||||||||||||||||||
| hDatabaseReference | MSIHANDLE | in | 元の要約情報を含むデータベースへのハンドル。 | ||||||||||||||||||||||||||||||||
| szTransformFile | LPCSTR | in | 要約情報を追加するトランスフォームの名前。 | ||||||||||||||||||||||||||||||||
| iErrorConditions | MSITRANSFORM_ERROR | in | トランスフォームの適用時に抑制すべきエラー条件。次の値を 1 つ以上使用します。
| ||||||||||||||||||||||||||||||||
| iValidation | MSITRANSFORM_VALIDATE | in | トランスフォームをデータベースに適用できることを確認するために検証するプロパティを指定します。このパラメーターには、次の値を 1 つ以上指定できます。
製品バージョンの検証フラグ。
製品バージョンの関係フラグ。次の表において、インストール済みバージョンとはトランスフォームの対象となるパッケージのバージョンであり、ベースバージョンとはトランスフォームの作成に使用されたパッケージのバージョンです。
アップグレードコードの検証フラグ。
|
戻り値の型: DWORD
公式ドキュメント
MsiCreateTransformSummaryInfo 関数は、検証条件とエラー条件を含めるために、既存のトランスフォームの要約情報を作成します。この関数を実行するとエラーレコードが設定され、MsiGetLastErrorRecord を使用してアクセスできます。(ANSI)
戻り値
この関数は UINT を返します。
解説(Remarks)
ProductCode プロパティと ProductVersion プロパティは、ベースデータベースと参照データベースの両方の Property テーブル で定義されている必要があります。MSITRANSFORM_VALIDATE_UPGRADECODE を使用する場合は、 UpgradeCode プロパティも両方のデータベースで定義されている必要があります。これらの条件が満たされていない場合、 MsiCreateTransformSummaryInfo は ERROR_INSTALL_PACKAGE_INVALID を返します。
- セミコロンはトランスフォーム、ソース、パッチのリスト区切り文字として使用されるため、ファイル名やパスに使用しないでください。
- この関数はカスタムアクションから呼び出すことはできません。カスタムアクションからこの関数を呼び出すと、関数は失敗します。
msiquery.h ヘッダーは、MsiCreateTransformSummaryInfo を、UNICODE プリプロセッサ定数の定義に基づいてこの関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして定義しています。エンコーディングニュートラルなエイリアスの使用を、エンコーディングニュートラルでないコードと混在させると、不一致が生じてコンパイルエラーや実行時エラーを引き起こす可能性があります。詳細については、関数プロトタイプの規約 を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiCreateTransformSummaryInfoA(
MSIHANDLE hDatabase,
MSIHANDLE hDatabaseReference,
LPCSTR szTransformFile,
MSITRANSFORM_ERROR iErrorConditions,
MSITRANSFORM_VALIDATE iValidation
);[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiCreateTransformSummaryInfoA(
uint hDatabase, // MSIHANDLE
uint hDatabaseReference, // MSIHANDLE
[MarshalAs(UnmanagedType.LPStr)] string szTransformFile, // LPCSTR
int iErrorConditions, // MSITRANSFORM_ERROR
int iValidation // MSITRANSFORM_VALIDATE
);<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiCreateTransformSummaryInfoA(
hDatabase As UInteger, ' MSIHANDLE
hDatabaseReference As UInteger, ' MSIHANDLE
<MarshalAs(UnmanagedType.LPStr)> szTransformFile As String, ' LPCSTR
iErrorConditions As Integer, ' MSITRANSFORM_ERROR
iValidation As Integer ' MSITRANSFORM_VALIDATE
) As UInteger
End Function' hDatabase : MSIHANDLE
' hDatabaseReference : MSIHANDLE
' szTransformFile : LPCSTR
' iErrorConditions : MSITRANSFORM_ERROR
' iValidation : MSITRANSFORM_VALIDATE
Declare PtrSafe Function MsiCreateTransformSummaryInfoA Lib "msi" ( _
ByVal hDatabase As Long, _
ByVal hDatabaseReference As Long, _
ByVal szTransformFile As String, _
ByVal iErrorConditions As Long, _
ByVal iValidation As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MsiCreateTransformSummaryInfoA = ctypes.windll.msi.MsiCreateTransformSummaryInfoA
MsiCreateTransformSummaryInfoA.restype = wintypes.DWORD
MsiCreateTransformSummaryInfoA.argtypes = [
wintypes.DWORD, # hDatabase : MSIHANDLE
wintypes.DWORD, # hDatabaseReference : MSIHANDLE
wintypes.LPCSTR, # szTransformFile : LPCSTR
ctypes.c_int, # iErrorConditions : MSITRANSFORM_ERROR
ctypes.c_int, # iValidation : MSITRANSFORM_VALIDATE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiCreateTransformSummaryInfoA = Fiddle::Function.new(
lib['MsiCreateTransformSummaryInfoA'],
[
-Fiddle::TYPE_INT, # hDatabase : MSIHANDLE
-Fiddle::TYPE_INT, # hDatabaseReference : MSIHANDLE
Fiddle::TYPE_VOIDP, # szTransformFile : LPCSTR
Fiddle::TYPE_INT, # iErrorConditions : MSITRANSFORM_ERROR
Fiddle::TYPE_INT, # iValidation : MSITRANSFORM_VALIDATE
],
-Fiddle::TYPE_INT)#[link(name = "msi")]
extern "system" {
fn MsiCreateTransformSummaryInfoA(
hDatabase: u32, // MSIHANDLE
hDatabaseReference: u32, // MSIHANDLE
szTransformFile: *const u8, // LPCSTR
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.Ansi)]
public static extern uint MsiCreateTransformSummaryInfoA(uint hDatabase, uint hDatabaseReference, [MarshalAs(UnmanagedType.LPStr)] string szTransformFile, int iErrorConditions, int iValidation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiCreateTransformSummaryInfoA' -Namespace Win32 -PassThru
# $api::MsiCreateTransformSummaryInfoA(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)#uselib "msi.dll"
#func global MsiCreateTransformSummaryInfoA "MsiCreateTransformSummaryInfoA" sptr, sptr, sptr, sptr, sptr
; MsiCreateTransformSummaryInfoA hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation ; 戻り値は stat
; hDatabase : MSIHANDLE -> "sptr"
; hDatabaseReference : MSIHANDLE -> "sptr"
; szTransformFile : LPCSTR -> "sptr"
; iErrorConditions : MSITRANSFORM_ERROR -> "sptr"
; iValidation : MSITRANSFORM_VALIDATE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "msi.dll"
#cfunc global MsiCreateTransformSummaryInfoA "MsiCreateTransformSummaryInfoA" int, int, str, int, int
; res = MsiCreateTransformSummaryInfoA(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
; hDatabase : MSIHANDLE -> "int"
; hDatabaseReference : MSIHANDLE -> "int"
; szTransformFile : LPCSTR -> "str"
; iErrorConditions : MSITRANSFORM_ERROR -> "int"
; iValidation : MSITRANSFORM_VALIDATE -> "int"; DWORD MsiCreateTransformSummaryInfoA(MSIHANDLE hDatabase, MSIHANDLE hDatabaseReference, LPCSTR szTransformFile, MSITRANSFORM_ERROR iErrorConditions, MSITRANSFORM_VALIDATE iValidation)
#uselib "msi.dll"
#cfunc global MsiCreateTransformSummaryInfoA "MsiCreateTransformSummaryInfoA" int, int, str, int, int
; res = MsiCreateTransformSummaryInfoA(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
; hDatabase : MSIHANDLE -> "int"
; hDatabaseReference : MSIHANDLE -> "int"
; szTransformFile : LPCSTR -> "str"
; iErrorConditions : MSITRANSFORM_ERROR -> "int"
; iValidation : MSITRANSFORM_VALIDATE -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiCreateTransformSummaryInfoA = msi.NewProc("MsiCreateTransformSummaryInfoA")
)
// hDatabase (MSIHANDLE), hDatabaseReference (MSIHANDLE), szTransformFile (LPCSTR), iErrorConditions (MSITRANSFORM_ERROR), iValidation (MSITRANSFORM_VALIDATE)
r1, _, err := procMsiCreateTransformSummaryInfoA.Call(
uintptr(hDatabase),
uintptr(hDatabaseReference),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szTransformFile))),
uintptr(iErrorConditions),
uintptr(iValidation),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiCreateTransformSummaryInfoA(
hDatabase: DWORD; // MSIHANDLE
hDatabaseReference: DWORD; // MSIHANDLE
szTransformFile: PAnsiChar; // LPCSTR
iErrorConditions: Integer; // MSITRANSFORM_ERROR
iValidation: Integer // MSITRANSFORM_VALIDATE
): DWORD; stdcall;
external 'msi.dll' name 'MsiCreateTransformSummaryInfoA';result := DllCall("msi\MsiCreateTransformSummaryInfoA"
, "UInt", hDatabase ; MSIHANDLE
, "UInt", hDatabaseReference ; MSIHANDLE
, "AStr", szTransformFile ; LPCSTR
, "Int", iErrorConditions ; MSITRANSFORM_ERROR
, "Int", iValidation ; MSITRANSFORM_VALIDATE
, "UInt") ; return: DWORD●MsiCreateTransformSummaryInfoA(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation) = DLL("msi.dll", "dword MsiCreateTransformSummaryInfoA(dword, dword, char*, int, int)")
# 呼び出し: MsiCreateTransformSummaryInfoA(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
# hDatabase : MSIHANDLE -> "dword"
# hDatabaseReference : MSIHANDLE -> "dword"
# szTransformFile : LPCSTR -> "char*"
# iErrorConditions : MSITRANSFORM_ERROR -> "int"
# iValidation : MSITRANSFORM_VALIDATE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msi" fn MsiCreateTransformSummaryInfoA(
hDatabase: u32, // MSIHANDLE
hDatabaseReference: u32, // MSIHANDLE
szTransformFile: [*c]const u8, // LPCSTR
iErrorConditions: i32, // MSITRANSFORM_ERROR
iValidation: i32 // MSITRANSFORM_VALIDATE
) callconv(std.os.windows.WINAPI) u32;proc MsiCreateTransformSummaryInfoA(
hDatabase: uint32, # MSIHANDLE
hDatabaseReference: uint32, # MSIHANDLE
szTransformFile: cstring, # LPCSTR
iErrorConditions: int32, # MSITRANSFORM_ERROR
iValidation: int32 # MSITRANSFORM_VALIDATE
): uint32 {.importc: "MsiCreateTransformSummaryInfoA", stdcall, dynlib: "msi.dll".}pragma(lib, "msi");
extern(Windows)
uint MsiCreateTransformSummaryInfoA(
uint hDatabase, // MSIHANDLE
uint hDatabaseReference, // MSIHANDLE
const(char)* szTransformFile, // LPCSTR
int iErrorConditions, // MSITRANSFORM_ERROR
int iValidation // MSITRANSFORM_VALIDATE
);ccall((:MsiCreateTransformSummaryInfoA, "msi.dll"), stdcall, UInt32,
(UInt32, UInt32, Cstring, Int32, Int32),
hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
# hDatabase : MSIHANDLE -> UInt32
# hDatabaseReference : MSIHANDLE -> UInt32
# szTransformFile : LPCSTR -> Cstring
# iErrorConditions : MSITRANSFORM_ERROR -> Int32
# iValidation : MSITRANSFORM_VALIDATE -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t MsiCreateTransformSummaryInfoA(
uint32_t hDatabase,
uint32_t hDatabaseReference,
const char* szTransformFile,
int32_t iErrorConditions,
int32_t iValidation);
]]
local msi = ffi.load("msi")
-- msi.MsiCreateTransformSummaryInfoA(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
-- hDatabase : MSIHANDLE
-- hDatabaseReference : MSIHANDLE
-- szTransformFile : LPCSTR
-- iErrorConditions : MSITRANSFORM_ERROR
-- iValidation : MSITRANSFORM_VALIDATE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('msi.dll');
const MsiCreateTransformSummaryInfoA = lib.func('__stdcall', 'MsiCreateTransformSummaryInfoA', 'uint32_t', ['uint32_t', 'uint32_t', 'str', 'int32_t', 'int32_t']);
// MsiCreateTransformSummaryInfoA(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
// hDatabase : MSIHANDLE -> 'uint32_t'
// hDatabaseReference : MSIHANDLE -> 'uint32_t'
// szTransformFile : LPCSTR -> 'str'
// iErrorConditions : MSITRANSFORM_ERROR -> 'int32_t'
// iValidation : MSITRANSFORM_VALIDATE -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("msi.dll", {
MsiCreateTransformSummaryInfoA: { parameters: ["u32", "u32", "buffer", "i32", "i32"], result: "u32" },
});
// lib.symbols.MsiCreateTransformSummaryInfoA(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation)
// hDatabase : MSIHANDLE -> "u32"
// hDatabaseReference : MSIHANDLE -> "u32"
// szTransformFile : LPCSTR -> "buffer"
// iErrorConditions : MSITRANSFORM_ERROR -> "i32"
// iValidation : MSITRANSFORM_VALIDATE -> "i32"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t MsiCreateTransformSummaryInfoA(
uint32_t hDatabase,
uint32_t hDatabaseReference,
const char* szTransformFile,
int32_t iErrorConditions,
int32_t iValidation);
C, "msi.dll");
// $ffi->MsiCreateTransformSummaryInfoA(hDatabase, hDatabaseReference, szTransformFile, iErrorConditions, iValidation);
// hDatabase : MSIHANDLE
// hDatabaseReference : MSIHANDLE
// szTransformFile : LPCSTR
// 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.ASCII_OPTIONS);
int MsiCreateTransformSummaryInfoA(
int hDatabase, // MSIHANDLE
int hDatabaseReference, // MSIHANDLE
String szTransformFile, // LPCSTR
int iErrorConditions, // MSITRANSFORM_ERROR
int iValidation // MSITRANSFORM_VALIDATE
);
}@[Link("msi")]
lib Libmsi
fun MsiCreateTransformSummaryInfoA = MsiCreateTransformSummaryInfoA(
hDatabase : UInt32, # MSIHANDLE
hDatabaseReference : UInt32, # MSIHANDLE
szTransformFile : UInt8*, # LPCSTR
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 MsiCreateTransformSummaryInfoANative = Uint32 Function(Uint32, Uint32, Pointer<Utf8>, Int32, Int32);
typedef MsiCreateTransformSummaryInfoADart = int Function(int, int, Pointer<Utf8>, int, int);
final MsiCreateTransformSummaryInfoA = DynamicLibrary.open('msi.dll')
.lookupFunction<MsiCreateTransformSummaryInfoANative, MsiCreateTransformSummaryInfoADart>('MsiCreateTransformSummaryInfoA');
// hDatabase : MSIHANDLE -> Uint32
// hDatabaseReference : MSIHANDLE -> Uint32
// szTransformFile : LPCSTR -> Pointer<Utf8>
// iErrorConditions : MSITRANSFORM_ERROR -> Int32
// iValidation : MSITRANSFORM_VALIDATE -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MsiCreateTransformSummaryInfoA(
hDatabase: DWORD; // MSIHANDLE
hDatabaseReference: DWORD; // MSIHANDLE
szTransformFile: PAnsiChar; // LPCSTR
iErrorConditions: Integer; // MSITRANSFORM_ERROR
iValidation: Integer // MSITRANSFORM_VALIDATE
): DWORD; stdcall;
external 'msi.dll' name 'MsiCreateTransformSummaryInfoA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MsiCreateTransformSummaryInfoA"
c_MsiCreateTransformSummaryInfoA :: Word32 -> Word32 -> CString -> Int32 -> Int32 -> IO Word32
-- hDatabase : MSIHANDLE -> Word32
-- hDatabaseReference : MSIHANDLE -> Word32
-- szTransformFile : LPCSTR -> CString
-- iErrorConditions : MSITRANSFORM_ERROR -> Int32
-- iValidation : MSITRANSFORM_VALIDATE -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let msicreatetransformsummaryinfoa =
foreign "MsiCreateTransformSummaryInfoA"
(uint32_t @-> uint32_t @-> string @-> int32_t @-> int32_t @-> returning uint32_t)
(* hDatabase : MSIHANDLE -> uint32_t *)
(* hDatabaseReference : MSIHANDLE -> uint32_t *)
(* szTransformFile : LPCSTR -> string *)
(* 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 ("MsiCreateTransformSummaryInfoA" msi-create-transform-summary-info-a :convention :stdcall) :uint32
(h-database :uint32) ; MSIHANDLE
(h-database-reference :uint32) ; MSIHANDLE
(sz-transform-file :string) ; LPCSTR
(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 $MsiCreateTransformSummaryInfoA = Win32::API::More->new('msi',
'DWORD MsiCreateTransformSummaryInfoA(DWORD hDatabase, DWORD hDatabaseReference, LPCSTR szTransformFile, int iErrorConditions, int iValidation)');
# my $ret = $MsiCreateTransformSummaryInfoA->Call($hDatabase, $hDatabaseReference, $szTransformFile, $iErrorConditions, $iValidation);
# hDatabase : MSIHANDLE -> DWORD
# hDatabaseReference : MSIHANDLE -> DWORD
# szTransformFile : LPCSTR -> LPCSTR
# iErrorConditions : MSITRANSFORM_ERROR -> int
# iValidation : MSITRANSFORM_VALIDATE -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
- f MsiCreateTransformSummaryInfoW (Unicode版) — トランスフォームのサマリ情報を生成して検証条件を設定する。