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

MsiProvideQualifiedComponentExW

関数
製品を指定し修飾コンポーネントのパスを取得し、必要なら起動時インストールする。
DLLmsi.dll文字セットUnicode (-W)呼出規約winapi対応OSwindows8.0

シグネチャ

// msi.dll  (Unicode / -W)
#include <windows.h>

DWORD MsiProvideQualifiedComponentExW(
    LPCWSTR szCategory,
    LPCWSTR szQualifier,
    DWORD dwInstallMode,
    LPCWSTR szProduct,   // optional
    DWORD dwUnused1,   // optional
    DWORD dwUnused2,   // optional
    LPWSTR lpPathBuf,   // optional
    DWORD* pcchPathBuf   // optional
);

パラメーター

名前方向
szCategoryLPCWSTRin
szQualifierLPCWSTRin
dwInstallModeDWORDin
szProductLPCWSTRinoptional
dwUnused1DWORDoptional
dwUnused2DWORDoptional
lpPathBufLPWSTRoutoptional
pcchPathBufDWORD*inoutoptional

戻り値の型: DWORD

各言語での呼び出し定義

// msi.dll  (Unicode / -W)
#include <windows.h>

DWORD MsiProvideQualifiedComponentExW(
    LPCWSTR szCategory,
    LPCWSTR szQualifier,
    DWORD dwInstallMode,
    LPCWSTR szProduct,   // optional
    DWORD dwUnused1,   // optional
    DWORD dwUnused2,   // optional
    LPWSTR lpPathBuf,   // optional
    DWORD* pcchPathBuf   // optional
);
[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiProvideQualifiedComponentExW(
    [MarshalAs(UnmanagedType.LPWStr)] string szCategory,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string szQualifier,   // LPCWSTR
    uint dwInstallMode,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string szProduct,   // LPCWSTR optional
    uint dwUnused1,   // DWORD optional
    uint dwUnused2,   // DWORD optional
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpPathBuf,   // LPWSTR optional, out
    IntPtr pcchPathBuf   // DWORD* optional, in/out
);
<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiProvideQualifiedComponentExW(
    <MarshalAs(UnmanagedType.LPWStr)> szCategory As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> szQualifier As String,   ' LPCWSTR
    dwInstallMode As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> szProduct As String,   ' LPCWSTR optional
    dwUnused1 As UInteger,   ' DWORD optional
    dwUnused2 As UInteger,   ' DWORD optional
    <MarshalAs(UnmanagedType.LPWStr)> lpPathBuf As System.Text.StringBuilder,   ' LPWSTR optional, out
    pcchPathBuf As IntPtr   ' DWORD* optional, in/out
) As UInteger
End Function
' szCategory : LPCWSTR
' szQualifier : LPCWSTR
' dwInstallMode : DWORD
' szProduct : LPCWSTR optional
' dwUnused1 : DWORD optional
' dwUnused2 : DWORD optional
' lpPathBuf : LPWSTR optional, out
' pcchPathBuf : DWORD* optional, in/out
Declare PtrSafe Function MsiProvideQualifiedComponentExW Lib "msi" ( _
    ByVal szCategory As LongPtr, _
    ByVal szQualifier As LongPtr, _
    ByVal dwInstallMode As Long, _
    ByVal szProduct As LongPtr, _
    ByVal dwUnused1 As Long, _
    ByVal dwUnused2 As Long, _
    ByVal lpPathBuf As LongPtr, _
    ByVal pcchPathBuf 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

MsiProvideQualifiedComponentExW = ctypes.windll.msi.MsiProvideQualifiedComponentExW
MsiProvideQualifiedComponentExW.restype = wintypes.DWORD
MsiProvideQualifiedComponentExW.argtypes = [
    wintypes.LPCWSTR,  # szCategory : LPCWSTR
    wintypes.LPCWSTR,  # szQualifier : LPCWSTR
    wintypes.DWORD,  # dwInstallMode : DWORD
    wintypes.LPCWSTR,  # szProduct : LPCWSTR optional
    wintypes.DWORD,  # dwUnused1 : DWORD optional
    wintypes.DWORD,  # dwUnused2 : DWORD optional
    wintypes.LPWSTR,  # lpPathBuf : LPWSTR optional, out
    ctypes.POINTER(wintypes.DWORD),  # pcchPathBuf : DWORD* optional, in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiProvideQualifiedComponentExW = Fiddle::Function.new(
  lib['MsiProvideQualifiedComponentExW'],
  [
    Fiddle::TYPE_VOIDP,  # szCategory : LPCWSTR
    Fiddle::TYPE_VOIDP,  # szQualifier : LPCWSTR
    -Fiddle::TYPE_INT,  # dwInstallMode : DWORD
    Fiddle::TYPE_VOIDP,  # szProduct : LPCWSTR optional
    -Fiddle::TYPE_INT,  # dwUnused1 : DWORD optional
    -Fiddle::TYPE_INT,  # dwUnused2 : DWORD optional
    Fiddle::TYPE_VOIDP,  # lpPathBuf : LPWSTR optional, out
    Fiddle::TYPE_VOIDP,  # pcchPathBuf : DWORD* optional, in/out
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "msi")]
extern "system" {
    fn MsiProvideQualifiedComponentExW(
        szCategory: *const u16,  // LPCWSTR
        szQualifier: *const u16,  // LPCWSTR
        dwInstallMode: u32,  // DWORD
        szProduct: *const u16,  // LPCWSTR optional
        dwUnused1: u32,  // DWORD optional
        dwUnused2: u32,  // DWORD optional
        lpPathBuf: *mut u16,  // LPWSTR optional, out
        pcchPathBuf: *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 MsiProvideQualifiedComponentExW([MarshalAs(UnmanagedType.LPWStr)] string szCategory, [MarshalAs(UnmanagedType.LPWStr)] string szQualifier, uint dwInstallMode, [MarshalAs(UnmanagedType.LPWStr)] string szProduct, uint dwUnused1, uint dwUnused2, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpPathBuf, IntPtr pcchPathBuf);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiProvideQualifiedComponentExW' -Namespace Win32 -PassThru
# $api::MsiProvideQualifiedComponentExW(szCategory, szQualifier, dwInstallMode, szProduct, dwUnused1, dwUnused2, lpPathBuf, pcchPathBuf)
#uselib "msi.dll"
#func global MsiProvideQualifiedComponentExW "MsiProvideQualifiedComponentExW" wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr
; MsiProvideQualifiedComponentExW szCategory, szQualifier, dwInstallMode, szProduct, dwUnused1, dwUnused2, varptr(lpPathBuf), varptr(pcchPathBuf)   ; 戻り値は stat
; szCategory : LPCWSTR -> "wptr"
; szQualifier : LPCWSTR -> "wptr"
; dwInstallMode : DWORD -> "wptr"
; szProduct : LPCWSTR optional -> "wptr"
; dwUnused1 : DWORD optional -> "wptr"
; dwUnused2 : DWORD optional -> "wptr"
; lpPathBuf : LPWSTR optional, out -> "wptr"
; pcchPathBuf : DWORD* optional, in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "msi.dll"
#cfunc global MsiProvideQualifiedComponentExW "MsiProvideQualifiedComponentExW" wstr, wstr, int, wstr, int, int, var, var
; res = MsiProvideQualifiedComponentExW(szCategory, szQualifier, dwInstallMode, szProduct, dwUnused1, dwUnused2, lpPathBuf, pcchPathBuf)
; szCategory : LPCWSTR -> "wstr"
; szQualifier : LPCWSTR -> "wstr"
; dwInstallMode : DWORD -> "int"
; szProduct : LPCWSTR optional -> "wstr"
; dwUnused1 : DWORD optional -> "int"
; dwUnused2 : DWORD optional -> "int"
; lpPathBuf : LPWSTR optional, out -> "var"
; pcchPathBuf : DWORD* optional, in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD MsiProvideQualifiedComponentExW(LPCWSTR szCategory, LPCWSTR szQualifier, DWORD dwInstallMode, LPCWSTR szProduct, DWORD dwUnused1, DWORD dwUnused2, LPWSTR lpPathBuf, DWORD* pcchPathBuf)
#uselib "msi.dll"
#cfunc global MsiProvideQualifiedComponentExW "MsiProvideQualifiedComponentExW" wstr, wstr, int, wstr, int, int, var, var
; res = MsiProvideQualifiedComponentExW(szCategory, szQualifier, dwInstallMode, szProduct, dwUnused1, dwUnused2, lpPathBuf, pcchPathBuf)
; szCategory : LPCWSTR -> "wstr"
; szQualifier : LPCWSTR -> "wstr"
; dwInstallMode : DWORD -> "int"
; szProduct : LPCWSTR optional -> "wstr"
; dwUnused1 : DWORD optional -> "int"
; dwUnused2 : DWORD optional -> "int"
; lpPathBuf : LPWSTR optional, out -> "var"
; pcchPathBuf : DWORD* optional, in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiProvideQualifiedComponentExW = msi.NewProc("MsiProvideQualifiedComponentExW")
)

// szCategory (LPCWSTR), szQualifier (LPCWSTR), dwInstallMode (DWORD), szProduct (LPCWSTR optional), dwUnused1 (DWORD optional), dwUnused2 (DWORD optional), lpPathBuf (LPWSTR optional, out), pcchPathBuf (DWORD* optional, in/out)
r1, _, err := procMsiProvideQualifiedComponentExW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szCategory))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szQualifier))),
	uintptr(dwInstallMode),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szProduct))),
	uintptr(dwUnused1),
	uintptr(dwUnused2),
	uintptr(lpPathBuf),
	uintptr(pcchPathBuf),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiProvideQualifiedComponentExW(
  szCategory: PWideChar;   // LPCWSTR
  szQualifier: PWideChar;   // LPCWSTR
  dwInstallMode: DWORD;   // DWORD
  szProduct: PWideChar;   // LPCWSTR optional
  dwUnused1: DWORD;   // DWORD optional
  dwUnused2: DWORD;   // DWORD optional
  lpPathBuf: PWideChar;   // LPWSTR optional, out
  pcchPathBuf: Pointer   // DWORD* optional, in/out
): DWORD; stdcall;
  external 'msi.dll' name 'MsiProvideQualifiedComponentExW';
