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