ホーム › System.ApplicationInstallationAndServicing › MsiSourceListAddMediaDiskA
MsiSourceListAddMediaDiskA
関数ソースリストにメディアディスクのラベルとプロンプトを登録する。
シグネチャ
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiSourceListAddMediaDiskA(
LPCSTR szProductCodeOrPatchCode,
LPCSTR szUserSid, // optional
MSIINSTALLCONTEXT dwContext,
DWORD dwOptions,
DWORD dwDiskId,
LPCSTR szVolumeLabel, // optional
LPCSTR szDiskPrompt // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| szProductCodeOrPatchCode | LPCSTR | in |
| szUserSid | LPCSTR | inoptional |
| dwContext | MSIINSTALLCONTEXT | in |
| dwOptions | DWORD | in |
| dwDiskId | DWORD | in |
| szVolumeLabel | LPCSTR | inoptional |
| szDiskPrompt | LPCSTR | inoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// msi.dll (ANSI / -A)
#include <windows.h>
DWORD MsiSourceListAddMediaDiskA(
LPCSTR szProductCodeOrPatchCode,
LPCSTR szUserSid, // optional
MSIINSTALLCONTEXT dwContext,
DWORD dwOptions,
DWORD dwDiskId,
LPCSTR szVolumeLabel, // optional
LPCSTR szDiskPrompt // optional
);[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiSourceListAddMediaDiskA(
[MarshalAs(UnmanagedType.LPStr)] string szProductCodeOrPatchCode, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string szUserSid, // LPCSTR optional
int dwContext, // MSIINSTALLCONTEXT
uint dwOptions, // DWORD
uint dwDiskId, // DWORD
[MarshalAs(UnmanagedType.LPStr)] string szVolumeLabel, // LPCSTR optional
[MarshalAs(UnmanagedType.LPStr)] string szDiskPrompt // LPCSTR optional
);<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiSourceListAddMediaDiskA(
<MarshalAs(UnmanagedType.LPStr)> szProductCodeOrPatchCode As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> szUserSid As String, ' LPCSTR optional
dwContext As Integer, ' MSIINSTALLCONTEXT
dwOptions As UInteger, ' DWORD
dwDiskId As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPStr)> szVolumeLabel As String, ' LPCSTR optional
<MarshalAs(UnmanagedType.LPStr)> szDiskPrompt As String ' LPCSTR optional
) As UInteger
End Function' szProductCodeOrPatchCode : LPCSTR
' szUserSid : LPCSTR optional
' dwContext : MSIINSTALLCONTEXT
' dwOptions : DWORD
' dwDiskId : DWORD
' szVolumeLabel : LPCSTR optional
' szDiskPrompt : LPCSTR optional
Declare PtrSafe Function MsiSourceListAddMediaDiskA Lib "msi" ( _
ByVal szProductCodeOrPatchCode As String, _
ByVal szUserSid As String, _
ByVal dwContext As Long, _
ByVal dwOptions As Long, _
ByVal dwDiskId As Long, _
ByVal szVolumeLabel As String, _
ByVal szDiskPrompt As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MsiSourceListAddMediaDiskA = ctypes.windll.msi.MsiSourceListAddMediaDiskA
MsiSourceListAddMediaDiskA.restype = wintypes.DWORD
MsiSourceListAddMediaDiskA.argtypes = [
wintypes.LPCSTR, # szProductCodeOrPatchCode : LPCSTR
wintypes.LPCSTR, # szUserSid : LPCSTR optional
ctypes.c_int, # dwContext : MSIINSTALLCONTEXT
wintypes.DWORD, # dwOptions : DWORD
wintypes.DWORD, # dwDiskId : DWORD
wintypes.LPCSTR, # szVolumeLabel : LPCSTR optional
wintypes.LPCSTR, # szDiskPrompt : LPCSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiSourceListAddMediaDiskA = Fiddle::Function.new(
lib['MsiSourceListAddMediaDiskA'],
[
Fiddle::TYPE_VOIDP, # szProductCodeOrPatchCode : LPCSTR
Fiddle::TYPE_VOIDP, # szUserSid : LPCSTR optional
Fiddle::TYPE_INT, # dwContext : MSIINSTALLCONTEXT
-Fiddle::TYPE_INT, # dwOptions : DWORD
-Fiddle::TYPE_INT, # dwDiskId : DWORD
Fiddle::TYPE_VOIDP, # szVolumeLabel : LPCSTR optional
Fiddle::TYPE_VOIDP, # szDiskPrompt : LPCSTR optional
],
-Fiddle::TYPE_INT)#[link(name = "msi")]
extern "system" {
fn MsiSourceListAddMediaDiskA(
szProductCodeOrPatchCode: *const u8, // LPCSTR
szUserSid: *const u8, // LPCSTR optional
dwContext: i32, // MSIINSTALLCONTEXT
dwOptions: u32, // DWORD
dwDiskId: u32, // DWORD
szVolumeLabel: *const u8, // LPCSTR optional
szDiskPrompt: *const u8 // LPCSTR optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiSourceListAddMediaDiskA([MarshalAs(UnmanagedType.LPStr)] string szProductCodeOrPatchCode, [MarshalAs(UnmanagedType.LPStr)] string szUserSid, int dwContext, uint dwOptions, uint dwDiskId, [MarshalAs(UnmanagedType.LPStr)] string szVolumeLabel, [MarshalAs(UnmanagedType.LPStr)] string szDiskPrompt);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiSourceListAddMediaDiskA' -Namespace Win32 -PassThru
# $api::MsiSourceListAddMediaDiskA(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwDiskId, szVolumeLabel, szDiskPrompt)#uselib "msi.dll"
#func global MsiSourceListAddMediaDiskA "MsiSourceListAddMediaDiskA" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; MsiSourceListAddMediaDiskA szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwDiskId, szVolumeLabel, szDiskPrompt ; 戻り値は stat
; szProductCodeOrPatchCode : LPCSTR -> "sptr"
; szUserSid : LPCSTR optional -> "sptr"
; dwContext : MSIINSTALLCONTEXT -> "sptr"
; dwOptions : DWORD -> "sptr"
; dwDiskId : DWORD -> "sptr"
; szVolumeLabel : LPCSTR optional -> "sptr"
; szDiskPrompt : LPCSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "msi.dll"
#cfunc global MsiSourceListAddMediaDiskA "MsiSourceListAddMediaDiskA" str, str, int, int, int, str, str
; res = MsiSourceListAddMediaDiskA(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwDiskId, szVolumeLabel, szDiskPrompt)
; szProductCodeOrPatchCode : LPCSTR -> "str"
; szUserSid : LPCSTR optional -> "str"
; dwContext : MSIINSTALLCONTEXT -> "int"
; dwOptions : DWORD -> "int"
; dwDiskId : DWORD -> "int"
; szVolumeLabel : LPCSTR optional -> "str"
; szDiskPrompt : LPCSTR optional -> "str"; DWORD MsiSourceListAddMediaDiskA(LPCSTR szProductCodeOrPatchCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId, LPCSTR szVolumeLabel, LPCSTR szDiskPrompt)
#uselib "msi.dll"
#cfunc global MsiSourceListAddMediaDiskA "MsiSourceListAddMediaDiskA" str, str, int, int, int, str, str
; res = MsiSourceListAddMediaDiskA(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwDiskId, szVolumeLabel, szDiskPrompt)
; szProductCodeOrPatchCode : LPCSTR -> "str"
; szUserSid : LPCSTR optional -> "str"
; dwContext : MSIINSTALLCONTEXT -> "int"
; dwOptions : DWORD -> "int"
; dwDiskId : DWORD -> "int"
; szVolumeLabel : LPCSTR optional -> "str"
; szDiskPrompt : LPCSTR optional -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiSourceListAddMediaDiskA = msi.NewProc("MsiSourceListAddMediaDiskA")
)
// szProductCodeOrPatchCode (LPCSTR), szUserSid (LPCSTR optional), dwContext (MSIINSTALLCONTEXT), dwOptions (DWORD), dwDiskId (DWORD), szVolumeLabel (LPCSTR optional), szDiskPrompt (LPCSTR optional)
r1, _, err := procMsiSourceListAddMediaDiskA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(szProductCodeOrPatchCode))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szUserSid))),
uintptr(dwContext),
uintptr(dwOptions),
uintptr(dwDiskId),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szVolumeLabel))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szDiskPrompt))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MsiSourceListAddMediaDiskA(
szProductCodeOrPatchCode: PAnsiChar; // LPCSTR
szUserSid: PAnsiChar; // LPCSTR optional
dwContext: Integer; // MSIINSTALLCONTEXT
dwOptions: DWORD; // DWORD
dwDiskId: DWORD; // DWORD
szVolumeLabel: PAnsiChar; // LPCSTR optional
szDiskPrompt: PAnsiChar // LPCSTR optional
): DWORD; stdcall;
external 'msi.dll' name 'MsiSourceListAddMediaDiskA';result := DllCall("msi\MsiSourceListAddMediaDiskA"
, "AStr", szProductCodeOrPatchCode ; LPCSTR
, "AStr", szUserSid ; LPCSTR optional
, "Int", dwContext ; MSIINSTALLCONTEXT
, "UInt", dwOptions ; DWORD
, "UInt", dwDiskId ; DWORD
, "AStr", szVolumeLabel ; LPCSTR optional
, "AStr", szDiskPrompt ; LPCSTR optional
, "UInt") ; return: DWORD●MsiSourceListAddMediaDiskA(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwDiskId, szVolumeLabel, szDiskPrompt) = DLL("msi.dll", "dword MsiSourceListAddMediaDiskA(char*, char*, int, dword, dword, char*, char*)")
# 呼び出し: MsiSourceListAddMediaDiskA(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions, dwDiskId, szVolumeLabel, szDiskPrompt)
# szProductCodeOrPatchCode : LPCSTR -> "char*"
# szUserSid : LPCSTR optional -> "char*"
# dwContext : MSIINSTALLCONTEXT -> "int"
# dwOptions : DWORD -> "dword"
# dwDiskId : DWORD -> "dword"
# szVolumeLabel : LPCSTR optional -> "char*"
# szDiskPrompt : LPCSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。