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

MsiSourceListEnumMediaDisksA

関数
ソースリストに登録されたメディアディスクを列挙する。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiSourceListEnumMediaDisksA(
    LPCSTR szProductCodeOrPatchCode,
    LPCSTR szUserSid,   // optional
    MSIINSTALLCONTEXT dwContext,
    DWORD dwOptions,
    DWORD dwIndex,
    DWORD* pdwDiskId,   // optional
    LPSTR szVolumeLabel,   // optional
    DWORD* pcchVolumeLabel,   // optional
    LPSTR szDiskPrompt,   // optional
    DWORD* pcchDiskPrompt   // optional
);

パラメーター

名前方向
szProductCodeOrPatchCodeLPCSTRin
szUserSidLPCSTRinoptional
dwContextMSIINSTALLCONTEXTin
dwOptionsDWORDin
dwIndexDWORDin
pdwDiskIdDWORD*outoptional
szVolumeLabelLPSTRoutoptional
pcchVolumeLabelDWORD*inoutoptional
szDiskPromptLPSTRoutoptional
pcchDiskPromptDWORD*inoutoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD MsiSourceListEnumMediaDisksA(
    LPCSTR szProductCodeOrPatchCode,
    LPCSTR szUserSid,   // optional
    MSIINSTALLCONTEXT dwContext,
    DWORD dwOptions,
    DWORD dwIndex,
    DWORD* pdwDiskId,   // optional
    LPSTR szVolumeLabel,   // optional
    DWORD* pcchVolumeLabel,   // optional
    LPSTR szDiskPrompt,   // optional
    DWORD* pcchDiskPrompt   // optional
);
[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiSourceListEnumMediaDisksA(
    [MarshalAs(UnmanagedType.LPStr)] string szProductCodeOrPatchCode,   // LPCSTR
    [MarshalAs(UnmanagedType.LPStr)] string szUserSid,   // LPCSTR optional
    int dwContext,   // MSIINSTALLCONTEXT
    uint dwOptions,   // DWORD
    uint dwIndex,   // DWORD
    IntPtr pdwDiskId,   // DWORD* optional, out
    [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder szVolumeLabel,   // LPSTR optional, out
    IntPtr pcchVolumeLabel,   // DWORD* optional, in/out
    [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder szDiskPrompt,   // LPSTR optional, out
    IntPtr pcchDiskPrompt   // DWORD* optional, in/out
);
<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiSourceListEnumMediaDisksA(
    <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
    pdwDiskId As IntPtr,   ' DWORD* optional, out
    <MarshalAs(UnmanagedType.LPStr)> szVolumeLabel As System.Text.StringBuilder,   ' LPSTR optional, out
    pcchVolumeLabel As IntPtr,   ' DWORD* optional, in/out
    <MarshalAs(UnmanagedType.LPStr)> szDiskPrompt As System.Text.StringBuilder,   ' LPSTR optional, out
    pcchDiskPrompt As IntPtr   ' DWORD* optional, in/out
) As UInteger
End Function
' szProductCodeOrPatchCode : LPCSTR
' szUserSid : LPCSTR optional
' dwContext : MSIINSTALLCONTEXT
' dwOptions : DWORD
' dwIndex : DWORD
' pdwDiskId : DWORD* optional, out
' szVolumeLabel : LPSTR optional, out
' pcchVolumeLabel : DWORD* optional, in/out
' szDiskPrompt : LPSTR optional, out
' pcchDiskPrompt : DWORD* optional, in/out
Declare PtrSafe Function MsiSourceListEnumMediaDisksA Lib "msi" ( _
    ByVal szProductCodeOrPatchCode As String, _
    ByVal szUserSid As String, _
    ByVal dwContext As Long, _
    ByVal dwOptions As Long, _
    ByVal dwIndex As Long, _
    ByVal pdwDiskId As LongPtr, _
    ByVal szVolumeLabel As String, _
    ByVal pcchVolumeLabel As LongPtr, _
    ByVal szDiskPrompt As String, _
    ByVal pcchDiskPrompt As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiSourceListEnumMediaDisksA = ctypes.windll.msi.MsiSourceListEnumMediaDisksA
MsiSourceListEnumMediaDisksA.restype = wintypes.DWORD
MsiSourceListEnumMediaDisksA.argtypes = [
    wintypes.LPCSTR,  # szProductCodeOrPatchCode : LPCSTR
    wintypes.LPCSTR,  # szUserSid : LPCSTR optional
    ctypes.c_int,  # dwContext : MSIINSTALLCONTEXT
    wintypes.DWORD,  # dwOptions : DWORD
    wintypes.DWORD,  # dwIndex : DWORD
    ctypes.POINTER(wintypes.DWORD),  # pdwDiskId : DWORD* optional, out
    wintypes.LPSTR,  # szVolumeLabel : LPSTR optional, out
    ctypes.POINTER(wintypes.DWORD),  # pcchVolumeLabel : DWORD* optional, in/out
    wintypes.LPSTR,  # szDiskPrompt : LPSTR optional, out
    ctypes.POINTER(wintypes.DWORD),  # pcchDiskPrompt : DWORD* optional, in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiSourceListEnumMediaDisksA = Fiddle::Function.new(
  lib['MsiSourceListEnumMediaDisksA'],
  [
    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,  # pdwDiskId : DWORD* optional, out
    Fiddle::TYPE_VOIDP,  # szVolumeLabel : LPSTR optional, out
    Fiddle::TYPE_VOIDP,  # pcchVolumeLabel : DWORD* optional, in/out
    Fiddle::TYPE_VOIDP,  # szDiskPrompt : LPSTR optional, out
    Fiddle::TYPE_VOIDP,  # pcchDiskPrompt : DWORD* optional, in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiSourceListEnumMediaDisksA(
        szProductCodeOrPatchCode: *const u8,  // LPCSTR
        szUserSid: *const u8,  // LPCSTR optional
        dwContext: i32,  // MSIINSTALLCONTEXT
        dwOptions: u32,  // DWORD
        dwIndex: u32,  // DWORD
        pdwDiskId: *mut u32,  // DWORD* optional, out
        szVolumeLabel: *mut u8,  // LPSTR optional, out
        pcchVolumeLabel: *mut u32,  // DWORD* optional, in/out
        szDiskPrompt: *mut u8,  // LPSTR optional, out
        pcchDiskPrompt: *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 MsiSourceListEnumMediaDisksA([MarshalAs(UnmanagedType.LPStr)] string szProductCodeOrPatchCode, [MarshalAs(UnmanagedType.LPStr)] string szUserSid, int dwContext, uint dwOptions, uint dwIndex, IntPtr pdwDiskId, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder szVolumeLabel, IntPtr pcchVolumeLabel, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder szDiskPrompt, IntPtr pcchDiskPrompt);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiSourceListEnumMediaDisksA' -Namespace Win32 -PassThru
# $api::MsiSourceListEnumMediaDisksA(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwIndex, pdwDiskId, szVolumeLabel, pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt)
#uselib "msi.dll"
#func global MsiSourceListEnumMediaDisksA "MsiSourceListEnumMediaDisksA" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; MsiSourceListEnumMediaDisksA szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwIndex, varptr(pdwDiskId), varptr(szVolumeLabel), varptr(pcchVolumeLabel), varptr(szDiskPrompt), varptr(pcchDiskPrompt)   ; 戻り値は stat
; szProductCodeOrPatchCode : LPCSTR -> "sptr"
; szUserSid : LPCSTR optional -> "sptr"
; dwContext : MSIINSTALLCONTEXT -> "sptr"
; dwOptions : DWORD -> "sptr"
; dwIndex : DWORD -> "sptr"
; pdwDiskId : DWORD* optional, out -> "sptr"
; szVolumeLabel : LPSTR optional, out -> "sptr"
; pcchVolumeLabel : DWORD* optional, in/out -> "sptr"
; szDiskPrompt : LPSTR optional, out -> "sptr"
; pcchDiskPrompt : DWORD* optional, in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "msi.dll"
#cfunc global MsiSourceListEnumMediaDisksA "MsiSourceListEnumMediaDisksA" str, str, int, int, int, var, var, var, var, var
; res = MsiSourceListEnumMediaDisksA(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwIndex, pdwDiskId, szVolumeLabel, pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt)
; szProductCodeOrPatchCode : LPCSTR -> "str"
; szUserSid : LPCSTR optional -> "str"
; dwContext : MSIINSTALLCONTEXT -> "int"
; dwOptions : DWORD -> "int"
; dwIndex : DWORD -> "int"
; pdwDiskId : DWORD* optional, out -> "var"
; szVolumeLabel : LPSTR optional, out -> "var"
; pcchVolumeLabel : DWORD* optional, in/out -> "var"
; szDiskPrompt : LPSTR optional, out -> "var"
; pcchDiskPrompt : DWORD* optional, in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD MsiSourceListEnumMediaDisksA(LPCSTR szProductCodeOrPatchCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, DWORD* pdwDiskId, LPSTR szVolumeLabel, DWORD* pcchVolumeLabel, LPSTR szDiskPrompt, DWORD* pcchDiskPrompt)
#uselib "msi.dll"
#cfunc global MsiSourceListEnumMediaDisksA "MsiSourceListEnumMediaDisksA" str, str, int, int, int, var, var, var, var, var
; res = MsiSourceListEnumMediaDisksA(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwIndex, pdwDiskId, szVolumeLabel, pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt)
; szProductCodeOrPatchCode : LPCSTR -> "str"
; szUserSid : LPCSTR optional -> "str"
; dwContext : MSIINSTALLCONTEXT -> "int"
; dwOptions : DWORD -> "int"
; dwIndex : DWORD -> "int"
; pdwDiskId : DWORD* optional, out -> "var"
; szVolumeLabel : LPSTR optional, out -> "var"
; pcchVolumeLabel : DWORD* optional, in/out -> "var"
; szDiskPrompt : LPSTR optional, out -> "var"
; pcchDiskPrompt : DWORD* optional, in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiSourceListEnumMediaDisksA = msi.NewProc("MsiSourceListEnumMediaDisksA")
)

// szProductCodeOrPatchCode (LPCSTR), szUserSid (LPCSTR optional), dwContext (MSIINSTALLCONTEXT), dwOptions (DWORD), dwIndex (DWORD), pdwDiskId (DWORD* optional, out), szVolumeLabel (LPSTR optional, out), pcchVolumeLabel (DWORD* optional, in/out), szDiskPrompt (LPSTR optional, out), pcchDiskPrompt (DWORD* optional, in/out)
r1, _, err := procMsiSourceListEnumMediaDisksA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szProductCodeOrPatchCode))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szUserSid))),
	uintptr(dwContext),
	uintptr(dwOptions),
	uintptr(dwIndex),
	uintptr(pdwDiskId),
	uintptr(szVolumeLabel),
	uintptr(pcchVolumeLabel),
	uintptr(szDiskPrompt),
	uintptr(pcchDiskPrompt),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiSourceListEnumMediaDisksA(
  szProductCodeOrPatchCode: PAnsiChar;   // LPCSTR
  szUserSid: PAnsiChar;   // LPCSTR optional
  dwContext: Integer;   // MSIINSTALLCONTEXT
  dwOptions: DWORD;   // DWORD
  dwIndex: DWORD;   // DWORD
  pdwDiskId: Pointer;   // DWORD* optional, out
  szVolumeLabel: PAnsiChar;   // LPSTR optional, out
  pcchVolumeLabel: Pointer;   // DWORD* optional, in/out
  szDiskPrompt: PAnsiChar;   // LPSTR optional, out
  pcchDiskPrompt: Pointer   // DWORD* optional, in/out
): DWORD; stdcall;
  external 'msi.dll' name 'MsiSourceListEnumMediaDisksA';
