ホーム › System.ApplicationInstallationAndServicing › MsiGetFeatureInfoW
MsiGetFeatureInfoW
関数製品のフィーチャーの属性、表示名、ヘルプ文字列を取得する。
シグネチャ
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiGetFeatureInfoW(
MSIHANDLE hProduct,
LPCWSTR szFeature,
DWORD* lpAttributes, // optional
LPWSTR lpTitleBuf, // optional
DWORD* pcchTitleBuf, // optional
LPWSTR lpHelpBuf, // optional
DWORD* pcchHelpBuf // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hProduct | MSIHANDLE | in |
| szFeature | LPCWSTR | in |
| lpAttributes | DWORD* | outoptional |
| lpTitleBuf | LPWSTR | outoptional |
| pcchTitleBuf | DWORD* | inoutoptional |
| lpHelpBuf | LPWSTR | outoptional |
| pcchHelpBuf | DWORD* | inoutoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiGetFeatureInfoW(
MSIHANDLE hProduct,
LPCWSTR szFeature,
DWORD* lpAttributes, // optional
LPWSTR lpTitleBuf, // optional
DWORD* pcchTitleBuf, // optional
LPWSTR lpHelpBuf, // optional
DWORD* pcchHelpBuf // optional
);[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiGetFeatureInfoW(
uint hProduct, // MSIHANDLE
[MarshalAs(UnmanagedType.LPWStr)] string szFeature, // LPCWSTR
IntPtr lpAttributes, // DWORD* optional, out
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpTitleBuf, // LPWSTR optional, out
IntPtr pcchTitleBuf, // DWORD* optional, in/out
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpHelpBuf, // LPWSTR optional, out
IntPtr pcchHelpBuf // DWORD* optional, in/out
);<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiGetFeatureInfoW(
hProduct As UInteger, ' MSIHANDLE
<MarshalAs(UnmanagedType.LPWStr)> szFeature As String, ' LPCWSTR
lpAttributes As IntPtr, ' DWORD* optional, out
<MarshalAs(UnmanagedType.LPWStr)> lpTitleBuf As System.Text.StringBuilder, ' LPWSTR optional, out
pcchTitleBuf As IntPtr, ' DWORD* optional, in/out
<MarshalAs(UnmanagedType.LPWStr)> lpHelpBuf As System.Text.StringBuilder, ' LPWSTR optional, out
pcchHelpBuf As IntPtr ' DWORD* optional, in/out
) As UInteger
End Function' hProduct : MSIHANDLE
' szFeature : LPCWSTR
' lpAttributes : DWORD* optional, out
' lpTitleBuf : LPWSTR optional, out
' pcchTitleBuf : DWORD* optional, in/out
' lpHelpBuf : LPWSTR optional, out
' pcchHelpBuf : DWORD* optional, in/out
Declare PtrSafe Function MsiGetFeatureInfoW Lib "msi" ( _
ByVal hProduct As Long, _
ByVal szFeature As LongPtr, _
ByVal lpAttributes As LongPtr, _
ByVal lpTitleBuf As LongPtr, _
ByVal pcchTitleBuf As LongPtr, _
ByVal lpHelpBuf As LongPtr, _
ByVal pcchHelpBuf 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
MsiGetFeatureInfoW = ctypes.windll.msi.MsiGetFeatureInfoW
MsiGetFeatureInfoW.restype = wintypes.DWORD
MsiGetFeatureInfoW.argtypes = [
wintypes.DWORD, # hProduct : MSIHANDLE
wintypes.LPCWSTR, # szFeature : LPCWSTR
ctypes.POINTER(wintypes.DWORD), # lpAttributes : DWORD* optional, out
wintypes.LPWSTR, # lpTitleBuf : LPWSTR optional, out
ctypes.POINTER(wintypes.DWORD), # pcchTitleBuf : DWORD* optional, in/out
wintypes.LPWSTR, # lpHelpBuf : LPWSTR optional, out
ctypes.POINTER(wintypes.DWORD), # pcchHelpBuf : DWORD* optional, in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiGetFeatureInfoW = Fiddle::Function.new(
lib['MsiGetFeatureInfoW'],
[
-Fiddle::TYPE_INT, # hProduct : MSIHANDLE
Fiddle::TYPE_VOIDP, # szFeature : LPCWSTR
Fiddle::TYPE_VOIDP, # lpAttributes : DWORD* optional, out
Fiddle::TYPE_VOIDP, # lpTitleBuf : LPWSTR optional, out
Fiddle::TYPE_VOIDP, # pcchTitleBuf : DWORD* optional, in/out
Fiddle::TYPE_VOIDP, # lpHelpBuf : LPWSTR optional, out
Fiddle::TYPE_VOIDP, # pcchHelpBuf : DWORD* optional, in/out
],
-Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "msi")]
extern "system" {
fn MsiGetFeatureInfoW(
hProduct: u32, // MSIHANDLE
szFeature: *const u16, // LPCWSTR
lpAttributes: *mut u32, // DWORD* optional, out
lpTitleBuf: *mut u16, // LPWSTR optional, out
pcchTitleBuf: *mut u32, // DWORD* optional, in/out
lpHelpBuf: *mut u16, // LPWSTR optional, out
pcchHelpBuf: *mut u32 // DWORD* optional, in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
public static extern uint MsiGetFeatureInfoW(uint hProduct, [MarshalAs(UnmanagedType.LPWStr)] string szFeature, IntPtr lpAttributes, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpTitleBuf, IntPtr pcchTitleBuf, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpHelpBuf, IntPtr pcchHelpBuf);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiGetFeatureInfoW' -Namespace Win32 -PassThru
# $api::MsiGetFeatureInfoW(hProduct, szFeature, lpAttributes, lpTitleBuf, pcchTitleBuf, lpHelpBuf, pcchHelpBuf)#uselib "msi.dll"
#func global MsiGetFeatureInfoW "MsiGetFeatureInfoW" wptr, wptr, wptr, wptr, wptr, wptr, wptr
; MsiGetFeatureInfoW hProduct, szFeature, varptr(lpAttributes), varptr(lpTitleBuf), varptr(pcchTitleBuf), varptr(lpHelpBuf), varptr(pcchHelpBuf) ; 戻り値は stat
; hProduct : MSIHANDLE -> "wptr"
; szFeature : LPCWSTR -> "wptr"
; lpAttributes : DWORD* optional, out -> "wptr"
; lpTitleBuf : LPWSTR optional, out -> "wptr"
; pcchTitleBuf : DWORD* optional, in/out -> "wptr"
; lpHelpBuf : LPWSTR optional, out -> "wptr"
; pcchHelpBuf : DWORD* optional, in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "msi.dll" #cfunc global MsiGetFeatureInfoW "MsiGetFeatureInfoW" int, wstr, var, var, var, var, var ; res = MsiGetFeatureInfoW(hProduct, szFeature, lpAttributes, lpTitleBuf, pcchTitleBuf, lpHelpBuf, pcchHelpBuf) ; hProduct : MSIHANDLE -> "int" ; szFeature : LPCWSTR -> "wstr" ; lpAttributes : DWORD* optional, out -> "var" ; lpTitleBuf : LPWSTR optional, out -> "var" ; pcchTitleBuf : DWORD* optional, in/out -> "var" ; lpHelpBuf : LPWSTR optional, out -> "var" ; pcchHelpBuf : DWORD* optional, in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "msi.dll" #cfunc global MsiGetFeatureInfoW "MsiGetFeatureInfoW" int, wstr, sptr, sptr, sptr, sptr, sptr ; res = MsiGetFeatureInfoW(hProduct, szFeature, varptr(lpAttributes), varptr(lpTitleBuf), varptr(pcchTitleBuf), varptr(lpHelpBuf), varptr(pcchHelpBuf)) ; hProduct : MSIHANDLE -> "int" ; szFeature : LPCWSTR -> "wstr" ; lpAttributes : DWORD* optional, out -> "sptr" ; lpTitleBuf : LPWSTR optional, out -> "sptr" ; pcchTitleBuf : DWORD* optional, in/out -> "sptr" ; lpHelpBuf : LPWSTR optional, out -> "sptr" ; pcchHelpBuf : DWORD* optional, in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD MsiGetFeatureInfoW(MSIHANDLE hProduct, LPCWSTR szFeature, DWORD* lpAttributes, LPWSTR lpTitleBuf, DWORD* pcchTitleBuf, LPWSTR lpHelpBuf, DWORD* pcchHelpBuf) #uselib "msi.dll" #cfunc global MsiGetFeatureInfoW "MsiGetFeatureInfoW" int, wstr, var, var, var, var, var ; res = MsiGetFeatureInfoW(hProduct, szFeature, lpAttributes, lpTitleBuf, pcchTitleBuf, lpHelpBuf, pcchHelpBuf) ; hProduct : MSIHANDLE -> "int" ; szFeature : LPCWSTR -> "wstr" ; lpAttributes : DWORD* optional, out -> "var" ; lpTitleBuf : LPWSTR optional, out -> "var" ; pcchTitleBuf : DWORD* optional, in/out -> "var" ; lpHelpBuf : LPWSTR optional, out -> "var" ; pcchHelpBuf : DWORD* optional, in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD MsiGetFeatureInfoW(MSIHANDLE hProduct, LPCWSTR szFeature, DWORD* lpAttributes, LPWSTR lpTitleBuf, DWORD* pcchTitleBuf, LPWSTR lpHelpBuf, DWORD* pcchHelpBuf) #uselib "msi.dll" #cfunc global MsiGetFeatureInfoW "MsiGetFeatureInfoW" int, wstr, intptr, intptr, intptr, intptr, intptr ; res = MsiGetFeatureInfoW(hProduct, szFeature, varptr(lpAttributes), varptr(lpTitleBuf), varptr(pcchTitleBuf), varptr(lpHelpBuf), varptr(pcchHelpBuf)) ; hProduct : MSIHANDLE -> "int" ; szFeature : LPCWSTR -> "wstr" ; lpAttributes : DWORD* optional, out -> "intptr" ; lpTitleBuf : LPWSTR optional, out -> "intptr" ; pcchTitleBuf : DWORD* optional, in/out -> "intptr" ; lpHelpBuf : LPWSTR optional, out -> "intptr" ; pcchHelpBuf : DWORD* optional, in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiGetFeatureInfoW = msi.NewProc("MsiGetFeatureInfoW")
)
// hProduct (MSIHANDLE), szFeature (LPCWSTR), lpAttributes (DWORD* optional, out), lpTitleBuf (LPWSTR optional, out), pcchTitleBuf (DWORD* optional, in/out), lpHelpBuf (LPWSTR optional, out), pcchHelpBuf (DWORD* optional, in/out)
r1, _, err := procMsiGetFeatureInfoW.Call(
uintptr(hProduct),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szFeature))),
uintptr(lpAttributes),
uintptr(lpTitleBuf),
uintptr(pcchTitleBuf),
uintptr(lpHelpBuf),
uintptr(pcchHelpBuf),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiGetFeatureInfoW(
hProduct: DWORD; // MSIHANDLE
szFeature: PWideChar; // LPCWSTR
lpAttributes: Pointer; // DWORD* optional, out
lpTitleBuf: PWideChar; // LPWSTR optional, out
pcchTitleBuf: Pointer; // DWORD* optional, in/out
lpHelpBuf: PWideChar; // LPWSTR optional, out
pcchHelpBuf: Pointer // DWORD* optional, in/out
): DWORD; stdcall;
external 'msi.dll' name 'MsiGetFeatureInfoW';result := DllCall("msi\MsiGetFeatureInfoW"
, "UInt", hProduct ; MSIHANDLE
, "WStr", szFeature ; LPCWSTR
, "Ptr", lpAttributes ; DWORD* optional, out
, "Ptr", lpTitleBuf ; LPWSTR optional, out
, "Ptr", pcchTitleBuf ; DWORD* optional, in/out
, "Ptr", lpHelpBuf ; LPWSTR optional, out
, "Ptr", pcchHelpBuf ; DWORD* optional, in/out
, "UInt") ; return: DWORD●MsiGetFeatureInfoW(hProduct, szFeature, lpAttributes, lpTitleBuf, pcchTitleBuf, lpHelpBuf, pcchHelpBuf) = DLL("msi.dll", "dword MsiGetFeatureInfoW(dword, char*, void*, char*, void*, char*, void*)")
# 呼び出し: MsiGetFeatureInfoW(hProduct, szFeature, lpAttributes, lpTitleBuf, pcchTitleBuf, lpHelpBuf, pcchHelpBuf)
# hProduct : MSIHANDLE -> "dword"
# szFeature : LPCWSTR -> "char*"
# lpAttributes : DWORD* optional, out -> "void*"
# lpTitleBuf : LPWSTR optional, out -> "char*"
# pcchTitleBuf : DWORD* optional, in/out -> "void*"
# lpHelpBuf : LPWSTR optional, out -> "char*"
# pcchHelpBuf : DWORD* optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。