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

MsiRecordSetInteger

関数
レコードの指定フィールドに整数値を設定する。
DLLmsi.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// msi.dll
#include <windows.h>

DWORD MsiRecordSetInteger(
    MSIHANDLE hRecord,
    DWORD iField,
    INT iValue
);

パラメーター

名前方向
hRecordMSIHANDLEin
iFieldDWORDin
iValueINTin

戻り値の型: DWORD

各言語での呼び出し定義

// msi.dll
#include <windows.h>

DWORD MsiRecordSetInteger(
    MSIHANDLE hRecord,
    DWORD iField,
    INT iValue
);
[DllImport("msi.dll", ExactSpelling = true)]
static extern uint MsiRecordSetInteger(
    uint hRecord,   // MSIHANDLE
    uint iField,   // DWORD
    int iValue   // INT
);
<DllImport("msi.dll", ExactSpelling:=True)>
Public Shared Function MsiRecordSetInteger(
    hRecord As UInteger,   ' MSIHANDLE
    iField As UInteger,   ' DWORD
    iValue As Integer   ' INT
) As UInteger
End Function
' hRecord : MSIHANDLE
' iField : DWORD
' iValue : INT
Declare PtrSafe Function MsiRecordSetInteger Lib "msi" ( _
    ByVal hRecord As Long, _
    ByVal iField As Long, _
    ByVal iValue As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiRecordSetInteger = ctypes.windll.msi.MsiRecordSetInteger
MsiRecordSetInteger.restype = wintypes.DWORD
MsiRecordSetInteger.argtypes = [
    wintypes.DWORD,  # hRecord : MSIHANDLE
    wintypes.DWORD,  # iField : DWORD
    ctypes.c_int,  # iValue : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiRecordSetInteger = Fiddle::Function.new(
  lib['MsiRecordSetInteger'],
  [
    -Fiddle::TYPE_INT,  # hRecord : MSIHANDLE
    -Fiddle::TYPE_INT,  # iField : DWORD
    Fiddle::TYPE_INT,  # iValue : INT
  ],
  -Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiRecordSetInteger(
        hRecord: u32,  // MSIHANDLE
        iField: u32,  // DWORD
        iValue: i32  // INT
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll")]
public static extern uint MsiRecordSetInteger(uint hRecord, uint iField, int iValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiRecordSetInteger' -Namespace Win32 -PassThru
# $api::MsiRecordSetInteger(hRecord, iField, iValue)
#uselib "msi.dll"
#func global MsiRecordSetInteger "MsiRecordSetInteger" sptr, sptr, sptr
; MsiRecordSetInteger hRecord, iField, iValue   ; 戻り値は stat
; hRecord : MSIHANDLE -> "sptr"
; iField : DWORD -> "sptr"
; iValue : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiRecordSetInteger "MsiRecordSetInteger" int, int, int
; res = MsiRecordSetInteger(hRecord, iField, iValue)
; hRecord : MSIHANDLE -> "int"
; iField : DWORD -> "int"
; iValue : INT -> "int"
; DWORD MsiRecordSetInteger(MSIHANDLE hRecord, DWORD iField, INT iValue)
#uselib "msi.dll"
#cfunc global MsiRecordSetInteger "MsiRecordSetInteger" int, int, int
; res = MsiRecordSetInteger(hRecord, iField, iValue)
; hRecord : MSIHANDLE -> "int"
; iField : DWORD -> "int"
; iValue : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiRecordSetInteger = msi.NewProc("MsiRecordSetInteger")
)

// hRecord (MSIHANDLE), iField (DWORD), iValue (INT)
r1, _, err := procMsiRecordSetInteger.Call(
	uintptr(hRecord),
	uintptr(iField),
	uintptr(iValue),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiRecordSetInteger(
  hRecord: DWORD;   // MSIHANDLE
  iField: DWORD;   // DWORD
  iValue: Integer   // INT
): DWORD; stdcall;
  external 'msi.dll' name 'MsiRecordSetInteger';
result := DllCall("msi\MsiRecordSetInteger"
    , "UInt", hRecord   ; MSIHANDLE
    , "UInt", iField   ; DWORD
    , "Int", iValue   ; INT
    , "UInt")   ; return: DWORD
●MsiRecordSetInteger(hRecord, iField, iValue) = DLL("msi.dll", "dword MsiRecordSetInteger(dword, dword, int)")
# 呼び出し: MsiRecordSetInteger(hRecord, iField, iValue)
# hRecord : MSIHANDLE -> "dword"
# iField : DWORD -> "dword"
# iValue : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。