ホーム › System.ApplicationInstallationAndServicing › MsiEnumFeaturesA
MsiEnumFeaturesA
関数指定製品の公開フィーチャーをインデックス順に列挙し親も取得する。
シグネチャ
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiEnumFeaturesA(
LPCSTR szProduct,
DWORD iFeatureIndex,
LPSTR lpFeatureBuf,
LPSTR lpParentBuf // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| szProduct | LPCSTR | in |
| iFeatureIndex | DWORD | in |
| lpFeatureBuf | LPSTR | out |
| lpParentBuf | LPSTR | outoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiEnumFeaturesA(
LPCSTR szProduct,
DWORD iFeatureIndex,
LPSTR lpFeatureBuf,
LPSTR lpParentBuf // optional
);[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiEnumFeaturesA(
[MarshalAs(UnmanagedType.LPStr)] string szProduct, // LPCSTR
uint iFeatureIndex, // DWORD
[MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpFeatureBuf, // LPSTR out
[MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpParentBuf // LPSTR optional, out
);<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiEnumFeaturesA(
<MarshalAs(UnmanagedType.LPStr)> szProduct As String, ' LPCSTR
iFeatureIndex As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPStr)> lpFeatureBuf As System.Text.StringBuilder, ' LPSTR out
<MarshalAs(UnmanagedType.LPStr)> lpParentBuf As System.Text.StringBuilder ' LPSTR optional, out
) As UInteger
End Function' szProduct : LPCSTR
' iFeatureIndex : DWORD
' lpFeatureBuf : LPSTR out
' lpParentBuf : LPSTR optional, out
Declare PtrSafe Function MsiEnumFeaturesA Lib "msi" ( _
ByVal szProduct As String, _
ByVal iFeatureIndex As Long, _
ByVal lpFeatureBuf As String, _
ByVal lpParentBuf As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MsiEnumFeaturesA = ctypes.windll.msi.MsiEnumFeaturesA
MsiEnumFeaturesA.restype = wintypes.DWORD
MsiEnumFeaturesA.argtypes = [
wintypes.LPCSTR, # szProduct : LPCSTR
wintypes.DWORD, # iFeatureIndex : DWORD
wintypes.LPSTR, # lpFeatureBuf : LPSTR out
wintypes.LPSTR, # lpParentBuf : LPSTR optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiEnumFeaturesA = Fiddle::Function.new(
lib['MsiEnumFeaturesA'],
[
Fiddle::TYPE_VOIDP, # szProduct : LPCSTR
-Fiddle::TYPE_INT, # iFeatureIndex : DWORD
Fiddle::TYPE_VOIDP, # lpFeatureBuf : LPSTR out
Fiddle::TYPE_VOIDP, # lpParentBuf : LPSTR optional, out
],
-Fiddle::TYPE_INT)#[link(name = "msi")]
extern "system" {
fn MsiEnumFeaturesA(
szProduct: *const u8, // LPCSTR
iFeatureIndex: u32, // DWORD
lpFeatureBuf: *mut u8, // LPSTR out
lpParentBuf: *mut u8 // LPSTR optional, out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiEnumFeaturesA([MarshalAs(UnmanagedType.LPStr)] string szProduct, uint iFeatureIndex, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpFeatureBuf, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpParentBuf);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiEnumFeaturesA' -Namespace Win32 -PassThru
# $api::MsiEnumFeaturesA(szProduct, iFeatureIndex, lpFeatureBuf, lpParentBuf)#uselib "msi.dll"
#func global MsiEnumFeaturesA "MsiEnumFeaturesA" sptr, sptr, sptr, sptr
; MsiEnumFeaturesA szProduct, iFeatureIndex, varptr(lpFeatureBuf), varptr(lpParentBuf) ; 戻り値は stat
; szProduct : LPCSTR -> "sptr"
; iFeatureIndex : DWORD -> "sptr"
; lpFeatureBuf : LPSTR out -> "sptr"
; lpParentBuf : LPSTR optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "msi.dll" #cfunc global MsiEnumFeaturesA "MsiEnumFeaturesA" str, int, var, var ; res = MsiEnumFeaturesA(szProduct, iFeatureIndex, lpFeatureBuf, lpParentBuf) ; szProduct : LPCSTR -> "str" ; iFeatureIndex : DWORD -> "int" ; lpFeatureBuf : LPSTR out -> "var" ; lpParentBuf : LPSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "msi.dll" #cfunc global MsiEnumFeaturesA "MsiEnumFeaturesA" str, int, sptr, sptr ; res = MsiEnumFeaturesA(szProduct, iFeatureIndex, varptr(lpFeatureBuf), varptr(lpParentBuf)) ; szProduct : LPCSTR -> "str" ; iFeatureIndex : DWORD -> "int" ; lpFeatureBuf : LPSTR out -> "sptr" ; lpParentBuf : LPSTR optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD MsiEnumFeaturesA(LPCSTR szProduct, DWORD iFeatureIndex, LPSTR lpFeatureBuf, LPSTR lpParentBuf) #uselib "msi.dll" #cfunc global MsiEnumFeaturesA "MsiEnumFeaturesA" str, int, var, var ; res = MsiEnumFeaturesA(szProduct, iFeatureIndex, lpFeatureBuf, lpParentBuf) ; szProduct : LPCSTR -> "str" ; iFeatureIndex : DWORD -> "int" ; lpFeatureBuf : LPSTR out -> "var" ; lpParentBuf : LPSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD MsiEnumFeaturesA(LPCSTR szProduct, DWORD iFeatureIndex, LPSTR lpFeatureBuf, LPSTR lpParentBuf) #uselib "msi.dll" #cfunc global MsiEnumFeaturesA "MsiEnumFeaturesA" str, int, intptr, intptr ; res = MsiEnumFeaturesA(szProduct, iFeatureIndex, varptr(lpFeatureBuf), varptr(lpParentBuf)) ; szProduct : LPCSTR -> "str" ; iFeatureIndex : DWORD -> "int" ; lpFeatureBuf : LPSTR out -> "intptr" ; lpParentBuf : LPSTR optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiEnumFeaturesA = msi.NewProc("MsiEnumFeaturesA")
)
// szProduct (LPCSTR), iFeatureIndex (DWORD), lpFeatureBuf (LPSTR out), lpParentBuf (LPSTR optional, out)
r1, _, err := procMsiEnumFeaturesA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(szProduct))),
uintptr(iFeatureIndex),
uintptr(lpFeatureBuf),
uintptr(lpParentBuf),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiEnumFeaturesA(
szProduct: PAnsiChar; // LPCSTR
iFeatureIndex: DWORD; // DWORD
lpFeatureBuf: PAnsiChar; // LPSTR out
lpParentBuf: PAnsiChar // LPSTR optional, out
): DWORD; stdcall;
external 'msi.dll' name 'MsiEnumFeaturesA';result := DllCall("msi\MsiEnumFeaturesA"
, "AStr", szProduct ; LPCSTR
, "UInt", iFeatureIndex ; DWORD
, "Ptr", lpFeatureBuf ; LPSTR out
, "Ptr", lpParentBuf ; LPSTR optional, out
, "UInt") ; return: DWORD●MsiEnumFeaturesA(szProduct, iFeatureIndex, lpFeatureBuf, lpParentBuf) = DLL("msi.dll", "dword MsiEnumFeaturesA(char*, dword, char*, char*)")
# 呼び出し: MsiEnumFeaturesA(szProduct, iFeatureIndex, lpFeatureBuf, lpParentBuf)
# szProduct : LPCSTR -> "char*"
# iFeatureIndex : DWORD -> "dword"
# lpFeatureBuf : LPSTR out -> "char*"
# lpParentBuf : LPSTR optional, out -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。