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