ホーム › System.ApplicationInstallationAndServicing › MsiRecordSetStreamW
MsiRecordSetStreamW
関数指定ファイルの内容をレコードのフィールドにストリームとして設定する。
シグネチャ
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiRecordSetStreamW(
MSIHANDLE hRecord,
DWORD iField,
LPCWSTR szFilePath
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hRecord | MSIHANDLE | in |
| iField | DWORD | in |
| szFilePath | LPCWSTR | in |
戻り値の型: DWORD
各言語での呼び出し定義
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiRecordSetStreamW(
MSIHANDLE hRecord,
DWORD iField,
LPCWSTR szFilePath
);[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiRecordSetStreamW(
uint hRecord, // MSIHANDLE
uint iField, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string szFilePath // LPCWSTR
);<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiRecordSetStreamW(
hRecord As UInteger, ' MSIHANDLE
iField As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> szFilePath As String ' LPCWSTR
) As UInteger
End Function' hRecord : MSIHANDLE
' iField : DWORD
' szFilePath : LPCWSTR
Declare PtrSafe Function MsiRecordSetStreamW Lib "msi" ( _
ByVal hRecord As Long, _
ByVal iField As Long, _
ByVal szFilePath 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
MsiRecordSetStreamW = ctypes.windll.msi.MsiRecordSetStreamW
MsiRecordSetStreamW.restype = wintypes.DWORD
MsiRecordSetStreamW.argtypes = [
wintypes.DWORD, # hRecord : MSIHANDLE
wintypes.DWORD, # iField : DWORD
wintypes.LPCWSTR, # szFilePath : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiRecordSetStreamW = Fiddle::Function.new(
lib['MsiRecordSetStreamW'],
[
-Fiddle::TYPE_INT, # hRecord : MSIHANDLE
-Fiddle::TYPE_INT, # iField : DWORD
Fiddle::TYPE_VOIDP, # szFilePath : LPCWSTR
],
-Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "msi")]
extern "system" {
fn MsiRecordSetStreamW(
hRecord: u32, // MSIHANDLE
iField: u32, // DWORD
szFilePath: *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 MsiRecordSetStreamW(uint hRecord, uint iField, [MarshalAs(UnmanagedType.LPWStr)] string szFilePath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiRecordSetStreamW' -Namespace Win32 -PassThru
# $api::MsiRecordSetStreamW(hRecord, iField, szFilePath)#uselib "msi.dll"
#func global MsiRecordSetStreamW "MsiRecordSetStreamW" wptr, wptr, wptr
; MsiRecordSetStreamW hRecord, iField, szFilePath ; 戻り値は stat
; hRecord : MSIHANDLE -> "wptr"
; iField : DWORD -> "wptr"
; szFilePath : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "msi.dll"
#cfunc global MsiRecordSetStreamW "MsiRecordSetStreamW" int, int, wstr
; res = MsiRecordSetStreamW(hRecord, iField, szFilePath)
; hRecord : MSIHANDLE -> "int"
; iField : DWORD -> "int"
; szFilePath : LPCWSTR -> "wstr"; DWORD MsiRecordSetStreamW(MSIHANDLE hRecord, DWORD iField, LPCWSTR szFilePath)
#uselib "msi.dll"
#cfunc global MsiRecordSetStreamW "MsiRecordSetStreamW" int, int, wstr
; res = MsiRecordSetStreamW(hRecord, iField, szFilePath)
; hRecord : MSIHANDLE -> "int"
; iField : DWORD -> "int"
; szFilePath : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiRecordSetStreamW = msi.NewProc("MsiRecordSetStreamW")
)
// hRecord (MSIHANDLE), iField (DWORD), szFilePath (LPCWSTR)
r1, _, err := procMsiRecordSetStreamW.Call(
uintptr(hRecord),
uintptr(iField),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szFilePath))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiRecordSetStreamW(
hRecord: DWORD; // MSIHANDLE
iField: DWORD; // DWORD
szFilePath: PWideChar // LPCWSTR
): DWORD; stdcall;
external 'msi.dll' name 'MsiRecordSetStreamW';result := DllCall("msi\MsiRecordSetStreamW"
, "UInt", hRecord ; MSIHANDLE
, "UInt", iField ; DWORD
, "WStr", szFilePath ; LPCWSTR
, "UInt") ; return: DWORD●MsiRecordSetStreamW(hRecord, iField, szFilePath) = DLL("msi.dll", "dword MsiRecordSetStreamW(dword, dword, char*)")
# 呼び出し: MsiRecordSetStreamW(hRecord, iField, szFilePath)
# hRecord : MSIHANDLE -> "dword"
# iField : DWORD -> "dword"
# szFilePath : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。