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

MsiSummaryInfoSetPropertyW

関数
サマリ情報の指定プロパティに値を設定する。
DLLmsi.dll文字セットUnicode (-W)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiSummaryInfoSetPropertyW(
    MSIHANDLE hSummaryInfo,
    DWORD uiProperty,
    DWORD uiDataType,
    INT iValue,
    FILETIME* pftValue,
    LPCWSTR szValue
);

パラメーター

名前方向
hSummaryInfoMSIHANDLEin
uiPropertyDWORDin
uiDataTypeDWORDin
iValueINTin
pftValueFILETIME*inout
szValueLPCWSTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD MsiSummaryInfoSetPropertyW(
    MSIHANDLE hSummaryInfo,
    DWORD uiProperty,
    DWORD uiDataType,
    INT iValue,
    FILETIME* pftValue,
    LPCWSTR szValue
);
[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiSummaryInfoSetPropertyW(
    uint hSummaryInfo,   // MSIHANDLE
    uint uiProperty,   // DWORD
    uint uiDataType,   // DWORD
    int iValue,   // INT
    IntPtr pftValue,   // FILETIME* in/out
    [MarshalAs(UnmanagedType.LPWStr)] string szValue   // LPCWSTR
);
<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiSummaryInfoSetPropertyW(
    hSummaryInfo As UInteger,   ' MSIHANDLE
    uiProperty As UInteger,   ' DWORD
    uiDataType As UInteger,   ' DWORD
    iValue As Integer,   ' INT
    pftValue As IntPtr,   ' FILETIME* in/out
    <MarshalAs(UnmanagedType.LPWStr)> szValue As String   ' LPCWSTR
) As UInteger
End Function
' hSummaryInfo : MSIHANDLE
' uiProperty : DWORD
' uiDataType : DWORD
' iValue : INT
' pftValue : FILETIME* in/out
' szValue : LPCWSTR
Declare PtrSafe Function MsiSummaryInfoSetPropertyW Lib "msi" ( _
    ByVal hSummaryInfo As Long, _
    ByVal uiProperty As Long, _
    ByVal uiDataType As Long, _
    ByVal iValue As Long, _
    ByVal pftValue As LongPtr, _
    ByVal szValue 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

MsiSummaryInfoSetPropertyW = ctypes.windll.msi.MsiSummaryInfoSetPropertyW
MsiSummaryInfoSetPropertyW.restype = wintypes.DWORD
MsiSummaryInfoSetPropertyW.argtypes = [
    wintypes.DWORD,  # hSummaryInfo : MSIHANDLE
    wintypes.DWORD,  # uiProperty : DWORD
    wintypes.DWORD,  # uiDataType : DWORD
    ctypes.c_int,  # iValue : INT
    ctypes.c_void_p,  # pftValue : FILETIME* in/out
    wintypes.LPCWSTR,  # szValue : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiSummaryInfoSetPropertyW = Fiddle::Function.new(
  lib['MsiSummaryInfoSetPropertyW'],
  [
    -Fiddle::TYPE_INT,  # hSummaryInfo : MSIHANDLE
    -Fiddle::TYPE_INT,  # uiProperty : DWORD
    -Fiddle::TYPE_INT,  # uiDataType : DWORD
    Fiddle::TYPE_INT,  # iValue : INT
    Fiddle::TYPE_VOIDP,  # pftValue : FILETIME* in/out
    Fiddle::TYPE_VOIDP,  # szValue : LPCWSTR
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "msi")]
extern "system" {
    fn MsiSummaryInfoSetPropertyW(
        hSummaryInfo: u32,  // MSIHANDLE
        uiProperty: u32,  // DWORD
        uiDataType: u32,  // DWORD
        iValue: i32,  // INT
        pftValue: *mut FILETIME,  // FILETIME* in/out
        szValue: *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 MsiSummaryInfoSetPropertyW(uint hSummaryInfo, uint uiProperty, uint uiDataType, int iValue, IntPtr pftValue, [MarshalAs(UnmanagedType.LPWStr)] string szValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiSummaryInfoSetPropertyW' -Namespace Win32 -PassThru
# $api::MsiSummaryInfoSetPropertyW(hSummaryInfo, uiProperty, uiDataType, iValue, pftValue, szValue)
#uselib "msi.dll"
#func global MsiSummaryInfoSetPropertyW "MsiSummaryInfoSetPropertyW" wptr, wptr, wptr, wptr, wptr, wptr
; MsiSummaryInfoSetPropertyW hSummaryInfo, uiProperty, uiDataType, iValue, varptr(pftValue), szValue   ; 戻り値は stat
; hSummaryInfo : MSIHANDLE -> "wptr"
; uiProperty : DWORD -> "wptr"
; uiDataType : DWORD -> "wptr"
; iValue : INT -> "wptr"
; pftValue : FILETIME* in/out -> "wptr"
; szValue : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "msi.dll"
#cfunc global MsiSummaryInfoSetPropertyW "MsiSummaryInfoSetPropertyW" int, int, int, int, var, wstr
; res = MsiSummaryInfoSetPropertyW(hSummaryInfo, uiProperty, uiDataType, iValue, pftValue, szValue)
; hSummaryInfo : MSIHANDLE -> "int"
; uiProperty : DWORD -> "int"
; uiDataType : DWORD -> "int"
; iValue : INT -> "int"
; pftValue : FILETIME* in/out -> "var"
; szValue : LPCWSTR -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD MsiSummaryInfoSetPropertyW(MSIHANDLE hSummaryInfo, DWORD uiProperty, DWORD uiDataType, INT iValue, FILETIME* pftValue, LPCWSTR szValue)
#uselib "msi.dll"
#cfunc global MsiSummaryInfoSetPropertyW "MsiSummaryInfoSetPropertyW" int, int, int, int, var, wstr
; res = MsiSummaryInfoSetPropertyW(hSummaryInfo, uiProperty, uiDataType, iValue, pftValue, szValue)
; hSummaryInfo : MSIHANDLE -> "int"
; uiProperty : DWORD -> "int"
; uiDataType : DWORD -> "int"
; iValue : INT -> "int"
; pftValue : FILETIME* in/out -> "var"
; szValue : LPCWSTR -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiSummaryInfoSetPropertyW = msi.NewProc("MsiSummaryInfoSetPropertyW")
)

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