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