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

MsiEnumClientsA

関数
指定コンポーネントを使用するクライアント製品を列挙する。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

// msi.dll  (ANSI / -A)
#include <windows.h>

DWORD MsiEnumClientsA(
    LPCSTR szComponent,
    DWORD iProductIndex,
    LPSTR lpProductBuf
);

パラメーター

名前方向
szComponentLPCSTRin
iProductIndexDWORDin
lpProductBufLPSTRout

戻り値の型: DWORD

各言語での呼び出し定義

// msi.dll  (ANSI / -A)
#include <windows.h>

DWORD MsiEnumClientsA(
    LPCSTR szComponent,
    DWORD iProductIndex,
    LPSTR lpProductBuf
);
[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiEnumClientsA(
    [MarshalAs(UnmanagedType.LPStr)] string szComponent,   // LPCSTR
    uint iProductIndex,   // DWORD
    [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpProductBuf   // LPSTR out
);
<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiEnumClientsA(
    <MarshalAs(UnmanagedType.LPStr)> szComponent As String,   ' LPCSTR
    iProductIndex As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPStr)> lpProductBuf As System.Text.StringBuilder   ' LPSTR out
) As UInteger
End Function
' szComponent : LPCSTR
' iProductIndex : DWORD
' lpProductBuf : LPSTR out
Declare PtrSafe Function MsiEnumClientsA Lib "msi" ( _
    ByVal szComponent As String, _
    ByVal iProductIndex As Long, _
    ByVal lpProductBuf As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiEnumClientsA = ctypes.windll.msi.MsiEnumClientsA
MsiEnumClientsA.restype = wintypes.DWORD
MsiEnumClientsA.argtypes = [
    wintypes.LPCSTR,  # szComponent : LPCSTR
    wintypes.DWORD,  # iProductIndex : DWORD
    wintypes.LPSTR,  # lpProductBuf : LPSTR out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiEnumClientsA = Fiddle::Function.new(
  lib['MsiEnumClientsA'],
  [
    Fiddle::TYPE_VOIDP,  # szComponent : LPCSTR
    -Fiddle::TYPE_INT,  # iProductIndex : DWORD
    Fiddle::TYPE_VOIDP,  # lpProductBuf : LPSTR out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiEnumClientsA(
        szComponent: *const u8,  // LPCSTR
        iProductIndex: u32,  // DWORD
        lpProductBuf: *mut u8  // LPSTR out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiEnumClientsA([MarshalAs(UnmanagedType.LPStr)] string szComponent, uint iProductIndex, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpProductBuf);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiEnumClientsA' -Namespace Win32 -PassThru
# $api::MsiEnumClientsA(szComponent, iProductIndex, lpProductBuf)
#uselib "msi.dll"
#func global MsiEnumClientsA "MsiEnumClientsA" sptr, sptr, sptr
; MsiEnumClientsA szComponent, iProductIndex, varptr(lpProductBuf)   ; 戻り値は stat
; szComponent : LPCSTR -> "sptr"
; iProductIndex : DWORD -> "sptr"
; lpProductBuf : LPSTR out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "msi.dll"
#cfunc global MsiEnumClientsA "MsiEnumClientsA" str, int, var
; res = MsiEnumClientsA(szComponent, iProductIndex, lpProductBuf)
; szComponent : LPCSTR -> "str"
; iProductIndex : DWORD -> "int"
; lpProductBuf : LPSTR out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD MsiEnumClientsA(LPCSTR szComponent, DWORD iProductIndex, LPSTR lpProductBuf)
#uselib "msi.dll"
#cfunc global MsiEnumClientsA "MsiEnumClientsA" str, int, var
; res = MsiEnumClientsA(szComponent, iProductIndex, lpProductBuf)
; szComponent : LPCSTR -> "str"
; iProductIndex : DWORD -> "int"
; lpProductBuf : LPSTR out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiEnumClientsA = msi.NewProc("MsiEnumClientsA")
)

// szComponent (LPCSTR), iProductIndex (DWORD), lpProductBuf (LPSTR out)
r1, _, err := procMsiEnumClientsA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szComponent))),
	uintptr(iProductIndex),
	uintptr(lpProductBuf),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiEnumClientsA(
  szComponent: PAnsiChar;   // LPCSTR
  iProductIndex: DWORD;   // DWORD
  lpProductBuf: PAnsiChar   // LPSTR out
): DWORD; stdcall;
  external 'msi.dll' name 'MsiEnumClientsA';
result := DllCall("msi\MsiEnumClientsA"
    , "AStr", szComponent   ; LPCSTR
    , "UInt", iProductIndex   ; DWORD
    , "Ptr", lpProductBuf   ; LPSTR out
    , "UInt")   ; return: DWORD
●MsiEnumClientsA(szComponent, iProductIndex, lpProductBuf) = DLL("msi.dll", "dword MsiEnumClientsA(char*, dword, char*)")
# 呼び出し: MsiEnumClientsA(szComponent, iProductIndex, lpProductBuf)
# szComponent : LPCSTR -> "char*"
# iProductIndex : DWORD -> "dword"
# lpProductBuf : LPSTR out -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。