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

MsiRecordSetStreamA

関数
指定ファイルの内容をレコードのフィールドにストリームとして設定する。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiRecordSetStreamA(
    MSIHANDLE hRecord,
    DWORD iField,
    LPCSTR szFilePath
);

パラメーター

名前方向
hRecordMSIHANDLEin
iFieldDWORDin
szFilePathLPCSTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

MsiRecordSetStreamA = ctypes.windll.msi.MsiRecordSetStreamA
MsiRecordSetStreamA.restype = wintypes.DWORD
MsiRecordSetStreamA.argtypes = [
    wintypes.DWORD,  # hRecord : MSIHANDLE
    wintypes.DWORD,  # iField : DWORD
    wintypes.LPCSTR,  # szFilePath : LPCSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiRecordSetStreamA = Fiddle::Function.new(
  lib['MsiRecordSetStreamA'],
  [
    -Fiddle::TYPE_INT,  # hRecord : MSIHANDLE
    -Fiddle::TYPE_INT,  # iField : DWORD
    Fiddle::TYPE_VOIDP,  # szFilePath : LPCSTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiRecordSetStreamA(
        hRecord: u32,  // MSIHANDLE
        iField: u32,  // DWORD
        szFilePath: *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 MsiRecordSetStreamA(uint hRecord, uint iField, [MarshalAs(UnmanagedType.LPStr)] string szFilePath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiRecordSetStreamA' -Namespace Win32 -PassThru
# $api::MsiRecordSetStreamA(hRecord, iField, szFilePath)
#uselib "msi.dll"
#func global MsiRecordSetStreamA "MsiRecordSetStreamA" sptr, sptr, sptr
; MsiRecordSetStreamA hRecord, iField, szFilePath   ; 戻り値は stat
; hRecord : MSIHANDLE -> "sptr"
; iField : DWORD -> "sptr"
; szFilePath : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiRecordSetStreamA "MsiRecordSetStreamA" int, int, str
; res = MsiRecordSetStreamA(hRecord, iField, szFilePath)
; hRecord : MSIHANDLE -> "int"
; iField : DWORD -> "int"
; szFilePath : LPCSTR -> "str"
; DWORD MsiRecordSetStreamA(MSIHANDLE hRecord, DWORD iField, LPCSTR szFilePath)
#uselib "msi.dll"
#cfunc global MsiRecordSetStreamA "MsiRecordSetStreamA" int, int, str
; res = MsiRecordSetStreamA(hRecord, iField, szFilePath)
; hRecord : MSIHANDLE -> "int"
; iField : DWORD -> "int"
; szFilePath : LPCSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiRecordSetStreamA = msi.NewProc("MsiRecordSetStreamA")
)

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