ホーム › System.ApplicationInstallationAndServicing › MsiProvideQualifiedComponentW
MsiProvideQualifiedComponentW
関数カテゴリと修飾子で指定したコンポーネントのパスを取得し、必要なら起動時インストールする。
シグネチャ
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiProvideQualifiedComponentW(
LPCWSTR szCategory,
LPCWSTR szQualifier,
DWORD dwInstallMode,
LPWSTR lpPathBuf, // optional
DWORD* pcchPathBuf // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| szCategory | LPCWSTR | in |
| szQualifier | LPCWSTR | in |
| dwInstallMode | DWORD | in |
| lpPathBuf | LPWSTR | outoptional |
| pcchPathBuf | DWORD* | inoutoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// msi.dll (Unicode / -W)
#include <windows.h>
DWORD MsiProvideQualifiedComponentW(
LPCWSTR szCategory,
LPCWSTR szQualifier,
DWORD dwInstallMode,
LPWSTR lpPathBuf, // optional
DWORD* pcchPathBuf // optional
);[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiProvideQualifiedComponentW(
[MarshalAs(UnmanagedType.LPWStr)] string szCategory, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string szQualifier, // LPCWSTR
uint dwInstallMode, // DWORD
[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 MsiProvideQualifiedComponentW(
<MarshalAs(UnmanagedType.LPWStr)> szCategory As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> szQualifier As String, ' LPCWSTR
dwInstallMode As UInteger, ' DWORD
<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
' lpPathBuf : LPWSTR optional, out
' pcchPathBuf : DWORD* optional, in/out
Declare PtrSafe Function MsiProvideQualifiedComponentW Lib "msi" ( _
ByVal szCategory As LongPtr, _
ByVal szQualifier As LongPtr, _
ByVal dwInstallMode 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
MsiProvideQualifiedComponentW = ctypes.windll.msi.MsiProvideQualifiedComponentW
MsiProvideQualifiedComponentW.restype = wintypes.DWORD
MsiProvideQualifiedComponentW.argtypes = [
wintypes.LPCWSTR, # szCategory : LPCWSTR
wintypes.LPCWSTR, # szQualifier : LPCWSTR
wintypes.DWORD, # dwInstallMode : DWORD
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')
MsiProvideQualifiedComponentW = Fiddle::Function.new(
lib['MsiProvideQualifiedComponentW'],
[
Fiddle::TYPE_VOIDP, # szCategory : LPCWSTR
Fiddle::TYPE_VOIDP, # szQualifier : LPCWSTR
-Fiddle::TYPE_INT, # dwInstallMode : DWORD
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 MsiProvideQualifiedComponentW(
szCategory: *const u16, // LPCWSTR
szQualifier: *const u16, // LPCWSTR
dwInstallMode: u32, // DWORD
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 MsiProvideQualifiedComponentW([MarshalAs(UnmanagedType.LPWStr)] string szCategory, [MarshalAs(UnmanagedType.LPWStr)] string szQualifier, uint dwInstallMode, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpPathBuf, IntPtr pcchPathBuf);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiProvideQualifiedComponentW' -Namespace Win32 -PassThru
# $api::MsiProvideQualifiedComponentW(szCategory, szQualifier, dwInstallMode, lpPathBuf, pcchPathBuf)#uselib "msi.dll"
#func global MsiProvideQualifiedComponentW "MsiProvideQualifiedComponentW" wptr, wptr, wptr, wptr, wptr
; MsiProvideQualifiedComponentW szCategory, szQualifier, dwInstallMode, varptr(lpPathBuf), varptr(pcchPathBuf) ; 戻り値は stat
; szCategory : LPCWSTR -> "wptr"
; szQualifier : LPCWSTR -> "wptr"
; dwInstallMode : DWORD -> "wptr"
; lpPathBuf : LPWSTR optional, out -> "wptr"
; pcchPathBuf : DWORD* optional, in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "msi.dll" #cfunc global MsiProvideQualifiedComponentW "MsiProvideQualifiedComponentW" wstr, wstr, int, var, var ; res = MsiProvideQualifiedComponentW(szCategory, szQualifier, dwInstallMode, lpPathBuf, pcchPathBuf) ; szCategory : LPCWSTR -> "wstr" ; szQualifier : LPCWSTR -> "wstr" ; dwInstallMode : DWORD -> "int" ; lpPathBuf : LPWSTR optional, out -> "var" ; pcchPathBuf : DWORD* optional, in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "msi.dll" #cfunc global MsiProvideQualifiedComponentW "MsiProvideQualifiedComponentW" wstr, wstr, int, sptr, sptr ; res = MsiProvideQualifiedComponentW(szCategory, szQualifier, dwInstallMode, varptr(lpPathBuf), varptr(pcchPathBuf)) ; szCategory : LPCWSTR -> "wstr" ; szQualifier : LPCWSTR -> "wstr" ; dwInstallMode : DWORD -> "int" ; lpPathBuf : LPWSTR optional, out -> "sptr" ; pcchPathBuf : DWORD* optional, in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD MsiProvideQualifiedComponentW(LPCWSTR szCategory, LPCWSTR szQualifier, DWORD dwInstallMode, LPWSTR lpPathBuf, DWORD* pcchPathBuf) #uselib "msi.dll" #cfunc global MsiProvideQualifiedComponentW "MsiProvideQualifiedComponentW" wstr, wstr, int, var, var ; res = MsiProvideQualifiedComponentW(szCategory, szQualifier, dwInstallMode, lpPathBuf, pcchPathBuf) ; szCategory : LPCWSTR -> "wstr" ; szQualifier : LPCWSTR -> "wstr" ; dwInstallMode : DWORD -> "int" ; lpPathBuf : LPWSTR optional, out -> "var" ; pcchPathBuf : DWORD* optional, in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD MsiProvideQualifiedComponentW(LPCWSTR szCategory, LPCWSTR szQualifier, DWORD dwInstallMode, LPWSTR lpPathBuf, DWORD* pcchPathBuf) #uselib "msi.dll" #cfunc global MsiProvideQualifiedComponentW "MsiProvideQualifiedComponentW" wstr, wstr, int, intptr, intptr ; res = MsiProvideQualifiedComponentW(szCategory, szQualifier, dwInstallMode, varptr(lpPathBuf), varptr(pcchPathBuf)) ; szCategory : LPCWSTR -> "wstr" ; szQualifier : LPCWSTR -> "wstr" ; dwInstallMode : DWORD -> "int" ; lpPathBuf : LPWSTR optional, out -> "intptr" ; pcchPathBuf : DWORD* optional, in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiProvideQualifiedComponentW = msi.NewProc("MsiProvideQualifiedComponentW")
)
// szCategory (LPCWSTR), szQualifier (LPCWSTR), dwInstallMode (DWORD), lpPathBuf (LPWSTR optional, out), pcchPathBuf (DWORD* optional, in/out)
r1, _, err := procMsiProvideQualifiedComponentW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szCategory))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szQualifier))),
uintptr(dwInstallMode),
uintptr(lpPathBuf),
uintptr(pcchPathBuf),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiProvideQualifiedComponentW(
szCategory: PWideChar; // LPCWSTR
szQualifier: PWideChar; // LPCWSTR
dwInstallMode: DWORD; // DWORD
lpPathBuf: PWideChar; // LPWSTR optional, out
pcchPathBuf: Pointer // DWORD* optional, in/out
): DWORD; stdcall;
external 'msi.dll' name 'MsiProvideQualifiedComponentW';result := DllCall("msi\MsiProvideQualifiedComponentW"
, "WStr", szCategory ; LPCWSTR
, "WStr", szQualifier ; LPCWSTR
, "UInt", dwInstallMode ; DWORD
, "Ptr", lpPathBuf ; LPWSTR optional, out
, "Ptr", pcchPathBuf ; DWORD* optional, in/out
, "UInt") ; return: DWORD●MsiProvideQualifiedComponentW(szCategory, szQualifier, dwInstallMode, lpPathBuf, pcchPathBuf) = DLL("msi.dll", "dword MsiProvideQualifiedComponentW(char*, char*, dword, char*, void*)")
# 呼び出し: MsiProvideQualifiedComponentW(szCategory, szQualifier, dwInstallMode, lpPathBuf, pcchPathBuf)
# szCategory : LPCWSTR -> "char*"
# szQualifier : LPCWSTR -> "char*"
# dwInstallMode : DWORD -> "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 版の利用を推奨。