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

MsiDatabaseApplyTransformA

関数
データベースにトランスフォームを適用して変更を反映する。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiDatabaseApplyTransformA(
    MSIHANDLE hDatabase,
    LPCSTR szTransformFile,
    MSITRANSFORM_ERROR iErrorConditions
);

パラメーター

名前方向
hDatabaseMSIHANDLEin
szTransformFileLPCSTRin
iErrorConditionsMSITRANSFORM_ERRORin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD MsiDatabaseApplyTransformA(
    MSIHANDLE hDatabase,
    LPCSTR szTransformFile,
    MSITRANSFORM_ERROR iErrorConditions
);
[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiDatabaseApplyTransformA(
    uint hDatabase,   // MSIHANDLE
    [MarshalAs(UnmanagedType.LPStr)] string szTransformFile,   // LPCSTR
    int iErrorConditions   // MSITRANSFORM_ERROR
);
<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiDatabaseApplyTransformA(
    hDatabase As UInteger,   ' MSIHANDLE
    <MarshalAs(UnmanagedType.LPStr)> szTransformFile As String,   ' LPCSTR
    iErrorConditions As Integer   ' MSITRANSFORM_ERROR
) As UInteger
End Function
' hDatabase : MSIHANDLE
' szTransformFile : LPCSTR
' iErrorConditions : MSITRANSFORM_ERROR
Declare PtrSafe Function MsiDatabaseApplyTransformA Lib "msi" ( _
    ByVal hDatabase As Long, _
    ByVal szTransformFile As String, _
    ByVal iErrorConditions As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiDatabaseApplyTransformA = ctypes.windll.msi.MsiDatabaseApplyTransformA
MsiDatabaseApplyTransformA.restype = wintypes.DWORD
MsiDatabaseApplyTransformA.argtypes = [
    wintypes.DWORD,  # hDatabase : MSIHANDLE
    wintypes.LPCSTR,  # szTransformFile : LPCSTR
    ctypes.c_int,  # iErrorConditions : MSITRANSFORM_ERROR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiDatabaseApplyTransformA = Fiddle::Function.new(
  lib['MsiDatabaseApplyTransformA'],
  [
    -Fiddle::TYPE_INT,  # hDatabase : MSIHANDLE
    Fiddle::TYPE_VOIDP,  # szTransformFile : LPCSTR
    Fiddle::TYPE_INT,  # iErrorConditions : MSITRANSFORM_ERROR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiDatabaseApplyTransformA(
        hDatabase: u32,  // MSIHANDLE
        szTransformFile: *const u8,  // LPCSTR
        iErrorConditions: i32  // MSITRANSFORM_ERROR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiDatabaseApplyTransformA(uint hDatabase, [MarshalAs(UnmanagedType.LPStr)] string szTransformFile, int iErrorConditions);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiDatabaseApplyTransformA' -Namespace Win32 -PassThru
# $api::MsiDatabaseApplyTransformA(hDatabase, szTransformFile, iErrorConditions)
#uselib "msi.dll"
#func global MsiDatabaseApplyTransformA "MsiDatabaseApplyTransformA" sptr, sptr, sptr
; MsiDatabaseApplyTransformA hDatabase, szTransformFile, iErrorConditions   ; 戻り値は stat
; hDatabase : MSIHANDLE -> "sptr"
; szTransformFile : LPCSTR -> "sptr"
; iErrorConditions : MSITRANSFORM_ERROR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiDatabaseApplyTransformA "MsiDatabaseApplyTransformA" int, str, int
; res = MsiDatabaseApplyTransformA(hDatabase, szTransformFile, iErrorConditions)
; hDatabase : MSIHANDLE -> "int"
; szTransformFile : LPCSTR -> "str"
; iErrorConditions : MSITRANSFORM_ERROR -> "int"
; DWORD MsiDatabaseApplyTransformA(MSIHANDLE hDatabase, LPCSTR szTransformFile, MSITRANSFORM_ERROR iErrorConditions)
#uselib "msi.dll"
#cfunc global MsiDatabaseApplyTransformA "MsiDatabaseApplyTransformA" int, str, int
; res = MsiDatabaseApplyTransformA(hDatabase, szTransformFile, iErrorConditions)
; hDatabase : MSIHANDLE -> "int"
; szTransformFile : LPCSTR -> "str"
; iErrorConditions : MSITRANSFORM_ERROR -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiDatabaseApplyTransformA = msi.NewProc("MsiDatabaseApplyTransformA")
)

// hDatabase (MSIHANDLE), szTransformFile (LPCSTR), iErrorConditions (MSITRANSFORM_ERROR)
r1, _, err := procMsiDatabaseApplyTransformA.Call(
	uintptr(hDatabase),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szTransformFile))),
	uintptr(iErrorConditions),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiDatabaseApplyTransformA(
  hDatabase: DWORD;   // MSIHANDLE
  szTransformFile: PAnsiChar;   // LPCSTR
  iErrorConditions: Integer   // MSITRANSFORM_ERROR
): DWORD; stdcall;
  external 'msi.dll' name 'MsiDatabaseApplyTransformA';
result := DllCall("msi\MsiDatabaseApplyTransformA"
    , "UInt", hDatabase   ; MSIHANDLE
    , "AStr", szTransformFile   ; LPCSTR
    , "Int", iErrorConditions   ; MSITRANSFORM_ERROR
    , "UInt")   ; return: DWORD
●MsiDatabaseApplyTransformA(hDatabase, szTransformFile, iErrorConditions) = DLL("msi.dll", "dword MsiDatabaseApplyTransformA(dword, char*, int)")
# 呼び出し: MsiDatabaseApplyTransformA(hDatabase, szTransformFile, iErrorConditions)
# hDatabase : MSIHANDLE -> "dword"
# szTransformFile : LPCSTR -> "char*"
# iErrorConditions : MSITRANSFORM_ERROR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。