result := DllCall("msi\MsiSourceListEnumMediaDisksA"
    , "AStr", szProductCodeOrPatchCode   ; LPCSTR
    , "AStr", szUserSid   ; LPCSTR optional
    , "Int", dwContext   ; MSIINSTALLCONTEXT
    , "UInt", dwOptions   ; DWORD
    , "UInt", dwIndex   ; DWORD
    , "Ptr", pdwDiskId   ; DWORD* optional, out
    , "Ptr", szVolumeLabel   ; LPSTR optional, out
    , "Ptr", pcchVolumeLabel   ; DWORD* optional, in/out
    , "Ptr", szDiskPrompt   ; LPSTR optional, out
    , "Ptr", pcchDiskPrompt   ; DWORD* optional, in/out
    , "UInt")   ; return: DWORD
●MsiSourceListEnumMediaDisksA(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwIndex, pdwDiskId, szVolumeLabel, pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt) = DLL("msi.dll", "dword MsiSourceListEnumMediaDisksA(char*, char*, int, dword, dword, void*, char*, void*, char*, void*)")
# 呼び出し: MsiSourceListEnumMediaDisksA(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwIndex, pdwDiskId, szVolumeLabel, pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt)
# szProductCodeOrPatchCode : LPCSTR -> "char*"
# szUserSid : LPCSTR optional -> "char*"
# dwContext : MSIINSTALLCONTEXT -> "int"
# dwOptions : DWORD -> "dword"
# dwIndex : DWORD -> "dword"
# pdwDiskId : DWORD* optional, out -> "void*"
# szVolumeLabel : LPSTR optional, out -> "char*"
# pcchVolumeLabel : DWORD* optional, in/out -> "void*"
# szDiskPrompt : LPSTR optional, out -> "char*"
# pcchDiskPrompt : DWORD* optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。