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