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