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