ホーム › System.ApplicationInstallationAndServicing › MsiSetPropertyA
MsiSetPropertyA
関数実行中のインストールセッションのプロパティ値を設定する。
シグネチャ
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiSetPropertyA(
MSIHANDLE hInstall,
LPCSTR szName,
LPCSTR szValue
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hInstall | MSIHANDLE | in |
| szName | LPCSTR | in |
| szValue | LPCSTR | in |
戻り値の型: DWORD
各言語での呼び出し定義
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiSetPropertyA(
MSIHANDLE hInstall,
LPCSTR szName,
LPCSTR szValue
);[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiSetPropertyA(
uint hInstall, // MSIHANDLE
[MarshalAs(UnmanagedType.LPStr)] string szName, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string szValue // LPCSTR
);<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiSetPropertyA(
hInstall As UInteger, ' MSIHANDLE
<MarshalAs(UnmanagedType.LPStr)> szName As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> szValue As String ' LPCSTR
) As UInteger
End Function' hInstall : MSIHANDLE
' szName : LPCSTR
' szValue : LPCSTR
Declare PtrSafe Function MsiSetPropertyA Lib "msi" ( _
ByVal hInstall As Long, _
ByVal szName As String, _
ByVal szValue As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MsiSetPropertyA = ctypes.windll.msi.MsiSetPropertyA
MsiSetPropertyA.restype = wintypes.DWORD
MsiSetPropertyA.argtypes = [
wintypes.DWORD, # hInstall : MSIHANDLE
wintypes.LPCSTR, # szName : LPCSTR
wintypes.LPCSTR, # szValue : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiSetPropertyA = Fiddle::Function.new(
lib['MsiSetPropertyA'],
[
-Fiddle::TYPE_INT, # hInstall : MSIHANDLE
Fiddle::TYPE_VOIDP, # szName : LPCSTR
Fiddle::TYPE_VOIDP, # szValue : LPCSTR
],
-Fiddle::TYPE_INT)#[link(name = "msi")]
extern "system" {
fn MsiSetPropertyA(
hInstall: u32, // MSIHANDLE
szName: *const u8, // LPCSTR
szValue: *const u8 // LPCSTR
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiSetPropertyA(uint hInstall, [MarshalAs(UnmanagedType.LPStr)] string szName, [MarshalAs(UnmanagedType.LPStr)] string szValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiSetPropertyA' -Namespace Win32 -PassThru
# $api::MsiSetPropertyA(hInstall, szName, szValue)#uselib "msi.dll"
#func global MsiSetPropertyA "MsiSetPropertyA" sptr, sptr, sptr
; MsiSetPropertyA hInstall, szName, szValue ; 戻り値は stat
; hInstall : MSIHANDLE -> "sptr"
; szName : LPCSTR -> "sptr"
; szValue : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "msi.dll"
#cfunc global MsiSetPropertyA "MsiSetPropertyA" int, str, str
; res = MsiSetPropertyA(hInstall, szName, szValue)
; hInstall : MSIHANDLE -> "int"
; szName : LPCSTR -> "str"
; szValue : LPCSTR -> "str"; DWORD MsiSetPropertyA(MSIHANDLE hInstall, LPCSTR szName, LPCSTR szValue)
#uselib "msi.dll"
#cfunc global MsiSetPropertyA "MsiSetPropertyA" int, str, str
; res = MsiSetPropertyA(hInstall, szName, szValue)
; hInstall : MSIHANDLE -> "int"
; szName : LPCSTR -> "str"
; szValue : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiSetPropertyA = msi.NewProc("MsiSetPropertyA")
)
// hInstall (MSIHANDLE), szName (LPCSTR), szValue (LPCSTR)
r1, _, err := procMsiSetPropertyA.Call(
uintptr(hInstall),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szName))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szValue))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiSetPropertyA(
hInstall: DWORD; // MSIHANDLE
szName: PAnsiChar; // LPCSTR
szValue: PAnsiChar // LPCSTR
): DWORD; stdcall;
external 'msi.dll' name 'MsiSetPropertyA';result := DllCall("msi\MsiSetPropertyA"
, "UInt", hInstall ; MSIHANDLE
, "AStr", szName ; LPCSTR
, "AStr", szValue ; LPCSTR
, "UInt") ; return: DWORD●MsiSetPropertyA(hInstall, szName, szValue) = DLL("msi.dll", "dword MsiSetPropertyA(dword, char*, char*)")
# 呼び出し: MsiSetPropertyA(hInstall, szName, szValue)
# hInstall : MSIHANDLE -> "dword"
# szName : LPCSTR -> "char*"
# szValue : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。