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