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

MsiSequenceA

関数
指定したシーケンステーブルのアクションを順に実行する(ANSI版)。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiSequenceA(
    MSIHANDLE hInstall,
    LPCSTR szTable,
    INT iSequenceMode
);

パラメーター

名前方向説明
hInstallMSIHANDLEinDLL カスタムアクションに提供されたインストールへのハンドル、または MsiOpenPackageMsiOpenPackageExMsiOpenProduct によって取得されたハンドルです。
szTableLPCSTRinアクションシーケンスを格納するテーブルの名前を指定します。
iSequenceModeINTinこのパラメーターは現在実装されていません。将来の使用のために予約されており、0 を指定する必要があります。

戻り値の型: DWORD

公式ドキュメント

MsiSequence 関数は、指定したテーブルに記述された別のアクションシーケンスを実行します。(ANSI)

戻り値

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

解説(Remarks)

MsiSequence 関数は、指定したテーブルに対してクエリを実行し、Sequence 列の番号順にアクションを並べ替えます。取得した各行について、指定された条件式が FALSE と評価されない限り、アクションが実行されます。

InstallFiles アクションや WriteRegistryValues アクションのように、システムを更新するアクションを含むアクションシーケンスは、 MsiSequence を呼び出して実行することはできません。この規則の例外は、 MsiSequenceInstallExecuteSequence テーブル内の InstallInitialize アクションと InstallFinalize アクションの間にスケジュールされたカスタムアクションから呼び出される場合です。 AppSearchCostInitialize のように、システムを更新しないアクションは呼び出すことができます。

メモ

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

出典・ライセンス: 上記「公式ドキュメント」の内容は 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 MsiSequenceA(
    MSIHANDLE hInstall,
    LPCSTR szTable,
    INT iSequenceMode
);
[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiSequenceA(
    uint hInstall,   // MSIHANDLE
    [MarshalAs(UnmanagedType.LPStr)] string szTable,   // LPCSTR
    int iSequenceMode   // INT
);
<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiSequenceA(
    hInstall As UInteger,   ' MSIHANDLE
    <MarshalAs(UnmanagedType.LPStr)> szTable As String,   ' LPCSTR
    iSequenceMode As Integer   ' INT
) As UInteger
End Function
' hInstall : MSIHANDLE
' szTable : LPCSTR
' iSequenceMode : INT
Declare PtrSafe Function MsiSequenceA Lib "msi" ( _
    ByVal hInstall As Long, _
    ByVal szTable As String, _
    ByVal iSequenceMode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiSequenceA = ctypes.windll.msi.MsiSequenceA
MsiSequenceA.restype = wintypes.DWORD
MsiSequenceA.argtypes = [
    wintypes.DWORD,  # hInstall : MSIHANDLE
    wintypes.LPCSTR,  # szTable : LPCSTR
    ctypes.c_int,  # iSequenceMode : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiSequenceA = msi.NewProc("MsiSequenceA")
)

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

extern "msi" fn MsiSequenceA(
    hInstall: u32, // MSIHANDLE
    szTable: [*c]const u8, // LPCSTR
    iSequenceMode: i32 // INT
) callconv(std.os.windows.WINAPI) u32;
proc MsiSequenceA(
    hInstall: uint32,  # MSIHANDLE
    szTable: cstring,  # LPCSTR
    iSequenceMode: int32  # INT
): uint32 {.importc: "MsiSequenceA", stdcall, dynlib: "msi.dll".}
pragma(lib, "msi");
extern(Windows)
uint MsiSequenceA(
    uint hInstall,   // MSIHANDLE
    const(char)* szTable,   // LPCSTR
    int iSequenceMode   // INT
);
ccall((:MsiSequenceA, "msi.dll"), stdcall, UInt32,
      (UInt32, Cstring, Int32),
      hInstall, szTable, iSequenceMode)
# hInstall : MSIHANDLE -> UInt32
# szTable : LPCSTR -> Cstring
# iSequenceMode : INT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t MsiSequenceA(
    uint32_t hInstall,
    const char* szTable,
    int32_t iSequenceMode);
]]
local msi = ffi.load("msi")
-- msi.MsiSequenceA(hInstall, szTable, iSequenceMode)
-- hInstall : MSIHANDLE
-- szTable : LPCSTR
-- iSequenceMode : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('msi.dll');
const MsiSequenceA = lib.func('__stdcall', 'MsiSequenceA', 'uint32_t', ['uint32_t', 'str', 'int32_t']);
// MsiSequenceA(hInstall, szTable, iSequenceMode)
// hInstall : MSIHANDLE -> 'uint32_t'
// szTable : LPCSTR -> 'str'
// iSequenceMode : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("msi.dll", {
  MsiSequenceA: { parameters: ["u32", "buffer", "i32"], result: "u32" },
});
// lib.symbols.MsiSequenceA(hInstall, szTable, iSequenceMode)
// hInstall : MSIHANDLE -> "u32"
// szTable : LPCSTR -> "buffer"
// iSequenceMode : INT -> "i32"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t MsiSequenceA(
    uint32_t hInstall,
    const char* szTable,
    int32_t iSequenceMode);
