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