result := DllCall("msi\MsiProvideQualifiedComponentExW"
    , "WStr", szCategory   ; LPCWSTR
    , "WStr", szQualifier   ; LPCWSTR
    , "UInt", dwInstallMode   ; DWORD
    , "WStr", szProduct   ; LPCWSTR optional
    , "UInt", dwUnused1   ; DWORD optional
    , "UInt", dwUnused2   ; DWORD optional
    , "Ptr", lpPathBuf   ; LPWSTR optional, out
    , "Ptr", pcchPathBuf   ; DWORD* optional, in/out
    , "UInt")   ; return: DWORD
●MsiProvideQualifiedComponentExW(szCategory, szQualifier, dwInstallMode, szProduct, dwUnused1, dwUnused2, lpPathBuf, pcchPathBuf) = DLL("msi.dll", "dword MsiProvideQualifiedComponentExW(char*, char*, dword, char*, dword, dword, char*, void*)")
# 呼び出し: MsiProvideQualifiedComponentExW(szCategory, szQualifier, dwInstallMode, szProduct, dwUnused1, dwUnused2, lpPathBuf, pcchPathBuf)
# szCategory : LPCWSTR -> "char*"
# szQualifier : LPCWSTR -> "char*"
# dwInstallMode : DWORD -> "dword"
# szProduct : LPCWSTR optional -> "char*"
# dwUnused1 : DWORD optional -> "dword"
# dwUnused2 : DWORD optional -> "dword"
# lpPathBuf : LPWSTR optional, out -> "char*"
# pcchPathBuf : DWORD* optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。