ホーム › System.ApplicationInstallationAndServicing › MsiDoActionA
MsiDoActionA
関数指定したインストールアクションを実行する(ANSI版)。
シグネチャ
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiDoActionA(
MSIHANDLE hInstall,
LPCSTR szAction
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hInstall | MSIHANDLE | in |
| szAction | LPCSTR | in |
戻り値の型: DWORD
各言語での呼び出し定義
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiDoActionA(
MSIHANDLE hInstall,
LPCSTR szAction
);[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiDoActionA(
uint hInstall, // MSIHANDLE
[MarshalAs(UnmanagedType.LPStr)] string szAction // LPCSTR
);<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiDoActionA(
hInstall As UInteger, ' MSIHANDLE
<MarshalAs(UnmanagedType.LPStr)> szAction As String ' LPCSTR
) As UInteger
End Function' hInstall : MSIHANDLE
' szAction : LPCSTR
Declare PtrSafe Function MsiDoActionA Lib "msi" ( _
ByVal hInstall As Long, _
ByVal szAction As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MsiDoActionA = ctypes.windll.msi.MsiDoActionA
MsiDoActionA.restype = wintypes.DWORD
MsiDoActionA.argtypes = [
wintypes.DWORD, # hInstall : MSIHANDLE
wintypes.LPCSTR, # szAction : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiDoActionA = Fiddle::Function.new(
lib['MsiDoActionA'],
[
-Fiddle::TYPE_INT, # hInstall : MSIHANDLE
Fiddle::TYPE_VOIDP, # szAction : LPCSTR
],
-Fiddle::TYPE_INT)#[link(name = "msi")]
extern "system" {
fn MsiDoActionA(
hInstall: u32, // MSIHANDLE
szAction: *const u8 // LPCSTR
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiDoActionA(uint hInstall, [MarshalAs(UnmanagedType.LPStr)] string szAction);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiDoActionA' -Namespace Win32 -PassThru
# $api::MsiDoActionA(hInstall, szAction)#uselib "msi.dll"
#func global MsiDoActionA "MsiDoActionA" sptr, sptr
; MsiDoActionA hInstall, szAction ; 戻り値は stat
; hInstall : MSIHANDLE -> "sptr"
; szAction : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "msi.dll"
#cfunc global MsiDoActionA "MsiDoActionA" int, str
; res = MsiDoActionA(hInstall, szAction)
; hInstall : MSIHANDLE -> "int"
; szAction : LPCSTR -> "str"; DWORD MsiDoActionA(MSIHANDLE hInstall, LPCSTR szAction)
#uselib "msi.dll"
#cfunc global MsiDoActionA "MsiDoActionA" int, str
; res = MsiDoActionA(hInstall, szAction)
; hInstall : MSIHANDLE -> "int"
; szAction : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiDoActionA = msi.NewProc("MsiDoActionA")
)
// hInstall (MSIHANDLE), szAction (LPCSTR)
r1, _, err := procMsiDoActionA.Call(
uintptr(hInstall),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szAction))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiDoActionA(
hInstall: DWORD; // MSIHANDLE
szAction: PAnsiChar // LPCSTR
): DWORD; stdcall;
external 'msi.dll' name 'MsiDoActionA';result := DllCall("msi\MsiDoActionA"
, "UInt", hInstall ; MSIHANDLE
, "AStr", szAction ; LPCSTR
, "UInt") ; return: DWORD●MsiDoActionA(hInstall, szAction) = DLL("msi.dll", "dword MsiDoActionA(dword, char*)")
# 呼び出し: MsiDoActionA(hInstall, szAction)
# hInstall : MSIHANDLE -> "dword"
# szAction : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。