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

MsiGetSummaryInformationW

関数
データベースのサマリ情報ストリームを開いてハンドルを取得する。
DLLmsi.dll文字セットUnicode (-W)呼出規約winapi対応OSwindows8.0

シグネチャ

// msi.dll  (Unicode / -W)
#include <windows.h>

DWORD MsiGetSummaryInformationW(
    MSIHANDLE hDatabase,
    LPCWSTR szDatabasePath,
    DWORD uiUpdateCount,
    MSIHANDLE* phSummaryInfo
);

パラメーター

名前方向
hDatabaseMSIHANDLEin
szDatabasePathLPCWSTRin
uiUpdateCountDWORDin
phSummaryInfoMSIHANDLE*inout

戻り値の型: DWORD

各言語での呼び出し定義

// msi.dll  (Unicode / -W)
#include <windows.h>

DWORD MsiGetSummaryInformationW(
    MSIHANDLE hDatabase,
    LPCWSTR szDatabasePath,
    DWORD uiUpdateCount,
    MSIHANDLE* phSummaryInfo
);
[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiGetSummaryInformationW(
    uint hDatabase,   // MSIHANDLE
    [MarshalAs(UnmanagedType.LPWStr)] string szDatabasePath,   // LPCWSTR
    uint uiUpdateCount,   // DWORD
    ref uint phSummaryInfo   // MSIHANDLE* in/out
);
<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiGetSummaryInformationW(
    hDatabase As UInteger,   ' MSIHANDLE
    <MarshalAs(UnmanagedType.LPWStr)> szDatabasePath As String,   ' LPCWSTR
    uiUpdateCount As UInteger,   ' DWORD
    ByRef phSummaryInfo As UInteger   ' MSIHANDLE* in/out
) As UInteger
End Function
' hDatabase : MSIHANDLE
' szDatabasePath : LPCWSTR
' uiUpdateCount : DWORD
' phSummaryInfo : MSIHANDLE* in/out
Declare PtrSafe Function MsiGetSummaryInformationW Lib "msi" ( _
    ByVal hDatabase As Long, _
    ByVal szDatabasePath As LongPtr, _
    ByVal uiUpdateCount As Long, _
    ByRef phSummaryInfo As Long) 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

MsiGetSummaryInformationW = ctypes.windll.msi.MsiGetSummaryInformationW
MsiGetSummaryInformationW.restype = wintypes.DWORD
MsiGetSummaryInformationW.argtypes = [
    wintypes.DWORD,  # hDatabase : MSIHANDLE
    wintypes.LPCWSTR,  # szDatabasePath : LPCWSTR
    wintypes.DWORD,  # uiUpdateCount : DWORD
    ctypes.c_void_p,  # phSummaryInfo : MSIHANDLE* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiGetSummaryInformationW = Fiddle::Function.new(
  lib['MsiGetSummaryInformationW'],
  [
    -Fiddle::TYPE_INT,  # hDatabase : MSIHANDLE
    Fiddle::TYPE_VOIDP,  # szDatabasePath : LPCWSTR
    -Fiddle::TYPE_INT,  # uiUpdateCount : DWORD
    Fiddle::TYPE_VOIDP,  # phSummaryInfo : MSIHANDLE* in/out
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "msi")]
extern "system" {
    fn MsiGetSummaryInformationW(
        hDatabase: u32,  // MSIHANDLE
        szDatabasePath: *const u16,  // LPCWSTR
        uiUpdateCount: u32,  // DWORD
        phSummaryInfo: *mut u32  // MSIHANDLE* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
public static extern uint MsiGetSummaryInformationW(uint hDatabase, [MarshalAs(UnmanagedType.LPWStr)] string szDatabasePath, uint uiUpdateCount, ref uint phSummaryInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiGetSummaryInformationW' -Namespace Win32 -PassThru
# $api::MsiGetSummaryInformationW(hDatabase, szDatabasePath, uiUpdateCount, phSummaryInfo)
#uselib "msi.dll"
#func global MsiGetSummaryInformationW "MsiGetSummaryInformationW" wptr, wptr, wptr, wptr
; MsiGetSummaryInformationW hDatabase, szDatabasePath, uiUpdateCount, phSummaryInfo   ; 戻り値は stat
; hDatabase : MSIHANDLE -> "wptr"
; szDatabasePath : LPCWSTR -> "wptr"
; uiUpdateCount : DWORD -> "wptr"
; phSummaryInfo : MSIHANDLE* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiGetSummaryInformationW "MsiGetSummaryInformationW" int, wstr, int, int
; res = MsiGetSummaryInformationW(hDatabase, szDatabasePath, uiUpdateCount, phSummaryInfo)
; hDatabase : MSIHANDLE -> "int"
; szDatabasePath : LPCWSTR -> "wstr"
; uiUpdateCount : DWORD -> "int"
; phSummaryInfo : MSIHANDLE* in/out -> "int"
; DWORD MsiGetSummaryInformationW(MSIHANDLE hDatabase, LPCWSTR szDatabasePath, DWORD uiUpdateCount, MSIHANDLE* phSummaryInfo)
#uselib "msi.dll"
#cfunc global MsiGetSummaryInformationW "MsiGetSummaryInformationW" int, wstr, int, int
; res = MsiGetSummaryInformationW(hDatabase, szDatabasePath, uiUpdateCount, phSummaryInfo)
; hDatabase : MSIHANDLE -> "int"
; szDatabasePath : LPCWSTR -> "wstr"
; uiUpdateCount : DWORD -> "int"
; phSummaryInfo : MSIHANDLE* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiGetSummaryInformationW = msi.NewProc("MsiGetSummaryInformationW")
)

// hDatabase (MSIHANDLE), szDatabasePath (LPCWSTR), uiUpdateCount (DWORD), phSummaryInfo (MSIHANDLE* in/out)
r1, _, err := procMsiGetSummaryInformationW.Call(
	uintptr(hDatabase),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szDatabasePath))),
	uintptr(uiUpdateCount),
	uintptr(phSummaryInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiGetSummaryInformationW(
  hDatabase: DWORD;   // MSIHANDLE
  szDatabasePath: PWideChar;   // LPCWSTR
  uiUpdateCount: DWORD;   // DWORD
  phSummaryInfo: Pointer   // MSIHANDLE* in/out
): DWORD; stdcall;
  external 'msi.dll' name 'MsiGetSummaryInformationW';
result := DllCall("msi\MsiGetSummaryInformationW"
    , "UInt", hDatabase   ; MSIHANDLE
    , "WStr", szDatabasePath   ; LPCWSTR
    , "UInt", uiUpdateCount   ; DWORD
    , "Ptr", phSummaryInfo   ; MSIHANDLE* in/out
    , "UInt")   ; return: DWORD
●MsiGetSummaryInformationW(hDatabase, szDatabasePath, uiUpdateCount, phSummaryInfo) = DLL("msi.dll", "dword MsiGetSummaryInformationW(dword, char*, dword, void*)")
# 呼び出し: MsiGetSummaryInformationW(hDatabase, szDatabasePath, uiUpdateCount, phSummaryInfo)
# hDatabase : MSIHANDLE -> "dword"
# szDatabasePath : LPCWSTR -> "char*"
# uiUpdateCount : DWORD -> "dword"
# phSummaryInfo : MSIHANDLE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。