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