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