C, "msi.dll");
// $ffi->MsiSequenceA(hInstall, szTable, iSequenceMode);
// hInstall : MSIHANDLE
// szTable : LPCSTR
// iSequenceMode : INT
// 構造体/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 MsiSequenceA(
        int hInstall,   // MSIHANDLE
        String szTable,   // LPCSTR
        int iSequenceMode   // INT
    );
}
@[Link("msi")]
lib Libmsi
  fun MsiSequenceA = MsiSequenceA(
    hInstall : UInt32,   # MSIHANDLE
    szTable : UInt8*,   # LPCSTR
    iSequenceMode : Int32   # INT
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MsiSequenceANative = Uint32 Function(Uint32, Pointer<Utf8>, Int32);
typedef MsiSequenceADart = int Function(int, Pointer<Utf8>, int);
final MsiSequenceA = DynamicLibrary.open('msi.dll')
    .lookupFunction<MsiSequenceANative, MsiSequenceADart>('MsiSequenceA');
// hInstall : MSIHANDLE -> Uint32
// szTable : LPCSTR -> Pointer<Utf8>
// iSequenceMode : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MsiSequenceA(
  hInstall: DWORD;   // MSIHANDLE
  szTable: PAnsiChar;   // LPCSTR
  iSequenceMode: Integer   // INT
): DWORD; stdcall;
  external 'msi.dll' name 'MsiSequenceA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MsiSequenceA"
  c_MsiSequenceA :: Word32 -> CString -> Int32 -> IO Word32
-- hInstall : MSIHANDLE -> Word32
-- szTable : LPCSTR -> CString
-- iSequenceMode : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let msisequencea =
  foreign "MsiSequenceA"
    (uint32_t @-> string @-> int32_t @-> returning uint32_t)
(* hInstall : MSIHANDLE -> uint32_t *)
(* szTable : LPCSTR -> string *)
(* iSequenceMode : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library msi (t "msi.dll"))
(cffi:use-foreign-library msi)

(cffi:defcfun ("MsiSequenceA" msi-sequence-a :convention :stdcall) :uint32
  (h-install :uint32)   ; MSIHANDLE
  (sz-table :string)   ; LPCSTR
  (i-sequence-mode :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MsiSequenceA = Win32::API::More->new('msi',
    'DWORD MsiSequenceA(DWORD hInstall, LPCSTR szTable, int iSequenceMode)');
# my $ret = $MsiSequenceA->Call($hInstall, $szTable, $iSequenceMode);
# hInstall : MSIHANDLE -> DWORD
# szTable : LPCSTR -> LPCSTR
# iSequenceMode : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

文字セット違い