Win32 API 日本語リファレンス
ホームSystem.ApplicationInstallationAndServicing › MsiDeterminePatchSequenceA

MsiDeterminePatchSequenceA

関数
パッチの適用順序を判定する(ANSI版)。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

// msi.dll  (ANSI / -A)
#include <windows.h>

DWORD MsiDeterminePatchSequenceA(
    LPCSTR szProductCode,
    LPCSTR szUserSid,   // optional
    MSIINSTALLCONTEXT dwContext,
    DWORD cPatchInfo,
    MSIPATCHSEQUENCEINFOA* pPatchInfo
);

パラメーター

名前方向
szProductCodeLPCSTRin
szUserSidLPCSTRinoptional
dwContextMSIINSTALLCONTEXTin
cPatchInfoDWORDin
pPatchInfoMSIPATCHSEQUENCEINFOA*inout

戻り値の型: DWORD

各言語での呼び出し定義

// msi.dll  (ANSI / -A)
#include <windows.h>

DWORD MsiDeterminePatchSequenceA(
    LPCSTR szProductCode,
    LPCSTR szUserSid,   // optional
    MSIINSTALLCONTEXT dwContext,
    DWORD cPatchInfo,
    MSIPATCHSEQUENCEINFOA* pPatchInfo
);
[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiDeterminePatchSequenceA(
    [MarshalAs(UnmanagedType.LPStr)] string szProductCode,   // LPCSTR
    [MarshalAs(UnmanagedType.LPStr)] string szUserSid,   // LPCSTR optional
    int dwContext,   // MSIINSTALLCONTEXT
    uint cPatchInfo,   // DWORD
    IntPtr pPatchInfo   // MSIPATCHSEQUENCEINFOA* in/out
);
<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiDeterminePatchSequenceA(
    <MarshalAs(UnmanagedType.LPStr)> szProductCode As String,   ' LPCSTR
    <MarshalAs(UnmanagedType.LPStr)> szUserSid As String,   ' LPCSTR optional
    dwContext As Integer,   ' MSIINSTALLCONTEXT
    cPatchInfo As UInteger,   ' DWORD
    pPatchInfo As IntPtr   ' MSIPATCHSEQUENCEINFOA* in/out
) As UInteger
End Function
' szProductCode : LPCSTR
' szUserSid : LPCSTR optional
' dwContext : MSIINSTALLCONTEXT
' cPatchInfo : DWORD
' pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out
Declare PtrSafe Function MsiDeterminePatchSequenceA Lib "msi" ( _
    ByVal szProductCode As String, _
    ByVal szUserSid As String, _
    ByVal dwContext As Long, _
    ByVal cPatchInfo As Long, _
    ByVal pPatchInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiDeterminePatchSequenceA = ctypes.windll.msi.MsiDeterminePatchSequenceA
MsiDeterminePatchSequenceA.restype = wintypes.DWORD
MsiDeterminePatchSequenceA.argtypes = [
    wintypes.LPCSTR,  # szProductCode : LPCSTR
    wintypes.LPCSTR,  # szUserSid : LPCSTR optional
    ctypes.c_int,  # dwContext : MSIINSTALLCONTEXT
    wintypes.DWORD,  # cPatchInfo : DWORD
    ctypes.c_void_p,  # pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiDeterminePatchSequenceA = Fiddle::Function.new(
  lib['MsiDeterminePatchSequenceA'],
  [
    Fiddle::TYPE_VOIDP,  # szProductCode : LPCSTR
    Fiddle::TYPE_VOIDP,  # szUserSid : LPCSTR optional
    Fiddle::TYPE_INT,  # dwContext : MSIINSTALLCONTEXT
    -Fiddle::TYPE_INT,  # cPatchInfo : DWORD
    Fiddle::TYPE_VOIDP,  # pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiDeterminePatchSequenceA(
        szProductCode: *const u8,  // LPCSTR
        szUserSid: *const u8,  // LPCSTR optional
        dwContext: i32,  // MSIINSTALLCONTEXT
        cPatchInfo: u32,  // DWORD
        pPatchInfo: *mut MSIPATCHSEQUENCEINFOA  // MSIPATCHSEQUENCEINFOA* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiDeterminePatchSequenceA([MarshalAs(UnmanagedType.LPStr)] string szProductCode, [MarshalAs(UnmanagedType.LPStr)] string szUserSid, int dwContext, uint cPatchInfo, IntPtr pPatchInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiDeterminePatchSequenceA' -Namespace Win32 -PassThru
# $api::MsiDeterminePatchSequenceA(szProductCode, szUserSid, dwContext, cPatchInfo, pPatchInfo)
#uselib "msi.dll"
#func global MsiDeterminePatchSequenceA "MsiDeterminePatchSequenceA" sptr, sptr, sptr, sptr, sptr
; MsiDeterminePatchSequenceA szProductCode, szUserSid, dwContext, cPatchInfo, varptr(pPatchInfo)   ; 戻り値は stat
; szProductCode : LPCSTR -> "sptr"
; szUserSid : LPCSTR optional -> "sptr"
; dwContext : MSIINSTALLCONTEXT -> "sptr"
; cPatchInfo : DWORD -> "sptr"
; pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "msi.dll"
#cfunc global MsiDeterminePatchSequenceA "MsiDeterminePatchSequenceA" str, str, int, int, var
; res = MsiDeterminePatchSequenceA(szProductCode, szUserSid, dwContext, cPatchInfo, pPatchInfo)
; szProductCode : LPCSTR -> "str"
; szUserSid : LPCSTR optional -> "str"
; dwContext : MSIINSTALLCONTEXT -> "int"
; cPatchInfo : DWORD -> "int"
; pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD MsiDeterminePatchSequenceA(LPCSTR szProductCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD cPatchInfo, MSIPATCHSEQUENCEINFOA* pPatchInfo)
#uselib "msi.dll"
#cfunc global MsiDeterminePatchSequenceA "MsiDeterminePatchSequenceA" str, str, int, int, var
; res = MsiDeterminePatchSequenceA(szProductCode, szUserSid, dwContext, cPatchInfo, pPatchInfo)
; szProductCode : LPCSTR -> "str"
; szUserSid : LPCSTR optional -> "str"
; dwContext : MSIINSTALLCONTEXT -> "int"
; cPatchInfo : DWORD -> "int"
; pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiDeterminePatchSequenceA = msi.NewProc("MsiDeterminePatchSequenceA")
)

// szProductCode (LPCSTR), szUserSid (LPCSTR optional), dwContext (MSIINSTALLCONTEXT), cPatchInfo (DWORD), pPatchInfo (MSIPATCHSEQUENCEINFOA* in/out)
r1, _, err := procMsiDeterminePatchSequenceA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szProductCode))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szUserSid))),
	uintptr(dwContext),
	uintptr(cPatchInfo),
	uintptr(pPatchInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiDeterminePatchSequenceA(
  szProductCode: PAnsiChar;   // LPCSTR
  szUserSid: PAnsiChar;   // LPCSTR optional
  dwContext: Integer;   // MSIINSTALLCONTEXT
  cPatchInfo: DWORD;   // DWORD
  pPatchInfo: Pointer   // MSIPATCHSEQUENCEINFOA* in/out
): DWORD; stdcall;
  external 'msi.dll' name 'MsiDeterminePatchSequenceA';
result := DllCall("msi\MsiDeterminePatchSequenceA"
    , "AStr", szProductCode   ; LPCSTR
    , "AStr", szUserSid   ; LPCSTR optional
    , "Int", dwContext   ; MSIINSTALLCONTEXT
    , "UInt", cPatchInfo   ; DWORD
    , "Ptr", pPatchInfo   ; MSIPATCHSEQUENCEINFOA* in/out
    , "UInt")   ; return: DWORD
●MsiDeterminePatchSequenceA(szProductCode, szUserSid, dwContext, cPatchInfo, pPatchInfo) = DLL("msi.dll", "dword MsiDeterminePatchSequenceA(char*, char*, int, dword, void*)")
# 呼び出し: MsiDeterminePatchSequenceA(szProductCode, szUserSid, dwContext, cPatchInfo, pPatchInfo)
# szProductCode : LPCSTR -> "char*"
# szUserSid : LPCSTR optional -> "char*"
# dwContext : MSIINSTALLCONTEXT -> "int"
# cPatchInfo : DWORD -> "dword"
# pPatchInfo : MSIPATCHSEQUENCEINFOA* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。